import { InternalError } from "../util/internalError.js";
export function getSecurityFromId(securityId, docsData) {
    const securityChunk = docsData.get(securityId);
    if (!securityChunk) {
        throw new InternalError(`Could not find security chunk: ${securityId}`);
    }
    if (securityChunk.chunkType !== "security" &&
        securityChunk.chunkType !== "globalSecurity") {
        throw new InternalError(`Security chunk is not of type security or globalSecurity: ${securityChunk.chunkType}`);
    }
    return securityChunk;
}
export function getSchemaFromId(schemaId, docsData) {
    const schemaChunk = docsData.get(schemaId);
    if (!schemaChunk) {
        throw new InternalError(`Could not find schema chunk: ${schemaId}`);
    }
    if (schemaChunk.chunkType !== "schema") {
        throw new InternalError(`Schema chunk is not of type schema: ${schemaId}`);
    }
    return schemaChunk;
}
export function getOperationFromId(operationId, docsData) {
    const operationChunk = docsData.get(operationId);
    if (!operationChunk) {
        throw new InternalError(`Could not find operation chunk: ${operationId}`);
    }
    if (operationChunk.chunkType !== "operation") {
        throw new InternalError(`Operation chunk is not of type operation: ${operationId}`);
    }
    return operationChunk;
}
//# sourceMappingURL=util.js.map