@graphql-tools/executor 0.0.9 → 0.0.10-alpha-20221114133606-dae9ff99

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.
@@ -8,12 +8,6 @@ const promiseForObject_js_1 = require("./promiseForObject.js");
8
8
  const flattenAsyncIterable_js_1 = require("./flattenAsyncIterable.js");
9
9
  const invariant_js_1 = require("./invariant.js");
10
10
  const value_or_promise_1 = require("value-or-promise");
11
- /**
12
- * A memoized collection of relevant subfields with regard to the return
13
- * type. Memoizing ensures the subfields are not repeatedly calculated, which
14
- * saves overhead when resolving lists of values.
15
- */
16
- const collectSubfields = (0, utils_1.memoize3)((exeContext, returnType, fieldNodes) => (0, utils_1.collectSubFields)(exeContext.schema, exeContext.fragments, exeContext.variableValues, returnType, fieldNodes));
17
11
  /**
18
12
  * Implements the "Executing requests" section of the GraphQL specification,
19
13
  * including `@defer` and `@stream` as proposed in
@@ -293,7 +287,7 @@ function executeField(exeContext, parentType, source, fieldNodes, path, asyncPay
293
287
  // Build a JS object of arguments from the field.arguments AST, using the
294
288
  // variables scope to fulfill any variable references.
295
289
  // TODO: find a way to memoize, in case this field is within a List type.
296
- const args = (0, utils_1.getArgumentValues)(fieldDef, fieldNodes[0], exeContext.variableValues);
290
+ const args = (0, graphql_1.getArgumentValues)(fieldDef, fieldNodes[0], exeContext.variableValues);
297
291
  // The resolve function's optional third argument is a context value that
298
292
  // is provided to every resolve function within an execution. It is commonly
299
293
  // used to represent an authenticated user, or request-specific caches.
@@ -634,7 +628,7 @@ function invalidReturnTypeError(returnType, result, fieldNodes) {
634
628
  }
635
629
  function collectAndExecuteSubfields(exeContext, returnType, fieldNodes, path, result, asyncPayloadRecord) {
636
630
  // Collect sub-fields to execute to complete this value.
637
- const { fields: subFieldNodes, patches: subPatches } = collectSubfields(exeContext, returnType, fieldNodes);
631
+ const { fields: subFieldNodes, patches: subPatches } = (0, utils_1.collectSubFields)(exeContext.schema, exeContext.fragments, exeContext.variableValues, returnType, fieldNodes);
638
632
  const subFields = executeFields(exeContext, returnType, result, path, subFieldNodes, asyncPayloadRecord);
639
633
  for (const subPatch of subPatches) {
640
634
  const { label, fields: subPatchFieldNodes } = subPatch;
@@ -903,7 +897,7 @@ function executeSubscription(exeContext) {
903
897
  // It differs from "ResolveFieldValue" due to providing a different `resolveFn`.
904
898
  // Build a JS object of arguments from the field.arguments AST, using the
905
899
  // variables scope to fulfill any variable references.
906
- const args = (0, utils_1.getArgumentValues)(fieldDef, fieldNodes[0], variableValues);
900
+ const args = (0, graphql_1.getArgumentValues)(fieldDef, fieldNodes[0], variableValues);
907
901
  // The resolve function's optional third argument is a context value that
908
902
  // is provided to every resolve function within an execution. It is commonly
909
903
  // used to represent an authenticated user, or request-specific caches.
@@ -1,16 +1,10 @@
1
- import { locatedError, Kind, isAbstractType, isLeafType, isListType, isNonNullType, isObjectType, assertValidSchema, getDirectiveValues, SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef, } from 'graphql';
2
- import { createGraphQLError, inspect, isAsyncIterable, isIterableObject, isObjectLike, isPromise, pathToArray, addPath, getArgumentValues, promiseReduce, memoize3, getDefinedRootType, mapAsyncIterator, GraphQLStreamDirective, collectFields, collectSubFields as _collectSubfields, } from '@graphql-tools/utils';
1
+ import { locatedError, Kind, isAbstractType, isLeafType, isListType, isNonNullType, isObjectType, assertValidSchema, getDirectiveValues, SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef, getArgumentValues, } from 'graphql';
2
+ import { createGraphQLError, inspect, isAsyncIterable, isIterableObject, isObjectLike, isPromise, pathToArray, addPath, promiseReduce, getDefinedRootType, mapAsyncIterator, GraphQLStreamDirective, collectFields, collectSubFields, } from '@graphql-tools/utils';
3
3
  import { getVariableValues } from './values.js';
4
4
  import { promiseForObject } from './promiseForObject.js';
5
5
  import { flattenAsyncIterable } from './flattenAsyncIterable.js';
6
6
  import { invariant } from './invariant.js';
7
7
  import { ValueOrPromise } from 'value-or-promise';
8
- /**
9
- * A memoized collection of relevant subfields with regard to the return
10
- * type. Memoizing ensures the subfields are not repeatedly calculated, which
11
- * saves overhead when resolving lists of values.
12
- */
13
- const collectSubfields = memoize3((exeContext, returnType, fieldNodes) => _collectSubfields(exeContext.schema, exeContext.fragments, exeContext.variableValues, returnType, fieldNodes));
14
8
  /**
15
9
  * Implements the "Executing requests" section of the GraphQL specification,
16
10
  * including `@defer` and `@stream` as proposed in
@@ -626,7 +620,7 @@ function invalidReturnTypeError(returnType, result, fieldNodes) {
626
620
  }
627
621
  function collectAndExecuteSubfields(exeContext, returnType, fieldNodes, path, result, asyncPayloadRecord) {
628
622
  // Collect sub-fields to execute to complete this value.
629
- const { fields: subFieldNodes, patches: subPatches } = collectSubfields(exeContext, returnType, fieldNodes);
623
+ const { fields: subFieldNodes, patches: subPatches } = collectSubFields(exeContext.schema, exeContext.fragments, exeContext.variableValues, returnType, fieldNodes);
630
624
  const subFields = executeFields(exeContext, returnType, result, path, subFieldNodes, asyncPayloadRecord);
631
625
  for (const subPatch of subPatches) {
632
626
  const { label, fields: subPatchFieldNodes } = subPatch;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@graphql-tools/executor",
3
- "version": "0.0.9",
3
+ "version": "0.0.10-alpha-20221114133606-dae9ff99",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
7
7
  },
8
8
  "dependencies": {
9
9
  "@repeaterjs/repeater": "3.0.4",
10
- "@graphql-tools/utils": "9.1.1",
10
+ "@graphql-tools/utils": "9.1.2-alpha-20221114133606-dae9ff99",
11
11
  "@graphql-typed-document-node/core": "3.1.1",
12
12
  "tslib": "^2.4.0",
13
13
  "value-or-promise": "1.0.11"
@@ -1,6 +1,7 @@
1
1
  import { GraphQLFormattedError, FieldNode, FragmentDefinitionNode, OperationDefinitionNode, GraphQLField, GraphQLFieldResolver, GraphQLObjectType, GraphQLResolveInfo, GraphQLTypeResolver, GraphQLSchema } from 'graphql';
2
2
  import type { GraphQLError } from 'graphql';
3
- import { Path, Maybe, MaybePromise } from '@graphql-tools/utils';
3
+ import { MaybePromise } from '@graphql-tools/utils';
4
+ import type { Maybe, Path } from '@graphql-tools/utils';
4
5
  import { TypedDocumentNode } from '@graphql-typed-document-node/core';
5
6
  export interface SingularExecutionResult<TData = any, TExtensions = any> {
6
7
  errors?: ReadonlyArray<GraphQLError>;
@@ -1,6 +1,7 @@
1
1
  import { GraphQLFormattedError, FieldNode, FragmentDefinitionNode, OperationDefinitionNode, GraphQLField, GraphQLFieldResolver, GraphQLObjectType, GraphQLResolveInfo, GraphQLTypeResolver, GraphQLSchema } from 'graphql';
2
2
  import type { GraphQLError } from 'graphql';
3
- import { Path, Maybe, MaybePromise } from '@graphql-tools/utils';
3
+ import { MaybePromise } from '@graphql-tools/utils';
4
+ import type { Maybe, Path } from '@graphql-tools/utils';
4
5
  import { TypedDocumentNode } from '@graphql-typed-document-node/core';
5
6
  export interface SingularExecutionResult<TData = any, TExtensions = any> {
6
7
  errors?: ReadonlyArray<GraphQLError>;
@@ -1,3 +1,3 @@
1
- import { MaybeAsyncIterable, ExecutionResult, MaybePromise } from '@graphql-tools/utils';
1
+ import type { MaybeAsyncIterable, ExecutionResult, MaybePromise } from '@graphql-tools/utils';
2
2
  import { ExecutionArgs } from './execute.cjs';
3
3
  export declare function normalizedExecutor<TData = any, TVariables = any, TContext = any>(args: ExecutionArgs<TData, TVariables, TContext>): MaybePromise<MaybeAsyncIterable<ExecutionResult<TData>>>;
@@ -1,3 +1,3 @@
1
- import { MaybeAsyncIterable, ExecutionResult, MaybePromise } from '@graphql-tools/utils';
1
+ import type { MaybeAsyncIterable, ExecutionResult, MaybePromise } from '@graphql-tools/utils';
2
2
  import { ExecutionArgs } from './execute.js';
3
3
  export declare function normalizedExecutor<TData = any, TVariables = any, TContext = any>(args: ExecutionArgs<TData, TVariables, TContext>): MaybePromise<MaybeAsyncIterable<ExecutionResult<TData>>>;