@revenexx/cli 0.0.6 → 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 (77) hide show
  1. package/README.md +93 -84
  2. package/dist/bundle-win-arm64.mjs +73280 -61939
  3. package/dist/cli.cjs +73070 -61729
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/index.cjs +1257 -61
  6. package/dist/index.js +1257 -61
  7. package/dist/lib/client.d.ts +68 -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 +3 -0
  29. package/dist/lib/commands/services/forms.d.ts.map +1 -0
  30. package/dist/lib/commands/services/greetings.d.ts.map +1 -1
  31. package/dist/lib/commands/services/inventories.d.ts.map +1 -1
  32. package/dist/lib/commands/services/locale.d.ts.map +1 -1
  33. package/dist/lib/commands/services/markets.d.ts.map +1 -1
  34. package/dist/lib/commands/services/messaging.d.ts.map +1 -1
  35. package/dist/lib/commands/services/orderlists.d.ts.map +1 -1
  36. package/dist/lib/commands/services/orders.d.ts.map +1 -1
  37. package/dist/lib/commands/services/pages.d.ts.map +1 -1
  38. package/dist/lib/commands/services/payments.d.ts.map +1 -1
  39. package/dist/lib/commands/services/prices.d.ts.map +1 -1
  40. package/dist/lib/commands/services/products.d.ts.map +1 -1
  41. package/dist/lib/commands/services/search.d.ts.map +1 -1
  42. package/dist/lib/commands/services/settings.d.ts +3 -0
  43. package/dist/lib/commands/services/settings.d.ts.map +1 -0
  44. package/dist/lib/commands/services/shipping.d.ts.map +1 -1
  45. package/dist/lib/commands/services/sites.d.ts.map +1 -1
  46. package/dist/lib/commands/services/storage.d.ts.map +1 -1
  47. package/dist/lib/commands/services/tokens.d.ts.map +1 -1
  48. package/dist/lib/commands/tenants.d.ts.map +1 -1
  49. package/dist/lib/commands/update.d.ts.map +1 -1
  50. package/dist/lib/config.d.ts +21 -0
  51. package/dist/lib/config.d.ts.map +1 -1
  52. package/dist/lib/constants.d.ts +7 -3
  53. package/dist/lib/constants.d.ts.map +1 -1
  54. package/dist/lib/interactive.d.ts +68 -0
  55. package/dist/lib/interactive.d.ts.map +1 -0
  56. package/dist/lib/oauth.d.ts +97 -0
  57. package/dist/lib/oauth.d.ts.map +1 -0
  58. package/dist/lib/parser.d.ts +13 -6
  59. package/dist/lib/parser.d.ts.map +1 -1
  60. package/dist/lib/redact.d.ts +12 -0
  61. package/dist/lib/redact.d.ts.map +1 -0
  62. package/dist/lib/sdks.d.ts.map +1 -1
  63. package/dist/lib/spinner.d.ts +9 -1
  64. package/dist/lib/spinner.d.ts.map +1 -1
  65. package/dist/lib/types.d.ts +10 -2
  66. package/dist/lib/types.d.ts.map +1 -1
  67. package/dist/tests/client-transport.test.d.ts +2 -0
  68. package/dist/tests/client-transport.test.d.ts.map +1 -0
  69. package/dist/tests/command-picker.test.d.ts +2 -0
  70. package/dist/tests/command-picker.test.d.ts.map +1 -0
  71. package/dist/tests/endpoint.test.d.ts +2 -0
  72. package/dist/tests/endpoint.test.d.ts.map +1 -0
  73. package/dist/tests/interactive.test.d.ts +2 -0
  74. package/dist/tests/interactive.test.d.ts.map +1 -0
  75. package/dist/tests/oauth.test.d.ts +2 -0
  76. package/dist/tests/oauth.test.d.ts.map +1 -0
  77. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -18546,6 +18546,877 @@ var require_json_bigint = __commonJS({
18546
18546
  }
18547
18547
  });
18548
18548
 
