@graphitation/supermassive 2.2.1 → 2.2.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/.eslintcache +1 -1
- package/lib/ast/TypedAST.js +1 -0
- package/lib/ast/addTypesToRequestDocument.js +48 -42
- package/lib/ast/addTypesToRequestDocument.mjs +47 -42
- package/lib/benchmarks/index.js +15 -4
- package/lib/benchmarks/index.mjs +6 -3
- package/lib/benchmarks/nice-benchmark.js +1 -0
- package/lib/benchmarks/swapi-schema/index.js +14 -4
- package/lib/benchmarks/swapi-schema/index.mjs +5 -3
- package/lib/benchmarks/swapi-schema/models.js +9 -1
- package/lib/benchmarks/swapi-schema/resolvers.js +22 -7
- package/lib/benchmarks/swapi-schema/resolvers.mjs +21 -7
- package/lib/collectFields.js +41 -11
- package/lib/collectFields.mjs +40 -11
- package/lib/compiledQuery.js +1 -0
- package/lib/definition.js +13 -8
- package/lib/definition.mjs +12 -8
- package/lib/directives.js +48 -33
- package/lib/directives.mjs +47 -33
- package/lib/executeWithSchema.js +1 -0
- package/lib/executeWithoutSchema.js +231 -49
- package/lib/executeWithoutSchema.mjs +224 -46
- package/lib/extractImplicitTypesRuntime.js +4 -1
- package/lib/extractImplicitTypesRuntime.mjs +3 -1
- package/lib/index.js +1 -0
- package/lib/jsutils/Maybe.js +1 -0
- package/lib/jsutils/ObjMap.js +1 -0
- package/lib/jsutils/Path.js +1 -0
- package/lib/jsutils/PromiseOrValue.js +1 -0
- package/lib/jsutils/devAssert.js +1 -0
- package/lib/jsutils/didYouMean.js +1 -0
- package/lib/jsutils/identityFunc.js +1 -0
- package/lib/jsutils/inspect.js +4 -1
- package/lib/jsutils/inspect.mjs +3 -1
- package/lib/jsutils/instanceOf.js +18 -6
- package/lib/jsutils/instanceOf.mjs +17 -6
- package/lib/jsutils/invariant.js +4 -1
- package/lib/jsutils/invariant.mjs +3 -1
- package/lib/jsutils/isAsyncIterable.js +1 -0
- package/lib/jsutils/isIterableObject.js +1 -0
- package/lib/jsutils/isObjectLike.js +1 -0
- package/lib/jsutils/isPromise.js +1 -0
- package/lib/jsutils/keyMap.js +1 -0
- package/lib/jsutils/keyValMap.js +1 -0
- package/lib/jsutils/mapValue.js +1 -0
- package/lib/jsutils/memoize3.js +1 -0
- package/lib/jsutils/naturalCompare.js +1 -0
- package/lib/jsutils/printPathArray.js +4 -1
- package/lib/jsutils/printPathArray.mjs +3 -1
- package/lib/jsutils/promiseForObject.js +1 -0
- package/lib/jsutils/promiseReduce.js +1 -0
- package/lib/jsutils/suggestionList.js +9 -1
- package/lib/jsutils/suggestionList.mjs +8 -1
- package/lib/jsutils/toObjMap.js +1 -0
- package/lib/subscribeWithSchema.js +1 -0
- package/lib/subscribeWithoutSchema.js +45 -6
- package/lib/subscribeWithoutSchema.mjs +44 -6
- package/lib/transforms/annotateDocumentGraphQLTransform.js +1 -0
- package/lib/types.js +1 -0
- package/lib/utilities/blankGraphQLTag.js +1 -0
- package/lib/utilities/mapAsyncIterator.js +1 -0
- package/lib/utilities/mergeResolvers.js +1 -0
- package/lib/utilities/typeNameFromAST.js +1 -0
- package/lib/values.js +82 -21
- package/lib/values.mjs +81 -21
- package/package.json +1 -1
|
@@ -40,7 +40,16 @@ function executeWithoutSchema(args) {
|
|
|
40
40
|
} = args;
|
|
41
41
|
const combinedResolvers = mergeResolvers(resolvers, schemaResolvers);
|
|
42
42
|
assertValidExecutionArguments(document, variableValues);
|
|
43
|
-
const exeContext = buildExecutionContext(
|
|
43
|
+
const exeContext = buildExecutionContext(
|
|
44
|
+
combinedResolvers,
|
|
45
|
+
document,
|
|
46
|
+
rootValue,
|
|
47
|
+
contextValue,
|
|
48
|
+
variableValues,
|
|
49
|
+
operationName,
|
|
50
|
+
fieldResolver,
|
|
51
|
+
typeResolver
|
|
52
|
+
);
|
|
44
53
|
if (!("resolvers" in exeContext)) {
|
|
45
54
|
return { errors: exeContext };
|
|
46
55
|
} else {
|
|
@@ -50,13 +59,18 @@ function executeWithoutSchema(args) {
|
|
|
50
59
|
}
|
|
51
60
|
function buildResponse(exeContext, data) {
|
|
52
61
|
if (isPromise(data)) {
|
|
53
|
-
return data.then(
|
|
62
|
+
return data.then(
|
|
63
|
+
(resolved) => buildResponse(exeContext, resolved)
|
|
64
|
+
);
|
|
54
65
|
}
|
|
55
66
|
return exeContext.errors.length === 0 ? { data } : { errors: exeContext.errors, data };
|
|
56
67
|
}
|
|
57
68
|
function assertValidExecutionArguments(document, rawVariableValues) {
|
|
58
69
|
devAssert(document, "Must provide document.");
|
|
59
|
-
devAssert(
|
|
70
|
+
devAssert(
|
|
71
|
+
rawVariableValues == null || isObjectLike(rawVariableValues),
|
|
72
|
+
"Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided."
|
|
73
|
+
);
|
|
60
74
|
}
|
|
61
75
|
function buildExecutionContext(resolvers, document, rootValue, contextValue, rawVariableValues, operationName, fieldResolver, typeResolver) {
|
|
62
76
|
var _a, _b;
|
|
@@ -68,7 +82,9 @@ function buildExecutionContext(resolvers, document, rootValue, contextValue, raw
|
|
|
68
82
|
if (operationName == null) {
|
|
69
83
|
if (operation !== void 0) {
|
|
70
84
|
return [
|
|
71
|
-
new GraphQLError(
|
|
85
|
+
new GraphQLError(
|
|
86
|
+
"Must provide operation name if query contains multiple operations."
|
|
87
|
+
)
|
|
72
88
|
];
|
|
73
89
|
}
|
|
74
90
|
operation = definition;
|
|
@@ -88,7 +104,12 @@ function buildExecutionContext(resolvers, document, rootValue, contextValue, raw
|
|
|
88
104
|
return [new GraphQLError("Must provide an operation.")];
|
|
89
105
|
}
|
|
90
106
|
const variableDefinitions = (_b = operation.variableDefinitions) != null ? _b : [];
|
|
91
|
-
const coercedVariableValues = getVariableValues(
|
|
107
|
+
const coercedVariableValues = getVariableValues(
|
|
108
|
+
resolvers,
|
|
109
|
+
variableDefinitions,
|
|
110
|
+
rawVariableValues != null ? rawVariableValues : {},
|
|
111
|
+
{ maxErrors: 50 }
|
|
112
|
+
);
|
|
92
113
|
if (coercedVariableValues.errors) {
|
|
93
114
|
return coercedVariableValues.errors;
|
|
94
115
|
}
|
|
@@ -106,7 +127,15 @@ function buildExecutionContext(resolvers, document, rootValue, contextValue, raw
|
|
|
106
127
|
}
|
|
107
128
|
function executeOperation(exeContext, operation, rootValue) {
|
|
108
129
|
const typeName = getOperationRootTypeName(operation);
|
|
109
|
-
const fields = collectFields(
|
|
130
|
+
const fields = collectFields(
|
|
131
|
+
exeContext.resolvers,
|
|
132
|
+
exeContext.fragments,
|
|
133
|
+
exeContext.variableValues,
|
|
134
|
+
typeName,
|
|
135
|
+
operation.selectionSet,
|
|
136
|
+
/* @__PURE__ */ new Map(),
|
|
137
|
+
/* @__PURE__ */ new Set()
|
|
138
|
+
);
|
|
110
139
|
const path = void 0;
|
|
111
140
|
try {
|
|
112
141
|
const result = operation.operation === "mutation" ? executeFieldsSerially(exeContext, typeName, rootValue, path, fields) : executeFields(exeContext, typeName, rootValue, path, fields);
|
|
@@ -123,28 +152,44 @@ function executeOperation(exeContext, operation, rootValue) {
|
|
|
123
152
|
}
|
|
124
153
|
}
|
|
125
154
|
function executeFieldsSerially(exeContext, parentTypeName, sourceValue, path, fields) {
|
|
126
|
-
return promiseReduce(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
155
|
+
return promiseReduce(
|
|
156
|
+
fields.entries(),
|
|
157
|
+
(results, [responseName, fieldNodes]) => {
|
|
158
|
+
const fieldPath = addPath(path, responseName, parentTypeName);
|
|
159
|
+
const result = executeField(
|
|
160
|
+
exeContext,
|
|
161
|
+
parentTypeName,
|
|
162
|
+
sourceValue,
|
|
163
|
+
fieldNodes,
|
|
164
|
+
fieldPath
|
|
165
|
+
);
|
|
166
|
+
if (result === void 0) {
|
|
135
167
|
return results;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
168
|
+
}
|
|
169
|
+
if (isPromise(result)) {
|
|
170
|
+
return result.then((resolvedResult) => {
|
|
171
|
+
results[responseName] = resolvedResult;
|
|
172
|
+
return results;
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
results[responseName] = result;
|
|
176
|
+
return results;
|
|
177
|
+
},
|
|
178
|
+
/* @__PURE__ */ Object.create(null)
|
|
179
|
+
);
|
|
141
180
|
}
|
|
142
181
|
function executeFields(exeContext, parentTypeName, sourceValue, path, fields) {
|
|
143
182
|
const results = /* @__PURE__ */ Object.create(null);
|
|
144
183
|
let containsPromise = false;
|
|
145
184
|
for (const [responseName, fieldNodes] of fields.entries()) {
|
|
146
185
|
const fieldPath = addPath(path, responseName, parentTypeName);
|
|
147
|
-
const result = executeField(
|
|
186
|
+
const result = executeField(
|
|
187
|
+
exeContext,
|
|
188
|
+
parentTypeName,
|
|
189
|
+
sourceValue,
|
|
190
|
+
fieldNodes,
|
|
191
|
+
fieldPath
|
|
192
|
+
);
|
|
148
193
|
if (result !== void 0) {
|
|
149
194
|
results[responseName] = result;
|
|
150
195
|
if (isPromise(result)) {
|
|
@@ -184,26 +229,62 @@ function executeField(exeContext, parentTypeName, source, fieldNodes, path) {
|
|
|
184
229
|
if (!resolveFn) {
|
|
185
230
|
resolveFn = exeContext.fieldResolver;
|
|
186
231
|
}
|
|
187
|
-
const info = buildResolveInfo(
|
|
232
|
+
const info = buildResolveInfo(
|
|
233
|
+
exeContext,
|
|
234
|
+
fieldName,
|
|
235
|
+
fieldNodes,
|
|
236
|
+
parentTypeName,
|
|
237
|
+
returnTypeName,
|
|
238
|
+
returnTypeNode,
|
|
239
|
+
path
|
|
240
|
+
);
|
|
188
241
|
try {
|
|
189
|
-
const args = getArgumentValues(
|
|
242
|
+
const args = getArgumentValues(
|
|
243
|
+
exeContext.resolvers,
|
|
244
|
+
fieldNodes[0],
|
|
245
|
+
exeContext.variableValues
|
|
246
|
+
);
|
|
190
247
|
const contextValue = exeContext.contextValue;
|
|
191
248
|
const result = resolveFn(source, args, contextValue, info);
|
|
192
249
|
let completed;
|
|
193
250
|
if (isPromise(result)) {
|
|
194
|
-
completed = result.then(
|
|
251
|
+
completed = result.then(
|
|
252
|
+
(resolved) => completeValue(
|
|
253
|
+
exeContext,
|
|
254
|
+
returnTypeNode,
|
|
255
|
+
fieldNodes,
|
|
256
|
+
info,
|
|
257
|
+
path,
|
|
258
|
+
resolved
|
|
259
|
+
)
|
|
260
|
+
);
|
|
195
261
|
} else {
|
|
196
|
-
completed = completeValue(
|
|
262
|
+
completed = completeValue(
|
|
263
|
+
exeContext,
|
|
264
|
+
returnTypeNode,
|
|
265
|
+
fieldNodes,
|
|
266
|
+
info,
|
|
267
|
+
path,
|
|
268
|
+
result
|
|
269
|
+
);
|
|
197
270
|
}
|
|
198
271
|
if (isPromise(completed)) {
|
|
199
272
|
return completed.then(void 0, (rawError) => {
|
|
200
|
-
const error = locatedError(
|
|
273
|
+
const error = locatedError(
|
|
274
|
+
rawError,
|
|
275
|
+
fieldNodes,
|
|
276
|
+
pathToArray(path)
|
|
277
|
+
);
|
|
201
278
|
return handleFieldError(error, returnTypeNode, exeContext);
|
|
202
279
|
});
|
|
203
280
|
}
|
|
204
281
|
return completed;
|
|
205
282
|
} catch (rawError) {
|
|
206
|
-
const error = locatedError(
|
|
283
|
+
const error = locatedError(
|
|
284
|
+
rawError,
|
|
285
|
+
fieldNodes,
|
|
286
|
+
pathToArray(path)
|
|
287
|
+
);
|
|
207
288
|
return handleFieldError(error, returnTypeNode, exeContext);
|
|
208
289
|
}
|
|
209
290
|
}
|
|
@@ -233,9 +314,18 @@ function completeValue(exeContext, returnTypeNode, fieldNodes, info, path, resul
|
|
|
233
314
|
throw result;
|
|
234
315
|
}
|
|
235
316
|
if (returnTypeNode.kind === Kind.NON_NULL_TYPE) {
|
|
236
|
-
const completed = completeValue(
|
|
317
|
+
const completed = completeValue(
|
|
318
|
+
exeContext,
|
|
319
|
+
returnTypeNode.type,
|
|
320
|
+
fieldNodes,
|
|
321
|
+
info,
|
|
322
|
+
path,
|
|
323
|
+
result
|
|
324
|
+
);
|
|
237
325
|
if (completed === null) {
|
|
238
|
-
throw new Error(
|
|
326
|
+
throw new Error(
|
|
327
|
+
`Cannot return null for non-nullable field ${info.parentTypeName}.${info.fieldName}.`
|
|
328
|
+
);
|
|
239
329
|
}
|
|
240
330
|
return completed;
|
|
241
331
|
}
|
|
@@ -243,7 +333,14 @@ function completeValue(exeContext, returnTypeNode, fieldNodes, info, path, resul
|
|
|
243
333
|
return null;
|
|
244
334
|
}
|
|
245
335
|
if (returnTypeNode.kind === Kind.LIST_TYPE) {
|
|
246
|
-
return completeListValue(
|
|
336
|
+
return completeListValue(
|
|
337
|
+
exeContext,
|
|
338
|
+
returnTypeNode.type,
|
|
339
|
+
fieldNodes,
|
|
340
|
+
info,
|
|
341
|
+
path,
|
|
342
|
+
result
|
|
343
|
+
);
|
|
247
344
|
}
|
|
248
345
|
const returnTypeName = returnTypeNode.name.value;
|
|
249
346
|
let returnType = exeContext.resolvers[returnTypeName];
|
|
@@ -256,16 +353,35 @@ function completeValue(exeContext, returnTypeNode, fieldNodes, info, path, resul
|
|
|
256
353
|
if (returnType instanceof GraphQLInputObjectType) {
|
|
257
354
|
}
|
|
258
355
|
if (isUnionResolverType(returnType) || isInterfaceResolverType(returnType)) {
|
|
259
|
-
return completeAbstractValue(
|
|
356
|
+
return completeAbstractValue(
|
|
357
|
+
exeContext,
|
|
358
|
+
returnType,
|
|
359
|
+
fieldNodes,
|
|
360
|
+
info,
|
|
361
|
+
path,
|
|
362
|
+
result
|
|
363
|
+
);
|
|
260
364
|
}
|
|
261
365
|
if (typeof returnType === "object") {
|
|
262
|
-
return completeObjectValue(
|
|
366
|
+
return completeObjectValue(
|
|
367
|
+
exeContext,
|
|
368
|
+
returnTypeName,
|
|
369
|
+
fieldNodes,
|
|
370
|
+
info,
|
|
371
|
+
path,
|
|
372
|
+
result
|
|
373
|
+
);
|
|
263
374
|
}
|
|
264
|
-
invariant(
|
|
375
|
+
invariant(
|
|
376
|
+
false,
|
|
377
|
+
"Cannot complete value of unexpected output type: " + inspect(returnType)
|
|
378
|
+
);
|
|
265
379
|
}
|
|
266
380
|
function completeListValue(exeContext, returnTypeNode, fieldNodes, info, path, result) {
|
|
267
381
|
if (!isIterableObject(result)) {
|
|
268
|
-
throw new GraphQLError(
|
|
382
|
+
throw new GraphQLError(
|
|
383
|
+
`Expected Iterable, but did not find one for field "${info.parentTypeName}.${info.fieldName}".`
|
|
384
|
+
);
|
|
269
385
|
}
|
|
270
386
|
let containsPromise = false;
|
|
271
387
|
const completedResults = Array.from(result, (item, index) => {
|
|
@@ -273,20 +389,44 @@ function completeListValue(exeContext, returnTypeNode, fieldNodes, info, path, r
|
|
|
273
389
|
try {
|
|
274
390
|
let completedItem;
|
|
275
391
|
if (isPromise(item)) {
|
|
276
|
-
completedItem = item.then(
|
|
392
|
+
completedItem = item.then(
|
|
393
|
+
(resolved) => completeValue(
|
|
394
|
+
exeContext,
|
|
395
|
+
returnTypeNode,
|
|
396
|
+
fieldNodes,
|
|
397
|
+
info,
|
|
398
|
+
itemPath,
|
|
399
|
+
resolved
|
|
400
|
+
)
|
|
401
|
+
);
|
|
277
402
|
} else {
|
|
278
|
-
completedItem = completeValue(
|
|
403
|
+
completedItem = completeValue(
|
|
404
|
+
exeContext,
|
|
405
|
+
returnTypeNode,
|
|
406
|
+
fieldNodes,
|
|
407
|
+
info,
|
|
408
|
+
itemPath,
|
|
409
|
+
item
|
|
410
|
+
);
|
|
279
411
|
}
|
|
280
412
|
if (isPromise(completedItem)) {
|
|
281
413
|
containsPromise = true;
|
|
282
414
|
return completedItem.then(void 0, (rawError) => {
|
|
283
|
-
const error = locatedError(
|
|
415
|
+
const error = locatedError(
|
|
416
|
+
rawError,
|
|
417
|
+
fieldNodes,
|
|
418
|
+
pathToArray(itemPath)
|
|
419
|
+
);
|
|
284
420
|
return handleFieldError(error, returnTypeNode, exeContext);
|
|
285
421
|
});
|
|
286
422
|
}
|
|
287
423
|
return completedItem;
|
|
288
424
|
} catch (rawError) {
|
|
289
|
-
const error = locatedError(
|
|
425
|
+
const error = locatedError(
|
|
426
|
+
rawError,
|
|
427
|
+
fieldNodes,
|
|
428
|
+
pathToArray(itemPath)
|
|
429
|
+
);
|
|
290
430
|
return handleFieldError(error, returnTypeNode, exeContext);
|
|
291
431
|
}
|
|
292
432
|
});
|
|
@@ -295,7 +435,9 @@ function completeListValue(exeContext, returnTypeNode, fieldNodes, info, path, r
|
|
|
295
435
|
function completeLeafValue(returnType, result) {
|
|
296
436
|
const serializedResult = returnType.serialize(result);
|
|
297
437
|
if (serializedResult === void 0) {
|
|
298
|
-
throw new Error(
|
|
438
|
+
throw new Error(
|
|
439
|
+
`Expected a value of type "${inspect(returnType)}" but received: ${inspect(result)}`
|
|
440
|
+
);
|
|
299
441
|
}
|
|
300
442
|
return serializedResult;
|
|
301
443
|
}
|
|
@@ -305,19 +447,43 @@ function completeAbstractValue(exeContext, returnType, fieldNodes, info, path, r
|
|
|
305
447
|
const contextValue = exeContext.contextValue;
|
|
306
448
|
const runtimeTypeName = resolveTypeFn(result, contextValue, info);
|
|
307
449
|
if (isPromise(runtimeTypeName)) {
|
|
308
|
-
return runtimeTypeName.then(
|
|
450
|
+
return runtimeTypeName.then(
|
|
451
|
+
(resolvedRuntimeTypeName) => completeObjectValue(
|
|
452
|
+
exeContext,
|
|
453
|
+
ensureValidRuntimeType(resolvedRuntimeTypeName, exeContext),
|
|
454
|
+
fieldNodes,
|
|
455
|
+
info,
|
|
456
|
+
path,
|
|
457
|
+
result
|
|
458
|
+
)
|
|
459
|
+
);
|
|
309
460
|
}
|
|
310
|
-
return completeObjectValue(
|
|
461
|
+
return completeObjectValue(
|
|
462
|
+
exeContext,
|
|
463
|
+
ensureValidRuntimeType(runtimeTypeName, exeContext),
|
|
464
|
+
fieldNodes,
|
|
465
|
+
info,
|
|
466
|
+
path,
|
|
467
|
+
result
|
|
468
|
+
);
|
|
311
469
|
}
|
|
312
470
|
function ensureValidRuntimeType(runtimeTypeName, exeContext) {
|
|
313
471
|
if (typeof runtimeTypeName !== "string") {
|
|
314
|
-
throw new GraphQLError(
|
|
472
|
+
throw new GraphQLError(
|
|
473
|
+
`Could not determine runtime type for abstract type ${runtimeTypeName}`
|
|
474
|
+
);
|
|
315
475
|
}
|
|
316
476
|
const runtimeType = exeContext.resolvers[runtimeTypeName];
|
|
317
477
|
if (!runtimeType) {
|
|
318
|
-
throw new GraphQLError(
|
|
478
|
+
throw new GraphQLError(
|
|
479
|
+
`Type "${runtimeTypeName}" does not exist inside the schema.`
|
|
480
|
+
);
|
|
319
481
|
} else if (runtimeType instanceof GraphQLScalarType || runtimeType instanceof GraphQLEnumType || runtimeType instanceof GraphQLInputObjectType || runtimeType.__resolveType) {
|
|
320
|
-
throw new GraphQLError(
|
|
482
|
+
throw new GraphQLError(
|
|
483
|
+
`Given runtime object "${getRuntimeTypeInstanceName(
|
|
484
|
+
runtimeType
|
|
485
|
+
)}" type is not a possible type for "${runtimeTypeName}".`
|
|
486
|
+
);
|
|
321
487
|
} else {
|
|
322
488
|
return runtimeTypeName;
|
|
323
489
|
}
|
|
@@ -338,7 +504,11 @@ function getRuntimeTypeInstanceName(runtimeType) {
|
|
|
338
504
|
}
|
|
339
505
|
}
|
|
340
506
|
function completeObjectValue(exeContext, returnTypeName, fieldNodes, info, path, result) {
|
|
341
|
-
const subFieldNodes = collectSubfields(
|
|
507
|
+
const subFieldNodes = collectSubfields(
|
|
508
|
+
exeContext,
|
|
509
|
+
returnTypeName,
|
|
510
|
+
fieldNodes
|
|
511
|
+
);
|
|
342
512
|
return executeFields(exeContext, returnTypeName, result, path, subFieldNodes);
|
|
343
513
|
}
|
|
344
514
|
function collectSubfields(exeContext, returnTypeName, fieldNodes) {
|
|
@@ -346,7 +516,15 @@ function collectSubfields(exeContext, returnTypeName, fieldNodes) {
|
|
|
346
516
|
const visitedFragmentNames = /* @__PURE__ */ new Set();
|
|
347
517
|
for (const node of fieldNodes) {
|
|
348
518
|
if (node.selectionSet) {
|
|
349
|
-
subFieldNodes = collectFields(
|
|
519
|
+
subFieldNodes = collectFields(
|
|
520
|
+
exeContext.resolvers,
|
|
521
|
+
exeContext.fragments,
|
|
522
|
+
exeContext.variableValues,
|
|
523
|
+
returnTypeName,
|
|
524
|
+
node.selectionSet,
|
|
525
|
+
subFieldNodes,
|
|
526
|
+
visitedFragmentNames
|
|
527
|
+
);
|
|
350
528
|
}
|
|
351
529
|
}
|
|
352
530
|
return subFieldNodes;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -57,7 +58,9 @@ function extractImplicitTypes(document, getTypeByName) {
|
|
|
57
58
|
if (!implementedBy[node.name.value]) {
|
|
58
59
|
implementedBy[node.name.value] = [];
|
|
59
60
|
}
|
|
60
|
-
implementedBy[node.name.value].push(
|
|
61
|
+
implementedBy[node.name.value].push(
|
|
62
|
+
astNode.name.value
|
|
63
|
+
);
|
|
61
64
|
});
|
|
62
65
|
result[astNode.name.value] = {};
|
|
63
66
|
}
|
|
@@ -46,7 +46,9 @@ function extractImplicitTypes(document, getTypeByName) {
|
|
|
46
46
|
if (!implementedBy[node.name.value]) {
|
|
47
47
|
implementedBy[node.name.value] = [];
|
|
48
48
|
}
|
|
49
|
-
implementedBy[node.name.value].push(
|
|
49
|
+
implementedBy[node.name.value].push(
|
|
50
|
+
astNode.name.value
|
|
51
|
+
);
|
|
50
52
|
});
|
|
51
53
|
result[astNode.name.value] = {};
|
|
52
54
|
}
|
package/lib/index.js
CHANGED
package/lib/jsutils/Maybe.js
CHANGED
package/lib/jsutils/ObjMap.js
CHANGED
package/lib/jsutils/Path.js
CHANGED
package/lib/jsutils/devAssert.js
CHANGED
package/lib/jsutils/inspect.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -66,7 +67,9 @@ function formatObject(object, seenValues) {
|
|
|
66
67
|
if (seenValues.length > MAX_RECURSIVE_DEPTH) {
|
|
67
68
|
return "[" + getObjectTag(object) + "]";
|
|
68
69
|
}
|
|
69
|
-
const properties = entries.map(
|
|
70
|
+
const properties = entries.map(
|
|
71
|
+
([key, value]) => key + ": " + formatValue(value, seenValues)
|
|
72
|
+
);
|
|
70
73
|
return "{ " + properties.join(", ") + " }";
|
|
71
74
|
}
|
|
72
75
|
function formatArray(array, seenValues) {
|
package/lib/jsutils/inspect.mjs
CHANGED
|
@@ -45,7 +45,9 @@ function formatObject(object, seenValues) {
|
|
|
45
45
|
if (seenValues.length > MAX_RECURSIVE_DEPTH) {
|
|
46
46
|
return "[" + getObjectTag(object) + "]";
|
|
47
47
|
}
|
|
48
|
-
const properties = entries.map(
|
|
48
|
+
const properties = entries.map(
|
|
49
|
+
([key, value]) => key + ": " + formatValue(value, seenValues)
|
|
50
|
+
);
|
|
49
51
|
return "{ " + properties.join(", ") + " }";
|
|
50
52
|
}
|
|
51
53
|
function formatArray(array, seenValues) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -21,19 +22,29 @@ __export(instanceOf_exports, {
|
|
|
21
22
|
});
|
|
22
23
|
module.exports = __toCommonJS(instanceOf_exports);
|
|
23
24
|
var import_inspect = require("./inspect");
|
|
24
|
-
const instanceOf = false ?
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const instanceOf = false ? (
|
|
26
|
+
// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')
|
|
27
|
+
function instanceOf2(value, constructor) {
|
|
28
|
+
return value instanceof constructor;
|
|
29
|
+
}
|
|
30
|
+
) : function instanceOf3(value, constructor) {
|
|
27
31
|
var _a;
|
|
28
32
|
if (value instanceof constructor) {
|
|
29
33
|
return true;
|
|
30
34
|
}
|
|
31
35
|
if (typeof value === "object" && value !== null) {
|
|
32
36
|
const className = constructor.prototype[Symbol.toStringTag];
|
|
33
|
-
const valueClassName =
|
|
37
|
+
const valueClassName = (
|
|
38
|
+
// We still need to support constructor's name to detect conflicts with older versions of this library.
|
|
39
|
+
Symbol.toStringTag in value ? (
|
|
40
|
+
// @ts-expect-error TS bug see, https://github.com/microsoft/TypeScript/issues/38009
|
|
41
|
+
value[Symbol.toStringTag]
|
|
42
|
+
) : (_a = value.constructor) == null ? void 0 : _a.name
|
|
43
|
+
);
|
|
34
44
|
if (className === valueClassName) {
|
|
35
45
|
const stringifiedValue = (0, import_inspect.inspect)(value);
|
|
36
|
-
throw new Error(
|
|
46
|
+
throw new Error(
|
|
47
|
+
`Cannot use ${className} "${stringifiedValue}" from another module or realm.
|
|
37
48
|
|
|
38
49
|
Ensure that there is only one instance of "graphql" in the node_modules
|
|
39
50
|
directory. If different versions of "graphql" are the dependencies of other
|
|
@@ -44,7 +55,8 @@ https://yarnpkg.com/en/docs/selective-version-resolutions
|
|
|
44
55
|
Duplicate "graphql" modules cannot be used at the same time since different
|
|
45
56
|
versions may have different capabilities and behavior. The data from one
|
|
46
57
|
version used in the function from another could produce confusing and
|
|
47
|
-
spurious results.`
|
|
58
|
+
spurious results.`
|
|
59
|
+
);
|
|
48
60
|
}
|
|
49
61
|
}
|
|
50
62
|
return false;
|
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
// src/jsutils/instanceOf.ts
|
|
2
2
|
import { inspect } from "./inspect.mjs";
|
|
3
|
-
var instanceOf = false ?
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
var instanceOf = false ? (
|
|
4
|
+
// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')
|
|
5
|
+
function instanceOf2(value, constructor) {
|
|
6
|
+
return value instanceof constructor;
|
|
7
|
+
}
|
|
8
|
+
) : function instanceOf3(value, constructor) {
|
|
6
9
|
var _a;
|
|
7
10
|
if (value instanceof constructor) {
|
|
8
11
|
return true;
|
|
9
12
|
}
|
|
10
13
|
if (typeof value === "object" && value !== null) {
|
|
11
14
|
const className = constructor.prototype[Symbol.toStringTag];
|
|
12
|
-
const valueClassName =
|
|
15
|
+
const valueClassName = (
|
|
16
|
+
// We still need to support constructor's name to detect conflicts with older versions of this library.
|
|
17
|
+
Symbol.toStringTag in value ? (
|
|
18
|
+
// @ts-expect-error TS bug see, https://github.com/microsoft/TypeScript/issues/38009
|
|
19
|
+
value[Symbol.toStringTag]
|
|
20
|
+
) : (_a = value.constructor) == null ? void 0 : _a.name
|
|
21
|
+
);
|
|
13
22
|
if (className === valueClassName) {
|
|
14
23
|
const stringifiedValue = inspect(value);
|
|
15
|
-
throw new Error(
|
|
24
|
+
throw new Error(
|
|
25
|
+
`Cannot use ${className} "${stringifiedValue}" from another module or realm.
|
|
16
26
|
|
|
17
27
|
Ensure that there is only one instance of "graphql" in the node_modules
|
|
18
28
|
directory. If different versions of "graphql" are the dependencies of other
|
|
@@ -23,7 +33,8 @@ https://yarnpkg.com/en/docs/selective-version-resolutions
|
|
|
23
33
|
Duplicate "graphql" modules cannot be used at the same time since different
|
|
24
34
|
versions may have different capabilities and behavior. The data from one
|
|
25
35
|
version used in the function from another could produce confusing and
|
|
26
|
-
spurious results.`
|
|
36
|
+
spurious results.`
|
|
37
|
+
);
|
|
27
38
|
}
|
|
28
39
|
}
|
|
29
40
|
return false;
|
package/lib/jsutils/invariant.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -23,6 +24,8 @@ module.exports = __toCommonJS(invariant_exports);
|
|
|
23
24
|
function invariant(condition, message) {
|
|
24
25
|
const booleanCondition = Boolean(condition);
|
|
25
26
|
if (!booleanCondition) {
|
|
26
|
-
throw new Error(
|
|
27
|
+
throw new Error(
|
|
28
|
+
message != null ? message : "Unexpected invariant triggered."
|
|
29
|
+
);
|
|
27
30
|
}
|
|
28
31
|
}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
function invariant(condition, message) {
|
|
3
3
|
const booleanCondition = Boolean(condition);
|
|
4
4
|
if (!booleanCondition) {
|
|
5
|
-
throw new Error(
|
|
5
|
+
throw new Error(
|
|
6
|
+
message != null ? message : "Unexpected invariant triggered."
|
|
7
|
+
);
|
|
6
8
|
}
|
|
7
9
|
}
|
|
8
10
|
export {
|
package/lib/jsutils/isPromise.js
CHANGED