@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/dist/index.js CHANGED
@@ -283,6 +283,1246 @@ var require_ansi_align = __commonJS({
283
283
  }
284
284
  });
285
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"(exports2, module2) {
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
+ module2.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"(exports2, module2) {
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
+ module2.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"(exports2, module2) {
584
+ "use strict";
585
+ exports2.formatArgs = formatArgs;
586
+ exports2.save = save;
587
+ exports2.load = load;
588
+ exports2.useColors = useColors;
589
+ exports2.storage = localstorage();
590
+ exports2.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
+ exports2.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 " : " ") + "+" + module2.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
+ exports2.log = console.debug || console.log || (() => {
712
+ });
713
+ function save(namespaces) {
714
+ try {
715
+ if (namespaces) {
716
+ exports2.storage.setItem("debug", namespaces);
717
+ } else {
718
+ exports2.storage.removeItem("debug");
719
+ }
720
+ } catch (error) {
721
+ }
722
+ }
723
+ function load() {
724
+ let r;
725
+ try {
726
+ r = exports2.storage.getItem("debug") || exports2.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
+ module2.exports = require_common()(exports2);
741
+ var { formatters } = module2.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"(exports2, module2) {
755
+ "use strict";
756
+ module2.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"(exports2, module2) {
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
+ module2.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"(exports2, module2) {
870
+ "use strict";
871
+ var tty = require("tty");
872
+ var util = require("util");
873
+ exports2.init = init;
874
+ exports2.log = log;
875
+ exports2.formatArgs = formatArgs;
876
+ exports2.save = save;
877
+ exports2.load = load;
878
+ exports2.useColors = useColors;
879
+ exports2.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
+ exports2.colors = [6, 2, 3, 4, 5, 1];
885
+ try {
886
+ const supportsColor = require_supports_color();
887
+ if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
888
+ exports2.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
+ exports2.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 exports2.inspectOpts ? Boolean(exports2.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+" + module2.exports.humanize(this.diff) + "\x1B[0m");
999
+ } else {
1000
+ args[0] = getDate() + name + " " + args[0];
1001
+ }
1002
+ }
1003
+ function getDate() {
1004
+ if (exports2.inspectOpts.hideDate) {
1005
+ return "";
1006
+ }
1007
+ return (/* @__PURE__ */ new Date()).toISOString() + " ";
1008
+ }
1009
+ function log(...args) {
1010
+ return process.stderr.write(util.formatWithOptions(exports2.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(exports2.inspectOpts);
1025
+ for (let i = 0; i < keys.length; i++) {
1026
+ debug.inspectOpts[keys[i]] = exports2.inspectOpts[keys[i]];
1027
+ }
1028
+ }
1029
+ module2.exports = require_common()(exports2);
1030
+ var { formatters } = module2.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"(exports2, module2) {
1045
+ "use strict";
1046
+ if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
1047
+ module2.exports = require_browser();
1048
+ } else {
1049
+ module2.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"(exports2) {
1057
+ "use strict";
1058
+ var __createBinding = exports2 && exports2.__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 = exports2 && exports2.__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 = exports2 && exports2.__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(exports2, "__esModule", { value: true });
1086
+ exports2.req = exports2.json = exports2.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
+ exports2.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
+ exports2.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
+ exports2.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"(exports2) {
1127
+ "use strict";
1128
+ var __createBinding = exports2 && exports2.__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 = exports2 && exports2.__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 = exports2 && exports2.__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 = exports2 && exports2.__exportStar || function(m, exports3) {
1156
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
1157
+ };
1158
+ Object.defineProperty(exports2, "__esModule", { value: true });
1159
+ exports2.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(), exports2);
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
+ exports2.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"(exports2) {
1283
+ "use strict";
1284
+ var __importDefault = exports2 && exports2.__importDefault || function(mod) {
1285
+ return mod && mod.__esModule ? mod : { "default": mod };
1286
+ };
1287
+ Object.defineProperty(exports2, "__esModule", { value: true });
1288
+ exports2.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
+ exports2.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"(exports2) {
1379
+ "use strict";
1380
+ var __createBinding = exports2 && exports2.__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 = exports2 && exports2.__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 = exports2 && exports2.__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 = exports2 && exports2.__importDefault || function(mod) {
1408
+ return mod && mod.__esModule ? mod : { "default": mod };
1409
+ };
1410
+ Object.defineProperty(exports2, "__esModule", { value: true });
1411
+ exports2.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
+ exports2.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
+
286
1526
  // src/index.ts
287
1527
  var index_exports = {};
288
1528
  __export(index_exports, {
@@ -301,7 +1541,7 @@ var import_path2 = __toESM(require("path"));
301
1541
  // package.json
302
1542
  var package_default = {
303
1543
  name: "@eventcatalog/generator-asyncapi",
304
- version: "4.0.3",
1544
+ version: "4.2.0",
305
1545
  description: "AsyncAPI generator for EventCatalog",
306
1546
  scripts: {
307
1547
  build: "tsup",
@@ -347,6 +1587,7 @@ var package_default = {
347
1587
  "js-yaml": "^4.1.0",
348
1588
  lodash: "^4.17.21",
349
1589
  minimist: "^1.2.8",
1590
+ "node-fetch": "^3.3.2",
350
1591
  slugify: "^1.6.6",
351
1592
  "update-notifier": "^7.3.1",
352
1593
  zod: "^3.23.8"
@@ -1269,9 +2510,9 @@ var getSchemaFileName = (message) => {
1269
2510
  var getMessageName = (message) => {
1270
2511
  return message.hasTitle() && message.title() ? message.title() : message.id();
1271
2512
  };
1272
- var getChannelsForMessage = (message, channels, document) => {
2513
+ var getChannelsForMessage = (message, channels, document2) => {
1273
2514
  let channelsForMessage = [];
1274
- const globalVersion = document.info().version();
2515
+ const globalVersion = document2.info().version();
1275
2516
  for (const channel of channels) {
1276
2517
  for (const channelMessage of channel.messages()) {
1277
2518
  if (channelMessage.id() === message.id()) {
@@ -1295,27 +2536,27 @@ var getChannelsForMessage = (message, channels, document) => {
1295
2536
  };
1296
2537
 
1297
2538
  // src/utils/services.ts
1298
- var defaultMarkdown2 = (document) => {
2539
+ var defaultMarkdown2 = (document2) => {
1299
2540
  return `
1300
2541
 
1301
- ${document.info().hasDescription() ? `${document.info().description()}` : ""}
2542
+ ${document2.info().hasDescription() ? `${document2.info().description()}` : ""}
1302
2543
 
1303
2544
  ## Architecture diagram
1304
2545
  <NodeGraph />
1305
2546
 
1306
- ${document.info().externalDocs() ? `
2547
+ ${document2.info().externalDocs() ? `
1307
2548
  ## External documentation
1308
- - [${document.info().externalDocs()?.description()}](${document.info().externalDocs()?.url()})
2549
+ - [${document2.info().externalDocs()?.description()}](${document2.info().externalDocs()?.url()})
1309
2550
  ` : ""}
1310
2551
  `;
1311
2552
  };
1312
- var getSummary2 = (document) => {
1313
- const summary = document.info().hasDescription() ? document.info().description() : "";
2553
+ var getSummary2 = (document2) => {
2554
+ const summary = document2.info().hasDescription() ? document2.info().description() : "";
1314
2555
  return summary && summary.length < 150 ? summary : "";
1315
2556
  };
1316
2557
 
1317
2558
  // src/utils/domains.ts
1318
- var defaultMarkdown3 = (document) => {
2559
+ var defaultMarkdown3 = (document2) => {
1319
2560
  return `
1320
2561
 
1321
2562
  ## Architecture diagram
@@ -1350,24 +2591,42 @@ var defaultMarkdown4 = (_document, channel) => {
1350
2591
  `;
1351
2592
  };
1352
2593
 
1353
- // src/checkLicense.ts
2594
+ // ../../shared/checkLicense.ts
2595
+ var import_node_fetch = __toESM(require("node-fetch"));
2596
+ var import_https_proxy_agent = __toESM(require_dist2());
1354
2597
  var import_chalk2 = __toESM(require("chalk"));
1355
- var checkLicense_default = async (licenseKey) => {
1356
- const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_ASYNCAPI || licenseKey || null;
1357
- if (!LICENSE_KEY) {
2598
+ var checkLicense_default = async (pkgName, licenseKey) => {
2599
+ const PROXY_SERVER_URI = process.env.PROXY_SERVER_URI || null;
2600
+ if (!licenseKey) {
1358
2601
  console.log(import_chalk2.default.bgRed(`
1359
2602
  This plugin requires a license key to use`));
1360
2603
  console.log(import_chalk2.default.redBright(`
1361
2604
  Visit https://eventcatalog.cloud/ to get a 14 day trial or purchase a license`));
1362
2605
  process.exit(1);
1363
2606
  }
1364
- const response = await fetch("https://api.eventcatalog.cloud/functions/v1/license", {
2607
+ const fetchOptions = {
1365
2608
  method: "POST",
1366
2609
  headers: {
1367
- Authorization: `Bearer ${LICENSE_KEY}`,
2610
+ Authorization: `Bearer ${licenseKey}`,
1368
2611
  "Content-Type": "application/json"
1369
2612
  }
1370
- });
2613
+ };
2614
+ let response;
2615
+ try {
2616
+ if (PROXY_SERVER_URI) {
2617
+ const proxyAgent = new import_https_proxy_agent.HttpsProxyAgent(PROXY_SERVER_URI);
2618
+ fetchOptions.agent = proxyAgent;
2619
+ }
2620
+ response = await (0, import_node_fetch.default)("https://api.eventcatalog.cloud/functions/v1/license", fetchOptions);
2621
+ } catch (err) {
2622
+ console.log(
2623
+ import_chalk2.default.redBright(
2624
+ "Network Connection Error: Unable to establish a connection to licence server. Check network or proxy settings."
2625
+ )
2626
+ );
2627
+ console.log(import_chalk2.default.red(`Error details: ${err?.message || err}`));
2628
+ process.exit(1);
2629
+ }
1371
2630
  if (response.status !== 200) {
1372
2631
  console.log(import_chalk2.default.bgRed(`
1373
2632
  Invalid license key`));
@@ -1376,7 +2635,7 @@ Invalid license key`));
1376
2635
  }
1377
2636
  if (response.status === 200) {
1378
2637
  const data = await response.json();
1379
- if (package_default.name !== data.plugin) {
2638
+ if (pkgName !== data.plugin) {
1380
2639
  console.log(import_chalk2.default.bgRed(`
1381
2640
  Invalid license key for this plugin`));
1382
2641
  console.log(import_chalk2.default.redBright("Please check your plugin license key or purchase a license at https://eventcatalog.cloud/"));
@@ -1432,7 +2691,8 @@ var index_default = async (config, options) => {
1432
2691
  if (!process.env.PROJECT_DIR) {
1433
2692
  throw new Error("Please provide catalog url (env variable PROJECT_DIR)");
1434
2693
  }
1435
- await checkLicense_default(options.licenseKey);
2694
+ const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_ASYNCAPI || options.licenseKey || "";
2695
+ await checkLicense_default(package_default.name, LICENSE_KEY);
1436
2696
  await checkForPackageUpdate(package_default.name);
1437
2697
  const {
1438
2698
  writeService,
@@ -1488,12 +2748,12 @@ var index_default = async (config, options) => {
1488
2748
  console.log(import_chalk3.default.green(`Processing ${services.length} AsyncAPI files...`));
1489
2749
  for (const service of services) {
1490
2750
  console.log(import_chalk3.default.gray(`Processing ${service.path}`));
1491
- const { document, diagnostics } = service.path.startsWith("http") ? await (0, import_parser.fromURL)(parser, service.path).parse({
2751
+ const { document: document2, diagnostics } = service.path.startsWith("http") ? await (0, import_parser.fromURL)(parser, service.path).parse({
1492
2752
  parseSchemas
1493
2753
  }) : await (0, import_parser.fromFile)(parser, service.path).parse({
1494
2754
  parseSchemas
1495
2755
  });
1496
- if (!document) {
2756
+ if (!document2) {
1497
2757
  console.log(import_chalk3.default.red("Failed to parse AsyncAPI file"));
1498
2758
  if (options.debug || cliArgs.debug) {
1499
2759
  console.log(diagnostics);
@@ -1502,19 +2762,19 @@ var index_default = async (config, options) => {
1502
2762
  }
1503
2763
  continue;
1504
2764
  }
1505
- const operations = document.allOperations();
1506
- const channels = document.allChannels();
1507
- const documentTags = document.info().tags().all() || [];
2765
+ const operations = document2.allOperations();
2766
+ const channels = document2.allChannels();
2767
+ const documentTags = document2.info().tags().all() || [];
1508
2768
  const serviceId = service.id;
1509
- const serviceName = service.name || document.info().title();
1510
- const version = document.info().version();
2769
+ const serviceName = service.name || document2.info().title();
2770
+ const version = document2.info().version();
1511
2771
  let sends = [];
1512
2772
  let receives = [];
1513
2773
  let owners = service.owners || null;
1514
2774
  let repository = null;
1515
2775
  let serviceSpecifications = {};
1516
2776
  let serviceSpecificationsFiles = [];
1517
- let serviceMarkdown = defaultMarkdown2(document);
2777
+ let serviceMarkdown = defaultMarkdown2(document2);
1518
2778
  let styles2 = null;
1519
2779
  let servicePath = options.domain ? import_path2.default.join("../", "domains", options.domain.id, "services", service.id) : import_path2.default.join("../", "services", service.id);
1520
2780
  if (options.writeFilesToRoot) {
@@ -1535,7 +2795,7 @@ Processing domain: ${domainName} (v${domainVersion})`));
1535
2795
  id: domainId,
1536
2796
  name: domainName,
1537
2797
  version: domainVersion,
1538
- markdown: defaultMarkdown3(document),
2798
+ markdown: defaultMarkdown3(document2),
1539
2799
  ...domainOwners && { owners: domainOwners }
1540
2800
  // services: [{ id: serviceId, version: version }],
1541
2801
  });
@@ -1553,7 +2813,7 @@ Processing domain: ${domainName} (v${domainVersion})`));
1553
2813
  const params = channelAsJSON?.parameters || {};
1554
2814
  const protocols = getChannelProtocols(channel);
1555
2815
  const channelVersion = channel.extensions().get("x-eventcatalog-channel-version")?.value() || version;
1556
- let channelMarkdown = defaultMarkdown4(document, channel);
2816
+ let channelMarkdown = defaultMarkdown4(document2, channel);
1557
2817
  console.log(import_chalk3.default.blue(`Processing channel: ${channelId} (v${channelVersion})`));
1558
2818
  const paramsForCatalog = Object.keys(params).reduce(
1559
2819
  (acc, key) => {
@@ -1611,7 +2871,7 @@ Processing domain: ${domainName} (v${domainVersion})`));
1611
2871
  addSchema: addSchemaToMessage,
1612
2872
  collection: folder
1613
2873
  } = MESSAGE_OPERATIONS[eventType];
1614
- let messageMarkdown = defaultMarkdown(document, message);
2874
+ let messageMarkdown = defaultMarkdown(document2, message);
1615
2875
  const badges = message.tags().all() || [];
1616
2876
  console.log(import_chalk3.default.blue(`Processing message: ${getMessageName(message)} (v${messageVersion})`));
1617
2877
  let messagePath = (0, import_node_path.join)(servicePath, folder, message.id());
@@ -1627,7 +2887,7 @@ Processing domain: ${domainName} (v${domainVersion})`));
1627
2887
  console.log(import_chalk3.default.cyan(` - Versioned previous message: (v${catalogedMessage.version})`));
1628
2888
  }
1629
2889
  }
1630
- const channelsForMessage = parseChannels ? getChannelsForMessage(message, channels, document) : [];
2890
+ const channelsForMessage = parseChannels ? getChannelsForMessage(message, channels, document2) : [];
1631
2891
  await writeMessage(
1632
2892
  {
1633
2893
  id: messageId,
@@ -1696,7 +2956,7 @@ Processing domain: ${domainName} (v${domainVersion})`));
1696
2956
  id: serviceId,
1697
2957
  name: serviceName,
1698
2958
  version,
1699
- summary: getSummary2(document),
2959
+ summary: getSummary2(document2),
1700
2960
  badges: documentTags.map((tag) => ({ content: tag.name(), textColor: "blue", backgroundColor: "blue" })),
1701
2961
  markdown: serviceMarkdown,
1702
2962
  sends,
@@ -1719,7 +2979,7 @@ Processing domain: ${domainName} (v${domainVersion})`));
1719
2979
  // add any previous spec files to the list
1720
2980
  ...serviceSpecificationsFiles,
1721
2981
  {
1722
- content: saveParsedSpecFile ? getParsedSpecFile(service, document) : await getRawSpecFile(service),
2982
+ content: saveParsedSpecFile ? getParsedSpecFile(service, document2) : await getRawSpecFile(service),
1723
2983
  fileName: import_path2.default.basename(service.path) || "asyncapi.yml"
1724
2984
  }
1725
2985
  ];
@@ -1738,9 +2998,9 @@ Processing domain: ${domainName} (v${domainVersion})`));
1738
2998
  Finished generating event catalog for AsyncAPI ${serviceId} (v${version})`));
1739
2999
  }
1740
3000
  };
1741
- var getParsedSpecFile = (service, document) => {
3001
+ var getParsedSpecFile = (service, document2) => {
1742
3002
  const isSpecFileJSON = service.path.endsWith(".json");
1743
- return isSpecFileJSON ? JSON.stringify(document.meta().asyncapi.parsed, null, 4) : import_js_yaml.default.dump(document.meta().asyncapi.parsed, { noRefs: true });
3003
+ return isSpecFileJSON ? JSON.stringify(document2.meta().asyncapi.parsed, null, 4) : import_js_yaml.default.dump(document2.meta().asyncapi.parsed, { noRefs: true });
1744
3004
  };
1745
3005
  var getRawSpecFile = async (service) => {
1746
3006
  if (service.path.startsWith("http")) {