18549
+ // node_modules/cli-progress/lib/eta.js
18550
+ var require_eta = __commonJS({
18551
+ "node_modules/cli-progress/lib/eta.js"(exports2, module2) {
18552
+ var ETA = class {
18553
+ constructor(length, initTime, initValue) {
18554
+ this.etaBufferLength = length || 100;
18555
+ this.valueBuffer = [initValue];
18556
+ this.timeBuffer = [initTime];
18557
+ this.eta = "0";
18558
+ }
18559
+ // add new values to calculation buffer
18560
+ update(time3, value, total) {
18561
+ this.valueBuffer.push(value);
18562
+ this.timeBuffer.push(time3);
18563
+ this.calculate(total - value);
18564
+ }
18565
+ // fetch estimated time
18566
+ getTime() {
18567
+ return this.eta;
18568
+ }
18569
+ // eta calculation - request number of remaining events
18570
+ calculate(remaining) {
18571
+ const currentBufferSize = this.valueBuffer.length;
18572
+ const buffer = Math.min(this.etaBufferLength, currentBufferSize);
18573
+ const v_diff = this.valueBuffer[currentBufferSize - 1] - this.valueBuffer[currentBufferSize - buffer];
18574
+ const t_diff = this.timeBuffer[currentBufferSize - 1] - this.timeBuffer[currentBufferSize - buffer];
18575
+ const vt_rate = v_diff / t_diff;
18576
+ this.valueBuffer = this.valueBuffer.slice(-this.etaBufferLength);
18577
+ this.timeBuffer = this.timeBuffer.slice(-this.etaBufferLength);
18578
+ const eta = Math.ceil(remaining / vt_rate / 1e3);
18579
+ if (isNaN(eta)) {
18580
+ this.eta = "NULL";
18581
+ } else if (!isFinite(eta)) {
18582
+ this.eta = "INF";
18583
+ } else if (eta > 1e7) {
18584
+ this.eta = "INF";
18585
+ } else if (eta < 0) {
18586
+ this.eta = 0;
18587
+ } else {
18588
+ this.eta = eta;
18589
+ }
18590
+ }
18591
+ };
18592
+ module2.exports = ETA;
18593
+ }
18594
+ });
18595
+
18596
+ // node_modules/cli-progress/lib/terminal.js
18597
+ var require_terminal = __commonJS({
18598
+ "node_modules/cli-progress/lib/terminal.js"(exports2, module2) {
18599
+ var _readline = require("readline");
18600
+ var Terminal = class {
18601
+ constructor(outputStream) {
18602
+ this.stream = outputStream;
18603
+ this.linewrap = true;
18604
+ this.dy = 0;
18605
+ }
18606
+ // save cursor position + settings
18607
+ cursorSave() {
18608
+ if (!this.stream.isTTY) {
18609
+ return;
18610
+ }
18611
+ this.stream.write("\x1B7");
18612
+ }
18613
+ // restore last cursor position + settings
18614
+ cursorRestore() {
18615
+ if (!this.stream.isTTY) {
18616
+ return;
18617
+ }
18618
+ this.stream.write("\x1B8");
18619
+ }
18620
+ // show/hide cursor
18621
+ cursor(enabled) {
18622
+ if (!this.stream.isTTY) {
18623
+ return;
18624
+ }
18625
+ if (enabled) {
18626
+ this.stream.write("\x1B[?25h");
18627
+ } else {
18628
+ this.stream.write("\x1B[?25l");
18629
+ }
18630
+ }
18631
+ // change cursor positionn
18632
+ cursorTo(x = null, y = null) {
18633
+ if (!this.stream.isTTY) {
18634
+ return;
18635
+ }
18636
+ _readline.cursorTo(this.stream, x, y);
18637
+ }
18638
+ // change relative cursor position
18639
+ cursorRelative(dx = null, dy = null) {
18640
+ if (!this.stream.isTTY) {
18641
+ return;
18642
+ }
18643
+ this.dy = this.dy + dy;
18644
+ _readline.moveCursor(this.stream, dx, dy);
18645
+ }
18646
+ // relative reset
18647
+ cursorRelativeReset() {
18648
+ if (!this.stream.isTTY) {
18649
+ return;
18650
+ }
18651
+ _readline.moveCursor(this.stream, 0, -this.dy);
18652
+ _readline.cursorTo(this.stream, 0, null);
18653
+ this.dy = 0;
18654
+ }
18655
+ // clear to the right from cursor
18656
+ clearRight() {
18657
+ if (!this.stream.isTTY) {
18658
+ return;
18659
+ }
18660
+ _readline.clearLine(this.stream, 1);
18661
+ }
18662
+ // clear the full line
18663
+ clearLine() {
18664
+ if (!this.stream.isTTY) {
18665
+ return;
18666
+ }
18667
+ _readline.clearLine(this.stream, 0);
18668
+ }
18669
+ // clear everyting beyond the current line
18670
+ clearBottom() {
18671
+ if (!this.stream.isTTY) {
18672
+ return;
18673
+ }
18674
+ _readline.clearScreenDown(this.stream);
18675
+ }
18676
+ // add new line; increment counter
18677
+ newline() {
18678
+ this.stream.write("\n");
18679
+ this.dy++;
18680
+ }
18681
+ // write content to output stream
18682
+ // @TODO use string-width to strip length
18683
+ write(s, rawWrite = false) {
18684
+ if (this.linewrap === true && rawWrite === false) {
18685
+ this.stream.write(s.substr(0, this.getWidth()));
18686
+ } else {
18687
+ this.stream.write(s);
18688
+ }
18689
+ }
18690
+ // control line wrapping
18691
+ lineWrapping(enabled) {
18692
+ if (!this.stream.isTTY) {
18693
+ return;
18694
+ }
18695
+ this.linewrap = enabled;
18696
+ if (enabled) {
18697
+ this.stream.write("\x1B[?7h");
18698
+ } else {
18699
+ this.stream.write("\x1B[?7l");
18700
+ }
18701
+ }
18702
+ // tty environment ?
18703
+ isTTY() {
18704
+ return this.stream.isTTY === true;
18705
+ }
18706
+ // get terminal width
18707
+ getWidth() {
18708
+ return this.stream.columns || (this.stream.isTTY ? 80 : 200);
18709
+ }
18710
+ };
18711
+ module2.exports = Terminal;
18712
+ }
18713
+ });
18714
+
18715
+ // node_modules/ansi-regex/index.js
18716
+ var require_ansi_regex = __commonJS({
18717
+ "node_modules/ansi-regex/index.js"(exports2, module2) {
18718
+ "use strict";
18719
+ module2.exports = ({ onlyFirst = false } = {}) => {
18720
+ const pattern = [
18721
+ "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
18722
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
18723
+ ].join("|");
18724
+ return new RegExp(pattern, onlyFirst ? void 0 : "g");
18725
+ };
18726
+ }
18727
+ });
18728
+
18729
+ // node_modules/strip-ansi/index.js
18730
+ var require_strip_ansi = __commonJS({
18731
+ "node_modules/strip-ansi/index.js"(exports2, module2) {
18732
+ "use strict";
18733
+ var ansiRegex = require_ansi_regex();
18734
+ module2.exports = (string4) => typeof string4 === "string" ? string4.replace(ansiRegex(), "") : string4;
18735
+ }
18736
+ });
18737
+
18738
+ // node_modules/is-fullwidth-code-point/index.js
18739
+ var require_is_fullwidth_code_point = __commonJS({
18740
+ "node_modules/is-fullwidth-code-point/index.js"(exports2, module2) {
18741
+ "use strict";
18742
+ var isFullwidthCodePoint = (codePoint) => {
18743
+ if (Number.isNaN(codePoint)) {
18744
+ return false;
18745
+ }
18746
+ if (codePoint >= 4352 && (codePoint <= 4447 || // Hangul Jamo
18747
+ codePoint === 9001 || // LEFT-POINTING ANGLE BRACKET
18748
+ codePoint === 9002 || // RIGHT-POINTING ANGLE BRACKET
18749
+ // CJK Radicals Supplement .. Enclosed CJK Letters and Months
18750
+ 11904 <= codePoint && codePoint <= 12871 && codePoint !== 12351 || // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
18751
+ 12880 <= codePoint && codePoint <= 19903 || // CJK Unified Ideographs .. Yi Radicals
18752
+ 19968 <= codePoint && codePoint <= 42182 || // Hangul Jamo Extended-A
18753
+ 43360 <= codePoint && codePoint <= 43388 || // Hangul Syllables
18754
+ 44032 <= codePoint && codePoint <= 55203 || // CJK Compatibility Ideographs
18755
+ 63744 <= codePoint && codePoint <= 64255 || // Vertical Forms
18756
+ 65040 <= codePoint && codePoint <= 65049 || // CJK Compatibility Forms .. Small Form Variants
18757
+ 65072 <= codePoint && codePoint <= 65131 || // Halfwidth and Fullwidth Forms
18758
+ 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510 || // Kana Supplement
18759
+ 110592 <= codePoint && codePoint <= 110593 || // Enclosed Ideographic Supplement
18760
+ 127488 <= codePoint && codePoint <= 127569 || // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
18761
+ 131072 <= codePoint && codePoint <= 262141)) {
18762
+ return true;
18763
+ }
18764
+ return false;
18765
+ };
18766
+ module2.exports = isFullwidthCodePoint;
18767
+ module2.exports.default = isFullwidthCodePoint;
18768
+ }
18769
+ });
18770
+
18771
+ // node_modules/emoji-regex/index.js
18772
+ var require_emoji_regex = __commonJS({
18773
+ "node_modules/emoji-regex/index.js"(exports2, module2) {
18774
+ "use strict";
18775
+ module2.exports = function() {
18776
+ 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;
18777
+ };
18778
+ }
18779
+ });
18780
+
18781
+ // node_modules/string-width/index.js
18782
+ var require_string_width = __commonJS({
18783
+ "node_modules/string-width/index.js"(exports2, module2) {
18784
+ "use strict";
18785
+ var stripAnsi = require_strip_ansi();
18786
+ var isFullwidthCodePoint = require_is_fullwidth_code_point();
18787
+ var emojiRegex = require_emoji_regex();
18788
+ var stringWidth = (string4) => {
18789
+ if (typeof string4 !== "string" || string4.length === 0) {
18790
+ return 0;
18791
+ }
18792
+ string4 = stripAnsi(string4);
18793
+ if (string4.length === 0) {
18794
+ return 0;
18795
+ }
18796
+ string4 = string4.replace(emojiRegex(), " ");
18797
+ let width = 0;
18798
+ for (let i = 0; i < string4.length; i++) {
18799
+ const code = string4.codePointAt(i);
18800
+ if (code <= 31 || code >= 127 && code <= 159) {
18801
+ continue;
18802
+ }
18803
+ if (code >= 768 && code <= 879) {
18804
+ continue;
18805
+ }
18806
+ if (code > 65535) {
18807
+ i++;
18808
+ }
18809
+ width += isFullwidthCodePoint(code) ? 2 : 1;
18810
+ }
18811
+ return width;
18812
+ };
18813
+ module2.exports = stringWidth;
18814
+ module2.exports.default = stringWidth;
18815
+ }
18816
+ });
18817
+
18818
+ // node_modules/cli-progress/lib/format-value.js
18819
+ var require_format_value = __commonJS({
18820
+ "node_modules/cli-progress/lib/format-value.js"(exports2, module2) {
18821
+ module2.exports = function formatValue(v, options, type) {
18822
+ if (options.autopadding !== true) {
18823
+ return v;
18824
+ }
18825
+ function autopadding(value, length) {
18826
+ return (options.autopaddingChar + value).slice(-length);
18827
+ }
18828
+ switch (type) {
18829
+ case "percentage":
18830
+ return autopadding(v, 3);
18831
+ default:
18832
+ return v;
18833
+ }
18834
+ };
18835
+ }
18836
+ });
18837
+
18838
+ // node_modules/cli-progress/lib/format-bar.js
18839
+ var require_format_bar = __commonJS({
18840
+ "node_modules/cli-progress/lib/format-bar.js"(exports2, module2) {
18841
+ module2.exports = function formatBar(progress2, options) {
18842
+ const completeSize = Math.round(progress2 * options.barsize);
18843
+ const incompleteSize = options.barsize - completeSize;
18844
+ return options.barCompleteString.substr(0, completeSize) + options.barGlue + options.barIncompleteString.substr(0, incompleteSize);
18845
+ };
18846
+ }
18847
+ });
18848
+
18849
+ // node_modules/cli-progress/lib/format-time.js
18850
+ var require_format_time = __commonJS({
18851
+ "node_modules/cli-progress/lib/format-time.js"(exports2, module2) {
18852
+ module2.exports = function formatTime(t, options, roundToMultipleOf) {
18853
+ function round(input) {
18854
+ if (roundToMultipleOf) {
18855
+ return roundToMultipleOf * Math.round(input / roundToMultipleOf);
18856
+ } else {
18857
+ return input;
18858
+ }
18859
+ }
18860
+ function autopadding(v) {
18861
+ return (options.autopaddingChar + v).slice(-2);
18862
+ }
18863
+ if (t > 3600) {
18864
+ return autopadding(Math.floor(t / 3600)) + "h" + autopadding(round(t % 3600 / 60)) + "m";
18865
+ } else if (t > 60) {
18866
+ return autopadding(Math.floor(t / 60)) + "m" + autopadding(round(t % 60)) + "s";
18867
+ } else if (t > 10) {
18868
+ return autopadding(round(t)) + "s";
18869
+ } else {
18870
+ return autopadding(t) + "s";
18871
+ }
18872
+ };
18873
+ }
18874
+ });
18875
+
18876
+ // node_modules/cli-progress/lib/formatter.js
18877
+ var require_formatter = __commonJS({
18878
+ "node_modules/cli-progress/lib/formatter.js"(exports2, module2) {
18879
+ var _stringWidth = require_string_width();
18880
+ var _defaultFormatValue = require_format_value();
18881
+ var _defaultFormatBar = require_format_bar();
18882
+ var _defaultFormatTime = require_format_time();
18883
+ module2.exports = function defaultFormatter(options, params, payload) {
18884
+ let s = options.format;
18885
+ const formatTime = options.formatTime || _defaultFormatTime;
18886
+ const formatValue = options.formatValue || _defaultFormatValue;
18887
+ const formatBar = options.formatBar || _defaultFormatBar;
18888
+ const percentage = Math.floor(params.progress * 100) + "";
18889
+ const stopTime = params.stopTime || Date.now();
18890
+ const elapsedTime = Math.round((stopTime - params.startTime) / 1e3);
18891
+ const context = Object.assign({}, payload, {
18892
+ bar: formatBar(params.progress, options),
18893
+ percentage: formatValue(percentage, options, "percentage"),
18894
+ total: formatValue(params.total, options, "total"),
18895
+ value: formatValue(params.value, options, "value"),
18896
+ eta: formatValue(params.eta, options, "eta"),
18897
+ eta_formatted: formatTime(params.eta, options, 5),
18898
+ duration: formatValue(elapsedTime, options, "duration"),
18899
+ duration_formatted: formatTime(elapsedTime, options, 1)
18900
+ });
18901
+ s = s.replace(/\{(\w+)\}/g, function(match, key) {
18902
+ if (typeof context[key] !== "undefined") {
18903
+ return context[key];
18904
+ }
18905
+ return match;
18906
+ });
18907
+ const fullMargin = Math.max(0, params.maxWidth - _stringWidth(s) - 2);
18908
+ const halfMargin = Math.floor(fullMargin / 2);
18909
+ switch (options.align) {
18910
+ // fill start-of-line with whitespaces
18911
+ case "right":
18912
+ s = fullMargin > 0 ? " ".repeat(fullMargin) + s : s;
18913
+ break;
18914
+ // distribute whitespaces to left+right
18915
+ case "center":
18916
+ s = halfMargin > 0 ? " ".repeat(halfMargin) + s : s;
18917
+ break;
18918
+ // default: left align, no additional whitespaces
18919
+ case "left":
18920
+ default:
18921
+ break;
18922
+ }
18923
+ return s;
18924
+ };
18925
+ }
18926
+ });
18927
+
18928
+ // node_modules/cli-progress/lib/options.js
18929
+ var require_options = __commonJS({
18930
+ "node_modules/cli-progress/lib/options.js"(exports2, module2) {
18931
+ function mergeOption(v, defaultValue) {
18932
+ if (typeof v === "undefined" || v === null) {
18933
+ return defaultValue;
18934
+ } else {
18935
+ return v;
18936
+ }
18937
+ }
18938
+ module2.exports = {
18939
+ // set global options
18940
+ parse: function parse3(rawOptions, preset) {
18941
+ const options = {};
18942
+ const opt = Object.assign({}, preset, rawOptions);
18943
+ options.throttleTime = 1e3 / mergeOption(opt.fps, 10);
18944
+ options.stream = mergeOption(opt.stream, process.stderr);
18945
+ options.terminal = mergeOption(opt.terminal, null);
18946
+ options.clearOnComplete = mergeOption(opt.clearOnComplete, false);
18947
+ options.stopOnComplete = mergeOption(opt.stopOnComplete, false);
18948
+ options.barsize = mergeOption(opt.barsize, 40);
18949
+ options.align = mergeOption(opt.align, "left");
18950
+ options.hideCursor = mergeOption(opt.hideCursor, false);
18951
+ options.linewrap = mergeOption(opt.linewrap, false);
18952
+ options.barGlue = mergeOption(opt.barGlue, "");
18953
+ options.barCompleteChar = mergeOption(opt.barCompleteChar, "=");
18954
+ options.barIncompleteChar = mergeOption(opt.barIncompleteChar, "-");
18955
+ options.format = mergeOption(opt.format, "progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}");
18956
+ options.formatTime = mergeOption(opt.formatTime, null);
18957
+ options.formatValue = mergeOption(opt.formatValue, null);
18958
+ options.formatBar = mergeOption(opt.formatBar, null);
18959
+ options.etaBufferLength = mergeOption(opt.etaBuffer, 10);
18960
+ options.etaAsynchronousUpdate = mergeOption(opt.etaAsynchronousUpdate, false);
18961
+ options.progressCalculationRelative = mergeOption(opt.progressCalculationRelative, false);
18962
+ options.synchronousUpdate = mergeOption(opt.synchronousUpdate, true);
18963
+ options.noTTYOutput = mergeOption(opt.noTTYOutput, false);
18964
+ options.notTTYSchedule = mergeOption(opt.notTTYSchedule, 2e3);
18965
+ options.emptyOnZero = mergeOption(opt.emptyOnZero, false);
18966
+ options.forceRedraw = mergeOption(opt.forceRedraw, false);
18967
+ options.autopadding = mergeOption(opt.autopadding, false);
18968
+ options.gracefulExit = mergeOption(opt.gracefulExit, false);
18969
+ return options;
18970
+ },
18971
+ // derived options: instance specific, has to be created for every bar element
18972
+ assignDerivedOptions: function assignDerivedOptions(options) {
18973
+ options.barCompleteString = options.barCompleteChar.repeat(options.barsize + 1);
18974
+ options.barIncompleteString = options.barIncompleteChar.repeat(options.barsize + 1);
18975
+ options.autopaddingChar = options.autopadding ? mergeOption(options.autopaddingChar, " ") : "";
18976
+ return options;
18977
+ }
18978
+ };
18979
+ }
18980
+ });
18981
+
18982
+ // node_modules/cli-progress/lib/generic-bar.js
18983
+ var require_generic_bar = __commonJS({
18984
+ "node_modules/cli-progress/lib/generic-bar.js"(exports2, module2) {
18985
+ var _ETA = require_eta();
18986
+ var _Terminal = require_terminal();
18987
+ var _formatter = require_formatter();
18988
+ var _options = require_options();
18989
+ var _EventEmitter = require("events");
18990
+ module2.exports = class GenericBar extends _EventEmitter {
18991
+ constructor(options) {
18992
+ super();
18993
+ this.options = _options.assignDerivedOptions(options);
18994
+ this.terminal = this.options.terminal ? this.options.terminal : new _Terminal(this.options.stream);
18995
+ this.value = 0;
18996
+ this.startValue = 0;
18997
+ this.total = 100;
18998
+ this.lastDrawnString = null;
18999
+ this.startTime = null;
19000
+ this.stopTime = null;
19001
+ this.lastRedraw = Date.now();
19002
+ this.eta = new _ETA(this.options.etaBufferLength, 0, 0);
19003
+ this.payload = {};
19004
+ this.isActive = false;
19005
+ this.formatter = typeof this.options.format === "function" ? this.options.format : _formatter;
19006
+ }
19007
+ // internal render function
19008
+ render(forceRendering = false) {
19009
+ const params = {
19010
+ progress: this.getProgress(),
19011
+ eta: this.eta.getTime(),
19012
+ startTime: this.startTime,
19013
+ stopTime: this.stopTime,
19014
+ total: this.total,
19015
+ value: this.value,
19016
+ maxWidth: this.terminal.getWidth()
19017
+ };
19018
+ if (this.options.etaAsynchronousUpdate) {
19019
+ this.updateETA();
19020
+ }
19021
+ const s = this.formatter(this.options, params, this.payload);
19022
+ const forceRedraw = forceRendering || this.options.forceRedraw || this.options.noTTYOutput && !this.terminal.isTTY();
19023
+ if (forceRedraw || this.lastDrawnString != s) {
19024
+ this.emit("redraw-pre");
19025
+ this.terminal.cursorTo(0, null);
19026
+ this.terminal.write(s);
19027
+ this.terminal.clearRight();
19028
+ this.lastDrawnString = s;
19029
+ this.lastRedraw = Date.now();
19030
+ this.emit("redraw-post");
19031
+ }
19032
+ }
19033
+ // start the progress bar
19034
+ start(total, startValue, payload) {
19035
+ this.value = startValue || 0;
19036
+ this.total = typeof total !== "undefined" && total >= 0 ? total : 100;
19037
+ this.startValue = startValue || 0;
19038
+ this.payload = payload || {};
19039
+ this.startTime = Date.now();
19040
+ this.stopTime = null;
19041
+ this.lastDrawnString = "";
19042
+ this.eta = new _ETA(this.options.etaBufferLength, this.startTime, this.value);
19043
+ this.isActive = true;
19044
+ this.emit("start", total, startValue);
19045
+ }
19046
+ // stop the bar
19047
+ stop() {
19048
+ this.isActive = false;
19049
+ this.stopTime = Date.now();
19050
+ this.emit("stop", this.total, this.value);
19051
+ }
19052
+ // update the bar value
19053
+ // update(value, payload)
19054
+ // update(payload)
19055
+ update(arg0, arg1 = {}) {
19056
+ if (typeof arg0 === "number") {
19057
+ this.value = arg0;
19058
+ this.eta.update(Date.now(), arg0, this.total);
19059
+ }
19060
+ const payloadData = (typeof arg0 === "object" ? arg0 : arg1) || {};
19061
+ this.emit("update", this.total, this.value);
19062
+ for (const key in payloadData) {
19063
+ this.payload[key] = payloadData[key];
19064
+ }
19065
+ if (this.value >= this.getTotal() && this.options.stopOnComplete) {
19066
+ this.stop();
19067
+ }
19068
+ }
19069
+ // calculate the actual progress value
19070
+ getProgress() {
19071
+ let progress2 = this.value / this.total;
19072
+ if (this.options.progressCalculationRelative) {
19073
+ progress2 = (this.value - this.startValue) / (this.total - this.startValue);
19074
+ }
19075
+ if (isNaN(progress2)) {
19076
+ progress2 = this.options && this.options.emptyOnZero ? 0 : 1;
19077
+ }
19078
+ progress2 = Math.min(Math.max(progress2, 0), 1);
19079
+ return progress2;
19080
+ }
19081
+ // update the bar value
19082
+ // increment(delta, payload)
19083
+ // increment(payload)
19084
+ increment(arg0 = 1, arg1 = {}) {
19085
+ if (typeof arg0 === "object") {
19086
+ this.update(this.value + 1, arg0);
19087
+ } else {
19088
+ this.update(this.value + arg0, arg1);
19089
+ }
19090
+ }
19091
+ // get the total (limit) value
19092
+ getTotal() {
19093
+ return this.total;
19094
+ }
19095
+ // set the total (limit) value
19096
+ setTotal(total) {
19097
+ if (typeof total !== "undefined" && total >= 0) {
19098
+ this.total = total;
19099
+ }
19100
+ }
19101
+ // force eta calculation update (long running processes)
19102
+ updateETA() {
19103
+ this.eta.update(Date.now(), this.value, this.total);
19104
+ }
19105
+ };
19106
+ }
19107
+ });
19108
+
19109
+ // node_modules/cli-progress/lib/single-bar.js
19110
+ var require_single_bar = __commonJS({
19111
+ "node_modules/cli-progress/lib/single-bar.js"(exports2, module2) {
19112
+ var _GenericBar = require_generic_bar();
19113
+ var _options = require_options();
19114
+ module2.exports = class SingleBar extends _GenericBar {
19115
+ constructor(options, preset) {
19116
+ super(_options.parse(options, preset));
19117
+ this.timer = null;
19118
+ if (this.options.noTTYOutput && this.terminal.isTTY() === false) {
19119
+ this.options.synchronousUpdate = false;
19120
+ }
19121
+ this.schedulingRate = this.terminal.isTTY() ? this.options.throttleTime : this.options.notTTYSchedule;
19122
+ this.sigintCallback = null;
19123
+ }
19124
+ // internal render function
19125
+ render() {
19126
+ if (this.timer) {
19127
+ clearTimeout(this.timer);
19128
+ this.timer = null;
19129
+ }
19130
+ super.render();
19131
+ if (this.options.noTTYOutput && this.terminal.isTTY() === false) {
19132
+ this.terminal.newline();
19133
+ }
19134
+ this.timer = setTimeout(this.render.bind(this), this.schedulingRate);
19135
+ }
19136
+ update(current, payload) {
19137
+ if (!this.timer) {
19138
+ return;
19139
+ }
19140
+ super.update(current, payload);
19141
+ if (this.options.synchronousUpdate && this.lastRedraw + this.options.throttleTime * 2 < Date.now()) {
19142
+ this.render();
19143
+ }
19144
+ }
19145
+ // start the progress bar
19146
+ start(total, startValue, payload) {
19147
+ if (this.options.noTTYOutput === false && this.terminal.isTTY() === false) {
19148
+ return;
19149
+ }
19150
+ if (this.sigintCallback === null && this.options.gracefulExit) {
19151
+ this.sigintCallback = this.stop.bind(this);
19152
+ process.once("SIGINT", this.sigintCallback);
19153
+ process.once("SIGTERM", this.sigintCallback);
19154
+ }
19155
+ this.terminal.cursorSave();
19156
+ if (this.options.hideCursor === true) {
19157
+ this.terminal.cursor(false);
19158
+ }
19159
+ if (this.options.linewrap === false) {
19160
+ this.terminal.lineWrapping(false);
19161
+ }
19162
+ super.start(total, startValue, payload);
19163
+ this.render();
19164
+ }
19165
+ // stop the bar
19166
+ stop() {
19167
+ if (!this.timer) {
19168
+ return;
19169
+ }
19170
+ if (this.sigintCallback) {
19171
+ process.removeListener("SIGINT", this.sigintCallback);
19172
+ process.removeListener("SIGTERM", this.sigintCallback);
19173
+ this.sigintCallback = null;
19174
+ }
19175
+ this.render();
19176
+ super.stop();
19177
+ clearTimeout(this.timer);
19178
+ this.timer = null;
19179
+ if (this.options.hideCursor === true) {
19180
+ this.terminal.cursor(true);
19181
+ }
19182
+ if (this.options.linewrap === false) {
19183
+ this.terminal.lineWrapping(true);
19184
+ }
19185
+ this.terminal.cursorRestore();
19186
+ if (this.options.clearOnComplete) {
19187
+ this.terminal.cursorTo(0, null);
19188
+ this.terminal.clearLine();
19189
+ } else {
19190
+ this.terminal.newline();
19191
+ }
19192
+ }
19193
+ };
19194
+ }
19195
+ });
19196
+
19197
+ // node_modules/cli-progress/lib/multi-bar.js
19198
+ var require_multi_bar = __commonJS({
19199
+ "node_modules/cli-progress/lib/multi-bar.js"(exports2, module2) {
19200
+ var _Terminal = require_terminal();
19201
+ var _BarElement = require_generic_bar();
19202
+ var _options = require_options();
19203
+ var _EventEmitter = require("events");
19204
+ module2.exports = class MultiBar extends _EventEmitter {
19205
+ constructor(options, preset) {
19206
+ super();
19207
+ this.bars = [];
19208
+ this.options = _options.parse(options, preset);
19209
+ this.options.synchronousUpdate = false;
19210
+ this.terminal = this.options.terminal ? this.options.terminal : new _Terminal(this.options.stream);
19211
+ this.timer = null;
19212
+ this.isActive = false;
19213
+ this.schedulingRate = this.terminal.isTTY() ? this.options.throttleTime : this.options.notTTYSchedule;
19214
+ this.loggingBuffer = [];
19215
+ this.sigintCallback = null;
19216
+ }
19217
+ // add a new bar to the stack
19218
+ create(total, startValue, payload, barOptions = {}) {
19219
+ const bar = new _BarElement(Object.assign(
19220
+ {},
19221
+ // global options
19222
+ this.options,
19223
+ // terminal instance
19224
+ {
19225
+ terminal: this.terminal
19226
+ },
19227
+ // overrides
19228
+ barOptions
19229
+ ));
19230
+ this.bars.push(bar);
19231
+ if (this.options.noTTYOutput === false && this.terminal.isTTY() === false) {
19232
+ return bar;
19233
+ }
19234
+ if (this.sigintCallback === null && this.options.gracefulExit) {
19235
+ this.sigintCallback = this.stop.bind(this);
19236
+ process.once("SIGINT", this.sigintCallback);
19237
+ process.once("SIGTERM", this.sigintCallback);
19238
+ }
19239
+ if (!this.isActive) {
19240
+ if (this.options.hideCursor === true) {
19241
+ this.terminal.cursor(false);
19242
+ }
19243
+ if (this.options.linewrap === false) {
19244
+ this.terminal.lineWrapping(false);
19245
+ }
19246
+ this.timer = setTimeout(this.update.bind(this), this.schedulingRate);
19247
+ }
19248
+ this.isActive = true;
19249
+ bar.start(total, startValue, payload);
19250
+ this.emit("start");
19251
+ return bar;
19252
+ }
19253
+ // remove a bar from the stack
19254
+ remove(bar) {
19255
+ const index = this.bars.indexOf(bar);
19256
+ if (index < 0) {
19257
+ return false;
19258
+ }
19259
+ this.bars.splice(index, 1);
19260
+ this.update();
19261
+ this.terminal.newline();
19262
+ this.terminal.clearBottom();
19263
+ return true;
19264
+ }
19265
+ // internal update routine
19266
+ update() {
19267
+ if (this.timer) {
19268
+ clearTimeout(this.timer);
19269
+ this.timer = null;
19270
+ }
19271
+ this.emit("update-pre");
19272
+ this.terminal.cursorRelativeReset();
19273
+ this.emit("redraw-pre");
19274
+ if (this.loggingBuffer.length > 0) {
19275
+ this.terminal.clearLine();
19276
+ while (this.loggingBuffer.length > 0) {
19277
+ this.terminal.write(this.loggingBuffer.shift(), true);
19278
+ }
19279
+ }
19280
+ for (let i = 0; i < this.bars.length; i++) {
19281
+ if (i > 0) {
19282
+ this.terminal.newline();
19283
+ }
19284
+ this.bars[i].render();
19285
+ }
19286
+ this.emit("redraw-post");
19287
+ if (this.options.noTTYOutput && this.terminal.isTTY() === false) {
19288
+ this.terminal.newline();
19289
+ this.terminal.newline();
19290
+ }
19291
+ this.timer = setTimeout(this.update.bind(this), this.schedulingRate);
19292
+ this.emit("update-post");
19293
+ if (this.options.stopOnComplete && !this.bars.find((bar) => bar.isActive)) {
19294
+ this.stop();
19295
+ }
19296
+ }
19297
+ stop() {
19298
+ clearTimeout(this.timer);
19299
+ this.timer = null;
19300
+ if (this.sigintCallback) {
19301
+ process.removeListener("SIGINT", this.sigintCallback);
19302
+ process.removeListener("SIGTERM", this.sigintCallback);
19303
+ this.sigintCallback = null;
19304
+ }
19305
+ this.isActive = false;
19306
+ if (this.options.hideCursor === true) {
19307
+ this.terminal.cursor(true);
19308
+ }
19309
+ if (this.options.linewrap === false) {
19310
+ this.terminal.lineWrapping(true);
19311
+ }
19312
+ this.terminal.cursorRelativeReset();
19313
+ this.emit("stop-pre-clear");
19314
+ if (this.options.clearOnComplete) {
19315
+ this.terminal.clearBottom();
19316
+ } else {
19317
+ for (let i = 0; i < this.bars.length; i++) {
19318
+ if (i > 0) {
19319
+ this.terminal.newline();
19320
+ }
19321
+ this.bars[i].render();
19322
+ this.bars[i].stop();
19323
+ }
19324
+ this.terminal.newline();
19325
+ }
19326
+ this.emit("stop");
19327
+ }
19328
+ log(s) {
19329
+ this.loggingBuffer.push(s);
19330
+ }
19331
+ };
19332
+ }
19333
+ });
19334
+
19335
+ // node_modules/cli-progress/presets/legacy.js
19336
+ var require_legacy = __commonJS({
19337
+ "node_modules/cli-progress/presets/legacy.js"(exports2, module2) {
19338
+ module2.exports = {
19339
+ format: "progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}",
19340
+ barCompleteChar: "=",
19341
+ barIncompleteChar: "-"
19342
+ };
19343
+ }
19344
+ });
19345
+
19346
+ // node_modules/cli-progress/presets/shades-classic.js
19347
+ var require_shades_classic = __commonJS({
19348
+ "node_modules/cli-progress/presets/shades-classic.js"(exports2, module2) {
19349
+ module2.exports = {
19350
+ format: " {bar} {percentage}% | ETA: {eta}s | {value}/{total}",
19351
+ barCompleteChar: "\u2588",
19352
+ barIncompleteChar: "\u2591"
19353
+ };
19354
+ }
19355
+ });
19356
+
19357
+ // node_modules/cli-progress/presets/shades-grey.js
19358
+ var require_shades_grey = __commonJS({
19359
+ "node_modules/cli-progress/presets/shades-grey.js"(exports2, module2) {
19360
+ module2.exports = {
19361
+ format: " \x1B[90m{bar}\x1B[0m {percentage}% | ETA: {eta}s | {value}/{total}",
19362
+ barCompleteChar: "\u2588",
19363
+ barIncompleteChar: "\u2591"
19364
+ };
19365
+ }
19366
+ });
19367
+
19368
+ // node_modules/cli-progress/presets/rect.js
19369
+ var require_rect = __commonJS({
19370
+ "node_modules/cli-progress/presets/rect.js"(exports2, module2) {
19371
+ module2.exports = {
19372
+ format: " {bar}\u25A0 {percentage}% | ETA: {eta}s | {value}/{total}",
19373
+ barCompleteChar: "\u25A0",
19374
+ barIncompleteChar: " "
19375
+ };
19376
+ }
19377
+ });
19378
+
19379
+ // node_modules/cli-progress/presets/index.js
19380
+ var require_presets = __commonJS({
19381
+ "node_modules/cli-progress/presets/index.js"(exports2, module2) {
19382
+ var _legacy = require_legacy();
19383
+ var _shades_classic = require_shades_classic();
19384
+ var _shades_grey = require_shades_grey();
19385
+ var _rect = require_rect();
19386
+ module2.exports = {
19387
+ legacy: _legacy,
19388
+ shades_classic: _shades_classic,
19389
+ shades_grey: _shades_grey,
19390
+ rect: _rect
19391
+ };
19392
+ }
19393
+ });
19394
+
19395
+ // node_modules/cli-progress/cli-progress.js
19396
+ var require_cli_progress = __commonJS({
19397
+ "node_modules/cli-progress/cli-progress.js"(exports2, module2) {
19398
+ var _SingleBar = require_single_bar();
19399
+ var _MultiBar = require_multi_bar();
19400
+ var _Presets = require_presets();
19401
+ var _Formatter = require_formatter();
19402
+ var _defaultFormatValue = require_format_value();
19403
+ var _defaultFormatBar = require_format_bar();
19404
+ var _defaultFormatTime = require_format_time();
19405
+ module2.exports = {
19406
+ Bar: _SingleBar,
19407
+ SingleBar: _SingleBar,
19408
+ MultiBar: _MultiBar,
19409
+ Presets: _Presets,
19410
+ Format: {
19411
+ Formatter: _Formatter,
19412
+ BarFormat: _defaultFormatBar,
19413
+ ValueFormat: _defaultFormatValue,
19414
+ TimeFormat: _defaultFormatTime
19415
+ }
19416
+ };
19417
+ }
19418
+ });
19419
+
18549
19420
  // node_modules/color-name/index.js
