@graphql-tools/executor 0.0.1-alpha-20221025014654-e3be5659

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 (35) hide show
  1. package/README.md +3 -0
  2. package/cjs/execution/AccumulatorMap.js +21 -0
  3. package/cjs/execution/collectFields.js +114 -0
  4. package/cjs/execution/execute.js +792 -0
  5. package/cjs/execution/index.js +10 -0
  6. package/cjs/execution/mapAsyncIterator.js +53 -0
  7. package/cjs/execution/subscribe.js +164 -0
  8. package/cjs/execution/values.js +168 -0
  9. package/cjs/index.js +4 -0
  10. package/cjs/package.json +1 -0
  11. package/esm/execution/AccumulatorMap.js +17 -0
  12. package/esm/execution/collectFields.js +109 -0
  13. package/esm/execution/execute.js +779 -0
  14. package/esm/execution/index.js +5 -0
  15. package/esm/execution/mapAsyncIterator.js +49 -0
  16. package/esm/execution/subscribe.js +159 -0
  17. package/esm/execution/values.js +162 -0
  18. package/esm/index.js +1 -0
  19. package/package.json +58 -0
  20. package/typings/execution/AccumulatorMap.d.cts +7 -0
  21. package/typings/execution/AccumulatorMap.d.ts +7 -0
  22. package/typings/execution/collectFields.d.cts +27 -0
  23. package/typings/execution/collectFields.d.ts +27 -0
  24. package/typings/execution/execute.d.cts +196 -0
  25. package/typings/execution/execute.d.ts +196 -0
  26. package/typings/execution/index.d.cts +5 -0
  27. package/typings/execution/index.d.ts +5 -0
  28. package/typings/execution/mapAsyncIterator.d.cts +6 -0
  29. package/typings/execution/mapAsyncIterator.d.ts +6 -0
  30. package/typings/execution/subscribe.d.cts +56 -0
  31. package/typings/execution/subscribe.d.ts +56 -0
  32. package/typings/execution/values.d.cts +54 -0
  33. package/typings/execution/values.d.ts +54 -0
  34. package/typings/index.d.cts +1 -0
  35. package/typings/index.d.ts +1 -0
