@graphql-mesh/transform-hoist-field 1.0.0-alpha-3fc47d119.0 → 1.0.0-alpha-20230420181317-a95037648
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 → cjs/index.js} +9 -11
- package/cjs/package.json +1 -0
- package/{index.mjs → esm/index.js} +2 -5
- package/package.json +24 -17
- package/typings/index.d.cts +13 -0
- package/{index.d.ts → typings/index.d.ts} +3 -3
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("@graphql-mesh/utils");
|
|
4
|
+
const wrap_1 = require("@graphql-tools/wrap");
|
|
6
5
|
class MeshHoistField {
|
|
7
6
|
constructor({ config }) {
|
|
8
7
|
this.noWrap = false;
|
|
9
8
|
this.transforms = config.map(({ typeName, pathConfig, newFieldName, alias, filterArgsInPath = false }) => {
|
|
10
9
|
const processedPathConfig = pathConfig.map(config => this.getPathConfigItem(config, filterArgsInPath));
|
|
11
|
-
return new
|
|
10
|
+
return new wrap_1.HoistField(typeName, processedPathConfig, newFieldName, alias);
|
|
12
11
|
});
|
|
13
12
|
}
|
|
14
13
|
getPathConfigItem(pathConfigItemFromConfig, filterArgsInPath) {
|
|
@@ -38,19 +37,18 @@ class MeshHoistField {
|
|
|
38
37
|
return pathConfigItem;
|
|
39
38
|
}
|
|
40
39
|
transformSchema(originalWrappingSchema, subschemaConfig, transformedSchema) {
|
|
41
|
-
return
|
|
40
|
+
return (0, utils_1.applySchemaTransforms)(originalWrappingSchema, subschemaConfig, transformedSchema, this.transforms);
|
|
42
41
|
}
|
|
43
42
|
transformRequest(originalRequest, delegationContext, transformationContext) {
|
|
44
|
-
return
|
|
43
|
+
return (0, utils_1.applyRequestTransforms)(originalRequest, delegationContext, transformationContext, this.transforms);
|
|
45
44
|
}
|
|
46
45
|
transformResult(originalResult, delegationContext, transformationContext) {
|
|
47
|
-
return
|
|
46
|
+
return (0, utils_1.applyResultTransforms)(originalResult, delegationContext, transformationContext, this.transforms);
|
|
48
47
|
}
|
|
49
48
|
}
|
|
49
|
+
exports.default = MeshHoistField;
|
|
50
50
|
// The argFilters in HoistField seem to work more like argIncludes, hence the value needs to be negated
|
|
51
51
|
// https://github.com/ardatan/graphql-tools/blob/af266974bf02967e0675187e9bea0391fd7fe0cf/packages/wrap/src/transforms/HoistField.ts#L44
|
|
52
52
|
function filterArgsValue(filter) {
|
|
53
53
|
return !filter;
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
module.exports = MeshHoistField;
|
package/cjs/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { applyRequestTransforms, applyResultTransforms, applySchemaTransforms, } from '@graphql-mesh/utils';
|
|
2
2
|
import { HoistField } from '@graphql-tools/wrap';
|
|
3
|
-
|
|
4
|
-
class MeshHoistField {
|
|
3
|
+
export default class MeshHoistField {
|
|
5
4
|
constructor({ config }) {
|
|
6
5
|
this.noWrap = false;
|
|
7
6
|
this.transforms = config.map(({ typeName, pathConfig, newFieldName, alias, filterArgsInPath = false }) => {
|
|
@@ -50,5 +49,3 @@ class MeshHoistField {
|
|
|
50
49
|
function filterArgsValue(filter) {
|
|
51
50
|
return !filter;
|
|
52
51
|
}
|
|
53
|
-
|
|
54
|
-
export default MeshHoistField;
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-mesh/transform-hoist-field",
|
|
3
|
-
"version": "1.0.0-alpha-
|
|
3
|
+
"version": "1.0.0-alpha-20230420181317-a95037648",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@graphql-mesh/types": "0.
|
|
7
|
-
"@graphql-mesh/utils": "1.0.0-alpha-
|
|
6
|
+
"@graphql-mesh/types": "1.0.0-alpha-20230420181317-a95037648",
|
|
7
|
+
"@graphql-mesh/utils": "1.0.0-alpha-20230420181317-a95037648",
|
|
8
|
+
"@graphql-tools/utils": "^9.2.1",
|
|
8
9
|
"graphql": "*"
|
|
9
10
|
},
|
|
10
11
|
"dependencies": {
|
|
11
|
-
"@graphql-tools/delegate": "
|
|
12
|
-
"@graphql-tools/
|
|
13
|
-
"@graphql-tools/wrap": "8.5.0"
|
|
12
|
+
"@graphql-tools/delegate": "9.0.32",
|
|
13
|
+
"@graphql-tools/wrap": "9.4.2"
|
|
14
14
|
},
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
@@ -18,21 +18,28 @@
|
|
|
18
18
|
"directory": "packages/transforms/hoist-field"
|
|
19
19
|
},
|
|
20
20
|
"license": "MIT",
|
|
21
|
-
"main": "index.js",
|
|
22
|
-
"module": "index.
|
|
23
|
-
"typings": "index.d.ts",
|
|
21
|
+
"main": "cjs/index.js",
|
|
22
|
+
"module": "esm/index.js",
|
|
23
|
+
"typings": "typings/index.d.ts",
|
|
24
24
|
"typescript": {
|
|
25
|
-
"definition": "index.d.ts"
|
|
25
|
+
"definition": "typings/index.d.ts"
|
|
26
26
|
},
|
|
27
|
+
"type": "module",
|
|
27
28
|
"exports": {
|
|
28
29
|
".": {
|
|
29
|
-
"require":
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
|
|
30
|
+
"require": {
|
|
31
|
+
"types": "./typings/index.d.cts",
|
|
32
|
+
"default": "./cjs/index.js"
|
|
33
|
+
},
|
|
34
|
+
"import": {
|
|
35
|
+
"types": "./typings/index.d.ts",
|
|
36
|
+
"default": "./esm/index.js"
|
|
37
|
+
},
|
|
38
|
+
"default": {
|
|
39
|
+
"types": "./typings/index.d.ts",
|
|
40
|
+
"default": "./esm/index.js"
|
|
41
|
+
}
|
|
35
42
|
},
|
|
36
43
|
"./package.json": "./package.json"
|
|
37
44
|
}
|
|
38
|
-
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GraphQLSchema } from 'graphql';
|
|
2
|
+
import { MeshTransform, MeshTransformOptions, YamlConfig } from '@graphql-mesh/types';
|
|
3
|
+
import { DelegationContext, SubschemaConfig } from '@graphql-tools/delegate';
|
|
4
|
+
import { ExecutionRequest, ExecutionResult } from '@graphql-tools/utils';
|
|
5
|
+
export default class MeshHoistField implements MeshTransform {
|
|
6
|
+
noWrap: boolean;
|
|
7
|
+
private transforms;
|
|
8
|
+
constructor({ config }: MeshTransformOptions<YamlConfig.HoistFieldTransformConfig[]>);
|
|
9
|
+
private getPathConfigItem;
|
|
10
|
+
transformSchema(originalWrappingSchema: GraphQLSchema, subschemaConfig: SubschemaConfig, transformedSchema?: GraphQLSchema): GraphQLSchema;
|
|
11
|
+
transformRequest(originalRequest: ExecutionRequest, delegationContext: DelegationContext, transformationContext: Record<string, any>): ExecutionRequest<any, any, any, Record<string, any>, any>;
|
|
12
|
+
transformResult(originalResult: ExecutionResult, delegationContext: DelegationContext, transformationContext: any): ExecutionResult<any, any>;
|
|
13
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { GraphQLSchema } from 'graphql';
|
|
1
2
|
import { MeshTransform, MeshTransformOptions, YamlConfig } from '@graphql-mesh/types';
|
|
2
3
|
import { DelegationContext, SubschemaConfig } from '@graphql-tools/delegate';
|
|
3
4
|
import { ExecutionRequest, ExecutionResult } from '@graphql-tools/utils';
|
|
4
|
-
import { GraphQLSchema } from 'graphql';
|
|
5
5
|
export default class MeshHoistField implements MeshTransform {
|
|
6
6
|
noWrap: boolean;
|
|
7
7
|
private transforms;
|
|
8
8
|
constructor({ config }: MeshTransformOptions<YamlConfig.HoistFieldTransformConfig[]>);
|
|
9
9
|
private getPathConfigItem;
|
|
10
10
|
transformSchema(originalWrappingSchema: GraphQLSchema, subschemaConfig: SubschemaConfig, transformedSchema?: GraphQLSchema): GraphQLSchema;
|
|
11
|
-
transformRequest(originalRequest: ExecutionRequest, delegationContext: DelegationContext, transformationContext: Record<string, any>): ExecutionRequest<
|
|
12
|
-
transformResult(originalResult: ExecutionResult, delegationContext: DelegationContext, transformationContext: any): ExecutionResult<
|
|
11
|
+
transformRequest(originalRequest: ExecutionRequest, delegationContext: DelegationContext, transformationContext: Record<string, any>): ExecutionRequest<any, any, any, Record<string, any>, any>;
|
|
12
|
+
transformResult(originalResult: ExecutionResult, delegationContext: DelegationContext, transformationContext: any): ExecutionResult<any, any>;
|
|
13
13
|
}
|