@graphql-tools/wrap 8.4.3-alpha-dae587b2.0 → 8.4.3-alpha-7150a353.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +0 -68
- package/index.mjs +1 -68
- package/package.json +1 -1
- package/transforms/index.d.ts +0 -1
package/index.js
CHANGED
|
@@ -507,73 +507,6 @@ class RenameObjectFields {
|
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
509
|
|
|
510
|
-
class RenameObjectFieldArguments {
|
|
511
|
-
constructor(renamer) {
|
|
512
|
-
this.renamer = renamer;
|
|
513
|
-
this.transformer = new TransformObjectFields((typeName, fieldName, fieldConfig) => {
|
|
514
|
-
const argsConfig = Object.fromEntries(Object.entries(fieldConfig.args || []).map(([argName, conf]) => {
|
|
515
|
-
const newName = renamer(typeName, fieldName, argName);
|
|
516
|
-
if (newName !== undefined && newName !== argName) {
|
|
517
|
-
if (newName != null) {
|
|
518
|
-
return [newName, conf];
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
return [argName, conf];
|
|
522
|
-
}));
|
|
523
|
-
return [fieldName, { ...fieldConfig, args: argsConfig }];
|
|
524
|
-
}, (typeName, fieldName, inputFieldNode) => {
|
|
525
|
-
if (!(typeName in this.reverseMap)) {
|
|
526
|
-
return inputFieldNode;
|
|
527
|
-
}
|
|
528
|
-
if (!(fieldName in this.reverseMap[typeName])) {
|
|
529
|
-
return inputFieldNode;
|
|
530
|
-
}
|
|
531
|
-
const fieldNameMap = this.reverseMap[typeName][fieldName];
|
|
532
|
-
return {
|
|
533
|
-
...inputFieldNode,
|
|
534
|
-
arguments: (inputFieldNode.arguments || []).map(argNode => {
|
|
535
|
-
return argNode.name.value in fieldNameMap
|
|
536
|
-
? {
|
|
537
|
-
...argNode,
|
|
538
|
-
name: {
|
|
539
|
-
...argNode.name,
|
|
540
|
-
value: fieldNameMap[argNode.name.value],
|
|
541
|
-
},
|
|
542
|
-
}
|
|
543
|
-
: argNode;
|
|
544
|
-
}),
|
|
545
|
-
};
|
|
546
|
-
});
|
|
547
|
-
this.reverseMap = Object.create(null);
|
|
548
|
-
}
|
|
549
|
-
transformSchema(originalWrappingSchema, subschemaConfig, transformedSchema) {
|
|
550
|
-
utils.mapSchema(originalWrappingSchema, {
|
|
551
|
-
[utils.MapperKind.OBJECT_FIELD]: (fieldConfig, fieldName, typeName) => {
|
|
552
|
-
Object.entries(fieldConfig.args || {}).forEach(([argName]) => {
|
|
553
|
-
const newName = this.renamer(typeName, fieldName, argName);
|
|
554
|
-
if (newName !== undefined && newName !== fieldName) {
|
|
555
|
-
if (this.reverseMap[typeName] == null) {
|
|
556
|
-
this.reverseMap[typeName] = Object.create(null);
|
|
557
|
-
}
|
|
558
|
-
if (this.reverseMap[typeName][fieldName] == null) {
|
|
559
|
-
this.reverseMap[typeName][fieldName] = Object.create(null);
|
|
560
|
-
}
|
|
561
|
-
this.reverseMap[typeName][fieldName][newName] = argName;
|
|
562
|
-
}
|
|
563
|
-
});
|
|
564
|
-
return undefined;
|
|
565
|
-
},
|
|
566
|
-
[utils.MapperKind.ROOT_OBJECT]() {
|
|
567
|
-
return undefined;
|
|
568
|
-
},
|
|
569
|
-
});
|
|
570
|
-
return this.transformer.transformSchema(originalWrappingSchema, subschemaConfig, transformedSchema);
|
|
571
|
-
}
|
|
572
|
-
transformRequest(originalRequest, delegationContext, transformationContext) {
|
|
573
|
-
return this.transformer.transformRequest(originalRequest, delegationContext, transformationContext);
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
|
|
577
510
|
class FilterObjectFields {
|
|
578
511
|
constructor(filter) {
|
|
579
512
|
this.transformer = new TransformObjectFields((typeName, fieldName, fieldConfig) => filter(typeName, fieldName, fieldConfig) ? undefined : null);
|
|
@@ -1796,7 +1729,6 @@ exports.RemoveObjectFieldsWithDeprecation = RemoveObjectFieldsWithDeprecation;
|
|
|
1796
1729
|
exports.RemoveObjectFieldsWithDirective = RemoveObjectFieldsWithDirective;
|
|
1797
1730
|
exports.RenameInputObjectFields = RenameInputObjectFields;
|
|
1798
1731
|
exports.RenameInterfaceFields = RenameInterfaceFields;
|
|
1799
|
-
exports.RenameObjectFieldArguments = RenameObjectFieldArguments;
|
|
1800
1732
|
exports.RenameObjectFields = RenameObjectFields;
|
|
1801
1733
|
exports.RenameRootFields = RenameRootFields;
|
|
1802
1734
|
exports.RenameRootTypes = RenameRootTypes;
|
package/index.mjs
CHANGED
|
@@ -503,73 +503,6 @@ class RenameObjectFields {
|
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
505
|
|
|
506
|
-
class RenameObjectFieldArguments {
|
|
507
|
-
constructor(renamer) {
|
|
508
|
-
this.renamer = renamer;
|
|
509
|
-
this.transformer = new TransformObjectFields((typeName, fieldName, fieldConfig) => {
|
|
510
|
-
const argsConfig = Object.fromEntries(Object.entries(fieldConfig.args || []).map(([argName, conf]) => {
|
|
511
|
-
const newName = renamer(typeName, fieldName, argName);
|
|
512
|
-
if (newName !== undefined && newName !== argName) {
|
|
513
|
-
if (newName != null) {
|
|
514
|
-
return [newName, conf];
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
return [argName, conf];
|
|
518
|
-
}));
|
|
519
|
-
return [fieldName, { ...fieldConfig, args: argsConfig }];
|
|
520
|
-
}, (typeName, fieldName, inputFieldNode) => {
|
|
521
|
-
if (!(typeName in this.reverseMap)) {
|
|
522
|
-
return inputFieldNode;
|
|
523
|
-
}
|
|
524
|
-
if (!(fieldName in this.reverseMap[typeName])) {
|
|
525
|
-
return inputFieldNode;
|
|
526
|
-
}
|
|
527
|
-
const fieldNameMap = this.reverseMap[typeName][fieldName];
|
|
528
|
-
return {
|
|
529
|
-
...inputFieldNode,
|
|
530
|
-
arguments: (inputFieldNode.arguments || []).map(argNode => {
|
|
531
|
-
return argNode.name.value in fieldNameMap
|
|
532
|
-
? {
|
|
533
|
-
...argNode,
|
|
534
|
-
name: {
|
|
535
|
-
...argNode.name,
|
|
536
|
-
value: fieldNameMap[argNode.name.value],
|
|
537
|
-
},
|
|
538
|
-
}
|
|
539
|
-
: argNode;
|
|
540
|
-
}),
|
|
541
|
-
};
|
|
542
|
-
});
|
|
543
|
-
this.reverseMap = Object.create(null);
|
|
544
|
-
}
|
|
545
|
-
transformSchema(originalWrappingSchema, subschemaConfig, transformedSchema) {
|
|
546
|
-
mapSchema(originalWrappingSchema, {
|
|
547
|
-
[MapperKind.OBJECT_FIELD]: (fieldConfig, fieldName, typeName) => {
|
|
548
|
-
Object.entries(fieldConfig.args || {}).forEach(([argName]) => {
|
|
549
|
-
const newName = this.renamer(typeName, fieldName, argName);
|
|
550
|
-
if (newName !== undefined && newName !== fieldName) {
|
|
551
|
-
if (this.reverseMap[typeName] == null) {
|
|
552
|
-
this.reverseMap[typeName] = Object.create(null);
|
|
553
|
-
}
|
|
554
|
-
if (this.reverseMap[typeName][fieldName] == null) {
|
|
555
|
-
this.reverseMap[typeName][fieldName] = Object.create(null);
|
|
556
|
-
}
|
|
557
|
-
this.reverseMap[typeName][fieldName][newName] = argName;
|
|
558
|
-
}
|
|
559
|
-
});
|
|
560
|
-
return undefined;
|
|
561
|
-
},
|
|
562
|
-
[MapperKind.ROOT_OBJECT]() {
|
|
563
|
-
return undefined;
|
|
564
|
-
},
|
|
565
|
-
});
|
|
566
|
-
return this.transformer.transformSchema(originalWrappingSchema, subschemaConfig, transformedSchema);
|
|
567
|
-
}
|
|
568
|
-
transformRequest(originalRequest, delegationContext, transformationContext) {
|
|
569
|
-
return this.transformer.transformRequest(originalRequest, delegationContext, transformationContext);
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
|
|
573
506
|
class FilterObjectFields {
|
|
574
507
|
constructor(filter) {
|
|
575
508
|
this.transformer = new TransformObjectFields((typeName, fieldName, fieldConfig) => filter(typeName, fieldName, fieldConfig) ? undefined : null);
|
|
@@ -1775,4 +1708,4 @@ function introspectSchema(executor, context, options) {
|
|
|
1775
1708
|
.resolve();
|
|
1776
1709
|
}
|
|
1777
1710
|
|
|
1778
|
-
export { ExtractField, FilterInputObjectFields, FilterInterfaceFields, FilterObjectFieldDirectives, FilterObjectFields, FilterRootFields, FilterTypes, HoistField, MapFields, MapLeafValues, PruneTypes as PruneSchema, RemoveObjectFieldDeprecations, RemoveObjectFieldDirectives, RemoveObjectFieldsWithDeprecation, RemoveObjectFieldsWithDirective, RenameInputObjectFields, RenameInterfaceFields,
|
|
1711
|
+
export { ExtractField, FilterInputObjectFields, FilterInterfaceFields, FilterObjectFieldDirectives, FilterObjectFields, FilterRootFields, FilterTypes, HoistField, MapFields, MapLeafValues, PruneTypes as PruneSchema, RemoveObjectFieldDeprecations, RemoveObjectFieldDirectives, RemoveObjectFieldsWithDeprecation, RemoveObjectFieldsWithDirective, RenameInputObjectFields, RenameInterfaceFields, RenameObjectFields, RenameRootFields, RenameRootTypes, RenameTypes, TransformCompositeFields, TransformEnumValues, TransformInputObjectFields, TransformInterfaceFields, TransformObjectFields, TransformQuery, TransformRootFields, WrapFields, WrapQuery, WrapType, defaultCreateProxyingResolver, generateProxyingResolvers, introspectSchema, wrapSchema };
|
package/package.json
CHANGED
package/transforms/index.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ export { default as RenameRootFields } from './RenameRootFields';
|
|
|
7
7
|
export { default as FilterRootFields } from './FilterRootFields';
|
|
8
8
|
export { default as TransformObjectFields } from './TransformObjectFields';
|
|
9
9
|
export { default as RenameObjectFields } from './RenameObjectFields';
|
|
10
|
-
export { default as RenameObjectFieldArguments } from './RenameObjectFieldArguments';
|
|
11
10
|
export { default as FilterObjectFields } from './FilterObjectFields';
|
|
12
11
|
export { default as TransformInterfaceFields } from './TransformInterfaceFields';
|
|
13
12
|
export { default as RenameInterfaceFields } from './RenameInterfaceFields';
|