@graphql-tools/executor 2.0.0-alpha-20240702150657-b50b1dda80c0083a63896cdbfd42efdcdf4c0b98 → 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.
- package/cjs/execution/IncrementalGraph.js +1 -2
- package/cjs/execution/execute.js +4 -1
- package/cjs/execution/values.js +1 -1
- package/esm/execution/IncrementalGraph.js +2 -3
- package/esm/execution/execute.js +5 -2
- package/esm/execution/values.js +1 -1
- package/package.json +2 -2
- package/cjs/execution/promiseWithResolvers.js +0 -18
- package/esm/execution/promiseWithResolvers.js +0 -14
- package/typings/execution/promiseWithResolvers.d.cts +0 -10
- package/typings/execution/promiseWithResolvers.d.ts +0 -10
|
@@ -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,
|
|
49
|
+
const { promise, resolve } = (0, utils_1.createDeferred)();
|
|
51
50
|
this._nextQueue.push(resolve);
|
|
52
51
|
return promise;
|
|
53
52
|
},
|
package/cjs/execution/execute.js
CHANGED
|
@@ -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
|
-
|
|
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 ` +
|
package/cjs/execution/values.js
CHANGED
|
@@ -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 } =
|
|
46
|
+
const { promise, resolve } = createDeferred();
|
|
48
47
|
this._nextQueue.push(resolve);
|
|
49
48
|
return promise;
|
|
50
49
|
},
|
package/esm/execution/execute.js
CHANGED
|
@@ -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
|
-
|
|
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 ` +
|
package/esm/execution/values.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/executor",
|
|
3
|
-
"version": "2.0.0-alpha-
|
|
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-
|
|
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
|
-
};
|