@graphql-tools/wrap 10.0.27 → 10.0.28-alpha-e8878e64f4cd1ea558f9ae1848b2e315883294cd
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 +7 -0
- package/dist/index.cjs +69 -69
- package/dist/index.js +69 -69
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @graphql-tools/wrap
|
|
2
2
|
|
|
3
|
+
## 10.0.28-alpha-e8878e64f4cd1ea558f9ae1848b2e315883294cd
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`e8878e6`](https://github.com/graphql-hive/gateway/commit/e8878e64f4cd1ea558f9ae1848b2e315883294cd)]:
|
|
8
|
+
- @graphql-tools/delegate@10.2.10-alpha-e8878e64f4cd1ea558f9ae1848b2e315883294cd
|
|
9
|
+
|
|
3
10
|
## 10.0.27
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -47,7 +47,7 @@ function createPossiblyNestedProxyingResolver(subschemaConfig, proxyingResolver)
|
|
|
47
47
|
if (delegate.isExternalObject(parent)) {
|
|
48
48
|
const unpathedErrors = delegate.getUnpathedErrors(parent);
|
|
49
49
|
const subschema = delegate.getSubschema(parent, responseKey);
|
|
50
|
-
if (subschemaConfig === subschema && parent[responseKey] !==
|
|
50
|
+
if (subschemaConfig === subschema && parent[responseKey] !== undefined) {
|
|
51
51
|
return delegate.resolveExternalValue(
|
|
52
52
|
parent[responseKey],
|
|
53
53
|
unpathedErrors,
|
|
@@ -94,34 +94,34 @@ function createWrappingSchema(schema, proxyingResolvers) {
|
|
|
94
94
|
return {
|
|
95
95
|
...fieldConfig,
|
|
96
96
|
resolve: delegate.defaultMergedResolver,
|
|
97
|
-
subscribe:
|
|
97
|
+
subscribe: undefined
|
|
98
98
|
};
|
|
99
99
|
},
|
|
100
100
|
[utils.MapperKind.OBJECT_TYPE]: (type) => {
|
|
101
101
|
const config = type.toConfig();
|
|
102
102
|
return new graphql.GraphQLObjectType({
|
|
103
103
|
...config,
|
|
104
|
-
isTypeOf:
|
|
104
|
+
isTypeOf: undefined
|
|
105
105
|
});
|
|
106
106
|
},
|
|
107
107
|
[utils.MapperKind.INTERFACE_TYPE]: (type) => {
|
|
108
108
|
const config = type.toConfig();
|
|
109
109
|
return new graphql.GraphQLInterfaceType({
|
|
110
110
|
...config,
|
|
111
|
-
resolveType:
|
|
111
|
+
resolveType: undefined
|
|
112
112
|
});
|
|
113
113
|
},
|
|
114
114
|
[utils.MapperKind.UNION_TYPE]: (type) => {
|
|
115
115
|
const config = type.toConfig();
|
|
116
116
|
return new graphql.GraphQLUnionType({
|
|
117
117
|
...config,
|
|
118
|
-
resolveType:
|
|
118
|
+
resolveType: undefined
|
|
119
119
|
});
|
|
120
120
|
},
|
|
121
121
|
[utils.MapperKind.ENUM_VALUE]: (valueConfig) => {
|
|
122
122
|
return {
|
|
123
123
|
...valueConfig,
|
|
124
|
-
value:
|
|
124
|
+
value: undefined
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
127
|
});
|
|
@@ -148,14 +148,14 @@ class RenameTypes {
|
|
|
148
148
|
return utils.mapSchema(originalWrappingSchema, {
|
|
149
149
|
[utils.MapperKind.TYPE]: (type) => {
|
|
150
150
|
if (graphql.isSpecifiedScalarType(type) && !this.renameBuiltins) {
|
|
151
|
-
return
|
|
151
|
+
return undefined;
|
|
152
152
|
}
|
|
153
153
|
if (graphql.isScalarType(type) && !this.renameScalars) {
|
|
154
|
-
return
|
|
154
|
+
return undefined;
|
|
155
155
|
}
|
|
156
156
|
const oldName = type.name;
|
|
157
157
|
const newName = this.renamer(oldName);
|
|
158
|
-
if (newName !==
|
|
158
|
+
if (newName !== undefined && newName !== oldName) {
|
|
159
159
|
if (typeNames.has(newName)) {
|
|
160
160
|
console.warn(
|
|
161
161
|
`New type name ${newName} for ${oldName} already exists in the schema. Skip renaming.`
|
|
@@ -168,10 +168,10 @@ class RenameTypes {
|
|
|
168
168
|
typeNames.add(newName);
|
|
169
169
|
return utils.renameType(type, newName);
|
|
170
170
|
}
|
|
171
|
-
return
|
|
171
|
+
return undefined;
|
|
172
172
|
},
|
|
173
173
|
[utils.MapperKind.ROOT_OBJECT]() {
|
|
174
|
-
return
|
|
174
|
+
return undefined;
|
|
175
175
|
}
|
|
176
176
|
});
|
|
177
177
|
}
|
|
@@ -188,7 +188,7 @@ class RenameTypes {
|
|
|
188
188
|
}
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
|
-
return
|
|
191
|
+
return undefined;
|
|
192
192
|
}
|
|
193
193
|
});
|
|
194
194
|
return {
|
|
@@ -219,7 +219,7 @@ class FilterTypes {
|
|
|
219
219
|
return utils.mapSchema(originalWrappingSchema, {
|
|
220
220
|
[utils.MapperKind.TYPE]: (type) => {
|
|
221
221
|
if (this.filter(type)) {
|
|
222
|
-
return
|
|
222
|
+
return undefined;
|
|
223
223
|
}
|
|
224
224
|
return null;
|
|
225
225
|
}
|
|
@@ -241,12 +241,12 @@ class RenameRootTypes {
|
|
|
241
241
|
[utils.MapperKind.ROOT_OBJECT]: (type) => {
|
|
242
242
|
const oldName = type.name;
|
|
243
243
|
const newName = this.renamer(oldName);
|
|
244
|
-
if (newName !==
|
|
244
|
+
if (newName !== undefined && newName !== oldName) {
|
|
245
245
|
this.map[oldName] = newName;
|
|
246
246
|
this.reverseMap[newName] = oldName;
|
|
247
247
|
return utils.renameType(type, newName);
|
|
248
248
|
}
|
|
249
|
-
return
|
|
249
|
+
return undefined;
|
|
250
250
|
}
|
|
251
251
|
});
|
|
252
252
|
}
|
|
@@ -263,7 +263,7 @@ class RenameRootTypes {
|
|
|
263
263
|
}
|
|
264
264
|
};
|
|
265
265
|
}
|
|
266
|
-
return
|
|
266
|
+
return undefined;
|
|
267
267
|
}
|
|
268
268
|
});
|
|
269
269
|
return {
|
|
@@ -303,7 +303,7 @@ class TransformCompositeFields {
|
|
|
303
303
|
}
|
|
304
304
|
_getTypeInfo() {
|
|
305
305
|
const typeInfo = this.typeInfo;
|
|
306
|
-
if (typeInfo ===
|
|
306
|
+
if (typeInfo === undefined) {
|
|
307
307
|
throw new Error(
|
|
308
308
|
`The TransformCompositeFields transform's "transformRequest" and "transformResult" methods cannot be used without first calling "transformSchema".`
|
|
309
309
|
);
|
|
@@ -381,7 +381,7 @@ class TransformCompositeFields {
|
|
|
381
381
|
transformSelectionSet(node, typeInfo, fragments, transformationContext) {
|
|
382
382
|
const parentType = typeInfo.getParentType();
|
|
383
383
|
if (parentType == null) {
|
|
384
|
-
return
|
|
384
|
+
return undefined;
|
|
385
385
|
}
|
|
386
386
|
const parentTypeName = parentType.name;
|
|
387
387
|
let newSelections = [];
|
|
@@ -406,7 +406,7 @@ class TransformCompositeFields {
|
|
|
406
406
|
fragments,
|
|
407
407
|
transformationContext
|
|
408
408
|
);
|
|
409
|
-
transformedSelection = transformedSelection ===
|
|
409
|
+
transformedSelection = transformedSelection === undefined ? selection : transformedSelection;
|
|
410
410
|
}
|
|
411
411
|
if (transformedSelection == null) {
|
|
412
412
|
continue;
|
|
@@ -465,7 +465,7 @@ class TransformObjectFields {
|
|
|
465
465
|
}
|
|
466
466
|
_getTransformer() {
|
|
467
467
|
const transformer = this.transformer;
|
|
468
|
-
if (transformer ===
|
|
468
|
+
if (transformer === undefined) {
|
|
469
469
|
throw new Error(
|
|
470
470
|
`The TransformObjectFields transform's "transformRequest" and "transformResult" methods cannot be used without first calling "transformSchema".`
|
|
471
471
|
);
|
|
@@ -477,7 +477,7 @@ class TransformObjectFields {
|
|
|
477
477
|
if (graphql.isObjectType(originalWrappingSchema.getType(typeName))) {
|
|
478
478
|
return this.objectFieldTransformer(typeName, fieldName, fieldConfig);
|
|
479
479
|
}
|
|
480
|
-
return
|
|
480
|
+
return undefined;
|
|
481
481
|
};
|
|
482
482
|
this.transformer = new TransformCompositeFields(
|
|
483
483
|
compositeToObjectFieldTransformer,
|
|
@@ -514,7 +514,7 @@ class TransformRootFields {
|
|
|
514
514
|
}
|
|
515
515
|
_getTransformer() {
|
|
516
516
|
const transformer = this.transformer;
|
|
517
|
-
if (transformer ===
|
|
517
|
+
if (transformer === undefined) {
|
|
518
518
|
throw new Error(
|
|
519
519
|
`The TransformRootFields transform's "transformRequest" and "transformResult" methods cannot be used without first calling "transformSchema".`
|
|
520
520
|
);
|
|
@@ -536,7 +536,7 @@ class TransformRootFields {
|
|
|
536
536
|
fieldConfig
|
|
537
537
|
);
|
|
538
538
|
}
|
|
539
|
-
return
|
|
539
|
+
return undefined;
|
|
540
540
|
};
|
|
541
541
|
this.transformer = new TransformObjectFields(
|
|
542
542
|
rootToObjectFieldTransformer,
|
|
@@ -591,7 +591,7 @@ class FilterRootFields {
|
|
|
591
591
|
this.transformer = new TransformRootFields(
|
|
592
592
|
(operation, fieldName, fieldConfig) => {
|
|
593
593
|
if (filter(operation, fieldName, fieldConfig)) {
|
|
594
|
-
return
|
|
594
|
+
return undefined;
|
|
595
595
|
}
|
|
596
596
|
return null;
|
|
597
597
|
}
|
|
@@ -638,7 +638,7 @@ class RenameObjectFieldArguments {
|
|
|
638
638
|
const argsConfig = Object.fromEntries(
|
|
639
639
|
Object.entries(fieldConfig.args || []).map(([argName, conf]) => {
|
|
640
640
|
const newName = renamer(typeName, fieldName, argName);
|
|
641
|
-
if (newName !==
|
|
641
|
+
if (newName !== undefined && newName !== argName) {
|
|
642
642
|
if (newName != null) {
|
|
643
643
|
return [newName, conf];
|
|
644
644
|
}
|
|
@@ -677,7 +677,7 @@ class RenameObjectFieldArguments {
|
|
|
677
677
|
[utils.MapperKind.OBJECT_FIELD]: (fieldConfig, fieldName, typeName) => {
|
|
678
678
|
Object.entries(fieldConfig.args || {}).forEach(([argName]) => {
|
|
679
679
|
const newName = this.renamer(typeName, fieldName, argName);
|
|
680
|
-
if (newName !==
|
|
680
|
+
if (newName !== undefined && newName !== fieldName) {
|
|
681
681
|
if (this.reverseMap[typeName] == null) {
|
|
682
682
|
this.reverseMap[typeName] = /* @__PURE__ */ Object.create(null);
|
|
683
683
|
}
|
|
@@ -687,10 +687,10 @@ class RenameObjectFieldArguments {
|
|
|
687
687
|
this.reverseMap[typeName][fieldName][newName] = argName;
|
|
688
688
|
}
|
|
689
689
|
});
|
|
690
|
-
return
|
|
690
|
+
return undefined;
|
|
691
691
|
},
|
|
692
692
|
[utils.MapperKind.ROOT_OBJECT]() {
|
|
693
|
-
return
|
|
693
|
+
return undefined;
|
|
694
694
|
}
|
|
695
695
|
});
|
|
696
696
|
return this.transformer.transformSchema(
|
|
@@ -711,7 +711,7 @@ class FilterObjectFields {
|
|
|
711
711
|
transformer;
|
|
712
712
|
constructor(filter) {
|
|
713
713
|
this.transformer = new TransformObjectFields(
|
|
714
|
-
(typeName, fieldName, fieldConfig) => filter(typeName, fieldName, fieldConfig) ?
|
|
714
|
+
(typeName, fieldName, fieldConfig) => filter(typeName, fieldName, fieldConfig) ? undefined : null
|
|
715
715
|
);
|
|
716
716
|
}
|
|
717
717
|
transformSchema(originalWrappingSchema, subschemaConfig) {
|
|
@@ -732,7 +732,7 @@ class TransformInterfaceFields {
|
|
|
732
732
|
}
|
|
733
733
|
_getTransformer() {
|
|
734
734
|
const transformer = this.transformer;
|
|
735
|
-
if (transformer ===
|
|
735
|
+
if (transformer === undefined) {
|
|
736
736
|
throw new Error(
|
|
737
737
|
`The TransformInterfaceFields transform's "transformRequest" and "transformResult" methods cannot be used without first calling "transformSchema".`
|
|
738
738
|
);
|
|
@@ -744,7 +744,7 @@ class TransformInterfaceFields {
|
|
|
744
744
|
if (graphql.isInterfaceType(originalWrappingSchema.getType(typeName))) {
|
|
745
745
|
return this.interfaceFieldTransformer(typeName, fieldName, fieldConfig);
|
|
746
746
|
}
|
|
747
|
-
return
|
|
747
|
+
return undefined;
|
|
748
748
|
};
|
|
749
749
|
this.transformer = new TransformCompositeFields(
|
|
750
750
|
compositeToObjectFieldTransformer,
|
|
@@ -797,7 +797,7 @@ class FilterInterfaceFields {
|
|
|
797
797
|
transformer;
|
|
798
798
|
constructor(filter) {
|
|
799
799
|
this.transformer = new TransformInterfaceFields(
|
|
800
|
-
(typeName, fieldName, fieldConfig) => filter(typeName, fieldName, fieldConfig) ?
|
|
800
|
+
(typeName, fieldName, fieldConfig) => filter(typeName, fieldName, fieldConfig) ? undefined : null
|
|
801
801
|
);
|
|
802
802
|
}
|
|
803
803
|
transformSchema(originalWrappingSchema, subschemaConfig) {
|
|
@@ -822,7 +822,7 @@ class TransformInputObjectFields {
|
|
|
822
822
|
}
|
|
823
823
|
_getTransformedSchema() {
|
|
824
824
|
const transformedSchema = this.transformedSchema;
|
|
825
|
-
if (transformedSchema ===
|
|
825
|
+
if (transformedSchema === undefined) {
|
|
826
826
|
throw new Error(
|
|
827
827
|
`The TransformInputObjectFields transform's "transformRequest" and "transformResult" methods cannot be used without first calling "transformSchema".`
|
|
828
828
|
);
|
|
@@ -877,7 +877,7 @@ class TransformInputObjectFields {
|
|
|
877
877
|
variableValues[varName] = utils.transformInputValue(
|
|
878
878
|
varType,
|
|
879
879
|
variableValues[varName],
|
|
880
|
-
|
|
880
|
+
undefined,
|
|
881
881
|
(type, originalValue) => {
|
|
882
882
|
const newValue = /* @__PURE__ */ Object.create(null);
|
|
883
883
|
const fields = type.getFields();
|
|
@@ -925,7 +925,7 @@ class TransformInputObjectFields {
|
|
|
925
925
|
newArgs[targetArg.name] = utils.transformInputValue(
|
|
926
926
|
targetArg.type,
|
|
927
927
|
delegationContext.args[targetArg.name],
|
|
928
|
-
|
|
928
|
+
undefined,
|
|
929
929
|
(type, originalValue) => {
|
|
930
930
|
const newValue = /* @__PURE__ */ Object.create(null);
|
|
931
931
|
const fields = type.getFields();
|
|
@@ -1043,13 +1043,13 @@ class RenameInputObjectFields {
|
|
|
1043
1043
|
this.transformer = new TransformInputObjectFields(
|
|
1044
1044
|
(typeName, inputFieldName, inputFieldConfig) => {
|
|
1045
1045
|
const newName = renamer(typeName, inputFieldName, inputFieldConfig);
|
|
1046
|
-
if (newName !==
|
|
1046
|
+
if (newName !== undefined && newName !== inputFieldName) {
|
|
1047
1047
|
const value = renamer(typeName, inputFieldName, inputFieldConfig);
|
|
1048
1048
|
if (value != null) {
|
|
1049
1049
|
return [value, inputFieldConfig];
|
|
1050
1050
|
}
|
|
1051
1051
|
}
|
|
1052
|
-
return
|
|
1052
|
+
return undefined;
|
|
1053
1053
|
},
|
|
1054
1054
|
(typeName, inputFieldName, inputFieldNode) => {
|
|
1055
1055
|
if (!(typeName in this.reverseMap)) {
|
|
@@ -1074,16 +1074,16 @@ class RenameInputObjectFields {
|
|
|
1074
1074
|
utils.mapSchema(originalWrappingSchema, {
|
|
1075
1075
|
[utils.MapperKind.INPUT_OBJECT_FIELD]: (inputFieldConfig, fieldName, typeName) => {
|
|
1076
1076
|
const newName = this.renamer(typeName, fieldName, inputFieldConfig);
|
|
1077
|
-
if (newName !==
|
|
1077
|
+
if (newName !== undefined && newName !== fieldName) {
|
|
1078
1078
|
if (this.reverseMap[typeName] == null) {
|
|
1079
1079
|
this.reverseMap[typeName] = /* @__PURE__ */ Object.create(null);
|
|
1080
1080
|
}
|
|
1081
1081
|
this.reverseMap[typeName][newName] = fieldName;
|
|
1082
1082
|
}
|
|
1083
|
-
return
|
|
1083
|
+
return undefined;
|
|
1084
1084
|
},
|
|
1085
1085
|
[utils.MapperKind.ROOT_OBJECT]() {
|
|
1086
|
-
return
|
|
1086
|
+
return undefined;
|
|
1087
1087
|
}
|
|
1088
1088
|
});
|
|
1089
1089
|
return this.transformer.transformSchema(
|
|
@@ -1104,8 +1104,8 @@ class FilterInputObjectFields {
|
|
|
1104
1104
|
transformer;
|
|
1105
1105
|
constructor(filter, inputObjectNodeTransformer) {
|
|
1106
1106
|
this.transformer = new TransformInputObjectFields(
|
|
1107
|
-
(typeName, fieldName, inputFieldConfig) => filter(typeName, fieldName, inputFieldConfig) ?
|
|
1108
|
-
|
|
1107
|
+
(typeName, fieldName, inputFieldConfig) => filter(typeName, fieldName, inputFieldConfig) ? undefined : null,
|
|
1108
|
+
undefined,
|
|
1109
1109
|
inputObjectNodeTransformer
|
|
1110
1110
|
);
|
|
1111
1111
|
}
|
|
@@ -1128,7 +1128,7 @@ const getTypeInfo = utils.memoize1(function getTypeInfo2(schema) {
|
|
|
1128
1128
|
return new graphql.TypeInfo(schema);
|
|
1129
1129
|
});
|
|
1130
1130
|
utils.memoize2(function getTypeInfoWithType2(schema, type) {
|
|
1131
|
-
return graphql.versionInfo.major < 16 ? new graphql.TypeInfo(schema,
|
|
1131
|
+
return graphql.versionInfo.major < 16 ? new graphql.TypeInfo(schema, undefined, type) : new graphql.TypeInfo(schema, type);
|
|
1132
1132
|
});
|
|
1133
1133
|
|
|
1134
1134
|
class MapLeafValues {
|
|
@@ -1238,7 +1238,7 @@ class MapLeafValues {
|
|
|
1238
1238
|
args[argName],
|
|
1239
1239
|
(t, v) => {
|
|
1240
1240
|
const newValue = this.inputValueTransformer(t.name, v);
|
|
1241
|
-
return newValue ===
|
|
1241
|
+
return newValue === undefined ? v : newValue;
|
|
1242
1242
|
}
|
|
1243
1243
|
);
|
|
1244
1244
|
}
|
|
@@ -1256,7 +1256,7 @@ class MapLeafValues {
|
|
|
1256
1256
|
value,
|
|
1257
1257
|
(t, v) => {
|
|
1258
1258
|
const newValue = this.inputValueTransformer(t.name, v);
|
|
1259
|
-
return newValue ===
|
|
1259
|
+
return newValue === undefined ? v : newValue;
|
|
1260
1260
|
}
|
|
1261
1261
|
);
|
|
1262
1262
|
if (argValue?.kind === graphql.Kind.VARIABLE) {
|
|
@@ -1282,7 +1282,7 @@ class MapLeafValues {
|
|
|
1282
1282
|
};
|
|
1283
1283
|
}
|
|
1284
1284
|
}
|
|
1285
|
-
return
|
|
1285
|
+
return undefined;
|
|
1286
1286
|
}
|
|
1287
1287
|
}
|
|
1288
1288
|
|
|
@@ -1323,7 +1323,7 @@ class TransformEnumValues {
|
|
|
1323
1323
|
defaultValue: newValue
|
|
1324
1324
|
};
|
|
1325
1325
|
}
|
|
1326
|
-
return
|
|
1326
|
+
return undefined;
|
|
1327
1327
|
}
|
|
1328
1328
|
});
|
|
1329
1329
|
return this.transformedSchema;
|
|
@@ -1369,13 +1369,13 @@ class TransformEnumValues {
|
|
|
1369
1369
|
newExternalValue,
|
|
1370
1370
|
{
|
|
1371
1371
|
...transformedEnumValue[1],
|
|
1372
|
-
value:
|
|
1372
|
+
value: undefined
|
|
1373
1373
|
}
|
|
1374
1374
|
];
|
|
1375
1375
|
}
|
|
1376
1376
|
return {
|
|
1377
1377
|
...transformedEnumValue,
|
|
1378
|
-
value:
|
|
1378
|
+
value: undefined
|
|
1379
1379
|
};
|
|
1380
1380
|
}
|
|
1381
1381
|
}
|
|
@@ -1437,7 +1437,7 @@ class TransformQuery {
|
|
|
1437
1437
|
selectionSet
|
|
1438
1438
|
};
|
|
1439
1439
|
}
|
|
1440
|
-
return
|
|
1440
|
+
return undefined;
|
|
1441
1441
|
},
|
|
1442
1442
|
leave: () => {
|
|
1443
1443
|
index--;
|
|
@@ -1462,7 +1462,7 @@ class TransformQuery {
|
|
|
1462
1462
|
const errors = originalResult.errors;
|
|
1463
1463
|
return {
|
|
1464
1464
|
data,
|
|
1465
|
-
errors: errors != null ? this.transformErrors(errors) :
|
|
1465
|
+
errors: errors != null ? this.transformErrors(errors) : undefined
|
|
1466
1466
|
};
|
|
1467
1467
|
}
|
|
1468
1468
|
transformData(data, delegationContext, transformationContext) {
|
|
@@ -1521,7 +1521,7 @@ class FilterObjectFieldDirectives {
|
|
|
1521
1521
|
const directiveDef = originalWrappingSchema.getDirective(
|
|
1522
1522
|
dir.name.value
|
|
1523
1523
|
);
|
|
1524
|
-
const directiveValue = directiveDef ? utils.getArgumentValues(directiveDef, dir) :
|
|
1524
|
+
const directiveValue = directiveDef ? utils.getArgumentValues(directiveDef, dir) : undefined;
|
|
1525
1525
|
return this.filter(dir.name.value, directiveValue);
|
|
1526
1526
|
}) ?? [];
|
|
1527
1527
|
if (fieldConfig.astNode?.directives != null && keepDirectives.length !== fieldConfig.astNode.directives.length) {
|
|
@@ -1534,7 +1534,7 @@ class FilterObjectFieldDirectives {
|
|
|
1534
1534
|
};
|
|
1535
1535
|
return fieldConfig;
|
|
1536
1536
|
}
|
|
1537
|
-
return
|
|
1537
|
+
return undefined;
|
|
1538
1538
|
}
|
|
1539
1539
|
);
|
|
1540
1540
|
return transformer.transformSchema(originalWrappingSchema, subschemaConfig);
|
|
@@ -1651,7 +1651,7 @@ class MapFields {
|
|
|
1651
1651
|
}
|
|
1652
1652
|
_getTransformer() {
|
|
1653
1653
|
const transformer = this.transformer;
|
|
1654
|
-
if (transformer ===
|
|
1654
|
+
if (transformer === undefined) {
|
|
1655
1655
|
throw new Error(
|
|
1656
1656
|
`The MapFields transform's "transformRequest" and "transformResult" methods cannot be used without first calling "transformSchema".`
|
|
1657
1657
|
);
|
|
@@ -1662,15 +1662,15 @@ class MapFields {
|
|
|
1662
1662
|
const subscriptionTypeName = originalWrappingSchema.getSubscriptionType()?.name;
|
|
1663
1663
|
const objectValueTransformerMap = this.objectValueTransformerMap;
|
|
1664
1664
|
this.transformer = new TransformCompositeFields(
|
|
1665
|
-
() =>
|
|
1665
|
+
() => undefined,
|
|
1666
1666
|
(typeName, fieldName, fieldNode, fragments, transformationContext) => {
|
|
1667
1667
|
const typeTransformers = this.fieldNodeTransformerMap[typeName];
|
|
1668
1668
|
if (typeTransformers == null) {
|
|
1669
|
-
return
|
|
1669
|
+
return undefined;
|
|
1670
1670
|
}
|
|
1671
1671
|
const fieldNodeTransformer = typeTransformers[fieldName];
|
|
1672
1672
|
if (fieldNodeTransformer == null) {
|
|
1673
|
-
return
|
|
1673
|
+
return undefined;
|
|
1674
1674
|
}
|
|
1675
1675
|
return fieldNodeTransformer(
|
|
1676
1676
|
fieldNode,
|
|
@@ -1694,8 +1694,8 @@ class MapFields {
|
|
|
1694
1694
|
return data;
|
|
1695
1695
|
}
|
|
1696
1696
|
return transformer(data, transformationContext);
|
|
1697
|
-
} :
|
|
1698
|
-
this.errorsTransformer != null ? this.errorsTransformer :
|
|
1697
|
+
} : undefined,
|
|
1698
|
+
this.errorsTransformer != null ? this.errorsTransformer : undefined
|
|
1699
1699
|
);
|
|
1700
1700
|
return this.transformer.transformSchema(
|
|
1701
1701
|
originalWrappingSchema,
|
|
@@ -1971,8 +1971,8 @@ function dehoistValue(originalValue, context) {
|
|
|
1971
1971
|
return newValue;
|
|
1972
1972
|
}
|
|
1973
1973
|
function dehoistErrors(errors, context) {
|
|
1974
|
-
if (errors ===
|
|
1975
|
-
return
|
|
1974
|
+
if (errors === undefined) {
|
|
1975
|
+
return undefined;
|
|
1976
1976
|
}
|
|
1977
1977
|
return errors.map((error) => {
|
|
1978
1978
|
const originalPath = error.path;
|
|
@@ -2071,7 +2071,7 @@ class HoistField {
|
|
|
2071
2071
|
{
|
|
2072
2072
|
[typeName]: (value) => unwrapValue(value, alias)
|
|
2073
2073
|
},
|
|
2074
|
-
(errors) => errors != null ? unwrapErrors(errors, alias) :
|
|
2074
|
+
(errors) => errors != null ? unwrapErrors(errors, alias) : undefined
|
|
2075
2075
|
);
|
|
2076
2076
|
this.argLevels = argLevels;
|
|
2077
2077
|
}
|
|
@@ -2188,13 +2188,13 @@ function wrapFieldNode(fieldNode, path, alias, argLevels) {
|
|
|
2188
2188
|
},
|
|
2189
2189
|
arguments: fieldNode.arguments != null ? fieldNode.arguments.filter(
|
|
2190
2190
|
(arg) => argLevels[arg.name.value] === index
|
|
2191
|
-
) :
|
|
2191
|
+
) : undefined
|
|
2192
2192
|
}),
|
|
2193
2193
|
{
|
|
2194
2194
|
...fieldNode,
|
|
2195
2195
|
arguments: fieldNode.arguments != null ? fieldNode.arguments.filter(
|
|
2196
2196
|
(arg) => argLevels[arg.name.value] === path.length
|
|
2197
|
-
) :
|
|
2197
|
+
) : undefined
|
|
2198
2198
|
}
|
|
2199
2199
|
);
|
|
2200
2200
|
}
|
|
@@ -2223,8 +2223,8 @@ function unwrapValue(originalValue, alias) {
|
|
|
2223
2223
|
return originalValue;
|
|
2224
2224
|
}
|
|
2225
2225
|
function unwrapErrors(errors, alias) {
|
|
2226
|
-
if (errors ===
|
|
2227
|
-
return
|
|
2226
|
+
if (errors === undefined) {
|
|
2227
|
+
return undefined;
|
|
2228
2228
|
}
|
|
2229
2229
|
return errors.map((error) => {
|
|
2230
2230
|
const originalPath = error.path;
|
|
@@ -2263,7 +2263,7 @@ class WrapQuery {
|
|
|
2263
2263
|
selectionSet
|
|
2264
2264
|
};
|
|
2265
2265
|
}
|
|
2266
|
-
return
|
|
2266
|
+
return undefined;
|
|
2267
2267
|
},
|
|
2268
2268
|
leave: () => {
|
|
2269
2269
|
fieldPath.pop();
|
|
@@ -2315,7 +2315,7 @@ class ExtractField {
|
|
|
2315
2315
|
fromSelection = node.selectionSet;
|
|
2316
2316
|
return graphql.BREAK;
|
|
2317
2317
|
}
|
|
2318
|
-
return
|
|
2318
|
+
return undefined;
|
|
2319
2319
|
},
|
|
2320
2320
|
leave: () => {
|
|
2321
2321
|
fieldPath.pop();
|
|
@@ -2333,7 +2333,7 @@ class ExtractField {
|
|
|
2333
2333
|
selectionSet: fromSelection
|
|
2334
2334
|
};
|
|
2335
2335
|
}
|
|
2336
|
-
return
|
|
2336
|
+
return undefined;
|
|
2337
2337
|
},
|
|
2338
2338
|
leave: () => {
|
|
2339
2339
|
fieldPath.pop();
|
package/dist/index.js
CHANGED
|
@@ -45,7 +45,7 @@ function createPossiblyNestedProxyingResolver(subschemaConfig, proxyingResolver)
|
|
|
45
45
|
if (isExternalObject(parent)) {
|
|
46
46
|
const unpathedErrors = getUnpathedErrors(parent);
|
|
47
47
|
const subschema = getSubschema(parent, responseKey);
|
|
48
|
-
if (subschemaConfig === subschema && parent[responseKey] !==
|
|
48
|
+
if (subschemaConfig === subschema && parent[responseKey] !== undefined) {
|
|
49
49
|
return resolveExternalValue(
|
|
50
50
|
parent[responseKey],
|
|
51
51
|
unpathedErrors,
|
|
@@ -92,34 +92,34 @@ function createWrappingSchema(schema, proxyingResolvers) {
|
|
|
92
92
|
return {
|
|
93
93
|
...fieldConfig,
|
|
94
94
|
resolve: defaultMergedResolver,
|
|
95
|
-
subscribe:
|
|
95
|
+
subscribe: undefined
|
|
96
96
|
};
|
|
97
97
|
},
|
|
98
98
|
[MapperKind.OBJECT_TYPE]: (type) => {
|
|
99
99
|
const config = type.toConfig();
|
|
100
100
|
return new GraphQLObjectType({
|
|
101
101
|
...config,
|
|
102
|
-
isTypeOf:
|
|
102
|
+
isTypeOf: undefined
|
|
103
103
|
});
|
|
104
104
|
},
|
|
105
105
|
[MapperKind.INTERFACE_TYPE]: (type) => {
|
|
106
106
|
const config = type.toConfig();
|
|
107
107
|
return new GraphQLInterfaceType({
|
|
108
108
|
...config,
|
|
109
|
-
resolveType:
|
|
109
|
+
resolveType: undefined
|
|
110
110
|
});
|
|
111
111
|
},
|
|
112
112
|
[MapperKind.UNION_TYPE]: (type) => {
|
|
113
113
|
const config = type.toConfig();
|
|
114
114
|
return new GraphQLUnionType({
|
|
115
115
|
...config,
|
|
116
|
-
resolveType:
|
|
116
|
+
resolveType: undefined
|
|
117
117
|
});
|
|
118
118
|
},
|
|
119
119
|
[MapperKind.ENUM_VALUE]: (valueConfig) => {
|
|
120
120
|
return {
|
|
121
121
|
...valueConfig,
|
|
122
|
-
value:
|
|
122
|
+
value: undefined
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
125
|
});
|
|
@@ -146,14 +146,14 @@ class RenameTypes {
|
|
|
146
146
|
return mapSchema(originalWrappingSchema, {
|
|
147
147
|
[MapperKind.TYPE]: (type) => {
|
|
148
148
|
if (isSpecifiedScalarType(type) && !this.renameBuiltins) {
|
|
149
|
-
return
|
|
149
|
+
return undefined;
|
|
150
150
|
}
|
|
151
151
|
if (isScalarType(type) && !this.renameScalars) {
|
|
152
|
-
return
|
|
152
|
+
return undefined;
|
|
153
153
|
}
|
|
154
154
|
const oldName = type.name;
|
|
155
155
|
const newName = this.renamer(oldName);
|
|
156
|
-
if (newName !==
|
|
156
|
+
if (newName !== undefined && newName !== oldName) {
|
|
157
157
|
if (typeNames.has(newName)) {
|
|
158
158
|
console.warn(
|
|
159
159
|
`New type name ${newName} for ${oldName} already exists in the schema. Skip renaming.`
|
|
@@ -166,10 +166,10 @@ class RenameTypes {
|
|
|
166
166
|
typeNames.add(newName);
|
|
167
167
|
return renameType(type, newName);
|
|
168
168
|
}
|
|
169
|
-
return
|
|
169
|
+
return undefined;
|
|
170
170
|
},
|
|
171
171
|
[MapperKind.ROOT_OBJECT]() {
|
|
172
|
-
return
|
|
172
|
+
return undefined;
|
|
173
173
|
}
|
|
174
174
|
});
|
|
175
175
|
}
|
|
@@ -186,7 +186,7 @@ class RenameTypes {
|
|
|
186
186
|
}
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
|
-
return
|
|
189
|
+
return undefined;
|
|
190
190
|
}
|
|
191
191
|
});
|
|
192
192
|
return {
|
|
@@ -217,7 +217,7 @@ class FilterTypes {
|
|
|
217
217
|
return mapSchema(originalWrappingSchema, {
|
|
218
218
|
[MapperKind.TYPE]: (type) => {
|
|
219
219
|
if (this.filter(type)) {
|
|
220
|
-
return
|
|
220
|
+
return undefined;
|
|
221
221
|
}
|
|
222
222
|
return null;
|
|
223
223
|
}
|
|
@@ -239,12 +239,12 @@ class RenameRootTypes {
|
|
|
239
239
|
[MapperKind.ROOT_OBJECT]: (type) => {
|
|
240
240
|
const oldName = type.name;
|
|
241
241
|
const newName = this.renamer(oldName);
|
|
242
|
-
if (newName !==
|
|
242
|
+
if (newName !== undefined && newName !== oldName) {
|
|
243
243
|
this.map[oldName] = newName;
|
|
244
244
|
this.reverseMap[newName] = oldName;
|
|
245
245
|
return renameType(type, newName);
|
|
246
246
|
}
|
|
247
|
-
return
|
|
247
|
+
return undefined;
|
|
248
248
|
}
|
|
249
249
|
});
|
|
250
250
|
}
|
|
@@ -261,7 +261,7 @@ class RenameRootTypes {
|
|
|
261
261
|
}
|
|
262
262
|
};
|
|
263
263
|
}
|
|
264
|
-
return
|
|
264
|
+
return undefined;
|
|
265
265
|
}
|
|
266
266
|
});
|
|
267
267
|
return {
|
|
@@ -301,7 +301,7 @@ class TransformCompositeFields {
|
|
|
301
301
|
}
|
|
302
302
|
_getTypeInfo() {
|
|
303
303
|
const typeInfo = this.typeInfo;
|
|
304
|
-
if (typeInfo ===
|
|
304
|
+
if (typeInfo === undefined) {
|
|
305
305
|
throw new Error(
|
|
306
306
|
`The TransformCompositeFields transform's "transformRequest" and "transformResult" methods cannot be used without first calling "transformSchema".`
|
|
307
307
|
);
|
|
@@ -379,7 +379,7 @@ class TransformCompositeFields {
|
|
|
379
379
|
transformSelectionSet(node, typeInfo, fragments, transformationContext) {
|
|
380
380
|
const parentType = typeInfo.getParentType();
|
|
381
381
|
if (parentType == null) {
|
|
382
|
-
return
|
|
382
|
+
return undefined;
|
|
383
383
|
}
|
|
384
384
|
const parentTypeName = parentType.name;
|
|
385
385
|
let newSelections = [];
|
|
@@ -404,7 +404,7 @@ class TransformCompositeFields {
|
|
|
404
404
|
fragments,
|
|
405
405
|
transformationContext
|
|
406
406
|
);
|
|
407
|
-
transformedSelection = transformedSelection ===
|
|
407
|
+
transformedSelection = transformedSelection === undefined ? selection : transformedSelection;
|
|
408
408
|
}
|
|
409
409
|
if (transformedSelection == null) {
|
|
410
410
|
continue;
|
|
@@ -463,7 +463,7 @@ class TransformObjectFields {
|
|
|
463
463
|
}
|
|
464
464
|
_getTransformer() {
|
|
465
465
|
const transformer = this.transformer;
|
|
466
|
-
if (transformer ===
|
|
466
|
+
if (transformer === undefined) {
|
|
467
467
|
throw new Error(
|
|
468
468
|
`The TransformObjectFields transform's "transformRequest" and "transformResult" methods cannot be used without first calling "transformSchema".`
|
|
469
469
|
);
|
|
@@ -475,7 +475,7 @@ class TransformObjectFields {
|
|
|
475
475
|
if (isObjectType(originalWrappingSchema.getType(typeName))) {
|
|
476
476
|
return this.objectFieldTransformer(typeName, fieldName, fieldConfig);
|
|
477
477
|
}
|
|
478
|
-
return
|
|
478
|
+
return undefined;
|
|
479
479
|
};
|
|
480
480
|
this.transformer = new TransformCompositeFields(
|
|
481
481
|
compositeToObjectFieldTransformer,
|
|
@@ -512,7 +512,7 @@ class TransformRootFields {
|
|
|
512
512
|
}
|
|
513
513
|
_getTransformer() {
|
|
514
514
|
const transformer = this.transformer;
|
|
515
|
-
if (transformer ===
|
|
515
|
+
if (transformer === undefined) {
|
|
516
516
|
throw new Error(
|
|
517
517
|
`The TransformRootFields transform's "transformRequest" and "transformResult" methods cannot be used without first calling "transformSchema".`
|
|
518
518
|
);
|
|
@@ -534,7 +534,7 @@ class TransformRootFields {
|
|
|
534
534
|
fieldConfig
|
|
535
535
|
);
|
|
536
536
|
}
|
|
537
|
-
return
|
|
537
|
+
return undefined;
|
|
538
538
|
};
|
|
539
539
|
this.transformer = new TransformObjectFields(
|
|
540
540
|
rootToObjectFieldTransformer,
|
|
@@ -589,7 +589,7 @@ class FilterRootFields {
|
|
|
589
589
|
this.transformer = new TransformRootFields(
|
|
590
590
|
(operation, fieldName, fieldConfig) => {
|
|
591
591
|
if (filter(operation, fieldName, fieldConfig)) {
|
|
592
|
-
return
|
|
592
|
+
return undefined;
|
|
593
593
|
}
|
|
594
594
|
return null;
|
|
595
595
|
}
|
|
@@ -636,7 +636,7 @@ class RenameObjectFieldArguments {
|
|
|
636
636
|
const argsConfig = Object.fromEntries(
|
|
637
637
|
Object.entries(fieldConfig.args || []).map(([argName, conf]) => {
|
|
638
638
|
const newName = renamer(typeName, fieldName, argName);
|
|
639
|
-
if (newName !==
|
|
639
|
+
if (newName !== undefined && newName !== argName) {
|
|
640
640
|
if (newName != null) {
|
|
641
641
|
return [newName, conf];
|
|
642
642
|
}
|
|
@@ -675,7 +675,7 @@ class RenameObjectFieldArguments {
|
|
|
675
675
|
[MapperKind.OBJECT_FIELD]: (fieldConfig, fieldName, typeName) => {
|
|
676
676
|
Object.entries(fieldConfig.args || {}).forEach(([argName]) => {
|
|
677
677
|
const newName = this.renamer(typeName, fieldName, argName);
|
|
678
|
-
if (newName !==
|
|
678
|
+
if (newName !== undefined && newName !== fieldName) {
|
|
679
679
|
if (this.reverseMap[typeName] == null) {
|
|
680
680
|
this.reverseMap[typeName] = /* @__PURE__ */ Object.create(null);
|
|
681
681
|
}
|
|
@@ -685,10 +685,10 @@ class RenameObjectFieldArguments {
|
|
|
685
685
|
this.reverseMap[typeName][fieldName][newName] = argName;
|
|
686
686
|
}
|
|
687
687
|
});
|
|
688
|
-
return
|
|
688
|
+
return undefined;
|
|
689
689
|
},
|
|
690
690
|
[MapperKind.ROOT_OBJECT]() {
|
|
691
|
-
return
|
|
691
|
+
return undefined;
|
|
692
692
|
}
|
|
693
693
|
});
|
|
694
694
|
return this.transformer.transformSchema(
|
|
@@ -709,7 +709,7 @@ class FilterObjectFields {
|
|
|
709
709
|
transformer;
|
|
710
710
|
constructor(filter) {
|
|
711
711
|
this.transformer = new TransformObjectFields(
|
|
712
|
-
(typeName, fieldName, fieldConfig) => filter(typeName, fieldName, fieldConfig) ?
|
|
712
|
+
(typeName, fieldName, fieldConfig) => filter(typeName, fieldName, fieldConfig) ? undefined : null
|
|
713
713
|
);
|
|
714
714
|
}
|
|
715
715
|
transformSchema(originalWrappingSchema, subschemaConfig) {
|
|
@@ -730,7 +730,7 @@ class TransformInterfaceFields {
|
|
|
730
730
|
}
|
|
731
731
|
_getTransformer() {
|
|
732
732
|
const transformer = this.transformer;
|
|
733
|
-
if (transformer ===
|
|
733
|
+
if (transformer === undefined) {
|
|
734
734
|
throw new Error(
|
|
735
735
|
`The TransformInterfaceFields transform's "transformRequest" and "transformResult" methods cannot be used without first calling "transformSchema".`
|
|
736
736
|
);
|
|
@@ -742,7 +742,7 @@ class TransformInterfaceFields {
|
|
|
742
742
|
if (isInterfaceType(originalWrappingSchema.getType(typeName))) {
|
|
743
743
|
return this.interfaceFieldTransformer(typeName, fieldName, fieldConfig);
|
|
744
744
|
}
|
|
745
|
-
return
|
|
745
|
+
return undefined;
|
|
746
746
|
};
|
|
747
747
|
this.transformer = new TransformCompositeFields(
|
|
748
748
|
compositeToObjectFieldTransformer,
|
|
@@ -795,7 +795,7 @@ class FilterInterfaceFields {
|
|
|
795
795
|
transformer;
|
|
796
796
|
constructor(filter) {
|
|
797
797
|
this.transformer = new TransformInterfaceFields(
|
|
798
|
-
(typeName, fieldName, fieldConfig) => filter(typeName, fieldName, fieldConfig) ?
|
|
798
|
+
(typeName, fieldName, fieldConfig) => filter(typeName, fieldName, fieldConfig) ? undefined : null
|
|
799
799
|
);
|
|
800
800
|
}
|
|
801
801
|
transformSchema(originalWrappingSchema, subschemaConfig) {
|
|
@@ -820,7 +820,7 @@ class TransformInputObjectFields {
|
|
|
820
820
|
}
|
|
821
821
|
_getTransformedSchema() {
|
|
822
822
|
const transformedSchema = this.transformedSchema;
|
|
823
|
-
if (transformedSchema ===
|
|
823
|
+
if (transformedSchema === undefined) {
|
|
824
824
|
throw new Error(
|
|
825
825
|
`The TransformInputObjectFields transform's "transformRequest" and "transformResult" methods cannot be used without first calling "transformSchema".`
|
|
826
826
|
);
|
|
@@ -875,7 +875,7 @@ class TransformInputObjectFields {
|
|
|
875
875
|
variableValues[varName] = transformInputValue(
|
|
876
876
|
varType,
|
|
877
877
|
variableValues[varName],
|
|
878
|
-
|
|
878
|
+
undefined,
|
|
879
879
|
(type, originalValue) => {
|
|
880
880
|
const newValue = /* @__PURE__ */ Object.create(null);
|
|
881
881
|
const fields = type.getFields();
|
|
@@ -923,7 +923,7 @@ class TransformInputObjectFields {
|
|
|
923
923
|
newArgs[targetArg.name] = transformInputValue(
|
|
924
924
|
targetArg.type,
|
|
925
925
|
delegationContext.args[targetArg.name],
|
|
926
|
-
|
|
926
|
+
undefined,
|
|
927
927
|
(type, originalValue) => {
|
|
928
928
|
const newValue = /* @__PURE__ */ Object.create(null);
|
|
929
929
|
const fields = type.getFields();
|
|
@@ -1041,13 +1041,13 @@ class RenameInputObjectFields {
|
|
|
1041
1041
|
this.transformer = new TransformInputObjectFields(
|
|
1042
1042
|
(typeName, inputFieldName, inputFieldConfig) => {
|
|
1043
1043
|
const newName = renamer(typeName, inputFieldName, inputFieldConfig);
|
|
1044
|
-
if (newName !==
|
|
1044
|
+
if (newName !== undefined && newName !== inputFieldName) {
|
|
1045
1045
|
const value = renamer(typeName, inputFieldName, inputFieldConfig);
|
|
1046
1046
|
if (value != null) {
|
|
1047
1047
|
return [value, inputFieldConfig];
|
|
1048
1048
|
}
|
|
1049
1049
|
}
|
|
1050
|
-
return
|
|
1050
|
+
return undefined;
|
|
1051
1051
|
},
|
|
1052
1052
|
(typeName, inputFieldName, inputFieldNode) => {
|
|
1053
1053
|
if (!(typeName in this.reverseMap)) {
|
|
@@ -1072,16 +1072,16 @@ class RenameInputObjectFields {
|
|
|
1072
1072
|
mapSchema(originalWrappingSchema, {
|
|
1073
1073
|
[MapperKind.INPUT_OBJECT_FIELD]: (inputFieldConfig, fieldName, typeName) => {
|
|
1074
1074
|
const newName = this.renamer(typeName, fieldName, inputFieldConfig);
|
|
1075
|
-
if (newName !==
|
|
1075
|
+
if (newName !== undefined && newName !== fieldName) {
|
|
1076
1076
|
if (this.reverseMap[typeName] == null) {
|
|
1077
1077
|
this.reverseMap[typeName] = /* @__PURE__ */ Object.create(null);
|
|
1078
1078
|
}
|
|
1079
1079
|
this.reverseMap[typeName][newName] = fieldName;
|
|
1080
1080
|
}
|
|
1081
|
-
return
|
|
1081
|
+
return undefined;
|
|
1082
1082
|
},
|
|
1083
1083
|
[MapperKind.ROOT_OBJECT]() {
|
|
1084
|
-
return
|
|
1084
|
+
return undefined;
|
|
1085
1085
|
}
|
|
1086
1086
|
});
|
|
1087
1087
|
return this.transformer.transformSchema(
|
|
@@ -1102,8 +1102,8 @@ class FilterInputObjectFields {
|
|
|
1102
1102
|
transformer;
|
|
1103
1103
|
constructor(filter, inputObjectNodeTransformer) {
|
|
1104
1104
|
this.transformer = new TransformInputObjectFields(
|
|
1105
|
-
(typeName, fieldName, inputFieldConfig) => filter(typeName, fieldName, inputFieldConfig) ?
|
|
1106
|
-
|
|
1105
|
+
(typeName, fieldName, inputFieldConfig) => filter(typeName, fieldName, inputFieldConfig) ? undefined : null,
|
|
1106
|
+
undefined,
|
|
1107
1107
|
inputObjectNodeTransformer
|
|
1108
1108
|
);
|
|
1109
1109
|
}
|
|
@@ -1126,7 +1126,7 @@ const getTypeInfo = memoize1(function getTypeInfo2(schema) {
|
|
|
1126
1126
|
return new TypeInfo(schema);
|
|
1127
1127
|
});
|
|
1128
1128
|
memoize2(function getTypeInfoWithType2(schema, type) {
|
|
1129
|
-
return versionInfo.major < 16 ? new TypeInfo(schema,
|
|
1129
|
+
return versionInfo.major < 16 ? new TypeInfo(schema, undefined, type) : new TypeInfo(schema, type);
|
|
1130
1130
|
});
|
|
1131
1131
|
|
|
1132
1132
|
class MapLeafValues {
|
|
@@ -1236,7 +1236,7 @@ class MapLeafValues {
|
|
|
1236
1236
|
args[argName],
|
|
1237
1237
|
(t, v) => {
|
|
1238
1238
|
const newValue = this.inputValueTransformer(t.name, v);
|
|
1239
|
-
return newValue ===
|
|
1239
|
+
return newValue === undefined ? v : newValue;
|
|
1240
1240
|
}
|
|
1241
1241
|
);
|
|
1242
1242
|
}
|
|
@@ -1254,7 +1254,7 @@ class MapLeafValues {
|
|
|
1254
1254
|
value,
|
|
1255
1255
|
(t, v) => {
|
|
1256
1256
|
const newValue = this.inputValueTransformer(t.name, v);
|
|
1257
|
-
return newValue ===
|
|
1257
|
+
return newValue === undefined ? v : newValue;
|
|
1258
1258
|
}
|
|
1259
1259
|
);
|
|
1260
1260
|
if (argValue?.kind === Kind.VARIABLE) {
|
|
@@ -1280,7 +1280,7 @@ class MapLeafValues {
|
|
|
1280
1280
|
};
|
|
1281
1281
|
}
|
|
1282
1282
|
}
|
|
1283
|
-
return
|
|
1283
|
+
return undefined;
|
|
1284
1284
|
}
|
|
1285
1285
|
}
|
|
1286
1286
|
|
|
@@ -1321,7 +1321,7 @@ class TransformEnumValues {
|
|
|
1321
1321
|
defaultValue: newValue
|
|
1322
1322
|
};
|
|
1323
1323
|
}
|
|
1324
|
-
return
|
|
1324
|
+
return undefined;
|
|
1325
1325
|
}
|
|
1326
1326
|
});
|
|
1327
1327
|
return this.transformedSchema;
|
|
@@ -1367,13 +1367,13 @@ class TransformEnumValues {
|
|
|
1367
1367
|
newExternalValue,
|
|
1368
1368
|
{
|
|
1369
1369
|
...transformedEnumValue[1],
|
|
1370
|
-
value:
|
|
1370
|
+
value: undefined
|
|
1371
1371
|
}
|
|
1372
1372
|
];
|
|
1373
1373
|
}
|
|
1374
1374
|
return {
|
|
1375
1375
|
...transformedEnumValue,
|
|
1376
|
-
value:
|
|
1376
|
+
value: undefined
|
|
1377
1377
|
};
|
|
1378
1378
|
}
|
|
1379
1379
|
}
|
|
@@ -1435,7 +1435,7 @@ class TransformQuery {
|
|
|
1435
1435
|
selectionSet
|
|
1436
1436
|
};
|
|
1437
1437
|
}
|
|
1438
|
-
return
|
|
1438
|
+
return undefined;
|
|
1439
1439
|
},
|
|
1440
1440
|
leave: () => {
|
|
1441
1441
|
index--;
|
|
@@ -1460,7 +1460,7 @@ class TransformQuery {
|
|
|
1460
1460
|
const errors = originalResult.errors;
|
|
1461
1461
|
return {
|
|
1462
1462
|
data,
|
|
1463
|
-
errors: errors != null ? this.transformErrors(errors) :
|
|
1463
|
+
errors: errors != null ? this.transformErrors(errors) : undefined
|
|
1464
1464
|
};
|
|
1465
1465
|
}
|
|
1466
1466
|
transformData(data, delegationContext, transformationContext) {
|
|
@@ -1519,7 +1519,7 @@ class FilterObjectFieldDirectives {
|
|
|
1519
1519
|
const directiveDef = originalWrappingSchema.getDirective(
|
|
1520
1520
|
dir.name.value
|
|
1521
1521
|
);
|
|
1522
|
-
const directiveValue = directiveDef ? getArgumentValues(directiveDef, dir) :
|
|
1522
|
+
const directiveValue = directiveDef ? getArgumentValues(directiveDef, dir) : undefined;
|
|
1523
1523
|
return this.filter(dir.name.value, directiveValue);
|
|
1524
1524
|
}) ?? [];
|
|
1525
1525
|
if (fieldConfig.astNode?.directives != null && keepDirectives.length !== fieldConfig.astNode.directives.length) {
|
|
@@ -1532,7 +1532,7 @@ class FilterObjectFieldDirectives {
|
|
|
1532
1532
|
};
|
|
1533
1533
|
return fieldConfig;
|
|
1534
1534
|
}
|
|
1535
|
-
return
|
|
1535
|
+
return undefined;
|
|
1536
1536
|
}
|
|
1537
1537
|
);
|
|
1538
1538
|
return transformer.transformSchema(originalWrappingSchema, subschemaConfig);
|
|
@@ -1649,7 +1649,7 @@ class MapFields {
|
|
|
1649
1649
|
}
|
|
1650
1650
|
_getTransformer() {
|
|
1651
1651
|
const transformer = this.transformer;
|
|
1652
|
-
if (transformer ===
|
|
1652
|
+
if (transformer === undefined) {
|
|
1653
1653
|
throw new Error(
|
|
1654
1654
|
`The MapFields transform's "transformRequest" and "transformResult" methods cannot be used without first calling "transformSchema".`
|
|
1655
1655
|
);
|
|
@@ -1660,15 +1660,15 @@ class MapFields {
|
|
|
1660
1660
|
const subscriptionTypeName = originalWrappingSchema.getSubscriptionType()?.name;
|
|
1661
1661
|
const objectValueTransformerMap = this.objectValueTransformerMap;
|
|
1662
1662
|
this.transformer = new TransformCompositeFields(
|
|
1663
|
-
() =>
|
|
1663
|
+
() => undefined,
|
|
1664
1664
|
(typeName, fieldName, fieldNode, fragments, transformationContext) => {
|
|
1665
1665
|
const typeTransformers = this.fieldNodeTransformerMap[typeName];
|
|
1666
1666
|
if (typeTransformers == null) {
|
|
1667
|
-
return
|
|
1667
|
+
return undefined;
|
|
1668
1668
|
}
|
|
1669
1669
|
const fieldNodeTransformer = typeTransformers[fieldName];
|
|
1670
1670
|
if (fieldNodeTransformer == null) {
|
|
1671
|
-
return
|
|
1671
|
+
return undefined;
|
|
1672
1672
|
}
|
|
1673
1673
|
return fieldNodeTransformer(
|
|
1674
1674
|
fieldNode,
|
|
@@ -1692,8 +1692,8 @@ class MapFields {
|
|
|
1692
1692
|
return data;
|
|
1693
1693
|
}
|
|
1694
1694
|
return transformer(data, transformationContext);
|
|
1695
|
-
} :
|
|
1696
|
-
this.errorsTransformer != null ? this.errorsTransformer :
|
|
1695
|
+
} : undefined,
|
|
1696
|
+
this.errorsTransformer != null ? this.errorsTransformer : undefined
|
|
1697
1697
|
);
|
|
1698
1698
|
return this.transformer.transformSchema(
|
|
1699
1699
|
originalWrappingSchema,
|
|
@@ -1969,8 +1969,8 @@ function dehoistValue(originalValue, context) {
|
|
|
1969
1969
|
return newValue;
|
|
1970
1970
|
}
|
|
1971
1971
|
function dehoistErrors(errors, context) {
|
|
1972
|
-
if (errors ===
|
|
1973
|
-
return
|
|
1972
|
+
if (errors === undefined) {
|
|
1973
|
+
return undefined;
|
|
1974
1974
|
}
|
|
1975
1975
|
return errors.map((error) => {
|
|
1976
1976
|
const originalPath = error.path;
|
|
@@ -2069,7 +2069,7 @@ class HoistField {
|
|
|
2069
2069
|
{
|
|
2070
2070
|
[typeName]: (value) => unwrapValue(value, alias)
|
|
2071
2071
|
},
|
|
2072
|
-
(errors) => errors != null ? unwrapErrors(errors, alias) :
|
|
2072
|
+
(errors) => errors != null ? unwrapErrors(errors, alias) : undefined
|
|
2073
2073
|
);
|
|
2074
2074
|
this.argLevels = argLevels;
|
|
2075
2075
|
}
|
|
@@ -2186,13 +2186,13 @@ function wrapFieldNode(fieldNode, path, alias, argLevels) {
|
|
|
2186
2186
|
},
|
|
2187
2187
|
arguments: fieldNode.arguments != null ? fieldNode.arguments.filter(
|
|
2188
2188
|
(arg) => argLevels[arg.name.value] === index
|
|
2189
|
-
) :
|
|
2189
|
+
) : undefined
|
|
2190
2190
|
}),
|
|
2191
2191
|
{
|
|
2192
2192
|
...fieldNode,
|
|
2193
2193
|
arguments: fieldNode.arguments != null ? fieldNode.arguments.filter(
|
|
2194
2194
|
(arg) => argLevels[arg.name.value] === path.length
|
|
2195
|
-
) :
|
|
2195
|
+
) : undefined
|
|
2196
2196
|
}
|
|
2197
2197
|
);
|
|
2198
2198
|
}
|
|
@@ -2221,8 +2221,8 @@ function unwrapValue(originalValue, alias) {
|
|
|
2221
2221
|
return originalValue;
|
|
2222
2222
|
}
|
|
2223
2223
|
function unwrapErrors(errors, alias) {
|
|
2224
|
-
if (errors ===
|
|
2225
|
-
return
|
|
2224
|
+
if (errors === undefined) {
|
|
2225
|
+
return undefined;
|
|
2226
2226
|
}
|
|
2227
2227
|
return errors.map((error) => {
|
|
2228
2228
|
const originalPath = error.path;
|
|
@@ -2261,7 +2261,7 @@ class WrapQuery {
|
|
|
2261
2261
|
selectionSet
|
|
2262
2262
|
};
|
|
2263
2263
|
}
|
|
2264
|
-
return
|
|
2264
|
+
return undefined;
|
|
2265
2265
|
},
|
|
2266
2266
|
leave: () => {
|
|
2267
2267
|
fieldPath.pop();
|
|
@@ -2313,7 +2313,7 @@ class ExtractField {
|
|
|
2313
2313
|
fromSelection = node.selectionSet;
|
|
2314
2314
|
return BREAK;
|
|
2315
2315
|
}
|
|
2316
|
-
return
|
|
2316
|
+
return undefined;
|
|
2317
2317
|
},
|
|
2318
2318
|
leave: () => {
|
|
2319
2319
|
fieldPath.pop();
|
|
@@ -2331,7 +2331,7 @@ class ExtractField {
|
|
|
2331
2331
|
selectionSet: fromSelection
|
|
2332
2332
|
};
|
|
2333
2333
|
}
|
|
2334
|
-
return
|
|
2334
|
+
return undefined;
|
|
2335
2335
|
},
|
|
2336
2336
|
leave: () => {
|
|
2337
2337
|
fieldPath.pop();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/wrap",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.28-alpha-e8878e64f4cd1ea558f9ae1848b2e315883294cd",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A set of utils for faster development of GraphQL tools",
|
|
6
6
|
"repository": {
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@graphql-tools/delegate": "
|
|
41
|
+
"@graphql-tools/delegate": "10.2.10-alpha-e8878e64f4cd1ea558f9ae1848b2e315883294cd",
|
|
42
42
|
"@graphql-tools/schema": "^10.0.11",
|
|
43
43
|
"@graphql-tools/utils": "^10.7.0",
|
|
44
44
|
"tslib": "^2.8.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"graphql": "^16.9.0",
|
|
48
|
-
"pkgroll": "2.6.
|
|
48
|
+
"pkgroll": "2.6.1"
|
|
49
49
|
},
|
|
50
50
|
"sideEffects": false
|
|
51
51
|
}
|