bdy 1.25.6-dev → 1.25.8-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 (46) hide show
  1. package/distTs/package.json +1 -1
  2. package/distTs/src/cliCommand.js +43 -0
  3. package/distTs/src/cliIndex.js +10 -0
  4. package/distTs/src/command/agent/uninstall.js +1 -1
  5. package/distTs/src/command/artifact/delete.js +1 -2
  6. package/distTs/src/command/artifact/version/delete.js +1 -2
  7. package/distTs/src/command/context/add.js +38 -0
  8. package/distTs/src/command/context/list.js +33 -0
  9. package/distTs/src/command/context/remove.js +35 -0
  10. package/distTs/src/command/context/show.js +35 -0
  11. package/distTs/src/command/context/use.js +25 -0
  12. package/distTs/src/command/context.js +22 -0
  13. package/distTs/src/command/distro/delete.js +1 -2
  14. package/distTs/src/command/distro/route/delete.js +1 -2
  15. package/distTs/src/command/environment/delete.js +1 -2
  16. package/distTs/src/command/login.js +1 -0
  17. package/distTs/src/command/logout.js +1 -0
  18. package/distTs/src/command/pipeline/delete.js +1 -2
  19. package/distTs/src/command/pipeline/run/approve.js +3 -2
  20. package/distTs/src/command/pipeline/run/cancel.js +3 -2
  21. package/distTs/src/command/pipeline/run/find.js +87 -0
  22. package/distTs/src/command/pipeline/run/findFilters.js +68 -0
  23. package/distTs/src/command/pipeline/run/retry.js +5 -2
  24. package/distTs/src/command/pipeline/run/start.js +3 -2
  25. package/distTs/src/command/pipeline/run/status.js +3 -2
  26. package/distTs/src/command/pipeline/run.js +3 -0
  27. package/distTs/src/command/project/link.js +1 -0
  28. package/distTs/src/command/register.js +1 -0
  29. package/distTs/src/command/sandbox/destroy.js +1 -2
  30. package/distTs/src/command/sandbox/endpoint/delete.js +1 -2
  31. package/distTs/src/command/sandbox/exec/kill.js +1 -2
  32. package/distTs/src/command/sandbox/snapshot/delete.js +1 -2
  33. package/distTs/src/command/target/delete.js +1 -1
  34. package/distTs/src/command/target/exec/kill.js +2 -3
  35. package/distTs/src/command/whoami.js +7 -10
  36. package/distTs/src/command/workspace/get.js +2 -2
  37. package/distTs/src/command/workspace/set.js +1 -0
  38. package/distTs/src/input.js +240 -26
  39. package/distTs/src/output/pipeline.js +84 -13
  40. package/distTs/src/output.js +24 -5
  41. package/distTs/src/project/context.js +97 -0
  42. package/distTs/src/texts.js +275 -29
  43. package/distTs/src/tunnel/cfg.js +43 -4
  44. package/distTs/src/types/context.js +2 -0
  45. package/distTs/src/types/pipelineRunFind.js +2 -0
  46. package/package.json +1 -1
@@ -1,9 +1,14 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  const path_1 = require("path");
4
7
  const fs_1 = require("fs");
5
8
  const utils_1 = require("../utils");
9
+ const cliError_1 = __importDefault(require("../cliError"));
6
10
  const texts_1 = require("../texts");
11
+ const texts_2 = require("../texts");
7
12
  const tunnel_1 = require("../types/tunnel");
8
13
  class Cfg {
9
14
  dir;
@@ -22,7 +27,7 @@ class Cfg {
22
27
  });
23
28
  }
24
29
  catch {
25
- throw new Error((0, texts_1.ERR_CANT_CREATE_DIR_IN_HOME)('.bdy'));
30
+ throw new Error((0, texts_2.ERR_CANT_CREATE_DIR_IN_HOME)('.bdy'));
26
31
  }
27
32
  try {
28
33
  (0, fs_1.chmodSync)(this.dir, 0o700);
@@ -36,7 +41,7 @@ class Cfg {
36
41
  (0, fs_1.writeFileSync)(this.file, '{}', 'utf-8');
37
42
  }
38
43
  catch {
39
- throw new Error((0, texts_1.ERR_CANT_CREATE_DIR_IN_HOME)('.bdy/cfg.json'));
44
+ throw new Error((0, texts_2.ERR_CANT_CREATE_DIR_IN_HOME)('.bdy/cfg.json'));
40
45
  }
41
46
  try {
42
47
  (0, fs_1.chmodSync)(this.file, 0o600);
@@ -252,6 +257,40 @@ class Cfg {
252
257
  getBaseUrl() {
253
258
  return this.json.baseUrl || '';
254
259
  }
260
+ getContexts() {
261
+ return { ...this.json.contexts };
262
+ }
263
+ getActiveContext() {
264
+ return this.json.activeContext || 'default';
265
+ }
266
+ getContext(name) {
267
+ if (name === 'default')
268
+ return null;
269
+ if (name === 'git')
270
+ return { source: 'git', remote: 'origin' };
271
+ if (name === 'link')
272
+ return { source: 'link' };
273
+ const contexts = this.getContexts();
274
+ if (!Object.hasOwn(contexts, name))
275
+ throw new cliError_1.default('context_not_found', (0, texts_1.ERR_CONTEXT_UNKNOWN)(name), texts_1.TXT_CONTEXT_HINT);
276
+ return contexts[name];
277
+ }
278
+ setContext(name, context) {
279
+ this.json.contexts = { ...this.getContexts(), [name]: context };
280
+ this.save();
281
+ }
282
+ setActiveContext(name) {
283
+ this.getContext(name);
284
+ this.json.activeContext = name;
285
+ this.save();
286
+ }
287
+ removeContext(name) {
288
+ this.getContext(name);
289
+ delete this.json.contexts[name];
290
+ if (this.getActiveContext() === name)
291
+ this.json.activeContext = 'default';
292
+ this.save();
293
+ }
255
294
  clearLogin() {
256
295
  delete this.json.apiToken;
257
296
  delete this.json.apiRefreshToken;
@@ -282,7 +321,7 @@ class Cfg {
282
321
  this.json = JSON.parse(txt);
283
322
  }
284
323
  catch {
285
- throw new Error(texts_1.ERR_CONFIG_CORRUPTED);
324
+ throw new Error(texts_2.ERR_CONFIG_CORRUPTED);
286
325
  }
287
326
  }
288
327
  save() {
@@ -291,7 +330,7 @@ class Cfg {
291
330
  (0, fs_1.writeFileSync)(this.file, JSON.stringify(this.json, null, 4), 'utf-8');
292
331
  }
293
332
  catch {
294
- throw new Error((0, texts_1.ERR_CANT_CREATE_DIR_IN_HOME)('.bdy/cfg.json'));
333
+ throw new Error((0, texts_2.ERR_CANT_CREATE_DIR_IN_HOME)('.bdy/cfg.json'));
295
334
  }
296
335
  try {
297
336
  (0, fs_1.chmodSync)(this.file, 0o600);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.25.6-dev",
4
+ "version": "1.25.8-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "homepage": "https://buddy.works/docs/cli",