@revenexx/cli 0.0.7 → 0.0.8

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 (75) hide show
  1. package/README.md +93 -84
  2. package/dist/bundle-win-arm64.mjs +64601 -57035
  3. package/dist/cli.cjs +64625 -57059
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/index.cjs +1243 -61
  6. package/dist/index.js +1243 -61
  7. package/dist/lib/client.d.ts +57 -1
  8. package/dist/lib/client.d.ts.map +1 -1
  9. package/dist/lib/command-picker.d.ts +17 -0
  10. package/dist/lib/command-picker.d.ts.map +1 -0
  11. package/dist/lib/commands/create/appsdk-core.d.ts +143 -0
  12. package/dist/lib/commands/create/appsdk-core.d.ts.map +1 -0
  13. package/dist/lib/commands/create/scaffold-app.d.ts +24 -0
  14. package/dist/lib/commands/create/scaffold-app.d.ts.map +1 -0
  15. package/dist/lib/commands/create/scaffold-theme.d.ts +22 -0
  16. package/dist/lib/commands/create/scaffold-theme.d.ts.map +1 -0
  17. package/dist/lib/commands/create.d.ts +3 -0
  18. package/dist/lib/commands/create.d.ts.map +1 -0
  19. package/dist/lib/commands/deploy.d.ts +3 -0
  20. package/dist/lib/commands/deploy.d.ts.map +1 -0
  21. package/dist/lib/commands/generic.d.ts +32 -1
  22. package/dist/lib/commands/generic.d.ts.map +1 -1
  23. package/dist/lib/commands/services/apps.d.ts.map +1 -1
  24. package/dist/lib/commands/services/avatars.d.ts.map +1 -1
  25. package/dist/lib/commands/services/carts.d.ts.map +1 -1
  26. package/dist/lib/commands/services/channels.d.ts.map +1 -1
  27. package/dist/lib/commands/services/customers.d.ts.map +1 -1
  28. package/dist/lib/commands/services/forms.d.ts.map +1 -1
  29. package/dist/lib/commands/services/greetings.d.ts.map +1 -1
  30. package/dist/lib/commands/services/inventories.d.ts.map +1 -1
  31. package/dist/lib/commands/services/locale.d.ts.map +1 -1
  32. package/dist/lib/commands/services/markets.d.ts.map +1 -1
  33. package/dist/lib/commands/services/messaging.d.ts.map +1 -1
  34. package/dist/lib/commands/services/orderlists.d.ts.map +1 -1
  35. package/dist/lib/commands/services/orders.d.ts.map +1 -1
  36. package/dist/lib/commands/services/pages.d.ts.map +1 -1
  37. package/dist/lib/commands/services/payments.d.ts.map +1 -1
  38. package/dist/lib/commands/services/prices.d.ts.map +1 -1
  39. package/dist/lib/commands/services/products.d.ts.map +1 -1
  40. package/dist/lib/commands/services/search.d.ts.map +1 -1
  41. package/dist/lib/commands/services/settings.d.ts.map +1 -1
  42. package/dist/lib/commands/services/shipping.d.ts.map +1 -1
  43. package/dist/lib/commands/services/sites.d.ts.map +1 -1
  44. package/dist/lib/commands/services/storage.d.ts.map +1 -1
  45. package/dist/lib/commands/services/tokens.d.ts.map +1 -1
  46. package/dist/lib/commands/tenants.d.ts.map +1 -1
  47. package/dist/lib/commands/update.d.ts.map +1 -1
  48. package/dist/lib/config.d.ts +21 -0
  49. package/dist/lib/config.d.ts.map +1 -1
  50. package/dist/lib/constants.d.ts +7 -3
  51. package/dist/lib/constants.d.ts.map +1 -1
  52. package/dist/lib/interactive.d.ts +68 -0
  53. package/dist/lib/interactive.d.ts.map +1 -0
  54. package/dist/lib/oauth.d.ts +97 -0
  55. package/dist/lib/oauth.d.ts.map +1 -0
  56. package/dist/lib/parser.d.ts +13 -6
  57. package/dist/lib/parser.d.ts.map +1 -1
  58. package/dist/lib/redact.d.ts +12 -0
  59. package/dist/lib/redact.d.ts.map +1 -0
  60. package/dist/lib/sdks.d.ts.map +1 -1
  61. package/dist/lib/spinner.d.ts +9 -1
  62. package/dist/lib/spinner.d.ts.map +1 -1
  63. package/dist/lib/types.d.ts +10 -2
  64. package/dist/lib/types.d.ts.map +1 -1
  65. package/dist/tests/client-transport.test.d.ts +2 -0
  66. package/dist/tests/client-transport.test.d.ts.map +1 -0
  67. package/dist/tests/command-picker.test.d.ts +2 -0
  68. package/dist/tests/command-picker.test.d.ts.map +1 -0
  69. package/dist/tests/endpoint.test.d.ts +2 -0
  70. package/dist/tests/endpoint.test.d.ts.map +1 -0
  71. package/dist/tests/interactive.test.d.ts +2 -0
  72. package/dist/tests/interactive.test.d.ts.map +1 -0
  73. package/dist/tests/oauth.test.d.ts +2 -0
  74. package/dist/tests/oauth.test.d.ts.map +1 -0
  75. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -18551,6 +18551,877 @@ var require_json_bigint = __commonJS({
18551
18551
  }
18552
18552
  });
18553
18553
 
