@graphitation/supermassive 3.0.0-alpha.1 → 3.0.0-alpha.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.
Files changed (193) hide show
  1. package/.eslintcache +1 -1
  2. package/CHANGELOG.md +10 -2
  3. package/lib/__testUtils__/execute.d.ts +13 -0
  4. package/lib/__testUtils__/execute.d.ts.map +1 -0
  5. package/lib/__testUtils__/execute.js +196 -0
  6. package/lib/__testUtils__/execute.js.map +7 -0
  7. package/lib/__testUtils__/execute.mjs +174 -0
  8. package/lib/__testUtils__/execute.mjs.map +7 -0
  9. package/lib/benchmarks/index.js +10 -19
  10. package/lib/benchmarks/index.js.map +3 -3
  11. package/lib/benchmarks/index.mjs +11 -22
  12. package/lib/benchmarks/index.mjs.map +2 -2
  13. package/lib/collectFields.d.ts +4 -9
  14. package/lib/collectFields.d.ts.map +1 -1
  15. package/lib/collectFields.js +38 -99
  16. package/lib/collectFields.js.map +2 -2
  17. package/lib/collectFields.mjs +41 -100
  18. package/lib/collectFields.mjs.map +2 -2
  19. package/lib/executeWithSchema.d.ts +1 -1
  20. package/lib/executeWithSchema.d.ts.map +1 -1
  21. package/lib/executeWithSchema.js +7 -13
  22. package/lib/executeWithSchema.js.map +2 -2
  23. package/lib/executeWithSchema.mjs +9 -20
  24. package/lib/executeWithSchema.mjs.map +2 -2
  25. package/lib/executeWithoutSchema.d.ts +5 -5
  26. package/lib/executeWithoutSchema.d.ts.map +1 -1
  27. package/lib/executeWithoutSchema.js +175 -227
  28. package/lib/executeWithoutSchema.js.map +2 -2
  29. package/lib/executeWithoutSchema.mjs +176 -228
  30. package/lib/executeWithoutSchema.mjs.map +2 -2
  31. package/lib/index.d.ts +2 -9
  32. package/lib/index.d.ts.map +1 -1
  33. package/lib/index.js +0 -7
  34. package/lib/index.js.map +2 -2
  35. package/lib/index.mjs +0 -10
  36. package/lib/index.mjs.map +2 -2
  37. package/lib/schema/definition.d.ts +95 -0
  38. package/lib/schema/definition.d.ts.map +1 -0
  39. package/lib/schema/definition.js +77 -0
  40. package/lib/schema/definition.js.map +7 -0
  41. package/lib/schema/definition.mjs +58 -0
  42. package/lib/schema/definition.mjs.map +7 -0
  43. package/lib/schema/directives.d.ts +41 -0
  44. package/lib/schema/directives.d.ts.map +1 -0
  45. package/lib/schema/directives.js +82 -0
  46. package/lib/schema/directives.js.map +7 -0
  47. package/lib/schema/directives.mjs +65 -0
  48. package/lib/schema/directives.mjs.map +7 -0
  49. package/lib/schema/fragment.d.ts +41 -0
  50. package/lib/schema/fragment.d.ts.map +1 -0
  51. package/lib/schema/fragment.js +270 -0
  52. package/lib/schema/fragment.js.map +7 -0
  53. package/lib/schema/fragment.mjs +267 -0
  54. package/lib/schema/fragment.mjs.map +7 -0
  55. package/lib/schema/reference.d.ts +12 -0
  56. package/lib/schema/reference.d.ts.map +1 -0
  57. package/lib/schema/reference.js +137 -0
  58. package/lib/schema/reference.js.map +7 -0
  59. package/lib/schema/reference.mjs +118 -0
  60. package/lib/schema/reference.mjs.map +7 -0
  61. package/lib/schema/resolvers.d.ts +9 -0
  62. package/lib/schema/resolvers.d.ts.map +1 -0
  63. package/lib/schema/resolvers.js +47 -0
  64. package/lib/schema/resolvers.js.map +7 -0
  65. package/lib/schema/resolvers.mjs +35 -0
  66. package/lib/schema/resolvers.mjs.map +7 -0
  67. package/lib/subscribeWithSchema.d.ts +1 -1
  68. package/lib/subscribeWithSchema.d.ts.map +1 -1
  69. package/lib/subscribeWithSchema.js +7 -13
  70. package/lib/subscribeWithSchema.js.map +2 -2
  71. package/lib/subscribeWithSchema.mjs +9 -20
  72. package/lib/subscribeWithSchema.mjs.map +2 -2
  73. package/lib/types.d.ts +10 -24
  74. package/lib/types.d.ts.map +1 -1
  75. package/lib/types.js.map +2 -2
  76. package/lib/types.mjs.map +2 -2
  77. package/lib/utilities/addMinimalViableSchemaToRequestDocument.d.ts +9 -0
  78. package/lib/utilities/addMinimalViableSchemaToRequestDocument.d.ts.map +1 -0
  79. package/lib/utilities/addMinimalViableSchemaToRequestDocument.js +303 -0
  80. package/lib/utilities/addMinimalViableSchemaToRequestDocument.js.map +7 -0
  81. package/lib/utilities/addMinimalViableSchemaToRequestDocument.mjs +317 -0
  82. package/lib/utilities/addMinimalViableSchemaToRequestDocument.mjs.map +7 -0
  83. package/lib/{supermassive-ast → utilities}/annotateDocumentGraphQLTransform.d.ts +1 -1
  84. package/lib/utilities/annotateDocumentGraphQLTransform.d.ts.map +1 -0
  85. package/lib/{supermassive-ast → utilities}/annotateDocumentGraphQLTransform.js +3 -3
  86. package/lib/utilities/annotateDocumentGraphQLTransform.js.map +7 -0
  87. package/lib/utilities/annotateDocumentGraphQLTransform.mjs +17 -0
  88. package/lib/utilities/annotateDocumentGraphQLTransform.mjs.map +7 -0
  89. package/lib/utilities/coerceInputValue.d.ts +10 -0
  90. package/lib/utilities/coerceInputValue.d.ts.map +1 -0
  91. package/lib/utilities/coerceInputValue.js +181 -0
  92. package/lib/utilities/coerceInputValue.js.map +7 -0
  93. package/lib/utilities/coerceInputValue.mjs +167 -0
  94. package/lib/utilities/coerceInputValue.mjs.map +7 -0
  95. package/lib/utilities/decodeASTSchema.d.ts +7 -0
  96. package/lib/utilities/decodeASTSchema.d.ts.map +1 -0
  97. package/lib/utilities/decodeASTSchema.js +243 -0
  98. package/lib/utilities/decodeASTSchema.js.map +7 -0
  99. package/lib/utilities/decodeASTSchema.mjs +242 -0
  100. package/lib/utilities/decodeASTSchema.mjs.map +7 -0
  101. package/lib/utilities/encodeASTSchema.d.ts +4 -0
  102. package/lib/utilities/encodeASTSchema.d.ts.map +1 -0
  103. package/lib/utilities/encodeASTSchema.js +122 -0
  104. package/lib/utilities/encodeASTSchema.js.map +7 -0
  105. package/lib/utilities/encodeASTSchema.mjs +105 -0
  106. package/lib/utilities/encodeASTSchema.mjs.map +7 -0
  107. package/lib/utilities/getSchemaFragment.d.ts +4 -0
  108. package/lib/utilities/getSchemaFragment.d.ts.map +1 -0
  109. package/lib/utilities/getSchemaFragment.js +38 -0
  110. package/lib/utilities/getSchemaFragment.js.map +7 -0
  111. package/lib/utilities/getSchemaFragment.mjs +22 -0
  112. package/lib/utilities/getSchemaFragment.mjs.map +7 -0
  113. package/lib/utilities/makeReadableErrorPath.d.ts +3 -0
  114. package/lib/utilities/makeReadableErrorPath.d.ts.map +1 -0
  115. package/lib/utilities/makeReadableErrorPath.js +47 -0
  116. package/lib/utilities/makeReadableErrorPath.js.map +7 -0
  117. package/lib/utilities/makeReadableErrorPath.mjs +28 -0
  118. package/lib/utilities/makeReadableErrorPath.mjs.map +7 -0
  119. package/lib/utilities/mergeDefinitions.d.ts +8 -0
  120. package/lib/utilities/mergeDefinitions.d.ts.map +1 -0
  121. package/lib/utilities/mergeDefinitions.js +126 -0
  122. package/lib/utilities/mergeDefinitions.js.map +7 -0
  123. package/lib/utilities/mergeDefinitions.mjs +114 -0
  124. package/lib/utilities/mergeDefinitions.mjs.map +7 -0
  125. package/lib/utilities/typeNameFromAST.d.ts +1 -1
  126. package/lib/utilities/typeNameFromAST.d.ts.map +1 -1
  127. package/lib/utilities/typeNameFromAST.js.map +2 -2
  128. package/lib/utilities/typeNameFromAST.mjs.map +2 -2
  129. package/lib/utilities/valueFromAST.d.ts +27 -0
  130. package/lib/utilities/valueFromAST.d.ts.map +1 -0
  131. package/lib/utilities/valueFromAST.js +139 -0
  132. package/lib/utilities/valueFromAST.js.map +7 -0
  133. package/lib/utilities/valueFromAST.mjs +125 -0
  134. package/lib/utilities/valueFromAST.mjs.map +7 -0
  135. package/lib/utilities/valueFromASTUntyped.d.ts +21 -0
  136. package/lib/utilities/valueFromASTUntyped.d.ts.map +1 -0
  137. package/lib/utilities/valueFromASTUntyped.js +51 -0
  138. package/lib/utilities/valueFromASTUntyped.js.map +7 -0
  139. package/lib/utilities/valueFromASTUntyped.mjs +32 -0
  140. package/lib/utilities/valueFromASTUntyped.mjs.map +7 -0
  141. package/lib/values.d.ts +8 -12
  142. package/lib/values.d.ts.map +1 -1
  143. package/lib/values.js +75 -63
  144. package/lib/values.js.map +2 -2
  145. package/lib/values.mjs +77 -71
  146. package/lib/values.mjs.map +2 -2
  147. package/package.json +8 -6
  148. package/lib/definition.d.ts +0 -7
  149. package/lib/definition.d.ts.map +0 -1
  150. package/lib/definition.js +0 -59
  151. package/lib/definition.js.map +0 -7
  152. package/lib/definition.mjs +0 -40
  153. package/lib/definition.mjs.map +0 -7
  154. package/lib/directives.d.ts +0 -8
  155. package/lib/directives.d.ts.map +0 -1
  156. package/lib/directives.js +0 -47
  157. package/lib/directives.js.map +0 -7
  158. package/lib/directives.mjs +0 -37
  159. package/lib/directives.mjs.map +0 -7
  160. package/lib/extractImplicitTypesRuntime.d.ts +0 -4
  161. package/lib/extractImplicitTypesRuntime.d.ts.map +0 -1
  162. package/lib/extractImplicitTypesRuntime.js +0 -123
  163. package/lib/extractImplicitTypesRuntime.js.map +0 -7
  164. package/lib/extractImplicitTypesRuntime.mjs +0 -114
  165. package/lib/extractImplicitTypesRuntime.mjs.map +0 -7
  166. package/lib/supermassive-ast/TypedAST.d.ts +0 -370
  167. package/lib/supermassive-ast/TypedAST.d.ts.map +0 -1
  168. package/lib/supermassive-ast/TypedAST.js +0 -29
  169. package/lib/supermassive-ast/TypedAST.js.map +0 -7
  170. package/lib/supermassive-ast/TypedAST.mjs +0 -10
  171. package/lib/supermassive-ast/TypedAST.mjs.map +0 -7
  172. package/lib/supermassive-ast/addTypesToRequestDocument.d.ts +0 -56
  173. package/lib/supermassive-ast/addTypesToRequestDocument.d.ts.map +0 -1
  174. package/lib/supermassive-ast/addTypesToRequestDocument.js +0 -473
  175. package/lib/supermassive-ast/addTypesToRequestDocument.js.map +0 -7
  176. package/lib/supermassive-ast/addTypesToRequestDocument.mjs +0 -463
  177. package/lib/supermassive-ast/addTypesToRequestDocument.mjs.map +0 -7
  178. package/lib/supermassive-ast/annotateDocumentGraphQLTransform.d.ts.map +0 -1
  179. package/lib/supermassive-ast/annotateDocumentGraphQLTransform.js.map +0 -7
  180. package/lib/supermassive-ast/annotateDocumentGraphQLTransform.mjs +0 -17
  181. package/lib/supermassive-ast/annotateDocumentGraphQLTransform.mjs.map +0 -7
  182. package/lib/supermassive-ast/directives.d.ts +0 -36
  183. package/lib/supermassive-ast/directives.d.ts.map +0 -1
  184. package/lib/supermassive-ast/directives.js +0 -165
  185. package/lib/supermassive-ast/directives.js.map +0 -7
  186. package/lib/supermassive-ast/directives.mjs +0 -153
  187. package/lib/supermassive-ast/directives.mjs.map +0 -7
  188. package/lib/supermassive-ast/index.d.ts +0 -6
  189. package/lib/supermassive-ast/index.d.ts.map +0 -1
  190. package/lib/supermassive-ast/index.js +0 -37
  191. package/lib/supermassive-ast/index.js.map +0 -7
  192. package/lib/supermassive-ast/index.mjs +0 -27
  193. package/lib/supermassive-ast/index.mjs.map +0 -7
