@stepzen/transpiler 0.20.1 → 0.21.0-beta.2
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/lib/actions/configure.d.ts +9 -0
- package/lib/actions/configure.d.ts.map +1 -1
- package/lib/actions/configure.js +94 -89
- package/lib/actions/configure.js.map +1 -1
- package/lib/actions/merge.js +8 -2
- package/lib/actions/merge.js.map +1 -1
- package/lib/actions/stitch.js +1 -2
- package/lib/actions/stitch.js.map +1 -1
- package/lib/actions/transpile.d.ts +2 -2
- package/lib/actions/transpile.d.ts.map +1 -1
- package/lib/actions/transpile.js +10 -26
- package/lib/actions/transpile.js.map +1 -1
- package/lib/mutations/config/envvars.d.ts.map +1 -1
- package/lib/mutations/config/envvars.js +10 -1
- package/lib/mutations/config/envvars.js.map +1 -1
- package/lib/utils/constants.d.ts.map +1 -1
- package/lib/utils/constants.js +2 -0
- package/lib/utils/constants.js.map +1 -1
- package/lib/utils/dedupe-query-and-mutation-types.js +8 -2
- package/lib/utils/dedupe-query-and-mutation-types.js.map +1 -1
- package/lib/utils/merge-helpers.js +20 -8
- package/lib/utils/merge-helpers.js.map +1 -1
- package/lib/utils/strip-empty-queries-and-mutations.js +2 -3
- package/lib/utils/strip-empty-queries-and-mutations.js.map +1 -1
- package/lib/validators/config-exists/index.js +4 -7
- package/lib/validators/config-exists/index.js.map +1 -1
- package/package.json +5 -5
- package/src/actions/configure.ts +93 -50
- package/src/actions/transpile.ts +13 -19
- package/src/mutations/config/envvars.ts +17 -1
- package/src/utils/constants.ts +4 -0
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get effective StepZen endpoint configuration for a directory:
|
|
3
|
+
* Traverse the file system starting at `source` and
|
|
4
|
+
* - merge all `config.yaml` files (discarding unrecognized properties)
|
|
5
|
+
* - merge all `config` sections from `stepzen.config.json` files
|
|
6
|
+
*
|
|
7
|
+
* Possibly, interactive: if `silent` is `false` and there are non-empty
|
|
8
|
+
* `config` sections in `stepzen.config.json` files.
|
|
9
|
+
*/
|
|
1
10
|
declare const _default: (source: string, silent?: boolean, answers?: any) => Promise<string | false>;
|
|
2
11
|
export default _default;
|
|
3
12
|
//# sourceMappingURL=configure.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../src/actions/configure.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../src/actions/configure.ts"],"names":[],"mappings":"AAOA;;;;;;;;GAQG;iCAC2B,MAAM,8BAA2B,GAAG;AAAlE,wBA+JC"}
|
package/lib/actions/configure.js
CHANGED
|
@@ -1,129 +1,134 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
3
|
const debug = require("debug");
|
|
5
4
|
const fs = require("fs-extra");
|
|
6
5
|
const glob = require("glob");
|
|
7
6
|
const inquirer = require("inquirer");
|
|
8
7
|
const path = require("path");
|
|
9
8
|
const yaml = require("yaml");
|
|
9
|
+
/**
|
|
10
|
+
* Get effective StepZen endpoint configuration for a directory:
|
|
11
|
+
* Traverse the file system starting at `source` and
|
|
12
|
+
* - merge all `config.yaml` files (discarding unrecognized properties)
|
|
13
|
+
* - merge all `config` sections from `stepzen.config.json` files
|
|
14
|
+
*
|
|
15
|
+
* Possibly, interactive: if `silent` is `false` and there are non-empty
|
|
16
|
+
* `config` sections in `stepzen.config.json` files.
|
|
17
|
+
*/
|
|
10
18
|
exports.default = async (source, silent = false, answers = {}) => {
|
|
11
|
-
|
|
12
|
-
var _c, _d, _e, _f;
|
|
13
|
-
let config = {
|
|
19
|
+
const config = {
|
|
14
20
|
configurationset: [],
|
|
15
21
|
ruleset: [],
|
|
22
|
+
access: undefined,
|
|
23
|
+
deployment: undefined,
|
|
16
24
|
};
|
|
25
|
+
debug('stepzen:transpiler:config')(`getting effective config for ${source}`);
|
|
17
26
|
// Now let's parse and add any config.yamls
|
|
27
|
+
let configYamlCount = 0;
|
|
18
28
|
for (const y of glob.sync('**/config.yaml', { cwd: source })) {
|
|
19
29
|
const filePath = path.join(source, y);
|
|
20
30
|
const file = fs.readFileSync(filePath, 'utf8');
|
|
21
31
|
let asYAML;
|
|
22
32
|
try {
|
|
23
|
-
asYAML = yaml.parse(file);
|
|
33
|
+
asYAML = yaml.parse(file, { schema: 'failsafe' });
|
|
24
34
|
}
|
|
25
35
|
catch (error) {
|
|
26
|
-
debug('stepzen:transpiler')(`
|
|
36
|
+
debug('stepzen:transpiler:config')(`Ignoring an invalid config.yaml ${filePath}.` +
|
|
37
|
+
` YAML parse error: ${error}`);
|
|
27
38
|
continue;
|
|
28
39
|
}
|
|
29
40
|
if (!asYAML) {
|
|
30
|
-
debug('stepzen:transpiler')(`
|
|
41
|
+
debug('stepzen:transpiler:config')(`ignoring an empty config.yaml ${filePath}`);
|
|
31
42
|
continue;
|
|
32
43
|
}
|
|
33
|
-
|
|
34
|
-
debug('stepzen:transpiler')(`
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
configYamlCount += 1;
|
|
45
|
+
debug('stepzen:transpiler:config')(`adding config.yaml ${filePath}:\n${JSON.stringify(asYAML, null, 2)}`);
|
|
46
|
+
// strip away any non-recognized properties
|
|
47
|
+
Object.entries(asYAML).forEach(([keyAsAny, value]) => {
|
|
48
|
+
if (Object.prototype.hasOwnProperty.call(config, keyAsAny)) {
|
|
49
|
+
const key = keyAsAny;
|
|
50
|
+
config[key] = Array.isArray(config[key])
|
|
51
|
+
? config[key].concat(value)
|
|
52
|
+
: value;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
debug('stepzen:transpiler:config')(`ignoring unrecognized config property ${keyAsAny}`);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
41
58
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
answer = await inquirer.prompt(Object.assign({ type: 'password' }, question));
|
|
66
|
-
}
|
|
67
|
-
const configset = {
|
|
68
|
-
configuration: {
|
|
69
|
-
name,
|
|
70
|
-
[key]: answer[name][key],
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
debug('stepzen:transpiler')(`Question: ${JSON.stringify(question, null, 2)}`);
|
|
74
|
-
debug('stepzen:transpiler')(`Answer: ${JSON.stringify(configset, null, 2)}`);
|
|
75
|
-
config.configurationset.push(Object.assign({}, configset));
|
|
76
|
-
}
|
|
59
|
+
debug('stepzen:transpiler:config')(`done adding **/config.yaml files (processed: ${configYamlCount})`);
|
|
60
|
+
// Now let's build configs from questions
|
|
61
|
+
let configJsonCount = 0;
|
|
62
|
+
for await (const j of glob.sync('**/stepzen.config.json', {
|
|
63
|
+
cwd: source,
|
|
64
|
+
})) {
|
|
65
|
+
const filePath = path.join(source, j);
|
|
66
|
+
const file = fs.readFileSync(filePath, 'utf8');
|
|
67
|
+
const asJSON = JSON.parse(file);
|
|
68
|
+
configJsonCount += 1;
|
|
69
|
+
debug('stepzen:transpiler:config')(`adding stepzen.config.json ${filePath}:` +
|
|
70
|
+
`\n${JSON.stringify(asJSON, null, 2)}`);
|
|
71
|
+
if (asJSON.config?.questions) {
|
|
72
|
+
for await (const question of asJSON.config?.questions) {
|
|
73
|
+
const [name, key] = question.name.split('.');
|
|
74
|
+
let answer = {};
|
|
75
|
+
if (silent) {
|
|
76
|
+
answer = {
|
|
77
|
+
[name]: { [key]: answers[name]?.[key] ? answers[name]?.[key] : '' },
|
|
78
|
+
};
|
|
77
79
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
finally { if (e_2) throw e_2.error; }
|
|
80
|
+
else {
|
|
81
|
+
answer = await inquirer.prompt({
|
|
82
|
+
type: 'password',
|
|
83
|
+
...question,
|
|
84
|
+
});
|
|
84
85
|
}
|
|
86
|
+
const configset = {
|
|
87
|
+
configuration: {
|
|
88
|
+
name,
|
|
89
|
+
[key]: answer[name][key],
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
debug('stepzen:transpiler:config')(`question: ${JSON.stringify(question, null, 2)}`);
|
|
93
|
+
debug('stepzen:transpiler:config')(`answer: ${JSON.stringify(configset, null, 2)}`);
|
|
94
|
+
config.configurationset.push({ ...configset });
|
|
85
95
|
}
|
|
86
96
|
}
|
|
87
97
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (_h && !_h.done && (_a = _g.return)) await _a.call(_g);
|
|
92
|
-
}
|
|
93
|
-
finally { if (e_1) throw e_1.error; }
|
|
94
|
-
}
|
|
95
|
-
debug('stepzen:transpiler')(`Configuration: ${JSON.stringify(config, null, 2)}`);
|
|
98
|
+
debug('stepzen:transpiler:config')(`done adding **/stepzen.config.json files (processed: ${configJsonCount})`);
|
|
99
|
+
debug('stepzen:transpiler:config')(`combined content of all config files:` +
|
|
100
|
+
`\n${JSON.stringify(config, null, 2)}`);
|
|
96
101
|
// OK now let's collate everything into shared configurations
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
const configurationset = [];
|
|
103
|
+
{
|
|
104
|
+
const obj = {};
|
|
105
|
+
for (const c of config.configurationset) {
|
|
106
|
+
const name = c.configuration.name;
|
|
107
|
+
if (!obj[name])
|
|
108
|
+
obj[name] = {};
|
|
109
|
+
for (const [key, value] of Object.entries(c.configuration)) {
|
|
110
|
+
if (key === name)
|
|
111
|
+
continue;
|
|
112
|
+
obj[name][key] = value;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
for (const configuration of Object.keys(obj)) {
|
|
116
|
+
configurationset.push({
|
|
117
|
+
configuration: { ...obj[configuration] },
|
|
118
|
+
});
|
|
106
119
|
}
|
|
107
120
|
}
|
|
108
121
|
// Now convert back into StepZen format
|
|
109
|
-
const structured = {
|
|
110
|
-
configurationset: [],
|
|
111
|
-
ruleset: [],
|
|
112
|
-
};
|
|
113
|
-
for (const configuration of Object.keys(obj)) {
|
|
114
|
-
structured.configurationset.push({
|
|
115
|
-
configuration: Object.assign({}, obj[configuration]),
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
structured.ruleset = [...config.ruleset];
|
|
122
|
+
const structured = Object.fromEntries(Object.entries({ ...config, configurationset }).filter(([_key, value]) => Array.isArray(value) ? value.length > 0 : value !== undefined));
|
|
119
123
|
// Return YAML, if appropriate
|
|
120
|
-
if (structured.
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if (structured.configurationset || structured.ruleset) {
|
|
125
|
-
return yaml.stringify(structured);
|
|
124
|
+
if (Object.keys(structured).length > 0) {
|
|
125
|
+
const configYamlStr = yaml.stringify(structured);
|
|
126
|
+
debug('stepzen:transpiler:config')(`effective config:\n${configYamlStr}`);
|
|
127
|
+
return configYamlStr;
|
|
126
128
|
}
|
|
129
|
+
debug('stepzen:transpiler:config')(`Could not find any of the supported properties in the config:` +
|
|
130
|
+
` [ '${Object.keys(config).join(`', '`)}' ].` +
|
|
131
|
+
` Retuning 'false' meaning 'effective config is empty'.`);
|
|
127
132
|
return false;
|
|
128
133
|
};
|
|
129
134
|
//# sourceMappingURL=configure.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure.js","sourceRoot":"","sources":["../../src/actions/configure.ts"],"names":[],"mappings":"
|
|
1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CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,CAC9D,CACF,CAAA;IAED,8BAA8B;IAC9B,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;QACtC,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;QAChD,KAAK,CAAC,2BAA2B,CAAC,CAAC,sBAAsB,aAAa,EAAE,CAAC,CAAA;QACzE,OAAO,aAAa,CAAA;KACrB;IAED,KAAK,CAAC,2BAA2B,CAAC,CAChC,+DAA+D;QAC7D,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;QAC7C,wDAAwD,CAC3D,CAAA;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA"}
|
package/lib/actions/merge.js
CHANGED
|
@@ -115,10 +115,16 @@ exports.default = async (original, imported, options = {
|
|
|
115
115
|
// Clean up the files. Remove empty Query / Mutation types, filter out now-empty files
|
|
116
116
|
const cleaned = {
|
|
117
117
|
original: details.original
|
|
118
|
-
.map(item => (
|
|
118
|
+
.map(item => ({
|
|
119
|
+
...item,
|
|
120
|
+
ast: (0, strip_empty_queries_and_mutations_1.default)(item.ast),
|
|
121
|
+
}))
|
|
119
122
|
.filter(item => item.ast.definitions.length > 0),
|
|
120
123
|
imported: details.imported
|
|
121
|
-
.map(item => (
|
|
124
|
+
.map(item => ({
|
|
125
|
+
...item,
|
|
126
|
+
ast: (0, strip_empty_queries_and_mutations_1.default)(item.ast),
|
|
127
|
+
}))
|
|
122
128
|
.filter(item => item.ast.definitions.length > 0),
|
|
123
129
|
};
|
|
124
130
|
// Write the files to the output directory
|
package/lib/actions/merge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../../src/actions/merge.ts"],"names":[],"mappings":";;AAAA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AA;KACH;SAAM;QACL,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,EAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,EAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;YACvE,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;YACjE,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAC9B,OAAO,CAAC,MAAO,EACf,eAAe,EACf,YAAY,CACb,CAAA;YACD,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAA;YAC9C,EAAE,CAAC,YAAY,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAA;QACnD,CAAC,CAAC,CAAA;KACH;IAED,6CAA6C;IAC7C,IAAA,0BAAa,EAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IAE7B,yBAAyB;IACzB,MAAM,MAAM,GAAG,MAAM,IAAA,gCAAgB,EACnC,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,EACjC,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,OAAO,CAChB,CAAA;IACD,IAAI,MAAM,EAAE;QACV,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;QAC3D,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,MAAgB,CAAC,CAAA;KAC/C;IAED,0BAA0B;IAC1B,OAAO,OAAO,CAAC,MAAM,CAAA;AACvB,CAAC,CAAA"}
|
package/lib/actions/stitch.js
CHANGED
|
@@ -23,9 +23,8 @@ exports.default = (source, output = path.join(os.tmpdir(), `stepzen-tmp-${Date.n
|
|
|
23
23
|
ast = (0, graphql_1.parse)(index);
|
|
24
24
|
ast = (0, graphql_1.visit)(ast, {
|
|
25
25
|
Directive(node) {
|
|
26
|
-
var _a;
|
|
27
26
|
if (node.name.value === 'sdl') {
|
|
28
|
-
const list =
|
|
27
|
+
const list = node.arguments?.find((arg) => arg.name.value === 'files');
|
|
29
28
|
// If we find a 'files' argument, we copy the list, and remove the argument
|
|
30
29
|
if (list) {
|
|
31
30
|
const copy = (0, lodash_1.clone)(list.value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stitch.js","sourceRoot":"","sources":["../../src/actions/stitch.ts"],"names":[],"mappings":";;AAAA,mCAAuC;AACvC,qCAA2C;AAC3C,+BAA8B;AAC9B,6BAA4B;AAC5B,yBAAwB;AACxB,6BAA4B;AAC5B,qCAAoC;AAEpC,8FAAkF;AAElF,kBAAe,CACb,MAAc,EACd,SAAiB,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,eAAe,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,EACpE,EAAE;IACF,6CAA6C;IAC7C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,gCAAgC,MAAM,EAAE,CAAC,CAAA;IAC3D,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;IAExB,uBAAuB;IACvB,IAAI,GAAQ,CAAA;IACZ,IAAI,KAAK,GAAa,EAAE,CAAA;IAExB,qEAAqE;IACrE,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAEtD,IAAI,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;QAC9B,MAAM,KAAK,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;QAClD,GAAG,GAAG,IAAA,eAAK,EAAC,KAAK,CAAC,CAAA;QAClB,GAAG,GAAG,IAAA,eAAK,EAAC,GAAG,EAAE;YACf,SAAS,CAAC,IAAI
|
|
1
|
+
{"version":3,"file":"stitch.js","sourceRoot":"","sources":["../../src/actions/stitch.ts"],"names":[],"mappings":";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mappings":"
|
|
1
|
+
{"version":3,"file":"transpile.d.ts","sourceRoot":"","sources":["../../src/actions/transpile.ts"],"names":[],"mappings":"iCAa8B,MAAM;;;;;AAApC,wBAkDC"}
|
package/lib/actions/transpile.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
3
|
const graphql_1 = require("graphql");
|
|
5
4
|
const dotenv = require("dotenv");
|
|
5
|
+
const debug = require("debug");
|
|
6
6
|
const fs = require("fs");
|
|
7
7
|
const glob = require("glob");
|
|
8
8
|
const path = require("path");
|
|
@@ -11,33 +11,24 @@ const stitch_1 = require("../actions/stitch");
|
|
|
11
11
|
const configure_1 = require("./configure");
|
|
12
12
|
const config_1 = require("../mutations/config");
|
|
13
13
|
exports.default = async (source) => {
|
|
14
|
-
var e_1, _a;
|
|
15
14
|
// Ensure source and output directories exist
|
|
16
15
|
if (!fs.existsSync(source)) {
|
|
17
16
|
throw new Error(`Cannot find source directory ${source}`);
|
|
18
17
|
}
|
|
19
18
|
// Load env vars, from working and source directories
|
|
19
|
+
debug('stepzen:dotenv')(`loading .env from ${process.cwd()}, at transpiler/src/actions/transpile.ts:24`);
|
|
20
20
|
dotenv.config();
|
|
21
|
+
debug('stepzen:dotenv')(`loading .env from ${path.resolve(source)}` +
|
|
22
|
+
`, at transpiler/src/actions/transpile.ts:29`);
|
|
21
23
|
dotenv.config({ path: path.resolve(source, '.env') });
|
|
22
24
|
// State of whether we've transpiled or not
|
|
23
25
|
let transpiledConfig = false;
|
|
24
|
-
let transpiledGraphQL = false;
|
|
25
26
|
// See whether to transpile config
|
|
26
27
|
let config = await (0, configure_1.default)(source, true);
|
|
27
28
|
const configCopy = config;
|
|
28
29
|
if (config) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const mutation = configMutations_1_1.value;
|
|
32
|
-
config = await mutation(config);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
36
|
-
finally {
|
|
37
|
-
try {
|
|
38
|
-
if (configMutations_1_1 && !configMutations_1_1.done && (_a = configMutations_1.return)) await _a.call(configMutations_1);
|
|
39
|
-
}
|
|
40
|
-
finally { if (e_1) throw e_1.error; }
|
|
30
|
+
for await (const mutation of config_1.default) {
|
|
31
|
+
config = await mutation(config);
|
|
41
32
|
}
|
|
42
33
|
}
|
|
43
34
|
if (configCopy !== config) {
|
|
@@ -45,24 +36,17 @@ exports.default = async (source) => {
|
|
|
45
36
|
}
|
|
46
37
|
// See whether to transpile GraphQL
|
|
47
38
|
const graphqlFiles = glob.sync('**/*.graphql', { cwd: source });
|
|
48
|
-
let
|
|
49
|
-
let mutated = '';
|
|
39
|
+
let schema = '';
|
|
50
40
|
if (graphqlFiles.length > 0) {
|
|
51
41
|
const stitched = await (0, stitch_1.default)(source);
|
|
52
42
|
const index = path.join(stitched, 'index.graphql');
|
|
53
43
|
const graphql = fs.readFileSync(index, 'utf8');
|
|
54
|
-
|
|
55
|
-
original = (0, graphql_1.parse)(graphql);
|
|
56
|
-
// you can transpile schema ast here
|
|
57
|
-
mutated = (0, print_1.default)(ast);
|
|
58
|
-
if ((0, print_1.default)(original) !== mutated) {
|
|
59
|
-
transpiledGraphQL = true;
|
|
60
|
-
}
|
|
44
|
+
schema = (0, print_1.default)((0, graphql_1.parse)(graphql));
|
|
61
45
|
}
|
|
62
46
|
return {
|
|
63
47
|
config,
|
|
64
|
-
schema
|
|
65
|
-
transpiled: transpiledConfig
|
|
48
|
+
schema,
|
|
49
|
+
transpiled: transpiledConfig,
|
|
66
50
|
};
|
|
67
51
|
};
|
|
68
52
|
//# sourceMappingURL=transpile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transpile.js","sourceRoot":"","sources":["../../src/actions/transpile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transpile.js","sour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AAE,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envvars.d.ts","sourceRoot":"","sources":["../../../src/mutations/config/envvars.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"envvars.d.ts","sourceRoot":"","sources":["../../../src/mutations/config/envvars.ts"],"names":[],"mappings":"iCAE8B,MAAM,KAAG,QAAQ,MAAM,CAAC;AAAtD,wBA8BC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const debug = require("debug");
|
|
3
4
|
exports.default = async (config) => {
|
|
4
5
|
const envvars = Object.keys(process.env)
|
|
5
6
|
.filter(key => {
|
|
@@ -9,10 +10,18 @@ exports.default = async (config) => {
|
|
|
9
10
|
obj[key] = process.env[key];
|
|
10
11
|
return obj;
|
|
11
12
|
}, {});
|
|
13
|
+
let replacements = 0;
|
|
14
|
+
debug('stepzen:transpiler:config')(`STEPZEN_* env vars available for replacement:` +
|
|
15
|
+
` ${JSON.stringify(envvars, undefined, 2)}`);
|
|
12
16
|
for (const [key, value] of Object.entries(envvars)) {
|
|
13
17
|
const regex = new RegExp(key, 'g');
|
|
14
|
-
config = config.replace(regex,
|
|
18
|
+
config = config.replace(regex, (match, offset) => {
|
|
19
|
+
replacements += 1;
|
|
20
|
+
debug('stepzen:transpiler:config')(`replacing ${match} at offset ${offset}`);
|
|
21
|
+
return `${value}`;
|
|
22
|
+
});
|
|
15
23
|
}
|
|
24
|
+
debug('stepzen:transpiler:config')(`total replacements made: ${replacements}`);
|
|
16
25
|
return config;
|
|
17
26
|
};
|
|
18
27
|
//# sourceMappingURL=envvars.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envvars.js","sourceRoot":"","sources":["../../../src/mutations/config/envvars.ts"],"names":[],"mappings":";;AAAA,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,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,GAAG,KAAK,EAAE,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"envvars.js","sourceRoot":"","sources":["../../../src/mutations/config/envvars.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAE9B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appings":"
|
|
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"}
|
package/lib/utils/constants.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.STEPZEN_DOMAIN = exports.EXPERIMENTAL_EXTENSIONS = void 0;
|
|
4
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`);
|
|
5
7
|
dotenv.config();
|
|
6
8
|
const { STEPZEN_DOMAIN: ENV_VAR_STEPZEN_DOMAIN } = process.env;
|
|
7
9
|
exports.EXPERIMENTAL_EXTENSIONS = `
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":";;;AAAA,iCAAgC;
|
|
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"}
|
|
@@ -45,7 +45,10 @@ exports.default = (schema) => {
|
|
|
45
45
|
// with all the concatenated queries
|
|
46
46
|
if (queries.length > 0) {
|
|
47
47
|
const mutated = (0, graphql_helpers_1.cloneDeep)(ast);
|
|
48
|
-
const query =
|
|
48
|
+
const query = {
|
|
49
|
+
...queryTemplate,
|
|
50
|
+
fields: queries,
|
|
51
|
+
};
|
|
49
52
|
mutated.definitions.push(query);
|
|
50
53
|
ast = mutated;
|
|
51
54
|
}
|
|
@@ -53,7 +56,10 @@ exports.default = (schema) => {
|
|
|
53
56
|
// with all the concatenated mutations
|
|
54
57
|
if (mutations.length > 0) {
|
|
55
58
|
const mutated = (0, graphql_helpers_1.cloneDeep)(ast);
|
|
56
|
-
const query =
|
|
59
|
+
const query = {
|
|
60
|
+
...mutationTemplate,
|
|
61
|
+
fields: mutations,
|
|
62
|
+
};
|
|
57
63
|
mutated.definitions.push(query);
|
|
58
64
|
ast = mutated;
|
|
59
65
|
}
|
|
@@ -1 +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,
|
|
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,EA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AAC,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"}
|
|
@@ -102,7 +102,9 @@ const getSchema = async (directory) => {
|
|
|
102
102
|
exports.getSchema = getSchema;
|
|
103
103
|
const mergeQueryMutationIntoSchema = (type, files) => {
|
|
104
104
|
files = files.map((file) => {
|
|
105
|
-
return
|
|
105
|
+
return {
|
|
106
|
+
...file,
|
|
107
|
+
ast: (0, graphql_1.visit)(file.ast, {
|
|
106
108
|
FieldDefinition(node) {
|
|
107
109
|
if (node.name.value === type.name.value) {
|
|
108
110
|
const directives = (0, graphql_helpers_1.cloneDeep)(type.directives);
|
|
@@ -111,14 +113,17 @@ const mergeQueryMutationIntoSchema = (type, files) => {
|
|
|
111
113
|
return mutated;
|
|
112
114
|
}
|
|
113
115
|
},
|
|
114
|
-
})
|
|
116
|
+
}),
|
|
117
|
+
};
|
|
115
118
|
});
|
|
116
119
|
return files;
|
|
117
120
|
};
|
|
118
121
|
exports.mergeQueryMutationIntoSchema = mergeQueryMutationIntoSchema;
|
|
119
122
|
const mergeTypeIntoSchema = (type, files) => {
|
|
120
123
|
files = files.map((file) => {
|
|
121
|
-
return
|
|
124
|
+
return {
|
|
125
|
+
...file,
|
|
126
|
+
ast: (0, graphql_1.visit)(file.ast, {
|
|
122
127
|
ObjectTypeDefinition(node) {
|
|
123
128
|
if (node.name.value === type.name.value) {
|
|
124
129
|
const directives = (0, graphql_helpers_1.cloneDeep)(type.directives);
|
|
@@ -129,33 +134,40 @@ const mergeTypeIntoSchema = (type, files) => {
|
|
|
129
134
|
return mutated;
|
|
130
135
|
}
|
|
131
136
|
},
|
|
132
|
-
})
|
|
137
|
+
}),
|
|
138
|
+
};
|
|
133
139
|
});
|
|
134
140
|
return files;
|
|
135
141
|
};
|
|
136
142
|
exports.mergeTypeIntoSchema = mergeTypeIntoSchema;
|
|
137
143
|
const removeQueryMutationFromSchema = (name, files) => {
|
|
138
144
|
files = files.map((file) => {
|
|
139
|
-
return
|
|
145
|
+
return {
|
|
146
|
+
...file,
|
|
147
|
+
ast: (0, graphql_1.visit)(file.ast, {
|
|
140
148
|
FieldDefinition(node) {
|
|
141
149
|
if (node.name.value === name) {
|
|
142
150
|
return null;
|
|
143
151
|
}
|
|
144
152
|
},
|
|
145
|
-
})
|
|
153
|
+
}),
|
|
154
|
+
};
|
|
146
155
|
});
|
|
147
156
|
return files;
|
|
148
157
|
};
|
|
149
158
|
exports.removeQueryMutationFromSchema = removeQueryMutationFromSchema;
|
|
150
159
|
const removeTypeFromSchema = (name, files) => {
|
|
151
160
|
files = files.map((file) => {
|
|
152
|
-
return
|
|
161
|
+
return {
|
|
162
|
+
...file,
|
|
163
|
+
ast: (0, graphql_1.visit)(file.ast, {
|
|
153
164
|
ObjectTypeDefinition(node) {
|
|
154
165
|
if (node.name.value === name) {
|
|
155
166
|
return null;
|
|
156
167
|
}
|
|
157
168
|
},
|
|
158
|
-
})
|
|
169
|
+
}),
|
|
170
|
+
};
|
|
159
171
|
});
|
|
160
172
|
return files;
|
|
161
173
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-helpers.js","sourceRoot":"","sources":["../../src/utils/merge-helpers.ts"],"names":[],"mappings":";;;AAAA,qCAAmD;AACnD,iDAA6C;AAC7C,2CAA8B;AAC9B,+BAA8B;AAC9B,6BAA4B;AAC5B,yBAAwB;AACxB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E;IAC/D,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE;QAC9B,OAAO;YACL,GAAG,IAAI;YACP,GAAG,EAAE,IAAA,eAAK,EAAC,IAAI,CAAC,GAAG,EAAE;gBACnB,oBAAoB,CAAC,IAAI;oBACvB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,EAAE;wBAC5B,OAAO,IAAI,CAAA;qBACZ;gBACH,CAAC;aACF,CAAC;SACH,CAAA;IACH,CAAC,CAAC,CAAA;IACF,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAdY,QAAA,oBAAoB,wBAchC"}
|
|
@@ -28,13 +28,12 @@ exports.default = (ast) => {
|
|
|
28
28
|
ast = (0, graphql_1.visit)(ast, {
|
|
29
29
|
ObjectTypeDefinition: {
|
|
30
30
|
enter(node) {
|
|
31
|
-
var _a, _b;
|
|
32
31
|
if (node.name.kind === 'Name' && node.name.value === 'Query') {
|
|
33
|
-
if (
|
|
32
|
+
if (node.fields?.length === 0)
|
|
34
33
|
return null;
|
|
35
34
|
}
|
|
36
35
|
if (node.name.kind === 'Name' && node.name.value === 'Mutation') {
|
|
37
|
-
if (
|
|
36
|
+
if (node.fields?.length === 0)
|
|
38
37
|
return null;
|
|
39
38
|
}
|
|
40
39
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strip-empty-queries-and-mutations.js","sourceRoot":"","sources":["../../src/utils/strip-empty-queries-and-mutations.ts"],"names":[],"mappings":";;AAAA,qCAA2C;AAE3C,uDAA2C;AAE3C,kBAAe,CAAC,GAAiB,EAAgB,EAAE;IACjD,iEAAiE;IACjE,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,MAAM,OAAO,GAAQ,IAAA,2BAAS,EAAC,IAAI,CAAC,CAAA;oBACpC,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAU,EAAE,EAAE;wBACpD,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,CAAA;oBACvC,CAAC,CAAC,CAAA;oBACF,OAAO,OAAO,CAAA;iBACf;gBACD,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,UAAU,EAAE;oBAC/D,MAAM,OAAO,GAAQ,IAAA,2BAAS,EAAC,IAAI,CAAC,CAAA;oBACpC,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAU,EAAE,EAAE;wBACpD,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,WAAW,CAAA;oBACzC,CAAC,CAAC,CAAA;oBACF,OAAO,OAAO,CAAA;iBACf;YACH,CAAC;SACF;KACF,CAAC,CAAA;IAEF,gDAAgD;IAChD,GAAG,GAAG,IAAA,eAAK,EAAC,GAAG,EAAE;QACf,oBAAoB,EAAE;YACpB,KAAK,CAAC,IAAI
|
|
1
|
+
{"version":3,"file":"strip-empty-queries-and-mutations.js","sourceRoot":"","sources":["../../src/utils/strip-empty-queries-and-mutations.ts"],"names":[],"mappings":";;AAAA,qCAA2C;AAE3C,uDAA2C;AAE3C,kBAAe,CAAC,GAAiB,EAAgB,EAAE;IACjD,iEAAiE;IACjE,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,MAAM,OAAO,GAAQ,IAAA,2BAAS,EAAC,IAA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13,11 @@ const STEPZEN_DEFAULTS = [
|
|
|
13
13
|
'ups_default',
|
|
14
14
|
];
|
|
15
15
|
exports.default = (ast, source) => {
|
|
16
|
-
var _a;
|
|
17
16
|
let configs = [];
|
|
18
17
|
(0, graphql_1.visit)(ast, {
|
|
19
18
|
Argument(node) {
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
const value = (_b = node.value) === null || _b === void 0 ? void 0 : _b.value;
|
|
19
|
+
const name = node.name?.value;
|
|
20
|
+
const value = node.value?.value;
|
|
23
21
|
if (name === 'configuration') {
|
|
24
22
|
configs = configs.concat(value);
|
|
25
23
|
}
|
|
@@ -35,9 +33,8 @@ exports.default = (ast, source) => {
|
|
|
35
33
|
const content = fs.readFileSync(sourceConfig, 'utf8');
|
|
36
34
|
const asYaml = yaml.parse(content);
|
|
37
35
|
for (const config of configs) {
|
|
38
|
-
const found =
|
|
39
|
-
|
|
40
|
-
return ((_a = c === null || c === void 0 ? void 0 : c.configuration) === null || _a === void 0 ? void 0 : _a.name) === config;
|
|
36
|
+
const found = asYaml?.configurationset?.find((c) => {
|
|
37
|
+
return c?.configuration?.name === config;
|
|
41
38
|
});
|
|
42
39
|
if (!found) {
|
|
43
40
|
throw new Error(`Could not find configuration item for "${config}"`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/validators/config-exists/index.ts"],"names":[],"mappings":";;AAAA,qCAA2C;AAC3C,mCAAmC;AACnC,yBAAwB;AACxB,6BAA4B;AAC5B,6BAA4B;AAE5B,MAAM,gBAAgB,GAAG;IACvB,eAAe;IACf,oBAAoB;IACpB,eAAe;IACf,aAAa;IACb,aAAa;CACd,CAAA;AAED,kBAAe,CAAC,GAAiB,EAAE,MAAc,EAAE,EAAE
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/validators/config-exists/index.ts"],"names":[],"mappings":";;AAAA,qCAA2C;AAC3C,mCAAmC;AACnC,yBAAwB;A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ACtD,OAAO,CAAC,EAAE,aAAa,EAAE,IAAI,KAAK,MAAM,CAAA;YAC1C,CAAC,CAAC,CAAA;YAEF,IAAI,CAAC,KAAK,EAAE;gBACV,MAAM,IAAI,KAAK,CAAC,0CAA0C,MAAM,GAAG,CAAC,CAAA;aACrE;SACF;KACF;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stepzen/transpiler",
|
|
3
3
|
"description": "The StepZen transpiler",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.21.0-beta.2",
|
|
5
5
|
"author": "Darren Waddell <darren@stepzen.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"files": [
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"debug": "^4.3.4",
|
|
26
26
|
"dotenv": "^10.0.0",
|
|
27
27
|
"fs-extra": "^9.1.0",
|
|
28
|
-
"glob": "^7.2.
|
|
28
|
+
"glob": "^7.2.3",
|
|
29
29
|
"graphql": "^15.8.0",
|
|
30
|
-
"inquirer": "^8.2.
|
|
30
|
+
"inquirer": "^8.2.4",
|
|
31
31
|
"lodash": "^4.17.21",
|
|
32
32
|
"node-fetch": "^2.6.7",
|
|
33
|
-
"prettier": "^2.
|
|
33
|
+
"prettier": "^2.7.1",
|
|
34
34
|
"shelljs": "^0.8.5",
|
|
35
35
|
"yaml": "^1.10.2"
|
|
36
36
|
},
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"nyc": "^14.1.1",
|
|
54
54
|
"ts-node": "^10.8.2"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "58b85cc37fa990639bf7170d4224cf51cc1f7ad1"
|
|
57
57
|
}
|
package/src/actions/configure.ts
CHANGED
|
@@ -5,47 +5,75 @@ import * as inquirer from 'inquirer'
|
|
|
5
5
|
import * as path from 'path'
|
|
6
6
|
import * as yaml from 'yaml'
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Get effective StepZen endpoint configuration for a directory:
|
|
10
|
+
* Traverse the file system starting at `source` and
|
|
11
|
+
* - merge all `config.yaml` files (discarding unrecognized properties)
|
|
12
|
+
* - merge all `config` sections from `stepzen.config.json` files
|
|
13
|
+
*
|
|
14
|
+
* Possibly, interactive: if `silent` is `false` and there are non-empty
|
|
15
|
+
* `config` sections in `stepzen.config.json` files.
|
|
16
|
+
*/
|
|
8
17
|
export default async (source: string, silent = false, answers: any = {}) => {
|
|
9
|
-
|
|
10
|
-
configurationset: [],
|
|
11
|
-
ruleset: [],
|
|
18
|
+
const config = {
|
|
19
|
+
configurationset: [] as any[],
|
|
20
|
+
ruleset: [] as any[],
|
|
21
|
+
access: undefined as any,
|
|
22
|
+
deployment: undefined as any,
|
|
12
23
|
}
|
|
13
24
|
|
|
25
|
+
debug('stepzen:transpiler:config')(`getting effective config for ${source}`)
|
|
26
|
+
|
|
14
27
|
// Now let's parse and add any config.yamls
|
|
28
|
+
let configYamlCount = 0
|
|
15
29
|
for (const y of glob.sync('**/config.yaml', {cwd: source})) {
|
|
16
30
|
const filePath = path.join(source, y)
|
|
17
31
|
|
|
18
32
|
const file = fs.readFileSync(filePath, 'utf8')
|
|
19
33
|
let asYAML
|
|
20
34
|
try {
|
|
21
|
-
asYAML = yaml.parse(file)
|
|
35
|
+
asYAML = yaml.parse(file, {schema: 'failsafe'})
|
|
22
36
|
} catch (error) {
|
|
23
|
-
debug('stepzen:transpiler')(
|
|
24
|
-
`
|
|
37
|
+
debug('stepzen:transpiler:config')(
|
|
38
|
+
`Ignoring an invalid config.yaml ${filePath}.` +
|
|
39
|
+
` YAML parse error: ${error}`,
|
|
25
40
|
)
|
|
26
41
|
continue
|
|
27
42
|
}
|
|
28
43
|
|
|
29
44
|
if (!asYAML) {
|
|
30
|
-
debug('stepzen:transpiler')(
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
debug('stepzen:transpiler')(`Adding config.yaml ${filePath}`)
|
|
35
|
-
debug('stepzen:transpiler')(`Contents: ${JSON.stringify(asYAML, null, 2)}`)
|
|
36
|
-
|
|
37
|
-
if (asYAML.configurationset) {
|
|
38
|
-
config.configurationset = config.configurationset.concat(
|
|
39
|
-
asYAML.configurationset,
|
|
45
|
+
debug('stepzen:transpiler:config')(
|
|
46
|
+
`ignoring an empty config.yaml ${filePath}`,
|
|
40
47
|
)
|
|
48
|
+
continue
|
|
41
49
|
}
|
|
42
50
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
51
|
+
configYamlCount += 1
|
|
52
|
+
debug('stepzen:transpiler:config')(
|
|
53
|
+
`adding config.yaml ${filePath}:\n${JSON.stringify(asYAML, null, 2)}`,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
// strip away any non-recognized properties
|
|
57
|
+
Object.entries(asYAML).forEach(([keyAsAny, value]) => {
|
|
58
|
+
if (Object.prototype.hasOwnProperty.call(config, keyAsAny)) {
|
|
59
|
+
const key = keyAsAny as keyof typeof config
|
|
60
|
+
config[key] = Array.isArray(config[key])
|
|
61
|
+
? config[key].concat(value)
|
|
62
|
+
: value
|
|
63
|
+
} else {
|
|
64
|
+
debug('stepzen:transpiler:config')(
|
|
65
|
+
`ignoring unrecognized config property ${keyAsAny}`,
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
})
|
|
46
69
|
}
|
|
47
70
|
|
|
71
|
+
debug('stepzen:transpiler:config')(
|
|
72
|
+
`done adding **/config.yaml files (processed: ${configYamlCount})`,
|
|
73
|
+
)
|
|
74
|
+
|
|
48
75
|
// Now let's build configs from questions
|
|
76
|
+
let configJsonCount = 0
|
|
49
77
|
for await (const j of glob.sync('**/stepzen.config.json', {
|
|
50
78
|
cwd: source,
|
|
51
79
|
})) {
|
|
@@ -54,8 +82,11 @@ export default async (source: string, silent = false, answers: any = {}) => {
|
|
|
54
82
|
const file = fs.readFileSync(filePath, 'utf8')
|
|
55
83
|
const asJSON = JSON.parse(file)
|
|
56
84
|
|
|
57
|
-
|
|
58
|
-
debug('stepzen:transpiler')(
|
|
85
|
+
configJsonCount += 1
|
|
86
|
+
debug('stepzen:transpiler:config')(
|
|
87
|
+
`adding stepzen.config.json ${filePath}:` +
|
|
88
|
+
`\n${JSON.stringify(asJSON, null, 2)}`,
|
|
89
|
+
)
|
|
59
90
|
|
|
60
91
|
if (asJSON.config?.questions) {
|
|
61
92
|
for await (const question of asJSON.config?.questions) {
|
|
@@ -81,11 +112,11 @@ export default async (source: string, silent = false, answers: any = {}) => {
|
|
|
81
112
|
},
|
|
82
113
|
}
|
|
83
114
|
|
|
84
|
-
debug('stepzen:transpiler')(
|
|
85
|
-
`
|
|
115
|
+
debug('stepzen:transpiler:config')(
|
|
116
|
+
`question: ${JSON.stringify(question, null, 2)}`,
|
|
86
117
|
)
|
|
87
|
-
debug('stepzen:transpiler')(
|
|
88
|
-
`
|
|
118
|
+
debug('stepzen:transpiler:config')(
|
|
119
|
+
`answer: ${JSON.stringify(configset, null, 2)}`,
|
|
89
120
|
)
|
|
90
121
|
|
|
91
122
|
config.configurationset.push({...configset})
|
|
@@ -93,41 +124,53 @@ export default async (source: string, silent = false, answers: any = {}) => {
|
|
|
93
124
|
}
|
|
94
125
|
}
|
|
95
126
|
|
|
96
|
-
debug('stepzen:transpiler')(
|
|
97
|
-
`
|
|
127
|
+
debug('stepzen:transpiler:config')(
|
|
128
|
+
`done adding **/stepzen.config.json files (processed: ${configJsonCount})`,
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
debug('stepzen:transpiler:config')(
|
|
132
|
+
`combined content of all config files:` +
|
|
133
|
+
`\n${JSON.stringify(config, null, 2)}`,
|
|
98
134
|
)
|
|
99
135
|
|
|
100
136
|
// OK now let's collate everything into shared configurations
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (
|
|
107
|
-
|
|
137
|
+
const configurationset = []
|
|
138
|
+
{
|
|
139
|
+
const obj: any = {}
|
|
140
|
+
for (const c of config.configurationset) {
|
|
141
|
+
const name = c.configuration.name
|
|
142
|
+
if (!obj[name]) obj[name] = {}
|
|
143
|
+
for (const [key, value] of Object.entries(c.configuration)) {
|
|
144
|
+
if (key === name) continue
|
|
145
|
+
obj[name][key] = value
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
for (const configuration of Object.keys(obj)) {
|
|
150
|
+
configurationset.push({
|
|
151
|
+
configuration: {...obj[configuration]},
|
|
152
|
+
})
|
|
108
153
|
}
|
|
109
154
|
}
|
|
110
155
|
|
|
111
156
|
// Now convert back into StepZen format
|
|
112
|
-
const structured
|
|
113
|
-
configurationset
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
structured.configurationset.push({
|
|
118
|
-
configuration: {...obj[configuration]},
|
|
119
|
-
})
|
|
120
|
-
}
|
|
121
|
-
structured.ruleset = [...config.ruleset]
|
|
157
|
+
const structured = Object.fromEntries(
|
|
158
|
+
Object.entries({...config, configurationset}).filter(([_key, value]) =>
|
|
159
|
+
Array.isArray(value) ? value.length > 0 : value !== undefined,
|
|
160
|
+
),
|
|
161
|
+
)
|
|
122
162
|
|
|
123
163
|
// Return YAML, if appropriate
|
|
124
|
-
if (structured.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (structured.configurationset || structured.ruleset) {
|
|
129
|
-
return yaml.stringify(structured)
|
|
164
|
+
if (Object.keys(structured).length > 0) {
|
|
165
|
+
const configYamlStr = yaml.stringify(structured)
|
|
166
|
+
debug('stepzen:transpiler:config')(`effective config:\n${configYamlStr}`)
|
|
167
|
+
return configYamlStr
|
|
130
168
|
}
|
|
131
169
|
|
|
170
|
+
debug('stepzen:transpiler:config')(
|
|
171
|
+
`Could not find any of the supported properties in the config:` +
|
|
172
|
+
` [ '${Object.keys(config).join(`', '`)}' ].` +
|
|
173
|
+
` Retuning 'false' meaning 'effective config is empty'.`,
|
|
174
|
+
)
|
|
132
175
|
return false
|
|
133
176
|
}
|
package/src/actions/transpile.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {DocumentNode, parse} from 'graphql'
|
|
2
2
|
import * as dotenv from 'dotenv'
|
|
3
|
+
import * as debug from 'debug'
|
|
3
4
|
import * as fs from 'fs'
|
|
4
5
|
import * as glob from 'glob'
|
|
5
6
|
import * as path from 'path'
|
|
@@ -17,15 +18,21 @@ export default async (source: string) => {
|
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
// Load env vars, from working and source directories
|
|
21
|
+
debug('stepzen:dotenv')(
|
|
22
|
+
`loading .env from ${process.cwd()}, at transpiler/src/actions/transpile.ts:24`,
|
|
23
|
+
)
|
|
20
24
|
dotenv.config()
|
|
25
|
+
debug('stepzen:dotenv')(
|
|
26
|
+
`loading .env from ${path.resolve(source)}` +
|
|
27
|
+
`, at transpiler/src/actions/transpile.ts:29`,
|
|
28
|
+
)
|
|
21
29
|
dotenv.config({path: path.resolve(source, '.env')})
|
|
22
30
|
|
|
23
31
|
// State of whether we've transpiled or not
|
|
24
32
|
let transpiledConfig = false
|
|
25
|
-
let transpiledGraphQL = false
|
|
26
33
|
|
|
27
34
|
// See whether to transpile config
|
|
28
|
-
let config
|
|
35
|
+
let config = await configure(source, true)
|
|
29
36
|
const configCopy = config
|
|
30
37
|
|
|
31
38
|
if (config) {
|
|
@@ -40,31 +47,18 @@ export default async (source: string) => {
|
|
|
40
47
|
|
|
41
48
|
// See whether to transpile GraphQL
|
|
42
49
|
const graphqlFiles = glob.sync('**/*.graphql', {cwd: source})
|
|
43
|
-
let
|
|
44
|
-
let mutated: any = ''
|
|
50
|
+
let schema = ''
|
|
45
51
|
|
|
46
52
|
if (graphqlFiles.length > 0) {
|
|
47
53
|
const stitched = await stitch(source)
|
|
48
|
-
|
|
49
54
|
const index = path.join(stitched, 'index.graphql')
|
|
50
|
-
|
|
51
55
|
const graphql = fs.readFileSync(index, 'utf8')
|
|
52
|
-
|
|
53
|
-
let ast: DocumentNode = parse(graphql)
|
|
54
|
-
original = parse(graphql)
|
|
55
|
-
|
|
56
|
-
// you can transpile schema ast here
|
|
57
|
-
|
|
58
|
-
mutated = print(ast)
|
|
59
|
-
|
|
60
|
-
if (print(original) !== mutated) {
|
|
61
|
-
transpiledGraphQL = true
|
|
62
|
-
}
|
|
56
|
+
schema = print(parse(graphql))
|
|
63
57
|
}
|
|
64
58
|
|
|
65
59
|
return {
|
|
66
60
|
config,
|
|
67
|
-
schema
|
|
68
|
-
transpiled: transpiledConfig
|
|
61
|
+
schema,
|
|
62
|
+
transpiled: transpiledConfig,
|
|
69
63
|
}
|
|
70
64
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as debug from 'debug'
|
|
2
|
+
|
|
1
3
|
export default async (config: string): Promise<string> => {
|
|
2
4
|
const envvars = Object.keys(process.env)
|
|
3
5
|
.filter(key => {
|
|
@@ -8,10 +10,24 @@ export default async (config: string): Promise<string> => {
|
|
|
8
10
|
return obj
|
|
9
11
|
}, {})
|
|
10
12
|
|
|
13
|
+
let replacements = 0
|
|
14
|
+
debug('stepzen:transpiler:config')(
|
|
15
|
+
`STEPZEN_* env vars available for replacement:` +
|
|
16
|
+
` ${JSON.stringify(envvars, undefined, 2)}`,
|
|
17
|
+
)
|
|
18
|
+
|
|
11
19
|
for (const [key, value] of Object.entries(envvars)) {
|
|
12
20
|
const regex = new RegExp(key, 'g')
|
|
13
|
-
config = config.replace(regex,
|
|
21
|
+
config = config.replace(regex, (match, offset) => {
|
|
22
|
+
replacements += 1
|
|
23
|
+
debug('stepzen:transpiler:config')(
|
|
24
|
+
`replacing ${match} at offset ${offset}`,
|
|
25
|
+
)
|
|
26
|
+
return `${value}`
|
|
27
|
+
})
|
|
14
28
|
}
|
|
15
29
|
|
|
30
|
+
debug('stepzen:transpiler:config')(`total replacements made: ${replacements}`)
|
|
31
|
+
|
|
16
32
|
return config
|
|
17
33
|
}
|
package/src/utils/constants.ts
CHANGED