18554
+ // node_modules/cli-progress/lib/eta.js
18555
+ var require_eta = __commonJS({
18556
+ "node_modules/cli-progress/lib/eta.js"(exports, module) {
18557
+ var ETA = class {
18558
+ constructor(length, initTime, initValue) {
18559
+ this.etaBufferLength = length || 100;
18560
+ this.valueBuffer = [initValue];
18561
+ this.timeBuffer = [initTime];
18562
+ this.eta = "0";
18563
+ }
18564
+ // add new values to calculation buffer
18565
+ update(time3, value, total) {
18566
+ this.valueBuffer.push(value);
18567
+ this.timeBuffer.push(time3);
18568
+ this.calculate(total - value);
18569
+ }
18570
+ // fetch estimated time
18571
+ getTime() {
18572
+ return this.eta;
18573
+ }
18574
+ // eta calculation - request number of remaining events
18575
+ calculate(remaining) {
18576
+ const currentBufferSize = this.valueBuffer.length;
18577
+ const buffer = Math.min(this.etaBufferLength, currentBufferSize);
18578
+ const v_diff = this.valueBuffer[currentBufferSize - 1] - this.valueBuffer[currentBufferSize - buffer];
18579
+ const t_diff = this.timeBuffer[currentBufferSize - 1] - this.timeBuffer[currentBufferSize - buffer];
18580
+ const vt_rate = v_diff / t_diff;
18581
+ this.valueBuffer = this.valueBuffer.slice(-this.etaBufferLength);
18582
+ this.timeBuffer = this.timeBuffer.slice(-this.etaBufferLength);
18583
+ const eta = Math.ceil(remaining / vt_rate / 1e3);
18584
+ if (isNaN(eta)) {
18585
+ this.eta = "NULL";
18586
+ } else if (!isFinite(eta)) {
18587
+ this.eta = "INF";
18588
+ } else if (eta > 1e7) {
18589
+ this.eta = "INF";
18590
+ } else if (eta < 0) {
18591
+ this.eta = 0;
18592
+ } else {
18593
+ this.eta = eta;
18594
+ }
18595
+ }
18596
+ };
18597
+ module.exports = ETA;
18598
+ }
18599
+ });
18600
+
18601
+ // node_modules/cli-progress/lib/terminal.js
18602
+ var require_terminal = __commonJS({
18603
+ "node_modules/cli-progress/lib/terminal.js"(exports, module) {
18604
+ var _readline = __require("readline");
18605
+ var Terminal = class {
18606
+ constructor(outputStream) {
18607
+ this.stream = outputStream;
18608
+ this.linewrap = true;
18609
+ this.dy = 0;
18610
+ }
18611
+ // save cursor position + settings
18612
+ cursorSave() {
18613
+ if (!this.stream.isTTY) {
18614
+ return;
18615
+ }
18616
+ this.stream.write("\x1B7");
18617
+ }
18618
+ // restore last cursor position + settings
18619
+ cursorRestore() {
18620
+ if (!this.stream.isTTY) {
18621
+ return;
18622
+ }
18623
+ this.stream.write("\x1B8");
18624
+ }
18625
+ // show/hide cursor
18626
+ cursor(enabled) {
18627
+ if (!this.stream.isTTY) {
18628
+ return;
18629
+ }
18630
+ if (enabled) {
18631
+ this.stream.write("\x1B[?25h");
18632
+ } else {
18633
+ this.stream.write("\x1B[?25l");
18634
+ }
18635
+ }
18636
+ // change cursor positionn
18637
+ cursorTo(x = null, y = null) {
18638
+ if (!this.stream.isTTY) {
18639
+ return;
18640
+ }
18641
+ _readline.cursorTo(this.stream, x, y);
18642
+ }
18643
+ // change relative cursor position
18644
+ cursorRelative(dx = null, dy = null) {
18645
+ if (!this.stream.isTTY) {
18646
+ return;
18647
+ }
18648
+ this.dy = this.dy + dy;
18649
+ _readline.moveCursor(this.stream, dx, dy);
18650
+ }
18651
+ // relative reset
18652
+ cursorRelativeReset() {
18653
+ if (!this.stream.isTTY) {
18654
+ return;
18655
+ }
18656
+ _readline.moveCursor(this.stream, 0, -this.dy);
18657
+ _readline.cursorTo(this.stream, 0, null);
18658
+ this.dy = 0;
18659
+ }
18660
+ // clear to the right from cursor
18661
+ clearRight() {
18662
+ if (!this.stream.isTTY) {
18663
+ return;
18664
+ }
18665
+ _readline.clearLine(this.stream, 1);
18666
+ }
18667
+ // clear the full line
18668
+ clearLine() {
18669
+ if (!this.stream.isTTY) {
18670
+ return;
18671
+ }
18672
+ _readline.clearLine(this.stream, 0);
18673
+ }
18674
+ // clear everyting beyond the current line
18675
+ clearBottom() {
18676
+ if (!this.stream.isTTY) {
18677
+ return;
18678
+ }
18679
+ _readline.clearScreenDown(this.stream);
18680
+ }
18681
+ // add new line; increment counter
18682
+ newline() {
18683
+ this.stream.write("\n");
18684
+ this.dy++;
18685
+ }
18686
+ // write content to output stream
18687
+ // @TODO use string-width to strip length
18688
+ write(s, rawWrite = false) {
18689
+ if (this.linewrap === true && rawWrite === false) {
18690
+ this.stream.write(s.substr(0, this.getWidth()));
18691
+ } else {
18692
+ this.stream.write(s);
18693
+ }
18694
+ }
18695
+ // control line wrapping
18696
+ lineWrapping(enabled) {
18697
+ if (!this.stream.isTTY) {
18698
+ return;
18699
+ }
18700
+ this.linewrap = enabled;
18701
+ if (enabled) {
18702
+ this.stream.write("\x1B[?7h");
18703
+ } else {
18704
+ this.stream.write("\x1B[?7l");
18705
+ }
18706
+ }
18707
+ // tty environment ?
18708
+ isTTY() {
18709
+ return this.stream.isTTY === true;
18710
+ }
18711
+ // get terminal width
18712
+ getWidth() {
18713
+ return this.stream.columns || (this.stream.isTTY ? 80 : 200);
18714
+ }
18715
+ };
18716
+ module.exports = Terminal;
18717
+ }
18718
+ });
18719
+
18720
+ // node_modules/ansi-regex/index.js
18721
+ var require_ansi_regex = __commonJS({
18722
+ "node_modules/ansi-regex/index.js"(exports, module) {
18723
+ "use strict";
18724
+ module.exports = ({ onlyFirst = false } = {}) => {
18725
+ const pattern = [
18726
+ "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
18727
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
18728
+ ].join("|");
18729
+ return new RegExp(pattern, onlyFirst ? void 0 : "g");
18730
+ };
18731
+ }
18732
+ });
18733
+
18734
+ // node_modules/strip-ansi/index.js
18735
+ var require_strip_ansi = __commonJS({
18736
+ "node_modules/strip-ansi/index.js"(exports, module) {
18737
+ "use strict";
18738
+ var ansiRegex = require_ansi_regex();
18739
+ module.exports = (string4) => typeof string4 === "string" ? string4.replace(ansiRegex(), "") : string4;
18740
+ }
18741
+ });
18742
+
18743
+ // node_modules/is-fullwidth-code-point/index.js
18744
+ var require_is_fullwidth_code_point = __commonJS({
18745
+ "node_modules/is-fullwidth-code-point/index.js"(exports, module) {
18746
+ "use strict";
18747
+ var isFullwidthCodePoint = (codePoint) => {
18748
+ if (Number.isNaN(codePoint)) {
18749
+ return false;
18750
+ }
18751
+ if (codePoint >= 4352 && (codePoint <= 4447 || // Hangul Jamo
18752
+ codePoint === 9001 || // LEFT-POINTING ANGLE BRACKET
18753
+ codePoint === 9002 || // RIGHT-POINTING ANGLE BRACKET
18754
+ // CJK Radicals Supplement .. Enclosed CJK Letters and Months
18755
+ 11904 <= codePoint && codePoint <= 12871 && codePoint !== 12351 || // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
18756
+ 12880 <= codePoint && codePoint <= 19903 || // CJK Unified Ideographs .. Yi Radicals
18757
+ 19968 <= codePoint && codePoint <= 42182 || // Hangul Jamo Extended-A
18758
+ 43360 <= codePoint && codePoint <= 43388 || // Hangul Syllables
18759
+ 44032 <= codePoint && codePoint <= 55203 || // CJK Compatibility Ideographs
18760
+ 63744 <= codePoint && codePoint <= 64255 || // Vertical Forms
18761
+ 65040 <= codePoint && codePoint <= 65049 || // CJK Compatibility Forms .. Small Form Variants
18762
+ 65072 <= codePoint && codePoint <= 65131 || // Halfwidth and Fullwidth Forms
18763
+ 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510 || // Kana Supplement
18764
+ 110592 <= codePoint && codePoint <= 110593 || // Enclosed Ideographic Supplement
18765
+ 127488 <= codePoint && codePoint <= 127569 || // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
18766
+ 131072 <= codePoint && codePoint <= 262141)) {
18767
+ return true;
18768
+ }
18769
+ return false;
18770
+ };
18771
+ module.exports = isFullwidthCodePoint;
18772
+ module.exports.default = isFullwidthCodePoint;
18773
+ }
18774
+ });
18775
+
18776
+ // node_modules/emoji-regex/index.js
18777
+ var require_emoji_regex = __commonJS({
18778
+ "node_modules/emoji-regex/index.js"(exports, module) {
18779
+ "use strict";
18780
+ module.exports = function() {
18781
+ return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
18782
+ };
18783
+ }
18784
+ });
18785
+
18786
+ // node_modules/string-width/index.js
18787
+ var require_string_width = __commonJS({
18788
+ "node_modules/string-width/index.js"(exports, module) {
18789
+ "use strict";
18790
+ var stripAnsi = require_strip_ansi();
18791
+ var isFullwidthCodePoint = require_is_fullwidth_code_point();
18792
+ var emojiRegex = require_emoji_regex();
18793
+ var stringWidth = (string4) => {
18794
+ if (typeof string4 !== "string" || string4.length === 0) {
18795
+ return 0;
18796
+ }
18797
+ string4 = stripAnsi(string4);
18798
+ if (string4.length === 0) {
18799
+ return 0;
18800
+ }
18801
+ string4 = string4.replace(emojiRegex(), " ");
18802
+ let width = 0;
18803
+ for (let i = 0; i < string4.length; i++) {
18804
+ const code = string4.codePointAt(i);
18805
+ if (code <= 31 || code >= 127 && code <= 159) {
18806
+ continue;
18807
+ }
18808
+ if (code >= 768 && code <= 879) {
18809
+ continue;
18810
+ }
18811
+ if (code > 65535) {
18812
+ i++;
18813
+ }
18814
+ width += isFullwidthCodePoint(code) ? 2 : 1;
18815
+ }
18816
+ return width;
18817
+ };
18818
+ module.exports = stringWidth;
18819
+ module.exports.default = stringWidth;
18820
+ }
18821
+ });
18822
+
18823
+ // node_modules/cli-progress/lib/format-value.js
18824
+ var require_format_value = __commonJS({
18825
+ "node_modules/cli-progress/lib/format-value.js"(exports, module) {
18826
+ module.exports = function formatValue(v, options, type) {
18827
+ if (options.autopadding !== true) {
18828
+ return v;
18829
+ }
18830
+ function autopadding(value, length) {
18831
+ return (options.autopaddingChar + value).slice(-length);
18832
+ }
18833
+ switch (type) {
18834
+ case "percentage":
18835
+ return autopadding(v, 3);
18836
+ default:
18837
+ return v;
18838
+ }
18839
+ };
18840
+ }
18841
+ });
18842
+
18843
+ // node_modules/cli-progress/lib/format-bar.js
18844
+ var require_format_bar = __commonJS({
18845
+ "node_modules/cli-progress/lib/format-bar.js"(exports, module) {
18846
+ module.exports = function formatBar(progress2, options) {
18847
+ const completeSize = Math.round(progress2 * options.barsize);
18848
+ const incompleteSize = options.barsize - completeSize;
18849
+ return options.barCompleteString.substr(0, completeSize) + options.barGlue + options.barIncompleteString.substr(0, incompleteSize);
18850
+ };
18851
+ }
18852
+ });
18853
+
18854
+ // node_modules/cli-progress/lib/format-time.js
18855
+ var require_format_time = __commonJS({
18856
+ "node_modules/cli-progress/lib/format-time.js"(exports, module) {
18857
+ module.exports = function formatTime(t, options, roundToMultipleOf) {
18858
+ function round(input) {
18859
+ if (roundToMultipleOf) {
18860
+ return roundToMultipleOf * Math.round(input / roundToMultipleOf);
18861
+ } else {
18862
+ return input;
18863
+ }
18864
+ }
18865
+ function autopadding(v) {
18866
+ return (options.autopaddingChar + v).slice(-2);
18867
+ }
18868
+ if (t > 3600) {
18869
+ return autopadding(Math.floor(t / 3600)) + "h" + autopadding(round(t % 3600 / 60)) + "m";
18870
+ } else if (t > 60) {
18871
+ return autopadding(Math.floor(t / 60)) + "m" + autopadding(round(t % 60)) + "s";
18872
+ } else if (t > 10) {
18873
+ return autopadding(round(t)) + "s";
18874
+ } else {
18875
+ return autopadding(t) + "s";
18876
+ }
18877
+ };
18878
+ }
18879
+ });
18880
+
18881
+ // node_modules/cli-progress/lib/formatter.js
18882
+ var require_formatter = __commonJS({
18883
+ "node_modules/cli-progress/lib/formatter.js"(exports, module) {
18884
+ var _stringWidth = require_string_width();
18885
+ var _defaultFormatValue = require_format_value();
18886
+ var _defaultFormatBar = require_format_bar();
18887
+ var _defaultFormatTime = require_format_time();
18888
+ module.exports = function defaultFormatter(options, params, payload) {
18889
+ let s = options.format;
18890
+ const formatTime = options.formatTime || _defaultFormatTime;
18891
+ const formatValue = options.formatValue || _defaultFormatValue;
18892
+ const formatBar = options.formatBar || _defaultFormatBar;
18893
+ const percentage = Math.floor(params.progress * 100) + "";
18894
+ const stopTime = params.stopTime || Date.now();
18895
+ const elapsedTime = Math.round((stopTime - params.startTime) / 1e3);
18896
+ const context = Object.assign({}, payload, {
18897
+ bar: formatBar(params.progress, options),
18898
+ percentage: formatValue(percentage, options, "percentage"),
18899
+ total: formatValue(params.total, options, "total"),
18900
+ value: formatValue(params.value, options, "value"),
18901
+ eta: formatValue(params.eta, options, "eta"),
18902
+ eta_formatted: formatTime(params.eta, options, 5),
18903
+ duration: formatValue(elapsedTime, options, "duration"),
18904
+ duration_formatted: formatTime(elapsedTime, options, 1)
18905
+ });
18906
+ s = s.replace(/\{(\w+)\}/g, function(match, key) {
18907
+ if (typeof context[key] !== "undefined") {
18908
+ return context[key];
18909
+ }
18910
+ return match;
18911
+ });
18912
+ const fullMargin = Math.max(0, params.maxWidth - _stringWidth(s) - 2);
18913
+ const halfMargin = Math.floor(fullMargin / 2);
18914
+ switch (options.align) {
18915
+ // fill start-of-line with whitespaces
18916
+ case "right":
18917
+ s = fullMargin > 0 ? " ".repeat(fullMargin) + s : s;
18918
+ break;
18919
+ // distribute whitespaces to left+right
18920
+ case "center":
18921
+ s = halfMargin > 0 ? " ".repeat(halfMargin) + s : s;
18922
+ break;
18923
+ // default: left align, no additional whitespaces
18924
+ case "left":
18925
+ default:
18926
+ break;
18927
+ }
18928
+ return s;
18929
+ };
18930
+ }
18931
+ });
18932
+
18933
+ // node_modules/cli-progress/lib/options.js
18934
+ var require_options = __commonJS({
18935
+ "node_modules/cli-progress/lib/options.js"(exports, module) {
18936
+ function mergeOption(v, defaultValue) {
18937
+ if (typeof v === "undefined" || v === null) {
18938
+ return defaultValue;
18939
+ } else {
18940
+ return v;
18941
+ }
18942
+ }
18943
+ module.exports = {
18944
+ // set global options
18945
+ parse: function parse3(rawOptions, preset) {
18946
+ const options = {};
18947
+ const opt = Object.assign({}, preset, rawOptions);
18948
+ options.throttleTime = 1e3 / mergeOption(opt.fps, 10);
18949
+ options.stream = mergeOption(opt.stream, process.stderr);
18950
+ options.terminal = mergeOption(opt.terminal, null);
18951
+ options.clearOnComplete = mergeOption(opt.clearOnComplete, false);
18952
+ options.stopOnComplete = mergeOption(opt.stopOnComplete, false);
18953
+ options.barsize = mergeOption(opt.barsize, 40);
18954
+ options.align = mergeOption(opt.align, "left");
18955
+ options.hideCursor = mergeOption(opt.hideCursor, false);
18956
+ options.linewrap = mergeOption(opt.linewrap, false);
18957
+ options.barGlue = mergeOption(opt.barGlue, "");
18958
+ options.barCompleteChar = mergeOption(opt.barCompleteChar, "=");
18959
+ options.barIncompleteChar = mergeOption(opt.barIncompleteChar, "-");
18960
+ options.format = mergeOption(opt.format, "progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}");
18961
+ options.formatTime = mergeOption(opt.formatTime, null);
18962
+ options.formatValue = mergeOption(opt.formatValue, null);
18963
+ options.formatBar = mergeOption(opt.formatBar, null);
18964
+ options.etaBufferLength = mergeOption(opt.etaBuffer, 10);
18965
+ options.etaAsynchronousUpdate = mergeOption(opt.etaAsynchronousUpdate, false);
18966
+ options.progressCalculationRelative = mergeOption(opt.progressCalculationRelative, false);
18967
+ options.synchronousUpdate = mergeOption(opt.synchronousUpdate, true);
18968
+ options.noTTYOutput = mergeOption(opt.noTTYOutput, false);
18969
+ options.notTTYSchedule = mergeOption(opt.notTTYSchedule, 2e3);
18970
+ options.emptyOnZero = mergeOption(opt.emptyOnZero, false);
18971
+ options.forceRedraw = mergeOption(opt.forceRedraw, false);
18972
+ options.autopadding = mergeOption(opt.autopadding, false);
18973
+ options.gracefulExit = mergeOption(opt.gracefulExit, false);
18974
+ return options;
18975
+ },
18976
+ // derived options: instance specific, has to be created for every bar element
18977
+ assignDerivedOptions: function assignDerivedOptions(options) {
18978
+ options.barCompleteString = options.barCompleteChar.repeat(options.barsize + 1);
18979
+ options.barIncompleteString = options.barIncompleteChar.repeat(options.barsize + 1);
18980
+ options.autopaddingChar = options.autopadding ? mergeOption(options.autopaddingChar, " ") : "";
18981
+ return options;
18982
+ }
18983
+ };
18984
+ }
18985
+ });
18986
+
18987
+ // node_modules/cli-progress/lib/generic-bar.js
18988
+ var require_generic_bar = __commonJS({
18989
+ "node_modules/cli-progress/lib/generic-bar.js"(exports, module) {
18990
+ var _ETA = require_eta();
18991
+ var _Terminal = require_terminal();
18992
+ var _formatter = require_formatter();
18993
+ var _options = require_options();
18994
+ var _EventEmitter = __require("events");
18995
+ module.exports = class GenericBar extends _EventEmitter {
18996
+ constructor(options) {
18997
+ super();
18998
+ this.options = _options.assignDerivedOptions(options);
18999
+ this.terminal = this.options.terminal ? this.options.terminal : new _Terminal(this.options.stream);
19000
+ this.value = 0;
19001
+ this.startValue = 0;
19002
+ this.total = 100;
19003
+ this.lastDrawnString = null;
19004
+ this.startTime = null;
19005
+ this.stopTime = null;
19006
+ this.lastRedraw = Date.now();
19007
+ this.eta = new _ETA(this.options.etaBufferLength, 0, 0);
19008
+ this.payload = {};
19009
+ this.isActive = false;
19010
+ this.formatter = typeof this.options.format === "function" ? this.options.format : _formatter;
19011
+ }
19012
+ // internal render function
19013
+ render(forceRendering = false) {
19014
+ const params = {
19015
+ progress: this.getProgress(),
19016
+ eta: this.eta.getTime(),
19017
+ startTime: this.startTime,
19018
+ stopTime: this.stopTime,
19019
+ total: this.total,
19020
+ value: this.value,
19021
+ maxWidth: this.terminal.getWidth()
19022
+ };
19023
+ if (this.options.etaAsynchronousUpdate) {
19024
+ this.updateETA();
19025
+ }
19026
+ const s = this.formatter(this.options, params, this.payload);
19027
+ const forceRedraw = forceRendering || this.options.forceRedraw || this.options.noTTYOutput && !this.terminal.isTTY();
19028
+ if (forceRedraw || this.lastDrawnString != s) {
19029
+ this.emit("redraw-pre");
19030
+ this.terminal.cursorTo(0, null);
19031
+ this.terminal.write(s);
19032
+ this.terminal.clearRight();
19033
+ this.lastDrawnString = s;
19034
+ this.lastRedraw = Date.now();
19035
+ this.emit("redraw-post");
19036
+ }
19037
+ }
19038
+ // start the progress bar
19039
+ start(total, startValue, payload) {
19040
+ this.value = startValue || 0;
19041
+ this.total = typeof total !== "undefined" && total >= 0 ? total : 100;
19042
+ this.startValue = startValue || 0;
19043
+ this.payload = payload || {};
19044
+ this.startTime = Date.now();
19045
+ this.stopTime = null;
19046
+ this.lastDrawnString = "";
19047
+ this.eta = new _ETA(this.options.etaBufferLength, this.startTime, this.value);
19048
+ this.isActive = true;
19049
+ this.emit("start", total, startValue);
19050
+ }
19051
+ // stop the bar
19052
+ stop() {
19053
+ this.isActive = false;
19054
+ this.stopTime = Date.now();
19055
+ this.emit("stop", this.total, this.value);
19056
+ }
19057
+ // update the bar value
19058
+ // update(value, payload)
19059
+ // update(payload)
19060
+ update(arg0, arg1 = {}) {
19061
+ if (typeof arg0 === "number") {
19062
+ this.value = arg0;
19063
+ this.eta.update(Date.now(), arg0, this.total);
19064
+ }
19065
+ const payloadData = (typeof arg0 === "object" ? arg0 : arg1) || {};
19066
+ this.emit("update", this.total, this.value);
19067
+ for (const key in payloadData) {
19068
+ this.payload[key] = payloadData[key];
19069
+ }
19070
+ if (this.value >= this.getTotal() && this.options.stopOnComplete) {
19071
+ this.stop();
19072
+ }
19073
+ }
19074
+ // calculate the actual progress value
19075
+ getProgress() {
19076
+ let progress2 = this.value / this.total;
19077
+ if (this.options.progressCalculationRelative) {
19078
+ progress2 = (this.value - this.startValue) / (this.total - this.startValue);
19079
+ }
19080
+ if (isNaN(progress2)) {
19081
+ progress2 = this.options && this.options.emptyOnZero ? 0 : 1;
19082
+ }
19083
+ progress2 = Math.min(Math.max(progress2, 0), 1);
19084
+ return progress2;
19085
+ }
19086
+ // update the bar value
19087
+ // increment(delta, payload)
19088
+ // increment(payload)
19089
+ increment(arg0 = 1, arg1 = {}) {
19090
+ if (typeof arg0 === "object") {
19091
+ this.update(this.value + 1, arg0);
19092
+ } else {
19093
+ this.update(this.value + arg0, arg1);
19094
+ }
19095
+ }
19096
+ // get the total (limit) value
19097
+ getTotal() {
19098
+ return this.total;
19099
+ }
19100
+ // set the total (limit) value
19101
+ setTotal(total) {
19102
+ if (typeof total !== "undefined" && total >= 0) {
19103
+ this.total = total;
19104
+ }
19105
+ }
19106
+ // force eta calculation update (long running processes)
19107
+ updateETA() {
19108
+ this.eta.update(Date.now(), this.value, this.total);
19109
+ }
19110
+ };
19111
+ }
19112
+ });
19113
+
19114
+ // node_modules/cli-progress/lib/single-bar.js
19115
+ var require_single_bar = __commonJS({
19116
+ "node_modules/cli-progress/lib/single-bar.js"(exports, module) {
19117
+ var _GenericBar = require_generic_bar();
19118
+ var _options = require_options();
19119
+ module.exports = class SingleBar extends _GenericBar {
19120
+ constructor(options, preset) {
19121
+ super(_options.parse(options, preset));
19122
+ this.timer = null;
19123
+ if (this.options.noTTYOutput && this.terminal.isTTY() === false) {
19124
+ this.options.synchronousUpdate = false;
19125
+ }
19126
+ this.schedulingRate = this.terminal.isTTY() ? this.options.throttleTime : this.options.notTTYSchedule;
19127
+ this.sigintCallback = null;
19128
+ }
19129
+ // internal render function
19130
+ render() {
19131
+ if (this.timer) {
19132
+ clearTimeout(this.timer);
19133
+ this.timer = null;
19134
+ }
19135
+ super.render();
19136
+ if (this.options.noTTYOutput && this.terminal.isTTY() === false) {
19137
+ this.terminal.newline();
19138
+ }
19139
+ this.timer = setTimeout(this.render.bind(this), this.schedulingRate);
19140
+ }
19141
+ update(current, payload) {
19142
+ if (!this.timer) {
19143
+ return;
19144
+ }
19145
+ super.update(current, payload);
19146
+ if (this.options.synchronousUpdate && this.lastRedraw + this.options.throttleTime * 2 < Date.now()) {
19147
+ this.render();
19148
+ }
19149
+ }
19150
+ // start the progress bar
19151
+ start(total, startValue, payload) {
19152
+ if (this.options.noTTYOutput === false && this.terminal.isTTY() === false) {
19153
+ return;
19154
+ }
19155
+ if (this.sigintCallback === null && this.options.gracefulExit) {
19156
+ this.sigintCallback = this.stop.bind(this);
19157
+ process.once("SIGINT", this.sigintCallback);
19158
+ process.once("SIGTERM", this.sigintCallback);
19159
+ }
19160
+ this.terminal.cursorSave();
19161
+ if (this.options.hideCursor === true) {
19162
+ this.terminal.cursor(false);
19163
+ }
19164
+ if (this.options.linewrap === false) {
19165
+ this.terminal.lineWrapping(false);
19166
+ }
19167
+ super.start(total, startValue, payload);
19168
+ this.render();
19169
+ }
19170
+ // stop the bar
19171
+ stop() {
19172
+ if (!this.timer) {
19173
+ return;
19174
+ }
19175
+ if (this.sigintCallback) {
19176
+ process.removeListener("SIGINT", this.sigintCallback);
19177
+ process.removeListener("SIGTERM", this.sigintCallback);
19178
+ this.sigintCallback = null;
19179
+ }
19180
+ this.render();
19181
+ super.stop();
19182
+ clearTimeout(this.timer);
19183
+ this.timer = null;
19184
+ if (this.options.hideCursor === true) {
19185
+ this.terminal.cursor(true);
19186
+ }
19187
+ if (this.options.linewrap === false) {
19188
+ this.terminal.lineWrapping(true);
19189
+ }
19190
+ this.terminal.cursorRestore();
19191
+ if (this.options.clearOnComplete) {
19192
+ this.terminal.cursorTo(0, null);
19193
+ this.terminal.clearLine();
19194
+ } else {
19195
+ this.terminal.newline();
19196
+ }
19197
+ }
19198
+ };
19199
+ }
19200
+ });
19201
+
19202
+ // node_modules/cli-progress/lib/multi-bar.js
19203
+ var require_multi_bar = __commonJS({
19204
+ "node_modules/cli-progress/lib/multi-bar.js"(exports, module) {
19205
+ var _Terminal = require_terminal();
19206
+ var _BarElement = require_generic_bar();
19207
+ var _options = require_options();
19208
+ var _EventEmitter = __require("events");
19209
+ module.exports = class MultiBar extends _EventEmitter {
19210
+ constructor(options, preset) {
19211
+ super();
19212
+ this.bars = [];
19213
+ this.options = _options.parse(options, preset);
19214
+ this.options.synchronousUpdate = false;
19215
+ this.terminal = this.options.terminal ? this.options.terminal : new _Terminal(this.options.stream);
19216
+ this.timer = null;
19217
+ this.isActive = false;
19218
+ this.schedulingRate = this.terminal.isTTY() ? this.options.throttleTime : this.options.notTTYSchedule;
19219
+ this.loggingBuffer = [];
19220
+ this.sigintCallback = null;
19221
+ }
19222
+ // add a new bar to the stack
19223
+ create(total, startValue, payload, barOptions = {}) {
19224
+ const bar = new _BarElement(Object.assign(
19225
+ {},
19226
+ // global options
19227
+ this.options,
19228
+ // terminal instance
19229
+ {
19230
+ terminal: this.terminal
19231
+ },
19232
+ // overrides
19233
+ barOptions
19234
+ ));
19235
+ this.bars.push(bar);
19236
+ if (this.options.noTTYOutput === false && this.terminal.isTTY() === false) {
19237
+ return bar;
19238
+ }
19239
+ if (this.sigintCallback === null && this.options.gracefulExit) {
19240
+ this.sigintCallback = this.stop.bind(this);
19241
+ process.once("SIGINT", this.sigintCallback);
19242
+ process.once("SIGTERM", this.sigintCallback);
19243
+ }
19244
+ if (!this.isActive) {
19245
+ if (this.options.hideCursor === true) {
19246
+ this.terminal.cursor(false);
19247
+ }
19248
+ if (this.options.linewrap === false) {
19249
+ this.terminal.lineWrapping(false);
19250
+ }
19251
+ this.timer = setTimeout(this.update.bind(this), this.schedulingRate);
19252
+ }
19253
+ this.isActive = true;
19254
+ bar.start(total, startValue, payload);
19255
+ this.emit("start");
19256
+ return bar;
19257
+ }
19258
+ // remove a bar from the stack
19259
+ remove(bar) {
19260
+ const index = this.bars.indexOf(bar);
19261
+ if (index < 0) {
19262
+ return false;
19263
+ }
19264
+ this.bars.splice(index, 1);
19265
+ this.update();
19266
+ this.terminal.newline();
19267
+ this.terminal.clearBottom();
19268
+ return true;
19269
+ }
19270
+ // internal update routine
19271
+ update() {
19272
+ if (this.timer) {
19273
+ clearTimeout(this.timer);
19274
+ this.timer = null;
19275
+ }
19276
+ this.emit("update-pre");
19277
+ this.terminal.cursorRelativeReset();
19278
+ this.emit("redraw-pre");
19279
+ if (this.loggingBuffer.length > 0) {
19280
+ this.terminal.clearLine();
19281
+ while (this.loggingBuffer.length > 0) {
19282
+ this.terminal.write(this.loggingBuffer.shift(), true);
19283
+ }
19284
+ }
19285
+ for (let i = 0; i < this.bars.length; i++) {
19286
+ if (i > 0) {
19287
+ this.terminal.newline();
19288
+ }
19289
+ this.bars[i].render();
19290
+ }
19291
+ this.emit("redraw-post");
19292
+ if (this.options.noTTYOutput && this.terminal.isTTY() === false) {
19293
+ this.terminal.newline();
19294
+ this.terminal.newline();
19295
+ }
19296
+ this.timer = setTimeout(this.update.bind(this), this.schedulingRate);
19297
+ this.emit("update-post");
19298
+ if (this.options.stopOnComplete && !this.bars.find((bar) => bar.isActive)) {
19299
+ this.stop();
19300
+ }
19301
+ }
19302
+ stop() {
19303
+ clearTimeout(this.timer);
19304
+ this.timer = null;
19305
+ if (this.sigintCallback) {
19306
+ process.removeListener("SIGINT", this.sigintCallback);
19307
+ process.removeListener("SIGTERM", this.sigintCallback);
19308
+ this.sigintCallback = null;
19309
+ }
19310
+ this.isActive = false;
19311
+ if (this.options.hideCursor === true) {
19312
+ this.terminal.cursor(true);
19313
+ }
19314
+ if (this.options.linewrap === false) {
19315
+ this.terminal.lineWrapping(true);
19316
+ }
19317
+ this.terminal.cursorRelativeReset();
19318
+ this.emit("stop-pre-clear");
19319
+ if (this.options.clearOnComplete) {
19320
+ this.terminal.clearBottom();
19321
+ } else {
19322
+ for (let i = 0; i < this.bars.length; i++) {
19323
+ if (i > 0) {
19324
+ this.terminal.newline();
19325
+ }
19326
+ this.bars[i].render();
19327
+ this.bars[i].stop();
19328
+ }
19329
+ this.terminal.newline();
19330
+ }
19331
+ this.emit("stop");
19332
+ }
19333
+ log(s) {
19334
+ this.loggingBuffer.push(s);
19335
+ }
19336
+ };
19337
+ }
19338
+ });
19339
+
19340
+ // node_modules/cli-progress/presets/legacy.js
19341
+ var require_legacy = __commonJS({
19342
+ "node_modules/cli-progress/presets/legacy.js"(exports, module) {
19343
+ module.exports = {
19344
+ format: "progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}",
19345
+ barCompleteChar: "=",
19346
+ barIncompleteChar: "-"
19347
+ };
19348
+ }
19349
+ });
19350
+
19351
+ // node_modules/cli-progress/presets/shades-classic.js
19352
+ var require_shades_classic = __commonJS({
19353
+ "node_modules/cli-progress/presets/shades-classic.js"(exports, module) {
19354
+ module.exports = {
19355
+ format: " {bar} {percentage}% | ETA: {eta}s | {value}/{total}",
19356
+ barCompleteChar: "\u2588",
19357
+ barIncompleteChar: "\u2591"
19358
+ };
19359
+ }
19360
+ });
19361
+
19362
+ // node_modules/cli-progress/presets/shades-grey.js
19363
+ var require_shades_grey = __commonJS({
19364
+ "node_modules/cli-progress/presets/shades-grey.js"(exports, module) {
19365
+ module.exports = {
19366
+ format: " \x1B[90m{bar}\x1B[0m {percentage}% | ETA: {eta}s | {value}/{total}",
19367
+ barCompleteChar: "\u2588",
19368
+ barIncompleteChar: "\u2591"
19369
+ };
19370
+ }
19371
+ });
19372
+
19373
+ // node_modules/cli-progress/presets/rect.js
19374
+ var require_rect = __commonJS({
19375
+ "node_modules/cli-progress/presets/rect.js"(exports, module) {
19376
+ module.exports = {
19377
+ format: " {bar}\u25A0 {percentage}% | ETA: {eta}s | {value}/{total}",
19378
+ barCompleteChar: "\u25A0",
19379
+ barIncompleteChar: " "
19380
+ };
19381
+ }
19382
+ });
19383
+
19384
+ // node_modules/cli-progress/presets/index.js
19385
+ var require_presets = __commonJS({
19386
+ "node_modules/cli-progress/presets/index.js"(exports, module) {
19387
+ var _legacy = require_legacy();
19388
+ var _shades_classic = require_shades_classic();
19389
+ var _shades_grey = require_shades_grey();
19390
+ var _rect = require_rect();
19391
+ module.exports = {
19392
+ legacy: _legacy,
19393
+ shades_classic: _shades_classic,
19394
+ shades_grey: _shades_grey,
19395
+ rect: _rect
19396
+ };
19397
+ }
19398
+ });
19399
+
19400
+ // node_modules/cli-progress/cli-progress.js
19401
+ var require_cli_progress = __commonJS({
19402
+ "node_modules/cli-progress/cli-progress.js"(exports, module) {
19403
+ var _SingleBar = require_single_bar();
19404
+ var _MultiBar = require_multi_bar();
19405
+ var _Presets = require_presets();
19406
+ var _Formatter = require_formatter();
19407
+ var _defaultFormatValue = require_format_value();
19408
+ var _defaultFormatBar = require_format_bar();
19409
+ var _defaultFormatTime = require_format_time();
19410
+ module.exports = {
19411
+ Bar: _SingleBar,
19412
+ SingleBar: _SingleBar,
19413
+ MultiBar: _MultiBar,
19414
+ Presets: _Presets,
19415
+ Format: {
19416
+ Formatter: _Formatter,
19417
+ BarFormat: _defaultFormatBar,
19418
+ ValueFormat: _defaultFormatValue,
19419
+ TimeFormat: _defaultFormatTime
19420
+ }
19421
+ };
19422
+ }
19423
+ });
19424
+
18554
19425
  // node_modules/color-name/index.js