@@ -64,7 +64,6 @@ __export(executeWithoutSchema_exports, {
64
64
  });
65
65
  module.exports = __toCommonJS(executeWithoutSchema_exports);
66
66
  var import_graphql = require("graphql");
67
- var import_supermassive_ast = require("./supermassive-ast");
68
67
  var import_collectFields = require("./collectFields");
69
68
  var import_devAssert = require("./jsutils/devAssert");
70
69
  var import_inspect = require("./jsutils/inspect");
@@ -75,28 +74,22 @@ var import_isPromise = require("./jsutils/isPromise");
75
74
  var import_Path = require("./jsutils/Path");
76
75
  var import_promiseForObject = require("./jsutils/promiseForObject");
77
76
  var import_promiseReduce = require("./jsutils/promiseReduce");
78
- var import_definition = require("./definition");
79
- var import_mergeResolvers = require("./utilities/mergeResolvers");
80
- var import_typeNameFromAST = require("./utilities/typeNameFromAST");
81
77
  var import_values = require("./values");
82
78
  var import_array = require("./utilities/array");
83
79
  var import_isAsyncIterable = require("./jsutils/isAsyncIterable");
84
80
  var import_mapAsyncIterator = require("./utilities/mapAsyncIterator");
85
- var import_directives = require("./directives");
81
+ var import_directives = require("./schema/directives");
86
82
  var import_memoize3 = require("./jsutils/memoize3");