@@ -0,0 +1,5 @@
1
+ export * from './collectFields.js';
2
+ export * from './execute.js';
3
+ export * from './mapAsyncIterator.js';
4
+ export * from './values.js';
5
+ export { pathToArray as responsePathAsArray } from 'graphql/jsutils/Path.js';
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Given an AsyncIterable and a callback function, return an AsyncIterator
3
+ * which produces values mapped via calling the callback function.
4
+ */
5
+ export function mapAsyncIterator(iterable, callback) {
6
+ const iterator = iterable[Symbol.asyncIterator]();
7
+ async function mapResult(result) {
8
+ if (result.done) {
9
+ return result;
10
+ }
11
+ try {
12
+ return { value: await callback(result.value), done: false };
13
+ }
14
+ catch (error) {
15
+ /* c8 ignore start */
16
+ // FIXME: add test case
17
+ if (typeof iterator.return === 'function') {
18
+ try {
19
+ await iterator.return();
20
+ }
21
+ catch (_e) {
22
+ /* ignore error */
23
+ }
24
+ }
25
+ throw error;
26
+ /* c8 ignore stop */
27
+ }
28
+ }
29
+ return {
30
+ async next() {
31
+ return mapResult(await iterator.next());
32
+ },
33
+ async return() {
34
+ // If iterator.return() does not exist, then type R must be undefined.
35
+ return typeof iterator.return === 'function'
36
+ ? mapResult(await iterator.return())
37
+ : { value: undefined, done: true };
38
+ },
39
+ async throw(error) {
40
+ if (typeof iterator.throw === 'function') {
41
+ return mapResult(await iterator.throw(error));
42
+ }
43
+ throw error;
44
+ },
45
+ [Symbol.asyncIterator]() {
46
+ return this;
47
+ },
48
+ };
49
+ }
@@ -0,0 +1,159 @@
1
+ import { GraphQLError, locatedError } from 'graphql';
2
+ import { devAssert } from 'graphql/jsutils/devAssert.js';
3
+ import { inspect } from 'graphql/jsutils/inspect.js';
4
+ import { isAsyncIterable } from 'graphql/jsutils/isAsyncIterable.js';
5
+ import { addPath, pathToArray } from 'graphql/jsutils/Path.js';
6
+ import { collectFields } from './collectFields.js';
7
+ import { assertValidExecutionArguments, buildExecutionContext, buildResolveInfo, execute, getFieldDef, } from './execute.js';
8
+ import { mapAsyncIterator } from './mapAsyncIterator.js';
9
+ import { getArgumentValues } from './values.js';
10
+ /**
11
+ * Implements the "Subscribe" algorithm described in the GraphQL specification.
12
+ *
13
+ * Returns a Promise which resolves to either an AsyncIterator (if successful)
14
+ * or an ExecutionResult (error). The promise will be rejected if the schema or
15
+ * other arguments to this function are invalid, or if the resolved event stream
16
+ * is not an async iterable.
17
+ *
18
+ * If the client-provided arguments to this function do not result in a
19
+ * compliant subscription, a GraphQL Response (ExecutionResult) with
20
+ * descriptive errors and no data will be returned.
21
+ *
22
+ * If the source stream could not be created due to faulty subscription
23
+ * resolver logic or underlying systems, the promise will resolve to a single
24
+ * ExecutionResult containing `errors` and no `data`.
25
+ *
26
+ * If the operation succeeded, the promise resolves to an AsyncIterator, which
27
+ * yields a stream of ExecutionResults representing the response stream.
28
+ *
29
+ * Accepts either an object with named arguments, or individual arguments.
30
+ */
31
+ export async function subscribe(args) {
32
+ // Temporary for v15 to v16 migration. Remove in v17
33
+ devAssert(arguments.length < 2, 'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.');
34
+ const { schema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, subscribeFieldResolver, } = args;
35
+ const resultOrStream = await createSourceEventStream(schema, document, rootValue, contextValue, variableValues, operationName, subscribeFieldResolver);
36
+ if (!isAsyncIterable(resultOrStream)) {
37
+ return resultOrStream;
38
+ }
39
+ // For each payload yielded from a subscription, map it over the normal
40
+ // GraphQL `execute` function, with `payload` as the rootValue.
41
+ // This implements the "MapSourceToResponseEvent" algorithm described in
42
+ // the GraphQL specification. The `execute` function provides the
43
+ // "ExecuteSubscriptionEvent" algorithm, as it is nearly identical to the
44
+ // "ExecuteQuery" algorithm, for which `execute` is also used.
45
+ const mapSourceToResponse = (payload) => execute({
46
+ schema,
47
+ document,
48
+ rootValue: payload,
49
+ contextValue,
50
+ variableValues,
51
+ operationName,
52
+ fieldResolver,
53
+ });
54
+ // Map every source value to a ExecutionResult value as described above.
55
+ return mapAsyncIterator(resultOrStream, mapSourceToResponse);
56
+ }
57
+ /**
58
+ * Implements the "CreateSourceEventStream" algorithm described in the
59
+ * GraphQL specification, resolving the subscription source event stream.
60
+ *
61
+ * Returns a Promise which resolves to either an AsyncIterable (if successful)
62
+ * or an ExecutionResult (error). The promise will be rejected if the schema or
63
+ * other arguments to this function are invalid, or if the resolved event stream
64
+ * is not an async iterable.
65
+ *
66
+ * If the client-provided arguments to this function do not result in a
67
+ * compliant subscription, a GraphQL Response (ExecutionResult) with
68
+ * descriptive errors and no data will be returned.
69
+ *
70
+ * If the the source stream could not be created due to faulty subscription
71
+ * resolver logic or underlying systems, the promise will resolve to a single
72
+ * ExecutionResult containing `errors` and no `data`.
73
+ *
74
+ * If the operation succeeded, the promise resolves to the AsyncIterable for the
75
+ * event stream returned by the resolver.
76
+ *
77
+ * A Source Event Stream represents a sequence of events, each of which triggers
78
+ * a GraphQL execution for that event.
79
+ *
80
+ * This may be useful when hosting the stateful subscription service in a
81
+ * different process or machine than the stateless GraphQL execution engine,
82
+ * or otherwise separating these two steps. For more on this, see the
83
+ * "Supporting Subscriptions at Scale" information in the GraphQL specification.
84
+ */
85
+ export async function createSourceEventStream(schema, document, rootValue, contextValue, variableValues, operationName, subscribeFieldResolver) {
86
+ // If arguments are missing or incorrectly typed, this is an internal
87
+ // developer mistake which should throw an early error.
88
+ assertValidExecutionArguments(schema, document, variableValues);
89
+ // If a valid execution context cannot be created due to incorrect arguments,
90
+ // a "Response" with only errors is returned.
91
+ const exeContext = buildExecutionContext({
92
+ schema,
93
+ document,
94
+ rootValue,
95
+ contextValue,
96
+ variableValues,
97
+ operationName,
98
+ subscribeFieldResolver,
99
+ });
100
+ // Return early errors if execution context failed.
101
+ if (!('schema' in exeContext)) {
102
+ return { errors: exeContext };
103
+ }
104
+ try {
105
+ const eventStream = await executeSubscription(exeContext);
106
+ // Assert field returned an event stream, otherwise yield an error.
107
+ if (!isAsyncIterable(eventStream)) {
108
+ throw new Error('Subscription field must return Async Iterable. ' + `Received: ${inspect(eventStream)}.`);
109
+ }
110
+ return eventStream;
111
+ }
112
+ catch (error) {
113
+ // If it GraphQLError, report it as an ExecutionResult, containing only errors and no data.
114
+ // Otherwise treat the error as a system-class error and re-throw it.
115
+ if (error instanceof GraphQLError) {
116
+ return { errors: [error] };
117
+ }
118
+ throw error;
119
+ }
120
+ }
121
+ async function executeSubscription(exeContext) {
122
+ var _a;
123
+ const { schema, fragments, operation, variableValues, rootValue } = exeContext;
124
+ const rootType = schema.getSubscriptionType();
125
+ if (rootType == null) {
126
+ throw new GraphQLError('Schema is not configured to execute subscription operation.', { nodes: operation });
127
+ }
128
+ const rootFields = collectFields(schema, fragments, variableValues, rootType, operation.selectionSet);
129
+ const [responseName, fieldNodes] = [...rootFields.entries()][0];
130
+ const fieldDef = getFieldDef(schema, rootType, fieldNodes[0]);
131
+ if (!fieldDef) {
132
+ const fieldName = fieldNodes[0].name.value;
133
+ throw new GraphQLError(`The subscription field "${fieldName}" is not defined.`, { nodes: fieldNodes });
134
+ }
135
+ const path = addPath(undefined, responseName, rootType.name);
136
+ const info = buildResolveInfo(exeContext, fieldDef, fieldNodes, rootType, path);
137
+ try {
138
+ // Implements the "ResolveFieldEventStream" algorithm from GraphQL specification.
139
+ // It differs from "ResolveFieldValue" due to providing a different `resolveFn`.
140
+ // Build a JS object of arguments from the field.arguments AST, using the
141
+ // variables scope to fulfill any variable references.
142
+ const args = getArgumentValues(fieldDef, fieldNodes[0], variableValues);
143
+ // The resolve function's optional third argument is a context value that
144
+ // is provided to every resolve function within an execution. It is commonly
145
+ // used to represent an authenticated user, or request-specific caches.
146
+ const contextValue = exeContext.contextValue;
147
+ // Call the `subscribe()` resolver or the default resolver to produce an
148
+ // AsyncIterable yielding raw payloads.
149
+ const resolveFn = (_a = fieldDef.subscribe) !== null && _a !== void 0 ? _a : exeContext.subscribeFieldResolver;
150
+ const eventStream = await resolveFn(rootValue, args, contextValue, info);
151
+ if (eventStream instanceof Error) {
152
+ throw eventStream;
153
+ }
154
+ return eventStream;
155
+ }
156
+ catch (error) {
157
+ throw locatedError(error, fieldNodes, pathToArray(path));
158
+ }
159
+ }
@@ -0,0 +1,162 @@
1
+ import { inspect } from 'graphql/jsutils/inspect.js';
2
+ import { keyMap } from 'graphql/jsutils/keyMap.js';
3
+ import { printPathArray } from 'graphql/jsutils/printPathArray.js';
4
+ import { GraphQLError, Kind, print, isInputType, isNonNullType, coerceInputValue, typeFromAST, valueFromAST, } from 'graphql';
5
+ /**
6
+ * Prepares an object map of variableValues of the correct type based on the
7
+ * provided variable definitions and arbitrary input. If the input cannot be
8
+ * parsed to match the variable definitions, a GraphQLError will be thrown.
9
+ *
10
+ * Note: The returned value is a plain Object with a prototype, since it is
11
+ * exposed to user code. Care should be taken to not pull values from the
12
+ * Object prototype.
13
+ */
14
+ export function getVariableValues(schema, varDefNodes, inputs, options) {
15
+ const errors = [];
16
+ const maxErrors = options === null || options === void 0 ? void 0 : options.maxErrors;
17
+ try {
18
+ const coerced = coerceVariableValues(schema, varDefNodes, inputs, error => {
19
+ if (maxErrors != null && errors.length >= maxErrors) {
20
+ throw new GraphQLError('Too many errors processing variables, error limit reached. Execution aborted.');
21
+ }
22
+ errors.push(error);
23
+ });
24
+ if (errors.length === 0) {
25
+ return { coerced };
26
+ }
27
+ }
28
+ catch (error) {
29
+ errors.push(error);
30
+ }
31
+ // @ts-expect-error - We know that errors is an array of GraphQLError.
32
+ return { errors };
33
+ }
34
+ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
35
+ const coercedValues = {};
36
+ for (const varDefNode of varDefNodes) {
37
+ const varName = varDefNode.variable.name.value;
38
+ const varType = typeFromAST(schema, varDefNode.type);
39
+ if (!isInputType(varType)) {
40
+ // Must use input types for variables. This should be caught during
41
+ // validation, however is checked again here for safety.
42
+ const varTypeStr = print(varDefNode.type);
43
+ onError(new GraphQLError(`Variable "$${varName}" expected value of type "${varTypeStr}" which cannot be used as an input type.`, { nodes: varDefNode.type }));
44
+ continue;
45
+ }
46
+ if (!hasOwnProperty(inputs, varName)) {
47
+ if (varDefNode.defaultValue) {
48
+ coercedValues[varName] = valueFromAST(varDefNode.defaultValue, varType);
49
+ }
50
+ else if (isNonNullType(varType)) {
51
+ const varTypeStr = inspect(varType);
52
+ onError(new GraphQLError(`Variable "$${varName}" of required type "${varTypeStr}" was not provided.`, {
53
+ nodes: varDefNode,
54
+ }));
55
+ }
56
+ continue;
57
+ }
58
+ const value = inputs[varName];
59
+ if (value === null && isNonNullType(varType)) {
60
+ const varTypeStr = inspect(varType);
61
+ onError(new GraphQLError(`Variable "$${varName}" of non-null type "${varTypeStr}" must not be null.`, {
62
+ nodes: varDefNode,
63
+ }));
64
+ continue;
65
+ }
66
+ coercedValues[varName] = coerceInputValue(value, varType, (path, invalidValue, error) => {
67
+ let prefix = `Variable "$${varName}" got invalid value ` + inspect(invalidValue);
68
+ if (path.length > 0) {
69
+ prefix += ` at "${varName}${printPathArray(path)}"`;
70
+ }
71
+ onError(new GraphQLError(prefix + '; ' + error.message, {
72
+ nodes: varDefNode,
73
+ originalError: error.originalError,
74
+ }));
75
+ });
76
+ }
77
+ return coercedValues;
78
+ }
79
+ /**
80
+ * Prepares an object map of argument values given a list of argument
81
+ * definitions and list of argument AST nodes.
82
+ *
83
+ * Note: The returned value is a plain Object with a prototype, since it is
84
+ * exposed to user code. Care should be taken to not pull values from the
85
+ * Object prototype.
86
+ */
87
+ export function getArgumentValues(def, node, variableValues) {
88
+ var _a;
89
+ const coercedValues = {};
90
+ // FIXME: https://github.com/graphql/graphql-js/issues/2203
91
+ /* c8 ignore next */
92
+ const argumentNodes = (_a = node.arguments) !== null && _a !== void 0 ? _a : [];
93
+ const argNodeMap = keyMap(argumentNodes, arg => arg.name.value);
94
+ for (const argDef of def.args) {
95
+ const name = argDef.name;
96
+ const argType = argDef.type;
97
+ const argumentNode = argNodeMap[name];
98
+ if (!argumentNode) {
99
+ if (argDef.defaultValue !== undefined) {
100
+ coercedValues[name] = argDef.defaultValue;
101
+ }
102
+ else if (isNonNullType(argType)) {
103
+ throw new GraphQLError(`Argument "${name}" of required type "${inspect(argType)}" ` + 'was not provided.', {
104
+ nodes: node,
105
+ });
106
+ }
107
+ continue;
108
+ }
109
+ const valueNode = argumentNode.value;
110
+ let isNull = valueNode.kind === Kind.NULL;
111
+ if (valueNode.kind === Kind.VARIABLE) {
112
+ const variableName = valueNode.name.value;
113
+ if (variableValues == null || !hasOwnProperty(variableValues, variableName)) {
114
+ if (argDef.defaultValue !== undefined) {
115
+ coercedValues[name] = argDef.defaultValue;
116
+ }
117
+ else if (isNonNullType(argType)) {
118
+ throw new GraphQLError(`Argument "${name}" of required type "${inspect(argType)}" ` +
119
+ `was provided the variable "$${variableName}" which was not provided a runtime value.`, { nodes: valueNode });
120
+ }
121
+ continue;
122
+ }
123
+ isNull = variableValues[variableName] == null;
124
+ }
125
+ if (isNull && isNonNullType(argType)) {
126
+ throw new GraphQLError(`Argument "${name}" of non-null type "${inspect(argType)}" ` + 'must not be null.', {
127
+ nodes: valueNode,
128
+ });
129
+ }
130
+ const coercedValue = valueFromAST(valueNode, argType, variableValues);
131
+ if (coercedValue === undefined) {
132
+ // Note: ValuesOfCorrectTypeRule validation should catch this before
133
+ // execution. This is a runtime check to ensure execution does not
134
+ // continue with an invalid argument value.
135
+ throw new GraphQLError(`Argument "${name}" has invalid value ${print(valueNode)}.`, { nodes: valueNode });
136
+ }
137
+ coercedValues[name] = coercedValue;
138
+ }
139
+ return coercedValues;
140
+ }
141
+ /**
142
+ * Prepares an object map of argument values given a directive definition
143
+ * and a AST node which may contain directives. Optionally also accepts a map
144
+ * of variable values.
145
+ *
146
+ * If the directive does not exist on the node, returns undefined.
147
+ *
148
+ * Note: The returned value is a plain Object with a prototype, since it is
149
+ * exposed to user code. Care should be taken to not pull values from the
150
+ * Object prototype.
151
+ */
152
+ export function getDirectiveValues(directiveDef, node, variableValues) {
153
+ var _a;
154
+ const directiveNode = (_a = node.directives) === null || _a === void 0 ? void 0 : _a.find(directive => directive.name.value === directiveDef.name);
155
+ if (directiveNode) {
156
+ return getArgumentValues(directiveDef, directiveNode, variableValues);
157
+ }
158
+ return undefined;
159
+ }
160
+ function hasOwnProperty(obj, prop) {
161
+ return Object.prototype.hasOwnProperty.call(obj, prop);
162
+ }
package/esm/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from './execution/index.js';
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@graphql-tools/executor",
3
+ "version": "0.0.1-alpha-20221025014654-e3be5659",
4
+ "sideEffects": false,
5
+ "peerDependencies": {
6
+ "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/ardatan/graphql-tools.git",
11
+ "directory": "packages/executor"
12
+ },
13
+ "keywords": [
14
+ "gql",
15
+ "graphql",
16
+ "typescript"
17
+ ],
18
+ "author": "Saihajpreet Singh <saihajpreet.singh@gmail.com>",
19
+ "license": "MIT",
20
+ "main": "cjs/index.js",
21
+ "module": "esm/index.js",
22
+ "typings": "typings/index.d.ts",
23
+ "typescript": {
24
+ "definition": "typings/index.d.ts"
25
+ },
26
+ "type": "module",
27
+ "exports": {
28
+ ".": {
29
+ "require": {
30
+ "types": "./typings/index.d.cts",
31
+ "default": "./cjs/index.js"
32
+ },
33
+ "import": {
34
+ "types": "./typings/index.d.ts",
35
+ "default": "./esm/index.js"
36
+ },
37
+ "default": {
38
+ "types": "./typings/index.d.ts",
39
+ "default": "./esm/index.js"
40
+ }
41
+ },
42
+ "./*": {
43
+ "require": {
44
+ "types": "./typings/*.d.cts",
45
+ "default": "./cjs/*.js"
46
+ },
47
+ "import": {
48
+ "types": "./typings/*.d.ts",
49
+ "default": "./esm/*.js"
50
+ },
51
+ "default": {
52
+ "types": "./typings/*.d.ts",
53
+ "default": "./esm/*.js"
54
+ }
55
+ },
56
+ "./package.json": "./package.json"
57
+ }
58
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * ES6 Map with additional `add` method to accumulate items.
3
+ */
4
+ export declare class AccumulatorMap<K, T> extends Map<K, Array<T>> {
5
+ get [Symbol.toStringTag](): string;
6
+ add(key: K, item: T): void;
7
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * ES6 Map with additional `add` method to accumulate items.
3
+ */
4
+ export declare class AccumulatorMap<K, T> extends Map<K, Array<T>> {
5
+ get [Symbol.toStringTag](): string;
6
+ add(key: K, item: T): void;
7
+ }
@@ -0,0 +1,27 @@
1
+ import type { ObjMap } from 'graphql/jsutils/ObjMap.cjs';
2
+ import { FieldNode, FragmentDefinitionNode, SelectionSetNode, GraphQLObjectType, GraphQLSchema } from 'graphql';
3
+ /**
4
+ * Given a selectionSet, collects all of the fields and returns them.
5
+ *
6
+ * CollectFields requires the "runtime type" of an object. For a field that
7
+ * returns an Interface or Union type, the "runtime type" will be the actual
8
+ * object type returned by that field.
9
+ *
10
+ * @internal
11
+ */
12
+ export declare function collectFields(schema: GraphQLSchema, fragments: ObjMap<FragmentDefinitionNode>, variableValues: {
13
+ [variable: string]: unknown;
14
+ }, runtimeType: GraphQLObjectType, selectionSet: SelectionSetNode): Map<string, ReadonlyArray<FieldNode>>;
15
+ /**
16
+ * Given an array of field nodes, collects all of the subfields of the passed
17
+ * in fields, and returns them at the end.
18
+ *
19
+ * CollectSubFields requires the "return type" of an object. For a field that
20
+ * returns an Interface or Union type, the "return type" will be the actual
21
+ * object type returned by that field.
22
+ *
23
+ * @internal
24
+ */
25
+ export declare function collectSubfields(schema: GraphQLSchema, fragments: ObjMap<FragmentDefinitionNode>, variableValues: {
26
+ [variable: string]: unknown;
27
+ }, returnType: GraphQLObjectType, fieldNodes: ReadonlyArray<FieldNode>): Map<string, ReadonlyArray<FieldNode>>;
@@ -0,0 +1,27 @@
1
+ import type { ObjMap } from 'graphql/jsutils/ObjMap.js';
2
+ import { FieldNode, FragmentDefinitionNode, SelectionSetNode, GraphQLObjectType, GraphQLSchema } from 'graphql';
3
+ /**
4
+ * Given a selectionSet, collects all of the fields and returns them.
5
+ *
6
+ * CollectFields requires the "runtime type" of an object. For a field that
7
+ * returns an Interface or Union type, the "runtime type" will be the actual
8
+ * object type returned by that field.
9
+ *
10
+ * @internal
11
+ */
12
+ export declare function collectFields(schema: GraphQLSchema, fragments: ObjMap<FragmentDefinitionNode>, variableValues: {
13
+ [variable: string]: unknown;
14
+ }, runtimeType: GraphQLObjectType, selectionSet: SelectionSetNode): Map<string, ReadonlyArray<FieldNode>>;
15
+ /**
16
+ * Given an array of field nodes, collects all of the subfields of the passed
17
+ * in fields, and returns them at the end.
18
+ *
19
+ * CollectSubFields requires the "return type" of an object. For a field that
20
+ * returns an Interface or Union type, the "return type" will be the actual
21
+ * object type returned by that field.
22
+ *
23
+ * @internal
24
+ */
25
+ export declare function collectSubfields(schema: GraphQLSchema, fragments: ObjMap<FragmentDefinitionNode>, variableValues: {
26
+ [variable: string]: unknown;
27
+ }, returnType: GraphQLObjectType, fieldNodes: ReadonlyArray<FieldNode>): Map<string, ReadonlyArray<FieldNode>>;