bdy 1.25.2-stage → 1.25.4-dev
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/distTs/package.json +20 -19
- package/distTs/src/agent/socket/tunnel.js +2 -0
- package/distTs/src/cliCommand.js +28 -0
- package/distTs/src/cliIndex.js +3 -1
- package/distTs/src/command/agent/proxy/status.js +9 -2
- package/distTs/src/command/agent/status.js +22 -6
- package/distTs/src/command/agent/tags/get.js +9 -2
- package/distTs/src/command/agent/target/status.js +9 -2
- package/distTs/src/command/agent/tunnel/http.js +4 -3
- package/distTs/src/command/agent/tunnel/list.js +7 -3
- package/distTs/src/command/agent/tunnel/remove.js +1 -2
- package/distTs/src/command/agent/tunnel/start.js +1 -2
- package/distTs/src/command/agent/tunnel/status.js +14 -3
- package/distTs/src/command/agent/tunnel/tcp.js +4 -3
- package/distTs/src/command/agent/tunnel/tls.js +4 -3
- package/distTs/src/command/agent/tunnel.js +11 -8
- package/distTs/src/command/agent/version.js +7 -2
- package/distTs/src/command/api/info.js +50 -2
- package/distTs/src/command/api/list.js +18 -2
- package/distTs/src/command/artifact/composer/publish.js +4 -2
- package/distTs/src/command/artifact/create.js +9 -2
- package/distTs/src/command/artifact/delete.js +4 -2
- package/distTs/src/command/artifact/docker.js +1 -1
- package/distTs/src/command/artifact/download.js +4 -2
- package/distTs/src/command/artifact/get.js +3 -1
- package/distTs/src/command/artifact/list.js +3 -1
- package/distTs/src/command/artifact/publish.js +24 -24
- package/distTs/src/command/artifact/version/create.js +9 -2
- package/distTs/src/command/artifact/version/delete.js +4 -2
- package/distTs/src/command/artifact/version/get.js +4 -2
- package/distTs/src/command/artifact/version/list.js +4 -2
- package/distTs/src/command/config/get/tunnel.js +8 -3
- package/distTs/src/command/config/get/tunnels.js +8 -3
- package/distTs/src/command/crawl/link.js +3 -2
- package/distTs/src/command/crawl/run.js +3 -2
- package/distTs/src/command/crawl.js +3 -4
- package/distTs/src/command/discover.js +34 -0
- package/distTs/src/command/distro/create.js +9 -2
- package/distTs/src/command/distro/delete.js +4 -2
- package/distTs/src/command/distro/get.js +4 -2
- package/distTs/src/command/distro/list.js +4 -2
- package/distTs/src/command/distro/route/create.js +9 -2
- package/distTs/src/command/distro/route/delete.js +4 -2
- package/distTs/src/command/distro/route/get.js +4 -2
- package/distTs/src/command/distro/route/list.js +4 -2
- package/distTs/src/command/distro/route/update.js +9 -2
- package/distTs/src/command/distro/route.js +9 -6
- package/distTs/src/command/distro/update.js +9 -2
- package/distTs/src/command/distro.js +14 -11
- package/distTs/src/command/domain/search.js +31 -10
- package/distTs/src/command/environment/create.js +6 -2
- package/distTs/src/command/environment/delete.js +1 -2
- package/distTs/src/command/environment/get.js +3 -2
- package/distTs/src/command/environment/list.js +1 -2
- package/distTs/src/command/environment/update.js +6 -2
- package/distTs/src/command/mcp.js +3 -2
- package/distTs/src/command/pipeline/create.js +4 -2
- package/distTs/src/command/pipeline/delete.js +4 -2
- package/distTs/src/command/pipeline/get.js +4 -2
- package/distTs/src/command/pipeline/list.js +4 -2
- package/distTs/src/command/pipeline/run/approve.js +5 -3
- package/distTs/src/command/pipeline/run/cancel.js +5 -3
- package/distTs/src/command/pipeline/run/list.js +4 -2
- package/distTs/src/command/pipeline/run/logs.js +5 -3
- package/distTs/src/command/pipeline/run/retry.js +5 -3
- package/distTs/src/command/pipeline/run/start.js +5 -3
- package/distTs/src/command/pipeline/run/status.js +5 -3
- package/distTs/src/command/pipeline/run.js +11 -9
- package/distTs/src/command/pipeline/update.js +4 -2
- package/distTs/src/command/pipeline/yaml.js +4 -2
- package/distTs/src/command/pipeline.js +17 -15
- package/distTs/src/command/pre.js +2 -1
- package/distTs/src/command/sandbox/app/add.js +10 -3
- package/distTs/src/command/sandbox/app/list.js +1 -2
- package/distTs/src/command/sandbox/app/logs.js +10 -6
- package/distTs/src/command/sandbox/app/remove.js +1 -2
- package/distTs/src/command/sandbox/app/start.js +1 -2
- package/distTs/src/command/sandbox/app/status.js +1 -2
- package/distTs/src/command/sandbox/app/stop.js +1 -2
- package/distTs/src/command/sandbox/app.js +11 -9
- package/distTs/src/command/sandbox/cp.js +3 -2
- package/distTs/src/command/sandbox/create.js +16 -7
- package/distTs/src/command/sandbox/endpoint/add.js +6 -2
- package/distTs/src/command/sandbox/endpoint/delete.js +1 -2
- package/distTs/src/command/sandbox/endpoint/get.js +1 -2
- package/distTs/src/command/sandbox/endpoint/list.js +1 -2
- package/distTs/src/command/sandbox/endpoint.js +8 -5
- package/distTs/src/command/sandbox/exec/command.js +15 -31
- package/distTs/src/command/sandbox/exec/kill.js +1 -2
- package/distTs/src/command/sandbox/exec/list.js +1 -2
- package/distTs/src/command/sandbox/exec/logs.js +4 -30
- package/distTs/src/command/sandbox/exec/status.js +1 -2
- package/distTs/src/command/sandbox/exec.js +9 -6
- package/distTs/src/command/sandbox/finishExec.js +33 -0
- package/distTs/src/command/sandbox/logs.js +14 -1
- package/distTs/src/command/sandbox/snapshot/create.js +10 -3
- package/distTs/src/command/sandbox/snapshot/delete.js +1 -2
- package/distTs/src/command/sandbox/snapshot/get.js +1 -2
- package/distTs/src/command/sandbox/snapshot/list.js +1 -2
- package/distTs/src/command/sandbox/snapshot.js +8 -5
- package/distTs/src/command/sandbox/ssh.js +3 -2
- package/distTs/src/command/target/create.js +8 -2
- package/distTs/src/command/target/delete.js +3 -2
- package/distTs/src/command/target/exec/command.js +1 -2
- package/distTs/src/command/target/exec/kill.js +1 -2
- package/distTs/src/command/target/exec/list.js +1 -2
- package/distTs/src/command/target/exec/logs.js +15 -3
- package/distTs/src/command/target/exec/status.js +1 -2
- package/distTs/src/command/target/exec.js +9 -6
- package/distTs/src/command/target/get.js +3 -2
- package/distTs/src/command/target/list.js +3 -2
- package/distTs/src/command/target/update.js +8 -2
- package/distTs/src/command/tests/capture.js +3 -2
- package/distTs/src/command/tests/unit/link.js +3 -2
- package/distTs/src/command/tests/unit/upload.js +3 -2
- package/distTs/src/command/tests/unit.js +3 -4
- package/distTs/src/command/tests/visual/link.js +3 -2
- package/distTs/src/command/tests/visual/session/close.js +3 -2
- package/distTs/src/command/tests/visual/session/create.js +3 -2
- package/distTs/src/command/tests/visual/session.js +6 -4
- package/distTs/src/command/tests/visual/setup.js +3 -2
- package/distTs/src/command/tests/visual/upload.js +3 -2
- package/distTs/src/command/tests/visual.js +9 -7
- package/distTs/src/command/tests.js +12 -10
- package/distTs/src/command/tunnel/http.js +3 -2
- package/distTs/src/command/tunnel/start.js +3 -2
- package/distTs/src/command/tunnel/tcp.js +1 -2
- package/distTs/src/command/tunnel/tls.js +1 -2
- package/distTs/src/command/tunnel.js +8 -5
- package/distTs/src/command/version.js +2 -1
- package/distTs/src/command/yaml/actions/info.js +1 -2
- package/distTs/src/command/yaml/actions/list.js +1 -2
- package/distTs/src/command/yaml/actions.js +3 -4
- package/distTs/src/command/yaml/pipeline.js +3 -2
- package/distTs/src/command/yaml/validate.js +114 -54
- package/distTs/src/command/yaml.js +8 -6
- package/distTs/src/discovery.js +119 -0
- package/distTs/src/openapi.js +8 -1
- package/distTs/src/output.js +39 -0
- package/distTs/src/texts.js +1570 -736
- package/distTs/src/utils.js +46 -17
- package/package.json +20 -19
|
@@ -9,15 +9,17 @@ const setup_1 = __importDefault(require("./visual/setup"));
|
|
|
9
9
|
const upload_1 = __importDefault(require("./visual/upload"));
|
|
10
10
|
const session_1 = __importDefault(require("./visual/session"));
|
|
11
11
|
const link_1 = __importDefault(require("./visual/link"));
|
|
12
|
-
const commandVisual = (0, utils_1.newCommand)('visual', texts_1.DESC_COMMAND_VISUAL
|
|
12
|
+
const commandVisual = (0, utils_1.newCommand)('visual', texts_1.DESC_COMMAND_VISUAL, {
|
|
13
|
+
examples: [
|
|
14
|
+
...texts_1.EXAMPLE_TESTS_VISUAL_SETUP,
|
|
15
|
+
...texts_1.EXAMPLE_TESTS_VISUAL_UPLOAD,
|
|
16
|
+
...texts_1.EXAMPLE_TESTS_VISUAL_LINK,
|
|
17
|
+
...texts_1.EXAMPLE_TESTS_VISUAL_SESSION_CREATE,
|
|
18
|
+
...texts_1.EXAMPLE_TESTS_VISUAL_SESSION_CLOSE,
|
|
19
|
+
],
|
|
20
|
+
});
|
|
13
21
|
commandVisual.addCommand(setup_1.default);
|
|
14
22
|
commandVisual.addCommand(upload_1.default);
|
|
15
23
|
commandVisual.addCommand(session_1.default);
|
|
16
24
|
commandVisual.addCommand(link_1.default);
|
|
17
|
-
commandVisual.addHelpText('after', `
|
|
18
|
-
EXAMPLES:${texts_1.EXAMPLE_TESTS_VISUAL_SETUP}
|
|
19
|
-
${texts_1.EXAMPLE_TESTS_VISUAL_UPLOAD}
|
|
20
|
-
${texts_1.EXAMPLE_TESTS_VISUAL_LINK}
|
|
21
|
-
${texts_1.EXAMPLE_TESTS_VISUAL_SESSION_CREATE}
|
|
22
|
-
${texts_1.EXAMPLE_TESTS_VISUAL_SESSION_CLOSE}`);
|
|
23
25
|
exports.default = commandVisual;
|
|
@@ -8,17 +8,19 @@ const texts_1 = require("../texts");
|
|
|
8
8
|
const unit_1 = __importDefault(require("./tests/unit"));
|
|
9
9
|
const visual_1 = __importDefault(require("./tests/visual"));
|
|
10
10
|
const capture_1 = __importDefault(require("./tests/capture"));
|
|
11
|
-
const commandTests = (0, utils_1.newCommand)('tests', texts_1.DESC_COMMAND_TESTS
|
|
11
|
+
const commandTests = (0, utils_1.newCommand)('tests', texts_1.DESC_COMMAND_TESTS, {
|
|
12
|
+
examples: [
|
|
13
|
+
...texts_1.EXAMPLE_TESTS_UNIT_UPLOAD,
|
|
14
|
+
...texts_1.EXAMPLE_TESTS_UNIT_LINK,
|
|
15
|
+
...texts_1.EXAMPLE_TESTS_VISUAL_SETUP,
|
|
16
|
+
...texts_1.EXAMPLE_TESTS_VISUAL_UPLOAD,
|
|
17
|
+
...texts_1.EXAMPLE_TESTS_VISUAL_LINK,
|
|
18
|
+
...texts_1.EXAMPLE_TESTS_VISUAL_SESSION_CREATE,
|
|
19
|
+
...texts_1.EXAMPLE_TESTS_VISUAL_SESSION_CLOSE,
|
|
20
|
+
...texts_1.EXAMPLE_TESTS_CAPTURE,
|
|
21
|
+
],
|
|
22
|
+
});
|
|
12
23
|
commandTests.addCommand(unit_1.default);
|
|
13
24
|
commandTests.addCommand(visual_1.default);
|
|
14
25
|
commandTests.addCommand(capture_1.default);
|
|
15
|
-
commandTests.addHelpText('after', `
|
|
16
|
-
EXAMPLES:${texts_1.EXAMPLE_TESTS_UNIT_UPLOAD}
|
|
17
|
-
${texts_1.EXAMPLE_TESTS_UNIT_LINK}
|
|
18
|
-
${texts_1.EXAMPLE_TESTS_VISUAL_SETUP}
|
|
19
|
-
${texts_1.EXAMPLE_TESTS_VISUAL_UPLOAD}
|
|
20
|
-
${texts_1.EXAMPLE_TESTS_VISUAL_LINK}
|
|
21
|
-
${texts_1.EXAMPLE_TESTS_VISUAL_SESSION_CREATE}
|
|
22
|
-
${texts_1.EXAMPLE_TESTS_VISUAL_SESSION_CLOSE}
|
|
23
|
-
${texts_1.EXAMPLE_TESTS_CAPTURE}`);
|
|
24
26
|
exports.default = commandTests;
|
|
@@ -7,12 +7,13 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const output_1 = __importDefault(require("../../output"));
|
|
8
8
|
const texts_1 = require("../../texts");
|
|
9
9
|
const tunnel_1 = require("../../types/tunnel");
|
|
10
|
-
const commandHttp = (0, utils_1.getBasicCommandHttp)(
|
|
10
|
+
const commandHttp = (0, utils_1.getBasicCommandHttp)({
|
|
11
|
+
examples: (0, texts_1.EXAMPLE_TUNNEL_HTTP)(false),
|
|
12
|
+
});
|
|
11
13
|
commandHttp.description(texts_1.DESC_COMMAND_HTTP);
|
|
12
14
|
commandHttp.option('-s, --serve <directory>', texts_1.OPTION_SERVE);
|
|
13
15
|
commandHttp.option('--token <token>', texts_1.OPTION_TOKEN);
|
|
14
16
|
commandHttp.argument('[protocol://host:port]', texts_1.OPTION_TARGET);
|
|
15
|
-
commandHttp.addHelpText('after', `\nEXAMPLES:${(0, texts_1.EXAMPLE_TUNNEL_HTTP)(false)}`);
|
|
16
17
|
commandHttp.action(async (target, options) => {
|
|
17
18
|
const ApiBuddy = require('../../tunnel/api/buddy').default;
|
|
18
19
|
const Input = require('../../input').default;
|
|
@@ -6,10 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const output_1 = __importDefault(require("../../output"));
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
|
-
const commandStart = (0, utils_1.newCommand)('start', texts_1.DESC_COMMAND_START
|
|
9
|
+
const commandStart = (0, utils_1.newCommand)('start', texts_1.DESC_COMMAND_START, {
|
|
10
|
+
examples: texts_1.EXAMPLE_TUNNEL_START,
|
|
11
|
+
});
|
|
10
12
|
commandStart.option('--token <token>', texts_1.OPTION_TOKEN);
|
|
11
13
|
commandStart.argument('<name>', texts_1.OPTION_NAME);
|
|
12
|
-
commandStart.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_TUNNEL_START}`);
|
|
13
14
|
commandStart.action(async (name, options) => {
|
|
14
15
|
const ApiBuddy = require('../../tunnel/api/buddy').default;
|
|
15
16
|
const Input = require('../../input').default;
|
|
@@ -7,11 +7,10 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const output_1 = __importDefault(require("../../output"));
|
|
8
8
|
const texts_1 = require("../../texts");
|
|
9
9
|
const tunnel_1 = require("../../types/tunnel");
|
|
10
|
-
const commandTcp = (0, utils_1.getBasicCommandTcp)();
|
|
10
|
+
const commandTcp = (0, utils_1.getBasicCommandTcp)({ examples: (0, texts_1.EXAMPLE_TUNNEL_TCP)(false) });
|
|
11
11
|
commandTcp.description(texts_1.DESC_COMMAND_TCP);
|
|
12
12
|
commandTcp.option('--token <token>', texts_1.OPTION_TOKEN);
|
|
13
13
|
commandTcp.argument('[host:port]', texts_1.OPTION_TARGET);
|
|
14
|
-
commandTcp.addHelpText('after', `\nEXAMPLES:${(0, texts_1.EXAMPLE_TUNNEL_TCP)(false)}`);
|
|
15
14
|
commandTcp.action(async (target, options) => {
|
|
16
15
|
const ApiBuddy = require('../../tunnel/api/buddy').default;
|
|
17
16
|
const Input = require('../../input').default;
|
|
@@ -7,11 +7,10 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const output_1 = __importDefault(require("../../output"));
|
|
8
8
|
const texts_1 = require("../../texts");
|
|
9
9
|
const tunnel_1 = require("../../types/tunnel");
|
|
10
|
-
const commandTls = (0, utils_1.getBasicCommandTls)();
|
|
10
|
+
const commandTls = (0, utils_1.getBasicCommandTls)({ examples: (0, texts_1.EXAMPLE_TUNNEL_TLS)(false) });
|
|
11
11
|
commandTls.description(texts_1.DESC_COMMAND_TLS);
|
|
12
12
|
commandTls.option('--token <token>', texts_1.OPTION_TOKEN);
|
|
13
13
|
commandTls.argument('[host:port]', texts_1.OPTION_TARGET);
|
|
14
|
-
commandTls.addHelpText('after', `\nEXAMPLES:${(0, texts_1.EXAMPLE_TUNNEL_TLS)(false)}`);
|
|
15
14
|
commandTls.action(async (target, options) => {
|
|
16
15
|
const ApiBuddy = require('../../tunnel/api/buddy').default;
|
|
17
16
|
const Input = require('../../input').default;
|
|
@@ -10,14 +10,17 @@ const tcp_1 = __importDefault(require("./tunnel/tcp"));
|
|
|
10
10
|
const tls_1 = __importDefault(require("./tunnel/tls"));
|
|
11
11
|
const http_1 = __importDefault(require("./tunnel/http"));
|
|
12
12
|
const start_1 = __importDefault(require("./tunnel/start"));
|
|
13
|
-
const commandTunnel = (0, utils_1.newCommand)('tunnel', texts_1.DESC_COMMAND_TUNNEL
|
|
13
|
+
const commandTunnel = (0, utils_1.newCommand)('tunnel', texts_1.DESC_COMMAND_TUNNEL, {
|
|
14
|
+
examples: [
|
|
15
|
+
...(0, texts_1.EXAMPLE_TUNNEL_HTTP)(false),
|
|
16
|
+
...(0, texts_1.EXAMPLE_TUNNEL_TLS)(false),
|
|
17
|
+
...(0, texts_1.EXAMPLE_TUNNEL_TCP)(false),
|
|
18
|
+
...texts_1.EXAMPLE_TUNNEL_START,
|
|
19
|
+
],
|
|
20
|
+
});
|
|
14
21
|
commandTunnel.addCommand(config_1.default);
|
|
15
22
|
commandTunnel.addCommand(tcp_1.default);
|
|
16
23
|
commandTunnel.addCommand(tls_1.default);
|
|
17
24
|
commandTunnel.addCommand(http_1.default);
|
|
18
25
|
commandTunnel.addCommand(start_1.default);
|
|
19
|
-
commandTunnel.addHelpText('after', `\nEXAMPLES:${(0, texts_1.EXAMPLE_TUNNEL_HTTP)(false)}
|
|
20
|
-
${(0, texts_1.EXAMPLE_TUNNEL_TLS)(false)}
|
|
21
|
-
${(0, texts_1.EXAMPLE_TUNNEL_TCP)(false)}
|
|
22
|
-
${texts_1.EXAMPLE_TUNNEL_START}`);
|
|
23
26
|
exports.default = commandTunnel;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const utils_1 = require("../utils");
|
|
7
7
|
const output_1 = __importDefault(require("../output"));
|
|
8
8
|
const utils_2 = require("../utils");
|
|
9
|
+
const texts_1 = require("../texts");
|
|
9
10
|
const updateMessage = (currentVersion, latestVersion, instructions) => {
|
|
10
11
|
output_1.default.normal('Current version: ', false);
|
|
11
12
|
output_1.default.gray(currentVersion);
|
|
@@ -71,7 +72,7 @@ const updateByDownload = (platform, currentVersion, latestVersion, env) => {
|
|
|
71
72
|
}
|
|
72
73
|
updateMessage(currentVersion, latestVersion, instructions);
|
|
73
74
|
};
|
|
74
|
-
const commandVersion = (0, utils_2.newCommand)('update');
|
|
75
|
+
const commandVersion = (0, utils_2.newCommand)('update', texts_1.DESC_COMMAND_UPDATE);
|
|
75
76
|
commandVersion.alias('version');
|
|
76
77
|
commandVersion.hideVersionUpdate = true;
|
|
77
78
|
commandVersion.action(async () => {
|
|
@@ -13,10 +13,9 @@ const render_1 = require("../render");
|
|
|
13
13
|
async function suggestionLine(query) {
|
|
14
14
|
return (await (0, schema_1.searchActions)(query, 5)).map((hit) => `${hit.type} (${hit.name})`);
|
|
15
15
|
}
|
|
16
|
-
const commandYamlActionsInfo = (0, utils_1.newCommand)('info', texts_1.DESC_COMMAND_YAML_ACTIONS_INFO);
|
|
16
|
+
const commandYamlActionsInfo = (0, utils_1.newCommand)('info', texts_1.DESC_COMMAND_YAML_ACTIONS_INFO, { examples: texts_1.EXAMPLE_YAML_ACTIONS_INFO });
|
|
17
17
|
commandYamlActionsInfo.argument('<type>', texts_1.OPTION_ACTION_TYPE);
|
|
18
18
|
commandYamlActionsInfo.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
19
|
-
commandYamlActionsInfo.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_YAML_ACTIONS_INFO}`);
|
|
20
19
|
commandYamlActionsInfo.action(async (type, options) => {
|
|
21
20
|
await (0, schemaUtils_1.ensureYamlSchema)();
|
|
22
21
|
const action = await (0, schema_1.findAction)(type);
|
|
@@ -26,11 +26,10 @@ function actionJson(actions, detectedTypes) {
|
|
|
26
26
|
suggested: detectedTypes.has(action.type),
|
|
27
27
|
}));
|
|
28
28
|
}
|
|
29
|
-
const commandYamlActionsList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_YAML_ACTIONS_LIST);
|
|
29
|
+
const commandYamlActionsList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_YAML_ACTIONS_LIST, { examples: texts_1.EXAMPLE_YAML_ACTIONS_LIST });
|
|
30
30
|
commandYamlActionsList.alias('ls');
|
|
31
31
|
commandYamlActionsList.option('-s, --search <query>', texts_1.OPTION_ACTION_SEARCH);
|
|
32
32
|
commandYamlActionsList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
33
|
-
commandYamlActionsList.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_YAML_ACTIONS_LIST}`);
|
|
34
33
|
commandYamlActionsList.action(async (options) => {
|
|
35
34
|
await (0, schemaUtils_1.ensureYamlSchema)();
|
|
36
35
|
const actions = await (0, schema_1.loadSchema)();
|
|
@@ -7,10 +7,9 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
8
|
const list_1 = __importDefault(require("./actions/list"));
|
|
9
9
|
const info_1 = __importDefault(require("./actions/info"));
|
|
10
|
-
const commandYamlActions = (0, utils_1.newCommand)('actions', texts_1.DESC_COMMAND_YAML_ACTIONS
|
|
10
|
+
const commandYamlActions = (0, utils_1.newCommand)('actions', texts_1.DESC_COMMAND_YAML_ACTIONS, {
|
|
11
|
+
examples: [...texts_1.EXAMPLE_YAML_ACTIONS_LIST, ...texts_1.EXAMPLE_YAML_ACTIONS_INFO],
|
|
12
|
+
});
|
|
11
13
|
commandYamlActions.addCommand(list_1.default);
|
|
12
14
|
commandYamlActions.addCommand(info_1.default);
|
|
13
|
-
commandYamlActions.addHelpText('after', `
|
|
14
|
-
EXAMPLES:${texts_1.EXAMPLE_YAML_ACTIONS_LIST}
|
|
15
|
-
${texts_1.EXAMPLE_YAML_ACTIONS_INFO}`);
|
|
16
15
|
exports.default = commandYamlActions;
|
|
@@ -8,9 +8,10 @@ const output_1 = __importDefault(require("../../output"));
|
|
|
8
8
|
const texts_1 = require("../../texts");
|
|
9
9
|
const schemaUtils_1 = require("./schemaUtils");
|
|
10
10
|
const render_1 = require("./render");
|
|
11
|
-
const commandYamlPipeline = (0, utils_1.newCommand)('pipeline', texts_1.DESC_COMMAND_YAML_PIPELINE
|
|
11
|
+
const commandYamlPipeline = (0, utils_1.newCommand)('pipeline', texts_1.DESC_COMMAND_YAML_PIPELINE, {
|
|
12
|
+
examples: texts_1.EXAMPLE_YAML_PIPELINE,
|
|
13
|
+
});
|
|
12
14
|
commandYamlPipeline.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
|
-
commandYamlPipeline.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_YAML_PIPELINE}`);
|
|
14
15
|
commandYamlPipeline.action(async (options) => {
|
|
15
16
|
await (0, schemaUtils_1.ensureYamlSchema)();
|
|
16
17
|
const scope = (0, schemaUtils_1.pipelinesScope)();
|
|
@@ -22,9 +22,17 @@ function prettifyKey(key) {
|
|
|
22
22
|
.map((w) => w.charAt(0).toUpperCase() + w.slice(1))
|
|
23
23
|
.join(' ');
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function recordError(context, path, message) {
|
|
26
|
+
context.errors.push({
|
|
27
|
+
pipeline: context.pipeline,
|
|
28
|
+
path: path.replace(/\.(\d+)(?=\.|$)/g, '[$1]'),
|
|
29
|
+
message,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function outputErrors(result, indent, context, prefix = '') {
|
|
26
33
|
for (const err of result.errors) {
|
|
27
|
-
|
|
34
|
+
recordError(context, [prefix, err.path].filter(Boolean).join('.'), err.message);
|
|
35
|
+
context.output.muted(`${indent}${err.path}: ${err.message}`);
|
|
28
36
|
}
|
|
29
37
|
}
|
|
30
38
|
function valueType(value) {
|
|
@@ -34,9 +42,10 @@ function valueType(value) {
|
|
|
34
42
|
return 'array';
|
|
35
43
|
return typeof value;
|
|
36
44
|
}
|
|
37
|
-
function reportWrongContainer(header, expected, value) {
|
|
38
|
-
|
|
39
|
-
|
|
45
|
+
function reportWrongContainer(header, expected, value, context, path) {
|
|
46
|
+
recordError(context, path, (0, texts_1.ERR_YAML_MUST_BE)(expected, valueType(value)));
|
|
47
|
+
context.output.error(header);
|
|
48
|
+
context.output.muted(` ${(0, texts_1.ERR_YAML_MUST_BE)(expected, valueType(value))}`);
|
|
40
49
|
return 1;
|
|
41
50
|
}
|
|
42
51
|
// Array whose items reference a def — directly, or via a single $ref branch in
|
|
@@ -117,85 +126,101 @@ function itemLabel(value, index, discProp) {
|
|
|
117
126
|
name = `#${index + 1}`;
|
|
118
127
|
return discProp && value && value[discProp] ? `${name} (${value[discProp]})` : name;
|
|
119
128
|
}
|
|
120
|
-
function validateScalarItem(item, section) {
|
|
129
|
+
function validateScalarItem(item, section, context, path) {
|
|
121
130
|
// Null errors even where the section takes a string: coerceTypes cannot fix a root scalar.
|
|
122
131
|
if (item === null || !section.scalar) {
|
|
123
|
-
|
|
132
|
+
recordError(context, path, (0, texts_1.ERR_YAML_MUST_BE)('object', valueType(item)));
|
|
133
|
+
context.output.error(` ${String(item)}: ${(0, texts_1.ERR_YAML_MUST_BE)('object', valueType(item))}`);
|
|
124
134
|
return 1;
|
|
125
135
|
}
|
|
126
136
|
const result = (0, schemaUtils_1.validateAgainstSchema)({ ...section.scalar, $defs: (0, schemaUtils_1.loadRawSchema)().$defs }, item);
|
|
127
137
|
if (result.valid) {
|
|
128
|
-
|
|
138
|
+
context.output.green(` ${String(item)}`);
|
|
129
139
|
return 0;
|
|
130
140
|
}
|
|
131
|
-
|
|
132
|
-
outputErrors(result, ' ');
|
|
141
|
+
context.output.error(` ${String(item)}`);
|
|
142
|
+
outputErrors(result, ' ', context, path);
|
|
133
143
|
return result.errors.length;
|
|
134
144
|
}
|
|
135
|
-
function validateItemSection(unions, items, section) {
|
|
145
|
+
function validateItemSection(unions, items, section, context) {
|
|
136
146
|
const refName = section.defName;
|
|
137
147
|
const discProp = unions.get(refName)?.property ?? null;
|
|
138
148
|
let errors = 0;
|
|
139
149
|
for (let i = 0; i < items.length; i++) {
|
|
140
150
|
const item = items[i];
|
|
151
|
+
const path = `${section.key}[${i}]`;
|
|
141
152
|
if (item === null || typeof item !== 'object' || Array.isArray(item)) {
|
|
142
|
-
errors += validateScalarItem(item, section);
|
|
153
|
+
errors += validateScalarItem(item, section, context, path);
|
|
143
154
|
continue;
|
|
144
155
|
}
|
|
145
156
|
const label = itemLabel(item, i, discProp);
|
|
146
157
|
const resolved = resolveDef(unions, refName, item);
|
|
147
158
|
if ('missingType' in resolved) {
|
|
148
|
-
|
|
159
|
+
recordError(context, `${path}.${resolved.missingType}`, (0, texts_1.ERR_YAML_ITEM_MISSING)(resolved.missingType));
|
|
160
|
+
context.output.error(` ${label}: ${(0, texts_1.ERR_YAML_ITEM_MISSING)(resolved.missingType)}`);
|
|
149
161
|
errors++;
|
|
150
162
|
continue;
|
|
151
163
|
}
|
|
152
164
|
if ('unknownType' in resolved) {
|
|
153
|
-
|
|
165
|
+
recordError(context, `${path}.${resolved.prop}`, (0, texts_1.ERR_YAML_ITEM_UNKNOWN)(resolved.prop, resolved.unknownType));
|
|
166
|
+
context.output.error(` ${label}: ${(0, texts_1.ERR_YAML_ITEM_UNKNOWN)(resolved.prop, resolved.unknownType)}`);
|
|
154
167
|
errors++;
|
|
155
168
|
continue;
|
|
156
169
|
}
|
|
157
170
|
const result = (0, schemaUtils_1.validateAgainstDef)(resolved.defName, item);
|
|
158
171
|
if (result.valid) {
|
|
159
|
-
|
|
172
|
+
context.output.green(` ${label}`);
|
|
160
173
|
}
|
|
161
174
|
else {
|
|
162
175
|
errors += result.errors.length;
|
|
163
|
-
|
|
164
|
-
outputErrors(result, ' ');
|
|
176
|
+
context.output.error(` ${label}`);
|
|
177
|
+
outputErrors(result, ' ', context, path);
|
|
165
178
|
}
|
|
166
179
|
}
|
|
167
180
|
return errors;
|
|
168
181
|
}
|
|
169
|
-
function validateObjectSection(unions, label, value, refName) {
|
|
182
|
+
function validateObjectSection(unions, label, value, refName, context, path) {
|
|
170
183
|
const resolved = resolveDef(unions, refName, value);
|
|
171
184
|
if ('missingType' in resolved) {
|
|
172
|
-
|
|
173
|
-
|
|
185
|
+
context.output.error(label);
|
|
186
|
+
recordError(context, `${path}.${resolved.missingType}`, (0, texts_1.ERR_YAML_ITEM_MISSING)(resolved.missingType));
|
|
187
|
+
context.output.muted(` ${(0, texts_1.ERR_YAML_ITEM_MISSING)(resolved.missingType)}`);
|
|
174
188
|
return 1;
|
|
175
189
|
}
|
|
176
190
|
if ('unknownType' in resolved) {
|
|
177
|
-
|
|
178
|
-
|
|
191
|
+
context.output.error(label);
|
|
192
|
+
recordError(context, `${path}.${resolved.prop}`, (0, texts_1.ERR_YAML_ITEM_UNKNOWN)(resolved.prop, resolved.unknownType));
|
|
193
|
+
context.output.muted(` ${(0, texts_1.ERR_YAML_ITEM_UNKNOWN)(resolved.prop, resolved.unknownType)}`);
|
|
179
194
|
return 1;
|
|
180
195
|
}
|
|
181
196
|
const result = (0, schemaUtils_1.validateAgainstDef)(resolved.defName, value);
|
|
182
197
|
if (result.valid) {
|
|
183
|
-
|
|
198
|
+
context.output.green(label);
|
|
184
199
|
return 0;
|
|
185
200
|
}
|
|
186
|
-
|
|
187
|
-
outputErrors(result, ' ');
|
|
201
|
+
context.output.error(label);
|
|
202
|
+
outputErrors(result, ' ', context, path);
|
|
188
203
|
return result.errors.length;
|
|
189
204
|
}
|
|
190
|
-
function validateSinglePipeline(parsed, label, unions) {
|
|
205
|
+
function validateSinglePipeline(parsed, label, unions, context) {
|
|
191
206
|
let errors = 0;
|
|
192
207
|
const defs = (0, schemaUtils_1.getAllDefs)();
|
|
193
208
|
const pipelineDef = defs['PipelineYaml'];
|
|
194
209
|
const props = pipelineDef?.properties || {};
|
|
195
|
-
const allKnownKeys = new Set([
|
|
210
|
+
const allKnownKeys = new Set([
|
|
211
|
+
...Object.keys(props),
|
|
212
|
+
...SCHEMA_OMITTED_TOP_LEVEL_KEYS,
|
|
213
|
+
]);
|
|
196
214
|
const unknownKeys = Object.keys(parsed).filter((k) => !allKnownKeys.has(k));
|
|
197
215
|
if (unknownKeys.length > 0) {
|
|
198
|
-
|
|
216
|
+
for (const key of unknownKeys) {
|
|
217
|
+
context.warnings.push({
|
|
218
|
+
pipeline: context.pipeline,
|
|
219
|
+
path: key,
|
|
220
|
+
message: (0, texts_1.TXT_YAML_UNKNOWN_TOP_LEVEL_KEYS)(key),
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
context.output.yellow(`${label}${(0, texts_1.TXT_YAML_UNKNOWN_TOP_LEVEL_KEYS)(unknownKeys.join(', '))}`);
|
|
199
224
|
}
|
|
200
225
|
const { itemSections, objectSections, settingsProps } = classifySections(props);
|
|
201
226
|
if (Object.keys(settingsProps).length > 0) {
|
|
@@ -212,12 +237,12 @@ function validateSinglePipeline(parsed, label, unions) {
|
|
|
212
237
|
$defs: rawSchema.$defs,
|
|
213
238
|
}, settingsData);
|
|
214
239
|
if (result.valid) {
|
|
215
|
-
|
|
240
|
+
context.output.green(`${label}Pipeline settings`);
|
|
216
241
|
}
|
|
217
242
|
else {
|
|
218
243
|
errors += result.errors.length;
|
|
219
|
-
|
|
220
|
-
outputErrors(result, ' ');
|
|
244
|
+
context.output.error(`${label}Pipeline settings`);
|
|
245
|
+
outputErrors(result, ' ', context);
|
|
221
246
|
}
|
|
222
247
|
}
|
|
223
248
|
const itemByKey = new Map(itemSections.map((s) => [s.key, s]));
|
|
@@ -232,27 +257,52 @@ function validateSinglePipeline(parsed, label, unions) {
|
|
|
232
257
|
const header = `${label}${prettifyKey(key)}`;
|
|
233
258
|
if (itemByKey.has(key)) {
|
|
234
259
|
if (!Array.isArray(value)) {
|
|
235
|
-
errors += reportWrongContainer(header, 'array', value);
|
|
260
|
+
errors += reportWrongContainer(header, 'array', value, context, key);
|
|
236
261
|
continue;
|
|
237
262
|
}
|
|
238
|
-
|
|
239
|
-
errors += validateItemSection(unions, value, itemByKey.get(key));
|
|
263
|
+
context.output.blue(header);
|
|
264
|
+
errors += validateItemSection(unions, value, itemByKey.get(key), context);
|
|
240
265
|
}
|
|
241
266
|
else if (objByKey.has(key)) {
|
|
242
267
|
if (typeof value !== 'object' || Array.isArray(value)) {
|
|
243
|
-
errors += reportWrongContainer(header, 'object', value);
|
|
268
|
+
errors += reportWrongContainer(header, 'object', value, context, key);
|
|
244
269
|
continue;
|
|
245
270
|
}
|
|
246
|
-
errors += validateObjectSection(unions, header, value, objByKey.get(key));
|
|
271
|
+
errors += validateObjectSection(unions, header, value, objByKey.get(key), context, key);
|
|
247
272
|
}
|
|
248
273
|
}
|
|
249
274
|
return errors;
|
|
250
275
|
}
|
|
251
|
-
function validatePipelineFile(file, unions) {
|
|
276
|
+
function validatePipelineFile(file, unions, json) {
|
|
277
|
+
const context = {
|
|
278
|
+
output: {
|
|
279
|
+
normal: output_1.default.progress(json),
|
|
280
|
+
error: output_1.default.progress(json, output_1.default.error.bind(output_1.default)),
|
|
281
|
+
muted: output_1.default.progress(json, output_1.default.muted.bind(output_1.default)),
|
|
282
|
+
green: output_1.default.progress(json, output_1.default.green.bind(output_1.default)),
|
|
283
|
+
yellow: output_1.default.progress(json, output_1.default.yellow.bind(output_1.default)),
|
|
284
|
+
blue: output_1.default.progress(json, output_1.default.blue.bind(output_1.default)),
|
|
285
|
+
},
|
|
286
|
+
pipeline: 0,
|
|
287
|
+
errors: [],
|
|
288
|
+
warnings: [],
|
|
289
|
+
};
|
|
290
|
+
const invalidDocument = (message) => {
|
|
291
|
+
if (json) {
|
|
292
|
+
recordError(context, '', message);
|
|
293
|
+
output_1.default.json({
|
|
294
|
+
valid: false,
|
|
295
|
+
pipelines: 0,
|
|
296
|
+
errors: context.errors,
|
|
297
|
+
warnings: context.warnings,
|
|
298
|
+
});
|
|
299
|
+
output_1.default.exitCode(1);
|
|
300
|
+
}
|
|
301
|
+
output_1.default.exitError(message);
|
|
302
|
+
};
|
|
252
303
|
const filePath = (0, path_1.resolve)(file);
|
|
253
304
|
if (!(0, fs_1.existsSync)(filePath)) {
|
|
254
|
-
|
|
255
|
-
return;
|
|
305
|
+
invalidDocument((0, texts_1.ERR_YAML_VALIDATE_FILE_NOT_FOUND)(file));
|
|
256
306
|
}
|
|
257
307
|
const YAML = require('yaml');
|
|
258
308
|
const content = (0, fs_1.readFileSync)(filePath, 'utf8');
|
|
@@ -261,33 +311,40 @@ function validatePipelineFile(file, unions) {
|
|
|
261
311
|
parsed = YAML.parse(content);
|
|
262
312
|
}
|
|
263
313
|
catch (e) {
|
|
264
|
-
|
|
265
|
-
return;
|
|
314
|
+
invalidDocument((0, texts_1.ERR_YAML_PARSE)(e.message));
|
|
266
315
|
}
|
|
267
316
|
if (!parsed || typeof parsed !== 'object') {
|
|
268
|
-
|
|
269
|
-
return;
|
|
317
|
+
invalidDocument(texts_1.ERR_YAML_NOT_ARRAY);
|
|
270
318
|
}
|
|
271
319
|
if (!Array.isArray(parsed)) {
|
|
272
|
-
|
|
273
|
-
return;
|
|
320
|
+
invalidDocument(texts_1.ERR_YAML_PLAIN_OBJECT);
|
|
274
321
|
}
|
|
275
322
|
if (parsed.length === 0) {
|
|
276
|
-
|
|
277
|
-
return;
|
|
323
|
+
invalidDocument(texts_1.ERR_YAML_EMPTY_ARRAY);
|
|
278
324
|
}
|
|
279
325
|
let errors = 0;
|
|
280
326
|
for (let i = 0; i < parsed.length; i++) {
|
|
281
327
|
const pipeline = parsed[i];
|
|
328
|
+
context.pipeline = i + 1;
|
|
282
329
|
if (!pipeline || typeof pipeline !== 'object' || Array.isArray(pipeline)) {
|
|
283
|
-
|
|
330
|
+
recordError(context, '', (0, texts_1.ERR_YAML_PIPELINE_NOT_OBJECT)(i + 1));
|
|
331
|
+
context.output.error(` ${(0, texts_1.ERR_YAML_PIPELINE_NOT_OBJECT)(i + 1)}`);
|
|
284
332
|
errors++;
|
|
285
333
|
continue;
|
|
286
334
|
}
|
|
287
335
|
const pipelineLabel = parsed.length > 1 ? `[${pipeline.pipeline || i + 1}] ` : '';
|
|
288
|
-
errors += validateSinglePipeline(pipeline, pipelineLabel, unions);
|
|
336
|
+
errors += validateSinglePipeline(pipeline, pipelineLabel, unions, context);
|
|
289
337
|
}
|
|
290
|
-
|
|
338
|
+
if (json) {
|
|
339
|
+
output_1.default.json({
|
|
340
|
+
valid: errors === 0,
|
|
341
|
+
pipelines: parsed.length,
|
|
342
|
+
errors: context.errors,
|
|
343
|
+
warnings: context.warnings,
|
|
344
|
+
});
|
|
345
|
+
output_1.default.exitCode(errors > 0 ? 1 : 0);
|
|
346
|
+
}
|
|
347
|
+
context.output.normal('');
|
|
291
348
|
if (errors > 0) {
|
|
292
349
|
output_1.default.exitError((0, texts_1.ERR_YAML_VALIDATE_FAILED_COUNT)(errors));
|
|
293
350
|
}
|
|
@@ -295,11 +352,14 @@ function validatePipelineFile(file, unions) {
|
|
|
295
352
|
output_1.default.exitSuccess(texts_1.TXT_YAML_VALIDATE_ALL_PASS);
|
|
296
353
|
}
|
|
297
354
|
}
|
|
298
|
-
const commandYamlValidate = (0, utils_1.newCommand)('validate', texts_1.DESC_COMMAND_YAML_VALIDATE
|
|
355
|
+
const commandYamlValidate = (0, utils_1.newCommand)('validate', texts_1.DESC_COMMAND_YAML_VALIDATE, {
|
|
356
|
+
helpText: texts_1.HELP_YAML_VALIDATE_JSON,
|
|
357
|
+
examples: texts_1.EXAMPLE_YAML_VALIDATE,
|
|
358
|
+
});
|
|
299
359
|
commandYamlValidate.argument('<file>', texts_1.OPTION_YAML_VALIDATE_FILE);
|
|
300
|
-
commandYamlValidate.
|
|
301
|
-
commandYamlValidate.action(async (file) => {
|
|
360
|
+
commandYamlValidate.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
361
|
+
commandYamlValidate.action(async (file, options) => {
|
|
302
362
|
await (0, schemaUtils_1.ensureYamlSchema)();
|
|
303
|
-
validatePipelineFile(file, await unionMappings((0, schemaUtils_1.getAllDefs)()));
|
|
363
|
+
validatePipelineFile(file, await unionMappings((0, schemaUtils_1.getAllDefs)()), options.format === 'json');
|
|
304
364
|
});
|
|
305
365
|
exports.default = commandYamlValidate;
|
|
@@ -8,13 +8,15 @@ const texts_1 = require("../texts");
|
|
|
8
8
|
const pipeline_1 = __importDefault(require("./yaml/pipeline"));
|
|
9
9
|
const actions_1 = __importDefault(require("./yaml/actions"));
|
|
10
10
|
const validate_1 = __importDefault(require("./yaml/validate"));
|
|
11
|
-
const commandYaml = (0, utils_1.newCommand)('yaml', texts_1.DESC_COMMAND_YAML
|
|
11
|
+
const commandYaml = (0, utils_1.newCommand)('yaml', texts_1.DESC_COMMAND_YAML, {
|
|
12
|
+
examples: [
|
|
13
|
+
...texts_1.EXAMPLE_YAML_PIPELINE,
|
|
14
|
+
...texts_1.EXAMPLE_YAML_ACTIONS_LIST,
|
|
15
|
+
...texts_1.EXAMPLE_YAML_ACTIONS_INFO,
|
|
16
|
+
...texts_1.EXAMPLE_YAML_VALIDATE,
|
|
17
|
+
],
|
|
18
|
+
});
|
|
12
19
|
commandYaml.addCommand(pipeline_1.default);
|
|
13
20
|
commandYaml.addCommand(actions_1.default);
|
|
14
21
|
commandYaml.addCommand(validate_1.default);
|
|
15
|
-
commandYaml.addHelpText('after', `
|
|
16
|
-
EXAMPLES:${texts_1.EXAMPLE_YAML_PIPELINE}
|
|
17
|
-
${texts_1.EXAMPLE_YAML_ACTIONS_LIST}
|
|
18
|
-
${texts_1.EXAMPLE_YAML_ACTIONS_INFO}
|
|
19
|
-
${texts_1.EXAMPLE_YAML_VALIDATE}`);
|
|
20
22
|
exports.default = commandYaml;
|