@graphql-tools/delegate
Version:
A set of utils for faster development of GraphQL tools
13 lines (12 loc) • 671 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.applySchemaTransforms = void 0;
const utils_1 = require("@graphql-tools/utils");
// TODO: Instead of memoization, we can make sure that this isn't called multiple times
exports.applySchemaTransforms = (0, utils_1.memoize2)(function applySchemaTransforms(originalWrappingSchema, subschemaConfig) {
const schemaTransforms = subschemaConfig.transforms;
if (schemaTransforms == null) {
return originalWrappingSchema;
}
return schemaTransforms.reduce((schema, transform) => transform.transformSchema?.(schema, subschemaConfig) || schema, originalWrappingSchema);
});