bdy 1.22.58 → 1.22.60-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/api/client.js +29 -5
- package/distTs/src/command/artifact/create.js +4 -2
- package/distTs/src/command/artifact/delete.js +5 -2
- package/distTs/src/command/artifact/download.js +5 -2
- package/distTs/src/command/artifact/get.js +4 -1
- package/distTs/src/command/artifact/list.js +7 -4
- package/distTs/src/command/artifact/publish.js +8 -5
- package/distTs/src/command/artifact/version/create.js +71 -0
- package/distTs/src/command/artifact/version/delete.js +4 -1
- package/distTs/src/command/artifact/version/get.js +4 -1
- package/distTs/src/command/artifact/version/list.js +4 -1
- package/distTs/src/command/artifact/version.js +2 -0
- package/distTs/src/command/distro/create.js +4 -3
- package/distTs/src/command/distro/delete.js +5 -2
- package/distTs/src/command/distro/list.js +4 -1
- package/distTs/src/command/distro/route/create.js +6 -3
- package/distTs/src/command/distro/route/delete.js +5 -2
- package/distTs/src/command/distro/route/list.js +5 -2
- package/distTs/src/command/distro/route/update.js +7 -4
- package/distTs/src/command/project/link.js +1 -1
- package/distTs/src/command/project/list.js +1 -1
- package/distTs/src/input.js +8 -12
- package/distTs/src/openapi.js +131 -5
- package/distTs/src/output.js +38 -2
- package/distTs/src/texts.js +30 -21
- package/distTs/src/types/distro.js +6 -6
- package/distTs/src/utils.js +2 -8
- package/package.json +1 -1
package/distTs/package.json
CHANGED
package/distTs/src/api/client.js
CHANGED
|
@@ -932,7 +932,27 @@ class ApiClient {
|
|
|
932
932
|
parseResponseBody: true,
|
|
933
933
|
});
|
|
934
934
|
}
|
|
935
|
-
async
|
|
935
|
+
async getAllProjects(workspace, limit = 2000) {
|
|
936
|
+
let page = 1;
|
|
937
|
+
const perPage = 100;
|
|
938
|
+
const projects = [];
|
|
939
|
+
while (page * perPage <= limit) {
|
|
940
|
+
const result = await this.getProjects(workspace, page, perPage);
|
|
941
|
+
if (result.projects && result.projects.length > 0) {
|
|
942
|
+
projects.push(...result.projects);
|
|
943
|
+
if (result.projects.length < perPage)
|
|
944
|
+
break;
|
|
945
|
+
page += 1;
|
|
946
|
+
}
|
|
947
|
+
else {
|
|
948
|
+
break;
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
return {
|
|
952
|
+
projects
|
|
953
|
+
};
|
|
954
|
+
}
|
|
955
|
+
async getProjects(workspace, page = 1, perPage = 100) {
|
|
936
956
|
const query = {
|
|
937
957
|
page: page.toString(),
|
|
938
958
|
per_page: perPage.toString(),
|
|
@@ -1075,13 +1095,17 @@ class ApiClient {
|
|
|
1075
1095
|
rawResponseBody: true,
|
|
1076
1096
|
});
|
|
1077
1097
|
}
|
|
1078
|
-
async createArtifactVersion(workspace, artifactId, version) {
|
|
1098
|
+
async createArtifactVersion(workspace, artifactId, version, from) {
|
|
1099
|
+
const body = {
|
|
1100
|
+
version
|
|
1101
|
+
};
|
|
1102
|
+
if (from) {
|
|
1103
|
+
body.from = from;
|
|
1104
|
+
}
|
|
1079
1105
|
return await this.request({
|
|
1080
1106
|
method: 'POST',
|
|
1081
1107
|
path: `/workspaces/${encodeURIComponent(workspace)}/artifacts/${encodeURIComponent(artifactId)}/versions`,
|
|
1082
|
-
body
|
|
1083
|
-
version,
|
|
1084
|
-
},
|
|
1108
|
+
body,
|
|
1085
1109
|
parseResponseBody: true,
|
|
1086
1110
|
});
|
|
1087
1111
|
}
|
|
@@ -7,12 +7,14 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../output"));
|
|
10
|
+
const distro_1 = require("../../types/distro");
|
|
10
11
|
const commandArtifactCreate = (0, utils_1.newCommand)('create', texts_1.DESC_COMMAND_ARTIFACT_CREATE);
|
|
11
12
|
commandArtifactCreate.alias('add');
|
|
12
13
|
commandArtifactCreate.option('-i, --identifier <identifier>', texts_1.OPT_COMMAND_ARTIFACT_CREATE_IDENTIFIER);
|
|
13
14
|
commandArtifactCreate.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
14
15
|
commandArtifactCreate.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
15
16
|
commandArtifactCreate.option('-t, --type <type>', texts_1.OPT_COMMAND_ARTIFACT_TYPE, utils_1.ARTIFACT_TYPE.BUCKET);
|
|
17
|
+
commandArtifactCreate.option('--scope <scope>', texts_1.OPT_COMMAND_SCOPE);
|
|
16
18
|
commandArtifactCreate.option('-b, --buddy', texts_1.OPTION_HTTP_AUTH_BUDDY);
|
|
17
19
|
commandArtifactCreate.option('-a, --auth <user:pass>', texts_1.OPTION_HTTP_AUTH);
|
|
18
20
|
commandArtifactCreate.argument('[name]', texts_1.OPT_COMMAND_ARTIFACT_NAME);
|
|
@@ -23,7 +25,7 @@ commandArtifactCreate.action(async (name, options) => {
|
|
|
23
25
|
const project = input_1.default.restApiProject(options.project, true);
|
|
24
26
|
const client = input_1.default.restApiTokenClient();
|
|
25
27
|
const type = input_1.default.artifactType(options.type);
|
|
26
|
-
const scope = input_1.default.
|
|
28
|
+
const scope = input_1.default.scope(project, options.scope);
|
|
27
29
|
if (!name) {
|
|
28
30
|
if (options.identifier)
|
|
29
31
|
name = options.identifier;
|
|
@@ -38,7 +40,7 @@ commandArtifactCreate.action(async (name, options) => {
|
|
|
38
40
|
type: utils_1.ARTIFACT_AUTH_TYPE.NONE,
|
|
39
41
|
},
|
|
40
42
|
};
|
|
41
|
-
if (project) {
|
|
43
|
+
if (project && scope === distro_1.SCOPE.PROJECT) {
|
|
42
44
|
data.project = {
|
|
43
45
|
name: project,
|
|
44
46
|
};
|
|
@@ -7,18 +7,21 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../output"));
|
|
10
|
+
const distro_1 = require("../../types/distro");
|
|
10
11
|
const commandArtifactDelete = (0, utils_1.newCommand)('delete', texts_1.DESC_COMMAND_ARTIFACT_DELETE);
|
|
11
12
|
commandArtifactDelete.alias('rm');
|
|
12
13
|
commandArtifactDelete.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
14
|
+
commandArtifactDelete.option('--scope <scope>', texts_1.OPT_COMMAND_SCOPE);
|
|
13
15
|
commandArtifactDelete.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
14
16
|
commandArtifactDelete.option('-f, --force', texts_1.OPTION_CONFIRM_FORCE);
|
|
15
17
|
commandArtifactDelete.argument('<identifier>', texts_1.OPT_COMMAND_ARTIFACT_IDENTIFIER);
|
|
16
18
|
commandArtifactDelete.addHelpText('after', texts_1.EXAMPLE_ARTIFACT_DELETE);
|
|
17
19
|
commandArtifactDelete.action(async (identifier, options) => {
|
|
18
20
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
19
|
-
const project = input_1.default.restApiProject(options.project);
|
|
21
|
+
const project = input_1.default.restApiProject(options.project, true);
|
|
22
|
+
const scope = input_1.default.scope(project, options.scope);
|
|
20
23
|
const client = input_1.default.restApiTokenClient();
|
|
21
|
-
const data = await client.getArtifactVersionByIdentifier(workspace, project, identifier);
|
|
24
|
+
const data = await client.getArtifactVersionByIdentifier(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, identifier);
|
|
22
25
|
if (!data || !data.domain) {
|
|
23
26
|
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
24
27
|
}
|
|
@@ -11,9 +11,11 @@ const logger_1 = __importDefault(require("../../logger"));
|
|
|
11
11
|
const path_1 = require("path");
|
|
12
12
|
const fs_1 = __importDefault(require("fs"));
|
|
13
13
|
const promises_1 = __importDefault(require("node:stream/promises"));
|
|
14
|
+
const distro_1 = require("../../types/distro");
|
|
14
15
|
const commandArtifactDownload = (0, utils_1.newCommand)('download', texts_1.DESC_COMMAND_ARTIFACT_DOWNLOAD);
|
|
15
16
|
commandArtifactDownload.alias('dd');
|
|
16
17
|
commandArtifactDownload.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
18
|
+
commandArtifactDownload.option('--scope <scope>', texts_1.OPT_COMMAND_SCOPE);
|
|
17
19
|
commandArtifactDownload.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
18
20
|
commandArtifactDownload.option('-m, --merge', texts_1.OPTION_ARTIFACT_DOWNLOAD_MERGE);
|
|
19
21
|
commandArtifactDownload.option('-r, --replace', texts_1.OPTION_ARTIFACT_DOWNLOAD_REPLACE);
|
|
@@ -27,13 +29,14 @@ commandArtifactDownload.action(async (id, path, options) => {
|
|
|
27
29
|
const client = input_1.default.restApiTokenClient();
|
|
28
30
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
29
31
|
const project = input_1.default.restApiProject(options.project, true);
|
|
32
|
+
const scope = input_1.default.scope(project, options.scope);
|
|
30
33
|
// eslint-disable-next-line prefer-const
|
|
31
34
|
let { identifier, version, isDefault } = input_1.default.artifactSplitIdentifier(id);
|
|
32
|
-
const data = await client.getArtifactVersionByIdentifier(workspace, project, identifier, version);
|
|
35
|
+
const data = await client.getArtifactVersionByIdentifier(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, identifier, version);
|
|
33
36
|
if (!data || !data.domain) {
|
|
34
37
|
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
35
38
|
}
|
|
36
|
-
if (project && !data.project_identifier) {
|
|
39
|
+
if (project && scope === distro_1.SCOPE.PROJECT && !data.project_identifier) {
|
|
37
40
|
output_1.default.exitError(texts_1.ERR_PROJECT_NOT_FOUND);
|
|
38
41
|
}
|
|
39
42
|
const artifactId = data.artifact_id;
|
|
@@ -7,16 +7,19 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../output"));
|
|
10
|
+
const distro_1 = require("../../types/distro");
|
|
10
11
|
const commandArtifactGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_ARTIFACT_GET);
|
|
11
12
|
commandArtifactGet.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
|
+
commandArtifactGet.option('--scope <scope>', texts_1.OPT_COMMAND_SCOPE);
|
|
12
14
|
commandArtifactGet.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
13
15
|
commandArtifactGet.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
16
|
commandArtifactGet.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
15
17
|
commandArtifactGet.action(async (identifier, options) => {
|
|
16
18
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
17
19
|
const project = input_1.default.restApiProject(options.project, true);
|
|
20
|
+
const scope = input_1.default.scope(project, options.scope);
|
|
18
21
|
const client = input_1.default.restApiTokenClient();
|
|
19
|
-
const data = await client.getArtifactVersionByIdentifier(workspace, project, identifier);
|
|
22
|
+
const data = await client.getArtifactVersionByIdentifier(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, identifier);
|
|
20
23
|
if (!data || !data.domain) {
|
|
21
24
|
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
22
25
|
}
|
|
@@ -7,20 +7,23 @@ const output_1 = __importDefault(require("../../output"));
|
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const input_1 = __importDefault(require("../../input"));
|
|
10
|
+
const distro_1 = require("../../types/distro");
|
|
10
11
|
const commandArtifactList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_ARTIFACT_LIST);
|
|
11
12
|
commandArtifactList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
|
+
commandArtifactList.option('--scope <scope>', texts_1.OPT_COMMAND_SCOPE);
|
|
12
14
|
commandArtifactList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
13
15
|
commandArtifactList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
16
|
commandArtifactList.alias('ls');
|
|
15
17
|
commandArtifactList.action(async (options) => {
|
|
16
18
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
17
19
|
const project = input_1.default.restApiProject(options.project, true);
|
|
20
|
+
const scope = input_1.default.scope(project, options.scope);
|
|
18
21
|
const client = input_1.default.restApiTokenClient();
|
|
19
|
-
const response = await client.getArtifacts(workspace, project);
|
|
22
|
+
const response = await client.getArtifacts(workspace, scope === distro_1.SCOPE.PROJECT ? project : null);
|
|
20
23
|
const artifacts = response.artifacts || [];
|
|
21
24
|
if (options.format === 'json') {
|
|
22
|
-
const filtered =
|
|
23
|
-
? artifacts.filter((a) => a.scope !==
|
|
25
|
+
const filtered = scope === distro_1.SCOPE.PROJECT
|
|
26
|
+
? artifacts.filter((a) => a.scope !== distro_1.SCOPE.WORKSPACE)
|
|
24
27
|
: artifacts;
|
|
25
28
|
output_1.default.json(filtered);
|
|
26
29
|
}
|
|
@@ -30,7 +33,7 @@ commandArtifactList.action(async (options) => {
|
|
|
30
33
|
}
|
|
31
34
|
const data = [['NAME', 'IDENTIFIER', 'TYPE', 'URL']];
|
|
32
35
|
for (const artifact of artifacts) {
|
|
33
|
-
if (
|
|
36
|
+
if (scope === distro_1.SCOPE.PROJECT && artifact.scope === distro_1.SCOPE.WORKSPACE)
|
|
34
37
|
continue;
|
|
35
38
|
data.push([
|
|
36
39
|
artifact.name,
|
|
@@ -10,9 +10,11 @@ const output_1 = __importDefault(require("../../output"));
|
|
|
10
10
|
const logger_1 = __importDefault(require("../../logger"));
|
|
11
11
|
const fs_1 = __importDefault(require("fs"));
|
|
12
12
|
const path_1 = require("path");
|
|
13
|
+
const distro_1 = require("../../types/distro");
|
|
13
14
|
const commandArtifactPublish = (0, utils_1.newCommand)('publish', texts_1.DESC_COMMAND_ARTIFACT_PUBLISH);
|
|
14
15
|
commandArtifactPublish.alias('pub');
|
|
15
16
|
commandArtifactPublish.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
17
|
+
commandArtifactPublish.option('--scope <scope>', texts_1.OPT_COMMAND_SCOPE);
|
|
16
18
|
commandArtifactPublish.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
17
19
|
commandArtifactPublish.option('-c, --create', texts_1.OPTION_ARTIFACT_PUBLISH_CREATE);
|
|
18
20
|
commandArtifactPublish.option('-f, --force', texts_1.OPTION_ARTIFACT_PUBLISH_OVERWRITE_VERSION);
|
|
@@ -24,13 +26,14 @@ commandArtifactPublish.action(async (id, path, options) => {
|
|
|
24
26
|
let dirPath = input_1.default.resolvePath(path);
|
|
25
27
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
26
28
|
const project = input_1.default.restApiProject(options.project, true);
|
|
29
|
+
const scope = input_1.default.scope(project, options.scope);
|
|
27
30
|
const { identifier, version } = input_1.default.artifactSplitIdentifier(id);
|
|
28
31
|
const client = input_1.default.restApiTokenClient();
|
|
29
|
-
const data = await client.getArtifactVersionByIdentifier(workspace, project, identifier, version);
|
|
32
|
+
const data = await client.getArtifactVersionByIdentifier(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, identifier, version);
|
|
30
33
|
if (!data || !data.domain) {
|
|
31
34
|
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
32
35
|
}
|
|
33
|
-
if (
|
|
36
|
+
if (scope === distro_1.SCOPE.PROJECT && !data.project_identifier) {
|
|
34
37
|
output_1.default.exitError(texts_1.ERR_PROJECT_NOT_FOUND);
|
|
35
38
|
}
|
|
36
39
|
let artifactId = data.artifact_id;
|
|
@@ -40,13 +43,13 @@ commandArtifactPublish.action(async (id, path, options) => {
|
|
|
40
43
|
name: identifier,
|
|
41
44
|
identifier,
|
|
42
45
|
type: utils_1.ARTIFACT_TYPE.BUCKET,
|
|
43
|
-
scope:
|
|
46
|
+
scope: distro_1.SCOPE.WORKSPACE,
|
|
44
47
|
authorization: {
|
|
45
48
|
type: utils_1.ARTIFACT_AUTH_TYPE.NONE,
|
|
46
49
|
},
|
|
47
50
|
};
|
|
48
|
-
if (project) {
|
|
49
|
-
data.scope =
|
|
51
|
+
if (scope === distro_1.SCOPE.PROJECT && project) {
|
|
52
|
+
data.scope = distro_1.SCOPE.PROJECT;
|
|
50
53
|
data.project = {
|
|
51
54
|
name: project,
|
|
52
55
|
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const utils_1 = require("../../../utils");
|
|
7
|
+
const texts_1 = require("../../../texts");
|
|
8
|
+
const input_1 = __importDefault(require("../../../input"));
|
|
9
|
+
const distro_1 = require("../../../types/distro");
|
|
10
|
+
const output_1 = __importDefault(require("../../../output"));
|
|
11
|
+
const commandArtifactVersionCreate = (0, utils_1.newCommand)('create', texts_1.DESC_COMMAND_ARTIFACT_VERSION_CREATE);
|
|
12
|
+
commandArtifactVersionCreate.alias('add');
|
|
13
|
+
commandArtifactVersionCreate.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
14
|
+
commandArtifactVersionCreate.option('--scope <scope>', texts_1.OPT_COMMAND_SCOPE);
|
|
15
|
+
commandArtifactVersionCreate.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
16
|
+
commandArtifactVersionCreate.option('-c, --create', texts_1.OPTION_ARTIFACT_PUBLISH_CREATE);
|
|
17
|
+
commandArtifactVersionCreate.option('--from <version>', texts_1.OPTION_ARTIFACT_VERSION_FROM);
|
|
18
|
+
commandArtifactVersionCreate.argument('<identifier>', texts_1.OPTION_ARTIFACT_ID);
|
|
19
|
+
commandArtifactVersionCreate.addHelpText('after', texts_1.EXAMPLE_ARTIFACT_VERSION_CREATE);
|
|
20
|
+
commandArtifactVersionCreate.action(async (id, options) => {
|
|
21
|
+
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
22
|
+
const project = input_1.default.restApiProject(options.project, true);
|
|
23
|
+
const scope = input_1.default.scope(project, options.scope);
|
|
24
|
+
const { identifier, version } = input_1.default.artifactSplitIdentifier(id);
|
|
25
|
+
const client = input_1.default.restApiTokenClient();
|
|
26
|
+
const data = await client.getArtifactVersionByIdentifier(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, identifier, version);
|
|
27
|
+
if (!data || !data.domain) {
|
|
28
|
+
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
29
|
+
}
|
|
30
|
+
if (scope === distro_1.SCOPE.PROJECT && !data.project_identifier) {
|
|
31
|
+
output_1.default.exitError(texts_1.ERR_PROJECT_NOT_FOUND);
|
|
32
|
+
}
|
|
33
|
+
let artifactId = data.artifact_id;
|
|
34
|
+
if (!artifactId) {
|
|
35
|
+
if (options.create) {
|
|
36
|
+
const data = {
|
|
37
|
+
name: identifier,
|
|
38
|
+
identifier,
|
|
39
|
+
type: utils_1.ARTIFACT_TYPE.BUCKET,
|
|
40
|
+
scope: distro_1.SCOPE.WORKSPACE,
|
|
41
|
+
authorization: {
|
|
42
|
+
type: utils_1.ARTIFACT_AUTH_TYPE.NONE,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
if (scope === distro_1.SCOPE.PROJECT && project) {
|
|
46
|
+
data.scope = distro_1.SCOPE.PROJECT;
|
|
47
|
+
data.project = {
|
|
48
|
+
name: project,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
const d = await client.createArtifact(workspace, data);
|
|
52
|
+
artifactId = d.id;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
output_1.default.exitError(texts_1.ERR_ARTIFACT_PUBLISH_NOT_FOUND);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const artifactVersionId = data.artifact_version_id;
|
|
59
|
+
if (artifactVersionId) {
|
|
60
|
+
output_1.default.exitError(texts_1.ERR_ARTIFACT_VERSION_EXISTS_NO_FORCE);
|
|
61
|
+
}
|
|
62
|
+
const d = await client.createArtifactVersion(workspace, artifactId, version, options.from);
|
|
63
|
+
const url = d.version_url;
|
|
64
|
+
output_1.default.object({
|
|
65
|
+
Version: `${identifier}:${version}`,
|
|
66
|
+
URL: url || '-',
|
|
67
|
+
});
|
|
68
|
+
output_1.default.normal((0, texts_1.TXT_ROUTE_SERVE)(`artifact=${identifier}:${version}`));
|
|
69
|
+
output_1.default.exitNormal();
|
|
70
|
+
});
|
|
71
|
+
exports.default = commandArtifactVersionCreate;
|
|
@@ -7,11 +7,13 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
+
const distro_1 = require("../../../types/distro");
|
|
10
11
|
const commandArtifactVersionDelete = (0, utils_1.newCommand)('delete', texts_1.DESC_COMMAND_ARTIFACT_VERSION_DELETE);
|
|
11
12
|
commandArtifactVersionDelete.alias('rm');
|
|
12
13
|
commandArtifactVersionDelete.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
14
|
commandArtifactVersionDelete.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
14
15
|
commandArtifactVersionDelete.argument('<identifier>', texts_1.OPT_COMMAND_ARTIFACT_IDENTIFIER);
|
|
16
|
+
commandArtifactVersionDelete.option('--scope <scope>', texts_1.OPT_COMMAND_SCOPE);
|
|
15
17
|
commandArtifactVersionDelete.option('-f, --force', texts_1.OPTION_CONFIRM_FORCE);
|
|
16
18
|
commandArtifactVersionDelete.argument('<version>', texts_1.OPT_COMMAND_ARTIFACT_VERSION);
|
|
17
19
|
commandArtifactVersionDelete.addHelpText('after', texts_1.EXAMPLE_ARTIFACT_VERSION_DELETE);
|
|
@@ -19,7 +21,8 @@ commandArtifactVersionDelete.action(async (identifier, version, options) => {
|
|
|
19
21
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
20
22
|
const project = input_1.default.restApiProject(options.project, true);
|
|
21
23
|
const client = input_1.default.restApiTokenClient();
|
|
22
|
-
const
|
|
24
|
+
const scope = input_1.default.scope(project, options.scope);
|
|
25
|
+
const data = await client.getArtifactVersionByIdentifier(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, identifier, version);
|
|
23
26
|
if (!data || !data.domain) {
|
|
24
27
|
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
25
28
|
}
|
|
@@ -7,18 +7,21 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
+
const distro_1 = require("../../../types/distro");
|
|
10
11
|
const commandArtifactVersionGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_ARTIFACT_VERSION_GET);
|
|
11
12
|
commandArtifactVersionGet.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
13
|
commandArtifactVersionGet.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
13
14
|
commandArtifactVersionGet.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
15
|
commandArtifactVersionGet.argument('<identifier>', texts_1.OPT_COMMAND_ARTIFACT_IDENTIFIER);
|
|
16
|
+
commandArtifactVersionGet.option('--scope <scope>', texts_1.OPT_COMMAND_SCOPE);
|
|
15
17
|
commandArtifactVersionGet.argument('<version>', texts_1.OPT_COMMAND_ARTIFACT_VERSION);
|
|
16
18
|
commandArtifactVersionGet.addHelpText('after', texts_1.EXAMPLE_ARTIFACT_VERSION_GET);
|
|
17
19
|
commandArtifactVersionGet.action(async (identifier, version, options) => {
|
|
18
20
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
19
21
|
const project = input_1.default.restApiProject(options.project, true);
|
|
22
|
+
const scope = input_1.default.scope(project, options.scope);
|
|
20
23
|
const client = input_1.default.restApiTokenClient();
|
|
21
|
-
const data = await client.getArtifactVersionByIdentifier(workspace, project, identifier, version);
|
|
24
|
+
const data = await client.getArtifactVersionByIdentifier(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, identifier, version);
|
|
22
25
|
if (!data || !data.domain) {
|
|
23
26
|
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
24
27
|
}
|
|
@@ -7,6 +7,7 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
+
const distro_1 = require("../../../types/distro");
|
|
10
11
|
const commandArtifactVersionList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_ARTIFACT_VERSION_LIST);
|
|
11
12
|
commandArtifactVersionList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
13
|
commandArtifactVersionList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
@@ -15,14 +16,16 @@ commandArtifactVersionList.option('--per-page <number>', texts_1.OPTION_REST_API
|
|
|
15
16
|
commandArtifactVersionList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
16
17
|
commandArtifactVersionList.alias('ls');
|
|
17
18
|
commandArtifactVersionList.argument('<identifier>', texts_1.OPT_COMMAND_ARTIFACT_IDENTIFIER);
|
|
19
|
+
commandArtifactVersionList.option('--scope <scope>', texts_1.OPT_COMMAND_SCOPE);
|
|
18
20
|
commandArtifactVersionList.addHelpText('after', texts_1.EXAMPLE_ARTIFACT_VERSION_LIST);
|
|
19
21
|
commandArtifactVersionList.action(async (identifier, options) => {
|
|
20
22
|
const page = input_1.default.restApiPage(options.page);
|
|
21
23
|
const perPage = input_1.default.restApiPerPage(options.perPage);
|
|
22
24
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
23
25
|
const project = input_1.default.restApiProject(options.project, true);
|
|
26
|
+
const scope = input_1.default.scope(project, options.scope);
|
|
24
27
|
const client = input_1.default.restApiTokenClient();
|
|
25
|
-
const data = await client.getArtifactVersionByIdentifier(workspace, project, identifier);
|
|
28
|
+
const data = await client.getArtifactVersionByIdentifier(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, identifier);
|
|
26
29
|
if (!data || !data.domain) {
|
|
27
30
|
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
28
31
|
}
|
|
@@ -8,9 +8,11 @@ const list_1 = __importDefault(require("./version/list"));
|
|
|
8
8
|
const texts_1 = require("../../texts");
|
|
9
9
|
const get_1 = __importDefault(require("./version/get"));
|
|
10
10
|
const delete_1 = __importDefault(require("./version/delete"));
|
|
11
|
+
const create_1 = __importDefault(require("./version/create"));
|
|
11
12
|
const commandArtifactVersion = (0, utils_1.newCommand)('version', texts_1.DESC_COMMAND_ARTIFACT_VERSION);
|
|
12
13
|
commandArtifactVersion.alias('ver');
|
|
13
14
|
commandArtifactVersion.addCommand(list_1.default);
|
|
14
15
|
commandArtifactVersion.addCommand(get_1.default);
|
|
15
16
|
commandArtifactVersion.addCommand(delete_1.default);
|
|
17
|
+
commandArtifactVersion.addCommand(create_1.default);
|
|
16
18
|
exports.default = commandArtifactVersion;
|
|
@@ -7,11 +7,12 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../output"));
|
|
10
|
+
const distro_1 = require("../../types/distro");
|
|
10
11
|
const commandDistroCreate = (0, utils_1.newCommand)('create', texts_1.DESC_COMMAND_DISTRO_CREATE);
|
|
11
12
|
commandDistroCreate.alias('add');
|
|
12
13
|
commandDistroCreate.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
14
|
commandDistroCreate.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
14
|
-
commandDistroCreate.option('
|
|
15
|
+
commandDistroCreate.option('--scope <scope>', texts_1.OPT_COMMAND_SCOPE);
|
|
15
16
|
commandDistroCreate.option('-i, --identifier <identifier>', texts_1.OPT_COMMAND_DISTRO_IDENTIFIER);
|
|
16
17
|
commandDistroCreate.option('-n, --name <name>', texts_1.OPT_COMMAND_DISTRO_NAME);
|
|
17
18
|
commandDistroCreate.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_DISTRO_CREATE}`);
|
|
@@ -20,7 +21,7 @@ commandDistroCreate.action(async (options) => {
|
|
|
20
21
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
21
22
|
const project = input_1.default.restApiProject(options.project, true);
|
|
22
23
|
const client = input_1.default.restApiTokenClient();
|
|
23
|
-
const scope = input_1.default.
|
|
24
|
+
const scope = input_1.default.scope(project, options.scope);
|
|
24
25
|
const timestamp = Date.now().toString(36);
|
|
25
26
|
const baseName = humanId({ separator: '-', capitalize: false });
|
|
26
27
|
const defaultIdentifier = `${baseName}-${timestamp}`;
|
|
@@ -29,7 +30,7 @@ commandDistroCreate.action(async (options) => {
|
|
|
29
30
|
identifier: options.identifier || defaultIdentifier,
|
|
30
31
|
scope,
|
|
31
32
|
};
|
|
32
|
-
if (project)
|
|
33
|
+
if (project && scope === distro_1.SCOPE.PROJECT)
|
|
33
34
|
body.project_name = project;
|
|
34
35
|
const result = await client.createDistro(workspace, body);
|
|
35
36
|
output_1.default.identifier(result.identifier);
|
|
@@ -7,9 +7,11 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../output"));
|
|
10
|
+
const distro_1 = require("../../types/distro");
|
|
10
11
|
const commandDistroDelete = (0, utils_1.newCommand)('delete', texts_1.DESC_COMMAND_DISTRO_DELETE);
|
|
11
12
|
commandDistroDelete.alias('rm');
|
|
12
13
|
commandDistroDelete.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
14
|
+
commandDistroDelete.option('--scope <scope>', texts_1.OPT_COMMAND_SCOPE);
|
|
13
15
|
commandDistroDelete.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
14
16
|
commandDistroDelete.option('-f, --force', texts_1.OPTION_CONFIRM_FORCE);
|
|
15
17
|
commandDistroDelete.argument('<identifier>', texts_1.OPT_COMMAND_DISTRO_IDENTIFIER);
|
|
@@ -17,8 +19,9 @@ commandDistroDelete.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_DISTRO_DE
|
|
|
17
19
|
commandDistroDelete.action(async (identifier, options) => {
|
|
18
20
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
19
21
|
const project = input_1.default.restApiProject(options.project, true);
|
|
22
|
+
const scope = input_1.default.scope(project, options.scope);
|
|
20
23
|
const client = input_1.default.restApiTokenClient();
|
|
21
|
-
const data = await client.getDistributionByIdentifier(workspace, project, identifier);
|
|
24
|
+
const data = await client.getDistributionByIdentifier(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, identifier);
|
|
22
25
|
if (!data || !data.domain) {
|
|
23
26
|
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
24
27
|
}
|
|
@@ -28,7 +31,7 @@ commandDistroDelete.action(async (identifier, options) => {
|
|
|
28
31
|
const confirmed = options.force ||
|
|
29
32
|
(await output_1.default.confirm((0, texts_1.TXT_COMMAND_DISTRO_DELETE_CONFIRM)(identifier)));
|
|
30
33
|
if (confirmed) {
|
|
31
|
-
await client.deleteDistribution(workspace, project, data.distribution_id);
|
|
34
|
+
await client.deleteDistribution(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, data.distribution_id);
|
|
32
35
|
output_1.default.exitSuccess(texts_1.TXT_COMMAND_DISTRO_DELETED);
|
|
33
36
|
}
|
|
34
37
|
else {
|
|
@@ -7,17 +7,20 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../output"));
|
|
10
|
+
const distro_1 = require("../../types/distro");
|
|
10
11
|
const commandDistroList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_DISTRO_LIST);
|
|
11
12
|
commandDistroList.alias('ls');
|
|
12
13
|
commandDistroList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
14
|
commandDistroList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
14
15
|
commandDistroList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
15
16
|
commandDistroList.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_DISTRO_LIST}`);
|
|
17
|
+
commandDistroList.option('--scope <scope>', texts_1.OPT_COMMAND_SCOPE);
|
|
16
18
|
commandDistroList.action(async (options) => {
|
|
17
19
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
18
20
|
const project = input_1.default.restApiProject(options.project, true);
|
|
21
|
+
const scope = input_1.default.scope(project, options.scope);
|
|
19
22
|
const client = input_1.default.restApiTokenClient();
|
|
20
|
-
const r = await client.getDistributions(workspace, project);
|
|
23
|
+
const r = await client.getDistributions(workspace, scope === distro_1.SCOPE.PROJECT ? project : null);
|
|
21
24
|
const distributions = r.distributions || [];
|
|
22
25
|
if (options.format === 'json') {
|
|
23
26
|
output_1.default.json(distributions);
|
|
@@ -7,10 +7,12 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
+
const distro_1 = require("../../../types/distro");
|
|
10
11
|
const commandDistroRouteCreate = (0, utils_1.newCommand)('create', texts_1.DESC_COMMAND_ROUTE_CREATE);
|
|
11
12
|
commandDistroRouteCreate.alias('add');
|
|
12
13
|
commandDistroRouteCreate.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
14
|
commandDistroRouteCreate.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
15
|
+
commandDistroRouteCreate.option('--scope <scope>', texts_1.OPT_COMMAND_SCOPE);
|
|
14
16
|
commandDistroRouteCreate.option('-t, --type <type>', texts_1.OPT_COMMAND_ROUTE_TYPE);
|
|
15
17
|
commandDistroRouteCreate.option('-s, --subdomain <subdomain>', texts_1.OPT_COMMAND_ROUTE_SUBDOMAIN);
|
|
16
18
|
commandDistroRouteCreate.option('-d, --domain <domain>', texts_1.OPT_COMMAND_ROUTE_DOMAIN);
|
|
@@ -21,6 +23,7 @@ commandDistroRouteCreate.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_ROUT
|
|
|
21
23
|
commandDistroRouteCreate.action(async (identifier, options) => {
|
|
22
24
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
23
25
|
const project = input_1.default.restApiProject(options.project, true);
|
|
26
|
+
const scope = input_1.default.scope(project, options.scope);
|
|
24
27
|
const client = input_1.default.restApiTokenClient();
|
|
25
28
|
const type = input_1.default.routeType(options.type);
|
|
26
29
|
const body = {
|
|
@@ -33,15 +36,15 @@ commandDistroRouteCreate.action(async (identifier, options) => {
|
|
|
33
36
|
body.domain = options.domain;
|
|
34
37
|
if (options.path)
|
|
35
38
|
body.path = input_1.default.routePath(options.path);
|
|
36
|
-
const data = await client.getDistributionByIdentifier(workspace, project, identifier);
|
|
39
|
+
const data = await client.getDistributionByIdentifier(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, identifier);
|
|
37
40
|
if (!data?.domain) {
|
|
38
41
|
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
39
42
|
}
|
|
40
43
|
if (!data?.distribution_id) {
|
|
41
44
|
output_1.default.exitError(texts_1.ERR_COMMAND_DISTRO_NOT_FOUND);
|
|
42
45
|
}
|
|
43
|
-
body.targets = await input_1.default.routeTarget(client, workspace, project, options.target);
|
|
44
|
-
const result = await client.createRoute(workspace, project, data.distribution_id, body);
|
|
46
|
+
body.targets = await input_1.default.routeTarget(client, workspace, scope === distro_1.SCOPE.PROJECT ? project : null, options.target);
|
|
47
|
+
const result = await client.createRoute(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, data.distribution_id, body);
|
|
45
48
|
output_1.default.id(result.id);
|
|
46
49
|
output_1.default.cyan(result.html_url);
|
|
47
50
|
output_1.default.green(texts_1.TXT_COMMAND_ROUTE_CREATED);
|
|
@@ -7,10 +7,12 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
+
const distro_1 = require("../../../types/distro");
|
|
10
11
|
const commandDistroRouteDelete = (0, utils_1.newCommand)('delete', texts_1.DESC_COMMAND_ROUTE_DELETE);
|
|
11
12
|
commandDistroRouteDelete.alias('rm');
|
|
12
13
|
commandDistroRouteDelete.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
14
|
commandDistroRouteDelete.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
15
|
+
commandDistroRouteDelete.option('--scope <scope>', texts_1.OPT_COMMAND_SCOPE);
|
|
14
16
|
commandDistroRouteDelete.option('-f, --force', texts_1.OPTION_CONFIRM_FORCE);
|
|
15
17
|
commandDistroRouteDelete.argument('<identifier>', texts_1.OPT_COMMAND_DISTRO_IDENTIFIER);
|
|
16
18
|
commandDistroRouteDelete.argument('<route-id>', texts_1.OPT_COMMAND_ROUTE_ID);
|
|
@@ -18,8 +20,9 @@ commandDistroRouteDelete.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_ROUT
|
|
|
18
20
|
commandDistroRouteDelete.action(async (identifier, routeId, options) => {
|
|
19
21
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
20
22
|
const project = input_1.default.restApiProject(options.project, true);
|
|
23
|
+
const scope = input_1.default.scope(project, options.scope);
|
|
21
24
|
const client = input_1.default.restApiTokenClient();
|
|
22
|
-
const data = await client.getDistributionByIdentifier(workspace, project, identifier);
|
|
25
|
+
const data = await client.getDistributionByIdentifier(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, identifier);
|
|
23
26
|
if (!data?.domain) {
|
|
24
27
|
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
25
28
|
}
|
|
@@ -29,7 +32,7 @@ commandDistroRouteDelete.action(async (identifier, routeId, options) => {
|
|
|
29
32
|
const confirmed = options.force ||
|
|
30
33
|
(await output_1.default.confirm((0, texts_1.TXT_COMMAND_ROUTE_DELETE_CONFIRM)(identifier, routeId)));
|
|
31
34
|
if (confirmed) {
|
|
32
|
-
await client.deleteRoute(workspace, project, data.distribution_id, routeId);
|
|
35
|
+
await client.deleteRoute(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, data.distribution_id, routeId);
|
|
33
36
|
output_1.default.exitSuccess(texts_1.TXT_COMMAND_ROUTE_DELETED);
|
|
34
37
|
}
|
|
35
38
|
else {
|
|
@@ -7,9 +7,11 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
+
const distro_1 = require("../../../types/distro");
|
|
10
11
|
const commandDistroRouteList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_ROUTE_LIST);
|
|
11
12
|
commandDistroRouteList.alias('ls');
|
|
12
13
|
commandDistroRouteList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
14
|
+
commandDistroRouteList.option('--scope <scope>', texts_1.OPT_COMMAND_SCOPE);
|
|
13
15
|
commandDistroRouteList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
14
16
|
commandDistroRouteList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
15
17
|
commandDistroRouteList.argument('<identifier>', texts_1.OPT_COMMAND_DISTRO_IDENTIFIER);
|
|
@@ -17,15 +19,16 @@ commandDistroRouteList.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_ROUTE_
|
|
|
17
19
|
commandDistroRouteList.action(async (identifier, options) => {
|
|
18
20
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
19
21
|
const project = input_1.default.restApiProject(options.project, true);
|
|
22
|
+
const scope = input_1.default.scope(project, options.scope);
|
|
20
23
|
const client = input_1.default.restApiTokenClient();
|
|
21
|
-
const data = await client.getDistributionByIdentifier(workspace, project, identifier);
|
|
24
|
+
const data = await client.getDistributionByIdentifier(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, identifier);
|
|
22
25
|
if (!data?.domain) {
|
|
23
26
|
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
24
27
|
}
|
|
25
28
|
if (!data?.distribution_id) {
|
|
26
29
|
output_1.default.exitError(texts_1.ERR_COMMAND_DISTRO_NOT_FOUND);
|
|
27
30
|
}
|
|
28
|
-
const r = await client.listRoutes(workspace, project, data.distribution_id);
|
|
31
|
+
const r = await client.listRoutes(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, data.distribution_id);
|
|
29
32
|
const routes = r.routes || [];
|
|
30
33
|
if (options.format === 'json') {
|
|
31
34
|
output_1.default.json(routes);
|