bdy 1.22.23-dev → 1.22.23-dev-pipeline

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 (31) hide show
  1. package/distTs/package.json +1 -1
  2. package/distTs/src/api/client.js +110 -2
  3. package/distTs/src/command/pipeline/create.js +51 -0
  4. package/distTs/src/command/pipeline/delete.js +41 -0
  5. package/distTs/src/command/pipeline/get.js +51 -0
  6. package/distTs/src/command/pipeline/list.js +47 -0
  7. package/distTs/src/command/pipeline/run/apply.js +62 -0
  8. package/distTs/src/command/pipeline/run/approve.js +64 -0
  9. package/distTs/src/command/pipeline/run/cancel.js +38 -0
  10. package/distTs/src/command/pipeline/run/list.js +58 -0
  11. package/distTs/src/command/pipeline/run/logs.js +38 -0
  12. package/distTs/src/command/pipeline/run/retry.js +38 -0
  13. package/distTs/src/command/pipeline/run/start.js +98 -0
  14. package/distTs/src/command/pipeline/run/status.js +37 -0
  15. package/distTs/src/command/pipeline/run.js +22 -125
  16. package/distTs/src/command/pipeline/update.js +47 -0
  17. package/distTs/src/command/pipeline/yaml.js +38 -0
  18. package/distTs/src/command/pipeline.js +26 -0
  19. package/distTs/src/command/pre.js +1 -1
  20. package/distTs/src/command/project/link.js +11 -11
  21. package/distTs/src/input.js +11 -10
  22. package/distTs/src/output/pipeline.js +1677 -0
  23. package/distTs/src/output.js +156 -32
  24. package/distTs/src/texts.js +203 -169
  25. package/distTs/src/tunnel/output/interactive/tunnel.js +2 -2
  26. package/distTs/src/types/pipeline.js +424 -0
  27. package/package.json +1 -1
  28. package/distTs/src/command/project/get.js +0 -18
  29. package/distTs/src/command/project/set.js +0 -31
  30. package/distTs/src/command/sandbox/get/yaml.js +0 -30
  31. package/distTs/src/command/vt/scrape.js +0 -193
