securewithtrace 0.18.2 → 0.19.0
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.
- package/README.md +23 -0
- package/dist/index.js +1392 -351
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1079,35 +1079,35 @@ var require_suggestSimilar = __commonJS({
|
|
|
1079
1079
|
function editDistance(a, b) {
|
|
1080
1080
|
if (Math.abs(a.length - b.length) > maxDistance)
|
|
1081
1081
|
return Math.max(a.length, b.length);
|
|
1082
|
-
const
|
|
1082
|
+
const d3 = [];
|
|
1083
1083
|
for (let i = 0; i <= a.length; i++) {
|
|
1084
|
-
|
|
1084
|
+
d3[i] = [i];
|
|
1085
1085
|
}
|
|
1086
|
-
for (let
|
|
1087
|
-
|
|
1086
|
+
for (let j2 = 0; j2 <= b.length; j2++) {
|
|
1087
|
+
d3[0][j2] = j2;
|
|
1088
1088
|
}
|
|
1089
|
-
for (let
|
|
1089
|
+
for (let j2 = 1; j2 <= b.length; j2++) {
|
|
1090
1090
|
for (let i = 1; i <= a.length; i++) {
|
|
1091
1091
|
let cost = 1;
|
|
1092
|
-
if (a[i - 1] === b[
|
|
1092
|
+
if (a[i - 1] === b[j2 - 1]) {
|
|
1093
1093
|
cost = 0;
|
|
1094
1094
|
} else {
|
|
1095
1095
|
cost = 1;
|
|
1096
1096
|
}
|
|
1097
|
-
|
|
1098
|
-
|
|
1097
|
+
d3[i][j2] = Math.min(
|
|
1098
|
+
d3[i - 1][j2] + 1,
|
|
1099
1099
|
// deletion
|
|
1100
|
-
|
|
1100
|
+
d3[i][j2 - 1] + 1,
|
|
1101
1101
|
// insertion
|
|
1102
|
-
|
|
1102
|
+
d3[i - 1][j2 - 1] + cost
|
|
1103
1103
|
// substitution
|
|
1104
1104
|
);
|
|
1105
|
-
if (i > 1 &&
|
|
1106
|
-
|
|
1105
|
+
if (i > 1 && j2 > 1 && a[i - 1] === b[j2 - 2] && a[i - 2] === b[j2 - 1]) {
|
|
1106
|
+
d3[i][j2] = Math.min(d3[i][j2], d3[i - 2][j2 - 2] + 1);
|
|
1107
1107
|
}
|
|
1108
1108
|
}
|
|
1109
1109
|
}
|
|
1110
|
-
return
|
|
1110
|
+
return d3[a.length][b.length];
|
|
1111
1111
|
}
|
|
1112
1112
|
function suggestSimilar(word, candidates) {
|
|
1113
1113
|
if (!candidates || candidates.length === 0) return "";
|
|
@@ -3335,6 +3335,62 @@ var require_commander = __commonJS({
|
|
|
3335
3335
|
}
|
|
3336
3336
|
});
|
|
3337
3337
|
|
|
3338
|
+
// ../../node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
|
|
3339
|
+
var require_src = __commonJS({
|
|
3340
|
+
"../../node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module) {
|
|
3341
|
+
"use strict";
|
|
3342
|
+
var ESC2 = "\x1B";
|
|
3343
|
+
var CSI2 = `${ESC2}[`;
|
|
3344
|
+
var beep = "\x07";
|
|
3345
|
+
var cursor = {
|
|
3346
|
+
to(x, y2) {
|
|
3347
|
+
if (!y2) return `${CSI2}${x + 1}G`;
|
|
3348
|
+
return `${CSI2}${y2 + 1};${x + 1}H`;
|
|
3349
|
+
},
|
|
3350
|
+
move(x, y2) {
|
|
3351
|
+
let ret = "";
|
|
3352
|
+
if (x < 0) ret += `${CSI2}${-x}D`;
|
|
3353
|
+
else if (x > 0) ret += `${CSI2}${x}C`;
|
|
3354
|
+
if (y2 < 0) ret += `${CSI2}${-y2}A`;
|
|
3355
|
+
else if (y2 > 0) ret += `${CSI2}${y2}B`;
|
|
3356
|
+
return ret;
|
|
3357
|
+
},
|
|
3358
|
+
up: (count = 1) => `${CSI2}${count}A`,
|
|
3359
|
+
down: (count = 1) => `${CSI2}${count}B`,
|
|
3360
|
+
forward: (count = 1) => `${CSI2}${count}C`,
|
|
3361
|
+
backward: (count = 1) => `${CSI2}${count}D`,
|
|
3362
|
+
nextLine: (count = 1) => `${CSI2}E`.repeat(count),
|
|
3363
|
+
prevLine: (count = 1) => `${CSI2}F`.repeat(count),
|
|
3364
|
+
left: `${CSI2}G`,
|
|
3365
|
+
hide: `${CSI2}?25l`,
|
|
3366
|
+
show: `${CSI2}?25h`,
|
|
3367
|
+
save: `${ESC2}7`,
|
|
3368
|
+
restore: `${ESC2}8`
|
|
3369
|
+
};
|
|
3370
|
+
var scroll = {
|
|
3371
|
+
up: (count = 1) => `${CSI2}S`.repeat(count),
|
|
3372
|
+
down: (count = 1) => `${CSI2}T`.repeat(count)
|
|
3373
|
+
};
|
|
3374
|
+
var erase = {
|
|
3375
|
+
screen: `${CSI2}2J`,
|
|
3376
|
+
up: (count = 1) => `${CSI2}1J`.repeat(count),
|
|
3377
|
+
down: (count = 1) => `${CSI2}J`.repeat(count),
|
|
3378
|
+
line: `${CSI2}2K`,
|
|
3379
|
+
lineEnd: `${CSI2}K`,
|
|
3380
|
+
lineStart: `${CSI2}1K`,
|
|
3381
|
+
lines(count) {
|
|
3382
|
+
let clear = "";
|
|
3383
|
+
for (let i = 0; i < count; i++)
|
|
3384
|
+
clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
3385
|
+
if (count)
|
|
3386
|
+
clear += cursor.left;
|
|
3387
|
+
return clear;
|
|
3388
|
+
}
|
|
3389
|
+
};
|
|
3390
|
+
module.exports = { cursor, scroll, erase, beep };
|
|
3391
|
+
}
|
|
3392
|
+
});
|
|
3393
|
+
|
|
3338
3394
|
// ../../node_modules/.bun/commander@13.1.0/node_modules/commander/esm.mjs
|
|
3339
3395
|
var import_index = __toESM(require_commander(), 1);
|
|
3340
3396
|
var {
|
|
@@ -3353,7 +3409,725 @@ var {
|
|
|
3353
3409
|
} = import_index.default;
|
|
3354
3410
|
|
|
3355
3411
|
// src/auth/commands.ts
|
|
3356
|
-
import { createInterface } from "readline/promises";
|
|
3412
|
+
import { createInterface as createInterface2 } from "readline/promises";
|
|
3413
|
+
|
|
3414
|
+
// ../../node_modules/.bun/@clack+core@1.2.0/node_modules/@clack/core/dist/index.mjs
|
|
3415
|
+
import { styleText as y } from "util";
|
|
3416
|
+
import { stdout as S, stdin as $ } from "process";
|
|
3417
|
+
import * as _ from "readline";
|
|
3418
|
+
import P from "readline";
|
|
3419
|
+
|
|
3420
|
+
// ../../node_modules/.bun/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/utils.js
|
|
3421
|
+
var isAmbiguous = (x) => {
|
|
3422
|
+
return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
|
|
3423
|
+
};
|
|
3424
|
+
var isFullWidth = (x) => {
|
|
3425
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
3426
|
+
};
|
|
3427
|
+
var isWide = (x) => {
|
|
3428
|
+
return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9800 && x <= 9811 || x === 9855 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 19968 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101632 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129672 || x >= 129680 && x <= 129725 || x >= 129727 && x <= 129733 || x >= 129742 && x <= 129755 || x >= 129760 && x <= 129768 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
3429
|
+
};
|
|
3430
|
+
|
|
3431
|
+
// ../../node_modules/.bun/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/index.js
|
|
3432
|
+
var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
3433
|
+
var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
3434
|
+
var TAB_RE = /\t{1,1000}/y;
|
|
3435
|
+
var EMOJI_RE = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
|
|
3436
|
+
var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
3437
|
+
var MODIFIER_RE = /\p{M}+/gu;
|
|
3438
|
+
var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
|
|
3439
|
+
var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
3440
|
+
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
3441
|
+
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
3442
|
+
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
3443
|
+
const ANSI_WIDTH = widthOptions.ansiWidth ?? 0;
|
|
3444
|
+
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
3445
|
+
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
3446
|
+
const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;
|
|
3447
|
+
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
3448
|
+
const FULL_WIDTH_WIDTH = widthOptions.fullWidthWidth ?? 2;
|
|
3449
|
+
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
3450
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? 2;
|
|
3451
|
+
let indexPrev = 0;
|
|
3452
|
+
let index = 0;
|
|
3453
|
+
let length = input.length;
|
|
3454
|
+
let lengthExtra = 0;
|
|
3455
|
+
let truncationEnabled = false;
|
|
3456
|
+
let truncationIndex = length;
|
|
3457
|
+
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
3458
|
+
let unmatchedStart = 0;
|
|
3459
|
+
let unmatchedEnd = 0;
|
|
3460
|
+
let width = 0;
|
|
3461
|
+
let widthExtra = 0;
|
|
3462
|
+
outer: while (true) {
|
|
3463
|
+
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
3464
|
+
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
|
|
3465
|
+
lengthExtra = 0;
|
|
3466
|
+
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
3467
|
+
const codePoint = char.codePointAt(0) || 0;
|
|
3468
|
+
if (isFullWidth(codePoint)) {
|
|
3469
|
+
widthExtra = FULL_WIDTH_WIDTH;
|
|
3470
|
+
} else if (isWide(codePoint)) {
|
|
3471
|
+
widthExtra = WIDE_WIDTH;
|
|
3472
|
+
} else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) {
|
|
3473
|
+
widthExtra = AMBIGUOUS_WIDTH;
|
|
3474
|
+
} else {
|
|
3475
|
+
widthExtra = REGULAR_WIDTH;
|
|
3476
|
+
}
|
|
3477
|
+
if (width + widthExtra > truncationLimit) {
|
|
3478
|
+
truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
3479
|
+
}
|
|
3480
|
+
if (width + widthExtra > LIMIT) {
|
|
3481
|
+
truncationEnabled = true;
|
|
3482
|
+
break outer;
|
|
3483
|
+
}
|
|
3484
|
+
lengthExtra += char.length;
|
|
3485
|
+
width += widthExtra;
|
|
3486
|
+
}
|
|
3487
|
+
unmatchedStart = unmatchedEnd = 0;
|
|
3488
|
+
}
|
|
3489
|
+
if (index >= length)
|
|
3490
|
+
break;
|
|
3491
|
+
LATIN_RE.lastIndex = index;
|
|
3492
|
+
if (LATIN_RE.test(input)) {
|
|
3493
|
+
lengthExtra = LATIN_RE.lastIndex - index;
|
|
3494
|
+
widthExtra = lengthExtra * REGULAR_WIDTH;
|
|
3495
|
+
if (width + widthExtra > truncationLimit) {
|
|
3496
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));
|
|
3497
|
+
}
|
|
3498
|
+
if (width + widthExtra > LIMIT) {
|
|
3499
|
+
truncationEnabled = true;
|
|
3500
|
+
break;
|
|
3501
|
+
}
|
|
3502
|
+
width += widthExtra;
|
|
3503
|
+
unmatchedStart = indexPrev;
|
|
3504
|
+
unmatchedEnd = index;
|
|
3505
|
+
index = indexPrev = LATIN_RE.lastIndex;
|
|
3506
|
+
continue;
|
|
3507
|
+
}
|
|
3508
|
+
ANSI_RE.lastIndex = index;
|
|
3509
|
+
if (ANSI_RE.test(input)) {
|
|
3510
|
+
if (width + ANSI_WIDTH > truncationLimit) {
|
|
3511
|
+
truncationIndex = Math.min(truncationIndex, index);
|
|
3512
|
+
}
|
|
3513
|
+
if (width + ANSI_WIDTH > LIMIT) {
|
|
3514
|
+
truncationEnabled = true;
|
|
3515
|
+
break;
|
|
3516
|
+
}
|
|
3517
|
+
width += ANSI_WIDTH;
|
|
3518
|
+
unmatchedStart = indexPrev;
|
|
3519
|
+
unmatchedEnd = index;
|
|
3520
|
+
index = indexPrev = ANSI_RE.lastIndex;
|
|
3521
|
+
continue;
|
|
3522
|
+
}
|
|
3523
|
+
CONTROL_RE.lastIndex = index;
|
|
3524
|
+
if (CONTROL_RE.test(input)) {
|
|
3525
|
+
lengthExtra = CONTROL_RE.lastIndex - index;
|
|
3526
|
+
widthExtra = lengthExtra * CONTROL_WIDTH;
|
|
3527
|
+
if (width + widthExtra > truncationLimit) {
|
|
3528
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));
|
|
3529
|
+
}
|
|
3530
|
+
if (width + widthExtra > LIMIT) {
|
|
3531
|
+
truncationEnabled = true;
|
|
3532
|
+
break;
|
|
3533
|
+
}
|
|
3534
|
+
width += widthExtra;
|
|
3535
|
+
unmatchedStart = indexPrev;
|
|
3536
|
+
unmatchedEnd = index;
|
|
3537
|
+
index = indexPrev = CONTROL_RE.lastIndex;
|
|
3538
|
+
continue;
|
|
3539
|
+
}
|
|
3540
|
+
TAB_RE.lastIndex = index;
|
|
3541
|
+
if (TAB_RE.test(input)) {
|
|
3542
|
+
lengthExtra = TAB_RE.lastIndex - index;
|
|
3543
|
+
widthExtra = lengthExtra * TAB_WIDTH;
|
|
3544
|
+
if (width + widthExtra > truncationLimit) {
|
|
3545
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));
|
|
3546
|
+
}
|
|
3547
|
+
if (width + widthExtra > LIMIT) {
|
|
3548
|
+
truncationEnabled = true;
|
|
3549
|
+
break;
|
|
3550
|
+
}
|
|
3551
|
+
width += widthExtra;
|
|
3552
|
+
unmatchedStart = indexPrev;
|
|
3553
|
+
unmatchedEnd = index;
|
|
3554
|
+
index = indexPrev = TAB_RE.lastIndex;
|
|
3555
|
+
continue;
|
|
3556
|
+
}
|
|
3557
|
+
EMOJI_RE.lastIndex = index;
|
|
3558
|
+
if (EMOJI_RE.test(input)) {
|
|
3559
|
+
if (width + EMOJI_WIDTH > truncationLimit) {
|
|
3560
|
+
truncationIndex = Math.min(truncationIndex, index);
|
|
3561
|
+
}
|
|
3562
|
+
if (width + EMOJI_WIDTH > LIMIT) {
|
|
3563
|
+
truncationEnabled = true;
|
|
3564
|
+
break;
|
|
3565
|
+
}
|
|
3566
|
+
width += EMOJI_WIDTH;
|
|
3567
|
+
unmatchedStart = indexPrev;
|
|
3568
|
+
unmatchedEnd = index;
|
|
3569
|
+
index = indexPrev = EMOJI_RE.lastIndex;
|
|
3570
|
+
continue;
|
|
3571
|
+
}
|
|
3572
|
+
index += 1;
|
|
3573
|
+
}
|
|
3574
|
+
return {
|
|
3575
|
+
width: truncationEnabled ? truncationLimit : width,
|
|
3576
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
3577
|
+
truncated: truncationEnabled,
|
|
3578
|
+
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
3579
|
+
};
|
|
3580
|
+
};
|
|
3581
|
+
var dist_default = getStringTruncatedWidth;
|
|
3582
|
+
|
|
3583
|
+
// ../../node_modules/.bun/fast-string-width@1.1.0/node_modules/fast-string-width/dist/index.js
|
|
3584
|
+
var NO_TRUNCATION2 = {
|
|
3585
|
+
limit: Infinity,
|
|
3586
|
+
ellipsis: "",
|
|
3587
|
+
ellipsisWidth: 0
|
|
3588
|
+
};
|
|
3589
|
+
var fastStringWidth = (input, options = {}) => {
|
|
3590
|
+
return dist_default(input, NO_TRUNCATION2, options).width;
|
|
3591
|
+
};
|
|
3592
|
+
var dist_default2 = fastStringWidth;
|
|
3593
|
+
|
|
3594
|
+
// ../../node_modules/.bun/fast-wrap-ansi@0.1.6/node_modules/fast-wrap-ansi/lib/main.js
|
|
3595
|
+
var ESC = "\x1B";
|
|
3596
|
+
var CSI = "\x9B";
|
|
3597
|
+
var END_CODE = 39;
|
|
3598
|
+
var ANSI_ESCAPE_BELL = "\x07";
|
|
3599
|
+
var ANSI_CSI = "[";
|
|
3600
|
+
var ANSI_OSC = "]";
|
|
3601
|
+
var ANSI_SGR_TERMINATOR = "m";
|
|
3602
|
+
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
3603
|
+
var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
3604
|
+
var getClosingCode = (openingCode) => {
|
|
3605
|
+
if (openingCode >= 30 && openingCode <= 37)
|
|
3606
|
+
return 39;
|
|
3607
|
+
if (openingCode >= 90 && openingCode <= 97)
|
|
3608
|
+
return 39;
|
|
3609
|
+
if (openingCode >= 40 && openingCode <= 47)
|
|
3610
|
+
return 49;
|
|
3611
|
+
if (openingCode >= 100 && openingCode <= 107)
|
|
3612
|
+
return 49;
|
|
3613
|
+
if (openingCode === 1 || openingCode === 2)
|
|
3614
|
+
return 22;
|
|
3615
|
+
if (openingCode === 3)
|
|
3616
|
+
return 23;
|
|
3617
|
+
if (openingCode === 4)
|
|
3618
|
+
return 24;
|
|
3619
|
+
if (openingCode === 7)
|
|
3620
|
+
return 27;
|
|
3621
|
+
if (openingCode === 8)
|
|
3622
|
+
return 28;
|
|
3623
|
+
if (openingCode === 9)
|
|
3624
|
+
return 29;
|
|
3625
|
+
if (openingCode === 0)
|
|
3626
|
+
return 0;
|
|
3627
|
+
return void 0;
|
|
3628
|
+
};
|
|
3629
|
+
var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
3630
|
+
var wrapAnsiHyperlink = (url2) => `${ESC}${ANSI_ESCAPE_LINK}${url2}${ANSI_ESCAPE_BELL}`;
|
|
3631
|
+
var wrapWord = (rows, word, columns) => {
|
|
3632
|
+
const characters = word[Symbol.iterator]();
|
|
3633
|
+
let isInsideEscape = false;
|
|
3634
|
+
let isInsideLinkEscape = false;
|
|
3635
|
+
let lastRow = rows.at(-1);
|
|
3636
|
+
let visible = lastRow === void 0 ? 0 : dist_default2(lastRow);
|
|
3637
|
+
let currentCharacter = characters.next();
|
|
3638
|
+
let nextCharacter = characters.next();
|
|
3639
|
+
let rawCharacterIndex = 0;
|
|
3640
|
+
while (!currentCharacter.done) {
|
|
3641
|
+
const character = currentCharacter.value;
|
|
3642
|
+
const characterLength = dist_default2(character);
|
|
3643
|
+
if (visible + characterLength <= columns) {
|
|
3644
|
+
rows[rows.length - 1] += character;
|
|
3645
|
+
} else {
|
|
3646
|
+
rows.push(character);
|
|
3647
|
+
visible = 0;
|
|
3648
|
+
}
|
|
3649
|
+
if (character === ESC || character === CSI) {
|
|
3650
|
+
isInsideEscape = true;
|
|
3651
|
+
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
|
|
3652
|
+
}
|
|
3653
|
+
if (isInsideEscape) {
|
|
3654
|
+
if (isInsideLinkEscape) {
|
|
3655
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
3656
|
+
isInsideEscape = false;
|
|
3657
|
+
isInsideLinkEscape = false;
|
|
3658
|
+
}
|
|
3659
|
+
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
3660
|
+
isInsideEscape = false;
|
|
3661
|
+
}
|
|
3662
|
+
} else {
|
|
3663
|
+
visible += characterLength;
|
|
3664
|
+
if (visible === columns && !nextCharacter.done) {
|
|
3665
|
+
rows.push("");
|
|
3666
|
+
visible = 0;
|
|
3667
|
+
}
|
|
3668
|
+
}
|
|
3669
|
+
currentCharacter = nextCharacter;
|
|
3670
|
+
nextCharacter = characters.next();
|
|
3671
|
+
rawCharacterIndex += character.length;
|
|
3672
|
+
}
|
|
3673
|
+
lastRow = rows.at(-1);
|
|
3674
|
+
if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) {
|
|
3675
|
+
rows[rows.length - 2] += rows.pop();
|
|
3676
|
+
}
|
|
3677
|
+
};
|
|
3678
|
+
var stringVisibleTrimSpacesRight = (string4) => {
|
|
3679
|
+
const words = string4.split(" ");
|
|
3680
|
+
let last = words.length;
|
|
3681
|
+
while (last) {
|
|
3682
|
+
if (dist_default2(words[last - 1])) {
|
|
3683
|
+
break;
|
|
3684
|
+
}
|
|
3685
|
+
last--;
|
|
3686
|
+
}
|
|
3687
|
+
if (last === words.length) {
|
|
3688
|
+
return string4;
|
|
3689
|
+
}
|
|
3690
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
3691
|
+
};
|
|
3692
|
+
var exec = (string4, columns, options = {}) => {
|
|
3693
|
+
if (options.trim !== false && string4.trim() === "") {
|
|
3694
|
+
return "";
|
|
3695
|
+
}
|
|
3696
|
+
let returnValue = "";
|
|
3697
|
+
let escapeCode;
|
|
3698
|
+
let escapeUrl;
|
|
3699
|
+
const words = string4.split(" ");
|
|
3700
|
+
let rows = [""];
|
|
3701
|
+
let rowLength = 0;
|
|
3702
|
+
for (let index = 0; index < words.length; index++) {
|
|
3703
|
+
const word = words[index];
|
|
3704
|
+
if (options.trim !== false) {
|
|
3705
|
+
const row = rows.at(-1) ?? "";
|
|
3706
|
+
const trimmed = row.trimStart();
|
|
3707
|
+
if (row.length !== trimmed.length) {
|
|
3708
|
+
rows[rows.length - 1] = trimmed;
|
|
3709
|
+
rowLength = dist_default2(trimmed);
|
|
3710
|
+
}
|
|
3711
|
+
}
|
|
3712
|
+
if (index !== 0) {
|
|
3713
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
3714
|
+
rows.push("");
|
|
3715
|
+
rowLength = 0;
|
|
3716
|
+
}
|
|
3717
|
+
if (rowLength || options.trim === false) {
|
|
3718
|
+
rows[rows.length - 1] += " ";
|
|
3719
|
+
rowLength++;
|
|
3720
|
+
}
|
|
3721
|
+
}
|
|
3722
|
+
const wordLength = dist_default2(word);
|
|
3723
|
+
if (options.hard && wordLength > columns) {
|
|
3724
|
+
const remainingColumns = columns - rowLength;
|
|
3725
|
+
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
|
3726
|
+
const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
|
|
3727
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
3728
|
+
rows.push("");
|
|
3729
|
+
}
|
|
3730
|
+
wrapWord(rows, word, columns);
|
|
3731
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
3732
|
+
continue;
|
|
3733
|
+
}
|
|
3734
|
+
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
|
3735
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
3736
|
+
wrapWord(rows, word, columns);
|
|
3737
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
3738
|
+
continue;
|
|
3739
|
+
}
|
|
3740
|
+
rows.push("");
|
|
3741
|
+
rowLength = 0;
|
|
3742
|
+
}
|
|
3743
|
+
if (rowLength + wordLength > columns && options.wordWrap === false) {
|
|
3744
|
+
wrapWord(rows, word, columns);
|
|
3745
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
3746
|
+
continue;
|
|
3747
|
+
}
|
|
3748
|
+
rows[rows.length - 1] += word;
|
|
3749
|
+
rowLength += wordLength;
|
|
3750
|
+
}
|
|
3751
|
+
if (options.trim !== false) {
|
|
3752
|
+
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
3753
|
+
}
|
|
3754
|
+
const preString = rows.join("\n");
|
|
3755
|
+
let inSurrogate = false;
|
|
3756
|
+
for (let i = 0; i < preString.length; i++) {
|
|
3757
|
+
const character = preString[i];
|
|
3758
|
+
returnValue += character;
|
|
3759
|
+
if (!inSurrogate) {
|
|
3760
|
+
inSurrogate = character >= "\uD800" && character <= "\uDBFF";
|
|
3761
|
+
} else {
|
|
3762
|
+
continue;
|
|
3763
|
+
}
|
|
3764
|
+
if (character === ESC || character === CSI) {
|
|
3765
|
+
GROUP_REGEX.lastIndex = i + 1;
|
|
3766
|
+
const groupsResult = GROUP_REGEX.exec(preString);
|
|
3767
|
+
const groups = groupsResult?.groups;
|
|
3768
|
+
if (groups?.code !== void 0) {
|
|
3769
|
+
const code = Number.parseFloat(groups.code);
|
|
3770
|
+
escapeCode = code === END_CODE ? void 0 : code;
|
|
3771
|
+
} else if (groups?.uri !== void 0) {
|
|
3772
|
+
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
3773
|
+
}
|
|
3774
|
+
}
|
|
3775
|
+
if (preString[i + 1] === "\n") {
|
|
3776
|
+
if (escapeUrl) {
|
|
3777
|
+
returnValue += wrapAnsiHyperlink("");
|
|
3778
|
+
}
|
|
3779
|
+
const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
|
|
3780
|
+
if (escapeCode && closingCode) {
|
|
3781
|
+
returnValue += wrapAnsiCode(closingCode);
|
|
3782
|
+
}
|
|
3783
|
+
} else if (character === "\n") {
|
|
3784
|
+
if (escapeCode && getClosingCode(escapeCode)) {
|
|
3785
|
+
returnValue += wrapAnsiCode(escapeCode);
|
|
3786
|
+
}
|
|
3787
|
+
if (escapeUrl) {
|
|
3788
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
3789
|
+
}
|
|
3790
|
+
}
|
|
3791
|
+
}
|
|
3792
|
+
return returnValue;
|
|
3793
|
+
};
|
|
3794
|
+
var CRLF_OR_LF = /\r?\n/;
|
|
3795
|
+
function wrapAnsi(string4, columns, options) {
|
|
3796
|
+
return String(string4).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
3797
|
+
}
|
|
3798
|
+
|
|
3799
|
+
// ../../node_modules/.bun/@clack+core@1.2.0/node_modules/@clack/core/dist/index.mjs
|
|
3800
|
+
var import_sisteransi = __toESM(require_src(), 1);
|
|
3801
|
+
import { ReadStream as D } from "tty";
|
|
3802
|
+
function d(r, t2, e) {
|
|
3803
|
+
if (!e.some((o) => !o.disabled)) return r;
|
|
3804
|
+
const s = r + t2, i = Math.max(e.length - 1, 0), n = s < 0 ? i : s > i ? 0 : s;
|
|
3805
|
+
return e[n].disabled ? d(n, t2 < 0 ? -1 : 1, e) : n;
|
|
3806
|
+
}
|
|
3807
|
+
var E = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
3808
|
+
var G = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
3809
|
+
var u = { actions: new Set(E), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true, date: { monthNames: [...G], messages: { required: "Please enter a valid date", invalidMonth: "There are only 12 months in a year", invalidDay: (r, t2) => `There are only ${r} days in ${t2}`, afterMin: (r) => `Date must be on or after ${r.toISOString().slice(0, 10)}`, beforeMax: (r) => `Date must be on or before ${r.toISOString().slice(0, 10)}` } } };
|
|
3810
|
+
function V(r, t2) {
|
|
3811
|
+
if (typeof r == "string") return u.aliases.get(r) === t2;
|
|
3812
|
+
for (const e of r) if (e !== void 0 && V(e, t2)) return true;
|
|
3813
|
+
return false;
|
|
3814
|
+
}
|
|
3815
|
+
function j(r, t2) {
|
|
3816
|
+
if (r === t2) return;
|
|
3817
|
+
const e = r.split(`
|
|
3818
|
+
`), s = t2.split(`
|
|
3819
|
+
`), i = Math.max(e.length, s.length), n = [];
|
|
3820
|
+
for (let o = 0; o < i; o++) e[o] !== s[o] && n.push(o);
|
|
3821
|
+
return { lines: n, numLinesBefore: e.length, numLinesAfter: s.length, numLines: i };
|
|
3822
|
+
}
|
|
3823
|
+
var Y = globalThis.process.platform.startsWith("win");
|
|
3824
|
+
var C = /* @__PURE__ */ Symbol("clack:cancel");
|
|
3825
|
+
function q(r) {
|
|
3826
|
+
return r === C;
|
|
3827
|
+
}
|
|
3828
|
+
function w(r, t2) {
|
|
3829
|
+
const e = r;
|
|
3830
|
+
e.isTTY && e.setRawMode(t2);
|
|
3831
|
+
}
|
|
3832
|
+
var O = (r) => "columns" in r && typeof r.columns == "number" ? r.columns : 80;
|
|
3833
|
+
var A = (r) => "rows" in r && typeof r.rows == "number" ? r.rows : 20;
|
|
3834
|
+
function R(r, t2, e, s = e) {
|
|
3835
|
+
const i = O(r ?? S);
|
|
3836
|
+
return wrapAnsi(t2, i - e.length, { hard: true, trim: false }).split(`
|
|
3837
|
+
`).map((n, o) => `${o === 0 ? s : e}${n}`).join(`
|
|
3838
|
+
`);
|
|
3839
|
+
}
|
|
3840
|
+
var p = class {
|
|
3841
|
+
input;
|
|
3842
|
+
output;
|
|
3843
|
+
_abortSignal;
|
|
3844
|
+
rl;
|
|
3845
|
+
opts;
|
|
3846
|
+
_render;
|
|
3847
|
+
_track = false;
|
|
3848
|
+
_prevFrame = "";
|
|
3849
|
+
_subscribers = /* @__PURE__ */ new Map();
|
|
3850
|
+
_cursor = 0;
|
|
3851
|
+
state = "initial";
|
|
3852
|
+
error = "";
|
|
3853
|
+
value;
|
|
3854
|
+
userInput = "";
|
|
3855
|
+
constructor(t2, e = true) {
|
|
3856
|
+
const { input: s = $, output: i = S, render: n, signal: o, ...a } = t2;
|
|
3857
|
+
this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = e, this._abortSignal = o, this.input = s, this.output = i;
|
|
3858
|
+
}
|
|
3859
|
+
unsubscribe() {
|
|
3860
|
+
this._subscribers.clear();
|
|
3861
|
+
}
|
|
3862
|
+
setSubscriber(t2, e) {
|
|
3863
|
+
const s = this._subscribers.get(t2) ?? [];
|
|
3864
|
+
s.push(e), this._subscribers.set(t2, s);
|
|
3865
|
+
}
|
|
3866
|
+
on(t2, e) {
|
|
3867
|
+
this.setSubscriber(t2, { cb: e });
|
|
3868
|
+
}
|
|
3869
|
+
once(t2, e) {
|
|
3870
|
+
this.setSubscriber(t2, { cb: e, once: true });
|
|
3871
|
+
}
|
|
3872
|
+
emit(t2, ...e) {
|
|
3873
|
+
const s = this._subscribers.get(t2) ?? [], i = [];
|
|
3874
|
+
for (const n of s) n.cb(...e), n.once && i.push(() => s.splice(s.indexOf(n), 1));
|
|
3875
|
+
for (const n of i) n();
|
|
3876
|
+
}
|
|
3877
|
+
prompt() {
|
|
3878
|
+
return new Promise((t2) => {
|
|
3879
|
+
if (this._abortSignal) {
|
|
3880
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t2(C);
|
|
3881
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
3882
|
+
this.state = "cancel", this.close();
|
|
3883
|
+
}, { once: true });
|
|
3884
|
+
}
|
|
3885
|
+
this.rl = P.createInterface({ input: this.input, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), w(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
3886
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), w(this.input, false), t2(this.value);
|
|
3887
|
+
}), this.once("cancel", () => {
|
|
3888
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), w(this.input, false), t2(C);
|
|
3889
|
+
});
|
|
3890
|
+
});
|
|
3891
|
+
}
|
|
3892
|
+
_isActionKey(t2, e) {
|
|
3893
|
+
return t2 === " ";
|
|
3894
|
+
}
|
|
3895
|
+
_setValue(t2) {
|
|
3896
|
+
this.value = t2, this.emit("value", this.value);
|
|
3897
|
+
}
|
|
3898
|
+
_setUserInput(t2, e) {
|
|
3899
|
+
this.userInput = t2 ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
3900
|
+
}
|
|
3901
|
+
_clearUserInput() {
|
|
3902
|
+
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
3903
|
+
}
|
|
3904
|
+
onKeypress(t2, e) {
|
|
3905
|
+
if (this._track && e.name !== "return" && (e.name && this._isActionKey(t2, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && u.aliases.has(e.name) && this.emit("cursor", u.aliases.get(e.name)), u.actions.has(e.name) && this.emit("cursor", e.name)), t2 && (t2.toLowerCase() === "y" || t2.toLowerCase() === "n") && this.emit("confirm", t2.toLowerCase() === "y"), this.emit("key", t2?.toLowerCase(), e), e?.name === "return") {
|
|
3906
|
+
if (this.opts.validate) {
|
|
3907
|
+
const s = this.opts.validate(this.value);
|
|
3908
|
+
s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
|
|
3909
|
+
}
|
|
3910
|
+
this.state !== "error" && (this.state = "submit");
|
|
3911
|
+
}
|
|
3912
|
+
V([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
3913
|
+
}
|
|
3914
|
+
close() {
|
|
3915
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
3916
|
+
`), w(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
3917
|
+
}
|
|
3918
|
+
restoreCursor() {
|
|
3919
|
+
const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
3920
|
+
`).length - 1;
|
|
3921
|
+
this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
|
|
3922
|
+
}
|
|
3923
|
+
render() {
|
|
3924
|
+
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, { hard: true, trim: false });
|
|
3925
|
+
if (t2 !== this._prevFrame) {
|
|
3926
|
+
if (this.state === "initial") this.output.write(import_sisteransi.cursor.hide);
|
|
3927
|
+
else {
|
|
3928
|
+
const e = j(this._prevFrame, t2), s = A(this.output);
|
|
3929
|
+
if (this.restoreCursor(), e) {
|
|
3930
|
+
const i = Math.max(0, e.numLinesAfter - s), n = Math.max(0, e.numLinesBefore - s);
|
|
3931
|
+
let o = e.lines.find((a) => a >= i);
|
|
3932
|
+
if (o === void 0) {
|
|
3933
|
+
this._prevFrame = t2;
|
|
3934
|
+
return;
|
|
3935
|
+
}
|
|
3936
|
+
if (e.lines.length === 1) {
|
|
3937
|
+
this.output.write(import_sisteransi.cursor.move(0, o - n)), this.output.write(import_sisteransi.erase.lines(1));
|
|
3938
|
+
const a = t2.split(`
|
|
3939
|
+
`);
|
|
3940
|
+
this.output.write(a[o]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, a.length - o - 1));
|
|
3941
|
+
return;
|
|
3942
|
+
} else if (e.lines.length > 1) {
|
|
3943
|
+
if (i < n) o = i;
|
|
3944
|
+
else {
|
|
3945
|
+
const h = o - n;
|
|
3946
|
+
h > 0 && this.output.write(import_sisteransi.cursor.move(0, h));
|
|
3947
|
+
}
|
|
3948
|
+
this.output.write(import_sisteransi.erase.down());
|
|
3949
|
+
const a = t2.split(`
|
|
3950
|
+
`).slice(o);
|
|
3951
|
+
this.output.write(a.join(`
|
|
3952
|
+
`)), this._prevFrame = t2;
|
|
3953
|
+
return;
|
|
3954
|
+
}
|
|
3955
|
+
}
|
|
3956
|
+
this.output.write(import_sisteransi.erase.down());
|
|
3957
|
+
}
|
|
3958
|
+
this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
|
|
3959
|
+
}
|
|
3960
|
+
}
|
|
3961
|
+
};
|
|
3962
|
+
var nt = class extends p {
|
|
3963
|
+
options;
|
|
3964
|
+
cursor = 0;
|
|
3965
|
+
get _selectedValue() {
|
|
3966
|
+
return this.options[this.cursor];
|
|
3967
|
+
}
|
|
3968
|
+
changeValue() {
|
|
3969
|
+
this.value = this._selectedValue.value;
|
|
3970
|
+
}
|
|
3971
|
+
constructor(t2) {
|
|
3972
|
+
super(t2, false), this.options = t2.options;
|
|
3973
|
+
const e = this.options.findIndex(({ value: i }) => i === t2.initialValue), s = e === -1 ? 0 : e;
|
|
3974
|
+
this.cursor = this.options[s].disabled ? d(s, 1, this.options) : s, this.changeValue(), this.on("cursor", (i) => {
|
|
3975
|
+
switch (i) {
|
|
3976
|
+
case "left":
|
|
3977
|
+
case "up":
|
|
3978
|
+
this.cursor = d(this.cursor, -1, this.options);
|
|
3979
|
+
break;
|
|
3980
|
+
case "down":
|
|
3981
|
+
case "right":
|
|
3982
|
+
this.cursor = d(this.cursor, 1, this.options);
|
|
3983
|
+
break;
|
|
3984
|
+
}
|
|
3985
|
+
this.changeValue();
|
|
3986
|
+
});
|
|
3987
|
+
}
|
|
3988
|
+
};
|
|
3989
|
+
|
|
3990
|
+
// ../../node_modules/.bun/@clack+prompts@1.2.0/node_modules/@clack/prompts/dist/index.mjs
|
|
3991
|
+
import { styleText as t, stripVTControlCharacters as ne } from "util";
|
|
3992
|
+
import P2 from "process";
|
|
3993
|
+
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
3994
|
+
import { existsSync as Xe, lstatSync as we, readdirSync as ze } from "fs";
|
|
3995
|
+
import { dirname as be, join as Qe } from "path";
|
|
3996
|
+
function Ze() {
|
|
3997
|
+
return P2.platform !== "win32" ? P2.env.TERM !== "linux" : !!P2.env.CI || !!P2.env.WT_SESSION || !!P2.env.TERMINUS_SUBLIME || P2.env.ConEmuTask === "{cmd::Cmder}" || P2.env.TERM_PROGRAM === "Terminus-Sublime" || P2.env.TERM_PROGRAM === "vscode" || P2.env.TERM === "xterm-256color" || P2.env.TERM === "alacritty" || P2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
3998
|
+
}
|
|
3999
|
+
var ee = Ze();
|
|
4000
|
+
var w2 = (e, i) => ee ? e : i;
|
|
4001
|
+
var _e = w2("\u25C6", "*");
|
|
4002
|
+
var oe = w2("\u25A0", "x");
|
|
4003
|
+
var ue = w2("\u25B2", "x");
|
|
4004
|
+
var F = w2("\u25C7", "o");
|
|
4005
|
+
var le = w2("\u250C", "T");
|
|
4006
|
+
var d2 = w2("\u2502", "|");
|
|
4007
|
+
var E2 = w2("\u2514", "\u2014");
|
|
4008
|
+
var Ie = w2("\u2510", "T");
|
|
4009
|
+
var Ee = w2("\u2518", "\u2014");
|
|
4010
|
+
var z2 = w2("\u25CF", ">");
|
|
4011
|
+
var H2 = w2("\u25CB", " ");
|
|
4012
|
+
var te = w2("\u25FB", "[\u2022]");
|
|
4013
|
+
var U = w2("\u25FC", "[+]");
|
|
4014
|
+
var J = w2("\u25FB", "[ ]");
|
|
4015
|
+
var xe = w2("\u25AA", "\u2022");
|
|
4016
|
+
var se = w2("\u2500", "-");
|
|
4017
|
+
var ce = w2("\u256E", "+");
|
|
4018
|
+
var Ge = w2("\u251C", "+");
|
|
4019
|
+
var $e = w2("\u256F", "+");
|
|
4020
|
+
var de = w2("\u2570", "+");
|
|
4021
|
+
var Oe = w2("\u256D", "+");
|
|
4022
|
+
var he = w2("\u25CF", "\u2022");
|
|
4023
|
+
var pe = w2("\u25C6", "*");
|
|
4024
|
+
var me = w2("\u25B2", "!");
|
|
4025
|
+
var ge = w2("\u25A0", "x");
|
|
4026
|
+
var V2 = (e) => {
|
|
4027
|
+
switch (e) {
|
|
4028
|
+
case "initial":
|
|
4029
|
+
case "active":
|
|
4030
|
+
return t("cyan", _e);
|
|
4031
|
+
case "cancel":
|
|
4032
|
+
return t("red", oe);
|
|
4033
|
+
case "error":
|
|
4034
|
+
return t("yellow", ue);
|
|
4035
|
+
case "submit":
|
|
4036
|
+
return t("green", F);
|
|
4037
|
+
}
|
|
4038
|
+
};
|
|
4039
|
+
var ye = (e) => {
|
|
4040
|
+
switch (e) {
|
|
4041
|
+
case "initial":
|
|
4042
|
+
case "active":
|
|
4043
|
+
return t("cyan", d2);
|
|
4044
|
+
case "cancel":
|
|
4045
|
+
return t("red", d2);
|
|
4046
|
+
case "error":
|
|
4047
|
+
return t("yellow", d2);
|
|
4048
|
+
case "submit":
|
|
4049
|
+
return t("green", d2);
|
|
4050
|
+
}
|
|
4051
|
+
};
|
|
4052
|
+
var et2 = (e, i, s, r, u2) => {
|
|
4053
|
+
let n = i, o = 0;
|
|
4054
|
+
for (let c26 = s; c26 < r; c26++) {
|
|
4055
|
+
const a = e[c26];
|
|
4056
|
+
if (n = n - a.length, o++, n <= u2) break;
|
|
4057
|
+
}
|
|
4058
|
+
return { lineCount: n, removals: o };
|
|
4059
|
+
};
|
|
4060
|
+
var Y2 = ({ cursor: e, options: i, style: s, output: r = process.stdout, maxItems: u2 = Number.POSITIVE_INFINITY, columnPadding: n = 0, rowPadding: o = 4 }) => {
|
|
4061
|
+
const c26 = O(r) - n, a = A(r), l = t("dim", "..."), $2 = Math.max(a - o, 0), y2 = Math.max(Math.min(u2, $2), 5);
|
|
4062
|
+
let p2 = 0;
|
|
4063
|
+
e >= y2 - 3 && (p2 = Math.max(Math.min(e - y2 + 3, i.length - y2), 0));
|
|
4064
|
+
let m = y2 < i.length && p2 > 0, g = y2 < i.length && p2 + y2 < i.length;
|
|
4065
|
+
const S2 = Math.min(p2 + y2, i.length), h = [];
|
|
4066
|
+
let f = 0;
|
|
4067
|
+
m && f++, g && f++;
|
|
4068
|
+
const v = p2 + (m ? 1 : 0), T = S2 - (g ? 1 : 0);
|
|
4069
|
+
for (let b = v; b < T; b++) {
|
|
4070
|
+
const x = wrapAnsi(s(i[b], b === e), c26, { hard: true, trim: false }).split(`
|
|
4071
|
+
`);
|
|
4072
|
+
h.push(x), f += x.length;
|
|
4073
|
+
}
|
|
4074
|
+
if (f > $2) {
|
|
4075
|
+
let b = 0, x = 0, G2 = f;
|
|
4076
|
+
const M2 = e - v, R2 = (j2, D2) => et2(h, G2, j2, D2, $2);
|
|
4077
|
+
m ? ({ lineCount: G2, removals: b } = R2(0, M2), G2 > $2 && ({ lineCount: G2, removals: x } = R2(M2 + 1, h.length))) : ({ lineCount: G2, removals: x } = R2(M2 + 1, h.length), G2 > $2 && ({ lineCount: G2, removals: b } = R2(0, M2))), b > 0 && (m = true, h.splice(0, b)), x > 0 && (g = true, h.splice(h.length - x, x));
|
|
4078
|
+
}
|
|
4079
|
+
const C2 = [];
|
|
4080
|
+
m && C2.push(l);
|
|
4081
|
+
for (const b of h) for (const x of b) C2.push(x);
|
|
4082
|
+
return g && C2.push(l), C2;
|
|
4083
|
+
};
|
|
4084
|
+
var Ve = { light: w2("\u2500", "-"), heavy: w2("\u2501", "="), block: w2("\u2588", "#") };
|
|
4085
|
+
var re = (e, i) => e.includes(`
|
|
4086
|
+
`) ? e.split(`
|
|
4087
|
+
`).map((s) => i(s)).join(`
|
|
4088
|
+
`) : i(e);
|
|
4089
|
+
var _t = (e) => {
|
|
4090
|
+
const i = (s, r) => {
|
|
4091
|
+
const u2 = s.label ?? String(s.value);
|
|
4092
|
+
switch (r) {
|
|
4093
|
+
case "disabled":
|
|
4094
|
+
return `${t("gray", H2)} ${re(u2, (n) => t("gray", n))}${s.hint ? ` ${t("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
|
|
4095
|
+
case "selected":
|
|
4096
|
+
return `${re(u2, (n) => t("dim", n))}`;
|
|
4097
|
+
case "active":
|
|
4098
|
+
return `${t("green", z2)} ${u2}${s.hint ? ` ${t("dim", `(${s.hint})`)}` : ""}`;
|
|
4099
|
+
case "cancelled":
|
|
4100
|
+
return `${re(u2, (n) => t(["strikethrough", "dim"], n))}`;
|
|
4101
|
+
default:
|
|
4102
|
+
return `${t("dim", H2)} ${re(u2, (n) => t("dim", n))}`;
|
|
4103
|
+
}
|
|
4104
|
+
};
|
|
4105
|
+
return new nt({ options: e.options, signal: e.signal, input: e.input, output: e.output, initialValue: e.initialValue, render() {
|
|
4106
|
+
const s = e.withGuide ?? u.withGuide, r = `${V2(this.state)} `, u2 = `${ye(this.state)} `, n = R(e.output, e.message, u2, r), o = `${s ? `${t("gray", d2)}
|
|
4107
|
+
` : ""}${n}
|
|
4108
|
+
`;
|
|
4109
|
+
switch (this.state) {
|
|
4110
|
+
case "submit": {
|
|
4111
|
+
const c26 = s ? `${t("gray", d2)} ` : "", a = R(e.output, i(this.options[this.cursor], "selected"), c26);
|
|
4112
|
+
return `${o}${a}`;
|
|
4113
|
+
}
|
|
4114
|
+
case "cancel": {
|
|
4115
|
+
const c26 = s ? `${t("gray", d2)} ` : "", a = R(e.output, i(this.options[this.cursor], "cancelled"), c26);
|
|
4116
|
+
return `${o}${a}${s ? `
|
|
4117
|
+
${t("gray", d2)}` : ""}`;
|
|
4118
|
+
}
|
|
4119
|
+
default: {
|
|
4120
|
+
const c26 = s ? `${t("cyan", d2)} ` : "", a = s ? t("cyan", E2) : "", l = o.split(`
|
|
4121
|
+
`).length, $2 = s ? 2 : 1;
|
|
4122
|
+
return `${o}${c26}${Y2({ output: e.output, cursor: this.cursor, options: this.options, maxItems: e.maxItems, columnPadding: c26.length, rowPadding: l + $2, style: (y2, p2) => i(y2, y2.disabled ? "disabled" : p2 ? "active" : "inactive") }).join(`
|
|
4123
|
+
${c26}`)}
|
|
4124
|
+
${a}
|
|
4125
|
+
`;
|
|
4126
|
+
}
|
|
4127
|
+
}
|
|
4128
|
+
} }).prompt();
|
|
4129
|
+
};
|
|
4130
|
+
var je = `${t("gray", d2)} `;
|
|
3357
4131
|
|
|
3358
4132
|
// ../../node_modules/.bun/@ts-rest+core@3.53.0-rc.1+f9199aabcde8d6a0/node_modules/@ts-rest/core/index.esm.mjs
|
|
3359
4133
|
var util;
|
|
@@ -3407,7 +4181,7 @@ var util;
|
|
|
3407
4181
|
return array2.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
|
|
3408
4182
|
}
|
|
3409
4183
|
util2.joinValues = joinValues2;
|
|
3410
|
-
util2.jsonStringifyReplacer = (
|
|
4184
|
+
util2.jsonStringifyReplacer = (_2, value) => {
|
|
3411
4185
|
if (typeof value === "bigint") {
|
|
3412
4186
|
return value.toString();
|
|
3413
4187
|
}
|
|
@@ -3447,8 +4221,8 @@ var ZodParsedType = util.arrayToEnum([
|
|
|
3447
4221
|
"set"
|
|
3448
4222
|
]);
|
|
3449
4223
|
var getParsedType = (data) => {
|
|
3450
|
-
const
|
|
3451
|
-
switch (
|
|
4224
|
+
const t2 = typeof data;
|
|
4225
|
+
switch (t2) {
|
|
3452
4226
|
case "undefined":
|
|
3453
4227
|
return ZodParsedType.undefined;
|
|
3454
4228
|
case "string":
|
|
@@ -6269,29 +7043,29 @@ var ZodFunction = class _ZodFunction extends ZodType {
|
|
|
6269
7043
|
const params = { errorMap: ctx.common.contextualErrorMap };
|
|
6270
7044
|
const fn = ctx.data;
|
|
6271
7045
|
if (this._def.returns instanceof ZodPromise) {
|
|
6272
|
-
const
|
|
7046
|
+
const me2 = this;
|
|
6273
7047
|
return OK(async function(...args) {
|
|
6274
7048
|
const error48 = new ZodError([]);
|
|
6275
|
-
const parsedArgs = await
|
|
7049
|
+
const parsedArgs = await me2._def.args.parseAsync(args, params).catch((e) => {
|
|
6276
7050
|
error48.addIssue(makeArgsIssue(args, e));
|
|
6277
7051
|
throw error48;
|
|
6278
7052
|
});
|
|
6279
7053
|
const result = await Reflect.apply(fn, this, parsedArgs);
|
|
6280
|
-
const parsedReturns = await
|
|
7054
|
+
const parsedReturns = await me2._def.returns._def.type.parseAsync(result, params).catch((e) => {
|
|
6281
7055
|
error48.addIssue(makeReturnsIssue(result, e));
|
|
6282
7056
|
throw error48;
|
|
6283
7057
|
});
|
|
6284
7058
|
return parsedReturns;
|
|
6285
7059
|
});
|
|
6286
7060
|
} else {
|
|
6287
|
-
const
|
|
7061
|
+
const me2 = this;
|
|
6288
7062
|
return OK(function(...args) {
|
|
6289
|
-
const parsedArgs =
|
|
7063
|
+
const parsedArgs = me2._def.args.safeParse(args, params);
|
|
6290
7064
|
if (!parsedArgs.success) {
|
|
6291
7065
|
throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
|
|
6292
7066
|
}
|
|
6293
7067
|
const result = Reflect.apply(fn, this, parsedArgs.data);
|
|
6294
|
-
const parsedReturns =
|
|
7068
|
+
const parsedReturns = me2._def.returns.safeParse(result, params);
|
|
6295
7069
|
if (!parsedReturns.success) {
|
|
6296
7070
|
throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
|
|
6297
7071
|
}
|
|
@@ -6855,10 +7629,10 @@ var custom = (check2, params = {}, fatal) => {
|
|
|
6855
7629
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
6856
7630
|
var _a2, _b;
|
|
6857
7631
|
if (!check2(data)) {
|
|
6858
|
-
const
|
|
6859
|
-
const _fatal = (_b = (_a2 =
|
|
6860
|
-
const
|
|
6861
|
-
ctx.addIssue({ code: "custom", ...
|
|
7632
|
+
const p2 = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
|
|
7633
|
+
const _fatal = (_b = (_a2 = p2.fatal) !== null && _a2 !== void 0 ? _a2 : fatal) !== null && _b !== void 0 ? _b : true;
|
|
7634
|
+
const p22 = typeof p2 === "string" ? { message: p2 } : p2;
|
|
7635
|
+
ctx.addIssue({ code: "custom", ...p22, fatal: _fatal });
|
|
6862
7636
|
}
|
|
6863
7637
|
});
|
|
6864
7638
|
return ZodAny.create();
|
|
@@ -6956,7 +7730,7 @@ var coerce = {
|
|
|
6956
7730
|
date: ((arg) => ZodDate.create({ ...arg, coerce: true }))
|
|
6957
7731
|
};
|
|
6958
7732
|
var NEVER = INVALID;
|
|
6959
|
-
var
|
|
7733
|
+
var z3 = /* @__PURE__ */ Object.freeze({
|
|
6960
7734
|
__proto__: null,
|
|
6961
7735
|
defaultErrorMap: errorMap,
|
|
6962
7736
|
setErrorMap,
|
|
@@ -7089,17 +7863,17 @@ var zodMerge = (objectA, objectB) => {
|
|
|
7089
7863
|
}
|
|
7090
7864
|
return Object.assign({}, objectA, objectB);
|
|
7091
7865
|
};
|
|
7092
|
-
var ZodErrorSchema =
|
|
7093
|
-
name:
|
|
7094
|
-
issues:
|
|
7095
|
-
path:
|
|
7096
|
-
message:
|
|
7097
|
-
code:
|
|
7098
|
-
}).catchall(
|
|
7866
|
+
var ZodErrorSchema = z3.object({
|
|
7867
|
+
name: z3.literal("ZodError"),
|
|
7868
|
+
issues: z3.array(z3.object({
|
|
7869
|
+
path: z3.array(z3.union([z3.string(), z3.number()])),
|
|
7870
|
+
message: z3.string().optional(),
|
|
7871
|
+
code: z3.nativeEnum(z3.ZodIssueCode)
|
|
7872
|
+
}).catchall(z3.any()))
|
|
7099
7873
|
});
|
|
7100
7874
|
var StandardSchemaError = class extends Error {
|
|
7101
7875
|
constructor(issues) {
|
|
7102
|
-
const message = JSON.stringify(issues, (
|
|
7876
|
+
const message = JSON.stringify(issues, (_2, value) => typeof value === "bigint" ? value.toString() : value, 2);
|
|
7103
7877
|
super(message);
|
|
7104
7878
|
this.name = "ValidationError";
|
|
7105
7879
|
this.issues = issues;
|
|
@@ -7112,21 +7886,21 @@ var StandardSchemaError = class extends Error {
|
|
|
7112
7886
|
return this.message;
|
|
7113
7887
|
}
|
|
7114
7888
|
};
|
|
7115
|
-
var RequestValidationErrorSchema =
|
|
7116
|
-
message:
|
|
7889
|
+
var RequestValidationErrorSchema = z3.object({
|
|
7890
|
+
message: z3.literal("Request validation failed"),
|
|
7117
7891
|
pathParameterErrors: ZodErrorSchema.nullable(),
|
|
7118
7892
|
headerErrors: ZodErrorSchema.nullable(),
|
|
7119
7893
|
queryParameterErrors: ZodErrorSchema.nullable(),
|
|
7120
7894
|
bodyErrors: ZodErrorSchema.nullable()
|
|
7121
7895
|
});
|
|
7122
|
-
var RequestValidationErrorSchemaWithoutMessage =
|
|
7896
|
+
var RequestValidationErrorSchemaWithoutMessage = z3.object({
|
|
7123
7897
|
// No message, express never had this implemented
|
|
7124
7898
|
pathParameterErrors: ZodErrorSchema.nullable(),
|
|
7125
7899
|
headerErrors: ZodErrorSchema.nullable(),
|
|
7126
7900
|
queryParameterErrors: ZodErrorSchema.nullable(),
|
|
7127
7901
|
bodyErrors: ZodErrorSchema.nullable()
|
|
7128
7902
|
});
|
|
7129
|
-
var RequestValidationErrorSchemaForNest =
|
|
7903
|
+
var RequestValidationErrorSchemaForNest = z3.object({
|
|
7130
7904
|
paramsResult: ZodErrorSchema.nullable(),
|
|
7131
7905
|
headersResult: ZodErrorSchema.nullable(),
|
|
7132
7906
|
queryResult: ZodErrorSchema.nullable(),
|
|
@@ -7263,7 +8037,7 @@ var initContract = () => {
|
|
|
7263
8037
|
};
|
|
7264
8038
|
var insertParamsIntoPath = ({ path, params }) => {
|
|
7265
8039
|
const pathParams = params;
|
|
7266
|
-
return path.replace(/\/?:([^/?]+)\??/g, (matched,
|
|
8040
|
+
return path.replace(/\/?:([^/?]+)\??/g, (matched, p2) => pathParams[p2] ? `${matched.startsWith("/") ? "/" : ""}${pathParams[p2]}` : "");
|
|
7267
8041
|
};
|
|
7268
8042
|
var convertQueryParamsToUrlString = (query, json2 = false) => {
|
|
7269
8043
|
const queryString = json2 ? encodeQueryParamsJson(query) : encodeQueryParams(query);
|
|
@@ -8060,7 +8834,7 @@ function $constructor(name, initializer3, params) {
|
|
|
8060
8834
|
Object.defineProperty(inst, "_zod", {
|
|
8061
8835
|
value: {
|
|
8062
8836
|
def,
|
|
8063
|
-
constr:
|
|
8837
|
+
constr: _2,
|
|
8064
8838
|
traits: /* @__PURE__ */ new Set()
|
|
8065
8839
|
},
|
|
8066
8840
|
enumerable: false
|
|
@@ -8071,7 +8845,7 @@ function $constructor(name, initializer3, params) {
|
|
|
8071
8845
|
}
|
|
8072
8846
|
inst._zod.traits.add(name);
|
|
8073
8847
|
initializer3(inst, def);
|
|
8074
|
-
const proto2 =
|
|
8848
|
+
const proto2 = _2.prototype;
|
|
8075
8849
|
const keys = Object.keys(proto2);
|
|
8076
8850
|
for (let i = 0; i < keys.length; i++) {
|
|
8077
8851
|
const k = keys[i];
|
|
@@ -8084,7 +8858,7 @@ function $constructor(name, initializer3, params) {
|
|
|
8084
8858
|
class Definition extends Parent {
|
|
8085
8859
|
}
|
|
8086
8860
|
Object.defineProperty(Definition, "name", { value: name });
|
|
8087
|
-
function
|
|
8861
|
+
function _2(def) {
|
|
8088
8862
|
var _a2;
|
|
8089
8863
|
const inst = params?.Parent ? new Definition() : this;
|
|
8090
8864
|
init(inst, def);
|
|
@@ -8094,16 +8868,16 @@ function $constructor(name, initializer3, params) {
|
|
|
8094
8868
|
}
|
|
8095
8869
|
return inst;
|
|
8096
8870
|
}
|
|
8097
|
-
Object.defineProperty(
|
|
8098
|
-
Object.defineProperty(
|
|
8871
|
+
Object.defineProperty(_2, "init", { value: init });
|
|
8872
|
+
Object.defineProperty(_2, Symbol.hasInstance, {
|
|
8099
8873
|
value: (inst) => {
|
|
8100
8874
|
if (params?.Parent && inst instanceof params.Parent)
|
|
8101
8875
|
return true;
|
|
8102
8876
|
return inst?._zod?.traits?.has(name);
|
|
8103
8877
|
}
|
|
8104
8878
|
});
|
|
8105
|
-
Object.defineProperty(
|
|
8106
|
-
return
|
|
8879
|
+
Object.defineProperty(_2, "name", { value: name });
|
|
8880
|
+
return _2;
|
|
8107
8881
|
}
|
|
8108
8882
|
var $brand = /* @__PURE__ */ Symbol("zod_brand");
|
|
8109
8883
|
var $ZodAsyncError = class extends Error {
|
|
@@ -8201,17 +8975,17 @@ function assertIs(_arg) {
|
|
|
8201
8975
|
function assertNever(_x) {
|
|
8202
8976
|
throw new Error("Unexpected value in exhaustive check");
|
|
8203
8977
|
}
|
|
8204
|
-
function assert(
|
|
8978
|
+
function assert(_2) {
|
|
8205
8979
|
}
|
|
8206
8980
|
function getEnumValues(entries) {
|
|
8207
8981
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
8208
|
-
const values = Object.entries(entries).filter(([k,
|
|
8982
|
+
const values = Object.entries(entries).filter(([k, _2]) => numericValues.indexOf(+k) === -1).map(([_2, v]) => v);
|
|
8209
8983
|
return values;
|
|
8210
8984
|
}
|
|
8211
8985
|
function joinValues(array2, separator = "|") {
|
|
8212
8986
|
return array2.map((val) => stringifyPrimitive(val)).join(separator);
|
|
8213
8987
|
}
|
|
8214
|
-
function jsonStringifyReplacer(
|
|
8988
|
+
function jsonStringifyReplacer(_2, value) {
|
|
8215
8989
|
if (typeof value === "bigint")
|
|
8216
8990
|
return value.toString();
|
|
8217
8991
|
return value;
|
|
@@ -8337,10 +9111,10 @@ var allowsEval = cached(() => {
|
|
|
8337
9111
|
return false;
|
|
8338
9112
|
}
|
|
8339
9113
|
try {
|
|
8340
|
-
const
|
|
8341
|
-
new
|
|
9114
|
+
const F2 = Function;
|
|
9115
|
+
new F2("");
|
|
8342
9116
|
return true;
|
|
8343
|
-
} catch (
|
|
9117
|
+
} catch (_2) {
|
|
8344
9118
|
return false;
|
|
8345
9119
|
}
|
|
8346
9120
|
});
|
|
@@ -8377,8 +9151,8 @@ function numKeys(data) {
|
|
|
8377
9151
|
return keyCount;
|
|
8378
9152
|
}
|
|
8379
9153
|
var getParsedType2 = (data) => {
|
|
8380
|
-
const
|
|
8381
|
-
switch (
|
|
9154
|
+
const t2 = typeof data;
|
|
9155
|
+
switch (t2) {
|
|
8382
9156
|
case "undefined":
|
|
8383
9157
|
return "undefined";
|
|
8384
9158
|
case "string":
|
|
@@ -8417,7 +9191,7 @@ var getParsedType2 = (data) => {
|
|
|
8417
9191
|
}
|
|
8418
9192
|
return "object";
|
|
8419
9193
|
default:
|
|
8420
|
-
throw new Error(`Unknown data type: ${
|
|
9194
|
+
throw new Error(`Unknown data type: ${t2}`);
|
|
8421
9195
|
}
|
|
8422
9196
|
};
|
|
8423
9197
|
var propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
|
|
@@ -8450,31 +9224,31 @@ function normalizeParams(_params) {
|
|
|
8450
9224
|
function createTransparentProxy(getter) {
|
|
8451
9225
|
let target;
|
|
8452
9226
|
return new Proxy({}, {
|
|
8453
|
-
get(
|
|
9227
|
+
get(_2, prop, receiver) {
|
|
8454
9228
|
target ?? (target = getter());
|
|
8455
9229
|
return Reflect.get(target, prop, receiver);
|
|
8456
9230
|
},
|
|
8457
|
-
set(
|
|
9231
|
+
set(_2, prop, value, receiver) {
|
|
8458
9232
|
target ?? (target = getter());
|
|
8459
9233
|
return Reflect.set(target, prop, value, receiver);
|
|
8460
9234
|
},
|
|
8461
|
-
has(
|
|
9235
|
+
has(_2, prop) {
|
|
8462
9236
|
target ?? (target = getter());
|
|
8463
9237
|
return Reflect.has(target, prop);
|
|
8464
9238
|
},
|
|
8465
|
-
deleteProperty(
|
|
9239
|
+
deleteProperty(_2, prop) {
|
|
8466
9240
|
target ?? (target = getter());
|
|
8467
9241
|
return Reflect.deleteProperty(target, prop);
|
|
8468
9242
|
},
|
|
8469
|
-
ownKeys(
|
|
9243
|
+
ownKeys(_2) {
|
|
8470
9244
|
target ?? (target = getter());
|
|
8471
9245
|
return Reflect.ownKeys(target);
|
|
8472
9246
|
},
|
|
8473
|
-
getOwnPropertyDescriptor(
|
|
9247
|
+
getOwnPropertyDescriptor(_2, prop) {
|
|
8474
9248
|
target ?? (target = getter());
|
|
8475
9249
|
return Reflect.getOwnPropertyDescriptor(target, prop);
|
|
8476
9250
|
},
|
|
8477
|
-
defineProperty(
|
|
9251
|
+
defineProperty(_2, prop, descriptor) {
|
|
8478
9252
|
target ?? (target = getter());
|
|
8479
9253
|
return Reflect.defineProperty(target, prop, descriptor);
|
|
8480
9254
|
}
|
|
@@ -8724,8 +9498,8 @@ function getLengthableOrigin(input) {
|
|
|
8724
9498
|
return "unknown";
|
|
8725
9499
|
}
|
|
8726
9500
|
function parsedType(data) {
|
|
8727
|
-
const
|
|
8728
|
-
switch (
|
|
9501
|
+
const t2 = typeof data;
|
|
9502
|
+
switch (t2) {
|
|
8729
9503
|
case "number": {
|
|
8730
9504
|
return Number.isNaN(data) ? "nan" : "number";
|
|
8731
9505
|
}
|
|
@@ -8742,7 +9516,7 @@ function parsedType(data) {
|
|
|
8742
9516
|
}
|
|
8743
9517
|
}
|
|
8744
9518
|
}
|
|
8745
|
-
return
|
|
9519
|
+
return t2;
|
|
8746
9520
|
}
|
|
8747
9521
|
function issue(...args) {
|
|
8748
9522
|
const [iss, input, inst] = args;
|
|
@@ -8757,7 +9531,7 @@ function issue(...args) {
|
|
|
8757
9531
|
return { ...iss };
|
|
8758
9532
|
}
|
|
8759
9533
|
function cleanEnum(obj) {
|
|
8760
|
-
return Object.entries(obj).filter(([k,
|
|
9534
|
+
return Object.entries(obj).filter(([k, _2]) => {
|
|
8761
9535
|
return Number.isNaN(Number.parseInt(k, 10));
|
|
8762
9536
|
}).map((el) => el[1]);
|
|
8763
9537
|
}
|
|
@@ -9760,11 +10534,11 @@ var Doc = class {
|
|
|
9760
10534
|
}
|
|
9761
10535
|
}
|
|
9762
10536
|
compile() {
|
|
9763
|
-
const
|
|
10537
|
+
const F2 = Function;
|
|
9764
10538
|
const args = this?.args;
|
|
9765
10539
|
const content = this?.content ?? [``];
|
|
9766
10540
|
const lines = [...content.map((x) => ` ${x}`)];
|
|
9767
|
-
return new
|
|
10541
|
+
return new F2(...args, lines.join("\n"));
|
|
9768
10542
|
}
|
|
9769
10543
|
};
|
|
9770
10544
|
|
|
@@ -9809,13 +10583,13 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
9809
10583
|
continue;
|
|
9810
10584
|
}
|
|
9811
10585
|
const currLen = payload.issues.length;
|
|
9812
|
-
const
|
|
9813
|
-
if (
|
|
10586
|
+
const _2 = ch._zod.check(payload);
|
|
10587
|
+
if (_2 instanceof Promise && ctx?.async === false) {
|
|
9814
10588
|
throw new $ZodAsyncError();
|
|
9815
10589
|
}
|
|
9816
|
-
if (asyncResult ||
|
|
10590
|
+
if (asyncResult || _2 instanceof Promise) {
|
|
9817
10591
|
asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
9818
|
-
await
|
|
10592
|
+
await _2;
|
|
9819
10593
|
const nextLen = payload.issues.length;
|
|
9820
10594
|
if (nextLen === currLen)
|
|
9821
10595
|
return;
|
|
@@ -9877,7 +10651,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
9877
10651
|
try {
|
|
9878
10652
|
const r = safeParse(inst, value);
|
|
9879
10653
|
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
9880
|
-
} catch (
|
|
10654
|
+
} catch (_2) {
|
|
9881
10655
|
return safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
|
|
9882
10656
|
}
|
|
9883
10657
|
},
|
|
@@ -9888,11 +10662,11 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
9888
10662
|
var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
9889
10663
|
$ZodType.init(inst, def);
|
|
9890
10664
|
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
|
|
9891
|
-
inst._zod.parse = (payload,
|
|
10665
|
+
inst._zod.parse = (payload, _2) => {
|
|
9892
10666
|
if (def.coerce)
|
|
9893
10667
|
try {
|
|
9894
10668
|
payload.value = String(payload.value);
|
|
9895
|
-
} catch (
|
|
10669
|
+
} catch (_3) {
|
|
9896
10670
|
}
|
|
9897
10671
|
if (typeof payload.value === "string")
|
|
9898
10672
|
return payload;
|
|
@@ -9977,7 +10751,7 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
|
9977
10751
|
payload.value = trimmed;
|
|
9978
10752
|
}
|
|
9979
10753
|
return;
|
|
9980
|
-
} catch (
|
|
10754
|
+
} catch (_2) {
|
|
9981
10755
|
payload.issues.push({
|
|
9982
10756
|
code: "invalid_format",
|
|
9983
10757
|
format: "url",
|
|
@@ -10123,7 +10897,7 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
|
10123
10897
|
function isValidBase64URL(data) {
|
|
10124
10898
|
if (!base64url.test(data))
|
|
10125
10899
|
return false;
|
|
10126
|
-
const base643 = data.replace(/[-_]/g, (
|
|
10900
|
+
const base643 = data.replace(/[-_]/g, (c26) => c26 === "-" ? "+" : "/");
|
|
10127
10901
|
const padded = base643.padEnd(Math.ceil(base643.length / 4) * 4, "=");
|
|
10128
10902
|
return isValidBase64(padded);
|
|
10129
10903
|
}
|
|
@@ -10202,7 +10976,7 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
|
10202
10976
|
if (def.coerce)
|
|
10203
10977
|
try {
|
|
10204
10978
|
payload.value = Number(payload.value);
|
|
10205
|
-
} catch (
|
|
10979
|
+
} catch (_2) {
|
|
10206
10980
|
}
|
|
10207
10981
|
const input = payload.value;
|
|
10208
10982
|
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
|
|
@@ -10230,7 +11004,7 @@ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
|
10230
11004
|
if (def.coerce)
|
|
10231
11005
|
try {
|
|
10232
11006
|
payload.value = Boolean(payload.value);
|
|
10233
|
-
} catch (
|
|
11007
|
+
} catch (_2) {
|
|
10234
11008
|
}
|
|
10235
11009
|
const input = payload.value;
|
|
10236
11010
|
if (typeof input === "boolean")
|
|
@@ -10251,7 +11025,7 @@ var $ZodBigInt = /* @__PURE__ */ $constructor("$ZodBigInt", (inst, def) => {
|
|
|
10251
11025
|
if (def.coerce)
|
|
10252
11026
|
try {
|
|
10253
11027
|
payload.value = BigInt(payload.value);
|
|
10254
|
-
} catch (
|
|
11028
|
+
} catch (_2) {
|
|
10255
11029
|
}
|
|
10256
11030
|
if (typeof payload.value === "bigint")
|
|
10257
11031
|
return payload;
|
|
@@ -10452,12 +11226,12 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
10452
11226
|
const unrecognized = [];
|
|
10453
11227
|
const keySet = def.keySet;
|
|
10454
11228
|
const _catchall = def.catchall._zod;
|
|
10455
|
-
const
|
|
11229
|
+
const t2 = _catchall.def.type;
|
|
10456
11230
|
const isOptionalOut = _catchall.optout === "optional";
|
|
10457
11231
|
for (const key in input) {
|
|
10458
11232
|
if (keySet.has(key))
|
|
10459
11233
|
continue;
|
|
10460
|
-
if (
|
|
11234
|
+
if (t2 === "never") {
|
|
10461
11235
|
unrecognized.push(key);
|
|
10462
11236
|
continue;
|
|
10463
11237
|
}
|
|
@@ -10677,7 +11451,7 @@ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
10677
11451
|
defineLazy(inst._zod, "pattern", () => {
|
|
10678
11452
|
if (def.options.every((o) => o._zod.pattern)) {
|
|
10679
11453
|
const patterns = def.options.map((o) => o._zod.pattern);
|
|
10680
|
-
return new RegExp(`^(${patterns.map((
|
|
11454
|
+
return new RegExp(`^(${patterns.map((p2) => cleanRegex(p2.source)).join("|")})$`);
|
|
10681
11455
|
}
|
|
10682
11456
|
return void 0;
|
|
10683
11457
|
});
|
|
@@ -11666,9 +12440,9 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
|
|
|
11666
12440
|
return payload;
|
|
11667
12441
|
};
|
|
11668
12442
|
inst.input = (...args) => {
|
|
11669
|
-
const
|
|
12443
|
+
const F2 = inst.constructor;
|
|
11670
12444
|
if (Array.isArray(args[0])) {
|
|
11671
|
-
return new
|
|
12445
|
+
return new F2({
|
|
11672
12446
|
type: "function",
|
|
11673
12447
|
input: new $ZodTuple({
|
|
11674
12448
|
type: "tuple",
|
|
@@ -11678,15 +12452,15 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
|
|
|
11678
12452
|
output: inst._def.output
|
|
11679
12453
|
});
|
|
11680
12454
|
}
|
|
11681
|
-
return new
|
|
12455
|
+
return new F2({
|
|
11682
12456
|
type: "function",
|
|
11683
12457
|
input: args[0],
|
|
11684
12458
|
output: inst._def.output
|
|
11685
12459
|
});
|
|
11686
12460
|
};
|
|
11687
12461
|
inst.output = (output) => {
|
|
11688
|
-
const
|
|
11689
|
-
return new
|
|
12462
|
+
const F2 = inst.constructor;
|
|
12463
|
+
return new F2({
|
|
11690
12464
|
type: "function",
|
|
11691
12465
|
input: inst._def.input,
|
|
11692
12466
|
output
|
|
@@ -11715,7 +12489,7 @@ var $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => {
|
|
|
11715
12489
|
var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
11716
12490
|
$ZodCheck.init(inst, def);
|
|
11717
12491
|
$ZodType.init(inst, def);
|
|
11718
|
-
inst._zod.parse = (payload,
|
|
12492
|
+
inst._zod.parse = (payload, _2) => {
|
|
11719
12493
|
return payload;
|
|
11720
12494
|
};
|
|
11721
12495
|
inst._zod.check = (payload) => {
|
|
@@ -13564,16 +14338,16 @@ var error16 = () => {
|
|
|
13564
14338
|
number: { unit: "", shortLabel: "\u05E7\u05D8\u05DF", longLabel: "\u05D2\u05D3\u05D5\u05DC" }
|
|
13565
14339
|
// no unit
|
|
13566
14340
|
};
|
|
13567
|
-
const typeEntry = (
|
|
13568
|
-
const typeLabel = (
|
|
13569
|
-
const e = typeEntry(
|
|
14341
|
+
const typeEntry = (t2) => t2 ? TypeNames[t2] : void 0;
|
|
14342
|
+
const typeLabel = (t2) => {
|
|
14343
|
+
const e = typeEntry(t2);
|
|
13570
14344
|
if (e)
|
|
13571
14345
|
return e.label;
|
|
13572
|
-
return
|
|
14346
|
+
return t2 ?? TypeNames.unknown.label;
|
|
13573
14347
|
};
|
|
13574
|
-
const withDefinite = (
|
|
13575
|
-
const verbFor = (
|
|
13576
|
-
const e = typeEntry(
|
|
14348
|
+
const withDefinite = (t2) => `\u05D4${typeLabel(t2)}`;
|
|
14349
|
+
const verbFor = (t2) => {
|
|
14350
|
+
const e = typeEntry(t2);
|
|
13577
14351
|
const gender = e?.gender ?? "m";
|
|
13578
14352
|
return gender === "f" ? "\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA" : "\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA";
|
|
13579
14353
|
};
|
|
@@ -13657,11 +14431,11 @@ var error16 = () => {
|
|
|
13657
14431
|
return `\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${subject} ${verb} \u05DC\u05D4\u05DB\u05D9\u05DC ${comparison}`.trim();
|
|
13658
14432
|
}
|
|
13659
14433
|
const adj = issue2.inclusive ? "<=" : "<";
|
|
13660
|
-
const
|
|
14434
|
+
const be2 = verbFor(issue2.origin ?? "value");
|
|
13661
14435
|
if (sizing?.unit) {
|
|
13662
|
-
return `${sizing.longLabel} \u05DE\u05D3\u05D9: ${subject} ${
|
|
14436
|
+
return `${sizing.longLabel} \u05DE\u05D3\u05D9: ${subject} ${be2} ${adj}${issue2.maximum.toString()} ${sizing.unit}`;
|
|
13663
14437
|
}
|
|
13664
|
-
return `${sizing?.longLabel ?? "\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${subject} ${
|
|
14438
|
+
return `${sizing?.longLabel ?? "\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${subject} ${be2} ${adj}${issue2.maximum.toString()}`;
|
|
13665
14439
|
}
|
|
13666
14440
|
case "too_small": {
|
|
13667
14441
|
const sizing = getSizing(issue2.origin);
|
|
@@ -13683,11 +14457,11 @@ var error16 = () => {
|
|
|
13683
14457
|
return `\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${subject} ${verb} \u05DC\u05D4\u05DB\u05D9\u05DC ${comparison}`.trim();
|
|
13684
14458
|
}
|
|
13685
14459
|
const adj = issue2.inclusive ? ">=" : ">";
|
|
13686
|
-
const
|
|
14460
|
+
const be2 = verbFor(issue2.origin ?? "value");
|
|
13687
14461
|
if (sizing?.unit) {
|
|
13688
|
-
return `${sizing.shortLabel} \u05DE\u05D3\u05D9: ${subject} ${
|
|
14462
|
+
return `${sizing.shortLabel} \u05DE\u05D3\u05D9: ${subject} ${be2} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
|
|
13689
14463
|
}
|
|
13690
|
-
return `${sizing?.shortLabel ?? "\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${subject} ${
|
|
14464
|
+
return `${sizing?.shortLabel ?? "\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${subject} ${be2} ${adj}${issue2.minimum.toString()}`;
|
|
13691
14465
|
}
|
|
13692
14466
|
case "invalid_format": {
|
|
13693
14467
|
const _issue = issue2;
|
|
@@ -17354,9 +18128,9 @@ var $ZodRegistry = class {
|
|
|
17354
18128
|
return this;
|
|
17355
18129
|
}
|
|
17356
18130
|
get(schema) {
|
|
17357
|
-
const
|
|
17358
|
-
if (
|
|
17359
|
-
const pm = { ...this.get(
|
|
18131
|
+
const p2 = schema._zod.parent;
|
|
18132
|
+
if (p2) {
|
|
18133
|
+
const pm = { ...this.get(p2) ?? {} };
|
|
17360
18134
|
delete pm.id;
|
|
17361
18135
|
const f = { ...pm, ...this._map.get(schema) };
|
|
17362
18136
|
return Object.keys(f).length ? f : void 0;
|
|
@@ -19286,7 +20060,7 @@ function toJSONSchema(input, params) {
|
|
|
19286
20060
|
const ctx2 = initializeContext({ ...params, processors: allProcessors });
|
|
19287
20061
|
const defs = {};
|
|
19288
20062
|
for (const entry of registry2._idmap.entries()) {
|
|
19289
|
-
const [
|
|
20063
|
+
const [_2, schema] = entry;
|
|
19290
20064
|
process2(schema, ctx2);
|
|
19291
20065
|
}
|
|
19292
20066
|
const schemas = {};
|
|
@@ -19385,7 +20159,7 @@ var JSONSchemaGenerator = class {
|
|
|
19385
20159
|
}
|
|
19386
20160
|
extractDefs(this.ctx, schema);
|
|
19387
20161
|
const result = finalize(this.ctx, schema);
|
|
19388
|
-
const { "~standard":
|
|
20162
|
+
const { "~standard": _2, ...plainResult } = result;
|
|
19389
20163
|
return plainResult;
|
|
19390
20164
|
}
|
|
19391
20165
|
};
|
|
@@ -20167,9 +20941,9 @@ var ZodDate2 = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
|
|
|
20167
20941
|
inst._zod.processJSONSchema = (ctx, json2, params) => dateProcessor(inst, ctx, json2, params);
|
|
20168
20942
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
20169
20943
|
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
20170
|
-
const
|
|
20171
|
-
inst.minDate =
|
|
20172
|
-
inst.maxDate =
|
|
20944
|
+
const c26 = inst._zod.bag;
|
|
20945
|
+
inst.minDate = c26.minimum ? new Date(c26.minimum) : null;
|
|
20946
|
+
inst.maxDate = c26.maximum ? new Date(c26.maximum) : null;
|
|
20173
20947
|
});
|
|
20174
20948
|
function date3(params) {
|
|
20175
20949
|
return _date(ZodDate2, params);
|
|
@@ -20797,7 +21571,7 @@ var ZodFirstPartyTypeKind2;
|
|
|
20797
21571
|
})(ZodFirstPartyTypeKind2 || (ZodFirstPartyTypeKind2 = {}));
|
|
20798
21572
|
|
|
20799
21573
|
// ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/from-json-schema.js
|
|
20800
|
-
var
|
|
21574
|
+
var z4 = {
|
|
20801
21575
|
...schemas_exports2,
|
|
20802
21576
|
...checks_exports2,
|
|
20803
21577
|
iso: iso_exports
|
|
@@ -20907,7 +21681,7 @@ function resolveRef(ref, ctx) {
|
|
|
20907
21681
|
function convertBaseSchema(schema, ctx) {
|
|
20908
21682
|
if (schema.not !== void 0) {
|
|
20909
21683
|
if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
|
|
20910
|
-
return
|
|
21684
|
+
return z4.never();
|
|
20911
21685
|
}
|
|
20912
21686
|
throw new Error("not is not supported in Zod (except { not: {} } for never)");
|
|
20913
21687
|
}
|
|
@@ -20929,7 +21703,7 @@ function convertBaseSchema(schema, ctx) {
|
|
|
20929
21703
|
return ctx.refs.get(refPath);
|
|
20930
21704
|
}
|
|
20931
21705
|
if (ctx.processing.has(refPath)) {
|
|
20932
|
-
return
|
|
21706
|
+
return z4.lazy(() => {
|
|
20933
21707
|
if (!ctx.refs.has(refPath)) {
|
|
20934
21708
|
throw new Error(`Circular reference not resolved: ${refPath}`);
|
|
20935
21709
|
}
|
|
@@ -20946,95 +21720,95 @@ function convertBaseSchema(schema, ctx) {
|
|
|
20946
21720
|
if (schema.enum !== void 0) {
|
|
20947
21721
|
const enumValues = schema.enum;
|
|
20948
21722
|
if (ctx.version === "openapi-3.0" && schema.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
|
|
20949
|
-
return
|
|
21723
|
+
return z4.null();
|
|
20950
21724
|
}
|
|
20951
21725
|
if (enumValues.length === 0) {
|
|
20952
|
-
return
|
|
21726
|
+
return z4.never();
|
|
20953
21727
|
}
|
|
20954
21728
|
if (enumValues.length === 1) {
|
|
20955
|
-
return
|
|
21729
|
+
return z4.literal(enumValues[0]);
|
|
20956
21730
|
}
|
|
20957
21731
|
if (enumValues.every((v) => typeof v === "string")) {
|
|
20958
|
-
return
|
|
21732
|
+
return z4.enum(enumValues);
|
|
20959
21733
|
}
|
|
20960
|
-
const literalSchemas = enumValues.map((v) =>
|
|
21734
|
+
const literalSchemas = enumValues.map((v) => z4.literal(v));
|
|
20961
21735
|
if (literalSchemas.length < 2) {
|
|
20962
21736
|
return literalSchemas[0];
|
|
20963
21737
|
}
|
|
20964
|
-
return
|
|
21738
|
+
return z4.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
|
|
20965
21739
|
}
|
|
20966
21740
|
if (schema.const !== void 0) {
|
|
20967
|
-
return
|
|
21741
|
+
return z4.literal(schema.const);
|
|
20968
21742
|
}
|
|
20969
21743
|
const type = schema.type;
|
|
20970
21744
|
if (Array.isArray(type)) {
|
|
20971
|
-
const typeSchemas = type.map((
|
|
20972
|
-
const typeSchema = { ...schema, type:
|
|
21745
|
+
const typeSchemas = type.map((t2) => {
|
|
21746
|
+
const typeSchema = { ...schema, type: t2 };
|
|
20973
21747
|
return convertBaseSchema(typeSchema, ctx);
|
|
20974
21748
|
});
|
|
20975
21749
|
if (typeSchemas.length === 0) {
|
|
20976
|
-
return
|
|
21750
|
+
return z4.never();
|
|
20977
21751
|
}
|
|
20978
21752
|
if (typeSchemas.length === 1) {
|
|
20979
21753
|
return typeSchemas[0];
|
|
20980
21754
|
}
|
|
20981
|
-
return
|
|
21755
|
+
return z4.union(typeSchemas);
|
|
20982
21756
|
}
|
|
20983
21757
|
if (!type) {
|
|
20984
|
-
return
|
|
21758
|
+
return z4.any();
|
|
20985
21759
|
}
|
|
20986
21760
|
let zodSchema;
|
|
20987
21761
|
switch (type) {
|
|
20988
21762
|
case "string": {
|
|
20989
|
-
let stringSchema =
|
|
21763
|
+
let stringSchema = z4.string();
|
|
20990
21764
|
if (schema.format) {
|
|
20991
21765
|
const format = schema.format;
|
|
20992
21766
|
if (format === "email") {
|
|
20993
|
-
stringSchema = stringSchema.check(
|
|
21767
|
+
stringSchema = stringSchema.check(z4.email());
|
|
20994
21768
|
} else if (format === "uri" || format === "uri-reference") {
|
|
20995
|
-
stringSchema = stringSchema.check(
|
|
21769
|
+
stringSchema = stringSchema.check(z4.url());
|
|
20996
21770
|
} else if (format === "uuid" || format === "guid") {
|
|
20997
|
-
stringSchema = stringSchema.check(
|
|
21771
|
+
stringSchema = stringSchema.check(z4.uuid());
|
|
20998
21772
|
} else if (format === "date-time") {
|
|
20999
|
-
stringSchema = stringSchema.check(
|
|
21773
|
+
stringSchema = stringSchema.check(z4.iso.datetime());
|
|
21000
21774
|
} else if (format === "date") {
|
|
21001
|
-
stringSchema = stringSchema.check(
|
|
21775
|
+
stringSchema = stringSchema.check(z4.iso.date());
|
|
21002
21776
|
} else if (format === "time") {
|
|
21003
|
-
stringSchema = stringSchema.check(
|
|
21777
|
+
stringSchema = stringSchema.check(z4.iso.time());
|
|
21004
21778
|
} else if (format === "duration") {
|
|
21005
|
-
stringSchema = stringSchema.check(
|
|
21779
|
+
stringSchema = stringSchema.check(z4.iso.duration());
|
|
21006
21780
|
} else if (format === "ipv4") {
|
|
21007
|
-
stringSchema = stringSchema.check(
|
|
21781
|
+
stringSchema = stringSchema.check(z4.ipv4());
|
|
21008
21782
|
} else if (format === "ipv6") {
|
|
21009
|
-
stringSchema = stringSchema.check(
|
|
21783
|
+
stringSchema = stringSchema.check(z4.ipv6());
|
|
21010
21784
|
} else if (format === "mac") {
|
|
21011
|
-
stringSchema = stringSchema.check(
|
|
21785
|
+
stringSchema = stringSchema.check(z4.mac());
|
|
21012
21786
|
} else if (format === "cidr") {
|
|
21013
|
-
stringSchema = stringSchema.check(
|
|
21787
|
+
stringSchema = stringSchema.check(z4.cidrv4());
|
|
21014
21788
|
} else if (format === "cidr-v6") {
|
|
21015
|
-
stringSchema = stringSchema.check(
|
|
21789
|
+
stringSchema = stringSchema.check(z4.cidrv6());
|
|
21016
21790
|
} else if (format === "base64") {
|
|
21017
|
-
stringSchema = stringSchema.check(
|
|
21791
|
+
stringSchema = stringSchema.check(z4.base64());
|
|
21018
21792
|
} else if (format === "base64url") {
|
|
21019
|
-
stringSchema = stringSchema.check(
|
|
21793
|
+
stringSchema = stringSchema.check(z4.base64url());
|
|
21020
21794
|
} else if (format === "e164") {
|
|
21021
|
-
stringSchema = stringSchema.check(
|
|
21795
|
+
stringSchema = stringSchema.check(z4.e164());
|
|
21022
21796
|
} else if (format === "jwt") {
|
|
21023
|
-
stringSchema = stringSchema.check(
|
|
21797
|
+
stringSchema = stringSchema.check(z4.jwt());
|
|
21024
21798
|
} else if (format === "emoji") {
|
|
21025
|
-
stringSchema = stringSchema.check(
|
|
21799
|
+
stringSchema = stringSchema.check(z4.emoji());
|
|
21026
21800
|
} else if (format === "nanoid") {
|
|
21027
|
-
stringSchema = stringSchema.check(
|
|
21801
|
+
stringSchema = stringSchema.check(z4.nanoid());
|
|
21028
21802
|
} else if (format === "cuid") {
|
|
21029
|
-
stringSchema = stringSchema.check(
|
|
21803
|
+
stringSchema = stringSchema.check(z4.cuid());
|
|
21030
21804
|
} else if (format === "cuid2") {
|
|
21031
|
-
stringSchema = stringSchema.check(
|
|
21805
|
+
stringSchema = stringSchema.check(z4.cuid2());
|
|
21032
21806
|
} else if (format === "ulid") {
|
|
21033
|
-
stringSchema = stringSchema.check(
|
|
21807
|
+
stringSchema = stringSchema.check(z4.ulid());
|
|
21034
21808
|
} else if (format === "xid") {
|
|
21035
|
-
stringSchema = stringSchema.check(
|
|
21809
|
+
stringSchema = stringSchema.check(z4.xid());
|
|
21036
21810
|
} else if (format === "ksuid") {
|
|
21037
|
-
stringSchema = stringSchema.check(
|
|
21811
|
+
stringSchema = stringSchema.check(z4.ksuid());
|
|
21038
21812
|
}
|
|
21039
21813
|
}
|
|
21040
21814
|
if (typeof schema.minLength === "number") {
|
|
@@ -21051,7 +21825,7 @@ function convertBaseSchema(schema, ctx) {
|
|
|
21051
21825
|
}
|
|
21052
21826
|
case "number":
|
|
21053
21827
|
case "integer": {
|
|
21054
|
-
let numberSchema = type === "integer" ?
|
|
21828
|
+
let numberSchema = type === "integer" ? z4.number().int() : z4.number();
|
|
21055
21829
|
if (typeof schema.minimum === "number") {
|
|
21056
21830
|
numberSchema = numberSchema.min(schema.minimum);
|
|
21057
21831
|
}
|
|
@@ -21075,11 +21849,11 @@ function convertBaseSchema(schema, ctx) {
|
|
|
21075
21849
|
break;
|
|
21076
21850
|
}
|
|
21077
21851
|
case "boolean": {
|
|
21078
|
-
zodSchema =
|
|
21852
|
+
zodSchema = z4.boolean();
|
|
21079
21853
|
break;
|
|
21080
21854
|
}
|
|
21081
21855
|
case "null": {
|
|
21082
|
-
zodSchema =
|
|
21856
|
+
zodSchema = z4.null();
|
|
21083
21857
|
break;
|
|
21084
21858
|
}
|
|
21085
21859
|
case "object": {
|
|
@@ -21092,14 +21866,14 @@ function convertBaseSchema(schema, ctx) {
|
|
|
21092
21866
|
}
|
|
21093
21867
|
if (schema.propertyNames) {
|
|
21094
21868
|
const keySchema = convertSchema(schema.propertyNames, ctx);
|
|
21095
|
-
const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) :
|
|
21869
|
+
const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z4.any();
|
|
21096
21870
|
if (Object.keys(shape).length === 0) {
|
|
21097
|
-
zodSchema =
|
|
21871
|
+
zodSchema = z4.record(keySchema, valueSchema);
|
|
21098
21872
|
break;
|
|
21099
21873
|
}
|
|
21100
|
-
const objectSchema2 =
|
|
21101
|
-
const recordSchema =
|
|
21102
|
-
zodSchema =
|
|
21874
|
+
const objectSchema2 = z4.object(shape).passthrough();
|
|
21875
|
+
const recordSchema = z4.looseRecord(keySchema, valueSchema);
|
|
21876
|
+
zodSchema = z4.intersection(objectSchema2, recordSchema);
|
|
21103
21877
|
break;
|
|
21104
21878
|
}
|
|
21105
21879
|
if (schema.patternProperties) {
|
|
@@ -21108,28 +21882,28 @@ function convertBaseSchema(schema, ctx) {
|
|
|
21108
21882
|
const looseRecords = [];
|
|
21109
21883
|
for (const pattern of patternKeys) {
|
|
21110
21884
|
const patternValue = convertSchema(patternProps[pattern], ctx);
|
|
21111
|
-
const keySchema =
|
|
21112
|
-
looseRecords.push(
|
|
21885
|
+
const keySchema = z4.string().regex(new RegExp(pattern));
|
|
21886
|
+
looseRecords.push(z4.looseRecord(keySchema, patternValue));
|
|
21113
21887
|
}
|
|
21114
21888
|
const schemasToIntersect = [];
|
|
21115
21889
|
if (Object.keys(shape).length > 0) {
|
|
21116
|
-
schemasToIntersect.push(
|
|
21890
|
+
schemasToIntersect.push(z4.object(shape).passthrough());
|
|
21117
21891
|
}
|
|
21118
21892
|
schemasToIntersect.push(...looseRecords);
|
|
21119
21893
|
if (schemasToIntersect.length === 0) {
|
|
21120
|
-
zodSchema =
|
|
21894
|
+
zodSchema = z4.object({}).passthrough();
|
|
21121
21895
|
} else if (schemasToIntersect.length === 1) {
|
|
21122
21896
|
zodSchema = schemasToIntersect[0];
|
|
21123
21897
|
} else {
|
|
21124
|
-
let result =
|
|
21898
|
+
let result = z4.intersection(schemasToIntersect[0], schemasToIntersect[1]);
|
|
21125
21899
|
for (let i = 2; i < schemasToIntersect.length; i++) {
|
|
21126
|
-
result =
|
|
21900
|
+
result = z4.intersection(result, schemasToIntersect[i]);
|
|
21127
21901
|
}
|
|
21128
21902
|
zodSchema = result;
|
|
21129
21903
|
}
|
|
21130
21904
|
break;
|
|
21131
21905
|
}
|
|
21132
|
-
const objectSchema =
|
|
21906
|
+
const objectSchema = z4.object(shape);
|
|
21133
21907
|
if (schema.additionalProperties === false) {
|
|
21134
21908
|
zodSchema = objectSchema.strict();
|
|
21135
21909
|
} else if (typeof schema.additionalProperties === "object") {
|
|
@@ -21146,33 +21920,33 @@ function convertBaseSchema(schema, ctx) {
|
|
|
21146
21920
|
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
|
|
21147
21921
|
const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
|
|
21148
21922
|
if (rest) {
|
|
21149
|
-
zodSchema =
|
|
21923
|
+
zodSchema = z4.tuple(tupleItems).rest(rest);
|
|
21150
21924
|
} else {
|
|
21151
|
-
zodSchema =
|
|
21925
|
+
zodSchema = z4.tuple(tupleItems);
|
|
21152
21926
|
}
|
|
21153
21927
|
if (typeof schema.minItems === "number") {
|
|
21154
|
-
zodSchema = zodSchema.check(
|
|
21928
|
+
zodSchema = zodSchema.check(z4.minLength(schema.minItems));
|
|
21155
21929
|
}
|
|
21156
21930
|
if (typeof schema.maxItems === "number") {
|
|
21157
|
-
zodSchema = zodSchema.check(
|
|
21931
|
+
zodSchema = zodSchema.check(z4.maxLength(schema.maxItems));
|
|
21158
21932
|
}
|
|
21159
21933
|
} else if (Array.isArray(items)) {
|
|
21160
21934
|
const tupleItems = items.map((item) => convertSchema(item, ctx));
|
|
21161
21935
|
const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : void 0;
|
|
21162
21936
|
if (rest) {
|
|
21163
|
-
zodSchema =
|
|
21937
|
+
zodSchema = z4.tuple(tupleItems).rest(rest);
|
|
21164
21938
|
} else {
|
|
21165
|
-
zodSchema =
|
|
21939
|
+
zodSchema = z4.tuple(tupleItems);
|
|
21166
21940
|
}
|
|
21167
21941
|
if (typeof schema.minItems === "number") {
|
|
21168
|
-
zodSchema = zodSchema.check(
|
|
21942
|
+
zodSchema = zodSchema.check(z4.minLength(schema.minItems));
|
|
21169
21943
|
}
|
|
21170
21944
|
if (typeof schema.maxItems === "number") {
|
|
21171
|
-
zodSchema = zodSchema.check(
|
|
21945
|
+
zodSchema = zodSchema.check(z4.maxLength(schema.maxItems));
|
|
21172
21946
|
}
|
|
21173
21947
|
} else if (items !== void 0) {
|
|
21174
21948
|
const element = convertSchema(items, ctx);
|
|
21175
|
-
let arraySchema =
|
|
21949
|
+
let arraySchema = z4.array(element);
|
|
21176
21950
|
if (typeof schema.minItems === "number") {
|
|
21177
21951
|
arraySchema = arraySchema.min(schema.minItems);
|
|
21178
21952
|
}
|
|
@@ -21181,7 +21955,7 @@ function convertBaseSchema(schema, ctx) {
|
|
|
21181
21955
|
}
|
|
21182
21956
|
zodSchema = arraySchema;
|
|
21183
21957
|
} else {
|
|
21184
|
-
zodSchema =
|
|
21958
|
+
zodSchema = z4.array(z4.any());
|
|
21185
21959
|
}
|
|
21186
21960
|
break;
|
|
21187
21961
|
}
|
|
@@ -21198,37 +21972,37 @@ function convertBaseSchema(schema, ctx) {
|
|
|
21198
21972
|
}
|
|
21199
21973
|
function convertSchema(schema, ctx) {
|
|
21200
21974
|
if (typeof schema === "boolean") {
|
|
21201
|
-
return schema ?
|
|
21975
|
+
return schema ? z4.any() : z4.never();
|
|
21202
21976
|
}
|
|
21203
21977
|
let baseSchema = convertBaseSchema(schema, ctx);
|
|
21204
21978
|
const hasExplicitType = schema.type || schema.enum !== void 0 || schema.const !== void 0;
|
|
21205
21979
|
if (schema.anyOf && Array.isArray(schema.anyOf)) {
|
|
21206
21980
|
const options = schema.anyOf.map((s) => convertSchema(s, ctx));
|
|
21207
|
-
const anyOfUnion =
|
|
21208
|
-
baseSchema = hasExplicitType ?
|
|
21981
|
+
const anyOfUnion = z4.union(options);
|
|
21982
|
+
baseSchema = hasExplicitType ? z4.intersection(baseSchema, anyOfUnion) : anyOfUnion;
|
|
21209
21983
|
}
|
|
21210
21984
|
if (schema.oneOf && Array.isArray(schema.oneOf)) {
|
|
21211
21985
|
const options = schema.oneOf.map((s) => convertSchema(s, ctx));
|
|
21212
|
-
const oneOfUnion =
|
|
21213
|
-
baseSchema = hasExplicitType ?
|
|
21986
|
+
const oneOfUnion = z4.xor(options);
|
|
21987
|
+
baseSchema = hasExplicitType ? z4.intersection(baseSchema, oneOfUnion) : oneOfUnion;
|
|
21214
21988
|
}
|
|
21215
21989
|
if (schema.allOf && Array.isArray(schema.allOf)) {
|
|
21216
21990
|
if (schema.allOf.length === 0) {
|
|
21217
|
-
baseSchema = hasExplicitType ? baseSchema :
|
|
21991
|
+
baseSchema = hasExplicitType ? baseSchema : z4.any();
|
|
21218
21992
|
} else {
|
|
21219
21993
|
let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
|
|
21220
21994
|
const startIdx = hasExplicitType ? 0 : 1;
|
|
21221
21995
|
for (let i = startIdx; i < schema.allOf.length; i++) {
|
|
21222
|
-
result =
|
|
21996
|
+
result = z4.intersection(result, convertSchema(schema.allOf[i], ctx));
|
|
21223
21997
|
}
|
|
21224
21998
|
baseSchema = result;
|
|
21225
21999
|
}
|
|
21226
22000
|
}
|
|
21227
22001
|
if (schema.nullable === true && ctx.version === "openapi-3.0") {
|
|
21228
|
-
baseSchema =
|
|
22002
|
+
baseSchema = z4.nullable(baseSchema);
|
|
21229
22003
|
}
|
|
21230
22004
|
if (schema.readOnly === true) {
|
|
21231
|
-
baseSchema =
|
|
22005
|
+
baseSchema = z4.readonly(baseSchema);
|
|
21232
22006
|
}
|
|
21233
22007
|
const extraMeta = {};
|
|
21234
22008
|
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
|
|
@@ -21255,7 +22029,7 @@ function convertSchema(schema, ctx) {
|
|
|
21255
22029
|
}
|
|
21256
22030
|
function fromJSONSchema(schema, params) {
|
|
21257
22031
|
if (typeof schema === "boolean") {
|
|
21258
|
-
return schema ?
|
|
22032
|
+
return schema ? z4.any() : z4.never();
|
|
21259
22033
|
}
|
|
21260
22034
|
const version2 = detectVersion(schema, params?.defaultTarget);
|
|
21261
22035
|
const defs = schema.$defs || schema.definitions || {};
|
|
@@ -21324,8 +22098,8 @@ var DeleteResponseSchema = external_exports.object({
|
|
|
21324
22098
|
});
|
|
21325
22099
|
|
|
21326
22100
|
// ../../packages/api-contracts/src/contracts/v1/admin.ts
|
|
21327
|
-
var
|
|
21328
|
-
var adminContract =
|
|
22101
|
+
var c2 = initContract();
|
|
22102
|
+
var adminContract = c2.router({
|
|
21329
22103
|
approveCheckRun: {
|
|
21330
22104
|
method: "POST",
|
|
21331
22105
|
path: "/organizations/:organizationId/admin/check-runs/approve",
|
|
@@ -21397,8 +22171,8 @@ var ListChatSessionsResponseSchema = external_exports.object({
|
|
|
21397
22171
|
});
|
|
21398
22172
|
|
|
21399
22173
|
// ../../packages/api-contracts/src/contracts/v1/chat-session.ts
|
|
21400
|
-
var
|
|
21401
|
-
var chatSessionContract =
|
|
22174
|
+
var c3 = initContract();
|
|
22175
|
+
var chatSessionContract = c3.router({
|
|
21402
22176
|
createSession: {
|
|
21403
22177
|
method: "POST",
|
|
21404
22178
|
path: "/organizations/:organizationId/chat/sessions",
|
|
@@ -21679,8 +22453,8 @@ var DependencySummaryResponseSchema = external_exports.object({
|
|
|
21679
22453
|
});
|
|
21680
22454
|
|
|
21681
22455
|
// ../../packages/api-contracts/src/contracts/v1/dependency.ts
|
|
21682
|
-
var
|
|
21683
|
-
var dependencyContract =
|
|
22456
|
+
var c4 = initContract();
|
|
22457
|
+
var dependencyContract = c4.router({
|
|
21684
22458
|
/** Cross-repo dependency search. Two-phase: pg_trgm on Package, then join repos. */
|
|
21685
22459
|
searchDependencies: {
|
|
21686
22460
|
method: "POST",
|
|
@@ -21825,8 +22599,8 @@ var DockerScoutIntegrationResponseSchema = external_exports.object({
|
|
|
21825
22599
|
});
|
|
21826
22600
|
|
|
21827
22601
|
// ../../packages/api-contracts/src/contracts/v1/docker-scout-integration.ts
|
|
21828
|
-
var
|
|
21829
|
-
var dockerScoutIntegrationContract =
|
|
22602
|
+
var c5 = initContract();
|
|
22603
|
+
var dockerScoutIntegrationContract = c5.router({
|
|
21830
22604
|
createDockerScoutIntegration: {
|
|
21831
22605
|
method: "POST",
|
|
21832
22606
|
path: "/organizations/:organizationId/docker-scout-integration",
|
|
@@ -21923,8 +22697,8 @@ var GitHubRepoSchema = external_exports.object({
|
|
|
21923
22697
|
var ListGitHubInstallationReposResponseSchema = external_exports.array(GitHubRepoSchema);
|
|
21924
22698
|
|
|
21925
22699
|
// ../../packages/api-contracts/src/contracts/v1/github.ts
|
|
21926
|
-
var
|
|
21927
|
-
var githubCallbackContract =
|
|
22700
|
+
var c6 = initContract();
|
|
22701
|
+
var githubCallbackContract = c6.router(
|
|
21928
22702
|
{
|
|
21929
22703
|
handleCallback: {
|
|
21930
22704
|
method: "POST",
|
|
@@ -21944,7 +22718,7 @@ var githubCallbackContract = c5.router(
|
|
|
21944
22718
|
pathPrefix: "/v1/github"
|
|
21945
22719
|
}
|
|
21946
22720
|
);
|
|
21947
|
-
var githubContract =
|
|
22721
|
+
var githubContract = c6.router({
|
|
21948
22722
|
generateInstallLink: {
|
|
21949
22723
|
method: "POST",
|
|
21950
22724
|
path: "/organizations/:organizationId/github/install-link",
|
|
@@ -22014,8 +22788,8 @@ var UpdateKnowledgeBaseResponseSchema = external_exports.object({
|
|
|
22014
22788
|
});
|
|
22015
22789
|
|
|
22016
22790
|
// ../../packages/api-contracts/src/contracts/v1/knowledge-base.ts
|
|
22017
|
-
var
|
|
22018
|
-
var knowledgeBaseContract =
|
|
22791
|
+
var c7 = initContract();
|
|
22792
|
+
var knowledgeBaseContract = c7.router({
|
|
22019
22793
|
getKnowledgeBase: {
|
|
22020
22794
|
method: "GET",
|
|
22021
22795
|
path: "/organizations/:organizationId/knowledge-base",
|
|
@@ -22236,8 +23010,8 @@ var UpdateRepoDocumentContentResponseSchema = external_exports.object({
|
|
|
22236
23010
|
});
|
|
22237
23011
|
|
|
22238
23012
|
// ../../packages/api-contracts/src/contracts/v1/knowledge-document.ts
|
|
22239
|
-
var
|
|
22240
|
-
var knowledgeDocumentContract =
|
|
23013
|
+
var c8 = initContract();
|
|
23014
|
+
var knowledgeDocumentContract = c8.router({
|
|
22241
23015
|
createDocument: {
|
|
22242
23016
|
method: "POST",
|
|
22243
23017
|
path: "/organizations/:organizationId/knowledge-documents",
|
|
@@ -22546,8 +23320,8 @@ var LlmProviderKeyResponseSchema = external_exports.object({
|
|
|
22546
23320
|
var ListLlmProviderKeysResponseSchema = external_exports.array(LlmProviderKeyResponseSchema);
|
|
22547
23321
|
|
|
22548
23322
|
// ../../packages/api-contracts/src/contracts/v1/llm-provider-key.ts
|
|
22549
|
-
var
|
|
22550
|
-
var llmProviderKeyContract =
|
|
23323
|
+
var c9 = initContract();
|
|
23324
|
+
var llmProviderKeyContract = c9.router({
|
|
22551
23325
|
createLlmProviderKey: {
|
|
22552
23326
|
method: "POST",
|
|
22553
23327
|
path: "/organizations/:organizationId/llm-provider-keys",
|
|
@@ -22663,8 +23437,8 @@ var LogoDeleteRequestSchema = external_exports.object({
|
|
|
22663
23437
|
});
|
|
22664
23438
|
|
|
22665
23439
|
// ../../packages/api-contracts/src/contracts/v1/organization.ts
|
|
22666
|
-
var
|
|
22667
|
-
var organizationContract =
|
|
23440
|
+
var c10 = initContract();
|
|
23441
|
+
var organizationContract = c10.router({
|
|
22668
23442
|
listOrganizations: {
|
|
22669
23443
|
method: "GET",
|
|
22670
23444
|
path: "/organizations",
|
|
@@ -22826,8 +23600,8 @@ var UpdatePentestRequestSchema = external_exports.object({
|
|
|
22826
23600
|
});
|
|
22827
23601
|
|
|
22828
23602
|
// ../../packages/api-contracts/src/contracts/v1/pentest.ts
|
|
22829
|
-
var
|
|
22830
|
-
var pentestContract =
|
|
23603
|
+
var c11 = initContract();
|
|
23604
|
+
var pentestContract = c11.router({
|
|
22831
23605
|
listPentests: {
|
|
22832
23606
|
method: "GET",
|
|
22833
23607
|
path: "/organizations/:organizationId/pentests",
|
|
@@ -23085,8 +23859,8 @@ var GetParseTaskStatusResponseSchema = external_exports.object({
|
|
|
23085
23859
|
});
|
|
23086
23860
|
|
|
23087
23861
|
// ../../packages/api-contracts/src/contracts/v1/pentest-finding.ts
|
|
23088
|
-
var
|
|
23089
|
-
var pentestFindingContract =
|
|
23862
|
+
var c12 = initContract();
|
|
23863
|
+
var pentestFindingContract = c12.router({
|
|
23090
23864
|
// ─── Findings ───
|
|
23091
23865
|
listFindings: {
|
|
23092
23866
|
method: "GET",
|
|
@@ -23356,8 +24130,8 @@ var CloneTokenResponseSchema = external_exports.object({
|
|
|
23356
24130
|
});
|
|
23357
24131
|
|
|
23358
24132
|
// ../../packages/api-contracts/src/contracts/v1/repository.ts
|
|
23359
|
-
var
|
|
23360
|
-
var repositoryContract =
|
|
24133
|
+
var c13 = initContract();
|
|
24134
|
+
var repositoryContract = c13.router({
|
|
23361
24135
|
createRepository: {
|
|
23362
24136
|
method: "POST",
|
|
23363
24137
|
path: "/organizations/:organizationId/repositories",
|
|
@@ -23555,8 +24329,8 @@ var ListScanLogsResponseSchema = external_exports.object({
|
|
|
23555
24329
|
});
|
|
23556
24330
|
|
|
23557
24331
|
// ../../packages/api-contracts/src/contracts/v1/scan.ts
|
|
23558
|
-
var
|
|
23559
|
-
var scanContract =
|
|
24332
|
+
var c14 = initContract();
|
|
24333
|
+
var scanContract = c14.router({
|
|
23560
24334
|
createScan: {
|
|
23561
24335
|
method: "POST",
|
|
23562
24336
|
path: "/organizations/:organizationId/scans",
|
|
@@ -23661,8 +24435,8 @@ var UserResponseSchema = external_exports.object({
|
|
|
23661
24435
|
var ListUsersResponseSchema = external_exports.array(UserResponseSchema);
|
|
23662
24436
|
|
|
23663
24437
|
// ../../packages/api-contracts/src/contracts/v1/user.ts
|
|
23664
|
-
var
|
|
23665
|
-
var userContract =
|
|
24438
|
+
var c15 = initContract();
|
|
24439
|
+
var userContract = c15.router({
|
|
23666
24440
|
listUsers: {
|
|
23667
24441
|
method: "GET",
|
|
23668
24442
|
path: "/organizations/:organizationId/users",
|
|
@@ -23734,8 +24508,8 @@ var VantaIntegrationResponseSchema = external_exports.object({
|
|
|
23734
24508
|
});
|
|
23735
24509
|
|
|
23736
24510
|
// ../../packages/api-contracts/src/contracts/v1/vanta-integration.ts
|
|
23737
|
-
var
|
|
23738
|
-
var vantaIntegrationContract =
|
|
24511
|
+
var c16 = initContract();
|
|
24512
|
+
var vantaIntegrationContract = c16.router({
|
|
23739
24513
|
createVantaIntegration: {
|
|
23740
24514
|
method: "POST",
|
|
23741
24515
|
path: "/organizations/:organizationId/vanta-integration",
|
|
@@ -23977,8 +24751,8 @@ var BulkUpdateVulnerabilitiesResponseSchema = external_exports.object({
|
|
|
23977
24751
|
});
|
|
23978
24752
|
|
|
23979
24753
|
// ../../packages/api-contracts/src/contracts/v1/vulnerability.ts
|
|
23980
|
-
var
|
|
23981
|
-
var vulnerabilityContract =
|
|
24754
|
+
var c17 = initContract();
|
|
24755
|
+
var vulnerabilityContract = c17.router({
|
|
23982
24756
|
filterVulnerabilities: {
|
|
23983
24757
|
method: "POST",
|
|
23984
24758
|
path: "/organizations/:organizationId/vulnerabilities/filter",
|
|
@@ -24137,8 +24911,8 @@ var UpdateVulnerabilityNoteRequestSchema = external_exports.object({
|
|
|
24137
24911
|
});
|
|
24138
24912
|
|
|
24139
24913
|
// ../../packages/api-contracts/src/contracts/v1/vulnerability-note.ts
|
|
24140
|
-
var
|
|
24141
|
-
var vulnerabilityNoteContract =
|
|
24914
|
+
var c18 = initContract();
|
|
24915
|
+
var vulnerabilityNoteContract = c18.router({
|
|
24142
24916
|
listNotes: {
|
|
24143
24917
|
method: "GET",
|
|
24144
24918
|
path: "/organizations/:organizationId/vulnerabilities/:vulnerabilityId/notes",
|
|
@@ -24210,8 +24984,8 @@ var WebApplicationResponseSchema = external_exports.object({
|
|
|
24210
24984
|
var ListWebApplicationsResponseSchema = external_exports.array(WebApplicationResponseSchema);
|
|
24211
24985
|
|
|
24212
24986
|
// ../../packages/api-contracts/src/contracts/v1/web-application.ts
|
|
24213
|
-
var
|
|
24214
|
-
var webApplicationContract =
|
|
24987
|
+
var c19 = initContract();
|
|
24988
|
+
var webApplicationContract = c19.router({
|
|
24215
24989
|
listWebApplications: {
|
|
24216
24990
|
method: "GET",
|
|
24217
24991
|
path: "/organizations/:organizationId/web-applications",
|
|
@@ -24350,8 +25124,8 @@ var ListWebhookDeliveriesResponseSchema = external_exports.object({
|
|
|
24350
25124
|
});
|
|
24351
25125
|
|
|
24352
25126
|
// ../../packages/api-contracts/src/contracts/v1/webhook-settings.ts
|
|
24353
|
-
var
|
|
24354
|
-
var webhookSettingsContract =
|
|
25127
|
+
var c20 = initContract();
|
|
25128
|
+
var webhookSettingsContract = c20.router({
|
|
24355
25129
|
listWebhookEndpoints: {
|
|
24356
25130
|
method: "GET",
|
|
24357
25131
|
path: "/organizations/:organizationId/webhook-settings/endpoints",
|
|
@@ -24489,8 +25263,8 @@ var webhookSettingsContract = c19.router({
|
|
|
24489
25263
|
});
|
|
24490
25264
|
|
|
24491
25265
|
// ../../packages/api-contracts/src/contracts/v1/index.ts
|
|
24492
|
-
var
|
|
24493
|
-
var v1Contract =
|
|
25266
|
+
var c21 = initContract();
|
|
25267
|
+
var v1Contract = c21.router(
|
|
24494
25268
|
{
|
|
24495
25269
|
admin: adminContract,
|
|
24496
25270
|
scan: scanContract,
|
|
@@ -24518,8 +25292,8 @@ var v1Contract = c20.router(
|
|
|
24518
25292
|
);
|
|
24519
25293
|
|
|
24520
25294
|
// ../../packages/api-contracts/src/contracts/index.ts
|
|
24521
|
-
var
|
|
24522
|
-
var contract =
|
|
25295
|
+
var c22 = initContract();
|
|
25296
|
+
var contract = c22.router({
|
|
24523
25297
|
v1: v1Contract
|
|
24524
25298
|
});
|
|
24525
25299
|
|
|
@@ -24529,8 +25303,8 @@ var GitHubWebhookResponseSchema = external_exports.object({
|
|
|
24529
25303
|
});
|
|
24530
25304
|
|
|
24531
25305
|
// ../../packages/api-contracts/src/contracts/webhooks/github.ts
|
|
24532
|
-
var
|
|
24533
|
-
var githubWebhookContract =
|
|
25306
|
+
var c23 = initContract();
|
|
25307
|
+
var githubWebhookContract = c23.router(
|
|
24534
25308
|
{
|
|
24535
25309
|
handleWebhook: {
|
|
24536
25310
|
method: "POST",
|
|
@@ -24555,8 +25329,8 @@ var HealthResponseSchema = external_exports.object({
|
|
|
24555
25329
|
});
|
|
24556
25330
|
|
|
24557
25331
|
// ../../packages/api-contracts/src/contracts/health.ts
|
|
24558
|
-
var
|
|
24559
|
-
var healthContract =
|
|
25332
|
+
var c24 = initContract();
|
|
25333
|
+
var healthContract = c24.router({
|
|
24560
25334
|
getHealth: {
|
|
24561
25335
|
method: "GET",
|
|
24562
25336
|
path: "/health",
|
|
@@ -24605,8 +25379,8 @@ var UpdatePrVulnerabilityRequestSchema = external_exports.object({
|
|
|
24605
25379
|
});
|
|
24606
25380
|
|
|
24607
25381
|
// ../../packages/api-contracts/src/contracts/v1/pr-vulnerability.ts
|
|
24608
|
-
var
|
|
24609
|
-
var prVulnerabilityContract =
|
|
25382
|
+
var c25 = initContract();
|
|
25383
|
+
var prVulnerabilityContract = c25.router(
|
|
24610
25384
|
{
|
|
24611
25385
|
listPrVulnerabilities: {
|
|
24612
25386
|
method: "GET",
|
|
@@ -24759,6 +25533,9 @@ function getRefreshTokenPath() {
|
|
|
24759
25533
|
function getSelectedOrganizationPath() {
|
|
24760
25534
|
return join(resolveTraceDir(), SELECTED_ORGANIZATION_FILENAME);
|
|
24761
25535
|
}
|
|
25536
|
+
function getTraceDir() {
|
|
25537
|
+
return resolveTraceDir();
|
|
25538
|
+
}
|
|
24762
25539
|
function readToken() {
|
|
24763
25540
|
const tokenPath = getTokenPath();
|
|
24764
25541
|
try {
|
|
@@ -25706,34 +26483,6 @@ function planOrganizationSelectionPersistence(args) {
|
|
|
25706
26483
|
function isSafeOrganizationId(organizationId) {
|
|
25707
26484
|
return SAFE_ORGANIZATION_ID_PATTERN.test(organizationId);
|
|
25708
26485
|
}
|
|
25709
|
-
function parseOrganizationSelectorInputKey(input) {
|
|
25710
|
-
const rawInput = typeof input === "string" ? input : input.toString("utf8");
|
|
25711
|
-
if (rawInput === "\x1B[A" || rawInput === "\x1BOA") {
|
|
25712
|
-
return "up";
|
|
25713
|
-
}
|
|
25714
|
-
if (rawInput === "\x1B[B" || rawInput === "\x1BOB") {
|
|
25715
|
-
return "down";
|
|
25716
|
-
}
|
|
25717
|
-
if (rawInput === "\r" || rawInput === "\n") {
|
|
25718
|
-
return "enter";
|
|
25719
|
-
}
|
|
25720
|
-
if (rawInput === "\x1B") {
|
|
25721
|
-
return "escape";
|
|
25722
|
-
}
|
|
25723
|
-
if (rawInput === "") {
|
|
25724
|
-
return "interrupt";
|
|
25725
|
-
}
|
|
25726
|
-
return "other";
|
|
25727
|
-
}
|
|
25728
|
-
function getNextOrganizationSelectionIndex(currentIndex, direction, organizationCount) {
|
|
25729
|
-
if (organizationCount <= 0) {
|
|
25730
|
-
return 0;
|
|
25731
|
-
}
|
|
25732
|
-
if (direction === "up") {
|
|
25733
|
-
return (currentIndex - 1 + organizationCount) % organizationCount;
|
|
25734
|
-
}
|
|
25735
|
-
return (currentIndex + 1) % organizationCount;
|
|
25736
|
-
}
|
|
25737
26486
|
async function fetchOrganizationContext() {
|
|
25738
26487
|
const result = await authenticatedRequest((client) => client.organization.listMyOrganizations());
|
|
25739
26488
|
if (result.status !== 200) {
|
|
@@ -25850,8 +26599,8 @@ async function promptForOrganizationSelection(organizations, activeOrganizationI
|
|
|
25850
26599
|
if (organizations.length === 0) {
|
|
25851
26600
|
return null;
|
|
25852
26601
|
}
|
|
25853
|
-
if (!process.stdin.
|
|
25854
|
-
const readline =
|
|
26602
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
26603
|
+
const readline = createInterface2({
|
|
25855
26604
|
input: process.stdin,
|
|
25856
26605
|
output: process.stdout
|
|
25857
26606
|
});
|
|
@@ -25873,76 +26622,30 @@ async function promptForOrganizationSelection(organizations, activeOrganizationI
|
|
|
25873
26622
|
readline.close();
|
|
25874
26623
|
}
|
|
25875
26624
|
}
|
|
25876
|
-
const
|
|
25877
|
-
const stdout = process.stdout;
|
|
25878
|
-
const activeOrganizationIndex = organizations.findIndex(
|
|
26625
|
+
const activeIndex = organizations.findIndex(
|
|
25879
26626
|
(organization) => organization.organizationId === activeOrganizationId
|
|
25880
26627
|
);
|
|
25881
|
-
|
|
25882
|
-
|
|
25883
|
-
|
|
25884
|
-
|
|
25885
|
-
|
|
25886
|
-
|
|
25887
|
-
|
|
25888
|
-
const isActive = organization.organizationId === activeOrganizationId;
|
|
25889
|
-
const selectionMarker = isSelected ? ">" : " ";
|
|
25890
|
-
const activeMarker = isActive ? "*" : " ";
|
|
25891
|
-
lines.push(
|
|
25892
|
-
`${selectionMarker} ${activeMarker} ${sanitizeForOutput(organization.name)} (${sanitizeForOutput(organization.slug)}) - ${organization.organizationId}`
|
|
25893
|
-
);
|
|
25894
|
-
}
|
|
25895
|
-
lines.push("", "Press Esc to cancel.");
|
|
25896
|
-
if (renderedLineCount > 0) {
|
|
25897
|
-
stdout.write(`\x1B[${renderedLineCount}A`);
|
|
25898
|
-
}
|
|
25899
|
-
for (const line of lines) {
|
|
25900
|
-
stdout.write(`\x1B[2K${line}
|
|
25901
|
-
`);
|
|
25902
|
-
}
|
|
25903
|
-
renderedLineCount = lines.length;
|
|
25904
|
-
};
|
|
25905
|
-
return await new Promise((resolve) => {
|
|
25906
|
-
const finishSelection = (result) => {
|
|
25907
|
-
stdin.off("data", handleInput);
|
|
25908
|
-
stdin.setRawMode(wasRawModeEnabled);
|
|
25909
|
-
stdout.write("\x1B[2K");
|
|
25910
|
-
resolve(result);
|
|
25911
|
-
};
|
|
25912
|
-
const handleInput = (chunk) => {
|
|
25913
|
-
const inputKey = parseOrganizationSelectorInputKey(chunk);
|
|
25914
|
-
if (inputKey === "up") {
|
|
25915
|
-
selectedOrganizationIndex = getNextOrganizationSelectionIndex(
|
|
25916
|
-
selectedOrganizationIndex,
|
|
25917
|
-
"up",
|
|
25918
|
-
organizations.length
|
|
25919
|
-
);
|
|
25920
|
-
renderSelector();
|
|
25921
|
-
return;
|
|
25922
|
-
}
|
|
25923
|
-
if (inputKey === "down") {
|
|
25924
|
-
selectedOrganizationIndex = getNextOrganizationSelectionIndex(
|
|
25925
|
-
selectedOrganizationIndex,
|
|
25926
|
-
"down",
|
|
25927
|
-
organizations.length
|
|
25928
|
-
);
|
|
25929
|
-
renderSelector();
|
|
25930
|
-
return;
|
|
25931
|
-
}
|
|
25932
|
-
if (inputKey === "enter") {
|
|
25933
|
-
const selectedOrganization = organizations[selectedOrganizationIndex];
|
|
25934
|
-
finishSelection(selectedOrganization ?? null);
|
|
25935
|
-
return;
|
|
25936
|
-
}
|
|
25937
|
-
if (inputKey === "escape" || inputKey === "interrupt") {
|
|
25938
|
-
finishSelection(null);
|
|
25939
|
-
}
|
|
26628
|
+
const choices = organizations.map((organization) => {
|
|
26629
|
+
const isActive = organization.organizationId === activeOrganizationId;
|
|
26630
|
+
const label = `${sanitizeForOutput(organization.name)} (${sanitizeForOutput(organization.slug)})`;
|
|
26631
|
+
return {
|
|
26632
|
+
value: organization.organizationId,
|
|
26633
|
+
label: isActive ? `${label} (current)` : label,
|
|
26634
|
+
hint: organization.organizationId
|
|
25940
26635
|
};
|
|
25941
|
-
stdin.setRawMode(true);
|
|
25942
|
-
stdin.resume();
|
|
25943
|
-
stdin.on("data", handleInput);
|
|
25944
|
-
renderSelector();
|
|
25945
26636
|
});
|
|
26637
|
+
const selected = await _t({
|
|
26638
|
+
message: "Switch organization",
|
|
26639
|
+
options: choices,
|
|
26640
|
+
initialValue: activeIndex >= 0 ? organizations[activeIndex]?.organizationId : void 0
|
|
26641
|
+
});
|
|
26642
|
+
if (q(selected)) {
|
|
26643
|
+
return null;
|
|
26644
|
+
}
|
|
26645
|
+
const selectedOrganization = organizations.find(
|
|
26646
|
+
(organization) => organization.organizationId === selected
|
|
26647
|
+
);
|
|
26648
|
+
return selectedOrganization ?? null;
|
|
25946
26649
|
}
|
|
25947
26650
|
async function refreshAfterOrganizationSwitch(workosOrganizationId, refreshForOrganization = (organizationId) => refreshStoredAccessTokenForOrganization(organizationId)) {
|
|
25948
26651
|
if (!workosOrganizationId || workosOrganizationId.trim().length === 0) {
|
|
@@ -25987,8 +26690,10 @@ Examples:
|
|
|
25987
26690
|
writeTokens(tokenResponse.access_token, tokenResponse.refresh_token);
|
|
25988
26691
|
const name = [tokenResponse.user.first_name, tokenResponse.user.last_name].filter(Boolean).join(" ");
|
|
25989
26692
|
const displayName = name || tokenResponse.user.email;
|
|
25990
|
-
console.log(
|
|
25991
|
-
|
|
26693
|
+
console.log(
|
|
26694
|
+
`
|
|
26695
|
+
${colorSuccess(`Authenticated as ${displayName} (${tokenResponse.user.email})`)}`
|
|
26696
|
+
);
|
|
25992
26697
|
console.log(colorSuccess("Tokens saved to ~/.trace"));
|
|
25993
26698
|
});
|
|
25994
26699
|
}
|
|
@@ -26296,7 +27001,7 @@ function extractCommandTree(cmd) {
|
|
|
26296
27001
|
description: o.description,
|
|
26297
27002
|
takesValue: o.required || o.optional
|
|
26298
27003
|
}));
|
|
26299
|
-
const subcommands = cmd.commands.filter((
|
|
27004
|
+
const subcommands = cmd.commands.filter((c26) => !c26._hidden).map((c26) => extractCommandTree(c26));
|
|
26300
27005
|
return {
|
|
26301
27006
|
name: cmd.name(),
|
|
26302
27007
|
description: cmd.description(),
|
|
@@ -26362,7 +27067,7 @@ function generateBashCompletion(tree, binName) {
|
|
|
26362
27067
|
}
|
|
26363
27068
|
function collectBashCases(tree, prefix) {
|
|
26364
27069
|
const cases = /* @__PURE__ */ new Map();
|
|
26365
|
-
const subcommandNames = tree.subcommands.map((
|
|
27070
|
+
const subcommandNames = tree.subcommands.map((c26) => c26.name);
|
|
26366
27071
|
const optionNames = tree.options.flatMap((o) => o.short ? [o.long, o.short] : [o.long]);
|
|
26367
27072
|
const extraOptions = prefix === "" ? ["--help", "--version"] : ["--help"];
|
|
26368
27073
|
const allOptions = [.../* @__PURE__ */ new Set([...optionNames, ...extraOptions])];
|
|
@@ -26531,7 +27236,7 @@ function buildFishCondition(binName, parentPath) {
|
|
|
26531
27236
|
if (parentPath.length === 1) {
|
|
26532
27237
|
return `-n '__fish_seen_subcommand_from ${parentPath[0]}'`;
|
|
26533
27238
|
}
|
|
26534
|
-
const conditions = parentPath.map((
|
|
27239
|
+
const conditions = parentPath.map((p2) => `__fish_seen_subcommand_from ${p2}`);
|
|
26535
27240
|
return `-n '${conditions.join("; and ")}'`;
|
|
26536
27241
|
}
|
|
26537
27242
|
function generateCompletion(program3, shell, binName) {
|
|
@@ -26562,14 +27267,14 @@ function completionFileName(shell) {
|
|
|
26562
27267
|
return "tracecli-completion.fish";
|
|
26563
27268
|
}
|
|
26564
27269
|
}
|
|
26565
|
-
function
|
|
27270
|
+
function getTraceDir2() {
|
|
26566
27271
|
return join2(homedir2(), TRACE_DIR);
|
|
26567
27272
|
}
|
|
26568
27273
|
function getCompletionFilePath(shell) {
|
|
26569
|
-
return join2(
|
|
27274
|
+
return join2(getTraceDir2(), completionFileName(shell));
|
|
26570
27275
|
}
|
|
26571
27276
|
function writeCompletionFile(shell, script) {
|
|
26572
|
-
const dir =
|
|
27277
|
+
const dir = getTraceDir2();
|
|
26573
27278
|
if (!existsSync2(dir)) {
|
|
26574
27279
|
mkdirSync2(dir, { recursive: true });
|
|
26575
27280
|
}
|
|
@@ -26649,6 +27354,33 @@ function createCompletionCommand(program3) {
|
|
|
26649
27354
|
});
|
|
26650
27355
|
}
|
|
26651
27356
|
|
|
27357
|
+
// src/metadata.ts
|
|
27358
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
27359
|
+
import { dirname, join as join3 } from "path";
|
|
27360
|
+
import { fileURLToPath } from "url";
|
|
27361
|
+
var DEFAULT_PACKAGE_NAME = "securewithtrace";
|
|
27362
|
+
var DEFAULT_VERSION = "0.0.1";
|
|
27363
|
+
function readPackageMetadata() {
|
|
27364
|
+
const currentFilePath = fileURLToPath(import.meta.url);
|
|
27365
|
+
const packageJsonPath = join3(dirname(currentFilePath), "..", "package.json");
|
|
27366
|
+
try {
|
|
27367
|
+
const rawPackageJson = readFileSync2(packageJsonPath, "utf-8");
|
|
27368
|
+
const parsed = JSON.parse(rawPackageJson);
|
|
27369
|
+
if (typeof parsed !== "object" || parsed === null) {
|
|
27370
|
+
return { name: DEFAULT_PACKAGE_NAME, version: DEFAULT_VERSION };
|
|
27371
|
+
}
|
|
27372
|
+
const metadata = parsed;
|
|
27373
|
+
const name = typeof metadata.name === "string" && metadata.name.trim().length > 0 ? metadata.name : DEFAULT_PACKAGE_NAME;
|
|
27374
|
+
const version2 = typeof metadata.version === "string" && metadata.version.trim().length > 0 ? metadata.version : DEFAULT_VERSION;
|
|
27375
|
+
return { name, version: version2 };
|
|
27376
|
+
} catch {
|
|
27377
|
+
return { name: DEFAULT_PACKAGE_NAME, version: DEFAULT_VERSION };
|
|
27378
|
+
}
|
|
27379
|
+
}
|
|
27380
|
+
var packageMetadata = readPackageMetadata();
|
|
27381
|
+
var CLI_PACKAGE_NAME = packageMetadata.name;
|
|
27382
|
+
var CLI_VERSION = packageMetadata.version;
|
|
27383
|
+
|
|
26652
27384
|
// src/pentest/commands.ts
|
|
26653
27385
|
var DEFAULT_LIMIT = 30;
|
|
26654
27386
|
var MAX_LIMIT = 100;
|
|
@@ -26659,8 +27391,8 @@ function formatDate(date5) {
|
|
|
26659
27391
|
if (!date5) {
|
|
26660
27392
|
return "\u2014";
|
|
26661
27393
|
}
|
|
26662
|
-
const
|
|
26663
|
-
return
|
|
27394
|
+
const d3 = typeof date5 === "string" ? new Date(date5) : date5;
|
|
27395
|
+
return d3.toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
|
|
26664
27396
|
}
|
|
26665
27397
|
function formatFindingSeverity(severity) {
|
|
26666
27398
|
switch (severity) {
|
|
@@ -26704,7 +27436,7 @@ async function resolvePentestId(organizationId, identifier) {
|
|
|
26704
27436
|
console.error(`Failed to list pentests (status ${result.status}).`);
|
|
26705
27437
|
process.exit(1);
|
|
26706
27438
|
}
|
|
26707
|
-
const pentest = result.body.find((
|
|
27439
|
+
const pentest = result.body.find((p2) => p2.displayId === displayId);
|
|
26708
27440
|
if (!pentest) {
|
|
26709
27441
|
console.error(
|
|
26710
27442
|
`Pentest with display ID ${displayId} not found.
|
|
@@ -26898,13 +27630,13 @@ function createPentestCommand() {
|
|
|
26898
27630
|
// src/repo/commands.ts
|
|
26899
27631
|
import { chmodSync, mkdtempSync, rmSync as rmSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
26900
27632
|
import { tmpdir } from "os";
|
|
26901
|
-
import { join as
|
|
27633
|
+
import { join as join4 } from "path";
|
|
26902
27634
|
function stripAnsi(str) {
|
|
26903
|
-
const
|
|
26904
|
-
const
|
|
27635
|
+
const ESC2 = String.fromCharCode(27);
|
|
27636
|
+
const CSI2 = String.fromCharCode(155);
|
|
26905
27637
|
const BEL = String.fromCharCode(7);
|
|
26906
|
-
const csi = `[${
|
|
26907
|
-
const osc = `${
|
|
27638
|
+
const csi = `[${ESC2}${CSI2}][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]`;
|
|
27639
|
+
const osc = `${ESC2}\\].*?(?:${BEL}|${ESC2}\\\\)`;
|
|
26908
27640
|
const pattern = new RegExp(`${osc}|${csi}`, "g");
|
|
26909
27641
|
return str.replace(pattern, "");
|
|
26910
27642
|
}
|
|
@@ -27470,8 +28202,8 @@ function urlWithUsername(httpsUrl) {
|
|
|
27470
28202
|
return url2.toString();
|
|
27471
28203
|
}
|
|
27472
28204
|
function createAskPassScript() {
|
|
27473
|
-
const dir = mkdtempSync(
|
|
27474
|
-
const scriptPath =
|
|
28205
|
+
const dir = mkdtempSync(join4(tmpdir(), "trace-askpass-"));
|
|
28206
|
+
const scriptPath = join4(dir, "askpass.sh");
|
|
27475
28207
|
writeFileSync3(
|
|
27476
28208
|
scriptPath,
|
|
27477
28209
|
`#!/bin/sh
|
|
@@ -27639,6 +28371,311 @@ function createRepoCommand() {
|
|
|
27639
28371
|
return repo;
|
|
27640
28372
|
}
|
|
27641
28373
|
|
|
28374
|
+
// src/update/commands.ts
|
|
28375
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync4 } from "fs";
|
|
28376
|
+
import { dirname as dirname2, join as join5 } from "path";
|
|
28377
|
+
import { createInterface as createInterface3 } from "readline/promises";
|
|
28378
|
+
var UPDATE_CACHE_FILE = "update-check.json";
|
|
28379
|
+
var UPDATE_CHECK_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
28380
|
+
var UPDATE_CHECK_TIMEOUT_MS = 1500;
|
|
28381
|
+
var DISABLE_UPDATE_NOTIFIER_ENV = "TRACECLI_DISABLE_UPDATE_NOTIFIER";
|
|
28382
|
+
var REGISTRY_URL_ENV = "TRACECLI_NPM_REGISTRY_URL";
|
|
28383
|
+
var noticePrinted = false;
|
|
28384
|
+
function getUpdateCheckCachePath() {
|
|
28385
|
+
return join5(getTraceDir(), UPDATE_CACHE_FILE);
|
|
28386
|
+
}
|
|
28387
|
+
function readUpdateCheckCache() {
|
|
28388
|
+
const cachePath = getUpdateCheckCachePath();
|
|
28389
|
+
if (!existsSync3(cachePath)) {
|
|
28390
|
+
return null;
|
|
28391
|
+
}
|
|
28392
|
+
try {
|
|
28393
|
+
const rawCache = readFileSync3(cachePath, "utf-8");
|
|
28394
|
+
const parsed = JSON.parse(rawCache);
|
|
28395
|
+
if (typeof parsed !== "object" || parsed === null) {
|
|
28396
|
+
return null;
|
|
28397
|
+
}
|
|
28398
|
+
const cache = parsed;
|
|
28399
|
+
if (typeof cache.checkedAt !== "number" || !Number.isFinite(cache.checkedAt)) {
|
|
28400
|
+
return null;
|
|
28401
|
+
}
|
|
28402
|
+
if (typeof cache.latestVersion === "string" && cache.latestVersion.trim().length > 0) {
|
|
28403
|
+
return { checkedAt: cache.checkedAt, latestVersion: cache.latestVersion };
|
|
28404
|
+
}
|
|
28405
|
+
return { checkedAt: cache.checkedAt };
|
|
28406
|
+
} catch {
|
|
28407
|
+
return null;
|
|
28408
|
+
}
|
|
28409
|
+
}
|
|
28410
|
+
function writeUpdateCheckCache(cache) {
|
|
28411
|
+
const cachePath = getUpdateCheckCachePath();
|
|
28412
|
+
mkdirSync3(dirname2(cachePath), { recursive: true, mode: 448 });
|
|
28413
|
+
writeFileSync4(cachePath, `${JSON.stringify(cache, null, 2)}
|
|
28414
|
+
`, {
|
|
28415
|
+
encoding: "utf-8",
|
|
28416
|
+
mode: 384
|
|
28417
|
+
});
|
|
28418
|
+
}
|
|
28419
|
+
function parseSemver(version2) {
|
|
28420
|
+
const normalized = version2.trim();
|
|
28421
|
+
const match = normalized.match(
|
|
28422
|
+
/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-.]+)?$/
|
|
28423
|
+
);
|
|
28424
|
+
if (!match?.[1] || !match[2] || !match[3]) {
|
|
28425
|
+
return null;
|
|
28426
|
+
}
|
|
28427
|
+
const major = Number.parseInt(match[1], 10);
|
|
28428
|
+
const minor = Number.parseInt(match[2], 10);
|
|
28429
|
+
const patch = Number.parseInt(match[3], 10);
|
|
28430
|
+
if (!Number.isFinite(major) || !Number.isFinite(minor) || !Number.isFinite(patch)) {
|
|
28431
|
+
return null;
|
|
28432
|
+
}
|
|
28433
|
+
const prerelease = match[4] ? match[4].split(".") : [];
|
|
28434
|
+
return { major, minor, patch, prerelease };
|
|
28435
|
+
}
|
|
28436
|
+
function comparePrerelease(a, b) {
|
|
28437
|
+
const maxLength = Math.max(a.length, b.length);
|
|
28438
|
+
for (let index = 0; index < maxLength; index += 1) {
|
|
28439
|
+
const aPart = a[index];
|
|
28440
|
+
const bPart = b[index];
|
|
28441
|
+
if (aPart === void 0 && bPart === void 0) {
|
|
28442
|
+
return 0;
|
|
28443
|
+
}
|
|
28444
|
+
if (aPart === void 0) {
|
|
28445
|
+
return -1;
|
|
28446
|
+
}
|
|
28447
|
+
if (bPart === void 0) {
|
|
28448
|
+
return 1;
|
|
28449
|
+
}
|
|
28450
|
+
const aIsNumeric = /^\d+$/.test(aPart);
|
|
28451
|
+
const bIsNumeric = /^\d+$/.test(bPart);
|
|
28452
|
+
if (aIsNumeric && bIsNumeric) {
|
|
28453
|
+
const aValue = Number.parseInt(aPart, 10);
|
|
28454
|
+
const bValue = Number.parseInt(bPart, 10);
|
|
28455
|
+
if (aValue !== bValue) {
|
|
28456
|
+
return aValue > bValue ? 1 : -1;
|
|
28457
|
+
}
|
|
28458
|
+
continue;
|
|
28459
|
+
}
|
|
28460
|
+
if (aIsNumeric) {
|
|
28461
|
+
return -1;
|
|
28462
|
+
}
|
|
28463
|
+
if (bIsNumeric) {
|
|
28464
|
+
return 1;
|
|
28465
|
+
}
|
|
28466
|
+
if (aPart !== bPart) {
|
|
28467
|
+
return aPart > bPart ? 1 : -1;
|
|
28468
|
+
}
|
|
28469
|
+
}
|
|
28470
|
+
return 0;
|
|
28471
|
+
}
|
|
28472
|
+
function compareSemver(a, b) {
|
|
28473
|
+
const aSemver = parseSemver(a);
|
|
28474
|
+
const bSemver = parseSemver(b);
|
|
28475
|
+
if (!aSemver || !bSemver) {
|
|
28476
|
+
return null;
|
|
28477
|
+
}
|
|
28478
|
+
if (aSemver.major !== bSemver.major) {
|
|
28479
|
+
return aSemver.major > bSemver.major ? 1 : -1;
|
|
28480
|
+
}
|
|
28481
|
+
if (aSemver.minor !== bSemver.minor) {
|
|
28482
|
+
return aSemver.minor > bSemver.minor ? 1 : -1;
|
|
28483
|
+
}
|
|
28484
|
+
if (aSemver.patch !== bSemver.patch) {
|
|
28485
|
+
return aSemver.patch > bSemver.patch ? 1 : -1;
|
|
28486
|
+
}
|
|
28487
|
+
if (aSemver.prerelease.length === 0 && bSemver.prerelease.length === 0) {
|
|
28488
|
+
return 0;
|
|
28489
|
+
}
|
|
28490
|
+
if (aSemver.prerelease.length === 0) {
|
|
28491
|
+
return 1;
|
|
28492
|
+
}
|
|
28493
|
+
if (bSemver.prerelease.length === 0) {
|
|
28494
|
+
return -1;
|
|
28495
|
+
}
|
|
28496
|
+
return comparePrerelease(aSemver.prerelease, bSemver.prerelease);
|
|
28497
|
+
}
|
|
28498
|
+
function isVersionNewer(currentVersion, candidateVersion) {
|
|
28499
|
+
const comparison = compareSemver(candidateVersion, currentVersion);
|
|
28500
|
+
return comparison !== null && comparison > 0;
|
|
28501
|
+
}
|
|
28502
|
+
function resolveRegistryUrl() {
|
|
28503
|
+
const override = process.env[REGISTRY_URL_ENV];
|
|
28504
|
+
if (typeof override === "string" && override.trim().length > 0) {
|
|
28505
|
+
return override;
|
|
28506
|
+
}
|
|
28507
|
+
return `https://registry.npmjs.org/${encodeURIComponent(CLI_PACKAGE_NAME)}/latest`;
|
|
28508
|
+
}
|
|
28509
|
+
function extractLatestVersionFromRegistryPayload(payload) {
|
|
28510
|
+
if (typeof payload !== "object" || payload === null) {
|
|
28511
|
+
return null;
|
|
28512
|
+
}
|
|
28513
|
+
if ("version" in payload && typeof payload.version === "string" && payload.version.trim().length > 0) {
|
|
28514
|
+
return payload.version;
|
|
28515
|
+
}
|
|
28516
|
+
return null;
|
|
28517
|
+
}
|
|
28518
|
+
async function fetchLatestVersionFromRegistry() {
|
|
28519
|
+
try {
|
|
28520
|
+
const response = await fetch(resolveRegistryUrl(), {
|
|
28521
|
+
headers: { accept: "application/json" },
|
|
28522
|
+
signal: AbortSignal.timeout(UPDATE_CHECK_TIMEOUT_MS)
|
|
28523
|
+
});
|
|
28524
|
+
if (!response.ok) {
|
|
28525
|
+
return null;
|
|
28526
|
+
}
|
|
28527
|
+
const payload = await response.json();
|
|
28528
|
+
return extractLatestVersionFromRegistryPayload(payload);
|
|
28529
|
+
} catch {
|
|
28530
|
+
return null;
|
|
28531
|
+
}
|
|
28532
|
+
}
|
|
28533
|
+
async function getLatestVersion(forceRefresh) {
|
|
28534
|
+
const now = Date.now();
|
|
28535
|
+
const cached2 = readUpdateCheckCache();
|
|
28536
|
+
if (!forceRefresh && cached2 && now - cached2.checkedAt < UPDATE_CHECK_TTL_MS) {
|
|
28537
|
+
return cached2.latestVersion ?? null;
|
|
28538
|
+
}
|
|
28539
|
+
const latestVersion = await fetchLatestVersionFromRegistry();
|
|
28540
|
+
if (latestVersion) {
|
|
28541
|
+
writeUpdateCheckCache({ checkedAt: now, latestVersion });
|
|
28542
|
+
return latestVersion;
|
|
28543
|
+
}
|
|
28544
|
+
if (cached2?.latestVersion) {
|
|
28545
|
+
writeUpdateCheckCache({ checkedAt: now, latestVersion: cached2.latestVersion });
|
|
28546
|
+
return cached2.latestVersion;
|
|
28547
|
+
}
|
|
28548
|
+
writeUpdateCheckCache({ checkedAt: now });
|
|
28549
|
+
return null;
|
|
28550
|
+
}
|
|
28551
|
+
async function getUpdateAvailability(forceRefresh) {
|
|
28552
|
+
const latestVersion = await getLatestVersion(forceRefresh);
|
|
28553
|
+
return {
|
|
28554
|
+
currentVersion: CLI_VERSION,
|
|
28555
|
+
latestVersion,
|
|
28556
|
+
isUpdateAvailable: latestVersion ? isVersionNewer(CLI_VERSION, latestVersion) : false
|
|
28557
|
+
};
|
|
28558
|
+
}
|
|
28559
|
+
function shouldSkipUpdateNotifier(commandName) {
|
|
28560
|
+
if (process.env[DISABLE_UPDATE_NOTIFIER_ENV] === "1") {
|
|
28561
|
+
return true;
|
|
28562
|
+
}
|
|
28563
|
+
if (process.env["CI"] === "true") {
|
|
28564
|
+
return true;
|
|
28565
|
+
}
|
|
28566
|
+
if (!process.stdout.isTTY) {
|
|
28567
|
+
return true;
|
|
28568
|
+
}
|
|
28569
|
+
if (commandName === "upgrade") {
|
|
28570
|
+
return true;
|
|
28571
|
+
}
|
|
28572
|
+
return false;
|
|
28573
|
+
}
|
|
28574
|
+
async function maybeNotifyUpdateAvailable(commandName) {
|
|
28575
|
+
if (noticePrinted || shouldSkipUpdateNotifier(commandName)) {
|
|
28576
|
+
return;
|
|
28577
|
+
}
|
|
28578
|
+
const availability = await getUpdateAvailability(false);
|
|
28579
|
+
if (!availability.isUpdateAvailable || !availability.latestVersion) {
|
|
28580
|
+
return;
|
|
28581
|
+
}
|
|
28582
|
+
noticePrinted = true;
|
|
28583
|
+
console.error("");
|
|
28584
|
+
console.error(
|
|
28585
|
+
`A new tracecli version is available: ${availability.currentVersion} -> ${availability.latestVersion}`
|
|
28586
|
+
);
|
|
28587
|
+
console.error("Run `tracecli upgrade` to install the latest version.");
|
|
28588
|
+
console.error("");
|
|
28589
|
+
}
|
|
28590
|
+
function resolveUpgradePlan() {
|
|
28591
|
+
const packageSpec = `${CLI_PACKAGE_NAME}@latest`;
|
|
28592
|
+
if (Bun.which("npm")) {
|
|
28593
|
+
return { command: "npm", args: ["install", "-g", packageSpec] };
|
|
28594
|
+
}
|
|
28595
|
+
if (Bun.which("bun")) {
|
|
28596
|
+
return { command: "bun", args: ["add", "-g", packageSpec] };
|
|
28597
|
+
}
|
|
28598
|
+
if (Bun.which("pnpm")) {
|
|
28599
|
+
return { command: "pnpm", args: ["add", "-g", packageSpec] };
|
|
28600
|
+
}
|
|
28601
|
+
return null;
|
|
28602
|
+
}
|
|
28603
|
+
async function promptForUpgradeConfirmation(latestVersion) {
|
|
28604
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
28605
|
+
return true;
|
|
28606
|
+
}
|
|
28607
|
+
const readline = createInterface3({
|
|
28608
|
+
input: process.stdin,
|
|
28609
|
+
output: process.stdout
|
|
28610
|
+
});
|
|
28611
|
+
try {
|
|
28612
|
+
const input = await readline.question(`Install tracecli ${latestVersion} now? [Y/n] `);
|
|
28613
|
+
const normalized = input.trim().toLowerCase();
|
|
28614
|
+
if (normalized === "n" || normalized === "no") {
|
|
28615
|
+
return false;
|
|
28616
|
+
}
|
|
28617
|
+
return true;
|
|
28618
|
+
} finally {
|
|
28619
|
+
readline.close();
|
|
28620
|
+
}
|
|
28621
|
+
}
|
|
28622
|
+
function createUpgradeCommand() {
|
|
28623
|
+
return new Command("upgrade").alias("self-update").description("Upgrade tracecli to the latest version").option("--check", "Check whether an update is available").option("-y, --yes", "Skip upgrade confirmation prompt").addHelpText(
|
|
28624
|
+
"after",
|
|
28625
|
+
`
|
|
28626
|
+
Examples:
|
|
28627
|
+
tracecli upgrade
|
|
28628
|
+
tracecli upgrade --check
|
|
28629
|
+
tracecli self-update`
|
|
28630
|
+
).action(async (options) => {
|
|
28631
|
+
const availability = await getUpdateAvailability(true);
|
|
28632
|
+
if (availability.latestVersion) {
|
|
28633
|
+
if (availability.isUpdateAvailable) {
|
|
28634
|
+
console.log(
|
|
28635
|
+
`Update available: ${availability.currentVersion} -> ${availability.latestVersion}`
|
|
28636
|
+
);
|
|
28637
|
+
} else {
|
|
28638
|
+
console.log(`tracecli is up to date (${availability.currentVersion}).`);
|
|
28639
|
+
return;
|
|
28640
|
+
}
|
|
28641
|
+
} else {
|
|
28642
|
+
console.warn(
|
|
28643
|
+
"Could not determine the latest published version from npm. Proceeding with best-effort upgrade."
|
|
28644
|
+
);
|
|
28645
|
+
}
|
|
28646
|
+
if (options.check) {
|
|
28647
|
+
return;
|
|
28648
|
+
}
|
|
28649
|
+
const versionLabel = availability.latestVersion ?? "the latest available version";
|
|
28650
|
+
const shouldUpgrade = options.yes ? true : await promptForUpgradeConfirmation(versionLabel);
|
|
28651
|
+
if (!shouldUpgrade) {
|
|
28652
|
+
console.log("Upgrade cancelled.");
|
|
28653
|
+
return;
|
|
28654
|
+
}
|
|
28655
|
+
const plan = resolveUpgradePlan();
|
|
28656
|
+
if (!plan) {
|
|
28657
|
+
console.error(
|
|
28658
|
+
`No supported package manager found (npm, bun, pnpm). Install the latest version manually from https://www.npmjs.com/package/${CLI_PACKAGE_NAME}`
|
|
28659
|
+
);
|
|
28660
|
+
process.exit(1);
|
|
28661
|
+
}
|
|
28662
|
+
console.log(`Running: ${plan.command} ${plan.args.join(" ")}`);
|
|
28663
|
+
const proc = Bun.spawn([plan.command, ...plan.args], {
|
|
28664
|
+
stdout: "inherit",
|
|
28665
|
+
stderr: "inherit"
|
|
28666
|
+
});
|
|
28667
|
+
const exitCode = await proc.exited;
|
|
28668
|
+
if (exitCode !== 0) {
|
|
28669
|
+
console.error(
|
|
28670
|
+
`Upgrade failed while running '${plan.command} ${plan.args.join(" ")}' (exit code ${exitCode}).`
|
|
28671
|
+
);
|
|
28672
|
+
process.exit(1);
|
|
28673
|
+
}
|
|
28674
|
+
console.log("tracecli upgrade completed.");
|
|
28675
|
+
console.log("Run `tracecli --version` to verify the installed version.");
|
|
28676
|
+
});
|
|
28677
|
+
}
|
|
28678
|
+
|
|
27642
28679
|
// src/vulnerabilities/commands.ts
|
|
27643
28680
|
var DEFAULT_LIMIT3 = 30;
|
|
27644
28681
|
var MAX_LIMIT3 = 100;
|
|
@@ -27848,7 +28885,10 @@ function createVulnerabilitiesCommand() {
|
|
|
27848
28885
|
|
|
27849
28886
|
// src/index.ts
|
|
27850
28887
|
var program2 = new Command();
|
|
27851
|
-
program2.name("tracecli").description("Trace CLI").version(
|
|
28888
|
+
program2.name("tracecli").description("Trace CLI").version(CLI_VERSION);
|
|
28889
|
+
program2.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
28890
|
+
await maybeNotifyUpdateAvailable(actionCommand.name());
|
|
28891
|
+
});
|
|
27852
28892
|
program2.action(() => {
|
|
27853
28893
|
showBanner();
|
|
27854
28894
|
program2.outputHelp();
|
|
@@ -27859,4 +28899,5 @@ program2.addCommand(createRepoCommand());
|
|
|
27859
28899
|
program2.addCommand(createVulnerabilitiesCommand());
|
|
27860
28900
|
program2.addCommand(createPentestCommand());
|
|
27861
28901
|
program2.addCommand(createCompletionCommand(program2));
|
|
27862
|
-
program2.
|
|
28902
|
+
program2.addCommand(createUpgradeCommand());
|
|
28903
|
+
await program2.parseAsync();
|