@graphql-tools/delegate 9.0.0-alpha-f0df17df.0 → 9.0.0-alpha-84325ed0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.applySchemaTransforms = void 0;
|
|
4
|
-
|
|
4
|
+
const utils_1 = require("@graphql-tools/utils");
|
|
5
|
+
// TODO: Instead of memoization, we can make sure that this isn't called multiple times
|
|
6
|
+
exports.applySchemaTransforms = (0, utils_1.memoize2)(function applySchemaTransforms(originalWrappingSchema, subschemaConfig) {
|
|
5
7
|
const schemaTransforms = subschemaConfig.transforms;
|
|
6
8
|
if (schemaTransforms == null) {
|
|
7
9
|
return originalWrappingSchema;
|
|
8
10
|
}
|
|
9
|
-
return schemaTransforms.reduce((schema, transform) => transform.transformSchema
|
|
10
|
-
}
|
|
11
|
-
exports.applySchemaTransforms = applySchemaTransforms;
|
|
11
|
+
return schemaTransforms.reduce((schema, transform) => { var _a; return ((_a = transform.transformSchema) === null || _a === void 0 ? void 0 : _a.call(transform, schema, subschemaConfig)) || schema; }, originalWrappingSchema);
|
|
12
|
+
});
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { memoize2 } from '@graphql-tools/utils';
|
|
2
|
+
// TODO: Instead of memoization, we can make sure that this isn't called multiple times
|
|
3
|
+
export const applySchemaTransforms = memoize2(function applySchemaTransforms(originalWrappingSchema, subschemaConfig) {
|
|
2
4
|
const schemaTransforms = subschemaConfig.transforms;
|
|
3
5
|
if (schemaTransforms == null) {
|
|
4
6
|
return originalWrappingSchema;
|
|
5
7
|
}
|
|
6
|
-
return schemaTransforms.reduce((schema, transform) => transform.transformSchema
|
|
7
|
-
}
|
|
8
|
+
return schemaTransforms.reduce((schema, transform) => { var _a; return ((_a = transform.transformSchema) === null || _a === void 0 ? void 0 : _a.call(transform, schema, subschemaConfig)) || schema; }, originalWrappingSchema);
|
|
9
|
+
});
|
package/package.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { GraphQLSchema } from 'graphql';
|
|
2
2
|
import { SubschemaConfig } from './types.js';
|
|
3
|
-
export declare
|
|
3
|
+
export declare const applySchemaTransforms: (originalWrappingSchema: GraphQLSchema, subschemaConfig: SubschemaConfig<any, any, any, any>) => GraphQLSchema;
|