@stepzen/transpiler 0.0.0-experimental-20221114-610843f6
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 +21 -0
- package/README.md +1 -0
- package/lib/actions/configure.d.ts +12 -0
- package/lib/actions/configure.d.ts.map +1 -0
- package/lib/actions/configure.js +134 -0
- package/lib/actions/configure.js.map +1 -0
- package/lib/actions/lint.d.ts +5 -0
- package/lib/actions/lint.d.ts.map +1 -0
- package/lib/actions/lint.js +31 -0
- package/lib/actions/lint.js.map +1 -0
- package/lib/actions/merge.d.ts +15 -0
- package/lib/actions/merge.d.ts.map +1 -0
- package/lib/actions/merge.js +177 -0
- package/lib/actions/merge.js.map +1 -0
- package/lib/actions/print.d.ts +4 -0
- package/lib/actions/print.d.ts.map +1 -0
- package/lib/actions/print.js +10 -0
- package/lib/actions/print.js.map +1 -0
- package/lib/actions/stitch.d.ts +3 -0
- package/lib/actions/stitch.d.ts.map +1 -0
- package/lib/actions/stitch.js +96 -0
- package/lib/actions/stitch.js.map +1 -0
- package/lib/actions/transpile.d.ts +17 -0
- package/lib/actions/transpile.d.ts.map +1 -0
- package/lib/actions/transpile.js +62 -0
- package/lib/actions/transpile.js.map +1 -0
- package/lib/actions/validate.d.ts +5 -0
- package/lib/actions/validate.d.ts.map +1 -0
- package/lib/actions/validate.js +40 -0
- package/lib/actions/validate.js.map +1 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +18 -0
- package/lib/index.js.map +1 -0
- package/lib/mutations/config/envvars.d.ts +3 -0
- package/lib/mutations/config/envvars.d.ts.map +1 -0
- package/lib/mutations/config/envvars.js +27 -0
- package/lib/mutations/config/envvars.js.map +1 -0
- package/lib/mutations/config/index.d.ts +3 -0
- package/lib/mutations/config/index.d.ts.map +1 -0
- package/lib/mutations/config/index.js +5 -0
- package/lib/mutations/config/index.js.map +1 -0
- package/lib/utils/constants.d.ts +4 -0
- package/lib/utils/constants.d.ts.map +1 -0
- package/lib/utils/constants.js +19 -0
- package/lib/utils/constants.js.map +1 -0
- package/lib/utils/copy-workspace-content.d.ts +15 -0
- package/lib/utils/copy-workspace-content.d.ts.map +1 -0
- package/lib/utils/copy-workspace-content.js +46 -0
- package/lib/utils/copy-workspace-content.js.map +1 -0
- package/lib/utils/dedupe-query-and-mutation-types.d.ts +3 -0
- package/lib/utils/dedupe-query-and-mutation-types.d.ts.map +1 -0
- package/lib/utils/dedupe-query-and-mutation-types.js +68 -0
- package/lib/utils/dedupe-query-and-mutation-types.js.map +1 -0
- package/lib/utils/ensure-query-and-mutation-types.d.ts +4 -0
- package/lib/utils/ensure-query-and-mutation-types.d.ts.map +1 -0
- package/lib/utils/ensure-query-and-mutation-types.js +49 -0
- package/lib/utils/ensure-query-and-mutation-types.js.map +1 -0
- package/lib/utils/graphql-helpers.d.ts +5 -0
- package/lib/utils/graphql-helpers.d.ts.map +1 -0
- package/lib/utils/graphql-helpers.js +6 -0
- package/lib/utils/graphql-helpers.js.map +1 -0
- package/lib/utils/merge-helpers.d.ts +13 -0
- package/lib/utils/merge-helpers.d.ts.map +1 -0
- package/lib/utils/merge-helpers.js +180 -0
- package/lib/utils/merge-helpers.js.map +1 -0
- package/lib/utils/set-files-in-sdl.d.ts +7 -0
- package/lib/utils/set-files-in-sdl.d.ts.map +1 -0
- package/lib/utils/set-files-in-sdl.js +122 -0
- package/lib/utils/set-files-in-sdl.js.map +1 -0
- package/lib/utils/strip-empty-queries-and-mutations.d.ts +4 -0
- package/lib/utils/strip-empty-queries-and-mutations.d.ts.map +1 -0
- package/lib/utils/strip-empty-queries-and-mutations.js +44 -0
- package/lib/utils/strip-empty-queries-and-mutations.js.map +1 -0
- package/lib/validators/config-exists/index.d.ts +4 -0
- package/lib/validators/config-exists/index.d.ts.map +1 -0
- package/lib/validators/config-exists/index.js +46 -0
- package/lib/validators/config-exists/index.js.map +1 -0
- package/lib/validators/index.d.ts +3 -0
- package/lib/validators/index.d.ts.map +1 -0
- package/lib/validators/index.js +5 -0
- package/lib/validators/index.js.map +1 -0
- package/package.json +57 -0
- package/src/actions/configure.ts +176 -0
- package/src/actions/lint.ts +44 -0
- package/src/actions/merge.ts +243 -0
- package/src/actions/print.ts +8 -0
- package/src/actions/stitch.ts +113 -0
- package/src/actions/transpile.ts +74 -0
- package/src/actions/validate.ts +54 -0
- package/src/index.ts +7 -0
- package/src/mutations/config/envvars.ts +33 -0
- package/src/mutations/config/index.ts +3 -0
- package/src/utils/constants.ts +22 -0
- package/src/utils/copy-workspace-content.ts +48 -0
- package/src/utils/dedupe-query-and-mutation-types.ts +74 -0
- package/src/utils/ensure-query-and-mutation-types.ts +52 -0
- package/src/utils/graphql-helpers.ts +3 -0
- package/src/utils/merge-helpers.ts +205 -0
- package/src/utils/set-files-in-sdl.ts +156 -0
- package/src/utils/strip-empty-queries-and-mutations.ts +43 -0
- package/src/validators/config-exists/index.ts +54 -0
- package/src/validators/index.ts +3 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const graphql_1 = require("graphql");
|
|
4
|
+
const dotenv = require("dotenv");
|
|
5
|
+
const debug = require("debug");
|
|
6
|
+
const fs = require("fs");
|
|
7
|
+
const glob = require("glob");
|
|
8
|
+
const path = require("path");
|
|
9
|
+
const print_1 = require("../actions/print");
|
|
10
|
+
const stitch_1 = require("../actions/stitch");
|
|
11
|
+
const configure_1 = require("./configure");
|
|
12
|
+
const config_1 = require("../mutations/config");
|
|
13
|
+
/**
|
|
14
|
+
* Read a StepZen workspace directory, apply StepZen-specific schema and config
|
|
15
|
+
* transformations, and return its effective GraphQL schema and configuration
|
|
16
|
+
* as in-memory strings.
|
|
17
|
+
*
|
|
18
|
+
* @param {*} source absolute path to a schema root folder
|
|
19
|
+
* @return {*} schema, configuration, and a "transpiled" flag indicating
|
|
20
|
+
* whether or not any StepZen-specific transformations have actually
|
|
21
|
+
* been applied.
|
|
22
|
+
*/
|
|
23
|
+
exports.default = async (source) => {
|
|
24
|
+
// Ensure source and output directories exist
|
|
25
|
+
if (!fs.existsSync(source)) {
|
|
26
|
+
throw new Error(`Cannot find source directory ${source}`);
|
|
27
|
+
}
|
|
28
|
+
// Load env vars, from working and source directories
|
|
29
|
+
debug('stepzen:dotenv')(`loading .env from ${process.cwd()}, at transpiler/src/actions/transpile.ts:24`);
|
|
30
|
+
dotenv.config();
|
|
31
|
+
debug('stepzen:dotenv')(`loading .env from ${path.resolve(source)}` +
|
|
32
|
+
`, at transpiler/src/actions/transpile.ts:29`);
|
|
33
|
+
dotenv.config({ path: path.resolve(source, '.env') });
|
|
34
|
+
// State of whether we've transpiled or not
|
|
35
|
+
let transpiledConfig = false;
|
|
36
|
+
// See whether to transpile config
|
|
37
|
+
let config = await (0, configure_1.default)(source, true);
|
|
38
|
+
const configCopy = config;
|
|
39
|
+
if (config) {
|
|
40
|
+
for await (const mutation of config_1.default) {
|
|
41
|
+
config = await mutation(config);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (configCopy !== config) {
|
|
45
|
+
transpiledConfig = true;
|
|
46
|
+
}
|
|
47
|
+
// See whether to transpile GraphQL
|
|
48
|
+
const graphqlFiles = glob.sync('**/*.graphql', { cwd: source });
|
|
49
|
+
let schema = '';
|
|
50
|
+
if (graphqlFiles.length > 0) {
|
|
51
|
+
const stitched = await (0, stitch_1.default)(source);
|
|
52
|
+
const index = path.join(stitched, 'index.graphql');
|
|
53
|
+
const graphql = fs.readFileSync(index, 'utf8');
|
|
54
|
+
schema = (0, print_1.default)((0, graphql_1.parse)(graphql));
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
config,
|
|
58
|
+
schema,
|
|
59
|
+
transpiled: transpiledConfig,
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=transpile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transpile.js","sourceRoot":"","sources":["../../src/actions/transpile.ts"],"names":[],"mappings":";;AAAA,qCAA2C;AAC3C,iCAAgC;AAChC,+BAA8B;AAC9B,yBAAwB;AACxB,6BAA4B;AAC5B,6BAA4B;AAE5B,4CAAoC;AACpC,8CAAsC;AACtC,2CAAmC;AAEnC,gDAAiD;AAEjD;;;;;;;;;GASG;AACH,kBAAe,KAAK,EAAE,MAAc,EAAE,EAAE;IACtC,6CAA6C;IAC7C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,gCAAgC,MAAM,EAAE,CAAC,CAAA;KAC1D;IAED,qDAAqD;IACrD,KAAK,CAAC,gBAAgB,CAAC,CACrB,qBAAqB,OAAO,CAAC,GAAG,EAAE,6CAA6C,CAChF,CAAA;IACD,MAAM,CAAC,MAAM,EAAE,CAAA;IACf,KAAK,CAAC,gBAAgB,CAAC,CACrB,qBAAqB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACzC,6CAA6C,CAChD,CAAA;IACD,MAAM,CAAC,MAAM,CAAC,EAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,EAAC,CAAC,CAAA;IAEnD,2CAA2C;IAC3C,IAAI,gBAAgB,GAAG,KAAK,CAAA;IAE5B,kCAAkC;IAClC,IAAI,MAAM,GAAG,MAAM,IAAA,mBAAS,EAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAC1C,MAAM,UAAU,GAAG,MAAM,CAAA;IAEzB,IAAI,MAAM,EAAE;QACV,IAAI,KAAK,EAAE,MAAM,QAAQ,IAAI,gBAAe,EAAE;YAC5C,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAA;SAChC;KACF;IAED,IAAI,UAAU,KAAK,MAAM,EAAE;QACzB,gBAAgB,GAAG,IAAI,CAAA;KACxB;IAED,mCAAmC;IACnC,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,EAAC,GAAG,EAAE,MAAM,EAAC,CAAC,CAAA;IAC7D,IAAI,MAAM,GAAG,EAAE,CAAA;IAEf,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;QAC3B,MAAM,QAAQ,GAAG,MAAM,IAAA,gBAAM,EAAC,MAAM,CAAC,CAAA;QACrC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAA;QAClD,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;QAC9C,MAAM,GAAG,IAAA,eAAK,EAAC,IAAA,eAAK,EAAC,OAAO,CAAC,CAAC,CAAA;KAC/B;IAED,OAAO;QACL,MAAM;QACN,MAAM;QACN,UAAU,EAAE,gBAAgB;KAC7B,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/actions/validate.ts"],"names":[],"mappings":"iCAUU,MAAM,YACL;IACP,UAAU,EAAE,MAAM,CAAA;CACnB;AAJH,wBA4CC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const graphql_1 = require("graphql");
|
|
4
|
+
const fs = require("fs-extra");
|
|
5
|
+
const os = require("os");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const ensure_query_and_mutation_types_1 = require("../utils/ensure-query-and-mutation-types");
|
|
8
|
+
const constants_1 = require("../utils/constants");
|
|
9
|
+
const validators_1 = require("../validators");
|
|
10
|
+
exports.default = (source, options = {
|
|
11
|
+
extensions: '',
|
|
12
|
+
}) => {
|
|
13
|
+
// Ensure source and output directories exist
|
|
14
|
+
if (!fs.existsSync(source)) {
|
|
15
|
+
throw new Error(`Cannot find source directory ${source}`);
|
|
16
|
+
}
|
|
17
|
+
// Ensure index.graphql exists
|
|
18
|
+
if (!fs.existsSync(`${source}/index.graphql`)) {
|
|
19
|
+
throw new Error(`Cannot find index.graphql in ${source}`);
|
|
20
|
+
}
|
|
21
|
+
// Get the index.graphql file
|
|
22
|
+
const file = path.join(source, 'index.graphql');
|
|
23
|
+
const index = fs.readFileSync(file, 'utf8');
|
|
24
|
+
// Parse
|
|
25
|
+
let ast = (0, graphql_1.parse)(`${constants_1.EXPERIMENTAL_EXTENSIONS}${os.EOL}${options.extensions}${os.EOL}${index}`, {
|
|
26
|
+
noLocation: true,
|
|
27
|
+
});
|
|
28
|
+
// We make an exception for 'no type Query' or 'no type Mutation'
|
|
29
|
+
ast = (0, ensure_query_and_mutation_types_1.default)(ast);
|
|
30
|
+
// Build and print, to validate
|
|
31
|
+
(0, graphql_1.buildASTSchema)(ast);
|
|
32
|
+
(0, graphql_1.print)(ast);
|
|
33
|
+
// Custom validators
|
|
34
|
+
for (const validator of validators_1.default) {
|
|
35
|
+
validator(ast, source);
|
|
36
|
+
}
|
|
37
|
+
// Return true
|
|
38
|
+
return true;
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/actions/validate.ts"],"names":[],"mappings":";;AAAA,qCAAkE;AAClE,+BAA8B;AAC9B,yBAAwB;AACxB,6BAA4B;AAE5B,8FAAkF;AAClF,kDAA0D;AAC1D,8CAAsC;AAEtC,kBAAe,CACb,MAAc,EACd,UAEI;IACF,UAAU,EAAE,EAAE;CACf,EACD,EAAE;IACF,6CAA6C;IAC7C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,gCAAgC,MAAM,EAAE,CAAC,CAAA;KAC1D;IAED,8BAA8B;IAC9B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,MAAM,gBAAgB,CAAC,EAAE;QAC7C,MAAM,IAAI,KAAK,CAAC,gCAAgC,MAAM,EAAE,CAAC,CAAA;KAC1D;IAED,6BAA6B;IAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAC/C,MAAM,KAAK,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAE3C,QAAQ;IACR,IAAI,GAAG,GAAiB,IAAA,eAAK,EAC3B,GAAG,mCAAuB,GAAG,EAAE,CAAC,GAAG,GAAG,OAAO,CAAC,UAAU,GAAG,EAAE,CAAC,GAAG,GAAG,KAAK,EAAE,EAC3E;QACE,UAAU,EAAE,IAAI;KACjB,CACF,CAAA;IAED,iEAAiE;IACjE,GAAG,GAAG,IAAA,yCAA2B,EAAC,GAAG,CAAC,CAAA;IAEtC,+BAA+B;IAC/B,IAAA,wBAAc,EAAC,GAAG,CAAC,CAAA;IACnB,IAAA,eAAK,EAAC,GAAG,CAAC,CAAA;IAEV,oBAAoB;IACpB,KAAK,MAAM,SAAS,IAAI,oBAAU,EAAE;QAClC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;KACvB;IAED,cAAc;IACd,OAAO,IAAI,CAAA;AACb,CAAC,CAAA"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +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';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAC,OAAO,IAAI,IAAI,EAAC,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAC,OAAO,IAAI,KAAK,EAAC,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAC,OAAO,IAAI,KAAK,EAAC,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAC,OAAO,IAAI,MAAM,EAAC,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,oBAAoB,CAAA"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validate = exports.transpile = exports.stitch = exports.print = exports.merge = exports.lint = exports.configure = void 0;
|
|
4
|
+
var configure_1 = require("./actions/configure");
|
|
5
|
+
Object.defineProperty(exports, "configure", { enumerable: true, get: function () { return configure_1.default; } });
|
|
6
|
+
var lint_1 = require("./actions/lint");
|
|
7
|
+
Object.defineProperty(exports, "lint", { enumerable: true, get: function () { return lint_1.default; } });
|
|
8
|
+
var merge_1 = require("./actions/merge");
|
|
9
|
+
Object.defineProperty(exports, "merge", { enumerable: true, get: function () { return merge_1.default; } });
|
|
10
|
+
var print_1 = require("./actions/print");
|
|
11
|
+
Object.defineProperty(exports, "print", { enumerable: true, get: function () { return print_1.default; } });
|
|
12
|
+
var stitch_1 = require("./actions/stitch");
|
|
13
|
+
Object.defineProperty(exports, "stitch", { enumerable: true, get: function () { return stitch_1.default; } });
|
|
14
|
+
var transpile_1 = require("./actions/transpile");
|
|
15
|
+
Object.defineProperty(exports, "transpile", { enumerable: true, get: function () { return transpile_1.default; } });
|
|
16
|
+
var validate_1 = require("./actions/validate");
|
|
17
|
+
Object.defineProperty(exports, "validate", { enumerable: true, get: function () { return validate_1.default; } });
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iDAAwD;AAAhD,sGAAA,OAAO,OAAa;AAC5B,uCAA8C;AAAtC,4FAAA,OAAO,OAAQ;AACvB,yCAAgD;AAAxC,8FAAA,OAAO,OAAS;AACxB,yCAAgD;AAAxC,8FAAA,OAAO,OAAS;AACxB,2CAAkD;AAA1C,gGAAA,OAAO,OAAU;AACzB,iDAAwD;AAAhD,sGAAA,OAAO,OAAa;AAC5B,+CAAsD;AAA9C,oGAAA,OAAO,OAAY"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"envvars.d.ts","sourceRoot":"","sources":["../../../src/mutations/config/envvars.ts"],"names":[],"mappings":"iCAE8B,MAAM,KAAG,QAAQ,MAAM,CAAC;AAAtD,wBA8BC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const debug = require("debug");
|
|
4
|
+
exports.default = async (config) => {
|
|
5
|
+
const envvars = Object.keys(process.env)
|
|
6
|
+
.filter(key => {
|
|
7
|
+
return key.startsWith(`STEPZEN_`);
|
|
8
|
+
})
|
|
9
|
+
.reduce((obj, key) => {
|
|
10
|
+
obj[key] = process.env[key];
|
|
11
|
+
return obj;
|
|
12
|
+
}, {});
|
|
13
|
+
let replacements = 0;
|
|
14
|
+
debug('stepzen:transpiler:config')(`STEPZEN_* env vars available for replacement:` +
|
|
15
|
+
` ${JSON.stringify(envvars, undefined, 2)}`);
|
|
16
|
+
for (const [key, value] of Object.entries(envvars)) {
|
|
17
|
+
const regex = new RegExp(key, 'g');
|
|
18
|
+
config = config.replace(regex, (match, offset) => {
|
|
19
|
+
replacements += 1;
|
|
20
|
+
debug('stepzen:transpiler:config')(`replacing ${match} at offset ${offset}`);
|
|
21
|
+
return `${value}`;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
debug('stepzen:transpiler:config')(`total replacements made: ${replacements}`);
|
|
25
|
+
return config;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=envvars.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"envvars.js","sourceRoot":"","sources":["../../../src/mutations/config/envvars.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAE9B,kBAAe,KAAK,EAAE,MAAc,EAAmB,EAAE;IACvD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC;SACrC,MAAM,CAAC,GAAG,CAAC,EAAE;QACZ,OAAO,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;IACnC,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,GAAQ,EAAE,GAAG,EAAE,EAAE;QACxB,GAAG,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAC3B,OAAO,GAAG,CAAA;IACZ,CAAC,EAAE,EAAE,CAAC,CAAA;IAER,IAAI,YAAY,GAAG,CAAC,CAAA;IACpB,KAAK,CAAC,2BAA2B,CAAC,CAChC,+CAA+C;QAC7C,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAC9C,CAAA;IAED,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAClD,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;QAClC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YAC/C,YAAY,IAAI,CAAC,CAAA;YACjB,KAAK,CAAC,2BAA2B,CAAC,CAChC,aAAa,KAAK,cAAc,MAAM,EAAE,CACzC,CAAA;YACD,OAAO,GAAG,KAAK,EAAE,CAAA;QACnB,CAAC,CAAC,CAAA;KACH;IAED,KAAK,CAAC,2BAA2B,CAAC,CAAC,4BAA4B,YAAY,EAAE,CAAC,CAAA;IAE9E,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mutations/config/index.ts"],"names":[],"mappings":";AAEA,wBAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mutations/config/index.ts"],"names":[],"mappings":";;AAAA,uCAA+B;AAE/B,kBAAe,CAAC,iBAAO,CAAC,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const EXPERIMENTAL_EXTENSIONS = "\ndirective @experimental(\n debug: Boolean\n function: String\n mock: String\n setter: String\n) on OBJECT | FIELD_DEFINITION\n";
|
|
2
|
+
export declare const STEPZEN_DOMAIN: string;
|
|
3
|
+
export declare const ALL_GRAPHQL_FILES = "**/*.graphql";
|
|
4
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,uBAAuB,yIAOnC,CAAA;AAED,eAAO,MAAM,cAAc,QAAyC,CAAA;AAEpE,eAAO,MAAM,iBAAiB,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ALL_GRAPHQL_FILES = exports.STEPZEN_DOMAIN = exports.EXPERIMENTAL_EXTENSIONS = void 0;
|
|
4
|
+
const dotenv = require("dotenv");
|
|
5
|
+
const debug = require("debug");
|
|
6
|
+
debug('stepzen:dotenv')(`loading .env from ${process.cwd()}, at transpiler/src/utils/constants.ts`);
|
|
7
|
+
dotenv.config();
|
|
8
|
+
const { STEPZEN_DOMAIN: ENV_VAR_STEPZEN_DOMAIN } = process.env;
|
|
9
|
+
exports.EXPERIMENTAL_EXTENSIONS = `
|
|
10
|
+
directive @experimental(
|
|
11
|
+
debug: Boolean
|
|
12
|
+
function: String
|
|
13
|
+
mock: String
|
|
14
|
+
setter: String
|
|
15
|
+
) on OBJECT | FIELD_DEFINITION
|
|
16
|
+
`;
|
|
17
|
+
exports.STEPZEN_DOMAIN = ENV_VAR_STEPZEN_DOMAIN || 'stepzen.io';
|
|
18
|
+
exports.ALL_GRAPHQL_FILES = '**/*.graphql';
|
|
19
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":";;;AAAA,iCAAgC;AAChC,+BAA8B;AAE9B,KAAK,CAAC,gBAAgB,CAAC,CACrB,qBAAqB,OAAO,CAAC,GAAG,EAAE,wCAAwC,CAC3E,CAAA;AACD,MAAM,CAAC,MAAM,EAAE,CAAA;AAEf,MAAM,EAAC,cAAc,EAAE,sBAAsB,EAAC,GAAG,OAAO,CAAC,GAAG,CAAA;AAE/C,QAAA,uBAAuB,GAAG;;;;;;;CAOtC,CAAA;AAEY,QAAA,cAAc,GAAG,sBAAsB,IAAI,YAAY,CAAA;AAEvD,QAAA,iBAAiB,GAAG,cAAc,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copy StepZen workspace content from one directory to another.
|
|
3
|
+
*
|
|
4
|
+
* Include only the files relevant to StepZen:
|
|
5
|
+
* - **/*.graphql
|
|
6
|
+
* - config.yaml
|
|
7
|
+
* - stepzen.config.json
|
|
8
|
+
*
|
|
9
|
+
* Exclude all other files.
|
|
10
|
+
* Exclude special folders, e.g. node_modules
|
|
11
|
+
*/
|
|
12
|
+
declare const _default: (srcPath: string, dstPath: string) => void;
|
|
13
|
+
export default _default;
|
|
14
|
+
export declare const getAllGraphQLFiles: (srcPath: string) => string[];
|
|
15
|
+
//# sourceMappingURL=copy-workspace-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-workspace-content.d.ts","sourceRoot":"","sources":["../../src/utils/copy-workspace-content.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;GAUG;kCACsB,MAAM,WAAW,MAAM;AAAhD,wBAgBC;AAED,eAAO,MAAM,kBAAkB,YAAa,MAAM,aAIjD,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAllGraphQLFiles = void 0;
|
|
4
|
+
const fs = require("fs-extra");
|
|
5
|
+
const glob = require("glob");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const lodash_1 = require("lodash");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
const WORKSPACE_FILE_PATTERNS = [
|
|
10
|
+
'**/*.graphql',
|
|
11
|
+
'stepzen.config.json',
|
|
12
|
+
'config.yaml',
|
|
13
|
+
];
|
|
14
|
+
const IGNORED_PATTERNS = ['node_modules/**'];
|
|
15
|
+
/**
|
|
16
|
+
* Copy StepZen workspace content from one directory to another.
|
|
17
|
+
*
|
|
18
|
+
* Include only the files relevant to StepZen:
|
|
19
|
+
* - **/*.graphql
|
|
20
|
+
* - config.yaml
|
|
21
|
+
* - stepzen.config.json
|
|
22
|
+
*
|
|
23
|
+
* Exclude all other files.
|
|
24
|
+
* Exclude special folders, e.g. node_modules
|
|
25
|
+
*/
|
|
26
|
+
exports.default = (srcPath, dstPath) => {
|
|
27
|
+
if (!fs.existsSync(srcPath)) {
|
|
28
|
+
throw new Error(`Cannot find source directory ${srcPath}`);
|
|
29
|
+
}
|
|
30
|
+
(0, lodash_1.flatMap)(WORKSPACE_FILE_PATTERNS, pattern => glob.sync(pattern, {
|
|
31
|
+
cwd: srcPath,
|
|
32
|
+
ignore: IGNORED_PATTERNS,
|
|
33
|
+
})).forEach(relativePath => {
|
|
34
|
+
const srcFileFullPath = path.join(srcPath, relativePath);
|
|
35
|
+
const dstFileFullPath = path.join(dstPath, relativePath);
|
|
36
|
+
fs.ensureDirSync(path.dirname(dstFileFullPath));
|
|
37
|
+
fs.copyFileSync(srcFileFullPath, dstFileFullPath);
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const getAllGraphQLFiles = (srcPath) => {
|
|
41
|
+
return glob
|
|
42
|
+
.sync(constants_1.ALL_GRAPHQL_FILES, { cwd: srcPath })
|
|
43
|
+
.filter(file => file !== 'index.graphql');
|
|
44
|
+
};
|
|
45
|
+
exports.getAllGraphQLFiles = getAllGraphQLFiles;
|
|
46
|
+
//# sourceMappingURL=copy-workspace-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-workspace-content.js","sourceRoot":"","sources":["../../src/utils/copy-workspace-content.ts"],"names":[],"mappings":";;;AAAA,+BAA8B;AAC9B,6BAA4B;AAC5B,6BAA4B;AAC5B,mCAA8B;AAC9B,2CAA6C;AAE7C,MAAM,uBAAuB,GAAG;IAC9B,cAAc;IACd,qBAAqB;IACrB,aAAa;CACd,CAAA;AAED,MAAM,gBAAgB,GAAG,CAAC,iBAAiB,CAAC,CAAA;AAE5C;;;;;;;;;;GAUG;AACH,kBAAe,CAAC,OAAe,EAAE,OAAe,EAAE,EAAE;IAClD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,gCAAgC,OAAO,EAAE,CAAC,CAAA;KAC3D;IAED,IAAA,gBAAO,EAAC,uBAAuB,EAAE,OAAO,CAAC,EAAE,CACzC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;QACjB,GAAG,EAAE,OAAO;QACZ,MAAM,EAAE,gBAAgB;KACzB,CAAC,CACH,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;QACvB,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;QACxD,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;QACxD,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAA;QAC/C,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,eAAe,CAAC,CAAA;IACnD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAEM,MAAM,kBAAkB,GAAG,CAAC,OAAe,EAAE,EAAE;IACpD,OAAO,IAAI;SACR,IAAI,CAAC,6BAAiB,EAAE,EAAC,GAAG,EAAE,OAAO,EAAC,CAAC;SACvC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,eAAe,CAAC,CAAA;AAC7C,CAAC,CAAA;AAJY,QAAA,kBAAkB,sBAI9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dedupe-query-and-mutation-types.d.ts","sourceRoot":"","sources":["../../src/utils/dedupe-query-and-mutation-types.ts"],"names":[],"mappings":"iCAIwB,MAAM,KAAG,MAAM;AAAvC,wBAqEC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const graphql_1 = require("graphql");
|
|
4
|
+
const graphql_helpers_1 = require("../utils/graphql-helpers");
|
|
5
|
+
exports.default = (schema) => {
|
|
6
|
+
let ast = (0, graphql_1.parse)(schema);
|
|
7
|
+
let queries = [];
|
|
8
|
+
let mutations = [];
|
|
9
|
+
// Loop through the AST and find Query and Mutation types.
|
|
10
|
+
// Store their fields.
|
|
11
|
+
// Return null to remove it from the tree
|
|
12
|
+
ast = (0, graphql_1.visit)(ast, {
|
|
13
|
+
ObjectTypeDefinition: {
|
|
14
|
+
enter(node) {
|
|
15
|
+
if (node.name.kind === 'Name' && node.name.value === 'Query') {
|
|
16
|
+
queries = queries.concat(node.fields);
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
if (node.name.kind === 'Name' && node.name.value === 'Mutation') {
|
|
20
|
+
mutations = mutations.concat(node.fields);
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
// This is the template for the new Query type
|
|
27
|
+
const queryTemplate = {
|
|
28
|
+
kind: 'ObjectTypeDefinition',
|
|
29
|
+
description: undefined,
|
|
30
|
+
name: { kind: 'Name', value: 'Query' },
|
|
31
|
+
interfaces: [],
|
|
32
|
+
directives: [],
|
|
33
|
+
fields: [],
|
|
34
|
+
};
|
|
35
|
+
// This is the template for the new Mutation type
|
|
36
|
+
const mutationTemplate = {
|
|
37
|
+
kind: 'ObjectTypeDefinition',
|
|
38
|
+
description: undefined,
|
|
39
|
+
name: { kind: 'Name', value: 'Mutation' },
|
|
40
|
+
interfaces: [],
|
|
41
|
+
directives: [],
|
|
42
|
+
fields: [],
|
|
43
|
+
};
|
|
44
|
+
// If there are queries, add a single Query type
|
|
45
|
+
// with all the concatenated queries
|
|
46
|
+
if (queries.length > 0) {
|
|
47
|
+
const mutated = (0, graphql_helpers_1.cloneDeep)(ast);
|
|
48
|
+
const query = {
|
|
49
|
+
...queryTemplate,
|
|
50
|
+
fields: queries,
|
|
51
|
+
};
|
|
52
|
+
mutated.definitions.push(query);
|
|
53
|
+
ast = mutated;
|
|
54
|
+
}
|
|
55
|
+
// If there are mutations, add a single Query type
|
|
56
|
+
// with all the concatenated mutations
|
|
57
|
+
if (mutations.length > 0) {
|
|
58
|
+
const mutated = (0, graphql_helpers_1.cloneDeep)(ast);
|
|
59
|
+
const query = {
|
|
60
|
+
...mutationTemplate,
|
|
61
|
+
fields: mutations,
|
|
62
|
+
};
|
|
63
|
+
mutated.definitions.push(query);
|
|
64
|
+
ast = mutated;
|
|
65
|
+
}
|
|
66
|
+
return (0, graphql_1.print)(ast);
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=dedupe-query-and-mutation-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dedupe-query-and-mutation-types.js","sourceRoot":"","sources":["../../src/utils/dedupe-query-and-mutation-types.ts"],"names":[],"mappings":";;AAAA,qCAAyD;AAEzD,8DAAkD;AAElD,kBAAe,CAAC,MAAc,EAAU,EAAE;IACxC,IAAI,GAAG,GAAiB,IAAA,eAAK,EAAC,MAAM,CAAC,CAAA;IAErC,IAAI,OAAO,GAAQ,EAAE,CAAA;IACrB,IAAI,SAAS,GAAQ,EAAE,CAAA;IAEvB,0DAA0D;IAC1D,sBAAsB;IACtB,yCAAyC;IACzC,GAAG,GAAG,IAAA,eAAK,EAAC,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;oBAC5D,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;oBACrC,OAAO,IAAI,CAAA;iBACZ;gBACD,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,UAAU,EAAE;oBAC/D,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;oBACzC,OAAO,IAAI,CAAA;iBACZ;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;QACtB,MAAM,OAAO,GAAQ,IAAA,2BAAS,EAAC,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;KACd;IAED,kDAAkD;IAClD,sCAAsC;IACtC,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;QACxB,MAAM,OAAO,GAAQ,IAAA,2BAAS,EAAC,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;KACd;IAED,OAAO,IAAA,eAAK,EAAC,GAAG,CAAC,CAAA;AACnB,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensure-query-and-mutation-types.d.ts","sourceRoot":"","sources":["../../src/utils/ensure-query-and-mutation-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAQ,MAAM,SAAS,CAAA;8BAItB,YAAY,KAAG,YAAY;AAAhD,wBA+CC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const graphql_1 = require("graphql");
|
|
4
|
+
const graphql_helpers_1 = require("../utils/graphql-helpers");
|
|
5
|
+
exports.default = (ast) => {
|
|
6
|
+
let queries = [];
|
|
7
|
+
let mutations = [];
|
|
8
|
+
// Loop through the AST and find Query and Mutation types.
|
|
9
|
+
ast = (0, graphql_1.visit)(ast, {
|
|
10
|
+
ObjectTypeDefinition: {
|
|
11
|
+
enter(node) {
|
|
12
|
+
if (node.name.kind === 'Name' && node.name.value === 'Query') {
|
|
13
|
+
queries = queries.concat(node.fields);
|
|
14
|
+
}
|
|
15
|
+
if (node.name.kind === 'Name' && node.name.value === 'Mutation') {
|
|
16
|
+
mutations = mutations.concat(node.fields);
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
// If there are no queries, add a single empty Query type
|
|
22
|
+
if (queries.length === 0) {
|
|
23
|
+
const mutated = (0, graphql_helpers_1.cloneDeep)(ast);
|
|
24
|
+
mutated.definitions.push({
|
|
25
|
+
kind: 'ObjectTypeDefinition',
|
|
26
|
+
description: undefined,
|
|
27
|
+
name: { kind: 'Name', value: 'Query' },
|
|
28
|
+
interfaces: [],
|
|
29
|
+
directives: [],
|
|
30
|
+
fields: [],
|
|
31
|
+
});
|
|
32
|
+
ast = mutated;
|
|
33
|
+
}
|
|
34
|
+
// If there are mutations, add a single empty Mutation type
|
|
35
|
+
if (mutations.length === 0) {
|
|
36
|
+
const mutated = (0, graphql_helpers_1.cloneDeep)(ast);
|
|
37
|
+
mutated.definitions.push({
|
|
38
|
+
kind: 'ObjectTypeDefinition',
|
|
39
|
+
description: undefined,
|
|
40
|
+
name: { kind: 'Name', value: 'Mutation' },
|
|
41
|
+
interfaces: [],
|
|
42
|
+
directives: [],
|
|
43
|
+
fields: [],
|
|
44
|
+
});
|
|
45
|
+
ast = mutated;
|
|
46
|
+
}
|
|
47
|
+
return ast;
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=ensure-query-and-mutation-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensure-query-and-mutation-types.js","sourceRoot":"","sources":["../../src/utils/ensure-query-and-mutation-types.ts"],"names":[],"mappings":";;AAAA,qCAA2C;AAE3C,8DAAkD;AAElD,kBAAe,CAAC,GAAiB,EAAgB,EAAE;IACjD,IAAI,OAAO,GAAQ,EAAE,CAAA;IACrB,IAAI,SAAS,GAAQ,EAAE,CAAA;IAEvB,0DAA0D;IAC1D,GAAG,GAAG,IAAA,eAAK,EAAC,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;oBAC5D,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;iBACtC;gBACD,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,UAAU,EAAE;oBAC/D,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;iBAC1C;YACH,CAAC;SACF;KACF,CAAC,CAAA;IAEF,yDAAyD;IACzD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;QACxB,MAAM,OAAO,GAAQ,IAAA,2BAAS,EAAC,GAAG,CAAC,CAAA;QACnC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC;YACvB,IAAI,EAAE,sBAAsB;YAC5B,WAAW,EAAE,SAAS;YACtB,IAAI,EAAE,EAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAC;YACpC,UAAU,EAAE,EAAE;YACd,UAAU,EAAE,EAAE;YACd,MAAM,EAAE,EAAE;SACX,CAAC,CAAA;QACF,GAAG,GAAG,OAAO,CAAA;KACd;IAED,2DAA2D;IAC3D,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;QAC1B,MAAM,OAAO,GAAQ,IAAA,2BAAS,EAAC,GAAG,CAAC,CAAA;QACnC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC;YACvB,IAAI,EAAE,sBAAsB;YAC5B,WAAW,EAAE,SAAS;YACtB,IAAI,EAAE,EAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAC;YACvC,UAAU,EAAE,EAAE;YACd,UAAU,EAAE,EAAE;YACd,MAAM,EAAE,EAAE;SACX,CAAC,CAAA;QACF,GAAG,GAAG,OAAO,CAAA;KACd;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/graphql-helpers.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa,CAAC,CAAC,IAAI;IAAC,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAC,CAAA;AAC9E,eAAO,MAAM,SAAS,iCACW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-helpers.js","sourceRoot":"","sources":["../../src/utils/graphql-helpers.ts"],"names":[],"mappings":";;;AACO,MAAM,SAAS,GAAG,CAAI,GAAM,EAAoB,EAAE,CACvD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAA;AADpB,QAAA,SAAS,aACW"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GraphQLSchema } from 'graphql';
|
|
2
|
+
export declare const dedupeTempFolder: (dirpath: string) => string;
|
|
3
|
+
export declare const findNextAvailableSubfolder: (folder: string, name: string) => string;
|
|
4
|
+
export declare const findQueryMutationInSchema: (name: string, files: any) => Boolean;
|
|
5
|
+
export declare const findTypeInSchema: (name: string, files: any) => Boolean;
|
|
6
|
+
export declare const getConfiguration: (directories: string[], silent?: boolean, answers?: any) => Promise<string | boolean>;
|
|
7
|
+
export declare const getExtensions: () => Promise<string>;
|
|
8
|
+
export declare const getSchema: (directory: string, extensions: string) => Promise<GraphQLSchema>;
|
|
9
|
+
export declare const mergeQueryMutationIntoSchema: (type: any, files: any) => any;
|
|
10
|
+
export declare const mergeTypeIntoSchema: (type: any, files: any) => any;
|
|
11
|
+
export declare const removeQueryMutationFromSchema: (name: string, files: any) => any;
|
|
12
|
+
export declare const removeTypeFromSchema: (name: string, files: any) => any;
|
|
13
|
+
//# sourceMappingURL=merge-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/merge-helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,aAAa,EAAQ,MAAM,SAAS,CAAA;AAenD,eAAO,MAAM,gBAAgB,YAAa,MAAM,WAQ/C,CAAA;AAED,eAAO,MAAM,0BAA0B,WAAY,MAAM,QAAQ,MAAM,WAStE,CAAA;AAED,eAAO,MAAM,yBAAyB,SAC9B,MAAM,SACL,GAAG,KACT,OAcF,CAAA;AAED,eAAO,MAAM,gBAAgB,SAAU,MAAM,SAAS,GAAG,KAAG,OAc3D,CAAA;AAED,eAAO,MAAM,gBAAgB,gBACd,MAAM,EAAE,WACb,OAAO,YACN,GAAG,KACX,QAAQ,MAAM,GAAG,OAAO,CA0B1B,CAAA;AAED,eAAO,MAAM,aAAa,QAAa,QAAQ,MAAM,CAoBpD,CAAA;AAED,eAAO,MAAM,SAAS,cACT,MAAM,cACL,MAAM,KACjB,QAAQ,aAAa,CAGvB,CAAA;AAED,eAAO,MAAM,4BAA4B,SAAU,GAAG,SAAS,GAAG,QAiBjE,CAAA;AAED,eAAO,MAAM,mBAAmB,SAAU,GAAG,SAAS,GAAG,QAmBxD,CAAA;AAED,eAAO,MAAM,6BAA6B,SAAU,MAAM,SAAS,GAAG,QAcrE,CAAA;AAED,eAAO,MAAM,oBAAoB,SAAU,MAAM,SAAS,GAAG,QAc5D,CAAA"}
|