bdy 1.17.3-dev → 1.17.5-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/command/agent/install.js +24 -32
- package/distTs/src/command/api/info.js +13 -5
- package/distTs/src/command/api/list.js +15 -5
- package/distTs/src/command/api/request.js +1 -4
- package/distTs/src/command/logout.js +1 -7
- package/distTs/src/command/package/create.js +1 -4
- package/distTs/src/command/package/delete.js +1 -4
- package/distTs/src/command/package/docker/login.js +3 -6
- package/distTs/src/command/package/download.js +1 -4
- package/distTs/src/command/package/get.js +7 -10
- package/distTs/src/command/package/list.js +1 -4
- package/distTs/src/command/package/publish.js +1 -4
- package/distTs/src/command/package/version/delete.js +1 -4
- package/distTs/src/command/package/version/get.js +1 -4
- package/distTs/src/command/package/version/list.js +1 -4
- package/distTs/src/command/pipeline/run.js +1 -4
- package/distTs/src/command/project/list.js +1 -4
- package/distTs/src/command/project/set.js +1 -4
- package/distTs/src/command/sandbox/cp.js +1 -4
- package/distTs/src/command/sandbox/create.js +1 -4
- package/distTs/src/command/sandbox/destroy.js +1 -4
- package/distTs/src/command/sandbox/endpoint/add.js +1 -1
- package/distTs/src/command/sandbox/endpoint/delete.js +1 -4
- package/distTs/src/command/sandbox/endpoint/get.js +1 -4
- package/distTs/src/command/sandbox/endpoint/list.js +1 -4
- package/distTs/src/command/sandbox/exec/command.js +1 -4
- package/distTs/src/command/sandbox/exec/kill.js +1 -4
- package/distTs/src/command/sandbox/exec/list.js +1 -4
- package/distTs/src/command/sandbox/exec/logs.js +1 -4
- package/distTs/src/command/sandbox/exec/status.js +1 -4
- package/distTs/src/command/sandbox/get.js +1 -4
- package/distTs/src/command/sandbox/list.js +5 -5
- package/distTs/src/command/sandbox/restart.js +1 -4
- package/distTs/src/command/sandbox/snapshot/create.js +1 -4
- package/distTs/src/command/sandbox/snapshot/delete.js +1 -4
- package/distTs/src/command/sandbox/snapshot/get.js +1 -4
- package/distTs/src/command/sandbox/snapshot/list.js +1 -4
- package/distTs/src/command/sandbox/start.js +1 -4
- package/distTs/src/command/sandbox/status.js +1 -4
- package/distTs/src/command/sandbox/stop.js +1 -4
- package/distTs/src/command/tunnel/http.js +2 -2
- package/distTs/src/command/tunnel/start.js +5 -2
- package/distTs/src/command/tunnel/tcp.js +2 -2
- package/distTs/src/command/tunnel/tls.js +2 -2
- package/distTs/src/command/whoami.js +1 -11
- package/distTs/src/command/workspace/list.js +2 -5
- package/distTs/src/command/workspace/set.js +2 -5
- package/distTs/src/input.js +37 -58
- package/distTs/src/output.js +12 -0
- package/distTs/src/texts.js +2 -2
- package/distTs/src/tunnel/cfg.js +3 -18
- package/distTs/src/tunnel/tunnel.js +25 -16
- package/distTs/src/utils.js +0 -3
- package/package.json +2 -2
package/distTs/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bdy",
|
|
3
3
|
"preferGlobal": false,
|
|
4
|
-
"version": "1.17.
|
|
4
|
+
"version": "1.17.5-dev",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@scalar/json-magic": "0.9.4",
|
|
34
34
|
"@scalar/types": "0.5.10",
|
|
35
35
|
"@scalar/openapi-types": "0.5.3",
|
|
36
|
-
"fastify": "4.
|
|
36
|
+
"fastify": "4.29.1",
|
|
37
37
|
"fdir": "6.5.0",
|
|
38
38
|
"open": "11.0.0",
|
|
39
39
|
"fflate": "0.8.2",
|
|
@@ -64,40 +64,36 @@ const installService = async (options) => {
|
|
|
64
64
|
if (!isSupported) {
|
|
65
65
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_SUPPORTED);
|
|
66
66
|
}
|
|
67
|
+
const { token, host } = await input_1.default.tunnelToken(options.token);
|
|
67
68
|
let id = '';
|
|
68
|
-
let
|
|
69
|
+
let agentToken = '';
|
|
69
70
|
let agent;
|
|
70
71
|
const port = input_1.default.port(options.port);
|
|
71
72
|
const target = !!options.target;
|
|
72
|
-
if (options.id && options.
|
|
73
|
+
if (options.id && options.agentToken) {
|
|
73
74
|
// if id & token passed set as it is
|
|
74
75
|
id = options.id;
|
|
75
|
-
|
|
76
|
+
agentToken = options.agentToken;
|
|
76
77
|
try {
|
|
77
|
-
agent = await buddy_1.default.fetchAgent(id,
|
|
78
|
+
agent = await buddy_1.default.fetchAgent(id, host, agentToken);
|
|
78
79
|
}
|
|
79
80
|
catch {
|
|
80
81
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_FOUND);
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
|
-
else {
|
|
84
|
-
// set global token if passed
|
|
85
|
-
await input_1.default.tunnelToken(options.token);
|
|
86
|
-
}
|
|
87
|
-
const host = cfg_1.default.getTokenHost();
|
|
88
84
|
if (!agent) {
|
|
89
85
|
const tags = prepareTags(options.tag);
|
|
90
|
-
agent = await buddy_1.default.register(true, target, host,
|
|
86
|
+
agent = await buddy_1.default.register(true, target, host, token, tags, (region) => {
|
|
91
87
|
cfg_1.default.setRegionIfNotSet(region);
|
|
92
88
|
});
|
|
93
89
|
id = agent.id;
|
|
94
|
-
|
|
90
|
+
agentToken = agent.token;
|
|
95
91
|
agent.destroy();
|
|
96
92
|
agent = null;
|
|
97
93
|
}
|
|
98
|
-
const saved = manager_1.default.system.saveSystemConfig(id, host,
|
|
94
|
+
const saved = manager_1.default.system.saveSystemConfig(id, host, agentToken, port, false, !!options.debug);
|
|
99
95
|
if (!saved) {
|
|
100
|
-
await removeAllAndExit(texts_1.ERR_SWW_AGENT_ENABLING, id, host,
|
|
96
|
+
await removeAllAndExit(texts_1.ERR_SWW_AGENT_ENABLING, id, host, agentToken);
|
|
101
97
|
}
|
|
102
98
|
try {
|
|
103
99
|
manager_1.default.system.clearAgentFiles();
|
|
@@ -113,22 +109,22 @@ const installService = async (options) => {
|
|
|
113
109
|
}
|
|
114
110
|
await output_1.default.spinner(texts_1.TXT_ENABLING_AGENT);
|
|
115
111
|
try {
|
|
116
|
-
await manager_1.default.system.install(id, host,
|
|
112
|
+
await manager_1.default.system.install(id, host, agentToken, port, !!options.start, options.user, options.pass, !!options.debug);
|
|
117
113
|
}
|
|
118
114
|
catch {
|
|
119
|
-
await removeAllAndExit(texts_1.ERR_SWW_AGENT_ENABLING, id, host,
|
|
115
|
+
await removeAllAndExit(texts_1.ERR_SWW_AGENT_ENABLING, id, host, agentToken);
|
|
120
116
|
}
|
|
121
117
|
if (options.start) {
|
|
122
118
|
const api = new agent_1.default(port);
|
|
123
119
|
await (0, wait_1.default)(api, 15000, () => {
|
|
124
|
-
removeAllAndExit(texts_1.ERR_SWW_AGENT_ENABLING, id, host,
|
|
120
|
+
removeAllAndExit(texts_1.ERR_SWW_AGENT_ENABLING, id, host, agentToken);
|
|
125
121
|
}, () => {
|
|
126
122
|
output_1.default.exitSuccess(texts_1.TXT_AGENT_INSTALLED);
|
|
127
123
|
});
|
|
128
124
|
}
|
|
129
125
|
else {
|
|
130
126
|
try {
|
|
131
|
-
await buddy_1.default.markAgentAsInactive(id, host,
|
|
127
|
+
await buddy_1.default.markAgentAsInactive(id, host, agentToken);
|
|
132
128
|
}
|
|
133
129
|
catch {
|
|
134
130
|
// do nothing
|
|
@@ -141,26 +137,24 @@ const installApp = async (options) => {
|
|
|
141
137
|
logger_1.default.setDebug(true);
|
|
142
138
|
}
|
|
143
139
|
let id;
|
|
144
|
-
let
|
|
145
|
-
let token;
|
|
140
|
+
let agentToken;
|
|
146
141
|
const port = input_1.default.port(options.port);
|
|
147
|
-
if (options.id) {
|
|
142
|
+
if (options.id && options.agentToken) {
|
|
148
143
|
id = options.id;
|
|
149
|
-
|
|
144
|
+
agentToken = options.agentToken;
|
|
150
145
|
}
|
|
146
|
+
const { token, host } = await input_1.default.tunnelToken(options.token);
|
|
151
147
|
if (!id) {
|
|
152
|
-
await input_1.default.tunnelToken(options.token);
|
|
153
|
-
host = cfg_1.default.getTokenHost();
|
|
154
148
|
const tags = prepareTags(options.tag);
|
|
155
149
|
try {
|
|
156
150
|
output_1.default.normal(texts_1.TXT_AGENT_STANDALONE_AGENT_REGISTERING, false);
|
|
157
|
-
const agent = await buddy_1.default.register(true, !!options.target, host,
|
|
151
|
+
const agent = await buddy_1.default.register(true, !!options.target, host, token, tags, (region) => {
|
|
158
152
|
cfg_1.default.setRegionIfNotSet(region);
|
|
159
153
|
});
|
|
160
154
|
logger_1.default.info(texts_1.TXT_AGENT_STANDALONE_AGENT_REGISTERED);
|
|
161
155
|
output_1.default.normal(texts_1.TXT_AGENT_STANDALONE_AGENT_REGISTERED);
|
|
162
156
|
id = agent.id;
|
|
163
|
-
|
|
157
|
+
agentToken = agent.token;
|
|
164
158
|
agent.destroy();
|
|
165
159
|
}
|
|
166
160
|
catch (err) {
|
|
@@ -171,13 +165,10 @@ const installApp = async (options) => {
|
|
|
171
165
|
}
|
|
172
166
|
}
|
|
173
167
|
else {
|
|
174
|
-
if (!host) {
|
|
175
|
-
host = cfg_1.default.getTokenHost();
|
|
176
|
-
}
|
|
177
168
|
try {
|
|
178
169
|
logger_1.default.info(texts_1.TXT_AGENT_STANDALONE_AGENT_FETCHING);
|
|
179
170
|
output_1.default.normal(texts_1.TXT_AGENT_STANDALONE_AGENT_FETCHING, false);
|
|
180
|
-
const agent = await buddy_1.default.fetchAgent(id, host,
|
|
171
|
+
const agent = await buddy_1.default.fetchAgent(id, host, agentToken);
|
|
181
172
|
agent.destroy();
|
|
182
173
|
logger_1.default.info(texts_1.TXT_AGENT_STANDALONE_AGENT_FETCHED);
|
|
183
174
|
output_1.default.normal(texts_1.TXT_AGENT_STANDALONE_AGENT_FETCHED);
|
|
@@ -189,7 +180,7 @@ const installApp = async (options) => {
|
|
|
189
180
|
output_1.default.exitError(err);
|
|
190
181
|
}
|
|
191
182
|
}
|
|
192
|
-
const saved = manager_1.default.system.saveSystemConfig(id, host,
|
|
183
|
+
const saved = manager_1.default.system.saveSystemConfig(id, host, agentToken, port, true, !!options.debug);
|
|
193
184
|
if (!saved) {
|
|
194
185
|
output_1.default.exitError(texts_1.ERR_SWW_AGENT_ENABLING);
|
|
195
186
|
}
|
|
@@ -198,7 +189,7 @@ const installApp = async (options) => {
|
|
|
198
189
|
}
|
|
199
190
|
else {
|
|
200
191
|
try {
|
|
201
|
-
await buddy_1.default.markAgentAsInactive(id, host,
|
|
192
|
+
await buddy_1.default.markAgentAsInactive(id, host, agentToken);
|
|
202
193
|
}
|
|
203
194
|
catch {
|
|
204
195
|
// do nothing
|
|
@@ -209,7 +200,8 @@ const installApp = async (options) => {
|
|
|
209
200
|
const commandAgentInstall = (0, utils_1.newCommand)('install', texts_1.DESC_COMMAND_AGENT_INSTALL);
|
|
210
201
|
commandAgentInstall.option('-s, --start [true|false]', texts_1.OPTION_AGENT_START, 'true');
|
|
211
202
|
commandAgentInstall.option('-i, --id <id>', texts_1.OPTION_AGENT_ID);
|
|
212
|
-
commandAgentInstall.option('-
|
|
203
|
+
commandAgentInstall.option('--agent-token <agent-token>', texts_1.OPTION_AGENT_TOKEN);
|
|
204
|
+
commandAgentInstall.option('-t, --token <token>', texts_1.OPTION_TOKEN);
|
|
213
205
|
commandAgentInstall.option('-p, --port <port>', texts_1.OPTION_AGENT_PORT, '7456');
|
|
214
206
|
commandAgentInstall.option('-u, --user <user>', texts_1.OPTION_USER);
|
|
215
207
|
commandAgentInstall.option('-a,--app', texts_1.OPTION_APP);
|
|
@@ -259,7 +259,18 @@ const outputRequestBody = (data, schema) => {
|
|
|
259
259
|
}
|
|
260
260
|
};
|
|
261
261
|
const outputUrl = (url, method, data, workspace, project, requestSchema, responseSchema) => {
|
|
262
|
-
|
|
262
|
+
const m = (method || 'get').toUpperCase();
|
|
263
|
+
if (m === 'GET')
|
|
264
|
+
output_1.default.cyan(m, false);
|
|
265
|
+
else if (m === 'POST')
|
|
266
|
+
output_1.default.green(m, false);
|
|
267
|
+
else if (m === 'PATCH')
|
|
268
|
+
output_1.default.blue(m, false);
|
|
269
|
+
else if (m === 'PUT')
|
|
270
|
+
output_1.default.yellow(m, false);
|
|
271
|
+
else if (m === 'DELETE')
|
|
272
|
+
output_1.default.error(m, false);
|
|
273
|
+
output_1.default.normal(` ${url}`);
|
|
263
274
|
if (data.summary)
|
|
264
275
|
output_1.default.gray(data.summary, false);
|
|
265
276
|
const scopes = getRequiredScopes(data);
|
|
@@ -277,9 +288,6 @@ const outputUrl = (url, method, data, workspace, project, requestSchema, respons
|
|
|
277
288
|
output_1.default.exitNormal();
|
|
278
289
|
};
|
|
279
290
|
const commandApiInfo = (0, utils_1.newCommand)('info', texts_1.DESC_COMMAND_API_INFO);
|
|
280
|
-
commandApiInfo.option('--token <token>', texts_1.OPTION_REST_API_TOKEN);
|
|
281
|
-
commandApiInfo.option('--api <url>', texts_1.OPTION_REST_API_ENDPOINT);
|
|
282
|
-
commandApiInfo.option('--region <region>', texts_1.OPTION_REST_API_REGION);
|
|
283
291
|
commandApiInfo.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
284
292
|
commandApiInfo.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
285
293
|
commandApiInfo.option('--request-schema <schema>', texts_1.OPT_COMMAND_API_INFO_SCHEMA);
|
|
@@ -290,7 +298,7 @@ commandApiInfo.action(async (fm, filterUrl, options) => {
|
|
|
290
298
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
291
299
|
const project = input_1.default.restApiProject(options.project, true);
|
|
292
300
|
const filterMethod = input_1.default.restApiMethod(fm, false);
|
|
293
|
-
const client = input_1.default.restApiTokenClient(
|
|
301
|
+
const client = input_1.default.restApiTokenClient(true);
|
|
294
302
|
const schema = await (0, utils_1.fetchOpenApiSchema)(client.baseUrl);
|
|
295
303
|
const paths = schema.paths || {};
|
|
296
304
|
Object.keys(paths).forEach((url) => {
|
|
@@ -8,15 +8,25 @@ const texts_1 = require("../../texts");
|
|
|
8
8
|
const input_1 = __importDefault(require("../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../output"));
|
|
10
10
|
const outputUrl = (url, method, data, workspace, project) => {
|
|
11
|
-
|
|
11
|
+
const m = (method || 'get').toUpperCase();
|
|
12
|
+
if (m === 'GET')
|
|
13
|
+
output_1.default.cyan(m, false);
|
|
14
|
+
else if (m === 'POST')
|
|
15
|
+
output_1.default.green(m, false);
|
|
16
|
+
else if (m === 'PATCH')
|
|
17
|
+
output_1.default.blue(m, false);
|
|
18
|
+
else if (m === 'PUT')
|
|
19
|
+
output_1.default.yellow(m, false);
|
|
20
|
+
else if (m === 'DELETE')
|
|
21
|
+
output_1.default.error(m, false);
|
|
22
|
+
else
|
|
23
|
+
output_1.default.blue(m, false);
|
|
24
|
+
output_1.default.normal(` ${(0, utils_1.openApiPrepareUrl)(url, workspace, project)}`);
|
|
12
25
|
if (data.summary)
|
|
13
26
|
output_1.default.gray(data.summary);
|
|
14
27
|
};
|
|
15
28
|
const commandApiList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_API_LIST);
|
|
16
29
|
commandApiList.alias('ls');
|
|
17
|
-
commandApiList.option('--token <token>', texts_1.OPTION_REST_API_TOKEN);
|
|
18
|
-
commandApiList.option('--api <url>', texts_1.OPTION_REST_API_ENDPOINT);
|
|
19
|
-
commandApiList.option('--region <region>', texts_1.OPTION_REST_API_REGION);
|
|
20
30
|
commandApiList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
21
31
|
commandApiList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
22
32
|
commandApiList.option('-m, --method <method>', texts_1.OPT_COMMAND_API_LIST_METHOD);
|
|
@@ -26,7 +36,7 @@ commandApiList.action(async (options) => {
|
|
|
26
36
|
const project = input_1.default.restApiProject(options.project, true);
|
|
27
37
|
const filterMethod = input_1.default.restApiMethod(options.method);
|
|
28
38
|
const filter = options.search;
|
|
29
|
-
const client = input_1.default.restApiTokenClient(
|
|
39
|
+
const client = input_1.default.restApiTokenClient(true);
|
|
30
40
|
const schema = await (0, utils_1.fetchOpenApiSchema)(client.baseUrl);
|
|
31
41
|
const paths = schema.paths || {};
|
|
32
42
|
Object.keys(paths).forEach((url) => {
|
|
@@ -81,7 +81,7 @@ const request = async (method, url, options) => {
|
|
|
81
81
|
output_1.default.handleSignals();
|
|
82
82
|
const workspace = input_1.default.restApiWorkspace(options.workspace, true);
|
|
83
83
|
const project = input_1.default.restApiProject(options.project, true);
|
|
84
|
-
const client = input_1.default.restApiTokenClient(
|
|
84
|
+
const client = input_1.default.restApiTokenClient();
|
|
85
85
|
const query = {};
|
|
86
86
|
if (options.query) {
|
|
87
87
|
options.query.forEach((q) => {
|
|
@@ -149,9 +149,6 @@ const newApiRequestCommand = (method, description, allowBody) => {
|
|
|
149
149
|
const command = (0, utils_1.newCommand)(method, description);
|
|
150
150
|
command.hideVersionUpdate = true;
|
|
151
151
|
command.alias(method.toUpperCase());
|
|
152
|
-
command.option('--token <token>', texts_1.OPTION_REST_API_TOKEN);
|
|
153
|
-
command.option('--api <url>', texts_1.OPTION_REST_API_ENDPOINT);
|
|
154
|
-
command.option('--region <region>', texts_1.OPTION_REST_API_REGION);
|
|
155
152
|
command.option('-w, --workspace <domain>', texts_1.DESC_COMMAND_API_WORKSPACE);
|
|
156
153
|
command.option('-p, --project <name>', texts_1.DESC_COMMAND_API_PROJECT);
|
|
157
154
|
command.option('-q, --query <key:val...>', texts_1.DESC_COMMAND_API_REQUEST_QUERY);
|
|
@@ -7,18 +7,12 @@ 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 client_1 = __importDefault(require("../api/client"));
|
|
11
10
|
const input_1 = __importDefault(require("../input"));
|
|
12
11
|
const commandLogout = (0, utils_1.newCommand)('logout', texts_1.DESC_COMMAND_LOGOUT);
|
|
13
12
|
const tryRemovingApp = async () => {
|
|
14
13
|
try {
|
|
15
|
-
const token = cfg_1.default.getApiToken();
|
|
16
|
-
const refreshToken = cfg_1.default.getApiRefreshApiToken();
|
|
17
14
|
const clientId = cfg_1.default.getApiClientId();
|
|
18
|
-
const
|
|
19
|
-
const clientToken = cfg_1.default.getApiClientToken();
|
|
20
|
-
const baseUrl = input_1.default.restApiBaseUrl();
|
|
21
|
-
const client = new client_1.default(baseUrl, token, refreshToken, clientId, clientSecret, clientToken);
|
|
15
|
+
const client = input_1.default.restApiTokenClient(true);
|
|
22
16
|
await client.deleteApp(clientId);
|
|
23
17
|
}
|
|
24
18
|
catch {
|
|
@@ -10,9 +10,6 @@ const output_1 = __importDefault(require("../../output"));
|
|
|
10
10
|
const human_id_1 = __importDefault(require("human-id"));
|
|
11
11
|
const commandPackageCreate = (0, utils_1.newCommand)('create', texts_1.DESC_COMMAND_PACKAGE_CREATE);
|
|
12
12
|
commandPackageCreate.alias('add');
|
|
13
|
-
commandPackageCreate.option('--token <token>', texts_1.OPTION_REST_API_TOKEN);
|
|
14
|
-
commandPackageCreate.option('--api <url>', texts_1.OPTION_REST_API_ENDPOINT);
|
|
15
|
-
commandPackageCreate.option('--region <region>', texts_1.OPTION_REST_API_REGION);
|
|
16
13
|
commandPackageCreate.option('-i, --identifier <identifier>', texts_1.OPT_COMMAND_PACKAGE_CREATE_IDENTIFIER);
|
|
17
14
|
commandPackageCreate.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
18
15
|
commandPackageCreate.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
@@ -24,7 +21,7 @@ commandPackageCreate.addHelpText('after', texts_1.EXAMPLE_PACKAGE_CREATE);
|
|
|
24
21
|
commandPackageCreate.action(async (name, options) => {
|
|
25
22
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
26
23
|
const project = input_1.default.restApiProject(options.project, true);
|
|
27
|
-
const client = input_1.default.restApiTokenClient(
|
|
24
|
+
const client = input_1.default.restApiTokenClient();
|
|
28
25
|
const type = input_1.default.packageType(options.type);
|
|
29
26
|
const scope = input_1.default.packageScope(project);
|
|
30
27
|
if (!name) {
|
|
@@ -9,16 +9,13 @@ const input_1 = __importDefault(require("../../input"));
|
|
|
9
9
|
const output_1 = __importDefault(require("../../output"));
|
|
10
10
|
const commandPackageDelete = (0, utils_1.newCommand)('delete', texts_1.DESC_COMMAND_PACKAGE_DELETE);
|
|
11
11
|
commandPackageDelete.alias('rm');
|
|
12
|
-
commandPackageDelete.option('--token <token>', texts_1.OPTION_REST_API_TOKEN);
|
|
13
|
-
commandPackageDelete.option('--api <url>', texts_1.OPTION_REST_API_ENDPOINT);
|
|
14
|
-
commandPackageDelete.option('--region <region>', texts_1.OPTION_REST_API_REGION);
|
|
15
12
|
commandPackageDelete.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
16
13
|
commandPackageDelete.option('-f, --force', texts_1.OPTION_CONFIRM_FORCE);
|
|
17
14
|
commandPackageDelete.argument('<identifier>', texts_1.OPT_COMMAND_PACKAGE_IDENTIFIER);
|
|
18
15
|
commandPackageDelete.addHelpText('after', texts_1.EXAMPLE_PACKAGE_DELETE);
|
|
19
16
|
commandPackageDelete.action(async (identifier, options) => {
|
|
20
17
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
21
|
-
const client = input_1.default.restApiTokenClient(
|
|
18
|
+
const client = input_1.default.restApiTokenClient();
|
|
22
19
|
const data = await client.getPackageVersionByIdentifier(workspace, null, identifier);
|
|
23
20
|
if (!data || !data.domain) {
|
|
24
21
|
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
@@ -8,15 +8,12 @@ const texts_1 = require("../../../texts");
|
|
|
8
8
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../../input"));
|
|
10
10
|
const commandPackageDockerLogin = (0, utils_1.newCommand)('login', texts_1.DESC_COMMAND_PACKAGE_DOCKER_LOGIN);
|
|
11
|
-
commandPackageDockerLogin.
|
|
12
|
-
|
|
13
|
-
commandPackageDockerLogin.option('--region <region>', texts_1.OPTION_REST_API_REGION);
|
|
14
|
-
commandPackageDockerLogin.action(async (options) => {
|
|
15
|
-
const client = input_1.default.restApiTokenClient(options.api, options.region, options.token);
|
|
11
|
+
commandPackageDockerLogin.action(async () => {
|
|
12
|
+
const client = input_1.default.restApiTokenClient();
|
|
16
13
|
await client.getInvoker();
|
|
17
14
|
const host = (0, utils_1.getDockerRegistryHostByApiBaseUrl)(client.baseUrl);
|
|
18
15
|
const output = await (0, utils_1.execLocally)(`docker login ${host} -u buddy -p "${client.token}"`);
|
|
19
|
-
if (/Login\sSucceeded/
|
|
16
|
+
if (/Login\sSucceeded/gi.test(output)) {
|
|
20
17
|
output_1.default.exitSuccess(texts_1.TXT_PACKAGE_DOCKER_LOGIN_SUCCESS);
|
|
21
18
|
}
|
|
22
19
|
else {
|
|
@@ -48,9 +48,6 @@ const promises_1 = __importDefault(require("node:stream/promises"));
|
|
|
48
48
|
const unzipper_1 = __importStar(require("../../unzipper"));
|
|
49
49
|
const commandPackageDownload = (0, utils_1.newCommand)('download', texts_1.DESC_COMMAND_PACKAGE_DOWNLOAD);
|
|
50
50
|
commandPackageDownload.alias('dd');
|
|
51
|
-
commandPackageDownload.option('-t, --token <token>', texts_1.OPTION_REST_API_TOKEN);
|
|
52
|
-
commandPackageDownload.option('--api <url>', texts_1.OPTION_REST_API_ENDPOINT);
|
|
53
|
-
commandPackageDownload.option('--region <region>', texts_1.OPTION_REST_API_REGION);
|
|
54
51
|
commandPackageDownload.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
55
52
|
commandPackageDownload.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
56
53
|
commandPackageDownload.option('-m, --merge', texts_1.OPTION_PACKAGE_DOWNLOAD_MERGE);
|
|
@@ -59,7 +56,7 @@ commandPackageDownload.argument('<identifier>', texts_1.OPTION_PACKAGE_ID);
|
|
|
59
56
|
commandPackageDownload.argument('<directory>', texts_1.OPTION_PACKAGE_DOWNLOAD_PATH);
|
|
60
57
|
commandPackageDownload.addHelpText('after', texts_1.EXAMPLE_PACKAGE_DOWNLOAD);
|
|
61
58
|
commandPackageDownload.action(async (id, path, options) => {
|
|
62
|
-
const client = input_1.default.restApiTokenClient(
|
|
59
|
+
const client = input_1.default.restApiTokenClient();
|
|
63
60
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
64
61
|
const project = input_1.default.restApiProject(options.project, true);
|
|
65
62
|
// eslint-disable-next-line prefer-const
|
|
@@ -8,16 +8,13 @@ const texts_1 = require("../../texts");
|
|
|
8
8
|
const input_1 = __importDefault(require("../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../output"));
|
|
10
10
|
const commandSandboxGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_PACKAGE_GET);
|
|
11
|
-
commandSandboxGet.option('--token <token>', texts_1.OPTION_REST_API_TOKEN);
|
|
12
|
-
commandSandboxGet.option('--api <url>', texts_1.OPTION_REST_API_ENDPOINT);
|
|
13
|
-
commandSandboxGet.option('--region <region>', texts_1.OPTION_REST_API_REGION);
|
|
14
11
|
commandSandboxGet.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
15
12
|
commandSandboxGet.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
16
13
|
commandSandboxGet.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
17
14
|
commandSandboxGet.action(async (identifier, options) => {
|
|
18
15
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
19
16
|
const project = input_1.default.restApiProject(options.project, true);
|
|
20
|
-
const client = input_1.default.restApiTokenClient(
|
|
17
|
+
const client = input_1.default.restApiTokenClient();
|
|
21
18
|
const data = await client.getPackageVersionByIdentifier(workspace, project, identifier);
|
|
22
19
|
if (!data || !data.domain) {
|
|
23
20
|
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
@@ -27,12 +24,12 @@ commandSandboxGet.action(async (identifier, options) => {
|
|
|
27
24
|
}
|
|
28
25
|
const pkg = await client.getPackage(workspace, data.pkg_id);
|
|
29
26
|
output_1.default.object({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
Name: pkg.name,
|
|
28
|
+
Identifier: pkg.identifier,
|
|
29
|
+
Type: pkg.type,
|
|
30
|
+
Scope: pkg.scope,
|
|
31
|
+
Size: (0, utils_1.formatBytes)(pkg.size || 0),
|
|
32
|
+
Created: pkg.created_date,
|
|
36
33
|
});
|
|
37
34
|
output_1.default.exitNormal(`\n${(0, texts_1.TXT_PACKAGE_PUBLISH)(client.baseUrl, workspace, pkg)}`);
|
|
38
35
|
});
|
|
@@ -8,16 +8,13 @@ const texts_1 = require("../../texts");
|
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const input_1 = __importDefault(require("../../input"));
|
|
10
10
|
const commandPackageList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_PACKAGE_LIST);
|
|
11
|
-
commandPackageList.option('--token <token>', texts_1.OPTION_REST_API_TOKEN);
|
|
12
|
-
commandPackageList.option('--api <url>', texts_1.OPTION_REST_API_ENDPOINT);
|
|
13
|
-
commandPackageList.option('--region <region>', texts_1.OPTION_REST_API_REGION);
|
|
14
11
|
commandPackageList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
15
12
|
commandPackageList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
16
13
|
commandPackageList.alias('ls');
|
|
17
14
|
commandPackageList.action(async (options) => {
|
|
18
15
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
19
16
|
const project = input_1.default.restApiProject(options.project, true);
|
|
20
|
-
const client = input_1.default.restApiTokenClient(
|
|
17
|
+
const client = input_1.default.restApiTokenClient();
|
|
21
18
|
const response = await client.getPackages(workspace, project);
|
|
22
19
|
if (!response.packages || response.packages.length === 0) {
|
|
23
20
|
output_1.default.exitError(texts_1.ERR_COMMAND_PACKAGE_NO_PROJECTS);
|
|
@@ -14,9 +14,6 @@ const path_1 = require("path");
|
|
|
14
14
|
const uuid_1 = require("uuid");
|
|
15
15
|
const commandPackagePublish = (0, utils_1.newCommand)('publish', texts_1.DESC_COMMAND_PACKAGE_PUBLISH);
|
|
16
16
|
commandPackagePublish.alias('pub');
|
|
17
|
-
commandPackagePublish.option('-t, --token <token>', texts_1.OPTION_REST_API_TOKEN);
|
|
18
|
-
commandPackagePublish.option('--api <url>', texts_1.OPTION_REST_API_ENDPOINT);
|
|
19
|
-
commandPackagePublish.option('--region <region>', texts_1.OPTION_REST_API_REGION);
|
|
20
17
|
commandPackagePublish.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
21
18
|
commandPackagePublish.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
22
19
|
commandPackagePublish.option('-c, --create', texts_1.OPTION_PACKAGE_PUBLISH_CREATE);
|
|
@@ -32,7 +29,7 @@ commandPackagePublish.action(async (id, path, options) => {
|
|
|
32
29
|
let { identifier, version } = input_1.default.packageSplitIdentifier(id);
|
|
33
30
|
if (!version)
|
|
34
31
|
version = (0, uuid_1.v4)();
|
|
35
|
-
const client = input_1.default.restApiTokenClient(
|
|
32
|
+
const client = input_1.default.restApiTokenClient();
|
|
36
33
|
const data = await client.getPackageVersionByIdentifier(workspace, project, identifier, version);
|
|
37
34
|
if (!data || !data.domain) {
|
|
38
35
|
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
@@ -9,9 +9,6 @@ const input_1 = __importDefault(require("../../../input"));
|
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
10
|
const commandPackageVersionDelete = (0, utils_1.newCommand)('delete', texts_1.DESC_COMMAND_PACKAGE_VERSION_DELETE);
|
|
11
11
|
commandPackageVersionDelete.alias('rm');
|
|
12
|
-
commandPackageVersionDelete.option('--token <token>', texts_1.OPTION_REST_API_TOKEN);
|
|
13
|
-
commandPackageVersionDelete.option('--api <url>', texts_1.OPTION_REST_API_ENDPOINT);
|
|
14
|
-
commandPackageVersionDelete.option('--region <region>', texts_1.OPTION_REST_API_REGION);
|
|
15
12
|
commandPackageVersionDelete.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
16
13
|
commandPackageVersionDelete.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
17
14
|
commandPackageVersionDelete.argument('<identifier>', texts_1.OPT_COMMAND_PACKAGE_IDENTIFIER);
|
|
@@ -21,7 +18,7 @@ commandPackageVersionDelete.addHelpText('after', texts_1.EXAMPLE_PACKAGE_VERSION
|
|
|
21
18
|
commandPackageVersionDelete.action(async (identifier, version, options) => {
|
|
22
19
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
23
20
|
const project = input_1.default.restApiProject(options.project, true);
|
|
24
|
-
const client = input_1.default.restApiTokenClient(
|
|
21
|
+
const client = input_1.default.restApiTokenClient();
|
|
25
22
|
const data = await client.getPackageVersionByIdentifier(workspace, project, identifier, version);
|
|
26
23
|
if (!data || !data.domain) {
|
|
27
24
|
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
@@ -8,9 +8,6 @@ const texts_1 = require("../../../texts");
|
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
10
|
const commandPackageVersionGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_PACKAGE_VERSION_GET);
|
|
11
|
-
commandPackageVersionGet.option('--token <token>', texts_1.OPTION_REST_API_TOKEN);
|
|
12
|
-
commandPackageVersionGet.option('--api <url>', texts_1.OPTION_REST_API_ENDPOINT);
|
|
13
|
-
commandPackageVersionGet.option('--region <region>', texts_1.OPTION_REST_API_REGION);
|
|
14
11
|
commandPackageVersionGet.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
15
12
|
commandPackageVersionGet.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
16
13
|
commandPackageVersionGet.argument('<identifier>', texts_1.OPT_COMMAND_PACKAGE_IDENTIFIER);
|
|
@@ -19,7 +16,7 @@ commandPackageVersionGet.addHelpText('after', texts_1.EXAMPLE_PACKAGE_VERSION_GE
|
|
|
19
16
|
commandPackageVersionGet.action(async (identifier, version, options) => {
|
|
20
17
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
21
18
|
const project = input_1.default.restApiProject(options.project, true);
|
|
22
|
-
const client = input_1.default.restApiTokenClient(
|
|
19
|
+
const client = input_1.default.restApiTokenClient();
|
|
23
20
|
const data = await client.getPackageVersionByIdentifier(workspace, project, identifier, version);
|
|
24
21
|
if (!data || !data.domain) {
|
|
25
22
|
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
@@ -8,9 +8,6 @@ const texts_1 = require("../../../texts");
|
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
10
|
const commandPackageVersionList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_PACKAGE_VERSION_LIST);
|
|
11
|
-
commandPackageVersionList.option('--token <token>', texts_1.OPTION_REST_API_TOKEN);
|
|
12
|
-
commandPackageVersionList.option('--api <url>', texts_1.OPTION_REST_API_ENDPOINT);
|
|
13
|
-
commandPackageVersionList.option('--region <region>', texts_1.OPTION_REST_API_REGION);
|
|
14
11
|
commandPackageVersionList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
15
12
|
commandPackageVersionList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
16
13
|
commandPackageVersionList.option('--page <number>', texts_1.OPTION_REST_API_PAGE, '1');
|
|
@@ -23,7 +20,7 @@ commandPackageVersionList.action(async (identifier, options) => {
|
|
|
23
20
|
const perPage = input_1.default.restApiPerPage(options.perPage);
|
|
24
21
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
25
22
|
const project = input_1.default.restApiProject(options.project, true);
|
|
26
|
-
const client = input_1.default.restApiTokenClient(
|
|
23
|
+
const client = input_1.default.restApiTokenClient();
|
|
27
24
|
const data = await client.getPackageVersionByIdentifier(workspace, project, identifier);
|
|
28
25
|
if (!data || !data.domain) {
|
|
29
26
|
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
@@ -9,9 +9,6 @@ const output_1 = __importDefault(require("../../output"));
|
|
|
9
9
|
const input_1 = __importDefault(require("../../input"));
|
|
10
10
|
const format_1 = __importDefault(require("../../format"));
|
|
11
11
|
const commandPipelineRun = (0, utils_1.newCommand)('run', texts_1.DESC_COMMAND_PIPELINE_RUN);
|
|
12
|
-
commandPipelineRun.option('--token <token>', texts_1.OPTION_REST_API_TOKEN);
|
|
13
|
-
commandPipelineRun.option('--api <url>', texts_1.OPTION_REST_API_ENDPOINT);
|
|
14
|
-
commandPipelineRun.option('--region <region>', texts_1.OPTION_REST_API_REGION);
|
|
15
12
|
commandPipelineRun.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
16
13
|
commandPipelineRun.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
17
14
|
commandPipelineRun.option('-b, --branch <branch>', texts_1.OPTION_PIPELINE_RUN_BRANCH);
|
|
@@ -33,7 +30,7 @@ commandPipelineRun.addHelpText('after', texts_1.EXAMPLE_PIPELINE_RUN);
|
|
|
33
30
|
commandPipelineRun.action(async (identifier, options) => {
|
|
34
31
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
35
32
|
const project = input_1.default.restApiProject(options.project);
|
|
36
|
-
const client = input_1.default.restApiTokenClient(
|
|
33
|
+
const client = input_1.default.restApiTokenClient();
|
|
37
34
|
const data = await client.getPipelineByIdentifier(workspace, project, identifier);
|
|
38
35
|
if (!data || !data.domain) {
|
|
39
36
|
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
@@ -8,14 +8,11 @@ const texts_1 = require("../../texts");
|
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const input_1 = __importDefault(require("../../input"));
|
|
10
10
|
const commandProjectList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_PROJECT_LIST);
|
|
11
|
-
commandProjectList.option('--token <token>', texts_1.OPTION_REST_API_TOKEN);
|
|
12
|
-
commandProjectList.option('--api <url>', texts_1.OPTION_REST_API_ENDPOINT);
|
|
13
|
-
commandProjectList.option('--region <region>', texts_1.OPTION_REST_API_REGION);
|
|
14
11
|
commandProjectList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
15
12
|
commandProjectList.alias('ls');
|
|
16
13
|
commandProjectList.action(async (options) => {
|
|
17
14
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
18
|
-
const client = input_1.default.restApiTokenClient(
|
|
15
|
+
const client = input_1.default.restApiTokenClient();
|
|
19
16
|
const response = await client.getProjects(workspace);
|
|
20
17
|
if (!response.projects || response.projects.length === 0) {
|
|
21
18
|
output_1.default.exitError(texts_1.ERR_PROJECT_NO_PROJECTS);
|
|
@@ -9,15 +9,12 @@ const texts_1 = require("../../texts");
|
|
|
9
9
|
const utils_1 = require("../../utils");
|
|
10
10
|
const input_1 = __importDefault(require("../../input"));
|
|
11
11
|
const commandProjectSet = (0, utils_1.newCommand)('set', texts_1.DESC_COMMAND_PROJECT_SET);
|
|
12
|
-
commandProjectSet.option('--token <token>', texts_1.OPTION_REST_API_TOKEN);
|
|
13
|
-
commandProjectSet.option('--api <url>', texts_1.OPTION_REST_API_ENDPOINT);
|
|
14
|
-
commandProjectSet.option('--region <region>', texts_1.OPTION_REST_API_REGION);
|
|
15
12
|
commandProjectSet.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
16
13
|
commandProjectSet.argument('[project]', texts_1.ARG_COMMAND_PROJECT_NAME);
|
|
17
14
|
commandProjectSet.action(async (projectName, options) => {
|
|
18
15
|
output_1.default.handleSignals();
|
|
19
16
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
20
|
-
const client = input_1.default.restApiTokenClient(
|
|
17
|
+
const client = input_1.default.restApiTokenClient();
|
|
21
18
|
const response = await client.getProjects(workspace);
|
|
22
19
|
if (!response.projects || response.projects.length === 0) {
|
|
23
20
|
output_1.default.exitError(texts_1.ERR_PROJECT_NO_PROJECTS);
|
|
@@ -47,9 +47,6 @@ const uuid_1 = require("uuid");
|
|
|
47
47
|
const promises_1 = __importDefault(require("node:stream/promises"));
|
|
48
48
|
const unzipper_1 = __importStar(require("../../unzipper"));
|
|
49
49
|
const commandSandboxCp = (0, utils_1.newCommand)('cp', texts_1.DESC_COMMAND_SANDBOX_CP);
|
|
50
|
-
commandSandboxCp.option('--token <token>', texts_1.OPTION_REST_API_TOKEN);
|
|
51
|
-
commandSandboxCp.option('--api <url>', texts_1.OPTION_REST_API_ENDPOINT);
|
|
52
|
-
commandSandboxCp.option('--region <region>', texts_1.OPTION_REST_API_REGION);
|
|
53
50
|
commandSandboxCp.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
54
51
|
commandSandboxCp.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
55
52
|
commandSandboxCp.option('-m, --merge', texts_1.OPTION_SANDBOX_CP_DOWNLOAD_MERGE);
|
|
@@ -157,7 +154,7 @@ const download = async (client, workspace, project, source, destination, merge,
|
|
|
157
154
|
commandSandboxCp.action(async (source, destination, options) => {
|
|
158
155
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
159
156
|
const project = input_1.default.restApiProject(options.project);
|
|
160
|
-
const client = input_1.default.restApiTokenClient(
|
|
157
|
+
const client = input_1.default.restApiTokenClient();
|
|
161
158
|
const isUpload = input_1.default.restApiSandboxIsUpload(destination);
|
|
162
159
|
if (isUpload) {
|
|
163
160
|
await upload(client, workspace, project, source, destination);
|
|
@@ -24,9 +24,6 @@ const VALID_RESOURCES = [
|
|
|
24
24
|
];
|
|
25
25
|
const commandSandboxCreate = (0, utils_1.newCommand)('create', texts_1.DESC_COMMAND_SANDBOX_CREATE);
|
|
26
26
|
commandSandboxCreate.alias('add');
|
|
27
|
-
commandSandboxCreate.option('--token <token>', texts_1.OPTION_REST_API_TOKEN);
|
|
28
|
-
commandSandboxCreate.option('--api <url>', texts_1.OPTION_REST_API_ENDPOINT);
|
|
29
|
-
commandSandboxCreate.option('--region <region>', texts_1.OPTION_REST_API_REGION);
|
|
30
27
|
commandSandboxCreate.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
31
28
|
commandSandboxCreate.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
32
29
|
commandSandboxCreate.option('-n, --name <name>', texts_1.OPTION_SANDBOX_NAME);
|
|
@@ -45,7 +42,7 @@ commandSandboxCreate.addHelpText('after', texts_1.EXAMPLE_SANDBOX_CREATE);
|
|
|
45
42
|
commandSandboxCreate.action(async (options) => {
|
|
46
43
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
47
44
|
const project = input_1.default.restApiProject(options.project);
|
|
48
|
-
const client = input_1.default.restApiTokenClient(
|
|
45
|
+
const client = input_1.default.restApiTokenClient();
|
|
49
46
|
if (options.resources && !VALID_RESOURCES.includes(options.resources)) {
|
|
50
47
|
output_1.default.exitError((0, texts_1.ERR_SANDBOX_INVALID_RESOURCES)(options.resources));
|
|
51
48
|
}
|
|
@@ -9,9 +9,6 @@ const output_1 = __importDefault(require("../../output"));
|
|
|
9
9
|
const input_1 = __importDefault(require("../../input"));
|
|
10
10
|
const commandSandboxDestroy = (0, utils_1.newCommand)('destroy', texts_1.DESC_COMMAND_SANDBOX_DESTROY);
|
|
11
11
|
commandSandboxDestroy.aliases(['delete', 'rm']);
|
|
12
|
-
commandSandboxDestroy.option('--token <token>', texts_1.OPTION_REST_API_TOKEN);
|
|
13
|
-
commandSandboxDestroy.option('--api <url>', texts_1.OPTION_REST_API_ENDPOINT);
|
|
14
|
-
commandSandboxDestroy.option('--region <region>', texts_1.OPTION_REST_API_REGION);
|
|
15
12
|
commandSandboxDestroy.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
16
13
|
commandSandboxDestroy.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
17
14
|
commandSandboxDestroy.option('-f, --force', texts_1.OPTION_CONFIRM_FORCE);
|
|
@@ -19,7 +16,7 @@ commandSandboxDestroy.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER
|
|
|
19
16
|
commandSandboxDestroy.action(async (identifier, options) => {
|
|
20
17
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
21
18
|
const project = input_1.default.restApiProject(options.project);
|
|
22
|
-
const client = input_1.default.restApiTokenClient(
|
|
19
|
+
const client = input_1.default.restApiTokenClient();
|
|
23
20
|
const result = await client.listSandboxes(workspace, project);
|
|
24
21
|
const sandboxes = result.sandboxes || [];
|
|
25
22
|
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
@@ -14,7 +14,7 @@ commandSandboxEndpointAdd.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SAN
|
|
|
14
14
|
commandSandboxEndpointAdd.action(async (identifier, options) => {
|
|
15
15
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
16
16
|
const project = input_1.default.restApiProject(options.project);
|
|
17
|
-
const client = input_1.default.restApiTokenClient(
|
|
17
|
+
const client = input_1.default.restApiTokenClient();
|
|
18
18
|
const result = await client.listSandboxes(workspace, project);
|
|
19
19
|
const sandboxes = result.sandboxes || [];
|
|
20
20
|
const found = sandboxes.find((s) => s.identifier === identifier);
|