bdy 1.17.28-dev → 1.18.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.
Files changed (33) hide show
  1. package/distTs/package.json +1 -1
  2. package/distTs/src/api/client.js +76 -5
  3. package/distTs/src/command/domain/buy.js +278 -0
  4. package/distTs/src/command/domain/get.js +45 -0
  5. package/distTs/src/command/domain/list.js +27 -0
  6. package/distTs/src/command/domain.js +15 -0
  7. package/distTs/src/command/project/link.js +1 -1
  8. package/distTs/src/command/sandbox/cp.js +7 -11
  9. package/distTs/src/command/sandbox/destroy.js +3 -5
  10. package/distTs/src/command/sandbox/endpoint/add.js +4 -6
  11. package/distTs/src/command/sandbox/endpoint/delete.js +4 -6
  12. package/distTs/src/command/sandbox/endpoint/get.js +3 -5
  13. package/distTs/src/command/sandbox/endpoint/list.js +3 -5
  14. package/distTs/src/command/sandbox/exec/command.js +5 -7
  15. package/distTs/src/command/sandbox/exec/kill.js +3 -5
  16. package/distTs/src/command/sandbox/exec/list.js +3 -5
  17. package/distTs/src/command/sandbox/exec/logs.js +4 -6
  18. package/distTs/src/command/sandbox/exec/status.js +3 -5
  19. package/distTs/src/command/sandbox/get.js +3 -5
  20. package/distTs/src/command/sandbox/restart.js +4 -6
  21. package/distTs/src/command/sandbox/snapshot/create.js +4 -6
  22. package/distTs/src/command/sandbox/snapshot/delete.js +4 -6
  23. package/distTs/src/command/sandbox/snapshot/get.js +4 -6
  24. package/distTs/src/command/sandbox/snapshot/list.js +3 -5
  25. package/distTs/src/command/sandbox/start.js +4 -6
  26. package/distTs/src/command/sandbox/status.js +3 -5
  27. package/distTs/src/command/sandbox/stop.js +4 -6
  28. package/distTs/src/command/sandbox/update.js +5 -8
  29. package/distTs/src/command/sandbox/yaml.js +3 -6
  30. package/distTs/src/index.js +2 -0
  31. package/distTs/src/output.js +22 -3
  32. package/distTs/src/texts.js +18 -4
  33. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.17.28-dev",
4
+ "version": "1.18.0-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -253,7 +253,7 @@ class ApiClient {
253
253
  method: 'POST',
254
254
  path: `/workspaces/${encodeURIComponent(workspace)}/projects`,
255
255
  body,
256
- parseResponseBody: true
256
+ parseResponseBody: true,
257
257
  });
258
258
  }
259
259
  async pipelineRun(workspace, project, pipelineId, body) {
@@ -278,14 +278,14 @@ class ApiClient {
278
278
  method: 'POST',
279
279
  path: `/workspaces/${encodeURIComponent(workspace)}/sandboxes/yaml?project_name=${encodeURIComponent(project)}`,
280
280
  body,
281
- parseResponseBody: true
281
+ parseResponseBody: true,
282
282
  });
283
283
  }
284
284
  async getSandboxYaml(workspace, sandboxId) {
285
285
  return await this.request({
286
286
  method: 'GET',
287
287
  path: `/workspaces/${encodeURIComponent(workspace)}/sandboxes/${encodeURIComponent(sandboxId)}/yaml`,
288
- parseResponseBody: true
288
+ parseResponseBody: true,
289
289
  });
290
290
  }
291
291
  async updateSandboxByYaml(workspace, sandboxId, body) {
@@ -293,7 +293,7 @@ class ApiClient {
293
293
  method: 'PATCH',
294
294
  path: `/workspaces/${encodeURIComponent(workspace)}/sandboxes/${encodeURIComponent(sandboxId)}/yaml`,
295
295
  body,
296
- parseResponseBody: true
296
+ parseResponseBody: true,
297
297
  });
298
298
  }
299
299
  async sandboxDownloadFile(workspace, sandboxId, remotePath) {
@@ -359,6 +359,70 @@ class ApiClient {
359
359
  parseResponseBody: true,
360
360
  });
361
361
  }
