bdy 1.18.34-dev → 1.19.0-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 +2 -2
- package/distTs/src/api/client.js +25 -25
- package/distTs/src/command/artifact/create.js +64 -0
- package/distTs/src/command/artifact/delete.js +38 -0
- package/distTs/src/command/artifact/docker/login.js +26 -0
- package/distTs/src/command/artifact/docker.js +11 -0
- package/distTs/src/command/artifact/download.js +138 -0
- package/distTs/src/command/artifact/get.js +36 -0
- package/distTs/src/command/artifact/list.js +31 -0
- package/distTs/src/command/artifact/publish.js +241 -0
- package/distTs/src/command/artifact/version/delete.js +39 -0
- package/distTs/src/command/artifact/version/get.js +45 -0
- package/distTs/src/command/artifact/version/list.js +47 -0
- package/distTs/src/command/artifact/version.js +16 -0
- package/distTs/src/command/artifact.js +26 -0
- package/distTs/src/command/login.js +1 -1
- package/distTs/src/command/project/link.js +2 -2
- package/distTs/src/index.js +2 -2
- package/distTs/src/input.js +8 -8
- package/distTs/src/texts.js +140 -146
- package/distTs/src/utils.js +37 -37
- package/package.json +2 -2
|
@@ -0,0 +1,241 @@
|
|
|
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 output_1 = __importDefault(require("../../output"));
|
|
10
|
+
const logger_1 = __importDefault(require("../../logger"));
|
|
11
|
+
const fs_1 = __importDefault(require("fs"));
|
|
12
|
+
const path_1 = require("path");
|
|
13
|
+
const commandArtifactPublish = (0, utils_1.newCommand)('publish', texts_1.DESC_COMMAND_ARTIFACT_PUBLISH);
|
|
14
|
+
commandArtifactPublish.alias('pub');
|
|
15
|
+
commandArtifactPublish.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
16
|
+
commandArtifactPublish.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
17
|
+
commandArtifactPublish.option('-c, --create', texts_1.OPTION_ARTIFACT_PUBLISH_CREATE);
|
|
18
|
+
commandArtifactPublish.option('-f, --force', texts_1.OPTION_ARTIFACT_PUBLISH_OVERWRITE_VERSION);
|
|
19
|
+
commandArtifactPublish.argument('<identifier>', texts_1.OPTION_ARTIFACT_ID);
|
|
20
|
+
commandArtifactPublish.argument('<directory>', texts_1.OPTION_ARTIFACT_PUBLISH_PATH);
|
|
21
|
+
commandArtifactPublish.addHelpText('after', texts_1.EXAMPLE_ARTIFACT_PUBLISH);
|
|
22
|
+
commandArtifactPublish.action(async (id, path, options) => {
|
|
23
|
+
const { v4 } = require('uuid');
|
|
24
|
+
let dirPath = input_1.default.resolvePath(path);
|
|
25
|
+
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
26
|
+
const project = input_1.default.restApiProject(options.project, true);
|
|
27
|
+
// eslint-disable-next-line prefer-const
|
|
28
|
+
let { identifier, version } = input_1.default.artifactSplitIdentifier(id);
|
|
29
|
+
if (!version)
|
|
30
|
+
version = v4();
|
|
31
|
+
const client = input_1.default.restApiTokenClient();
|
|
32
|
+
const data = await client.getArtifactVersionByIdentifier(workspace, project, identifier, version);
|
|
33
|
+
if (!data || !data.domain) {
|
|
34
|
+
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
35
|
+
}
|
|
36
|
+
if (project && !data.project_identifier) {
|
|
37
|
+
output_1.default.exitError(texts_1.ERR_PROJECT_NOT_FOUND);
|
|
38
|
+
}
|
|
39
|
+
let artifactId = data.artifact_id;
|
|
40
|
+
if (!artifactId) {
|
|
41
|
+
if (options.create) {
|
|
42
|
+
const data = {
|
|
43
|
+
name: identifier,
|
|
44
|
+
identifier,
|
|
45
|
+
type: utils_1.ARTIFACT_TYPE.BUCKET,
|
|
46
|
+
scope: utils_1.ARTIFACT_SCOPE.WORKSPACE,
|
|
47
|
+
authorization: {
|
|
48
|
+
type: utils_1.ARTIFACT_AUTH_TYPE.BUDDY,
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
if (project) {
|
|
52
|
+
data.scope = utils_1.ARTIFACT_SCOPE.PROJECT;
|
|
53
|
+
data.project = {
|
|
54
|
+
name: project,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const d = await client.createArtifact(workspace, data);
|
|
58
|
+
artifactId = d.id;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
output_1.default.exitError(texts_1.ERR_ARTIFACT_PUBLISH_NOT_FOUND);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
let artifactVersionId = data.artifact_version_id;
|
|
65
|
+
let url;
|
|
66
|
+
if (artifactVersionId && !options.force) {
|
|
67
|
+
output_1.default.exitError(texts_1.ERR_ARTIFACT_VERSION_EXISTS);
|
|
68
|
+
}
|
|
69
|
+
if (!artifactVersionId) {
|
|
70
|
+
const d = await client.createArtifactVersion(workspace, artifactId, version);
|
|
71
|
+
url = d.version_url;
|
|
72
|
+
artifactVersionId = d.id;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
const d = await client.getArtifactVersion(workspace, artifactId, artifactVersionId);
|
|
76
|
+
url = d.version_url;
|
|
77
|
+
}
|
|
78
|
+
output_1.default.normal(texts_1.TXT_ARTIFACT_SCANNING_DIR, false);
|
|
79
|
+
const stat = fs_1.default.statSync(dirPath);
|
|
80
|
+
let entries;
|
|
81
|
+
if (stat.isDirectory()) {
|
|
82
|
+
entries = fs_1.default.readdirSync(dirPath, {
|
|
83
|
+
withFileTypes: true,
|
|
84
|
+
recursive: true,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
const parentPath = (0, path_1.dirname)(dirPath);
|
|
89
|
+
entries = [
|
|
90
|
+
{
|
|
91
|
+
isDirectory: () => stat.isDirectory(),
|
|
92
|
+
isFile: () => stat.isFile(),
|
|
93
|
+
isBlockDevice: () => stat.isBlockDevice(),
|
|
94
|
+
isCharacterDevice: () => stat.isCharacterDevice(),
|
|
95
|
+
isFIFO: () => stat.isFIFO(),
|
|
96
|
+
isSocket: () => stat.isSocket(),
|
|
97
|
+
isSymbolicLink: () => stat.isSymbolicLink(),
|
|
98
|
+
name: (0, path_1.basename)(dirPath),
|
|
99
|
+
parentPath,
|
|
100
|
+
},
|
|
101
|
+
];
|
|
102
|
+
dirPath = parentPath;
|
|
103
|
+
}
|
|
104
|
+
if (!entries.length) {
|
|
105
|
+
output_1.default.normal(texts_1.TXT_ARTIFACT_NO_ENTRIES_FOUND);
|
|
106
|
+
output_1.default.exitSuccess((0, texts_1.TXT_ARTIFACT_PUBLISHED)(url));
|
|
107
|
+
}
|
|
108
|
+
else if (entries.length === 1) {
|
|
109
|
+
output_1.default.normal(texts_1.TXT_ARTIFACT_ONE_ENTRY_FOUND);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
output_1.default.normal((0, texts_1.TXT_ARTIFACT_ENTRIES_FOUND)(entries.length));
|
|
113
|
+
}
|
|
114
|
+
output_1.default.normal((0, texts_1.TXT_ARTIFACT_ZIP_ENTRIES)(0));
|
|
115
|
+
const zipPath = (0, path_1.join)((0, utils_1.getHomeDirectory)(), `${v4()}.zip`);
|
|
116
|
+
const clearZip = () => {
|
|
117
|
+
try {
|
|
118
|
+
fs_1.default.rmSync(zipPath);
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
// do nothing
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
let blob;
|
|
125
|
+
try {
|
|
126
|
+
let proc = 0;
|
|
127
|
+
await createZip(dirPath, zipPath, entries, () => {
|
|
128
|
+
proc += 1;
|
|
129
|
+
output_1.default.clearPreviousLine();
|
|
130
|
+
output_1.default.normal((0, texts_1.TXT_ARTIFACT_ZIP_ENTRIES)(proc));
|
|
131
|
+
});
|
|
132
|
+
output_1.default.clearPreviousLine();
|
|
133
|
+
output_1.default.normal(texts_1.TXT_ARTIFACT_ZIPPED);
|
|
134
|
+
blob = await fs_1.default.openAsBlob(zipPath);
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
logger_1.default.error(err);
|
|
138
|
+
clearZip();
|
|
139
|
+
output_1.default.exitError(texts_1.ERR_SWW);
|
|
140
|
+
}
|
|
141
|
+
try {
|
|
142
|
+
output_1.default.normal(texts_1.TXT_ARTIFACT_UPLOADING);
|
|
143
|
+
await client.createArtifactVersionZip(workspace, artifactId, artifactVersionId, blob);
|
|
144
|
+
output_1.default.clearPreviousLine();
|
|
145
|
+
output_1.default.normal(texts_1.TXT_ARTIFACT_UPLOADED);
|
|
146
|
+
clearZip();
|
|
147
|
+
output_1.default.exitSuccess((0, texts_1.TXT_ARTIFACT_PUBLISHED)(url));
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
clearZip();
|
|
151
|
+
logger_1.default.error(err);
|
|
152
|
+
output_1.default.exitError(err);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
const addEntryToZip = (dirPath, zip, entry) => {
|
|
156
|
+
const fflate = require('fflate');
|
|
157
|
+
return new Promise((resolve, reject) => {
|
|
158
|
+
const isDir = entry.isDirectory();
|
|
159
|
+
let name = (0, path_1.join)(entry.parentPath.replace(dirPath, ''), entry.name);
|
|
160
|
+
if (isDir)
|
|
161
|
+
name += '/';
|
|
162
|
+
else
|
|
163
|
+
name = name.replace(/^\//, '');
|
|
164
|
+
const file = new fflate.ZipDeflate(name, {
|
|
165
|
+
level: 3,
|
|
166
|
+
});
|
|
167
|
+
zip.add(file);
|
|
168
|
+
if (isDir) {
|
|
169
|
+
file.push(new Uint8Array(0), true);
|
|
170
|
+
resolve();
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const fullPath = (0, path_1.join)(entry.parentPath, entry.name);
|
|
174
|
+
const rs = fs_1.default.createReadStream(fullPath);
|
|
175
|
+
const finish = (err) => {
|
|
176
|
+
try {
|
|
177
|
+
rs.removeAllListeners();
|
|
178
|
+
rs.close();
|
|
179
|
+
}
|
|
180
|
+
catch {
|
|
181
|
+
// do nothing
|
|
182
|
+
}
|
|
183
|
+
if (err)
|
|
184
|
+
reject(err);
|
|
185
|
+
else
|
|
186
|
+
resolve();
|
|
187
|
+
};
|
|
188
|
+
rs.on('data', (chunk) => {
|
|
189
|
+
file.push(chunk, false);
|
|
190
|
+
});
|
|
191
|
+
rs.on('error', (err) => {
|
|
192
|
+
finish(err);
|
|
193
|
+
});
|
|
194
|
+
rs.on('end', () => {
|
|
195
|
+
file.push(new Uint8Array(0), true);
|
|
196
|
+
finish();
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
const addEntriesToZip = async (dirPath, zip, entries, onEntry) => {
|
|
201
|
+
for (let i = 0; i < entries.length; i += 1) {
|
|
202
|
+
await addEntryToZip(dirPath, zip, entries[i]);
|
|
203
|
+
onEntry();
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
const createZip = (dirPath, zipPath, entries, onEntry) => {
|
|
207
|
+
const fflate = require('fflate');
|
|
208
|
+
return new Promise((resolve, reject) => {
|
|
209
|
+
const ws = fs_1.default.createWriteStream(zipPath);
|
|
210
|
+
let wasError = false;
|
|
211
|
+
const zip = new fflate.Zip((err, data, final) => {
|
|
212
|
+
if (wasError) {
|
|
213
|
+
// do nothing
|
|
214
|
+
}
|
|
215
|
+
else if (err) {
|
|
216
|
+
wasError = true;
|
|
217
|
+
ws.close();
|
|
218
|
+
reject(err);
|
|
219
|
+
}
|
|
220
|
+
else if (final) {
|
|
221
|
+
ws.end(data, () => {
|
|
222
|
+
resolve();
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
ws.write(data);
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
addEntriesToZip(dirPath, zip, entries, onEntry)
|
|
230
|
+
.then(() => {
|
|
231
|
+
zip.end();
|
|
232
|
+
})
|
|
233
|
+
.catch((err) => {
|
|
234
|
+
wasError = true;
|
|
235
|
+
ws.close(() => {
|
|
236
|
+
reject(err);
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
};
|
|
241
|
+
exports.default = commandArtifactPublish;
|
|
@@ -0,0 +1,39 @@
|
|
|
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 output_1 = __importDefault(require("../../../output"));
|
|
10
|
+
const commandArtifactVersionDelete = (0, utils_1.newCommand)('delete', texts_1.DESC_COMMAND_ARTIFACT_VERSION_DELETE);
|
|
11
|
+
commandArtifactVersionDelete.alias('rm');
|
|
12
|
+
commandArtifactVersionDelete.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
|
+
commandArtifactVersionDelete.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
14
|
+
commandArtifactVersionDelete.argument('<identifier>', texts_1.OPT_COMMAND_ARTIFACT_IDENTIFIER);
|
|
15
|
+
commandArtifactVersionDelete.option('-f, --force', texts_1.OPTION_CONFIRM_FORCE);
|
|
16
|
+
commandArtifactVersionDelete.argument('<version>', texts_1.OPT_COMMAND_ARTIFACT_VERSION);
|
|
17
|
+
commandArtifactVersionDelete.addHelpText('after', texts_1.EXAMPLE_ARTIFACT_VERSION_DELETE);
|
|
18
|
+
commandArtifactVersionDelete.action(async (identifier, version, options) => {
|
|
19
|
+
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
20
|
+
const project = input_1.default.restApiProject(options.project, true);
|
|
21
|
+
const client = input_1.default.restApiTokenClient();
|
|
22
|
+
const data = await client.getArtifactVersionByIdentifier(workspace, project, identifier, version);
|
|
23
|
+
if (!data || !data.domain) {
|
|
24
|
+
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
25
|
+
}
|
|
26
|
+
if (!data || !data.artifact_id) {
|
|
27
|
+
output_1.default.exitError(texts_1.ERR_ARTIFACT_NOT_FOUND);
|
|
28
|
+
}
|
|
29
|
+
if (!data || !data.artifact_version_id) {
|
|
30
|
+
output_1.default.exitError(texts_1.ERR_ARTIFACT_VERSION_NOT_FOUND);
|
|
31
|
+
}
|
|
32
|
+
const confirmed = options.force ||
|
|
33
|
+
(await output_1.default.confirm((0, texts_1.TXT_ARTIFACT_VERSION_DELETE_CONFIRM)(identifier, version)));
|
|
34
|
+
if (!confirmed)
|
|
35
|
+
output_1.default.exitNormal();
|
|
36
|
+
await client.deleteArtifactVersion(workspace, data.artifact_id, data.artifact_version_id);
|
|
37
|
+
output_1.default.exitSuccess(texts_1.TXT_ARTIFACT_VERSION_DELETED);
|
|
38
|
+
});
|
|
39
|
+
exports.default = commandArtifactVersionDelete;
|
|
@@ -0,0 +1,45 @@
|
|
|
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 output_1 = __importDefault(require("../../../output"));
|
|
10
|
+
const commandArtifactVersionGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_ARTIFACT_VERSION_GET);
|
|
11
|
+
commandArtifactVersionGet.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
|
+
commandArtifactVersionGet.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
13
|
+
commandArtifactVersionGet.argument('<identifier>', texts_1.OPT_COMMAND_ARTIFACT_IDENTIFIER);
|
|
14
|
+
commandArtifactVersionGet.argument('<version>', texts_1.OPT_COMMAND_ARTIFACT_VERSION);
|
|
15
|
+
commandArtifactVersionGet.addHelpText('after', texts_1.EXAMPLE_ARTIFACT_VERSION_GET);
|
|
16
|
+
commandArtifactVersionGet.action(async (identifier, version, options) => {
|
|
17
|
+
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
18
|
+
const project = input_1.default.restApiProject(options.project, true);
|
|
19
|
+
const client = input_1.default.restApiTokenClient();
|
|
20
|
+
const data = await client.getArtifactVersionByIdentifier(workspace, project, identifier, version);
|
|
21
|
+
if (!data || !data.domain) {
|
|
22
|
+
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
23
|
+
}
|
|
24
|
+
if (!data || !data.artifact_id) {
|
|
25
|
+
output_1.default.exitError(texts_1.ERR_ARTIFACT_NOT_FOUND);
|
|
26
|
+
}
|
|
27
|
+
if (!data || !data.artifact_version_id) {
|
|
28
|
+
output_1.default.exitError(texts_1.ERR_ARTIFACT_VERSION_NOT_FOUND);
|
|
29
|
+
}
|
|
30
|
+
const result = await client.getArtifactVersion(workspace, data.artifact_id, data.artifact_version_id);
|
|
31
|
+
const obj = {
|
|
32
|
+
Version: result.version,
|
|
33
|
+
Size: (0, utils_1.formatBytes)(result.size),
|
|
34
|
+
Created: result.created_date,
|
|
35
|
+
'App url': result.html_url,
|
|
36
|
+
Url: result.version_url,
|
|
37
|
+
};
|
|
38
|
+
output_1.default.object(obj);
|
|
39
|
+
output_1.default.normal('');
|
|
40
|
+
const type = result.version_url.startsWith('https://')
|
|
41
|
+
? utils_1.ARTIFACT_TYPE.BUCKET
|
|
42
|
+
: utils_1.ARTIFACT_TYPE.CONTAINER;
|
|
43
|
+
output_1.default.exitNormal((0, texts_1.TXT_ARTIFACT_VERSION_DOWNLOAD)(type, identifier, version, result.version_url));
|
|
44
|
+
});
|
|
45
|
+
exports.default = commandArtifactVersionGet;
|
|
@@ -0,0 +1,47 @@
|
|
|
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 output_1 = __importDefault(require("../../../output"));
|
|
10
|
+
const commandArtifactVersionList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_ARTIFACT_VERSION_LIST);
|
|
11
|
+
commandArtifactVersionList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
|
+
commandArtifactVersionList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
13
|
+
commandArtifactVersionList.option('--page <number>', texts_1.OPTION_REST_API_PAGE, '1');
|
|
14
|
+
commandArtifactVersionList.option('--per-page <number>', texts_1.OPTION_REST_API_PER_PAGE, '10');
|
|
15
|
+
commandArtifactVersionList.alias('ls');
|
|
16
|
+
commandArtifactVersionList.argument('<identifier>', texts_1.OPT_COMMAND_ARTIFACT_IDENTIFIER);
|
|
17
|
+
commandArtifactVersionList.addHelpText('after', texts_1.EXAMPLE_ARTIFACT_VERSION_LIST);
|
|
18
|
+
commandArtifactVersionList.action(async (identifier, options) => {
|
|
19
|
+
const page = input_1.default.restApiPage(options.page);
|
|
20
|
+
const perPage = input_1.default.restApiPerPage(options.perPage);
|
|
21
|
+
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
22
|
+
const project = input_1.default.restApiProject(options.project, true);
|
|
23
|
+
const client = input_1.default.restApiTokenClient();
|
|
24
|
+
const data = await client.getArtifactVersionByIdentifier(workspace, project, identifier);
|
|
25
|
+
if (!data || !data.domain) {
|
|
26
|
+
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
27
|
+
}
|
|
28
|
+
if (!data || !data.artifact_id) {
|
|
29
|
+
output_1.default.exitError(texts_1.ERR_ARTIFACT_NOT_FOUND);
|
|
30
|
+
}
|
|
31
|
+
const result = await client.getArtifactVersions(workspace, data.artifact_id, page, perPage);
|
|
32
|
+
const table = [['VERSION', 'SIZE', 'CREATED', 'URL']];
|
|
33
|
+
if (!result.versions.length) {
|
|
34
|
+
output_1.default.exitError(texts_1.ERR_ARTIFACT_VERSIONS_NOT_FOUND);
|
|
35
|
+
}
|
|
36
|
+
result.versions.forEach((ver) => {
|
|
37
|
+
table.push([
|
|
38
|
+
ver.version,
|
|
39
|
+
(0, utils_1.formatBytes)(ver.size),
|
|
40
|
+
ver.created_date,
|
|
41
|
+
ver.version_url,
|
|
42
|
+
]);
|
|
43
|
+
});
|
|
44
|
+
output_1.default.table(table);
|
|
45
|
+
output_1.default.exitNormal();
|
|
46
|
+
});
|
|
47
|
+
exports.default = commandArtifactVersionList;
|
|
@@ -0,0 +1,16 @@
|
|
|
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 list_1 = __importDefault(require("./version/list"));
|
|
8
|
+
const texts_1 = require("../../texts");
|
|
9
|
+
const get_1 = __importDefault(require("./version/get"));
|
|
10
|
+
const delete_1 = __importDefault(require("./version/delete"));
|
|
11
|
+
const commandArtifactVersion = (0, utils_1.newCommand)('version', texts_1.DESC_COMMAND_ARTIFACT_VERSION);
|
|
12
|
+
commandArtifactVersion.alias('ver');
|
|
13
|
+
commandArtifactVersion.addCommand(list_1.default);
|
|
14
|
+
commandArtifactVersion.addCommand(get_1.default);
|
|
15
|
+
commandArtifactVersion.addCommand(delete_1.default);
|
|
16
|
+
exports.default = commandArtifactVersion;
|
|
@@ -0,0 +1,26 @@
|
|
|
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 publish_1 = __importDefault(require("./artifact/publish"));
|
|
9
|
+
const download_1 = __importDefault(require("./artifact/download"));
|
|
10
|
+
const list_1 = __importDefault(require("./artifact/list"));
|
|
11
|
+
const create_1 = __importDefault(require("./artifact/create"));
|
|
12
|
+
const delete_1 = __importDefault(require("./artifact/delete"));
|
|
13
|
+
const get_1 = __importDefault(require("./artifact/get"));
|
|
14
|
+
const version_1 = __importDefault(require("./artifact/version"));
|
|
15
|
+
const docker_1 = __importDefault(require("./artifact/docker"));
|
|
16
|
+
const commandArtifact = (0, utils_1.newCommand)('artifact', texts_1.DESC_COMMAND_ARTIFACT);
|
|
17
|
+
commandArtifact.alias('art');
|
|
18
|
+
commandArtifact.addCommand(list_1.default);
|
|
19
|
+
commandArtifact.addCommand(create_1.default);
|
|
20
|
+
commandArtifact.addCommand(get_1.default);
|
|
21
|
+
commandArtifact.addCommand(delete_1.default);
|
|
22
|
+
commandArtifact.addCommand(publish_1.default);
|
|
23
|
+
commandArtifact.addCommand(download_1.default);
|
|
24
|
+
commandArtifact.addCommand(version_1.default);
|
|
25
|
+
commandArtifact.addCommand(docker_1.default);
|
|
26
|
+
exports.default = commandArtifact;
|
|
@@ -57,8 +57,8 @@ const tryNow = () => {
|
|
|
57
57
|
output_1.default.light('bdy tunnel http 3000 ', false);
|
|
58
58
|
output_1.default.muted(' Expose localhost:3000 to the internet');
|
|
59
59
|
output_1.default.dim('$ ', false);
|
|
60
|
-
output_1.default.light('bdy
|
|
61
|
-
output_1.default.muted(' Publish
|
|
60
|
+
output_1.default.light('bdy artifact publish . ', false);
|
|
61
|
+
output_1.default.muted(' Publish an artifact from the current project');
|
|
62
62
|
output_1.default.dim('$ ', false);
|
|
63
63
|
output_1.default.light('bdy sandbox create --run "npm start" ', false);
|
|
64
64
|
output_1.default.muted(' Spin up a cloud sandbox and run your app');
|
package/distTs/src/index.js
CHANGED
|
@@ -22,7 +22,7 @@ const logout_1 = __importDefault(require("./command/logout"));
|
|
|
22
22
|
const workspace_1 = __importDefault(require("./command/workspace"));
|
|
23
23
|
const project_1 = __importDefault(require("./command/project"));
|
|
24
24
|
const whoami_1 = __importDefault(require("./command/whoami"));
|
|
25
|
-
const
|
|
25
|
+
const artifact_1 = __importDefault(require("./command/artifact"));
|
|
26
26
|
const api_1 = __importDefault(require("./command/api"));
|
|
27
27
|
const domain_1 = __importDefault(require("./command/domain"));
|
|
28
28
|
const main_1 = __importDefault(require("./main"));
|
|
@@ -45,7 +45,7 @@ program.addCommand(vt_1.default);
|
|
|
45
45
|
program.addCommand(scrape_1.default);
|
|
46
46
|
program.addCommand(ut_1.default);
|
|
47
47
|
program.addCommand(pipeline_1.default);
|
|
48
|
-
program.addCommand(
|
|
48
|
+
program.addCommand(artifact_1.default);
|
|
49
49
|
program.addCommand(sandbox_1.default);
|
|
50
50
|
program.addCommand(domain_1.default);
|
|
51
51
|
program.addCommand(login_1.default);
|
package/distTs/src/input.js
CHANGED
|
@@ -338,17 +338,17 @@ class Input {
|
|
|
338
338
|
const { token: t, refreshToken, clientId, clientToken, clientSecret, } = this.restApiToken(allowNoToken, token);
|
|
339
339
|
return new ApiClient(baseUrl, t, refreshToken, clientId, clientSecret, clientToken);
|
|
340
340
|
}
|
|
341
|
-
static
|
|
341
|
+
static artifactType(type) {
|
|
342
342
|
if (!type)
|
|
343
|
-
return utils_1.
|
|
344
|
-
if (Object.values(utils_1.
|
|
343
|
+
return utils_1.ARTIFACT_TYPE.BUCKET;
|
|
344
|
+
if (Object.values(utils_1.ARTIFACT_TYPE).includes(type))
|
|
345
345
|
return type;
|
|
346
|
-
output_1.default.exitError(texts_1.
|
|
346
|
+
output_1.default.exitError(texts_1.ERR_COMMAND_ARTIFACT_TYPE);
|
|
347
347
|
}
|
|
348
|
-
static
|
|
348
|
+
static artifactScope(project) {
|
|
349
349
|
if (project)
|
|
350
|
-
return utils_1.
|
|
351
|
-
return utils_1.
|
|
350
|
+
return utils_1.ARTIFACT_SCOPE.PROJECT;
|
|
351
|
+
return utils_1.ARTIFACT_SCOPE.WORKSPACE;
|
|
352
352
|
}
|
|
353
353
|
static pipelineRunPriority(priority) {
|
|
354
354
|
if (!priority)
|
|
@@ -491,7 +491,7 @@ class Input {
|
|
|
491
491
|
}
|
|
492
492
|
return w;
|
|
493
493
|
}
|
|
494
|
-
static
|
|
494
|
+
static artifactSplitIdentifier(identifier) {
|
|
495
495
|
const s = (identifier || '').split('@');
|
|
496
496
|
if (s.length >= 2) {
|
|
497
497
|
return {
|