18550
19421
  var require_color_name = __commonJS({
18551
19422
  "node_modules/color-name/index.js"(exports2, module2) {
@@ -19863,14 +20734,14 @@ var require_templates = __commonJS({
19863
20734
  }
19864
20735
  return results;
19865
20736
  }
19866
- function buildStyle(chalk2, styles) {
20737
+ function buildStyle(chalk3, styles) {
19867
20738
  const enabled = {};
19868
20739
  for (const layer of styles) {
19869
20740
  for (const style of layer.styles) {
19870
20741
  enabled[style[0]] = layer.inverse ? null : style.slice(1);
19871
20742
  }
19872
20743
  }
19873
- let current = chalk2;
20744
+ let current = chalk3;
19874
20745
  for (const [styleName, styles2] of Object.entries(enabled)) {
19875
20746
  if (!Array.isArray(styles2)) {
19876
20747
  continue;
@@ -19882,7 +20753,7 @@ var require_templates = __commonJS({
19882
20753
  }
19883
20754
  return current;
19884
20755
  }
19885
- module2.exports = (chalk2, temporary) => {
20756
+ module2.exports = (chalk3, temporary) => {
19886
20757
  const styles = [];
19887
20758
  const chunks = [];
19888
20759
  let chunk = [];
@@ -19892,13 +20763,13 @@ var require_templates = __commonJS({
19892
20763
  } else if (style) {
19893
20764
  const string4 = chunk.join("");
19894
20765
  chunk = [];
19895
- chunks.push(styles.length === 0 ? string4 : buildStyle(chalk2, styles)(string4));
20766
+ chunks.push(styles.length === 0 ? string4 : buildStyle(chalk3, styles)(string4));
19896
20767
  styles.push({ inverse, styles: parseStyle(style) });
19897
20768
  } else if (close) {
19898
20769
  if (styles.length === 0) {
19899
20770
  throw new Error("Found extraneous } in Chalk template literal");
19900
20771
  }
19901
- chunks.push(buildStyle(chalk2, styles)(chunk.join("")));
20772
+ chunks.push(buildStyle(chalk3, styles)(chunk.join("")));
19902
20773
  chunk = [];
19903
20774
  styles.pop();
19904
20775
  } else {
@@ -19946,16 +20817,16 @@ var require_source = __commonJS({
19946
20817
  }
19947
20818
  };
19948
20819
  var chalkFactory = (options) => {
19949
- const chalk3 = {};
19950
- applyOptions(chalk3, options);
19951
- chalk3.template = (...arguments_) => chalkTag(chalk3.template, ...arguments_);
19952
- Object.setPrototypeOf(chalk3, Chalk.prototype);
19953
- Object.setPrototypeOf(chalk3.template, chalk3);
19954
- chalk3.template.constructor = () => {
20820
+ const chalk4 = {};
20821
+ applyOptions(chalk4, options);
20822
+ chalk4.template = (...arguments_) => chalkTag(chalk4.template, ...arguments_);
20823
+ Object.setPrototypeOf(chalk4, Chalk.prototype);
20824
+ Object.setPrototypeOf(chalk4.template, chalk4);
20825
+ chalk4.template.constructor = () => {
19955
20826
  throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
19956
20827
  };
19957
- chalk3.template.Instance = ChalkClass;
19958
- return chalk3.template;
20828
+ chalk4.template.Instance = ChalkClass;
20829
+ return chalk4.template;
19959
20830
  };
19960
20831
  function Chalk(options) {
19961
20832
  return chalkFactory(options);
@@ -20066,7 +20937,7 @@ var require_source = __commonJS({
20066
20937
  return openAll + string4 + closeAll;
20067
20938
  };
20068
20939
  var template;
20069
- var chalkTag = (chalk3, ...strings) => {
20940
+ var chalkTag = (chalk4, ...strings) => {
20070
20941
  const [firstString] = strings;
20071
20942
  if (!isArray(firstString) || !isArray(firstString.raw)) {
20072
20943
  return strings.join(" ");
@@ -20082,14 +20953,14 @@ var require_source = __commonJS({
20082
20953
  if (template === void 0) {
20083
20954
  template = require_templates();
20084
20955
  }
20085
- return template(chalk3, parts.join(""));
20956
+ return template(chalk4, parts.join(""));
20086
20957
  };
20087
20958
  Object.defineProperties(Chalk.prototype, styles);
20088
- var chalk2 = Chalk();
20089
- chalk2.supportsColor = stdoutColor;
20090
- chalk2.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
20091
- chalk2.stderr.supportsColor = stderrColor;
20092
- module2.exports = chalk2;
20959
+ var chalk3 = Chalk();
20960
+ chalk3.supportsColor = stdoutColor;
20961
+ chalk3.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
20962
+ chalk3.stderr.supportsColor = stderrColor;
20963
+ module2.exports = chalk3;
20093
20964
  }
20094
20965
  });
20095
20966
 
@@ -35048,8 +35919,8 @@ var ConfigSchema = external_exports.object({
35048
35919
  }).strict().superRefine(validateCrossDatabase);
35049
35920
 
35050
35921
  // lib/constants.ts
35051
- var SDK_TITLE = "RevenexxAPIRevenexx";
35052
- var SDK_VERSION = "0.0.6";
35922
+ var SDK_TITLE = "Revenexx";
35923
+ var SDK_VERSION = "0.0.8";
35053
35924
  var SDK_NAME = "Revenexx CLI";
35054
35925
  var SDK_PLATFORM = "";
35055
35926
  var SDK_LANGUAGE = "cli";
@@ -35059,6 +35930,9 @@ var NPM_REGISTRY_URL = `https://registry.npmjs.org/${NPM_PACKAGE_NAME}/latest`;
35059
35930
  var GITHUB_REPO = "revenexx-sdks/cli";
35060
35931
  var GITHUB_RELEASES_URL = `https://github.com/${GITHUB_REPO}/releases`;
35061
35932
  var DEFAULT_ENDPOINT = "https://api.revenexx.com/v1";
35933
+ var SSO_ISSUER = process.env.REVENEXX_SSO_ISSUER || "https://id.revenexx.com";
35934
+ var SSO_CLIENT_ID = process.env.REVENEXX_SSO_CLIENT_ID || "378821498762167046";
35935
+ var SSO_REDIRECT_URI = process.env.REVENEXX_SSO_REDIRECT_URI || "http://127.0.0.1:8000/callback";
35062
35936
 
35063
35937
  // lib/json.ts
35064
35938
  var import_json_bigint = __toESM(require_json_bigint(), 1);
@@ -35183,13 +36057,23 @@ var Config = class {
35183
36057
  }
35184
36058
  }
35185
36059
  write() {
36060
+ this.writeSecure(JSONBig.stringify(this.data, null, 4));
36061
+ }
36062
+ /**
36063
+ * Persist `serialized` to `this.path` with owner-only permissions. The
36064
+ * containing directory is created `0o700` and the file `0o600`; because
36065
+ * `writeFileSync`'s `mode` only applies when the file is *created*, the
36066
+ * mode is reasserted with `chmodSync` on every write to repair drift on
36067
+ * files that predate this hardening or were written under a loose umask.
36068
+ */
36069
+ writeSecure(serialized) {
35186
36070
  const dir = import_path.default.dirname(this.path);
35187
- if (!import_fs.default.existsSync(dir)) {
35188
- import_fs.default.mkdirSync(dir, { recursive: true });
36071
+ import_fs.default.mkdirSync(dir, { recursive: true, mode: 448 });
36072
+ import_fs.default.writeFileSync(this.path, serialized, { mode: 384 });
36073
+ try {
36074
+ import_fs.default.chmodSync(this.path, 384);
36075
+ } catch {
35189
36076
  }
35190
- import_fs.default.writeFileSync(this.path, JSONBig.stringify(this.data, null, 4), {
35191
- mode: 384
35192
- });
35193
36077
  }
35194
36078
  get(key) {
35195
36079
  return this.data[key];
@@ -35269,14 +36153,7 @@ var Local = class _Local extends Config {
35269
36153
  this.configDirectoryPath = import_path.default.dirname(absolutePath);
35270
36154
  }
35271
36155
  write() {
35272
- const dir = import_path.default.dirname(this.path);
35273
- if (!import_fs.default.existsSync(dir)) {
35274
- import_fs.default.mkdirSync(dir, { recursive: true });
35275
- }
35276
- const orderedData = orderConfigKeys(this.data);
35277
- import_fs.default.writeFileSync(this.path, JSONBig.stringify(orderedData, null, 4), {
35278
- mode: 384
35279
- });
36156
+ this.writeSecure(JSONBig.stringify(orderConfigKeys(this.data), null, 4));
35280
36157
  }
35281
36158
  static findConfigFile(filename) {
35282
36159
  let currentPath = import_process.default.cwd();
@@ -35602,6 +36479,10 @@ var Global = class _Global extends Config {
35602
36479
  static PREFERENCE_KEY = "key";
35603
36480
  static PREFERENCE_LOCALE = "locale";
35604
36481
  static PREFERENCE_MODE = "mode";
36482
+ static PREFERENCE_JWT = "jwt";
36483
+ static PREFERENCE_REFRESH_TOKEN = "refreshToken";
36484
+ static PREFERENCE_JWT_EXPIRES = "jwtExpiresAt";
36485
+ static PREFERENCE_AUTH_METHOD = "authMethod";
35605
36486
  static IGNORE_ATTRIBUTES = [
35606
36487
  _Global.PREFERENCE_CURRENT,
35607
36488
  _Global.PREFERENCE_SELF_SIGNED,
@@ -35610,7 +36491,11 @@ var Global = class _Global extends Config {
35610
36491
  _Global.PREFERENCE_PROJECT,
35611
36492
  _Global.PREFERENCE_KEY,
35612
36493
  _Global.PREFERENCE_LOCALE,
35613
- _Global.PREFERENCE_MODE
36494
+ _Global.PREFERENCE_MODE,
36495
+ _Global.PREFERENCE_JWT,
36496
+ _Global.PREFERENCE_REFRESH_TOKEN,
36497
+ _Global.PREFERENCE_JWT_EXPIRES,
36498
+ _Global.PREFERENCE_AUTH_METHOD
35614
36499
  ];
35615
36500
  static MODE_ADMIN = "admin";
35616
36501
  static MODE_DEFAULT = "default";
@@ -35619,6 +36504,13 @@ var Global = class _Global extends Config {
35619
36504
  const homeDir = import_os.default.homedir();
35620
36505
  super(`${homeDir}/${path}`);
35621
36506
  }
36507
+ write() {
36508
+ super.write();
36509
+ try {
36510
+ import_fs.default.chmodSync(import_path.default.dirname(this.path), 448);
36511
+ } catch {
36512
+ }
36513
+ }
35622
36514
  getCurrentSession() {
35623
36515
  if (!this.has(_Global.PREFERENCE_CURRENT)) {
35624
36516
  return "";
@@ -35716,6 +36608,42 @@ var Global = class _Global extends Config {
35716
36608
  setKey(key) {
35717
36609
  this.setTo(_Global.PREFERENCE_KEY, key);
35718
36610
  }
36611
+ getJWT() {
36612
+ if (!this.hasFrom(_Global.PREFERENCE_JWT)) {
36613
+ return "";
36614
+ }
36615
+ return this.getFrom(_Global.PREFERENCE_JWT);
36616
+ }
36617
+ setJWT(jwt2) {
36618
+ this.setTo(_Global.PREFERENCE_JWT, jwt2);
36619
+ }
36620
+ getRefreshToken() {
36621
+ if (!this.hasFrom(_Global.PREFERENCE_REFRESH_TOKEN)) {
36622
+ return "";
36623
+ }
36624
+ return this.getFrom(_Global.PREFERENCE_REFRESH_TOKEN);
36625
+ }
36626
+ setRefreshToken(refreshToken) {
36627
+ this.setTo(_Global.PREFERENCE_REFRESH_TOKEN, refreshToken);
36628
+ }
36629
+ getJwtExpires() {
36630
+ if (!this.hasFrom(_Global.PREFERENCE_JWT_EXPIRES)) {
36631
+ return 0;
36632
+ }
36633
+ return this.getFrom(_Global.PREFERENCE_JWT_EXPIRES);
36634
+ }
36635
+ setJwtExpires(expiresAt) {
36636
+ this.setTo(_Global.PREFERENCE_JWT_EXPIRES, expiresAt);
36637
+ }
36638
+ getAuthMethod() {
36639
+ if (!this.hasFrom(_Global.PREFERENCE_AUTH_METHOD)) {
36640
+ return "";
36641
+ }
36642
+ return this.getFrom(_Global.PREFERENCE_AUTH_METHOD);
36643
+ }
36644
+ setAuthMethod(authMethod) {
36645
+ this.setTo(_Global.PREFERENCE_AUTH_METHOD, authMethod);
36646
+ }
35719
36647
  hasFrom(key) {
35720
36648
  const current = this.getCurrentSession();
35721
36649
  if (current) {
@@ -35743,32 +36671,151 @@ var Global = class _Global extends Config {
35743
36671
  var localConfig = new Local();
35744
36672
  var globalConfig2 = new Global();
35745
36673
 
35746
- // lib/client.ts
36674
+ // lib/spinner.ts
36675
+ var import_cli_progress = __toESM(require_cli_progress(), 1);
35747
36676
  var import_chalk = __toESM(require_source(), 1);
36677
+ var SPINNER_ARC = "arc";
36678
+ var SPINNER_DOTS = "dots";
36679
+ var spinners = {
36680
+ [SPINNER_ARC]: {
36681
+ interval: 100,
36682
+ frames: ["\u25DC", "\u25E0", "\u25DD", "\u25DE", "\u25E1", "\u25DF"]
36683
+ },
36684
+ [SPINNER_DOTS]: {
36685
+ interval: 80,
36686
+ frames: ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"]
36687
+ }
36688
+ };
36689
+ var requestSpinnerEnabled = false;
36690
+ var requestSpinnerActive = false;
36691
+ var multibarActive = false;
36692
+ var startRequestSpinner = (label = "Loading\u2026") => {
36693
+ if (!requestSpinnerEnabled || requestSpinnerActive || multibarActive || !process.stderr.isTTY) {
36694
+ return () => {
36695
+ };
36696
+ }
36697
+ requestSpinnerActive = true;
36698
+ const { frames, interval } = spinners[SPINNER_DOTS];
36699
+ let frame = 0;
36700
+ const render = () => {
36701
+ process.stderr.write(
36702
+ `\r${import_chalk.default.cyan(frames[frame])} ${import_chalk.default.dim(label)}`
36703
+ );
36704
+ frame = (frame + 1) % frames.length;
36705
+ };
36706
+ render();
36707
+ const timer = setInterval(render, interval);
36708
+ timer.unref();
36709
+ return () => {
36710
+ clearInterval(timer);
36711
+ requestSpinnerActive = false;
36712
+ process.stderr.write("\r\x1B[2K");
36713
+ };
36714
+ };
36715
+
36716
+ // lib/redact.ts
36717
+ var redactSecrets = (input) => {
36718
+ if (input === null || input === void 0) return "";
36719
+ let s = typeof input === "string" ? input : String(input);
36720
+ s = s.replace(/standard_[A-Za-z0-9]{32,}/g, "standard_***");
36721
+ s = s.replace(/rvxk_[A-Za-z0-9]{16,}/g, "rvxk_***");
36722
+ s = s.replace(
36723
+ /(X-Revenexx-(?:Api-Key|Key|Cookie|JWT|Session|Dev-Key|Mode))(\s*[:=]\s*)([^\s,'"`}\]]+)/gi,
36724
+ "$1$2***"
36725
+ );
36726
+ s = s.replace(/(Bearer\s+)([A-Za-z0-9._\-]{20,})/gi, "$1***");
36727
+ s = s.replace(/(a_session[a-z0-9_]*=)([^\s;,'"`]+)/gi, "$1***");
36728
+ s = s.replace(
36729
+ /\b(REVENEXX_(?:TOKEN|API_KEY|KEY|COOKIE)\s*=\s*)([^\s;'"`]+)/g,
36730
+ "$1***"
36731
+ );
36732
+ s = s.replace(
36733
+ /(["'`]?(?:token|api[_-]?key|secret|password|cookie|key|access_token|id_token|refresh_token)["'`]?\s*[:=]\s*["'`]?)([^"'`\s,;}\]]{4,})/gi,
36734
+ "$1***"
36735
+ );
36736
+ s = s.replace(/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]+/g, "eyJ***");
36737
+ return s;
36738
+ };
36739
+
36740
+ // lib/client.ts
36741
+ var import_chalk2 = __toESM(require_source(), 1);
35748
36742
  var perf = globalThis.performance;
35749
36743
  if (typeof perf.markResourceTiming !== "function") {
35750
36744
  perf.markResourceTiming = () => {
35751
36745
  };
35752
36746
  }
36747
+ var DEFAULT_TIMEOUT_MS = 3e4;
36748
+ var CONNECT_TIMEOUT_MS = 1e4;
36749
+ var DEFAULT_MAX_RETRIES = 3;
36750
+ var RETRY_BASE_DELAY_MS = 300;
36751
+ var RETRY_MAX_DELAY_MS = 5e3;
36752
+ var RETRY_AFTER_MAX_MS = 6e4;
36753
+ var IDEMPOTENT_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD", "PUT", "DELETE", "OPTIONS"]);
36754
+ var RETRYABLE_STATUS = /* @__PURE__ */ new Set([429, 502, 503, 504]);
36755
+ var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
36756
+ var parseRetryAfter = (value) => {
36757
+ if (!value) return null;
36758
+ const seconds = Number(value);
36759
+ if (Number.isFinite(seconds)) {
36760
+ return Math.min(Math.max(seconds, 0) * 1e3, RETRY_AFTER_MAX_MS);
36761
+ }
36762
+ const date5 = Date.parse(value);
36763
+ if (!Number.isNaN(date5)) {
36764
+ return Math.min(Math.max(date5 - Date.now(), 0), RETRY_AFTER_MAX_MS);
36765
+ }
36766
+ return null;
36767
+ };
36768
+ var backoffDelay = (attempt) => {
36769
+ const ceiling = Math.min(
36770
+ RETRY_MAX_DELAY_MS,
36771
+ RETRY_BASE_DELAY_MS * 2 ** attempt
36772
+ );
36773
+ return Math.floor(Math.random() * ceiling);
36774
+ };
36775
+ var sharedAgent;
36776
+ var sharedAgentSelfSigned;
36777
+ var getDispatcher = (selfSigned) => {
36778
+ if (sharedAgent === void 0 || sharedAgentSelfSigned !== selfSigned) {
36779
+ void sharedAgent?.close().catch(() => {
36780
+ });
36781
+ sharedAgent = new import_undici.Agent({
36782
+ connect: {
36783
+ rejectUnauthorized: !selfSigned,
36784
+ timeout: CONNECT_TIMEOUT_MS
36785
+ }
36786
+ });
36787
+ sharedAgentSelfSigned = selfSigned;
36788
+ }
36789
+ return sharedAgent;
36790
+ };
35753
36791
  var RevenexxException = class extends Error {
35754
36792
  code;
35755
36793
  type;
35756
36794
  response;
35757
- constructor(message, code, type = "", response = "") {
36795
+ /** Gateway correlation id (`x-request-id`), when the response carried one. */
36796
+ requestId;
36797
+ constructor(message, code, type = "", response = "", requestId) {
35758
36798
  super(message);
35759
36799
  this.name = "RevenexxException";
35760
36800
  this.code = code;
35761
36801
  this.type = type;
35762
36802
  this.response = response;
36803
+ this.requestId = requestId;
35763
36804
  }
35764
36805
  };
35765
36806
  var Client = class _Client {
35766
36807
  endpoint;
35767
36808
  headers;
35768
36809
  selfSigned;
36810
+ timeout;
36811
+ retry;
36812
+ debug;
35769
36813
  constructor() {
35770
36814
  this.endpoint = DEFAULT_ENDPOINT;
35771
36815
  this.selfSigned = false;
36816
+ this.timeout = DEFAULT_TIMEOUT_MS;
36817
+ this.retry = true;
36818
+ this.debug = false;
35772
36819
  this.headers = {
35773
36820
  "content-type": "",
35774
36821
  "x-sdk-name": SDK_NAME,
@@ -35819,6 +36866,20 @@ var Client = class _Client {
35819
36866
  this.addHeader("X-Revenexx-Tenant", tenant);
35820
36867
  return this;
35821
36868
  }
36869
+ /**
36870
+ * Set Market
36871
+ *
36872
+ * The active market slug to scope requests to, sent as the X-Revenexx-Market
36873
+ * header. Optional — omit it to see only global rows.
36874
+ *
36875
+ * @param {string} market
36876
+ *
36877
+ * @return self
36878
+ */
36879
+ setMarket(market) {
36880
+ this.addHeader("X-Revenexx-Market", market);
36881
+ return this;
36882
+ }
35822
36883
  /**
35823
36884
  * Set Key
35824
36885
  *
@@ -35845,6 +36906,23 @@ var Client = class _Client {
35845
36906
  this.addHeader("X-Revenexx-JWT", jwt2);
35846
36907
  return this;
35847
36908
  }
36909
+ /**
36910
+ * Set Bearer token
36911
+ *
36912
+ * An OAuth2 / OIDC access token (e.g. from SSO sign-in), sent in the standard
36913
+ * `Authorization: Bearer` header — the header the gateway validates for JWT
36914
+ * auth (see sdk-generator PR #9). Adds the `Bearer ` prefix unless the caller
36915
+ * already supplied one.
36916
+ *
36917
+ * @param {string} token
36918
+ *
36919
+ * @return self
36920
+ */
36921
+ setBearer(token) {
36922
+ const value = token.toLowerCase().startsWith("bearer ") ? token : `Bearer ${token}`;
36923
+ this.addHeader("Authorization", value);
36924
+ return this;
36925
+ }
35848
36926
  /**
35849
36927
  * Set Locale
35850
36928
  *
@@ -35878,6 +36956,14 @@ var Client = class _Client {
35878
36956
  this.selfSigned = status;
35879
36957
  return this;
35880
36958
  }
36959
+ /**
36960
+ * True for hosts where cleartext `http://` is acceptable during local
36961
+ * development (loopback interfaces never leave the machine).
36962
+ */
36963
+ static isLoopbackHost(hostname3) {
36964
+ const host = hostname3.replace(/^\[|\]$/g, "").toLowerCase();
36965
+ return host === "localhost" || host === "::1" || /^127(?:\.\d{1,3}){3}$/.test(host);
36966
+ }
35881
36967
  /**
35882
36968
  * Set endpoint.
35883
36969
  *
@@ -35886,12 +36972,62 @@ var Client = class _Client {
35886
36972
  * @return this
35887
36973
  */
35888
36974
  setEndpoint(endpoint) {
35889
- if (!endpoint.startsWith("http://") && !endpoint.startsWith("https://")) {
36975
+ let url2;
36976
+ try {
36977
+ url2 = new URL(endpoint);
36978
+ } catch {
36979
+ throw new RevenexxException("Invalid endpoint URL: " + endpoint);
36980
+ }
36981
+ if (url2.protocol !== "http:" && url2.protocol !== "https:") {
35890
36982
  throw new RevenexxException("Invalid endpoint URL: " + endpoint);
35891
36983
  }
36984
+ const allowCleartext = process.env.REVENEXX_ALLOW_CLEARTEXT === "1";
36985
+ if (url2.protocol === "http:" && !_Client.isLoopbackHost(url2.hostname) && !allowCleartext) {
36986
+ throw new RevenexxException(
36987
+ `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.`
36988
+ );
36989
+ }
35892
36990
  this.endpoint = endpoint;
35893
36991
  return this;
35894
36992
  }
36993
+ /**
36994
+ * Set the per-request timeout in milliseconds. A request that exceeds this is
36995
+ * aborted with a clear "timed out" error rather than hanging indefinitely.
36996
+ *
36997
+ * @param {number} ms
36998
+ *
36999
+ * @return this
37000
+ */
37001
+ setTimeout(ms) {
37002
+ if (Number.isFinite(ms) && ms > 0) {
37003
+ this.timeout = ms;
37004
+ }
37005
+ return this;
37006
+ }
37007
+ /**
37008
+ * Enable or disable automatic retries (bounded exponential backoff with
37009
+ * jitter for idempotent requests, honoring `Retry-After`). On by default.
37010
+ *
37011
+ * @param {boolean} enabled
37012
+ *
37013
+ * @return this
37014
+ */
37015
+ setRetry(enabled) {
37016
+ this.retry = enabled;
37017
+ return this;
37018
+ }
37019
+ /**
37020
+ * Enable redacted HTTP debug logging (request line, status, duration,
37021
+ * request id) to stderr. Off by default.
37022
+ *
37023
+ * @param {boolean} enabled
37024
+ *
37025
+ * @return this
37026
+ */
37027
+ setDebug(enabled) {
37028
+ this.debug = enabled;
37029
+ return this;
37030
+ }
35895
37031
  /**
35896
37032
  * @param {string} key
35897
37033
  * @param {string} value
@@ -35924,33 +37060,80 @@ var Client = class _Client {
35924
37060
  } else {
35925
37061
  body = JSONBig.stringify(params);
35926
37062
  }
37063
+ const upperMethod = method.toUpperCase();
37064
+ const bodyReplayable = !(body instanceof import_undici.FormData);
37065
+ const maxRetries = this.retry && IDEMPOTENT_METHODS.has(upperMethod) && bodyReplayable ? DEFAULT_MAX_RETRIES : 0;
35927
37066
  let response = void 0;
37067
+ const stopSpinner = startRequestSpinner(`${upperMethod} ${path}`);
35928
37068
  try {
35929
- response = await (0, import_undici.fetch)(url2.toString(), {
35930
- method: method.toUpperCase(),
35931
- headers: mergedHeaders,
35932
- body,
35933
- dispatcher: new import_undici.Agent({
35934
- connect: {
35935
- rejectUnauthorized: !this.selfSigned
37069
+ for (let attempt = 0; ; attempt++) {
37070
+ const startedAt = Date.now();
37071
+ try {
37072
+ response = await (0, import_undici.fetch)(url2.toString(), {
37073
+ method: upperMethod,
37074
+ headers: mergedHeaders,
37075
+ body,
37076
+ // Bound every request so a slow/black-holed gateway can't hang
37077
+ // the CLI forever; aborts with a TimeoutError we translate below.
37078
+ signal: AbortSignal.timeout(this.timeout),
37079
+ // One pooled dispatcher, reused across requests (see getDispatcher).
37080
+ dispatcher: getDispatcher(this.selfSigned)
37081
+ });
37082
+ } catch (error51) {
37083
+ const err = error51;
37084
+ const timedOut = err.name === "TimeoutError" || err.name === "AbortError";
37085
+ this.logDebug(
37086
+ upperMethod,
37087
+ path,
37088
+ timedOut ? "timeout" : "network-error",
37089
+ Date.now() - startedAt
37090
+ );
37091
+ if (!timedOut && attempt < maxRetries) {
37092
+ await sleep(backoffDelay(attempt));
37093
+ continue;
35936
37094
  }
35937
- })
35938
- });
35939
- } catch (error51) {
35940
- throw new RevenexxException(error51.message);
37095
+ if (timedOut) {
37096
+ throw new RevenexxException(
37097
+ `Request timed out after ${this.timeout}ms (${upperMethod} ${path}). Increase the limit with --timeout, or check your connection and the endpoint.`
37098
+ );
37099
+ }
37100
+ throw new RevenexxException(err.message);
37101
+ }
37102
+ const requestId2 = response.headers.get("x-request-id") ?? void 0;
37103
+ this.logDebug(
37104
+ upperMethod,
37105
+ path,
37106
+ String(response.status),
37107
+ Date.now() - startedAt,
37108
+ requestId2
37109
+ );
37110
+ if (attempt < maxRetries && RETRYABLE_STATUS.has(response.status)) {
37111
+ const retryAfter = parseRetryAfter(
37112
+ response.headers.get("retry-after")
37113
+ );
37114
+ const delay = retryAfter ?? backoffDelay(attempt);
37115
+ await response.arrayBuffer().catch(() => {
37116
+ });
37117
+ await sleep(delay);
37118
+ continue;
37119
+ }
37120
+ break;
37121
+ }
37122
+ } finally {
37123
+ stopSpinner();
35941
37124
  }
35942
- if (response.status >= 400) {
35943
- const text2 = await response.text();
37125
+ const res = response;
37126
+ const requestId = res.headers.get("x-request-id") ?? void 0;
37127
+ if (res.status >= 400) {
37128
+ const text2 = await res.text();
35944
37129
  let json3 = void 0;
35945
37130
  try {
35946
37131
  json3 = JSON.parse(text2);
35947
37132
  } catch (_error) {
35948
- throw new RevenexxException(text2, response.status, "", text2);
37133
+ throw new RevenexxException(text2, res.status, "", text2, requestId);
35949
37134
  }
35950
37135
  if (path !== "/account" && json3.code === 401 && json3.type === "user_more_factors_required") {
35951
- console.log(
35952
- `${import_chalk.default.cyan.bold("\u2139 Info")} ${import_chalk.default.cyan("Unusable account found, removing...")}`
35953
- );
37136
+ console.log(`${import_chalk2.default.cyan("\u2139")} Unusable account found, removing...`);
35954
37137
  const current = globalConfig2.getCurrentSession();
35955
37138
  globalConfig2.setCurrentSession("");
35956
37139
  globalConfig2.removeSession(current);
@@ -35961,21 +37144,23 @@ var Client = class _Client {
35961
37144
  `You are not authenticated. Run '${EXECUTABLE_NAME} login' to authenticate and try again.`,
35962
37145
  json3.code,
35963
37146
  json3.type,
35964
- text2
37147
+ text2,
37148
+ requestId
35965
37149
  );
35966
37150
  }
35967
37151
  throw new RevenexxException(
35968
37152
  json3.message || text2,
35969
37153
  json3.code,
35970
37154
  json3.type,
35971
- text2
37155
+ text2,
37156
+ requestId
35972
37157
  );
35973
37158
  }
35974
37159
  if (responseType === "arraybuffer") {
35975
- const data = await response.arrayBuffer();
37160
+ const data = await res.arrayBuffer();
35976
37161
  return data;
35977
37162
  }
35978
- const cookies = response.headers.getSetCookie();
37163
+ const cookies = res.headers.getSetCookie();
35979
37164
  if (cookies && cookies.length > 0) {
35980
37165
  for (const cookie of cookies) {
35981
37166
  if (cookie.startsWith("a_session_console=")) {
@@ -35983,7 +37168,7 @@ var Client = class _Client {
35983
37168
  }
35984
37169
  }
35985
37170
  }
35986
- const text = await response.text();
37171
+ const text = await res.text();
35987
37172
  let json2 = void 0;
35988
37173
  try {
35989
37174
  json2 = JSONBig.parse(text);
@@ -35992,6 +37177,17 @@ var Client = class _Client {
35992
37177
  }
35993
37178
  return json2;
35994
37179
  }
37180
+ /**
37181
+ * Redacted, opt-in HTTP debug line on stderr (request line, status/outcome,
37182
+ * duration, and gateway request id). Everything is passed through
37183
+ * redactSecrets so auth material in the path can never leak.
37184
+ */
37185
+ logDebug(method, path, outcome, durationMs, requestId) {
37186
+ if (!this.debug) return;
37187
+ const id = requestId ? ` request-id=${requestId}` : "";
37188
+ const line = `${method} ${path} \u2192 ${outcome} (${durationMs}ms)${id}`;
37189
+ console.error(import_chalk2.default.dim(`[http] ${redactSecrets(line)}`));
37190
+ }
35995
37191
  static flatten(data, prefix = "") {
35996
37192
  let output = {};
35997
37193
  for (const key in data) {