@stepzen/transpiler 0.45.0-experimental.a6f5273 → 0.45.0-experimental.aa7017c
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/LICENSE +1 -1
- package/lib/actions/configure.js +8 -10
- package/lib/actions/configure.js.map +1 -1
- package/lib/actions/lint.js +13 -15
- package/lib/actions/lint.js.map +1 -1
- package/lib/actions/merge.d.ts +1 -1
- package/lib/actions/merge.d.ts.map +1 -1
- package/lib/actions/merge.js +44 -46
- package/lib/actions/merge.js.map +1 -1
- package/lib/actions/print.js +5 -7
- package/lib/actions/print.js.map +1 -1
- package/lib/actions/stitch.js +24 -26
- package/lib/actions/stitch.js.map +1 -1
- package/lib/actions/transpile.js +19 -21
- package/lib/actions/transpile.js.map +1 -1
- package/lib/actions/validate.js +14 -16
- package/lib/actions/validate.js.map +1 -1
- package/lib/index.d.ts +7 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -18
- package/lib/index.js.map +1 -1
- package/lib/mutations/config/envvars.js +3 -5
- package/lib/mutations/config/envvars.js.map +1 -1
- package/lib/mutations/config/index.js +3 -5
- package/lib/mutations/config/index.js.map +1 -1
- package/lib/utils/constants.js +6 -9
- package/lib/utils/constants.js.map +1 -1
- package/lib/utils/copy-workspace-content.js +10 -14
- package/lib/utils/copy-workspace-content.js.map +1 -1
- package/lib/utils/dedupe-query-and-mutation-types.js +9 -11
- package/lib/utils/dedupe-query-and-mutation-types.js.map +1 -1
- package/lib/utils/ensure-query-and-mutation-types.js +7 -9
- package/lib/utils/ensure-query-and-mutation-types.js.map +1 -1
- package/lib/utils/graphql-helpers.d.ts +1 -1
- package/lib/utils/graphql-helpers.d.ts.map +1 -1
- package/lib/utils/graphql-helpers.js +2 -6
- package/lib/utils/graphql-helpers.js.map +1 -1
- package/lib/utils/merge-helpers.js +48 -62
- package/lib/utils/merge-helpers.js.map +1 -1
- package/lib/utils/rmtemp.js +7 -11
- package/lib/utils/rmtemp.js.map +1 -1
- package/lib/utils/set-files-in-sdl.d.ts +2 -3
- package/lib/utils/set-files-in-sdl.d.ts.map +1 -1
- package/lib/utils/set-files-in-sdl.js +40 -43
- package/lib/utils/set-files-in-sdl.js.map +1 -1
- package/lib/utils/strip-empty-queries-and-mutations.js +8 -10
- package/lib/utils/strip-empty-queries-and-mutations.js.map +1 -1
- package/lib/validators/config-exists/index.js +10 -12
- package/lib/validators/config-exists/index.js.map +1 -1
- package/lib/validators/index.js +3 -5
- package/lib/validators/index.js.map +1 -1
- package/package.json +16 -12
- package/src/actions/configure.ts +8 -8
- package/src/actions/lint.ts +8 -8
- package/src/actions/merge.ts +13 -13
- package/src/actions/print.ts +2 -2
- package/src/actions/stitch.ts +12 -12
- package/src/actions/transpile.ts +12 -12
- package/src/actions/validate.ts +7 -7
- package/src/index.ts +8 -8
- package/src/mutations/config/envvars.ts +2 -2
- package/src/mutations/config/index.ts +2 -2
- package/src/utils/constants.ts +3 -3
- package/src/utils/copy-workspace-content.ts +6 -6
- package/src/utils/dedupe-query-and-mutation-types.ts +2 -2
- package/src/utils/ensure-query-and-mutation-types.ts +2 -2
- package/src/utils/graphql-helpers.ts +4 -2
- package/src/utils/merge-helpers.ts +15 -15
- package/src/utils/rmtemp.ts +5 -5
- package/src/utils/set-files-in-sdl.ts +28 -22
- package/src/utils/strip-empty-queries-and-mutations.ts +2 -2
- package/src/validators/config-exists/index.ts +5 -5
- package/src/validators/index.ts +2 -2
package/lib/actions/validate.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const validators_1 = require("../validators");
|
|
11
|
-
exports.default = (source, options = {
|
|
1
|
+
// Copyright IBM Corp. 2020, 2025
|
|
2
|
+
import { buildASTSchema, parse, print } from 'graphql';
|
|
3
|
+
import fsx from 'fs-extra';
|
|
4
|
+
import os from 'node:os';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import ensureQueryAndMutationTypes from '../utils/ensure-query-and-mutation-types.js';
|
|
7
|
+
import { EXPERIMENTAL_EXTENSIONS } from '../utils/constants.js';
|
|
8
|
+
import validators from '../validators/index.js';
|
|
9
|
+
export default (source, options = {
|
|
12
10
|
extensions: '',
|
|
13
11
|
}) => {
|
|
14
12
|
// Ensure source and output directories exist
|
|
@@ -23,16 +21,16 @@ exports.default = (source, options = {
|
|
|
23
21
|
const file = path.join(source, 'index.graphql');
|
|
24
22
|
const index = fsx.readFileSync(file, 'utf8');
|
|
25
23
|
// Parse
|
|
26
|
-
let ast =
|
|
24
|
+
let ast = parse(`${EXPERIMENTAL_EXTENSIONS}${os.EOL}${options.extensions}${os.EOL}${index}`, {
|
|
27
25
|
noLocation: true,
|
|
28
26
|
});
|
|
29
27
|
// We make an exception for 'no type Query' or 'no type Mutation'
|
|
30
|
-
ast = (
|
|
28
|
+
ast = ensureQueryAndMutationTypes(ast);
|
|
31
29
|
// Build and print, to validate
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
buildASTSchema(ast);
|
|
31
|
+
print(ast);
|
|
34
32
|
// Custom validators
|
|
35
|
-
for (const validator of
|
|
33
|
+
for (const validator of validators) {
|
|
36
34
|
validator(ast, source);
|
|
37
35
|
}
|
|
38
36
|
// Return true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/actions/validate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/actions/validate.ts"],"names":[],"mappings":"AAAA,iCAAiC;AAEjC,OAAO,EAAC,cAAc,EAAgB,KAAK,EAAE,KAAK,EAAC,MAAM,SAAS,CAAA;AAClE,OAAO,GAAG,MAAM,UAAU,CAAA;AAC1B,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,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/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { default as configure } from './actions/configure';
|
|
2
|
-
export { default as lint } from './actions/lint';
|
|
3
|
-
export { default as merge } from './actions/merge';
|
|
4
|
-
export { default as print } from './actions/print';
|
|
5
|
-
export { default as stitch } from './actions/stitch';
|
|
6
|
-
export { default as transpile } from './actions/transpile';
|
|
7
|
-
export { default as validate } from './actions/validate';
|
|
1
|
+
export { default as configure } from './actions/configure.js';
|
|
2
|
+
export { default as lint } from './actions/lint.js';
|
|
3
|
+
export { default as merge } from './actions/merge.js';
|
|
4
|
+
export { default as print } from './actions/print.js';
|
|
5
|
+
export { default as stitch } from './actions/stitch.js';
|
|
6
|
+
export { default as transpile } from './actions/transpile.js';
|
|
7
|
+
export { default as validate } from './actions/validate.js';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAC,OAAO,IAAI,IAAI,EAAC,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAC,OAAO,IAAI,KAAK,EAAC,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAC,OAAO,IAAI,KAAK,EAAC,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAC,OAAO,IAAI,MAAM,EAAC,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,uBAAuB,CAAA"}
|
package/lib/index.js
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var merge_1 = require("./actions/merge");
|
|
10
|
-
Object.defineProperty(exports, "merge", { enumerable: true, get: function () { return merge_1.default; } });
|
|
11
|
-
var print_1 = require("./actions/print");
|
|
12
|
-
Object.defineProperty(exports, "print", { enumerable: true, get: function () { return print_1.default; } });
|
|
13
|
-
var stitch_1 = require("./actions/stitch");
|
|
14
|
-
Object.defineProperty(exports, "stitch", { enumerable: true, get: function () { return stitch_1.default; } });
|
|
15
|
-
var transpile_1 = require("./actions/transpile");
|
|
16
|
-
Object.defineProperty(exports, "transpile", { enumerable: true, get: function () { return transpile_1.default; } });
|
|
17
|
-
var validate_1 = require("./actions/validate");
|
|
18
|
-
Object.defineProperty(exports, "validate", { enumerable: true, get: function () { return validate_1.default; } });
|
|
1
|
+
// Copyright IBM Corp. 2020, 2025
|
|
2
|
+
export { default as configure } from './actions/configure.js';
|
|
3
|
+
export { default as lint } from './actions/lint.js';
|
|
4
|
+
export { default as merge } from './actions/merge.js';
|
|
5
|
+
export { default as print } from './actions/print.js';
|
|
6
|
+
export { default as stitch } from './actions/stitch.js';
|
|
7
|
+
export { default as transpile } from './actions/transpile.js';
|
|
8
|
+
export { default as validate } from './actions/validate.js';
|
|
19
9
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iCAAiC;AAEjC,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAC,OAAO,IAAI,IAAI,EAAC,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAC,OAAO,IAAI,KAAK,EAAC,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAC,OAAO,IAAI,KAAK,EAAC,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAC,OAAO,IAAI,MAAM,EAAC,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,uBAAuB,CAAA"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const debug = require("debug");
|
|
1
|
+
// Copyright IBM Corp. 2020, 2025
|
|
2
|
+
import debug from 'debug';
|
|
5
3
|
function replaceVars(value, envvars, path = '') {
|
|
6
4
|
if (!value) {
|
|
7
5
|
return [value, 0];
|
|
@@ -34,7 +32,7 @@ function replaceVars(value, envvars, path = '') {
|
|
|
34
32
|
return [value, 0];
|
|
35
33
|
}
|
|
36
34
|
}
|
|
37
|
-
|
|
35
|
+
export default async (config) => {
|
|
38
36
|
const envvars = Object.keys(process.env)
|
|
39
37
|
.filter(key => {
|
|
40
38
|
return key.startsWith(`STEPZEN_`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envvars.js","sourceRoot":"","sources":["../../../src/mutations/config/envvars.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"envvars.js","sourceRoot":"","sources":["../../../src/mutations/config/envvars.ts"],"names":[],"mappings":"AAAA,iCAAiC;AAEjC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,SAAS,WAAW,CAClB,KAAQ,EACR,OAA+B,EAC/B,IAAI,GAAG,EAAE;IAET,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IACnB,CAAC;IAED,IAAI,YAAY,GAAG,CAAC,CAAA;IAC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
const envvars_1 = require("./envvars");
|
|
5
|
-
exports.default = [envvars_1.default];
|
|
1
|
+
// Copyright IBM Corp. 2020, 2025
|
|
2
|
+
import envvars from './envvars.js';
|
|
3
|
+
export default [envvars];
|
|
6
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mutations/config/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mutations/config/index.ts"],"names":[],"mappings":"AAAA,iCAAiC;AAEjC,OAAO,OAAO,MAAM,cAAc,CAAA;AAElC,eAAe,CAAC,OAAO,CAAC,CAAA"}
|
package/lib/utils/constants.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.ALL_GRAPHQL_FILES = exports.STEPZEN_SERVER_URL = exports.EXPERIMENTAL_EXTENSIONS = void 0;
|
|
5
|
-
const dotenv = require("dotenv");
|
|
6
|
-
const debug = require("debug");
|
|
1
|
+
// Copyright IBM Corp. 2020, 2025
|
|
2
|
+
import dotenv from 'dotenv';
|
|
3
|
+
import debug from 'debug';
|
|
7
4
|
debug('stepzen:dotenv')(`loading .env from ${process.cwd()}, at transpiler/src/utils/constants.ts`);
|
|
8
5
|
dotenv.config();
|
|
9
6
|
const { STEPZEN_SERVER_URL: ENV_VAR_STEPZEN_SERVER_URL } = process.env;
|
|
10
|
-
|
|
7
|
+
export const EXPERIMENTAL_EXTENSIONS = `
|
|
11
8
|
directive @experimental(
|
|
12
9
|
debug: Boolean
|
|
13
10
|
function: String
|
|
@@ -15,6 +12,6 @@ directive @experimental(
|
|
|
15
12
|
setter: String
|
|
16
13
|
) on OBJECT | FIELD_DEFINITION
|
|
17
14
|
`;
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
export const STEPZEN_SERVER_URL = ENV_VAR_STEPZEN_SERVER_URL || 'https://{account}.stepzen.io';
|
|
16
|
+
export const ALL_GRAPHQL_FILES = '**/*.graphql';
|
|
20
17
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,iCAAiC;AAEjC,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,KAAK,CAAC,gBAAgB,CAAC,CACrB,qBAAqB,OAAO,CAAC,GAAG,EAAE,wCAAwC,CAC3E,CAAA;AACD,MAAM,CAAC,MAAM,EAAE,CAAA;AAEf,MAAM,EAAC,kBAAkB,EAAE,0BAA0B,EAAC,GAAG,OAAO,CAAC,GAAG,CAAA;AAEpE,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;CAOtC,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAC7B,0BAA0B,IAAI,8BAA8B,CAAA;AAE9D,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAAA"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const path = require("path");
|
|
8
|
-
const lodash_1 = require("lodash");
|
|
9
|
-
const constants_1 = require("./constants");
|
|
1
|
+
// Copyright IBM Corp. 2020, 2025
|
|
2
|
+
import fsx from 'fs-extra';
|
|
3
|
+
import glob from 'glob';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { flatMap } from 'lodash-es';
|
|
6
|
+
import { ALL_GRAPHQL_FILES } from './constants.js';
|
|
10
7
|
const WORKSPACE_FILE_PATTERNS = [
|
|
11
8
|
'**/*.graphql',
|
|
12
9
|
'stepzen.config.json',
|
|
@@ -24,11 +21,11 @@ const IGNORED_PATTERNS = ['node_modules/**'];
|
|
|
24
21
|
* Exclude all other files.
|
|
25
22
|
* Exclude special folders, e.g. node_modules
|
|
26
23
|
*/
|
|
27
|
-
|
|
24
|
+
export default (srcPath, dstPath) => {
|
|
28
25
|
if (!fsx.existsSync(srcPath)) {
|
|
29
26
|
throw new Error(`Cannot find source directory ${srcPath}`);
|
|
30
27
|
}
|
|
31
|
-
|
|
28
|
+
flatMap(WORKSPACE_FILE_PATTERNS, pattern => glob.sync(pattern, {
|
|
32
29
|
cwd: srcPath,
|
|
33
30
|
ignore: IGNORED_PATTERNS,
|
|
34
31
|
})).forEach(relativePath => {
|
|
@@ -38,10 +35,9 @@ exports.default = (srcPath, dstPath) => {
|
|
|
38
35
|
fsx.copyFileSync(srcFileFullPath, dstFileFullPath);
|
|
39
36
|
});
|
|
40
37
|
};
|
|
41
|
-
const getAllGraphQLFiles = (srcPath) => {
|
|
38
|
+
export const getAllGraphQLFiles = (srcPath) => {
|
|
42
39
|
return glob
|
|
43
|
-
.sync(
|
|
40
|
+
.sync(ALL_GRAPHQL_FILES, { cwd: srcPath })
|
|
44
41
|
.filter(file => file !== 'index.graphql');
|
|
45
42
|
};
|
|
46
|
-
exports.getAllGraphQLFiles = getAllGraphQLFiles;
|
|
47
43
|
//# sourceMappingURL=copy-workspace-content.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy-workspace-content.js","sourceRoot":"","sources":["../../src/utils/copy-workspace-content.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"copy-workspace-content.js","sourceRoot":"","sources":["../../src/utils/copy-workspace-content.ts"],"names":[],"mappings":"AAAA,iCAAiC;AAEjC,OAAO,GAAG,MAAM,UAAU,CAAA;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AACjC,OAAO,EAAC,iBAAiB,EAAC,MAAM,gBAAgB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=> {
|
|
7
|
-
let ast = (0, graphql_1.parse)(schema);
|
|
1
|
+
// Copyright IBM Corp. 2020, 2025
|
|
2
|
+
import { parse, print, visit } from 'graphql';
|
|
3
|
+
import { cloneDeep } from '../utils/graphql-helpers.js';
|
|
4
|
+
export default (schema) => {
|
|
5
|
+
let ast = parse(schema);
|
|
8
6
|
let queries = [];
|
|
9
7
|
let mutations = [];
|
|
10
8
|
// Loop through the AST and find Query and Mutation types.
|
|
11
9
|
// Store their fields.
|
|
12
10
|
// Return null to remove it from the tree
|
|
13
|
-
ast =
|
|
11
|
+
ast = visit(ast, {
|
|
14
12
|
ObjectTypeDefinition: {
|
|
15
13
|
enter(node) {
|
|
16
14
|
if (node.name.kind === 'Name' && node.name.value === 'Query') {
|
|
@@ -45,7 +43,7 @@ exports.default = (schema) => {
|
|
|
45
43
|
// If there are queries, add a single Query type
|
|
46
44
|
// with all the concatenated queries
|
|
47
45
|
if (queries.length > 0) {
|
|
48
|
-
const mutated =
|
|
46
|
+
const mutated = cloneDeep(ast);
|
|
49
47
|
const query = {
|
|
50
48
|
...queryTemplate,
|
|
51
49
|
fields: queries,
|
|
@@ -56,7 +54,7 @@ exports.default = (schema) => {
|
|
|
56
54
|
// If there are mutations, add a single Query type
|
|
57
55
|
// with all the concatenated mutations
|
|
58
56
|
if (mutations.length > 0) {
|
|
59
|
-
const mutated =
|
|
57
|
+
const mutated = cloneDeep(ast);
|
|
60
58
|
const query = {
|
|
61
59
|
...mutationTemplate,
|
|
62
60
|
fields: mutations,
|
|
@@ -64,6 +62,6 @@ exports.default = (schema) => {
|
|
|
64
62
|
mutated.definitions.push(query);
|
|
65
63
|
ast = mutated;
|
|
66
64
|
}
|
|
67
|
-
return
|
|
65
|
+
return print(ast);
|
|
68
66
|
};
|
|
69
67
|
//# sourceMappingURL=dedupe-query-and-mutation-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dedupe-query-and-mutation-types.js","sourceRoot":"","sources":["../../src/utils/dedupe-query-and-mutation-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dedupe-query-and-mutation-types.js","sourceRoot":"","sources":["../../src/utils/dedupe-query-and-mutation-types.ts"],"names":[],"mappings":"AAAA,iCAAiC;AAEjC,OAAO,EAAe,KAAK,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,SAAS,CAAA;AAEzD,OAAO,EAAC,SAAS,EAAC,MAAM,6BAA6B,CAAA;AAErD,eAAe,CAAC,MAAc,EAAU,EAAE;IACxC,IAAI,GAAG,GAAiB,KAAK,CAAC,MAAM,CAAC,CAAA;IAErC,IAAI,OAAO,GAAQ,EAAE,CAAA;IACrB,IAAI,SAAS,GAAQ,EAAE,CAAA;IAEvB,0DAA0D;IAC1D,sBAAsB;IACtB,yCAAyC;IACzC,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE;QACf,oBAAoB,EAAE;YACpB,KAAK,CAAC,IAAI;gBACR,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,OAAO,EAAE,CAAC;oBAC7D,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;oBACrC,OAAO,IAAI,CAAA;gBACb,CAAC;gBACD,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;oBAChE,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;oBACzC,OAAO,IAAI,CAAA;gBACb,CAAC;YACH,CAAC;SACF;KACF,CAAC,CAAA;IAEF,8CAA8C;IAC9C,MAAM,aAAa,GAAG;QACpB,IAAI,EAAE,sBAAsB;QAC5B,WAAW,EAAE,SAAS;QACtB,IAAI,EAAE,EAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAC;QACpC,UAAU,EAAE,EAAE;QACd,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,EAAE;KACX,CAAA;IAED,iDAAiD;IACjD,MAAM,gBAAgB,GAAG;QACvB,IAAI,EAAE,sBAAsB;QAC5B,WAAW,EAAE,SAAS;QACtB,IAAI,EAAE,EAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAC;QACvC,UAAU,EAAE,EAAE;QACd,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,EAAE;KACX,CAAA;IAED,gDAAgD;IAChD,oCAAoC;IACpC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,OAAO,GAAQ,SAAS,CAAC,GAAG,CAAC,CAAA;QACnC,MAAM,KAAK,GAAG;YACZ,GAAG,aAAa;YAChB,MAAM,EAAE,OAAO;SAChB,CAAA;QACD,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC/B,GAAG,GAAG,OAAO,CAAA;IACf,CAAC;IAED,kDAAkD;IAClD,sCAAsC;IACtC,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzB,MAAM,OAAO,GAAQ,SAAS,CAAC,GAAG,CAAC,CAAA;QACnC,MAAM,KAAK,GAAG;YACZ,GAAG,gBAAgB;YACnB,MAAM,EAAE,SAAS;SAClB,CAAA;QACD,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC/B,GAAG,GAAG,OAAO,CAAA;IACf,CAAC;IAED,OAAO,KAAK,CAAC,GAAG,CAAC,CAAA;AACnB,CAAC,CAAA"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const graphql_helpers_1 = require("../utils/graphql-helpers");
|
|
6
|
-
exports.default = (ast) => {
|
|
1
|
+
// Copyright IBM Corp. 2020, 2025
|
|
2
|
+
import { visit } from 'graphql';
|
|
3
|
+
import { cloneDeep } from '../utils/graphql-helpers.js';
|
|
4
|
+
export default (ast) => {
|
|
7
5
|
let queries = [];
|
|
8
6
|
let mutations = [];
|
|
9
7
|
// Loop through the AST and find Query and Mutation types.
|
|
10
|
-
ast =
|
|
8
|
+
ast = visit(ast, {
|
|
11
9
|
ObjectTypeDefinition: {
|
|
12
10
|
enter(node) {
|
|
13
11
|
if (node.name.kind === 'Name' && node.name.value === 'Query') {
|
|
@@ -21,7 +19,7 @@ exports.default = (ast) => {
|
|
|
21
19
|
});
|
|
22
20
|
// If there are no queries, add a single empty Query type
|
|
23
21
|
if (queries.length === 0) {
|
|
24
|
-
const mutated =
|
|
22
|
+
const mutated = cloneDeep(ast);
|
|
25
23
|
mutated.definitions.push({
|
|
26
24
|
kind: 'ObjectTypeDefinition',
|
|
27
25
|
description: undefined,
|
|
@@ -34,7 +32,7 @@ exports.default = (ast) => {
|
|
|
34
32
|
}
|
|
35
33
|
// If there are mutations, add a single empty Mutation type
|
|
36
34
|
if (mutations.length === 0) {
|
|
37
|
-
const mutated =
|
|
35
|
+
const mutated = cloneDeep(ast);
|
|
38
36
|
mutated.definitions.push({
|
|
39
37
|
kind: 'ObjectTypeDefinition',
|
|
40
38
|
description: undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensure-query-and-mutation-types.js","sourceRoot":"","sources":["../../src/utils/ensure-query-and-mutation-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ensure-query-and-mutation-types.js","sourceRoot":"","sources":["../../src/utils/ensure-query-and-mutation-types.ts"],"names":[],"mappings":"AAAA,iCAAiC;AAEjC,OAAO,EAAe,KAAK,EAAC,MAAM,SAAS,CAAA;AAE3C,OAAO,EAAC,SAAS,EAAC,MAAM,6BAA6B,CAAA;AAErD,eAAe,CAAC,GAAiB,EAAgB,EAAE;IACjD,IAAI,OAAO,GAAQ,EAAE,CAAA;IACrB,IAAI,SAAS,GAAQ,EAAE,CAAA;IAEvB,0D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AAC;YACvC,UAAU,EAAE,EAAE;YACd,UAAU,EAAE,EAAE;YACd,MAAM,EAAE,EAAE;SACX,CAAC,CAAA;QACF,GAAG,GAAG,OAAO,CAAA;IACf,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/graphql-helpers.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"graphql-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/graphql-helpers.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS,QAAQ,GAC7C,CAAC,GACD;IAAC,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAC,CAAA;AACnD,eAAO,MAAM,SAAS,iCACW,CAAA"}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.cloneDeep = void 0;
|
|
5
|
-
const cloneDeep = (obj) => JSON.parse(JSON.stringify(obj));
|
|
6
|
-
exports.cloneDeep = cloneDeep;
|
|
1
|
+
// Copyright IBM Corp. 2020, 2025
|
|
2
|
+
export const cloneDeep = (obj) => JSON.parse(JSON.stringify(obj));
|
|
7
3
|
//# sourceMappingURL=graphql-helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-helpers.js","sourceRoot":"","sources":["../../src/utils/graphql-helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"graphql-helpers.js","sourceRoot":"","sources":["../../src/utils/graphql-helpers.ts"],"names":[],"mappings":"AAAA,iCAAiC;AAKjC,MAAM,CAAC,MAAM,SAAS,GAAG,CAAI,GAAM,EAAoB,EAAE,CACvD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAA"}
|