18555
19426
  var require_color_name = __commonJS({
18556
19427
  "node_modules/color-name/index.js"(exports, module) {
@@ -19868,14 +20739,14 @@ var require_templates = __commonJS({
19868
20739
  }
19869
20740
  return results;
19870
20741
  }
19871
- function buildStyle(chalk2, styles) {
20742
+ function buildStyle(chalk3, styles) {
19872
20743
  const enabled = {};
19873
20744
  for (const layer of styles) {
19874
20745
  for (const style of layer.styles) {
19875
20746
  enabled[style[0]] = layer.inverse ? null : style.slice(1);
19876
20747
  }
19877
20748
  }
19878
- let current = chalk2;
20749
+ let current = chalk3;
19879
20750
  for (const [styleName, styles2] of Object.entries(enabled)) {
19880
20751
  if (!Array.isArray(styles2)) {
19881
20752
  continue;
@@ -19887,7 +20758,7 @@ var require_templates = __commonJS({
19887
20758
  }
19888
20759
  return current;
19889
20760
  }
19890
- module.exports = (chalk2, temporary) => {
20761
+ module.exports = (chalk3, temporary) => {
19891
20762
  const styles = [];
19892
20763
  const chunks = [];
19893
20764
  let chunk = [];
@@ -19897,13 +20768,13 @@ var require_templates = __commonJS({
19897
20768
  } else if (style) {
19898
20769
  const string4 = chunk.join("");
19899
20770
  chunk = [];
19900
- chunks.push(styles.length === 0 ? string4 : buildStyle(chalk2, styles)(string4));
20771
+ chunks.push(styles.length === 0 ? string4 : buildStyle(chalk3, styles)(string4));
19901
20772
  styles.push({ inverse, styles: parseStyle(style) });
19902
20773
  } else if (close) {
19903
20774
  if (styles.length === 0) {
19904
20775
  throw new Error("Found extraneous } in Chalk template literal");
19905
20776
  }
19906
- chunks.push(buildStyle(chalk2, styles)(chunk.join("")));
20777
+ chunks.push(buildStyle(chalk3, styles)(chunk.join("")));
19907
20778
  chunk = [];
19908
20779
  styles.pop();
19909
20780
  } else {
@@ -19951,16 +20822,16 @@ var require_source = __commonJS({
19951
20822
  }
19952
20823
  };
19953
20824
  var chalkFactory = (options) => {
19954
- const chalk3 = {};
19955
- applyOptions(chalk3, options);
19956
- chalk3.template = (...arguments_) => chalkTag(chalk3.template, ...arguments_);
19957
- Object.setPrototypeOf(chalk3, Chalk.prototype);
19958
- Object.setPrototypeOf(chalk3.template, chalk3);
19959
- chalk3.template.constructor = () => {
20825
+ const chalk4 = {};
20826
+ applyOptions(chalk4, options);
20827
+ chalk4.template = (...arguments_) => chalkTag(chalk4.template, ...arguments_);
20828
+ Object.setPrototypeOf(chalk4, Chalk.prototype);
20829
+ Object.setPrototypeOf(chalk4.template, chalk4);
20830
+ chalk4.template.constructor = () => {
19960
20831
  throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
19961
20832
  };
19962
- chalk3.template.Instance = ChalkClass;
19963
- return chalk3.template;
20833
+ chalk4.template.Instance = ChalkClass;
20834
+ return chalk4.template;
19964
20835
  };
19965
20836
  function Chalk(options) {
19966
20837
  return chalkFactory(options);
@@ -20071,7 +20942,7 @@ var require_source = __commonJS({
20071
20942
  return openAll + string4 + closeAll;
20072
20943
  };
20073
20944
  var template;
20074
- var chalkTag = (chalk3, ...strings) => {
20945
+ var chalkTag = (chalk4, ...strings) => {
20075
20946
  const [firstString] = strings;
20076
20947
  if (!isArray(firstString) || !isArray(firstString.raw)) {
20077
20948
  return strings.join(" ");
@@ -20087,14 +20958,14 @@ var require_source = __commonJS({
20087
20958
  if (template === void 0) {
20088
20959
  template = require_templates();
20089
20960
  }
20090
- return template(chalk3, parts.join(""));
20961
+ return template(chalk4, parts.join(""));
20091
20962
  };
20092
20963
  Object.defineProperties(Chalk.prototype, styles);
20093
- var chalk2 = Chalk();
20094
- chalk2.supportsColor = stdoutColor;
20095
- chalk2.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
20096
- chalk2.stderr.supportsColor = stderrColor;
20097
- module.exports = chalk2;
20964
+ var chalk3 = Chalk();
20965
+ chalk3.supportsColor = stdoutColor;
20966
+ chalk3.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
20967
+ chalk3.stderr.supportsColor = stderrColor;
20968
+ module.exports = chalk3;
20098
20969
  }
20099
20970
  });
20100
20971
 
@@ -35030,8 +35901,8 @@ var ConfigSchema = external_exports.object({
35030
35901
  }).strict().superRefine(validateCrossDatabase);
35031
35902
 
35032
35903
  // lib/constants.ts
35033
- var SDK_TITLE = "RevenexxAPIRevenexx";
35034
- var SDK_VERSION = "0.0.7";
35904
+ var SDK_TITLE = "Revenexx";
35905
+ var SDK_VERSION = "0.0.8";
35035
35906
  var SDK_NAME = "Revenexx CLI";
35036
35907
  var SDK_PLATFORM = "";
35037
35908
  var SDK_LANGUAGE = "cli";
@@ -35041,6 +35912,9 @@ var NPM_REGISTRY_URL = `https://registry.npmjs.org/${NPM_PACKAGE_NAME}/latest`;
35041
35912
  var GITHUB_REPO = "revenexx-sdks/cli";
35042
35913
  var GITHUB_RELEASES_URL = `https://github.com/${GITHUB_REPO}/releases`;
35043
35914
  var DEFAULT_ENDPOINT = "https://api.revenexx.com/v1";
35915
+ var SSO_ISSUER = process.env.REVENEXX_SSO_ISSUER || "https://id.revenexx.com";
35916
+ var SSO_CLIENT_ID = process.env.REVENEXX_SSO_CLIENT_ID || "378821498762167046";
35917
+ var SSO_REDIRECT_URI = process.env.REVENEXX_SSO_REDIRECT_URI || "http://127.0.0.1:8000/callback";
35044
35918
 
35045
35919
  // lib/json.ts
35046
35920
  var import_json_bigint = __toESM(require_json_bigint(), 1);
@@ -35165,13 +36039,23 @@ var Config = class {
35165
36039
  }
35166
36040
  }
35167
36041
  write() {
36042
+ this.writeSecure(JSONBig.stringify(this.data, null, 4));
36043
+ }
36044
+ /**
36045
+ * Persist `serialized` to `this.path` with owner-only permissions. The
36046
+ * containing directory is created `0o700` and the file `0o600`; because
36047
+ * `writeFileSync`'s `mode` only applies when the file is *created*, the
36048
+ * mode is reasserted with `chmodSync` on every write to repair drift on
36049
+ * files that predate this hardening or were written under a loose umask.
36050
+ */
36051
+ writeSecure(serialized) {
35168
36052
  const dir = _path.dirname(this.path);
35169
- if (!fs.existsSync(dir)) {
35170
- fs.mkdirSync(dir, { recursive: true });
36053
+ fs.mkdirSync(dir, { recursive: true, mode: 448 });
36054
+ fs.writeFileSync(this.path, serialized, { mode: 384 });
36055
+ try {
36056
+ fs.chmodSync(this.path, 384);
36057
+ } catch {
35171
36058
  }
35172
- fs.writeFileSync(this.path, JSONBig.stringify(this.data, null, 4), {
35173
- mode: 384
35174
- });
35175
36059
  }
35176
36060
  get(key) {
35177
36061
  return this.data[key];
@@ -35251,14 +36135,7 @@ var Local = class _Local extends Config {
35251
36135
  this.configDirectoryPath = _path.dirname(absolutePath);
35252
36136
  }
35253
36137
  write() {
35254
- const dir = _path.dirname(this.path);
35255
- if (!fs.existsSync(dir)) {
35256
- fs.mkdirSync(dir, { recursive: true });
35257
- }
35258
- const orderedData = orderConfigKeys(this.data);
35259
- fs.writeFileSync(this.path, JSONBig.stringify(orderedData, null, 4), {
35260
- mode: 384
35261
- });
36138
+ this.writeSecure(JSONBig.stringify(orderConfigKeys(this.data), null, 4));
35262
36139
  }
35263
36140
  static findConfigFile(filename) {
35264
36141
  let currentPath = process3.cwd();
@@ -35584,6 +36461,10 @@ var Global = class _Global extends Config {
35584
36461
  static PREFERENCE_KEY = "key";
35585
36462
  static PREFERENCE_LOCALE = "locale";
35586
36463
  static PREFERENCE_MODE = "mode";
36464
+ static PREFERENCE_JWT = "jwt";
36465
+ static PREFERENCE_REFRESH_TOKEN = "refreshToken";
36466
+ static PREFERENCE_JWT_EXPIRES = "jwtExpiresAt";
36467
+ static PREFERENCE_AUTH_METHOD = "authMethod";
35587
36468
  static IGNORE_ATTRIBUTES = [
35588
36469
  _Global.PREFERENCE_CURRENT,
35589
36470
  _Global.PREFERENCE_SELF_SIGNED,
@@ -35592,7 +36473,11 @@ var Global = class _Global extends Config {
35592
36473
  _Global.PREFERENCE_PROJECT,
35593
36474
  _Global.PREFERENCE_KEY,
35594
36475
  _Global.PREFERENCE_LOCALE,
35595
- _Global.PREFERENCE_MODE
36476
+ _Global.PREFERENCE_MODE,
36477
+ _Global.PREFERENCE_JWT,
36478
+ _Global.PREFERENCE_REFRESH_TOKEN,
36479
+ _Global.PREFERENCE_JWT_EXPIRES,
36480
+ _Global.PREFERENCE_AUTH_METHOD
35596
36481
  ];
35597
36482
  static MODE_ADMIN = "admin";
35598
36483
  static MODE_DEFAULT = "default";
@@ -35601,6 +36486,13 @@ var Global = class _Global extends Config {
35601
36486
  const homeDir = os.homedir();
35602
36487
  super(`${homeDir}/${path}`);
35603
36488
  }
36489
+ write() {
36490
+ super.write();
36491
+ try {
36492
+ fs.chmodSync(_path.dirname(this.path), 448);
36493
+ } catch {
36494
+ }
36495
+ }
35604
36496
  getCurrentSession() {
35605
36497
  if (!this.has(_Global.PREFERENCE_CURRENT)) {
35606
36498
  return "";
@@ -35698,6 +36590,42 @@ var Global = class _Global extends Config {
35698
36590
  setKey(key) {
35699
36591
  this.setTo(_Global.PREFERENCE_KEY, key);
35700
36592
  }
36593
+ getJWT() {
36594
+ if (!this.hasFrom(_Global.PREFERENCE_JWT)) {
36595
+ return "";
36596
+ }
36597
+ return this.getFrom(_Global.PREFERENCE_JWT);
36598
+ }
36599
+ setJWT(jwt2) {
36600
+ this.setTo(_Global.PREFERENCE_JWT, jwt2);
36601
+ }
36602
+ getRefreshToken() {
36603
+ if (!this.hasFrom(_Global.PREFERENCE_REFRESH_TOKEN)) {
36604
+ return "";
36605
+ }
36606
+ return this.getFrom(_Global.PREFERENCE_REFRESH_TOKEN);
36607
+ }
36608
+ setRefreshToken(refreshToken) {
36609
+ this.setTo(_Global.PREFERENCE_REFRESH_TOKEN, refreshToken);
36610
+ }
36611
+ getJwtExpires() {
36612
+ if (!this.hasFrom(_Global.PREFERENCE_JWT_EXPIRES)) {
36613
+ return 0;
36614
+ }
36615
+ return this.getFrom(_Global.PREFERENCE_JWT_EXPIRES);
36616
+ }
36617
+ setJwtExpires(expiresAt) {
36618
+ this.setTo(_Global.PREFERENCE_JWT_EXPIRES, expiresAt);
36619
+ }
36620
+ getAuthMethod() {
36621
+ if (!this.hasFrom(_Global.PREFERENCE_AUTH_METHOD)) {
36622
+ return "";
36623
+ }
36624
+ return this.getFrom(_Global.PREFERENCE_AUTH_METHOD);
36625
+ }
36626
+ setAuthMethod(authMethod) {
36627
+ this.setTo(_Global.PREFERENCE_AUTH_METHOD, authMethod);
36628
+ }
35701
36629
  hasFrom(key) {
35702
36630
  const current = this.getCurrentSession();
35703
36631
  if (current) {
@@ -35725,32 +36653,151 @@ var Global = class _Global extends Config {
35725
36653
  var localConfig = new Local();
35726
36654
  var globalConfig2 = new Global();
35727
36655
 
35728
- // lib/client.ts
36656
+ // lib/spinner.ts
36657
+ var import_cli_progress = __toESM(require_cli_progress(), 1);
35729
36658
  var import_chalk = __toESM(require_source(), 1);
36659
+ var SPINNER_ARC = "arc";
36660
+ var SPINNER_DOTS = "dots";
36661
+ var spinners = {
36662
+ [SPINNER_ARC]: {
36663
+ interval: 100,
36664
+ frames: ["\u25DC", "\u25E0", "\u25DD", "\u25DE", "\u25E1", "\u25DF"]
36665
+ },
36666
+ [SPINNER_DOTS]: {
36667
+ interval: 80,
36668
+ frames: ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"]
36669
+ }
36670
+ };
36671
+ var requestSpinnerEnabled = false;
36672
+ var requestSpinnerActive = false;
36673
+ var multibarActive = false;
36674
+ var startRequestSpinner = (label = "Loading\u2026") => {
36675
+ if (!requestSpinnerEnabled || requestSpinnerActive || multibarActive || !process.stderr.isTTY) {
36676
+ return () => {
36677
+ };
36678
+ }
36679
+ requestSpinnerActive = true;
36680
+ const { frames, interval } = spinners[SPINNER_DOTS];
36681
+ let frame = 0;
36682
+ const render = () => {
36683
+ process.stderr.write(
36684
+ `\r${import_chalk.default.cyan(frames[frame])} ${import_chalk.default.dim(label)}`
36685
+ );
36686
+ frame = (frame + 1) % frames.length;
36687
+ };
36688
+ render();
36689
+ const timer = setInterval(render, interval);
36690
+ timer.unref();
36691
+ return () => {
36692
+ clearInterval(timer);
36693
+ requestSpinnerActive = false;
36694
+ process.stderr.write("\r\x1B[2K");
36695
+ };
36696
+ };
36697
+
36698
+ // lib/redact.ts
36699
+ var redactSecrets = (input) => {
36700
+ if (input === null || input === void 0) return "";
36701
+ let s = typeof input === "string" ? input : String(input);
36702
+ s = s.replace(/standard_[A-Za-z0-9]{32,}/g, "standard_***");
36703
+ s = s.replace(/rvxk_[A-Za-z0-9]{16,}/g, "rvxk_***");
36704
+ s = s.replace(
36705
+ /(X-Revenexx-(?:Api-Key|Key|Cookie|JWT|Session|Dev-Key|Mode))(\s*[:=]\s*)([^\s,'"`}\]]+)/gi,
36706
+ "$1$2***"
36707
+ );
36708
+ s = s.replace(/(Bearer\s+)([A-Za-z0-9._\-]{20,})/gi, "$1***");
36709
+ s = s.replace(/(a_session[a-z0-9_]*=)([^\s;,'"`]+)/gi, "$1***");
36710
+ s = s.replace(
36711
+ /\b(REVENEXX_(?:TOKEN|API_KEY|KEY|COOKIE)\s*=\s*)([^\s;'"`]+)/g,
36712
+ "$1***"
36713
+ );
36714
+ s = s.replace(
36715
+ /(["'`]?(?:token|api[_-]?key|secret|password|cookie|key|access_token|id_token|refresh_token)["'`]?\s*[:=]\s*["'`]?)([^"'`\s,;}\]]{4,})/gi,
36716
+ "$1***"
36717
+ );
36718
+ s = s.replace(/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]+/g, "eyJ***");
36719
+ return s;
36720
+ };
36721
+
36722
+ // lib/client.ts
36723
+ var import_chalk2 = __toESM(require_source(), 1);
35730
36724
  var perf = globalThis.performance;
35731
36725
  if (typeof perf.markResourceTiming !== "function") {
35732
36726
  perf.markResourceTiming = () => {
35733
36727
  };
35734
36728
  }
36729
+ var DEFAULT_TIMEOUT_MS = 3e4;
36730
+ var CONNECT_TIMEOUT_MS = 1e4;
36731
+ var DEFAULT_MAX_RETRIES = 3;
36732
+ var RETRY_BASE_DELAY_MS = 300;
36733
+ var RETRY_MAX_DELAY_MS = 5e3;
36734
+ var RETRY_AFTER_MAX_MS = 6e4;
36735
+ var IDEMPOTENT_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD", "PUT", "DELETE", "OPTIONS"]);
36736
+ var RETRYABLE_STATUS = /* @__PURE__ */ new Set([429, 502, 503, 504]);
36737
+ var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
36738
+ var parseRetryAfter = (value) => {
36739
+ if (!value) return null;
36740
+ const seconds = Number(value);
36741
+ if (Number.isFinite(seconds)) {
36742
+ return Math.min(Math.max(seconds, 0) * 1e3, RETRY_AFTER_MAX_MS);
36743
+ }
36744
+ const date5 = Date.parse(value);
36745
+ if (!Number.isNaN(date5)) {
36746
+ return Math.min(Math.max(date5 - Date.now(), 0), RETRY_AFTER_MAX_MS);
36747
+ }
36748
+ return null;
36749
+ };
36750
+ var backoffDelay = (attempt) => {
36751
+ const ceiling = Math.min(
36752
+ RETRY_MAX_DELAY_MS,
36753
+ RETRY_BASE_DELAY_MS * 2 ** attempt
36754
+ );
36755
+ return Math.floor(Math.random() * ceiling);
36756
+ };
36757
+ var sharedAgent;
36758
+ var sharedAgentSelfSigned;
36759
+ var getDispatcher = (selfSigned) => {
36760
+ if (sharedAgent === void 0 || sharedAgentSelfSigned !== selfSigned) {
36761
+ void sharedAgent?.close().catch(() => {
36762
+ });
36763
+ sharedAgent = new import_undici.Agent({
36764
+ connect: {
36765
+ rejectUnauthorized: !selfSigned,
36766
+ timeout: CONNECT_TIMEOUT_MS
36767
+ }
36768
+ });
36769
+ sharedAgentSelfSigned = selfSigned;
36770
+ }
36771
+ return sharedAgent;
36772
+ };
35735
36773
  var RevenexxException = class extends Error {
35736
36774
  code;
35737
36775
  type;
35738
36776
  response;
35739
- constructor(message, code, type = "", response = "") {
36777
+ /** Gateway correlation id (`x-request-id`), when the response carried one. */
36778
+ requestId;
36779
+ constructor(message, code, type = "", response = "", requestId) {
35740
36780
  super(message);
35741
36781
  this.name = "RevenexxException";
35742
36782
  this.code = code;
35743
36783
  this.type = type;
35744
36784
  this.response = response;
36785
+ this.requestId = requestId;
35745
36786
  }
35746
36787
  };
35747
36788
  var Client = class _Client {
35748
36789
  endpoint;
35749
36790
  headers;
35750
36791
  selfSigned;
36792
+ timeout;
36793
+ retry;
36794
+ debug;
35751
36795
  constructor() {
35752
36796
  this.endpoint = DEFAULT_ENDPOINT;
35753
36797
  this.selfSigned = false;
36798
+ this.timeout = DEFAULT_TIMEOUT_MS;
36799
+ this.retry = true;
36800
+ this.debug = false;
35754
36801
  this.headers = {
35755
36802
  "content-type": "",
35756
36803
  "x-sdk-name": SDK_NAME,
@@ -35841,6 +36888,23 @@ var Client = class _Client {
35841
36888
  this.addHeader("X-Revenexx-JWT", jwt2);
35842
36889
  return this;
35843
36890
  }
36891
+ /**
36892
+ * Set Bearer token
36893
+ *
36894
+ * An OAuth2 / OIDC access token (e.g. from SSO sign-in), sent in the standard
36895
+ * `Authorization: Bearer` header — the header the gateway validates for JWT
36896
+ * auth (see sdk-generator PR #9). Adds the `Bearer ` prefix unless the caller
36897
+ * already supplied one.
36898
+ *
36899
+ * @param {string} token
36900
+ *
36901
+ * @return self
36902
+ */
36903
+ setBearer(token) {
36904
+ const value = token.toLowerCase().startsWith("bearer ") ? token : `Bearer ${token}`;
36905
+ this.addHeader("Authorization", value);
36906
+ return this;
36907
+ }
35844
36908
  /**
35845
36909
  * Set Locale
35846
36910
  *
@@ -35874,6 +36938,14 @@ var Client = class _Client {
35874
36938
  this.selfSigned = status;
35875
36939
  return this;
35876
36940
  }
36941
+ /**
36942
+ * True for hosts where cleartext `http://` is acceptable during local
36943
+ * development (loopback interfaces never leave the machine).
36944
+ */
36945
+ static isLoopbackHost(hostname3) {
36946
+ const host = hostname3.replace(/^\[|\]$/g, "").toLowerCase();
36947
+ return host === "localhost" || host === "::1" || /^127(?:\.\d{1,3}){3}$/.test(host);
36948
+ }
35877
36949
  /**
35878
36950
  * Set endpoint.
35879
36951
  *
@@ -35882,12 +36954,62 @@ var Client = class _Client {
35882
36954
  * @return this
35883
36955
  */
35884
36956
  setEndpoint(endpoint) {
35885
- if (!endpoint.startsWith("http://") && !endpoint.startsWith("https://")) {
36957
+ let url2;
36958
+ try {
36959
+ url2 = new URL(endpoint);
36960
+ } catch {
36961
+ throw new RevenexxException("Invalid endpoint URL: " + endpoint);
36962
+ }
36963
+ if (url2.protocol !== "http:" && url2.protocol !== "https:") {
35886
36964
  throw new RevenexxException("Invalid endpoint URL: " + endpoint);
35887
36965
  }
36966
+ const allowCleartext = process.env.REVENEXX_ALLOW_CLEARTEXT === "1";
36967
+ if (url2.protocol === "http:" && !_Client.isLoopbackHost(url2.hostname) && !allowCleartext) {
36968
+ throw new RevenexxException(
36969
+ `Refusing to use insecure endpoint '${endpoint}': credentials would be sent in cleartext over http://. Use https:// (self-hosted setups can pair it with --self-signed), or a loopback host such as http://localhost for local development. Set REVENEXX_ALLOW_CLEARTEXT=1 to override on a trusted private network.`
36970
+ );
36971
+ }
35888
36972
  this.endpoint = endpoint;
35889
36973
  return this;
35890
36974
  }
36975
+ /**
36976
+ * Set the per-request timeout in milliseconds. A request that exceeds this is
36977
+ * aborted with a clear "timed out" error rather than hanging indefinitely.
36978
+ *
36979
+ * @param {number} ms
36980
+ *
36981
+ * @return this
36982
+ */
36983
+ setTimeout(ms) {
36984
+ if (Number.isFinite(ms) && ms > 0) {
36985
+ this.timeout = ms;
36986
+ }
36987
+ return this;
36988
+ }
36989
+ /**
36990
+ * Enable or disable automatic retries (bounded exponential backoff with
36991
+ * jitter for idempotent requests, honoring `Retry-After`). On by default.
36992
+ *
36993
+ * @param {boolean} enabled
36994
+ *
36995
+ * @return this
36996
+ */
36997
+ setRetry(enabled) {
36998
+ this.retry = enabled;
36999
+ return this;
37000
+ }
37001
+ /**
37002
+ * Enable redacted HTTP debug logging (request line, status, duration,
37003
+ * request id) to stderr. Off by default.
37004
+ *
37005
+ * @param {boolean} enabled
37006
+ *
37007
+ * @return this
37008
+ */
37009
+ setDebug(enabled) {
37010
+ this.debug = enabled;
37011
+ return this;
37012
+ }
35891
37013
  /**
35892
37014
  * @param {string} key
35893
37015
  * @param {string} value
@@ -35920,33 +37042,80 @@ var Client = class _Client {
35920
37042
  } else {
35921
37043
  body = JSONBig.stringify(params);
35922
37044
  }
37045
+ const upperMethod = method.toUpperCase();
37046
+ const bodyReplayable = !(body instanceof import_undici.FormData);
37047
+ const maxRetries = this.retry && IDEMPOTENT_METHODS.has(upperMethod) && bodyReplayable ? DEFAULT_MAX_RETRIES : 0;
35923
37048
  let response = void 0;
37049
+ const stopSpinner = startRequestSpinner(`${upperMethod} ${path}`);
35924
37050
  try {
35925
- response = await (0, import_undici.fetch)(url2.toString(), {
35926
- method: method.toUpperCase(),
35927
- headers: mergedHeaders,
35928
- body,
35929
- dispatcher: new import_undici.Agent({
35930
- connect: {
35931
- rejectUnauthorized: !this.selfSigned
37051
+ for (let attempt = 0; ; attempt++) {
37052
+ const startedAt = Date.now();
37053
+ try {
37054
+ response = await (0, import_undici.fetch)(url2.toString(), {
37055
+ method: upperMethod,
37056
+ headers: mergedHeaders,
37057
+ body,
37058
+ // Bound every request so a slow/black-holed gateway can't hang
37059
+ // the CLI forever; aborts with a TimeoutError we translate below.
37060
+ signal: AbortSignal.timeout(this.timeout),
37061
+ // One pooled dispatcher, reused across requests (see getDispatcher).
37062
+ dispatcher: getDispatcher(this.selfSigned)
37063
+ });
37064
+ } catch (error51) {
37065
+ const err = error51;
37066
+ const timedOut = err.name === "TimeoutError" || err.name === "AbortError";
37067
+ this.logDebug(
37068
+ upperMethod,
37069
+ path,
37070
+ timedOut ? "timeout" : "network-error",
37071
+ Date.now() - startedAt
37072
+ );
37073
+ if (!timedOut && attempt < maxRetries) {
37074
+ await sleep(backoffDelay(attempt));
37075
+ continue;
35932
37076
  }
35933
- })
35934
- });
35935
- } catch (error51) {
35936
- throw new RevenexxException(error51.message);
37077
+ if (timedOut) {
37078
+ throw new RevenexxException(
37079
+ `Request timed out after ${this.timeout}ms (${upperMethod} ${path}). Increase the limit with --timeout, or check your connection and the endpoint.`
37080
+ );
37081
+ }
37082
+ throw new RevenexxException(err.message);
37083
+ }
37084
+ const requestId2 = response.headers.get("x-request-id") ?? void 0;
37085
+ this.logDebug(
37086
+ upperMethod,
37087
+ path,
37088
+ String(response.status),
37089
+ Date.now() - startedAt,
37090
+ requestId2
37091
+ );
37092
+ if (attempt < maxRetries && RETRYABLE_STATUS.has(response.status)) {
37093
+ const retryAfter = parseRetryAfter(
37094
+ response.headers.get("retry-after")
37095
+ );
37096
+ const delay = retryAfter ?? backoffDelay(attempt);
37097
+ await response.arrayBuffer().catch(() => {
37098
+ });
37099
+ await sleep(delay);
37100
+ continue;
37101
+ }
37102
+ break;
37103
+ }
37104
+ } finally {
37105
+ stopSpinner();
35937
37106
  }
35938
- if (response.status >= 400) {
35939
- const text2 = await response.text();
37107
+ const res = response;
37108
+ const requestId = res.headers.get("x-request-id") ?? void 0;
37109
+ if (res.status >= 400) {
37110
+ const text2 = await res.text();
35940
37111
  let json3 = void 0;
35941
37112
  try {
35942
37113
  json3 = JSON.parse(text2);
35943
37114
  } catch (_error) {
35944
- throw new RevenexxException(text2, response.status, "", text2);
37115
+ throw new RevenexxException(text2, res.status, "", text2, requestId);
35945
37116
  }
35946
37117
  if (path !== "/account" && json3.code === 401 && json3.type === "user_more_factors_required") {
35947
- console.log(
35948
- `${import_chalk.default.cyan.bold("\u2139 Info")} ${import_chalk.default.cyan("Unusable account found, removing...")}`
35949
- );
37118
+ console.log(`${import_chalk2.default.cyan("\u2139")} Unusable account found, removing...`);
35950
37119
  const current = globalConfig2.getCurrentSession();
35951
37120
  globalConfig2.setCurrentSession("");
35952
37121
  globalConfig2.removeSession(current);
@@ -35957,21 +37126,23 @@ var Client = class _Client {
35957
37126
  `You are not authenticated. Run '${EXECUTABLE_NAME} login' to authenticate and try again.`,
35958
37127
  json3.code,
35959
37128
  json3.type,
35960
- text2
37129
+ text2,
37130
+ requestId
35961
37131
  );
35962
37132
  }
35963
37133
  throw new RevenexxException(
35964
37134
  json3.message || text2,
35965
37135
  json3.code,
35966
37136
  json3.type,
35967
- text2
37137
+ text2,
37138
+ requestId
35968
37139
  );
35969
37140
  }
35970
37141
  if (responseType === "arraybuffer") {
35971
- const data = await response.arrayBuffer();
37142
+ const data = await res.arrayBuffer();
35972
37143
  return data;
35973
37144
  }
35974
- const cookies = response.headers.getSetCookie();
37145
+ const cookies = res.headers.getSetCookie();
35975
37146
  if (cookies && cookies.length > 0) {
35976
37147
  for (const cookie of cookies) {
35977
37148
  if (cookie.startsWith("a_session_console=")) {
@@ -35979,7 +37150,7 @@ var Client = class _Client {
35979
37150
  }
35980
37151
  }
35981
37152
  }
35982
- const text = await response.text();
37153
+ const text = await res.text();
35983
37154
  let json2 = void 0;
35984
37155
  try {
35985
37156
  json2 = JSONBig.parse(text);
@@ -35988,6 +37159,17 @@ var Client = class _Client {
35988
37159
  }
35989
37160
  return json2;
35990
37161
  }
37162
+ /**
37163
+ * Redacted, opt-in HTTP debug line on stderr (request line, status/outcome,
37164
+ * duration, and gateway request id). Everything is passed through
37165
+ * redactSecrets so auth material in the path can never leak.
37166
+ */
37167
+ logDebug(method, path, outcome, durationMs, requestId) {
37168
+ if (!this.debug) return;
37169
+ const id = requestId ? ` request-id=${requestId}` : "";
37170
+ const line = `${method} ${path} \u2192 ${outcome} (${durationMs}ms)${id}`;
37171
+ console.error(import_chalk2.default.dim(`[http] ${redactSecrets(line)}`));
37172
+ }
35991
37173
  static flatten(data, prefix = "") {
35992
37174
  let output = {};
35993
37175
  for (const key in data) {