362
+ async domainBuy(workspace, name, onOwnerBehalf = false, autoRenew = true) {
363
+ return await this.request({
364
+ method: 'POST',
365
+ path: `/workspaces/${encodeURIComponent(workspace)}/domains/register`,
366
+ body: {
367
+ name,
368
+ on_owner_behalf: onOwnerBehalf,
369
+ auto_renew: autoRenew,
370
+ },
371
+ });
372
+ }
373
+ async domainClaim(workspace, name, onOwnerBehalf = false) {
374
+ return await this.request({
375
+ method: 'POST',
376
+ path: `/workspaces/${encodeURIComponent(workspace)}/domains/claim`,
377
+ body: {
378
+ name,
379
+ on_owner_behalf: onOwnerBehalf,
380
+ },
381
+ });
382
+ }
383
+ async domainSearch(workspace, domains) {
384
+ return await this.request({
385
+ method: 'POST',
386
+ path: `/workspaces/${encodeURIComponent(workspace)}/domains/search`,
387
+ body: { domains },
388
+ parseResponseBody: true,
389
+ });
390
+ }
391
+ async getDomains(workspace) {
392
+ return await this.request({
393
+ method: 'GET',
394
+ path: `/workspaces/${encodeURIComponent(workspace)}/domains`,
395
+ parseResponseBody: true,
396
+ });
397
+ }
398
+ async getDomain(workspace, id) {
399
+ return await this.request({
400
+ method: 'GET',
401
+ path: `/workspaces/${encodeURIComponent(workspace)}/domains/${encodeURIComponent(id)}`,
402
+ parseResponseBody: true,
403
+ });
404
+ }
405
+ async domainSuggest(workspace, prompt, tlds, limit) {
406
+ const body = {
407
+ prompt,
408
+ limit,
409
+ };
410
+ if (tlds.length > 0)
411
+ body.tlds = tlds;
412
+ return await this.request({
413
+ method: 'POST',
414
+ path: `/workspaces/${encodeURIComponent(workspace)}/domains/suggest`,
415
+ body,
416
+ parseResponseBody: true,
417
+ });
418
+ }
419
+ async domainClaimable(workspace, name) {
420
+ return await this.request({
421
+ method: 'GET',
422
+ path: `/workspaces/${encodeURIComponent(workspace)}/domains/claimable/${encodeURIComponent(name)}`,
423
+ parseResponseBody: true,
424
+ });
425
+ }
362
426
  async registerApp(name, redirectUrl) {
363
427
  return await this.request({
364
428
  method: 'POST',
@@ -569,7 +633,7 @@ class ApiClient {
569
633
  return await this.request({
570
634
  method: 'GET',
571
635
  path: `/workspaces/${encodeURIComponent(workspace)}/projects/${encodeURIComponent(project)}`,
572
- parseResponseBody: true
636
+ parseResponseBody: true,
573
637
  });
574
638
  }
575
639
  async getProjects(workspace, page = 1, perPage = 100) {
@@ -623,6 +687,13 @@ class ApiClient {
623
687
  opts.package_version = version;
624
688
  return await this.getResourceByIdentifier(workspace, opts);
625
689
  }
690
+ async getSandboxByIdentifier(workspace, project, sandbox) {
691
+ const opts = {
692
+ project,
693
+ sandbox,
694
+ };
695
+ return await this.getResourceByIdentifier(workspace, opts);
696
+ }
626
697
  async getPackageVersions(workspace, pkgId, page = 1, perPage = 10) {
627
698
  return await this.request({
628
699
  method: 'GET',
@@ -0,0 +1,278 @@
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 output_1 = __importDefault(require("../../output"));
9
+ const input_1 = __importDefault(require("../../input"));
10
+ const popularTlds = [
11
+ 'com',
12
+ 'ai',
13
+ 'io',
14
+ 'net',
15
+ 'cloud',
16
+ 'dev',
17
+ 'app',
18
+ 'info',
19
+ 'blog',
20
+ 'run',
21
+ 'me',
22
+ 'at',
23
+ 'nl',
24
+ 'xyz',
25
+ 'org',
26
+ 'co',
27
+ 'tech',
28
+ 'studio',
29
+ 'sh',
30
+ 'space',
31
+ 'fyi',
32
+ 'link',
33
+ 'es',
34
+ 'art',
35
+ 'club',
36
+ 'inc',
37
+ 'pro',
38
+ 'store',
39
+ 'shop',
40
+ 'one',
41
+ 'biz',
42
+ 'vip',
43
+ 'tube',
44
+ 'online',
45
+ 'design',
46
+ 'realty',
47
+ 'audio',
48
+ 'lol',
49
+ 'pics',
50
+ 'love',
51
+ 'baby',
52
+ 'lat',
53
+ 'so',
54
+ 'homes',
55
+ 'beauty',
56
+ 'buzz',
57
+ 'mom',
58
+ 'my',
59
+ ];
60
+ const commandDomainBuy = (0, utils_1.newCommand)('buy', texts_1.DESC_COMMAND_DOMAIN_BUY);
61
+ commandDomainBuy.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
62
+ commandDomainBuy.option('-d, --tld <tld...>', texts_1.OPT_COMMAND_DOMAIN_BUY_TLD);
63
+ commandDomainBuy.option('-o, --owner-behalf', texts_1.OPT_COMMAND_DOMAIN_BUY_OWNER);
64
+ commandDomainBuy.argument('[domain|prompt]', texts_1.OPT_COMMAND_DOMAIN_PHRASE);
65
+ commandDomainBuy.action(async (text, options) => {
66
+ const workspace = input_1.default.restApiWorkspace(options.workspace);
67
+ const client = input_1.default.restApiTokenClient();
68
+ const tlds = getAllowedTlds(options.tld);
69
+ const prompt = (text || '').trim().toLowerCase();
70
+ const onOwnerBehalf = !!options.ownerBehalf;
71
+ if (output_1.default.isTTY()) {
72
+ await interactive(client, workspace, prompt, tlds, onOwnerBehalf);
73
+ }
74
+ else {
75
+ await nonInteractive(client, workspace, prompt, tlds, onOwnerBehalf);
76
+ }
77
+ output_1.default.exitNormal();
78
+ });
79
+ const formatDomainPrice = (price) => {
80
+ const sign = price.currency === 'USD' ? '$' : '€';
81
+ const value = price.price * price.min_duration;
82
+ const duration = price.min_duration === 1 ? '1yr' : `${price.min_duration}yrs`;
83
+ return `${sign}${value.toFixed(2)} (${duration})`;
84
+ };
85
+ const formatClaim = (domain, available) => {
86
+ if (available) {
87
+ return `${output_1.default.getGreenColor(domain)} (Free)`;
88
+ }
89
+ return output_1.default.getDimColor(`${domain} (Unavailable)`);
90
+ };
91
+ const formatDomain = (domain) => {
92
+ if (!domain.available || domain.premium) {
93
+ return output_1.default.getDimColor(`${domain.name} (Unavailable)`);
94
+ }
95
+ return `${output_1.default.getGreenColor(domain.name)} ${formatDomainPrice(domain.prices.create)} / ${formatDomainPrice(domain.prices.renew)}`;
96
+ };
97
+ const isValidDomain = (prompt) => {
98
+ return /^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/i.test(prompt);
99
+ };
100
+ const isValidSubdomain = (prompt) => {
101
+ return /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(prompt);
102
+ };
103
+ const getSubdomain = (domain) => {
104
+ const idx = domain.indexOf('.');
105
+ if (idx < 0)
106
+ return '';
107
+ return domain.substring(0, idx);
108
+ };
109
+ const getTld = (domain) => {
110
+ const idx = domain.lastIndexOf('.');
111
+ if (idx < 0)
112
+ return '';
113
+ return domain.substring(idx + 1);
114
+ };
115
+ const claimNonInteractive = async (client, workspace, domain, onOwnerBehalf) => {
116
+ output_1.default.arrowSign();
117
+ output_1.default.normal(`Matched: ${formatClaim(domain, true)}`);
118
+ await client.domainClaim(workspace, domain, onOwnerBehalf);
119
+ output_1.default.okSign();
120
+ output_1.default.normal(`${domain} claimed`);
121
+ };
122
+ const buyNonInteractive = async (client, workspace, domain, onOwnerBehalf) => {
123
+ output_1.default.arrowSign();
124
+ output_1.default.normal(`Matched: ${formatDomain(domain)}`);
125
+ if (domain.available && !domain.premium) {
126
+ await client.domainBuy(workspace, domain.name, onOwnerBehalf, true);
127
+ output_1.default.okSign();
128
+ output_1.default.normal(`${domain.name} bought`);
129
+ }
130
+ };
131
+ const interactive = async (client, workspace, prompt, tlds, onOwnerBehalf) => {
132
+ if (!prompt) {
133
+ prompt = await output_1.default.inputString(texts_1.TXT_COMMAND_DOMAIN_BUY_PROVIDE_PROMPT);
134
+ }
135
+ if (!prompt) {
136
+ output_1.default.exitError(texts_1.TXT_COMMAND_DOMAIN_BUY_PROMPT_REQUIRED);
137
+ }
138
+ output_1.default.arrowSign();
139
+ output_1.default.normal(`Searching...`);
140
+ let items = [];
141
+ const createValue = (type, name) => {
142
+ return `${type}:${name}`;
143
+ };
144
+ if (isValidDomain(prompt)) {
145
+ const subdomain = getSubdomain(prompt);
146
+ const claims = await client.domainClaimable(workspace, subdomain);
147
+ const claimable = claims.domains.find((c) => `${subdomain}.${c.domain}` === prompt);
148
+ if (claimable) {
149
+ items.push(output_1.default.createMenuSeparator('Matched'));
150
+ items.push(output_1.default.createMenuItem(formatClaim(prompt, claimable.available), createValue('claim', prompt)));
151
+ }
152
+ else {
153
+ const search = await client.domainSearch(workspace, [prompt]);
154
+ const buyable = search.domains.find((d) => d.name === prompt);
155
+ if (buyable) {
156
+ items.push(output_1.default.createMenuSeparator('Matched'));
157
+ items.push(output_1.default.createMenuItem(formatDomain(buyable), createValue('domain', prompt)));
158
+ }
159
+ }
160
+ }
161
+ else if (isValidSubdomain(prompt)) {
162
+ const claims = await client.domainClaimable(workspace, prompt);
163
+ const domains = [];
164
+ const searchTlds = tlds.length > 0 ? tlds : popularTlds;
165
+ searchTlds.forEach((tld) => {
166
+ domains.push(`${prompt}.${tld}`);
167
+ });
168
+ const search = await client.domainSearch(workspace, domains);
169
+ if (claims.domains.length > 0 || search.domains.length > 0) {
170
+ const claimsAvailable = claims.domains.filter((c) => (c.available && !tlds.length) || tlds.includes(c.domain));
171
+ const claimsUnavailable = claims.domains.filter((c) => (!c.available && !tlds.length) || tlds.includes(c.domain));
172
+ search.domains = search.domains.sort((a, b) => {
173
+ const aTld = getTld(a.name);
174
+ const bTld = getTld(b.name);
175
+ const aIdx = popularTlds.indexOf(aTld);
176
+ const bIdx = popularTlds.indexOf(bTld);
177
+ return aIdx < bIdx ? -1 : 1;
178
+ });
179
+ const domainsAvailable = search.domains.filter((d) => d.available && !d.premium);
180
+ const domainsUnavailable = search.domains.filter((d) => !d.available || d.premium);
181
+ domainsAvailable.forEach((d) => {
182
+ items.push(output_1.default.createMenuItem(formatDomain(d), createValue('domain', d.name)));
183
+ });
184
+ claimsAvailable.forEach((c, i) => {
185
+ const domain = `${prompt}.${c.domain}`;
186
+ const item = output_1.default.createMenuItem(formatClaim(domain, true), createValue('claim', domain));
187
+ if (i < 5)
188
+ items.unshift(item);
189
+ else
190
+ items.push(item);
191
+ });
192
+ domainsUnavailable.forEach((d) => {
193
+ items.push(output_1.default.createMenuItem(formatDomain(d), createValue('domain', d.name)));
194
+ });
195
+ claimsUnavailable.forEach((c) => {
196
+ const domain = `${prompt}.${c.domain}`;
197
+ const item = output_1.default.createMenuItem(formatClaim(domain, false), createValue('claim', domain));
198
+ items.push(item);
199
+ });
200
+ if (items.length > 10)
201
+ items = items.filter((_, i) => i < 10);
202
+ items.unshift(output_1.default.createMenuSeparator('Matched'));
203
+ }
204
+ }
205
+ const suggestions = await client.domainSuggest(workspace, prompt, tlds, 5);
206
+ if (suggestions.domains.length > 0 || suggestions.claims.length > 0) {
207
+ items.push(output_1.default.createMenuSeparator('Suggestions'));
208
+ let i = 0;
209
+ suggestions.claims.forEach((c) => {
210
+ if (i >= 10)
211
+ return;
212
+ items.push(output_1.default.createMenuItem(formatClaim(c, true), createValue('claim', c)));
213
+ i += 1;
214
+ });
215
+ suggestions.domains.forEach((d) => {
216
+ if (i >= 10)
217
+ return;
218
+ items.push(output_1.default.createMenuItem(formatDomain(d), createValue('domain', d.name)));
219
+ i += 1;
220
+ });
221
+ }
222
+ output_1.default.clearPreviousLine();
223
+ if (!items.length) {
224
+ output_1.default.exitError(texts_1.ERR_COMMAND_DOMAIN_NOT_FOUND);
225
+ }
226
+ const value = await output_1.default.inputMenuAdv(texts_1.TXT_COMMAND_DOMAIN_BUY_SELECT_DOMAIN, items);
227
+ const [type, name] = value.split(':');
228
+ if (type === 'claim') {
229
+ await client.domainClaim(workspace, name, onOwnerBehalf);
230
+ output_1.default.okSign();
231
+ output_1.default.normal(`${name} claimed`);
232
+ }
233
+ else {
234
+ await client.domainBuy(workspace, name, onOwnerBehalf);
235
+ output_1.default.okSign();
236
+ output_1.default.normal(`${name} bought`);
237
+ }
238
+ };
239
+ const nonInteractive = async (client, workspace, prompt, tlds, onOwnerBehalf) => {
240
+ if (!prompt) {
241
+ output_1.default.exitError(texts_1.TXT_COMMAND_DOMAIN_BUY_PROMPT_REQUIRED);
242
+ }
243
+ if (isValidDomain(prompt)) {
244
+ const subdomain = getSubdomain(prompt);
245
+ const claims = await client.domainClaimable(workspace, subdomain);
246
+ const claimable = claims.domains.find((c) => c.available && `${subdomain}.${c.domain}` === prompt);
247
+ if (claimable) {
248
+ await claimNonInteractive(client, workspace, prompt, onOwnerBehalf);
249
+ return;
250
+ }
251
+ const { domains } = await client.domainSearch(workspace, [prompt]);
252
+ await buyNonInteractive(client, workspace, domains[0], onOwnerBehalf);
253
+ return;
254
+ }
255
+ output_1.default.arrowSign();
256
+ output_1.default.normal(`Searching...`);
257
+ const suggestions = await client.domainSuggest(workspace, prompt, tlds, 5);
258
+ output_1.default.clearPreviousLine();
259
+ if (suggestions.claims.length > 0) {
260
+ await claimNonInteractive(client, workspace, suggestions.claims[0], onOwnerBehalf);
261
+ return;
262
+ }
263
+ if (suggestions.domains.length > 0) {
264
+ await buyNonInteractive(client, workspace, suggestions.domains[0], onOwnerBehalf);
265
+ return;
266
+ }
267
+ output_1.default.exitError(texts_1.ERR_COMMAND_DOMAIN_NOT_FOUND);
268
+ };
269
+ const getAllowedTlds = (tld) => {
270
+ const result = [];
271
+ if (tld) {
272
+ tld.forEach((t) => {
273
+ result.push(...t.split(',').map((t) => t.replace(/^\./, '')));
274
+ });
275
+ }
276
+ return result;
277
+ };
278
+ exports.default = commandDomainBuy;
@@ -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 commandDomainGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_DOMAIN_GET);
11
+ commandDomainGet.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
12
+ commandDomainGet.argument('<id|name>', texts_1.OPTION_COMMAND_DOMAIN_IDENTIFIER);
13
+ commandDomainGet.action(async (name, options) => {
14
+ const workspace = input_1.default.restApiWorkspace(options.workspace);
15
+ const client = input_1.default.restApiTokenClient();
16
+ let domain;
17
+ try {
18
+ domain = await client.getDomain(workspace, name);
19
+ }
20
+ catch {
21
+ const response = await client.getDomains(workspace);
22
+ domain = (response.domains || []).find((d) => d.name === name);
23
+ if (domain) {
24
+ domain = await client.getDomain(workspace, domain.id);
25
+ }
26
+ }
27
+ if (!domain) {
28
+ output_1.default.exitError(texts_1.ERR_COMMAND_DOMAIN_NOT_FOUND);
29
+ }
30
+ const props = {
31
+ Name: domain.name,
32
+ ID: domain.id,
33
+ Type: domain.type,
34
+ };
35
+ if (domain.type === 'REGISTERED') {
36
+ if (domain.expiry_date) {
37
+ props.Expires = domain.expiry_date;
38
+ }
39
+ props.Renew = domain.auto_renew ? 'Auto' : 'Manual';
40
+ }
41
+ props.URL = domain.html_url;
42
+ output_1.default.object(props);
43
+ output_1.default.exitNormal();
44
+ });
45
+ exports.default = commandDomainGet;
@@ -0,0 +1,27 @@
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 commandDomainList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_DOMAIN_LIST);
11
+ commandDomainList.alias('ls');
12
+ commandDomainList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
13
+ commandDomainList.action(async (options) => {
14
+ const workspace = input_1.default.restApiWorkspace(options.workspace);
15
+ const client = input_1.default.restApiTokenClient();
16
+ const response = await client.getDomains(workspace);
17
+ if (!response.domains || response.domains.length === 0) {
18
+ output_1.default.exitError(texts_1.ERR_COMMAND_DOMAIN_NO_DOMAINS);
19
+ }
20
+ const data = [['NAME', 'ID', 'URL']];
21
+ for (const d of response.domains) {
22
+ data.push([d.name, d.id, d.html_url]);
23
+ }
24
+ output_1.default.table(data);
25
+ output_1.default.exitNormal();
26
+ });
27
+ exports.default = commandDomainList;
@@ -0,0 +1,15 @@
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 buy_1 = __importDefault(require("./domain/buy"));
9
+ const list_1 = __importDefault(require("./domain/list"));
10
+ const get_1 = __importDefault(require("./domain/get"));
11
+ const commandDomain = (0, utils_1.newCommand)('domain', texts_1.DESC_COMMAND_DOMAIN);
12
+ commandDomain.addCommand(buy_1.default);
13
+ commandDomain.addCommand(list_1.default);
14
+ commandDomain.addCommand(get_1.default);
15
+ exports.default = commandDomain;
@@ -51,7 +51,7 @@ const getRemoteNames = (str) => {
51
51
  return names;
52
52
  };
53
53
  const tryNow = () => {
54
- output_1.default.cyan('→ ', false);
54
+ output_1.default.arrowSign();
55
55
  output_1.default.label(texts_1.OPT_COMMAND_PROJECT_LINK_TRY_NOW);
56
56
  output_1.default.dim('$ ', false);
57
57
  output_1.default.light('bdy tunnel http 3000 ', false);
@@ -57,10 +57,8 @@ commandSandboxCp.addHelpText('after', texts_1.EXAMPLE_SANDBOX_CP);
57
57
  const upload = async (client, workspace, project, source, destination) => {
58
58
  const { sourcePath, sourceStats } = input_1.default.restApiSandboxUploadSourcePath(source);
59
59
  const { identifier, remotePath, isRemoteDir } = input_1.default.restApiSandboxUploadDestinationPath(destination);
60
- const result = await client.listSandboxes(workspace, project);
61
- const sandboxes = result.sandboxes || [];
62
- const found = sandboxes.find((s) => s.identifier === identifier);
63
- if (!found) {
60
+ const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
61
+ if (!sandbox_id) {
64
62
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
65
63
  }
66
64
  if (sourceStats.isFile()) {
@@ -68,7 +66,7 @@ const upload = async (client, workspace, project, source, destination) => {
68
66
  const name = (0, path_1.basename)(sourcePath);
69
67
  output_1.default.normal((0, texts_1.TXT_SANDBOX_CP_PROGRESS)(1, 1, name));
70
68
  const remoteFile = isRemoteDir ? (0, path_1.join)(remotePath, name) : remotePath;
71
- await client.sandboxUploadFile(workspace, found.id, remoteFile, sourcePath);
69
+ await client.sandboxUploadFile(workspace, sandbox_id, remoteFile, sourcePath);
72
70
  output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_CP_DONE)(1));
73
71
  }
74
72
  else if (sourceStats.isDirectory()) {
@@ -90,7 +88,7 @@ const upload = async (client, workspace, project, source, destination) => {
90
88
  const remoteFile = (0, path_1.join)(baseRemoteDir, relativePath).replace(/\\/g, '/');
91
89
  output_1.default.clearPreviousLine();
92
90
  output_1.default.normal((0, texts_1.TXT_SANDBOX_CP_PROGRESS)(i + 1, files.length, relativePath));
93
- await client.sandboxUploadFile(workspace, found.id, remoteFile, localFile);
91
+ await client.sandboxUploadFile(workspace, sandbox_id, remoteFile, localFile);
94
92
  }
95
93
  output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_CP_DONE)(files.length));
96
94
  }
@@ -101,14 +99,12 @@ const upload = async (client, workspace, project, source, destination) => {
101
99
  const download = async (client, workspace, project, source, destination, merge, replace) => {
102
100
  const { destPath, isDestPathDir } = input_1.default.restApiSandboxDownloadDestinationPath(destination, merge, replace);
103
101
  const { sourcePath, identifier } = input_1.default.restApiSandboxDownloadSourcePath(source);
104
- const result = await client.listSandboxes(workspace, project);
105
- const sandboxes = result.sandboxes || [];
106
- const found = sandboxes.find((s) => s.identifier === identifier);
107
- if (!found) {
102
+ const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
103
+ if (!sandbox_id) {
108
104
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
109
105
  }
110
106
  output_1.default.normal(texts_1.TXT_SANDBOX_CP_DOWNLOAD, false);
111
- const { body, headers } = await client.sandboxDownloadFile(workspace, found.id, sourcePath);
107
+ const { body, headers } = await client.sandboxDownloadFile(workspace, sandbox_id, sourcePath);
112
108
  const isFile = headers['content-type'] === 'application/octet-stream';
113
109
  const name = (0, path_1.basename)(sourcePath);
114
110
  if (isFile) {
@@ -17,17 +17,15 @@ commandSandboxDestroy.action(async (identifier, options) => {
17
17
  const workspace = input_1.default.restApiWorkspace(options.workspace);
18
18
  const project = input_1.default.restApiProject(options.project);
19
19
  const client = input_1.default.restApiTokenClient();
20
- const result = await client.listSandboxes(workspace, project);
21
- const sandboxes = result.sandboxes || [];
22
- const found = sandboxes.find((s) => s.identifier === identifier);
23
- if (!found) {
20
+ const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
21
+ if (!sandbox_id) {
24
22
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
25
23
  }
26
24
  const confirmed = options.force ||
27
25
  (await output_1.default.confirm((0, texts_1.TXT_SANDBOX_DESTROY_CONFIRM)(identifier)));
28
26
  if (!confirmed)
29
27
  output_1.default.exitNormal();
30
- await client.deleteSandbox(workspace, found.id);
28
+ await client.deleteSandbox(workspace, sandbox_id);
31
29
  output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_DESTROYED)(identifier));
32
30
  });
33
31
  exports.default = commandSandboxDestroy;
@@ -15,13 +15,11 @@ 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
17
  const client = input_1.default.restApiTokenClient();
18
- const result = await client.listSandboxes(workspace, project);
19
- const sandboxes = result.sandboxes || [];
20
- const found = sandboxes.find((s) => s.identifier === identifier);
21
- if (!found) {
18
+ const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
19
+ if (!sandbox_id) {
22
20
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
23
21
  }
24
- const sandbox = await client.getSandbox(workspace, found.id);
22
+ const sandbox = await client.getSandbox(workspace, sandbox_id);
25
23
  const endpoints = sandbox.endpoints || [];
26
24
  const existing = endpoints.find((ep) => ep.name === options.name);
27
25
  if (existing) {
@@ -30,7 +28,7 @@ commandSandboxEndpointAdd.action(async (identifier, options) => {
30
28
  const endpoint = input_1.default.prepareSandboxEndpoint(options);
31
29
  logger_1.default.info(endpoint);
32
30
  const updatedEndpoints = [...endpoints, endpoint];
33
- const updatedSandbox = await client.updateSandbox(workspace, found.id, {
31
+ const updatedSandbox = await client.updateSandbox(workspace, sandbox_id, {
34
32
  endpoints: updatedEndpoints,
35
33
  });
36
34
  const addedEndpoint = (updatedSandbox.endpoints || []).find((ep) => ep.name === options.name);
@@ -19,13 +19,11 @@ commandSandboxEndpointDelete.action(async (identifier, endpointName, options) =>
19
19
  const workspace = input_1.default.restApiWorkspace(options.workspace);
20
20
  const project = input_1.default.restApiProject(options.project);
21
21
  const client = input_1.default.restApiTokenClient();
22
- const result = await client.listSandboxes(workspace, project);
23
- const sandboxes = result.sandboxes || [];
24
- const found = sandboxes.find((s) => s.identifier === identifier);
25
- if (!found) {
22
+ const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
23
+ if (!sandbox_id) {
26
24
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
27
25
  }
28
- const sandbox = await client.getSandbox(workspace, found.id);
26
+ const sandbox = await client.getSandbox(workspace, sandbox_id);
29
27
  const endpoints = sandbox.endpoints || [];
30
28
  const endpointIndex = endpoints.findIndex((ep) => ep.name === endpointName);
31
29
  if (endpointIndex === -1) {
@@ -36,7 +34,7 @@ commandSandboxEndpointDelete.action(async (identifier, endpointName, options) =>
36
34
  (await output_1.default.confirm((0, texts_1.TXT_SANDBOX_ENDPOINT_DELETE_CONFIRM)(identifier, endpointName)));
37
35
  if (!confirmed)
38
36
  output_1.default.exitNormal();
39
- await client.updateSandbox(workspace, found.id, {
37
+ await client.updateSandbox(workspace, sandbox_id, {
40
38
  endpoints: updatedEndpoints,
41
39
  });
42
40
  output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_ENDPOINT_DELETED)(endpointName));
@@ -17,13 +17,11 @@ commandSandboxEndpointGet.action(async (identifier, endpointName, options) => {
17
17
  const workspace = input_1.default.restApiWorkspace(options.workspace);
18
18
  const project = input_1.default.restApiProject(options.project);
19
19
  const client = input_1.default.restApiTokenClient();
20
- const result = await client.listSandboxes(workspace, project);
21
- const sandboxes = result.sandboxes || [];
22
- const found = sandboxes.find((s) => s.identifier === identifier);
23
- if (!found) {
20
+ const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
21
+ if (!sandbox_id) {
24
22
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
25
23
  }
26
- const sandbox = await client.getSandbox(workspace, found.id);
24
+ const sandbox = await client.getSandbox(workspace, sandbox_id);
27
25
  const endpoints = sandbox.endpoints || [];
28
26
  const endpoint = endpoints.find((ep) => ep.name === endpointName);
29
27
  if (!endpoint) {
@@ -17,13 +17,11 @@ commandSandboxEndpointList.action(async (identifier, options) => {
17
17
  const workspace = input_1.default.restApiWorkspace(options.workspace);
18
18
  const project = input_1.default.restApiProject(options.project);
19
19
  const client = input_1.default.restApiTokenClient();
20
- const result = await client.listSandboxes(workspace, project);
21
- const sandboxes = result.sandboxes || [];
22
- const found = sandboxes.find((s) => s.identifier === identifier);
23
- if (!found) {
20
+ const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
21
+ if (!sandbox_id) {
24
22
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
25
23
  }
26
- const sandbox = await client.getSandbox(workspace, found.id);
24
+ const sandbox = await client.getSandbox(workspace, sandbox_id);
27
25
  const endpoints = sandbox.endpoints || [];
28
26
  if (endpoints.length === 0) {
29
27
  output_1.default.exitError(texts_1.ERR_SANDBOX_ENDPOINTS_NOT_FOUND);
@@ -22,13 +22,11 @@ commandSandboxExecCommand.action(async (identifier, command, options) => {
22
22
  const project = input_1.default.restApiProject(options.project);
23
23
  const client = input_1.default.restApiTokenClient();
24
24
  const runtime = input_1.default.restApiSandboxExecRuntime(options.runtime);
25
- const result = await client.listSandboxes(workspace, project);
26
- const sandboxes = result.sandboxes || [];
27
- const found = sandboxes.find((s) => s.identifier === identifier);
28
- if (!found) {
25
+ const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
26
+ if (!sandbox_id) {
29
27
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
30
28
  }
31
- const cmdResult = await client.executeSandboxCommand(workspace, found.id, {
29
+ const cmdResult = await client.executeSandboxCommand(workspace, sandbox_id, {
32
30
  command,
33
31
  runtime,
34
32
  });
@@ -37,7 +35,7 @@ commandSandboxExecCommand.action(async (identifier, command, options) => {
37
35
  output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_EXEC_BACKGROUND)(cmdResult.id));
38
36
  }
39
37
  else {
40
- const body = await client.streamSandboxCommandLogs(workspace, found.id, cmdResult.id);
38
+ const body = await client.streamSandboxCommandLogs(workspace, sandbox_id, cmdResult.id);
41
39
  body.on('data', (data) => {
42
40
  if (data) {
43
41
  try {
@@ -54,7 +52,7 @@ commandSandboxExecCommand.action(async (identifier, command, options) => {
54
52
  }
55
53
  });
56
54
  body.on('close', async () => {
57
- const cmdExit = await client.getSandboxCommand(workspace, found.id, cmdResult.id);
55
+ const cmdExit = await client.getSandboxCommand(workspace, sandbox_id, cmdResult.id);
58
56
  if (cmdExit.status === utils_1.SANDBOX_EXEC_STATUS.SUCCESSFUL) {
59
57
  output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_EXEC_SUCCESS)(cmdResult.id));
60
58
  }
@@ -18,17 +18,15 @@ commandSandboxExecKill.action(async (identifier, commandId, options) => {
18
18
  const workspace = input_1.default.restApiWorkspace(options.workspace);
19
19
  const project = input_1.default.restApiProject(options.project);
20
20
  const client = input_1.default.restApiTokenClient();
21
- const result = await client.listSandboxes(workspace, project);
22
- const sandboxes = result.sandboxes || [];
23
- const found = sandboxes.find((s) => s.identifier === identifier);
24
- if (!found) {
21
+ const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
22
+ if (!sandbox_id) {
25
23
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
26
24
  }
27
25
  const confirmed = options.force ||
28
26
  (await output_1.default.confirm((0, texts_1.OPTION_SANDBOX_COMMAND_KILL_CONFIRM)(identifier, commandId)));
29
27
  if (!confirmed)
30
28
  output_1.default.exitNormal();
31
- await client.terminateSandboxCommand(workspace, found.id, commandId);
29
+ await client.terminateSandboxCommand(workspace, sandbox_id, commandId);
32
30
  output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_COMMAND_KILLED)(commandId));
33
31
  });
34
32
  exports.default = commandSandboxExecKill;
@@ -17,13 +17,11 @@ commandSandboxExecList.action(async (identifier, options) => {
17
17
  const workspace = input_1.default.restApiWorkspace(options.workspace);
18
18
  const project = input_1.default.restApiProject(options.project);
19
19
  const client = input_1.default.restApiTokenClient();
20
- const result = await client.listSandboxes(workspace, project);
21
- const sandboxes = result.sandboxes || [];
22
- const found = sandboxes.find((s) => s.identifier === identifier);
23
- if (!found) {
20
+ const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
21
+ if (!sandbox_id) {
24
22
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
25
23
  }
26
- const commandsResult = await client.listSandboxCommands(workspace, found.id);
24
+ const commandsResult = await client.listSandboxCommands(workspace, sandbox_id);
27
25
  const commands = commandsResult.commands || [];
28
26
  if (commands.length === 0) {
29
27
  output_1.default.exitError(texts_1.ERR_SANDBOX_NO_COMMANDS);
@@ -19,13 +19,11 @@ commandSandboxExecLogs.action(async (identifier, commandId, options) => {
19
19
  const workspace = input_1.default.restApiWorkspace(options.workspace);
20
20
  const project = input_1.default.restApiProject(options.project);
21
21
  const client = input_1.default.restApiTokenClient();
22
- const result = await client.listSandboxes(workspace, project);
23
- const sandboxes = result.sandboxes || [];
24
- const found = sandboxes.find((s) => s.identifier === identifier);
25
- if (!found) {
22
+ const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
23
+ if (!sandbox_id) {
26
24
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
27
25
  }
28
- const body = await client.streamSandboxCommandLogs(workspace, found.id, commandId, !!options.wait);
26
+ const body = await client.streamSandboxCommandLogs(workspace, sandbox_id, commandId, !!options.wait);
29
27
  body.on('data', (data) => {
30
28
  if (data) {
31
29
  try {
@@ -42,7 +40,7 @@ commandSandboxExecLogs.action(async (identifier, commandId, options) => {
42
40
  }
43
41
  });
44
42
  body.on('close', async () => {
45
- const cmdExit = await client.getSandboxCommand(workspace, found.id, commandId);
43
+ const cmdExit = await client.getSandboxCommand(workspace, sandbox_id, commandId);
46
44
  if (cmdExit.status === utils_1.SANDBOX_EXEC_STATUS.SUCCESSFUL) {
47
45
  output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_EXEC_SUCCESS)(commandId));
48
46
  }
@@ -17,13 +17,11 @@ commandSandboxExecStatus.action(async (identifier, commandId, options) => {
17
17
  const workspace = input_1.default.restApiWorkspace(options.workspace);
18
18
  const project = input_1.default.restApiProject(options.project);
19
19
  const client = input_1.default.restApiTokenClient();
20
- const result = await client.listSandboxes(workspace, project);
21
- const sandboxes = result.sandboxes || [];
22
- const found = sandboxes.find((s) => s.identifier === identifier);
23
- if (!found) {
20
+ const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
21
+ if (!sandbox_id) {
24
22
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
25
23
  }
26
- const cmd = await client.getSandboxCommand(workspace, found.id, commandId);
24
+ const cmd = await client.getSandboxCommand(workspace, sandbox_id, commandId);
27
25
  const data = [
28
26
  ['Property', 'Value'],
29
27
  ['Command ID', cmd.id || '-'],
@@ -15,13 +15,11 @@ commandSandboxGet.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
17
  const client = input_1.default.restApiTokenClient();
18
- const result = await client.listSandboxes(workspace, project);
19
- const sandboxes = result.sandboxes || [];
20
- const found = sandboxes.find((s) => s.identifier === identifier);
21
- if (!found) {
18
+ const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
19
+ if (!sandbox_id) {
22
20
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
23
21
  }
24
- const sandbox = await client.getSandbox(workspace, found.id);
22
+ const sandbox = await client.getSandbox(workspace, sandbox_id);
25
23
  const data = [
26
24
  ['Field', 'Value'],
27
25
  ['ID', sandbox.id || '-'],
@@ -16,18 +16,16 @@ commandSandboxRestart.action(async (identifier, options) => {
16
16
  const workspace = input_1.default.restApiWorkspace(options.workspace);
17
17
  const project = input_1.default.restApiProject(options.project);
18
18
  const client = input_1.default.restApiTokenClient();
19
- const result = await client.listSandboxes(workspace, project);
20
- const sandboxes = result.sandboxes || [];
21
- const found = sandboxes.find((s) => s.identifier === identifier);
22
- if (!found) {
19
+ const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
20
+ if (!sandbox_id) {
23
21
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
24
22
  }
25
- await client.restartSandbox(workspace, found.id);
23
+ await client.restartSandbox(workspace, sandbox_id);
26
24
  if (options.wait) {
27
25
  output_1.default.normal(texts_1.TXT_SANDBOX_WAITING_START);
28
26
  const timeout = parseInt(options.wait, 10) || 300;
29
27
  try {
30
- const status = await client.sandboxWaitForRunning(workspace, found.id, timeout);
28
+ const status = await client.sandboxWaitForRunning(workspace, sandbox_id, timeout);
31
29
  if (status !== utils_1.SANDBOX_STATUS.RUNNING) {
32
30
  output_1.default.exitError(texts_1.ERR_SANDBOX_RUNNING_FAILED);
33
31
  }
@@ -20,10 +20,8 @@ commandSandboxSnapshotCreate.action(async (identifier, options) => {
20
20
  const workspace = input_1.default.restApiWorkspace(options.workspace);
21
21
  const project = input_1.default.restApiProject(options.project);
22
22
  const client = input_1.default.restApiTokenClient();
23
- const result = await client.listSandboxes(workspace, project);
24
- const sandboxes = result.sandboxes || [];
25
- const found = sandboxes.find((s) => s.identifier === identifier);
26
- if (!found) {
23
+ const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
24
+ if (!sandbox_id) {
27
25
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
28
26
  }
29
27
  const defaultName = 'snapshot-' + (0, human_id_1.default)({ separator: '-', capitalize: false });
@@ -31,13 +29,13 @@ commandSandboxSnapshotCreate.action(async (identifier, options) => {
31
29
  const body = {
32
30
  name: snapshotName,
33
31
  };
34
- const snapshot = await client.createSandboxSnapshot(workspace, found.id, body);
32
+ const snapshot = await client.createSandboxSnapshot(workspace, sandbox_id, body);
35
33
  const snapshotId = snapshot.id;
36
34
  if (options.wait) {
37
35
  output_1.default.normal(texts_1.TXT_SANDBOX_SNAPSHOT_WAITING);
38
36
  const timeout = parseInt(options.wait, 10) || 300;
39
37
  try {
40
- const status = await client.sandboxWaitForSnapshot(workspace, found.id, snapshotId, timeout);
38
+ const status = await client.sandboxWaitForSnapshot(workspace, sandbox_id, snapshotId, timeout);
41
39
  if (status !== utils_1.SANDBOX_SNAPSHOT_STATUS.CREATED) {
42
40
  output_1.default.exitError(texts_1.ERR_SANDBOX_SNAPSHOT_FAILED);
43
41
  }
@@ -19,13 +19,11 @@ commandSandboxSnapshotDelete.action(async (identifier, snapshotName, options) =>
19
19
  const workspace = input_1.default.restApiWorkspace(options.workspace);
20
20
  const project = input_1.default.restApiProject(options.project);
21
21
  const client = input_1.default.restApiTokenClient();
22
- const result = await client.listSandboxes(workspace, project);
23
- const sandboxes = result.sandboxes || [];
24
- const found = sandboxes.find((s) => s.identifier === identifier);
25
- if (!found) {
22
+ const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
23
+ if (!sandbox_id) {
26
24
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
27
25
  }
28
- const snapshotsResult = await client.listSandboxSnapshots(workspace, found.id);
26
+ const snapshotsResult = await client.listSandboxSnapshots(workspace, sandbox_id);
29
27
  const snapshots = snapshotsResult.snapshots || [];
30
28
  const foundSnapshot = snapshots.find((s) => s.name === snapshotName);
31
29
  if (!foundSnapshot) {
@@ -35,7 +33,7 @@ commandSandboxSnapshotDelete.action(async (identifier, snapshotName, options) =>
35
33
  (await output_1.default.confirm((0, texts_1.TXT_SANDBOX_SNAPSHOT_DELETE_CONFIRM)(identifier, snapshotName)));
36
34
  if (!confirmed)
37
35
  output_1.default.exitNormal();
38
- await client.deleteSandboxSnapshot(workspace, found.id, foundSnapshot.id);
36
+ await client.deleteSandboxSnapshot(workspace, sandbox_id, foundSnapshot.id);
39
37
  output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_SNAPSHOT_DELETED)(snapshotName));
40
38
  });
41
39
  exports.default = commandSandboxSnapshotDelete;
@@ -17,19 +17,17 @@ commandSandboxSnapshotGet.action(async (identifier, snapshotName, options) => {
17
17
  const workspace = input_1.default.restApiWorkspace(options.workspace);
18
18
  const project = input_1.default.restApiProject(options.project);
19
19
  const client = input_1.default.restApiTokenClient();
20
- const result = await client.listSandboxes(workspace, project);
21
- const sandboxes = result.sandboxes || [];
22
- const found = sandboxes.find((s) => s.identifier === identifier);
23
- if (!found) {
20
+ const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
21
+ if (!sandbox_id) {
24
22
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
25
23
  }
26
- const snapshotsResult = await client.listSandboxSnapshots(workspace, found.id);
24
+ const snapshotsResult = await client.listSandboxSnapshots(workspace, sandbox_id);
27
25
  const snapshots = snapshotsResult.snapshots || [];
28
26
  const foundSnapshot = snapshots.find((s) => s.name === snapshotName);
29
27
  if (!foundSnapshot) {
30
28
  output_1.default.exitError(texts_1.ERR_SANDBOX_SNAPSHOT_NOT_FOUND);
31
29
  }
32
- const snapshot = await client.getSandboxSnapshot(workspace, found.id, foundSnapshot.id);
30
+ const snapshot = await client.getSandboxSnapshot(workspace, sandbox_id, foundSnapshot.id);
33
31
  const data = [
34
32
  ['Field', 'Value'],
35
33
  ['Name', snapshot.name || '-'],
@@ -19,13 +19,11 @@ commandSandboxSnapshotList.action(async (identifier, options) => {
19
19
  const client = input_1.default.restApiTokenClient();
20
20
  let snapshots;
21
21
  if (identifier) {
22
- const result = await client.listSandboxes(workspace, project);
23
- const sandboxes = result.sandboxes || [];
24
- const found = sandboxes.find((s) => s.identifier === identifier);
25
- if (!found) {
22
+ const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
23
+ if (!sandbox_id) {
26
24
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
27
25
  }
28
- const snapshotsResult = await client.listSandboxSnapshots(workspace, found.id);
26
+ const snapshotsResult = await client.listSandboxSnapshots(workspace, sandbox_id);
29
27
  snapshots = snapshotsResult.snapshots || [];
30
28
  }
31
29
  else {
@@ -16,18 +16,16 @@ commandSandboxStart.action(async (identifier, options) => {
16
16
  const workspace = input_1.default.restApiWorkspace(options.workspace);
17
17
  const project = input_1.default.restApiProject(options.project);
18
18
  const client = input_1.default.restApiTokenClient();
19
- const result = await client.listSandboxes(workspace, project);
20
- const sandboxes = result.sandboxes || [];
21
- const found = sandboxes.find((s) => s.identifier === identifier);
22
- if (!found) {
19
+ const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
20
+ if (!sandbox_id) {
23
21
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
24
22
  }
25
- await client.startSandbox(workspace, found.id);
23
+ await client.startSandbox(workspace, sandbox_id);
26
24
  if (options.wait) {
27
25
  output_1.default.normal(texts_1.TXT_SANDBOX_WAITING_START);
28
26
  const timeout = parseInt(options.wait, 10) || 300;
29
27
  try {
30
- const status = await client.sandboxWaitForRunning(workspace, found.id, timeout);
28
+ const status = await client.sandboxWaitForRunning(workspace, sandbox_id, timeout);
31
29
  if (status !== utils_1.SANDBOX_STATUS.RUNNING) {
32
30
  output_1.default.exitError(texts_1.ERR_SANDBOX_RUNNING_FAILED);
33
31
  }
@@ -15,13 +15,11 @@ commandSandboxStatus.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
17
  const client = input_1.default.restApiTokenClient();
18
- const result = await client.listSandboxes(workspace, project);
19
- const sandboxes = result.sandboxes || [];
20
- const found = sandboxes.find((s) => s.identifier === identifier);
21
- if (!found) {
18
+ const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
19
+ if (!sandbox_id) {
22
20
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
23
21
  }
24
- const sandbox = await client.getSandbox(workspace, found.id);
22
+ const sandbox = await client.getSandbox(workspace, sandbox_id);
25
23
  output_1.default.table([
26
24
  ['Type', 'Status'],
27
25
  ['Status', sandbox.status || 'UNKNOWN'],
@@ -16,18 +16,16 @@ commandSandboxStop.action(async (identifier, options) => {
16
16
  const workspace = input_1.default.restApiWorkspace(options.workspace);
17
17
  const project = input_1.default.restApiProject(options.project);
18
18
  const client = input_1.default.restApiTokenClient();
19
- const result = await client.listSandboxes(workspace, project);
20
- const sandboxes = result.sandboxes || [];
21
- const found = sandboxes.find((s) => s.identifier === identifier);
22
- if (!found) {
19
+ const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
20
+ if (!sandbox_id) {
23
21
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
24
22
  }
25
- await client.stopSandbox(workspace, found.id);
23
+ await client.stopSandbox(workspace, sandbox_id);
26
24
  if (options.wait) {
27
25
  output_1.default.normal(texts_1.TXT_SANDBOX_WAITING_STOP);
28
26
  const timeout = parseInt(options.wait, 10) || 300;
29
27
  try {
30
- const status = await client.sandboxWaitForRunning(workspace, found.id, timeout);
28
+ const status = await client.sandboxWaitForRunning(workspace, sandbox_id, timeout);
31
29
  if (status !== utils_1.SANDBOX_STATUS.STOPPED) {
32
30
  output_1.default.exitError(texts_1.ERR_SANDBOX_STOP_FAILED);
33
31
  }
@@ -21,22 +21,19 @@ commandSandboxUpdate.action(async (identifier, yamlFile, options) => {
21
21
  const workspace = input_1.default.restApiWorkspace(options.workspace);
22
22
  const project = input_1.default.restApiProject(options.project);
23
23
  const client = input_1.default.restApiTokenClient();
24
- let result = await client.listSandboxes(workspace, project);
25
- const sandboxes = result.sandboxes || [];
26
- const found = sandboxes.find((s) => s.identifier === identifier);
27
- if (!found) {
24
+ const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
25
+ if (!sandbox_id) {
28
26
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
29
27
  }
30
- const sandboxId = found.id;
31
28
  const body = {
32
29
  yaml: Buffer.from(yaml, 'utf8').toString('base64'),
33
30
  };
34
- result = await client.updateSandboxByYaml(workspace, sandboxId, body);
31
+ const result = await client.updateSandboxByYaml(workspace, sandbox_id, body);
35
32
  if (options.waitForRunning) {
36
33
  output_1.default.normal(texts_1.TXT_SANDBOX_WAITING_RUNNING);
37
34
  const timeout = parseInt(options.waitForRunning, 10) || 300;
38
35
  try {
39
- const status = await client.sandboxWaitForRunning(workspace, sandboxId, timeout);
36
+ const status = await client.sandboxWaitForRunning(workspace, sandbox_id, timeout);
40
37
  if (status !== utils_1.SANDBOX_STATUS.RUNNING) {
41
38
  output_1.default.exitError(texts_1.ERR_SANDBOX_RUNNING_FAILED);
42
39
  }
@@ -49,7 +46,7 @@ commandSandboxUpdate.action(async (identifier, yamlFile, options) => {
49
46
  output_1.default.normal(texts_1.TXT_SANDBOX_WAITING_SETUP);
50
47
  const timeout = parseInt(options.waitForConfigured, 10) || 300;
51
48
  try {
52
- const status = await client.sandboxWaitForConfigured(workspace, sandboxId, timeout);
49
+ const status = await client.sandboxWaitForConfigured(workspace, sandbox_id, timeout);
53
50
  if (status !== utils_1.SANDBOX_SETUP_STATUS.SUCCESS) {
54
51
  output_1.default.exitError(texts_1.ERR_SANDBOX_SETUP_FAILED);
55
52
  }
@@ -17,14 +17,11 @@ commandSandboxYaml.action(async (identifier, options) => {
17
17
  const workspace = input_1.default.restApiWorkspace(options.workspace);
18
18
  const project = input_1.default.restApiProject(options.project);
19
19
  const client = input_1.default.restApiTokenClient();
20
- let result = await client.listSandboxes(workspace, project);
21
- const sandboxes = result.sandboxes || [];
22
- const found = sandboxes.find((s) => s.identifier === identifier);
23
- if (!found) {
20
+ const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
21
+ if (!sandbox_id) {
24
22
  output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
25
23
  }
26
- const sandboxId = found.id;
27
- result = await client.getSandboxYaml(workspace, sandboxId);
24
+ const result = await client.getSandboxYaml(workspace, sandbox_id);
28
25
  output_1.default.exitNormal(Buffer.from(result.yaml, 'base64').toString('utf8'));
29
26
  });
30
27
  exports.default = commandSandboxYaml;
@@ -25,6 +25,7 @@ const package_1 = __importDefault(require("./command/package"));
25
25
  const api_1 = __importDefault(require("./command/api"));
26
26
  const autocomplete_1 = __importDefault(require("./autocomplete"));
27
27
  const autocomplete_2 = __importDefault(require("./command/autocomplete"));
28
+ const domain_1 = __importDefault(require("./command/domain"));
28
29
  stream_1.default.setDefaultHighWaterMark(false, 67108864);
29
30
  process.title = 'bdy';
30
31
  process.on('uncaughtException', (err) => {
@@ -45,6 +46,7 @@ program.addCommand(ut_1.default);
45
46
  program.addCommand(pipeline_1.default);
46
47
  program.addCommand(package_1.default);
47
48
  program.addCommand(sandbox_1.default);
49
+ program.addCommand(domain_1.default);
48
50
  program.addCommand(login_1.default);
49
51
  program.addCommand(whoami_1.default);
50
52
  program.addCommand(logout_1.default);
@@ -66,9 +66,15 @@ class Output {
66
66
  static getOkSign() {
67
67
  return '✔ ';
68
68
  }
69
+ static getArrowSign() {
70
+ return '→ ';
71
+ }
69
72
  static okSign(newLine = false) {
70
73
  return this.cyan(this.getOkSign(), newLine);
71
74
  }
75
+ static arrowSign(newLine = false) {
76
+ return this.cyan(this.getArrowSign(), newLine);
77
+ }
72
78
  static exitSuccess(msg) {
73
79
  this.exitNormal(this.getGreenColor(msg));
74
80
  }
@@ -280,14 +286,27 @@ class Output {
280
286
  else {
281
287
  this.cyan('? ', false);
282
288
  this.normal(message, false);
283
- if (items.length > 0) {
284
- this.cyan(` ${items[0].name}`);
285
- return items[0].value;
289
+ const item = items.find((item) => !prompts_1.default.Separator.isSeparator(item) && !item.disabled);
290
+ if (item && item.name && item.value) {
291
+ this.cyan(` ${item.name}`);
292
+ return item.value;
286
293
  }
287
294
  this.normal('');
288
295
  return '';
289
296
  }
290
297
  }
298
+ static createMenuSeparator(text) {
299
+ return new prompts_1.default.Separator(text);
300
+ }
301
+ static createMenuItem(name, value, description) {
302
+ const item = {
303
+ name,
304
+ value,
305
+ };
306
+ if (description)
307
+ item.description = description;
308
+ return item;
309
+ }
291
310
  static async inputMenu(message, items) {
292
311
  if (this.isStdInTTY()) {
293
312
  return await prompts_1.default.select({
@@ -11,14 +11,14 @@ exports.LOG_TUNNEL_HTTP_WRONG_USER_AGENTS = exports.LOG_TUNNEL_HTTP_CIRCUIT_BREA
11
11
  exports.OPTION_SANDBOX_APP_TYPE = exports.OPTION_SANDBOX_APP_DIR = exports.OPTION_SANDBOX_RUN_COMMAND = exports.OPTION_SANDBOX_YAML = exports.OPTION_SANDBOX_TAGS = exports.OPTION_SANDBOX_INSTALL_COMMANDS = exports.OPTION_SANDBOX_RESOURCES = exports.OPTION_SANDBOX_OS = exports.OPTION_SANDBOX_NAME = exports.OPTION_SANDBOX_IDENTIFIER = exports.TXT_AUTOCOMPLETE_UNINSTALLED = exports.TXT_AUTOCOMPLETE_INSTALLED = exports.DESC_COMMAND_AUTOCOMPLETE_UNINSTALL = exports.DESC_COMMAND_AUTOCOMPLETE_INSTALL = exports.DESC_COMMAND_AUTOCOMPLETE = exports.DESC_COMMAND_SANDBOX_EXEC = exports.DESC_COMMAND_SANDBOX_STATUS = exports.DESC_COMMAND_SANDBOX_RESTART = exports.DESC_COMMAND_SANDBOX_STOP = exports.DESC_COMMAND_SANDBOX_START = exports.DESC_COMMAND_SANDBOX_DESTROY = exports.DESC_COMMAND_SANDBOX_GET = exports.DESC_COMMAND_SANDBOX_LIST = exports.DESC_COMMAND_SANDBOX_UPDATE = exports.DESC_COMMAND_SANDBOX_GET_YAML = exports.DESC_COMMAND_SANDBOX_CREATE = exports.DESC_COMMAND_SANDBOX = exports.DEBUG_WAIT_FOR_IDLE_TIMEOUT = exports.DEBUG_WAIT_FOR_IDLE = exports.DEBUG_RESOURCE_DISCOVERY_TIMEOUT = exports.DEBUG_AUTO_WIDTH = exports.DEBUG_AUTO_SCROLL = exports.DEBUG_RESOURCE_SCRAPPING_URL = exports.DEBUG_SNAPSHOT_PROCESSING = exports.DEBUG_SNAPSHOTS_PROCESSING = exports.DEBUG_EXEC_COMMAND = exports.DEBUG_EXEC_TEST_COMMAND = exports.LOG_INSTALLED_BROWSER = exports.LOG_SESSION_LINK = exports.LOG_SENDING_DATA = exports.LOG_SENDING_REQUEST = exports.LOG_PROCESSING_SNAPSHOTS = exports.LOG_RUNNING_EXEC_COMMAND = exports.LOG_TUNNEL_SSH_STREAM = exports.LOG_TUNNEL_TLS_AGENT_STREAM = exports.LOG_TUNNEL_TLS_REGION_STREAM = exports.LOG_TUNNEL_TLS_TARGET_STREAM = exports.LOG_TUNNEL_HTTP2_STREAM = exports.LOG_TUNNEL_HTTP1_STREAM = exports.LOG_TUNNEL_TCP_STREAM = void 0;
12
12
  exports.DESC_COMMAND_SANDBOX_ENDPOINT_GET = exports.DESC_COMMAND_SANDBOX_ENDPOINT_LIST = exports.DESC_COMMAND_SANDBOX_ENDPOINT = exports.ERR_SANDBOX_SNAPSHOTS_NOT_FOUND = exports.ERR_SANDBOX_SNAPSHOT_NOT_FOUND = exports.ERR_SANDBOX_SNAPSHOT_FAILED = exports.TXT_SANDBOX_SNAPSHOT_WAITING = exports.TXT_SANDBOX_SNAPSHOT_DELETE_CONFIRM = exports.TXT_SANDBOX_SNAPSHOT_DELETED = exports.TXT_SANDBOX_SNAPSHOT_CREATED = exports.OPTION_SANDBOX_FROM_SNAPSHOT = exports.OPTION_SANDBOX_SNAPSHOT_NAME_ARG = exports.OPTION_SANDBOX_SNAPSHOT_NAME = exports.DESC_COMMAND_SANDBOX_SNAPSHOT_DELETE = exports.DESC_COMMAND_SANDBOX_SNAPSHOT_GET = exports.DESC_COMMAND_SANDBOX_SNAPSHOT_CREATE = exports.DESC_COMMAND_SANDBOX_SNAPSHOT_LIST = exports.DESC_COMMAND_SANDBOX_SNAPSHOT = exports.TXT_SANDBOX_COMMAND_KILLED = exports.OPTION_SANDBOX_COMMAND_KILL_CONFIRM = exports.OPTION_SANDBOX_COMMAND_ID = exports.DESC_COMMAND_SANDBOX_EXEC_KILL = exports.DESC_COMMAND_SANDBOX_EXEC_LOGS = exports.DESC_COMMAND_SANDBOX_EXEC_STATUS = exports.DESC_COMMAND_SANDBOX_EXEC_LIST = exports.TXT_SANDBOX_WAITING_START = exports.TXT_SANDBOX_WAITING_STOP = exports.TXT_SANDBOX_WAITING_SETUP = exports.TXT_SANDBOX_WAITING_RUNNING = exports.TXT_SANDBOX_STOPPED = exports.TXT_SANDBOX_STARTED = exports.TXT_SANDBOX_DESTROYED = exports.TXT_SANDBOX_DESTROY_CONFIRM = exports.TXT_SANDBOX_UPDATED = exports.TXT_SANDBOX_CREATED = exports.TXT_SANDBOX_CREATING = exports.OPTION_SANDBOX_WAIT = exports.OPTION_SANDBOX_WAIT_CONFIGURED = exports.OPTION_SANDBOX_WAIT_RUNNING = exports.ERR_SANDBOX_STOP_FAILED = exports.ERR_SANDBOX_NO_COMMANDS = exports.ERR_SANDBOX_RUNNING_FAILED = exports.ERR_SANDBOX_STOP_TIMEOUT = exports.ERR_SANDBOX_SNAPSHOT_TIMEOUT = exports.ERR_SANDBOX_RUNNING_TIMEOUT = exports.ERR_SANDBOX_SETUP_TIMEOUT = exports.ERR_SANDBOX_SETUP_FAILED = exports.ERR_SANDBOX_INVALID_RESOURCES = exports.ERR_SANDBOX_NOT_FOUND = exports.OPTION_SANDBOX_RUNTIME = void 0;
13
13
  exports.DESC_COMMAND_API_WORKSPACE = exports.DESC_COMMAND_API_REQUEST_URL = exports.DESC_COMMAND_API_GET = exports.DESC_COMMAND_API_PATCH = exports.DESC_COMMAND_API_DELETE = exports.DESC_COMMAND_API_PUT = exports.DESC_COMMAND_API_POST = exports.DESC_COMMAND_API_LIST = exports.DESC_COMMAND_API = exports.ERR_WHOAMI_LOGOUT = exports.TXT_WHOAMI_NO_WORKSPACE = exports.DESC_COMMAND_WHOAMI = exports.TXT_SANDBOX_EXEC_FAILED = exports.TXT_SANDBOX_EXEC_INPROGRESS = exports.TXT_SANDBOX_EXEC_SUCCESS = exports.TXT_SANDBOX_EXEC_BACKGROUND = exports.TXT_SANDBOX_EXEC_ID = exports.ERR_SANDBOX_CP_INVALID_SOURCE = exports.ERR_SANDBOX_CP_INVALID_DEST = exports.ERR_SANDBOX_CP_REPLACE = exports.ERR_SANDBOX_CP_MKDIR = exports.ERR_SANDBOX_CP_PATH_EXISTS = exports.ERR_SANDBOX_CP_NOT_EMPTY_DIR = exports.ERR_SANDBOX_CP_READDIR = exports.ERR_SANDBOX_CP_DEST_NOT_FOLDER = exports.ERR_SANDBOX_CP_SOURCE_NOT_FOUND = exports.TXT_SANDBOX_CP_DONE = exports.TXT_SANDBOX_CP_PROGRESS = exports.TXT_SANDBOX_UNZIPPING_COUNT = exports.TXT_SANDBOX_UNZIP_DONE = exports.TXT_SANDBOX_UNZIP = exports.TXT_SANDBOX_CP_DOWNLOAD_DONE = exports.TXT_SANDBOX_CP_DOWNLOAD = exports.OPTION_SANDBOX_CP_DOWNLOAD_REPLACE = exports.OPTION_SANDBOX_CP_DOWNLOAD_MERGE = exports.OPTION_SANDBOX_CP_DEST = exports.OPTION_SANDBOX_CP_SOURCE = exports.DESC_COMMAND_SANDBOX_CP = exports.ERR_SANDBOX_ENDPOINTS_NOT_FOUND = exports.ERR_SANDBOX_ENDPOINT_NOT_FOUND = exports.ERR_SANDBOX_ENDPOINT_EXISTS = exports.TXT_SANDBOX_ENDPOINT_DELETED = exports.TXT_SANDBOX_ENDPOINT_DELETE_CONFIRM = exports.TXT_SANDBOX_ENDPOINT_ADDED = exports.OPTION_SANDBOX_ENDPOINT_TYPE = exports.OPTION_SANDBOX_ENDPOINT_PORT = exports.OPTION_SANDBOX_ENDPOINT_NAME_ARG = exports.OPTION_SANDBOX_ENDPOINT_NAME = exports.DESC_COMMAND_SANDBOX_ENDPOINT_DELETE = exports.DESC_COMMAND_SANDBOX_ENDPOINT_ADD = void 0;
14
- exports.DESC_COMMAND_PACKAGE_VERSION_LIST = exports.DESC_COMMAND_PACKAGE_VERSION_DELETE = exports.DESC_COMMAND_PACKAGE_DOCKER_LOGIN = exports.DESC_COMMAND_PACKAGE_LIST = exports.DESC_COMMAND_PACKAGE_VERSION = exports.ERR_API_MESSAGE_REPLACER = exports.ERR_LOGIN_INVALID_BASE_URL = exports.ERR_LOGIN_NO_WORKSPACE_FOUND = exports.ERR_LOGIN_NO_WORKSPACES = exports.ERR_LOGIN_HTTP_SUCCESS = exports.ERR_LOGIN_HTTP_FAILED = exports.TXT_LOGIN_OAUTH = exports.ERR_LOGIN_HTTP_SERVER_PORT_TAKEN = exports.TXT_LOGIN_SUCCESS = exports.TXT_LOGIN_SELECT_WORKSPACE = exports.TXT_LOGIN_ENTER_BASE_URL = exports.TXT_LOGIN_SELECT_REGION = exports.TXT_WORKSPACE_NONE = exports.TXT_WORKSPACE_SET_SUCCESS = exports.ARG_COMMAND_WORKSPACE = exports.DESC_COMMAND_WORKSPACE_GET = exports.DESC_COMMAND_WORKSPACE_SET = exports.DESC_COMMAND_WORKSPACE_LIST = exports.DESC_COMMAND_WORKSPACE = exports.TXT_LOGOUT_SUCCESS = exports.DESC_COMMAND_LOGOUT = exports.DESC_COMMAND_LOGIN = exports.ERR_API_MEDIA_TYPE_NOT_IMPLEMENTED = exports.ERR_API_PARAMETER_NOT_REPLACED = exports.TXT_API_ENDPOINT_REQUIRED_SCOPES = exports.ERR_API_ENDPOINT_NOT_FOUND = exports.ERR_API_WRONG_METHOD = exports.ERR_SCHEMA_FETCH_FAILED = exports.OPT_COMMAND_API_INFO_URL = exports.OPT_COMMAND_API_INFO_SCHEMA = exports.OPT_COMMAND_API_INFO_METHOD = exports.OPT_COMMAND_API_LIST_SEARCH = exports.OPT_COMMAND_API_LIST_METHOD = exports.ERR_API_REQUEST_BODY_VALUE = exports.ERR_API_REQUEST_QUERY_VALUE = exports.ERR_API_REQUEST_INVALID_JSON = exports.ERR_API_REQUEST_FILE_ERROR = exports.ERR_API_REQUEST_OUTPUT_EXISTS = exports.DESC_COMMAND_API_INFO = exports.DESC_COMMAND_API_FORM = exports.DESC_COMMAND_API_JSON = exports.DESC_COMMAND_API_DATA = exports.DESC_COMMAND_API_OUTPUT = exports.DESC_COMMAND_API_REQUEST_QUERY = exports.DESC_COMMAND_API_PROJECT = void 0;
15
- exports.EXAMPLE_SANDBOX_CREATE = exports.EXAMPLE_SANDBOX_CP = exports.ERR_PROJECT_NO_PROJECTS = exports.TXT_LOGIN_SELECT_PROJECT = exports.TXT_COMMAND_PROJECT_CREATED = exports.TXT_COMMAND_PROJECT_LINK_NOT_FOUND = exports.TXT_COMMAND_PROJECT_LINK_NAME = exports.TXT_COMMAND_PROJECT_LINK_SELECT_PROJECT = exports.TXT_COMMAND_PROJECT_LINK_TO = exports.TXT_COMMAND_PROJECT_LINK_EXISTING_DESC = exports.TXT_COMMAND_PROJECT_LINK_EXISTING = exports.TXT_COMMAND_PROJECT_LINK_CREATE_NEW_DESC = exports.TXT_COMMAND_PROJECT_LINK_CREATE_NEW = exports.ERR_COMMAND_PROJECT_LINK_DIR_NOT_DIR = exports.TXT_COMMAND_PROJECT_LINK_GIT_REPO_INITIALIZED = exports.TXT_COMMAND_PROJECT_LINK_GIT_REPO = exports.TXT_COMMAND_PROJECT_LINK_DIR_CONFIRM = exports.TXT_COMMAND_PROJECT_LINK_DIR_LINKED = exports.ERR_COMMAND_PROJECT_LINK_DIR_CREATE = exports.OPT_COMMAND_PROJECT_LINK_TRY_NOW = exports.OPT_COMMAND_PROJECT_LINK_SET_GIT_REMOTE = exports.OPT_COMMAND_PROJECT_LINK_HAS_REMOTE = exports.OPT_COMMAND_PROJECT_LINK_DIRECTORY = exports.OPT_COMMAND_PROJECT_LINK_GIT = exports.OPT_COMMAND_PROJECT_LINK_RELINK = exports.DESC_COMMAND_PROJECT_LINK = exports.DESC_COMMAND_PROJECT_LIST = exports.DESC_COMMAND_PROJECT_GIT = exports.DESC_COMMAND_PROJECT_GIT_CREDENTIAL = exports.DESC_COMMAND_PROJECT = exports.TXT_PACKAGE_VERSION_DOWNLOAD = exports.TXT_PACKAGE_PUBLISH = exports.TXT_PACKAGE_CREATED = exports.TXT_PACKAGE_VERSION_DELETED = exports.TXT_PACKAGE_DELETED = exports.ERR_COMMAND_PACKAGE_TYPE = exports.OPT_COMMAND_PACKAGE_VERSION = exports.OPT_COMMAND_PACKAGE_IDENTIFIER = exports.OPT_COMMAND_PACKAGE_CREATE_IDENTIFIER = exports.OPT_COMMAND_PACKAGE_NAME = exports.OPT_COMMAND_PACKAGE_TYPE = exports.DESC_COMMAND_PACKAGE_CREATE = exports.DESC_COMMAND_PACKAGE_GET = exports.TXT_PACKAGE_DOCKER_LOGIN_FAILED = exports.TXT_PACKAGE_DOCKER_LOGIN_SUCCESS = exports.TXT_PACKAGE_VERSION_DELETE_CONFIRM = exports.TXT_PACKAGE_DELETE_CONFIRM = exports.DESC_COMMAND_PACKAGE_DELETE = exports.ERR_COMMAND_PACKAGE_NO_PROJECTS = exports.DESC_COMMAND_PACKAGE_VERSION_GET = void 0;
16
- exports.EXAMPLE_PACKAGE_VERSION_DELETE = exports.EXAMPLE_PACKAGE_VERSION_GET = exports.EXAMPLE_PACKAGE_VERSION_LIST = exports.EXAMPLE_PACKAGE_CREATE = exports.EXAMPLE_PACKAGE_DELETE = exports.EXAMPLE_PACKAGE_DOWNLOAD = exports.EXAMPLE_PACKAGE_PUBLISH = exports.EXAMPLE_PIPELINE_RUN = exports.EXAMPLE_SANDBOX_ENDPOINT_LIST = exports.EXAMPLE_SANDBOX_ENDPOINT_GET = exports.EXAMPLE_SANDBOX_ENDPOINT_DELETE = exports.EXAMPLE_SANDBOX_ENDPOINT_CREATE = exports.EXAMPLE_SANDBOX_SNAPSHOT_LIST = exports.EXAMPLE_SANDBOX_SNAPSHOT_GET = exports.EXAMPLE_SANDBOX_SNAPSHOT_DELETE = exports.EXAMPLE_SANDBOX_SNAPSHOT_CREATE = exports.EXAMPLE_SANDBOX_EXEC_STATUS = exports.EXAMPLE_SANDBOX_EXEC_LOGS = exports.EXAMPLE_SANDBOX_EXEC_LIST = exports.EXAMPLE_SANDBOX_EXEC_KILL = exports.EXAMPLE_SANDBOX_EXEC_COMMAND = exports.EXAMPLE_TUNNEL_START = exports.EXAMPLE_TUNNEL_TCP = exports.EXAMPLE_TUNNEL_TLS = exports.EXAMPLE_AGENT_TUNNEL_START = exports.EXAMPLE_AGENT_TUNNEL_STATUS = exports.EXAMPLE_AGENT_TUNNEL_REMOVE = exports.EXAMPLE_AGENT_TUNNEL_LIST = exports.EXAMPLE_TUNNEL_HTTP = void 0;
14
+ exports.OPT_COMMAND_DOMAIN_BUY_TLD = exports.DESC_COMMAND_DOMAIN_GET = exports.DESC_COMMAND_DOMAIN_LIST = exports.DESC_COMMAND_DOMAIN_BUY = exports.DESC_COMMAND_DOMAIN = exports.ERR_API_MESSAGE_REPLACER = exports.ERR_LOGIN_INVALID_BASE_URL = exports.ERR_LOGIN_NO_WORKSPACE_FOUND = exports.ERR_LOGIN_NO_WORKSPACES = exports.ERR_LOGIN_HTTP_SUCCESS = exports.ERR_LOGIN_HTTP_FAILED = exports.TXT_LOGIN_OAUTH = exports.ERR_LOGIN_HTTP_SERVER_PORT_TAKEN = exports.TXT_LOGIN_SUCCESS = exports.TXT_LOGIN_SELECT_WORKSPACE = exports.TXT_LOGIN_ENTER_BASE_URL = exports.TXT_LOGIN_SELECT_REGION = exports.TXT_WORKSPACE_NONE = exports.TXT_WORKSPACE_SET_SUCCESS = exports.ARG_COMMAND_WORKSPACE = exports.DESC_COMMAND_WORKSPACE_GET = exports.DESC_COMMAND_WORKSPACE_SET = exports.DESC_COMMAND_WORKSPACE_LIST = exports.DESC_COMMAND_WORKSPACE = exports.TXT_LOGOUT_SUCCESS = exports.DESC_COMMAND_LOGOUT = exports.DESC_COMMAND_LOGIN = exports.ERR_API_MEDIA_TYPE_NOT_IMPLEMENTED = exports.ERR_API_PARAMETER_NOT_REPLACED = exports.TXT_API_ENDPOINT_REQUIRED_SCOPES = exports.ERR_API_ENDPOINT_NOT_FOUND = exports.ERR_API_WRONG_METHOD = exports.ERR_SCHEMA_FETCH_FAILED = exports.OPT_COMMAND_API_INFO_URL = exports.OPT_COMMAND_API_INFO_SCHEMA = exports.OPT_COMMAND_API_INFO_METHOD = exports.OPT_COMMAND_API_LIST_SEARCH = exports.OPT_COMMAND_API_LIST_METHOD = exports.ERR_API_REQUEST_BODY_VALUE = exports.ERR_API_REQUEST_QUERY_VALUE = exports.ERR_API_REQUEST_INVALID_JSON = exports.ERR_API_REQUEST_FILE_ERROR = exports.ERR_API_REQUEST_OUTPUT_EXISTS = exports.DESC_COMMAND_API_INFO = exports.DESC_COMMAND_API_FORM = exports.DESC_COMMAND_API_JSON = exports.DESC_COMMAND_API_DATA = exports.DESC_COMMAND_API_OUTPUT = exports.DESC_COMMAND_API_REQUEST_QUERY = exports.DESC_COMMAND_API_PROJECT = void 0;
15
+ exports.ERR_COMMAND_PROJECT_LINK_DIR_NOT_DIR = exports.TXT_COMMAND_PROJECT_LINK_GIT_REPO_INITIALIZED = exports.TXT_COMMAND_PROJECT_LINK_GIT_REPO = exports.TXT_COMMAND_PROJECT_LINK_DIR_CONFIRM = exports.TXT_COMMAND_PROJECT_LINK_DIR_LINKED = exports.ERR_COMMAND_PROJECT_LINK_DIR_CREATE = exports.OPT_COMMAND_PROJECT_LINK_TRY_NOW = exports.OPT_COMMAND_PROJECT_LINK_SET_GIT_REMOTE = exports.OPT_COMMAND_PROJECT_LINK_HAS_REMOTE = exports.OPT_COMMAND_PROJECT_LINK_DIRECTORY = exports.OPT_COMMAND_PROJECT_LINK_GIT = exports.OPT_COMMAND_PROJECT_LINK_RELINK = exports.DESC_COMMAND_PROJECT_LINK = exports.DESC_COMMAND_PROJECT_LIST = exports.DESC_COMMAND_PROJECT_GIT = exports.DESC_COMMAND_PROJECT_GIT_CREDENTIAL = exports.DESC_COMMAND_PROJECT = exports.TXT_PACKAGE_VERSION_DOWNLOAD = exports.TXT_PACKAGE_PUBLISH = exports.TXT_PACKAGE_CREATED = exports.TXT_PACKAGE_VERSION_DELETED = exports.TXT_PACKAGE_DELETED = exports.ERR_COMMAND_PACKAGE_TYPE = exports.OPT_COMMAND_PACKAGE_VERSION = exports.OPT_COMMAND_PACKAGE_IDENTIFIER = exports.OPT_COMMAND_PACKAGE_CREATE_IDENTIFIER = exports.OPT_COMMAND_PACKAGE_NAME = exports.OPT_COMMAND_PACKAGE_TYPE = exports.DESC_COMMAND_PACKAGE_CREATE = exports.DESC_COMMAND_PACKAGE_GET = exports.TXT_PACKAGE_DOCKER_LOGIN_FAILED = exports.TXT_PACKAGE_DOCKER_LOGIN_SUCCESS = exports.TXT_PACKAGE_VERSION_DELETE_CONFIRM = exports.TXT_PACKAGE_DELETE_CONFIRM = exports.DESC_COMMAND_PACKAGE_DELETE = exports.ERR_COMMAND_PACKAGE_NO_PROJECTS = exports.DESC_COMMAND_PACKAGE_VERSION_GET = exports.DESC_COMMAND_PACKAGE_VERSION_LIST = exports.DESC_COMMAND_PACKAGE_VERSION_DELETE = exports.DESC_COMMAND_PACKAGE_DOCKER_LOGIN = exports.DESC_COMMAND_PACKAGE_LIST = exports.DESC_COMMAND_PACKAGE_VERSION = exports.OPTION_COMMAND_DOMAIN_IDENTIFIER = exports.ERR_COMMAND_DOMAIN_NO_DOMAINS = exports.TXT_COMMAND_DOMAIN_BUY_PROMPT_REQUIRED = exports.TXT_COMMAND_DOMAIN_BUY_SELECT_DOMAIN = exports.TXT_COMMAND_DOMAIN_BUY_PROVIDE_PROMPT = exports.ERR_COMMAND_DOMAIN_NOT_FOUND = exports.OPT_COMMAND_DOMAIN_PHRASE = exports.OPT_COMMAND_DOMAIN_BUY_OWNER = void 0;
16
+ exports.EXAMPLE_PACKAGE_VERSION_DELETE = exports.EXAMPLE_PACKAGE_VERSION_GET = exports.EXAMPLE_PACKAGE_VERSION_LIST = exports.EXAMPLE_PACKAGE_CREATE = exports.EXAMPLE_PACKAGE_DELETE = exports.EXAMPLE_PACKAGE_DOWNLOAD = exports.EXAMPLE_PACKAGE_PUBLISH = exports.EXAMPLE_PIPELINE_RUN = exports.EXAMPLE_SANDBOX_ENDPOINT_LIST = exports.EXAMPLE_SANDBOX_ENDPOINT_GET = exports.EXAMPLE_SANDBOX_ENDPOINT_DELETE = exports.EXAMPLE_SANDBOX_ENDPOINT_CREATE = exports.EXAMPLE_SANDBOX_SNAPSHOT_LIST = exports.EXAMPLE_SANDBOX_SNAPSHOT_GET = exports.EXAMPLE_SANDBOX_SNAPSHOT_DELETE = exports.EXAMPLE_SANDBOX_SNAPSHOT_CREATE = exports.EXAMPLE_SANDBOX_EXEC_STATUS = exports.EXAMPLE_SANDBOX_EXEC_LOGS = exports.EXAMPLE_SANDBOX_EXEC_LIST = exports.EXAMPLE_SANDBOX_EXEC_KILL = exports.EXAMPLE_SANDBOX_EXEC_COMMAND = exports.EXAMPLE_TUNNEL_START = exports.EXAMPLE_TUNNEL_TCP = exports.EXAMPLE_TUNNEL_TLS = exports.EXAMPLE_AGENT_TUNNEL_START = exports.EXAMPLE_AGENT_TUNNEL_STATUS = exports.EXAMPLE_AGENT_TUNNEL_REMOVE = exports.EXAMPLE_AGENT_TUNNEL_LIST = exports.EXAMPLE_TUNNEL_HTTP = exports.EXAMPLE_SANDBOX_CREATE = exports.EXAMPLE_SANDBOX_CP = exports.ERR_PROJECT_NO_PROJECTS = exports.TXT_LOGIN_SELECT_PROJECT = exports.TXT_COMMAND_PROJECT_CREATED = exports.TXT_COMMAND_PROJECT_LINK_NOT_FOUND = exports.TXT_COMMAND_PROJECT_LINK_NAME = exports.TXT_COMMAND_PROJECT_LINK_SELECT_PROJECT = exports.TXT_COMMAND_PROJECT_LINK_TO = exports.TXT_COMMAND_PROJECT_LINK_EXISTING_DESC = exports.TXT_COMMAND_PROJECT_LINK_EXISTING = exports.TXT_COMMAND_PROJECT_LINK_CREATE_NEW_DESC = exports.TXT_COMMAND_PROJECT_LINK_CREATE_NEW = void 0;
17
17
  const utils_1 = require("./utils");
18
18
  exports.ERR_REST_API_GENERAL_ERROR = 'Something went wrong';
19
19
  exports.ERR_REST_API_NOT_RESPONDING = 'Api endpoint not responding. Try again later...';
20
20
  exports.ERR_REST_API_CONNECT_ERROR = 'Connection refused. Check selected endpoint';
21
- exports.ERR_REST_API_WRONG_TOKEN = 'Valid token with proper scopes is required';
21
+ exports.ERR_REST_API_WRONG_TOKEN = 'Valid token with proper scopes is required or run bdy login';
22
22
  exports.ERR_REST_API_RESOURCE_NOT_FOUND = 'Resource not found';
23
23
  const ERR_REST_API_RATE_LIMIT = (rateLimitReset) => {
24
24
  if (rateLimitReset) {
@@ -777,6 +777,20 @@ const ERR_API_MESSAGE_REPLACER = (message, path, baseUrl, rateLimitTs) => {
777
777
  return message;
778
778
  };
779
779
  exports.ERR_API_MESSAGE_REPLACER = ERR_API_MESSAGE_REPLACER;
780
+ // domain commands
781
+ exports.DESC_COMMAND_DOMAIN = 'Manage domains';
782
+ exports.DESC_COMMAND_DOMAIN_BUY = 'Buy domain';
783
+ exports.DESC_COMMAND_DOMAIN_LIST = 'List domains';
784
+ exports.DESC_COMMAND_DOMAIN_GET = 'Get domain';
785
+ exports.OPT_COMMAND_DOMAIN_BUY_TLD = 'Filter tld. Can be passed multiple times or separated by comma. Example: --tld=de --tld=com,io';
786
+ exports.OPT_COMMAND_DOMAIN_BUY_OWNER = 'Buy domain on workspace owner behalf';
787
+ exports.OPT_COMMAND_DOMAIN_PHRASE = 'Phrase, full domain or part of it';
788
+ exports.ERR_COMMAND_DOMAIN_NOT_FOUND = 'Domain not found';
789
+ exports.TXT_COMMAND_DOMAIN_BUY_PROVIDE_PROMPT = 'Enter domain name or describe your needs:';
790
+ exports.TXT_COMMAND_DOMAIN_BUY_SELECT_DOMAIN = 'Select domain:';
791
+ exports.TXT_COMMAND_DOMAIN_BUY_PROMPT_REQUIRED = 'Domain or prompt is required';
792
+ exports.ERR_COMMAND_DOMAIN_NO_DOMAINS = 'No domains found';
793
+ exports.OPTION_COMMAND_DOMAIN_IDENTIFIER = 'Domain ID or name';
780
794
  // package commands
781
795
  exports.DESC_COMMAND_PACKAGE_VERSION = 'Manage package versions';
782
796
  exports.DESC_COMMAND_PACKAGE_LIST = 'List packages. Required scopes: PACKAGE_READ';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.17.28-dev",
4
+ "version": "1.18.0-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {