@envelop/graphql-middleware 3.3.3-alpha-a584bed.0 → 3.3.3
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.
- package/index.js +8 -3
- package/index.mjs +8 -3
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -4,16 +4,21 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const graphqlMiddleware = require('graphql-middleware');
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const graphqlMiddlewareAppliedTransformSymbol = Symbol('graphqlMiddleware.appliedTransform');
|
|
8
8
|
const useGraphQLMiddleware = (middlewares) => {
|
|
9
9
|
return {
|
|
10
10
|
onSchemaChange({ schema, replaceSchema }) {
|
|
11
|
-
|
|
11
|
+
var _a;
|
|
12
|
+
// @ts-expect-error See https://github.com/graphql/graphql-js/pull/3511 - remove this comments once merged
|
|
13
|
+
if ((_a = schema.extensions) === null || _a === void 0 ? void 0 : _a[graphqlMiddlewareAppliedTransformSymbol]) {
|
|
12
14
|
return;
|
|
13
15
|
}
|
|
14
16
|
if (middlewares.length > 0) {
|
|
15
17
|
const wrappedSchema = graphqlMiddleware.applyMiddleware(schema, ...middlewares);
|
|
16
|
-
wrappedSchema
|
|
18
|
+
wrappedSchema.extensions = {
|
|
19
|
+
...schema.extensions,
|
|
20
|
+
[graphqlMiddlewareAppliedTransformSymbol]: true,
|
|
21
|
+
};
|
|
17
22
|
replaceSchema(wrappedSchema);
|
|
18
23
|
}
|
|
19
24
|
},
|
package/index.mjs
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { applyMiddleware } from 'graphql-middleware';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const graphqlMiddlewareAppliedTransformSymbol = Symbol('graphqlMiddleware.appliedTransform');
|
|
4
4
|
const useGraphQLMiddleware = (middlewares) => {
|
|
5
5
|
return {
|
|
6
6
|
onSchemaChange({ schema, replaceSchema }) {
|
|
7
|
-
|
|
7
|
+
var _a;
|
|
8
|
+
// @ts-expect-error See https://github.com/graphql/graphql-js/pull/3511 - remove this comments once merged
|
|
9
|
+
if ((_a = schema.extensions) === null || _a === void 0 ? void 0 : _a[graphqlMiddlewareAppliedTransformSymbol]) {
|
|
8
10
|
return;
|
|
9
11
|
}
|
|
10
12
|
if (middlewares.length > 0) {
|
|
11
13
|
const wrappedSchema = applyMiddleware(schema, ...middlewares);
|
|
12
|
-
wrappedSchema
|
|
14
|
+
wrappedSchema.extensions = {
|
|
15
|
+
...schema.extensions,
|
|
16
|
+
[graphqlMiddlewareAppliedTransformSymbol]: true,
|
|
17
|
+
};
|
|
13
18
|
replaceSchema(wrappedSchema);
|
|
14
19
|
}
|
|
15
20
|
},
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envelop/graphql-middleware",
|
|
3
|
-
"version": "3.3.3
|
|
3
|
+
"version": "3.3.3",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@envelop/core": "2.3.
|
|
6
|
+
"@envelop/core": "^2.3.2",
|
|
7
7
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0",
|
|
8
8
|
"graphql-middleware": "^6.0.0"
|
|
9
9
|
},
|