@graphql-tools/executor 2.0.0-alpha-20240702150434-510cb232d9e9dd0212d17ed8efc3e54d83ea25f4 → 2.0.0-alpha-20240702193427-1ce4b1efdef732d2635b657df6273a975a19d217

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.
@@ -4,7 +4,6 @@ exports.IncrementalGraph = void 0;
4
4
  const utils_1 = require("@graphql-tools/utils");
5
5
  const BoxedPromiseOrValue_js_1 = require("./BoxedPromiseOrValue.js");
6
6
  const invariant_js_1 = require("./invariant.js");
7
- const promiseWithResolvers_js_1 = require("./promiseWithResolvers.js");
8
7
  const types_js_1 = require("./types.js");
9
8
  /**
10
9
  * @internal
@@ -47,7 +46,7 @@ class IncrementalGraph {
47
46
  done: false,
48
47
  });
49
48
  }
50
- const { promise, resolve } = (0, promiseWithResolvers_js_1.promiseWithResolvers)();
49
+ const { promise, resolve } = (0, utils_1.createDeferred)();
51
50
  this._nextQueue.push(resolve);
52
51
  return promise;
53
52
  },
@@ -762,7 +762,10 @@ function ensureValidRuntimeType(runtimeTypeName, exeContext, returnType, fieldGr
762
762
  // releases before 16.0.0 supported returning `GraphQLObjectType` from `resolveType`
763
763
  // TODO: remove in 17.0.0 release
764
764
  if ((0, graphql_1.isObjectType)(runtimeTypeName)) {
765
- throw (0, utils_1.createGraphQLError)('Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead.');
765
+ if (graphql_1.versionInfo.major >= 16) {
766
+ throw (0, utils_1.createGraphQLError)('Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead.');
767
+ }
768
+ runtimeTypeName = runtimeTypeName.name;
766
769
  }
767
770
  if (typeof runtimeTypeName !== 'string') {
768
771
  throw (0, utils_1.createGraphQLError)(`Abstract type "${returnType.name}" must resolve to an Object type at runtime for field "${info.parentType.name}.${info.fieldName}" with ` +
@@ -72,7 +72,7 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
72
72
  }
73
73
  onError((0, utils_1.createGraphQLError)(prefix + '; ' + error.message, {
74
74
  nodes: varDefNode,
75
- originalError: error.originalError,
75
+ originalError: error,
76
76
  }));
77
77
  });
78
78
  }
@@ -1,7 +1,6 @@
1
- import { isPromise } from '@graphql-tools/utils';
1
+ import { createDeferred, isPromise } from '@graphql-tools/utils';
2
2
  import { BoxedPromiseOrValue } from './BoxedPromiseOrValue.js';
3
3
  import { invariant } from './invariant.js';
4
- import { promiseWithResolvers } from './promiseWithResolvers.js';
5
4
  import { isDeferredFragmentRecord, isDeferredGroupedFieldSetRecord } from './types.js';
6
5
  /**
7
6
  * @internal
@@ -44,7 +43,7 @@ export class IncrementalGraph {
44
43
  done: false,
45
44
  });
46
45
  }
47
- const { promise, resolve } = promiseWithResolvers();
46
+ const { promise, resolve } = createDeferred();
48
47
  this._nextQueue.push(resolve);
49
48
  return promise;
50
49
  },
@@ -1,4 +1,4 @@
1
- import { assertValidSchema, getDirectiveValues, GraphQLError, isAbstractType, isLeafType, isListType, isNonNullType, isObjectType, Kind, locatedError, SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef, } from 'graphql';
1
+ import { assertValidSchema, getDirectiveValues, GraphQLError, isAbstractType, isLeafType, isListType, isNonNullType, isObjectType, Kind, locatedError, SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef, versionInfo, } from 'graphql';
2
2
  import { addPath, createGraphQLError, getArgumentValues, getDefinedRootType, GraphQLStreamDirective, inspect, isAsyncIterable, isIterableObject, isObjectLike, isPromise, mapAsyncIterator, memoize1, memoize3, pathToArray, promiseReduce, } from '@graphql-tools/utils';
3
3
  import { BoxedPromiseOrValue } from './BoxedPromiseOrValue.js';
4
4
  import { buildFieldPlan } from './buildFieldPlan.js';
@@ -754,7 +754,10 @@ function ensureValidRuntimeType(runtimeTypeName, exeContext, returnType, fieldGr
754
754
  // releases before 16.0.0 supported returning `GraphQLObjectType` from `resolveType`
755
755
  // TODO: remove in 17.0.0 release
756
756
  if (isObjectType(runtimeTypeName)) {
757
- throw createGraphQLError('Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead.');
757
+ if (versionInfo.major >= 16) {
758
+ throw createGraphQLError('Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead.');
759
+ }
760
+ runtimeTypeName = runtimeTypeName.name;
758
761
  }
759
762
  if (typeof runtimeTypeName !== 'string') {
760
763
  throw createGraphQLError(`Abstract type "${returnType.name}" must resolve to an Object type at runtime for field "${info.parentType.name}.${info.fieldName}" with ` +
@@ -68,7 +68,7 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
68
68
  }
69
69
  onError(createGraphQLError(prefix + '; ' + error.message, {
70
70
  nodes: varDefNode,
71
- originalError: error.originalError,
71
+ originalError: error,
72
72
  }));
73
73
  });
74
74
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@graphql-tools/executor",
3
- "version": "2.0.0-alpha-20240702150434-510cb232d9e9dd0212d17ed8efc3e54d83ea25f4",
3
+ "version": "2.0.0-alpha-20240702193427-1ce4b1efdef732d2635b657df6273a975a19d217",
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
- "@graphql-tools/utils": "10.3.0-alpha-20240702150434-510cb232d9e9dd0212d17ed8efc3e54d83ea25f4",
9
+ "@graphql-tools/utils": "10.3.0-alpha-20240702193427-1ce4b1efdef732d2635b657df6273a975a19d217",
10
10
  "@graphql-typed-document-node/core": "3.2.0",
11
11
  "@repeaterjs/repeater": "^3.0.4",
12
12
  "tslib": "^2.4.0",
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.promiseWithResolvers = void 0;
4
- /**
5
- * Based on Promise.withResolvers proposal
6
- * https://github.com/tc39/proposal-promise-with-resolvers
7
- */
8
- function promiseWithResolvers() {
9
- // these are assigned synchronously within the Promise constructor
10
- let resolve;
11
- let reject;
12
- const promise = new Promise((res, rej) => {
13
- resolve = res;
14
- reject = rej;
15
- });
16
- return { promise, resolve, reject };
17
- }
18
- exports.promiseWithResolvers = promiseWithResolvers;
@@ -1,14 +0,0 @@
1
- /**
2
- * Based on Promise.withResolvers proposal
3
- * https://github.com/tc39/proposal-promise-with-resolvers
4
- */
5
- export function promiseWithResolvers() {
6
- // these are assigned synchronously within the Promise constructor
7
- let resolve;
8
- let reject;
9
- const promise = new Promise((res, rej) => {
10
- resolve = res;
11
- reject = rej;
12
- });
13
- return { promise, resolve, reject };
14
- }
@@ -1,10 +0,0 @@
1
- import { MaybePromise } from '@graphql-tools/utils';
2
- /**
3
- * Based on Promise.withResolvers proposal
4
- * https://github.com/tc39/proposal-promise-with-resolvers
5
- */
6
- export declare function promiseWithResolvers<T>(): {
7
- promise: Promise<T>;
8
- resolve: (value: T | MaybePromise<T>) => void;
9
- reject: (reason?: any) => void;
10
- };
@@ -1,10 +0,0 @@
1
- import { MaybePromise } from '@graphql-tools/utils';
2
- /**
3
- * Based on Promise.withResolvers proposal
4
- * https://github.com/tc39/proposal-promise-with-resolvers
5
- */
6
- export declare function promiseWithResolvers<T>(): {
7
- promise: Promise<T>;
8
- resolve: (value: T | MaybePromise<T>) => void;
9
- reject: (reason?: any) => void;
10
- };