@envelop/core 2.5.0 → 2.5.1-alpha-20220822173124-85a67c8e
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/cjs/utils.js +12 -9
- package/esm/utils.js +13 -10
- package/package.json +1 -1
package/cjs/utils.js
CHANGED
|
@@ -8,17 +8,20 @@ function isOperationDefinition(def) {
|
|
|
8
8
|
}
|
|
9
9
|
exports.isOperationDefinition = isOperationDefinition;
|
|
10
10
|
function isIntrospectionOperation(operation) {
|
|
11
|
+
var _a;
|
|
11
12
|
if (operation.kind === 'OperationDefinition') {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
if (((_a = operation.name) === null || _a === void 0 ? void 0 : _a.value) === '__schema') {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
const nodesWithSchema = operation.selectionSet.selections.filter(selection => {
|
|
17
|
+
if (selection.kind === 'Field' && selection.name.value === '__schema') {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
return false;
|
|
20
21
|
});
|
|
21
|
-
|
|
22
|
+
if (nodesWithSchema.length > 0) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
22
25
|
}
|
|
23
26
|
return false;
|
|
24
27
|
}
|
package/esm/utils.js
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import { Kind,
|
|
1
|
+
import { Kind, } from 'graphql';
|
|
2
2
|
export const envelopIsIntrospectionSymbol = Symbol('ENVELOP_IS_INTROSPECTION');
|
|
3
3
|
export function isOperationDefinition(def) {
|
|
4
4
|
return def.kind === Kind.OPERATION_DEFINITION;
|
|
5
5
|
}
|
|
6
6
|
export function isIntrospectionOperation(operation) {
|
|
7
|
+
var _a;
|
|
7
8
|
if (operation.kind === 'OperationDefinition') {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
if (((_a = operation.name) === null || _a === void 0 ? void 0 : _a.value) === '__schema') {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
const nodesWithSchema = operation.selectionSet.selections.filter(selection => {
|
|
13
|
+
if (selection.kind === 'Field' && selection.name.value === '__schema') {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
16
17
|
});
|
|
17
|
-
|
|
18
|
+
if (nodesWithSchema.length > 0) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
18
21
|
}
|
|
19
22
|
return false;
|
|
20
23
|
}
|