@graphql-mesh/runtime 0.98.4 → 0.98.5
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 +20 -10
- package/esm/utils.js +20 -10
- package/package.json +1 -1
package/cjs/utils.js
CHANGED
|
@@ -2,23 +2,33 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isGraphQLJitCompatible = exports.isStreamOperation = void 0;
|
|
4
4
|
const graphql_1 = require("graphql");
|
|
5
|
+
const core_1 = require("@envelop/core");
|
|
5
6
|
const utils_1 = require("@graphql-tools/utils");
|
|
6
7
|
exports.isStreamOperation = (0, utils_1.memoize1)(function isStreamOperation(astNode) {
|
|
8
|
+
if (globalThis.process?.env?.DISABLE_JIT) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
const documentStr = (0, core_1.getDocumentString)(astNode);
|
|
7
12
|
let isStream = false;
|
|
8
|
-
(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
if (!documentStr || documentStr.includes('@stream')) {
|
|
14
|
+
(0, graphql_1.visit)(astNode, {
|
|
15
|
+
Field: {
|
|
16
|
+
enter(node) {
|
|
17
|
+
if (node.directives?.some(d => d.name.value === 'stream')) {
|
|
18
|
+
isStream = true;
|
|
19
|
+
return graphql_1.BREAK;
|
|
20
|
+
}
|
|
21
|
+
return undefined;
|
|
22
|
+
},
|
|
16
23
|
},
|
|
17
|
-
}
|
|
18
|
-
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
19
26
|
return isStream;
|
|
20
27
|
});
|
|
21
28
|
exports.isGraphQLJitCompatible = (0, utils_1.memoize1)(function isGraphQLJitCompatible(schema) {
|
|
29
|
+
if (globalThis.process?.env?.DISABLE_JIT) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
22
32
|
let compatibleSchema = true;
|
|
23
33
|
(0, utils_1.mapSchema)(schema, {
|
|
24
34
|
[utils_1.MapperKind.INPUT_OBJECT_TYPE]: type => {
|
package/esm/utils.js
CHANGED
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
import { BREAK, getNamedType, visit } from 'graphql';
|
|
2
|
+
import { getDocumentString } from '@envelop/core';
|
|
2
3
|
import { MapperKind, mapSchema, memoize1 } from '@graphql-tools/utils';
|
|
3
4
|
export const isStreamOperation = memoize1(function isStreamOperation(astNode) {
|
|
5
|
+
if (globalThis.process?.env?.DISABLE_JIT) {
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
const documentStr = getDocumentString(astNode);
|
|
4
9
|
let isStream = false;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
if (!documentStr || documentStr.includes('@stream')) {
|
|
11
|
+
visit(astNode, {
|
|
12
|
+
Field: {
|
|
13
|
+
enter(node) {
|
|
14
|
+
if (node.directives?.some(d => d.name.value === 'stream')) {
|
|
15
|
+
isStream = true;
|
|
16
|
+
return BREAK;
|
|
17
|
+
}
|
|
18
|
+
return undefined;
|
|
19
|
+
},
|
|
13
20
|
},
|
|
14
|
-
}
|
|
15
|
-
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
16
23
|
return isStream;
|
|
17
24
|
});
|
|
18
25
|
export const isGraphQLJitCompatible = memoize1(function isGraphQLJitCompatible(schema) {
|
|
26
|
+
if (globalThis.process?.env?.DISABLE_JIT) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
19
29
|
let compatibleSchema = true;
|
|
20
30
|
mapSchema(schema, {
|
|
21
31
|
[MapperKind.INPUT_OBJECT_TYPE]: type => {
|