@depup/graphql-tools__delegate 12.1.0-depup.0 → 12.1.1-depup.1
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/README.md +5 -5
- package/changes.json +4 -4
- package/dist/index.cjs +30 -11
- package/dist/index.js +31 -12
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -13,8 +13,8 @@ npm install @depup/graphql-tools__delegate
|
|
|
13
13
|
|
|
14
14
|
| Field | Value |
|
|
15
15
|
|-------|-------|
|
|
16
|
-
| Original | [@graphql-tools/delegate](https://www.npmjs.com/package/@graphql-tools/delegate) @ 12.1.
|
|
17
|
-
| Processed | 2026-
|
|
16
|
+
| Original | [@graphql-tools/delegate](https://www.npmjs.com/package/@graphql-tools/delegate) @ 12.1.1 |
|
|
17
|
+
| Processed | 2026-08-13 |
|
|
18
18
|
| Smoke test | passed |
|
|
19
19
|
| Deps updated | 4 |
|
|
20
20
|
|
|
@@ -22,9 +22,9 @@ npm install @depup/graphql-tools__delegate
|
|
|
22
22
|
|
|
23
23
|
| Dependency | From | To |
|
|
24
24
|
|------------|------|-----|
|
|
25
|
-
| @graphql-tools/executor | ^1.4.13 | ^
|
|
26
|
-
| @graphql-tools/schema | ^10.0.29 | ^10.0
|
|
27
|
-
| @graphql-tools/utils | ^11.0.0 | ^
|
|
25
|
+
| @graphql-tools/executor | ^1.4.13 | ^2.0.0 |
|
|
26
|
+
| @graphql-tools/schema | ^10.0.29 | ^10.1.0 |
|
|
27
|
+
| @graphql-tools/utils | ^11.0.0 | ^12.0.0 |
|
|
28
28
|
| @repeaterjs/repeater | ^3.0.6 | ^3.1.0 |
|
|
29
29
|
|
|
30
30
|
---
|
package/changes.json
CHANGED
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
"bumped": {
|
|
3
3
|
"@graphql-tools/executor": {
|
|
4
4
|
"from": "^1.4.13",
|
|
5
|
-
"to": "^
|
|
5
|
+
"to": "^2.0.0"
|
|
6
6
|
},
|
|
7
7
|
"@graphql-tools/schema": {
|
|
8
8
|
"from": "^10.0.29",
|
|
9
|
-
"to": "^10.0
|
|
9
|
+
"to": "^10.1.0"
|
|
10
10
|
},
|
|
11
11
|
"@graphql-tools/utils": {
|
|
12
12
|
"from": "^11.0.0",
|
|
13
|
-
"to": "^
|
|
13
|
+
"to": "^12.0.0"
|
|
14
14
|
},
|
|
15
15
|
"@repeaterjs/repeater": {
|
|
16
16
|
"from": "^3.0.6",
|
|
17
17
|
"to": "^3.1.0"
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
|
-
"timestamp": "2026-
|
|
20
|
+
"timestamp": "2026-08-13T00:27:21.151Z",
|
|
21
21
|
"totalUpdated": 4
|
|
22
22
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -2344,6 +2344,7 @@ function createRequest({
|
|
|
2344
2344
|
const newVariables = info?.variableValues ? { ...info.variableValues } : {};
|
|
2345
2345
|
const variableDefinitions = info?.operation.variableDefinitions ? [...info.operation.variableDefinitions] : [];
|
|
2346
2346
|
const argNodes = [];
|
|
2347
|
+
const replacedVariableNames = /* @__PURE__ */ new Set();
|
|
2347
2348
|
if (args != null) {
|
|
2348
2349
|
const rootType = targetSchema != null ? utils.getDefinedRootType(targetSchema, targetOperation) : void 0;
|
|
2349
2350
|
const rootField = rootType?.getFields()[rootFieldName];
|
|
@@ -2354,14 +2355,18 @@ function createRequest({
|
|
|
2354
2355
|
const existingArgNode = fieldNode?.arguments?.find(
|
|
2355
2356
|
(argNode) => argNode.name.value === argName
|
|
2356
2357
|
);
|
|
2357
|
-
if (existingArgNode
|
|
2358
|
+
if (existingArgNode && !argInstance) {
|
|
2359
|
+
argNodes.push(existingArgNode);
|
|
2360
|
+
continue;
|
|
2361
|
+
}
|
|
2362
|
+
if (existingArgNode?.value.kind === graphql.Kind.VARIABLE) {
|
|
2358
2363
|
const varName = existingArgNode.value.name.value;
|
|
2359
2364
|
const varValue = newVariables[varName];
|
|
2360
2365
|
const variableDefinition = variableDefinitions.find(
|
|
2361
2366
|
(definition) => definition.variable.name.value === varName
|
|
2362
2367
|
);
|
|
2363
2368
|
const variableType = variableDefinition && targetSchema ? graphql.typeFromAST(info?.schema ?? targetSchema, variableDefinition.type) : void 0;
|
|
2364
|
-
if (varValue === argValue && variableType && graphql.isTypeSubTypeOf(
|
|
2369
|
+
if (varValue === argValue && variableType && argInstance && graphql.isTypeSubTypeOf(
|
|
2365
2370
|
info?.schema ?? targetSchema,
|
|
2366
2371
|
variableType,
|
|
2367
2372
|
argInstance.type
|
|
@@ -2387,14 +2392,7 @@ function createRequest({
|
|
|
2387
2392
|
}
|
|
2388
2393
|
}
|
|
2389
2394
|
if (existingArgNode?.value.kind === graphql.Kind.VARIABLE) {
|
|
2390
|
-
|
|
2391
|
-
const existingVarIndex = variableDefinitions.findIndex(
|
|
2392
|
-
(definition) => definition.variable.name.value === existingVarName
|
|
2393
|
-
);
|
|
2394
|
-
if (existingVarIndex !== -1) {
|
|
2395
|
-
variableDefinitions.splice(existingVarIndex, 1);
|
|
2396
|
-
delete newVariables[existingVarName];
|
|
2397
|
-
}
|
|
2395
|
+
replacedVariableNames.add(existingArgNode.value.name.value);
|
|
2398
2396
|
}
|
|
2399
2397
|
variableDefinitions.push({
|
|
2400
2398
|
kind: graphql.Kind.VARIABLE_DEFINITION,
|
|
@@ -2472,6 +2470,26 @@ function createRequest({
|
|
|
2472
2470
|
kind: graphql.Kind.DOCUMENT,
|
|
2473
2471
|
definitions
|
|
2474
2472
|
};
|
|
2473
|
+
if (replacedVariableNames.size > 0) {
|
|
2474
|
+
const usedVariableNames = /* @__PURE__ */ new Set();
|
|
2475
|
+
graphql.visit(document, {
|
|
2476
|
+
VariableDefinition: () => false,
|
|
2477
|
+
Variable: (variableNode) => {
|
|
2478
|
+
usedVariableNames.add(variableNode.name.value);
|
|
2479
|
+
}
|
|
2480
|
+
});
|
|
2481
|
+
for (const variableName of replacedVariableNames) {
|
|
2482
|
+
if (!usedVariableNames.has(variableName)) {
|
|
2483
|
+
const variableIndex = variableDefinitions.findIndex(
|
|
2484
|
+
(definition) => definition.variable.name.value === variableName
|
|
2485
|
+
);
|
|
2486
|
+
if (variableIndex !== -1) {
|
|
2487
|
+
variableDefinitions.splice(variableIndex, 1);
|
|
2488
|
+
delete newVariables[variableName];
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2475
2493
|
return {
|
|
2476
2494
|
subgraphName,
|
|
2477
2495
|
document,
|
|
@@ -2995,10 +3013,11 @@ function delegateToSchema(options) {
|
|
|
2995
3013
|
}
|
|
2996
3014
|
}
|
|
2997
3015
|
const fragments = info ? getFragmentDefinitions(info) : void 0;
|
|
3016
|
+
const targetRootType = operation === graphql.OperationTypeNode.MUTATION ? targetSchema.getMutationType() : operation === graphql.OperationTypeNode.SUBSCRIPTION ? targetSchema.getSubscriptionType() : targetSchema.getQueryType();
|
|
2998
3017
|
const request = createRequest({
|
|
2999
3018
|
subgraphName: schema.name,
|
|
3000
3019
|
fragments,
|
|
3001
|
-
targetSchema:
|
|
3020
|
+
targetSchema: targetRootType?.getFields()[fieldName] == null && isSubschemaConfig(schema) ? schema.schema : targetSchema,
|
|
3002
3021
|
rootValue,
|
|
3003
3022
|
targetOperationName: operationName,
|
|
3004
3023
|
targetOperation: operation,
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { memoize2, memoize1, collectFields, relocatedError, mergeDeep, promiseReduce, pathToArray, getResponseKeyFromInfo, memoize3, getDefinedRootType, createGraphQLError, implementsAbstractType, getRootTypeNames, astFromArg, astFromValueUntyped, asArray, isAsyncIterable, getOperationASTFromRequest } from '@graphql-tools/utils';
|
|
2
2
|
export { createDeferred } from '@graphql-tools/utils';
|
|
3
|
-
import { GraphQLError, locatedError, isAbstractType, getNullableType, isLeafType, isCompositeType, isListType, responsePathAsArray, Kind, TypeInfo, versionInfo, visit, visitWithTypeInfo, isNullableType, isUnionType, getNamedType, isObjectType, isInterfaceType, typeFromAST, isTypeSubTypeOf, isNonNullType, isInputObjectType, defaultFieldResolver, isSchema, validate } from 'graphql';
|
|
3
|
+
import { GraphQLError, locatedError, isAbstractType, getNullableType, isLeafType, isCompositeType, isListType, responsePathAsArray, Kind, TypeInfo, versionInfo, visit, visitWithTypeInfo, isNullableType, isUnionType, getNamedType, isObjectType, isInterfaceType, typeFromAST, isTypeSubTypeOf, isNonNullType, isInputObjectType, defaultFieldResolver, isSchema, OperationTypeNode, validate } from 'graphql';
|
|
4
4
|
import { handleMaybePromise, isPromise, createDeferredPromise, mapAsyncIterator } from '@whatwg-node/promise-helpers';
|
|
5
5
|
import { CRITICAL_ERROR, executorFromSchema } from '@graphql-tools/executor';
|
|
6
6
|
export { executorFromSchema as createDefaultExecutor } from '@graphql-tools/executor';
|
|
@@ -2344,6 +2344,7 @@ function createRequest({
|
|
|
2344
2344
|
const newVariables = info?.variableValues ? { ...info.variableValues } : {};
|
|
2345
2345
|
const variableDefinitions = info?.operation.variableDefinitions ? [...info.operation.variableDefinitions] : [];
|
|
2346
2346
|
const argNodes = [];
|
|
2347
|
+
const replacedVariableNames = /* @__PURE__ */ new Set();
|
|
2347
2348
|
if (args != null) {
|
|
2348
2349
|
const rootType = targetSchema != null ? getDefinedRootType(targetSchema, targetOperation) : void 0;
|
|
2349
2350
|
const rootField = rootType?.getFields()[rootFieldName];
|
|
@@ -2354,14 +2355,18 @@ function createRequest({
|
|
|
2354
2355
|
const existingArgNode = fieldNode?.arguments?.find(
|
|
2355
2356
|
(argNode) => argNode.name.value === argName
|
|
2356
2357
|
);
|
|
2357
|
-
if (existingArgNode
|
|
2358
|
+
if (existingArgNode && !argInstance) {
|
|
2359
|
+
argNodes.push(existingArgNode);
|
|
2360
|
+
continue;
|
|
2361
|
+
}
|
|
2362
|
+
if (existingArgNode?.value.kind === Kind.VARIABLE) {
|
|
2358
2363
|
const varName = existingArgNode.value.name.value;
|
|
2359
2364
|
const varValue = newVariables[varName];
|
|
2360
2365
|
const variableDefinition = variableDefinitions.find(
|
|
2361
2366
|
(definition) => definition.variable.name.value === varName
|
|
2362
2367
|
);
|
|
2363
2368
|
const variableType = variableDefinition && targetSchema ? typeFromAST(info?.schema ?? targetSchema, variableDefinition.type) : void 0;
|
|
2364
|
-
if (varValue === argValue && variableType && isTypeSubTypeOf(
|
|
2369
|
+
if (varValue === argValue && variableType && argInstance && isTypeSubTypeOf(
|
|
2365
2370
|
info?.schema ?? targetSchema,
|
|
2366
2371
|
variableType,
|
|
2367
2372
|
argInstance.type
|
|
@@ -2387,14 +2392,7 @@ function createRequest({
|
|
|
2387
2392
|
}
|
|
2388
2393
|
}
|
|
2389
2394
|
if (existingArgNode?.value.kind === Kind.VARIABLE) {
|
|
2390
|
-
|
|
2391
|
-
const existingVarIndex = variableDefinitions.findIndex(
|
|
2392
|
-
(definition) => definition.variable.name.value === existingVarName
|
|
2393
|
-
);
|
|
2394
|
-
if (existingVarIndex !== -1) {
|
|
2395
|
-
variableDefinitions.splice(existingVarIndex, 1);
|
|
2396
|
-
delete newVariables[existingVarName];
|
|
2397
|
-
}
|
|
2395
|
+
replacedVariableNames.add(existingArgNode.value.name.value);
|
|
2398
2396
|
}
|
|
2399
2397
|
variableDefinitions.push({
|
|
2400
2398
|
kind: Kind.VARIABLE_DEFINITION,
|
|
@@ -2472,6 +2470,26 @@ function createRequest({
|
|
|
2472
2470
|
kind: Kind.DOCUMENT,
|
|
2473
2471
|
definitions
|
|
2474
2472
|
};
|
|
2473
|
+
if (replacedVariableNames.size > 0) {
|
|
2474
|
+
const usedVariableNames = /* @__PURE__ */ new Set();
|
|
2475
|
+
visit(document, {
|
|
2476
|
+
VariableDefinition: () => false,
|
|
2477
|
+
Variable: (variableNode) => {
|
|
2478
|
+
usedVariableNames.add(variableNode.name.value);
|
|
2479
|
+
}
|
|
2480
|
+
});
|
|
2481
|
+
for (const variableName of replacedVariableNames) {
|
|
2482
|
+
if (!usedVariableNames.has(variableName)) {
|
|
2483
|
+
const variableIndex = variableDefinitions.findIndex(
|
|
2484
|
+
(definition) => definition.variable.name.value === variableName
|
|
2485
|
+
);
|
|
2486
|
+
if (variableIndex !== -1) {
|
|
2487
|
+
variableDefinitions.splice(variableIndex, 1);
|
|
2488
|
+
delete newVariables[variableName];
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2475
2493
|
return {
|
|
2476
2494
|
subgraphName,
|
|
2477
2495
|
document,
|
|
@@ -2995,10 +3013,11 @@ function delegateToSchema(options) {
|
|
|
2995
3013
|
}
|
|
2996
3014
|
}
|
|
2997
3015
|
const fragments = info ? getFragmentDefinitions(info) : void 0;
|
|
3016
|
+
const targetRootType = operation === OperationTypeNode.MUTATION ? targetSchema.getMutationType() : operation === OperationTypeNode.SUBSCRIPTION ? targetSchema.getSubscriptionType() : targetSchema.getQueryType();
|
|
2998
3017
|
const request = createRequest({
|
|
2999
3018
|
subgraphName: schema.name,
|
|
3000
3019
|
fragments,
|
|
3001
|
-
targetSchema:
|
|
3020
|
+
targetSchema: targetRootType?.getFields()[fieldName] == null && isSubschemaConfig(schema) ? schema.schema : targetSchema,
|
|
3002
3021
|
rootValue,
|
|
3003
3022
|
targetOperationName: operationName,
|
|
3004
3023
|
targetOperation: operation,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depup/graphql-tools__delegate",
|
|
3
|
-
"version": "12.1.
|
|
3
|
+
"version": "12.1.1-depup.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A set of utils for faster development of GraphQL tools (with updated dependencies)",
|
|
6
6
|
"repository": {
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@graphql-tools/batch-execute": "^10.0.9",
|
|
43
|
-
"@graphql-tools/executor": "^
|
|
44
|
-
"@graphql-tools/schema": "^10.0
|
|
45
|
-
"@graphql-tools/utils": "^
|
|
43
|
+
"@graphql-tools/executor": "^2.0.0",
|
|
44
|
+
"@graphql-tools/schema": "^10.1.0",
|
|
45
|
+
"@graphql-tools/utils": "^12.0.0",
|
|
46
46
|
"@repeaterjs/repeater": "^3.1.0",
|
|
47
47
|
"@whatwg-node/promise-helpers": "^1.3.2",
|
|
48
48
|
"dataloader": "^2.2.3",
|
|
@@ -66,15 +66,15 @@
|
|
|
66
66
|
"changes": {
|
|
67
67
|
"@graphql-tools/executor": {
|
|
68
68
|
"from": "^1.4.13",
|
|
69
|
-
"to": "^
|
|
69
|
+
"to": "^2.0.0"
|
|
70
70
|
},
|
|
71
71
|
"@graphql-tools/schema": {
|
|
72
72
|
"from": "^10.0.29",
|
|
73
|
-
"to": "^10.0
|
|
73
|
+
"to": "^10.1.0"
|
|
74
74
|
},
|
|
75
75
|
"@graphql-tools/utils": {
|
|
76
76
|
"from": "^11.0.0",
|
|
77
|
-
"to": "^
|
|
77
|
+
"to": "^12.0.0"
|
|
78
78
|
},
|
|
79
79
|
"@repeaterjs/repeater": {
|
|
80
80
|
"from": "^3.0.6",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
},
|
|
84
84
|
"depsUpdated": 4,
|
|
85
85
|
"originalPackage": "@graphql-tools/delegate",
|
|
86
|
-
"originalVersion": "12.1.
|
|
87
|
-
"processedAt": "2026-
|
|
86
|
+
"originalVersion": "12.1.1",
|
|
87
|
+
"processedAt": "2026-08-13T00:27:25.909Z",
|
|
88
88
|
"smokeTest": "passed"
|
|
89
89
|
}
|
|
90
90
|
}
|