@graphql-tools/stitch 10.1.4-alpha-6ac197bf92d989542ec403d525b5611cc3291cbf → 10.1.4-alpha-818c8406fd595e3e7774079d54f09027720344b3
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/CHANGELOG.md +5 -9
- package/dist/index.cjs +22 -15
- package/dist/index.js +23 -16
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
# @graphql-tools/stitch
|
|
2
2
|
|
|
3
|
-
## 10.1.4-alpha-
|
|
3
|
+
## 10.1.4-alpha-818c8406fd595e3e7774079d54f09027720344b3
|
|
4
4
|
### Patch Changes
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
- Updated dependencies [[`b1295c5`](https://github.com/graphql-hive/gateway/commit/b1295c5d6bdccb8187816c72d40a55a5fca35bdd)]:
|
|
11
|
-
- @graphql-tools/delegate@11.1.4-alpha-6ac197bf92d989542ec403d525b5611cc3291cbf
|
|
12
|
-
- @graphql-tools/batch-delegate@10.0.6-alpha-6ac197bf92d989542ec403d525b5611cc3291cbf
|
|
13
|
-
- @graphql-tools/wrap@11.0.6-alpha-6ac197bf92d989542ec403d525b5611cc3291cbf
|
|
6
|
+
- Updated dependencies [[`5f4795d`](https://github.com/graphql-hive/gateway/commit/5f4795dbd945f8147d12cdaa40267f848c885dfb), [`5f4795d`](https://github.com/graphql-hive/gateway/commit/5f4795dbd945f8147d12cdaa40267f848c885dfb)]:
|
|
7
|
+
- @graphql-tools/wrap@11.1.0-alpha-818c8406fd595e3e7774079d54f09027720344b3
|
|
8
|
+
- @graphql-tools/delegate@12.0.0-alpha-818c8406fd595e3e7774079d54f09027720344b3
|
|
9
|
+
- @graphql-tools/batch-delegate@10.0.6-alpha-818c8406fd595e3e7774079d54f09027720344b3
|
|
14
10
|
|
|
15
11
|
## 10.1.3
|
|
16
12
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -992,18 +992,9 @@ function completeStitchingInfo(stitchingInfo, resolvers, schema) {
|
|
|
992
992
|
const rootTypes = [schema.getQueryType(), schema.getMutationType()];
|
|
993
993
|
for (const rootType of rootTypes) {
|
|
994
994
|
if (rootType) {
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
if (field != null) {
|
|
999
|
-
const fieldType = graphql.getNamedType(field.type);
|
|
1000
|
-
if (rootType.name === fieldType.name) {
|
|
1001
|
-
fieldNodesByType[rootType.name] ||= [
|
|
1002
|
-
utils.parseSelectionSet("{ __typename }", { noLocation: true }).selections[0]
|
|
1003
|
-
];
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
995
|
+
fieldNodesByType[rootType.name] = [
|
|
996
|
+
utils.parseSelectionSet("{ __typename }", { noLocation: true }).selections[0]
|
|
997
|
+
];
|
|
1007
998
|
}
|
|
1008
999
|
}
|
|
1009
1000
|
const selectionSetsByField = /* @__PURE__ */ Object.create(null);
|
|
@@ -3226,7 +3217,15 @@ function createStitchingExecutor(stitchedSchema) {
|
|
|
3226
3217
|
);
|
|
3227
3218
|
const data = {};
|
|
3228
3219
|
for (const [fieldName, fieldNodes] of fields) {
|
|
3229
|
-
const
|
|
3220
|
+
const fieldNode = fieldNodes[0];
|
|
3221
|
+
if (!fieldNode) {
|
|
3222
|
+
continue;
|
|
3223
|
+
}
|
|
3224
|
+
const fieldInstance = rootType.getFields()[fieldName];
|
|
3225
|
+
if (!fieldInstance) {
|
|
3226
|
+
continue;
|
|
3227
|
+
}
|
|
3228
|
+
const responseKey = fieldNode.alias?.value ?? fieldName;
|
|
3230
3229
|
const subschemaForField = subschemas.find((subschema) => {
|
|
3231
3230
|
const subschemaSchema = delegate.isSubschemaConfig(subschema) ? subschema.schema : subschema;
|
|
3232
3231
|
const rootType2 = utils.getDefinedRootType(
|
|
@@ -3235,9 +3234,15 @@ function createStitchingExecutor(stitchedSchema) {
|
|
|
3235
3234
|
);
|
|
3236
3235
|
return rootType2.getFields()[fieldName] != null;
|
|
3237
3236
|
});
|
|
3237
|
+
const args = utils.getArgumentValues(
|
|
3238
|
+
fieldInstance,
|
|
3239
|
+
fieldNode,
|
|
3240
|
+
executorRequest.variables
|
|
3241
|
+
);
|
|
3238
3242
|
let result = await delegate.delegateToSchema({
|
|
3239
3243
|
schema: subschemaForField || stitchedSchema,
|
|
3240
3244
|
rootValue: executorRequest.rootValue,
|
|
3245
|
+
args,
|
|
3241
3246
|
context: executorRequest.context,
|
|
3242
3247
|
info: {
|
|
3243
3248
|
schema: stitchedSchema,
|
|
@@ -3246,8 +3251,10 @@ function createStitchingExecutor(stitchedSchema) {
|
|
|
3246
3251
|
operation,
|
|
3247
3252
|
fragments,
|
|
3248
3253
|
parentType: rootType,
|
|
3249
|
-
returnType:
|
|
3250
|
-
variableValues: executorRequest.variables
|
|
3254
|
+
returnType: fieldInstance.type,
|
|
3255
|
+
variableValues: executorRequest.variables,
|
|
3256
|
+
rootValue: executorRequest.rootValue,
|
|
3257
|
+
path: { typename: void 0, key: responseKey, prev: void 0 }
|
|
3251
3258
|
}
|
|
3252
3259
|
});
|
|
3253
3260
|
if (Array.isArray(result)) {
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { handleOverrideByDelegation as handleOverrideByDelegation$1, subtractSelectionSets, extractUnavailableFields, leftOverByDelegationPlan, extractUnavailableFieldsFromSelectionSet, delegateToSchema, cloneSubschemaConfig, isSubschemaConfig, defaultMergedResolver, Subschema } from '@graphql-tools/delegate';
|
|
2
2
|
import { mergeType, mergeInputType, mergeInterface, mergeUnion, mergeEnum, mergeScalar, mergeTypeDefs, mergeResolvers, mergeExtensions, applyExtensions } from '@graphql-tools/merge';
|
|
3
3
|
import { extendResolversFromInterfaces, addResolversToSchema, assertResolversPresent, makeExecutableSchema } from '@graphql-tools/schema';
|
|
4
|
-
import { memoize3, collectSubFields, memoize2, memoize1, parseSelectionSet, collectFields, isSome, getImplementingTypes, getRootTypeNames, filterSchema, mergeDeep, getDescription, createNamedStub, createStub, getRootTypeMap, getRootTypes, inspect, rewireTypes, getOperationASTFromRequest, getDefinedRootType } from '@graphql-tools/utils';
|
|
4
|
+
import { memoize3, collectSubFields, memoize2, memoize1, parseSelectionSet, collectFields, isSome, getImplementingTypes, getRootTypeNames, filterSchema, mergeDeep, getDescription, createNamedStub, createStub, getRootTypeMap, getRootTypes, inspect, rewireTypes, getOperationASTFromRequest, getDefinedRootType, getArgumentValues } from '@graphql-tools/utils';
|
|
5
5
|
import { isAbstractType, Kind, TypeNameMetaFieldDef, getNamedType, GraphQLList, isLeafType, isInputObjectType, isUnionType, print, isObjectType, isInterfaceType, visit, isScalarType, isCompositeType, isNonNullType, isEnumType, isListType, getNullableType, isNullableType, GraphQLObjectType, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLUnionType, GraphQLEnumType, GraphQLScalarType, GraphQLDirective, valueFromASTUntyped, getDirectiveValues, GraphQLDeprecatedDirective, DirectiveLocation, isNamedType, isIntrospectionType, isDirective, isSpecifiedScalarType, specifiedDirectives, GraphQLSchema, extendSchema } from 'graphql';
|
|
6
6
|
import { handleMaybePromise } from '@whatwg-node/promise-helpers';
|
|
7
7
|
import { batchDelegateToSchema } from '@graphql-tools/batch-delegate';
|
|
@@ -990,18 +990,9 @@ function completeStitchingInfo(stitchingInfo, resolvers, schema) {
|
|
|
990
990
|
const rootTypes = [schema.getQueryType(), schema.getMutationType()];
|
|
991
991
|
for (const rootType of rootTypes) {
|
|
992
992
|
if (rootType) {
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
if (field != null) {
|
|
997
|
-
const fieldType = getNamedType(field.type);
|
|
998
|
-
if (rootType.name === fieldType.name) {
|
|
999
|
-
fieldNodesByType[rootType.name] ||= [
|
|
1000
|
-
parseSelectionSet("{ __typename }", { noLocation: true }).selections[0]
|
|
1001
|
-
];
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
993
|
+
fieldNodesByType[rootType.name] = [
|
|
994
|
+
parseSelectionSet("{ __typename }", { noLocation: true }).selections[0]
|
|
995
|
+
];
|
|
1005
996
|
}
|
|
1006
997
|
}
|
|
1007
998
|
const selectionSetsByField = /* @__PURE__ */ Object.create(null);
|
|
@@ -3224,7 +3215,15 @@ function createStitchingExecutor(stitchedSchema) {
|
|
|
3224
3215
|
);
|
|
3225
3216
|
const data = {};
|
|
3226
3217
|
for (const [fieldName, fieldNodes] of fields) {
|
|
3227
|
-
const
|
|
3218
|
+
const fieldNode = fieldNodes[0];
|
|
3219
|
+
if (!fieldNode) {
|
|
3220
|
+
continue;
|
|
3221
|
+
}
|
|
3222
|
+
const fieldInstance = rootType.getFields()[fieldName];
|
|
3223
|
+
if (!fieldInstance) {
|
|
3224
|
+
continue;
|
|
3225
|
+
}
|
|
3226
|
+
const responseKey = fieldNode.alias?.value ?? fieldName;
|
|
3228
3227
|
const subschemaForField = subschemas.find((subschema) => {
|
|
3229
3228
|
const subschemaSchema = isSubschemaConfig(subschema) ? subschema.schema : subschema;
|
|
3230
3229
|
const rootType2 = getDefinedRootType(
|
|
@@ -3233,9 +3232,15 @@ function createStitchingExecutor(stitchedSchema) {
|
|
|
3233
3232
|
);
|
|
3234
3233
|
return rootType2.getFields()[fieldName] != null;
|
|
3235
3234
|
});
|
|
3235
|
+
const args = getArgumentValues(
|
|
3236
|
+
fieldInstance,
|
|
3237
|
+
fieldNode,
|
|
3238
|
+
executorRequest.variables
|
|
3239
|
+
);
|
|
3236
3240
|
let result = await delegateToSchema({
|
|
3237
3241
|
schema: subschemaForField || stitchedSchema,
|
|
3238
3242
|
rootValue: executorRequest.rootValue,
|
|
3243
|
+
args,
|
|
3239
3244
|
context: executorRequest.context,
|
|
3240
3245
|
info: {
|
|
3241
3246
|
schema: stitchedSchema,
|
|
@@ -3244,8 +3249,10 @@ function createStitchingExecutor(stitchedSchema) {
|
|
|
3244
3249
|
operation,
|
|
3245
3250
|
fragments,
|
|
3246
3251
|
parentType: rootType,
|
|
3247
|
-
returnType:
|
|
3248
|
-
variableValues: executorRequest.variables
|
|
3252
|
+
returnType: fieldInstance.type,
|
|
3253
|
+
variableValues: executorRequest.variables,
|
|
3254
|
+
rootValue: executorRequest.rootValue,
|
|
3255
|
+
path: { typename: void 0, key: responseKey, prev: void 0 }
|
|
3249
3256
|
}
|
|
3250
3257
|
});
|
|
3251
3258
|
if (Array.isArray(result)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/stitch",
|
|
3
|
-
"version": "10.1.4-alpha-
|
|
3
|
+
"version": "10.1.4-alpha-818c8406fd595e3e7774079d54f09027720344b3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A set of utils for faster development of GraphQL tools",
|
|
6
6
|
"repository": {
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@graphql-tools/batch-delegate": "10.0.6-alpha-
|
|
42
|
-
"@graphql-tools/delegate": "
|
|
41
|
+
"@graphql-tools/batch-delegate": "10.0.6-alpha-818c8406fd595e3e7774079d54f09027720344b3",
|
|
42
|
+
"@graphql-tools/delegate": "12.0.0-alpha-818c8406fd595e3e7774079d54f09027720344b3",
|
|
43
43
|
"@graphql-tools/executor": "^1.4.13",
|
|
44
44
|
"@graphql-tools/merge": "^9.1.5",
|
|
45
45
|
"@graphql-tools/schema": "^10.0.29",
|
|
46
46
|
"@graphql-tools/utils": "^10.10.3",
|
|
47
|
-
"@graphql-tools/wrap": "11.0
|
|
47
|
+
"@graphql-tools/wrap": "11.1.0-alpha-818c8406fd595e3e7774079d54f09027720344b3",
|
|
48
48
|
"@whatwg-node/promise-helpers": "^1.3.2",
|
|
49
49
|
"tslib": "^2.8.1"
|
|
50
50
|
},
|