@graphql-tools/executor 0.0.9 → 0.0.10-alpha-20221114133331-f1811a2c

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
@@ -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;
@@ -1,16 +1,10 @@
1
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';
2
+ import { createGraphQLError, inspect, isAsyncIterable, isIterableObject, isObjectLike, isPromise, pathToArray, addPath, getArgumentValues, 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-20221114133331-f1811a2c",
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-20221114133331-f1811a2c",
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>>>;