@eventcatalog/generator-asyncapi 4.0.3 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/index.js +1295 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1305 -39
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
- package/dist/checkLicense.d.mts +0 -3
- package/dist/checkLicense.d.ts +0 -3
- package/dist/checkLicense.js +0 -131
- package/dist/checkLicense.js.map +0 -1
- package/dist/checkLicense.mjs +0 -100
- package/dist/checkLicense.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,13 @@ 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
|
|
7
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
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() {
|
|
8
14
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
15
|
};
|
|
10
16
|
var __copyProps = (to, from, except, desc) => {
|
|
@@ -277,10 +283,1250 @@ var require_ansi_align = __commonJS({
|
|
|
277
283
|
}
|
|
278
284
|
});
|
|
279
285
|
|
|
286
|
+
// ../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js
|
|
287
|
+
var require_ms = __commonJS({
|
|
288
|
+
"../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js"(exports, module) {
|
|
289
|
+
"use strict";
|
|
290
|
+
var s = 1e3;
|
|
291
|
+
var m = s * 60;
|
|
292
|
+
var h = m * 60;
|
|
293
|
+
var d = h * 24;
|
|
294
|
+
var w = d * 7;
|
|
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
|
+
});
|
|
402
|
+
|
|
403
|
+
// ../../node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/common.js
|
|
404
|
+
var require_common = __commonJS({
|
|
405
|
+
"../../node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/common.js"(exports, module) {
|
|
406
|
+
"use strict";
|
|
407
|
+
function setup(env) {
|
|
408
|
+
createDebug.debug = createDebug;
|
|
409
|
+
createDebug.default = createDebug;
|
|
410
|
+
createDebug.coerce = coerce;
|
|
411
|
+
createDebug.disable = disable;
|
|
412
|
+
createDebug.enable = enable;
|
|
413
|
+
createDebug.enabled = enabled;
|
|
414
|
+
createDebug.humanize = require_ms();
|
|
415
|
+
createDebug.destroy = destroy;
|
|
416
|
+
Object.keys(env).forEach((key) => {
|
|
417
|
+
createDebug[key] = env[key];
|
|
418
|
+
});
|
|
419
|
+
createDebug.names = [];
|
|
420
|
+
createDebug.skips = [];
|
|
421
|
+
createDebug.formatters = {};
|
|
422
|
+
function selectColor(namespace) {
|
|
423
|
+
let hash = 0;
|
|
424
|
+
for (let i = 0; i < namespace.length; i++) {
|
|
425
|
+
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
426
|
+
hash |= 0;
|
|
427
|
+
}
|
|
428
|
+
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
429
|
+
}
|
|
430
|
+
createDebug.selectColor = selectColor;
|
|
431
|
+
function createDebug(namespace) {
|
|
432
|
+
let prevTime;
|
|
433
|
+
let enableOverride = null;
|
|
434
|
+
let namespacesCache;
|
|
435
|
+
let enabledCache;
|
|
436
|
+
function debug(...args) {
|
|
437
|
+
if (!debug.enabled) {
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
const self = debug;
|
|
441
|
+
const curr = Number(/* @__PURE__ */ new Date());
|
|
442
|
+
const ms = curr - (prevTime || curr);
|
|
443
|
+
self.diff = ms;
|
|
444
|
+
self.prev = prevTime;
|
|
445
|
+
self.curr = curr;
|
|
446
|
+
prevTime = curr;
|
|
447
|
+
args[0] = createDebug.coerce(args[0]);
|
|
448
|
+
if (typeof args[0] !== "string") {
|
|
449
|
+
args.unshift("%O");
|
|
450
|
+
}
|
|
451
|
+
let index = 0;
|
|
452
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
453
|
+
if (match === "%%") {
|
|
454
|
+
return "%";
|
|
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;
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
// ../../node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/browser.js
|
|
582
|
+
var require_browser = __commonJS({
|
|
583
|
+
"../../node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/browser.js"(exports, module) {
|
|
584
|
+
"use strict";
|
|
585
|
+
exports.formatArgs = formatArgs;
|
|
586
|
+
exports.save = save;
|
|
587
|
+
exports.load = load;
|
|
588
|
+
exports.useColors = useColors;
|
|
589
|
+
exports.storage = localstorage();
|
|
590
|
+
exports.destroy = /* @__PURE__ */ (() => {
|
|
591
|
+
let warned = false;
|
|
592
|
+
return () => {
|
|
593
|
+
if (!warned) {
|
|
594
|
+
warned = true;
|
|
595
|
+
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
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
|
+
};
|
|
749
|
+
}
|
|
750
|
+
});
|
|
751
|
+
|
|
752
|
+
// ../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js
|
|
753
|
+
var require_has_flag = __commonJS({
|
|
754
|
+
"../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js"(exports, module) {
|
|
755
|
+
"use strict";
|
|
756
|
+
module.exports = (flag, argv2 = process.argv) => {
|
|
757
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
758
|
+
const position = argv2.indexOf(prefix + flag);
|
|
759
|
+
const terminatorPosition = argv2.indexOf("--");
|
|
760
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
});
|
|
764
|
+
|
|
765
|
+
// ../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js
|
|
766
|
+
var require_supports_color = __commonJS({
|
|
767
|
+
"../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js"(exports, module) {
|
|
768
|
+
"use strict";
|
|
769
|
+
var os = __require("os");
|
|
770
|
+
var tty = __require("tty");
|
|
771
|
+
var hasFlag = require_has_flag();
|
|
772
|
+
var { env } = process;
|
|
773
|
+
var forceColor;
|
|
774
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
775
|
+
forceColor = 0;
|
|
776
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
777
|
+
forceColor = 1;
|
|
778
|
+
}
|
|
779
|
+
if ("FORCE_COLOR" in env) {
|
|
780
|
+
if (env.FORCE_COLOR === "true") {
|
|
781
|
+
forceColor = 1;
|
|
782
|
+
} else if (env.FORCE_COLOR === "false") {
|
|
783
|
+
forceColor = 0;
|
|
784
|
+
} else {
|
|
785
|
+
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
function translateLevel(level) {
|
|
789
|
+
if (level === 0) {
|
|
790
|
+
return false;
|
|
791
|
+
}
|
|
792
|
+
return {
|
|
793
|
+
level,
|
|
794
|
+
hasBasic: true,
|
|
795
|
+
has256: level >= 2,
|
|
796
|
+
has16m: level >= 3
|
|
797
|
+
};
|
|
798
|
+
}
|
|
799
|
+
function supportsColor(haveStream, streamIsTTY) {
|
|
800
|
+
if (forceColor === 0) {
|
|
801
|
+
return 0;
|
|
802
|
+
}
|
|
803
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
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;
|
|
854
|
+
}
|
|
855
|
+
function getSupportLevel(stream) {
|
|
856
|
+
const level = supportsColor(stream, stream && stream.isTTY);
|
|
857
|
+
return translateLevel(level);
|
|
858
|
+
}
|
|
859
|
+
module.exports = {
|
|
860
|
+
supportsColor: getSupportLevel,
|
|
861
|
+
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
|
862
|
+
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|
863
|
+
};
|
|
864
|
+
}
|
|
865
|
+
});
|
|
866
|
+
|
|
867
|
+
// ../../node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/node.js
|
|
868
|
+
var require_node = __commonJS({
|
|
869
|
+
"../../node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/node.js"(exports, module) {
|
|
870
|
+
"use strict";
|
|
871
|
+
var tty = __require("tty");
|
|
872
|
+
var util = __require("util");
|
|
873
|
+
exports.init = init;
|
|
874
|
+
exports.log = log;
|
|
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
|
+
};
|
|
1039
|
+
}
|
|
1040
|
+
});
|
|
1041
|
+
|
|
1042
|
+
// ../../node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/index.js
|
|
1043
|
+
var require_src = __commonJS({
|
|
1044
|
+
"../../node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/index.js"(exports, module) {
|
|
1045
|
+
"use strict";
|
|
1046
|
+
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
|
|
1047
|
+
module.exports = require_browser();
|
|
1048
|
+
} else {
|
|
1049
|
+
module.exports = require_node();
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
});
|
|
1053
|
+
|
|
1054
|
+
// ../../node_modules/.pnpm/agent-base@7.1.3/node_modules/agent-base/dist/helpers.js
|
|
1055
|
+
var require_helpers = __commonJS({
|
|
1056
|
+
"../../node_modules/.pnpm/agent-base@7.1.3/node_modules/agent-base/dist/helpers.js"(exports) {
|
|
1057
|
+
"use strict";
|
|
1058
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
1059
|
+
if (k2 === void 0) k2 = k;
|
|
1060
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1061
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1062
|
+
desc = { enumerable: true, get: function() {
|
|
1063
|
+
return m[k];
|
|
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;
|
|
1121
|
+
}
|
|
1122
|
+
});
|
|
1123
|
+
|
|
1124
|
+
// ../../node_modules/.pnpm/agent-base@7.1.3/node_modules/agent-base/dist/index.js
|
|
1125
|
+
var require_dist = __commonJS({
|
|
1126
|
+
"../../node_modules/.pnpm/agent-base@7.1.3/node_modules/agent-base/dist/index.js"(exports) {
|
|
1127
|
+
"use strict";
|
|
1128
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
1129
|
+
if (k2 === void 0) k2 = k;
|
|
1130
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
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 = typeof options.secureEndpoint === "boolean" ? options.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;
|
|
1277
|
+
}
|
|
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;
|
|
1373
|
+
}
|
|
1374
|
+
});
|
|
1375
|
+
|
|
1376
|
+
// ../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js
|
|
1377
|
+
var require_dist2 = __commonJS({
|
|
1378
|
+
"../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js"(exports) {
|
|
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;
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
});
|
|
1525
|
+
|
|
280
1526
|
// src/index.ts
|
|
281
1527
|
import { Parser, fromFile, fromURL } from "@asyncapi/parser";
|
|
282
1528
|
import utils from "@eventcatalog/sdk";
|
|
283
|
-
import { readFile } from "
|
|
1529
|
+
import { readFile } from "fs/promises";
|
|
284
1530
|
import argv from "minimist";
|
|
285
1531
|
import yaml from "js-yaml";
|
|
286
1532
|
import { z } from "zod";
|
|
@@ -290,7 +1536,7 @@ import path2 from "path";
|
|
|
290
1536
|
// package.json
|
|
291
1537
|
var package_default = {
|
|
292
1538
|
name: "@eventcatalog/generator-asyncapi",
|
|
293
|
-
version: "4.0
|
|
1539
|
+
version: "4.2.0",
|
|
294
1540
|
description: "AsyncAPI generator for EventCatalog",
|
|
295
1541
|
scripts: {
|
|
296
1542
|
build: "tsup",
|
|
@@ -336,6 +1582,7 @@ var package_default = {
|
|
|
336
1582
|
"js-yaml": "^4.1.0",
|
|
337
1583
|
lodash: "^4.17.21",
|
|
338
1584
|
minimist: "^1.2.8",
|
|
1585
|
+
"node-fetch": "^3.3.2",
|
|
339
1586
|
slugify: "^1.6.6",
|
|
340
1587
|
"update-notifier": "^7.3.1",
|
|
341
1588
|
zod: "^3.23.8"
|
|
@@ -343,7 +1590,7 @@ var package_default = {
|
|
|
343
1590
|
};
|
|
344
1591
|
|
|
345
1592
|
// ../../node_modules/.pnpm/boxen@8.0.1/node_modules/boxen/index.js
|
|
346
|
-
import process2 from "
|
|
1593
|
+
import process2 from "process";
|
|
347
1594
|
|
|
348
1595
|
// ../../node_modules/.pnpm/ansi-regex@6.1.0/node_modules/ansi-regex/index.js
|
|
349
1596
|
function ansiRegex({ onlyFirst = false } = {}) {
|
|
@@ -1258,9 +2505,9 @@ var getSchemaFileName = (message) => {
|
|
|
1258
2505
|
var getMessageName = (message) => {
|
|
1259
2506
|
return message.hasTitle() && message.title() ? message.title() : message.id();
|
|
1260
2507
|
};
|
|
1261
|
-
var getChannelsForMessage = (message, channels,
|
|
2508
|
+
var getChannelsForMessage = (message, channels, document2) => {
|
|
1262
2509
|
let channelsForMessage = [];
|
|
1263
|
-
const globalVersion =
|
|
2510
|
+
const globalVersion = document2.info().version();
|
|
1264
2511
|
for (const channel of channels) {
|
|
1265
2512
|
for (const channelMessage of channel.messages()) {
|
|
1266
2513
|
if (channelMessage.id() === message.id()) {
|
|
@@ -1284,27 +2531,27 @@ var getChannelsForMessage = (message, channels, document) => {
|
|
|
1284
2531
|
};
|
|
1285
2532
|
|
|
1286
2533
|
// src/utils/services.ts
|
|
1287
|
-
var defaultMarkdown2 = (
|
|
2534
|
+
var defaultMarkdown2 = (document2) => {
|
|
1288
2535
|
return `
|
|
1289
2536
|
|
|
1290
|
-
${
|
|
2537
|
+
${document2.info().hasDescription() ? `${document2.info().description()}` : ""}
|
|
1291
2538
|
|
|
1292
2539
|
## Architecture diagram
|
|
1293
2540
|
<NodeGraph />
|
|
1294
2541
|
|
|
1295
|
-
${
|
|
2542
|
+
${document2.info().externalDocs() ? `
|
|
1296
2543
|
## External documentation
|
|
1297
|
-
- [${
|
|
2544
|
+
- [${document2.info().externalDocs()?.description()}](${document2.info().externalDocs()?.url()})
|
|
1298
2545
|
` : ""}
|
|
1299
2546
|
`;
|
|
1300
2547
|
};
|
|
1301
|
-
var getSummary2 = (
|
|
1302
|
-
const summary =
|
|
2548
|
+
var getSummary2 = (document2) => {
|
|
2549
|
+
const summary = document2.info().hasDescription() ? document2.info().description() : "";
|
|
1303
2550
|
return summary && summary.length < 150 ? summary : "";
|
|
1304
2551
|
};
|
|
1305
2552
|
|
|
1306
2553
|
// src/utils/domains.ts
|
|
1307
|
-
var defaultMarkdown3 = (
|
|
2554
|
+
var defaultMarkdown3 = (document2) => {
|
|
1308
2555
|
return `
|
|
1309
2556
|
|
|
1310
2557
|
## Architecture diagram
|
|
@@ -1339,24 +2586,42 @@ var defaultMarkdown4 = (_document, channel) => {
|
|
|
1339
2586
|
`;
|
|
1340
2587
|
};
|
|
1341
2588
|
|
|
1342
|
-
//
|
|
2589
|
+
// ../../shared/checkLicense.ts
|
|
2590
|
+
var import_https_proxy_agent = __toESM(require_dist2());
|
|
2591
|
+
import fetch2 from "node-fetch";
|
|
1343
2592
|
import chalk2 from "chalk";
|
|
1344
|
-
var checkLicense_default = async (licenseKey) => {
|
|
1345
|
-
const
|
|
1346
|
-
if (!
|
|
2593
|
+
var checkLicense_default = async (pkgName, licenseKey) => {
|
|
2594
|
+
const PROXY_SERVER_URI = process.env.PROXY_SERVER_URI || null;
|
|
2595
|
+
if (!licenseKey) {
|
|
1347
2596
|
console.log(chalk2.bgRed(`
|
|
1348
2597
|
This plugin requires a license key to use`));
|
|
1349
2598
|
console.log(chalk2.redBright(`
|
|
1350
2599
|
Visit https://eventcatalog.cloud/ to get a 14 day trial or purchase a license`));
|
|
1351
2600
|
process.exit(1);
|
|
1352
2601
|
}
|
|
1353
|
-
const
|
|
2602
|
+
const fetchOptions = {
|
|
1354
2603
|
method: "POST",
|
|
1355
2604
|
headers: {
|
|
1356
|
-
Authorization: `Bearer ${
|
|
2605
|
+
Authorization: `Bearer ${licenseKey}`,
|
|
1357
2606
|
"Content-Type": "application/json"
|
|
1358
2607
|
}
|
|
1359
|
-
}
|
|
2608
|
+
};
|
|
2609
|
+
let response;
|
|
2610
|
+
try {
|
|
2611
|
+
if (PROXY_SERVER_URI) {
|
|
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);
|
|
2616
|
+
} 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
|
+
);
|
|
2622
|
+
console.log(chalk2.red(`Error details: ${err?.message || err}`));
|
|
2623
|
+
process.exit(1);
|
|
2624
|
+
}
|
|
1360
2625
|
if (response.status !== 200) {
|
|
1361
2626
|
console.log(chalk2.bgRed(`
|
|
1362
2627
|
Invalid license key`));
|
|
@@ -1365,7 +2630,7 @@ Invalid license key`));
|
|
|
1365
2630
|
}
|
|
1366
2631
|
if (response.status === 200) {
|
|
1367
2632
|
const data = await response.json();
|
|
1368
|
-
if (
|
|
2633
|
+
if (pkgName !== data.plugin) {
|
|
1369
2634
|
console.log(chalk2.bgRed(`
|
|
1370
2635
|
Invalid license key for this plugin`));
|
|
1371
2636
|
console.log(chalk2.redBright("Please check your plugin license key or purchase a license at https://eventcatalog.cloud/"));
|
|
@@ -1380,7 +2645,7 @@ You are using a trial license for this plugin`));
|
|
|
1380
2645
|
};
|
|
1381
2646
|
|
|
1382
2647
|
// src/index.ts
|
|
1383
|
-
import { join } from "
|
|
2648
|
+
import { join } from "path";
|
|
1384
2649
|
var parser = new Parser();
|
|
1385
2650
|
parser.registerSchemaParser(AvroSchemaParser());
|
|
1386
2651
|
var cliArgs = argv(process.argv.slice(2));
|
|
@@ -1421,7 +2686,8 @@ var index_default = async (config, options) => {
|
|
|
1421
2686
|
if (!process.env.PROJECT_DIR) {
|
|
1422
2687
|
throw new Error("Please provide catalog url (env variable PROJECT_DIR)");
|
|
1423
2688
|
}
|
|
1424
|
-
|
|
2689
|
+
const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_ASYNCAPI || options.licenseKey || "";
|
|
2690
|
+
await checkLicense_default(package_default.name, LICENSE_KEY);
|
|
1425
2691
|
await checkForPackageUpdate(package_default.name);
|
|
1426
2692
|
const {
|
|
1427
2693
|
writeService,
|
|
@@ -1477,12 +2743,12 @@ var index_default = async (config, options) => {
|
|
|
1477
2743
|
console.log(chalk3.green(`Processing ${services.length} AsyncAPI files...`));
|
|
1478
2744
|
for (const service of services) {
|
|
1479
2745
|
console.log(chalk3.gray(`Processing ${service.path}`));
|
|
1480
|
-
const { document, diagnostics } = service.path.startsWith("http") ? await fromURL(parser, service.path).parse({
|
|
2746
|
+
const { document: document2, diagnostics } = service.path.startsWith("http") ? await fromURL(parser, service.path).parse({
|
|
1481
2747
|
parseSchemas
|
|
1482
2748
|
}) : await fromFile(parser, service.path).parse({
|
|
1483
2749
|
parseSchemas
|
|
1484
2750
|
});
|
|
1485
|
-
if (!
|
|
2751
|
+
if (!document2) {
|
|
1486
2752
|
console.log(chalk3.red("Failed to parse AsyncAPI file"));
|
|
1487
2753
|
if (options.debug || cliArgs.debug) {
|
|
1488
2754
|
console.log(diagnostics);
|
|
@@ -1491,19 +2757,19 @@ var index_default = async (config, options) => {
|
|
|
1491
2757
|
}
|
|
1492
2758
|
continue;
|
|
1493
2759
|
}
|
|
1494
|
-
const operations =
|
|
1495
|
-
const channels =
|
|
1496
|
-
const documentTags =
|
|
2760
|
+
const operations = document2.allOperations();
|
|
2761
|
+
const channels = document2.allChannels();
|
|
2762
|
+
const documentTags = document2.info().tags().all() || [];
|
|
1497
2763
|
const serviceId = service.id;
|
|
1498
|
-
const serviceName = service.name ||
|
|
1499
|
-
const version =
|
|
2764
|
+
const serviceName = service.name || document2.info().title();
|
|
2765
|
+
const version = document2.info().version();
|
|
1500
2766
|
let sends = [];
|
|
1501
2767
|
let receives = [];
|
|
1502
2768
|
let owners = service.owners || null;
|
|
1503
2769
|
let repository = null;
|
|
1504
2770
|
let serviceSpecifications = {};
|
|
1505
2771
|
let serviceSpecificationsFiles = [];
|
|
1506
|
-
let serviceMarkdown = defaultMarkdown2(
|
|
2772
|
+
let serviceMarkdown = defaultMarkdown2(document2);
|
|
1507
2773
|
let styles2 = null;
|
|
1508
2774
|
let servicePath = options.domain ? path2.join("../", "domains", options.domain.id, "services", service.id) : path2.join("../", "services", service.id);
|
|
1509
2775
|
if (options.writeFilesToRoot) {
|
|
@@ -1524,7 +2790,7 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
1524
2790
|
id: domainId,
|
|
1525
2791
|
name: domainName,
|
|
1526
2792
|
version: domainVersion,
|
|
1527
|
-
markdown: defaultMarkdown3(
|
|
2793
|
+
markdown: defaultMarkdown3(document2),
|
|
1528
2794
|
...domainOwners && { owners: domainOwners }
|
|
1529
2795
|
// services: [{ id: serviceId, version: version }],
|
|
1530
2796
|
});
|
|
@@ -1542,7 +2808,7 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
1542
2808
|
const params = channelAsJSON?.parameters || {};
|
|
1543
2809
|
const protocols = getChannelProtocols(channel);
|
|
1544
2810
|
const channelVersion = channel.extensions().get("x-eventcatalog-channel-version")?.value() || version;
|
|
1545
|
-
let channelMarkdown = defaultMarkdown4(
|
|
2811
|
+
let channelMarkdown = defaultMarkdown4(document2, channel);
|
|
1546
2812
|
console.log(chalk3.blue(`Processing channel: ${channelId} (v${channelVersion})`));
|
|
1547
2813
|
const paramsForCatalog = Object.keys(params).reduce(
|
|
1548
2814
|
(acc, key) => {
|
|
@@ -1600,7 +2866,7 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
1600
2866
|
addSchema: addSchemaToMessage,
|
|
1601
2867
|
collection: folder
|
|
1602
2868
|
} = MESSAGE_OPERATIONS[eventType];
|
|
1603
|
-
let messageMarkdown = defaultMarkdown(
|
|
2869
|
+
let messageMarkdown = defaultMarkdown(document2, message);
|
|
1604
2870
|
const badges = message.tags().all() || [];
|
|
1605
2871
|
console.log(chalk3.blue(`Processing message: ${getMessageName(message)} (v${messageVersion})`));
|
|
1606
2872
|
let messagePath = join(servicePath, folder, message.id());
|
|
@@ -1616,7 +2882,7 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
1616
2882
|
console.log(chalk3.cyan(` - Versioned previous message: (v${catalogedMessage.version})`));
|
|
1617
2883
|
}
|
|
1618
2884
|
}
|
|
1619
|
-
const channelsForMessage = parseChannels ? getChannelsForMessage(message, channels,
|
|
2885
|
+
const channelsForMessage = parseChannels ? getChannelsForMessage(message, channels, document2) : [];
|
|
1620
2886
|
await writeMessage(
|
|
1621
2887
|
{
|
|
1622
2888
|
id: messageId,
|
|
@@ -1685,7 +2951,7 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
1685
2951
|
id: serviceId,
|
|
1686
2952
|
name: serviceName,
|
|
1687
2953
|
version,
|
|
1688
|
-
summary: getSummary2(
|
|
2954
|
+
summary: getSummary2(document2),
|
|
1689
2955
|
badges: documentTags.map((tag) => ({ content: tag.name(), textColor: "blue", backgroundColor: "blue" })),
|
|
1690
2956
|
markdown: serviceMarkdown,
|
|
1691
2957
|
sends,
|
|
@@ -1708,7 +2974,7 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
1708
2974
|
// add any previous spec files to the list
|
|
1709
2975
|
...serviceSpecificationsFiles,
|
|
1710
2976
|
{
|
|
1711
|
-
content: saveParsedSpecFile ? getParsedSpecFile(service,
|
|
2977
|
+
content: saveParsedSpecFile ? getParsedSpecFile(service, document2) : await getRawSpecFile(service),
|
|
1712
2978
|
fileName: path2.basename(service.path) || "asyncapi.yml"
|
|
1713
2979
|
}
|
|
1714
2980
|
];
|
|
@@ -1727,9 +2993,9 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
1727
2993
|
Finished generating event catalog for AsyncAPI ${serviceId} (v${version})`));
|
|
1728
2994
|
}
|
|
1729
2995
|
};
|
|
1730
|
-
var getParsedSpecFile = (service,
|
|
2996
|
+
var getParsedSpecFile = (service, document2) => {
|
|
1731
2997
|
const isSpecFileJSON = service.path.endsWith(".json");
|
|
1732
|
-
return isSpecFileJSON ? JSON.stringify(
|
|
2998
|
+
return isSpecFileJSON ? JSON.stringify(document2.meta().asyncapi.parsed, null, 4) : yaml.dump(document2.meta().asyncapi.parsed, { noRefs: true });
|
|
1733
2999
|
};
|
|
1734
3000
|
var getRawSpecFile = async (service) => {
|
|
1735
3001
|
if (service.path.startsWith("http")) {
|