@graphql-tools/wrap 10.0.29 → 10.0.30-alpha-bb010bd4b613397bc4e6ba96149dc972a0ef0997
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 +11 -0
- package/dist/index.cjs +69 -69
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +71 -71
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @graphql-tools/wrap
|
|
2
2
|
|
|
3
|
+
## 10.0.30-alpha-bb010bd4b613397bc4e6ba96149dc972a0ef0997
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#620](https://github.com/graphql-hive/gateway/pull/620) [`d72209a`](https://github.com/graphql-hive/gateway/commit/d72209ad82ec53689f93ce5d81bfa52493919ad9) Thanks [@renovate](https://github.com/apps/renovate)! - dependencies updates:
|
|
8
|
+
|
|
9
|
+
- Updated dependency [`@graphql-tools/utils@^10.8.1` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.8.1) (from `^10.7.0`, in `dependencies`)
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`d72209a`](https://github.com/graphql-hive/gateway/commit/d72209ad82ec53689f93ce5d81bfa52493919ad9)]:
|
|
12
|
+
- @graphql-tools/delegate@10.2.12-alpha-bb010bd4b613397bc4e6ba96149dc972a0ef0997
|
|
13
|
+
|
|
3
14
|
## 10.0.29
|
|
4
15
|
|
|
5
16
|
### 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] !== void 0) {
|
|
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: void 0
|
|
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: void 0
|
|
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: void 0
|
|
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: void 0
|
|
119
119
|
});
|
|
120
120
|
},
|
|
121
121
|
[utils.MapperKind.ENUM_VALUE]: (valueConfig) => {
|
|
122
122
|
return {
|
|
123
123
|
...valueConfig,
|
|
124
|
-
value:
|
|
124
|
+
value: void 0
|
|
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 void 0;
|
|
152
152
|
}
|
|
153
153
|
if (graphql.isScalarType(type) && !this.renameScalars) {
|
|
154
|
-
return
|
|
154
|
+
return void 0;
|
|
155
155
|
}
|
|
156
156
|
const oldName = type.name;
|
|
157
157
|
const newName = this.renamer(oldName);
|
|
158
|
-
if (newName !==
|
|
158
|
+
if (newName !== void 0 && 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 void 0;
|
|
172
172
|
},
|
|
173
173
|
[utils.MapperKind.ROOT_OBJECT]() {
|
|
174
|
-
return
|
|
174
|
+
return void 0;
|
|
175
175
|
}
|
|
176
176
|
});
|
|
177
177
|
}
|
|
@@ -188,7 +188,7 @@ class RenameTypes {
|
|
|
188
188
|
}
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
|
-
return
|
|
191
|
+
return void 0;
|
|
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 void 0;
|
|
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 !== void 0 && 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 void 0;
|
|
250
250
|
}
|
|
251
251
|
});
|
|
252
252
|
}
|
|
@@ -263,7 +263,7 @@ class RenameRootTypes {
|
|
|
263
263
|
}
|
|
264
264
|
};
|
|
265
265
|
}
|
|
266
|
-
return
|
|
266
|
+
return void 0;
|
|
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 === void 0) {
|
|
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 void 0;
|
|
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 === void 0 ? 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 === void 0) {
|
|
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 void 0;
|
|
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 === void 0) {
|
|
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 void 0;
|
|
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 void 0;
|
|
595
595
|
}
|
|
596
596
|
return null;
|
|
597
597
|
}
|
|
@@ -639,7 +639,7 @@ class RenameObjectFieldArguments {
|
|
|
639
639
|
const argsConfig = Object.fromEntries(
|
|
640
640
|
Object.entries(fieldConfig.args || []).map(([argName, conf]) => {
|
|
641
641
|
const newName = renamer(typeName, fieldName, argName);
|
|
642
|
-
if (newName !==
|
|
642
|
+
if (newName !== void 0 && newName !== argName) {
|
|
643
643
|
if (newName != null) {
|
|
644
644
|
return [newName, conf];
|
|
645
645
|
}
|
|
@@ -678,7 +678,7 @@ class RenameObjectFieldArguments {
|
|
|
678
678
|
[utils.MapperKind.OBJECT_FIELD]: (fieldConfig, fieldName, typeName) => {
|
|
679
679
|
Object.entries(fieldConfig.args || {}).forEach(([argName]) => {
|
|
680
680
|
const newName = this.renamer(typeName, fieldName, argName);
|
|
681
|
-
if (newName !==
|
|
681
|
+
if (newName !== void 0 && newName !== fieldName) {
|
|
682
682
|
if (this.reverseMap[typeName] == null) {
|
|
683
683
|
this.reverseMap[typeName] = /* @__PURE__ */ Object.create(null);
|
|
684
684
|
}
|
|
@@ -688,10 +688,10 @@ class RenameObjectFieldArguments {
|
|
|
688
688
|
this.reverseMap[typeName][fieldName][newName] = argName;
|
|
689
689
|
}
|
|
690
690
|
});
|
|
691
|
-
return
|
|
691
|
+
return void 0;
|
|
692
692
|
},
|
|
693
693
|
[utils.MapperKind.ROOT_OBJECT]() {
|
|
694
|
-
return
|
|
694
|
+
return void 0;
|
|
695
695
|
}
|
|
696
696
|
});
|
|
697
697
|
this.transformedSchema = this.transformer.transformSchema(
|
|
@@ -735,7 +735,7 @@ class FilterObjectFields {
|
|
|
735
735
|
transformer;
|
|
736
736
|
constructor(filter) {
|
|
737
737
|
this.transformer = new TransformObjectFields(
|
|
738
|
-
(typeName, fieldName, fieldConfig) => filter(typeName, fieldName, fieldConfig) ?
|
|
738
|
+
(typeName, fieldName, fieldConfig) => filter(typeName, fieldName, fieldConfig) ? void 0 : null
|
|
739
739
|
);
|
|
740
740
|
}
|
|
741
741
|
transformSchema(originalWrappingSchema, subschemaConfig) {
|
|
@@ -756,7 +756,7 @@ class TransformInterfaceFields {
|
|
|
756
756
|
}
|
|
757
757
|
_getTransformer() {
|
|
758
758
|
const transformer = this.transformer;
|
|
759
|
-
if (transformer ===
|
|
759
|
+
if (transformer === void 0) {
|
|
760
760
|
throw new Error(
|
|
761
761
|
`The TransformInterfaceFields transform's "transformRequest" and "transformResult" methods cannot be used without first calling "transformSchema".`
|
|
762
762
|
);
|
|
@@ -768,7 +768,7 @@ class TransformInterfaceFields {
|
|
|
768
768
|
if (graphql.isInterfaceType(originalWrappingSchema.getType(typeName))) {
|
|
769
769
|
return this.interfaceFieldTransformer(typeName, fieldName, fieldConfig);
|
|
770
770
|
}
|
|
771
|
-
return
|
|
771
|
+
return void 0;
|
|
772
772
|
};
|
|
773
773
|
this.transformer = new TransformCompositeFields(
|
|
774
774
|
compositeToObjectFieldTransformer,
|
|
@@ -821,7 +821,7 @@ class FilterInterfaceFields {
|
|
|
821
821
|
transformer;
|
|
822
822
|
constructor(filter) {
|
|
823
823
|
this.transformer = new TransformInterfaceFields(
|
|
824
|
-
(typeName, fieldName, fieldConfig) => filter(typeName, fieldName, fieldConfig) ?
|
|
824
|
+
(typeName, fieldName, fieldConfig) => filter(typeName, fieldName, fieldConfig) ? void 0 : null
|
|
825
825
|
);
|
|
826
826
|
}
|
|
827
827
|
transformSchema(originalWrappingSchema, subschemaConfig) {
|
|
@@ -846,7 +846,7 @@ class TransformInputObjectFields {
|
|
|
846
846
|
}
|
|
847
847
|
_getTransformedSchema() {
|
|
848
848
|
const transformedSchema = this.transformedSchema;
|
|
849
|
-
if (transformedSchema ===
|
|
849
|
+
if (transformedSchema === void 0) {
|
|
850
850
|
throw new Error(
|
|
851
851
|
`The TransformInputObjectFields transform's "transformRequest" and "transformResult" methods cannot be used without first calling "transformSchema".`
|
|
852
852
|
);
|
|
@@ -901,7 +901,7 @@ class TransformInputObjectFields {
|
|
|
901
901
|
variableValues[varName] = utils.transformInputValue(
|
|
902
902
|
varType,
|
|
903
903
|
variableValues[varName],
|
|
904
|
-
|
|
904
|
+
void 0,
|
|
905
905
|
(type, originalValue) => {
|
|
906
906
|
const newValue = /* @__PURE__ */ Object.create(null);
|
|
907
907
|
const fields = type.getFields();
|
|
@@ -949,7 +949,7 @@ class TransformInputObjectFields {
|
|
|
949
949
|
newArgs[targetArg.name] = utils.transformInputValue(
|
|
950
950
|
targetArg.type,
|
|
951
951
|
delegationContext.args[targetArg.name],
|
|
952
|
-
|
|
952
|
+
void 0,
|
|
953
953
|
(type, originalValue) => {
|
|
954
954
|
const newValue = /* @__PURE__ */ Object.create(null);
|
|
955
955
|
const fields = type.getFields();
|
|
@@ -1067,13 +1067,13 @@ class RenameInputObjectFields {
|
|
|
1067
1067
|
this.transformer = new TransformInputObjectFields(
|
|
1068
1068
|
(typeName, inputFieldName, inputFieldConfig) => {
|
|
1069
1069
|
const newName = renamer(typeName, inputFieldName, inputFieldConfig);
|
|
1070
|
-
if (newName !==
|
|
1070
|
+
if (newName !== void 0 && newName !== inputFieldName) {
|
|
1071
1071
|
const value = renamer(typeName, inputFieldName, inputFieldConfig);
|
|
1072
1072
|
if (value != null) {
|
|
1073
1073
|
return [value, inputFieldConfig];
|
|
1074
1074
|
}
|
|
1075
1075
|
}
|
|
1076
|
-
return
|
|
1076
|
+
return void 0;
|
|
1077
1077
|
},
|
|
1078
1078
|
(typeName, inputFieldName, inputFieldNode) => {
|
|
1079
1079
|
if (!(typeName in this.reverseMap)) {
|
|
@@ -1098,16 +1098,16 @@ class RenameInputObjectFields {
|
|
|
1098
1098
|
utils.mapSchema(originalWrappingSchema, {
|
|
1099
1099
|
[utils.MapperKind.INPUT_OBJECT_FIELD]: (inputFieldConfig, fieldName, typeName) => {
|
|
1100
1100
|
const newName = this.renamer(typeName, fieldName, inputFieldConfig);
|
|
1101
|
-
if (newName !==
|
|
1101
|
+
if (newName !== void 0 && newName !== fieldName) {
|
|
1102
1102
|
if (this.reverseMap[typeName] == null) {
|
|
1103
1103
|
this.reverseMap[typeName] = /* @__PURE__ */ Object.create(null);
|
|
1104
1104
|
}
|
|
1105
1105
|
this.reverseMap[typeName][newName] = fieldName;
|
|
1106
1106
|
}
|
|
1107
|
-
return
|
|
1107
|
+
return void 0;
|
|
1108
1108
|
},
|
|
1109
1109
|
[utils.MapperKind.ROOT_OBJECT]() {
|
|
1110
|
-
return
|
|
1110
|
+
return void 0;
|
|
1111
1111
|
}
|
|
1112
1112
|
});
|
|
1113
1113
|
return this.transformer.transformSchema(
|
|
@@ -1128,8 +1128,8 @@ class FilterInputObjectFields {
|
|
|
1128
1128
|
transformer;
|
|
1129
1129
|
constructor(filter, inputObjectNodeTransformer) {
|
|
1130
1130
|
this.transformer = new TransformInputObjectFields(
|
|
1131
|
-
(typeName, fieldName, inputFieldConfig) => filter(typeName, fieldName, inputFieldConfig) ?
|
|
1132
|
-
|
|
1131
|
+
(typeName, fieldName, inputFieldConfig) => filter(typeName, fieldName, inputFieldConfig) ? void 0 : null,
|
|
1132
|
+
void 0,
|
|
1133
1133
|
inputObjectNodeTransformer
|
|
1134
1134
|
);
|
|
1135
1135
|
}
|
|
@@ -1152,7 +1152,7 @@ const getTypeInfo = utils.memoize1(function getTypeInfo2(schema) {
|
|
|
1152
1152
|
return new graphql.TypeInfo(schema);
|
|
1153
1153
|
});
|
|
1154
1154
|
utils.memoize2(function getTypeInfoWithType2(schema, type) {
|
|
1155
|
-
return graphql.versionInfo.major < 16 ? new graphql.TypeInfo(schema,
|
|
1155
|
+
return graphql.versionInfo.major < 16 ? new graphql.TypeInfo(schema, void 0, type) : new graphql.TypeInfo(schema, type);
|
|
1156
1156
|
});
|
|
1157
1157
|
|
|
1158
1158
|
class MapLeafValues {
|
|
@@ -1262,7 +1262,7 @@ class MapLeafValues {
|
|
|
1262
1262
|
args[argName],
|
|
1263
1263
|
(t, v) => {
|
|
1264
1264
|
const newValue = this.inputValueTransformer(t.name, v);
|
|
1265
|
-
return newValue ===
|
|
1265
|
+
return newValue === void 0 ? v : newValue;
|
|
1266
1266
|
}
|
|
1267
1267
|
);
|
|
1268
1268
|
}
|
|
@@ -1280,7 +1280,7 @@ class MapLeafValues {
|
|
|
1280
1280
|
value,
|
|
1281
1281
|
(t, v) => {
|
|
1282
1282
|
const newValue = this.inputValueTransformer(t.name, v);
|
|
1283
|
-
return newValue ===
|
|
1283
|
+
return newValue === void 0 ? v : newValue;
|
|
1284
1284
|
}
|
|
1285
1285
|
);
|
|
1286
1286
|
if (argValue?.kind === graphql.Kind.VARIABLE) {
|
|
@@ -1306,7 +1306,7 @@ class MapLeafValues {
|
|
|
1306
1306
|
};
|
|
1307
1307
|
}
|
|
1308
1308
|
}
|
|
1309
|
-
return
|
|
1309
|
+
return void 0;
|
|
1310
1310
|
}
|
|
1311
1311
|
}
|
|
1312
1312
|
|
|
@@ -1347,7 +1347,7 @@ class TransformEnumValues {
|
|
|
1347
1347
|
defaultValue: newValue
|
|
1348
1348
|
};
|
|
1349
1349
|
}
|
|
1350
|
-
return
|
|
1350
|
+
return void 0;
|
|
1351
1351
|
}
|
|
1352
1352
|
});
|
|
1353
1353
|
return this.transformedSchema;
|
|
@@ -1393,13 +1393,13 @@ class TransformEnumValues {
|
|
|
1393
1393
|
newExternalValue,
|
|
1394
1394
|
{
|
|
1395
1395
|
...transformedEnumValue[1],
|
|
1396
|
-
value:
|
|
1396
|
+
value: void 0
|
|
1397
1397
|
}
|
|
1398
1398
|
];
|
|
1399
1399
|
}
|
|
1400
1400
|
return {
|
|
1401
1401
|
...transformedEnumValue,
|
|
1402
|
-
value:
|
|
1402
|
+
value: void 0
|
|
1403
1403
|
};
|
|
1404
1404
|
}
|
|
1405
1405
|
}
|
|
@@ -1467,7 +1467,7 @@ class TransformQuery {
|
|
|
1467
1467
|
selectionSet
|
|
1468
1468
|
};
|
|
1469
1469
|
}
|
|
1470
|
-
return
|
|
1470
|
+
return void 0;
|
|
1471
1471
|
},
|
|
1472
1472
|
leave: () => {
|
|
1473
1473
|
index--;
|
|
@@ -1492,7 +1492,7 @@ class TransformQuery {
|
|
|
1492
1492
|
const errors = originalResult.errors;
|
|
1493
1493
|
return {
|
|
1494
1494
|
data,
|
|
1495
|
-
errors: errors != null ? this.transformErrors(errors) :
|
|
1495
|
+
errors: errors != null ? this.transformErrors(errors) : void 0
|
|
1496
1496
|
};
|
|
1497
1497
|
}
|
|
1498
1498
|
transformData(data, delegationContext, transformationContext) {
|
|
@@ -1551,7 +1551,7 @@ class FilterObjectFieldDirectives {
|
|
|
1551
1551
|
const directiveDef = originalWrappingSchema.getDirective(
|
|
1552
1552
|
dir.name.value
|
|
1553
1553
|
);
|
|
1554
|
-
const directiveValue = directiveDef ? utils.getArgumentValues(directiveDef, dir) :
|
|
1554
|
+
const directiveValue = directiveDef ? utils.getArgumentValues(directiveDef, dir) : void 0;
|
|
1555
1555
|
return this.filter(dir.name.value, directiveValue);
|
|
1556
1556
|
}) ?? [];
|
|
1557
1557
|
if (fieldConfig.astNode?.directives != null && keepDirectives.length !== fieldConfig.astNode.directives.length) {
|
|
@@ -1564,7 +1564,7 @@ class FilterObjectFieldDirectives {
|
|
|
1564
1564
|
};
|
|
1565
1565
|
return fieldConfig;
|
|
1566
1566
|
}
|
|
1567
|
-
return
|
|
1567
|
+
return void 0;
|
|
1568
1568
|
}
|
|
1569
1569
|
);
|
|
1570
1570
|
return transformer.transformSchema(originalWrappingSchema, subschemaConfig);
|
|
@@ -1681,7 +1681,7 @@ class MapFields {
|
|
|
1681
1681
|
}
|
|
1682
1682
|
_getTransformer() {
|
|
1683
1683
|
const transformer = this.transformer;
|
|
1684
|
-
if (transformer ===
|
|
1684
|
+
if (transformer === void 0) {
|
|
1685
1685
|
throw new Error(
|
|
1686
1686
|
`The MapFields transform's "transformRequest" and "transformResult" methods cannot be used without first calling "transformSchema".`
|
|
1687
1687
|
);
|
|
@@ -1692,15 +1692,15 @@ class MapFields {
|
|
|
1692
1692
|
const subscriptionTypeName = originalWrappingSchema.getSubscriptionType()?.name;
|
|
1693
1693
|
const objectValueTransformerMap = this.objectValueTransformerMap;
|
|
1694
1694
|
this.transformer = new TransformCompositeFields(
|
|
1695
|
-
() =>
|
|
1695
|
+
() => void 0,
|
|
1696
1696
|
(typeName, fieldName, fieldNode, fragments, transformationContext) => {
|
|
1697
1697
|
const typeTransformers = this.fieldNodeTransformerMap[typeName];
|
|
1698
1698
|
if (typeTransformers == null) {
|
|
1699
|
-
return
|
|
1699
|
+
return void 0;
|
|
1700
1700
|
}
|
|
1701
1701
|
const fieldNodeTransformer = typeTransformers[fieldName];
|
|
1702
1702
|
if (fieldNodeTransformer == null) {
|
|
1703
|
-
return
|
|
1703
|
+
return void 0;
|
|
1704
1704
|
}
|
|
1705
1705
|
return fieldNodeTransformer(
|
|
1706
1706
|
fieldNode,
|
|
@@ -1724,8 +1724,8 @@ class MapFields {
|
|
|
1724
1724
|
return data;
|
|
1725
1725
|
}
|
|
1726
1726
|
return transformer(data, transformationContext);
|
|
1727
|
-
} :
|
|
1728
|
-
this.errorsTransformer != null ? this.errorsTransformer :
|
|
1727
|
+
} : void 0,
|
|
1728
|
+
this.errorsTransformer != null ? this.errorsTransformer : void 0
|
|
1729
1729
|
);
|
|
1730
1730
|
return this.transformer.transformSchema(
|
|
1731
1731
|
originalWrappingSchema,
|
|
@@ -2001,8 +2001,8 @@ function dehoistValue(originalValue, context) {
|
|
|
2001
2001
|
return newValue;
|
|
2002
2002
|
}
|
|
2003
2003
|
function dehoistErrors(errors, context) {
|
|
2004
|
-
if (errors ===
|
|
2005
|
-
return
|
|
2004
|
+
if (errors === void 0) {
|
|
2005
|
+
return void 0;
|
|
2006
2006
|
}
|
|
2007
2007
|
return errors.map((error) => {
|
|
2008
2008
|
const originalPath = error.path;
|
|
@@ -2101,7 +2101,7 @@ class HoistField {
|
|
|
2101
2101
|
{
|
|
2102
2102
|
[typeName]: (value) => unwrapValue(value, alias)
|
|
2103
2103
|
},
|
|
2104
|
-
(errors) => errors != null ? unwrapErrors(errors, alias) :
|
|
2104
|
+
(errors) => errors != null ? unwrapErrors(errors, alias) : void 0
|
|
2105
2105
|
);
|
|
2106
2106
|
this.argLevels = argLevels;
|
|
2107
2107
|
}
|
|
@@ -2218,13 +2218,13 @@ function wrapFieldNode(fieldNode, path, alias, argLevels) {
|
|
|
2218
2218
|
},
|
|
2219
2219
|
arguments: fieldNode.arguments != null ? fieldNode.arguments.filter(
|
|
2220
2220
|
(arg) => argLevels[arg.name.value] === index
|
|
2221
|
-
) :
|
|
2221
|
+
) : void 0
|
|
2222
2222
|
}),
|
|
2223
2223
|
{
|
|
2224
2224
|
...fieldNode,
|
|
2225
2225
|
arguments: fieldNode.arguments != null ? fieldNode.arguments.filter(
|
|
2226
2226
|
(arg) => argLevels[arg.name.value] === path.length
|
|
2227
|
-
) :
|
|
2227
|
+
) : void 0
|
|
2228
2228
|
}
|
|
2229
2229
|
);
|
|
2230
2230
|
}
|
|
@@ -2253,8 +2253,8 @@ function unwrapValue(originalValue, alias) {
|
|
|
2253
2253
|
return originalValue;
|
|
2254
2254
|
}
|
|
2255
2255
|
function unwrapErrors(errors, alias) {
|
|
2256
|
-
if (errors ===
|
|
2257
|
-
return
|
|
2256
|
+
if (errors === void 0) {
|
|
2257
|
+
return void 0;
|
|
2258
2258
|
}
|
|
2259
2259
|
return errors.map((error) => {
|
|
2260
2260
|
const originalPath = error.path;
|
|
@@ -2296,7 +2296,7 @@ class WrapQuery {
|
|
|
2296
2296
|
selectionSet
|
|
2297
2297
|
};
|
|
2298
2298
|
}
|
|
2299
|
-
return
|
|
2299
|
+
return void 0;
|
|
2300
2300
|
},
|
|
2301
2301
|
leave: () => {
|
|
2302
2302
|
fieldPath.pop();
|
|
@@ -2349,7 +2349,7 @@ class ExtractField {
|
|
|
2349
2349
|
fromSelection = node.selectionSet;
|
|
2350
2350
|
return graphql.BREAK;
|
|
2351
2351
|
}
|
|
2352
|
-
return
|
|
2352
|
+
return void 0;
|
|
2353
2353
|
},
|
|
2354
2354
|
leave: () => {
|
|
2355
2355
|
fieldPath.pop();
|
|
@@ -2367,7 +2367,7 @@ class ExtractField {
|
|
|
2367
2367
|
selectionSet: fromSelection
|
|
2368
2368
|
};
|
|
2369
2369
|
}
|
|
2370
|
-
return
|
|
2370
|
+
return void 0;
|
|
2371
2371
|
},
|
|
2372
2372
|
leave: () => {
|
|
2373
2373
|
fieldPath.pop();
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SubschemaConfig, Subschema, ICreateProxyingResolverOptions, Transform, DelegationContext } from '@graphql-tools/delegate';
|
|
2
|
-
import { GraphQLSchema, GraphQLFieldResolver, GraphQLNamedType,
|
|
2
|
+
import { GraphQLSchema, GraphQLFieldResolver, GraphQLNamedType, GraphQLFieldConfig, FieldNode, FragmentDefinitionNode, SelectionNode, GraphQLError, GraphQLInputFieldConfig, ObjectFieldNode, ObjectValueNode, GraphQLEnumValueConfig, SelectionSetNode, GraphQLArgument, IntrospectionOptions, buildClientSchema, ParseOptions } from 'graphql';
|
|
3
3
|
import { RenameTypesOptions, ExecutionRequest, ExecutionResult, Maybe, RootFieldFilter, ObjectFieldFilter, FieldFilter, InputFieldFilter, PruneSchemaOptions, FieldNodeMappers, SyncExecutor, AsyncExecutor, Executor, MaybePromise } from '@graphql-tools/utils';
|
|
4
4
|
|
|
5
5
|
declare const wrapSchema: <TConfig extends Record<string, any> = Record<string, any>>(subschemaConfig: SubschemaConfig<any, any, any, TConfig> | Subschema<any, any, any, TConfig>) => GraphQLSchema;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SubschemaConfig, Subschema, ICreateProxyingResolverOptions, Transform, DelegationContext } from '@graphql-tools/delegate';
|
|
2
|
-
import { GraphQLSchema, GraphQLFieldResolver, GraphQLNamedType,
|
|
2
|
+
import { GraphQLSchema, GraphQLFieldResolver, GraphQLNamedType, GraphQLFieldConfig, FieldNode, FragmentDefinitionNode, SelectionNode, GraphQLError, GraphQLInputFieldConfig, ObjectFieldNode, ObjectValueNode, GraphQLEnumValueConfig, SelectionSetNode, GraphQLArgument, IntrospectionOptions, buildClientSchema, ParseOptions } from 'graphql';
|
|
3
3
|
import { RenameTypesOptions, ExecutionRequest, ExecutionResult, Maybe, RootFieldFilter, ObjectFieldFilter, FieldFilter, InputFieldFilter, PruneSchemaOptions, FieldNodeMappers, SyncExecutor, AsyncExecutor, Executor, MaybePromise } from '@graphql-tools/utils';
|
|
4
4
|
|
|
5
5
|
declare const wrapSchema: <TConfig extends Record<string, any> = Record<string, any>>(subschemaConfig: SubschemaConfig<any, any, any, TConfig> | Subschema<any, any, any, TConfig>) => GraphQLSchema;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isExternalObject, getUnpathedErrors, getSubschema, resolveExternalValue, delegateToSchema, applySchemaTransforms, defaultMergedResolver, getTypeInfo as getTypeInfo$1, isPrototypePollutingKey } from '@graphql-tools/delegate';
|
|
2
2
|
import { getRootTypeMap, getResponseKeyFromInfo, memoize1, mapSchema, MapperKind, renameType, visitData, transformInputValue, getDefinedRootType, memoize2, visitResult, astFromValueUntyped, getOperationASTFromRequest, relocatedError, getArgumentValues, valueMatchesCriteria, getDirectives, pruneSchema, selectObjectFields, appendObjectFields, modifyObjectFields, removeObjectFields, mapMaybePromise, isAsyncIterable, createGraphQLError, inspect } from '@graphql-tools/utils';
|
|
3
|
-
import {
|
|
3
|
+
import { GraphQLUnionType, GraphQLInterfaceType, GraphQLObjectType, isSpecifiedScalarType, isScalarType, visit, Kind, visitWithTypeInfo, isObjectType, isInterfaceType, typeFromAST, isInputType, getNamedType, TypeInfo, versionInfo, isLeafType, valueFromAST, valueFromASTUntyped, astFromValue, GraphQLNonNull, getNullableType, isListType, GraphQLList, BREAK, parse, getIntrospectionQuery, buildClientSchema } from 'graphql';
|
|
4
4
|
|
|
5
5
|
function generateProxyingResolvers(subschemaConfig) {
|
|
6
6
|
const targetSchema = subschemaConfig.schema;
|
|
@@ -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] !== void 0) {
|
|
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: void 0
|
|
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: void 0
|
|
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: void 0
|
|
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: void 0
|
|
117
117
|
});
|
|
118
118
|
},
|
|
119
119
|
[MapperKind.ENUM_VALUE]: (valueConfig) => {
|
|
120
120
|
return {
|
|
121
121
|
...valueConfig,
|
|
122
|
-
value:
|
|
122
|
+
value: void 0
|
|
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 void 0;
|
|
150
150
|
}
|
|
151
151
|
if (isScalarType(type) && !this.renameScalars) {
|
|
152
|
-
return
|
|
152
|
+
return void 0;
|
|
153
153
|
}
|
|
154
154
|
const oldName = type.name;
|
|
155
155
|
const newName = this.renamer(oldName);
|
|
156
|
-
if (newName !==
|
|
156
|
+
if (newName !== void 0 && 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 void 0;
|
|
170
170
|
},
|
|
171
171
|
[MapperKind.ROOT_OBJECT]() {
|
|
172
|
-
return
|
|
172
|
+
return void 0;
|
|
173
173
|
}
|
|
174
174
|
});
|
|
175
175
|
}
|
|
@@ -186,7 +186,7 @@ class RenameTypes {
|
|
|
186
186
|
}
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
|
-
return
|
|
189
|
+
return void 0;
|
|
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 void 0;
|
|
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 !== void 0 && 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 void 0;
|
|
248
248
|
}
|
|
249
249
|
});
|
|
250
250
|
}
|
|
@@ -261,7 +261,7 @@ class RenameRootTypes {
|
|
|
261
261
|
}
|
|
262
262
|
};
|
|
263
263
|
}
|
|
264
|
-
return
|
|
264
|
+
return void 0;
|
|
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 === void 0) {
|
|
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 void 0;
|
|
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 === void 0 ? 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 === void 0) {
|
|
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 void 0;
|
|
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 === void 0) {
|
|
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 void 0;
|
|
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 void 0;
|
|
593
593
|
}
|
|
594
594
|
return null;
|
|
595
595
|
}
|
|
@@ -637,7 +637,7 @@ class RenameObjectFieldArguments {
|
|
|
637
637
|
const argsConfig = Object.fromEntries(
|
|
638
638
|
Object.entries(fieldConfig.args || []).map(([argName, conf]) => {
|
|
639
639
|
const newName = renamer(typeName, fieldName, argName);
|
|
640
|
-
if (newName !==
|
|
640
|
+
if (newName !== void 0 && newName !== argName) {
|
|
641
641
|
if (newName != null) {
|
|
642
642
|
return [newName, conf];
|
|
643
643
|
}
|
|
@@ -676,7 +676,7 @@ class RenameObjectFieldArguments {
|
|
|
676
676
|
[MapperKind.OBJECT_FIELD]: (fieldConfig, fieldName, typeName) => {
|
|
677
677
|
Object.entries(fieldConfig.args || {}).forEach(([argName]) => {
|
|
678
678
|
const newName = this.renamer(typeName, fieldName, argName);
|
|
679
|
-
if (newName !==
|
|
679
|
+
if (newName !== void 0 && newName !== fieldName) {
|
|
680
680
|
if (this.reverseMap[typeName] == null) {
|
|
681
681
|
this.reverseMap[typeName] = /* @__PURE__ */ Object.create(null);
|
|
682
682
|
}
|
|
@@ -686,10 +686,10 @@ class RenameObjectFieldArguments {
|
|
|
686
686
|
this.reverseMap[typeName][fieldName][newName] = argName;
|
|
687
687
|
}
|
|
688
688
|
});
|
|
689
|
-
return
|
|
689
|
+
return void 0;
|
|
690
690
|
},
|
|
691
691
|
[MapperKind.ROOT_OBJECT]() {
|
|
692
|
-
return
|
|
692
|
+
return void 0;
|
|
693
693
|
}
|
|
694
694
|
});
|
|
695
695
|
this.transformedSchema = this.transformer.transformSchema(
|
|
@@ -733,7 +733,7 @@ class FilterObjectFields {
|
|
|
733
733
|
transformer;
|
|
734
734
|
constructor(filter) {
|
|
735
735
|
this.transformer = new TransformObjectFields(
|
|
736
|
-
(typeName, fieldName, fieldConfig) => filter(typeName, fieldName, fieldConfig) ?
|
|
736
|
+
(typeName, fieldName, fieldConfig) => filter(typeName, fieldName, fieldConfig) ? void 0 : null
|
|
737
737
|
);
|
|
738
738
|
}
|
|
739
739
|
transformSchema(originalWrappingSchema, subschemaConfig) {
|
|
@@ -754,7 +754,7 @@ class TransformInterfaceFields {
|
|
|
754
754
|
}
|
|
755
755
|
_getTransformer() {
|
|
756
756
|
const transformer = this.transformer;
|
|
757
|
-
if (transformer ===
|
|
757
|
+
if (transformer === void 0) {
|
|
758
758
|
throw new Error(
|
|
759
759
|
`The TransformInterfaceFields transform's "transformRequest" and "transformResult" methods cannot be used without first calling "transformSchema".`
|
|
760
760
|
);
|
|
@@ -766,7 +766,7 @@ class TransformInterfaceFields {
|
|
|
766
766
|
if (isInterfaceType(originalWrappingSchema.getType(typeName))) {
|
|
767
767
|
return this.interfaceFieldTransformer(typeName, fieldName, fieldConfig);
|
|
768
768
|
}
|
|
769
|
-
return
|
|
769
|
+
return void 0;
|
|
770
770
|
};
|
|
771
771
|
this.transformer = new TransformCompositeFields(
|
|
772
772
|
compositeToObjectFieldTransformer,
|
|
@@ -819,7 +819,7 @@ class FilterInterfaceFields {
|
|
|
819
819
|
transformer;
|
|
820
820
|
constructor(filter) {
|
|
821
821
|
this.transformer = new TransformInterfaceFields(
|
|
822
|
-
(typeName, fieldName, fieldConfig) => filter(typeName, fieldName, fieldConfig) ?
|
|
822
|
+
(typeName, fieldName, fieldConfig) => filter(typeName, fieldName, fieldConfig) ? void 0 : null
|
|
823
823
|
);
|
|
824
824
|
}
|
|
825
825
|
transformSchema(originalWrappingSchema, subschemaConfig) {
|
|
@@ -844,7 +844,7 @@ class TransformInputObjectFields {
|
|
|
844
844
|
}
|
|
845
845
|
_getTransformedSchema() {
|
|
846
846
|
const transformedSchema = this.transformedSchema;
|
|
847
|
-
if (transformedSchema ===
|
|
847
|
+
if (transformedSchema === void 0) {
|
|
848
848
|
throw new Error(
|
|
849
849
|
`The TransformInputObjectFields transform's "transformRequest" and "transformResult" methods cannot be used without first calling "transformSchema".`
|
|
850
850
|
);
|
|
@@ -899,7 +899,7 @@ class TransformInputObjectFields {
|
|
|
899
899
|
variableValues[varName] = transformInputValue(
|
|
900
900
|
varType,
|
|
901
901
|
variableValues[varName],
|
|
902
|
-
|
|
902
|
+
void 0,
|
|
903
903
|
(type, originalValue) => {
|
|
904
904
|
const newValue = /* @__PURE__ */ Object.create(null);
|
|
905
905
|
const fields = type.getFields();
|
|
@@ -947,7 +947,7 @@ class TransformInputObjectFields {
|
|
|
947
947
|
newArgs[targetArg.name] = transformInputValue(
|
|
948
948
|
targetArg.type,
|
|
949
949
|
delegationContext.args[targetArg.name],
|
|
950
|
-
|
|
950
|
+
void 0,
|
|
951
951
|
(type, originalValue) => {
|
|
952
952
|
const newValue = /* @__PURE__ */ Object.create(null);
|
|
953
953
|
const fields = type.getFields();
|
|
@@ -1065,13 +1065,13 @@ class RenameInputObjectFields {
|
|
|
1065
1065
|
this.transformer = new TransformInputObjectFields(
|
|
1066
1066
|
(typeName, inputFieldName, inputFieldConfig) => {
|
|
1067
1067
|
const newName = renamer(typeName, inputFieldName, inputFieldConfig);
|
|
1068
|
-
if (newName !==
|
|
1068
|
+
if (newName !== void 0 && newName !== inputFieldName) {
|
|
1069
1069
|
const value = renamer(typeName, inputFieldName, inputFieldConfig);
|
|
1070
1070
|
if (value != null) {
|
|
1071
1071
|
return [value, inputFieldConfig];
|
|
1072
1072
|
}
|
|
1073
1073
|
}
|
|
1074
|
-
return
|
|
1074
|
+
return void 0;
|
|
1075
1075
|
},
|
|
1076
1076
|
(typeName, inputFieldName, inputFieldNode) => {
|
|
1077
1077
|
if (!(typeName in this.reverseMap)) {
|
|
@@ -1096,16 +1096,16 @@ class RenameInputObjectFields {
|
|
|
1096
1096
|
mapSchema(originalWrappingSchema, {
|
|
1097
1097
|
[MapperKind.INPUT_OBJECT_FIELD]: (inputFieldConfig, fieldName, typeName) => {
|
|
1098
1098
|
const newName = this.renamer(typeName, fieldName, inputFieldConfig);
|
|
1099
|
-
if (newName !==
|
|
1099
|
+
if (newName !== void 0 && newName !== fieldName) {
|
|
1100
1100
|
if (this.reverseMap[typeName] == null) {
|
|
1101
1101
|
this.reverseMap[typeName] = /* @__PURE__ */ Object.create(null);
|
|
1102
1102
|
}
|
|
1103
1103
|
this.reverseMap[typeName][newName] = fieldName;
|
|
1104
1104
|
}
|
|
1105
|
-
return
|
|
1105
|
+
return void 0;
|
|
1106
1106
|
},
|
|
1107
1107
|
[MapperKind.ROOT_OBJECT]() {
|
|
1108
|
-
return
|
|
1108
|
+
return void 0;
|
|
1109
1109
|
}
|
|
1110
1110
|
});
|
|
1111
1111
|
return this.transformer.transformSchema(
|
|
@@ -1126,8 +1126,8 @@ class FilterInputObjectFields {
|
|
|
1126
1126
|
transformer;
|
|
1127
1127
|
constructor(filter, inputObjectNodeTransformer) {
|
|
1128
1128
|
this.transformer = new TransformInputObjectFields(
|
|
1129
|
-
(typeName, fieldName, inputFieldConfig) => filter(typeName, fieldName, inputFieldConfig) ?
|
|
1130
|
-
|
|
1129
|
+
(typeName, fieldName, inputFieldConfig) => filter(typeName, fieldName, inputFieldConfig) ? void 0 : null,
|
|
1130
|
+
void 0,
|
|
1131
1131
|
inputObjectNodeTransformer
|
|
1132
1132
|
);
|
|
1133
1133
|
}
|
|
@@ -1150,7 +1150,7 @@ const getTypeInfo = memoize1(function getTypeInfo2(schema) {
|
|
|
1150
1150
|
return new TypeInfo(schema);
|
|
1151
1151
|
});
|
|
1152
1152
|
memoize2(function getTypeInfoWithType2(schema, type) {
|
|
1153
|
-
return versionInfo.major < 16 ? new TypeInfo(schema,
|
|
1153
|
+
return versionInfo.major < 16 ? new TypeInfo(schema, void 0, type) : new TypeInfo(schema, type);
|
|
1154
1154
|
});
|
|
1155
1155
|
|
|
1156
1156
|
class MapLeafValues {
|
|
@@ -1260,7 +1260,7 @@ class MapLeafValues {
|
|
|
1260
1260
|
args[argName],
|
|
1261
1261
|
(t, v) => {
|
|
1262
1262
|
const newValue = this.inputValueTransformer(t.name, v);
|
|
1263
|
-
return newValue ===
|
|
1263
|
+
return newValue === void 0 ? v : newValue;
|
|
1264
1264
|
}
|
|
1265
1265
|
);
|
|
1266
1266
|
}
|
|
@@ -1278,7 +1278,7 @@ class MapLeafValues {
|
|
|
1278
1278
|
value,
|
|
1279
1279
|
(t, v) => {
|
|
1280
1280
|
const newValue = this.inputValueTransformer(t.name, v);
|
|
1281
|
-
return newValue ===
|
|
1281
|
+
return newValue === void 0 ? v : newValue;
|
|
1282
1282
|
}
|
|
1283
1283
|
);
|
|
1284
1284
|
if (argValue?.kind === Kind.VARIABLE) {
|
|
@@ -1304,7 +1304,7 @@ class MapLeafValues {
|
|
|
1304
1304
|
};
|
|
1305
1305
|
}
|
|
1306
1306
|
}
|
|
1307
|
-
return
|
|
1307
|
+
return void 0;
|
|
1308
1308
|
}
|
|
1309
1309
|
}
|
|
1310
1310
|
|
|
@@ -1345,7 +1345,7 @@ class TransformEnumValues {
|
|
|
1345
1345
|
defaultValue: newValue
|
|
1346
1346
|
};
|
|
1347
1347
|
}
|
|
1348
|
-
return
|
|
1348
|
+
return void 0;
|
|
1349
1349
|
}
|
|
1350
1350
|
});
|
|
1351
1351
|
return this.transformedSchema;
|
|
@@ -1391,13 +1391,13 @@ class TransformEnumValues {
|
|
|
1391
1391
|
newExternalValue,
|
|
1392
1392
|
{
|
|
1393
1393
|
...transformedEnumValue[1],
|
|
1394
|
-
value:
|
|
1394
|
+
value: void 0
|
|
1395
1395
|
}
|
|
1396
1396
|
];
|
|
1397
1397
|
}
|
|
1398
1398
|
return {
|
|
1399
1399
|
...transformedEnumValue,
|
|
1400
|
-
value:
|
|
1400
|
+
value: void 0
|
|
1401
1401
|
};
|
|
1402
1402
|
}
|
|
1403
1403
|
}
|
|
@@ -1465,7 +1465,7 @@ class TransformQuery {
|
|
|
1465
1465
|
selectionSet
|
|
1466
1466
|
};
|
|
1467
1467
|
}
|
|
1468
|
-
return
|
|
1468
|
+
return void 0;
|
|
1469
1469
|
},
|
|
1470
1470
|
leave: () => {
|
|
1471
1471
|
index--;
|
|
@@ -1490,7 +1490,7 @@ class TransformQuery {
|
|
|
1490
1490
|
const errors = originalResult.errors;
|
|
1491
1491
|
return {
|
|
1492
1492
|
data,
|
|
1493
|
-
errors: errors != null ? this.transformErrors(errors) :
|
|
1493
|
+
errors: errors != null ? this.transformErrors(errors) : void 0
|
|
1494
1494
|
};
|
|
1495
1495
|
}
|
|
1496
1496
|
transformData(data, delegationContext, transformationContext) {
|
|
@@ -1549,7 +1549,7 @@ class FilterObjectFieldDirectives {
|
|
|
1549
1549
|
const directiveDef = originalWrappingSchema.getDirective(
|
|
1550
1550
|
dir.name.value
|
|
1551
1551
|
);
|
|
1552
|
-
const directiveValue = directiveDef ? getArgumentValues(directiveDef, dir) :
|
|
1552
|
+
const directiveValue = directiveDef ? getArgumentValues(directiveDef, dir) : void 0;
|
|
1553
1553
|
return this.filter(dir.name.value, directiveValue);
|
|
1554
1554
|
}) ?? [];
|
|
1555
1555
|
if (fieldConfig.astNode?.directives != null && keepDirectives.length !== fieldConfig.astNode.directives.length) {
|
|
@@ -1562,7 +1562,7 @@ class FilterObjectFieldDirectives {
|
|
|
1562
1562
|
};
|
|
1563
1563
|
return fieldConfig;
|
|
1564
1564
|
}
|
|
1565
|
-
return
|
|
1565
|
+
return void 0;
|
|
1566
1566
|
}
|
|
1567
1567
|
);
|
|
1568
1568
|
return transformer.transformSchema(originalWrappingSchema, subschemaConfig);
|
|
@@ -1679,7 +1679,7 @@ class MapFields {
|
|
|
1679
1679
|
}
|
|
1680
1680
|
_getTransformer() {
|
|
1681
1681
|
const transformer = this.transformer;
|
|
1682
|
-
if (transformer ===
|
|
1682
|
+
if (transformer === void 0) {
|
|
1683
1683
|
throw new Error(
|
|
1684
1684
|
`The MapFields transform's "transformRequest" and "transformResult" methods cannot be used without first calling "transformSchema".`
|
|
1685
1685
|
);
|
|
@@ -1690,15 +1690,15 @@ class MapFields {
|
|
|
1690
1690
|
const subscriptionTypeName = originalWrappingSchema.getSubscriptionType()?.name;
|
|
1691
1691
|
const objectValueTransformerMap = this.objectValueTransformerMap;
|
|
1692
1692
|
this.transformer = new TransformCompositeFields(
|
|
1693
|
-
() =>
|
|
1693
|
+
() => void 0,
|
|
1694
1694
|
(typeName, fieldName, fieldNode, fragments, transformationContext) => {
|
|
1695
1695
|
const typeTransformers = this.fieldNodeTransformerMap[typeName];
|
|
1696
1696
|
if (typeTransformers == null) {
|
|
1697
|
-
return
|
|
1697
|
+
return void 0;
|
|
1698
1698
|
}
|
|
1699
1699
|
const fieldNodeTransformer = typeTransformers[fieldName];
|
|
1700
1700
|
if (fieldNodeTransformer == null) {
|
|
1701
|
-
return
|
|
1701
|
+
return void 0;
|
|
1702
1702
|
}
|
|
1703
1703
|
return fieldNodeTransformer(
|
|
1704
1704
|
fieldNode,
|
|
@@ -1722,8 +1722,8 @@ class MapFields {
|
|
|
1722
1722
|
return data;
|
|
1723
1723
|
}
|
|
1724
1724
|
return transformer(data, transformationContext);
|
|
1725
|
-
} :
|
|
1726
|
-
this.errorsTransformer != null ? this.errorsTransformer :
|
|
1725
|
+
} : void 0,
|
|
1726
|
+
this.errorsTransformer != null ? this.errorsTransformer : void 0
|
|
1727
1727
|
);
|
|
1728
1728
|
return this.transformer.transformSchema(
|
|
1729
1729
|
originalWrappingSchema,
|
|
@@ -1999,8 +1999,8 @@ function dehoistValue(originalValue, context) {
|
|
|
1999
1999
|
return newValue;
|
|
2000
2000
|
}
|
|
2001
2001
|
function dehoistErrors(errors, context) {
|
|
2002
|
-
if (errors ===
|
|
2003
|
-
return
|
|
2002
|
+
if (errors === void 0) {
|
|
2003
|
+
return void 0;
|
|
2004
2004
|
}
|
|
2005
2005
|
return errors.map((error) => {
|
|
2006
2006
|
const originalPath = error.path;
|
|
@@ -2099,7 +2099,7 @@ class HoistField {
|
|
|
2099
2099
|
{
|
|
2100
2100
|
[typeName]: (value) => unwrapValue(value, alias)
|
|
2101
2101
|
},
|
|
2102
|
-
(errors) => errors != null ? unwrapErrors(errors, alias) :
|
|
2102
|
+
(errors) => errors != null ? unwrapErrors(errors, alias) : void 0
|
|
2103
2103
|
);
|
|
2104
2104
|
this.argLevels = argLevels;
|
|
2105
2105
|
}
|
|
@@ -2216,13 +2216,13 @@ function wrapFieldNode(fieldNode, path, alias, argLevels) {
|
|
|
2216
2216
|
},
|
|
2217
2217
|
arguments: fieldNode.arguments != null ? fieldNode.arguments.filter(
|
|
2218
2218
|
(arg) => argLevels[arg.name.value] === index
|
|
2219
|
-
) :
|
|
2219
|
+
) : void 0
|
|
2220
2220
|
}),
|
|
2221
2221
|
{
|
|
2222
2222
|
...fieldNode,
|
|
2223
2223
|
arguments: fieldNode.arguments != null ? fieldNode.arguments.filter(
|
|
2224
2224
|
(arg) => argLevels[arg.name.value] === path.length
|
|
2225
|
-
) :
|
|
2225
|
+
) : void 0
|
|
2226
2226
|
}
|
|
2227
2227
|
);
|
|
2228
2228
|
}
|
|
@@ -2251,8 +2251,8 @@ function unwrapValue(originalValue, alias) {
|
|
|
2251
2251
|
return originalValue;
|
|
2252
2252
|
}
|
|
2253
2253
|
function unwrapErrors(errors, alias) {
|
|
2254
|
-
if (errors ===
|
|
2255
|
-
return
|
|
2254
|
+
if (errors === void 0) {
|
|
2255
|
+
return void 0;
|
|
2256
2256
|
}
|
|
2257
2257
|
return errors.map((error) => {
|
|
2258
2258
|
const originalPath = error.path;
|
|
@@ -2294,7 +2294,7 @@ class WrapQuery {
|
|
|
2294
2294
|
selectionSet
|
|
2295
2295
|
};
|
|
2296
2296
|
}
|
|
2297
|
-
return
|
|
2297
|
+
return void 0;
|
|
2298
2298
|
},
|
|
2299
2299
|
leave: () => {
|
|
2300
2300
|
fieldPath.pop();
|
|
@@ -2347,7 +2347,7 @@ class ExtractField {
|
|
|
2347
2347
|
fromSelection = node.selectionSet;
|
|
2348
2348
|
return BREAK;
|
|
2349
2349
|
}
|
|
2350
|
-
return
|
|
2350
|
+
return void 0;
|
|
2351
2351
|
},
|
|
2352
2352
|
leave: () => {
|
|
2353
2353
|
fieldPath.pop();
|
|
@@ -2365,7 +2365,7 @@ class ExtractField {
|
|
|
2365
2365
|
selectionSet: fromSelection
|
|
2366
2366
|
};
|
|
2367
2367
|
}
|
|
2368
|
-
return
|
|
2368
|
+
return void 0;
|
|
2369
2369
|
},
|
|
2370
2370
|
leave: () => {
|
|
2371
2371
|
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.30-alpha-bb010bd4b613397bc4e6ba96149dc972a0ef0997",
|
|
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.12-alpha-bb010bd4b613397bc4e6ba96149dc972a0ef0997",
|
|
42
42
|
"@graphql-tools/schema": "^10.0.11",
|
|
43
|
-
"@graphql-tools/utils": "^10.
|
|
43
|
+
"@graphql-tools/utils": "^10.8.1",
|
|
44
44
|
"tslib": "^2.8.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"graphql": "^16.9.0",
|
|
48
|
-
"pkgroll": "2.
|
|
48
|
+
"pkgroll": "2.8.2"
|
|
49
49
|
},
|
|
50
50
|
"sideEffects": false
|
|
51
51
|
}
|