@graphql-mesh/merger-bare 1.0.0-alpha-20220804093904-8e2e41f7f → 1.0.0-alpha-20230420220344-25b6b92bf
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/cjs/index.js +91 -0
- package/cjs/package.json +1 -0
- package/{index.mjs → esm/index.js} +17 -41
- package/package.json +26 -19
- package/typings/index.d.cts +25 -0
- package/{index.d.ts → typings/index.d.ts} +7 -5
- package/index.js +0 -113
package/cjs/index.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const graphql_1 = require("graphql");
|
|
5
|
+
const merger_stitching_1 = tslib_1.__importDefault(require("@graphql-mesh/merger-stitching"));
|
|
6
|
+
const utils_1 = require("@graphql-mesh/utils");
|
|
7
|
+
const schema_1 = require("@graphql-tools/schema");
|
|
8
|
+
const utils_2 = require("@graphql-tools/utils");
|
|
9
|
+
class BareMerger {
|
|
10
|
+
constructor(options) {
|
|
11
|
+
this.options = options;
|
|
12
|
+
this.name = 'bare';
|
|
13
|
+
}
|
|
14
|
+
handleSingleWrappedExtendedSource(mergerCtx) {
|
|
15
|
+
// switch to stitching merger
|
|
16
|
+
this.name = 'stitching';
|
|
17
|
+
this.options.logger.debug(`Switching to Stitching merger due to the transforms and additional resolvers`);
|
|
18
|
+
this.options.logger = this.options.logger.child('Stitching Proxy');
|
|
19
|
+
this.stitchingMerger = this.stitchingMerger || new merger_stitching_1.default(this.options);
|
|
20
|
+
return this.stitchingMerger.getUnifiedSchema(mergerCtx);
|
|
21
|
+
}
|
|
22
|
+
handleSingleRegularSource({ rawSources: [rawSource], typeDefs, resolvers }) {
|
|
23
|
+
let schema = rawSource.schema;
|
|
24
|
+
if (typeDefs.length > 0 || (0, utils_2.asArray)(resolvers).length > 0) {
|
|
25
|
+
for (const typeDef of typeDefs) {
|
|
26
|
+
schema = (0, graphql_1.extendSchema)(schema, typeDef);
|
|
27
|
+
}
|
|
28
|
+
for (const resolversObj of (0, utils_2.asArray)(resolvers)) {
|
|
29
|
+
(0, schema_1.addResolversToSchema)({
|
|
30
|
+
schema,
|
|
31
|
+
resolvers: resolversObj,
|
|
32
|
+
updateResolversInPlace: true,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
this.options.logger.debug(`Attaching a dummy sourceMap to the final schema`);
|
|
37
|
+
schema.extensions = schema.extensions || {};
|
|
38
|
+
Object.defineProperty(schema.extensions, 'sourceMap', {
|
|
39
|
+
get: () => {
|
|
40
|
+
return {
|
|
41
|
+
get() {
|
|
42
|
+
// We should return a version of the schema only with the source-level transforms
|
|
43
|
+
// But we should prevent the existing schema from being mutated internally
|
|
44
|
+
const nonExecutableSchema = (0, utils_2.mapSchema)(schema);
|
|
45
|
+
return (0, utils_1.applySchemaTransforms)(nonExecutableSchema, rawSource, nonExecutableSchema, rawSource.transforms);
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
...rawSource,
|
|
52
|
+
schema,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
async getUnifiedSchema({ rawSources, typeDefs, resolvers }) {
|
|
56
|
+
var _a;
|
|
57
|
+
if (rawSources.length === 1) {
|
|
58
|
+
if ((rawSources[0].executor || ((_a = rawSources[0].transforms) === null || _a === void 0 ? void 0 : _a.length)) &&
|
|
59
|
+
(typeDefs.length > 0 || (0, utils_2.asArray)(resolvers).length > 0)) {
|
|
60
|
+
return this.handleSingleWrappedExtendedSource({ rawSources, typeDefs, resolvers });
|
|
61
|
+
}
|
|
62
|
+
return this.handleSingleRegularSource({ rawSources, typeDefs, resolvers });
|
|
63
|
+
}
|
|
64
|
+
const sourceMap = new Map();
|
|
65
|
+
this.options.logger.debug(`Applying transforms for each source`);
|
|
66
|
+
const schemas = rawSources.map(source => {
|
|
67
|
+
let schema = source.schema;
|
|
68
|
+
let sourceLevelSchema = source.schema;
|
|
69
|
+
schema = (0, utils_1.applySchemaTransforms)(schema, undefined, schema, source.transforms);
|
|
70
|
+
// After that step, it will be considered as root level schema
|
|
71
|
+
sourceLevelSchema = schema;
|
|
72
|
+
sourceMap.set(source, sourceLevelSchema);
|
|
73
|
+
return schema;
|
|
74
|
+
});
|
|
75
|
+
this.options.logger.debug(`Merging sources`);
|
|
76
|
+
const unifiedSchema = (0, schema_1.mergeSchemas)({
|
|
77
|
+
schemas,
|
|
78
|
+
typeDefs,
|
|
79
|
+
resolvers,
|
|
80
|
+
});
|
|
81
|
+
this.options.logger.debug(`Attaching sources to the unified schema`);
|
|
82
|
+
unifiedSchema.extensions = unifiedSchema.extensions || {};
|
|
83
|
+
Object.defineProperty(unifiedSchema.extensions, 'sourceMap', {
|
|
84
|
+
get: () => sourceMap,
|
|
85
|
+
});
|
|
86
|
+
return {
|
|
87
|
+
schema: unifiedSchema,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
exports.default = BareMerger;
|
package/cjs/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -1,42 +1,20 @@
|
|
|
1
|
+
import { extendSchema } from 'graphql';
|
|
2
|
+
import StitchingMerger from '@graphql-mesh/merger-stitching';
|
|
1
3
|
import { applySchemaTransforms } from '@graphql-mesh/utils';
|
|
2
4
|
import { addResolversToSchema, mergeSchemas } from '@graphql-tools/schema';
|
|
3
|
-
import { asArray,
|
|
4
|
-
|
|
5
|
-
import { extendSchema, buildASTSchema } from 'graphql';
|
|
6
|
-
|
|
7
|
-
class BareMerger {
|
|
5
|
+
import { asArray, mapSchema } from '@graphql-tools/utils';
|
|
6
|
+
export default class BareMerger {
|
|
8
7
|
constructor(options) {
|
|
8
|
+
this.options = options;
|
|
9
9
|
this.name = 'bare';
|
|
10
|
-
this.logger = options.logger;
|
|
11
10
|
}
|
|
12
|
-
handleSingleWrappedExtendedSource(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
addResolversToSchema({
|
|
20
|
-
schema,
|
|
21
|
-
resolvers: resolversObj,
|
|
22
|
-
updateResolversInPlace: true,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
this.logger.debug(`Attaching a dummy sourceMap to the final schema`);
|
|
27
|
-
schema.extensions = schema.extensions || {};
|
|
28
|
-
Object.defineProperty(schema.extensions, 'sourceMap', {
|
|
29
|
-
get: () => {
|
|
30
|
-
return {
|
|
31
|
-
get() {
|
|
32
|
-
return schema;
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
return {
|
|
38
|
-
schema,
|
|
39
|
-
};
|
|
11
|
+
handleSingleWrappedExtendedSource(mergerCtx) {
|
|
12
|
+
// switch to stitching merger
|
|
13
|
+
this.name = 'stitching';
|
|
14
|
+
this.options.logger.debug(`Switching to Stitching merger due to the transforms and additional resolvers`);
|
|
15
|
+
this.options.logger = this.options.logger.child('Stitching Proxy');
|
|
16
|
+
this.stitchingMerger = this.stitchingMerger || new StitchingMerger(this.options);
|
|
17
|
+
return this.stitchingMerger.getUnifiedSchema(mergerCtx);
|
|
40
18
|
}
|
|
41
19
|
handleSingleRegularSource({ rawSources: [rawSource], typeDefs, resolvers }) {
|
|
42
20
|
let schema = rawSource.schema;
|
|
@@ -52,7 +30,7 @@ class BareMerger {
|
|
|
52
30
|
});
|
|
53
31
|
}
|
|
54
32
|
}
|
|
55
|
-
this.logger.debug(`Attaching a dummy sourceMap to the final schema`);
|
|
33
|
+
this.options.logger.debug(`Attaching a dummy sourceMap to the final schema`);
|
|
56
34
|
schema.extensions = schema.extensions || {};
|
|
57
35
|
Object.defineProperty(schema.extensions, 'sourceMap', {
|
|
58
36
|
get: () => {
|
|
@@ -60,7 +38,7 @@ class BareMerger {
|
|
|
60
38
|
get() {
|
|
61
39
|
// We should return a version of the schema only with the source-level transforms
|
|
62
40
|
// But we should prevent the existing schema from being mutated internally
|
|
63
|
-
const nonExecutableSchema =
|
|
41
|
+
const nonExecutableSchema = mapSchema(schema);
|
|
64
42
|
return applySchemaTransforms(nonExecutableSchema, rawSource, nonExecutableSchema, rawSource.transforms);
|
|
65
43
|
},
|
|
66
44
|
};
|
|
@@ -81,7 +59,7 @@ class BareMerger {
|
|
|
81
59
|
return this.handleSingleRegularSource({ rawSources, typeDefs, resolvers });
|
|
82
60
|
}
|
|
83
61
|
const sourceMap = new Map();
|
|
84
|
-
this.logger.debug(`Applying transforms for each source`);
|
|
62
|
+
this.options.logger.debug(`Applying transforms for each source`);
|
|
85
63
|
const schemas = rawSources.map(source => {
|
|
86
64
|
let schema = source.schema;
|
|
87
65
|
let sourceLevelSchema = source.schema;
|
|
@@ -91,13 +69,13 @@ class BareMerger {
|
|
|
91
69
|
sourceMap.set(source, sourceLevelSchema);
|
|
92
70
|
return schema;
|
|
93
71
|
});
|
|
94
|
-
this.logger.debug(`Merging sources`);
|
|
72
|
+
this.options.logger.debug(`Merging sources`);
|
|
95
73
|
const unifiedSchema = mergeSchemas({
|
|
96
74
|
schemas,
|
|
97
75
|
typeDefs,
|
|
98
76
|
resolvers,
|
|
99
77
|
});
|
|
100
|
-
this.logger.debug(`Attaching sources to the unified schema`);
|
|
78
|
+
this.options.logger.debug(`Attaching sources to the unified schema`);
|
|
101
79
|
unifiedSchema.extensions = unifiedSchema.extensions || {};
|
|
102
80
|
Object.defineProperty(unifiedSchema.extensions, 'sourceMap', {
|
|
103
81
|
get: () => sourceMap,
|
|
@@ -107,5 +85,3 @@ class BareMerger {
|
|
|
107
85
|
};
|
|
108
86
|
}
|
|
109
87
|
}
|
|
110
|
-
|
|
111
|
-
export default BareMerger;
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-mesh/merger-bare",
|
|
3
|
-
"version": "1.0.0-alpha-
|
|
3
|
+
"version": "1.0.0-alpha-20230420220344-25b6b92bf",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@graphql-mesh/types": "0.
|
|
7
|
-
"@graphql-mesh/utils": "1.0.0-alpha-
|
|
8
|
-
"graphql": "
|
|
6
|
+
"@graphql-mesh/types": "1.0.0-alpha-20230420220344-25b6b92bf",
|
|
7
|
+
"@graphql-mesh/utils": "1.0.0-alpha-20230420220344-25b6b92bf",
|
|
8
|
+
"@graphql-tools/utils": "^9.2.1",
|
|
9
|
+
"graphql": "*",
|
|
10
|
+
"tslib": "^2.4.0"
|
|
9
11
|
},
|
|
10
12
|
"dependencies": {
|
|
11
|
-
"@graphql-
|
|
12
|
-
"@graphql-tools/
|
|
13
|
-
"@graphql-tools/wrap": "8.5.1",
|
|
14
|
-
"tslib": "^2.4.0"
|
|
13
|
+
"@graphql-mesh/merger-stitching": "1.0.0-alpha-20230420220344-25b6b92bf",
|
|
14
|
+
"@graphql-tools/schema": "9.0.18"
|
|
15
15
|
},
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
@@ -19,21 +19,28 @@
|
|
|
19
19
|
"directory": "packages/mergers/bare"
|
|
20
20
|
},
|
|
21
21
|
"license": "MIT",
|
|
22
|
-
"main": "index.js",
|
|
23
|
-
"module": "index.
|
|
24
|
-
"typings": "index.d.ts",
|
|
22
|
+
"main": "cjs/index.js",
|
|
23
|
+
"module": "esm/index.js",
|
|
24
|
+
"typings": "typings/index.d.ts",
|
|
25
25
|
"typescript": {
|
|
26
|
-
"definition": "index.d.ts"
|
|
26
|
+
"definition": "typings/index.d.ts"
|
|
27
27
|
},
|
|
28
|
+
"type": "module",
|
|
28
29
|
"exports": {
|
|
29
30
|
".": {
|
|
30
|
-
"require":
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
31
|
+
"require": {
|
|
32
|
+
"types": "./typings/index.d.cts",
|
|
33
|
+
"default": "./cjs/index.js"
|
|
34
|
+
},
|
|
35
|
+
"import": {
|
|
36
|
+
"types": "./typings/index.d.ts",
|
|
37
|
+
"default": "./esm/index.js"
|
|
38
|
+
},
|
|
39
|
+
"default": {
|
|
40
|
+
"types": "./typings/index.d.ts",
|
|
41
|
+
"default": "./esm/index.js"
|
|
42
|
+
}
|
|
36
43
|
},
|
|
37
44
|
"./package.json": "./package.json"
|
|
38
45
|
}
|
|
39
|
-
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { GraphQLSchema } from 'graphql';
|
|
2
|
+
import { MeshMerger, MeshMergerContext, MeshMergerOptions } from '@graphql-mesh/types';
|
|
3
|
+
export default class BareMerger implements MeshMerger {
|
|
4
|
+
private options;
|
|
5
|
+
name: string;
|
|
6
|
+
private stitchingMerger;
|
|
7
|
+
constructor(options: MeshMergerOptions);
|
|
8
|
+
handleSingleWrappedExtendedSource(mergerCtx: MeshMergerContext): Promise<{
|
|
9
|
+
schema: GraphQLSchema;
|
|
10
|
+
}>;
|
|
11
|
+
handleSingleRegularSource({ rawSources: [rawSource], typeDefs, resolvers }: MeshMergerContext): {
|
|
12
|
+
schema: GraphQLSchema;
|
|
13
|
+
name: string;
|
|
14
|
+
executor?: import("@graphql-tools/utils").Executor;
|
|
15
|
+
transforms: import("@graphql-mesh/types").MeshTransform<any>[];
|
|
16
|
+
contextVariables: Record<string, string>;
|
|
17
|
+
handler: import("@graphql-mesh/types").MeshHandler;
|
|
18
|
+
batch: boolean;
|
|
19
|
+
merge?: Record<string, import("@graphql-tools/delegate").MergedTypeConfig<any, any, Record<string, any>>>;
|
|
20
|
+
createProxyingResolver: import("@graphql-tools/delegate").CreateProxyingResolverFn<any>;
|
|
21
|
+
};
|
|
22
|
+
getUnifiedSchema({ rawSources, typeDefs, resolvers }: MeshMergerContext): Promise<{
|
|
23
|
+
schema: GraphQLSchema;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import { MeshMerger, MeshMergerContext, MeshMergerOptions } from '@graphql-mesh/types';
|
|
2
1
|
import { GraphQLSchema } from 'graphql';
|
|
2
|
+
import { MeshMerger, MeshMergerContext, MeshMergerOptions } from '@graphql-mesh/types';
|
|
3
3
|
export default class BareMerger implements MeshMerger {
|
|
4
|
+
private options;
|
|
4
5
|
name: string;
|
|
5
|
-
private
|
|
6
|
+
private stitchingMerger;
|
|
6
7
|
constructor(options: MeshMergerOptions);
|
|
7
|
-
handleSingleWrappedExtendedSource(
|
|
8
|
+
handleSingleWrappedExtendedSource(mergerCtx: MeshMergerContext): Promise<{
|
|
8
9
|
schema: GraphQLSchema;
|
|
9
|
-
}
|
|
10
|
+
}>;
|
|
10
11
|
handleSingleRegularSource({ rawSources: [rawSource], typeDefs, resolvers }: MeshMergerContext): {
|
|
11
12
|
schema: GraphQLSchema;
|
|
12
13
|
name: string;
|
|
13
|
-
executor?: import("@graphql-tools/utils").Executor
|
|
14
|
+
executor?: import("@graphql-tools/utils").Executor;
|
|
14
15
|
transforms: import("@graphql-mesh/types").MeshTransform<any>[];
|
|
15
16
|
contextVariables: Record<string, string>;
|
|
16
17
|
handler: import("@graphql-mesh/types").MeshHandler;
|
|
17
18
|
batch: boolean;
|
|
18
19
|
merge?: Record<string, import("@graphql-tools/delegate").MergedTypeConfig<any, any, Record<string, any>>>;
|
|
20
|
+
createProxyingResolver: import("@graphql-tools/delegate").CreateProxyingResolverFn<any>;
|
|
19
21
|
};
|
|
20
22
|
getUnifiedSchema({ rawSources, typeDefs, resolvers }: MeshMergerContext): Promise<{
|
|
21
23
|
schema: GraphQLSchema;
|
package/index.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const utils = require('@graphql-mesh/utils');
|
|
4
|
-
const schema = require('@graphql-tools/schema');
|
|
5
|
-
const utils$1 = require('@graphql-tools/utils');
|
|
6
|
-
const wrap = require('@graphql-tools/wrap');
|
|
7
|
-
const graphql = require('graphql');
|
|
8
|
-
|
|
9
|
-
class BareMerger {
|
|
10
|
-
constructor(options) {
|
|
11
|
-
this.name = 'bare';
|
|
12
|
-
this.logger = options.logger;
|
|
13
|
-
}
|
|
14
|
-
handleSingleWrappedExtendedSource({ rawSources: [rawSource], typeDefs, resolvers }) {
|
|
15
|
-
let schema$1 = wrap.wrapSchema(rawSource);
|
|
16
|
-
if (typeDefs.length > 0 || utils$1.asArray(resolvers).length > 0) {
|
|
17
|
-
for (const typeDef of typeDefs) {
|
|
18
|
-
schema$1 = graphql.extendSchema(schema$1, typeDef);
|
|
19
|
-
}
|
|
20
|
-
for (const resolversObj of utils$1.asArray(resolvers)) {
|
|
21
|
-
schema.addResolversToSchema({
|
|
22
|
-
schema: schema$1,
|
|
23
|
-
resolvers: resolversObj,
|
|
24
|
-
updateResolversInPlace: true,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
this.logger.debug(`Attaching a dummy sourceMap to the final schema`);
|
|
29
|
-
schema$1.extensions = schema$1.extensions || {};
|
|
30
|
-
Object.defineProperty(schema$1.extensions, 'sourceMap', {
|
|
31
|
-
get: () => {
|
|
32
|
-
return {
|
|
33
|
-
get() {
|
|
34
|
-
return schema$1;
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
return {
|
|
40
|
-
schema: schema$1,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
handleSingleRegularSource({ rawSources: [rawSource], typeDefs, resolvers }) {
|
|
44
|
-
let schema$1 = rawSource.schema;
|
|
45
|
-
if (typeDefs.length > 0 || utils$1.asArray(resolvers).length > 0) {
|
|
46
|
-
for (const typeDef of typeDefs) {
|
|
47
|
-
schema$1 = graphql.extendSchema(schema$1, typeDef);
|
|
48
|
-
}
|
|
49
|
-
for (const resolversObj of utils$1.asArray(resolvers)) {
|
|
50
|
-
schema.addResolversToSchema({
|
|
51
|
-
schema: schema$1,
|
|
52
|
-
resolvers: resolversObj,
|
|
53
|
-
updateResolversInPlace: true,
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
this.logger.debug(`Attaching a dummy sourceMap to the final schema`);
|
|
58
|
-
schema$1.extensions = schema$1.extensions || {};
|
|
59
|
-
Object.defineProperty(schema$1.extensions, 'sourceMap', {
|
|
60
|
-
get: () => {
|
|
61
|
-
return {
|
|
62
|
-
get() {
|
|
63
|
-
// We should return a version of the schema only with the source-level transforms
|
|
64
|
-
// But we should prevent the existing schema from being mutated internally
|
|
65
|
-
const nonExecutableSchema = graphql.buildASTSchema(utils$1.getDocumentNodeFromSchema(schema$1));
|
|
66
|
-
return utils.applySchemaTransforms(nonExecutableSchema, rawSource, nonExecutableSchema, rawSource.transforms);
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
return {
|
|
72
|
-
...rawSource,
|
|
73
|
-
schema: schema$1,
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
async getUnifiedSchema({ rawSources, typeDefs, resolvers }) {
|
|
77
|
-
var _a;
|
|
78
|
-
if (rawSources.length === 1) {
|
|
79
|
-
if ((rawSources[0].executor || ((_a = rawSources[0].transforms) === null || _a === void 0 ? void 0 : _a.length)) &&
|
|
80
|
-
(typeDefs.length > 0 || utils$1.asArray(resolvers).length > 0)) {
|
|
81
|
-
return this.handleSingleWrappedExtendedSource({ rawSources, typeDefs, resolvers });
|
|
82
|
-
}
|
|
83
|
-
return this.handleSingleRegularSource({ rawSources, typeDefs, resolvers });
|
|
84
|
-
}
|
|
85
|
-
const sourceMap = new Map();
|
|
86
|
-
this.logger.debug(`Applying transforms for each source`);
|
|
87
|
-
const schemas = rawSources.map(source => {
|
|
88
|
-
let schema = source.schema;
|
|
89
|
-
let sourceLevelSchema = source.schema;
|
|
90
|
-
schema = utils.applySchemaTransforms(schema, undefined, schema, source.transforms);
|
|
91
|
-
// After that step, it will be considered as root level schema
|
|
92
|
-
sourceLevelSchema = schema;
|
|
93
|
-
sourceMap.set(source, sourceLevelSchema);
|
|
94
|
-
return schema;
|
|
95
|
-
});
|
|
96
|
-
this.logger.debug(`Merging sources`);
|
|
97
|
-
const unifiedSchema = schema.mergeSchemas({
|
|
98
|
-
schemas,
|
|
99
|
-
typeDefs,
|
|
100
|
-
resolvers,
|
|
101
|
-
});
|
|
102
|
-
this.logger.debug(`Attaching sources to the unified schema`);
|
|
103
|
-
unifiedSchema.extensions = unifiedSchema.extensions || {};
|
|
104
|
-
Object.defineProperty(unifiedSchema.extensions, 'sourceMap', {
|
|
105
|
-
get: () => sourceMap,
|
|
106
|
-
});
|
|
107
|
-
return {
|
|
108
|
-
schema: unifiedSchema,
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
module.exports = BareMerger;
|