@depup/graphql-tools__delegate 12.1.2-depup.0 → 12.1.4-depup.0
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 +48 -8
- package/dist/index.d.cts +11 -3
- package/dist/index.d.ts +11 -3
- package/dist/index.js +48 -8
- package/package.json +10 -10
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-09-
|
|
16
|
+
| Original | [@graphql-tools/delegate](https://www.npmjs.com/package/@graphql-tools/delegate) @ 12.1.4 |
|
|
17
|
+
| Processed | 2026-09-08 |
|
|
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 | ^2.0.
|
|
26
|
-
| @graphql-tools/schema | ^10.0.29 | ^10.1.
|
|
27
|
-
| @graphql-tools/utils | ^11.0.0 | ^12.0.
|
|
25
|
+
| @graphql-tools/executor | ^1.4.13 | ^2.0.1 |
|
|
26
|
+
| @graphql-tools/schema | ^10.0.29 | ^10.1.1 |
|
|
27
|
+
| @graphql-tools/utils | ^11.0.0 | ^12.0.1 |
|
|
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": "^2.0.
|
|
5
|
+
"to": "^2.0.1"
|
|
6
6
|
},
|
|
7
7
|
"@graphql-tools/schema": {
|
|
8
8
|
"from": "^10.0.29",
|
|
9
|
-
"to": "^10.1.
|
|
9
|
+
"to": "^10.1.1"
|
|
10
10
|
},
|
|
11
11
|
"@graphql-tools/utils": {
|
|
12
12
|
"from": "^11.0.0",
|
|
13
|
-
"to": "^12.0.
|
|
13
|
+
"to": "^12.0.1"
|
|
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-09-
|
|
20
|
+
"timestamp": "2026-09-08T00:32:22.102Z",
|
|
21
21
|
"totalUpdated": 4
|
|
22
22
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -75,6 +75,22 @@ const prototypePollutingKeys = [
|
|
|
75
75
|
function isPrototypePollutingKey(key) {
|
|
76
76
|
return prototypePollutingKeys.includes(key);
|
|
77
77
|
}
|
|
78
|
+
function removePrototypePollutingKeys(value) {
|
|
79
|
+
if (Array.isArray(value)) {
|
|
80
|
+
for (const item of value) {
|
|
81
|
+
removePrototypePollutingKeys(item);
|
|
82
|
+
}
|
|
83
|
+
} else if (value && typeof value === "object" && !(value instanceof Error)) {
|
|
84
|
+
for (const key of Object.keys(value)) {
|
|
85
|
+
if (isPrototypePollutingKey(key)) {
|
|
86
|
+
delete value[key];
|
|
87
|
+
} else {
|
|
88
|
+
removePrototypePollutingKeys(value[key]);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return value;
|
|
93
|
+
}
|
|
78
94
|
|
|
79
95
|
const leftOverByDelegationPlan = /* @__PURE__ */ new WeakMap();
|
|
80
96
|
const PLAN_LEFT_OVER = Symbol("PLAN_LEFT_OVER");
|
|
@@ -106,19 +122,18 @@ function getSubschema(object, responseKey) {
|
|
|
106
122
|
function getUnpathedErrors(object) {
|
|
107
123
|
return object[UNPATHED_ERRORS_SYMBOL];
|
|
108
124
|
}
|
|
109
|
-
const EMPTY_ARRAY = [];
|
|
110
125
|
const EMPTY_OBJECT = /* @__PURE__ */ Object.create(null);
|
|
111
126
|
const getActualFieldNodes = utils.memoize1(function(fieldNode) {
|
|
112
127
|
return [fieldNode];
|
|
113
128
|
});
|
|
114
|
-
function mergeFields(mergedTypeInfo, object, sourceSubschema, context, info) {
|
|
129
|
+
function mergeFields(mergedTypeInfo, object, sourceSubschema, context, info, fieldNodes = info.fieldNodes) {
|
|
115
130
|
const variableValues = getCoercedVariableValues(info.variableValues);
|
|
116
131
|
const delegationMaps = mergedTypeInfo.delegationPlanBuilder(
|
|
117
132
|
info.schema,
|
|
118
133
|
sourceSubschema,
|
|
119
134
|
variableValues != null && Object.keys(variableValues).length > 0 ? variableValues : EMPTY_OBJECT,
|
|
120
135
|
info.fragments != null && Object.keys(info.fragments).length > 0 ? info.fragments : EMPTY_OBJECT,
|
|
121
|
-
|
|
136
|
+
fieldNodes.length === 1 && fieldNodes[0] ? getActualFieldNodes(fieldNodes[0]) : fieldNodes,
|
|
122
137
|
context,
|
|
123
138
|
info
|
|
124
139
|
);
|
|
@@ -189,7 +204,9 @@ function handleResolverResult(resolverResult, subschema, selectionSet, object, c
|
|
|
189
204
|
continue;
|
|
190
205
|
}
|
|
191
206
|
const existingPropValue = object[responseKey];
|
|
192
|
-
const sourcePropValue =
|
|
207
|
+
const sourcePropValue = removePrototypePollutingKeys(
|
|
208
|
+
resolverResult[responseKey]
|
|
209
|
+
);
|
|
193
210
|
if (responseKey === "__typename" && existingPropValue !== sourcePropValue && graphql.isAbstractType(subschema.transformedSchema.getType(sourcePropValue))) {
|
|
194
211
|
continue;
|
|
195
212
|
}
|
|
@@ -2586,9 +2603,9 @@ function defaultMergedResolver(parent, args, context, info) {
|
|
|
2586
2603
|
}
|
|
2587
2604
|
const deferred = promiseHelpers.createDeferredPromise();
|
|
2588
2605
|
missingDeferredFields.set(responseKey, deferred);
|
|
2589
|
-
const
|
|
2590
|
-
const
|
|
2591
|
-
const fieldNodesByType =
|
|
2606
|
+
const stitchingInfo2 = info.schema.extensions?.["stitchingInfo"];
|
|
2607
|
+
const parentTypeName2 = parent?.__typename || info.parentType.name;
|
|
2608
|
+
const fieldNodesByType = stitchingInfo2?.fieldNodesByField?.[parentTypeName2]?.[info.fieldName];
|
|
2592
2609
|
if (fieldNodesByType?.every((fieldNode) => {
|
|
2593
2610
|
const responseKey2 = fieldNode.alias?.value ?? fieldNode.name.value;
|
|
2594
2611
|
return Object.prototype.hasOwnProperty.call(parent, responseKey2);
|
|
@@ -2602,6 +2619,29 @@ function defaultMergedResolver(parent, args, context, info) {
|
|
|
2602
2619
|
if (Object.prototype.hasOwnProperty.call(parent, info.fieldName)) {
|
|
2603
2620
|
return graphql.defaultFieldResolver(parent, args, context, info);
|
|
2604
2621
|
}
|
|
2622
|
+
const stitchingInfo = info.schema?.extensions?.["stitchingInfo"];
|
|
2623
|
+
const parentTypeName = parent.__typename || info.parentType?.name;
|
|
2624
|
+
const mergedTypeInfo = parentTypeName ? stitchingInfo?.mergedTypes[parentTypeName] : void 0;
|
|
2625
|
+
const sourceSubschema = parent[OBJECT_SUBSCHEMA_SYMBOL];
|
|
2626
|
+
if (mergedTypeInfo && sourceSubschema) {
|
|
2627
|
+
const fieldNode = {
|
|
2628
|
+
kind: graphql.Kind.FIELD,
|
|
2629
|
+
name: info.fieldNodes[0]?.name ?? {
|
|
2630
|
+
kind: graphql.Kind.NAME,
|
|
2631
|
+
value: info.fieldName
|
|
2632
|
+
},
|
|
2633
|
+
selectionSet: {
|
|
2634
|
+
kind: graphql.Kind.SELECTION_SET,
|
|
2635
|
+
selections: info.fieldNodes
|
|
2636
|
+
}
|
|
2637
|
+
};
|
|
2638
|
+
return promiseHelpers.handleMaybePromise(
|
|
2639
|
+
() => mergeFields(mergedTypeInfo, parent, sourceSubschema, context, info, [
|
|
2640
|
+
fieldNode
|
|
2641
|
+
]),
|
|
2642
|
+
() => Object.prototype.hasOwnProperty.call(parent, responseKey) ? handleResult(parent, responseKey, context, info) : void 0
|
|
2643
|
+
);
|
|
2644
|
+
}
|
|
2605
2645
|
return void 0;
|
|
2606
2646
|
}
|
|
2607
2647
|
return handleResult(parent, responseKey, context, info);
|
|
@@ -3511,7 +3551,6 @@ Object.defineProperty(exports, "createDefaultExecutor", {
|
|
|
3511
3551
|
enumerable: true,
|
|
3512
3552
|
get: function () { return executor.executorFromSchema; }
|
|
3513
3553
|
});
|
|
3514
|
-
exports.EMPTY_ARRAY = EMPTY_ARRAY;
|
|
3515
3554
|
exports.EMPTY_OBJECT = EMPTY_OBJECT;
|
|
3516
3555
|
exports.FIELD_SUBSCHEMA_MAP_SYMBOL = FIELD_SUBSCHEMA_MAP_SYMBOL;
|
|
3517
3556
|
exports.OBJECT_SUBSCHEMA_SYMBOL = OBJECT_SUBSCHEMA_SYMBOL;
|
|
@@ -3543,5 +3582,6 @@ exports.isSubschema = isSubschema;
|
|
|
3543
3582
|
exports.isSubschemaConfig = isSubschemaConfig;
|
|
3544
3583
|
exports.leftOverByDelegationPlan = leftOverByDelegationPlan;
|
|
3545
3584
|
exports.mergeFields = mergeFields;
|
|
3585
|
+
exports.removePrototypePollutingKeys = removePrototypePollutingKeys;
|
|
3546
3586
|
exports.resolveExternalValue = resolveExternalValue;
|
|
3547
3587
|
exports.subtractSelectionSets = subtractSelectionSets;
|
package/dist/index.d.cts
CHANGED
|
@@ -199,10 +199,9 @@ declare function isExternalObject(data: any): data is ExternalObject;
|
|
|
199
199
|
declare function annotateExternalObject<TContext>(object: any, errors: Array<GraphQLError>, subschema: GraphQLSchema | SubschemaConfig<any, any, any, TContext> | undefined, subschemaMap: Record<string, GraphQLSchema | SubschemaConfig<any, any, any, Record<string, any>>>): ExternalObject;
|
|
200
200
|
declare function getSubschema(object: ExternalObject, responseKey: string): GraphQLSchema | SubschemaConfig;
|
|
201
201
|
declare function getUnpathedErrors(object: ExternalObject): Array<GraphQLError>;
|
|
202
|
-
declare const EMPTY_ARRAY: any[];
|
|
203
202
|
declare const EMPTY_OBJECT: any;
|
|
204
203
|
declare const getActualFieldNodes: (fieldNode: FieldNode) => FieldNode[];
|
|
205
|
-
declare function mergeFields<TContext>(mergedTypeInfo: MergedTypeInfo, object: any, sourceSubschema: Subschema<any, any, any, TContext>, context: any, info: GraphQLResolveInfo): MaybePromise<any>;
|
|
204
|
+
declare function mergeFields<TContext>(mergedTypeInfo: MergedTypeInfo, object: any, sourceSubschema: Subschema<any, any, any, TContext>, context: any, info: GraphQLResolveInfo, fieldNodes?: FieldNode[]): MaybePromise<any>;
|
|
206
205
|
declare function handleResolverResult(resolverResult: any, subschema: Subschema, selectionSet: SelectionSetNode, object: ExternalObject, combinedFieldSubschemaMap: Record<string, GraphQLSchema | SubschemaConfig<any, any, any, Record<string, any>>>, info: GraphQLResolveInfo, path: Array<string | number>, combinedErrors: Array<GraphQLError>): void;
|
|
207
206
|
|
|
208
207
|
declare function resolveExternalValue<TContext extends Record<string, any>>(result: any, unpathedErrors: Array<GraphQLError>, subschema: GraphQLSchema | SubschemaConfig<any, any, any, TContext>, context?: Record<string, any>, info?: GraphQLResolveInfo, returnType?: GraphQLOutputType, skipTypeMerging?: boolean): any;
|
|
@@ -236,7 +235,16 @@ declare const getTypeInfoWithType: (schema: GraphQLSchema, type: Maybe<GraphQLTy
|
|
|
236
235
|
declare const prototypePollutingKeys: readonly ["__proto__", "constructor", "prototype"];
|
|
237
236
|
type PrototypePollutingKey = (typeof prototypePollutingKeys)[number];
|
|
238
237
|
declare function isPrototypePollutingKey(key: string): key is PrototypePollutingKey;
|
|
238
|
+
/**
|
|
239
|
+
* Removes prototype polluting keys from the given value, in place and at every depth.
|
|
240
|
+
*
|
|
241
|
+
* Response data coming from a subgraph can contain keys such as `__proto__` or
|
|
242
|
+
* `constructor` when the client aliases a field to one of those names. Deep merging
|
|
243
|
+
* such data walks the prototype chain and can end up writing to `Object.prototype` or
|
|
244
|
+
* `Function.prototype`, so the keys are dropped before any merge happens.
|
|
245
|
+
*/
|
|
246
|
+
declare function removePrototypePollutingKeys<T>(value: T): T;
|
|
239
247
|
|
|
240
248
|
declare const handleOverrideByDelegation: (info: GraphQLResolveInfo$1, context: any, overrideHandler: OverrideHandler) => boolean;
|
|
241
249
|
|
|
242
|
-
export { type BatchingOptions, type CreateProxyingResolverFn, type Deferred, type DelegationContext, type DelegationPlanBuilder, type DelegationPlanLeftOver,
|
|
250
|
+
export { type BatchingOptions, type CreateProxyingResolverFn, type Deferred, type DelegationContext, type DelegationPlanBuilder, type DelegationPlanLeftOver, EMPTY_OBJECT, type ExternalObject, FIELD_SUBSCHEMA_MAP_SYMBOL, type ICreateProxyingResolverOptions, type ICreateRequest, type IDelegateRequestOptions, type IDelegateToSchemaOptions, type MergedFieldConfig, type MergedTypeConfig, type MergedTypeEntryPoint, type MergedTypeInfo, type MergedTypeResolver, type MergedTypeResolverOptions, OBJECT_SUBSCHEMA_SYMBOL, type OverrideHandler, PLAN_LEFT_OVER, type RequestTransform, type ResultTransform, type SchemaTransform, type StitchingInfo, Subschema, type SubschemaConfig, type Transform, Transformer, UNPATHED_ERRORS_SYMBOL, annotateExternalObject, applySchemaTransforms, cloneSubschemaConfig, createRequest, defaultMergedResolver, delegateRequest, delegateToSchema, extractUnavailableFields, extractUnavailableFieldsFromSelectionSet, getActualFieldNodes, getDelegatingOperation, getPlanLeftOverFromParent, getSubschema, getTypeInfo, getTypeInfoWithType, getUnpathedErrors, handleOverrideByDelegation, handleResolverResult, isExternalObject, isPrototypePollutingKey, isSubschema, isSubschemaConfig, leftOverByDelegationPlan, mergeFields, removePrototypePollutingKeys, resolveExternalValue, subtractSelectionSets };
|
package/dist/index.d.ts
CHANGED
|
@@ -199,10 +199,9 @@ declare function isExternalObject(data: any): data is ExternalObject;
|
|
|
199
199
|
declare function annotateExternalObject<TContext>(object: any, errors: Array<GraphQLError>, subschema: GraphQLSchema | SubschemaConfig<any, any, any, TContext> | undefined, subschemaMap: Record<string, GraphQLSchema | SubschemaConfig<any, any, any, Record<string, any>>>): ExternalObject;
|
|
200
200
|
declare function getSubschema(object: ExternalObject, responseKey: string): GraphQLSchema | SubschemaConfig;
|
|
201
201
|
declare function getUnpathedErrors(object: ExternalObject): Array<GraphQLError>;
|
|
202
|
-
declare const EMPTY_ARRAY: any[];
|
|
203
202
|
declare const EMPTY_OBJECT: any;
|
|
204
203
|
declare const getActualFieldNodes: (fieldNode: FieldNode) => FieldNode[];
|
|
205
|
-
declare function mergeFields<TContext>(mergedTypeInfo: MergedTypeInfo, object: any, sourceSubschema: Subschema<any, any, any, TContext>, context: any, info: GraphQLResolveInfo): MaybePromise<any>;
|
|
204
|
+
declare function mergeFields<TContext>(mergedTypeInfo: MergedTypeInfo, object: any, sourceSubschema: Subschema<any, any, any, TContext>, context: any, info: GraphQLResolveInfo, fieldNodes?: FieldNode[]): MaybePromise<any>;
|
|
206
205
|
declare function handleResolverResult(resolverResult: any, subschema: Subschema, selectionSet: SelectionSetNode, object: ExternalObject, combinedFieldSubschemaMap: Record<string, GraphQLSchema | SubschemaConfig<any, any, any, Record<string, any>>>, info: GraphQLResolveInfo, path: Array<string | number>, combinedErrors: Array<GraphQLError>): void;
|
|
207
206
|
|
|
208
207
|
declare function resolveExternalValue<TContext extends Record<string, any>>(result: any, unpathedErrors: Array<GraphQLError>, subschema: GraphQLSchema | SubschemaConfig<any, any, any, TContext>, context?: Record<string, any>, info?: GraphQLResolveInfo, returnType?: GraphQLOutputType, skipTypeMerging?: boolean): any;
|
|
@@ -236,7 +235,16 @@ declare const getTypeInfoWithType: (schema: GraphQLSchema, type: Maybe<GraphQLTy
|
|
|
236
235
|
declare const prototypePollutingKeys: readonly ["__proto__", "constructor", "prototype"];
|
|
237
236
|
type PrototypePollutingKey = (typeof prototypePollutingKeys)[number];
|
|
238
237
|
declare function isPrototypePollutingKey(key: string): key is PrototypePollutingKey;
|
|
238
|
+
/**
|
|
239
|
+
* Removes prototype polluting keys from the given value, in place and at every depth.
|
|
240
|
+
*
|
|
241
|
+
* Response data coming from a subgraph can contain keys such as `__proto__` or
|
|
242
|
+
* `constructor` when the client aliases a field to one of those names. Deep merging
|
|
243
|
+
* such data walks the prototype chain and can end up writing to `Object.prototype` or
|
|
244
|
+
* `Function.prototype`, so the keys are dropped before any merge happens.
|
|
245
|
+
*/
|
|
246
|
+
declare function removePrototypePollutingKeys<T>(value: T): T;
|
|
239
247
|
|
|
240
248
|
declare const handleOverrideByDelegation: (info: GraphQLResolveInfo$1, context: any, overrideHandler: OverrideHandler) => boolean;
|
|
241
249
|
|
|
242
|
-
export { type BatchingOptions, type CreateProxyingResolverFn, type Deferred, type DelegationContext, type DelegationPlanBuilder, type DelegationPlanLeftOver,
|
|
250
|
+
export { type BatchingOptions, type CreateProxyingResolverFn, type Deferred, type DelegationContext, type DelegationPlanBuilder, type DelegationPlanLeftOver, EMPTY_OBJECT, type ExternalObject, FIELD_SUBSCHEMA_MAP_SYMBOL, type ICreateProxyingResolverOptions, type ICreateRequest, type IDelegateRequestOptions, type IDelegateToSchemaOptions, type MergedFieldConfig, type MergedTypeConfig, type MergedTypeEntryPoint, type MergedTypeInfo, type MergedTypeResolver, type MergedTypeResolverOptions, OBJECT_SUBSCHEMA_SYMBOL, type OverrideHandler, PLAN_LEFT_OVER, type RequestTransform, type ResultTransform, type SchemaTransform, type StitchingInfo, Subschema, type SubschemaConfig, type Transform, Transformer, UNPATHED_ERRORS_SYMBOL, annotateExternalObject, applySchemaTransforms, cloneSubschemaConfig, createRequest, defaultMergedResolver, delegateRequest, delegateToSchema, extractUnavailableFields, extractUnavailableFieldsFromSelectionSet, getActualFieldNodes, getDelegatingOperation, getPlanLeftOverFromParent, getSubschema, getTypeInfo, getTypeInfoWithType, getUnpathedErrors, handleOverrideByDelegation, handleResolverResult, isExternalObject, isPrototypePollutingKey, isSubschema, isSubschemaConfig, leftOverByDelegationPlan, mergeFields, removePrototypePollutingKeys, resolveExternalValue, subtractSelectionSets };
|
package/dist/index.js
CHANGED
|
@@ -75,6 +75,22 @@ const prototypePollutingKeys = [
|
|
|
75
75
|
function isPrototypePollutingKey(key) {
|
|
76
76
|
return prototypePollutingKeys.includes(key);
|
|
77
77
|
}
|
|
78
|
+
function removePrototypePollutingKeys(value) {
|
|
79
|
+
if (Array.isArray(value)) {
|
|
80
|
+
for (const item of value) {
|
|
81
|
+
removePrototypePollutingKeys(item);
|
|
82
|
+
}
|
|
83
|
+
} else if (value && typeof value === "object" && !(value instanceof Error)) {
|
|
84
|
+
for (const key of Object.keys(value)) {
|
|
85
|
+
if (isPrototypePollutingKey(key)) {
|
|
86
|
+
delete value[key];
|
|
87
|
+
} else {
|
|
88
|
+
removePrototypePollutingKeys(value[key]);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return value;
|
|
93
|
+
}
|
|
78
94
|
|
|
79
95
|
const leftOverByDelegationPlan = /* @__PURE__ */ new WeakMap();
|
|
80
96
|
const PLAN_LEFT_OVER = Symbol("PLAN_LEFT_OVER");
|
|
@@ -106,19 +122,18 @@ function getSubschema(object, responseKey) {
|
|
|
106
122
|
function getUnpathedErrors(object) {
|
|
107
123
|
return object[UNPATHED_ERRORS_SYMBOL];
|
|
108
124
|
}
|
|
109
|
-
const EMPTY_ARRAY = [];
|
|
110
125
|
const EMPTY_OBJECT = /* @__PURE__ */ Object.create(null);
|
|
111
126
|
const getActualFieldNodes = memoize1(function(fieldNode) {
|
|
112
127
|
return [fieldNode];
|
|
113
128
|
});
|
|
114
|
-
function mergeFields(mergedTypeInfo, object, sourceSubschema, context, info) {
|
|
129
|
+
function mergeFields(mergedTypeInfo, object, sourceSubschema, context, info, fieldNodes = info.fieldNodes) {
|
|
115
130
|
const variableValues = getCoercedVariableValues(info.variableValues);
|
|
116
131
|
const delegationMaps = mergedTypeInfo.delegationPlanBuilder(
|
|
117
132
|
info.schema,
|
|
118
133
|
sourceSubschema,
|
|
119
134
|
variableValues != null && Object.keys(variableValues).length > 0 ? variableValues : EMPTY_OBJECT,
|
|
120
135
|
info.fragments != null && Object.keys(info.fragments).length > 0 ? info.fragments : EMPTY_OBJECT,
|
|
121
|
-
|
|
136
|
+
fieldNodes.length === 1 && fieldNodes[0] ? getActualFieldNodes(fieldNodes[0]) : fieldNodes,
|
|
122
137
|
context,
|
|
123
138
|
info
|
|
124
139
|
);
|
|
@@ -189,7 +204,9 @@ function handleResolverResult(resolverResult, subschema, selectionSet, object, c
|
|
|
189
204
|
continue;
|
|
190
205
|
}
|
|
191
206
|
const existingPropValue = object[responseKey];
|
|
192
|
-
const sourcePropValue =
|
|
207
|
+
const sourcePropValue = removePrototypePollutingKeys(
|
|
208
|
+
resolverResult[responseKey]
|
|
209
|
+
);
|
|
193
210
|
if (responseKey === "__typename" && existingPropValue !== sourcePropValue && isAbstractType(subschema.transformedSchema.getType(sourcePropValue))) {
|
|
194
211
|
continue;
|
|
195
212
|
}
|
|
@@ -2586,9 +2603,9 @@ function defaultMergedResolver(parent, args, context, info) {
|
|
|
2586
2603
|
}
|
|
2587
2604
|
const deferred = createDeferredPromise();
|
|
2588
2605
|
missingDeferredFields.set(responseKey, deferred);
|
|
2589
|
-
const
|
|
2590
|
-
const
|
|
2591
|
-
const fieldNodesByType =
|
|
2606
|
+
const stitchingInfo2 = info.schema.extensions?.["stitchingInfo"];
|
|
2607
|
+
const parentTypeName2 = parent?.__typename || info.parentType.name;
|
|
2608
|
+
const fieldNodesByType = stitchingInfo2?.fieldNodesByField?.[parentTypeName2]?.[info.fieldName];
|
|
2592
2609
|
if (fieldNodesByType?.every((fieldNode) => {
|
|
2593
2610
|
const responseKey2 = fieldNode.alias?.value ?? fieldNode.name.value;
|
|
2594
2611
|
return Object.prototype.hasOwnProperty.call(parent, responseKey2);
|
|
@@ -2602,6 +2619,29 @@ function defaultMergedResolver(parent, args, context, info) {
|
|
|
2602
2619
|
if (Object.prototype.hasOwnProperty.call(parent, info.fieldName)) {
|
|
2603
2620
|
return defaultFieldResolver(parent, args, context, info);
|
|
2604
2621
|
}
|
|
2622
|
+
const stitchingInfo = info.schema?.extensions?.["stitchingInfo"];
|
|
2623
|
+
const parentTypeName = parent.__typename || info.parentType?.name;
|
|
2624
|
+
const mergedTypeInfo = parentTypeName ? stitchingInfo?.mergedTypes[parentTypeName] : void 0;
|
|
2625
|
+
const sourceSubschema = parent[OBJECT_SUBSCHEMA_SYMBOL];
|
|
2626
|
+
if (mergedTypeInfo && sourceSubschema) {
|
|
2627
|
+
const fieldNode = {
|
|
2628
|
+
kind: Kind.FIELD,
|
|
2629
|
+
name: info.fieldNodes[0]?.name ?? {
|
|
2630
|
+
kind: Kind.NAME,
|
|
2631
|
+
value: info.fieldName
|
|
2632
|
+
},
|
|
2633
|
+
selectionSet: {
|
|
2634
|
+
kind: Kind.SELECTION_SET,
|
|
2635
|
+
selections: info.fieldNodes
|
|
2636
|
+
}
|
|
2637
|
+
};
|
|
2638
|
+
return handleMaybePromise(
|
|
2639
|
+
() => mergeFields(mergedTypeInfo, parent, sourceSubschema, context, info, [
|
|
2640
|
+
fieldNode
|
|
2641
|
+
]),
|
|
2642
|
+
() => Object.prototype.hasOwnProperty.call(parent, responseKey) ? handleResult(parent, responseKey, context, info) : void 0
|
|
2643
|
+
);
|
|
2644
|
+
}
|
|
2605
2645
|
return void 0;
|
|
2606
2646
|
}
|
|
2607
2647
|
return handleResult(parent, responseKey, context, info);
|
|
@@ -3503,4 +3543,4 @@ function subtractSelectionSets(selectionSetA, selectionSetB, fragments = {}) {
|
|
|
3503
3543
|
};
|
|
3504
3544
|
}
|
|
3505
3545
|
|
|
3506
|
-
export {
|
|
3546
|
+
export { EMPTY_OBJECT, FIELD_SUBSCHEMA_MAP_SYMBOL, OBJECT_SUBSCHEMA_SYMBOL, PLAN_LEFT_OVER, Subschema, Transformer, UNPATHED_ERRORS_SYMBOL, annotateExternalObject, applySchemaTransforms, cloneSubschemaConfig, createRequest, defaultMergedResolver, delegateRequest, delegateToSchema, extractUnavailableFields, extractUnavailableFieldsFromSelectionSet, getActualFieldNodes, getDelegatingOperation, getPlanLeftOverFromParent, getSubschema, getTypeInfo, getTypeInfoWithType, getUnpathedErrors, handleOverrideByDelegation, handleResolverResult, isExternalObject, isPrototypePollutingKey, isSubschema, isSubschemaConfig, leftOverByDelegationPlan, mergeFields, removePrototypePollutingKeys, resolveExternalValue, subtractSelectionSets };
|
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.4-depup.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A set of utils for faster development of GraphQL tools (with updated dependencies)",
|
|
6
6
|
"repository": {
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@graphql-tools/batch-execute": "^10.0
|
|
43
|
-
"@graphql-tools/executor": "^2.0.
|
|
44
|
-
"@graphql-tools/schema": "^10.1.
|
|
45
|
-
"@graphql-tools/utils": "^12.0.
|
|
42
|
+
"@graphql-tools/batch-execute": "^10.1.0",
|
|
43
|
+
"@graphql-tools/executor": "^2.0.1",
|
|
44
|
+
"@graphql-tools/schema": "^10.1.1",
|
|
45
|
+
"@graphql-tools/utils": "^12.0.1",
|
|
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": "^2.0.
|
|
69
|
+
"to": "^2.0.1"
|
|
70
70
|
},
|
|
71
71
|
"@graphql-tools/schema": {
|
|
72
72
|
"from": "^10.0.29",
|
|
73
|
-
"to": "^10.1.
|
|
73
|
+
"to": "^10.1.1"
|
|
74
74
|
},
|
|
75
75
|
"@graphql-tools/utils": {
|
|
76
76
|
"from": "^11.0.0",
|
|
77
|
-
"to": "^12.0.
|
|
77
|
+
"to": "^12.0.1"
|
|
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-09-
|
|
86
|
+
"originalVersion": "12.1.4",
|
|
87
|
+
"processedAt": "2026-09-08T00:32:30.879Z",
|
|
88
88
|
"smokeTest": "passed"
|
|
89
89
|
}
|
|
90
90
|
}
|