@graphql-tools/utils 10.6.2 → 10.6.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/cjs/Path.js +3 -4
- package/cjs/addTypes.js +1 -2
- package/cjs/astFromType.js +1 -2
- package/cjs/astFromValue.js +1 -2
- package/cjs/astFromValueUntyped.js +1 -2
- package/cjs/build-operation-for-field.js +1 -2
- package/cjs/collectFields.js +6 -6
- package/cjs/comments.js +10 -11
- package/cjs/createDeferred.js +1 -2
- package/cjs/debugTimer.js +2 -3
- package/cjs/descriptionFromObject.js +1 -2
- package/cjs/errors.js +2 -3
- package/cjs/extractExtensionsFromSchema.js +1 -2
- package/cjs/fakePromise.js +2 -3
- package/cjs/fields.js +4 -5
- package/cjs/filterSchema.js +1 -2
- package/cjs/fixSchemaAst.js +1 -2
- package/cjs/forEachDefaultValue.js +1 -2
- package/cjs/forEachField.js +1 -2
- package/cjs/get-arguments-with-directives.js +1 -2
- package/cjs/get-directives.js +4 -5
- package/cjs/get-fields-with-directives.js +1 -2
- package/cjs/get-implementing-types.js +1 -2
- package/cjs/getArgumentValues.js +1 -2
- package/cjs/getDirectiveExtensions.js +1 -2
- package/cjs/getObjectTypeFromTypeMap.js +1 -2
- package/cjs/getOperationASTFromRequest.js +2 -2
- package/cjs/getResolversFromSchema.js +1 -2
- package/cjs/getResponseKeyFromInfo.js +1 -2
- package/cjs/heal.js +2 -3
- package/cjs/helpers.js +8 -8
- package/cjs/implementsAbstractType.js +1 -2
- package/cjs/isAsyncIterable.js +1 -2
- package/cjs/isDocumentNode.js +1 -2
- package/cjs/jsutils.js +5 -6
- package/cjs/map-maybe-promise.js +1 -2
- package/cjs/mapAsyncIterator.js +1 -2
- package/cjs/mapSchema.js +2 -3
- package/cjs/memoize.js +7 -8
- package/cjs/mergeDeep.js +1 -2
- package/cjs/mergeIncrementalResult.js +1 -2
- package/cjs/observableToAsyncIterable.js +1 -2
- package/cjs/parse-graphql-json.js +1 -2
- package/cjs/parse-graphql-sdl.js +3 -4
- package/cjs/print-schema-with-directives.js +18 -19
- package/cjs/prune.js +1 -2
- package/cjs/renameType.js +1 -2
- package/cjs/rewire.js +1 -2
- package/cjs/rootTypes.js +2 -2
- package/cjs/selectionSets.js +1 -2
- package/cjs/stub.js +4 -5
- package/cjs/transformInputValue.js +4 -5
- package/cjs/updateArgument.js +2 -3
- package/cjs/validate-documents.js +2 -3
- package/cjs/valueMatchesCriteria.js +1 -2
- package/cjs/visitResult.js +3 -4
- package/cjs/withCancel.js +3 -4
- package/package.json +1 -1
- package/typings/Interfaces.d.cts +5 -1
- package/typings/Interfaces.d.ts +5 -1
- package/typings/getResponseKeyFromInfo.d.cts +1 -1
- package/typings/getResponseKeyFromInfo.d.ts +1 -1
package/cjs/helpers.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.asArray = void 0;
|
|
4
|
+
exports.isDocumentString = isDocumentString;
|
|
5
|
+
exports.isValidPath = isValidPath;
|
|
6
|
+
exports.compareStrings = compareStrings;
|
|
7
|
+
exports.nodeToString = nodeToString;
|
|
8
|
+
exports.compareNodes = compareNodes;
|
|
9
|
+
exports.isSome = isSome;
|
|
10
|
+
exports.assertSome = assertSome;
|
|
4
11
|
const graphql_1 = require("graphql");
|
|
5
12
|
function isURL(str) {
|
|
6
13
|
try {
|
|
@@ -39,7 +46,6 @@ function isDocumentString(str) {
|
|
|
39
46
|
}
|
|
40
47
|
return false;
|
|
41
48
|
}
|
|
42
|
-
exports.isDocumentString = isDocumentString;
|
|
43
49
|
const invalidPathRegex = /[‘“!%^<>`\n]/;
|
|
44
50
|
/**
|
|
45
51
|
* Checkes whether the `str` contains any path illegal characters.
|
|
@@ -52,7 +58,6 @@ const invalidPathRegex = /[‘“!%^<>`\n]/;
|
|
|
52
58
|
function isValidPath(str) {
|
|
53
59
|
return typeof str === 'string' && !invalidPathRegex.test(str);
|
|
54
60
|
}
|
|
55
|
-
exports.isValidPath = isValidPath;
|
|
56
61
|
function compareStrings(a, b) {
|
|
57
62
|
if (String(a) < String(b)) {
|
|
58
63
|
return -1;
|
|
@@ -62,7 +67,6 @@ function compareStrings(a, b) {
|
|
|
62
67
|
}
|
|
63
68
|
return 0;
|
|
64
69
|
}
|
|
65
|
-
exports.compareStrings = compareStrings;
|
|
66
70
|
function nodeToString(a) {
|
|
67
71
|
let name;
|
|
68
72
|
if ('alias' in a) {
|
|
@@ -76,7 +80,6 @@ function nodeToString(a) {
|
|
|
76
80
|
}
|
|
77
81
|
return name;
|
|
78
82
|
}
|
|
79
|
-
exports.nodeToString = nodeToString;
|
|
80
83
|
function compareNodes(a, b, customFn) {
|
|
81
84
|
const aStr = nodeToString(a);
|
|
82
85
|
const bStr = nodeToString(b);
|
|
@@ -85,14 +88,11 @@ function compareNodes(a, b, customFn) {
|
|
|
85
88
|
}
|
|
86
89
|
return compareStrings(aStr, bStr);
|
|
87
90
|
}
|
|
88
|
-
exports.compareNodes = compareNodes;
|
|
89
91
|
function isSome(input) {
|
|
90
92
|
return input != null;
|
|
91
93
|
}
|
|
92
|
-
exports.isSome = isSome;
|
|
93
94
|
function assertSome(input, message = 'Value should be something') {
|
|
94
95
|
if (input == null) {
|
|
95
96
|
throw new Error(message);
|
|
96
97
|
}
|
|
97
98
|
}
|
|
98
|
-
exports.assertSome = assertSome;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.implementsAbstractType =
|
|
3
|
+
exports.implementsAbstractType = implementsAbstractType;
|
|
4
4
|
const graphql_1 = require("graphql");
|
|
5
5
|
function implementsAbstractType(schema, typeA, typeB) {
|
|
6
6
|
if (typeB == null || typeA == null) {
|
|
@@ -14,4 +14,3 @@ function implementsAbstractType(schema, typeA, typeB) {
|
|
|
14
14
|
}
|
|
15
15
|
return false;
|
|
16
16
|
}
|
|
17
|
-
exports.implementsAbstractType = implementsAbstractType;
|
package/cjs/isAsyncIterable.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isAsyncIterable =
|
|
3
|
+
exports.isAsyncIterable = isAsyncIterable;
|
|
4
4
|
function isAsyncIterable(value) {
|
|
5
5
|
return value?.[Symbol.asyncIterator] != null;
|
|
6
6
|
}
|
|
7
|
-
exports.isAsyncIterable = isAsyncIterable;
|
package/cjs/isDocumentNode.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isDocumentNode =
|
|
3
|
+
exports.isDocumentNode = isDocumentNode;
|
|
4
4
|
const graphql_1 = require("graphql");
|
|
5
5
|
function isDocumentNode(object) {
|
|
6
6
|
return object && typeof object === 'object' && 'kind' in object && object.kind === graphql_1.Kind.DOCUMENT;
|
|
7
7
|
}
|
|
8
|
-
exports.isDocumentNode = isDocumentNode;
|
package/cjs/jsutils.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isIterableObject = isIterableObject;
|
|
4
|
+
exports.isObjectLike = isObjectLike;
|
|
5
|
+
exports.isPromise = isPromise;
|
|
6
|
+
exports.promiseReduce = promiseReduce;
|
|
7
|
+
exports.hasOwnProperty = hasOwnProperty;
|
|
4
8
|
const map_maybe_promise_js_1 = require("./map-maybe-promise.js");
|
|
5
9
|
function isIterableObject(value) {
|
|
6
10
|
return value != null && typeof value === 'object' && Symbol.iterator in value;
|
|
7
11
|
}
|
|
8
|
-
exports.isIterableObject = isIterableObject;
|
|
9
12
|
function isObjectLike(value) {
|
|
10
13
|
return typeof value === 'object' && value !== null;
|
|
11
14
|
}
|
|
12
|
-
exports.isObjectLike = isObjectLike;
|
|
13
15
|
function isPromise(value) {
|
|
14
16
|
return value?.then != null;
|
|
15
17
|
}
|
|
16
|
-
exports.isPromise = isPromise;
|
|
17
18
|
function promiseReduce(values, callbackFn, initialValue) {
|
|
18
19
|
let accumulator = initialValue;
|
|
19
20
|
for (const value of values) {
|
|
@@ -21,8 +22,6 @@ function promiseReduce(values, callbackFn, initialValue) {
|
|
|
21
22
|
}
|
|
22
23
|
return accumulator;
|
|
23
24
|
}
|
|
24
|
-
exports.promiseReduce = promiseReduce;
|
|
25
25
|
function hasOwnProperty(obj, prop) {
|
|
26
26
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
27
27
|
}
|
|
28
|
-
exports.hasOwnProperty = hasOwnProperty;
|
package/cjs/map-maybe-promise.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mapMaybePromise =
|
|
3
|
+
exports.mapMaybePromise = mapMaybePromise;
|
|
4
4
|
const jsutils_js_1 = require("./jsutils.js");
|
|
5
5
|
function mapMaybePromise(value, mapper, errorMapper) {
|
|
6
6
|
if ((0, jsutils_js_1.isPromise)(value)) {
|
|
@@ -24,4 +24,3 @@ function mapMaybePromise(value, mapper, errorMapper) {
|
|
|
24
24
|
}
|
|
25
25
|
return mapper(value);
|
|
26
26
|
}
|
|
27
|
-
exports.mapMaybePromise = mapMaybePromise;
|
package/cjs/mapAsyncIterator.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mapAsyncIterator =
|
|
3
|
+
exports.mapAsyncIterator = mapAsyncIterator;
|
|
4
4
|
const fakePromise_js_1 = require("./fakePromise.js");
|
|
5
5
|
const map_maybe_promise_js_1 = require("./map-maybe-promise.js");
|
|
6
6
|
/**
|
|
@@ -70,7 +70,6 @@ function mapAsyncIterator(iterator, onNext, onError, onEnd) {
|
|
|
70
70
|
},
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
-
exports.mapAsyncIterator = mapAsyncIterator;
|
|
74
73
|
function iteratorResult(value) {
|
|
75
74
|
return { value, done: false };
|
|
76
75
|
}
|
package/cjs/mapSchema.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.mapSchema = mapSchema;
|
|
4
|
+
exports.correctASTNodes = correctASTNodes;
|
|
4
5
|
const graphql_1 = require("graphql");
|
|
5
6
|
const getObjectTypeFromTypeMap_js_1 = require("./getObjectTypeFromTypeMap.js");
|
|
6
7
|
const Interfaces_js_1 = require("./Interfaces.js");
|
|
@@ -20,7 +21,6 @@ function mapSchema(schema, schemaMapper = {}) {
|
|
|
20
21
|
directives,
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
|
-
exports.mapSchema = mapSchema;
|
|
24
24
|
function mapTypes(originalTypeMap, schema, schemaMapper, testFn = () => true) {
|
|
25
25
|
const newTypeMap = {};
|
|
26
26
|
for (const typeName in originalTypeMap) {
|
|
@@ -468,4 +468,3 @@ function correctASTNodes(type) {
|
|
|
468
468
|
return type;
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
|
-
exports.correctASTNodes = correctASTNodes;
|
package/cjs/memoize.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.memoize1 = memoize1;
|
|
4
|
+
exports.memoize2 = memoize2;
|
|
5
|
+
exports.memoize3 = memoize3;
|
|
6
|
+
exports.memoize4 = memoize4;
|
|
7
|
+
exports.memoize5 = memoize5;
|
|
8
|
+
exports.memoize2of4 = memoize2of4;
|
|
9
|
+
exports.memoize2of5 = memoize2of5;
|
|
4
10
|
function memoize1(fn) {
|
|
5
11
|
const memoize1cache = new WeakMap();
|
|
6
12
|
return function memoized(a1) {
|
|
@@ -13,7 +19,6 @@ function memoize1(fn) {
|
|
|
13
19
|
return cachedValue;
|
|
14
20
|
};
|
|
15
21
|
}
|
|
16
|
-
exports.memoize1 = memoize1;
|
|
17
22
|
function memoize2(fn) {
|
|
18
23
|
const memoize2cache = new WeakMap();
|
|
19
24
|
return function memoized(a1, a2) {
|
|
@@ -34,7 +39,6 @@ function memoize2(fn) {
|
|
|
34
39
|
return cachedValue;
|
|
35
40
|
};
|
|
36
41
|
}
|
|
37
|
-
exports.memoize2 = memoize2;
|
|
38
42
|
function memoize3(fn) {
|
|
39
43
|
const memoize3Cache = new WeakMap();
|
|
40
44
|
return function memoized(a1, a2, a3) {
|
|
@@ -65,7 +69,6 @@ function memoize3(fn) {
|
|
|
65
69
|
return cachedValue;
|
|
66
70
|
};
|
|
67
71
|
}
|
|
68
|
-
exports.memoize3 = memoize3;
|
|
69
72
|
function memoize4(fn) {
|
|
70
73
|
const memoize4Cache = new WeakMap();
|
|
71
74
|
return function memoized(a1, a2, a3, a4) {
|
|
@@ -108,7 +111,6 @@ function memoize4(fn) {
|
|
|
108
111
|
return cachedValue;
|
|
109
112
|
};
|
|
110
113
|
}
|
|
111
|
-
exports.memoize4 = memoize4;
|
|
112
114
|
function memoize5(fn) {
|
|
113
115
|
const memoize5Cache = new WeakMap();
|
|
114
116
|
return function memoized(a1, a2, a3, a4, a5) {
|
|
@@ -165,7 +167,6 @@ function memoize5(fn) {
|
|
|
165
167
|
return cachedValue;
|
|
166
168
|
};
|
|
167
169
|
}
|
|
168
|
-
exports.memoize5 = memoize5;
|
|
169
170
|
function memoize2of4(fn) {
|
|
170
171
|
const memoize2of4cache = new WeakMap();
|
|
171
172
|
return function memoized(a1, a2, a3, a4) {
|
|
@@ -186,7 +187,6 @@ function memoize2of4(fn) {
|
|
|
186
187
|
return cachedValue;
|
|
187
188
|
};
|
|
188
189
|
}
|
|
189
|
-
exports.memoize2of4 = memoize2of4;
|
|
190
190
|
function memoize2of5(fn) {
|
|
191
191
|
const memoize2of4cache = new WeakMap();
|
|
192
192
|
return function memoized(a1, a2, a3, a4, a5) {
|
|
@@ -207,4 +207,3 @@ function memoize2of5(fn) {
|
|
|
207
207
|
return cachedValue;
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
|
-
exports.memoize2of5 = memoize2of5;
|
package/cjs/mergeDeep.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mergeDeep =
|
|
3
|
+
exports.mergeDeep = mergeDeep;
|
|
4
4
|
const helpers_js_1 = require("./helpers.js");
|
|
5
5
|
function mergeDeep(sources, respectPrototype = false, respectArrays = false, respectArrayLength = false) {
|
|
6
6
|
let expectedLength;
|
|
@@ -77,7 +77,6 @@ function mergeDeep(sources, respectPrototype = false, respectArrays = false, res
|
|
|
77
77
|
}
|
|
78
78
|
return output;
|
|
79
79
|
}
|
|
80
|
-
exports.mergeDeep = mergeDeep;
|
|
81
80
|
function isObject(item) {
|
|
82
81
|
return item && typeof item === 'object' && !Array.isArray(item);
|
|
83
82
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mergeIncrementalResult =
|
|
3
|
+
exports.mergeIncrementalResult = mergeIncrementalResult;
|
|
4
4
|
const merge_1 = require("dset/merge");
|
|
5
5
|
function mergeIncrementalResult({ incrementalResult, executionResult, }) {
|
|
6
6
|
const path = ['data', ...(incrementalResult.path ?? [])];
|
|
@@ -30,4 +30,3 @@ function mergeIncrementalResult({ incrementalResult, executionResult, }) {
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
exports.mergeIncrementalResult = mergeIncrementalResult;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.observableToAsyncIterable =
|
|
3
|
+
exports.observableToAsyncIterable = observableToAsyncIterable;
|
|
4
4
|
const fakePromise_js_1 = require("./fakePromise.js");
|
|
5
5
|
function observableToAsyncIterable(observable) {
|
|
6
6
|
const pullQueue = [];
|
|
@@ -83,4 +83,3 @@ function observableToAsyncIterable(observable) {
|
|
|
83
83
|
},
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
|
-
exports.observableToAsyncIterable = observableToAsyncIterable;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseGraphQLJSON =
|
|
3
|
+
exports.parseGraphQLJSON = parseGraphQLJSON;
|
|
4
4
|
const graphql_1 = require("graphql");
|
|
5
5
|
function stripBOM(content) {
|
|
6
6
|
content = content.toString();
|
|
@@ -41,4 +41,3 @@ function parseGraphQLJSON(location, jsonContent, options) {
|
|
|
41
41
|
}
|
|
42
42
|
throw new Error(`Not valid JSON content`);
|
|
43
43
|
}
|
|
44
|
-
exports.parseGraphQLJSON = parseGraphQLJSON;
|
package/cjs/parse-graphql-sdl.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.parseGraphQLSDL = parseGraphQLSDL;
|
|
4
|
+
exports.transformCommentsToDescriptions = transformCommentsToDescriptions;
|
|
5
|
+
exports.isDescribable = isDescribable;
|
|
4
6
|
const graphql_1 = require("graphql");
|
|
5
7
|
const comments_js_1 = require("./comments.js");
|
|
6
8
|
function parseGraphQLSDL(location, rawSDL, options = {}) {
|
|
@@ -35,7 +37,6 @@ function parseGraphQLSDL(location, rawSDL, options = {}) {
|
|
|
35
37
|
document,
|
|
36
38
|
};
|
|
37
39
|
}
|
|
38
|
-
exports.parseGraphQLSDL = parseGraphQLSDL;
|
|
39
40
|
function transformCommentsToDescriptions(sourceSdl, options = {}) {
|
|
40
41
|
const parsedDoc = (0, graphql_1.parse)(sourceSdl, {
|
|
41
42
|
...options,
|
|
@@ -74,11 +75,9 @@ function transformCommentsToDescriptions(sourceSdl, options = {}) {
|
|
|
74
75
|
});
|
|
75
76
|
return modifiedDoc;
|
|
76
77
|
}
|
|
77
|
-
exports.transformCommentsToDescriptions = transformCommentsToDescriptions;
|
|
78
78
|
function isDescribable(node) {
|
|
79
79
|
return ((0, graphql_1.isTypeSystemDefinitionNode)(node) ||
|
|
80
80
|
node.kind === graphql_1.Kind.FIELD_DEFINITION ||
|
|
81
81
|
node.kind === graphql_1.Kind.INPUT_VALUE_DEFINITION ||
|
|
82
82
|
node.kind === graphql_1.Kind.ENUM_VALUE_DEFINITION);
|
|
83
83
|
}
|
|
84
|
-
exports.isDescribable = isDescribable;
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getDocumentNodeFromSchema = getDocumentNodeFromSchema;
|
|
4
|
+
exports.printSchemaWithDirectives = printSchemaWithDirectives;
|
|
5
|
+
exports.astFromSchema = astFromSchema;
|
|
6
|
+
exports.astFromDirective = astFromDirective;
|
|
7
|
+
exports.getDirectiveNodes = getDirectiveNodes;
|
|
8
|
+
exports.astFromArg = astFromArg;
|
|
9
|
+
exports.astFromObjectType = astFromObjectType;
|
|
10
|
+
exports.astFromInterfaceType = astFromInterfaceType;
|
|
11
|
+
exports.astFromUnionType = astFromUnionType;
|
|
12
|
+
exports.astFromInputObjectType = astFromInputObjectType;
|
|
13
|
+
exports.astFromEnumType = astFromEnumType;
|
|
14
|
+
exports.astFromScalarType = astFromScalarType;
|
|
15
|
+
exports.astFromField = astFromField;
|
|
16
|
+
exports.astFromInputField = astFromInputField;
|
|
17
|
+
exports.astFromEnumValue = astFromEnumValue;
|
|
18
|
+
exports.makeDeprecatedDirective = makeDeprecatedDirective;
|
|
19
|
+
exports.makeDirectiveNode = makeDirectiveNode;
|
|
20
|
+
exports.makeDirectiveNodes = makeDirectiveNodes;
|
|
4
21
|
const graphql_1 = require("graphql");
|
|
5
22
|
const astFromType_js_1 = require("./astFromType.js");
|
|
6
23
|
const astFromValue_js_1 = require("./astFromValue.js");
|
|
@@ -55,14 +72,12 @@ function getDocumentNodeFromSchema(schema, options = {}) {
|
|
|
55
72
|
definitions,
|
|
56
73
|
};
|
|
57
74
|
}
|
|
58
|
-
exports.getDocumentNodeFromSchema = getDocumentNodeFromSchema;
|
|
59
75
|
// this approach uses the default schema printer rather than a custom solution, so may be more backwards compatible
|
|
60
76
|
// currently does not allow customization of printSchema options having to do with comments.
|
|
61
77
|
function printSchemaWithDirectives(schema, options = {}) {
|
|
62
78
|
const documentNode = getDocumentNodeFromSchema(schema, options);
|
|
63
79
|
return (0, graphql_1.print)(documentNode);
|
|
64
80
|
}
|
|
65
|
-
exports.printSchemaWithDirectives = printSchemaWithDirectives;
|
|
66
81
|
function astFromSchema(schema, pathToDirectivesInExtensions) {
|
|
67
82
|
const operationTypeMap = new Map([
|
|
68
83
|
['query', undefined],
|
|
@@ -119,7 +134,6 @@ function astFromSchema(schema, pathToDirectivesInExtensions) {
|
|
|
119
134
|
}
|
|
120
135
|
return schemaNode;
|
|
121
136
|
}
|
|
122
|
-
exports.astFromSchema = astFromSchema;
|
|
123
137
|
function astFromDirective(directive, schema, pathToDirectivesInExtensions) {
|
|
124
138
|
return {
|
|
125
139
|
kind: graphql_1.Kind.DIRECTIVE_DEFINITION,
|
|
@@ -136,7 +150,6 @@ function astFromDirective(directive, schema, pathToDirectivesInExtensions) {
|
|
|
136
150
|
})) || [],
|
|
137
151
|
};
|
|
138
152
|
}
|
|
139
|
-
exports.astFromDirective = astFromDirective;
|
|
140
153
|
function getDirectiveNodes(entity, schema, pathToDirectivesInExtensions) {
|
|
141
154
|
let directiveNodesBesidesDeprecatedAndSpecifiedBy = [];
|
|
142
155
|
const directivesInExtensions = (0, get_directives_js_1.getDirectivesInExtensions)(entity, pathToDirectivesInExtensions);
|
|
@@ -174,7 +187,6 @@ function getDirectiveNodes(entity, schema, pathToDirectivesInExtensions) {
|
|
|
174
187
|
}
|
|
175
188
|
return directiveNodesBesidesDeprecatedAndSpecifiedBy;
|
|
176
189
|
}
|
|
177
|
-
exports.getDirectiveNodes = getDirectiveNodes;
|
|
178
190
|
function astFromArg(arg, schema, pathToDirectivesInExtensions) {
|
|
179
191
|
return {
|
|
180
192
|
kind: graphql_1.Kind.INPUT_VALUE_DEFINITION,
|
|
@@ -191,7 +203,6 @@ function astFromArg(arg, schema, pathToDirectivesInExtensions) {
|
|
|
191
203
|
directives: getDirectiveNodes(arg, schema, pathToDirectivesInExtensions),
|
|
192
204
|
};
|
|
193
205
|
}
|
|
194
|
-
exports.astFromArg = astFromArg;
|
|
195
206
|
function astFromObjectType(type, schema, pathToDirectivesInExtensions) {
|
|
196
207
|
return {
|
|
197
208
|
kind: graphql_1.Kind.OBJECT_TYPE_DEFINITION,
|
|
@@ -205,7 +216,6 @@ function astFromObjectType(type, schema, pathToDirectivesInExtensions) {
|
|
|
205
216
|
directives: getDirectiveNodes(type, schema, pathToDirectivesInExtensions),
|
|
206
217
|
};
|
|
207
218
|
}
|
|
208
|
-
exports.astFromObjectType = astFromObjectType;
|
|
209
219
|
function astFromInterfaceType(type, schema, pathToDirectivesInExtensions) {
|
|
210
220
|
const node = {
|
|
211
221
|
kind: graphql_1.Kind.INTERFACE_TYPE_DEFINITION,
|
|
@@ -222,7 +232,6 @@ function astFromInterfaceType(type, schema, pathToDirectivesInExtensions) {
|
|
|
222
232
|
}
|
|
223
233
|
return node;
|
|
224
234
|
}
|
|
225
|
-
exports.astFromInterfaceType = astFromInterfaceType;
|
|
226
235
|
function astFromUnionType(type, schema, pathToDirectivesInExtensions) {
|
|
227
236
|
return {
|
|
228
237
|
kind: graphql_1.Kind.UNION_TYPE_DEFINITION,
|
|
@@ -236,7 +245,6 @@ function astFromUnionType(type, schema, pathToDirectivesInExtensions) {
|
|
|
236
245
|
types: type.getTypes().map(type => (0, astFromType_js_1.astFromType)(type)),
|
|
237
246
|
};
|
|
238
247
|
}
|
|
239
|
-
exports.astFromUnionType = astFromUnionType;
|
|
240
248
|
function astFromInputObjectType(type, schema, pathToDirectivesInExtensions) {
|
|
241
249
|
return {
|
|
242
250
|
kind: graphql_1.Kind.INPUT_OBJECT_TYPE_DEFINITION,
|
|
@@ -250,7 +258,6 @@ function astFromInputObjectType(type, schema, pathToDirectivesInExtensions) {
|
|
|
250
258
|
directives: getDirectiveNodes(type, schema, pathToDirectivesInExtensions),
|
|
251
259
|
};
|
|
252
260
|
}
|
|
253
|
-
exports.astFromInputObjectType = astFromInputObjectType;
|
|
254
261
|
function astFromEnumType(type, schema, pathToDirectivesInExtensions) {
|
|
255
262
|
return {
|
|
256
263
|
kind: graphql_1.Kind.ENUM_TYPE_DEFINITION,
|
|
@@ -264,7 +271,6 @@ function astFromEnumType(type, schema, pathToDirectivesInExtensions) {
|
|
|
264
271
|
directives: getDirectiveNodes(type, schema, pathToDirectivesInExtensions),
|
|
265
272
|
};
|
|
266
273
|
}
|
|
267
|
-
exports.astFromEnumType = astFromEnumType;
|
|
268
274
|
function astFromScalarType(type, schema, pathToDirectivesInExtensions) {
|
|
269
275
|
const directivesInExtensions = (0, get_directives_js_1.getDirectivesInExtensions)(type, pathToDirectivesInExtensions);
|
|
270
276
|
const directives = makeDirectiveNodes(schema, directivesInExtensions);
|
|
@@ -288,7 +294,6 @@ function astFromScalarType(type, schema, pathToDirectivesInExtensions) {
|
|
|
288
294
|
directives: directives,
|
|
289
295
|
};
|
|
290
296
|
}
|
|
291
|
-
exports.astFromScalarType = astFromScalarType;
|
|
292
297
|
function astFromField(field, schema, pathToDirectivesInExtensions) {
|
|
293
298
|
return {
|
|
294
299
|
kind: graphql_1.Kind.FIELD_DEFINITION,
|
|
@@ -303,7 +308,6 @@ function astFromField(field, schema, pathToDirectivesInExtensions) {
|
|
|
303
308
|
directives: getDirectiveNodes(field, schema, pathToDirectivesInExtensions),
|
|
304
309
|
};
|
|
305
310
|
}
|
|
306
|
-
exports.astFromField = astFromField;
|
|
307
311
|
function astFromInputField(field, schema, pathToDirectivesInExtensions) {
|
|
308
312
|
return {
|
|
309
313
|
kind: graphql_1.Kind.INPUT_VALUE_DEFINITION,
|
|
@@ -318,7 +322,6 @@ function astFromInputField(field, schema, pathToDirectivesInExtensions) {
|
|
|
318
322
|
defaultValue: (0, astFromValue_js_1.astFromValue)(field.defaultValue, field.type) ?? undefined,
|
|
319
323
|
};
|
|
320
324
|
}
|
|
321
|
-
exports.astFromInputField = astFromInputField;
|
|
322
325
|
function astFromEnumValue(value, schema, pathToDirectivesInExtensions) {
|
|
323
326
|
return {
|
|
324
327
|
kind: graphql_1.Kind.ENUM_VALUE_DEFINITION,
|
|
@@ -330,11 +333,9 @@ function astFromEnumValue(value, schema, pathToDirectivesInExtensions) {
|
|
|
330
333
|
directives: getDirectiveNodes(value, schema, pathToDirectivesInExtensions),
|
|
331
334
|
};
|
|
332
335
|
}
|
|
333
|
-
exports.astFromEnumValue = astFromEnumValue;
|
|
334
336
|
function makeDeprecatedDirective(deprecationReason) {
|
|
335
337
|
return makeDirectiveNode('deprecated', { reason: deprecationReason }, graphql_1.GraphQLDeprecatedDirective);
|
|
336
338
|
}
|
|
337
|
-
exports.makeDeprecatedDirective = makeDeprecatedDirective;
|
|
338
339
|
function makeDirectiveNode(name, args, directive) {
|
|
339
340
|
const directiveArguments = [];
|
|
340
341
|
for (const argName in args) {
|
|
@@ -369,7 +370,6 @@ function makeDirectiveNode(name, args, directive) {
|
|
|
369
370
|
arguments: directiveArguments,
|
|
370
371
|
};
|
|
371
372
|
}
|
|
372
|
-
exports.makeDirectiveNode = makeDirectiveNode;
|
|
373
373
|
function makeDirectiveNodes(schema, directiveValues) {
|
|
374
374
|
const directiveNodes = [];
|
|
375
375
|
for (const { name, args } of directiveValues) {
|
|
@@ -378,4 +378,3 @@ function makeDirectiveNodes(schema, directiveValues) {
|
|
|
378
378
|
}
|
|
379
379
|
return directiveNodes;
|
|
380
380
|
}
|
|
381
|
-
exports.makeDirectiveNodes = makeDirectiveNodes;
|
package/cjs/prune.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.pruneSchema =
|
|
3
|
+
exports.pruneSchema = pruneSchema;
|
|
4
4
|
const graphql_1 = require("graphql");
|
|
5
5
|
const get_implementing_types_js_1 = require("./get-implementing-types.js");
|
|
6
6
|
const Interfaces_js_1 = require("./Interfaces.js");
|
|
@@ -72,7 +72,6 @@ function pruneSchema(schema, options = {}) {
|
|
|
72
72
|
} while (prunedTypes.length); // Might have empty types and need to prune again
|
|
73
73
|
return prunedSchema;
|
|
74
74
|
}
|
|
75
|
-
exports.pruneSchema = pruneSchema;
|
|
76
75
|
function visitSchema(schema) {
|
|
77
76
|
const queue = []; // queue of nodes to visit
|
|
78
77
|
// Grab the root types and start there
|
package/cjs/renameType.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.renameType =
|
|
3
|
+
exports.renameType = renameType;
|
|
4
4
|
const graphql_1 = require("graphql");
|
|
5
5
|
function renameType(type, newTypeName) {
|
|
6
6
|
if ((0, graphql_1.isObjectType)(type)) {
|
|
@@ -149,4 +149,3 @@ function renameType(type, newTypeName) {
|
|
|
149
149
|
}
|
|
150
150
|
throw new Error(`Unknown type ${type}.`);
|
|
151
151
|
}
|
|
152
|
-
exports.renameType = renameType;
|
package/cjs/rewire.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.rewireTypes =
|
|
3
|
+
exports.rewireTypes = rewireTypes;
|
|
4
4
|
const graphql_1 = require("graphql");
|
|
5
5
|
const stub_js_1 = require("./stub.js");
|
|
6
6
|
function rewireTypes(originalTypeMap, directives) {
|
|
@@ -157,4 +157,3 @@ function rewireTypes(originalTypeMap, directives) {
|
|
|
157
157
|
return null;
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
exports.rewireTypes = rewireTypes;
|
package/cjs/rootTypes.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRootTypeMap = exports.getRootTypes = exports.getRootTypeNames =
|
|
3
|
+
exports.getRootTypeMap = exports.getRootTypes = exports.getRootTypeNames = void 0;
|
|
4
|
+
exports.getDefinedRootType = getDefinedRootType;
|
|
4
5
|
const errors_js_1 = require("./errors.js");
|
|
5
6
|
const memoize_js_1 = require("./memoize.js");
|
|
6
7
|
function getDefinedRootType(schema, operation, nodes) {
|
|
@@ -13,7 +14,6 @@ function getDefinedRootType(schema, operation, nodes) {
|
|
|
13
14
|
}
|
|
14
15
|
return rootType;
|
|
15
16
|
}
|
|
16
|
-
exports.getDefinedRootType = getDefinedRootType;
|
|
17
17
|
exports.getRootTypeNames = (0, memoize_js_1.memoize1)(function getRootTypeNames(schema) {
|
|
18
18
|
const rootTypes = (0, exports.getRootTypes)(schema);
|
|
19
19
|
return new Set([...rootTypes].map(type => type.name));
|
package/cjs/selectionSets.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseSelectionSet =
|
|
3
|
+
exports.parseSelectionSet = parseSelectionSet;
|
|
4
4
|
const graphql_1 = require("graphql");
|
|
5
5
|
function parseSelectionSet(selectionSet, options) {
|
|
6
6
|
const query = (0, graphql_1.parse)(selectionSet, options).definitions[0];
|
|
7
7
|
return query.selectionSet;
|
|
8
8
|
}
|
|
9
|
-
exports.parseSelectionSet = parseSelectionSet;
|
package/cjs/stub.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.createNamedStub = createNamedStub;
|
|
4
|
+
exports.createStub = createStub;
|
|
5
|
+
exports.isNamedStub = isNamedStub;
|
|
6
|
+
exports.getBuiltInForStub = getBuiltInForStub;
|
|
4
7
|
const graphql_1 = require("graphql");
|
|
5
8
|
function createNamedStub(name, type) {
|
|
6
9
|
let constructor;
|
|
@@ -22,7 +25,6 @@ function createNamedStub(name, type) {
|
|
|
22
25
|
},
|
|
23
26
|
});
|
|
24
27
|
}
|
|
25
|
-
exports.createNamedStub = createNamedStub;
|
|
26
28
|
function createStub(node, type) {
|
|
27
29
|
switch (node.kind) {
|
|
28
30
|
case graphql_1.Kind.LIST_TYPE:
|
|
@@ -36,7 +38,6 @@ function createStub(node, type) {
|
|
|
36
38
|
return createNamedStub(node.name.value, 'input');
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
|
-
exports.createStub = createStub;
|
|
40
41
|
function isNamedStub(type) {
|
|
41
42
|
if ('getFields' in type) {
|
|
42
43
|
const fields = type.getFields();
|
|
@@ -48,7 +49,6 @@ function isNamedStub(type) {
|
|
|
48
49
|
}
|
|
49
50
|
return false;
|
|
50
51
|
}
|
|
51
|
-
exports.isNamedStub = isNamedStub;
|
|
52
52
|
function getBuiltInForStub(type) {
|
|
53
53
|
switch (type.name) {
|
|
54
54
|
case graphql_1.GraphQLInt.name:
|
|
@@ -65,4 +65,3 @@ function getBuiltInForStub(type) {
|
|
|
65
65
|
return type;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
exports.getBuiltInForStub = getBuiltInForStub;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.transformInputValue = transformInputValue;
|
|
4
|
+
exports.serializeInputValue = serializeInputValue;
|
|
5
|
+
exports.parseInputValue = parseInputValue;
|
|
6
|
+
exports.parseInputValueLiteral = parseInputValueLiteral;
|
|
4
7
|
const graphql_1 = require("graphql");
|
|
5
8
|
const helpers_js_1 = require("./helpers.js");
|
|
6
9
|
function transformInputValue(type, value, inputLeafValueTransformer = null, inputObjectValueTransformer = null) {
|
|
@@ -31,7 +34,6 @@ function transformInputValue(type, value, inputLeafValueTransformer = null, inpu
|
|
|
31
34
|
}
|
|
32
35
|
// unreachable, no other possible return value
|
|
33
36
|
}
|
|
34
|
-
exports.transformInputValue = transformInputValue;
|
|
35
37
|
function serializeInputValue(type, value) {
|
|
36
38
|
return transformInputValue(type, value, (t, v) => {
|
|
37
39
|
try {
|
|
@@ -42,7 +44,6 @@ function serializeInputValue(type, value) {
|
|
|
42
44
|
}
|
|
43
45
|
});
|
|
44
46
|
}
|
|
45
|
-
exports.serializeInputValue = serializeInputValue;
|
|
46
47
|
function parseInputValue(type, value) {
|
|
47
48
|
return transformInputValue(type, value, (t, v) => {
|
|
48
49
|
try {
|
|
@@ -53,8 +54,6 @@ function parseInputValue(type, value) {
|
|
|
53
54
|
}
|
|
54
55
|
});
|
|
55
56
|
}
|
|
56
|
-
exports.parseInputValue = parseInputValue;
|
|
57
57
|
function parseInputValueLiteral(type, value) {
|
|
58
58
|
return transformInputValue(type, value, (t, v) => t.parseLiteral(v, {}));
|
|
59
59
|
}
|
|
60
|
-
exports.parseInputValueLiteral = parseInputValueLiteral;
|
package/cjs/updateArgument.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.updateArgument = updateArgument;
|
|
4
|
+
exports.createVariableNameGenerator = createVariableNameGenerator;
|
|
4
5
|
const graphql_1 = require("graphql");
|
|
5
6
|
const astFromType_js_1 = require("./astFromType.js");
|
|
6
7
|
function updateArgument(argumentNodes, variableDefinitionsMap, variableValues, argName, varName, type, value) {
|
|
@@ -40,7 +41,6 @@ function updateArgument(argumentNodes, variableDefinitionsMap, variableValues, a
|
|
|
40
41
|
delete variableValues[varName];
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
|
-
exports.updateArgument = updateArgument;
|
|
44
44
|
function createVariableNameGenerator(variableDefinitionMap) {
|
|
45
45
|
let varCounter = 0;
|
|
46
46
|
return (argName) => {
|
|
@@ -51,4 +51,3 @@ function createVariableNameGenerator(variableDefinitionMap) {
|
|
|
51
51
|
return varName;
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
exports.createVariableNameGenerator = createVariableNameGenerator;
|