bdy 1.25.13-stage → 1.25.15-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 +1 -1
- package/distTs/src/agent/manager.js +19 -6
- package/distTs/src/agent/system.js +9 -4
- package/distTs/src/api/client.js +20 -7
- package/distTs/src/cliCommand.js +17 -1
- package/distTs/src/cliIndex.js +12 -2
- package/distTs/src/command/agent/debug.js +4 -3
- package/distTs/src/command/agent/disable.js +4 -3
- package/distTs/src/command/agent/enable.js +4 -3
- package/distTs/src/command/agent/install.js +28 -12
- package/distTs/src/command/agent/proxy/disable.js +4 -3
- package/distTs/src/command/agent/proxy/enable.js +4 -3
- package/distTs/src/command/agent/proxy/status.js +1 -1
- package/distTs/src/command/agent/restart.js +13 -5
- package/distTs/src/command/agent/start.js +11 -4
- package/distTs/src/command/agent/status.js +1 -1
- package/distTs/src/command/agent/stop.js +5 -4
- package/distTs/src/command/agent/tags/get.js +1 -1
- package/distTs/src/command/agent/tags/set.js +4 -3
- package/distTs/src/command/agent/target/disable.js +4 -3
- package/distTs/src/command/agent/target/enable.js +4 -3
- package/distTs/src/command/agent/target/status.js +1 -1
- package/distTs/src/command/agent/tunnel/disable.js +4 -3
- package/distTs/src/command/agent/tunnel/enable.js +4 -3
- package/distTs/src/command/agent/tunnel/http.js +10 -2
- package/distTs/src/command/agent/tunnel/list.js +1 -1
- package/distTs/src/command/agent/tunnel/remove.js +4 -3
- package/distTs/src/command/agent/tunnel/start.js +9 -5
- package/distTs/src/command/agent/tunnel/status.js +1 -1
- package/distTs/src/command/agent/tunnel/tcp.js +10 -2
- package/distTs/src/command/agent/tunnel/tls.js +10 -2
- package/distTs/src/command/agent/uninstall.js +6 -4
- package/distTs/src/command/agent/update.js +13 -5
- package/distTs/src/command/agent/user.js +4 -3
- package/distTs/src/command/agent/version.js +1 -1
- package/distTs/src/command/api/info.js +5 -3
- package/distTs/src/command/api/list.js +1 -0
- package/distTs/src/command/artifact/composer/publish.js +21 -16
- package/distTs/src/command/artifact/delete.js +8 -5
- package/distTs/src/command/artifact/docker/login.js +22 -5
- package/distTs/src/command/artifact/download.js +16 -15
- package/distTs/src/command/artifact/get.js +3 -2
- package/distTs/src/command/artifact/open.js +3 -2
- package/distTs/src/command/artifact/publish.js +3 -2
- package/distTs/src/command/artifact/version/create.js +3 -2
- package/distTs/src/command/artifact/version/delete.js +9 -6
- package/distTs/src/command/artifact/version/get.js +4 -3
- package/distTs/src/command/artifact/version/list.js +3 -2
- package/distTs/src/command/artifact/version/open.js +7 -6
- package/distTs/src/command/config/add/http.js +3 -2
- package/distTs/src/command/config/add/tcp.js +3 -2
- package/distTs/src/command/config/add/tls.js +3 -2
- package/distTs/src/command/config/get/region.js +5 -2
- package/distTs/src/command/config/get/timeout.js +5 -2
- package/distTs/src/command/config/get/token.js +5 -2
- package/distTs/src/command/config/get/tunnel.js +3 -2
- package/distTs/src/command/config/get/tunnels.js +1 -1
- package/distTs/src/command/config/get/whitelist.js +5 -2
- package/distTs/src/command/config/remove/token.js +4 -3
- package/distTs/src/command/config/remove/tunnel.js +6 -4
- package/distTs/src/command/config/set/region.js +4 -3
- package/distTs/src/command/config/set/timeout.js +4 -3
- package/distTs/src/command/config/set/token.js +5 -3
- package/distTs/src/command/config/set/whitelist.js +4 -3
- package/distTs/src/command/crawl/link.js +10 -4
- package/distTs/src/command/crawl/run.js +30 -18
- package/distTs/src/command/distro/delete.js +8 -5
- package/distTs/src/command/distro/get.js +3 -2
- package/distTs/src/command/distro/open.js +3 -2
- package/distTs/src/command/distro/route/create.js +3 -2
- package/distTs/src/command/distro/route/delete.js +8 -5
- package/distTs/src/command/distro/route/get.js +3 -2
- package/distTs/src/command/distro/route/list.js +3 -2
- package/distTs/src/command/distro/route/open.js +3 -2
- package/distTs/src/command/distro/route/update.js +3 -2
- package/distTs/src/command/distro/update.js +3 -2
- package/distTs/src/command/domain/buy.js +36 -17
- package/distTs/src/command/domain/get.js +3 -2
- package/distTs/src/command/domain/list.js +1 -1
- package/distTs/src/command/domain/open.js +4 -2
- package/distTs/src/command/domain/search.js +1 -0
- package/distTs/src/command/environment/create.js +1 -1
- package/distTs/src/command/environment/delete.js +6 -4
- package/distTs/src/command/environment/get.js +1 -0
- package/distTs/src/command/environment/list.js +1 -1
- package/distTs/src/command/environment/open.js +3 -1
- package/distTs/src/command/environment/update.js +1 -1
- package/distTs/src/command/login.js +29 -17
- package/distTs/src/command/logout.js +4 -3
- package/distTs/src/command/pipeline/create.js +13 -3
- package/distTs/src/command/pipeline/delete.js +9 -6
- package/distTs/src/command/pipeline/get.js +4 -3
- package/distTs/src/command/pipeline/open.js +2 -1
- package/distTs/src/command/pipeline/run/execution.js +3 -3
- package/distTs/src/command/pipeline/run/list.js +4 -3
- package/distTs/src/command/pipeline/run/open.js +2 -1
- package/distTs/src/command/pipeline/update.js +4 -3
- package/distTs/src/command/pipeline/yaml.js +4 -3
- package/distTs/src/command/project/link.js +74 -36
- package/distTs/src/command/project/list.js +1 -0
- package/distTs/src/command/project/open.js +3 -1
- package/distTs/src/command/register.js +2 -1
- package/distTs/src/command/sandbox/app/add.js +1 -0
- package/distTs/src/command/sandbox/app/list.js +1 -1
- package/distTs/src/command/sandbox/app/logs.js +1 -1
- package/distTs/src/command/sandbox/app/remove.js +4 -3
- package/distTs/src/command/sandbox/app/start.js +4 -3
- package/distTs/src/command/sandbox/app/status.js +3 -2
- package/distTs/src/command/sandbox/app/stop.js +4 -3
- package/distTs/src/command/sandbox/cp.js +23 -23
- package/distTs/src/command/sandbox/create.js +3 -1
- package/distTs/src/command/sandbox/destroy.js +6 -4
- package/distTs/src/command/sandbox/endpoint/add.js +1 -1
- package/distTs/src/command/sandbox/endpoint/delete.js +9 -6
- package/distTs/src/command/sandbox/endpoint/get.js +3 -2
- package/distTs/src/command/sandbox/endpoint/list.js +1 -1
- package/distTs/src/command/sandbox/exec/command.js +1 -0
- package/distTs/src/command/sandbox/exec/kill.js +7 -5
- package/distTs/src/command/sandbox/exec/list.js +1 -1
- package/distTs/src/command/sandbox/exec/logs.js +1 -1
- package/distTs/src/command/sandbox/exec/status.js +1 -1
- package/distTs/src/command/sandbox/get.js +1 -1
- package/distTs/src/command/sandbox/list.js +1 -1
- package/distTs/src/command/sandbox/logs.js +1 -1
- package/distTs/src/command/sandbox/open.js +3 -1
- package/distTs/src/command/sandbox/restart.js +9 -4
- package/distTs/src/command/sandbox/snapshot/create.js +1 -1
- package/distTs/src/command/sandbox/snapshot/delete.js +8 -5
- package/distTs/src/command/sandbox/snapshot/get.js +3 -2
- package/distTs/src/command/sandbox/snapshot/list.js +1 -1
- package/distTs/src/command/sandbox/snapshot/open.js +4 -2
- package/distTs/src/command/sandbox/ssh.js +1 -0
- package/distTs/src/command/sandbox/start.js +9 -4
- package/distTs/src/command/sandbox/status.js +1 -1
- package/distTs/src/command/sandbox/stop.js +9 -4
- package/distTs/src/command/sandbox/update.js +12 -6
- package/distTs/src/command/sandbox/yaml.js +1 -1
- package/distTs/src/command/target/create.js +1 -0
- package/distTs/src/command/target/delete.js +6 -3
- package/distTs/src/command/target/exec/command.js +1 -1
- package/distTs/src/command/target/exec/kill.js +6 -4
- package/distTs/src/command/target/exec/list.js +1 -1
- package/distTs/src/command/target/exec/logs.js +1 -1
- package/distTs/src/command/target/exec/status.js +1 -1
- package/distTs/src/command/target/get.js +1 -0
- package/distTs/src/command/target/list.js +1 -0
- package/distTs/src/command/target/open.js +3 -1
- package/distTs/src/command/target/scope.js +4 -4
- package/distTs/src/command/target/update.js +1 -0
- package/distTs/src/command/tests/capture.js +10 -7
- package/distTs/src/command/tests/unit/link.js +10 -4
- package/distTs/src/command/tests/visual/link.js +10 -4
- package/distTs/src/command/tests/visual/session/close.js +8 -3
- package/distTs/src/command/tests/visual/setup.js +6 -3
- package/distTs/src/command/tests/visual/upload.js +11 -8
- package/distTs/src/command/tunnel/http.js +6 -2
- package/distTs/src/command/tunnel/start.js +8 -3
- package/distTs/src/command/tunnel/tcp.js +6 -3
- package/distTs/src/command/tunnel/tls.js +6 -3
- package/distTs/src/command/version.js +24 -2
- package/distTs/src/command/whoami.js +1 -1
- package/distTs/src/command/workspace/get.js +7 -2
- package/distTs/src/command/workspace/list.js +1 -1
- package/distTs/src/command/workspace/open.js +4 -2
- package/distTs/src/command/workspace/set.js +4 -3
- package/distTs/src/command/yaml/actions/info.js +1 -1
- package/distTs/src/command/yaml/actions/list.js +1 -1
- package/distTs/src/command/yaml/pipeline.js +1 -0
- package/distTs/src/command/yaml/validate.js +1 -0
- package/distTs/src/discovery.js +169 -50
- package/distTs/src/input.js +6 -6
- package/distTs/src/output.js +72 -33
- package/distTs/src/texts.js +103 -42
- package/distTs/src/tunnel/output/noninteractive/tunnelJsonl.js +62 -0
- package/distTs/src/utils.js +61 -50
- package/distTs/src/visualTest/browser.js +3 -2
- package/package.json +1 -1
|
@@ -3,24 +3,41 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const node_child_process_1 = require("node:child_process");
|
|
6
7
|
const utils_1 = require("../../../utils");
|
|
7
8
|
const texts_1 = require("../../../texts");
|
|
8
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
10
|
const input_1 = __importDefault(require("../../../input"));
|
|
10
|
-
const
|
|
11
|
+
const cliError_1 = __importDefault(require("../../../cliError"));
|
|
12
|
+
// The token goes in on stdin, never in argv: argv is readable by every user
|
|
13
|
+
// through the process list, and no shell is involved to reinterpret it.
|
|
14
|
+
const dockerLogin = (host, token) => new Promise((resolve, reject) => {
|
|
15
|
+
const child = (0, node_child_process_1.spawn)('docker', ['login', host, '-u', 'buddy', '--password-stdin'], { stdio: ['pipe', 'ignore', 'pipe'] });
|
|
16
|
+
let stderr = '';
|
|
17
|
+
child.stderr.on('data', (chunk) => (stderr += chunk));
|
|
18
|
+
child.on('error', (err) => reject(err.code === 'ENOENT'
|
|
19
|
+
? new cliError_1.default('command_failed', texts_1.ERR_ARTIFACT_DOCKER_NOT_FOUND)
|
|
20
|
+
: err));
|
|
21
|
+
child.on('close', (code) => resolve({ code, stderr }));
|
|
22
|
+
// docker exiting before it reads stdin surfaces through its exit code
|
|
23
|
+
child.stdin.on('error', () => { });
|
|
24
|
+
child.stdin.end(token);
|
|
25
|
+
});
|
|
26
|
+
const commandArtifactDockerLogin = (0, utils_1.newCommand)('login', texts_1.DESC_COMMAND_ARTIFACT_DOCKER_LOGIN, { requiredScopes: [utils_1.REST_API_SCOPE.USER_READ] });
|
|
11
27
|
commandArtifactDockerLogin.option('--token <token>', texts_1.OPTION_REST_API_TOKEN);
|
|
12
28
|
commandArtifactDockerLogin.option('--api <url>', texts_1.OPTION_REST_API_ENDPOINT);
|
|
13
29
|
commandArtifactDockerLogin.option('--region <region>', texts_1.OPTION_REST_API_REGION);
|
|
30
|
+
commandArtifactDockerLogin.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
31
|
commandArtifactDockerLogin.action(async (options) => {
|
|
15
32
|
const client = input_1.default.restApiTokenClient(false, options.api, options.region, options.token);
|
|
16
33
|
await client.getInvoker();
|
|
17
34
|
const host = (0, utils_1.getDockerRegistryHostByApiBaseUrl)(client.baseUrl);
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
output_1.default.
|
|
35
|
+
const { code, stderr } = await dockerLogin(host, client.token ?? '');
|
|
36
|
+
if (code === 0) {
|
|
37
|
+
output_1.default.exitResult(options.format === 'json', { registry: host }, texts_1.TXT_ARTIFACT_DOCKER_LOGIN_SUCCESS);
|
|
21
38
|
}
|
|
22
39
|
else {
|
|
23
|
-
output_1.default.exitError(texts_1.TXT_ARTIFACT_DOCKER_LOGIN_FAILED);
|
|
40
|
+
output_1.default.exitError(new cliError_1.default('command_failed', texts_1.TXT_ARTIFACT_DOCKER_LOGIN_FAILED, stderr.trim() || null));
|
|
24
41
|
}
|
|
25
42
|
});
|
|
26
43
|
exports.default = commandArtifactDockerLogin;
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const cliError_1 = __importDefault(require("../../cliError"));
|
|
6
7
|
const utils_1 = require("../../utils");
|
|
7
8
|
const texts_1 = require("../../texts");
|
|
8
9
|
const input_1 = __importDefault(require("../../input"));
|
|
@@ -22,12 +23,15 @@ commandArtifactDownload.option('--scope <scope>', texts_1.OPT_COMMAND_SCOPE);
|
|
|
22
23
|
commandArtifactDownload.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
23
24
|
commandArtifactDownload.option('-m, --merge', texts_1.OPTION_ARTIFACT_DOWNLOAD_MERGE);
|
|
24
25
|
commandArtifactDownload.option('-r, --replace', texts_1.OPTION_ARTIFACT_DOWNLOAD_REPLACE);
|
|
26
|
+
commandArtifactDownload.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
25
27
|
commandArtifactDownload.argument('<identifier>', texts_1.OPTION_ARTIFACT_ID);
|
|
26
28
|
commandArtifactDownload.argument('<directory>', texts_1.OPTION_ARTIFACT_DOWNLOAD_PATH);
|
|
27
29
|
commandArtifactDownload.action(async (id, path, options) => {
|
|
28
30
|
const { v4 } = require('uuid');
|
|
29
31
|
const ArchiverExtract = require('../../unzipper').default;
|
|
30
32
|
const { UNZIPPER_FORMAT } = require('../../unzipper');
|
|
33
|
+
const json = options.format === 'json';
|
|
34
|
+
const say = output_1.default.progress(json);
|
|
31
35
|
const client = input_1.default.restApiTokenClient();
|
|
32
36
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
33
37
|
const project = input_1.default.restApiProject(options.project, true);
|
|
@@ -36,23 +40,23 @@ commandArtifactDownload.action(async (id, path, options) => {
|
|
|
36
40
|
let { identifier, version, isDefault } = input_1.default.artifactSplitIdentifier(id);
|
|
37
41
|
const data = await client.getArtifactVersionByIdentifier(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, identifier, version);
|
|
38
42
|
if (!data || !data.domain) {
|
|
39
|
-
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
43
|
+
output_1.default.exitError(new cliError_1.default('not_found', texts_1.ERR_WORKSPACE_NOT_FOUND, texts_1.HINT_WORKSPACE_LIST));
|
|
40
44
|
}
|
|
41
45
|
if (project && scope === distro_1.SCOPE.PROJECT && !data.project_identifier) {
|
|
42
|
-
output_1.default.exitError(texts_1.ERR_PROJECT_NOT_FOUND);
|
|
46
|
+
output_1.default.exitError(new cliError_1.default('not_found', texts_1.ERR_PROJECT_NOT_FOUND, texts_1.HINT_PROJECT_LIST));
|
|
43
47
|
}
|
|
44
48
|
const artifactId = data.artifact_id;
|
|
45
49
|
if (!artifactId) {
|
|
46
|
-
output_1.default.exitError(texts_1.ERR_ARTIFACT_DOWNLOAD_NOT_FOUND);
|
|
50
|
+
output_1.default.exitError(new cliError_1.default('not_found', texts_1.ERR_ARTIFACT_DOWNLOAD_NOT_FOUND, texts_1.HINT_ARTIFACT_LIST));
|
|
47
51
|
}
|
|
48
52
|
let versionId = data.artifact_version_id;
|
|
49
53
|
if (!isDefault && !versionId) {
|
|
50
|
-
output_1.default.exitError(texts_1.ERR_ARTIFACT_VERSION_NOT_FOUND);
|
|
54
|
+
output_1.default.exitError(new cliError_1.default('not_found', texts_1.ERR_ARTIFACT_VERSION_NOT_FOUND, texts_1.HINT_ARTIFACT_VERSION_LIST));
|
|
51
55
|
}
|
|
52
56
|
if (!versionId) {
|
|
53
57
|
const v = await client.getArtifactLatest(workspace, artifactId);
|
|
54
58
|
if (!v) {
|
|
55
|
-
output_1.default.exitError(texts_1.ERR_ARTIFACT_VERSION_NOT_FOUND);
|
|
59
|
+
output_1.default.exitError(new cliError_1.default('not_found', texts_1.ERR_ARTIFACT_VERSION_NOT_FOUND, texts_1.HINT_ARTIFACT_VERSION_LIST));
|
|
56
60
|
}
|
|
57
61
|
version = v.version;
|
|
58
62
|
versionId = v.id;
|
|
@@ -116,28 +120,25 @@ commandArtifactDownload.action(async (id, path, options) => {
|
|
|
116
120
|
// do nothing
|
|
117
121
|
}
|
|
118
122
|
};
|
|
119
|
-
|
|
123
|
+
say(texts_1.TXT_ARTIFACT_DOWNLOADING_ZIP);
|
|
120
124
|
const body = await client.downloadArtifactVersion(workspace, artifactId, versionId);
|
|
125
|
+
let count = 0;
|
|
121
126
|
try {
|
|
122
127
|
await promises_1.default.pipeline(body, fs_1.default.createWriteStream(zipPath));
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
output_1.default.normal(texts_1.TXT_ARTIFACT_UNZIPPING);
|
|
126
|
-
let count = 0;
|
|
128
|
+
say(texts_1.TXT_ARTIFACT_DOWNLOADED_ZIP, true, true);
|
|
129
|
+
say(texts_1.TXT_ARTIFACT_UNZIPPING);
|
|
127
130
|
await ArchiverExtract.extract(UNZIPPER_FORMAT.ZIP, zipPath, dirPath, async () => {
|
|
128
131
|
count += 1;
|
|
129
|
-
|
|
130
|
-
output_1.default.normal((0, texts_1.TXT_ARTIFACT_UNZIPPING_COUNT)(count));
|
|
132
|
+
say((0, texts_1.TXT_ARTIFACT_UNZIPPING_COUNT)(count), true, true);
|
|
131
133
|
});
|
|
132
134
|
clearZip();
|
|
133
|
-
|
|
134
|
-
output_1.default.normal(texts_1.TXT_ARTIFACT_UNZIPPED);
|
|
135
|
+
say(texts_1.TXT_ARTIFACT_UNZIPPED, true, true);
|
|
135
136
|
}
|
|
136
137
|
catch (err) {
|
|
137
138
|
logger_1.default.error(err);
|
|
138
139
|
clearZip();
|
|
139
140
|
output_1.default.exitError(texts_1.ERR_SWW);
|
|
140
141
|
}
|
|
141
|
-
output_1.default.
|
|
142
|
+
output_1.default.exitResult(json, { identifier, version, path: dirPath, files: count }, (0, texts_1.TXT_ARTIFACT_DOWNLOADED)(version, dirPath));
|
|
142
143
|
});
|
|
143
144
|
exports.default = commandArtifactDownload;
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const cliError_1 = __importDefault(require("../../cliError"));
|
|
6
7
|
const utils_1 = require("../../utils");
|
|
7
8
|
const texts_1 = require("../../texts");
|
|
8
9
|
const input_1 = __importDefault(require("../../input"));
|
|
@@ -23,10 +24,10 @@ commandArtifactGet.action(async (identifier, options) => {
|
|
|
23
24
|
const client = input_1.default.restApiTokenClient();
|
|
24
25
|
const data = await client.getArtifactVersionByIdentifier(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, identifier);
|
|
25
26
|
if (!data || !data.domain) {
|
|
26
|
-
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
27
|
+
output_1.default.exitError(new cliError_1.default('not_found', texts_1.ERR_WORKSPACE_NOT_FOUND, texts_1.HINT_WORKSPACE_LIST));
|
|
27
28
|
}
|
|
28
29
|
if (!data || !data.artifact_id) {
|
|
29
|
-
output_1.default.exitError(texts_1.ERR_ARTIFACT_NOT_FOUND);
|
|
30
|
+
output_1.default.exitError(new cliError_1.default('not_found', texts_1.ERR_ARTIFACT_NOT_FOUND, texts_1.HINT_ARTIFACT_LIST));
|
|
30
31
|
}
|
|
31
32
|
const art = await client.getArtifact(workspace, data.artifact_id);
|
|
32
33
|
if (options.format === 'json') {
|
|
@@ -16,6 +16,7 @@ const commandArtifactOpen = (0, utils_1.newCommand)('open', texts_1.DESC_COMMAND
|
|
|
16
16
|
commandArtifactOpen.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
17
17
|
commandArtifactOpen.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
18
18
|
commandArtifactOpen.option('--scope <scope>', texts_1.OPT_COMMAND_SCOPE);
|
|
19
|
+
commandArtifactOpen.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
19
20
|
commandArtifactOpen.argument('<identifier>', texts_1.OPT_COMMAND_ARTIFACT_IDENTIFIER);
|
|
20
21
|
commandArtifactOpen.action(async (identifier, options) => {
|
|
21
22
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
@@ -24,8 +25,8 @@ commandArtifactOpen.action(async (identifier, options) => {
|
|
|
24
25
|
const client = input_1.default.restApiTokenClient();
|
|
25
26
|
const data = await client.getArtifactVersionByIdentifier(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, identifier);
|
|
26
27
|
if (!data?.artifact_id)
|
|
27
|
-
throw new cliError_1.default('not_found', texts_1.ERR_ARTIFACT_NOT_FOUND);
|
|
28
|
+
throw new cliError_1.default('not_found', texts_1.ERR_ARTIFACT_NOT_FOUND, texts_1.HINT_ARTIFACT_LIST);
|
|
28
29
|
const artifact = await client.getArtifact(workspace, data.artifact_id);
|
|
29
|
-
await output_1.default.openUrl(artifact.html_url);
|
|
30
|
+
await output_1.default.openUrl(artifact.html_url, options.format === 'json');
|
|
30
31
|
});
|
|
31
32
|
exports.default = commandArtifactOpen;
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const cliError_1 = __importDefault(require("../../cliError"));
|
|
6
7
|
const utils_1 = require("../../utils");
|
|
7
8
|
const texts_1 = require("../../texts");
|
|
8
9
|
const input_1 = __importDefault(require("../../input"));
|
|
@@ -37,10 +38,10 @@ commandArtifactPublish.action(async (id, path, options) => {
|
|
|
37
38
|
const client = input_1.default.restApiTokenClient();
|
|
38
39
|
const data = await client.getArtifactVersionByIdentifier(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, identifier, version);
|
|
39
40
|
if (!data || !data.domain) {
|
|
40
|
-
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
41
|
+
output_1.default.exitError(new cliError_1.default('not_found', texts_1.ERR_WORKSPACE_NOT_FOUND, texts_1.HINT_WORKSPACE_LIST));
|
|
41
42
|
}
|
|
42
43
|
if (scope === distro_1.SCOPE.PROJECT && !data.project_identifier) {
|
|
43
|
-
output_1.default.exitError(texts_1.ERR_PROJECT_NOT_FOUND);
|
|
44
|
+
output_1.default.exitError(new cliError_1.default('not_found', texts_1.ERR_PROJECT_NOT_FOUND, texts_1.HINT_PROJECT_LIST));
|
|
44
45
|
}
|
|
45
46
|
let artifactId = data.artifact_id;
|
|
46
47
|
if (!artifactId) {
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const cliError_1 = __importDefault(require("../../../cliError"));
|
|
6
7
|
const utils_1 = require("../../../utils");
|
|
7
8
|
const texts_1 = require("../../../texts");
|
|
8
9
|
const input_1 = __importDefault(require("../../../input"));
|
|
@@ -30,10 +31,10 @@ commandArtifactVersionCreate.action(async (id, options) => {
|
|
|
30
31
|
const client = input_1.default.restApiTokenClient();
|
|
31
32
|
const data = await client.getArtifactVersionByIdentifier(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, identifier, version);
|
|
32
33
|
if (!data || !data.domain) {
|
|
33
|
-
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
34
|
+
output_1.default.exitError(new cliError_1.default('not_found', texts_1.ERR_WORKSPACE_NOT_FOUND, texts_1.HINT_WORKSPACE_LIST));
|
|
34
35
|
}
|
|
35
36
|
if (scope === distro_1.SCOPE.PROJECT && !data.project_identifier) {
|
|
36
|
-
output_1.default.exitError(texts_1.ERR_PROJECT_NOT_FOUND);
|
|
37
|
+
output_1.default.exitError(new cliError_1.default('not_found', texts_1.ERR_PROJECT_NOT_FOUND, texts_1.HINT_PROJECT_LIST));
|
|
37
38
|
}
|
|
38
39
|
let artifactId = data.artifact_id;
|
|
39
40
|
if (!artifactId) {
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const cliError_1 = __importDefault(require("../../../cliError"));
|
|
6
7
|
const utils_1 = require("../../../utils");
|
|
7
8
|
const texts_1 = require("../../../texts");
|
|
8
9
|
const input_1 = __importDefault(require("../../../input"));
|
|
@@ -18,6 +19,7 @@ commandArtifactVersionDelete.option('-p, --project <name>', texts_1.OPTION_REST_
|
|
|
18
19
|
commandArtifactVersionDelete.argument('<identifier>', texts_1.OPT_COMMAND_ARTIFACT_IDENTIFIER);
|
|
19
20
|
commandArtifactVersionDelete.option('--scope <scope>', texts_1.OPT_COMMAND_SCOPE);
|
|
20
21
|
commandArtifactVersionDelete.option('-f, --force', texts_1.OPTION_CONFIRM_FORCE);
|
|
22
|
+
commandArtifactVersionDelete.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
21
23
|
commandArtifactVersionDelete.argument('<version>', texts_1.OPT_COMMAND_ARTIFACT_VERSION);
|
|
22
24
|
commandArtifactVersionDelete.action(async (identifier, version, options) => {
|
|
23
25
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
@@ -26,18 +28,19 @@ commandArtifactVersionDelete.action(async (identifier, version, options) => {
|
|
|
26
28
|
const scope = input_1.default.scope(project, options.scope);
|
|
27
29
|
const data = await client.getArtifactVersionByIdentifier(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, identifier, version);
|
|
28
30
|
if (!data || !data.domain) {
|
|
29
|
-
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
31
|
+
output_1.default.exitError(new cliError_1.default('not_found', texts_1.ERR_WORKSPACE_NOT_FOUND, texts_1.HINT_WORKSPACE_LIST));
|
|
30
32
|
}
|
|
31
33
|
if (!data || !data.artifact_id) {
|
|
32
|
-
output_1.default.exitError(texts_1.ERR_ARTIFACT_NOT_FOUND);
|
|
34
|
+
output_1.default.exitError(new cliError_1.default('not_found', texts_1.ERR_ARTIFACT_NOT_FOUND, texts_1.HINT_ARTIFACT_LIST));
|
|
33
35
|
}
|
|
34
36
|
if (!data || !data.artifact_version_id) {
|
|
35
|
-
output_1.default.exitError(texts_1.ERR_ARTIFACT_VERSION_NOT_FOUND);
|
|
37
|
+
output_1.default.exitError(new cliError_1.default('not_found', texts_1.ERR_ARTIFACT_VERSION_NOT_FOUND, texts_1.HINT_ARTIFACT_VERSION_LIST));
|
|
36
38
|
}
|
|
37
|
-
const
|
|
39
|
+
const json = options.format === 'json';
|
|
40
|
+
const confirmed = await output_1.default.confirmDestructive(options.force, (0, texts_1.TXT_ARTIFACT_VERSION_DELETE_CONFIRM)(identifier, version), json);
|
|
38
41
|
if (!confirmed)
|
|
39
|
-
output_1.default.
|
|
42
|
+
output_1.default.exitResult(json, { deleted: null });
|
|
40
43
|
await client.deleteArtifactVersion(workspace, data.artifact_id, data.artifact_version_id);
|
|
41
|
-
output_1.default.
|
|
44
|
+
output_1.default.exitResult(json, { deleted: version }, texts_1.TXT_ARTIFACT_VERSION_DELETED);
|
|
42
45
|
});
|
|
43
46
|
exports.default = commandArtifactVersionDelete;
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const cliError_1 = __importDefault(require("../../../cliError"));
|
|
6
7
|
const utils_1 = require("../../../utils");
|
|
7
8
|
const texts_1 = require("../../../texts");
|
|
8
9
|
const input_1 = __importDefault(require("../../../input"));
|
|
@@ -25,13 +26,13 @@ commandArtifactVersionGet.action(async (identifier, version, options) => {
|
|
|
25
26
|
const client = input_1.default.restApiTokenClient();
|
|
26
27
|
const data = await client.getArtifactVersionByIdentifier(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, identifier, version);
|
|
27
28
|
if (!data || !data.domain) {
|
|
28
|
-
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
29
|
+
output_1.default.exitError(new cliError_1.default('not_found', texts_1.ERR_WORKSPACE_NOT_FOUND, texts_1.HINT_WORKSPACE_LIST));
|
|
29
30
|
}
|
|
30
31
|
if (!data || !data.artifact_id) {
|
|
31
|
-
output_1.default.exitError(texts_1.ERR_ARTIFACT_NOT_FOUND);
|
|
32
|
+
output_1.default.exitError(new cliError_1.default('not_found', texts_1.ERR_ARTIFACT_NOT_FOUND, texts_1.HINT_ARTIFACT_LIST));
|
|
32
33
|
}
|
|
33
34
|
if (!data || !data.artifact_version_id) {
|
|
34
|
-
output_1.default.exitError(texts_1.ERR_ARTIFACT_VERSION_NOT_FOUND);
|
|
35
|
+
output_1.default.exitError(new cliError_1.default('not_found', texts_1.ERR_ARTIFACT_VERSION_NOT_FOUND, texts_1.HINT_ARTIFACT_VERSION_LIST));
|
|
35
36
|
}
|
|
36
37
|
const result = await client.getArtifactVersion(workspace, data.artifact_id, data.artifact_version_id);
|
|
37
38
|
if (options.format === 'json') {
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const cliError_1 = __importDefault(require("../../../cliError"));
|
|
6
7
|
const utils_1 = require("../../../utils");
|
|
7
8
|
const texts_1 = require("../../../texts");
|
|
8
9
|
const input_1 = __importDefault(require("../../../input"));
|
|
@@ -29,10 +30,10 @@ commandArtifactVersionList.action(async (identifier, options) => {
|
|
|
29
30
|
const client = input_1.default.restApiTokenClient();
|
|
30
31
|
const data = await client.getArtifactVersionByIdentifier(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, identifier);
|
|
31
32
|
if (!data || !data.domain) {
|
|
32
|
-
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
33
|
+
output_1.default.exitError(new cliError_1.default('not_found', texts_1.ERR_WORKSPACE_NOT_FOUND, texts_1.HINT_WORKSPACE_LIST));
|
|
33
34
|
}
|
|
34
35
|
if (!data || !data.artifact_id) {
|
|
35
|
-
output_1.default.exitError(texts_1.ERR_ARTIFACT_NOT_FOUND);
|
|
36
|
+
output_1.default.exitError(new cliError_1.default('not_found', texts_1.ERR_ARTIFACT_NOT_FOUND, texts_1.HINT_ARTIFACT_LIST));
|
|
36
37
|
}
|
|
37
38
|
const result = await client.getArtifactVersions(workspace, data.artifact_id, page, perPage);
|
|
38
39
|
const versions = result.versions || [];
|
|
@@ -21,6 +21,7 @@ commandArtifactVersionOpen.option('-w, --workspace <domain>', texts_1.OPTION_RES
|
|
|
21
21
|
commandArtifactVersionOpen.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
22
22
|
commandArtifactVersionOpen.option('--scope <scope>', texts_1.OPT_COMMAND_SCOPE);
|
|
23
23
|
commandArtifactVersionOpen.option('--www [path]', texts_1.OPTION_ARTIFACT_VERSION_WWW);
|
|
24
|
+
commandArtifactVersionOpen.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
24
25
|
commandArtifactVersionOpen.argument('<identifier>', texts_1.OPT_COMMAND_ARTIFACT_IDENTIFIER);
|
|
25
26
|
commandArtifactVersionOpen.argument('<version>', texts_1.OPT_COMMAND_ARTIFACT_VERSION);
|
|
26
27
|
commandArtifactVersionOpen.action(async (identifier, version, options) => {
|
|
@@ -30,12 +31,12 @@ commandArtifactVersionOpen.action(async (identifier, version, options) => {
|
|
|
30
31
|
const client = input_1.default.restApiTokenClient();
|
|
31
32
|
const data = await client.getArtifactVersionByIdentifier(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, identifier, version);
|
|
32
33
|
if (!data?.artifact_id)
|
|
33
|
-
throw new cliError_1.default('not_found', texts_1.ERR_ARTIFACT_NOT_FOUND);
|
|
34
|
+
throw new cliError_1.default('not_found', texts_1.ERR_ARTIFACT_NOT_FOUND, texts_1.HINT_ARTIFACT_LIST);
|
|
34
35
|
if (!data.artifact_version_id)
|
|
35
|
-
throw new cliError_1.default('not_found', texts_1.ERR_ARTIFACT_VERSION_NOT_FOUND);
|
|
36
|
+
throw new cliError_1.default('not_found', texts_1.ERR_ARTIFACT_VERSION_NOT_FOUND, texts_1.HINT_ARTIFACT_VERSION_LIST);
|
|
36
37
|
const artifactVersion = await client.getArtifactVersion(workspace, data.artifact_id, data.artifact_version_id);
|
|
37
38
|
if (options.www === undefined) {
|
|
38
|
-
await output_1.default.openUrl(artifactVersion.html_url);
|
|
39
|
+
await output_1.default.openUrl(artifactVersion.html_url, options.format === 'json');
|
|
39
40
|
return;
|
|
40
41
|
}
|
|
41
42
|
const artifact = await client.getArtifact(workspace, data.artifact_id);
|
|
@@ -44,12 +45,12 @@ commandArtifactVersionOpen.action(async (identifier, version, options) => {
|
|
|
44
45
|
}
|
|
45
46
|
const root = artifactVersion.version_url;
|
|
46
47
|
if (typeof options.www === 'boolean') {
|
|
47
|
-
await output_1.default.openUrl(root);
|
|
48
|
+
await output_1.default.openUrl(root, options.format === 'json');
|
|
48
49
|
return;
|
|
49
50
|
}
|
|
50
51
|
const path = options.www.replace(/^\/+/, '');
|
|
51
52
|
if (!path && options.www === '/') {
|
|
52
|
-
await output_1.default.openUrl(root);
|
|
53
|
+
await output_1.default.openUrl(root, options.format === 'json');
|
|
53
54
|
return;
|
|
54
55
|
}
|
|
55
56
|
const parts = path.split('/');
|
|
@@ -58,6 +59,6 @@ commandArtifactVersionOpen.action(async (identifier, version, options) => {
|
|
|
58
59
|
}
|
|
59
60
|
const url = new URL(root);
|
|
60
61
|
url.pathname = url.pathname.replace(/\/?$/, '/') + parts.map(encodeURIComponent).join('/');
|
|
61
|
-
await output_1.default.openUrl(url.toString());
|
|
62
|
+
await output_1.default.openUrl(url.toString(), options.format === 'json');
|
|
62
63
|
});
|
|
63
64
|
exports.default = commandArtifactVersionOpen;
|
|
@@ -9,9 +9,10 @@ const cfg_1 = __importDefault(require("../../../tunnel/cfg"));
|
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
10
|
const texts_1 = require("../../../texts");
|
|
11
11
|
const tunnel_1 = require("../../../types/tunnel");
|
|
12
|
-
const commandConfigAddHttp = (0, utils_1.getBasicCommandHttp)();
|
|
12
|
+
const commandConfigAddHttp = (0, utils_1.getBasicCommandHttp)({ requiredScopes: [] });
|
|
13
13
|
commandConfigAddHttp.description(texts_1.DESC_COMMAND_CONFIG_ADD_HTTP);
|
|
14
14
|
commandConfigAddHttp.option('-f, --force', texts_1.OPTION_FORCE);
|
|
15
|
+
commandConfigAddHttp.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
15
16
|
commandConfigAddHttp.argument('<name>', texts_1.OPTION_NAME);
|
|
16
17
|
commandConfigAddHttp.argument('[protocol://host:port]', texts_1.OPTION_TARGET);
|
|
17
18
|
commandConfigAddHttp.action(async (n, target, options) => {
|
|
@@ -20,6 +21,6 @@ commandConfigAddHttp.action(async (n, target, options) => {
|
|
|
20
21
|
output_1.default.exitError(texts_1.ERR_TUNNEL_ALREADY_EXISTS);
|
|
21
22
|
}
|
|
22
23
|
await cfg_1.default.addTunnel(name, tunnel_1.TUNNEL_TYPE.HTTP, target, options);
|
|
23
|
-
output_1.default.
|
|
24
|
+
output_1.default.exitResult(options.format === 'json', cfg_1.default.getTunnel(name), texts_1.TXT_TUNNEL_ADDED);
|
|
24
25
|
});
|
|
25
26
|
exports.default = commandConfigAddHttp;
|
|
@@ -9,9 +9,10 @@ const cfg_1 = __importDefault(require("../../../tunnel/cfg"));
|
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
10
|
const texts_1 = require("../../../texts");
|
|
11
11
|
const tunnel_1 = require("../../../types/tunnel");
|
|
12
|
-
const commandConfigAddTcp = (0, utils_1.getBasicCommandTcp)();
|
|
12
|
+
const commandConfigAddTcp = (0, utils_1.getBasicCommandTcp)({ requiredScopes: [] });
|
|
13
13
|
commandConfigAddTcp.description(texts_1.DESC_COMMAND_CONFIG_ADD_TCP);
|
|
14
14
|
commandConfigAddTcp.option('-f, --force', texts_1.OPTION_FORCE);
|
|
15
|
+
commandConfigAddTcp.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
15
16
|
commandConfigAddTcp.argument('<name>', texts_1.OPTION_NAME);
|
|
16
17
|
commandConfigAddTcp.argument('[host:port]', texts_1.OPTION_TARGET);
|
|
17
18
|
commandConfigAddTcp.action(async (n, target, options) => {
|
|
@@ -20,6 +21,6 @@ commandConfigAddTcp.action(async (n, target, options) => {
|
|
|
20
21
|
output_1.default.exitError(texts_1.ERR_TUNNEL_ALREADY_EXISTS);
|
|
21
22
|
}
|
|
22
23
|
await cfg_1.default.addTunnel(name, tunnel_1.TUNNEL_TYPE.TCP, target, options);
|
|
23
|
-
output_1.default.
|
|
24
|
+
output_1.default.exitResult(options.format === 'json', cfg_1.default.getTunnel(name), texts_1.TXT_TUNNEL_ADDED);
|
|
24
25
|
});
|
|
25
26
|
exports.default = commandConfigAddTcp;
|
|
@@ -9,9 +9,10 @@ const cfg_1 = __importDefault(require("../../../tunnel/cfg"));
|
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
10
|
const texts_1 = require("../../../texts");
|
|
11
11
|
const tunnel_1 = require("../../../types/tunnel");
|
|
12
|
-
const commandConfigAddTls = (0, utils_1.getBasicCommandTls)();
|
|
12
|
+
const commandConfigAddTls = (0, utils_1.getBasicCommandTls)({ requiredScopes: [] });
|
|
13
13
|
commandConfigAddTls.description(texts_1.DESC_COMMAND_CONFIG_ADD_TLS);
|
|
14
14
|
commandConfigAddTls.option('-f, --force', texts_1.OPTION_FORCE);
|
|
15
|
+
commandConfigAddTls.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
15
16
|
commandConfigAddTls.argument('<name>', texts_1.OPTION_NAME);
|
|
16
17
|
commandConfigAddTls.argument('[host:port]', texts_1.OPTION_TARGET);
|
|
17
18
|
commandConfigAddTls.action(async (n, target, options) => {
|
|
@@ -20,6 +21,6 @@ commandConfigAddTls.action(async (n, target, options) => {
|
|
|
20
21
|
output_1.default.exitError(texts_1.ERR_TUNNEL_ALREADY_EXISTS);
|
|
21
22
|
}
|
|
22
23
|
await cfg_1.default.addTunnel(name, tunnel_1.TUNNEL_TYPE.TLS, target, options);
|
|
23
|
-
output_1.default.
|
|
24
|
+
output_1.default.exitResult(options.format === 'json', cfg_1.default.getTunnel(name), texts_1.TXT_TUNNEL_ADDED);
|
|
24
25
|
});
|
|
25
26
|
exports.default = commandConfigAddTls;
|
|
@@ -8,8 +8,11 @@ const output_1 = __importDefault(require("../../../output"));
|
|
|
8
8
|
const texts_1 = require("../../../texts");
|
|
9
9
|
const format_1 = __importDefault(require("../../../format"));
|
|
10
10
|
const utils_1 = require("../../../utils");
|
|
11
|
-
const commandConfigGetRegion = (0, utils_1.newCommand)('region', texts_1.DESC_COMMAND_CONFIG_GET_REGION);
|
|
12
|
-
commandConfigGetRegion.
|
|
11
|
+
const commandConfigGetRegion = (0, utils_1.newCommand)('region', texts_1.DESC_COMMAND_CONFIG_GET_REGION, { requiredScopes: [] });
|
|
12
|
+
commandConfigGetRegion.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
|
+
commandConfigGetRegion.action((options) => {
|
|
14
|
+
if (options.format === 'json')
|
|
15
|
+
output_1.default.exitResult(true, { region: cfg_1.default.getRegion() || null });
|
|
13
16
|
output_1.default.exitNormal(format_1.default.region(cfg_1.default.getRegion()));
|
|
14
17
|
});
|
|
15
18
|
exports.default = commandConfigGetRegion;
|
|
@@ -8,8 +8,11 @@ const cfg_1 = __importDefault(require("../../../tunnel/cfg"));
|
|
|
8
8
|
const texts_1 = require("../../../texts");
|
|
9
9
|
const format_1 = __importDefault(require("../../../format"));
|
|
10
10
|
const utils_1 = require("../../../utils");
|
|
11
|
-
const commandConfigGetTimeout = (0, utils_1.newCommand)('timeout', texts_1.DESC_COMMAND_CONFIG_GET_TIMEOUT);
|
|
12
|
-
commandConfigGetTimeout.
|
|
11
|
+
const commandConfigGetTimeout = (0, utils_1.newCommand)('timeout', texts_1.DESC_COMMAND_CONFIG_GET_TIMEOUT, { requiredScopes: [] });
|
|
12
|
+
commandConfigGetTimeout.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
|
+
commandConfigGetTimeout.action((options) => {
|
|
14
|
+
if (options.format === 'json')
|
|
15
|
+
output_1.default.exitResult(true, { timeout: cfg_1.default.getTimeout() });
|
|
13
16
|
output_1.default.exitNormal(format_1.default.timeout(cfg_1.default.getTimeout()));
|
|
14
17
|
});
|
|
15
18
|
exports.default = commandConfigGetTimeout;
|
|
@@ -8,8 +8,11 @@ const output_1 = __importDefault(require("../../../output"));
|
|
|
8
8
|
const texts_1 = require("../../../texts");
|
|
9
9
|
const format_1 = __importDefault(require("../../../format"));
|
|
10
10
|
const utils_1 = require("../../../utils");
|
|
11
|
-
const commandConfigGetToken = (0, utils_1.newCommand)('token', texts_1.DESC_COMMAND_CONFIG_GET_TOKEN);
|
|
12
|
-
commandConfigGetToken.
|
|
11
|
+
const commandConfigGetToken = (0, utils_1.newCommand)('token', texts_1.DESC_COMMAND_CONFIG_GET_TOKEN, { requiredScopes: [] });
|
|
12
|
+
commandConfigGetToken.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
|
+
commandConfigGetToken.action((options) => {
|
|
14
|
+
if (options.format === 'json')
|
|
15
|
+
output_1.default.exitResult(true, { token: cfg_1.default.getToken() ? format_1.default.token(cfg_1.default.getToken()) : null });
|
|
13
16
|
output_1.default.exitNormal(format_1.default.token(cfg_1.default.getToken()));
|
|
14
17
|
});
|
|
15
18
|
exports.default = commandConfigGetToken;
|
|
@@ -3,16 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const cliError_1 = __importDefault(require("../../../cliError"));
|
|
6
7
|
const cfg_1 = __importDefault(require("../../../tunnel/cfg"));
|
|
7
8
|
const output_1 = __importDefault(require("../../../output"));
|
|
8
9
|
const texts_1 = require("../../../texts");
|
|
9
10
|
const utils_1 = require("../../../utils");
|
|
10
|
-
const commandConfigGetTunnel = (0, utils_1.newCommand)('tunnel', texts_1.DESC_COMMAND_CONFIG_GET_TUNNEL, { examples: texts_1.EXAMPLE_CONFIG_GET_TUNNEL });
|
|
11
|
+
const commandConfigGetTunnel = (0, utils_1.newCommand)('tunnel', texts_1.DESC_COMMAND_CONFIG_GET_TUNNEL, { requiredScopes: [], examples: texts_1.EXAMPLE_CONFIG_GET_TUNNEL });
|
|
11
12
|
commandConfigGetTunnel.argument('<name>', texts_1.OPTION_NAME);
|
|
12
13
|
commandConfigGetTunnel.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
14
|
commandConfigGetTunnel.action((name, options) => {
|
|
14
15
|
if (!cfg_1.default.hasTunnel(name)) {
|
|
15
|
-
output_1.default.exitError((0, texts_1.ERR_TUNNEL_NOT_FOUND)(name));
|
|
16
|
+
output_1.default.exitError(new cliError_1.default('not_found', (0, texts_1.ERR_TUNNEL_NOT_FOUND)(name), texts_1.HINT_TUNNEL_CONFIG_LIST));
|
|
16
17
|
}
|
|
17
18
|
if (options.format === 'json') {
|
|
18
19
|
output_1.default.json(cfg_1.default.getTunnel(name));
|
|
@@ -7,7 +7,7 @@ const cfg_1 = __importDefault(require("../../../tunnel/cfg"));
|
|
|
7
7
|
const output_1 = __importDefault(require("../../../output"));
|
|
8
8
|
const texts_1 = require("../../../texts");
|
|
9
9
|
const utils_1 = require("../../../utils");
|
|
10
|
-
const commandConfigGetTunnels = (0, utils_1.newCommand)('tunnels', texts_1.DESC_COMMAND_CONFIG_GET_TUNNELS, { examples: texts_1.EXAMPLE_CONFIG_GET_TUNNELS });
|
|
10
|
+
const commandConfigGetTunnels = (0, utils_1.newCommand)('tunnels', texts_1.DESC_COMMAND_CONFIG_GET_TUNNELS, { requiredScopes: [], examples: texts_1.EXAMPLE_CONFIG_GET_TUNNELS });
|
|
11
11
|
commandConfigGetTunnels.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
12
12
|
commandConfigGetTunnels.action((options) => {
|
|
13
13
|
if (options.format === 'json') {
|
|
@@ -8,8 +8,11 @@ const format_1 = __importDefault(require("../../../format"));
|
|
|
8
8
|
const texts_1 = require("../../../texts");
|
|
9
9
|
const cfg_1 = __importDefault(require("../../../tunnel/cfg"));
|
|
10
10
|
const output_1 = __importDefault(require("../../../output"));
|
|
11
|
-
const commandConfigGetWhitelist = (0, utils_1.newCommand)('whitelist', texts_1.DESC_COMMAND_CONFIG_GET_WHITELIST);
|
|
12
|
-
commandConfigGetWhitelist.
|
|
11
|
+
const commandConfigGetWhitelist = (0, utils_1.newCommand)('whitelist', texts_1.DESC_COMMAND_CONFIG_GET_WHITELIST, { requiredScopes: [] });
|
|
12
|
+
commandConfigGetWhitelist.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
|
+
commandConfigGetWhitelist.action((options) => {
|
|
14
|
+
if (options.format === 'json')
|
|
15
|
+
output_1.default.exitResult(true, { whitelist: cfg_1.default.getWhitelist().length ? cfg_1.default.getWhitelist() : null });
|
|
13
16
|
output_1.default.exitNormal(format_1.default.whitelist(cfg_1.default.getWhitelist()));
|
|
14
17
|
});
|
|
15
18
|
exports.default = commandConfigGetWhitelist;
|
|
@@ -7,9 +7,10 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const cfg_1 = __importDefault(require("../../../tunnel/cfg"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
-
const commandConfigRemoveToken = (0, utils_1.newCommand)('token', texts_1.DESC_COMMAND_CONFIG_REMOVE_TOKEN);
|
|
11
|
-
commandConfigRemoveToken.
|
|
10
|
+
const commandConfigRemoveToken = (0, utils_1.newCommand)('token', texts_1.DESC_COMMAND_CONFIG_REMOVE_TOKEN, { requiredScopes: [] });
|
|
11
|
+
commandConfigRemoveToken.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
12
|
+
commandConfigRemoveToken.action((options) => {
|
|
12
13
|
cfg_1.default.setToken('');
|
|
13
|
-
output_1.default.
|
|
14
|
+
output_1.default.exitResult(options.format === 'json', { removed: 'token' }, texts_1.TXT_TOKEN_REMOVED);
|
|
14
15
|
});
|
|
15
16
|
exports.default = commandConfigRemoveToken;
|
|
@@ -3,17 +3,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const cliError_1 = __importDefault(require("../../../cliError"));
|
|
6
7
|
const cfg_1 = __importDefault(require("../../../tunnel/cfg"));
|
|
7
8
|
const output_1 = __importDefault(require("../../../output"));
|
|
8
9
|
const texts_1 = require("../../../texts");
|
|
9
10
|
const utils_1 = require("../../../utils");
|
|
10
|
-
const commandConfigRemoveTunnel = (0, utils_1.newCommand)('tunnel', texts_1.DESC_COMMAND_CONFIG_REMOVE_TUNNEL);
|
|
11
|
+
const commandConfigRemoveTunnel = (0, utils_1.newCommand)('tunnel', texts_1.DESC_COMMAND_CONFIG_REMOVE_TUNNEL, { requiredScopes: [] });
|
|
11
12
|
commandConfigRemoveTunnel.argument('<name>', texts_1.OPTION_NAME);
|
|
12
|
-
commandConfigRemoveTunnel.
|
|
13
|
+
commandConfigRemoveTunnel.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
|
+
commandConfigRemoveTunnel.action((name, options) => {
|
|
13
15
|
if (!cfg_1.default.hasTunnel(name)) {
|
|
14
|
-
output_1.default.exitError((0, texts_1.ERR_TUNNEL_NOT_FOUND)(name));
|
|
16
|
+
output_1.default.exitError(new cliError_1.default('not_found', (0, texts_1.ERR_TUNNEL_NOT_FOUND)(name), texts_1.HINT_TUNNEL_CONFIG_LIST));
|
|
15
17
|
}
|
|
16
18
|
cfg_1.default.removeTunnel(name);
|
|
17
|
-
output_1.default.
|
|
19
|
+
output_1.default.exitResult(options.format === 'json', { removed: name }, texts_1.TXT_TUNNEL_REMOVED);
|
|
18
20
|
});
|
|
19
21
|
exports.default = commandConfigRemoveTunnel;
|
|
@@ -8,10 +8,11 @@ const output_1 = __importDefault(require("../../../output"));
|
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const texts_1 = require("../../../texts");
|
|
10
10
|
const utils_1 = require("../../../utils");
|
|
11
|
-
const commandConfigSetRegion = (0, utils_1.newCommand)('region', texts_1.DESC_COMMAND_CONFIG_SET_REGION);
|
|
11
|
+
const commandConfigSetRegion = (0, utils_1.newCommand)('region', texts_1.DESC_COMMAND_CONFIG_SET_REGION, { requiredScopes: [] });
|
|
12
12
|
commandConfigSetRegion.argument('<region>', texts_1.OPTION_DEFAULT_REGION);
|
|
13
|
-
commandConfigSetRegion.
|
|
13
|
+
commandConfigSetRegion.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
|
+
commandConfigSetRegion.action((region, options) => {
|
|
14
15
|
cfg_1.default.setRegion(input_1.default.region(region));
|
|
15
|
-
output_1.default.
|
|
16
|
+
output_1.default.exitResult(options.format === 'json', { region: cfg_1.default.getRegion() || null }, texts_1.TXT_REGION_SAVED);
|
|
16
17
|
});
|
|
17
18
|
exports.default = commandConfigSetRegion;
|
|
@@ -8,10 +8,11 @@ const cfg_1 = __importDefault(require("../../../tunnel/cfg"));
|
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const utils_1 = require("../../../utils");
|
|
10
10
|
const texts_1 = require("../../../texts");
|
|
11
|
-
const commandConfigSetTimeout = (0, utils_1.newCommand)('timeout', texts_1.DESC_COMMAND_CONFIG_SET_TIMEOUT);
|
|
11
|
+
const commandConfigSetTimeout = (0, utils_1.newCommand)('timeout', texts_1.DESC_COMMAND_CONFIG_SET_TIMEOUT, { requiredScopes: [] });
|
|
12
12
|
commandConfigSetTimeout.argument('[timeout]', texts_1.OPTION_TIMEOUT, utils_1.DEFAULT_TIMEOUT);
|
|
13
|
-
commandConfigSetTimeout.
|
|
13
|
+
commandConfigSetTimeout.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
|
+
commandConfigSetTimeout.action((timeout, options) => {
|
|
14
15
|
cfg_1.default.setTimeout(input_1.default.timeout(timeout));
|
|
15
|
-
output_1.default.
|
|
16
|
+
output_1.default.exitResult(options.format === 'json', { timeout: cfg_1.default.getTimeout() }, texts_1.TXT_TIMEOUT_SAVED);
|
|
16
17
|
});
|
|
17
18
|
exports.default = commandConfigSetTimeout;
|
|
@@ -5,12 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const cfg_1 = __importDefault(require("../../../tunnel/cfg"));
|
|
7
7
|
const output_1 = __importDefault(require("../../../output"));
|
|
8
|
+
const format_1 = __importDefault(require("../../../format"));
|
|
8
9
|
const texts_1 = require("../../../texts");
|
|
9
10
|
const utils_1 = require("../../../utils");
|
|
10
|
-
const commandConfigSetToken = (0, utils_1.newCommand)('token', texts_1.DESC_COMMAND_CONFIG_SET_TOKEN);
|
|
11
|
+
const commandConfigSetToken = (0, utils_1.newCommand)('token', texts_1.DESC_COMMAND_CONFIG_SET_TOKEN, { requiredScopes: [] });
|
|
11
12
|
commandConfigSetToken.argument('[token]', texts_1.OPTION_TOKEN, '');
|
|
12
|
-
commandConfigSetToken.
|
|
13
|
+
commandConfigSetToken.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
|
+
commandConfigSetToken.action((token, options) => {
|
|
13
15
|
cfg_1.default.setToken(token);
|
|
14
|
-
output_1.default.
|
|
16
|
+
output_1.default.exitResult(options.format === 'json', { token: token ? format_1.default.token(token) : null }, !token ? texts_1.TXT_TOKEN_REMOVED : texts_1.TXT_TOKEN_SAVED);
|
|
15
17
|
});
|
|
16
18
|
exports.default = commandConfigSetToken;
|