@graphql-tools/wrap 9.2.5-alpha-20221031104513-296096ea → 9.2.5
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.
|
@@ -5,6 +5,7 @@ const utils_1 = require("@graphql-tools/utils");
|
|
|
5
5
|
const MapLeafValues_js_1 = tslib_1.__importDefault(require("./MapLeafValues.js"));
|
|
6
6
|
class TransformEnumValues {
|
|
7
7
|
constructor(enumValueTransformer, inputValueTransformer, outputValueTransformer) {
|
|
8
|
+
this.noTransformation = true;
|
|
8
9
|
this.enumValueTransformer = enumValueTransformer;
|
|
9
10
|
this.mapping = Object.create(null);
|
|
10
11
|
this.reverseMapping = Object.create(null);
|
|
@@ -18,9 +19,15 @@ class TransformEnumValues {
|
|
|
18
19
|
return this.transformedSchema;
|
|
19
20
|
}
|
|
20
21
|
transformRequest(originalRequest, delegationContext, transformationContext) {
|
|
22
|
+
if (this.noTransformation) {
|
|
23
|
+
return originalRequest;
|
|
24
|
+
}
|
|
21
25
|
return this.transformer.transformRequest(originalRequest, delegationContext, transformationContext);
|
|
22
26
|
}
|
|
23
27
|
transformResult(originalResult, delegationContext, transformationContext) {
|
|
28
|
+
if (this.noTransformation) {
|
|
29
|
+
return originalResult;
|
|
30
|
+
}
|
|
24
31
|
return this.transformer.transformResult(originalResult, delegationContext, transformationContext);
|
|
25
32
|
}
|
|
26
33
|
transformEnumValue(typeName, externalValue, enumValueConfig) {
|
|
@@ -34,6 +41,7 @@ class TransformEnumValues {
|
|
|
34
41
|
}
|
|
35
42
|
this.mapping[typeName][externalValue] = newExternalValue;
|
|
36
43
|
this.reverseMapping[typeName][newExternalValue] = externalValue;
|
|
44
|
+
this.noTransformation = false;
|
|
37
45
|
}
|
|
38
46
|
}
|
|
39
47
|
return transformedEnumValue;
|
|
@@ -2,6 +2,7 @@ import { MapperKind, mapSchema } from '@graphql-tools/utils';
|
|
|
2
2
|
import MapLeafValues from './MapLeafValues.js';
|
|
3
3
|
export default class TransformEnumValues {
|
|
4
4
|
constructor(enumValueTransformer, inputValueTransformer, outputValueTransformer) {
|
|
5
|
+
this.noTransformation = true;
|
|
5
6
|
this.enumValueTransformer = enumValueTransformer;
|
|
6
7
|
this.mapping = Object.create(null);
|
|
7
8
|
this.reverseMapping = Object.create(null);
|
|
@@ -15,9 +16,15 @@ export default class TransformEnumValues {
|
|
|
15
16
|
return this.transformedSchema;
|
|
16
17
|
}
|
|
17
18
|
transformRequest(originalRequest, delegationContext, transformationContext) {
|
|
19
|
+
if (this.noTransformation) {
|
|
20
|
+
return originalRequest;
|
|
21
|
+
}
|
|
18
22
|
return this.transformer.transformRequest(originalRequest, delegationContext, transformationContext);
|
|
19
23
|
}
|
|
20
24
|
transformResult(originalResult, delegationContext, transformationContext) {
|
|
25
|
+
if (this.noTransformation) {
|
|
26
|
+
return originalResult;
|
|
27
|
+
}
|
|
21
28
|
return this.transformer.transformResult(originalResult, delegationContext, transformationContext);
|
|
22
29
|
}
|
|
23
30
|
transformEnumValue(typeName, externalValue, enumValueConfig) {
|
|
@@ -31,6 +38,7 @@ export default class TransformEnumValues {
|
|
|
31
38
|
}
|
|
32
39
|
this.mapping[typeName][externalValue] = newExternalValue;
|
|
33
40
|
this.reverseMapping[typeName][newExternalValue] = externalValue;
|
|
41
|
+
this.noTransformation = false;
|
|
34
42
|
}
|
|
35
43
|
}
|
|
36
44
|
return transformedEnumValue;
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/wrap",
|
|
3
|
-
"version": "9.2.5
|
|
3
|
+
"version": "9.2.5",
|
|
4
4
|
"description": "A set of utils for faster development of GraphQL tools",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"peerDependencies": {
|
|
7
7
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@graphql-tools/delegate": "9.0.10
|
|
11
|
-
"@graphql-tools/schema": "9.0.6
|
|
12
|
-
"@graphql-tools/utils": "8.13.1
|
|
10
|
+
"@graphql-tools/delegate": "9.0.10",
|
|
11
|
+
"@graphql-tools/schema": "9.0.6",
|
|
12
|
+
"@graphql-tools/utils": "8.13.1",
|
|
13
13
|
"tslib": "^2.4.0",
|
|
14
14
|
"value-or-promise": "1.0.11"
|
|
15
15
|
},
|
|
@@ -11,6 +11,7 @@ export default class TransformEnumValues<TContext = Record<string, any>> impleme
|
|
|
11
11
|
private transformedSchema;
|
|
12
12
|
private mapping;
|
|
13
13
|
private reverseMapping;
|
|
14
|
+
private noTransformation;
|
|
14
15
|
constructor(enumValueTransformer: EnumValueTransformer, inputValueTransformer?: LeafValueTransformer, outputValueTransformer?: LeafValueTransformer);
|
|
15
16
|
transformSchema(originalWrappingSchema: GraphQLSchema, subschemaConfig: SubschemaConfig<any, any, any, TContext>): GraphQLSchema;
|
|
16
17
|
transformRequest(originalRequest: ExecutionRequest, delegationContext: DelegationContext<TContext>, transformationContext: TransformEnumValuesTransformationContext): ExecutionRequest;
|
|
@@ -11,6 +11,7 @@ export default class TransformEnumValues<TContext = Record<string, any>> impleme
|
|
|
11
11
|
private transformedSchema;
|
|
12
12
|
private mapping;
|
|
13
13
|
private reverseMapping;
|
|
14
|
+
private noTransformation;
|
|
14
15
|
constructor(enumValueTransformer: EnumValueTransformer, inputValueTransformer?: LeafValueTransformer, outputValueTransformer?: LeafValueTransformer);
|
|
15
16
|
transformSchema(originalWrappingSchema: GraphQLSchema, subschemaConfig: SubschemaConfig<any, any, any, TContext>): GraphQLSchema;
|
|
16
17
|
transformRequest(originalRequest: ExecutionRequest, delegationContext: DelegationContext<TContext>, transformationContext: TransformEnumValuesTransformationContext): ExecutionRequest;
|