@eventcatalog/generator-asyncapi 4.4.0 → 4.5.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/dist/index.js +2142 -2074
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2125 -2063
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -3
package/dist/index.mjs
CHANGED
|
@@ -4,13 +4,8 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
}) : x)(function(x) {
|
|
10
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
-
});
|
|
13
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
14
9
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
10
|
};
|
|
16
11
|
var __copyProps = (to, from, except, desc) => {
|
|
@@ -29,6 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
25
|
mod
|
|
31
26
|
));
|
|
27
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
32
28
|
|
|
33
29
|
// ../../node_modules/.pnpm/cli-boxes@3.0.0/node_modules/cli-boxes/boxes.json
|
|
34
30
|
var require_boxes = __commonJS({
|
|
@@ -283,1529 +279,287 @@ var require_ansi_align = __commonJS({
|
|
|
283
279
|
}
|
|
284
280
|
});
|
|
285
281
|
|
|
286
|
-
//
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
var y = d * 365.25;
|
|
296
|
-
module.exports = function(val, options) {
|
|
297
|
-
options = options || {};
|
|
298
|
-
var type = typeof val;
|
|
299
|
-
if (type === "string" && val.length > 0) {
|
|
300
|
-
return parse(val);
|
|
301
|
-
} else if (type === "number" && isFinite(val)) {
|
|
302
|
-
return options.long ? fmtLong(val) : fmtShort(val);
|
|
303
|
-
}
|
|
304
|
-
throw new Error(
|
|
305
|
-
"val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
|
|
306
|
-
);
|
|
307
|
-
};
|
|
308
|
-
function parse(str) {
|
|
309
|
-
str = String(str);
|
|
310
|
-
if (str.length > 100) {
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
|
314
|
-
str
|
|
315
|
-
);
|
|
316
|
-
if (!match) {
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
var n = parseFloat(match[1]);
|
|
320
|
-
var type = (match[2] || "ms").toLowerCase();
|
|
321
|
-
switch (type) {
|
|
322
|
-
case "years":
|
|
323
|
-
case "year":
|
|
324
|
-
case "yrs":
|
|
325
|
-
case "yr":
|
|
326
|
-
case "y":
|
|
327
|
-
return n * y;
|
|
328
|
-
case "weeks":
|
|
329
|
-
case "week":
|
|
330
|
-
case "w":
|
|
331
|
-
return n * w;
|
|
332
|
-
case "days":
|
|
333
|
-
case "day":
|
|
334
|
-
case "d":
|
|
335
|
-
return n * d;
|
|
336
|
-
case "hours":
|
|
337
|
-
case "hour":
|
|
338
|
-
case "hrs":
|
|
339
|
-
case "hr":
|
|
340
|
-
case "h":
|
|
341
|
-
return n * h;
|
|
342
|
-
case "minutes":
|
|
343
|
-
case "minute":
|
|
344
|
-
case "mins":
|
|
345
|
-
case "min":
|
|
346
|
-
case "m":
|
|
347
|
-
return n * m;
|
|
348
|
-
case "seconds":
|
|
349
|
-
case "second":
|
|
350
|
-
case "secs":
|
|
351
|
-
case "sec":
|
|
352
|
-
case "s":
|
|
353
|
-
return n * s;
|
|
354
|
-
case "milliseconds":
|
|
355
|
-
case "millisecond":
|
|
356
|
-
case "msecs":
|
|
357
|
-
case "msec":
|
|
358
|
-
case "ms":
|
|
359
|
-
return n;
|
|
360
|
-
default:
|
|
361
|
-
return void 0;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
function fmtShort(ms) {
|
|
365
|
-
var msAbs = Math.abs(ms);
|
|
366
|
-
if (msAbs >= d) {
|
|
367
|
-
return Math.round(ms / d) + "d";
|
|
368
|
-
}
|
|
369
|
-
if (msAbs >= h) {
|
|
370
|
-
return Math.round(ms / h) + "h";
|
|
371
|
-
}
|
|
372
|
-
if (msAbs >= m) {
|
|
373
|
-
return Math.round(ms / m) + "m";
|
|
374
|
-
}
|
|
375
|
-
if (msAbs >= s) {
|
|
376
|
-
return Math.round(ms / s) + "s";
|
|
377
|
-
}
|
|
378
|
-
return ms + "ms";
|
|
379
|
-
}
|
|
380
|
-
function fmtLong(ms) {
|
|
381
|
-
var msAbs = Math.abs(ms);
|
|
382
|
-
if (msAbs >= d) {
|
|
383
|
-
return plural(ms, msAbs, d, "day");
|
|
384
|
-
}
|
|
385
|
-
if (msAbs >= h) {
|
|
386
|
-
return plural(ms, msAbs, h, "hour");
|
|
387
|
-
}
|
|
388
|
-
if (msAbs >= m) {
|
|
389
|
-
return plural(ms, msAbs, m, "minute");
|
|
390
|
-
}
|
|
391
|
-
if (msAbs >= s) {
|
|
392
|
-
return plural(ms, msAbs, s, "second");
|
|
393
|
-
}
|
|
394
|
-
return ms + " ms";
|
|
395
|
-
}
|
|
396
|
-
function plural(ms, msAbs, n, name) {
|
|
397
|
-
var isPlural = msAbs >= n * 1.5;
|
|
398
|
-
return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
});
|
|
282
|
+
// src/index.ts
|
|
283
|
+
import { Parser, fromFile, fromURL } from "@asyncapi/parser";
|
|
284
|
+
import utils from "@eventcatalog/sdk";
|
|
285
|
+
import { readFile } from "fs/promises";
|
|
286
|
+
import argv from "minimist";
|
|
287
|
+
import yaml from "js-yaml";
|
|
288
|
+
import { z } from "zod";
|
|
289
|
+
import chalk4 from "chalk";
|
|
290
|
+
import path3 from "path";
|
|
402
291
|
|
|
403
|
-
//
|
|
404
|
-
var
|
|
405
|
-
"
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
}
|
|
456
|
-
index++;
|
|
457
|
-
const formatter = createDebug.formatters[format];
|
|
458
|
-
if (typeof formatter === "function") {
|
|
459
|
-
const val = args[index];
|
|
460
|
-
match = formatter.call(self, val);
|
|
461
|
-
args.splice(index, 1);
|
|
462
|
-
index--;
|
|
463
|
-
}
|
|
464
|
-
return match;
|
|
465
|
-
});
|
|
466
|
-
createDebug.formatArgs.call(self, args);
|
|
467
|
-
const logFn = self.log || createDebug.log;
|
|
468
|
-
logFn.apply(self, args);
|
|
469
|
-
}
|
|
470
|
-
debug.namespace = namespace;
|
|
471
|
-
debug.useColors = createDebug.useColors();
|
|
472
|
-
debug.color = createDebug.selectColor(namespace);
|
|
473
|
-
debug.extend = extend;
|
|
474
|
-
debug.destroy = createDebug.destroy;
|
|
475
|
-
Object.defineProperty(debug, "enabled", {
|
|
476
|
-
enumerable: true,
|
|
477
|
-
configurable: false,
|
|
478
|
-
get: () => {
|
|
479
|
-
if (enableOverride !== null) {
|
|
480
|
-
return enableOverride;
|
|
481
|
-
}
|
|
482
|
-
if (namespacesCache !== createDebug.namespaces) {
|
|
483
|
-
namespacesCache = createDebug.namespaces;
|
|
484
|
-
enabledCache = createDebug.enabled(namespace);
|
|
485
|
-
}
|
|
486
|
-
return enabledCache;
|
|
487
|
-
},
|
|
488
|
-
set: (v) => {
|
|
489
|
-
enableOverride = v;
|
|
490
|
-
}
|
|
491
|
-
});
|
|
492
|
-
if (typeof createDebug.init === "function") {
|
|
493
|
-
createDebug.init(debug);
|
|
494
|
-
}
|
|
495
|
-
return debug;
|
|
496
|
-
}
|
|
497
|
-
function extend(namespace, delimiter) {
|
|
498
|
-
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
499
|
-
newDebug.log = this.log;
|
|
500
|
-
return newDebug;
|
|
501
|
-
}
|
|
502
|
-
function enable(namespaces) {
|
|
503
|
-
createDebug.save(namespaces);
|
|
504
|
-
createDebug.namespaces = namespaces;
|
|
505
|
-
createDebug.names = [];
|
|
506
|
-
createDebug.skips = [];
|
|
507
|
-
const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
508
|
-
for (const ns of split) {
|
|
509
|
-
if (ns[0] === "-") {
|
|
510
|
-
createDebug.skips.push(ns.slice(1));
|
|
511
|
-
} else {
|
|
512
|
-
createDebug.names.push(ns);
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
function matchesTemplate(search, template) {
|
|
517
|
-
let searchIndex = 0;
|
|
518
|
-
let templateIndex = 0;
|
|
519
|
-
let starIndex = -1;
|
|
520
|
-
let matchIndex = 0;
|
|
521
|
-
while (searchIndex < search.length) {
|
|
522
|
-
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
|
|
523
|
-
if (template[templateIndex] === "*") {
|
|
524
|
-
starIndex = templateIndex;
|
|
525
|
-
matchIndex = searchIndex;
|
|
526
|
-
templateIndex++;
|
|
527
|
-
} else {
|
|
528
|
-
searchIndex++;
|
|
529
|
-
templateIndex++;
|
|
530
|
-
}
|
|
531
|
-
} else if (starIndex !== -1) {
|
|
532
|
-
templateIndex = starIndex + 1;
|
|
533
|
-
matchIndex++;
|
|
534
|
-
searchIndex = matchIndex;
|
|
535
|
-
} else {
|
|
536
|
-
return false;
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
while (templateIndex < template.length && template[templateIndex] === "*") {
|
|
540
|
-
templateIndex++;
|
|
541
|
-
}
|
|
542
|
-
return templateIndex === template.length;
|
|
543
|
-
}
|
|
544
|
-
function disable() {
|
|
545
|
-
const namespaces = [
|
|
546
|
-
...createDebug.names,
|
|
547
|
-
...createDebug.skips.map((namespace) => "-" + namespace)
|
|
548
|
-
].join(",");
|
|
549
|
-
createDebug.enable("");
|
|
550
|
-
return namespaces;
|
|
551
|
-
}
|
|
552
|
-
function enabled(name) {
|
|
553
|
-
for (const skip of createDebug.skips) {
|
|
554
|
-
if (matchesTemplate(name, skip)) {
|
|
555
|
-
return false;
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
for (const ns of createDebug.names) {
|
|
559
|
-
if (matchesTemplate(name, ns)) {
|
|
560
|
-
return true;
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
return false;
|
|
564
|
-
}
|
|
565
|
-
function coerce(val) {
|
|
566
|
-
if (val instanceof Error) {
|
|
567
|
-
return val.stack || val.message;
|
|
568
|
-
}
|
|
569
|
-
return val;
|
|
570
|
-
}
|
|
571
|
-
function destroy() {
|
|
572
|
-
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
573
|
-
}
|
|
574
|
-
createDebug.enable(createDebug.load());
|
|
575
|
-
return createDebug;
|
|
576
|
-
}
|
|
577
|
-
module.exports = setup;
|
|
292
|
+
// package.json
|
|
293
|
+
var package_default = {
|
|
294
|
+
name: "@eventcatalog/generator-asyncapi",
|
|
295
|
+
version: "4.5.0",
|
|
296
|
+
description: "AsyncAPI generator for EventCatalog",
|
|
297
|
+
scripts: {
|
|
298
|
+
build: "tsup",
|
|
299
|
+
test: "vitest",
|
|
300
|
+
format: "prettier --write .",
|
|
301
|
+
"format:diff": "prettier --list-different .",
|
|
302
|
+
changeset: "changeset",
|
|
303
|
+
release: "changeset publish"
|
|
304
|
+
},
|
|
305
|
+
publishConfig: {
|
|
306
|
+
access: "public"
|
|
307
|
+
},
|
|
308
|
+
keywords: [],
|
|
309
|
+
author: "",
|
|
310
|
+
license: "ISC",
|
|
311
|
+
devDependencies: {
|
|
312
|
+
"@changesets/cli": "^2.27.9",
|
|
313
|
+
"@types/fs-extra": "^11.0.4",
|
|
314
|
+
"@types/js-yaml": "^4.0.9",
|
|
315
|
+
"@types/lodash": "^4.17.7",
|
|
316
|
+
"@types/minimist": "^1.2.5",
|
|
317
|
+
"@types/node": "^20.16.1",
|
|
318
|
+
prettier: "^3.3.3",
|
|
319
|
+
tsup: "^8.1.0",
|
|
320
|
+
typescript: "^5.5.3",
|
|
321
|
+
vitest: "^2.0.2"
|
|
322
|
+
},
|
|
323
|
+
files: [
|
|
324
|
+
"dist",
|
|
325
|
+
"package.json"
|
|
326
|
+
],
|
|
327
|
+
main: "./dist/index.js",
|
|
328
|
+
module: "./dist/index.mjs",
|
|
329
|
+
types: "./dist/index.d.ts",
|
|
330
|
+
dependencies: {
|
|
331
|
+
"@asyncapi/avro-schema-parser": "^3.0.24",
|
|
332
|
+
"@asyncapi/parser": "^3.4.0",
|
|
333
|
+
"@eventcatalog/sdk": "^2.6.9",
|
|
334
|
+
chalk: "^4",
|
|
335
|
+
"fs-extra": "^11.2.0",
|
|
336
|
+
glob: "^11.0.0",
|
|
337
|
+
"gray-matter": "^4.0.3",
|
|
338
|
+
"js-yaml": "^4.1.0",
|
|
339
|
+
lodash: "^4.17.21",
|
|
340
|
+
minimist: "^1.2.8",
|
|
341
|
+
slugify: "^1.6.6",
|
|
342
|
+
"update-notifier": "^7.3.1",
|
|
343
|
+
zod: "^3.23.8"
|
|
578
344
|
}
|
|
579
|
-
}
|
|
345
|
+
};
|
|
580
346
|
|
|
581
|
-
// ../../node_modules/.pnpm/
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
})();
|
|
599
|
-
exports.colors = [
|
|
600
|
-
"#0000CC",
|
|
601
|
-
"#0000FF",
|
|
602
|
-
"#0033CC",
|
|
603
|
-
"#0033FF",
|
|
604
|
-
"#0066CC",
|
|
605
|
-
"#0066FF",
|
|
606
|
-
"#0099CC",
|
|
607
|
-
"#0099FF",
|
|
608
|
-
"#00CC00",
|
|
609
|
-
"#00CC33",
|
|
610
|
-
"#00CC66",
|
|
611
|
-
"#00CC99",
|
|
612
|
-
"#00CCCC",
|
|
613
|
-
"#00CCFF",
|
|
614
|
-
"#3300CC",
|
|
615
|
-
"#3300FF",
|
|
616
|
-
"#3333CC",
|
|
617
|
-
"#3333FF",
|
|
618
|
-
"#3366CC",
|
|
619
|
-
"#3366FF",
|
|
620
|
-
"#3399CC",
|
|
621
|
-
"#3399FF",
|
|
622
|
-
"#33CC00",
|
|
623
|
-
"#33CC33",
|
|
624
|
-
"#33CC66",
|
|
625
|
-
"#33CC99",
|
|
626
|
-
"#33CCCC",
|
|
627
|
-
"#33CCFF",
|
|
628
|
-
"#6600CC",
|
|
629
|
-
"#6600FF",
|
|
630
|
-
"#6633CC",
|
|
631
|
-
"#6633FF",
|
|
632
|
-
"#66CC00",
|
|
633
|
-
"#66CC33",
|
|
634
|
-
"#9900CC",
|
|
635
|
-
"#9900FF",
|
|
636
|
-
"#9933CC",
|
|
637
|
-
"#9933FF",
|
|
638
|
-
"#99CC00",
|
|
639
|
-
"#99CC33",
|
|
640
|
-
"#CC0000",
|
|
641
|
-
"#CC0033",
|
|
642
|
-
"#CC0066",
|
|
643
|
-
"#CC0099",
|
|
644
|
-
"#CC00CC",
|
|
645
|
-
"#CC00FF",
|
|
646
|
-
"#CC3300",
|
|
647
|
-
"#CC3333",
|
|
648
|
-
"#CC3366",
|
|
649
|
-
"#CC3399",
|
|
650
|
-
"#CC33CC",
|
|
651
|
-
"#CC33FF",
|
|
652
|
-
"#CC6600",
|
|
653
|
-
"#CC6633",
|
|
654
|
-
"#CC9900",
|
|
655
|
-
"#CC9933",
|
|
656
|
-
"#CCCC00",
|
|
657
|
-
"#CCCC33",
|
|
658
|
-
"#FF0000",
|
|
659
|
-
"#FF0033",
|
|
660
|
-
"#FF0066",
|
|
661
|
-
"#FF0099",
|
|
662
|
-
"#FF00CC",
|
|
663
|
-
"#FF00FF",
|
|
664
|
-
"#FF3300",
|
|
665
|
-
"#FF3333",
|
|
666
|
-
"#FF3366",
|
|
667
|
-
"#FF3399",
|
|
668
|
-
"#FF33CC",
|
|
669
|
-
"#FF33FF",
|
|
670
|
-
"#FF6600",
|
|
671
|
-
"#FF6633",
|
|
672
|
-
"#FF9900",
|
|
673
|
-
"#FF9933",
|
|
674
|
-
"#FFCC00",
|
|
675
|
-
"#FFCC33"
|
|
676
|
-
];
|
|
677
|
-
function useColors() {
|
|
678
|
-
if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
|
|
679
|
-
return true;
|
|
680
|
-
}
|
|
681
|
-
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
682
|
-
return false;
|
|
683
|
-
}
|
|
684
|
-
let m;
|
|
685
|
-
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
|
|
686
|
-
typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
|
|
687
|
-
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
688
|
-
typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
|
|
689
|
-
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
690
|
-
}
|
|
691
|
-
function formatArgs(args) {
|
|
692
|
-
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
|
|
693
|
-
if (!this.useColors) {
|
|
694
|
-
return;
|
|
695
|
-
}
|
|
696
|
-
const c = "color: " + this.color;
|
|
697
|
-
args.splice(1, 0, c, "color: inherit");
|
|
698
|
-
let index = 0;
|
|
699
|
-
let lastC = 0;
|
|
700
|
-
args[0].replace(/%[a-zA-Z%]/g, (match) => {
|
|
701
|
-
if (match === "%%") {
|
|
702
|
-
return;
|
|
703
|
-
}
|
|
704
|
-
index++;
|
|
705
|
-
if (match === "%c") {
|
|
706
|
-
lastC = index;
|
|
707
|
-
}
|
|
708
|
-
});
|
|
709
|
-
args.splice(lastC, 0, c);
|
|
710
|
-
}
|
|
711
|
-
exports.log = console.debug || console.log || (() => {
|
|
712
|
-
});
|
|
713
|
-
function save(namespaces) {
|
|
714
|
-
try {
|
|
715
|
-
if (namespaces) {
|
|
716
|
-
exports.storage.setItem("debug", namespaces);
|
|
717
|
-
} else {
|
|
718
|
-
exports.storage.removeItem("debug");
|
|
719
|
-
}
|
|
720
|
-
} catch (error) {
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
function load() {
|
|
724
|
-
let r;
|
|
725
|
-
try {
|
|
726
|
-
r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
|
|
727
|
-
} catch (error) {
|
|
728
|
-
}
|
|
729
|
-
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
730
|
-
r = process.env.DEBUG;
|
|
731
|
-
}
|
|
732
|
-
return r;
|
|
733
|
-
}
|
|
734
|
-
function localstorage() {
|
|
735
|
-
try {
|
|
736
|
-
return localStorage;
|
|
737
|
-
} catch (error) {
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
module.exports = require_common()(exports);
|
|
741
|
-
var { formatters } = module.exports;
|
|
742
|
-
formatters.j = function(v) {
|
|
743
|
-
try {
|
|
744
|
-
return JSON.stringify(v);
|
|
745
|
-
} catch (error) {
|
|
746
|
-
return "[UnexpectedJSONParseError]: " + error.message;
|
|
747
|
-
}
|
|
748
|
-
};
|
|
347
|
+
// ../../node_modules/.pnpm/boxen@8.0.1/node_modules/boxen/index.js
|
|
348
|
+
import process2 from "process";
|
|
349
|
+
|
|
350
|
+
// ../../node_modules/.pnpm/ansi-regex@6.2.0/node_modules/ansi-regex/index.js
|
|
351
|
+
function ansiRegex({ onlyFirst = false } = {}) {
|
|
352
|
+
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
353
|
+
const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
|
|
354
|
+
const csi = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
|
|
355
|
+
const pattern = `${osc}|${csi}`;
|
|
356
|
+
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// ../../node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js
|
|
360
|
+
var regex = ansiRegex();
|
|
361
|
+
function stripAnsi(string) {
|
|
362
|
+
if (typeof string !== "string") {
|
|
363
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
749
364
|
}
|
|
750
|
-
|
|
365
|
+
return string.replace(regex, "");
|
|
366
|
+
}
|
|
751
367
|
|
|
752
|
-
// ../../node_modules/.pnpm/
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
368
|
+
// ../../node_modules/.pnpm/get-east-asian-width@1.3.1/node_modules/get-east-asian-width/lookup.js
|
|
369
|
+
function isAmbiguous(x) {
|
|
370
|
+
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;
|
|
371
|
+
}
|
|
372
|
+
function isFullWidth(x) {
|
|
373
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
374
|
+
}
|
|
375
|
+
function isWide(x) {
|
|
376
|
+
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 >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || 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 <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && 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 >= 101631 && 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 >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || 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 <= 129673 || x >= 129679 && x <= 129734 || x >= 129742 && x <= 129756 || x >= 129759 && x <= 129769 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// ../../node_modules/.pnpm/get-east-asian-width@1.3.1/node_modules/get-east-asian-width/index.js
|
|
380
|
+
function validate(codePoint) {
|
|
381
|
+
if (!Number.isSafeInteger(codePoint)) {
|
|
382
|
+
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
762
383
|
}
|
|
763
|
-
}
|
|
384
|
+
}
|
|
385
|
+
function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
386
|
+
validate(codePoint);
|
|
387
|
+
if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
|
|
388
|
+
return 2;
|
|
389
|
+
}
|
|
390
|
+
return 1;
|
|
391
|
+
}
|
|
764
392
|
|
|
765
|
-
// ../../node_modules/.pnpm/
|
|
766
|
-
var
|
|
767
|
-
"../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js"(exports, module) {
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
393
|
+
// ../../node_modules/.pnpm/emoji-regex@10.5.0/node_modules/emoji-regex/index.mjs
|
|
394
|
+
var emoji_regex_default = () => {
|
|
395
|
+
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
// ../../node_modules/.pnpm/string-width@7.2.0/node_modules/string-width/index.js
|
|
399
|
+
var segmenter = new Intl.Segmenter();
|
|
400
|
+
var defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
401
|
+
function stringWidth(string, options = {}) {
|
|
402
|
+
if (typeof string !== "string" || string.length === 0) {
|
|
403
|
+
return 0;
|
|
404
|
+
}
|
|
405
|
+
const {
|
|
406
|
+
ambiguousIsNarrow = true,
|
|
407
|
+
countAnsiEscapeCodes = false
|
|
408
|
+
} = options;
|
|
409
|
+
if (!countAnsiEscapeCodes) {
|
|
410
|
+
string = stripAnsi(string);
|
|
411
|
+
}
|
|
412
|
+
if (string.length === 0) {
|
|
413
|
+
return 0;
|
|
414
|
+
}
|
|
415
|
+
let width = 0;
|
|
416
|
+
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
417
|
+
for (const { segment: character } of segmenter.segment(string)) {
|
|
418
|
+
const codePoint = character.codePointAt(0);
|
|
419
|
+
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
|
420
|
+
continue;
|
|
787
421
|
}
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
return false;
|
|
791
|
-
}
|
|
792
|
-
return {
|
|
793
|
-
level,
|
|
794
|
-
hasBasic: true,
|
|
795
|
-
has256: level >= 2,
|
|
796
|
-
has16m: level >= 3
|
|
797
|
-
};
|
|
422
|
+
if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
|
|
423
|
+
continue;
|
|
798
424
|
}
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
return 3;
|
|
805
|
-
}
|
|
806
|
-
if (hasFlag("color=256")) {
|
|
807
|
-
return 2;
|
|
808
|
-
}
|
|
809
|
-
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
810
|
-
return 0;
|
|
811
|
-
}
|
|
812
|
-
const min = forceColor || 0;
|
|
813
|
-
if (env.TERM === "dumb") {
|
|
814
|
-
return min;
|
|
815
|
-
}
|
|
816
|
-
if (process.platform === "win32") {
|
|
817
|
-
const osRelease = os.release().split(".");
|
|
818
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
819
|
-
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
820
|
-
}
|
|
821
|
-
return 1;
|
|
822
|
-
}
|
|
823
|
-
if ("CI" in env) {
|
|
824
|
-
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
825
|
-
return 1;
|
|
826
|
-
}
|
|
827
|
-
return min;
|
|
828
|
-
}
|
|
829
|
-
if ("TEAMCITY_VERSION" in env) {
|
|
830
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
831
|
-
}
|
|
832
|
-
if (env.COLORTERM === "truecolor") {
|
|
833
|
-
return 3;
|
|
834
|
-
}
|
|
835
|
-
if ("TERM_PROGRAM" in env) {
|
|
836
|
-
const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
837
|
-
switch (env.TERM_PROGRAM) {
|
|
838
|
-
case "iTerm.app":
|
|
839
|
-
return version >= 3 ? 3 : 2;
|
|
840
|
-
case "Apple_Terminal":
|
|
841
|
-
return 2;
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
if (/-256(color)?$/i.test(env.TERM)) {
|
|
845
|
-
return 2;
|
|
846
|
-
}
|
|
847
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
848
|
-
return 1;
|
|
849
|
-
}
|
|
850
|
-
if ("COLORTERM" in env) {
|
|
851
|
-
return 1;
|
|
852
|
-
}
|
|
853
|
-
return min;
|
|
425
|
+
if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
|
|
426
|
+
continue;
|
|
427
|
+
}
|
|
428
|
+
if (codePoint >= 55296 && codePoint <= 57343) {
|
|
429
|
+
continue;
|
|
854
430
|
}
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
return translateLevel(level);
|
|
431
|
+
if (codePoint >= 65024 && codePoint <= 65039) {
|
|
432
|
+
continue;
|
|
858
433
|
}
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
434
|
+
if (defaultIgnorableCodePointRegex.test(character)) {
|
|
435
|
+
continue;
|
|
436
|
+
}
|
|
437
|
+
if (emoji_regex_default().test(character)) {
|
|
438
|
+
width += 2;
|
|
439
|
+
continue;
|
|
440
|
+
}
|
|
441
|
+
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
864
442
|
}
|
|
865
|
-
|
|
443
|
+
return width;
|
|
444
|
+
}
|
|
866
445
|
|
|
867
|
-
// ../../node_modules/.pnpm/
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
exports.formatArgs = formatArgs;
|
|
876
|
-
exports.save = save;
|
|
877
|
-
exports.load = load;
|
|
878
|
-
exports.useColors = useColors;
|
|
879
|
-
exports.destroy = util.deprecate(
|
|
880
|
-
() => {
|
|
881
|
-
},
|
|
882
|
-
"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."
|
|
883
|
-
);
|
|
884
|
-
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
885
|
-
try {
|
|
886
|
-
const supportsColor = require_supports_color();
|
|
887
|
-
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
888
|
-
exports.colors = [
|
|
889
|
-
20,
|
|
890
|
-
21,
|
|
891
|
-
26,
|
|
892
|
-
27,
|
|
893
|
-
32,
|
|
894
|
-
33,
|
|
895
|
-
38,
|
|
896
|
-
39,
|
|
897
|
-
40,
|
|
898
|
-
41,
|
|
899
|
-
42,
|
|
900
|
-
43,
|
|
901
|
-
44,
|
|
902
|
-
45,
|
|
903
|
-
56,
|
|
904
|
-
57,
|
|
905
|
-
62,
|
|
906
|
-
63,
|
|
907
|
-
68,
|
|
908
|
-
69,
|
|
909
|
-
74,
|
|
910
|
-
75,
|
|
911
|
-
76,
|
|
912
|
-
77,
|
|
913
|
-
78,
|
|
914
|
-
79,
|
|
915
|
-
80,
|
|
916
|
-
81,
|
|
917
|
-
92,
|
|
918
|
-
93,
|
|
919
|
-
98,
|
|
920
|
-
99,
|
|
921
|
-
112,
|
|
922
|
-
113,
|
|
923
|
-
128,
|
|
924
|
-
129,
|
|
925
|
-
134,
|
|
926
|
-
135,
|
|
927
|
-
148,
|
|
928
|
-
149,
|
|
929
|
-
160,
|
|
930
|
-
161,
|
|
931
|
-
162,
|
|
932
|
-
163,
|
|
933
|
-
164,
|
|
934
|
-
165,
|
|
935
|
-
166,
|
|
936
|
-
167,
|
|
937
|
-
168,
|
|
938
|
-
169,
|
|
939
|
-
170,
|
|
940
|
-
171,
|
|
941
|
-
172,
|
|
942
|
-
173,
|
|
943
|
-
178,
|
|
944
|
-
179,
|
|
945
|
-
184,
|
|
946
|
-
185,
|
|
947
|
-
196,
|
|
948
|
-
197,
|
|
949
|
-
198,
|
|
950
|
-
199,
|
|
951
|
-
200,
|
|
952
|
-
201,
|
|
953
|
-
202,
|
|
954
|
-
203,
|
|
955
|
-
204,
|
|
956
|
-
205,
|
|
957
|
-
206,
|
|
958
|
-
207,
|
|
959
|
-
208,
|
|
960
|
-
209,
|
|
961
|
-
214,
|
|
962
|
-
215,
|
|
963
|
-
220,
|
|
964
|
-
221
|
|
965
|
-
];
|
|
966
|
-
}
|
|
967
|
-
} catch (error) {
|
|
968
|
-
}
|
|
969
|
-
exports.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
970
|
-
return /^debug_/i.test(key);
|
|
971
|
-
}).reduce((obj, key) => {
|
|
972
|
-
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
|
|
973
|
-
return k.toUpperCase();
|
|
974
|
-
});
|
|
975
|
-
let val = process.env[key];
|
|
976
|
-
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
|
977
|
-
val = true;
|
|
978
|
-
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
|
979
|
-
val = false;
|
|
980
|
-
} else if (val === "null") {
|
|
981
|
-
val = null;
|
|
982
|
-
} else {
|
|
983
|
-
val = Number(val);
|
|
984
|
-
}
|
|
985
|
-
obj[prop] = val;
|
|
986
|
-
return obj;
|
|
987
|
-
}, {});
|
|
988
|
-
function useColors() {
|
|
989
|
-
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
990
|
-
}
|
|
991
|
-
function formatArgs(args) {
|
|
992
|
-
const { namespace: name, useColors: useColors2 } = this;
|
|
993
|
-
if (useColors2) {
|
|
994
|
-
const c = this.color;
|
|
995
|
-
const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
|
|
996
|
-
const prefix = ` ${colorCode};1m${name} \x1B[0m`;
|
|
997
|
-
args[0] = prefix + args[0].split("\n").join("\n" + prefix);
|
|
998
|
-
args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
|
|
999
|
-
} else {
|
|
1000
|
-
args[0] = getDate() + name + " " + args[0];
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
function getDate() {
|
|
1004
|
-
if (exports.inspectOpts.hideDate) {
|
|
1005
|
-
return "";
|
|
1006
|
-
}
|
|
1007
|
-
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
1008
|
-
}
|
|
1009
|
-
function log(...args) {
|
|
1010
|
-
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + "\n");
|
|
1011
|
-
}
|
|
1012
|
-
function save(namespaces) {
|
|
1013
|
-
if (namespaces) {
|
|
1014
|
-
process.env.DEBUG = namespaces;
|
|
1015
|
-
} else {
|
|
1016
|
-
delete process.env.DEBUG;
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
function load() {
|
|
1020
|
-
return process.env.DEBUG;
|
|
1021
|
-
}
|
|
1022
|
-
function init(debug) {
|
|
1023
|
-
debug.inspectOpts = {};
|
|
1024
|
-
const keys = Object.keys(exports.inspectOpts);
|
|
1025
|
-
for (let i = 0; i < keys.length; i++) {
|
|
1026
|
-
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
|
-
module.exports = require_common()(exports);
|
|
1030
|
-
var { formatters } = module.exports;
|
|
1031
|
-
formatters.o = function(v) {
|
|
1032
|
-
this.inspectOpts.colors = this.useColors;
|
|
1033
|
-
return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
|
|
1034
|
-
};
|
|
1035
|
-
formatters.O = function(v) {
|
|
1036
|
-
this.inspectOpts.colors = this.useColors;
|
|
1037
|
-
return util.inspect(v, this.inspectOpts);
|
|
1038
|
-
};
|
|
446
|
+
// ../../node_modules/.pnpm/boxen@8.0.1/node_modules/boxen/index.js
|
|
447
|
+
import chalk from "chalk";
|
|
448
|
+
|
|
449
|
+
// ../../node_modules/.pnpm/widest-line@5.0.0/node_modules/widest-line/index.js
|
|
450
|
+
function widestLine(string) {
|
|
451
|
+
let lineWidth = 0;
|
|
452
|
+
for (const line of string.split("\n")) {
|
|
453
|
+
lineWidth = Math.max(lineWidth, stringWidth(line));
|
|
1039
454
|
}
|
|
1040
|
-
|
|
455
|
+
return lineWidth;
|
|
456
|
+
}
|
|
1041
457
|
|
|
1042
|
-
// ../../node_modules/.pnpm/
|
|
1043
|
-
var
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
458
|
+
// ../../node_modules/.pnpm/boxen@8.0.1/node_modules/boxen/index.js
|
|
459
|
+
var import_cli_boxes = __toESM(require_cli_boxes(), 1);
|
|
460
|
+
|
|
461
|
+
// ../../node_modules/.pnpm/camelcase@8.0.0/node_modules/camelcase/index.js
|
|
462
|
+
var UPPERCASE = /[\p{Lu}]/u;
|
|
463
|
+
var LOWERCASE = /[\p{Ll}]/u;
|
|
464
|
+
var LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu;
|
|
465
|
+
var IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
|
|
466
|
+
var SEPARATORS = /[_.\- ]+/;
|
|
467
|
+
var LEADING_SEPARATORS = new RegExp("^" + SEPARATORS.source);
|
|
468
|
+
var SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, "gu");
|
|
469
|
+
var NUMBERS_AND_IDENTIFIER = new RegExp("\\d+" + IDENTIFIER.source, "gu");
|
|
470
|
+
var preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUppercase2) => {
|
|
471
|
+
let isLastCharLower = false;
|
|
472
|
+
let isLastCharUpper = false;
|
|
473
|
+
let isLastLastCharUpper = false;
|
|
474
|
+
let isLastLastCharPreserved = false;
|
|
475
|
+
for (let index = 0; index < string.length; index++) {
|
|
476
|
+
const character = string[index];
|
|
477
|
+
isLastLastCharPreserved = index > 2 ? string[index - 3] === "-" : true;
|
|
478
|
+
if (isLastCharLower && UPPERCASE.test(character)) {
|
|
479
|
+
string = string.slice(0, index) + "-" + string.slice(index);
|
|
480
|
+
isLastCharLower = false;
|
|
481
|
+
isLastLastCharUpper = isLastCharUpper;
|
|
482
|
+
isLastCharUpper = true;
|
|
483
|
+
index++;
|
|
484
|
+
} else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character) && (!isLastLastCharPreserved || preserveConsecutiveUppercase2)) {
|
|
485
|
+
string = string.slice(0, index - 1) + "-" + string.slice(index - 1);
|
|
486
|
+
isLastLastCharUpper = isLastCharUpper;
|
|
487
|
+
isLastCharUpper = false;
|
|
488
|
+
isLastCharLower = true;
|
|
1048
489
|
} else {
|
|
1049
|
-
|
|
490
|
+
isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;
|
|
491
|
+
isLastLastCharUpper = isLastCharUpper;
|
|
492
|
+
isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;
|
|
1050
493
|
}
|
|
1051
494
|
}
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
Object.defineProperty(o, k2, desc);
|
|
1067
|
-
} : function(o, m, k, k2) {
|
|
1068
|
-
if (k2 === void 0) k2 = k;
|
|
1069
|
-
o[k2] = m[k];
|
|
1070
|
-
});
|
|
1071
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
|
|
1072
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
1073
|
-
} : function(o, v) {
|
|
1074
|
-
o["default"] = v;
|
|
1075
|
-
});
|
|
1076
|
-
var __importStar = exports && exports.__importStar || function(mod) {
|
|
1077
|
-
if (mod && mod.__esModule) return mod;
|
|
1078
|
-
var result = {};
|
|
1079
|
-
if (mod != null) {
|
|
1080
|
-
for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
1081
|
-
}
|
|
1082
|
-
__setModuleDefault(result, mod);
|
|
1083
|
-
return result;
|
|
1084
|
-
};
|
|
1085
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1086
|
-
exports.req = exports.json = exports.toBuffer = void 0;
|
|
1087
|
-
var http = __importStar(__require("http"));
|
|
1088
|
-
var https = __importStar(__require("https"));
|
|
1089
|
-
async function toBuffer(stream) {
|
|
1090
|
-
let length = 0;
|
|
1091
|
-
const chunks = [];
|
|
1092
|
-
for await (const chunk of stream) {
|
|
1093
|
-
length += chunk.length;
|
|
1094
|
-
chunks.push(chunk);
|
|
1095
|
-
}
|
|
1096
|
-
return Buffer.concat(chunks, length);
|
|
1097
|
-
}
|
|
1098
|
-
exports.toBuffer = toBuffer;
|
|
1099
|
-
async function json(stream) {
|
|
1100
|
-
const buf = await toBuffer(stream);
|
|
1101
|
-
const str = buf.toString("utf8");
|
|
1102
|
-
try {
|
|
1103
|
-
return JSON.parse(str);
|
|
1104
|
-
} catch (_err) {
|
|
1105
|
-
const err = _err;
|
|
1106
|
-
err.message += ` (input: ${str})`;
|
|
1107
|
-
throw err;
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
|
-
exports.json = json;
|
|
1111
|
-
function req(url, opts = {}) {
|
|
1112
|
-
const href = typeof url === "string" ? url : url.href;
|
|
1113
|
-
const req2 = (href.startsWith("https:") ? https : http).request(url, opts);
|
|
1114
|
-
const promise = new Promise((resolve, reject) => {
|
|
1115
|
-
req2.once("response", resolve).once("error", reject).end();
|
|
1116
|
-
});
|
|
1117
|
-
req2.then = promise.then.bind(promise);
|
|
1118
|
-
return req2;
|
|
1119
|
-
}
|
|
1120
|
-
exports.req = req;
|
|
495
|
+
return string;
|
|
496
|
+
};
|
|
497
|
+
var preserveConsecutiveUppercase = (input, toLowerCase) => {
|
|
498
|
+
LEADING_CAPITAL.lastIndex = 0;
|
|
499
|
+
return input.replaceAll(LEADING_CAPITAL, (match) => toLowerCase(match));
|
|
500
|
+
};
|
|
501
|
+
var postProcess = (input, toUpperCase) => {
|
|
502
|
+
SEPARATORS_AND_IDENTIFIER.lastIndex = 0;
|
|
503
|
+
NUMBERS_AND_IDENTIFIER.lastIndex = 0;
|
|
504
|
+
return input.replaceAll(NUMBERS_AND_IDENTIFIER, (match, pattern, offset) => ["_", "-"].includes(input.charAt(offset + match.length)) ? match : toUpperCase(match)).replaceAll(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier));
|
|
505
|
+
};
|
|
506
|
+
function camelCase(input, options) {
|
|
507
|
+
if (!(typeof input === "string" || Array.isArray(input))) {
|
|
508
|
+
throw new TypeError("Expected the input to be `string | string[]`");
|
|
1121
509
|
}
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1132
|
-
desc = { enumerable: true, get: function() {
|
|
1133
|
-
return m[k];
|
|
1134
|
-
} };
|
|
1135
|
-
}
|
|
1136
|
-
Object.defineProperty(o, k2, desc);
|
|
1137
|
-
} : function(o, m, k, k2) {
|
|
1138
|
-
if (k2 === void 0) k2 = k;
|
|
1139
|
-
o[k2] = m[k];
|
|
1140
|
-
});
|
|
1141
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
|
|
1142
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
1143
|
-
} : function(o, v) {
|
|
1144
|
-
o["default"] = v;
|
|
1145
|
-
});
|
|
1146
|
-
var __importStar = exports && exports.__importStar || function(mod) {
|
|
1147
|
-
if (mod && mod.__esModule) return mod;
|
|
1148
|
-
var result = {};
|
|
1149
|
-
if (mod != null) {
|
|
1150
|
-
for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
1151
|
-
}
|
|
1152
|
-
__setModuleDefault(result, mod);
|
|
1153
|
-
return result;
|
|
1154
|
-
};
|
|
1155
|
-
var __exportStar = exports && exports.__exportStar || function(m, exports2) {
|
|
1156
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
|
|
1157
|
-
};
|
|
1158
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1159
|
-
exports.Agent = void 0;
|
|
1160
|
-
var net = __importStar(__require("net"));
|
|
1161
|
-
var http = __importStar(__require("http"));
|
|
1162
|
-
var https_1 = __require("https");
|
|
1163
|
-
__exportStar(require_helpers(), exports);
|
|
1164
|
-
var INTERNAL = Symbol("AgentBaseInternalState");
|
|
1165
|
-
var Agent = class extends http.Agent {
|
|
1166
|
-
constructor(opts) {
|
|
1167
|
-
super(opts);
|
|
1168
|
-
this[INTERNAL] = {};
|
|
1169
|
-
}
|
|
1170
|
-
/**
|
|
1171
|
-
* Determine whether this is an `http` or `https` request.
|
|
1172
|
-
*/
|
|
1173
|
-
isSecureEndpoint(options) {
|
|
1174
|
-
if (options) {
|
|
1175
|
-
if (typeof options.secureEndpoint === "boolean") {
|
|
1176
|
-
return options.secureEndpoint;
|
|
1177
|
-
}
|
|
1178
|
-
if (typeof options.protocol === "string") {
|
|
1179
|
-
return options.protocol === "https:";
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
const { stack } = new Error();
|
|
1183
|
-
if (typeof stack !== "string")
|
|
1184
|
-
return false;
|
|
1185
|
-
return stack.split("\n").some((l) => l.indexOf("(https.js:") !== -1 || l.indexOf("node:https:") !== -1);
|
|
1186
|
-
}
|
|
1187
|
-
// In order to support async signatures in `connect()` and Node's native
|
|
1188
|
-
// connection pooling in `http.Agent`, the array of sockets for each origin
|
|
1189
|
-
// has to be updated synchronously. This is so the length of the array is
|
|
1190
|
-
// accurate when `addRequest()` is next called. We achieve this by creating a
|
|
1191
|
-
// fake socket and adding it to `sockets[origin]` and incrementing
|
|
1192
|
-
// `totalSocketCount`.
|
|
1193
|
-
incrementSockets(name) {
|
|
1194
|
-
if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) {
|
|
1195
|
-
return null;
|
|
1196
|
-
}
|
|
1197
|
-
if (!this.sockets[name]) {
|
|
1198
|
-
this.sockets[name] = [];
|
|
1199
|
-
}
|
|
1200
|
-
const fakeSocket = new net.Socket({ writable: false });
|
|
1201
|
-
this.sockets[name].push(fakeSocket);
|
|
1202
|
-
this.totalSocketCount++;
|
|
1203
|
-
return fakeSocket;
|
|
1204
|
-
}
|
|
1205
|
-
decrementSockets(name, socket) {
|
|
1206
|
-
if (!this.sockets[name] || socket === null) {
|
|
1207
|
-
return;
|
|
1208
|
-
}
|
|
1209
|
-
const sockets = this.sockets[name];
|
|
1210
|
-
const index = sockets.indexOf(socket);
|
|
1211
|
-
if (index !== -1) {
|
|
1212
|
-
sockets.splice(index, 1);
|
|
1213
|
-
this.totalSocketCount--;
|
|
1214
|
-
if (sockets.length === 0) {
|
|
1215
|
-
delete this.sockets[name];
|
|
1216
|
-
}
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
// In order to properly update the socket pool, we need to call `getName()` on
|
|
1220
|
-
// the core `https.Agent` if it is a secureEndpoint.
|
|
1221
|
-
getName(options) {
|
|
1222
|
-
const secureEndpoint = this.isSecureEndpoint(options);
|
|
1223
|
-
if (secureEndpoint) {
|
|
1224
|
-
return https_1.Agent.prototype.getName.call(this, options);
|
|
1225
|
-
}
|
|
1226
|
-
return super.getName(options);
|
|
1227
|
-
}
|
|
1228
|
-
createSocket(req, options, cb) {
|
|
1229
|
-
const connectOpts = {
|
|
1230
|
-
...options,
|
|
1231
|
-
secureEndpoint: this.isSecureEndpoint(options)
|
|
1232
|
-
};
|
|
1233
|
-
const name = this.getName(connectOpts);
|
|
1234
|
-
const fakeSocket = this.incrementSockets(name);
|
|
1235
|
-
Promise.resolve().then(() => this.connect(req, connectOpts)).then((socket) => {
|
|
1236
|
-
this.decrementSockets(name, fakeSocket);
|
|
1237
|
-
if (socket instanceof http.Agent) {
|
|
1238
|
-
try {
|
|
1239
|
-
return socket.addRequest(req, connectOpts);
|
|
1240
|
-
} catch (err) {
|
|
1241
|
-
return cb(err);
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
this[INTERNAL].currentSocket = socket;
|
|
1245
|
-
super.createSocket(req, options, cb);
|
|
1246
|
-
}, (err) => {
|
|
1247
|
-
this.decrementSockets(name, fakeSocket);
|
|
1248
|
-
cb(err);
|
|
1249
|
-
});
|
|
1250
|
-
}
|
|
1251
|
-
createConnection() {
|
|
1252
|
-
const socket = this[INTERNAL].currentSocket;
|
|
1253
|
-
this[INTERNAL].currentSocket = void 0;
|
|
1254
|
-
if (!socket) {
|
|
1255
|
-
throw new Error("No socket was returned in the `connect()` function");
|
|
1256
|
-
}
|
|
1257
|
-
return socket;
|
|
1258
|
-
}
|
|
1259
|
-
get defaultPort() {
|
|
1260
|
-
return this[INTERNAL].defaultPort ?? (this.protocol === "https:" ? 443 : 80);
|
|
1261
|
-
}
|
|
1262
|
-
set defaultPort(v) {
|
|
1263
|
-
if (this[INTERNAL]) {
|
|
1264
|
-
this[INTERNAL].defaultPort = v;
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
get protocol() {
|
|
1268
|
-
return this[INTERNAL].protocol ?? (this.isSecureEndpoint() ? "https:" : "http:");
|
|
1269
|
-
}
|
|
1270
|
-
set protocol(v) {
|
|
1271
|
-
if (this[INTERNAL]) {
|
|
1272
|
-
this[INTERNAL].protocol = v;
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1275
|
-
};
|
|
1276
|
-
exports.Agent = Agent;
|
|
510
|
+
options = {
|
|
511
|
+
pascalCase: false,
|
|
512
|
+
preserveConsecutiveUppercase: false,
|
|
513
|
+
...options
|
|
514
|
+
};
|
|
515
|
+
if (Array.isArray(input)) {
|
|
516
|
+
input = input.map((x) => x.trim()).filter((x) => x.length).join("-");
|
|
517
|
+
} else {
|
|
518
|
+
input = input.trim();
|
|
1277
519
|
}
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
// ../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/parse-proxy-response.js
|
|
1281
|
-
var require_parse_proxy_response = __commonJS({
|
|
1282
|
-
"../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/parse-proxy-response.js"(exports) {
|
|
1283
|
-
"use strict";
|
|
1284
|
-
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
1285
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1286
|
-
};
|
|
1287
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1288
|
-
exports.parseProxyResponse = void 0;
|
|
1289
|
-
var debug_1 = __importDefault(require_src());
|
|
1290
|
-
var debug = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
|
|
1291
|
-
function parseProxyResponse(socket) {
|
|
1292
|
-
return new Promise((resolve, reject) => {
|
|
1293
|
-
let buffersLength = 0;
|
|
1294
|
-
const buffers = [];
|
|
1295
|
-
function read() {
|
|
1296
|
-
const b = socket.read();
|
|
1297
|
-
if (b)
|
|
1298
|
-
ondata(b);
|
|
1299
|
-
else
|
|
1300
|
-
socket.once("readable", read);
|
|
1301
|
-
}
|
|
1302
|
-
function cleanup() {
|
|
1303
|
-
socket.removeListener("end", onend);
|
|
1304
|
-
socket.removeListener("error", onerror);
|
|
1305
|
-
socket.removeListener("readable", read);
|
|
1306
|
-
}
|
|
1307
|
-
function onend() {
|
|
1308
|
-
cleanup();
|
|
1309
|
-
debug("onend");
|
|
1310
|
-
reject(new Error("Proxy connection ended before receiving CONNECT response"));
|
|
1311
|
-
}
|
|
1312
|
-
function onerror(err) {
|
|
1313
|
-
cleanup();
|
|
1314
|
-
debug("onerror %o", err);
|
|
1315
|
-
reject(err);
|
|
1316
|
-
}
|
|
1317
|
-
function ondata(b) {
|
|
1318
|
-
buffers.push(b);
|
|
1319
|
-
buffersLength += b.length;
|
|
1320
|
-
const buffered = Buffer.concat(buffers, buffersLength);
|
|
1321
|
-
const endOfHeaders = buffered.indexOf("\r\n\r\n");
|
|
1322
|
-
if (endOfHeaders === -1) {
|
|
1323
|
-
debug("have not received end of HTTP headers yet...");
|
|
1324
|
-
read();
|
|
1325
|
-
return;
|
|
1326
|
-
}
|
|
1327
|
-
const headerParts = buffered.slice(0, endOfHeaders).toString("ascii").split("\r\n");
|
|
1328
|
-
const firstLine = headerParts.shift();
|
|
1329
|
-
if (!firstLine) {
|
|
1330
|
-
socket.destroy();
|
|
1331
|
-
return reject(new Error("No header received from proxy CONNECT response"));
|
|
1332
|
-
}
|
|
1333
|
-
const firstLineParts = firstLine.split(" ");
|
|
1334
|
-
const statusCode = +firstLineParts[1];
|
|
1335
|
-
const statusText = firstLineParts.slice(2).join(" ");
|
|
1336
|
-
const headers = {};
|
|
1337
|
-
for (const header of headerParts) {
|
|
1338
|
-
if (!header)
|
|
1339
|
-
continue;
|
|
1340
|
-
const firstColon = header.indexOf(":");
|
|
1341
|
-
if (firstColon === -1) {
|
|
1342
|
-
socket.destroy();
|
|
1343
|
-
return reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`));
|
|
1344
|
-
}
|
|
1345
|
-
const key = header.slice(0, firstColon).toLowerCase();
|
|
1346
|
-
const value = header.slice(firstColon + 1).trimStart();
|
|
1347
|
-
const current = headers[key];
|
|
1348
|
-
if (typeof current === "string") {
|
|
1349
|
-
headers[key] = [current, value];
|
|
1350
|
-
} else if (Array.isArray(current)) {
|
|
1351
|
-
current.push(value);
|
|
1352
|
-
} else {
|
|
1353
|
-
headers[key] = value;
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
debug("got proxy server response: %o %o", firstLine, headers);
|
|
1357
|
-
cleanup();
|
|
1358
|
-
resolve({
|
|
1359
|
-
connect: {
|
|
1360
|
-
statusCode,
|
|
1361
|
-
statusText,
|
|
1362
|
-
headers
|
|
1363
|
-
},
|
|
1364
|
-
buffered
|
|
1365
|
-
});
|
|
1366
|
-
}
|
|
1367
|
-
socket.on("error", onerror);
|
|
1368
|
-
socket.on("end", onend);
|
|
1369
|
-
read();
|
|
1370
|
-
});
|
|
1371
|
-
}
|
|
1372
|
-
exports.parseProxyResponse = parseProxyResponse;
|
|
520
|
+
if (input.length === 0) {
|
|
521
|
+
return "";
|
|
1373
522
|
}
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
"use strict";
|
|
1380
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
1381
|
-
if (k2 === void 0) k2 = k;
|
|
1382
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1383
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1384
|
-
desc = { enumerable: true, get: function() {
|
|
1385
|
-
return m[k];
|
|
1386
|
-
} };
|
|
1387
|
-
}
|
|
1388
|
-
Object.defineProperty(o, k2, desc);
|
|
1389
|
-
} : function(o, m, k, k2) {
|
|
1390
|
-
if (k2 === void 0) k2 = k;
|
|
1391
|
-
o[k2] = m[k];
|
|
1392
|
-
});
|
|
1393
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
|
|
1394
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
1395
|
-
} : function(o, v) {
|
|
1396
|
-
o["default"] = v;
|
|
1397
|
-
});
|
|
1398
|
-
var __importStar = exports && exports.__importStar || function(mod) {
|
|
1399
|
-
if (mod && mod.__esModule) return mod;
|
|
1400
|
-
var result = {};
|
|
1401
|
-
if (mod != null) {
|
|
1402
|
-
for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
1403
|
-
}
|
|
1404
|
-
__setModuleDefault(result, mod);
|
|
1405
|
-
return result;
|
|
1406
|
-
};
|
|
1407
|
-
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
1408
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1409
|
-
};
|
|
1410
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1411
|
-
exports.HttpsProxyAgent = void 0;
|
|
1412
|
-
var net = __importStar(__require("net"));
|
|
1413
|
-
var tls = __importStar(__require("tls"));
|
|
1414
|
-
var assert_1 = __importDefault(__require("assert"));
|
|
1415
|
-
var debug_1 = __importDefault(require_src());
|
|
1416
|
-
var agent_base_1 = require_dist();
|
|
1417
|
-
var url_1 = __require("url");
|
|
1418
|
-
var parse_proxy_response_1 = require_parse_proxy_response();
|
|
1419
|
-
var debug = (0, debug_1.default)("https-proxy-agent");
|
|
1420
|
-
var setServernameFromNonIpHost = (options) => {
|
|
1421
|
-
if (options.servername === void 0 && options.host && !net.isIP(options.host)) {
|
|
1422
|
-
return {
|
|
1423
|
-
...options,
|
|
1424
|
-
servername: options.host
|
|
1425
|
-
};
|
|
1426
|
-
}
|
|
1427
|
-
return options;
|
|
1428
|
-
};
|
|
1429
|
-
var HttpsProxyAgent2 = class extends agent_base_1.Agent {
|
|
1430
|
-
constructor(proxy, opts) {
|
|
1431
|
-
super(opts);
|
|
1432
|
-
this.options = { path: void 0 };
|
|
1433
|
-
this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy;
|
|
1434
|
-
this.proxyHeaders = opts?.headers ?? {};
|
|
1435
|
-
debug("Creating new HttpsProxyAgent instance: %o", this.proxy.href);
|
|
1436
|
-
const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, "");
|
|
1437
|
-
const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80;
|
|
1438
|
-
this.connectOpts = {
|
|
1439
|
-
// Attempt to negotiate http/1.1 for proxy servers that support http/2
|
|
1440
|
-
ALPNProtocols: ["http/1.1"],
|
|
1441
|
-
...opts ? omit(opts, "headers") : null,
|
|
1442
|
-
host,
|
|
1443
|
-
port
|
|
1444
|
-
};
|
|
1445
|
-
}
|
|
1446
|
-
/**
|
|
1447
|
-
* Called when the node-core HTTP client library is creating a
|
|
1448
|
-
* new HTTP request.
|
|
1449
|
-
*/
|
|
1450
|
-
async connect(req, opts) {
|
|
1451
|
-
const { proxy } = this;
|
|
1452
|
-
if (!opts.host) {
|
|
1453
|
-
throw new TypeError('No "host" provided');
|
|
1454
|
-
}
|
|
1455
|
-
let socket;
|
|
1456
|
-
if (proxy.protocol === "https:") {
|
|
1457
|
-
debug("Creating `tls.Socket`: %o", this.connectOpts);
|
|
1458
|
-
socket = tls.connect(setServernameFromNonIpHost(this.connectOpts));
|
|
1459
|
-
} else {
|
|
1460
|
-
debug("Creating `net.Socket`: %o", this.connectOpts);
|
|
1461
|
-
socket = net.connect(this.connectOpts);
|
|
1462
|
-
}
|
|
1463
|
-
const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders };
|
|
1464
|
-
const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
|
|
1465
|
-
let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r
|
|
1466
|
-
`;
|
|
1467
|
-
if (proxy.username || proxy.password) {
|
|
1468
|
-
const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;
|
|
1469
|
-
headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`;
|
|
1470
|
-
}
|
|
1471
|
-
headers.Host = `${host}:${opts.port}`;
|
|
1472
|
-
if (!headers["Proxy-Connection"]) {
|
|
1473
|
-
headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close";
|
|
1474
|
-
}
|
|
1475
|
-
for (const name of Object.keys(headers)) {
|
|
1476
|
-
payload += `${name}: ${headers[name]}\r
|
|
1477
|
-
`;
|
|
1478
|
-
}
|
|
1479
|
-
const proxyResponsePromise = (0, parse_proxy_response_1.parseProxyResponse)(socket);
|
|
1480
|
-
socket.write(`${payload}\r
|
|
1481
|
-
`);
|
|
1482
|
-
const { connect, buffered } = await proxyResponsePromise;
|
|
1483
|
-
req.emit("proxyConnect", connect);
|
|
1484
|
-
this.emit("proxyConnect", connect, req);
|
|
1485
|
-
if (connect.statusCode === 200) {
|
|
1486
|
-
req.once("socket", resume);
|
|
1487
|
-
if (opts.secureEndpoint) {
|
|
1488
|
-
debug("Upgrading socket connection to TLS");
|
|
1489
|
-
return tls.connect({
|
|
1490
|
-
...omit(setServernameFromNonIpHost(opts), "host", "path", "port"),
|
|
1491
|
-
socket
|
|
1492
|
-
});
|
|
1493
|
-
}
|
|
1494
|
-
return socket;
|
|
1495
|
-
}
|
|
1496
|
-
socket.destroy();
|
|
1497
|
-
const fakeSocket = new net.Socket({ writable: false });
|
|
1498
|
-
fakeSocket.readable = true;
|
|
1499
|
-
req.once("socket", (s) => {
|
|
1500
|
-
debug("Replaying proxy buffer for failed request");
|
|
1501
|
-
(0, assert_1.default)(s.listenerCount("data") > 0);
|
|
1502
|
-
s.push(buffered);
|
|
1503
|
-
s.push(null);
|
|
1504
|
-
});
|
|
1505
|
-
return fakeSocket;
|
|
1506
|
-
}
|
|
1507
|
-
};
|
|
1508
|
-
HttpsProxyAgent2.protocols = ["http", "https"];
|
|
1509
|
-
exports.HttpsProxyAgent = HttpsProxyAgent2;
|
|
1510
|
-
function resume(socket) {
|
|
1511
|
-
socket.resume();
|
|
1512
|
-
}
|
|
1513
|
-
function omit(obj, ...keys) {
|
|
1514
|
-
const ret = {};
|
|
1515
|
-
let key;
|
|
1516
|
-
for (key in obj) {
|
|
1517
|
-
if (!keys.includes(key)) {
|
|
1518
|
-
ret[key] = obj[key];
|
|
1519
|
-
}
|
|
1520
|
-
}
|
|
1521
|
-
return ret;
|
|
523
|
+
const toLowerCase = options.locale === false ? (string) => string.toLowerCase() : (string) => string.toLocaleLowerCase(options.locale);
|
|
524
|
+
const toUpperCase = options.locale === false ? (string) => string.toUpperCase() : (string) => string.toLocaleUpperCase(options.locale);
|
|
525
|
+
if (input.length === 1) {
|
|
526
|
+
if (SEPARATORS.test(input)) {
|
|
527
|
+
return "";
|
|
1522
528
|
}
|
|
529
|
+
return options.pascalCase ? toUpperCase(input) : toLowerCase(input);
|
|
1523
530
|
}
|
|
1524
|
-
|
|
531
|
+
const hasUpperCase = input !== toLowerCase(input);
|
|
532
|
+
if (hasUpperCase) {
|
|
533
|
+
input = preserveCamelCase(input, toLowerCase, toUpperCase, options.preserveConsecutiveUppercase);
|
|
534
|
+
}
|
|
535
|
+
input = input.replace(LEADING_SEPARATORS, "");
|
|
536
|
+
input = options.preserveConsecutiveUppercase ? preserveConsecutiveUppercase(input, toLowerCase) : toLowerCase(input);
|
|
537
|
+
if (options.pascalCase) {
|
|
538
|
+
input = toUpperCase(input.charAt(0)) + input.slice(1);
|
|
539
|
+
}
|
|
540
|
+
return postProcess(input, toUpperCase);
|
|
541
|
+
}
|
|
1525
542
|
|
|
1526
|
-
//
|
|
1527
|
-
|
|
1528
|
-
import utils from "@eventcatalog/sdk";
|
|
1529
|
-
import { readFile } from "fs/promises";
|
|
1530
|
-
import argv from "minimist";
|
|
1531
|
-
import yaml from "js-yaml";
|
|
1532
|
-
import { z } from "zod";
|
|
1533
|
-
import chalk3 from "chalk";
|
|
1534
|
-
import path2 from "path";
|
|
543
|
+
// ../../node_modules/.pnpm/boxen@8.0.1/node_modules/boxen/index.js
|
|
544
|
+
var import_ansi_align = __toESM(require_ansi_align(), 1);
|
|
1535
545
|
|
|
1536
|
-
//
|
|
1537
|
-
var
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
author: "",
|
|
1554
|
-
license: "ISC",
|
|
1555
|
-
devDependencies: {
|
|
1556
|
-
"@changesets/cli": "^2.27.9",
|
|
1557
|
-
"@types/fs-extra": "^11.0.4",
|
|
1558
|
-
"@types/js-yaml": "^4.0.9",
|
|
1559
|
-
"@types/lodash": "^4.17.7",
|
|
1560
|
-
"@types/minimist": "^1.2.5",
|
|
1561
|
-
"@types/node": "^20.16.1",
|
|
1562
|
-
prettier: "^3.3.3",
|
|
1563
|
-
tsup: "^8.1.0",
|
|
1564
|
-
typescript: "^5.5.3",
|
|
1565
|
-
vitest: "^2.0.2"
|
|
1566
|
-
},
|
|
1567
|
-
files: [
|
|
1568
|
-
"dist",
|
|
1569
|
-
"package.json"
|
|
1570
|
-
],
|
|
1571
|
-
main: "./dist/index.js",
|
|
1572
|
-
module: "./dist/index.mjs",
|
|
1573
|
-
types: "./dist/index.d.ts",
|
|
1574
|
-
dependencies: {
|
|
1575
|
-
"@asyncapi/avro-schema-parser": "^3.0.24",
|
|
1576
|
-
"@asyncapi/parser": "^3.3.0",
|
|
1577
|
-
"@eventcatalog/sdk": "^2.6.9",
|
|
1578
|
-
chalk: "^4",
|
|
1579
|
-
"fs-extra": "^11.2.0",
|
|
1580
|
-
glob: "^11.0.0",
|
|
1581
|
-
"gray-matter": "^4.0.3",
|
|
1582
|
-
"js-yaml": "^4.1.0",
|
|
1583
|
-
lodash: "^4.17.21",
|
|
1584
|
-
minimist: "^1.2.8",
|
|
1585
|
-
"node-fetch": "^3.3.2",
|
|
1586
|
-
slugify: "^1.6.6",
|
|
1587
|
-
"update-notifier": "^7.3.1",
|
|
1588
|
-
zod: "^3.23.8"
|
|
1589
|
-
}
|
|
1590
|
-
};
|
|
1591
|
-
|
|
1592
|
-
// ../../node_modules/.pnpm/boxen@8.0.1/node_modules/boxen/index.js
|
|
1593
|
-
import process2 from "process";
|
|
1594
|
-
|
|
1595
|
-
// ../../node_modules/.pnpm/ansi-regex@6.1.0/node_modules/ansi-regex/index.js
|
|
1596
|
-
function ansiRegex({ onlyFirst = false } = {}) {
|
|
1597
|
-
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
1598
|
-
const pattern = [
|
|
1599
|
-
`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
|
|
1600
|
-
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
|
|
1601
|
-
].join("|");
|
|
1602
|
-
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
1603
|
-
}
|
|
1604
|
-
|
|
1605
|
-
// ../../node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js
|
|
1606
|
-
var regex = ansiRegex();
|
|
1607
|
-
function stripAnsi(string) {
|
|
1608
|
-
if (typeof string !== "string") {
|
|
1609
|
-
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
1610
|
-
}
|
|
1611
|
-
return string.replace(regex, "");
|
|
1612
|
-
}
|
|
1613
|
-
|
|
1614
|
-
// ../../node_modules/.pnpm/get-east-asian-width@1.3.0/node_modules/get-east-asian-width/lookup.js
|
|
1615
|
-
function isAmbiguous(x) {
|
|
1616
|
-
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;
|
|
1617
|
-
}
|
|
1618
|
-
function isFullWidth(x) {
|
|
1619
|
-
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
1620
|
-
}
|
|
1621
|
-
function isWide(x) {
|
|
1622
|
-
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 >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || 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 <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && 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 >= 101631 && 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 >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || 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 <= 129673 || x >= 129679 && x <= 129734 || x >= 129742 && x <= 129756 || x >= 129759 && x <= 129769 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
1623
|
-
}
|
|
1624
|
-
|
|
1625
|
-
// ../../node_modules/.pnpm/get-east-asian-width@1.3.0/node_modules/get-east-asian-width/index.js
|
|
1626
|
-
function validate(codePoint) {
|
|
1627
|
-
if (!Number.isSafeInteger(codePoint)) {
|
|
1628
|
-
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
1629
|
-
}
|
|
1630
|
-
}
|
|
1631
|
-
function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
1632
|
-
validate(codePoint);
|
|
1633
|
-
if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
|
|
1634
|
-
return 2;
|
|
1635
|
-
}
|
|
1636
|
-
return 1;
|
|
1637
|
-
}
|
|
1638
|
-
|
|
1639
|
-
// ../../node_modules/.pnpm/emoji-regex@10.4.0/node_modules/emoji-regex/index.mjs
|
|
1640
|
-
var emoji_regex_default = () => {
|
|
1641
|
-
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
1642
|
-
};
|
|
1643
|
-
|
|
1644
|
-
// ../../node_modules/.pnpm/string-width@7.2.0/node_modules/string-width/index.js
|
|
1645
|
-
var segmenter = new Intl.Segmenter();
|
|
1646
|
-
var defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
1647
|
-
function stringWidth(string, options = {}) {
|
|
1648
|
-
if (typeof string !== "string" || string.length === 0) {
|
|
1649
|
-
return 0;
|
|
1650
|
-
}
|
|
1651
|
-
const {
|
|
1652
|
-
ambiguousIsNarrow = true,
|
|
1653
|
-
countAnsiEscapeCodes = false
|
|
1654
|
-
} = options;
|
|
1655
|
-
if (!countAnsiEscapeCodes) {
|
|
1656
|
-
string = stripAnsi(string);
|
|
1657
|
-
}
|
|
1658
|
-
if (string.length === 0) {
|
|
1659
|
-
return 0;
|
|
1660
|
-
}
|
|
1661
|
-
let width = 0;
|
|
1662
|
-
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
1663
|
-
for (const { segment: character } of segmenter.segment(string)) {
|
|
1664
|
-
const codePoint = character.codePointAt(0);
|
|
1665
|
-
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
|
1666
|
-
continue;
|
|
1667
|
-
}
|
|
1668
|
-
if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
|
|
1669
|
-
continue;
|
|
1670
|
-
}
|
|
1671
|
-
if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
|
|
1672
|
-
continue;
|
|
1673
|
-
}
|
|
1674
|
-
if (codePoint >= 55296 && codePoint <= 57343) {
|
|
1675
|
-
continue;
|
|
1676
|
-
}
|
|
1677
|
-
if (codePoint >= 65024 && codePoint <= 65039) {
|
|
1678
|
-
continue;
|
|
1679
|
-
}
|
|
1680
|
-
if (defaultIgnorableCodePointRegex.test(character)) {
|
|
1681
|
-
continue;
|
|
1682
|
-
}
|
|
1683
|
-
if (emoji_regex_default().test(character)) {
|
|
1684
|
-
width += 2;
|
|
1685
|
-
continue;
|
|
1686
|
-
}
|
|
1687
|
-
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
1688
|
-
}
|
|
1689
|
-
return width;
|
|
1690
|
-
}
|
|
1691
|
-
|
|
1692
|
-
// ../../node_modules/.pnpm/boxen@8.0.1/node_modules/boxen/index.js
|
|
1693
|
-
import chalk from "chalk";
|
|
1694
|
-
|
|
1695
|
-
// ../../node_modules/.pnpm/widest-line@5.0.0/node_modules/widest-line/index.js
|
|
1696
|
-
function widestLine(string) {
|
|
1697
|
-
let lineWidth = 0;
|
|
1698
|
-
for (const line of string.split("\n")) {
|
|
1699
|
-
lineWidth = Math.max(lineWidth, stringWidth(line));
|
|
1700
|
-
}
|
|
1701
|
-
return lineWidth;
|
|
1702
|
-
}
|
|
1703
|
-
|
|
1704
|
-
// ../../node_modules/.pnpm/boxen@8.0.1/node_modules/boxen/index.js
|
|
1705
|
-
var import_cli_boxes = __toESM(require_cli_boxes(), 1);
|
|
1706
|
-
|
|
1707
|
-
// ../../node_modules/.pnpm/camelcase@8.0.0/node_modules/camelcase/index.js
|
|
1708
|
-
var UPPERCASE = /[\p{Lu}]/u;
|
|
1709
|
-
var LOWERCASE = /[\p{Ll}]/u;
|
|
1710
|
-
var LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu;
|
|
1711
|
-
var IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
|
|
1712
|
-
var SEPARATORS = /[_.\- ]+/;
|
|
1713
|
-
var LEADING_SEPARATORS = new RegExp("^" + SEPARATORS.source);
|
|
1714
|
-
var SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, "gu");
|
|
1715
|
-
var NUMBERS_AND_IDENTIFIER = new RegExp("\\d+" + IDENTIFIER.source, "gu");
|
|
1716
|
-
var preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUppercase2) => {
|
|
1717
|
-
let isLastCharLower = false;
|
|
1718
|
-
let isLastCharUpper = false;
|
|
1719
|
-
let isLastLastCharUpper = false;
|
|
1720
|
-
let isLastLastCharPreserved = false;
|
|
1721
|
-
for (let index = 0; index < string.length; index++) {
|
|
1722
|
-
const character = string[index];
|
|
1723
|
-
isLastLastCharPreserved = index > 2 ? string[index - 3] === "-" : true;
|
|
1724
|
-
if (isLastCharLower && UPPERCASE.test(character)) {
|
|
1725
|
-
string = string.slice(0, index) + "-" + string.slice(index);
|
|
1726
|
-
isLastCharLower = false;
|
|
1727
|
-
isLastLastCharUpper = isLastCharUpper;
|
|
1728
|
-
isLastCharUpper = true;
|
|
1729
|
-
index++;
|
|
1730
|
-
} else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character) && (!isLastLastCharPreserved || preserveConsecutiveUppercase2)) {
|
|
1731
|
-
string = string.slice(0, index - 1) + "-" + string.slice(index - 1);
|
|
1732
|
-
isLastLastCharUpper = isLastCharUpper;
|
|
1733
|
-
isLastCharUpper = false;
|
|
1734
|
-
isLastCharLower = true;
|
|
1735
|
-
} else {
|
|
1736
|
-
isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;
|
|
1737
|
-
isLastLastCharUpper = isLastCharUpper;
|
|
1738
|
-
isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;
|
|
1739
|
-
}
|
|
1740
|
-
}
|
|
1741
|
-
return string;
|
|
1742
|
-
};
|
|
1743
|
-
var preserveConsecutiveUppercase = (input, toLowerCase) => {
|
|
1744
|
-
LEADING_CAPITAL.lastIndex = 0;
|
|
1745
|
-
return input.replaceAll(LEADING_CAPITAL, (match) => toLowerCase(match));
|
|
1746
|
-
};
|
|
1747
|
-
var postProcess = (input, toUpperCase) => {
|
|
1748
|
-
SEPARATORS_AND_IDENTIFIER.lastIndex = 0;
|
|
1749
|
-
NUMBERS_AND_IDENTIFIER.lastIndex = 0;
|
|
1750
|
-
return input.replaceAll(NUMBERS_AND_IDENTIFIER, (match, pattern, offset) => ["_", "-"].includes(input.charAt(offset + match.length)) ? match : toUpperCase(match)).replaceAll(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier));
|
|
1751
|
-
};
|
|
1752
|
-
function camelCase(input, options) {
|
|
1753
|
-
if (!(typeof input === "string" || Array.isArray(input))) {
|
|
1754
|
-
throw new TypeError("Expected the input to be `string | string[]`");
|
|
1755
|
-
}
|
|
1756
|
-
options = {
|
|
1757
|
-
pascalCase: false,
|
|
1758
|
-
preserveConsecutiveUppercase: false,
|
|
1759
|
-
...options
|
|
1760
|
-
};
|
|
1761
|
-
if (Array.isArray(input)) {
|
|
1762
|
-
input = input.map((x) => x.trim()).filter((x) => x.length).join("-");
|
|
1763
|
-
} else {
|
|
1764
|
-
input = input.trim();
|
|
1765
|
-
}
|
|
1766
|
-
if (input.length === 0) {
|
|
1767
|
-
return "";
|
|
1768
|
-
}
|
|
1769
|
-
const toLowerCase = options.locale === false ? (string) => string.toLowerCase() : (string) => string.toLocaleLowerCase(options.locale);
|
|
1770
|
-
const toUpperCase = options.locale === false ? (string) => string.toUpperCase() : (string) => string.toLocaleUpperCase(options.locale);
|
|
1771
|
-
if (input.length === 1) {
|
|
1772
|
-
if (SEPARATORS.test(input)) {
|
|
1773
|
-
return "";
|
|
1774
|
-
}
|
|
1775
|
-
return options.pascalCase ? toUpperCase(input) : toLowerCase(input);
|
|
1776
|
-
}
|
|
1777
|
-
const hasUpperCase = input !== toLowerCase(input);
|
|
1778
|
-
if (hasUpperCase) {
|
|
1779
|
-
input = preserveCamelCase(input, toLowerCase, toUpperCase, options.preserveConsecutiveUppercase);
|
|
1780
|
-
}
|
|
1781
|
-
input = input.replace(LEADING_SEPARATORS, "");
|
|
1782
|
-
input = options.preserveConsecutiveUppercase ? preserveConsecutiveUppercase(input, toLowerCase) : toLowerCase(input);
|
|
1783
|
-
if (options.pascalCase) {
|
|
1784
|
-
input = toUpperCase(input.charAt(0)) + input.slice(1);
|
|
1785
|
-
}
|
|
1786
|
-
return postProcess(input, toUpperCase);
|
|
1787
|
-
}
|
|
1788
|
-
|
|
1789
|
-
// ../../node_modules/.pnpm/boxen@8.0.1/node_modules/boxen/index.js
|
|
1790
|
-
var import_ansi_align = __toESM(require_ansi_align(), 1);
|
|
1791
|
-
|
|
1792
|
-
// ../../node_modules/.pnpm/ansi-styles@6.2.1/node_modules/ansi-styles/index.js
|
|
1793
|
-
var ANSI_BACKGROUND_OFFSET = 10;
|
|
1794
|
-
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
1795
|
-
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
1796
|
-
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
1797
|
-
var styles = {
|
|
1798
|
-
modifier: {
|
|
1799
|
-
reset: [0, 0],
|
|
1800
|
-
// 21 isn't widely supported and 22 does the same thing
|
|
1801
|
-
bold: [1, 22],
|
|
1802
|
-
dim: [2, 22],
|
|
1803
|
-
italic: [3, 23],
|
|
1804
|
-
underline: [4, 24],
|
|
1805
|
-
overline: [53, 55],
|
|
1806
|
-
inverse: [7, 27],
|
|
1807
|
-
hidden: [8, 28],
|
|
1808
|
-
strikethrough: [9, 29]
|
|
546
|
+
// ../../node_modules/.pnpm/ansi-styles@6.2.1/node_modules/ansi-styles/index.js
|
|
547
|
+
var ANSI_BACKGROUND_OFFSET = 10;
|
|
548
|
+
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
549
|
+
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
550
|
+
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
551
|
+
var styles = {
|
|
552
|
+
modifier: {
|
|
553
|
+
reset: [0, 0],
|
|
554
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
555
|
+
bold: [1, 22],
|
|
556
|
+
dim: [2, 22],
|
|
557
|
+
italic: [3, 23],
|
|
558
|
+
underline: [4, 24],
|
|
559
|
+
overline: [53, 55],
|
|
560
|
+
inverse: [7, 27],
|
|
561
|
+
hidden: [8, 28],
|
|
562
|
+
strikethrough: [9, 29]
|
|
1809
563
|
},
|
|
1810
564
|
color: {
|
|
1811
565
|
black: [30, 39],
|
|
@@ -2042,606 +796,1910 @@ var stringVisibleTrimSpacesRight = (string) => {
|
|
|
2042
796
|
}
|
|
2043
797
|
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
2044
798
|
};
|
|
2045
|
-
var exec = (string, columns, options = {}) => {
|
|
2046
|
-
if (options.trim !== false && string.trim() === "") {
|
|
2047
|
-
return "";
|
|
2048
|
-
}
|
|
2049
|
-
let returnValue = "";
|
|
2050
|
-
let escapeCode;
|
|
2051
|
-
let escapeUrl;
|
|
2052
|
-
const lengths = wordLengths(string);
|
|
2053
|
-
let rows = [""];
|
|
2054
|
-
for (const [index, word] of string.split(" ").entries()) {
|
|
2055
|
-
if (options.trim !== false) {
|
|
2056
|
-
rows[rows.length - 1] = rows.at(-1).trimStart();
|
|
2057
|
-
}
|
|
2058
|
-
let rowLength = stringWidth(rows.at(-1));
|
|
2059
|
-
if (index !== 0) {
|
|
2060
|
-
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
2061
|
-
rows.push("");
|
|
2062
|
-
rowLength = 0;
|
|
2063
|
-
}
|
|
2064
|
-
if (rowLength > 0 || options.trim === false) {
|
|
2065
|
-
rows[rows.length - 1] += " ";
|
|
2066
|
-
rowLength++;
|
|
2067
|
-
}
|
|
2068
|
-
}
|
|
2069
|
-
if (options.hard && lengths[index] > columns) {
|
|
2070
|
-
const remainingColumns = columns - rowLength;
|
|
2071
|
-
const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
|
|
2072
|
-
const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);
|
|
2073
|
-
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
2074
|
-
rows.push("");
|
|
2075
|
-
}
|
|
2076
|
-
wrapWord(rows, word, columns);
|
|
2077
|
-
continue;
|
|
2078
|
-
}
|
|
2079
|
-
if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
|
|
2080
|
-
if (options.wordWrap === false && rowLength < columns) {
|
|
2081
|
-
wrapWord(rows, word, columns);
|
|
2082
|
-
continue;
|
|
799
|
+
var exec = (string, columns, options = {}) => {
|
|
800
|
+
if (options.trim !== false && string.trim() === "") {
|
|
801
|
+
return "";
|
|
802
|
+
}
|
|
803
|
+
let returnValue = "";
|
|
804
|
+
let escapeCode;
|
|
805
|
+
let escapeUrl;
|
|
806
|
+
const lengths = wordLengths(string);
|
|
807
|
+
let rows = [""];
|
|
808
|
+
for (const [index, word] of string.split(" ").entries()) {
|
|
809
|
+
if (options.trim !== false) {
|
|
810
|
+
rows[rows.length - 1] = rows.at(-1).trimStart();
|
|
811
|
+
}
|
|
812
|
+
let rowLength = stringWidth(rows.at(-1));
|
|
813
|
+
if (index !== 0) {
|
|
814
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
815
|
+
rows.push("");
|
|
816
|
+
rowLength = 0;
|
|
817
|
+
}
|
|
818
|
+
if (rowLength > 0 || options.trim === false) {
|
|
819
|
+
rows[rows.length - 1] += " ";
|
|
820
|
+
rowLength++;
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
if (options.hard && lengths[index] > columns) {
|
|
824
|
+
const remainingColumns = columns - rowLength;
|
|
825
|
+
const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
|
|
826
|
+
const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);
|
|
827
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
828
|
+
rows.push("");
|
|
829
|
+
}
|
|
830
|
+
wrapWord(rows, word, columns);
|
|
831
|
+
continue;
|
|
832
|
+
}
|
|
833
|
+
if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
|
|
834
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
835
|
+
wrapWord(rows, word, columns);
|
|
836
|
+
continue;
|
|
837
|
+
}
|
|
838
|
+
rows.push("");
|
|
839
|
+
}
|
|
840
|
+
if (rowLength + lengths[index] > columns && options.wordWrap === false) {
|
|
841
|
+
wrapWord(rows, word, columns);
|
|
842
|
+
continue;
|
|
843
|
+
}
|
|
844
|
+
rows[rows.length - 1] += word;
|
|
845
|
+
}
|
|
846
|
+
if (options.trim !== false) {
|
|
847
|
+
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
848
|
+
}
|
|
849
|
+
const preString = rows.join("\n");
|
|
850
|
+
const pre = [...preString];
|
|
851
|
+
let preStringIndex = 0;
|
|
852
|
+
for (const [index, character] of pre.entries()) {
|
|
853
|
+
returnValue += character;
|
|
854
|
+
if (ESCAPES.has(character)) {
|
|
855
|
+
const { groups } = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(preString.slice(preStringIndex)) || { groups: {} };
|
|
856
|
+
if (groups.code !== void 0) {
|
|
857
|
+
const code2 = Number.parseFloat(groups.code);
|
|
858
|
+
escapeCode = code2 === END_CODE ? void 0 : code2;
|
|
859
|
+
} else if (groups.uri !== void 0) {
|
|
860
|
+
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
const code = ansi_styles_default.codes.get(Number(escapeCode));
|
|
864
|
+
if (pre[index + 1] === "\n") {
|
|
865
|
+
if (escapeUrl) {
|
|
866
|
+
returnValue += wrapAnsiHyperlink("");
|
|
867
|
+
}
|
|
868
|
+
if (escapeCode && code) {
|
|
869
|
+
returnValue += wrapAnsiCode(code);
|
|
870
|
+
}
|
|
871
|
+
} else if (character === "\n") {
|
|
872
|
+
if (escapeCode && code) {
|
|
873
|
+
returnValue += wrapAnsiCode(escapeCode);
|
|
874
|
+
}
|
|
875
|
+
if (escapeUrl) {
|
|
876
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
preStringIndex += character.length;
|
|
880
|
+
}
|
|
881
|
+
return returnValue;
|
|
882
|
+
};
|
|
883
|
+
function wrapAnsi(string, columns, options) {
|
|
884
|
+
return String(string).normalize().replaceAll("\r\n", "\n").split("\n").map((line) => exec(line, columns, options)).join("\n");
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
// ../../node_modules/.pnpm/boxen@8.0.1/node_modules/boxen/index.js
|
|
888
|
+
var import_cli_boxes2 = __toESM(require_cli_boxes(), 1);
|
|
889
|
+
var NEWLINE = "\n";
|
|
890
|
+
var PAD = " ";
|
|
891
|
+
var NONE = "none";
|
|
892
|
+
var terminalColumns = () => {
|
|
893
|
+
const { env, stdout, stderr } = process2;
|
|
894
|
+
if (stdout?.columns) {
|
|
895
|
+
return stdout.columns;
|
|
896
|
+
}
|
|
897
|
+
if (stderr?.columns) {
|
|
898
|
+
return stderr.columns;
|
|
899
|
+
}
|
|
900
|
+
if (env.COLUMNS) {
|
|
901
|
+
return Number.parseInt(env.COLUMNS, 10);
|
|
902
|
+
}
|
|
903
|
+
return 80;
|
|
904
|
+
};
|
|
905
|
+
var getObject = (detail) => typeof detail === "number" ? {
|
|
906
|
+
top: detail,
|
|
907
|
+
right: detail * 3,
|
|
908
|
+
bottom: detail,
|
|
909
|
+
left: detail * 3
|
|
910
|
+
} : {
|
|
911
|
+
top: 0,
|
|
912
|
+
right: 0,
|
|
913
|
+
bottom: 0,
|
|
914
|
+
left: 0,
|
|
915
|
+
...detail
|
|
916
|
+
};
|
|
917
|
+
var getBorderWidth = (borderStyle) => borderStyle === NONE ? 0 : 2;
|
|
918
|
+
var getBorderChars = (borderStyle) => {
|
|
919
|
+
const sides = [
|
|
920
|
+
"topLeft",
|
|
921
|
+
"topRight",
|
|
922
|
+
"bottomRight",
|
|
923
|
+
"bottomLeft",
|
|
924
|
+
"left",
|
|
925
|
+
"right",
|
|
926
|
+
"top",
|
|
927
|
+
"bottom"
|
|
928
|
+
];
|
|
929
|
+
let characters;
|
|
930
|
+
if (borderStyle === NONE) {
|
|
931
|
+
borderStyle = {};
|
|
932
|
+
for (const side of sides) {
|
|
933
|
+
borderStyle[side] = "";
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
if (typeof borderStyle === "string") {
|
|
937
|
+
characters = import_cli_boxes.default[borderStyle];
|
|
938
|
+
if (!characters) {
|
|
939
|
+
throw new TypeError(`Invalid border style: ${borderStyle}`);
|
|
940
|
+
}
|
|
941
|
+
} else {
|
|
942
|
+
if (typeof borderStyle?.vertical === "string") {
|
|
943
|
+
borderStyle.left = borderStyle.vertical;
|
|
944
|
+
borderStyle.right = borderStyle.vertical;
|
|
945
|
+
}
|
|
946
|
+
if (typeof borderStyle?.horizontal === "string") {
|
|
947
|
+
borderStyle.top = borderStyle.horizontal;
|
|
948
|
+
borderStyle.bottom = borderStyle.horizontal;
|
|
949
|
+
}
|
|
950
|
+
for (const side of sides) {
|
|
951
|
+
if (borderStyle[side] === null || typeof borderStyle[side] !== "string") {
|
|
952
|
+
throw new TypeError(`Invalid border style: ${side}`);
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
characters = borderStyle;
|
|
956
|
+
}
|
|
957
|
+
return characters;
|
|
958
|
+
};
|
|
959
|
+
var makeTitle = (text, horizontal, alignment) => {
|
|
960
|
+
let title = "";
|
|
961
|
+
const textWidth = stringWidth(text);
|
|
962
|
+
switch (alignment) {
|
|
963
|
+
case "left": {
|
|
964
|
+
title = text + horizontal.slice(textWidth);
|
|
965
|
+
break;
|
|
966
|
+
}
|
|
967
|
+
case "right": {
|
|
968
|
+
title = horizontal.slice(textWidth) + text;
|
|
969
|
+
break;
|
|
970
|
+
}
|
|
971
|
+
default: {
|
|
972
|
+
horizontal = horizontal.slice(textWidth);
|
|
973
|
+
if (horizontal.length % 2 === 1) {
|
|
974
|
+
horizontal = horizontal.slice(Math.floor(horizontal.length / 2));
|
|
975
|
+
title = horizontal.slice(1) + text + horizontal;
|
|
976
|
+
} else {
|
|
977
|
+
horizontal = horizontal.slice(horizontal.length / 2);
|
|
978
|
+
title = horizontal + text + horizontal;
|
|
979
|
+
}
|
|
980
|
+
break;
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
return title;
|
|
984
|
+
};
|
|
985
|
+
var makeContentText = (text, { padding, width, textAlignment, height }) => {
|
|
986
|
+
text = (0, import_ansi_align.default)(text, { align: textAlignment });
|
|
987
|
+
let lines = text.split(NEWLINE);
|
|
988
|
+
const textWidth = widestLine(text);
|
|
989
|
+
const max = width - padding.left - padding.right;
|
|
990
|
+
if (textWidth > max) {
|
|
991
|
+
const newLines = [];
|
|
992
|
+
for (const line of lines) {
|
|
993
|
+
const createdLines = wrapAnsi(line, max, { hard: true });
|
|
994
|
+
const alignedLines = (0, import_ansi_align.default)(createdLines, { align: textAlignment });
|
|
995
|
+
const alignedLinesArray = alignedLines.split("\n");
|
|
996
|
+
const longestLength = Math.max(...alignedLinesArray.map((s) => stringWidth(s)));
|
|
997
|
+
for (const alignedLine of alignedLinesArray) {
|
|
998
|
+
let paddedLine;
|
|
999
|
+
switch (textAlignment) {
|
|
1000
|
+
case "center": {
|
|
1001
|
+
paddedLine = PAD.repeat((max - longestLength) / 2) + alignedLine;
|
|
1002
|
+
break;
|
|
1003
|
+
}
|
|
1004
|
+
case "right": {
|
|
1005
|
+
paddedLine = PAD.repeat(max - longestLength) + alignedLine;
|
|
1006
|
+
break;
|
|
1007
|
+
}
|
|
1008
|
+
default: {
|
|
1009
|
+
paddedLine = alignedLine;
|
|
1010
|
+
break;
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
newLines.push(paddedLine);
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
lines = newLines;
|
|
1017
|
+
}
|
|
1018
|
+
if (textAlignment === "center" && textWidth < max) {
|
|
1019
|
+
lines = lines.map((line) => PAD.repeat((max - textWidth) / 2) + line);
|
|
1020
|
+
} else if (textAlignment === "right" && textWidth < max) {
|
|
1021
|
+
lines = lines.map((line) => PAD.repeat(max - textWidth) + line);
|
|
1022
|
+
}
|
|
1023
|
+
const paddingLeft = PAD.repeat(padding.left);
|
|
1024
|
+
const paddingRight = PAD.repeat(padding.right);
|
|
1025
|
+
lines = lines.map((line) => {
|
|
1026
|
+
const newLine = paddingLeft + line + paddingRight;
|
|
1027
|
+
return newLine + PAD.repeat(width - stringWidth(newLine));
|
|
1028
|
+
});
|
|
1029
|
+
if (padding.top > 0) {
|
|
1030
|
+
lines = [...Array.from({ length: padding.top }).fill(PAD.repeat(width)), ...lines];
|
|
1031
|
+
}
|
|
1032
|
+
if (padding.bottom > 0) {
|
|
1033
|
+
lines = [...lines, ...Array.from({ length: padding.bottom }).fill(PAD.repeat(width))];
|
|
1034
|
+
}
|
|
1035
|
+
if (height && lines.length > height) {
|
|
1036
|
+
lines = lines.slice(0, height);
|
|
1037
|
+
} else if (height && lines.length < height) {
|
|
1038
|
+
lines = [...lines, ...Array.from({ length: height - lines.length }).fill(PAD.repeat(width))];
|
|
1039
|
+
}
|
|
1040
|
+
return lines.join(NEWLINE);
|
|
1041
|
+
};
|
|
1042
|
+
var boxContent = (content, contentWidth, options) => {
|
|
1043
|
+
const colorizeBorder = (border) => {
|
|
1044
|
+
const newBorder = options.borderColor ? getColorFunction(options.borderColor)(border) : border;
|
|
1045
|
+
return options.dimBorder ? chalk.dim(newBorder) : newBorder;
|
|
1046
|
+
};
|
|
1047
|
+
const colorizeContent = (content2) => options.backgroundColor ? getBGColorFunction(options.backgroundColor)(content2) : content2;
|
|
1048
|
+
const chars = getBorderChars(options.borderStyle);
|
|
1049
|
+
const columns = terminalColumns();
|
|
1050
|
+
let marginLeft = PAD.repeat(options.margin.left);
|
|
1051
|
+
if (options.float === "center") {
|
|
1052
|
+
const marginWidth = Math.max((columns - contentWidth - getBorderWidth(options.borderStyle)) / 2, 0);
|
|
1053
|
+
marginLeft = PAD.repeat(marginWidth);
|
|
1054
|
+
} else if (options.float === "right") {
|
|
1055
|
+
const marginWidth = Math.max(columns - contentWidth - options.margin.right - getBorderWidth(options.borderStyle), 0);
|
|
1056
|
+
marginLeft = PAD.repeat(marginWidth);
|
|
1057
|
+
}
|
|
1058
|
+
let result = "";
|
|
1059
|
+
if (options.margin.top) {
|
|
1060
|
+
result += NEWLINE.repeat(options.margin.top);
|
|
1061
|
+
}
|
|
1062
|
+
if (options.borderStyle !== NONE || options.title) {
|
|
1063
|
+
result += colorizeBorder(marginLeft + chars.topLeft + (options.title ? makeTitle(options.title, chars.top.repeat(contentWidth), options.titleAlignment) : chars.top.repeat(contentWidth)) + chars.topRight) + NEWLINE;
|
|
1064
|
+
}
|
|
1065
|
+
const lines = content.split(NEWLINE);
|
|
1066
|
+
result += lines.map((line) => marginLeft + colorizeBorder(chars.left) + colorizeContent(line) + colorizeBorder(chars.right)).join(NEWLINE);
|
|
1067
|
+
if (options.borderStyle !== NONE) {
|
|
1068
|
+
result += NEWLINE + colorizeBorder(marginLeft + chars.bottomLeft + chars.bottom.repeat(contentWidth) + chars.bottomRight);
|
|
1069
|
+
}
|
|
1070
|
+
if (options.margin.bottom) {
|
|
1071
|
+
result += NEWLINE.repeat(options.margin.bottom);
|
|
1072
|
+
}
|
|
1073
|
+
return result;
|
|
1074
|
+
};
|
|
1075
|
+
var sanitizeOptions = (options) => {
|
|
1076
|
+
if (options.fullscreen && process2?.stdout) {
|
|
1077
|
+
let newDimensions = [process2.stdout.columns, process2.stdout.rows];
|
|
1078
|
+
if (typeof options.fullscreen === "function") {
|
|
1079
|
+
newDimensions = options.fullscreen(...newDimensions);
|
|
1080
|
+
}
|
|
1081
|
+
options.width || (options.width = newDimensions[0]);
|
|
1082
|
+
options.height || (options.height = newDimensions[1]);
|
|
1083
|
+
}
|
|
1084
|
+
options.width && (options.width = Math.max(1, options.width - getBorderWidth(options.borderStyle)));
|
|
1085
|
+
options.height && (options.height = Math.max(1, options.height - getBorderWidth(options.borderStyle)));
|
|
1086
|
+
return options;
|
|
1087
|
+
};
|
|
1088
|
+
var formatTitle = (title, borderStyle) => borderStyle === NONE ? title : ` ${title} `;
|
|
1089
|
+
var determineDimensions = (text, options) => {
|
|
1090
|
+
options = sanitizeOptions(options);
|
|
1091
|
+
const widthOverride = options.width !== void 0;
|
|
1092
|
+
const columns = terminalColumns();
|
|
1093
|
+
const borderWidth = getBorderWidth(options.borderStyle);
|
|
1094
|
+
const maxWidth = columns - options.margin.left - options.margin.right - borderWidth;
|
|
1095
|
+
const widest = widestLine(wrapAnsi(text, columns - borderWidth, { hard: true, trim: false })) + options.padding.left + options.padding.right;
|
|
1096
|
+
if (options.title && widthOverride) {
|
|
1097
|
+
options.title = options.title.slice(0, Math.max(0, options.width - 2));
|
|
1098
|
+
options.title && (options.title = formatTitle(options.title, options.borderStyle));
|
|
1099
|
+
} else if (options.title) {
|
|
1100
|
+
options.title = options.title.slice(0, Math.max(0, maxWidth - 2));
|
|
1101
|
+
if (options.title) {
|
|
1102
|
+
options.title = formatTitle(options.title, options.borderStyle);
|
|
1103
|
+
if (stringWidth(options.title) > widest) {
|
|
1104
|
+
options.width = stringWidth(options.title);
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
options.width || (options.width = widest);
|
|
1109
|
+
if (!widthOverride) {
|
|
1110
|
+
if (options.margin.left && options.margin.right && options.width > maxWidth) {
|
|
1111
|
+
const spaceForMargins = columns - options.width - borderWidth;
|
|
1112
|
+
const multiplier = spaceForMargins / (options.margin.left + options.margin.right);
|
|
1113
|
+
options.margin.left = Math.max(0, Math.floor(options.margin.left * multiplier));
|
|
1114
|
+
options.margin.right = Math.max(0, Math.floor(options.margin.right * multiplier));
|
|
1115
|
+
}
|
|
1116
|
+
options.width = Math.min(options.width, columns - borderWidth - options.margin.left - options.margin.right);
|
|
1117
|
+
}
|
|
1118
|
+
if (options.width - (options.padding.left + options.padding.right) <= 0) {
|
|
1119
|
+
options.padding.left = 0;
|
|
1120
|
+
options.padding.right = 0;
|
|
1121
|
+
}
|
|
1122
|
+
if (options.height && options.height - (options.padding.top + options.padding.bottom) <= 0) {
|
|
1123
|
+
options.padding.top = 0;
|
|
1124
|
+
options.padding.bottom = 0;
|
|
1125
|
+
}
|
|
1126
|
+
return options;
|
|
1127
|
+
};
|
|
1128
|
+
var isHex = (color) => color.match(/^#(?:[0-f]{3}){1,2}$/i);
|
|
1129
|
+
var isColorValid = (color) => typeof color === "string" && (chalk[color] ?? isHex(color));
|
|
1130
|
+
var getColorFunction = (color) => isHex(color) ? chalk.hex(color) : chalk[color];
|
|
1131
|
+
var getBGColorFunction = (color) => isHex(color) ? chalk.bgHex(color) : chalk[camelCase(["bg", color])];
|
|
1132
|
+
function boxen(text, options) {
|
|
1133
|
+
options = {
|
|
1134
|
+
padding: 0,
|
|
1135
|
+
borderStyle: "single",
|
|
1136
|
+
dimBorder: false,
|
|
1137
|
+
textAlignment: "left",
|
|
1138
|
+
float: "left",
|
|
1139
|
+
titleAlignment: "left",
|
|
1140
|
+
...options
|
|
1141
|
+
};
|
|
1142
|
+
if (options.align) {
|
|
1143
|
+
options.textAlignment = options.align;
|
|
1144
|
+
}
|
|
1145
|
+
if (options.borderColor && !isColorValid(options.borderColor)) {
|
|
1146
|
+
throw new Error(`${options.borderColor} is not a valid borderColor`);
|
|
1147
|
+
}
|
|
1148
|
+
if (options.backgroundColor && !isColorValid(options.backgroundColor)) {
|
|
1149
|
+
throw new Error(`${options.backgroundColor} is not a valid backgroundColor`);
|
|
1150
|
+
}
|
|
1151
|
+
options.padding = getObject(options.padding);
|
|
1152
|
+
options.margin = getObject(options.margin);
|
|
1153
|
+
options = determineDimensions(text, options);
|
|
1154
|
+
text = makeContentText(text, options);
|
|
1155
|
+
return boxContent(text, options.width, options);
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
// ../../shared/check-for-package-update.ts
|
|
1159
|
+
import fs from "fs";
|
|
1160
|
+
import path from "path";
|
|
1161
|
+
var getInstalledVersionOfPackage = (packageName) => {
|
|
1162
|
+
try {
|
|
1163
|
+
const PROJECT_DIR = process.env.PROJECT_DIR || process.cwd();
|
|
1164
|
+
const pkg = fs.readFileSync(path.join(PROJECT_DIR, "package.json"), "utf8");
|
|
1165
|
+
const json = JSON.parse(pkg);
|
|
1166
|
+
const version = json.dependencies[packageName];
|
|
1167
|
+
return version?.replace(/[\^~><=]/g, "");
|
|
1168
|
+
} catch (error) {
|
|
1169
|
+
return null;
|
|
1170
|
+
}
|
|
1171
|
+
};
|
|
1172
|
+
async function checkForPackageUpdate(packageName) {
|
|
1173
|
+
const installedVersion = getInstalledVersionOfPackage(packageName);
|
|
1174
|
+
if (!installedVersion || installedVersion === "latest") return;
|
|
1175
|
+
const pkg = { name: packageName, version: installedVersion };
|
|
1176
|
+
const updateNotifierModule = await import("update-notifier");
|
|
1177
|
+
const notifier = updateNotifierModule.default({ pkg, updateCheckInterval: 0, shouldNotifyInNpmScript: true });
|
|
1178
|
+
const info = await notifier.fetchInfo();
|
|
1179
|
+
if (info?.type !== "latest") {
|
|
1180
|
+
const message2 = `Package ${packageName} update available ${info.current} \u2192 ${info.latest}
|
|
1181
|
+
Run npm i ${packageName} to update`;
|
|
1182
|
+
console.log(
|
|
1183
|
+
boxen(message2, {
|
|
1184
|
+
padding: 1,
|
|
1185
|
+
margin: 1,
|
|
1186
|
+
align: "center",
|
|
1187
|
+
borderColor: "yellow",
|
|
1188
|
+
borderStyle: {
|
|
1189
|
+
topLeft: " ",
|
|
1190
|
+
topRight: " ",
|
|
1191
|
+
bottomLeft: " ",
|
|
1192
|
+
bottomRight: " ",
|
|
1193
|
+
right: " ",
|
|
1194
|
+
top: "-",
|
|
1195
|
+
bottom: "-",
|
|
1196
|
+
left: " "
|
|
1197
|
+
}
|
|
1198
|
+
})
|
|
1199
|
+
);
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
// src/index.ts
|
|
1204
|
+
import { AvroSchemaParser } from "@asyncapi/avro-schema-parser";
|
|
1205
|
+
|
|
1206
|
+
// src/utils/schemas.ts
|
|
1207
|
+
var getFileExtentionFromSchemaFormat = (format = "") => {
|
|
1208
|
+
if (format.includes("avro")) return "avsc";
|
|
1209
|
+
if (format.includes("yml")) return "yml";
|
|
1210
|
+
if (format.includes("json")) return "json";
|
|
1211
|
+
if (format.includes("openapi")) return "openapi";
|
|
1212
|
+
if (format.includes("protobuf")) return "protobuf";
|
|
1213
|
+
if (format.includes("yaml")) return "yaml";
|
|
1214
|
+
return "json";
|
|
1215
|
+
};
|
|
1216
|
+
|
|
1217
|
+
// src/utils/messages.ts
|
|
1218
|
+
var defaultMarkdown = (_document, message2) => {
|
|
1219
|
+
return `
|
|
1220
|
+
## Architecture
|
|
1221
|
+
<NodeGraph />
|
|
1222
|
+
|
|
1223
|
+
${messageHasSchema(message2) && messageIsJSON(message2) ? `
|
|
1224
|
+
## Schema
|
|
1225
|
+
<SchemaViewer file="${getSchemaFileName(message2)}" title="Message Schema" maxHeight="500" />
|
|
1226
|
+
` : ""}
|
|
1227
|
+
${messageHasSchema(message2) && !messageIsJSON(message2) ? `
|
|
1228
|
+
## Schema
|
|
1229
|
+
<Schema file="${getSchemaFileName(message2)}" title="Message Schema" maxHeight="500" />
|
|
1230
|
+
` : ""}
|
|
1231
|
+
|
|
1232
|
+
${message2.externalDocs() ? `
|
|
1233
|
+
## External documentation
|
|
1234
|
+
- [${message2.externalDocs()?.description()}](${message2.externalDocs()?.url()})
|
|
1235
|
+
` : ""}
|
|
1236
|
+
|
|
1237
|
+
`;
|
|
1238
|
+
};
|
|
1239
|
+
var getSummary = (message2) => {
|
|
1240
|
+
const messageSummary = message2.hasSummary() ? message2.summary() : "";
|
|
1241
|
+
const messageDescription = message2.hasDescription() ? message2.description() : "";
|
|
1242
|
+
let eventCatalogMessageSummary = messageSummary;
|
|
1243
|
+
if (!eventCatalogMessageSummary) {
|
|
1244
|
+
eventCatalogMessageSummary = messageDescription && messageDescription.length < 150 ? messageDescription : "";
|
|
1245
|
+
}
|
|
1246
|
+
return eventCatalogMessageSummary;
|
|
1247
|
+
};
|
|
1248
|
+
var messageHasSchema = (message2) => {
|
|
1249
|
+
return message2.hasPayload() && message2.schemaFormat();
|
|
1250
|
+
};
|
|
1251
|
+
var messageIsJSON = (message2) => {
|
|
1252
|
+
const fileName = getSchemaFileName(message2);
|
|
1253
|
+
return fileName.endsWith(".json");
|
|
1254
|
+
};
|
|
1255
|
+
var getSchemaFileName = (message2) => {
|
|
1256
|
+
const extension = getFileExtentionFromSchemaFormat(message2.schemaFormat());
|
|
1257
|
+
return `schema.${extension}`;
|
|
1258
|
+
};
|
|
1259
|
+
var getMessageName = (message2) => {
|
|
1260
|
+
return message2.hasTitle() && message2.title() ? message2.title() : message2.id();
|
|
1261
|
+
};
|
|
1262
|
+
var getChannelsForMessage = (message2, channels, document) => {
|
|
1263
|
+
let channelsForMessage = [];
|
|
1264
|
+
const globalVersion = document.info().version();
|
|
1265
|
+
for (const channel of channels) {
|
|
1266
|
+
for (const channelMessage of channel.messages()) {
|
|
1267
|
+
if (channelMessage.id() === message2.id()) {
|
|
1268
|
+
channelsForMessage.push(channel);
|
|
2083
1269
|
}
|
|
2084
|
-
rows.push("");
|
|
2085
|
-
}
|
|
2086
|
-
if (rowLength + lengths[index] > columns && options.wordWrap === false) {
|
|
2087
|
-
wrapWord(rows, word, columns);
|
|
2088
|
-
continue;
|
|
2089
1270
|
}
|
|
2090
|
-
rows[rows.length - 1] += word;
|
|
2091
1271
|
}
|
|
2092
|
-
|
|
2093
|
-
|
|
1272
|
+
for (const messageChannel of message2.channels()) {
|
|
1273
|
+
channelsForMessage.push(messageChannel);
|
|
2094
1274
|
}
|
|
2095
|
-
const
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
1275
|
+
const uniqueChannels = channelsForMessage.filter(
|
|
1276
|
+
(channel, index, self) => index === self.findIndex((t) => t.id() === channel.id())
|
|
1277
|
+
);
|
|
1278
|
+
return uniqueChannels.map((channel) => {
|
|
1279
|
+
const channelVersion = channel.extensions().get("x-eventcatalog-channel-version")?.value() || globalVersion;
|
|
1280
|
+
return {
|
|
1281
|
+
id: channel.id(),
|
|
1282
|
+
version: channelVersion
|
|
1283
|
+
};
|
|
1284
|
+
});
|
|
1285
|
+
};
|
|
1286
|
+
|
|
1287
|
+
// src/utils/services.ts
|
|
1288
|
+
var defaultMarkdown2 = (document) => {
|
|
1289
|
+
return `
|
|
1290
|
+
|
|
1291
|
+
${document.info().hasDescription() ? `${document.info().description()}` : ""}
|
|
1292
|
+
|
|
1293
|
+
## Architecture diagram
|
|
1294
|
+
<NodeGraph />
|
|
1295
|
+
|
|
1296
|
+
${document.info().externalDocs() ? `
|
|
1297
|
+
## External documentation
|
|
1298
|
+
- [${document.info().externalDocs()?.description()}](${document.info().externalDocs()?.url()})
|
|
1299
|
+
` : ""}
|
|
1300
|
+
`;
|
|
1301
|
+
};
|
|
1302
|
+
var getSummary2 = (document) => {
|
|
1303
|
+
const summary = document.info().hasDescription() ? document.info().description() : "";
|
|
1304
|
+
return summary && summary.length < 150 ? summary : "";
|
|
1305
|
+
};
|
|
1306
|
+
|
|
1307
|
+
// src/utils/domains.ts
|
|
1308
|
+
var defaultMarkdown3 = (document) => {
|
|
1309
|
+
return `
|
|
1310
|
+
|
|
1311
|
+
## Architecture diagram
|
|
1312
|
+
<NodeGraph />
|
|
1313
|
+
|
|
1314
|
+
`;
|
|
1315
|
+
};
|
|
1316
|
+
|
|
1317
|
+
// src/utils/channels.ts
|
|
1318
|
+
var getChannelProtocols = (channel) => {
|
|
1319
|
+
const protocols = [];
|
|
1320
|
+
const bindings = channel.bindings();
|
|
1321
|
+
for (const binding of bindings) {
|
|
1322
|
+
protocols.push(binding.protocol());
|
|
1323
|
+
}
|
|
1324
|
+
return protocols;
|
|
1325
|
+
};
|
|
1326
|
+
var getChannelTags = (channel) => {
|
|
1327
|
+
const tags = [];
|
|
1328
|
+
const jsonTags = channel.json()?.tags;
|
|
1329
|
+
if (Array.isArray(jsonTags)) {
|
|
1330
|
+
for (const tag2 of jsonTags) {
|
|
1331
|
+
if (tag2.name && !tags.includes(tag2.name)) {
|
|
1332
|
+
tags.push(tag2.name);
|
|
2123
1333
|
}
|
|
2124
1334
|
}
|
|
2125
|
-
preStringIndex += character.length;
|
|
2126
1335
|
}
|
|
2127
|
-
return
|
|
1336
|
+
return tags;
|
|
2128
1337
|
};
|
|
2129
|
-
|
|
2130
|
-
return
|
|
1338
|
+
var defaultMarkdown4 = (_document, channel) => {
|
|
1339
|
+
return `
|
|
1340
|
+
${channel.hasDescription() ? `
|
|
1341
|
+
## Overview
|
|
1342
|
+
${channel.description()}
|
|
1343
|
+
` : ""}
|
|
1344
|
+
|
|
1345
|
+
<ChannelInformation />
|
|
1346
|
+
|
|
1347
|
+
${channel.json()?.externalDocs ? `
|
|
1348
|
+
## External documentation
|
|
1349
|
+
- [${channel.json()?.externalDocs?.description}](${channel.json()?.externalDocs?.url})
|
|
1350
|
+
` : ""}
|
|
1351
|
+
|
|
1352
|
+
`;
|
|
1353
|
+
};
|
|
1354
|
+
|
|
1355
|
+
// ../../shared/checkLicense.ts
|
|
1356
|
+
import chalk3 from "chalk";
|
|
1357
|
+
|
|
1358
|
+
// ../../node_modules/.pnpm/@eventcatalog+license@0.0.5/node_modules/@eventcatalog/license/dist/verify.js
|
|
1359
|
+
import { readFileSync, existsSync } from "fs";
|
|
1360
|
+
|
|
1361
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/base64url.js
|
|
1362
|
+
import { Buffer as Buffer2 } from "buffer";
|
|
1363
|
+
|
|
1364
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/buffer_utils.js
|
|
1365
|
+
var encoder = new TextEncoder();
|
|
1366
|
+
var decoder = new TextDecoder();
|
|
1367
|
+
var MAX_INT32 = 2 ** 32;
|
|
1368
|
+
function concat(...buffers) {
|
|
1369
|
+
const size = buffers.reduce((acc, { length }) => acc + length, 0);
|
|
1370
|
+
const buf = new Uint8Array(size);
|
|
1371
|
+
let i = 0;
|
|
1372
|
+
for (const buffer of buffers) {
|
|
1373
|
+
buf.set(buffer, i);
|
|
1374
|
+
i += buffer.length;
|
|
1375
|
+
}
|
|
1376
|
+
return buf;
|
|
2131
1377
|
}
|
|
2132
1378
|
|
|
2133
|
-
// ../../node_modules/.pnpm/
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
var terminalColumns = () => {
|
|
2139
|
-
const { env, stdout, stderr } = process2;
|
|
2140
|
-
if (stdout?.columns) {
|
|
2141
|
-
return stdout.columns;
|
|
1379
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/base64url.js
|
|
1380
|
+
function normalize(input) {
|
|
1381
|
+
let encoded = input;
|
|
1382
|
+
if (encoded instanceof Uint8Array) {
|
|
1383
|
+
encoded = decoder.decode(encoded);
|
|
2142
1384
|
}
|
|
2143
|
-
|
|
2144
|
-
|
|
1385
|
+
return encoded;
|
|
1386
|
+
}
|
|
1387
|
+
var decode = (input) => new Uint8Array(Buffer2.from(normalize(input), "base64url"));
|
|
1388
|
+
|
|
1389
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/util/errors.js
|
|
1390
|
+
var JOSEError = class extends Error {
|
|
1391
|
+
constructor(message2, options) {
|
|
1392
|
+
super(message2, options);
|
|
1393
|
+
__publicField(this, "code", "ERR_JOSE_GENERIC");
|
|
1394
|
+
this.name = this.constructor.name;
|
|
1395
|
+
Error.captureStackTrace?.(this, this.constructor);
|
|
2145
1396
|
}
|
|
2146
|
-
|
|
2147
|
-
|
|
1397
|
+
};
|
|
1398
|
+
__publicField(JOSEError, "code", "ERR_JOSE_GENERIC");
|
|
1399
|
+
var JWTClaimValidationFailed = class extends JOSEError {
|
|
1400
|
+
constructor(message2, payload, claim = "unspecified", reason = "unspecified") {
|
|
1401
|
+
super(message2, { cause: { claim, reason, payload } });
|
|
1402
|
+
__publicField(this, "code", "ERR_JWT_CLAIM_VALIDATION_FAILED");
|
|
1403
|
+
__publicField(this, "claim");
|
|
1404
|
+
__publicField(this, "reason");
|
|
1405
|
+
__publicField(this, "payload");
|
|
1406
|
+
this.claim = claim;
|
|
1407
|
+
this.reason = reason;
|
|
1408
|
+
this.payload = payload;
|
|
2148
1409
|
}
|
|
2149
|
-
return 80;
|
|
2150
1410
|
};
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
1411
|
+
__publicField(JWTClaimValidationFailed, "code", "ERR_JWT_CLAIM_VALIDATION_FAILED");
|
|
1412
|
+
var JWTExpired = class extends JOSEError {
|
|
1413
|
+
constructor(message2, payload, claim = "unspecified", reason = "unspecified") {
|
|
1414
|
+
super(message2, { cause: { claim, reason, payload } });
|
|
1415
|
+
__publicField(this, "code", "ERR_JWT_EXPIRED");
|
|
1416
|
+
__publicField(this, "claim");
|
|
1417
|
+
__publicField(this, "reason");
|
|
1418
|
+
__publicField(this, "payload");
|
|
1419
|
+
this.claim = claim;
|
|
1420
|
+
this.reason = reason;
|
|
1421
|
+
this.payload = payload;
|
|
1422
|
+
}
|
|
2162
1423
|
};
|
|
2163
|
-
|
|
2164
|
-
var
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
"
|
|
2168
|
-
"bottomRight",
|
|
2169
|
-
"bottomLeft",
|
|
2170
|
-
"left",
|
|
2171
|
-
"right",
|
|
2172
|
-
"top",
|
|
2173
|
-
"bottom"
|
|
2174
|
-
];
|
|
2175
|
-
let characters;
|
|
2176
|
-
if (borderStyle === NONE) {
|
|
2177
|
-
borderStyle = {};
|
|
2178
|
-
for (const side of sides) {
|
|
2179
|
-
borderStyle[side] = "";
|
|
2180
|
-
}
|
|
1424
|
+
__publicField(JWTExpired, "code", "ERR_JWT_EXPIRED");
|
|
1425
|
+
var JOSEAlgNotAllowed = class extends JOSEError {
|
|
1426
|
+
constructor() {
|
|
1427
|
+
super(...arguments);
|
|
1428
|
+
__publicField(this, "code", "ERR_JOSE_ALG_NOT_ALLOWED");
|
|
2181
1429
|
}
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
if (typeof borderStyle?.vertical === "string") {
|
|
2189
|
-
borderStyle.left = borderStyle.vertical;
|
|
2190
|
-
borderStyle.right = borderStyle.vertical;
|
|
2191
|
-
}
|
|
2192
|
-
if (typeof borderStyle?.horizontal === "string") {
|
|
2193
|
-
borderStyle.top = borderStyle.horizontal;
|
|
2194
|
-
borderStyle.bottom = borderStyle.horizontal;
|
|
2195
|
-
}
|
|
2196
|
-
for (const side of sides) {
|
|
2197
|
-
if (borderStyle[side] === null || typeof borderStyle[side] !== "string") {
|
|
2198
|
-
throw new TypeError(`Invalid border style: ${side}`);
|
|
2199
|
-
}
|
|
2200
|
-
}
|
|
2201
|
-
characters = borderStyle;
|
|
1430
|
+
};
|
|
1431
|
+
__publicField(JOSEAlgNotAllowed, "code", "ERR_JOSE_ALG_NOT_ALLOWED");
|
|
1432
|
+
var JOSENotSupported = class extends JOSEError {
|
|
1433
|
+
constructor() {
|
|
1434
|
+
super(...arguments);
|
|
1435
|
+
__publicField(this, "code", "ERR_JOSE_NOT_SUPPORTED");
|
|
2202
1436
|
}
|
|
2203
|
-
return characters;
|
|
2204
1437
|
};
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
1438
|
+
__publicField(JOSENotSupported, "code", "ERR_JOSE_NOT_SUPPORTED");
|
|
1439
|
+
var JWSInvalid = class extends JOSEError {
|
|
1440
|
+
constructor() {
|
|
1441
|
+
super(...arguments);
|
|
1442
|
+
__publicField(this, "code", "ERR_JWS_INVALID");
|
|
1443
|
+
}
|
|
1444
|
+
};
|
|
1445
|
+
__publicField(JWSInvalid, "code", "ERR_JWS_INVALID");
|
|
1446
|
+
var JWTInvalid = class extends JOSEError {
|
|
1447
|
+
constructor() {
|
|
1448
|
+
super(...arguments);
|
|
1449
|
+
__publicField(this, "code", "ERR_JWT_INVALID");
|
|
1450
|
+
}
|
|
1451
|
+
};
|
|
1452
|
+
__publicField(JWTInvalid, "code", "ERR_JWT_INVALID");
|
|
1453
|
+
var _a, _b;
|
|
1454
|
+
var JWKSMultipleMatchingKeys = class extends (_b = JOSEError, _a = Symbol.asyncIterator, _b) {
|
|
1455
|
+
constructor(message2 = "multiple matching keys found in the JSON Web Key Set", options) {
|
|
1456
|
+
super(message2, options);
|
|
1457
|
+
__publicField(this, _a);
|
|
1458
|
+
__publicField(this, "code", "ERR_JWKS_MULTIPLE_MATCHING_KEYS");
|
|
1459
|
+
}
|
|
1460
|
+
};
|
|
1461
|
+
__publicField(JWKSMultipleMatchingKeys, "code", "ERR_JWKS_MULTIPLE_MATCHING_KEYS");
|
|
1462
|
+
var JWSSignatureVerificationFailed = class extends JOSEError {
|
|
1463
|
+
constructor(message2 = "signature verification failed", options) {
|
|
1464
|
+
super(message2, options);
|
|
1465
|
+
__publicField(this, "code", "ERR_JWS_SIGNATURE_VERIFICATION_FAILED");
|
|
1466
|
+
}
|
|
1467
|
+
};
|
|
1468
|
+
__publicField(JWSSignatureVerificationFailed, "code", "ERR_JWS_SIGNATURE_VERIFICATION_FAILED");
|
|
1469
|
+
|
|
1470
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/is_key_object.js
|
|
1471
|
+
import * as util from "util";
|
|
1472
|
+
var is_key_object_default = (obj) => util.types.isKeyObject(obj);
|
|
1473
|
+
|
|
1474
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/webcrypto.js
|
|
1475
|
+
import * as crypto from "crypto";
|
|
1476
|
+
import * as util2 from "util";
|
|
1477
|
+
var webcrypto2 = crypto.webcrypto;
|
|
1478
|
+
var webcrypto_default = webcrypto2;
|
|
1479
|
+
var isCryptoKey = (key) => util2.types.isCryptoKey(key);
|
|
1480
|
+
|
|
1481
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/crypto_key.js
|
|
1482
|
+
function unusable(name, prop = "algorithm.name") {
|
|
1483
|
+
return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);
|
|
1484
|
+
}
|
|
1485
|
+
function isAlgorithm(algorithm, name) {
|
|
1486
|
+
return algorithm.name === name;
|
|
1487
|
+
}
|
|
1488
|
+
function getHashLength(hash) {
|
|
1489
|
+
return parseInt(hash.name.slice(4), 10);
|
|
1490
|
+
}
|
|
1491
|
+
function getNamedCurve(alg) {
|
|
1492
|
+
switch (alg) {
|
|
1493
|
+
case "ES256":
|
|
1494
|
+
return "P-256";
|
|
1495
|
+
case "ES384":
|
|
1496
|
+
return "P-384";
|
|
1497
|
+
case "ES512":
|
|
1498
|
+
return "P-521";
|
|
1499
|
+
default:
|
|
1500
|
+
throw new Error("unreachable");
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
function checkUsage(key, usages) {
|
|
1504
|
+
if (usages.length && !usages.some((expected) => key.usages.includes(expected))) {
|
|
1505
|
+
let msg = "CryptoKey does not support this operation, its usages must include ";
|
|
1506
|
+
if (usages.length > 2) {
|
|
1507
|
+
const last = usages.pop();
|
|
1508
|
+
msg += `one of ${usages.join(", ")}, or ${last}.`;
|
|
1509
|
+
} else if (usages.length === 2) {
|
|
1510
|
+
msg += `one of ${usages[0]} or ${usages[1]}.`;
|
|
1511
|
+
} else {
|
|
1512
|
+
msg += `${usages[0]}.`;
|
|
2212
1513
|
}
|
|
2213
|
-
|
|
2214
|
-
|
|
1514
|
+
throw new TypeError(msg);
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
function checkSigCryptoKey(key, alg, ...usages) {
|
|
1518
|
+
switch (alg) {
|
|
1519
|
+
case "HS256":
|
|
1520
|
+
case "HS384":
|
|
1521
|
+
case "HS512": {
|
|
1522
|
+
if (!isAlgorithm(key.algorithm, "HMAC"))
|
|
1523
|
+
throw unusable("HMAC");
|
|
1524
|
+
const expected = parseInt(alg.slice(2), 10);
|
|
1525
|
+
const actual = getHashLength(key.algorithm.hash);
|
|
1526
|
+
if (actual !== expected)
|
|
1527
|
+
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
2215
1528
|
break;
|
|
2216
1529
|
}
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
1530
|
+
case "RS256":
|
|
1531
|
+
case "RS384":
|
|
1532
|
+
case "RS512": {
|
|
1533
|
+
if (!isAlgorithm(key.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
1534
|
+
throw unusable("RSASSA-PKCS1-v1_5");
|
|
1535
|
+
const expected = parseInt(alg.slice(2), 10);
|
|
1536
|
+
const actual = getHashLength(key.algorithm.hash);
|
|
1537
|
+
if (actual !== expected)
|
|
1538
|
+
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
1539
|
+
break;
|
|
1540
|
+
}
|
|
1541
|
+
case "PS256":
|
|
1542
|
+
case "PS384":
|
|
1543
|
+
case "PS512": {
|
|
1544
|
+
if (!isAlgorithm(key.algorithm, "RSA-PSS"))
|
|
1545
|
+
throw unusable("RSA-PSS");
|
|
1546
|
+
const expected = parseInt(alg.slice(2), 10);
|
|
1547
|
+
const actual = getHashLength(key.algorithm.hash);
|
|
1548
|
+
if (actual !== expected)
|
|
1549
|
+
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
1550
|
+
break;
|
|
1551
|
+
}
|
|
1552
|
+
case "EdDSA": {
|
|
1553
|
+
if (key.algorithm.name !== "Ed25519" && key.algorithm.name !== "Ed448") {
|
|
1554
|
+
throw unusable("Ed25519 or Ed448");
|
|
2225
1555
|
}
|
|
2226
1556
|
break;
|
|
2227
1557
|
}
|
|
1558
|
+
case "Ed25519": {
|
|
1559
|
+
if (!isAlgorithm(key.algorithm, "Ed25519"))
|
|
1560
|
+
throw unusable("Ed25519");
|
|
1561
|
+
break;
|
|
1562
|
+
}
|
|
1563
|
+
case "ES256":
|
|
1564
|
+
case "ES384":
|
|
1565
|
+
case "ES512": {
|
|
1566
|
+
if (!isAlgorithm(key.algorithm, "ECDSA"))
|
|
1567
|
+
throw unusable("ECDSA");
|
|
1568
|
+
const expected = getNamedCurve(alg);
|
|
1569
|
+
const actual = key.algorithm.namedCurve;
|
|
1570
|
+
if (actual !== expected)
|
|
1571
|
+
throw unusable(expected, "algorithm.namedCurve");
|
|
1572
|
+
break;
|
|
1573
|
+
}
|
|
1574
|
+
default:
|
|
1575
|
+
throw new TypeError("CryptoKey does not support this operation");
|
|
2228
1576
|
}
|
|
2229
|
-
|
|
1577
|
+
checkUsage(key, usages);
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/invalid_key_input.js
|
|
1581
|
+
function message(msg, actual, ...types4) {
|
|
1582
|
+
types4 = types4.filter(Boolean);
|
|
1583
|
+
if (types4.length > 2) {
|
|
1584
|
+
const last = types4.pop();
|
|
1585
|
+
msg += `one of type ${types4.join(", ")}, or ${last}.`;
|
|
1586
|
+
} else if (types4.length === 2) {
|
|
1587
|
+
msg += `one of type ${types4[0]} or ${types4[1]}.`;
|
|
1588
|
+
} else {
|
|
1589
|
+
msg += `of type ${types4[0]}.`;
|
|
1590
|
+
}
|
|
1591
|
+
if (actual == null) {
|
|
1592
|
+
msg += ` Received ${actual}`;
|
|
1593
|
+
} else if (typeof actual === "function" && actual.name) {
|
|
1594
|
+
msg += ` Received function ${actual.name}`;
|
|
1595
|
+
} else if (typeof actual === "object" && actual != null) {
|
|
1596
|
+
if (actual.constructor?.name) {
|
|
1597
|
+
msg += ` Received an instance of ${actual.constructor.name}`;
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
return msg;
|
|
1601
|
+
}
|
|
1602
|
+
var invalid_key_input_default = (actual, ...types4) => {
|
|
1603
|
+
return message("Key must be ", actual, ...types4);
|
|
2230
1604
|
};
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
}
|
|
2259
|
-
newLines.push(paddedLine);
|
|
1605
|
+
function withAlg(alg, actual, ...types4) {
|
|
1606
|
+
return message(`Key for the ${alg} algorithm must be `, actual, ...types4);
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/is_key_like.js
|
|
1610
|
+
var is_key_like_default = (key) => is_key_object_default(key) || isCryptoKey(key);
|
|
1611
|
+
var types3 = ["KeyObject"];
|
|
1612
|
+
if (globalThis.CryptoKey || webcrypto_default?.CryptoKey) {
|
|
1613
|
+
types3.push("CryptoKey");
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_disjoint.js
|
|
1617
|
+
var isDisjoint = (...headers) => {
|
|
1618
|
+
const sources = headers.filter(Boolean);
|
|
1619
|
+
if (sources.length === 0 || sources.length === 1) {
|
|
1620
|
+
return true;
|
|
1621
|
+
}
|
|
1622
|
+
let acc;
|
|
1623
|
+
for (const header of sources) {
|
|
1624
|
+
const parameters = Object.keys(header);
|
|
1625
|
+
if (!acc || acc.size === 0) {
|
|
1626
|
+
acc = new Set(parameters);
|
|
1627
|
+
continue;
|
|
1628
|
+
}
|
|
1629
|
+
for (const parameter of parameters) {
|
|
1630
|
+
if (acc.has(parameter)) {
|
|
1631
|
+
return false;
|
|
2260
1632
|
}
|
|
1633
|
+
acc.add(parameter);
|
|
2261
1634
|
}
|
|
2262
|
-
lines = newLines;
|
|
2263
1635
|
}
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
1636
|
+
return true;
|
|
1637
|
+
};
|
|
1638
|
+
var is_disjoint_default = isDisjoint;
|
|
1639
|
+
|
|
1640
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_object.js
|
|
1641
|
+
function isObjectLike(value) {
|
|
1642
|
+
return typeof value === "object" && value !== null;
|
|
1643
|
+
}
|
|
1644
|
+
function isObject(input) {
|
|
1645
|
+
if (!isObjectLike(input) || Object.prototype.toString.call(input) !== "[object Object]") {
|
|
1646
|
+
return false;
|
|
2268
1647
|
}
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
lines = lines.map((line) => {
|
|
2272
|
-
const newLine = paddingLeft + line + paddingRight;
|
|
2273
|
-
return newLine + PAD.repeat(width - stringWidth(newLine));
|
|
2274
|
-
});
|
|
2275
|
-
if (padding.top > 0) {
|
|
2276
|
-
lines = [...Array.from({ length: padding.top }).fill(PAD.repeat(width)), ...lines];
|
|
1648
|
+
if (Object.getPrototypeOf(input) === null) {
|
|
1649
|
+
return true;
|
|
2277
1650
|
}
|
|
2278
|
-
|
|
2279
|
-
|
|
1651
|
+
let proto = input;
|
|
1652
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
1653
|
+
proto = Object.getPrototypeOf(proto);
|
|
2280
1654
|
}
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
1655
|
+
return Object.getPrototypeOf(input) === proto;
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_named_curve.js
|
|
1659
|
+
import { KeyObject } from "crypto";
|
|
1660
|
+
|
|
1661
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_jwk.js
|
|
1662
|
+
function isJWK(key) {
|
|
1663
|
+
return isObject(key) && typeof key.kty === "string";
|
|
1664
|
+
}
|
|
1665
|
+
function isPrivateJWK(key) {
|
|
1666
|
+
return key.kty !== "oct" && typeof key.d === "string";
|
|
1667
|
+
}
|
|
1668
|
+
function isPublicJWK(key) {
|
|
1669
|
+
return key.kty !== "oct" && typeof key.d === "undefined";
|
|
1670
|
+
}
|
|
1671
|
+
function isSecretJWK(key) {
|
|
1672
|
+
return isJWK(key) && key.kty === "oct" && typeof key.k === "string";
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_named_curve.js
|
|
1676
|
+
var namedCurveToJOSE = (namedCurve) => {
|
|
1677
|
+
switch (namedCurve) {
|
|
1678
|
+
case "prime256v1":
|
|
1679
|
+
return "P-256";
|
|
1680
|
+
case "secp384r1":
|
|
1681
|
+
return "P-384";
|
|
1682
|
+
case "secp521r1":
|
|
1683
|
+
return "P-521";
|
|
1684
|
+
case "secp256k1":
|
|
1685
|
+
return "secp256k1";
|
|
1686
|
+
default:
|
|
1687
|
+
throw new JOSENotSupported("Unsupported key curve for this operation");
|
|
2285
1688
|
}
|
|
2286
|
-
return lines.join(NEWLINE);
|
|
2287
1689
|
};
|
|
2288
|
-
var
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
}
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
const marginWidth = Math.max((columns - contentWidth - getBorderWidth(options.borderStyle)) / 2, 0);
|
|
2299
|
-
marginLeft = PAD.repeat(marginWidth);
|
|
2300
|
-
} else if (options.float === "right") {
|
|
2301
|
-
const marginWidth = Math.max(columns - contentWidth - options.margin.right - getBorderWidth(options.borderStyle), 0);
|
|
2302
|
-
marginLeft = PAD.repeat(marginWidth);
|
|
1690
|
+
var getNamedCurve2 = (kee, raw) => {
|
|
1691
|
+
let key;
|
|
1692
|
+
if (isCryptoKey(kee)) {
|
|
1693
|
+
key = KeyObject.from(kee);
|
|
1694
|
+
} else if (is_key_object_default(kee)) {
|
|
1695
|
+
key = kee;
|
|
1696
|
+
} else if (isJWK(kee)) {
|
|
1697
|
+
return kee.crv;
|
|
1698
|
+
} else {
|
|
1699
|
+
throw new TypeError(invalid_key_input_default(kee, ...types3));
|
|
2303
1700
|
}
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
result += NEWLINE.repeat(options.margin.top);
|
|
1701
|
+
if (key.type === "secret") {
|
|
1702
|
+
throw new TypeError('only "private" or "public" type keys can be used for this operation');
|
|
2307
1703
|
}
|
|
2308
|
-
|
|
2309
|
-
|
|
1704
|
+
switch (key.asymmetricKeyType) {
|
|
1705
|
+
case "ed25519":
|
|
1706
|
+
case "ed448":
|
|
1707
|
+
return `Ed${key.asymmetricKeyType.slice(2)}`;
|
|
1708
|
+
case "x25519":
|
|
1709
|
+
case "x448":
|
|
1710
|
+
return `X${key.asymmetricKeyType.slice(1)}`;
|
|
1711
|
+
case "ec": {
|
|
1712
|
+
const namedCurve = key.asymmetricKeyDetails.namedCurve;
|
|
1713
|
+
if (raw) {
|
|
1714
|
+
return namedCurve;
|
|
1715
|
+
}
|
|
1716
|
+
return namedCurveToJOSE(namedCurve);
|
|
1717
|
+
}
|
|
1718
|
+
default:
|
|
1719
|
+
throw new TypeError("Invalid asymmetric key type for this operation");
|
|
2310
1720
|
}
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
1721
|
+
};
|
|
1722
|
+
var get_named_curve_default = getNamedCurve2;
|
|
1723
|
+
|
|
1724
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/check_key_length.js
|
|
1725
|
+
import { KeyObject as KeyObject2 } from "crypto";
|
|
1726
|
+
var check_key_length_default = (key, alg) => {
|
|
1727
|
+
let modulusLength;
|
|
1728
|
+
try {
|
|
1729
|
+
if (key instanceof KeyObject2) {
|
|
1730
|
+
modulusLength = key.asymmetricKeyDetails?.modulusLength;
|
|
1731
|
+
} else {
|
|
1732
|
+
modulusLength = Buffer.from(key.n, "base64url").byteLength << 3;
|
|
1733
|
+
}
|
|
1734
|
+
} catch {
|
|
2315
1735
|
}
|
|
2316
|
-
if (
|
|
2317
|
-
|
|
1736
|
+
if (typeof modulusLength !== "number" || modulusLength < 2048) {
|
|
1737
|
+
throw new TypeError(`${alg} requires key modulusLength to be 2048 bits or larger`);
|
|
2318
1738
|
}
|
|
2319
|
-
return result;
|
|
2320
1739
|
};
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
1740
|
+
|
|
1741
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/asn1.js
|
|
1742
|
+
import { createPrivateKey, createPublicKey, KeyObject as KeyObject3 } from "crypto";
|
|
1743
|
+
import { Buffer as Buffer3 } from "buffer";
|
|
1744
|
+
var fromSPKI = (pem) => createPublicKey({
|
|
1745
|
+
key: Buffer3.from(pem.replace(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, ""), "base64"),
|
|
1746
|
+
type: "spki",
|
|
1747
|
+
format: "der"
|
|
1748
|
+
});
|
|
1749
|
+
|
|
1750
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/jwk_to_key.js
|
|
1751
|
+
import { createPrivateKey as createPrivateKey2, createPublicKey as createPublicKey2 } from "crypto";
|
|
1752
|
+
var parse = (key) => {
|
|
1753
|
+
if (key.d) {
|
|
1754
|
+
return createPrivateKey2({ format: "jwk", key });
|
|
2329
1755
|
}
|
|
2330
|
-
|
|
2331
|
-
options.height && (options.height = Math.max(1, options.height - getBorderWidth(options.borderStyle)));
|
|
2332
|
-
return options;
|
|
1756
|
+
return createPublicKey2({ format: "jwk", key });
|
|
2333
1757
|
};
|
|
2334
|
-
var
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
const maxWidth = columns - options.margin.left - options.margin.right - borderWidth;
|
|
2341
|
-
const widest = widestLine(wrapAnsi(text, columns - borderWidth, { hard: true, trim: false })) + options.padding.left + options.padding.right;
|
|
2342
|
-
if (options.title && widthOverride) {
|
|
2343
|
-
options.title = options.title.slice(0, Math.max(0, options.width - 2));
|
|
2344
|
-
options.title && (options.title = formatTitle(options.title, options.borderStyle));
|
|
2345
|
-
} else if (options.title) {
|
|
2346
|
-
options.title = options.title.slice(0, Math.max(0, maxWidth - 2));
|
|
2347
|
-
if (options.title) {
|
|
2348
|
-
options.title = formatTitle(options.title, options.borderStyle);
|
|
2349
|
-
if (stringWidth(options.title) > widest) {
|
|
2350
|
-
options.width = stringWidth(options.title);
|
|
2351
|
-
}
|
|
2352
|
-
}
|
|
1758
|
+
var jwk_to_key_default = parse;
|
|
1759
|
+
|
|
1760
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/key/import.js
|
|
1761
|
+
async function importSPKI(spki, alg, options) {
|
|
1762
|
+
if (typeof spki !== "string" || spki.indexOf("-----BEGIN PUBLIC KEY-----") !== 0) {
|
|
1763
|
+
throw new TypeError('"spki" must be SPKI formatted string');
|
|
2353
1764
|
}
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
1765
|
+
return fromSPKI(spki, alg, options);
|
|
1766
|
+
}
|
|
1767
|
+
async function importJWK(jwk, alg) {
|
|
1768
|
+
if (!isObject(jwk)) {
|
|
1769
|
+
throw new TypeError("JWK must be an object");
|
|
1770
|
+
}
|
|
1771
|
+
alg || (alg = jwk.alg);
|
|
1772
|
+
switch (jwk.kty) {
|
|
1773
|
+
case "oct":
|
|
1774
|
+
if (typeof jwk.k !== "string" || !jwk.k) {
|
|
1775
|
+
throw new TypeError('missing "k" (Key Value) Parameter value');
|
|
1776
|
+
}
|
|
1777
|
+
return decode(jwk.k);
|
|
1778
|
+
case "RSA":
|
|
1779
|
+
if ("oth" in jwk && jwk.oth !== void 0) {
|
|
1780
|
+
throw new JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
|
|
1781
|
+
}
|
|
1782
|
+
case "EC":
|
|
1783
|
+
case "OKP":
|
|
1784
|
+
return jwk_to_key_default({ ...jwk, alg });
|
|
1785
|
+
default:
|
|
1786
|
+
throw new JOSENotSupported('Unsupported "kty" (Key Type) Parameter value');
|
|
2363
1787
|
}
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/check_key_type.js
|
|
1791
|
+
var tag = (key) => key?.[Symbol.toStringTag];
|
|
1792
|
+
var jwkMatchesOp = (alg, key, usage) => {
|
|
1793
|
+
if (key.use !== void 0 && key.use !== "sig") {
|
|
1794
|
+
throw new TypeError("Invalid key for this operation, when present its use must be sig");
|
|
2367
1795
|
}
|
|
2368
|
-
if (
|
|
2369
|
-
|
|
2370
|
-
options.padding.bottom = 0;
|
|
1796
|
+
if (key.key_ops !== void 0 && key.key_ops.includes?.(usage) !== true) {
|
|
1797
|
+
throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${usage}`);
|
|
2371
1798
|
}
|
|
2372
|
-
|
|
1799
|
+
if (key.alg !== void 0 && key.alg !== alg) {
|
|
1800
|
+
throw new TypeError(`Invalid key for this operation, when present its alg must be ${alg}`);
|
|
1801
|
+
}
|
|
1802
|
+
return true;
|
|
2373
1803
|
};
|
|
2374
|
-
var
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
borderStyle: "single",
|
|
2382
|
-
dimBorder: false,
|
|
2383
|
-
textAlignment: "left",
|
|
2384
|
-
float: "left",
|
|
2385
|
-
titleAlignment: "left",
|
|
2386
|
-
...options
|
|
2387
|
-
};
|
|
2388
|
-
if (options.align) {
|
|
2389
|
-
options.textAlignment = options.align;
|
|
1804
|
+
var symmetricTypeCheck = (alg, key, usage, allowJwk) => {
|
|
1805
|
+
if (key instanceof Uint8Array)
|
|
1806
|
+
return;
|
|
1807
|
+
if (allowJwk && isJWK(key)) {
|
|
1808
|
+
if (isSecretJWK(key) && jwkMatchesOp(alg, key, usage))
|
|
1809
|
+
return;
|
|
1810
|
+
throw new TypeError(`JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present`);
|
|
2390
1811
|
}
|
|
2391
|
-
if (
|
|
2392
|
-
throw new
|
|
1812
|
+
if (!is_key_like_default(key)) {
|
|
1813
|
+
throw new TypeError(withAlg(alg, key, ...types3, "Uint8Array", allowJwk ? "JSON Web Key" : null));
|
|
2393
1814
|
}
|
|
2394
|
-
if (
|
|
2395
|
-
throw new
|
|
1815
|
+
if (key.type !== "secret") {
|
|
1816
|
+
throw new TypeError(`${tag(key)} instances for symmetric algorithms must be of type "secret"`);
|
|
1817
|
+
}
|
|
1818
|
+
};
|
|
1819
|
+
var asymmetricTypeCheck = (alg, key, usage, allowJwk) => {
|
|
1820
|
+
if (allowJwk && isJWK(key)) {
|
|
1821
|
+
switch (usage) {
|
|
1822
|
+
case "sign":
|
|
1823
|
+
if (isPrivateJWK(key) && jwkMatchesOp(alg, key, usage))
|
|
1824
|
+
return;
|
|
1825
|
+
throw new TypeError(`JSON Web Key for this operation be a private JWK`);
|
|
1826
|
+
case "verify":
|
|
1827
|
+
if (isPublicJWK(key) && jwkMatchesOp(alg, key, usage))
|
|
1828
|
+
return;
|
|
1829
|
+
throw new TypeError(`JSON Web Key for this operation be a public JWK`);
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
if (!is_key_like_default(key)) {
|
|
1833
|
+
throw new TypeError(withAlg(alg, key, ...types3, allowJwk ? "JSON Web Key" : null));
|
|
1834
|
+
}
|
|
1835
|
+
if (key.type === "secret") {
|
|
1836
|
+
throw new TypeError(`${tag(key)} instances for asymmetric algorithms must not be of type "secret"`);
|
|
1837
|
+
}
|
|
1838
|
+
if (usage === "sign" && key.type === "public") {
|
|
1839
|
+
throw new TypeError(`${tag(key)} instances for asymmetric algorithm signing must be of type "private"`);
|
|
1840
|
+
}
|
|
1841
|
+
if (usage === "decrypt" && key.type === "public") {
|
|
1842
|
+
throw new TypeError(`${tag(key)} instances for asymmetric algorithm decryption must be of type "private"`);
|
|
1843
|
+
}
|
|
1844
|
+
if (key.algorithm && usage === "verify" && key.type === "private") {
|
|
1845
|
+
throw new TypeError(`${tag(key)} instances for asymmetric algorithm verifying must be of type "public"`);
|
|
1846
|
+
}
|
|
1847
|
+
if (key.algorithm && usage === "encrypt" && key.type === "private") {
|
|
1848
|
+
throw new TypeError(`${tag(key)} instances for asymmetric algorithm encryption must be of type "public"`);
|
|
1849
|
+
}
|
|
1850
|
+
};
|
|
1851
|
+
function checkKeyType(allowJwk, alg, key, usage) {
|
|
1852
|
+
const symmetric = alg.startsWith("HS") || alg === "dir" || alg.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(alg);
|
|
1853
|
+
if (symmetric) {
|
|
1854
|
+
symmetricTypeCheck(alg, key, usage, allowJwk);
|
|
1855
|
+
} else {
|
|
1856
|
+
asymmetricTypeCheck(alg, key, usage, allowJwk);
|
|
2396
1857
|
}
|
|
2397
|
-
options.padding = getObject(options.padding);
|
|
2398
|
-
options.margin = getObject(options.margin);
|
|
2399
|
-
options = determineDimensions(text, options);
|
|
2400
|
-
text = makeContentText(text, options);
|
|
2401
|
-
return boxContent(text, options.width, options);
|
|
2402
1858
|
}
|
|
1859
|
+
var check_key_type_default = checkKeyType.bind(void 0, false);
|
|
1860
|
+
var checkKeyTypeWithJwk = checkKeyType.bind(void 0, true);
|
|
2403
1861
|
|
|
2404
|
-
// ../../
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
try {
|
|
2409
|
-
const PROJECT_DIR = process.env.PROJECT_DIR || process.cwd();
|
|
2410
|
-
const pkg = fs.readFileSync(path.join(PROJECT_DIR, "package.json"), "utf8");
|
|
2411
|
-
const json = JSON.parse(pkg);
|
|
2412
|
-
const version = json.dependencies[packageName];
|
|
2413
|
-
return version?.replace(/[\^~><=]/g, "");
|
|
2414
|
-
} catch (error) {
|
|
2415
|
-
return null;
|
|
1862
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/validate_crit.js
|
|
1863
|
+
function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
|
|
1864
|
+
if (joseHeader.crit !== void 0 && protectedHeader?.crit === void 0) {
|
|
1865
|
+
throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
2416
1866
|
}
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
if (!
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
right: " ",
|
|
2440
|
-
top: "-",
|
|
2441
|
-
bottom: "-",
|
|
2442
|
-
left: " "
|
|
2443
|
-
}
|
|
2444
|
-
})
|
|
2445
|
-
);
|
|
1867
|
+
if (!protectedHeader || protectedHeader.crit === void 0) {
|
|
1868
|
+
return /* @__PURE__ */ new Set();
|
|
1869
|
+
}
|
|
1870
|
+
if (!Array.isArray(protectedHeader.crit) || protectedHeader.crit.length === 0 || protectedHeader.crit.some((input) => typeof input !== "string" || input.length === 0)) {
|
|
1871
|
+
throw new Err('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
|
|
1872
|
+
}
|
|
1873
|
+
let recognized;
|
|
1874
|
+
if (recognizedOption !== void 0) {
|
|
1875
|
+
recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]);
|
|
1876
|
+
} else {
|
|
1877
|
+
recognized = recognizedDefault;
|
|
1878
|
+
}
|
|
1879
|
+
for (const parameter of protectedHeader.crit) {
|
|
1880
|
+
if (!recognized.has(parameter)) {
|
|
1881
|
+
throw new JOSENotSupported(`Extension Header Parameter "${parameter}" is not recognized`);
|
|
1882
|
+
}
|
|
1883
|
+
if (joseHeader[parameter] === void 0) {
|
|
1884
|
+
throw new Err(`Extension Header Parameter "${parameter}" is missing`);
|
|
1885
|
+
}
|
|
1886
|
+
if (recognized.get(parameter) && protectedHeader[parameter] === void 0) {
|
|
1887
|
+
throw new Err(`Extension Header Parameter "${parameter}" MUST be integrity protected`);
|
|
1888
|
+
}
|
|
2446
1889
|
}
|
|
1890
|
+
return new Set(protectedHeader.crit);
|
|
2447
1891
|
}
|
|
1892
|
+
var validate_crit_default = validateCrit;
|
|
2448
1893
|
|
|
2449
|
-
//
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
if (
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
if (format.includes("protobuf")) return "protobuf";
|
|
2459
|
-
if (format.includes("yaml")) return "yaml";
|
|
2460
|
-
return "json";
|
|
1894
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/validate_algorithms.js
|
|
1895
|
+
var validateAlgorithms = (option, algorithms) => {
|
|
1896
|
+
if (algorithms !== void 0 && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
|
|
1897
|
+
throw new TypeError(`"${option}" option must be an array of strings`);
|
|
1898
|
+
}
|
|
1899
|
+
if (!algorithms) {
|
|
1900
|
+
return void 0;
|
|
1901
|
+
}
|
|
1902
|
+
return new Set(algorithms);
|
|
2461
1903
|
};
|
|
1904
|
+
var validate_algorithms_default = validateAlgorithms;
|
|
2462
1905
|
|
|
2463
|
-
//
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
## Architecture
|
|
2467
|
-
<NodeGraph />
|
|
2468
|
-
|
|
2469
|
-
${messageHasSchema(message) && messageIsJSON(message) ? `
|
|
2470
|
-
## Schema
|
|
2471
|
-
<SchemaViewer file="${getSchemaFileName(message)}" title="Message Schema" maxHeight="500" />
|
|
2472
|
-
` : ""}
|
|
2473
|
-
${messageHasSchema(message) && !messageIsJSON(message) ? `
|
|
2474
|
-
## Schema
|
|
2475
|
-
<Schema file="${getSchemaFileName(message)}" title="Message Schema" maxHeight="500" />
|
|
2476
|
-
` : ""}
|
|
1906
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/verify.js
|
|
1907
|
+
import * as crypto3 from "crypto";
|
|
1908
|
+
import { promisify as promisify2 } from "util";
|
|
2477
1909
|
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
1910
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/dsa_digest.js
|
|
1911
|
+
function dsaDigest(alg) {
|
|
1912
|
+
switch (alg) {
|
|
1913
|
+
case "PS256":
|
|
1914
|
+
case "RS256":
|
|
1915
|
+
case "ES256":
|
|
1916
|
+
case "ES256K":
|
|
1917
|
+
return "sha256";
|
|
1918
|
+
case "PS384":
|
|
1919
|
+
case "RS384":
|
|
1920
|
+
case "ES384":
|
|
1921
|
+
return "sha384";
|
|
1922
|
+
case "PS512":
|
|
1923
|
+
case "RS512":
|
|
1924
|
+
case "ES512":
|
|
1925
|
+
return "sha512";
|
|
1926
|
+
case "Ed25519":
|
|
1927
|
+
case "EdDSA":
|
|
1928
|
+
return void 0;
|
|
1929
|
+
default:
|
|
1930
|
+
throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
2482
1933
|
|
|
2483
|
-
|
|
2484
|
-
};
|
|
2485
|
-
var
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
1934
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/node_key.js
|
|
1935
|
+
import { constants, KeyObject as KeyObject4 } from "crypto";
|
|
1936
|
+
var ecCurveAlgMap = /* @__PURE__ */ new Map([
|
|
1937
|
+
["ES256", "P-256"],
|
|
1938
|
+
["ES256K", "secp256k1"],
|
|
1939
|
+
["ES384", "P-384"],
|
|
1940
|
+
["ES512", "P-521"]
|
|
1941
|
+
]);
|
|
1942
|
+
function keyForCrypto(alg, key) {
|
|
1943
|
+
let asymmetricKeyType;
|
|
1944
|
+
let asymmetricKeyDetails;
|
|
1945
|
+
let isJWK2;
|
|
1946
|
+
if (key instanceof KeyObject4) {
|
|
1947
|
+
asymmetricKeyType = key.asymmetricKeyType;
|
|
1948
|
+
asymmetricKeyDetails = key.asymmetricKeyDetails;
|
|
1949
|
+
} else {
|
|
1950
|
+
isJWK2 = true;
|
|
1951
|
+
switch (key.kty) {
|
|
1952
|
+
case "RSA":
|
|
1953
|
+
asymmetricKeyType = "rsa";
|
|
1954
|
+
break;
|
|
1955
|
+
case "EC":
|
|
1956
|
+
asymmetricKeyType = "ec";
|
|
1957
|
+
break;
|
|
1958
|
+
case "OKP": {
|
|
1959
|
+
if (key.crv === "Ed25519") {
|
|
1960
|
+
asymmetricKeyType = "ed25519";
|
|
1961
|
+
break;
|
|
1962
|
+
}
|
|
1963
|
+
if (key.crv === "Ed448") {
|
|
1964
|
+
asymmetricKeyType = "ed448";
|
|
1965
|
+
break;
|
|
1966
|
+
}
|
|
1967
|
+
throw new TypeError("Invalid key for this operation, its crv must be Ed25519 or Ed448");
|
|
1968
|
+
}
|
|
1969
|
+
default:
|
|
1970
|
+
throw new TypeError("Invalid key for this operation, its kty must be RSA, OKP, or EC");
|
|
1971
|
+
}
|
|
2491
1972
|
}
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
1973
|
+
let options;
|
|
1974
|
+
switch (alg) {
|
|
1975
|
+
case "Ed25519":
|
|
1976
|
+
if (asymmetricKeyType !== "ed25519") {
|
|
1977
|
+
throw new TypeError(`Invalid key for this operation, its asymmetricKeyType must be ed25519`);
|
|
1978
|
+
}
|
|
1979
|
+
break;
|
|
1980
|
+
case "EdDSA":
|
|
1981
|
+
if (!["ed25519", "ed448"].includes(asymmetricKeyType)) {
|
|
1982
|
+
throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be ed25519 or ed448");
|
|
1983
|
+
}
|
|
1984
|
+
break;
|
|
1985
|
+
case "RS256":
|
|
1986
|
+
case "RS384":
|
|
1987
|
+
case "RS512":
|
|
1988
|
+
if (asymmetricKeyType !== "rsa") {
|
|
1989
|
+
throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa");
|
|
1990
|
+
}
|
|
1991
|
+
check_key_length_default(key, alg);
|
|
1992
|
+
break;
|
|
1993
|
+
case "PS256":
|
|
1994
|
+
case "PS384":
|
|
1995
|
+
case "PS512":
|
|
1996
|
+
if (asymmetricKeyType === "rsa-pss") {
|
|
1997
|
+
const { hashAlgorithm, mgf1HashAlgorithm, saltLength } = asymmetricKeyDetails;
|
|
1998
|
+
const length = parseInt(alg.slice(-3), 10);
|
|
1999
|
+
if (hashAlgorithm !== void 0 && (hashAlgorithm !== `sha${length}` || mgf1HashAlgorithm !== hashAlgorithm)) {
|
|
2000
|
+
throw new TypeError(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${alg}`);
|
|
2001
|
+
}
|
|
2002
|
+
if (saltLength !== void 0 && saltLength > length >> 3) {
|
|
2003
|
+
throw new TypeError(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${alg}`);
|
|
2004
|
+
}
|
|
2005
|
+
} else if (asymmetricKeyType !== "rsa") {
|
|
2006
|
+
throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa or rsa-pss");
|
|
2515
2007
|
}
|
|
2008
|
+
check_key_length_default(key, alg);
|
|
2009
|
+
options = {
|
|
2010
|
+
padding: constants.RSA_PKCS1_PSS_PADDING,
|
|
2011
|
+
saltLength: constants.RSA_PSS_SALTLEN_DIGEST
|
|
2012
|
+
};
|
|
2013
|
+
break;
|
|
2014
|
+
case "ES256":
|
|
2015
|
+
case "ES256K":
|
|
2016
|
+
case "ES384":
|
|
2017
|
+
case "ES512": {
|
|
2018
|
+
if (asymmetricKeyType !== "ec") {
|
|
2019
|
+
throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be ec");
|
|
2020
|
+
}
|
|
2021
|
+
const actual = get_named_curve_default(key);
|
|
2022
|
+
const expected = ecCurveAlgMap.get(alg);
|
|
2023
|
+
if (actual !== expected) {
|
|
2024
|
+
throw new TypeError(`Invalid key curve for the algorithm, its curve must be ${expected}, got ${actual}`);
|
|
2025
|
+
}
|
|
2026
|
+
options = { dsaEncoding: "ieee-p1363" };
|
|
2027
|
+
break;
|
|
2516
2028
|
}
|
|
2029
|
+
default:
|
|
2030
|
+
throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
2517
2031
|
}
|
|
2518
|
-
|
|
2519
|
-
|
|
2032
|
+
if (isJWK2) {
|
|
2033
|
+
return { format: "jwk", key, ...options };
|
|
2520
2034
|
}
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
);
|
|
2524
|
-
return uniqueChannels.map((channel) => {
|
|
2525
|
-
const channelVersion = channel.extensions().get("x-eventcatalog-channel-version")?.value() || globalVersion;
|
|
2526
|
-
return {
|
|
2527
|
-
id: channel.id(),
|
|
2528
|
-
version: channelVersion
|
|
2529
|
-
};
|
|
2530
|
-
});
|
|
2531
|
-
};
|
|
2035
|
+
return options ? { ...options, key } : key;
|
|
2036
|
+
}
|
|
2532
2037
|
|
|
2533
|
-
//
|
|
2534
|
-
|
|
2535
|
-
|
|
2038
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/sign.js
|
|
2039
|
+
import * as crypto2 from "crypto";
|
|
2040
|
+
import { promisify } from "util";
|
|
2536
2041
|
|
|
2537
|
-
|
|
2042
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/hmac_digest.js
|
|
2043
|
+
function hmacDigest(alg) {
|
|
2044
|
+
switch (alg) {
|
|
2045
|
+
case "HS256":
|
|
2046
|
+
return "sha256";
|
|
2047
|
+
case "HS384":
|
|
2048
|
+
return "sha384";
|
|
2049
|
+
case "HS512":
|
|
2050
|
+
return "sha512";
|
|
2051
|
+
default:
|
|
2052
|
+
throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2538
2055
|
|
|
2539
|
-
|
|
2540
|
-
|
|
2056
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_sign_verify_key.js
|
|
2057
|
+
import { KeyObject as KeyObject5, createSecretKey } from "crypto";
|
|
2058
|
+
function getSignVerifyKey(alg, key, usage) {
|
|
2059
|
+
if (key instanceof Uint8Array) {
|
|
2060
|
+
if (!alg.startsWith("HS")) {
|
|
2061
|
+
throw new TypeError(invalid_key_input_default(key, ...types3));
|
|
2062
|
+
}
|
|
2063
|
+
return createSecretKey(key);
|
|
2064
|
+
}
|
|
2065
|
+
if (key instanceof KeyObject5) {
|
|
2066
|
+
return key;
|
|
2067
|
+
}
|
|
2068
|
+
if (isCryptoKey(key)) {
|
|
2069
|
+
checkSigCryptoKey(key, alg, usage);
|
|
2070
|
+
return KeyObject5.from(key);
|
|
2071
|
+
}
|
|
2072
|
+
if (isJWK(key)) {
|
|
2073
|
+
if (alg.startsWith("HS")) {
|
|
2074
|
+
return createSecretKey(Buffer.from(key.k, "base64url"));
|
|
2075
|
+
}
|
|
2076
|
+
return key;
|
|
2077
|
+
}
|
|
2078
|
+
throw new TypeError(invalid_key_input_default(key, ...types3, "Uint8Array", "JSON Web Key"));
|
|
2079
|
+
}
|
|
2541
2080
|
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2081
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/sign.js
|
|
2082
|
+
var oneShotSign = promisify(crypto2.sign);
|
|
2083
|
+
var sign2 = async (alg, key, data) => {
|
|
2084
|
+
const k = getSignVerifyKey(alg, key, "sign");
|
|
2085
|
+
if (alg.startsWith("HS")) {
|
|
2086
|
+
const hmac = crypto2.createHmac(hmacDigest(alg), k);
|
|
2087
|
+
hmac.update(data);
|
|
2088
|
+
return hmac.digest();
|
|
2089
|
+
}
|
|
2090
|
+
return oneShotSign(dsaDigest(alg), data, keyForCrypto(alg, k));
|
|
2547
2091
|
};
|
|
2548
|
-
var
|
|
2549
|
-
|
|
2550
|
-
|
|
2092
|
+
var sign_default = sign2;
|
|
2093
|
+
|
|
2094
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/verify.js
|
|
2095
|
+
var oneShotVerify = promisify2(crypto3.verify);
|
|
2096
|
+
var verify2 = async (alg, key, signature, data) => {
|
|
2097
|
+
const k = getSignVerifyKey(alg, key, "verify");
|
|
2098
|
+
if (alg.startsWith("HS")) {
|
|
2099
|
+
const expected = await sign_default(alg, k, data);
|
|
2100
|
+
const actual = signature;
|
|
2101
|
+
try {
|
|
2102
|
+
return crypto3.timingSafeEqual(actual, expected);
|
|
2103
|
+
} catch {
|
|
2104
|
+
return false;
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
const algorithm = dsaDigest(alg);
|
|
2108
|
+
const keyInput = keyForCrypto(alg, k);
|
|
2109
|
+
try {
|
|
2110
|
+
return await oneShotVerify(algorithm, data, keyInput, signature);
|
|
2111
|
+
} catch {
|
|
2112
|
+
return false;
|
|
2113
|
+
}
|
|
2551
2114
|
};
|
|
2115
|
+
var verify_default = verify2;
|
|
2552
2116
|
|
|
2553
|
-
//
|
|
2554
|
-
|
|
2555
|
-
|
|
2117
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jws/flattened/verify.js
|
|
2118
|
+
async function flattenedVerify(jws, key, options) {
|
|
2119
|
+
if (!isObject(jws)) {
|
|
2120
|
+
throw new JWSInvalid("Flattened JWS must be an object");
|
|
2121
|
+
}
|
|
2122
|
+
if (jws.protected === void 0 && jws.header === void 0) {
|
|
2123
|
+
throw new JWSInvalid('Flattened JWS must have either of the "protected" or "header" members');
|
|
2124
|
+
}
|
|
2125
|
+
if (jws.protected !== void 0 && typeof jws.protected !== "string") {
|
|
2126
|
+
throw new JWSInvalid("JWS Protected Header incorrect type");
|
|
2127
|
+
}
|
|
2128
|
+
if (jws.payload === void 0) {
|
|
2129
|
+
throw new JWSInvalid("JWS Payload missing");
|
|
2130
|
+
}
|
|
2131
|
+
if (typeof jws.signature !== "string") {
|
|
2132
|
+
throw new JWSInvalid("JWS Signature missing or incorrect type");
|
|
2133
|
+
}
|
|
2134
|
+
if (jws.header !== void 0 && !isObject(jws.header)) {
|
|
2135
|
+
throw new JWSInvalid("JWS Unprotected Header incorrect type");
|
|
2136
|
+
}
|
|
2137
|
+
let parsedProt = {};
|
|
2138
|
+
if (jws.protected) {
|
|
2139
|
+
try {
|
|
2140
|
+
const protectedHeader = decode(jws.protected);
|
|
2141
|
+
parsedProt = JSON.parse(decoder.decode(protectedHeader));
|
|
2142
|
+
} catch {
|
|
2143
|
+
throw new JWSInvalid("JWS Protected Header is invalid");
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
if (!is_disjoint_default(parsedProt, jws.header)) {
|
|
2147
|
+
throw new JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
|
|
2148
|
+
}
|
|
2149
|
+
const joseHeader = {
|
|
2150
|
+
...parsedProt,
|
|
2151
|
+
...jws.header
|
|
2152
|
+
};
|
|
2153
|
+
const extensions = validate_crit_default(JWSInvalid, /* @__PURE__ */ new Map([["b64", true]]), options?.crit, parsedProt, joseHeader);
|
|
2154
|
+
let b64 = true;
|
|
2155
|
+
if (extensions.has("b64")) {
|
|
2156
|
+
b64 = parsedProt.b64;
|
|
2157
|
+
if (typeof b64 !== "boolean") {
|
|
2158
|
+
throw new JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
|
|
2159
|
+
}
|
|
2160
|
+
}
|
|
2161
|
+
const { alg } = joseHeader;
|
|
2162
|
+
if (typeof alg !== "string" || !alg) {
|
|
2163
|
+
throw new JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');
|
|
2164
|
+
}
|
|
2165
|
+
const algorithms = options && validate_algorithms_default("algorithms", options.algorithms);
|
|
2166
|
+
if (algorithms && !algorithms.has(alg)) {
|
|
2167
|
+
throw new JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter value not allowed');
|
|
2168
|
+
}
|
|
2169
|
+
if (b64) {
|
|
2170
|
+
if (typeof jws.payload !== "string") {
|
|
2171
|
+
throw new JWSInvalid("JWS Payload must be a string");
|
|
2172
|
+
}
|
|
2173
|
+
} else if (typeof jws.payload !== "string" && !(jws.payload instanceof Uint8Array)) {
|
|
2174
|
+
throw new JWSInvalid("JWS Payload must be a string or an Uint8Array instance");
|
|
2175
|
+
}
|
|
2176
|
+
let resolvedKey = false;
|
|
2177
|
+
if (typeof key === "function") {
|
|
2178
|
+
key = await key(parsedProt, jws);
|
|
2179
|
+
resolvedKey = true;
|
|
2180
|
+
checkKeyTypeWithJwk(alg, key, "verify");
|
|
2181
|
+
if (isJWK(key)) {
|
|
2182
|
+
key = await importJWK(key, alg);
|
|
2183
|
+
}
|
|
2184
|
+
} else {
|
|
2185
|
+
checkKeyTypeWithJwk(alg, key, "verify");
|
|
2186
|
+
}
|
|
2187
|
+
const data = concat(encoder.encode(jws.protected ?? ""), encoder.encode("."), typeof jws.payload === "string" ? encoder.encode(jws.payload) : jws.payload);
|
|
2188
|
+
let signature;
|
|
2189
|
+
try {
|
|
2190
|
+
signature = decode(jws.signature);
|
|
2191
|
+
} catch {
|
|
2192
|
+
throw new JWSInvalid("Failed to base64url decode the signature");
|
|
2193
|
+
}
|
|
2194
|
+
const verified = await verify_default(alg, key, signature, data);
|
|
2195
|
+
if (!verified) {
|
|
2196
|
+
throw new JWSSignatureVerificationFailed();
|
|
2197
|
+
}
|
|
2198
|
+
let payload;
|
|
2199
|
+
if (b64) {
|
|
2200
|
+
try {
|
|
2201
|
+
payload = decode(jws.payload);
|
|
2202
|
+
} catch {
|
|
2203
|
+
throw new JWSInvalid("Failed to base64url decode the payload");
|
|
2204
|
+
}
|
|
2205
|
+
} else if (typeof jws.payload === "string") {
|
|
2206
|
+
payload = encoder.encode(jws.payload);
|
|
2207
|
+
} else {
|
|
2208
|
+
payload = jws.payload;
|
|
2209
|
+
}
|
|
2210
|
+
const result = { payload };
|
|
2211
|
+
if (jws.protected !== void 0) {
|
|
2212
|
+
result.protectedHeader = parsedProt;
|
|
2213
|
+
}
|
|
2214
|
+
if (jws.header !== void 0) {
|
|
2215
|
+
result.unprotectedHeader = jws.header;
|
|
2216
|
+
}
|
|
2217
|
+
if (resolvedKey) {
|
|
2218
|
+
return { ...result, key };
|
|
2219
|
+
}
|
|
2220
|
+
return result;
|
|
2221
|
+
}
|
|
2556
2222
|
|
|
2557
|
-
|
|
2558
|
-
|
|
2223
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jws/compact/verify.js
|
|
2224
|
+
async function compactVerify(jws, key, options) {
|
|
2225
|
+
if (jws instanceof Uint8Array) {
|
|
2226
|
+
jws = decoder.decode(jws);
|
|
2227
|
+
}
|
|
2228
|
+
if (typeof jws !== "string") {
|
|
2229
|
+
throw new JWSInvalid("Compact JWS must be a string or Uint8Array");
|
|
2230
|
+
}
|
|
2231
|
+
const { 0: protectedHeader, 1: payload, 2: signature, length } = jws.split(".");
|
|
2232
|
+
if (length !== 3) {
|
|
2233
|
+
throw new JWSInvalid("Invalid Compact JWS");
|
|
2234
|
+
}
|
|
2235
|
+
const verified = await flattenedVerify({ payload, protected: protectedHeader, signature }, key, options);
|
|
2236
|
+
const result = { payload: verified.payload, protectedHeader: verified.protectedHeader };
|
|
2237
|
+
if (typeof key === "function") {
|
|
2238
|
+
return { ...result, key: verified.key };
|
|
2239
|
+
}
|
|
2240
|
+
return result;
|
|
2241
|
+
}
|
|
2559
2242
|
|
|
2560
|
-
|
|
2243
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/epoch.js
|
|
2244
|
+
var epoch_default = (date) => Math.floor(date.getTime() / 1e3);
|
|
2245
|
+
|
|
2246
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/secs.js
|
|
2247
|
+
var minute = 60;
|
|
2248
|
+
var hour = minute * 60;
|
|
2249
|
+
var day = hour * 24;
|
|
2250
|
+
var week = day * 7;
|
|
2251
|
+
var year = day * 365.25;
|
|
2252
|
+
var REGEX = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;
|
|
2253
|
+
var secs_default = (str) => {
|
|
2254
|
+
const matched = REGEX.exec(str);
|
|
2255
|
+
if (!matched || matched[4] && matched[1]) {
|
|
2256
|
+
throw new TypeError("Invalid time period format");
|
|
2257
|
+
}
|
|
2258
|
+
const value = parseFloat(matched[2]);
|
|
2259
|
+
const unit = matched[3].toLowerCase();
|
|
2260
|
+
let numericDate;
|
|
2261
|
+
switch (unit) {
|
|
2262
|
+
case "sec":
|
|
2263
|
+
case "secs":
|
|
2264
|
+
case "second":
|
|
2265
|
+
case "seconds":
|
|
2266
|
+
case "s":
|
|
2267
|
+
numericDate = Math.round(value);
|
|
2268
|
+
break;
|
|
2269
|
+
case "minute":
|
|
2270
|
+
case "minutes":
|
|
2271
|
+
case "min":
|
|
2272
|
+
case "mins":
|
|
2273
|
+
case "m":
|
|
2274
|
+
numericDate = Math.round(value * minute);
|
|
2275
|
+
break;
|
|
2276
|
+
case "hour":
|
|
2277
|
+
case "hours":
|
|
2278
|
+
case "hr":
|
|
2279
|
+
case "hrs":
|
|
2280
|
+
case "h":
|
|
2281
|
+
numericDate = Math.round(value * hour);
|
|
2282
|
+
break;
|
|
2283
|
+
case "day":
|
|
2284
|
+
case "days":
|
|
2285
|
+
case "d":
|
|
2286
|
+
numericDate = Math.round(value * day);
|
|
2287
|
+
break;
|
|
2288
|
+
case "week":
|
|
2289
|
+
case "weeks":
|
|
2290
|
+
case "w":
|
|
2291
|
+
numericDate = Math.round(value * week);
|
|
2292
|
+
break;
|
|
2293
|
+
default:
|
|
2294
|
+
numericDate = Math.round(value * year);
|
|
2295
|
+
break;
|
|
2296
|
+
}
|
|
2297
|
+
if (matched[1] === "-" || matched[4] === "ago") {
|
|
2298
|
+
return -numericDate;
|
|
2299
|
+
}
|
|
2300
|
+
return numericDate;
|
|
2561
2301
|
};
|
|
2562
2302
|
|
|
2563
|
-
//
|
|
2564
|
-
var
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
protocols.push(binding.protocol());
|
|
2303
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/jwt_claims_set.js
|
|
2304
|
+
var normalizeTyp = (value) => value.toLowerCase().replace(/^application\//, "");
|
|
2305
|
+
var checkAudiencePresence = (audPayload, audOption) => {
|
|
2306
|
+
if (typeof audPayload === "string") {
|
|
2307
|
+
return audOption.includes(audPayload);
|
|
2569
2308
|
}
|
|
2570
|
-
|
|
2309
|
+
if (Array.isArray(audPayload)) {
|
|
2310
|
+
return audOption.some(Set.prototype.has.bind(new Set(audPayload)));
|
|
2311
|
+
}
|
|
2312
|
+
return false;
|
|
2313
|
+
};
|
|
2314
|
+
var jwt_claims_set_default = (protectedHeader, encodedPayload, options = {}) => {
|
|
2315
|
+
let payload;
|
|
2316
|
+
try {
|
|
2317
|
+
payload = JSON.parse(decoder.decode(encodedPayload));
|
|
2318
|
+
} catch {
|
|
2319
|
+
}
|
|
2320
|
+
if (!isObject(payload)) {
|
|
2321
|
+
throw new JWTInvalid("JWT Claims Set must be a top-level JSON object");
|
|
2322
|
+
}
|
|
2323
|
+
const { typ } = options;
|
|
2324
|
+
if (typ && (typeof protectedHeader.typ !== "string" || normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ))) {
|
|
2325
|
+
throw new JWTClaimValidationFailed('unexpected "typ" JWT header value', payload, "typ", "check_failed");
|
|
2326
|
+
}
|
|
2327
|
+
const { requiredClaims = [], issuer, subject, audience, maxTokenAge } = options;
|
|
2328
|
+
const presenceCheck = [...requiredClaims];
|
|
2329
|
+
if (maxTokenAge !== void 0)
|
|
2330
|
+
presenceCheck.push("iat");
|
|
2331
|
+
if (audience !== void 0)
|
|
2332
|
+
presenceCheck.push("aud");
|
|
2333
|
+
if (subject !== void 0)
|
|
2334
|
+
presenceCheck.push("sub");
|
|
2335
|
+
if (issuer !== void 0)
|
|
2336
|
+
presenceCheck.push("iss");
|
|
2337
|
+
for (const claim of new Set(presenceCheck.reverse())) {
|
|
2338
|
+
if (!(claim in payload)) {
|
|
2339
|
+
throw new JWTClaimValidationFailed(`missing required "${claim}" claim`, payload, claim, "missing");
|
|
2340
|
+
}
|
|
2341
|
+
}
|
|
2342
|
+
if (issuer && !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) {
|
|
2343
|
+
throw new JWTClaimValidationFailed('unexpected "iss" claim value', payload, "iss", "check_failed");
|
|
2344
|
+
}
|
|
2345
|
+
if (subject && payload.sub !== subject) {
|
|
2346
|
+
throw new JWTClaimValidationFailed('unexpected "sub" claim value', payload, "sub", "check_failed");
|
|
2347
|
+
}
|
|
2348
|
+
if (audience && !checkAudiencePresence(payload.aud, typeof audience === "string" ? [audience] : audience)) {
|
|
2349
|
+
throw new JWTClaimValidationFailed('unexpected "aud" claim value', payload, "aud", "check_failed");
|
|
2350
|
+
}
|
|
2351
|
+
let tolerance;
|
|
2352
|
+
switch (typeof options.clockTolerance) {
|
|
2353
|
+
case "string":
|
|
2354
|
+
tolerance = secs_default(options.clockTolerance);
|
|
2355
|
+
break;
|
|
2356
|
+
case "number":
|
|
2357
|
+
tolerance = options.clockTolerance;
|
|
2358
|
+
break;
|
|
2359
|
+
case "undefined":
|
|
2360
|
+
tolerance = 0;
|
|
2361
|
+
break;
|
|
2362
|
+
default:
|
|
2363
|
+
throw new TypeError("Invalid clockTolerance option type");
|
|
2364
|
+
}
|
|
2365
|
+
const { currentDate } = options;
|
|
2366
|
+
const now = epoch_default(currentDate || /* @__PURE__ */ new Date());
|
|
2367
|
+
if ((payload.iat !== void 0 || maxTokenAge) && typeof payload.iat !== "number") {
|
|
2368
|
+
throw new JWTClaimValidationFailed('"iat" claim must be a number', payload, "iat", "invalid");
|
|
2369
|
+
}
|
|
2370
|
+
if (payload.nbf !== void 0) {
|
|
2371
|
+
if (typeof payload.nbf !== "number") {
|
|
2372
|
+
throw new JWTClaimValidationFailed('"nbf" claim must be a number', payload, "nbf", "invalid");
|
|
2373
|
+
}
|
|
2374
|
+
if (payload.nbf > now + tolerance) {
|
|
2375
|
+
throw new JWTClaimValidationFailed('"nbf" claim timestamp check failed', payload, "nbf", "check_failed");
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
if (payload.exp !== void 0) {
|
|
2379
|
+
if (typeof payload.exp !== "number") {
|
|
2380
|
+
throw new JWTClaimValidationFailed('"exp" claim must be a number', payload, "exp", "invalid");
|
|
2381
|
+
}
|
|
2382
|
+
if (payload.exp <= now - tolerance) {
|
|
2383
|
+
throw new JWTExpired('"exp" claim timestamp check failed', payload, "exp", "check_failed");
|
|
2384
|
+
}
|
|
2385
|
+
}
|
|
2386
|
+
if (maxTokenAge) {
|
|
2387
|
+
const age = now - payload.iat;
|
|
2388
|
+
const max = typeof maxTokenAge === "number" ? maxTokenAge : secs_default(maxTokenAge);
|
|
2389
|
+
if (age - tolerance > max) {
|
|
2390
|
+
throw new JWTExpired('"iat" claim timestamp check failed (too far in the past)', payload, "iat", "check_failed");
|
|
2391
|
+
}
|
|
2392
|
+
if (age < 0 - tolerance) {
|
|
2393
|
+
throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', payload, "iat", "check_failed");
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2396
|
+
return payload;
|
|
2571
2397
|
};
|
|
2572
|
-
var defaultMarkdown4 = (_document, channel) => {
|
|
2573
|
-
return `
|
|
2574
|
-
${channel.hasDescription() ? `
|
|
2575
|
-
## Overview
|
|
2576
|
-
${channel.description()}
|
|
2577
|
-
` : ""}
|
|
2578
2398
|
|
|
2579
|
-
|
|
2399
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jwt/verify.js
|
|
2400
|
+
async function jwtVerify(jwt, key, options) {
|
|
2401
|
+
const verified = await compactVerify(jwt, key, options);
|
|
2402
|
+
if (verified.protectedHeader.crit?.includes("b64") && verified.protectedHeader.b64 === false) {
|
|
2403
|
+
throw new JWTInvalid("JWTs MUST NOT use unencoded payload");
|
|
2404
|
+
}
|
|
2405
|
+
const payload = jwt_claims_set_default(verified.protectedHeader, verified.payload, options);
|
|
2406
|
+
const result = { payload, protectedHeader: verified.protectedHeader };
|
|
2407
|
+
if (typeof key === "function") {
|
|
2408
|
+
return { ...result, key: verified.key };
|
|
2409
|
+
}
|
|
2410
|
+
return result;
|
|
2411
|
+
}
|
|
2580
2412
|
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
}
|
|
2413
|
+
// ../../node_modules/.pnpm/@eventcatalog+license@0.0.5/node_modules/@eventcatalog/license/dist/key.js
|
|
2414
|
+
var PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
|
|
2415
|
+
MCowBQYDK2VwAyEA599maqjKG7VW5bnj9fFA3msK691iHUYd+PkiZ7h9LpI=
|
|
2416
|
+
-----END PUBLIC KEY-----`;
|
|
2417
|
+
async function loadPublicPem() {
|
|
2418
|
+
return PUBLIC_KEY;
|
|
2419
|
+
}
|
|
2588
2420
|
|
|
2589
|
-
// ../../
|
|
2590
|
-
|
|
2591
|
-
import fetch2 from "node-fetch";
|
|
2421
|
+
// ../../node_modules/.pnpm/@eventcatalog+license@0.0.5/node_modules/@eventcatalog/license/dist/verify.js
|
|
2422
|
+
import path2 from "path";
|
|
2592
2423
|
import chalk2 from "chalk";
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2424
|
+
import https from "https";
|
|
2425
|
+
import http from "http";
|
|
2426
|
+
import { URL } from "url";
|
|
2427
|
+
var cachedEntitlements = null;
|
|
2428
|
+
function makeHttpRequest(url, options) {
|
|
2429
|
+
return new Promise((resolve, reject) => {
|
|
2430
|
+
const urlObj = new URL(url);
|
|
2431
|
+
const isHttps = urlObj.protocol === "https:";
|
|
2432
|
+
const client = isHttps ? https : http;
|
|
2433
|
+
const requestOptions = {
|
|
2434
|
+
hostname: urlObj.hostname,
|
|
2435
|
+
port: urlObj.port || (isHttps ? 443 : 80),
|
|
2436
|
+
path: urlObj.pathname + urlObj.search,
|
|
2437
|
+
method: options.method || "GET",
|
|
2438
|
+
headers: options.headers || {}
|
|
2439
|
+
};
|
|
2440
|
+
const proxyUrl = process.env.PROXY_SERVER_URI || process.env.HTTPS_PROXY || process.env.HTTP_PROXY;
|
|
2441
|
+
if (proxyUrl) {
|
|
2442
|
+
const proxy = new URL(proxyUrl);
|
|
2443
|
+
requestOptions.hostname = proxy.hostname;
|
|
2444
|
+
requestOptions.port = proxy.port || (proxy.protocol === "https:" ? 443 : 80);
|
|
2445
|
+
requestOptions.path = url;
|
|
2446
|
+
requestOptions.headers = {
|
|
2447
|
+
...requestOptions.headers,
|
|
2448
|
+
Host: urlObj.hostname
|
|
2449
|
+
};
|
|
2450
|
+
}
|
|
2451
|
+
const req = client.request(requestOptions, (res) => {
|
|
2452
|
+
let data = "";
|
|
2453
|
+
res.on("data", (chunk) => data += chunk);
|
|
2454
|
+
res.on("end", () => {
|
|
2455
|
+
resolve({
|
|
2456
|
+
status: res.statusCode,
|
|
2457
|
+
json: () => Promise.resolve(JSON.parse(data))
|
|
2458
|
+
});
|
|
2459
|
+
});
|
|
2460
|
+
});
|
|
2461
|
+
req.on("error", reject);
|
|
2462
|
+
if (options.body) {
|
|
2463
|
+
req.write(options.body);
|
|
2464
|
+
}
|
|
2465
|
+
req.end();
|
|
2466
|
+
});
|
|
2467
|
+
}
|
|
2468
|
+
async function verifyOfflineLicense(opts = {}) {
|
|
2469
|
+
if (cachedEntitlements) {
|
|
2470
|
+
return cachedEntitlements;
|
|
2601
2471
|
}
|
|
2602
|
-
const
|
|
2472
|
+
const { licensePath, audience = "EventCatalog", issuer = "EventCatalog Ltd", clockTolerance = "12h", currentVersion, fingerprintProvider } = opts;
|
|
2473
|
+
try {
|
|
2474
|
+
const licenseFilePath = licensePath || findLicenseFile();
|
|
2475
|
+
if (!licenseFilePath) {
|
|
2476
|
+
const licenseError = new Error("License file not found. Check EC_LICENSE environment variable or place license.jwt in current directory or /etc/eventcatalog/");
|
|
2477
|
+
licenseError.code = "LICENSE_FILE_NOT_FOUND";
|
|
2478
|
+
throw licenseError;
|
|
2479
|
+
}
|
|
2480
|
+
const token = readFileSync(licenseFilePath, "utf8").trim();
|
|
2481
|
+
if (!token) {
|
|
2482
|
+
const licenseError = new Error("License file is empty");
|
|
2483
|
+
licenseError.code = "LICENSE_FILE_EMPTY";
|
|
2484
|
+
throw licenseError;
|
|
2485
|
+
}
|
|
2486
|
+
const pemContent = await loadPublicPem();
|
|
2487
|
+
const publicKey = await importSPKI(pemContent, "EdDSA");
|
|
2488
|
+
const { payload } = await jwtVerify(token, publicKey, {
|
|
2489
|
+
issuer,
|
|
2490
|
+
audience,
|
|
2491
|
+
clockTolerance
|
|
2492
|
+
});
|
|
2493
|
+
const entitlements = payload;
|
|
2494
|
+
await performAdditionalChecks(entitlements, { currentVersion, fingerprintProvider });
|
|
2495
|
+
cachedEntitlements = entitlements;
|
|
2496
|
+
return entitlements;
|
|
2497
|
+
} catch (error) {
|
|
2498
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
2499
|
+
const errorName = error && typeof error === "object" && "name" in error ? error.name : "";
|
|
2500
|
+
const errorCode = error && typeof error === "object" && "code" in error ? error.code : "";
|
|
2501
|
+
if (errorName === "JWTExpired" || errorMessage.includes("JWTExpired") || errorCode === "JWTExpired") {
|
|
2502
|
+
const licenseError = new Error("License has expired");
|
|
2503
|
+
licenseError.code = "LICENSE_EXPIRED";
|
|
2504
|
+
console.error(chalk2.red(`You have an expired license. Please renew your license to continue using EventCatalog.`));
|
|
2505
|
+
throw licenseError;
|
|
2506
|
+
}
|
|
2507
|
+
if (errorName === "JWTNotYetValid" || errorMessage.includes("JWTNotYetValid") || errorCode === "JWTNotYetValid") {
|
|
2508
|
+
const licenseError = new Error("License is not yet valid");
|
|
2509
|
+
licenseError.code = "LICENSE_NOT_YET_VALID";
|
|
2510
|
+
console.error(chalk2.red(`License is not yet valid`));
|
|
2511
|
+
throw licenseError;
|
|
2512
|
+
}
|
|
2513
|
+
if (errorName === "JWTClaimValidationFailed" || errorMessage.includes("JWTClaimValidationFailed") || errorCode === "JWTClaimValidationFailed") {
|
|
2514
|
+
const licenseError = new Error("License validation failed - invalid issuer or audience");
|
|
2515
|
+
licenseError.code = "LICENSE_VALIDATION_FAILED";
|
|
2516
|
+
console.error(chalk2.red(`License validation failed - invalid issuer or audience`));
|
|
2517
|
+
throw licenseError;
|
|
2518
|
+
}
|
|
2519
|
+
if (errorName === "JWSSignatureVerificationFailed" || errorMessage.includes("JWSSignatureVerificationFailed") || errorCode === "JWSSignatureVerificationFailed") {
|
|
2520
|
+
const licenseError = new Error("License signature verification failed - invalid or tampered license");
|
|
2521
|
+
licenseError.code = "LICENSE_SIGNATURE_INVALID";
|
|
2522
|
+
console.error(chalk2.red(`License signature verification failed - invalid or tampered license`));
|
|
2523
|
+
throw licenseError;
|
|
2524
|
+
}
|
|
2525
|
+
throw error;
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
async function verifyOnlineLicense(key, plugin) {
|
|
2529
|
+
if (!isValidLicenseKeyFormat(key)) {
|
|
2530
|
+
const licenseError = new Error("Invalid license key format. Expected format: XXXX-XXXX-XXXX-XXXX-XXXX-XXXX");
|
|
2531
|
+
licenseError.code = "INVALID_LICENSE_KEY_FORMAT";
|
|
2532
|
+
throw licenseError;
|
|
2533
|
+
}
|
|
2534
|
+
const PLANS = {
|
|
2535
|
+
"@eventcatalog/eventcatalog-starter": "EventCatalog Starter",
|
|
2536
|
+
"@eventcatalog/eventcatalog-scale": "EventCatalog Scale",
|
|
2537
|
+
"@eventcatalog/eventcatalog-enterprise": "EventCatalog Enterprise",
|
|
2538
|
+
"@eventcatalog/generator-amazon-apigateway": "Amazon API Gateway",
|
|
2539
|
+
"@eventcatalog/generator-asyncapi": "AsyncAPI",
|
|
2540
|
+
"@eventcatalog/generator-openapi": "OpenAPI",
|
|
2541
|
+
"@eventcatalog/backstage-plugin-eventcatalog": "Backstage",
|
|
2542
|
+
"@eventcatalog/generator-aws-glue": "AWS Glue",
|
|
2543
|
+
"@eventcatalog/generator-confluent-schema-registry": "Confluent Schema Registry",
|
|
2544
|
+
"@eventcatalog/generator-github": "GitHub",
|
|
2545
|
+
"@eventcatalog/generator-federation": "Federation"
|
|
2546
|
+
};
|
|
2547
|
+
const requestOptions = {
|
|
2603
2548
|
method: "POST",
|
|
2604
2549
|
headers: {
|
|
2605
|
-
Authorization: `Bearer ${
|
|
2550
|
+
Authorization: `Bearer ${key}`,
|
|
2606
2551
|
"Content-Type": "application/json"
|
|
2607
2552
|
}
|
|
2608
2553
|
};
|
|
2609
2554
|
let response;
|
|
2610
2555
|
try {
|
|
2611
|
-
|
|
2612
|
-
const proxyAgent = new import_https_proxy_agent.HttpsProxyAgent(PROXY_SERVER_URI);
|
|
2613
|
-
fetchOptions.agent = proxyAgent;
|
|
2614
|
-
}
|
|
2615
|
-
response = await fetch2("https://api.eventcatalog.cloud/functions/v1/license", fetchOptions);
|
|
2556
|
+
response = await makeHttpRequest("https://api.eventcatalog.cloud/functions/v1/license", requestOptions);
|
|
2616
2557
|
} catch (err) {
|
|
2617
|
-
console.log(
|
|
2618
|
-
chalk2.redBright(
|
|
2619
|
-
"Network Connection Error: Unable to establish a connection to licence server. Check network or proxy settings."
|
|
2620
|
-
)
|
|
2621
|
-
);
|
|
2558
|
+
console.log(chalk2.redBright("Network Connection Error: Unable to establish a connection to license server. Check network or proxy settings."));
|
|
2622
2559
|
console.log(chalk2.red(`Error details: ${err?.message || err}`));
|
|
2560
|
+
const proxyUrl = process.env.PROXY_SERVER_URI || process.env.HTTPS_PROXY || process.env.HTTP_PROXY;
|
|
2561
|
+
if (proxyUrl) {
|
|
2562
|
+
console.log(chalk2.yellow("\n\u{1F4A1} Proxy is configured but connection failed."));
|
|
2563
|
+
console.log(chalk2.yellow(` Proxy: ${proxyUrl}`));
|
|
2564
|
+
} else {
|
|
2565
|
+
console.log(chalk2.yellow("\n\u{1F4A1} For proxy support, set PROXY_SERVER_URI, HTTPS_PROXY, or HTTP_PROXY environment variable"));
|
|
2566
|
+
}
|
|
2623
2567
|
process.exit(1);
|
|
2624
2568
|
}
|
|
2625
2569
|
if (response.status !== 200) {
|
|
2626
2570
|
console.log(chalk2.bgRed(`
|
|
2627
2571
|
Invalid license key`));
|
|
2628
|
-
console.log(
|
|
2629
|
-
|
|
2572
|
+
console.log(`
|
|
2573
|
+
Tried to verify your ${PLANS[plugin]} license, but your license key is not valid. Please check your license key or purchase a license at https://eventcatalog.cloud/
|
|
2574
|
+
`);
|
|
2575
|
+
return false;
|
|
2630
2576
|
}
|
|
2631
2577
|
if (response.status === 200) {
|
|
2632
2578
|
const data = await response.json();
|
|
2633
|
-
if (
|
|
2579
|
+
if (plugin !== data.plugin) {
|
|
2634
2580
|
console.log(chalk2.bgRed(`
|
|
2635
2581
|
Invalid license key for this plugin`));
|
|
2636
|
-
console.log(
|
|
2637
|
-
|
|
2582
|
+
console.log(`
|
|
2583
|
+
Invalid license key for ${PLANS[plugin]} license, please check your license key or purchase a license at https://eventcatalog.cloud/
|
|
2584
|
+
`);
|
|
2585
|
+
return false;
|
|
2638
2586
|
}
|
|
2587
|
+
let message2 = `${PLANS[plugin]} license is enabled for EventCatalog`;
|
|
2639
2588
|
if (data.is_trial) {
|
|
2640
|
-
|
|
2641
|
-
You are using a trial license for
|
|
2589
|
+
message2 += `
|
|
2590
|
+
You are using a trial license for ${PLANS[plugin]}. Please upgrade to a paid version to continue using EventCatalog.`;
|
|
2642
2591
|
}
|
|
2592
|
+
if (PLANS[plugin]) {
|
|
2593
|
+
console.log(boxen(message2, {
|
|
2594
|
+
padding: 1,
|
|
2595
|
+
margin: 1,
|
|
2596
|
+
borderColor: "green",
|
|
2597
|
+
title: PLANS[plugin],
|
|
2598
|
+
titleAlignment: "center"
|
|
2599
|
+
}));
|
|
2600
|
+
}
|
|
2601
|
+
}
|
|
2602
|
+
return true;
|
|
2603
|
+
}
|
|
2604
|
+
function isFeatureEnabled(name) {
|
|
2605
|
+
if (!cachedEntitlements?.plugins) {
|
|
2606
|
+
return false;
|
|
2607
|
+
}
|
|
2608
|
+
const isEnabled = cachedEntitlements.plugins.some((plugin) => plugin === name);
|
|
2609
|
+
let message2 = `${name} is enabled for EventCatalog`;
|
|
2610
|
+
if (isEnabled) {
|
|
2611
|
+
console.log(boxen(message2, {
|
|
2612
|
+
padding: 1,
|
|
2613
|
+
margin: 1,
|
|
2614
|
+
borderColor: "green",
|
|
2615
|
+
title: name,
|
|
2616
|
+
titleAlignment: "center"
|
|
2617
|
+
}));
|
|
2618
|
+
}
|
|
2619
|
+
return isEnabled;
|
|
2620
|
+
}
|
|
2621
|
+
function hasOfflineLicenseKey() {
|
|
2622
|
+
return findLicenseFile() !== null;
|
|
2623
|
+
}
|
|
2624
|
+
function findLicenseFile() {
|
|
2625
|
+
const candidates = [
|
|
2626
|
+
process.env.EC_LICENSE,
|
|
2627
|
+
path2.join(process.env.PROJECT_DIR || process.cwd(), "license.jwt"),
|
|
2628
|
+
"./license.jwt",
|
|
2629
|
+
"/etc/eventcatalog/license.jwt"
|
|
2630
|
+
].filter(Boolean);
|
|
2631
|
+
for (const candidate of candidates) {
|
|
2632
|
+
if (existsSync(candidate)) {
|
|
2633
|
+
return candidate;
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
return null;
|
|
2637
|
+
}
|
|
2638
|
+
async function performAdditionalChecks(entitlements, options) {
|
|
2639
|
+
const { currentVersion, fingerprintProvider } = options;
|
|
2640
|
+
if (entitlements.fingerprint && fingerprintProvider) {
|
|
2641
|
+
const actualFingerprint = fingerprintProvider();
|
|
2642
|
+
if (actualFingerprint && actualFingerprint !== entitlements.fingerprint) {
|
|
2643
|
+
const licenseError = new Error("License fingerprint mismatch - license is bound to a different machine");
|
|
2644
|
+
licenseError.code = "LICENSE_FINGERPRINT_MISMATCH";
|
|
2645
|
+
throw licenseError;
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2648
|
+
}
|
|
2649
|
+
function isValidLicenseKeyFormat(key) {
|
|
2650
|
+
if (typeof key !== "string") {
|
|
2651
|
+
return false;
|
|
2652
|
+
}
|
|
2653
|
+
const trimmedKey = key.trim();
|
|
2654
|
+
const licenseKeyPattern = /^[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}$/;
|
|
2655
|
+
if (!licenseKeyPattern.test(trimmedKey)) {
|
|
2656
|
+
return false;
|
|
2657
|
+
}
|
|
2658
|
+
if (trimmedKey.length !== 29) {
|
|
2659
|
+
return false;
|
|
2660
|
+
}
|
|
2661
|
+
if (trimmedKey.includes("--") || /[^A-Z0-9-]/.test(trimmedKey)) {
|
|
2662
|
+
return false;
|
|
2663
|
+
}
|
|
2664
|
+
return true;
|
|
2665
|
+
}
|
|
2666
|
+
|
|
2667
|
+
// ../../node_modules/.pnpm/@eventcatalog+license@0.0.5/node_modules/@eventcatalog/license/dist/plans.js
|
|
2668
|
+
var isFeatureEnabled2 = async (feature, key) => {
|
|
2669
|
+
if (hasOfflineLicenseKey()) {
|
|
2670
|
+
await verifyOfflineLicense();
|
|
2671
|
+
return isFeatureEnabled(feature);
|
|
2672
|
+
}
|
|
2673
|
+
if (!key) {
|
|
2674
|
+
return false;
|
|
2675
|
+
}
|
|
2676
|
+
return verifyOnlineLicense(key, feature);
|
|
2677
|
+
};
|
|
2678
|
+
|
|
2679
|
+
// ../../shared/checkLicense.ts
|
|
2680
|
+
var checkLicense_default = async (pkgName, licenseKey) => {
|
|
2681
|
+
if (!hasOfflineLicenseKey() && !licenseKey) {
|
|
2682
|
+
console.log(chalk3.bgRed(`
|
|
2683
|
+
No license key provided for ${pkgName}`));
|
|
2684
|
+
console.log(chalk3.redBright("You can get a free 14 day trial license at https://eventcatalog.cloud/"));
|
|
2685
|
+
process.exit(1);
|
|
2686
|
+
}
|
|
2687
|
+
try {
|
|
2688
|
+
const featureEnabled = await isFeatureEnabled2(pkgName, licenseKey);
|
|
2689
|
+
if (!featureEnabled) {
|
|
2690
|
+
console.log(chalk3.bgRed(`
|
|
2691
|
+
Invalid license key`));
|
|
2692
|
+
console.log(chalk3.redBright("Please check your plugin license key or purchase a license at https://eventcatalog.cloud/"));
|
|
2693
|
+
process.exit(1);
|
|
2694
|
+
}
|
|
2695
|
+
return Promise.resolve();
|
|
2696
|
+
} catch (error) {
|
|
2697
|
+
console.log(error);
|
|
2698
|
+
console.log(chalk3.bgRed(`
|
|
2699
|
+
Failed to verify license key`));
|
|
2700
|
+
console.log(chalk3.redBright("Please check your plugin license key or purchase a license at https://eventcatalog.cloud/"));
|
|
2701
|
+
process.exit(1);
|
|
2643
2702
|
}
|
|
2644
|
-
return Promise.resolve();
|
|
2645
2703
|
};
|
|
2646
2704
|
|
|
2647
2705
|
// src/index.ts
|
|
@@ -2774,45 +2832,45 @@ var index_default = async (config, options) => {
|
|
|
2774
2832
|
};
|
|
2775
2833
|
validateOptions(options);
|
|
2776
2834
|
const { services, saveParsedSpecFile = false, parseSchemas = true, parseChannels = false } = options;
|
|
2777
|
-
console.log(
|
|
2835
|
+
console.log(chalk4.green(`Processing ${services.length} AsyncAPI files...`));
|
|
2778
2836
|
for (const service of services) {
|
|
2779
|
-
console.log(
|
|
2780
|
-
const { document
|
|
2837
|
+
console.log(chalk4.gray(`Processing ${service.path}`));
|
|
2838
|
+
const { document, diagnostics } = service.path.startsWith("http") ? await fromURL(parser, service.path).parse({
|
|
2781
2839
|
parseSchemas
|
|
2782
2840
|
}) : await fromFile(parser, service.path).parse({
|
|
2783
2841
|
parseSchemas
|
|
2784
2842
|
});
|
|
2785
|
-
if (!
|
|
2786
|
-
console.log(
|
|
2843
|
+
if (!document) {
|
|
2844
|
+
console.log(chalk4.red("Failed to parse AsyncAPI file"));
|
|
2787
2845
|
if (options.debug || cliArgs.debug) {
|
|
2788
2846
|
console.log(diagnostics);
|
|
2789
2847
|
} else {
|
|
2790
|
-
console.log(
|
|
2848
|
+
console.log(chalk4.red("Run with debug option in the generator to see diagnostics"));
|
|
2791
2849
|
}
|
|
2792
2850
|
continue;
|
|
2793
2851
|
}
|
|
2794
|
-
const operations =
|
|
2795
|
-
const channels =
|
|
2796
|
-
const documentTags =
|
|
2852
|
+
const operations = document.allOperations();
|
|
2853
|
+
const channels = document.allChannels();
|
|
2854
|
+
const documentTags = document.info().tags().all() || [];
|
|
2797
2855
|
const isDomainMarkedAsDraft = options.domain?.draft || false;
|
|
2798
|
-
const isServiceMarkedAsDraft = isDomainMarkedAsDraft ||
|
|
2856
|
+
const isServiceMarkedAsDraft = isDomainMarkedAsDraft || document.info().extensions().get("x-eventcatalog-draft")?.value() || service.draft || false;
|
|
2799
2857
|
const serviceId = service.id;
|
|
2800
|
-
const serviceName = service.name ||
|
|
2801
|
-
const version =
|
|
2858
|
+
const serviceName = service.name || document.info().title();
|
|
2859
|
+
const version = document.info().version();
|
|
2802
2860
|
let sends = [];
|
|
2803
2861
|
let receives = [];
|
|
2804
2862
|
let owners = service.owners || null;
|
|
2805
2863
|
let repository = null;
|
|
2806
2864
|
let serviceSpecifications = {};
|
|
2807
2865
|
let serviceSpecificationsFiles = [];
|
|
2808
|
-
const generatedMarkdownForService = defaultMarkdown2(
|
|
2866
|
+
const generatedMarkdownForService = defaultMarkdown2(document);
|
|
2809
2867
|
let serviceMarkdown = service.generateMarkdown ? service.generateMarkdown({
|
|
2810
2868
|
service: { id: service.id, name: serviceName, version },
|
|
2811
|
-
document
|
|
2869
|
+
document,
|
|
2812
2870
|
markdown: generatedMarkdownForService
|
|
2813
2871
|
}) : generatedMarkdownForService;
|
|
2814
2872
|
let styles2 = null;
|
|
2815
|
-
let servicePath = options.domain ?
|
|
2873
|
+
let servicePath = options.domain ? path3.join("../", "domains", options.domain.id, "services", service.id) : path3.join("../", "services", service.id);
|
|
2816
2874
|
if (options.writeFilesToRoot) {
|
|
2817
2875
|
servicePath = service.id;
|
|
2818
2876
|
}
|
|
@@ -2821,14 +2879,14 @@ var index_default = async (config, options) => {
|
|
|
2821
2879
|
const domain = await getDomain(options.domain.id, domainVersion || "latest");
|
|
2822
2880
|
const currentDomain = await getDomain(options.domain.id, "latest");
|
|
2823
2881
|
const domainIsDraft = isDomainMarkedAsDraft || currentDomain?.draft || false;
|
|
2824
|
-
console.log(
|
|
2882
|
+
console.log(chalk4.blue(`
|
|
2825
2883
|
Processing domain: ${domainName} (v${domainVersion})`));
|
|
2826
2884
|
if (currentDomain && currentDomain.version !== domainVersion) {
|
|
2827
2885
|
await versionDomain(domainId);
|
|
2828
|
-
console.log(
|
|
2886
|
+
console.log(chalk4.cyan(` - Versioned previous domain (v${currentDomain.version})`));
|
|
2829
2887
|
}
|
|
2830
2888
|
if (!domain || domain && domain.version !== domainVersion) {
|
|
2831
|
-
const generatedMarkdownForDomain = defaultMarkdown3(
|
|
2889
|
+
const generatedMarkdownForDomain = defaultMarkdown3(document);
|
|
2832
2890
|
await writeDomain({
|
|
2833
2891
|
id: domainId,
|
|
2834
2892
|
name: domainName,
|
|
@@ -2838,10 +2896,10 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
2838
2896
|
...domainIsDraft && { draft: true }
|
|
2839
2897
|
// services: [{ id: serviceId, version: version }],
|
|
2840
2898
|
});
|
|
2841
|
-
console.log(
|
|
2899
|
+
console.log(chalk4.cyan(` - Domain (v${domainVersion}) created`));
|
|
2842
2900
|
}
|
|
2843
2901
|
if (currentDomain && currentDomain.version === domainVersion) {
|
|
2844
|
-
console.log(
|
|
2902
|
+
console.log(chalk4.yellow(` - Domain (v${domainVersion}) already exists, skipped creation...`));
|
|
2845
2903
|
}
|
|
2846
2904
|
await addServiceToDomain(domainId, { id: serviceId, version }, domainVersion);
|
|
2847
2905
|
}
|
|
@@ -2851,9 +2909,10 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
2851
2909
|
const channelId = channel.id();
|
|
2852
2910
|
const params = channelAsJSON?.parameters || {};
|
|
2853
2911
|
const protocols = getChannelProtocols(channel);
|
|
2912
|
+
const channelTags = getChannelTags(channel);
|
|
2854
2913
|
const channelVersion = channel.extensions().get("x-eventcatalog-channel-version")?.value() || version;
|
|
2855
|
-
let channelMarkdown = defaultMarkdown4(
|
|
2856
|
-
console.log(
|
|
2914
|
+
let channelMarkdown = defaultMarkdown4(document, channel);
|
|
2915
|
+
console.log(chalk4.blue(`Processing channel: ${channelId} (v${channelVersion})`));
|
|
2857
2916
|
const paramsForCatalog = Object.keys(params).reduce(
|
|
2858
2917
|
(acc, key) => {
|
|
2859
2918
|
const param = params[key];
|
|
@@ -2871,7 +2930,7 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
2871
2930
|
channelMarkdown = catalogedChannel.markdown;
|
|
2872
2931
|
if (catalogedChannel.version !== channelVersion) {
|
|
2873
2932
|
await versionChannel(channelId);
|
|
2874
|
-
console.log(
|
|
2933
|
+
console.log(chalk4.cyan(` - Versioned previous channel: ${channelId} (v${channelVersion})`));
|
|
2875
2934
|
}
|
|
2876
2935
|
}
|
|
2877
2936
|
await writeChannel(
|
|
@@ -2883,25 +2942,28 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
2883
2942
|
...Object.keys(paramsForCatalog).length > 0 && { parameters: paramsForCatalog },
|
|
2884
2943
|
...channel.address() && { address: channel.address() },
|
|
2885
2944
|
...channelAsJSON?.summary && { summary: channelAsJSON.summary },
|
|
2945
|
+
...channelTags.length > 0 && {
|
|
2946
|
+
badges: channelTags.map((tagName) => ({ content: tagName, textColor: "blue", backgroundColor: "blue" }))
|
|
2947
|
+
},
|
|
2886
2948
|
...protocols.length > 0 && { protocols },
|
|
2887
2949
|
...(isDomainMarkedAsDraft || isServiceMarkedAsDraft) && { draft: true }
|
|
2888
2950
|
},
|
|
2889
2951
|
{ override: true }
|
|
2890
2952
|
);
|
|
2891
|
-
console.log(
|
|
2953
|
+
console.log(chalk4.cyan(` - Message ${channelId} (v${version}) created`));
|
|
2892
2954
|
}
|
|
2893
2955
|
}
|
|
2894
2956
|
for (const operation of operations) {
|
|
2895
|
-
for (const
|
|
2896
|
-
const eventType =
|
|
2897
|
-
const messageVersion =
|
|
2898
|
-
const deprecatedDate =
|
|
2899
|
-
const deprecatedMessage =
|
|
2900
|
-
const isMessageMarkedAsDraft = isDomainMarkedAsDraft || isServiceMarkedAsDraft ||
|
|
2901
|
-
const serviceOwnsMessageContract = isServiceMessageOwner(
|
|
2957
|
+
for (const message2 of operation.messages()) {
|
|
2958
|
+
const eventType = message2.extensions().get("x-eventcatalog-message-type")?.value() || "event";
|
|
2959
|
+
const messageVersion = message2.extensions().get("x-eventcatalog-message-version")?.value() || version;
|
|
2960
|
+
const deprecatedDate = message2.extensions().get("x-eventcatalog-deprecated-date")?.value() || null;
|
|
2961
|
+
const deprecatedMessage = message2.extensions().get("x-eventcatalog-deprecated-message")?.value() || null;
|
|
2962
|
+
const isMessageMarkedAsDraft = isDomainMarkedAsDraft || isServiceMarkedAsDraft || message2.extensions().get("x-eventcatalog-draft")?.value() || null;
|
|
2963
|
+
const serviceOwnsMessageContract = isServiceMessageOwner(message2);
|
|
2902
2964
|
const isReceived = operation.action() === "receive" || operation.action() === "subscribe";
|
|
2903
2965
|
const isSent = operation.action() === "send" || operation.action() === "publish";
|
|
2904
|
-
const messageId =
|
|
2966
|
+
const messageId = message2.id().toLowerCase();
|
|
2905
2967
|
if (eventType !== "event" && eventType !== "command" && eventType !== "query") {
|
|
2906
2968
|
throw new Error("Invalid message type");
|
|
2907
2969
|
}
|
|
@@ -2912,33 +2974,33 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
2912
2974
|
addSchema: addSchemaToMessage,
|
|
2913
2975
|
collection: folder
|
|
2914
2976
|
} = MESSAGE_OPERATIONS[eventType];
|
|
2915
|
-
const generatedMarkdownForMessage = defaultMarkdown(
|
|
2916
|
-
let messageMarkdown = options.messages?.generateMarkdown ? options.messages.generateMarkdown({ message, document
|
|
2917
|
-
const badges =
|
|
2918
|
-
console.log(
|
|
2919
|
-
let messagePath = join(servicePath, folder,
|
|
2977
|
+
const generatedMarkdownForMessage = defaultMarkdown(document, message2);
|
|
2978
|
+
let messageMarkdown = options.messages?.generateMarkdown ? options.messages.generateMarkdown({ message: message2, document, markdown: generatedMarkdownForMessage }) : generatedMarkdownForMessage;
|
|
2979
|
+
const badges = message2.tags().all() || [];
|
|
2980
|
+
console.log(chalk4.blue(`Processing message: ${getMessageName(message2)} (v${messageVersion})`));
|
|
2981
|
+
let messagePath = join(servicePath, folder, message2.id());
|
|
2920
2982
|
if (options.writeFilesToRoot) {
|
|
2921
|
-
messagePath =
|
|
2983
|
+
messagePath = message2.id();
|
|
2922
2984
|
}
|
|
2923
2985
|
if (serviceOwnsMessageContract) {
|
|
2924
|
-
const catalogedMessage = await getMessage(
|
|
2986
|
+
const catalogedMessage = await getMessage(message2.id().toLowerCase(), "latest");
|
|
2925
2987
|
if (catalogedMessage) {
|
|
2926
2988
|
messageMarkdown = catalogedMessage.markdown;
|
|
2927
2989
|
if (catalogedMessage.version !== messageVersion) {
|
|
2928
2990
|
await versionMessage(messageId);
|
|
2929
|
-
console.log(
|
|
2991
|
+
console.log(chalk4.cyan(` - Versioned previous message: (v${catalogedMessage.version})`));
|
|
2930
2992
|
}
|
|
2931
2993
|
}
|
|
2932
|
-
const channelsForMessage = parseChannels ? getChannelsForMessage(
|
|
2994
|
+
const channelsForMessage = parseChannels ? getChannelsForMessage(message2, channels, document) : [];
|
|
2933
2995
|
await writeMessage(
|
|
2934
2996
|
{
|
|
2935
2997
|
id: messageId,
|
|
2936
2998
|
version: messageVersion,
|
|
2937
|
-
name: getMessageName(
|
|
2938
|
-
summary: getSummary(
|
|
2999
|
+
name: getMessageName(message2),
|
|
3000
|
+
summary: getSummary(message2),
|
|
2939
3001
|
markdown: messageMarkdown,
|
|
2940
3002
|
badges: badges.map((badge) => ({ content: badge.name(), textColor: "blue", backgroundColor: "blue" })),
|
|
2941
|
-
...messageHasSchema(
|
|
3003
|
+
...messageHasSchema(message2) && { schemaPath: getSchemaFileName(message2) },
|
|
2942
3004
|
...owners && { owners },
|
|
2943
3005
|
...channelsForMessage.length > 0 && { channels: channelsForMessage },
|
|
2944
3006
|
...deprecatedDate && {
|
|
@@ -2951,31 +3013,31 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
2951
3013
|
path: messagePath
|
|
2952
3014
|
}
|
|
2953
3015
|
);
|
|
2954
|
-
console.log(
|
|
2955
|
-
if (messageHasSchema(
|
|
2956
|
-
let schema =
|
|
3016
|
+
console.log(chalk4.cyan(` - Message (v${messageVersion}) created`));
|
|
3017
|
+
if (messageHasSchema(message2)) {
|
|
3018
|
+
let schema = message2.payload()?.extensions()?.get("x-parser-original-payload")?.json() || message2.payload()?.json();
|
|
2957
3019
|
if (schema?.schema) {
|
|
2958
3020
|
schema = schema.schema;
|
|
2959
3021
|
}
|
|
2960
3022
|
await addSchemaToMessage(
|
|
2961
3023
|
messageId,
|
|
2962
3024
|
{
|
|
2963
|
-
fileName: getSchemaFileName(
|
|
3025
|
+
fileName: getSchemaFileName(message2),
|
|
2964
3026
|
schema: JSON.stringify(schema, null, 4)
|
|
2965
3027
|
},
|
|
2966
3028
|
messageVersion
|
|
2967
3029
|
);
|
|
2968
|
-
console.log(
|
|
3030
|
+
console.log(chalk4.cyan(` - Schema added to message (v${messageVersion})`));
|
|
2969
3031
|
}
|
|
2970
3032
|
} else {
|
|
2971
|
-
console.log(
|
|
3033
|
+
console.log(chalk4.yellow(` - Skipping external message: ${getMessageName(message2)}(v${messageVersion})`));
|
|
2972
3034
|
}
|
|
2973
3035
|
if (isSent) sends.push({ id: messageId, version: messageVersion });
|
|
2974
3036
|
if (isReceived) receives.push({ id: messageId, version: messageVersion });
|
|
2975
3037
|
}
|
|
2976
3038
|
}
|
|
2977
3039
|
const latestServiceInCatalog = await getService(serviceId, "latest");
|
|
2978
|
-
console.log(
|
|
3040
|
+
console.log(chalk4.blue(`Processing service: ${serviceId} (v${version})`));
|
|
2979
3041
|
if (latestServiceInCatalog) {
|
|
2980
3042
|
serviceMarkdown = latestServiceInCatalog.markdown;
|
|
2981
3043
|
owners = latestServiceInCatalog.owners || owners;
|
|
@@ -2983,7 +3045,7 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
2983
3045
|
styles2 = latestServiceInCatalog.styles || null;
|
|
2984
3046
|
if (latestServiceInCatalog.version !== version) {
|
|
2985
3047
|
await versionService(serviceId);
|
|
2986
|
-
console.log(
|
|
3048
|
+
console.log(chalk4.cyan(` - Versioned previous service (v${latestServiceInCatalog.version})`));
|
|
2987
3049
|
}
|
|
2988
3050
|
if (latestServiceInCatalog.version === version) {
|
|
2989
3051
|
serviceMarkdown = latestServiceInCatalog.markdown;
|
|
@@ -2993,14 +3055,14 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
2993
3055
|
serviceSpecificationsFiles = await getSpecificationFilesForService(serviceId, version);
|
|
2994
3056
|
}
|
|
2995
3057
|
}
|
|
2996
|
-
const fileName =
|
|
3058
|
+
const fileName = path3.basename(service.path);
|
|
2997
3059
|
await writeService(
|
|
2998
3060
|
{
|
|
2999
3061
|
id: serviceId,
|
|
3000
3062
|
name: serviceName,
|
|
3001
3063
|
version,
|
|
3002
|
-
summary: getSummary2(
|
|
3003
|
-
badges: documentTags.map((
|
|
3064
|
+
summary: getSummary2(document),
|
|
3065
|
+
badges: documentTags.map((tag2) => ({ content: tag2.name(), textColor: "blue", backgroundColor: "blue" })),
|
|
3004
3066
|
markdown: serviceMarkdown,
|
|
3005
3067
|
sends,
|
|
3006
3068
|
receives,
|
|
@@ -3023,8 +3085,8 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
3023
3085
|
// add any previous spec files to the list
|
|
3024
3086
|
...serviceSpecificationsFiles,
|
|
3025
3087
|
{
|
|
3026
|
-
content: saveParsedSpecFile ? getParsedSpecFile(service,
|
|
3027
|
-
fileName:
|
|
3088
|
+
content: saveParsedSpecFile ? getParsedSpecFile(service, document) : await getRawSpecFile(service),
|
|
3089
|
+
fileName: path3.basename(service.path) || "asyncapi.yml"
|
|
3028
3090
|
}
|
|
3029
3091
|
];
|
|
3030
3092
|
for (const specFile of specFiles) {
|
|
@@ -3037,14 +3099,14 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
3037
3099
|
version
|
|
3038
3100
|
);
|
|
3039
3101
|
}
|
|
3040
|
-
console.log(
|
|
3041
|
-
console.log(
|
|
3102
|
+
console.log(chalk4.cyan(` - Service (v${version}) created`));
|
|
3103
|
+
console.log(chalk4.green(`
|
|
3042
3104
|
Finished generating event catalog for AsyncAPI ${serviceId} (v${version})`));
|
|
3043
3105
|
}
|
|
3044
3106
|
};
|
|
3045
|
-
var getParsedSpecFile = (service,
|
|
3107
|
+
var getParsedSpecFile = (service, document) => {
|
|
3046
3108
|
const isSpecFileJSON = service.path.endsWith(".json");
|
|
3047
|
-
return isSpecFileJSON ? JSON.stringify(
|
|
3109
|
+
return isSpecFileJSON ? JSON.stringify(document.meta().asyncapi.parsed, null, 4) : yaml.dump(document.meta().asyncapi.parsed, { noRefs: true });
|
|
3048
3110
|
};
|
|
3049
3111
|
var getRawSpecFile = async (service) => {
|
|
3050
3112
|
if (service.path.startsWith("http")) {
|
|
@@ -3052,7 +3114,7 @@ var getRawSpecFile = async (service) => {
|
|
|
3052
3114
|
const response = await fetch(service.path);
|
|
3053
3115
|
return response.text();
|
|
3054
3116
|
} catch (error) {
|
|
3055
|
-
console.log(
|
|
3117
|
+
console.log(chalk4.red(`
|
|
3056
3118
|
Failed to request AsyncAPI file from ${service.path}`));
|
|
3057
3119
|
return "";
|
|
3058
3120
|
}
|
|
@@ -3060,8 +3122,8 @@ Failed to request AsyncAPI file from ${service.path}`));
|
|
|
3060
3122
|
return await readFile(service.path, "utf8");
|
|
3061
3123
|
}
|
|
3062
3124
|
};
|
|
3063
|
-
var isServiceMessageOwner = (
|
|
3064
|
-
const value =
|
|
3125
|
+
var isServiceMessageOwner = (message2) => {
|
|
3126
|
+
const value = message2.extensions().get("x-eventcatalog-role")?.value() || "provider";
|
|
3065
3127
|
return value === "provider";
|
|
3066
3128
|
};
|
|
3067
3129
|
export {
|