83
+ var import_fragment = require("./schema/fragment");
84
+ var import_reference = require("./schema/reference");
85
+ var import_getSchemaFragment = require("./utilities/getSchemaFragment");
86
+ var import_mergeDefinitions = require("./utilities/mergeDefinitions");
87
87
  const collectSubfields = (0, import_memoize3.memoize3)(
88
- (exeContext, returnTypeName, fieldGroup) => (0, import_collectFields.collectSubfields)(
89
- exeContext.resolvers,
90
- exeContext.fragments,
91
- exeContext.variableValues,
92
- exeContext.operation,
93
- returnTypeName.name,
94
- fieldGroup
95
- )
88
+ (exeContext, returnTypeName, fieldGroup) => (0, import_collectFields.collectSubfields)(exeContext, returnTypeName.name, fieldGroup)
96
89
  );
97
90
  function executeWithoutSchema(args) {
98
91
  const exeContext = buildExecutionContext(args);
99
- if (!("resolvers" in exeContext)) {
92
+ if (!("schemaTypes" in exeContext)) {
100
93
  return { errors: exeContext };
101
94
  } else {
102
95
  return executeOperation(exeContext);
@@ -113,7 +106,7 @@ function buildExecutionContext(args) {
113
106
  var _a, _b;
114
107
  const {
115
108
  resolvers,
116
- schemaResolvers,
109
+ schemaFragment: explicitSchemaFragment,
117
110
  document,
118
111
  rootValue,
119
112
  contextValue,
@@ -126,7 +119,6 @@ function buildExecutionContext(args) {
126
119
  fieldExecutionHooks
127
120
  } = args;
128
121
  assertValidExecutionArguments(document, variableValues);
129
- const combinedResolvers = schemaResolvers ? (0, import_mergeResolvers.mergeResolvers)(resolvers, schemaResolvers) : resolvers;
130
122
  let operation;
131
123
  const fragments = /* @__PURE__ */ Object.create(null);
132
124
  for (const definition of document.definitions) {
@@ -156,9 +148,24 @@ function buildExecutionContext(args) {
156
148
  }
157
149
  return [new import_graphql.GraphQLError("Must provide an operation.")];
158
150
  }
151
+ let schemaFragment = explicitSchemaFragment;
152
+ if (!schemaFragment) {
153
+ schemaFragment = (0, import_getSchemaFragment.getSchemaFragment)(operation);
154
+ if (schemaFragment && !schemaFragment.__merged) {
155
+ (0, import_mergeDefinitions.mergeSchemaDefinitions)(
156
+ schemaFragment,
157
+ Object.values(fragments).map((fragmentDef) => (0, import_getSchemaFragment.getSchemaFragment)(fragmentDef)).filter((f) => Boolean(f))
158
+ );
159
+ schemaFragment.__merged = true;
160
+ }
161
+ }
162
+ if (!schemaFragment) {
163
+ return [new import_graphql.GraphQLError("Must provide schema fragment.")];
164
+ }
159
165
  const variableDefinitions = (_b = operation.variableDefinitions) != null ? _b : [];
166
+ const schemaTypes = new import_fragment.SchemaFragment(schemaFragment, resolvers);
160
167
  const coercedVariableValues = (0, import_values.getVariableValues)(
161
- combinedResolvers,
168
+ schemaTypes,
162
169
  variableDefinitions,
163
170
  variableValues != null ? variableValues : {},
164
171
  { maxErrors: 50 }
@@ -167,7 +174,7 @@ function buildExecutionContext(args) {
167
174
  return coercedVariableValues.errors;
168
175
  }
169
176
  return {
170
- resolvers: combinedResolvers,
177
+ schemaTypes,
171
178
  fragments,
172
179
  rootValue,
173
180
  contextValue: buildContextValue ? buildContextValue(contextValue) : contextValue,
@@ -191,19 +198,13 @@ function buildPerEventExecutionContext(exeContext, payload) {
191
198
  });
192
199
  }
193
200
  function executeOperation(exeContext) {
194
- const { operation, rootValue, resolvers, fragments, variableValues } = exeContext;
201
+ const { operation, rootValue } = exeContext;
195
202
  const rootTypeName = getOperationRootTypeName(operation);
196
- const { groupedFieldSet, patches } = (0, import_collectFields.collectFields)(
197
- resolvers,
198
- fragments,
199
- variableValues,
200
- rootTypeName,
201
- operation
202
- );
203
+ const { groupedFieldSet, patches } = (0, import_collectFields.collectFields)(exeContext, rootTypeName);
203
204
  const path = void 0;
204
205
  let result;
205
206
  switch (operation.operation) {
206
- case import_supermassive_ast.OperationTypeNode.QUERY:
207
+ case import_graphql.OperationTypeNode.QUERY:
207
208
  result = executeFields(
208
209
  exeContext,
209
210
  rootTypeName,
@@ -214,7 +215,7 @@ function executeOperation(exeContext) {
214
215
  );
215
216
  result = buildResponse(exeContext, result);
216
217
  break;
217
- case import_supermassive_ast.OperationTypeNode.MUTATION:
218
+ case import_graphql.OperationTypeNode.MUTATION:
218
219
  result = executeFieldsSerially(
219
220
  exeContext,
220
221
  rootTypeName,
@@ -224,7 +225,7 @@ function executeOperation(exeContext) {
224
225
  );
225
226
  result = buildResponse(exeContext, result);
226
227
  break;
227
- case import_supermassive_ast.OperationTypeNode.SUBSCRIPTION: {
228
+ case import_graphql.OperationTypeNode.SUBSCRIPTION: {
228
229
  const resultOrStreamOrPromise = createSourceEventStream(exeContext);
229
230
  result = mapResultOrEventStreamOrPromise(
230
231
  resultOrStreamOrPromise,
@@ -329,52 +330,34 @@ function executeFields(exeContext, parentTypeName, sourceValue, path, groupedFie
329
330
  return (0, import_promiseForObject.promiseForObject)(results);
330
331
  }
331
332
  function executeField(exeContext, parentTypeName, source, fieldGroup, path, incrementalDataRecord) {
333
+ var _a;
334
+ const schemaTypes = exeContext.schemaTypes;
332
335
  const fieldName = fieldGroup[0].name.value;
333
- let resolveFn;
334
- let returnTypeName;
335
- let returnTypeNode;
336
- if (fieldName === "__typename" && !resolveFn) {
337
- resolveFn = () => parentTypeName;
338
- returnTypeName = "String";
339
- returnTypeNode = {
340
- kind: import_graphql.Kind.NAMED_TYPE,
341
- name: {
342
- kind: import_graphql.Kind.NAME,
343
- value: "String"
344
- }
345
- };
346
- } else {
347
- returnTypeNode = fieldGroup[0].__type;
348
- returnTypeName = (0, import_typeNameFromAST.typeNameFromAST)(returnTypeNode);
349
- const typeResolvers = exeContext.resolvers[parentTypeName];
350
- resolveFn = typeResolvers == null ? void 0 : typeResolvers[fieldName];
351
- if (typeof resolveFn !== "function" && resolveFn != null) {
352
- resolveFn = resolveFn.resolve;
353
- }
354
- }
355
- const isDefaultResolverUsed = !resolveFn;
356
- if (!resolveFn) {
357
- resolveFn = exeContext.fieldResolver;
336
+ const fieldDef = schemaTypes.getField(parentTypeName, fieldName);
337
+ if (fieldDef === void 0) {
338
+ return;
358
339
  }
340
+ const returnTypeRef = schemaTypes.getTypeReference(fieldDef);
341
+ const resolveFn = (_a = schemaTypes.getFieldResolver(parentTypeName, fieldName)) != null ? _a : exeContext.fieldResolver;
359
342
  const info = buildResolveInfo(
360
343
  exeContext,
361
344
  fieldName,
362
345
  fieldGroup,
363
346
  parentTypeName,
364
- returnTypeName,
365
- returnTypeNode,
347
+ (0, import_reference.typeNameFromReference)(returnTypeRef),
366
348
  path
367
349
  );
368
350
  return resolveAndCompleteField(
369
351
  exeContext,
370
- returnTypeNode,
352
+ parentTypeName,
353
+ returnTypeRef,
354
+ fieldDef,
371
355
  fieldGroup,
372
356
  info,
373
357
  path,
374
358
  resolveFn,
375
359
  source,
376
- incrementalDataRecord,
377
- isDefaultResolverUsed
360
+ incrementalDataRecord
378
361
  );
379
362
  }
380
363
  function createSourceEventStream(exeContext) {
@@ -389,71 +372,43 @@ function createSourceEventStream(exeContext) {
389
372
  }
390
373
  }
391
374
  function executeSubscriptionImpl(exeContext) {
392
- const { resolvers, fragments, operation, variableValues, rootValue } = exeContext;
393
- const typeName = getOperationRootTypeName(operation);
394
- const { groupedFieldSet } = (0, import_collectFields.collectFields)(
395
- resolvers,
396
- fragments,
397
- variableValues,
398
- typeName,
399
- operation
400
- );
375
+ var _a;
376
+ const { operation, rootValue, schemaTypes } = exeContext;
377
+ const rootTypeName = getOperationRootTypeName(operation);
378
+ const { groupedFieldSet } = (0, import_collectFields.collectFields)(exeContext, rootTypeName);
401
379
  const firstRootField = groupedFieldSet.entries().next().value;
402
380
  const [responseName, fieldGroup] = firstRootField;
403
381
  const fieldName = fieldGroup[0].name.value;
404
- let resolveFn;
405
- let returnTypeName;
406
- let returnTypeNode;
407
- if (fieldName === "__typename" && !resolveFn) {
408
- resolveFn = () => typeName;
409
- returnTypeName = "String";
410
- returnTypeNode = {
411
- kind: import_graphql.Kind.NAMED_TYPE,
412
- name: {
413
- kind: import_graphql.Kind.NAME,
414
- value: "String"
415
- }
416
- };
417
- } else {
418
- returnTypeNode = fieldGroup[0].__type;
419
- returnTypeName = (0, import_typeNameFromAST.typeNameFromAST)(returnTypeNode);
420
- const typeResolvers = exeContext.resolvers[typeName];
421
- const fieldResolver = typeResolvers == null ? void 0 : typeResolvers[fieldName];
422
- resolveFn = fieldResolver == null ? void 0 : fieldResolver.subscribe;
423
- }
424
- if (!resolveFn) {
425
- resolveFn = exeContext.subscribeFieldResolver;
382
+ const fieldDef = schemaTypes.getField(rootTypeName, fieldName);
383
+ if (!fieldDef) {
384
+ throw new import_graphql.GraphQLError(
385
+ `The subscription field "${fieldName}" is not defined.`,
386
+ { nodes: fieldGroup }
387
+ );
426
388
  }
427
- const path = (0, import_Path.addPath)(void 0, responseName, typeName);
389
+ const returnTypeRef = schemaTypes.getTypeReference(fieldDef);
390
+ const resolveFn = (_a = schemaTypes.getSubscriptionFieldResolver(rootTypeName, fieldName)) != null ? _a : exeContext.subscribeFieldResolver;
391
+ const path = (0, import_Path.addPath)(void 0, responseName, rootTypeName);
428
392
  const info = buildResolveInfo(
429
393
  exeContext,
430
394
  fieldName,
431
395
  fieldGroup,
432
- typeName,
433
- returnTypeName,
434
- returnTypeNode,
396
+ rootTypeName,
397
+ (0, import_reference.typeNameFromReference)(returnTypeRef),
435
398
  path
436
399
  );
437
400
  try {
438
- const args = (0, import_values.getArgumentValues)(resolvers, fieldGroup[0], variableValues);
401
+ const args = (0, import_values.getArgumentValues)(exeContext, fieldDef, fieldGroup[0]);
439
402
  const contextValue = exeContext.contextValue;
440
403
  const result = resolveFn(rootValue, args, contextValue, info);
441
404
  if ((0, import_isPromise.isPromise)(result)) {
442
405
  return result.then(assertEventStream).then(void 0, (error) => {
443
- throw (0, import_graphql.locatedError)(
444
- error,
445
- fieldGroup,
446
- (0, import_Path.pathToArray)(path)
447
- );
406
+ throw (0, import_graphql.locatedError)(error, fieldGroup, (0, import_Path.pathToArray)(path));
448
407
  });
449
408
  }
450
409
  return assertEventStream(result);
451
410
  } catch (error) {
452
- throw (0, import_graphql.locatedError)(
453
- error,
454
- fieldGroup,
455
- (0, import_Path.pathToArray)(path)
456
- );
411
+ throw (0, import_graphql.locatedError)(error, fieldGroup, (0, import_Path.pathToArray)(path));
457
412
  }
458
413
  }
459
414
  function assertEventStream(result) {
@@ -501,13 +456,12 @@ function mapResultOrEventStreamOrPromise(resultOrStreamOrPromise, exeContext, pa
501
456
  }
502
457
  }
503
458
  }
504
- function buildResolveInfo(exeContext, fieldName, fieldGroup, parentTypeName, returnTypeName, returnTypeNode, path) {
459
+ function buildResolveInfo(exeContext, fieldName, fieldGroup, parentTypeName, returnTypeName, path) {
505
460
  return {
506
461
  fieldName,
507
462
  fieldGroup,
508
463
  returnTypeName,
509
464
  parentTypeName,
510
- returnTypeNode,
511
465
  path,
512
466
  fragments: exeContext.fragments,
513
467
  rootValue: exeContext.rootValue,
@@ -515,27 +469,20 @@ function buildResolveInfo(exeContext, fieldName, fieldGroup, parentTypeName, ret
515
469
  variableValues: exeContext.variableValues
516
470
  };
517
471
  }
518
- function handleFieldError(rawError, exeContext, returnTypeNode, fieldGroup, path, incrementalDataRecord) {
472
+ function handleFieldError(rawError, exeContext, returnTypeRef, fieldGroup, path, incrementalDataRecord) {
519
473
  var _a;
520
- const error = (0, import_graphql.locatedError)(
521
- rawError,
522
- fieldGroup,
523
- (0, import_Path.pathToArray)(path)
524
- );
525
- if (returnTypeNode.kind === import_graphql.Kind.NON_NULL_TYPE) {
474
+ const error = (0, import_graphql.locatedError)(rawError, fieldGroup, (0, import_Path.pathToArray)(path));
475
+ if ((0, import_reference.isNonNullType)(returnTypeRef)) {
526
476
  throw error;
527
477
  }
528
478
  const errors = (_a = incrementalDataRecord == null ? void 0 : incrementalDataRecord.errors) != null ? _a : exeContext.errors;
529
479
  errors.push(error);
530
480
  }
531
- function resolveAndCompleteField(exeContext, returnTypeNode, fieldGroup, info, path, resolveFn, source, incrementalDataRecord, isDefaultResolverUsed) {
481
+ function resolveAndCompleteField(exeContext, parentTypeName, returnTypeRef, fieldDefinition, fieldGroup, info, path, resolveFn, source, incrementalDataRecord) {
482
+ const isDefaultResolverUsed = resolveFn === exeContext.fieldResolver;
532
483
  const hooks = exeContext.fieldExecutionHooks;
533
484
  try {
534
- const args = (0, import_values.getArgumentValues)(
535
- exeContext.resolvers,
536
- fieldGroup[0],
537
- exeContext.variableValues
538
- );
485
+ const args = (0, import_values.getArgumentValues)(exeContext, fieldDefinition, fieldGroup[0]);
539
486
  const contextValue = exeContext.contextValue;
540
487
  if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.beforeFieldResolve)) {
541
488
  invokeBeforeFieldResolveHook(info, exeContext);
@@ -550,7 +497,7 @@ function resolveAndCompleteField(exeContext, returnTypeNode, fieldGroup, info, p
550
497
  }
551
498
  return completeValue(
552
499
  exeContext,
553
- returnTypeNode,
500
+ returnTypeRef,
554
501
  fieldGroup,
555
502
  info,
556
503
  path,
@@ -571,7 +518,7 @@ function resolveAndCompleteField(exeContext, returnTypeNode, fieldGroup, info, p
571
518
  }
572
519
  completed = completeValue(
573
520
  exeContext,
574
- returnTypeNode,
521
+ returnTypeRef,
575
522
  fieldGroup,
576
523
  info,
577
524
  path,
@@ -588,18 +535,14 @@ function resolveAndCompleteField(exeContext, returnTypeNode, fieldGroup, info, p
588
535
  return resolved;
589
536
  },
590
537
  (rawError) => {
591
- const error = (0, import_graphql.locatedError)(
592
- rawError,
593
- fieldGroup,
594
- (0, import_Path.pathToArray)(path)
595
- );
538
+ const error = (0, import_graphql.locatedError)(rawError, fieldGroup, (0, import_Path.pathToArray)(path));
596
539
  if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldComplete)) {
597
540
  invokeAfterFieldCompleteHook(info, exeContext, void 0, error);
598
541
  }
599
542
  handleFieldError(
600
543
  rawError,
601
544
  exeContext,
602
- returnTypeNode,
545
+ returnTypeRef,
603
546
  fieldGroup,
604
547
  path,
605
548
  incrementalDataRecord
@@ -614,11 +557,7 @@ function resolveAndCompleteField(exeContext, returnTypeNode, fieldGroup, info, p
614
557
  return completed;
615
558
  } catch (rawError) {
616
559
  const pathArray = (0, import_Path.pathToArray)(path);
617
- const error = (0, import_graphql.locatedError)(
618
- rawError,
619
- fieldGroup,
620
- pathArray
621
- );
560
+ const error = (0, import_graphql.locatedError)(rawError, fieldGroup, pathArray);
622
561
  if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve) && error.path && (0, import_array.arraysAreEqual)(pathArray, error.path)) {
623
562
  invokeAfterFieldResolveHook(info, exeContext, void 0, error);
624
563
  }
@@ -628,7 +567,7 @@ function resolveAndCompleteField(exeContext, returnTypeNode, fieldGroup, info, p
628
567
  handleFieldError(
629
568
  rawError,
630
569
  exeContext,
631
- returnTypeNode,
570
+ returnTypeRef,
632
571
  fieldGroup,
633
572
  path,
634
573
  incrementalDataRecord
@@ -636,14 +575,14 @@ function resolveAndCompleteField(exeContext, returnTypeNode, fieldGroup, info, p
636
575
  return null;
637
576
  }
638
577
  }
639
- function completeValue(exeContext, returnTypeNode, fieldGroup, info, path, result, incrementalDataRecord) {
578
+ function completeValue(exeContext, returnTypeRef, fieldGroup, info, path, result, incrementalDataRecord) {
640
579
  if (result instanceof Error) {
641
580
  throw result;
642
581
  }
643
- if (returnTypeNode.kind === import_graphql.Kind.NON_NULL_TYPE) {
582
+ if ((0, import_reference.isNonNullType)(returnTypeRef)) {
644
583
  const completed = completeValue(
645
584
  exeContext,
646
- returnTypeNode.type,
585
+ (0, import_reference.unwrap)(returnTypeRef),
647
586
  fieldGroup,
648
587
  info,
649
588
  path,
@@ -660,10 +599,10 @@ function completeValue(exeContext, returnTypeNode, fieldGroup, info, path, resul
660
599
  if (result == null) {
661
600
  return null;
662
601
  }
663
- if (returnTypeNode.kind === import_graphql.Kind.LIST_TYPE) {
602
+ if ((0, import_reference.isListType)(returnTypeRef)) {
664
603
  return completeListValue(
665
604
  exeContext,
666
- returnTypeNode,
605
+ returnTypeRef,
667
606
  fieldGroup,
668
607
  info,
669
608
  path,
@@ -671,20 +610,16 @@ function completeValue(exeContext, returnTypeNode, fieldGroup, info, path, resul
671
610
  incrementalDataRecord
672
611
  );
673
612
  }
674
- const returnTypeName = returnTypeNode.name.value;
675
- let returnType = exeContext.resolvers[returnTypeName];
676
- if (!returnType) {
677
- returnType = import_values.specifiedScalars[returnTypeName];
678
- }
679
- if ((0, import_graphql.isLeafType)(returnType)) {
680
- return completeLeafValue(returnType, result);
613
+ const schemaTypes = exeContext.schemaTypes;
614
+ const returnTypeName = (0, import_reference.typeNameFromReference)(returnTypeRef);
615
+ const leafType = schemaTypes.getLeafTypeResolver(returnTypeRef);
616
+ if (leafType) {
617
+ return completeLeafValue(leafType, result);
681
618
  }
682
- if (returnType instanceof import_graphql.GraphQLInputObjectType) {
683
- }
684
- if ((0, import_definition.isUnionResolverType)(returnType) || (0, import_definition.isInterfaceResolverType)(returnType)) {
619
+ if (schemaTypes.isAbstractType(returnTypeRef)) {
685
620
  return completeAbstractValue(
686
621
  exeContext,
687
- returnType,
622
+ returnTypeName,
688
623
  fieldGroup,
689
624
  info,
690
625
  path,
@@ -692,7 +627,7 @@ function completeValue(exeContext, returnTypeNode, fieldGroup, info, path, resul
692
627
  incrementalDataRecord
693
628
  );
694
629
  }
695
- if (typeof returnType === "object") {
630
+ if (schemaTypes.isObjectType(returnTypeRef)) {
696
631
  return completeObjectValue(
697
632
  exeContext,
698
633
  returnTypeName,
@@ -704,16 +639,16 @@ function completeValue(exeContext, returnTypeNode, fieldGroup, info, path, resul
704
639
  }
705
640
  (0, import_invariant.invariant)(
706
641
  false,
707
- "Cannot complete value of unexpected output type: " + (0, import_inspect.inspect)(returnType)
642
+ "Cannot complete value of unexpected output type: " + (0, import_reference.inspectTypeReference)(returnTypeRef)
708
643
  );
709
644
  }
710
- function completePromisedValue(exeContext, returnTypeNode, fieldGroup, info, path, result, incrementalDataRecord) {
645
+ function completePromisedValue(exeContext, returnTypeRef, fieldGroup, info, path, result, incrementalDataRecord) {
711
646
  return __async(this, null, function* () {
712
647
  try {
713
648
  const resolved = yield result;
714
649
  let completed = completeValue(
715
650
  exeContext,
716
- returnTypeNode,
651
+ returnTypeRef,
717
652
  fieldGroup,
718
653
  info,
719
654
  path,
@@ -728,7 +663,7 @@ function completePromisedValue(exeContext, returnTypeNode, fieldGroup, info, pat
728
663
  handleFieldError(
729
664
  rawError,
730
665
  exeContext,
731
- returnTypeNode,
666
+ returnTypeRef,
732
667
  fieldGroup,
733
668
  path,
734
669
  incrementalDataRecord
@@ -738,13 +673,13 @@ function completePromisedValue(exeContext, returnTypeNode, fieldGroup, info, pat
738
673
  }
739
674
  });
740
675
  }
741
- function completeListValue(exeContext, returnTypeNode, fieldGroup, info, path, result, incrementalDataRecord) {
742
- const itemType = returnTypeNode.type;
676
+ function completeListValue(exeContext, returnTypeRef, fieldGroup, info, path, result, incrementalDataRecord) {
677
+ const itemTypeRef = (0, import_reference.unwrap)(returnTypeRef);
743
678
  if ((0, import_isAsyncIterable.isAsyncIterable)(result)) {
744
679
  const asyncIterator = result[Symbol.asyncIterator]();
745
680
  return completeAsyncIteratorValue(
746
681
  exeContext,
747
- itemType,
682
+ itemTypeRef,
748
683
  fieldGroup,
749
684
  info,
750
685
  path,
@@ -772,7 +707,7 @@ function completeListValue(exeContext, returnTypeNode, fieldGroup, info, path, r
772
707
  exeContext,
773
708
  fieldGroup,
774
709
  info,
775
- itemType,
710
+ itemTypeRef,
776
711
  stream.label,
777
712
  previousIncrementalDataRecord
778
713
  );
@@ -783,7 +718,7 @@ function completeListValue(exeContext, returnTypeNode, fieldGroup, info, path, r
783
718
  item,
784
719
  completedResults,
785
720
  exeContext,
786
- itemType,
721
+ itemTypeRef,
787
722
  fieldGroup,
788
723
  info,
789
724
  itemPath,
@@ -795,12 +730,12 @@ function completeListValue(exeContext, returnTypeNode, fieldGroup, info, path, r
795
730
  }
796
731
  return containsPromise ? Promise.all(completedResults) : completedResults;
797
732
  }
798
- function completeListItemValue(item, completedResults, exeContext, itemTypeNode, fieldGroup, info, itemPath, incrementalDataRecord) {
733
+ function completeListItemValue(item, completedResults, exeContext, itemTypeRef, fieldGroup, info, itemPath, incrementalDataRecord) {
799
734
  if ((0, import_isPromise.isPromise)(item)) {
800
735
  completedResults.push(
801
736
  completePromisedValue(
802
737
  exeContext,
803
- itemTypeNode,
738
+ itemTypeRef,
804
739
  fieldGroup,
805
740
  info,
806
741
  itemPath,
@@ -813,7 +748,7 @@ function completeListItemValue(item, completedResults, exeContext, itemTypeNode,
813
748
  try {
814
749
  const completedItem = completeValue(
815
750
  exeContext,
816
- itemTypeNode,
751
+ itemTypeRef,
817
752
  fieldGroup,
818
753
  info,
819
754
  itemPath,
@@ -826,7 +761,7 @@ function completeListItemValue(item, completedResults, exeContext, itemTypeNode,
826
761
  handleFieldError(
827
762
  rawError,
828
763
  exeContext,
829
- itemTypeNode,
764
+ itemTypeRef,
830
765
  fieldGroup,
831
766
  itemPath,
832
767
  incrementalDataRecord
@@ -842,7 +777,7 @@ function completeListItemValue(item, completedResults, exeContext, itemTypeNode,
842
777
  handleFieldError(
843
778
  rawError,
844
779
  exeContext,
845
- itemTypeNode,
780
+ itemTypeRef,
846
781
  fieldGroup,
847
782
  itemPath,
848
783
  incrementalDataRecord
@@ -857,10 +792,9 @@ function getStreamValues(exeContext, fieldGroup, path) {
857
792
  return;
858
793
  }
859
794
  const stream = (0, import_values.getDirectiveValues)(
795
+ exeContext,
860
796
  import_directives.GraphQLStreamDirective,
861
- fieldGroup[0],
862
- exeContext.resolvers,
863
- exeContext.variableValues
797
+ fieldGroup[0]
864
798
  );
865
799
  if (!stream) {
866
800
  return;
@@ -877,7 +811,7 @@ function getStreamValues(exeContext, fieldGroup, path) {
877
811
  "initialCount must be a positive integer"
878
812
  );
879
813
  (0, import_invariant.invariant)(
880
- exeContext.operation.operation !== import_supermassive_ast.OperationTypeNode.SUBSCRIPTION,
814
+ exeContext.operation.operation !== import_graphql.OperationTypeNode.SUBSCRIPTION,
881
815
  "`@stream` directive not supported on subscription operations. Disable `@stream` by setting the `if` argument to `false`."
882
816
  );
883
817
  return {
@@ -885,7 +819,7 @@ function getStreamValues(exeContext, fieldGroup, path) {
885
819
  label: typeof stream.label === "string" ? stream.label : void 0
886
820
  };
887
821
  }
888
- function completeAsyncIteratorValue(exeContext, itemType, fieldGroup, info, path, asyncIterator, incrementalDataRecord) {
822
+ function completeAsyncIteratorValue(exeContext, itemTypeRef, fieldGroup, info, path, asyncIterator, incrementalDataRecord) {
889
823
  return __async(this, null, function* () {
890
824
  const stream = getStreamValues(exeContext, fieldGroup, path);
891
825
  let containsPromise = false;
@@ -899,7 +833,7 @@ function completeAsyncIteratorValue(exeContext, itemType, fieldGroup, info, path
899
833
  exeContext,
900
834
  fieldGroup,
901
835
  info,
902
- itemType,
836
+ itemTypeRef,
903
837
  path,
904
838
  stream.label,
905
839
  incrementalDataRecord
@@ -914,17 +848,13 @@ function completeAsyncIteratorValue(exeContext, itemType, fieldGroup, info, path
914
848
  break;
915
849
  }
916
850
  } catch (rawError) {
917
- throw (0, import_graphql.locatedError)(
918
- rawError,
919
- fieldGroup,
920
- (0, import_Path.pathToArray)(path)
921
- );
851
+ throw (0, import_graphql.locatedError)(rawError, fieldGroup, (0, import_Path.pathToArray)(path));
922
852
  }
923
853
  if (completeListItemValue(
924
854
  iteration.value,
925
855
  completedResults,
926
856
  exeContext,
927
- itemType,
857
+ itemTypeRef,
928
858
  fieldGroup,
929
859
  info,
930
860
  itemPath,
@@ -946,16 +876,23 @@ function completeLeafValue(returnType, result) {
946
876
  }
947
877
  return serializedResult;
948
878
  }
949
- function completeAbstractValue(exeContext, returnType, fieldGroup, info, path, result, incrementalDataRecord) {
879
+ function completeAbstractValue(exeContext, returnTypeName, fieldGroup, info, path, result, incrementalDataRecord) {
950
880
  var _a;
951
- const resolveTypeFn = (_a = returnType.__resolveType) != null ? _a : exeContext.typeResolver;
881
+ const resolveTypeFn = (_a = exeContext.schemaTypes.getAbstractTypeResolver(returnTypeName)) != null ? _a : exeContext.typeResolver;
952
882
  const contextValue = exeContext.contextValue;
953
883
  const runtimeTypeName = resolveTypeFn(result, contextValue, info);
954
884
  if ((0, import_isPromise.isPromise)(runtimeTypeName)) {
955
885
  return runtimeTypeName.then(
956
886
  (resolvedRuntimeTypeName) => completeObjectValue(
957
887
  exeContext,
958
- ensureValidRuntimeType(resolvedRuntimeTypeName, exeContext),
888
+ ensureValidRuntimeType(
889
+ resolvedRuntimeTypeName,
890
+ exeContext,
891
+ returnTypeName,
892
+ fieldGroup,
893
+ info,
894
+ result
895
+ ),
959
896
  fieldGroup,
960
897
  path,
961
898
  result,
@@ -965,48 +902,63 @@ function completeAbstractValue(exeContext, returnType, fieldGroup, info, path, r
965
902
  }
966
903
  return completeObjectValue(
967
904
  exeContext,
968
- ensureValidRuntimeType(runtimeTypeName, exeContext),
905
+ ensureValidRuntimeType(
906
+ runtimeTypeName,
907
+ exeContext,
908
+ returnTypeName,
909
+ fieldGroup,
910
+ info,
911
+ result
912
+ ),
969
913
  fieldGroup,
970
914
  path,
971
915
  result,
972
916
  incrementalDataRecord
973
917
  );
974
918
  }
975
- function ensureValidRuntimeType(runtimeTypeName, exeContext) {
976
- if (typeof runtimeTypeName !== "string") {
919
+ function ensureValidRuntimeType(runtimeTypeName, exeContext, returnTypeName, fieldGroup, info, result) {
920
+ if (runtimeTypeName == null) {
977
921
  throw new import_graphql.GraphQLError(
978
- `Could not determine runtime type for abstract type ${runtimeTypeName}`
922
+ `Abstract type "${returnTypeName}" must resolve to an Object type at runtime for field "${info.parentTypeName}.${info.fieldName}". Either the "${returnTypeName}" should provide a "__resolveType" resolver function or "${info.parentTypeName}.${info.fieldName}" should be an object with "__typename" property.`,
923
+ { nodes: fieldGroup }
979
924
  );
980
925
  }
981
- const runtimeType = exeContext.resolvers[runtimeTypeName];
982
- if (!runtimeType) {
983
- throw new import_graphql.GraphQLError(
984
- `Type "${runtimeTypeName}" does not exist inside the schema.`
985
- );
986
- } else if (runtimeType instanceof import_graphql.GraphQLScalarType || runtimeType instanceof import_graphql.GraphQLEnumType || runtimeType instanceof import_graphql.GraphQLInputObjectType || runtimeType.__resolveType) {
926
+ if (typeof runtimeTypeName !== "string") {
987
927
  throw new import_graphql.GraphQLError(
988
- `Given runtime object "${getRuntimeTypeInstanceName(
989
- runtimeType
990
- )}" type is not a possible type for "${runtimeTypeName}".`
928
+ `Abstract type "${returnTypeName}" must resolve to an Object type at runtime for field "${info.returnTypeName}.${info.fieldName}" with value ${(0, import_inspect.inspect)(result)}, received "${(0, import_inspect.inspect)(runtimeTypeName)}".`
991
929
  );
992
- } else {
993
- return runtimeTypeName;
994
930
  }
995
- }
996
- function getRuntimeTypeInstanceName(runtimeType) {
997
- if (runtimeType instanceof import_graphql.GraphQLScalarType) {
998
- return "GraphQLScalarType";
999
- } else if (runtimeType instanceof import_graphql.GraphQLEnumType) {
1000
- return "GraphQLEnumType";
1001
- } else if (runtimeType instanceof import_graphql.GraphQLInputObjectType) {
1002
- return "GraphQLInputObjectType";
1003
- } else if ("__types" in runtimeType) {
1004
- return "GraphQLUnionType";
1005
- } else if ("__implementedBy" in runtimeType) {
1006
- return "GraphQLInterfaceType";
931
+ const schemaTypes = exeContext.schemaTypes;
932
+ const iface = schemaTypes.getInterfaceType(returnTypeName);
933
+ if (iface) {
934
+ if (schemaTypes.isDefined(runtimeTypeName) && !schemaTypes.isObjectType(runtimeTypeName)) {
935
+ throw new import_graphql.GraphQLError(
936
+ `Abstract type "${returnTypeName}" was resolved to a non-object type "${runtimeTypeName}".`,
937
+ { nodes: fieldGroup }
938
+ );
939
+ }
940
+ schemaTypes.addInterfaceImplementation(returnTypeName, runtimeTypeName);
1007
941
  } else {
1008
- return "Unknown";
942
+ if (!schemaTypes.isDefined(runtimeTypeName)) {
943
+ throw new import_graphql.GraphQLError(
944
+ `Abstract type "${returnTypeName}" was resolved to a type "${runtimeTypeName}" that does not exist inside the schema.`,
945
+ { nodes: fieldGroup }
946
+ );
947
+ }
948
+ if (!schemaTypes.isObjectType(runtimeTypeName)) {
949
+ throw new import_graphql.GraphQLError(
950
+ `Abstract type "${returnTypeName}" was resolved to a non-object type "${runtimeTypeName}".`,
951
+ { nodes: fieldGroup }
952
+ );
953
+ }
954
+ if (!exeContext.schemaTypes.isSubType(returnTypeName, runtimeTypeName)) {
955
+ throw new import_graphql.GraphQLError(
956
+ `Runtime Object type "${runtimeTypeName}" is not a possible type for "${returnTypeName}".`,
957
+ { nodes: fieldGroup }
958
+ );
959
+ }
1009
960
  }
961
+ return runtimeTypeName;
1010
962
  }
1011
963
  function completeObjectValue(exeContext, returnTypeName, fieldGroup, path, result, incrementalDataRecord) {
1012
964
  return collectAndExecuteSubfields(
@@ -1151,11 +1103,11 @@ const defaultFieldResolver = (
1151
1103
  );
1152
1104
  function getOperationRootTypeName(operation) {
1153
1105
  switch (operation.operation) {
1154
- case import_supermassive_ast.OperationTypeNode.QUERY:
1106
+ case import_graphql.OperationTypeNode.QUERY:
1155
1107
  return "Query";
1156
- case import_supermassive_ast.OperationTypeNode.MUTATION:
1108
+ case import_graphql.OperationTypeNode.MUTATION:
1157
1109
  return "Mutation";
1158
- case import_supermassive_ast.OperationTypeNode.SUBSCRIPTION:
1110
+ case import_graphql.OperationTypeNode.SUBSCRIPTION:
1159
1111
  return "Subscription";
1160
1112
  }
1161
1113
  }
@@ -1188,7 +1140,7 @@ function executeDeferredFragment(exeContext, parentTypeName, sourceValue, fields
1188
1140
  }
1189
1141
  incrementalDataRecord.addData(promiseOrData);
1190
1142
  }
1191
- function executeStreamField(path, itemPath, item, exeContext, fieldGroup, info, itemTypeNode, label, parentContext) {
1143
+ function executeStreamField(path, itemPath, item, exeContext, fieldGroup, info, itemTypeRef, label, parentContext) {
1192
1144
  const incrementalDataRecord = new StreamItemsRecord({
1193
1145
  label,
1194
1146
  path: itemPath,
@@ -1198,7 +1150,7 @@ function executeStreamField(path, itemPath, item, exeContext, fieldGroup, info,
1198
1150
  if ((0, import_isPromise.isPromise)(item)) {
1199
1151
  const completedItems = completePromisedValue(
1200
1152
  exeContext,
1201
- itemTypeNode,
1153
+ itemTypeRef,
1202
1154
  fieldGroup,
1203
1155
  info,
1204
1156
  itemPath,
@@ -1220,7 +1172,7 @@ function executeStreamField(path, itemPath, item, exeContext, fieldGroup, info,
1220
1172
  try {
1221
1173
  completedItem = completeValue(
1222
1174
  exeContext,
1223
- itemTypeNode,
1175
+ itemTypeRef,
1224
1176
  fieldGroup,
1225
1177
  info,
1226
1178
  itemPath,
@@ -1231,7 +1183,7 @@ function executeStreamField(path, itemPath, item, exeContext, fieldGroup, info,
1231
1183
  handleFieldError(
1232
1184
  rawError,
1233
1185
  exeContext,
1234
- itemTypeNode,
1186
+ itemTypeRef,
1235
1187
  fieldGroup,
1236
1188
  itemPath,
1237
1189
  incrementalDataRecord
@@ -1250,7 +1202,7 @@ function executeStreamField(path, itemPath, item, exeContext, fieldGroup, info,
1250
1202
  handleFieldError(
1251
1203
  rawError,
1252
1204
  exeContext,
1253
- itemTypeNode,
1205
+ itemTypeRef,
1254
1206
  fieldGroup,
1255
1207
  itemPath,
1256
1208
  incrementalDataRecord
@@ -1271,7 +1223,7 @@ function executeStreamField(path, itemPath, item, exeContext, fieldGroup, info,
1271
1223
  incrementalDataRecord.addItems([completedItem]);
1272
1224
  return incrementalDataRecord;
1273
1225
  }
1274
- function executeStreamAsyncIteratorItem(asyncIterator, exeContext, fieldGroup, info, itemTypeNode, incrementalDataRecord, path, itemPath) {
1226
+ function executeStreamAsyncIteratorItem(asyncIterator, exeContext, fieldGroup, info, itemTypeRef, incrementalDataRecord, path, itemPath) {
1275
1227
  return __async(this, null, function* () {
1276
1228
  let item;
1277
1229
  try {
@@ -1282,17 +1234,13 @@ function executeStreamAsyncIteratorItem(asyncIterator, exeContext, fieldGroup, i
1282
1234
  }
1283
1235
  item = value;
1284
1236
  } catch (rawError) {
1285
- throw (0, import_graphql.locatedError)(
1286
- rawError,
1287
- fieldGroup,
1288
- (0, import_Path.pathToArray)(path)
1289
- );
1237
+ throw (0, import_graphql.locatedError)(rawError, fieldGroup, (0, import_Path.pathToArray)(path));
1290
1238
  }
1291
1239
  let completedItem;
1292
1240
  try {
1293
1241
  completedItem = completeValue(
1294
1242
  exeContext,
1295
- itemTypeNode,
1243
+ itemTypeRef,
1296
1244
  fieldGroup,
1297
1245
  info,
1298
1246
  itemPath,
@@ -1304,7 +1252,7 @@ function executeStreamAsyncIteratorItem(asyncIterator, exeContext, fieldGroup, i
1304
1252
  handleFieldError(
1305
1253
  rawError,
1306
1254
  exeContext,
1307
- itemTypeNode,
1255
+ itemTypeRef,
1308
1256
  fieldGroup,
1309
1257
  itemPath,
1310
1258
  incrementalDataRecord
@@ -1318,7 +1266,7 @@ function executeStreamAsyncIteratorItem(asyncIterator, exeContext, fieldGroup, i
1318
1266
  handleFieldError(
1319
1267
  rawError,
1320
1268
  exeContext,
1321
- itemTypeNode,
1269
+ itemTypeRef,
1322
1270
  fieldGroup,
1323
1271
  itemPath,
1324
1272
  incrementalDataRecord
@@ -1328,7 +1276,7 @@ function executeStreamAsyncIteratorItem(asyncIterator, exeContext, fieldGroup, i
1328
1276
  }
1329
1277
  });
1330
1278
  }
1331
- function executeStreamAsyncIterator(initialIndex, asyncIterator, exeContext, fieldGroup, info, itemTypeNode, path, label, parentContext) {
1279
+ function executeStreamAsyncIterator(initialIndex, asyncIterator, exeContext, fieldGroup, info, itemTypeRef, path, label, parentContext) {
1332
1280
  return __async(this, null, function* () {
1333
1281
  let index = initialIndex;
1334
1282
  let previousIncrementalDataRecord = parentContext != null ? parentContext : void 0;
@@ -1348,7 +1296,7 @@ function executeStreamAsyncIterator(initialIndex, asyncIterator, exeContext, fie
1348
1296
  exeContext,
1349
1297
  fieldGroup,
1350
1298
  info,
1351
- itemTypeNode,
1299
+ itemTypeRef,
1352
1300
  incrementalDataRecord,
1353
1301
  path,
1354
1302
  itemPath