@graphitation/supermassive 3.0.0-alpha.6 → 3.0.0-alpha.8
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/CHANGELOG.md +18 -2
- package/README.md +137 -26
- package/lib/__testUtils__/execute.d.ts.map +1 -1
- package/lib/__testUtils__/execute.js +2 -5
- package/lib/__testUtils__/execute.js.map +2 -2
- package/lib/__testUtils__/execute.mjs +2 -5
- package/lib/__testUtils__/execute.mjs.map +2 -2
- package/lib/benchmarks/index.js.map +2 -2
- package/lib/benchmarks/index.mjs.map +2 -2
- package/lib/collectFields.d.ts.map +1 -1
- package/lib/collectFields.js +6 -5
- package/lib/collectFields.js.map +2 -2
- package/lib/collectFields.mjs +6 -5
- package/lib/collectFields.mjs.map +2 -2
- package/lib/executeWithSchema.d.ts +1 -1
- package/lib/executeWithSchema.d.ts.map +1 -1
- package/lib/executeWithSchema.js +9 -23
- package/lib/executeWithSchema.js.map +2 -2
- package/lib/executeWithSchema.mjs +9 -26
- package/lib/executeWithSchema.mjs.map +2 -2
- package/lib/executeWithoutSchema.d.ts +1 -3
- package/lib/executeWithoutSchema.d.ts.map +1 -1
- package/lib/executeWithoutSchema.js +154 -69
- package/lib/executeWithoutSchema.js.map +2 -2
- package/lib/executeWithoutSchema.mjs +144 -71
- package/lib/executeWithoutSchema.mjs.map +2 -2
- package/lib/index.d.ts +4 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -1
- package/lib/index.js.map +2 -2
- package/lib/index.mjs +10 -2
- package/lib/index.mjs.map +2 -2
- package/lib/schema/definition.d.ts +43 -33
- package/lib/schema/definition.d.ts.map +1 -1
- package/lib/schema/definition.js +284 -9
- package/lib/schema/definition.js.map +2 -2
- package/lib/schema/definition.mjs +284 -55
- package/lib/schema/definition.mjs.map +3 -3
- package/lib/schema/directives.d.ts.map +1 -1
- package/lib/schema/directives.js +3 -3
- package/lib/schema/directives.js.map +2 -2
- package/lib/schema/directives.mjs +4 -4
- package/lib/schema/directives.mjs.map +2 -2
- package/lib/schema/reference.d.ts +3 -1
- package/lib/schema/reference.d.ts.map +1 -1
- package/lib/schema/reference.js.map +2 -2
- package/lib/schema/reference.mjs.map +2 -2
- package/lib/schema/resolvers.d.ts +10 -4
- package/lib/schema/resolvers.d.ts.map +1 -1
- package/lib/schema/resolvers.js +92 -9
- package/lib/schema/resolvers.js.map +2 -2
- package/lib/schema/resolvers.mjs +99 -9
- package/lib/schema/resolvers.mjs.map +2 -2
- package/lib/subscribeWithSchema.d.ts +1 -1
- package/lib/subscribeWithSchema.d.ts.map +1 -1
- package/lib/subscribeWithSchema.js +9 -23
- package/lib/subscribeWithSchema.js.map +2 -2
- package/lib/subscribeWithSchema.mjs +9 -26
- package/lib/subscribeWithSchema.mjs.map +2 -2
- package/lib/types.d.ts +28 -9
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/utilities/coerceInputValue.d.ts +3 -3
- package/lib/utilities/coerceInputValue.d.ts.map +1 -1
- package/lib/utilities/coerceInputValue.js +17 -12
- package/lib/utilities/coerceInputValue.js.map +2 -2
- package/lib/utilities/coerceInputValue.mjs +22 -12
- package/lib/utilities/coerceInputValue.mjs.map +2 -2
- package/lib/utilities/decodeASTSchema.d.ts.map +1 -1
- package/lib/utilities/decodeASTSchema.js +32 -40
- package/lib/utilities/decodeASTSchema.js.map +2 -2
- package/lib/utilities/decodeASTSchema.mjs +51 -49
- package/lib/utilities/decodeASTSchema.mjs.map +2 -2
- package/lib/utilities/encodeASTSchema.d.ts.map +1 -1
- package/lib/utilities/encodeASTSchema.js +16 -20
- package/lib/utilities/encodeASTSchema.js.map +2 -2
- package/lib/utilities/encodeASTSchema.mjs +22 -21
- package/lib/utilities/encodeASTSchema.mjs.map +2 -2
- package/lib/utilities/extractMinimalViableSchemaForRequestDocument.d.ts.map +1 -1
- package/lib/utilities/extractMinimalViableSchemaForRequestDocument.js +20 -22
- package/lib/utilities/extractMinimalViableSchemaForRequestDocument.js.map +2 -2
- package/lib/utilities/extractMinimalViableSchemaForRequestDocument.mjs +35 -29
- package/lib/utilities/extractMinimalViableSchemaForRequestDocument.mjs.map +2 -2
- package/lib/utilities/mergeSchemaDefinitions.d.ts.map +1 -1
- package/lib/utilities/mergeSchemaDefinitions.js +18 -28
- package/lib/utilities/mergeSchemaDefinitions.js.map +2 -2
- package/lib/utilities/mergeSchemaDefinitions.mjs +28 -34
- package/lib/utilities/mergeSchemaDefinitions.mjs.map +2 -2
- package/lib/utilities/valueFromAST.d.ts +3 -3
- package/lib/utilities/valueFromAST.d.ts.map +1 -1
- package/lib/utilities/valueFromAST.js +23 -10
- package/lib/utilities/valueFromAST.js.map +2 -2
- package/lib/utilities/valueFromAST.mjs +13 -10
- package/lib/utilities/valueFromAST.mjs.map +2 -2
- package/lib/values.d.ts +2 -2
- package/lib/values.d.ts.map +1 -1
- package/lib/values.js +14 -14
- package/lib/values.js.map +2 -2
- package/lib/values.mjs +21 -14
- package/lib/values.mjs.map +2 -2
- package/package.json +1 -1
- package/lib/schema/fragment.d.ts +0 -63
- package/lib/schema/fragment.d.ts.map +0 -1
- package/lib/schema/fragment.js +0 -295
- package/lib/schema/fragment.js.map +0 -7
- package/lib/schema/fragment.mjs +0 -292
- package/lib/schema/fragment.mjs.map +0 -7
|
@@ -67,9 +67,6 @@ import { isAsyncIterable } from "./jsutils/isAsyncIterable.mjs";
|
|
|
67
67
|
import { mapAsyncIterator } from "./utilities/mapAsyncIterator.mjs";
|
|
68
68
|
import { GraphQLStreamDirective } from "./schema/directives.mjs";
|
|
69
69
|
import { memoize3 } from "./jsutils/memoize3.mjs";
|
|
70
|
-
import {
|
|
71
|
-
PartialSchema
|
|
72
|
-
} from "./schema/fragment.mjs";
|
|
73
70
|
import {
|
|
74
71
|
inspectTypeReference,
|
|
75
72
|
isListType,
|
|
@@ -77,12 +74,14 @@ import {
|
|
|
77
74
|
typeNameFromReference,
|
|
78
75
|
unwrap
|
|
79
76
|
} from "./schema/reference.mjs";
|
|
77
|
+
import * as Definitions from "./schema/definition.mjs";
|
|
78
|
+
import * as Resolvers from "./schema/resolvers.mjs";
|
|
80
79
|
var collectSubfields = memoize3(
|
|
81
80
|
(exeContext, returnTypeName, fieldGroup) => _collectSubfields(exeContext, returnTypeName.name, fieldGroup)
|
|
82
81
|
);
|
|
83
82
|
function executeWithoutSchema(args) {
|
|
84
83
|
const exeContext = buildExecutionContext(args);
|
|
85
|
-
if (!("
|
|
84
|
+
if (!("schemaFragment" in exeContext)) {
|
|
86
85
|
return { errors: exeContext };
|
|
87
86
|
} else {
|
|
88
87
|
return executeOperation(exeContext);
|
|
@@ -98,7 +97,6 @@ function assertValidExecutionArguments(document, rawVariableValues) {
|
|
|
98
97
|
function buildExecutionContext(args) {
|
|
99
98
|
var _a, _b;
|
|
100
99
|
const {
|
|
101
|
-
// resolvers,
|
|
102
100
|
schemaFragment,
|
|
103
101
|
schemaFragmentLoader,
|
|
104
102
|
document,
|
|
@@ -143,9 +141,8 @@ function buildExecutionContext(args) {
|
|
|
143
141
|
return [new GraphQLError("Must provide an operation.")];
|
|
144
142
|
}
|
|
145
143
|
const variableDefinitions = (_b = operation.variableDefinitions) != null ? _b : [];
|
|
146
|
-
const partialSchema = new PartialSchema(schemaFragment);
|
|
147
144
|
const coercedVariableValues = getVariableValues(
|
|
148
|
-
|
|
145
|
+
schemaFragment,
|
|
149
146
|
variableDefinitions,
|
|
150
147
|
variableValues != null ? variableValues : {},
|
|
151
148
|
{ maxErrors: 50 }
|
|
@@ -154,7 +151,6 @@ function buildExecutionContext(args) {
|
|
|
154
151
|
return coercedVariableValues.errors;
|
|
155
152
|
}
|
|
156
153
|
return {
|
|
157
|
-
partialSchema,
|
|
158
154
|
schemaFragment,
|
|
159
155
|
schemaFragmentLoader,
|
|
160
156
|
fragments,
|
|
@@ -318,8 +314,13 @@ function executeFields(exeContext, parentTypeName, sourceValue, path, groupedFie
|
|
|
318
314
|
return promiseForObject(results);
|
|
319
315
|
}
|
|
320
316
|
function executeField(exeContext, parentTypeName, source, fieldGroup, path, incrementalDataRecord) {
|
|
317
|
+
const schemaFragment = exeContext.schemaFragment;
|
|
321
318
|
const fieldName = fieldGroup[0].name.value;
|
|
322
|
-
const fieldDef =
|
|
319
|
+
const fieldDef = Definitions.getField(
|
|
320
|
+
schemaFragment.definitions,
|
|
321
|
+
parentTypeName,
|
|
322
|
+
fieldName
|
|
323
|
+
);
|
|
323
324
|
if (fieldDef !== void 0) {
|
|
324
325
|
return resolveAndCompleteField(
|
|
325
326
|
exeContext,
|
|
@@ -331,30 +332,51 @@ function executeField(exeContext, parentTypeName, source, fieldGroup, path, incr
|
|
|
331
332
|
incrementalDataRecord
|
|
332
333
|
);
|
|
333
334
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
}
|
|
337
|
-
return exeContext.schemaFragmentLoader(exeContext.schemaFragment, exeContext.contextValue, {
|
|
338
|
-
kind: "byField",
|
|
335
|
+
const loading = requestSchemaFragment(exeContext, {
|
|
336
|
+
kind: "ReturnType",
|
|
339
337
|
parentTypeName,
|
|
340
338
|
fieldName
|
|
341
|
-
})
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
339
|
+
});
|
|
340
|
+
if (!loading) {
|
|
341
|
+
return void 0;
|
|
342
|
+
}
|
|
343
|
+
return loading.then(() => {
|
|
344
|
+
const fieldDef2 = Definitions.getField(
|
|
345
|
+
exeContext.schemaFragment.definitions,
|
|
346
346
|
parentTypeName,
|
|
347
347
|
fieldName
|
|
348
348
|
);
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
349
|
+
if (fieldDef2 !== void 0) {
|
|
350
|
+
return resolveAndCompleteField(
|
|
351
|
+
exeContext,
|
|
352
|
+
parentTypeName,
|
|
353
|
+
fieldDef2,
|
|
354
|
+
fieldGroup,
|
|
355
|
+
path,
|
|
356
|
+
source,
|
|
357
|
+
incrementalDataRecord
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
return void 0;
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
function requestSchemaFragment(exeContext, request) {
|
|
364
|
+
if (!exeContext.schemaFragmentLoader) {
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
const currentSchemaId = exeContext.schemaFragment.schemaId;
|
|
368
|
+
return exeContext.schemaFragmentLoader(
|
|
369
|
+
exeContext.schemaFragment,
|
|
370
|
+
exeContext.contextValue,
|
|
371
|
+
request
|
|
372
|
+
).then(({ mergedFragment, mergedContextValue }) => {
|
|
373
|
+
if (currentSchemaId !== mergedFragment.schemaId) {
|
|
374
|
+
throw new Error(
|
|
375
|
+
`Cannot use new schema fragment: old and new fragments describe different schemas: ${currentSchemaId} vs. ${mergedFragment.schemaId}`
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
exeContext.contextValue = mergedContextValue != null ? mergedContextValue : exeContext.contextValue;
|
|
379
|
+
exeContext.schemaFragment = mergedFragment;
|
|
358
380
|
});
|
|
359
381
|
}
|
|
360
382
|
function createSourceEventStream(exeContext) {
|
|
@@ -370,21 +392,29 @@ function createSourceEventStream(exeContext) {
|
|
|
370
392
|
}
|
|
371
393
|
function executeSubscriptionImpl(exeContext) {
|
|
372
394
|
var _a;
|
|
373
|
-
const { operation, rootValue,
|
|
395
|
+
const { operation, rootValue, schemaFragment } = exeContext;
|
|
374
396
|
const rootTypeName = getOperationRootTypeName(operation);
|
|
375
397
|
const { groupedFieldSet } = collectFields(exeContext, rootTypeName);
|
|
376
398
|
const firstRootField = groupedFieldSet.entries().next().value;
|
|
377
399
|
const [responseName, fieldGroup] = firstRootField;
|
|
378
400
|
const fieldName = fieldGroup[0].name.value;
|
|
379
|
-
const fieldDef =
|
|
401
|
+
const fieldDef = Definitions.getField(
|
|
402
|
+
schemaFragment.definitions,
|
|
403
|
+
rootTypeName,
|
|
404
|
+
fieldName
|
|
405
|
+
);
|
|
380
406
|
if (!fieldDef) {
|
|
381
407
|
throw new GraphQLError(
|
|
382
408
|
`The subscription field "${fieldName}" is not defined.`,
|
|
383
409
|
{ nodes: fieldGroup }
|
|
384
410
|
);
|
|
385
411
|
}
|
|
386
|
-
const returnTypeRef =
|
|
387
|
-
const resolveFn = (_a =
|
|
412
|
+
const returnTypeRef = Definitions.getFieldTypeReference(fieldDef);
|
|
413
|
+
const resolveFn = (_a = Resolvers.getSubscriptionFieldResolver(
|
|
414
|
+
schemaFragment,
|
|
415
|
+
rootTypeName,
|
|
416
|
+
fieldName
|
|
417
|
+
)) != null ? _a : exeContext.subscribeFieldResolver;
|
|
388
418
|
const path = addPath(void 0, responseName, rootTypeName);
|
|
389
419
|
const info = buildResolveInfo(
|
|
390
420
|
exeContext,
|
|
@@ -478,8 +508,12 @@ function handleFieldError(rawError, exeContext, returnTypeRef, fieldGroup, path,
|
|
|
478
508
|
function resolveAndCompleteField(exeContext, parentTypeName, fieldDefinition, fieldGroup, path, source, incrementalDataRecord) {
|
|
479
509
|
var _a;
|
|
480
510
|
const fieldName = fieldGroup[0].name.value;
|
|
481
|
-
const returnTypeRef =
|
|
482
|
-
const resolveFn = (_a =
|
|
511
|
+
const returnTypeRef = Definitions.getFieldTypeReference(fieldDefinition);
|
|
512
|
+
const resolveFn = (_a = Resolvers.getFieldResolver(
|
|
513
|
+
exeContext.schemaFragment,
|
|
514
|
+
parentTypeName,
|
|
515
|
+
fieldName
|
|
516
|
+
)) != null ? _a : exeContext.fieldResolver;
|
|
483
517
|
const info = buildResolveInfo(
|
|
484
518
|
exeContext,
|
|
485
519
|
fieldName,
|
|
@@ -619,13 +653,13 @@ function completeValue(exeContext, returnTypeRef, fieldGroup, info, path, result
|
|
|
619
653
|
incrementalDataRecord
|
|
620
654
|
);
|
|
621
655
|
}
|
|
622
|
-
const
|
|
656
|
+
const { schemaFragment } = exeContext;
|
|
623
657
|
const returnTypeName = typeNameFromReference(returnTypeRef);
|
|
624
|
-
const leafType =
|
|
658
|
+
const leafType = Resolvers.getLeafTypeResolver(schemaFragment, returnTypeRef);
|
|
625
659
|
if (leafType) {
|
|
626
660
|
return completeLeafValue(leafType, result);
|
|
627
661
|
}
|
|
628
|
-
if (
|
|
662
|
+
if (Definitions.isAbstractType(schemaFragment.definitions, returnTypeRef)) {
|
|
629
663
|
return completeAbstractValue(
|
|
630
664
|
exeContext,
|
|
631
665
|
returnTypeName,
|
|
@@ -636,7 +670,7 @@ function completeValue(exeContext, returnTypeRef, fieldGroup, info, path, result
|
|
|
636
670
|
incrementalDataRecord
|
|
637
671
|
);
|
|
638
672
|
}
|
|
639
|
-
if (
|
|
673
|
+
if (Definitions.isObjectType(schemaFragment.definitions, returnTypeRef)) {
|
|
640
674
|
return completeObjectValue(
|
|
641
675
|
exeContext,
|
|
642
676
|
returnTypeName,
|
|
@@ -887,21 +921,32 @@ function completeLeafValue(returnType, result) {
|
|
|
887
921
|
}
|
|
888
922
|
function completeAbstractValue(exeContext, returnTypeName, fieldGroup, info, path, result, incrementalDataRecord) {
|
|
889
923
|
var _a;
|
|
890
|
-
const
|
|
924
|
+
const { schemaFragment } = exeContext;
|
|
925
|
+
const resolveTypeFn = (_a = Resolvers.getAbstractTypeResolver(schemaFragment, returnTypeName)) != null ? _a : exeContext.typeResolver;
|
|
891
926
|
const contextValue = exeContext.contextValue;
|
|
892
927
|
const runtimeTypeName = resolveTypeFn(result, contextValue, info);
|
|
893
|
-
|
|
894
|
-
|
|
928
|
+
const validatedRuntimeTypeName = isPromise(runtimeTypeName) ? runtimeTypeName.then(
|
|
929
|
+
(resolvedRuntimeTypeName) => ensureValidRuntimeType(
|
|
930
|
+
resolvedRuntimeTypeName,
|
|
931
|
+
exeContext,
|
|
932
|
+
returnTypeName,
|
|
933
|
+
fieldGroup,
|
|
934
|
+
info,
|
|
935
|
+
result
|
|
936
|
+
)
|
|
937
|
+
) : ensureValidRuntimeType(
|
|
938
|
+
runtimeTypeName,
|
|
939
|
+
exeContext,
|
|
940
|
+
returnTypeName,
|
|
941
|
+
fieldGroup,
|
|
942
|
+
info,
|
|
943
|
+
result
|
|
944
|
+
);
|
|
945
|
+
if (isPromise(validatedRuntimeTypeName)) {
|
|
946
|
+
return validatedRuntimeTypeName.then(
|
|
895
947
|
(resolvedRuntimeTypeName) => completeObjectValue(
|
|
896
948
|
exeContext,
|
|
897
|
-
|
|
898
|
-
resolvedRuntimeTypeName,
|
|
899
|
-
exeContext,
|
|
900
|
-
returnTypeName,
|
|
901
|
-
fieldGroup,
|
|
902
|
-
info,
|
|
903
|
-
result
|
|
904
|
-
),
|
|
949
|
+
resolvedRuntimeTypeName,
|
|
905
950
|
fieldGroup,
|
|
906
951
|
path,
|
|
907
952
|
result,
|
|
@@ -911,14 +956,7 @@ function completeAbstractValue(exeContext, returnTypeName, fieldGroup, info, pat
|
|
|
911
956
|
}
|
|
912
957
|
return completeObjectValue(
|
|
913
958
|
exeContext,
|
|
914
|
-
|
|
915
|
-
runtimeTypeName,
|
|
916
|
-
exeContext,
|
|
917
|
-
returnTypeName,
|
|
918
|
-
fieldGroup,
|
|
919
|
-
info,
|
|
920
|
-
result
|
|
921
|
-
),
|
|
959
|
+
validatedRuntimeTypeName,
|
|
922
960
|
fieldGroup,
|
|
923
961
|
path,
|
|
924
962
|
result,
|
|
@@ -937,37 +975,72 @@ function ensureValidRuntimeType(runtimeTypeName, exeContext, returnTypeName, fie
|
|
|
937
975
|
`Abstract type "${returnTypeName}" must resolve to an Object type at runtime for field "${info.returnTypeName}.${info.fieldName}" with value ${inspect(result)}, received "${inspect(runtimeTypeName)}".`
|
|
938
976
|
);
|
|
939
977
|
}
|
|
940
|
-
const
|
|
941
|
-
const
|
|
942
|
-
|
|
943
|
-
|
|
978
|
+
const strictInterfaceValidation = !!exeContext.schemaFragmentLoader;
|
|
979
|
+
const isDefinedType = Definitions.isDefined(
|
|
980
|
+
exeContext.schemaFragment.definitions,
|
|
981
|
+
runtimeTypeName
|
|
982
|
+
);
|
|
983
|
+
const loading = !isDefinedType ? requestSchemaFragment(exeContext, {
|
|
984
|
+
kind: "RuntimeType",
|
|
985
|
+
abstractTypeName: returnTypeName,
|
|
986
|
+
runtimeTypeName
|
|
987
|
+
}) : void 0;
|
|
988
|
+
return loading ? loading.then(
|
|
989
|
+
() => ensureValidRuntimeTypeImpl(
|
|
990
|
+
runtimeTypeName,
|
|
991
|
+
exeContext,
|
|
992
|
+
returnTypeName,
|
|
993
|
+
fieldGroup,
|
|
994
|
+
strictInterfaceValidation
|
|
995
|
+
)
|
|
996
|
+
) : ensureValidRuntimeTypeImpl(
|
|
997
|
+
runtimeTypeName,
|
|
998
|
+
exeContext,
|
|
999
|
+
returnTypeName,
|
|
1000
|
+
fieldGroup,
|
|
1001
|
+
strictInterfaceValidation
|
|
1002
|
+
);
|
|
1003
|
+
}
|
|
1004
|
+
function ensureValidRuntimeTypeImpl(runtimeTypeName, exeContext, returnTypeName, fieldGroup, strictInterfaceValidation) {
|
|
1005
|
+
const definitions = exeContext.schemaFragment.definitions;
|
|
1006
|
+
const union = Definitions.getUnionType(definitions, returnTypeName);
|
|
1007
|
+
if (union || strictInterfaceValidation) {
|
|
1008
|
+
if (!Definitions.isDefined(definitions, runtimeTypeName)) {
|
|
944
1009
|
throw new GraphQLError(
|
|
945
|
-
`Abstract type "${returnTypeName}" was resolved to a
|
|
1010
|
+
`Abstract type "${returnTypeName}" was resolved to a type "${runtimeTypeName}" that does not exist inside the schema.`,
|
|
946
1011
|
{ nodes: fieldGroup }
|
|
947
1012
|
);
|
|
948
1013
|
}
|
|
949
|
-
|
|
950
|
-
} else {
|
|
951
|
-
if (!partialSchema.isDefined(runtimeTypeName)) {
|
|
1014
|
+
if (!Definitions.isObjectType(definitions, runtimeTypeName)) {
|
|
952
1015
|
throw new GraphQLError(
|
|
953
|
-
`Abstract type "${returnTypeName}" was resolved to a type "${runtimeTypeName}"
|
|
1016
|
+
`Abstract type "${returnTypeName}" was resolved to a non-object type "${runtimeTypeName}".`,
|
|
954
1017
|
{ nodes: fieldGroup }
|
|
955
1018
|
);
|
|
956
1019
|
}
|
|
957
|
-
if (!
|
|
1020
|
+
if (!Definitions.isSubType(definitions, returnTypeName, runtimeTypeName)) {
|
|
958
1021
|
throw new GraphQLError(
|
|
959
|
-
`
|
|
1022
|
+
`Runtime Object type "${runtimeTypeName}" is not a possible type for "${returnTypeName}".`,
|
|
960
1023
|
{ nodes: fieldGroup }
|
|
961
1024
|
);
|
|
962
1025
|
}
|
|
963
|
-
|
|
1026
|
+
return runtimeTypeName;
|
|
1027
|
+
}
|
|
1028
|
+
const iface = Definitions.getInterfaceType(definitions, returnTypeName);
|
|
1029
|
+
if (iface) {
|
|
1030
|
+
if (Definitions.isDefined(definitions, runtimeTypeName) && !Definitions.isObjectType(definitions, runtimeTypeName)) {
|
|
964
1031
|
throw new GraphQLError(
|
|
965
|
-
`
|
|
1032
|
+
`Abstract type "${returnTypeName}" was resolved to a non-object type "${runtimeTypeName}".`,
|
|
966
1033
|
{ nodes: fieldGroup }
|
|
967
1034
|
);
|
|
968
1035
|
}
|
|
1036
|
+
Definitions.addInterfaceImplementation(
|
|
1037
|
+
definitions,
|
|
1038
|
+
returnTypeName,
|
|
1039
|
+
runtimeTypeName
|
|
1040
|
+
);
|
|
1041
|
+
return runtimeTypeName;
|
|
969
1042
|
}
|
|
970
|
-
|
|
1043
|
+
invariant(false, `${returnTypeName} is not an abstract type`);
|
|
971
1044
|
}
|
|
972
1045
|
function completeObjectValue(exeContext, returnTypeName, fieldGroup, path, result, incrementalDataRecord) {
|
|
973
1046
|
return collectAndExecuteSubfields(
|