@graphql-tools/load 8.0.0 → 8.0.1-alpha-20231123133003-7b1f3276
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/documents.js +10 -2
- package/cjs/filter-document-kind.js +6 -2
- package/cjs/load-typedefs/collect-sources.js +30 -74
- package/cjs/load-typedefs/load-file.js +5 -12
- package/cjs/load-typedefs/parse.js +13 -35
- package/cjs/load-typedefs.js +8 -21
- package/cjs/schema.js +6 -3
- package/cjs/utils/pointers.js +4 -13
- package/cjs/utils/queue.js +3 -1
- package/esm/documents.js +11 -3
- package/esm/filter-document-kind.js +6 -2
- package/esm/load-typedefs/collect-sources.js +30 -74
- package/esm/load-typedefs/load-file.js +5 -12
- package/esm/load-typedefs/parse.js +14 -36
- package/esm/load-typedefs.js +9 -22
- package/esm/schema.js +8 -5
- package/esm/utils/pointers.js +5 -14
- package/esm/utils/queue.js +3 -1
- package/package.json +3 -3
- package/typings/documents.d.cts +1 -1
- package/typings/documents.d.ts +1 -1
- package/typings/load-typedefs/parse.d.cts +1 -1
- package/typings/load-typedefs/parse.d.ts +1 -1
- package/typings/load-typedefs.d.cts +1 -1
- package/typings/load-typedefs.d.ts +1 -1
- package/typings/schema.d.cts +2 -2
- package/typings/schema.d.ts +2 -2
package/cjs/documents.js
CHANGED
|
@@ -22,7 +22,11 @@ exports.NON_OPERATION_KINDS = Object.keys(graphql_1.Kind)
|
|
|
22
22
|
* @param options Additional options
|
|
23
23
|
*/
|
|
24
24
|
function loadDocuments(pointerOrPointers, options) {
|
|
25
|
-
return (0, load_typedefs_js_1.loadTypedefs)(pointerOrPointers, {
|
|
25
|
+
return (0, load_typedefs_js_1.loadTypedefs)(pointerOrPointers, {
|
|
26
|
+
noRequire: true,
|
|
27
|
+
filterKinds: exports.NON_OPERATION_KINDS,
|
|
28
|
+
...options,
|
|
29
|
+
});
|
|
26
30
|
}
|
|
27
31
|
exports.loadDocuments = loadDocuments;
|
|
28
32
|
/**
|
|
@@ -34,6 +38,10 @@ exports.loadDocuments = loadDocuments;
|
|
|
34
38
|
* @param options Additional options
|
|
35
39
|
*/
|
|
36
40
|
function loadDocumentsSync(pointerOrPointers, options) {
|
|
37
|
-
return (0, load_typedefs_js_1.loadTypedefsSync)(pointerOrPointers, {
|
|
41
|
+
return (0, load_typedefs_js_1.loadTypedefsSync)(pointerOrPointers, {
|
|
42
|
+
noRequire: true,
|
|
43
|
+
filterKinds: exports.NON_OPERATION_KINDS,
|
|
44
|
+
...options,
|
|
45
|
+
});
|
|
38
46
|
}
|
|
39
47
|
exports.loadDocumentsSync = loadDocumentsSync;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.filterKind = void 0;
|
|
4
|
-
const graphql_1 = require("graphql");
|
|
5
4
|
const process_1 = require("process");
|
|
5
|
+
const graphql_1 = require("graphql");
|
|
6
6
|
/**
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
9
9
|
const filterKind = (content, filterKinds) => {
|
|
10
|
-
if (content &&
|
|
10
|
+
if (content &&
|
|
11
|
+
content.definitions &&
|
|
12
|
+
content.definitions.length &&
|
|
13
|
+
filterKinds &&
|
|
14
|
+
filterKinds.length > 0) {
|
|
11
15
|
const invalidDefinitions = [];
|
|
12
16
|
const validDefinitions = [];
|
|
13
17
|
for (const definitionNode of content.definitions) {
|
|
@@ -24,19 +24,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.collectSourcesSync = exports.collectSources = void 0;
|
|
27
|
-
const
|
|
27
|
+
const module_1 = require("module");
|
|
28
|
+
const process_1 = require("process");
|
|
28
29
|
const graphql_1 = require("graphql");
|
|
29
|
-
const
|
|
30
|
-
const helpers_js_1 = require("../utils/helpers.js");
|
|
30
|
+
const utils_1 = require("@graphql-tools/utils");
|
|
31
31
|
const custom_loader_js_1 = require("../utils/custom-loader.js");
|
|
32
|
+
const helpers_js_1 = require("../utils/helpers.js");
|
|
32
33
|
const queue_js_1 = require("../utils/queue.js");
|
|
33
|
-
const
|
|
34
|
-
const process_1 = require("process");
|
|
34
|
+
const load_file_js_1 = require("./load-file.js");
|
|
35
35
|
const CONCURRENCY_LIMIT = 50;
|
|
36
36
|
async function collectSources({ pointerOptionMap, options, }) {
|
|
37
|
-
|
|
38
|
-
console.time('@graphql-tools/load: collectSources');
|
|
39
|
-
}
|
|
37
|
+
(0, utils_1.debugTimerStart)('@graphql-tools/load: collectSources');
|
|
40
38
|
const sources = [];
|
|
41
39
|
const queue = (0, queue_js_1.useQueue)({ concurrency: CONCURRENCY_LIMIT });
|
|
42
40
|
const { addSource, collect } = createHelpers({
|
|
@@ -45,9 +43,7 @@ async function collectSources({ pointerOptionMap, options, }) {
|
|
|
45
43
|
});
|
|
46
44
|
for (const pointer in pointerOptionMap) {
|
|
47
45
|
const pointerOptions = pointerOptionMap[pointer];
|
|
48
|
-
|
|
49
|
-
console.time(`@graphql-tools/load: collectSources ${pointer}`);
|
|
50
|
-
}
|
|
46
|
+
(0, utils_1.debugTimerStart)(`@graphql-tools/load: collectSources ${pointer}`);
|
|
51
47
|
collect({
|
|
52
48
|
pointer,
|
|
53
49
|
pointerOptions,
|
|
@@ -56,17 +52,11 @@ async function collectSources({ pointerOptionMap, options, }) {
|
|
|
56
52
|
addSource,
|
|
57
53
|
queue: queue.add,
|
|
58
54
|
});
|
|
59
|
-
|
|
60
|
-
console.timeEnd(`@graphql-tools/load: collectSources ${pointer}`);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (process_1.env['DEBUG'] != null) {
|
|
64
|
-
console.time('@graphql-tools/load: collectSources queue');
|
|
55
|
+
(0, utils_1.debugTimerEnd)(`@graphql-tools/load: collectSources ${pointer}`);
|
|
65
56
|
}
|
|
57
|
+
(0, utils_1.debugTimerStart)('@graphql-tools/load: collectSources queue');
|
|
66
58
|
await queue.runAll();
|
|
67
|
-
|
|
68
|
-
console.timeEnd('@graphql-tools/load: collectSources queue');
|
|
69
|
-
}
|
|
59
|
+
(0, utils_1.debugTimerEnd)('@graphql-tools/load: collectSources queue');
|
|
70
60
|
return sources;
|
|
71
61
|
}
|
|
72
62
|
exports.collectSources = collectSources;
|
|
@@ -77,14 +67,10 @@ function collectSourcesSync({ pointerOptionMap, options, }) {
|
|
|
77
67
|
sources,
|
|
78
68
|
stack: [collectDocumentString, collectCustomLoaderSync, collectFallbackSync],
|
|
79
69
|
});
|
|
80
|
-
|
|
81
|
-
console.time('@graphql-tools/load: collectSourcesSync');
|
|
82
|
-
}
|
|
70
|
+
(0, utils_1.debugTimerStart)('@graphql-tools/load: collectSourcesSync');
|
|
83
71
|
for (const pointer in pointerOptionMap) {
|
|
84
72
|
const pointerOptions = pointerOptionMap[pointer];
|
|
85
|
-
|
|
86
|
-
console.time(`@graphql-tools/load: collectSourcesSync ${pointer}`);
|
|
87
|
-
}
|
|
73
|
+
(0, utils_1.debugTimerStart)(`@graphql-tools/load: collectSourcesSync ${pointer}`);
|
|
88
74
|
collect({
|
|
89
75
|
pointer,
|
|
90
76
|
pointerOptions,
|
|
@@ -93,21 +79,15 @@ function collectSourcesSync({ pointerOptionMap, options, }) {
|
|
|
93
79
|
addSource,
|
|
94
80
|
queue: queue.add,
|
|
95
81
|
});
|
|
96
|
-
|
|
97
|
-
console.timeEnd(`@graphql-tools/load: collectSourcesSync ${pointer}`);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
if (process_1.env['DEBUG'] != null) {
|
|
101
|
-
console.time('@graphql-tools/load: collectSourcesSync queue');
|
|
82
|
+
(0, utils_1.debugTimerEnd)(`@graphql-tools/load: collectSourcesSync ${pointer}`);
|
|
102
83
|
}
|
|
84
|
+
(0, utils_1.debugTimerStart)('@graphql-tools/load: collectSourcesSync queue');
|
|
103
85
|
queue.runAll();
|
|
104
|
-
|
|
105
|
-
console.timeEnd('@graphql-tools/load: collectSourcesSync queue');
|
|
106
|
-
}
|
|
86
|
+
(0, utils_1.debugTimerEnd)('@graphql-tools/load: collectSourcesSync queue');
|
|
107
87
|
return sources;
|
|
108
88
|
}
|
|
109
89
|
exports.collectSourcesSync = collectSourcesSync;
|
|
110
|
-
function createHelpers({ sources, stack }) {
|
|
90
|
+
function createHelpers({ sources, stack, }) {
|
|
111
91
|
const addSource = ({ source }) => {
|
|
112
92
|
sources.push(source);
|
|
113
93
|
};
|
|
@@ -118,9 +98,7 @@ function createHelpers({ sources, stack }) {
|
|
|
118
98
|
};
|
|
119
99
|
}
|
|
120
100
|
function addResultOfCustomLoader({ pointer, result, addSource, }) {
|
|
121
|
-
|
|
122
|
-
console.time(`@graphql-tools/load: addResultOfCustomLoader ${pointer}`);
|
|
123
|
-
}
|
|
101
|
+
(0, utils_1.debugTimerStart)(`@graphql-tools/load: addResultOfCustomLoader ${pointer}`);
|
|
124
102
|
if ((0, graphql_1.isSchema)(result)) {
|
|
125
103
|
addSource({
|
|
126
104
|
source: {
|
|
@@ -150,14 +128,10 @@ function addResultOfCustomLoader({ pointer, result, addSource, }) {
|
|
|
150
128
|
pointer,
|
|
151
129
|
});
|
|
152
130
|
}
|
|
153
|
-
|
|
154
|
-
console.timeEnd(`@graphql-tools/load: addResultOfCustomLoader ${pointer}`);
|
|
155
|
-
}
|
|
131
|
+
(0, utils_1.debugTimerEnd)(`@graphql-tools/load: addResultOfCustomLoader ${pointer}`);
|
|
156
132
|
}
|
|
157
133
|
function collectDocumentString({ pointer, pointerOptions, options, addSource, queue }, next) {
|
|
158
|
-
|
|
159
|
-
console.time(`@graphql-tools/load: collectDocumentString ${pointer}`);
|
|
160
|
-
}
|
|
134
|
+
(0, utils_1.debugTimerStart)(`@graphql-tools/load: collectDocumentString ${pointer}`);
|
|
161
135
|
if ((0, utils_1.isDocumentString)(pointer)) {
|
|
162
136
|
return queue(() => {
|
|
163
137
|
const source = (0, utils_1.parseGraphQLSDL)(`${(0, helpers_js_1.stringToHash)(pointer)}.graphql`, pointer, {
|
|
@@ -170,25 +144,19 @@ function collectDocumentString({ pointer, pointerOptions, options, addSource, qu
|
|
|
170
144
|
});
|
|
171
145
|
});
|
|
172
146
|
}
|
|
173
|
-
|
|
174
|
-
console.timeEnd(`@graphql-tools/load: collectDocumentString ${pointer}`);
|
|
175
|
-
}
|
|
147
|
+
(0, utils_1.debugTimerEnd)(`@graphql-tools/load: collectDocumentString ${pointer}`);
|
|
176
148
|
next();
|
|
177
149
|
}
|
|
178
150
|
function collectCustomLoader({ pointer, pointerOptions, queue, addSource, options, pointerOptionMap }, next) {
|
|
179
151
|
if (pointerOptions.loader) {
|
|
180
152
|
return queue(async () => {
|
|
181
|
-
|
|
182
|
-
console.time(`@graphql-tools/load: collectCustomLoader ${pointer}`);
|
|
183
|
-
}
|
|
153
|
+
(0, utils_1.debugTimerStart)(`@graphql-tools/load: collectCustomLoader ${pointer}`);
|
|
184
154
|
await Promise.all((0, utils_1.asArray)(pointerOptions.require).map(m => Promise.resolve(`${m}`).then(s => __importStar(require(s)))));
|
|
185
155
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
186
156
|
// @ts-ignore TODO options.cwd is possibly undefined, but it seems like no test covers this path
|
|
187
157
|
const loader = await (0, custom_loader_js_1.useCustomLoader)(pointerOptions.loader, options.cwd);
|
|
188
158
|
const result = await loader(pointer, { ...options, ...pointerOptions }, pointerOptionMap);
|
|
189
|
-
|
|
190
|
-
console.timeEnd(`@graphql-tools/load: collectCustomLoader ${pointer}`);
|
|
191
|
-
}
|
|
159
|
+
(0, utils_1.debugTimerEnd)(`@graphql-tools/load: collectCustomLoader ${pointer}`);
|
|
192
160
|
if (!result) {
|
|
193
161
|
return;
|
|
194
162
|
}
|
|
@@ -200,9 +168,7 @@ function collectCustomLoader({ pointer, pointerOptions, queue, addSource, option
|
|
|
200
168
|
function collectCustomLoaderSync({ pointer, pointerOptions, queue, addSource, options, pointerOptionMap }, next) {
|
|
201
169
|
if (pointerOptions.loader) {
|
|
202
170
|
return queue(() => {
|
|
203
|
-
|
|
204
|
-
console.time(`@graphql-tools/load: collectCustomLoaderSync ${pointer}`);
|
|
205
|
-
}
|
|
171
|
+
(0, utils_1.debugTimerStart)(`@graphql-tools/load: collectCustomLoaderSync ${pointer}`);
|
|
206
172
|
const cwdRequire = (0, module_1.createRequire)(options.cwd || (0, process_1.cwd)());
|
|
207
173
|
for (const m of (0, utils_1.asArray)(pointerOptions.require)) {
|
|
208
174
|
cwdRequire(m);
|
|
@@ -211,9 +177,7 @@ function collectCustomLoaderSync({ pointer, pointerOptions, queue, addSource, op
|
|
|
211
177
|
// @ts-ignore TODO options.cwd is possibly undefined, but it seems like no test covers this path
|
|
212
178
|
const loader = (0, custom_loader_js_1.useCustomLoaderSync)(pointerOptions.loader, options.cwd);
|
|
213
179
|
const result = loader(pointer, { ...options, ...pointerOptions }, pointerOptionMap);
|
|
214
|
-
|
|
215
|
-
console.timeEnd(`@graphql-tools/load: collectCustomLoaderSync ${pointer}`);
|
|
216
|
-
}
|
|
180
|
+
(0, utils_1.debugTimerEnd)(`@graphql-tools/load: collectCustomLoaderSync ${pointer}`);
|
|
217
181
|
if (result) {
|
|
218
182
|
addResultOfCustomLoader({ pointer, result, addSource });
|
|
219
183
|
}
|
|
@@ -221,11 +185,9 @@ function collectCustomLoaderSync({ pointer, pointerOptions, queue, addSource, op
|
|
|
221
185
|
}
|
|
222
186
|
next();
|
|
223
187
|
}
|
|
224
|
-
function collectFallback({ queue, pointer, options, pointerOptions, addSource }) {
|
|
188
|
+
function collectFallback({ queue, pointer, options, pointerOptions, addSource, }) {
|
|
225
189
|
return queue(async () => {
|
|
226
|
-
|
|
227
|
-
console.time(`@graphql-tools/load: collectFallback ${pointer}`);
|
|
228
|
-
}
|
|
190
|
+
(0, utils_1.debugTimerStart)(`@graphql-tools/load: collectFallback ${pointer}`);
|
|
229
191
|
const sources = await (0, load_file_js_1.loadFile)(pointer, {
|
|
230
192
|
...options,
|
|
231
193
|
...pointerOptions,
|
|
@@ -235,16 +197,12 @@ function collectFallback({ queue, pointer, options, pointerOptions, addSource })
|
|
|
235
197
|
addSource({ source, pointer });
|
|
236
198
|
}
|
|
237
199
|
}
|
|
238
|
-
|
|
239
|
-
console.timeEnd(`@graphql-tools/load: collectFallback ${pointer}`);
|
|
240
|
-
}
|
|
200
|
+
(0, utils_1.debugTimerEnd)(`@graphql-tools/load: collectFallback ${pointer}`);
|
|
241
201
|
});
|
|
242
202
|
}
|
|
243
|
-
function collectFallbackSync({ queue, pointer, options, pointerOptions, addSource }) {
|
|
203
|
+
function collectFallbackSync({ queue, pointer, options, pointerOptions, addSource, }) {
|
|
244
204
|
return queue(() => {
|
|
245
|
-
|
|
246
|
-
console.time(`@graphql-tools/load: collectFallbackSync ${pointer}`);
|
|
247
|
-
}
|
|
205
|
+
(0, utils_1.debugTimerStart)(`@graphql-tools/load: collectFallbackSync ${pointer}`);
|
|
248
206
|
const sources = (0, load_file_js_1.loadFileSync)(pointer, {
|
|
249
207
|
...options,
|
|
250
208
|
...pointerOptions,
|
|
@@ -254,8 +212,6 @@ function collectFallbackSync({ queue, pointer, options, pointerOptions, addSourc
|
|
|
254
212
|
addSource({ source, pointer });
|
|
255
213
|
}
|
|
256
214
|
}
|
|
257
|
-
|
|
258
|
-
console.timeEnd(`@graphql-tools/load: collectFallbackSync ${pointer}`);
|
|
259
|
-
}
|
|
215
|
+
(0, utils_1.debugTimerEnd)(`@graphql-tools/load: collectFallbackSync ${pointer}`);
|
|
260
216
|
});
|
|
261
217
|
}
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadFileSync = exports.loadFile = void 0;
|
|
4
4
|
const process_1 = require("process");
|
|
5
|
+
const utils_1 = require("@graphql-tools/utils");
|
|
5
6
|
async function loadFile(pointer, options) {
|
|
6
|
-
|
|
7
|
-
console.time(`@graphql-tools/load: loadFile ${pointer}`);
|
|
8
|
-
}
|
|
7
|
+
(0, utils_1.debugTimerStart)(`@graphql-tools/load: loadFile ${pointer}`);
|
|
9
8
|
let results = options.cache?.[pointer];
|
|
10
9
|
if (!results) {
|
|
11
10
|
results = [];
|
|
@@ -41,16 +40,12 @@ async function loadFile(pointer, options) {
|
|
|
41
40
|
options.cache[pointer] = results;
|
|
42
41
|
}
|
|
43
42
|
}
|
|
44
|
-
|
|
45
|
-
console.timeEnd(`@graphql-tools/load: loadFile ${pointer}`);
|
|
46
|
-
}
|
|
43
|
+
(0, utils_1.debugTimerEnd)(`@graphql-tools/load: loadFile ${pointer}`);
|
|
47
44
|
return results;
|
|
48
45
|
}
|
|
49
46
|
exports.loadFile = loadFile;
|
|
50
47
|
function loadFileSync(pointer, options) {
|
|
51
|
-
|
|
52
|
-
console.time(`@graphql-tools/load: loadFileSync ${pointer}`);
|
|
53
|
-
}
|
|
48
|
+
(0, utils_1.debugTimerStart)(`@graphql-tools/load: loadFileSync ${pointer}`);
|
|
54
49
|
let results = options.cache?.[pointer];
|
|
55
50
|
if (!results) {
|
|
56
51
|
results = [];
|
|
@@ -87,9 +82,7 @@ function loadFileSync(pointer, options) {
|
|
|
87
82
|
options.cache[pointer] = results;
|
|
88
83
|
}
|
|
89
84
|
}
|
|
90
|
-
|
|
91
|
-
console.timeEnd(`@graphql-tools/load: loadFileSync ${pointer}`);
|
|
92
|
-
}
|
|
85
|
+
(0, utils_1.debugTimerEnd)(`@graphql-tools/load: loadFileSync ${pointer}`);
|
|
93
86
|
return results;
|
|
94
87
|
}
|
|
95
88
|
exports.loadFileSync = loadFileSync;
|
|
@@ -2,13 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseSource = void 0;
|
|
4
4
|
const utils_1 = require("@graphql-tools/utils");
|
|
5
|
-
const process_1 = require("process");
|
|
6
5
|
const filter_document_kind_js_1 = require("../filter-document-kind.js");
|
|
7
|
-
function parseSource({ partialSource, options, pointerOptionMap, addValidSource }) {
|
|
8
|
-
if (process_1.env['DEBUG'] != null) {
|
|
9
|
-
console.time(`@graphql-tools/load: parseSource ${partialSource.location}`);
|
|
10
|
-
}
|
|
6
|
+
function parseSource({ partialSource, options, pointerOptionMap, addValidSource, }) {
|
|
11
7
|
if (partialSource) {
|
|
8
|
+
(0, utils_1.debugTimerStart)(`@graphql-tools/load: parseSource ${partialSource.location}`);
|
|
12
9
|
const input = prepareInput({
|
|
13
10
|
source: partialSource,
|
|
14
11
|
options,
|
|
@@ -21,9 +18,7 @@ function parseSource({ partialSource, options, pointerOptionMap, addValidSource
|
|
|
21
18
|
useComments(input);
|
|
22
19
|
collectValidSources(input, addValidSource);
|
|
23
20
|
}
|
|
24
|
-
|
|
25
|
-
if (process_1.env['DEBUG'] != null) {
|
|
26
|
-
console.timeEnd(`@graphql-tools/load: parseSource ${partialSource.location}`);
|
|
21
|
+
(0, utils_1.debugTimerEnd)(`@graphql-tools/load: parseSource ${partialSource.location}`);
|
|
27
22
|
}
|
|
28
23
|
}
|
|
29
24
|
exports.parseSource = parseSource;
|
|
@@ -41,55 +36,38 @@ function prepareInput({ source, options, pointerOptionMap, }) {
|
|
|
41
36
|
return { source: { ...source }, options: specificOptions };
|
|
42
37
|
}
|
|
43
38
|
function parseSchema(input) {
|
|
44
|
-
if (process_1.env['DEBUG'] != null) {
|
|
45
|
-
console.time(`@graphql-tools/load: parseSchema ${input.source.location}`);
|
|
46
|
-
}
|
|
47
39
|
if (input.source.schema) {
|
|
40
|
+
(0, utils_1.debugTimerStart)(`@graphql-tools/load: parseSchema ${input.source.location}`);
|
|
48
41
|
input.source.rawSDL = (0, utils_1.printSchemaWithDirectives)(input.source.schema, input.options);
|
|
49
|
-
|
|
50
|
-
if (process_1.env['DEBUG'] != null) {
|
|
51
|
-
console.timeEnd(`@graphql-tools/load: parseSchema ${input.source.location}`);
|
|
42
|
+
(0, utils_1.debugTimerEnd)(`@graphql-tools/load: parseSchema ${input.source.location}`);
|
|
52
43
|
}
|
|
53
44
|
}
|
|
54
45
|
function parseRawSDL(input) {
|
|
55
|
-
if (process_1.env['DEBUG'] != null) {
|
|
56
|
-
console.time(`@graphql-tools/load: parseRawSDL ${input.source.location}`);
|
|
57
|
-
}
|
|
58
46
|
if (input.source.rawSDL) {
|
|
47
|
+
(0, utils_1.debugTimerStart)(`@graphql-tools/load: parseRawSDL ${input.source.location}`);
|
|
59
48
|
input.source.document = (0, utils_1.parseGraphQLSDL)(input.source.location, input.source.rawSDL, input.options).document;
|
|
60
|
-
|
|
61
|
-
if (process_1.env['DEBUG'] != null) {
|
|
62
|
-
console.timeEnd(`@graphql-tools/load: parseRawSDL ${input.source.location}`);
|
|
49
|
+
(0, utils_1.debugTimerEnd)(`@graphql-tools/load: parseRawSDL ${input.source.location}`);
|
|
63
50
|
}
|
|
64
51
|
}
|
|
65
52
|
function useKindsFilter(input) {
|
|
66
|
-
if (process_1.env['DEBUG'] != null) {
|
|
67
|
-
console.time(`@graphql-tools/load: useKindsFilter ${input.source.location}`);
|
|
68
|
-
}
|
|
69
53
|
if (input.options.filterKinds) {
|
|
54
|
+
(0, utils_1.debugTimerStart)(`@graphql-tools/load: useKindsFilter ${input.source.location}`);
|
|
70
55
|
input.source.document = (0, filter_document_kind_js_1.filterKind)(input.source.document, input.options.filterKinds);
|
|
56
|
+
(0, utils_1.debugTimerEnd)(`@graphql-tools/load: useKindsFilter ${input.source.location}`);
|
|
71
57
|
}
|
|
72
58
|
}
|
|
73
59
|
function useComments(input) {
|
|
74
|
-
if (process_1.env['DEBUG'] != null) {
|
|
75
|
-
console.time(`@graphql-tools/load: useComments ${input.source.location}`);
|
|
76
|
-
}
|
|
77
60
|
if (!input.source.rawSDL && input.source.document) {
|
|
61
|
+
(0, utils_1.debugTimerStart)(`@graphql-tools/load: useComments ${input.source.location}`);
|
|
78
62
|
input.source.rawSDL = (0, utils_1.printWithComments)(input.source.document);
|
|
79
63
|
(0, utils_1.resetComments)();
|
|
80
|
-
|
|
81
|
-
if (process_1.env['DEBUG'] != null) {
|
|
82
|
-
console.timeEnd(`@graphql-tools/load: useComments ${input.source.location}`);
|
|
64
|
+
(0, utils_1.debugTimerEnd)(`@graphql-tools/load: useComments ${input.source.location}`);
|
|
83
65
|
}
|
|
84
66
|
}
|
|
85
67
|
function collectValidSources(input, addValidSource) {
|
|
86
|
-
if (process_1.env['DEBUG'] != null) {
|
|
87
|
-
console.time(`@graphql-tools/load: collectValidSources ${input.source.location}`);
|
|
88
|
-
}
|
|
89
68
|
if (input.source.document?.definitions && input.source.document.definitions.length > 0) {
|
|
69
|
+
(0, utils_1.debugTimerStart)(`@graphql-tools/load: collectValidSources ${input.source.location}`);
|
|
90
70
|
addValidSource(input.source);
|
|
91
|
-
|
|
92
|
-
if (process_1.env['DEBUG'] != null) {
|
|
93
|
-
console.timeEnd(`@graphql-tools/load: collectValidSources ${input.source.location}`);
|
|
71
|
+
(0, utils_1.debugTimerEnd)(`@graphql-tools/load: collectValidSources ${input.source.location}`);
|
|
94
72
|
}
|
|
95
73
|
}
|
package/cjs/load-typedefs.js
CHANGED
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadTypedefsSync = exports.loadTypedefs = void 0;
|
|
4
4
|
const utils_1 = require("@graphql-tools/utils");
|
|
5
|
-
const pointers_js_1 = require("./utils/pointers.js");
|
|
6
|
-
const options_js_1 = require("./load-typedefs/options.js");
|
|
7
5
|
const collect_sources_js_1 = require("./load-typedefs/collect-sources.js");
|
|
6
|
+
const options_js_1 = require("./load-typedefs/options.js");
|
|
8
7
|
const parse_js_1 = require("./load-typedefs/parse.js");
|
|
9
8
|
const helpers_js_1 = require("./utils/helpers.js");
|
|
10
|
-
const
|
|
9
|
+
const pointers_js_1 = require("./utils/pointers.js");
|
|
11
10
|
const CONCURRENCY_LIMIT = 100;
|
|
12
11
|
/**
|
|
13
12
|
* Asynchronously loads any GraphQL documents (i.e. executable documents like
|
|
@@ -18,9 +17,7 @@ const CONCURRENCY_LIMIT = 100;
|
|
|
18
17
|
* @param options Additional options
|
|
19
18
|
*/
|
|
20
19
|
async function loadTypedefs(pointerOrPointers, options) {
|
|
21
|
-
|
|
22
|
-
console.time('@graphql-tools/load: loadTypedefs');
|
|
23
|
-
}
|
|
20
|
+
(0, utils_1.debugTimerStart)('@graphql-tools/load: loadTypedefs');
|
|
24
21
|
const { ignore, pointerOptionMap } = (0, pointers_js_1.normalizePointers)(pointerOrPointers);
|
|
25
22
|
options.ignore = (0, utils_1.asArray)(options.ignore || []);
|
|
26
23
|
options.ignore.push(...ignore);
|
|
@@ -41,9 +38,7 @@ async function loadTypedefs(pointerOrPointers, options) {
|
|
|
41
38
|
},
|
|
42
39
|
}))));
|
|
43
40
|
const result = prepareResult({ options, pointerOptionMap, validSources });
|
|
44
|
-
|
|
45
|
-
console.timeEnd('@graphql-tools/load: loadTypedefs');
|
|
46
|
-
}
|
|
41
|
+
(0, utils_1.debugTimerEnd)('@graphql-tools/load: loadTypedefs');
|
|
47
42
|
return result;
|
|
48
43
|
}
|
|
49
44
|
exports.loadTypedefs = loadTypedefs;
|
|
@@ -55,9 +50,7 @@ exports.loadTypedefs = loadTypedefs;
|
|
|
55
50
|
* @param options Additional options
|
|
56
51
|
*/
|
|
57
52
|
function loadTypedefsSync(pointerOrPointers, options) {
|
|
58
|
-
|
|
59
|
-
console.time('@graphql-tools/load: loadTypedefsSync');
|
|
60
|
-
}
|
|
53
|
+
(0, utils_1.debugTimerStart)('@graphql-tools/load: loadTypedefsSync');
|
|
61
54
|
const { ignore, pointerOptionMap } = (0, pointers_js_1.normalizePointers)(pointerOrPointers);
|
|
62
55
|
options.ignore = (0, utils_1.asArray)(options.ignore || []).concat(ignore);
|
|
63
56
|
(0, options_js_1.applyDefaultOptions)(options);
|
|
@@ -77,17 +70,13 @@ function loadTypedefsSync(pointerOrPointers, options) {
|
|
|
77
70
|
});
|
|
78
71
|
}
|
|
79
72
|
const result = prepareResult({ options, pointerOptionMap, validSources });
|
|
80
|
-
|
|
81
|
-
console.timeEnd('@graphql-tools/load: loadTypedefsSync');
|
|
82
|
-
}
|
|
73
|
+
(0, utils_1.debugTimerEnd)('@graphql-tools/load: loadTypedefsSync');
|
|
83
74
|
return result;
|
|
84
75
|
}
|
|
85
76
|
exports.loadTypedefsSync = loadTypedefsSync;
|
|
86
77
|
//
|
|
87
78
|
function prepareResult({ options, pointerOptionMap, validSources, }) {
|
|
88
|
-
|
|
89
|
-
console.time('@graphql-tools/load: prepareResult');
|
|
90
|
-
}
|
|
79
|
+
(0, utils_1.debugTimerStart)('@graphql-tools/load: prepareResult');
|
|
91
80
|
const pointerList = Object.keys(pointerOptionMap);
|
|
92
81
|
if (pointerList.length > 0 && validSources.length === 0) {
|
|
93
82
|
throw new Error(`
|
|
@@ -99,8 +88,6 @@ function prepareResult({ options, pointerOptionMap, validSources, }) {
|
|
|
99
88
|
const sortedResult = options.sort
|
|
100
89
|
? validSources.sort((left, right) => (0, utils_1.compareStrings)(left.location, right.location))
|
|
101
90
|
: validSources;
|
|
102
|
-
|
|
103
|
-
console.timeEnd('@graphql-tools/load: prepareResult');
|
|
104
|
-
}
|
|
91
|
+
(0, utils_1.debugTimerEnd)('@graphql-tools/load: prepareResult');
|
|
105
92
|
return sortedResult;
|
|
106
93
|
}
|
package/cjs/schema.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadSchemaSync = exports.loadSchema = void 0;
|
|
4
|
-
const load_typedefs_js_1 = require("./load-typedefs.js");
|
|
5
4
|
const graphql_1 = require("graphql");
|
|
6
|
-
const documents_js_1 = require("./documents.js");
|
|
7
5
|
const schema_1 = require("@graphql-tools/schema");
|
|
8
6
|
const utils_1 = require("@graphql-tools/utils");
|
|
7
|
+
const documents_js_1 = require("./documents.js");
|
|
8
|
+
const load_typedefs_js_1 = require("./load-typedefs.js");
|
|
9
9
|
/**
|
|
10
10
|
* Asynchronously loads a schema from the provided pointers.
|
|
11
11
|
* @param schemaPointers Pointers to the sources to load the schema from
|
|
@@ -49,7 +49,10 @@ function includeSources(schema, sources) {
|
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
function getSchemaFromSources(sources, options) {
|
|
52
|
-
if (sources.length === 1 &&
|
|
52
|
+
if (sources.length === 1 &&
|
|
53
|
+
sources[0].schema != null &&
|
|
54
|
+
options.typeDefs == null &&
|
|
55
|
+
options.resolvers == null) {
|
|
53
56
|
return options.sort ? (0, graphql_1.lexicographicSortSchema)(sources[0].schema) : sources[0].schema;
|
|
54
57
|
}
|
|
55
58
|
const { typeDefs, resolvers, schemaExtensions } = collectSchemaParts(sources);
|
package/cjs/utils/pointers.js
CHANGED
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizePointers = void 0;
|
|
4
4
|
const utils_1 = require("@graphql-tools/utils");
|
|
5
|
-
const process_1 = require("process");
|
|
6
5
|
function normalizePointers(unnormalizedPointerOrPointers) {
|
|
7
|
-
|
|
8
|
-
console.time(`@graphql-tools/load: normalizePointers`);
|
|
9
|
-
}
|
|
6
|
+
(0, utils_1.debugTimerStart)('@graphql-tools/load: normalizePointers');
|
|
10
7
|
const ignore = [];
|
|
11
8
|
const pointerOptionMap = {};
|
|
12
9
|
const handlePointer = (rawPointer, options = {}) => {
|
|
@@ -18,9 +15,7 @@ function normalizePointers(unnormalizedPointerOrPointers) {
|
|
|
18
15
|
}
|
|
19
16
|
};
|
|
20
17
|
for (const rawPointer of (0, utils_1.asArray)(unnormalizedPointerOrPointers)) {
|
|
21
|
-
|
|
22
|
-
console.time(`@graphql-tools/load: normalizePointers ${rawPointer}`);
|
|
23
|
-
}
|
|
18
|
+
(0, utils_1.debugTimerStart)(`@graphql-tools/load: normalizePointers ${rawPointer}`);
|
|
24
19
|
if (typeof rawPointer === 'string') {
|
|
25
20
|
handlePointer(rawPointer);
|
|
26
21
|
}
|
|
@@ -32,13 +27,9 @@ function normalizePointers(unnormalizedPointerOrPointers) {
|
|
|
32
27
|
else {
|
|
33
28
|
throw new Error(`Invalid pointer '${rawPointer}'.`);
|
|
34
29
|
}
|
|
35
|
-
|
|
36
|
-
console.timeEnd(`@graphql-tools/load: normalizePointers ${rawPointer}`);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
if (process_1.env['DEBUG'] != null) {
|
|
40
|
-
console.timeEnd(`@graphql-tools/load: normalizePointers`);
|
|
30
|
+
(0, utils_1.debugTimerEnd)(`@graphql-tools/load: normalizePointers ${rawPointer}`);
|
|
41
31
|
}
|
|
32
|
+
(0, utils_1.debugTimerEnd)('@graphql-tools/load: normalizePointers');
|
|
42
33
|
return { ignore, pointerOptionMap };
|
|
43
34
|
}
|
|
44
35
|
exports.normalizePointers = normalizePointers;
|
package/cjs/utils/queue.js
CHANGED
|
@@ -5,7 +5,9 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const p_limit_1 = tslib_1.__importDefault(require("p-limit"));
|
|
6
6
|
function useQueue(options) {
|
|
7
7
|
const queue = [];
|
|
8
|
-
const limit = options?.concurrency
|
|
8
|
+
const limit = options?.concurrency
|
|
9
|
+
? (0, p_limit_1.default)(options.concurrency)
|
|
10
|
+
: async (fn) => fn();
|
|
9
11
|
return {
|
|
10
12
|
add(fn) {
|
|
11
13
|
queue.push(() => limit(fn));
|
package/esm/documents.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Kind } from 'graphql';
|
|
2
|
-
import { loadTypedefs, loadTypedefsSync } from './load-typedefs.js';
|
|
2
|
+
import { loadTypedefs, loadTypedefsSync, } from './load-typedefs.js';
|
|
3
3
|
/**
|
|
4
4
|
* Kinds of AST nodes that are included in executable documents
|
|
5
5
|
*/
|
|
@@ -19,7 +19,11 @@ export const NON_OPERATION_KINDS = Object.keys(Kind)
|
|
|
19
19
|
* @param options Additional options
|
|
20
20
|
*/
|
|
21
21
|
export function loadDocuments(pointerOrPointers, options) {
|
|
22
|
-
return loadTypedefs(pointerOrPointers, {
|
|
22
|
+
return loadTypedefs(pointerOrPointers, {
|
|
23
|
+
noRequire: true,
|
|
24
|
+
filterKinds: NON_OPERATION_KINDS,
|
|
25
|
+
...options,
|
|
26
|
+
});
|
|
23
27
|
}
|
|
24
28
|
/**
|
|
25
29
|
* Synchronously loads executable documents (i.e. operations and fragments) from
|
|
@@ -30,5 +34,9 @@ export function loadDocuments(pointerOrPointers, options) {
|
|
|
30
34
|
* @param options Additional options
|
|
31
35
|
*/
|
|
32
36
|
export function loadDocumentsSync(pointerOrPointers, options) {
|
|
33
|
-
return loadTypedefsSync(pointerOrPointers, {
|
|
37
|
+
return loadTypedefsSync(pointerOrPointers, {
|
|
38
|
+
noRequire: true,
|
|
39
|
+
filterKinds: NON_OPERATION_KINDS,
|
|
40
|
+
...options,
|
|
41
|
+
});
|
|
34
42
|
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { Kind } from 'graphql';
|
|
2
1
|
import { env } from 'process';
|
|
2
|
+
import { Kind } from 'graphql';
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
*/
|
|
6
6
|
export const filterKind = (content, filterKinds) => {
|
|
7
|
-
if (content &&
|
|
7
|
+
if (content &&
|
|
8
|
+
content.definitions &&
|
|
9
|
+
content.definitions.length &&
|
|
10
|
+
filterKinds &&
|
|
11
|
+
filterKinds.length > 0) {
|
|
8
12
|
const invalidDefinitions = [];
|
|
9
13
|
const validDefinitions = [];
|
|
10
14
|
for (const definitionNode of content.definitions) {
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createRequire } from 'module';
|
|
2
|
+
import { cwd } from 'process';
|
|
2
3
|
import { isSchema, Kind } from 'graphql';
|
|
3
|
-
import {
|
|
4
|
-
import { stringToHash, useStack } from '../utils/helpers.js';
|
|
4
|
+
import { asArray, debugTimerEnd, debugTimerStart, getDocumentNodeFromSchema, isDocumentString, parseGraphQLSDL, } from '@graphql-tools/utils';
|
|
5
5
|
import { useCustomLoader, useCustomLoaderSync } from '../utils/custom-loader.js';
|
|
6
|
+
import { stringToHash, useStack } from '../utils/helpers.js';
|
|
6
7
|
import { useQueue, useSyncQueue } from '../utils/queue.js';
|
|
7
|
-
import {
|
|
8
|
-
import { cwd, env } from 'process';
|
|
8
|
+
import { loadFile, loadFileSync } from './load-file.js';
|
|
9
9
|
const CONCURRENCY_LIMIT = 50;
|
|
10
10
|
export async function collectSources({ pointerOptionMap, options, }) {
|
|
11
|
-
|
|
12
|
-
console.time('@graphql-tools/load: collectSources');
|
|
13
|
-
}
|
|
11
|
+
debugTimerStart('@graphql-tools/load: collectSources');
|
|
14
12
|
const sources = [];
|
|
15
13
|
const queue = useQueue({ concurrency: CONCURRENCY_LIMIT });
|
|
16
14
|
const { addSource, collect } = createHelpers({
|
|
@@ -19,9 +17,7 @@ export async function collectSources({ pointerOptionMap, options, }) {
|
|
|
19
17
|
});
|
|
20
18
|
for (const pointer in pointerOptionMap) {
|
|
21
19
|
const pointerOptions = pointerOptionMap[pointer];
|
|
22
|
-
|
|
23
|
-
console.time(`@graphql-tools/load: collectSources ${pointer}`);
|
|
24
|
-
}
|
|
20
|
+
debugTimerStart(`@graphql-tools/load: collectSources ${pointer}`);
|
|
25
21
|
collect({
|
|
26
22
|
pointer,
|
|
27
23
|
pointerOptions,
|
|
@@ -30,17 +26,11 @@ export async function collectSources({ pointerOptionMap, options, }) {
|
|
|
30
26
|
addSource,
|
|
31
27
|
queue: queue.add,
|
|
32
28
|
});
|
|
33
|
-
|
|
34
|
-
console.timeEnd(`@graphql-tools/load: collectSources ${pointer}`);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
if (env['DEBUG'] != null) {
|
|
38
|
-
console.time('@graphql-tools/load: collectSources queue');
|
|
29
|
+
debugTimerEnd(`@graphql-tools/load: collectSources ${pointer}`);
|
|
39
30
|
}
|
|
31
|
+
debugTimerStart('@graphql-tools/load: collectSources queue');
|
|
40
32
|
await queue.runAll();
|
|
41
|
-
|
|
42
|
-
console.timeEnd('@graphql-tools/load: collectSources queue');
|
|
43
|
-
}
|
|
33
|
+
debugTimerEnd('@graphql-tools/load: collectSources queue');
|
|
44
34
|
return sources;
|
|
45
35
|
}
|
|
46
36
|
export function collectSourcesSync({ pointerOptionMap, options, }) {
|
|
@@ -50,14 +40,10 @@ export function collectSourcesSync({ pointerOptionMap, options, }) {
|
|
|
50
40
|
sources,
|
|
51
41
|
stack: [collectDocumentString, collectCustomLoaderSync, collectFallbackSync],
|
|
52
42
|
});
|
|
53
|
-
|
|
54
|
-
console.time('@graphql-tools/load: collectSourcesSync');
|
|
55
|
-
}
|
|
43
|
+
debugTimerStart('@graphql-tools/load: collectSourcesSync');
|
|
56
44
|
for (const pointer in pointerOptionMap) {
|
|
57
45
|
const pointerOptions = pointerOptionMap[pointer];
|
|
58
|
-
|
|
59
|
-
console.time(`@graphql-tools/load: collectSourcesSync ${pointer}`);
|
|
60
|
-
}
|
|
46
|
+
debugTimerStart(`@graphql-tools/load: collectSourcesSync ${pointer}`);
|
|
61
47
|
collect({
|
|
62
48
|
pointer,
|
|
63
49
|
pointerOptions,
|
|
@@ -66,20 +52,14 @@ export function collectSourcesSync({ pointerOptionMap, options, }) {
|
|
|
66
52
|
addSource,
|
|
67
53
|
queue: queue.add,
|
|
68
54
|
});
|
|
69
|
-
|
|
70
|
-
console.timeEnd(`@graphql-tools/load: collectSourcesSync ${pointer}`);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
if (env['DEBUG'] != null) {
|
|
74
|
-
console.time('@graphql-tools/load: collectSourcesSync queue');
|
|
55
|
+
debugTimerEnd(`@graphql-tools/load: collectSourcesSync ${pointer}`);
|
|
75
56
|
}
|
|
57
|
+
debugTimerStart('@graphql-tools/load: collectSourcesSync queue');
|
|
76
58
|
queue.runAll();
|
|
77
|
-
|
|
78
|
-
console.timeEnd('@graphql-tools/load: collectSourcesSync queue');
|
|
79
|
-
}
|
|
59
|
+
debugTimerEnd('@graphql-tools/load: collectSourcesSync queue');
|
|
80
60
|
return sources;
|
|
81
61
|
}
|
|
82
|
-
function createHelpers({ sources, stack }) {
|
|
62
|
+
function createHelpers({ sources, stack, }) {
|
|
83
63
|
const addSource = ({ source }) => {
|
|
84
64
|
sources.push(source);
|
|
85
65
|
};
|
|
@@ -90,9 +70,7 @@ function createHelpers({ sources, stack }) {
|
|
|
90
70
|
};
|
|
91
71
|
}
|
|
92
72
|
function addResultOfCustomLoader({ pointer, result, addSource, }) {
|
|
93
|
-
|
|
94
|
-
console.time(`@graphql-tools/load: addResultOfCustomLoader ${pointer}`);
|
|
95
|
-
}
|
|
73
|
+
debugTimerStart(`@graphql-tools/load: addResultOfCustomLoader ${pointer}`);
|
|
96
74
|
if (isSchema(result)) {
|
|
97
75
|
addSource({
|
|
98
76
|
source: {
|
|
@@ -122,14 +100,10 @@ function addResultOfCustomLoader({ pointer, result, addSource, }) {
|
|
|
122
100
|
pointer,
|
|
123
101
|
});
|
|
124
102
|
}
|
|
125
|
-
|
|
126
|
-
console.timeEnd(`@graphql-tools/load: addResultOfCustomLoader ${pointer}`);
|
|
127
|
-
}
|
|
103
|
+
debugTimerEnd(`@graphql-tools/load: addResultOfCustomLoader ${pointer}`);
|
|
128
104
|
}
|
|
129
105
|
function collectDocumentString({ pointer, pointerOptions, options, addSource, queue }, next) {
|
|
130
|
-
|
|
131
|
-
console.time(`@graphql-tools/load: collectDocumentString ${pointer}`);
|
|
132
|
-
}
|
|
106
|
+
debugTimerStart(`@graphql-tools/load: collectDocumentString ${pointer}`);
|
|
133
107
|
if (isDocumentString(pointer)) {
|
|
134
108
|
return queue(() => {
|
|
135
109
|
const source = parseGraphQLSDL(`${stringToHash(pointer)}.graphql`, pointer, {
|
|
@@ -142,25 +116,19 @@ function collectDocumentString({ pointer, pointerOptions, options, addSource, qu
|
|
|
142
116
|
});
|
|
143
117
|
});
|
|
144
118
|
}
|
|
145
|
-
|
|
146
|
-
console.timeEnd(`@graphql-tools/load: collectDocumentString ${pointer}`);
|
|
147
|
-
}
|
|
119
|
+
debugTimerEnd(`@graphql-tools/load: collectDocumentString ${pointer}`);
|
|
148
120
|
next();
|
|
149
121
|
}
|
|
150
122
|
function collectCustomLoader({ pointer, pointerOptions, queue, addSource, options, pointerOptionMap }, next) {
|
|
151
123
|
if (pointerOptions.loader) {
|
|
152
124
|
return queue(async () => {
|
|
153
|
-
|
|
154
|
-
console.time(`@graphql-tools/load: collectCustomLoader ${pointer}`);
|
|
155
|
-
}
|
|
125
|
+
debugTimerStart(`@graphql-tools/load: collectCustomLoader ${pointer}`);
|
|
156
126
|
await Promise.all(asArray(pointerOptions.require).map(m => import(m)));
|
|
157
127
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
158
128
|
// @ts-ignore TODO options.cwd is possibly undefined, but it seems like no test covers this path
|
|
159
129
|
const loader = await useCustomLoader(pointerOptions.loader, options.cwd);
|
|
160
130
|
const result = await loader(pointer, { ...options, ...pointerOptions }, pointerOptionMap);
|
|
161
|
-
|
|
162
|
-
console.timeEnd(`@graphql-tools/load: collectCustomLoader ${pointer}`);
|
|
163
|
-
}
|
|
131
|
+
debugTimerEnd(`@graphql-tools/load: collectCustomLoader ${pointer}`);
|
|
164
132
|
if (!result) {
|
|
165
133
|
return;
|
|
166
134
|
}
|
|
@@ -172,9 +140,7 @@ function collectCustomLoader({ pointer, pointerOptions, queue, addSource, option
|
|
|
172
140
|
function collectCustomLoaderSync({ pointer, pointerOptions, queue, addSource, options, pointerOptionMap }, next) {
|
|
173
141
|
if (pointerOptions.loader) {
|
|
174
142
|
return queue(() => {
|
|
175
|
-
|
|
176
|
-
console.time(`@graphql-tools/load: collectCustomLoaderSync ${pointer}`);
|
|
177
|
-
}
|
|
143
|
+
debugTimerStart(`@graphql-tools/load: collectCustomLoaderSync ${pointer}`);
|
|
178
144
|
const cwdRequire = createRequire(options.cwd || cwd());
|
|
179
145
|
for (const m of asArray(pointerOptions.require)) {
|
|
180
146
|
cwdRequire(m);
|
|
@@ -183,9 +149,7 @@ function collectCustomLoaderSync({ pointer, pointerOptions, queue, addSource, op
|
|
|
183
149
|
// @ts-ignore TODO options.cwd is possibly undefined, but it seems like no test covers this path
|
|
184
150
|
const loader = useCustomLoaderSync(pointerOptions.loader, options.cwd);
|
|
185
151
|
const result = loader(pointer, { ...options, ...pointerOptions }, pointerOptionMap);
|
|
186
|
-
|
|
187
|
-
console.timeEnd(`@graphql-tools/load: collectCustomLoaderSync ${pointer}`);
|
|
188
|
-
}
|
|
152
|
+
debugTimerEnd(`@graphql-tools/load: collectCustomLoaderSync ${pointer}`);
|
|
189
153
|
if (result) {
|
|
190
154
|
addResultOfCustomLoader({ pointer, result, addSource });
|
|
191
155
|
}
|
|
@@ -193,11 +157,9 @@ function collectCustomLoaderSync({ pointer, pointerOptions, queue, addSource, op
|
|
|
193
157
|
}
|
|
194
158
|
next();
|
|
195
159
|
}
|
|
196
|
-
function collectFallback({ queue, pointer, options, pointerOptions, addSource }) {
|
|
160
|
+
function collectFallback({ queue, pointer, options, pointerOptions, addSource, }) {
|
|
197
161
|
return queue(async () => {
|
|
198
|
-
|
|
199
|
-
console.time(`@graphql-tools/load: collectFallback ${pointer}`);
|
|
200
|
-
}
|
|
162
|
+
debugTimerStart(`@graphql-tools/load: collectFallback ${pointer}`);
|
|
201
163
|
const sources = await loadFile(pointer, {
|
|
202
164
|
...options,
|
|
203
165
|
...pointerOptions,
|
|
@@ -207,16 +169,12 @@ function collectFallback({ queue, pointer, options, pointerOptions, addSource })
|
|
|
207
169
|
addSource({ source, pointer });
|
|
208
170
|
}
|
|
209
171
|
}
|
|
210
|
-
|
|
211
|
-
console.timeEnd(`@graphql-tools/load: collectFallback ${pointer}`);
|
|
212
|
-
}
|
|
172
|
+
debugTimerEnd(`@graphql-tools/load: collectFallback ${pointer}`);
|
|
213
173
|
});
|
|
214
174
|
}
|
|
215
|
-
function collectFallbackSync({ queue, pointer, options, pointerOptions, addSource }) {
|
|
175
|
+
function collectFallbackSync({ queue, pointer, options, pointerOptions, addSource, }) {
|
|
216
176
|
return queue(() => {
|
|
217
|
-
|
|
218
|
-
console.time(`@graphql-tools/load: collectFallbackSync ${pointer}`);
|
|
219
|
-
}
|
|
177
|
+
debugTimerStart(`@graphql-tools/load: collectFallbackSync ${pointer}`);
|
|
220
178
|
const sources = loadFileSync(pointer, {
|
|
221
179
|
...options,
|
|
222
180
|
...pointerOptions,
|
|
@@ -226,8 +184,6 @@ function collectFallbackSync({ queue, pointer, options, pointerOptions, addSourc
|
|
|
226
184
|
addSource({ source, pointer });
|
|
227
185
|
}
|
|
228
186
|
}
|
|
229
|
-
|
|
230
|
-
console.timeEnd(`@graphql-tools/load: collectFallbackSync ${pointer}`);
|
|
231
|
-
}
|
|
187
|
+
debugTimerEnd(`@graphql-tools/load: collectFallbackSync ${pointer}`);
|
|
232
188
|
});
|
|
233
189
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { env } from 'process';
|
|
2
|
+
import { debugTimerEnd, debugTimerStart } from '@graphql-tools/utils';
|
|
2
3
|
export async function loadFile(pointer, options) {
|
|
3
|
-
|
|
4
|
-
console.time(`@graphql-tools/load: loadFile ${pointer}`);
|
|
5
|
-
}
|
|
4
|
+
debugTimerStart(`@graphql-tools/load: loadFile ${pointer}`);
|
|
6
5
|
let results = options.cache?.[pointer];
|
|
7
6
|
if (!results) {
|
|
8
7
|
results = [];
|
|
@@ -38,15 +37,11 @@ export async function loadFile(pointer, options) {
|
|
|
38
37
|
options.cache[pointer] = results;
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
|
-
|
|
42
|
-
console.timeEnd(`@graphql-tools/load: loadFile ${pointer}`);
|
|
43
|
-
}
|
|
40
|
+
debugTimerEnd(`@graphql-tools/load: loadFile ${pointer}`);
|
|
44
41
|
return results;
|
|
45
42
|
}
|
|
46
43
|
export function loadFileSync(pointer, options) {
|
|
47
|
-
|
|
48
|
-
console.time(`@graphql-tools/load: loadFileSync ${pointer}`);
|
|
49
|
-
}
|
|
44
|
+
debugTimerStart(`@graphql-tools/load: loadFileSync ${pointer}`);
|
|
50
45
|
let results = options.cache?.[pointer];
|
|
51
46
|
if (!results) {
|
|
52
47
|
results = [];
|
|
@@ -83,8 +78,6 @@ export function loadFileSync(pointer, options) {
|
|
|
83
78
|
options.cache[pointer] = results;
|
|
84
79
|
}
|
|
85
80
|
}
|
|
86
|
-
|
|
87
|
-
console.timeEnd(`@graphql-tools/load: loadFileSync ${pointer}`);
|
|
88
|
-
}
|
|
81
|
+
debugTimerEnd(`@graphql-tools/load: loadFileSync ${pointer}`);
|
|
89
82
|
return results;
|
|
90
83
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { env } from 'process';
|
|
1
|
+
import { debugTimerEnd, debugTimerStart, parseGraphQLSDL, printSchemaWithDirectives, printWithComments, resetComments, } from '@graphql-tools/utils';
|
|
3
2
|
import { filterKind } from '../filter-document-kind.js';
|
|
4
|
-
export function parseSource({ partialSource, options, pointerOptionMap, addValidSource }) {
|
|
5
|
-
if (env['DEBUG'] != null) {
|
|
6
|
-
console.time(`@graphql-tools/load: parseSource ${partialSource.location}`);
|
|
7
|
-
}
|
|
3
|
+
export function parseSource({ partialSource, options, pointerOptionMap, addValidSource, }) {
|
|
8
4
|
if (partialSource) {
|
|
5
|
+
debugTimerStart(`@graphql-tools/load: parseSource ${partialSource.location}`);
|
|
9
6
|
const input = prepareInput({
|
|
10
7
|
source: partialSource,
|
|
11
8
|
options,
|
|
@@ -18,9 +15,7 @@ export function parseSource({ partialSource, options, pointerOptionMap, addValid
|
|
|
18
15
|
useComments(input);
|
|
19
16
|
collectValidSources(input, addValidSource);
|
|
20
17
|
}
|
|
21
|
-
|
|
22
|
-
if (env['DEBUG'] != null) {
|
|
23
|
-
console.timeEnd(`@graphql-tools/load: parseSource ${partialSource.location}`);
|
|
18
|
+
debugTimerEnd(`@graphql-tools/load: parseSource ${partialSource.location}`);
|
|
24
19
|
}
|
|
25
20
|
}
|
|
26
21
|
//
|
|
@@ -37,55 +32,38 @@ function prepareInput({ source, options, pointerOptionMap, }) {
|
|
|
37
32
|
return { source: { ...source }, options: specificOptions };
|
|
38
33
|
}
|
|
39
34
|
function parseSchema(input) {
|
|
40
|
-
if (env['DEBUG'] != null) {
|
|
41
|
-
console.time(`@graphql-tools/load: parseSchema ${input.source.location}`);
|
|
42
|
-
}
|
|
43
35
|
if (input.source.schema) {
|
|
36
|
+
debugTimerStart(`@graphql-tools/load: parseSchema ${input.source.location}`);
|
|
44
37
|
input.source.rawSDL = printSchemaWithDirectives(input.source.schema, input.options);
|
|
45
|
-
|
|
46
|
-
if (env['DEBUG'] != null) {
|
|
47
|
-
console.timeEnd(`@graphql-tools/load: parseSchema ${input.source.location}`);
|
|
38
|
+
debugTimerEnd(`@graphql-tools/load: parseSchema ${input.source.location}`);
|
|
48
39
|
}
|
|
49
40
|
}
|
|
50
41
|
function parseRawSDL(input) {
|
|
51
|
-
if (env['DEBUG'] != null) {
|
|
52
|
-
console.time(`@graphql-tools/load: parseRawSDL ${input.source.location}`);
|
|
53
|
-
}
|
|
54
42
|
if (input.source.rawSDL) {
|
|
43
|
+
debugTimerStart(`@graphql-tools/load: parseRawSDL ${input.source.location}`);
|
|
55
44
|
input.source.document = parseGraphQLSDL(input.source.location, input.source.rawSDL, input.options).document;
|
|
56
|
-
|
|
57
|
-
if (env['DEBUG'] != null) {
|
|
58
|
-
console.timeEnd(`@graphql-tools/load: parseRawSDL ${input.source.location}`);
|
|
45
|
+
debugTimerEnd(`@graphql-tools/load: parseRawSDL ${input.source.location}`);
|
|
59
46
|
}
|
|
60
47
|
}
|
|
61
48
|
function useKindsFilter(input) {
|
|
62
|
-
if (env['DEBUG'] != null) {
|
|
63
|
-
console.time(`@graphql-tools/load: useKindsFilter ${input.source.location}`);
|
|
64
|
-
}
|
|
65
49
|
if (input.options.filterKinds) {
|
|
50
|
+
debugTimerStart(`@graphql-tools/load: useKindsFilter ${input.source.location}`);
|
|
66
51
|
input.source.document = filterKind(input.source.document, input.options.filterKinds);
|
|
52
|
+
debugTimerEnd(`@graphql-tools/load: useKindsFilter ${input.source.location}`);
|
|
67
53
|
}
|
|
68
54
|
}
|
|
69
55
|
function useComments(input) {
|
|
70
|
-
if (env['DEBUG'] != null) {
|
|
71
|
-
console.time(`@graphql-tools/load: useComments ${input.source.location}`);
|
|
72
|
-
}
|
|
73
56
|
if (!input.source.rawSDL && input.source.document) {
|
|
57
|
+
debugTimerStart(`@graphql-tools/load: useComments ${input.source.location}`);
|
|
74
58
|
input.source.rawSDL = printWithComments(input.source.document);
|
|
75
59
|
resetComments();
|
|
76
|
-
|
|
77
|
-
if (env['DEBUG'] != null) {
|
|
78
|
-
console.timeEnd(`@graphql-tools/load: useComments ${input.source.location}`);
|
|
60
|
+
debugTimerEnd(`@graphql-tools/load: useComments ${input.source.location}`);
|
|
79
61
|
}
|
|
80
62
|
}
|
|
81
63
|
function collectValidSources(input, addValidSource) {
|
|
82
|
-
if (env['DEBUG'] != null) {
|
|
83
|
-
console.time(`@graphql-tools/load: collectValidSources ${input.source.location}`);
|
|
84
|
-
}
|
|
85
64
|
if (input.source.document?.definitions && input.source.document.definitions.length > 0) {
|
|
65
|
+
debugTimerStart(`@graphql-tools/load: collectValidSources ${input.source.location}`);
|
|
86
66
|
addValidSource(input.source);
|
|
87
|
-
|
|
88
|
-
if (env['DEBUG'] != null) {
|
|
89
|
-
console.timeEnd(`@graphql-tools/load: collectValidSources ${input.source.location}`);
|
|
67
|
+
debugTimerEnd(`@graphql-tools/load: collectValidSources ${input.source.location}`);
|
|
90
68
|
}
|
|
91
69
|
}
|
package/esm/load-typedefs.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { compareStrings,
|
|
2
|
-
import { normalizePointers } from './utils/pointers.js';
|
|
3
|
-
import { applyDefaultOptions } from './load-typedefs/options.js';
|
|
1
|
+
import { asArray, compareStrings, debugTimerEnd, debugTimerStart, } from '@graphql-tools/utils';
|
|
4
2
|
import { collectSources, collectSourcesSync } from './load-typedefs/collect-sources.js';
|
|
3
|
+
import { applyDefaultOptions } from './load-typedefs/options.js';
|
|
5
4
|
import { parseSource } from './load-typedefs/parse.js';
|
|
6
5
|
import { useLimit } from './utils/helpers.js';
|
|
7
|
-
import {
|
|
6
|
+
import { normalizePointers } from './utils/pointers.js';
|
|
8
7
|
const CONCURRENCY_LIMIT = 100;
|
|
9
8
|
/**
|
|
10
9
|
* Asynchronously loads any GraphQL documents (i.e. executable documents like
|
|
@@ -15,9 +14,7 @@ const CONCURRENCY_LIMIT = 100;
|
|
|
15
14
|
* @param options Additional options
|
|
16
15
|
*/
|
|
17
16
|
export async function loadTypedefs(pointerOrPointers, options) {
|
|
18
|
-
|
|
19
|
-
console.time('@graphql-tools/load: loadTypedefs');
|
|
20
|
-
}
|
|
17
|
+
debugTimerStart('@graphql-tools/load: loadTypedefs');
|
|
21
18
|
const { ignore, pointerOptionMap } = normalizePointers(pointerOrPointers);
|
|
22
19
|
options.ignore = asArray(options.ignore || []);
|
|
23
20
|
options.ignore.push(...ignore);
|
|
@@ -38,9 +35,7 @@ export async function loadTypedefs(pointerOrPointers, options) {
|
|
|
38
35
|
},
|
|
39
36
|
}))));
|
|
40
37
|
const result = prepareResult({ options, pointerOptionMap, validSources });
|
|
41
|
-
|
|
42
|
-
console.timeEnd('@graphql-tools/load: loadTypedefs');
|
|
43
|
-
}
|
|
38
|
+
debugTimerEnd('@graphql-tools/load: loadTypedefs');
|
|
44
39
|
return result;
|
|
45
40
|
}
|
|
46
41
|
/**
|
|
@@ -51,9 +46,7 @@ export async function loadTypedefs(pointerOrPointers, options) {
|
|
|
51
46
|
* @param options Additional options
|
|
52
47
|
*/
|
|
53
48
|
export function loadTypedefsSync(pointerOrPointers, options) {
|
|
54
|
-
|
|
55
|
-
console.time('@graphql-tools/load: loadTypedefsSync');
|
|
56
|
-
}
|
|
49
|
+
debugTimerStart('@graphql-tools/load: loadTypedefsSync');
|
|
57
50
|
const { ignore, pointerOptionMap } = normalizePointers(pointerOrPointers);
|
|
58
51
|
options.ignore = asArray(options.ignore || []).concat(ignore);
|
|
59
52
|
applyDefaultOptions(options);
|
|
@@ -73,16 +66,12 @@ export function loadTypedefsSync(pointerOrPointers, options) {
|
|
|
73
66
|
});
|
|
74
67
|
}
|
|
75
68
|
const result = prepareResult({ options, pointerOptionMap, validSources });
|
|
76
|
-
|
|
77
|
-
console.timeEnd('@graphql-tools/load: loadTypedefsSync');
|
|
78
|
-
}
|
|
69
|
+
debugTimerEnd('@graphql-tools/load: loadTypedefsSync');
|
|
79
70
|
return result;
|
|
80
71
|
}
|
|
81
72
|
//
|
|
82
73
|
function prepareResult({ options, pointerOptionMap, validSources, }) {
|
|
83
|
-
|
|
84
|
-
console.time('@graphql-tools/load: prepareResult');
|
|
85
|
-
}
|
|
74
|
+
debugTimerStart('@graphql-tools/load: prepareResult');
|
|
86
75
|
const pointerList = Object.keys(pointerOptionMap);
|
|
87
76
|
if (pointerList.length > 0 && validSources.length === 0) {
|
|
88
77
|
throw new Error(`
|
|
@@ -94,8 +83,6 @@ function prepareResult({ options, pointerOptionMap, validSources, }) {
|
|
|
94
83
|
const sortedResult = options.sort
|
|
95
84
|
? validSources.sort((left, right) => compareStrings(left.location, right.location))
|
|
96
85
|
: validSources;
|
|
97
|
-
|
|
98
|
-
console.timeEnd('@graphql-tools/load: prepareResult');
|
|
99
|
-
}
|
|
86
|
+
debugTimerEnd('@graphql-tools/load: prepareResult');
|
|
100
87
|
return sortedResult;
|
|
101
88
|
}
|
package/esm/schema.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Source as GraphQLSource, lexicographicSortSchema, print, } from 'graphql';
|
|
2
|
+
import { extractExtensionsFromSchema, mergeSchemas, } from '@graphql-tools/schema';
|
|
3
|
+
import { getResolversFromSchema, } from '@graphql-tools/utils';
|
|
3
4
|
import { OPERATION_KINDS } from './documents.js';
|
|
4
|
-
import {
|
|
5
|
-
import { getResolversFromSchema } from '@graphql-tools/utils';
|
|
5
|
+
import { loadTypedefs, loadTypedefsSync, } from './load-typedefs.js';
|
|
6
6
|
/**
|
|
7
7
|
* Asynchronously loads a schema from the provided pointers.
|
|
8
8
|
* @param schemaPointers Pointers to the sources to load the schema from
|
|
@@ -44,7 +44,10 @@ function includeSources(schema, sources) {
|
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
function getSchemaFromSources(sources, options) {
|
|
47
|
-
if (sources.length === 1 &&
|
|
47
|
+
if (sources.length === 1 &&
|
|
48
|
+
sources[0].schema != null &&
|
|
49
|
+
options.typeDefs == null &&
|
|
50
|
+
options.resolvers == null) {
|
|
48
51
|
return options.sort ? lexicographicSortSchema(sources[0].schema) : sources[0].schema;
|
|
49
52
|
}
|
|
50
53
|
const { typeDefs, resolvers, schemaExtensions } = collectSchemaParts(sources);
|
package/esm/utils/pointers.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { asArray } from '@graphql-tools/utils';
|
|
2
|
-
import { env } from 'process';
|
|
1
|
+
import { asArray, debugTimerEnd, debugTimerStart } from '@graphql-tools/utils';
|
|
3
2
|
export function normalizePointers(unnormalizedPointerOrPointers) {
|
|
4
|
-
|
|
5
|
-
console.time(`@graphql-tools/load: normalizePointers`);
|
|
6
|
-
}
|
|
3
|
+
debugTimerStart('@graphql-tools/load: normalizePointers');
|
|
7
4
|
const ignore = [];
|
|
8
5
|
const pointerOptionMap = {};
|
|
9
6
|
const handlePointer = (rawPointer, options = {}) => {
|
|
@@ -15,9 +12,7 @@ export function normalizePointers(unnormalizedPointerOrPointers) {
|
|
|
15
12
|
}
|
|
16
13
|
};
|
|
17
14
|
for (const rawPointer of asArray(unnormalizedPointerOrPointers)) {
|
|
18
|
-
|
|
19
|
-
console.time(`@graphql-tools/load: normalizePointers ${rawPointer}`);
|
|
20
|
-
}
|
|
15
|
+
debugTimerStart(`@graphql-tools/load: normalizePointers ${rawPointer}`);
|
|
21
16
|
if (typeof rawPointer === 'string') {
|
|
22
17
|
handlePointer(rawPointer);
|
|
23
18
|
}
|
|
@@ -29,12 +24,8 @@ export function normalizePointers(unnormalizedPointerOrPointers) {
|
|
|
29
24
|
else {
|
|
30
25
|
throw new Error(`Invalid pointer '${rawPointer}'.`);
|
|
31
26
|
}
|
|
32
|
-
|
|
33
|
-
console.timeEnd(`@graphql-tools/load: normalizePointers ${rawPointer}`);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
if (env['DEBUG'] != null) {
|
|
37
|
-
console.timeEnd(`@graphql-tools/load: normalizePointers`);
|
|
27
|
+
debugTimerEnd(`@graphql-tools/load: normalizePointers ${rawPointer}`);
|
|
38
28
|
}
|
|
29
|
+
debugTimerEnd('@graphql-tools/load: normalizePointers');
|
|
39
30
|
return { ignore, pointerOptionMap };
|
|
40
31
|
}
|
package/esm/utils/queue.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import pLimit from 'p-limit';
|
|
2
2
|
export function useQueue(options) {
|
|
3
3
|
const queue = [];
|
|
4
|
-
const limit = options?.concurrency
|
|
4
|
+
const limit = options?.concurrency
|
|
5
|
+
? pLimit(options.concurrency)
|
|
6
|
+
: async (fn) => fn();
|
|
5
7
|
return {
|
|
6
8
|
add(fn) {
|
|
7
9
|
queue.push(() => limit(fn));
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/load",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.1-alpha-20231123133003-7b1f3276",
|
|
4
4
|
"description": "A set of utils for faster development of GraphQL tools",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"peerDependencies": {
|
|
7
7
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@graphql-tools/
|
|
11
|
-
"@graphql-tools/
|
|
10
|
+
"@graphql-tools/schema": "10.0.2-alpha-20231123133003-7b1f3276",
|
|
11
|
+
"@graphql-tools/utils": "10.0.10-alpha-20231123133003-7b1f3276",
|
|
12
12
|
"p-limit": "3.1.0",
|
|
13
13
|
"tslib": "^2.4.0"
|
|
14
14
|
},
|
package/typings/documents.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Source } from '@graphql-tools/utils';
|
|
2
1
|
import { Kind } from 'graphql';
|
|
2
|
+
import { Source } from '@graphql-tools/utils';
|
|
3
3
|
import { LoadTypedefsOptions, UnnormalizedTypeDefPointer } from './load-typedefs.cjs';
|
|
4
4
|
type KindList = Array<(typeof Kind)[keyof typeof Kind]>;
|
|
5
5
|
/**
|
package/typings/documents.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Source } from '@graphql-tools/utils';
|
|
2
1
|
import { Kind } from 'graphql';
|
|
2
|
+
import { Source } from '@graphql-tools/utils';
|
|
3
3
|
import { LoadTypedefsOptions, UnnormalizedTypeDefPointer } from './load-typedefs.js';
|
|
4
4
|
type KindList = Array<(typeof Kind)[keyof typeof Kind]>;
|
|
5
5
|
/**
|
|
@@ -6,5 +6,5 @@ type ParseOptions = {
|
|
|
6
6
|
pointerOptionMap: any;
|
|
7
7
|
addValidSource: AddValidSource;
|
|
8
8
|
};
|
|
9
|
-
export declare function parseSource({ partialSource, options, pointerOptionMap, addValidSource }: ParseOptions): void;
|
|
9
|
+
export declare function parseSource({ partialSource, options, pointerOptionMap, addValidSource, }: ParseOptions): void;
|
|
10
10
|
export {};
|
|
@@ -6,5 +6,5 @@ type ParseOptions = {
|
|
|
6
6
|
pointerOptionMap: any;
|
|
7
7
|
addValidSource: AddValidSource;
|
|
8
8
|
};
|
|
9
|
-
export declare function parseSource({ partialSource, options, pointerOptionMap, addValidSource }: ParseOptions): void;
|
|
9
|
+
export declare function parseSource({ partialSource, options, pointerOptionMap, addValidSource, }: ParseOptions): void;
|
|
10
10
|
export {};
|
package/typings/schema.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { GraphQLSchema, BuildSchemaOptions } from 'graphql';
|
|
1
|
+
import { BuildSchemaOptions, GraphQLSchema } from 'graphql';
|
|
3
2
|
import { IExecutableSchemaDefinition } from '@graphql-tools/schema';
|
|
3
|
+
import { LoadTypedefsOptions, UnnormalizedTypeDefPointer } from './load-typedefs.cjs';
|
|
4
4
|
export type LoadSchemaOptions = BuildSchemaOptions & LoadTypedefsOptions & Partial<IExecutableSchemaDefinition> & {
|
|
5
5
|
/**
|
|
6
6
|
* Adds a list of Sources in to `extensions.sources`
|
package/typings/schema.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { GraphQLSchema, BuildSchemaOptions } from 'graphql';
|
|
1
|
+
import { BuildSchemaOptions, GraphQLSchema } from 'graphql';
|
|
3
2
|
import { IExecutableSchemaDefinition } from '@graphql-tools/schema';
|
|
3
|
+
import { LoadTypedefsOptions, UnnormalizedTypeDefPointer } from './load-typedefs.js';
|
|
4
4
|
export type LoadSchemaOptions = BuildSchemaOptions & LoadTypedefsOptions & Partial<IExecutableSchemaDefinition> & {
|
|
5
5
|
/**
|
|
6
6
|
* Adds a list of Sources in to `extensions.sources`
|