@@ -20,39 +20,69 @@ class Output {
20
20
  static getCyanColor(text) {
21
21
  return chalk_1.default.hex('#00C9FF')(text);
22
22
  }
23
+ static getTermKitCyanColor(text) {
24
+ return `^C${text}^:`;
25
+ }
23
26
  static getBlueColor(text) {
24
27
  return chalk_1.default.hex('#1A86FD')(text);
25
28
  }
26
- static getLightColor(text) {
27
- return chalk_1.default.hex('#05BBFF')(text);
29
+ static getTermKitBlueColor(text) {
30
+ return `^B${text}^:`;
31
+ }
32
+ static getPurpleColor(text) {
33
+ return chalk_1.default.hex('#A06BC4')(text);
34
+ }
35
+ static getTermKitPurpleColor(text) {
36
+ return `^M${text}^:`;
28
37
  }
29
38
  static getMutedColor(text) {
30
39
  return chalk_1.default.hex('#8B8D98')(text);
31
40
  }
41
+ static getTermKitMutedColor(text) {
42
+ return `^w${text}^:`;
43
+ }
32
44
  static getDimColor(text) {
33
- return chalk_1.default.hex('#555869')(text);
45
+ return chalk_1.default.hex('#4A4A4A')(text);
46
+ }
47
+ static getTermKitDimColor(text) {
48
+ return `^K${text}^:`;
34
49
  }
35
50
  static getArgColor(text) {
36
51
  return chalk_1.default.hex('#5A8AB5')(text);
37
52
  }
53
+ static getTermKitArgColor(text) {
54
+ return `^B${text}^:`;
55
+ }
38
56
  static getLabelColor(text) {
39
57
  return chalk_1.default.hex('#D1D5DB')(text);
40
58
  }
59
+ static getTermKitLabelColor(text) {
60
+ return `^W${text}^:`;
61
+ }
41
62
  static getGreenColor(text) {
42
- return chalk_1.default.green(text);
63
+ return chalk_1.default.greenBright(text);
64
+ }
65
+ static getTermKitGreenColor(text) {
66
+ return `^G${text}^:`;
43
67
  }
44
68
  static getYellowColor(text) {
45
69
  return chalk_1.default.yellow(text);
46
70
  }
71
+ static getTermKitYellowColor(text) {
72
+ return `^Y${text}^:`;
73
+ }
47
74
  static getRedColor(text) {
48
- return chalk_1.default.red(text);
75
+ return chalk_1.default.redBright(text);
76
+ }
77
+ static getTermKitRedColor(text) {
78
+ return `^R${text}^:`;
49
79
  }
50
80
  static getInquirerTheme() {
51
81
  return {
52
82
  prefix: this.getCyanColor('?'),
53
83
  style: {
54
84
  highlight: (text) => this.getCyanColor(text),
55
- answer: (text) => this.getLightColor(text),
85
+ answer: (text) => this.getCyanColor(text),
56
86
  message: (text) => this.getLabelColor(text),
57
87
  help: (text) => this.getDimColor(text),
58
88
  description: (text) => this.getArgColor(text),
@@ -92,9 +122,6 @@ class Output {
92
122
  static newline() {
93
123
  getTerminal()('\n');
94
124
  }
95
- static light(txt, newLine = true) {
96
- this.normal(this.getLightColor(txt), newLine);
97
- }
98
125
  static muted(txt, newLine = true) {
99
126
  this.normal(this.getMutedColor(txt), newLine);
100
127
  }
@@ -257,11 +284,16 @@ class Output {
257
284
  static async confirm(message = 'Are you sure?') {
258
285
  if (this.isStdInTTY()) {
259
286
  const prompts = require('@inquirer/prompts');
260
- return await prompts.confirm({
261
- message,
262
- theme: this.getInquirerTheme(),
263
- default: false,
264
- });
287
+ try {
288
+ return await prompts.confirm({
289
+ message,
290
+ theme: this.getInquirerTheme(),
291
+ default: false,
292
+ });
293
+ }
294
+ catch {
295
+ this.exitError(texts_1.ERR_CANCELLED);
296
+ }
265
297
  }
266
298
  this.cyan('? ', false);
267
299
  this.label(message, false);
@@ -271,12 +303,19 @@ class Output {
271
303
  static async inputString(message, def, required, signal) {
272
304
  if (this.isStdInTTY()) {
273
305
  const prompts = require('@inquirer/prompts');
274
- return await prompts.input({
275
- required,
276
- message,
277
- default: def,
278
- theme: this.getInquirerTheme(),
279
- }, { signal });
306
+ try {
307
+ return await prompts.input({
308
+ required,
309
+ message,
310
+ default: def,
311
+ theme: this.getInquirerTheme(),
312
+ }, { signal });
313
+ }
314
+ catch (err) {
315
+ if (err.name === 'AbortPromptError')
316
+ throw err;
317
+ this.exitError(texts_1.ERR_CANCELLED);
318
+ }
280
319
  }
281
320
  this.cyan('? ', false);
282
321
  this.normal(message, false);
@@ -290,12 +329,17 @@ class Output {
290
329
  static async inputMenuAdv(message, items) {
291
330
  const prompts = require('@inquirer/prompts');
292
331
  if (this.isStdInTTY()) {
293
- return await prompts.select({
294
- message,
295
- theme: this.getInquirerTheme(),
296
- loop: false,
297
- choices: items,
298
- });
332
+ try {
333
+ return await prompts.select({
334
+ message,
335
+ theme: this.getInquirerTheme(),
336
+ loop: false,
337
+ choices: items,
338
+ });
339
+ }
340
+ catch {
341
+ this.exitError(texts_1.ERR_CANCELLED);
342
+ }
299
343
  }
300
344
  else {
301
345
  this.cyan('? ', false);
@@ -345,12 +389,17 @@ class Output {
345
389
  static async inputMenu(message, items) {
346
390
  if (this.isStdInTTY()) {
347
391
  const prompts = require('@inquirer/prompts');
348
- return await prompts.select({
349
- message,
350
- theme: this.getInquirerTheme(),
351
- loop: false,
352
- choices: items.map((item, index) => ({ value: index, name: item })),
353
- });
392
+ try {
393
+ return await prompts.select({
394
+ message,
395
+ theme: this.getInquirerTheme(),
396
+ loop: false,
397
+ choices: items.map((item, index) => ({ value: index, name: item })),
398
+ });
399
+ }
400
+ catch {
401
+ this.exitError(texts_1.ERR_CANCELLED);
402
+ }
354
403
  }
355
404
  else {
356
405
  this.cyan('? ', false);
@@ -391,6 +440,75 @@ class Output {
391
440
  }
392
441
  return `${normalized}/api`;
393
442
  }
443
+ static createScreenBuffer(onKey, onResize) {
444
+ const TerminalKit = require('terminal-kit/lib/termkit-no-lazy-require');
445
+ const terminal = getTerminal();
446
+ // @ts-ignore
447
+ const viewPort = new TerminalKit.ScreenBuffer({
448
+ dst: terminal,
449
+ width: terminal.width,
450
+ height: terminal.height,
451
+ x: 1,
452
+ y: 1,
453
+ });
454
+ terminal.grabInput();
455
+ terminal.hideCursor();
456
+ terminal.fullscreen(true);
457
+ const exit = () => {
458
+ terminal.fullscreen(false);
459
+ terminal.hideCursor(false);
460
+ terminal.grabInput(false);
461
+ process.exit();
462
+ };
463
+ terminal.on('key', (name) => {
464
+ const shouldExit = onKey(name);
465
+ if (shouldExit)
466
+ exit();
467
+ });
468
+ terminal.on('resize', () => {
469
+ viewPort.resize({
470
+ width: TerminalKit.terminal.width,
471
+ height: TerminalKit.terminal.height,
472
+ x: 1,
473
+ y: 1,
474
+ });
475
+ onResize();
476
+ });
477
+ let y = 1;
478
+ const put = (str) => {
479
+ viewPort.put({
480
+ x: 1,
481
+ y,
482
+ markup: true,
483
+ }, str);
484
+ y += 1;
485
+ return y;
486
+ };
487
+ const blank = () => {
488
+ y += 1;
489
+ return y;
490
+ };
491
+ const reset = () => {
492
+ y = 1;
493
+ viewPort.fill({
494
+ char: ' ',
495
+ });
496
+ };
497
+ const apply = () => {
498
+ viewPort.draw();
499
+ };
500
+ const getY = () => {
501
+ return y;
502
+ };
503
+ return {
504
+ put,
505
+ reset,
506
+ blank,
507
+ apply,
508
+ getY,
509
+ exit,
510
+ };
511
+ }
394
512
  static async selectRegion() {
395
513
  const index = await Output.inputMenu(texts_1.TXT_LOGIN_SELECT_REGION, [
396
514
  'US (default)',
@@ -406,6 +524,9 @@ class Output {
406
524
  return utils_1.REST_API_REGION.AS;
407
525
  return utils_1.REST_API_REGION.ONPREM;
408
526
  }
527
+ static getTerminal() {
528
+ return getTerminal();
529
+ }
409
530
  static getUndiciUnauthorizedAgent() {
410
531
  if (!this._a) {
411
532
  const undici = require('undici');
@@ -432,6 +553,9 @@ class Output {
432
553
  _terminal.hideCursor(false);
433
554
  _terminal.grabInput(false);
434
555
  }
556
+ static json(json) {
557
+ this.normal(JSON.stringify(json));
558
+ }
435
559
  static exitError(err) {
436
560
  this.clearUndici();
437
561
  this.clearTerminal();