@eventcatalog/generator-apicurio 0.0.3
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/client.d.mts +16 -0
- package/dist/client.d.ts +16 -0
- package/dist/client.js +150 -0
- package/dist/client.js.map +1 -0
- package/dist/client.mjs +115 -0
- package/dist/client.mjs.map +1 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4602 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +4600 -0
- package/dist/index.mjs.map +1 -0
- package/dist/types.d.mts +139 -0
- package/dist/types.d.ts +139 -0
- package/dist/types.js +38 -0
- package/dist/types.js.map +1 -0
- package/dist/types.mjs +13 -0
- package/dist/types.mjs.map +1 -0
- package/package.json +57 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,4602 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
10
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
|
+
};
|
|
12
|
+
var __export = (target, all) => {
|
|
13
|
+
for (var name in all)
|
|
14
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
+
mod
|
|
31
|
+
));
|
|
32
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
33
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
34
|
+
|
|
35
|
+
// ../../node_modules/.pnpm/cli-boxes@3.0.0/node_modules/cli-boxes/boxes.json
|
|
36
|
+
var require_boxes = __commonJS({
|
|
37
|
+
"../../node_modules/.pnpm/cli-boxes@3.0.0/node_modules/cli-boxes/boxes.json"(exports2, module2) {
|
|
38
|
+
module2.exports = {
|
|
39
|
+
single: {
|
|
40
|
+
topLeft: "\u250C",
|
|
41
|
+
top: "\u2500",
|
|
42
|
+
topRight: "\u2510",
|
|
43
|
+
right: "\u2502",
|
|
44
|
+
bottomRight: "\u2518",
|
|
45
|
+
bottom: "\u2500",
|
|
46
|
+
bottomLeft: "\u2514",
|
|
47
|
+
left: "\u2502"
|
|
48
|
+
},
|
|
49
|
+
double: {
|
|
50
|
+
topLeft: "\u2554",
|
|
51
|
+
top: "\u2550",
|
|
52
|
+
topRight: "\u2557",
|
|
53
|
+
right: "\u2551",
|
|
54
|
+
bottomRight: "\u255D",
|
|
55
|
+
bottom: "\u2550",
|
|
56
|
+
bottomLeft: "\u255A",
|
|
57
|
+
left: "\u2551"
|
|
58
|
+
},
|
|
59
|
+
round: {
|
|
60
|
+
topLeft: "\u256D",
|
|
61
|
+
top: "\u2500",
|
|
62
|
+
topRight: "\u256E",
|
|
63
|
+
right: "\u2502",
|
|
64
|
+
bottomRight: "\u256F",
|
|
65
|
+
bottom: "\u2500",
|
|
66
|
+
bottomLeft: "\u2570",
|
|
67
|
+
left: "\u2502"
|
|
68
|
+
},
|
|
69
|
+
bold: {
|
|
70
|
+
topLeft: "\u250F",
|
|
71
|
+
top: "\u2501",
|
|
72
|
+
topRight: "\u2513",
|
|
73
|
+
right: "\u2503",
|
|
74
|
+
bottomRight: "\u251B",
|
|
75
|
+
bottom: "\u2501",
|
|
76
|
+
bottomLeft: "\u2517",
|
|
77
|
+
left: "\u2503"
|
|
78
|
+
},
|
|
79
|
+
singleDouble: {
|
|
80
|
+
topLeft: "\u2553",
|
|
81
|
+
top: "\u2500",
|
|
82
|
+
topRight: "\u2556",
|
|
83
|
+
right: "\u2551",
|
|
84
|
+
bottomRight: "\u255C",
|
|
85
|
+
bottom: "\u2500",
|
|
86
|
+
bottomLeft: "\u2559",
|
|
87
|
+
left: "\u2551"
|
|
88
|
+
},
|
|
89
|
+
doubleSingle: {
|
|
90
|
+
topLeft: "\u2552",
|
|
91
|
+
top: "\u2550",
|
|
92
|
+
topRight: "\u2555",
|
|
93
|
+
right: "\u2502",
|
|
94
|
+
bottomRight: "\u255B",
|
|
95
|
+
bottom: "\u2550",
|
|
96
|
+
bottomLeft: "\u2558",
|
|
97
|
+
left: "\u2502"
|
|
98
|
+
},
|
|
99
|
+
classic: {
|
|
100
|
+
topLeft: "+",
|
|
101
|
+
top: "-",
|
|
102
|
+
topRight: "+",
|
|
103
|
+
right: "|",
|
|
104
|
+
bottomRight: "+",
|
|
105
|
+
bottom: "-",
|
|
106
|
+
bottomLeft: "+",
|
|
107
|
+
left: "|"
|
|
108
|
+
},
|
|
109
|
+
arrow: {
|
|
110
|
+
topLeft: "\u2198",
|
|
111
|
+
top: "\u2193",
|
|
112
|
+
topRight: "\u2199",
|
|
113
|
+
right: "\u2190",
|
|
114
|
+
bottomRight: "\u2196",
|
|
115
|
+
bottom: "\u2191",
|
|
116
|
+
bottomLeft: "\u2197",
|
|
117
|
+
left: "\u2192"
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// ../../node_modules/.pnpm/cli-boxes@3.0.0/node_modules/cli-boxes/index.js
|
|
124
|
+
var require_cli_boxes = __commonJS({
|
|
125
|
+
"../../node_modules/.pnpm/cli-boxes@3.0.0/node_modules/cli-boxes/index.js"(exports2, module2) {
|
|
126
|
+
"use strict";
|
|
127
|
+
var cliBoxes2 = require_boxes();
|
|
128
|
+
module2.exports = cliBoxes2;
|
|
129
|
+
module2.exports.default = cliBoxes2;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// ../../node_modules/.pnpm/ansi-regex@5.0.1/node_modules/ansi-regex/index.js
|
|
134
|
+
var require_ansi_regex = __commonJS({
|
|
135
|
+
"../../node_modules/.pnpm/ansi-regex@5.0.1/node_modules/ansi-regex/index.js"(exports2, module2) {
|
|
136
|
+
"use strict";
|
|
137
|
+
module2.exports = ({ onlyFirst = false } = {}) => {
|
|
138
|
+
const pattern = [
|
|
139
|
+
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
|
|
140
|
+
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
|
|
141
|
+
].join("|");
|
|
142
|
+
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// ../../node_modules/.pnpm/strip-ansi@6.0.1/node_modules/strip-ansi/index.js
|
|
148
|
+
var require_strip_ansi = __commonJS({
|
|
149
|
+
"../../node_modules/.pnpm/strip-ansi@6.0.1/node_modules/strip-ansi/index.js"(exports2, module2) {
|
|
150
|
+
"use strict";
|
|
151
|
+
var ansiRegex2 = require_ansi_regex();
|
|
152
|
+
module2.exports = (string) => typeof string === "string" ? string.replace(ansiRegex2(), "") : string;
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
// ../../node_modules/.pnpm/is-fullwidth-code-point@3.0.0/node_modules/is-fullwidth-code-point/index.js
|
|
157
|
+
var require_is_fullwidth_code_point = __commonJS({
|
|
158
|
+
"../../node_modules/.pnpm/is-fullwidth-code-point@3.0.0/node_modules/is-fullwidth-code-point/index.js"(exports2, module2) {
|
|
159
|
+
"use strict";
|
|
160
|
+
var isFullwidthCodePoint = (codePoint) => {
|
|
161
|
+
if (Number.isNaN(codePoint)) {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
if (codePoint >= 4352 && (codePoint <= 4447 || // Hangul Jamo
|
|
165
|
+
codePoint === 9001 || // LEFT-POINTING ANGLE BRACKET
|
|
166
|
+
codePoint === 9002 || // RIGHT-POINTING ANGLE BRACKET
|
|
167
|
+
// CJK Radicals Supplement .. Enclosed CJK Letters and Months
|
|
168
|
+
11904 <= codePoint && codePoint <= 12871 && codePoint !== 12351 || // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
|
|
169
|
+
12880 <= codePoint && codePoint <= 19903 || // CJK Unified Ideographs .. Yi Radicals
|
|
170
|
+
19968 <= codePoint && codePoint <= 42182 || // Hangul Jamo Extended-A
|
|
171
|
+
43360 <= codePoint && codePoint <= 43388 || // Hangul Syllables
|
|
172
|
+
44032 <= codePoint && codePoint <= 55203 || // CJK Compatibility Ideographs
|
|
173
|
+
63744 <= codePoint && codePoint <= 64255 || // Vertical Forms
|
|
174
|
+
65040 <= codePoint && codePoint <= 65049 || // CJK Compatibility Forms .. Small Form Variants
|
|
175
|
+
65072 <= codePoint && codePoint <= 65131 || // Halfwidth and Fullwidth Forms
|
|
176
|
+
65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510 || // Kana Supplement
|
|
177
|
+
110592 <= codePoint && codePoint <= 110593 || // Enclosed Ideographic Supplement
|
|
178
|
+
127488 <= codePoint && codePoint <= 127569 || // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
|
|
179
|
+
131072 <= codePoint && codePoint <= 262141)) {
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
return false;
|
|
183
|
+
};
|
|
184
|
+
module2.exports = isFullwidthCodePoint;
|
|
185
|
+
module2.exports.default = isFullwidthCodePoint;
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
// ../../node_modules/.pnpm/emoji-regex@8.0.0/node_modules/emoji-regex/index.js
|
|
190
|
+
var require_emoji_regex = __commonJS({
|
|
191
|
+
"../../node_modules/.pnpm/emoji-regex@8.0.0/node_modules/emoji-regex/index.js"(exports2, module2) {
|
|
192
|
+
"use strict";
|
|
193
|
+
module2.exports = function() {
|
|
194
|
+
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
// ../../node_modules/.pnpm/string-width@4.2.3/node_modules/string-width/index.js
|
|
200
|
+
var require_string_width = __commonJS({
|
|
201
|
+
"../../node_modules/.pnpm/string-width@4.2.3/node_modules/string-width/index.js"(exports2, module2) {
|
|
202
|
+
"use strict";
|
|
203
|
+
var stripAnsi2 = require_strip_ansi();
|
|
204
|
+
var isFullwidthCodePoint = require_is_fullwidth_code_point();
|
|
205
|
+
var emojiRegex = require_emoji_regex();
|
|
206
|
+
var stringWidth2 = (string) => {
|
|
207
|
+
if (typeof string !== "string" || string.length === 0) {
|
|
208
|
+
return 0;
|
|
209
|
+
}
|
|
210
|
+
string = stripAnsi2(string);
|
|
211
|
+
if (string.length === 0) {
|
|
212
|
+
return 0;
|
|
213
|
+
}
|
|
214
|
+
string = string.replace(emojiRegex(), " ");
|
|
215
|
+
let width = 0;
|
|
216
|
+
for (let i = 0; i < string.length; i++) {
|
|
217
|
+
const code = string.codePointAt(i);
|
|
218
|
+
if (code <= 31 || code >= 127 && code <= 159) {
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
if (code >= 768 && code <= 879) {
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
if (code > 65535) {
|
|
225
|
+
i++;
|
|
226
|
+
}
|
|
227
|
+
width += isFullwidthCodePoint(code) ? 2 : 1;
|
|
228
|
+
}
|
|
229
|
+
return width;
|
|
230
|
+
};
|
|
231
|
+
module2.exports = stringWidth2;
|
|
232
|
+
module2.exports.default = stringWidth2;
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
// ../../node_modules/.pnpm/ansi-align@3.0.1/node_modules/ansi-align/index.js
|
|
237
|
+
var require_ansi_align = __commonJS({
|
|
238
|
+
"../../node_modules/.pnpm/ansi-align@3.0.1/node_modules/ansi-align/index.js"(exports2, module2) {
|
|
239
|
+
"use strict";
|
|
240
|
+
var stringWidth2 = require_string_width();
|
|
241
|
+
function ansiAlign2(text, opts) {
|
|
242
|
+
if (!text) return text;
|
|
243
|
+
opts = opts || {};
|
|
244
|
+
const align = opts.align || "center";
|
|
245
|
+
if (align === "left") return text;
|
|
246
|
+
const split = opts.split || "\n";
|
|
247
|
+
const pad = opts.pad || " ";
|
|
248
|
+
const widthDiffFn = align !== "right" ? halfDiff : fullDiff;
|
|
249
|
+
let returnString = false;
|
|
250
|
+
if (!Array.isArray(text)) {
|
|
251
|
+
returnString = true;
|
|
252
|
+
text = String(text).split(split);
|
|
253
|
+
}
|
|
254
|
+
let width;
|
|
255
|
+
let maxWidth = 0;
|
|
256
|
+
text = text.map(function(str) {
|
|
257
|
+
str = String(str);
|
|
258
|
+
width = stringWidth2(str);
|
|
259
|
+
maxWidth = Math.max(width, maxWidth);
|
|
260
|
+
return {
|
|
261
|
+
str,
|
|
262
|
+
width
|
|
263
|
+
};
|
|
264
|
+
}).map(function(obj) {
|
|
265
|
+
return new Array(widthDiffFn(maxWidth, obj.width) + 1).join(pad) + obj.str;
|
|
266
|
+
});
|
|
267
|
+
return returnString ? text.join(split) : text;
|
|
268
|
+
}
|
|
269
|
+
ansiAlign2.left = function left(text) {
|
|
270
|
+
return ansiAlign2(text, { align: "left" });
|
|
271
|
+
};
|
|
272
|
+
ansiAlign2.center = function center(text) {
|
|
273
|
+
return ansiAlign2(text, { align: "center" });
|
|
274
|
+
};
|
|
275
|
+
ansiAlign2.right = function right(text) {
|
|
276
|
+
return ansiAlign2(text, { align: "right" });
|
|
277
|
+
};
|
|
278
|
+
module2.exports = ansiAlign2;
|
|
279
|
+
function halfDiff(maxWidth, curWidth) {
|
|
280
|
+
return Math.floor((maxWidth - curWidth) / 2);
|
|
281
|
+
}
|
|
282
|
+
function fullDiff(maxWidth, curWidth) {
|
|
283
|
+
return maxWidth - curWidth;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
// ../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js
|
|
289
|
+
var require_ms = __commonJS({
|
|
290
|
+
"../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js"(exports2, module2) {
|
|
291
|
+
"use strict";
|
|
292
|
+
var s = 1e3;
|
|
293
|
+
var m = s * 60;
|
|
294
|
+
var h = m * 60;
|
|
295
|
+
var d = h * 24;
|
|
296
|
+
var w = d * 7;
|
|
297
|
+
var y = d * 365.25;
|
|
298
|
+
module2.exports = function(val, options) {
|
|
299
|
+
options = options || {};
|
|
300
|
+
var type = typeof val;
|
|
301
|
+
if (type === "string" && val.length > 0) {
|
|
302
|
+
return parse2(val);
|
|
303
|
+
} else if (type === "number" && isFinite(val)) {
|
|
304
|
+
return options.long ? fmtLong(val) : fmtShort(val);
|
|
305
|
+
}
|
|
306
|
+
throw new Error(
|
|
307
|
+
"val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
|
|
308
|
+
);
|
|
309
|
+
};
|
|
310
|
+
function parse2(str) {
|
|
311
|
+
str = String(str);
|
|
312
|
+
if (str.length > 100) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
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(
|
|
316
|
+
str
|
|
317
|
+
);
|
|
318
|
+
if (!match) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
var n = parseFloat(match[1]);
|
|
322
|
+
var type = (match[2] || "ms").toLowerCase();
|
|
323
|
+
switch (type) {
|
|
324
|
+
case "years":
|
|
325
|
+
case "year":
|
|
326
|
+
case "yrs":
|
|
327
|
+
case "yr":
|
|
328
|
+
case "y":
|
|
329
|
+
return n * y;
|
|
330
|
+
case "weeks":
|
|
331
|
+
case "week":
|
|
332
|
+
case "w":
|
|
333
|
+
return n * w;
|
|
334
|
+
case "days":
|
|
335
|
+
case "day":
|
|
336
|
+
case "d":
|
|
337
|
+
return n * d;
|
|
338
|
+
case "hours":
|
|
339
|
+
case "hour":
|
|
340
|
+
case "hrs":
|
|
341
|
+
case "hr":
|
|
342
|
+
case "h":
|
|
343
|
+
return n * h;
|
|
344
|
+
case "minutes":
|
|
345
|
+
case "minute":
|
|
346
|
+
case "mins":
|
|
347
|
+
case "min":
|
|
348
|
+
case "m":
|
|
349
|
+
return n * m;
|
|
350
|
+
case "seconds":
|
|
351
|
+
case "second":
|
|
352
|
+
case "secs":
|
|
353
|
+
case "sec":
|
|
354
|
+
case "s":
|
|
355
|
+
return n * s;
|
|
356
|
+
case "milliseconds":
|
|
357
|
+
case "millisecond":
|
|
358
|
+
case "msecs":
|
|
359
|
+
case "msec":
|
|
360
|
+
case "ms":
|
|
361
|
+
return n;
|
|
362
|
+
default:
|
|
363
|
+
return void 0;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
function fmtShort(ms) {
|
|
367
|
+
var msAbs = Math.abs(ms);
|
|
368
|
+
if (msAbs >= d) {
|
|
369
|
+
return Math.round(ms / d) + "d";
|
|
370
|
+
}
|
|
371
|
+
if (msAbs >= h) {
|
|
372
|
+
return Math.round(ms / h) + "h";
|
|
373
|
+
}
|
|
374
|
+
if (msAbs >= m) {
|
|
375
|
+
return Math.round(ms / m) + "m";
|
|
376
|
+
}
|
|
377
|
+
if (msAbs >= s) {
|
|
378
|
+
return Math.round(ms / s) + "s";
|
|
379
|
+
}
|
|
380
|
+
return ms + "ms";
|
|
381
|
+
}
|
|
382
|
+
function fmtLong(ms) {
|
|
383
|
+
var msAbs = Math.abs(ms);
|
|
384
|
+
if (msAbs >= d) {
|
|
385
|
+
return plural(ms, msAbs, d, "day");
|
|
386
|
+
}
|
|
387
|
+
if (msAbs >= h) {
|
|
388
|
+
return plural(ms, msAbs, h, "hour");
|
|
389
|
+
}
|
|
390
|
+
if (msAbs >= m) {
|
|
391
|
+
return plural(ms, msAbs, m, "minute");
|
|
392
|
+
}
|
|
393
|
+
if (msAbs >= s) {
|
|
394
|
+
return plural(ms, msAbs, s, "second");
|
|
395
|
+
}
|
|
396
|
+
return ms + " ms";
|
|
397
|
+
}
|
|
398
|
+
function plural(ms, msAbs, n, name) {
|
|
399
|
+
var isPlural = msAbs >= n * 1.5;
|
|
400
|
+
return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
// ../../node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/common.js
|
|
406
|
+
var require_common = __commonJS({
|
|
407
|
+
"../../node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/common.js"(exports2, module2) {
|
|
408
|
+
"use strict";
|
|
409
|
+
function setup(env) {
|
|
410
|
+
createDebug.debug = createDebug;
|
|
411
|
+
createDebug.default = createDebug;
|
|
412
|
+
createDebug.coerce = coerce;
|
|
413
|
+
createDebug.disable = disable;
|
|
414
|
+
createDebug.enable = enable;
|
|
415
|
+
createDebug.enabled = enabled;
|
|
416
|
+
createDebug.humanize = require_ms();
|
|
417
|
+
createDebug.destroy = destroy;
|
|
418
|
+
Object.keys(env).forEach((key) => {
|
|
419
|
+
createDebug[key] = env[key];
|
|
420
|
+
});
|
|
421
|
+
createDebug.names = [];
|
|
422
|
+
createDebug.skips = [];
|
|
423
|
+
createDebug.formatters = {};
|
|
424
|
+
function selectColor(namespace) {
|
|
425
|
+
let hash = 0;
|
|
426
|
+
for (let i = 0; i < namespace.length; i++) {
|
|
427
|
+
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
428
|
+
hash |= 0;
|
|
429
|
+
}
|
|
430
|
+
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
431
|
+
}
|
|
432
|
+
createDebug.selectColor = selectColor;
|
|
433
|
+
function createDebug(namespace) {
|
|
434
|
+
let prevTime;
|
|
435
|
+
let enableOverride = null;
|
|
436
|
+
let namespacesCache;
|
|
437
|
+
let enabledCache;
|
|
438
|
+
function debug(...args) {
|
|
439
|
+
if (!debug.enabled) {
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
const self = debug;
|
|
443
|
+
const curr = Number(/* @__PURE__ */ new Date());
|
|
444
|
+
const ms = curr - (prevTime || curr);
|
|
445
|
+
self.diff = ms;
|
|
446
|
+
self.prev = prevTime;
|
|
447
|
+
self.curr = curr;
|
|
448
|
+
prevTime = curr;
|
|
449
|
+
args[0] = createDebug.coerce(args[0]);
|
|
450
|
+
if (typeof args[0] !== "string") {
|
|
451
|
+
args.unshift("%O");
|
|
452
|
+
}
|
|
453
|
+
let index = 0;
|
|
454
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
455
|
+
if (match === "%%") {
|
|
456
|
+
return "%";
|
|
457
|
+
}
|
|
458
|
+
index++;
|
|
459
|
+
const formatter = createDebug.formatters[format];
|
|
460
|
+
if (typeof formatter === "function") {
|
|
461
|
+
const val = args[index];
|
|
462
|
+
match = formatter.call(self, val);
|
|
463
|
+
args.splice(index, 1);
|
|
464
|
+
index--;
|
|
465
|
+
}
|
|
466
|
+
return match;
|
|
467
|
+
});
|
|
468
|
+
createDebug.formatArgs.call(self, args);
|
|
469
|
+
const logFn = self.log || createDebug.log;
|
|
470
|
+
logFn.apply(self, args);
|
|
471
|
+
}
|
|
472
|
+
debug.namespace = namespace;
|
|
473
|
+
debug.useColors = createDebug.useColors();
|
|
474
|
+
debug.color = createDebug.selectColor(namespace);
|
|
475
|
+
debug.extend = extend;
|
|
476
|
+
debug.destroy = createDebug.destroy;
|
|
477
|
+
Object.defineProperty(debug, "enabled", {
|
|
478
|
+
enumerable: true,
|
|
479
|
+
configurable: false,
|
|
480
|
+
get: () => {
|
|
481
|
+
if (enableOverride !== null) {
|
|
482
|
+
return enableOverride;
|
|
483
|
+
}
|
|
484
|
+
if (namespacesCache !== createDebug.namespaces) {
|
|
485
|
+
namespacesCache = createDebug.namespaces;
|
|
486
|
+
enabledCache = createDebug.enabled(namespace);
|
|
487
|
+
}
|
|
488
|
+
return enabledCache;
|
|
489
|
+
},
|
|
490
|
+
set: (v) => {
|
|
491
|
+
enableOverride = v;
|
|
492
|
+
}
|
|
493
|
+
});
|
|
494
|
+
if (typeof createDebug.init === "function") {
|
|
495
|
+
createDebug.init(debug);
|
|
496
|
+
}
|
|
497
|
+
return debug;
|
|
498
|
+
}
|
|
499
|
+
function extend(namespace, delimiter) {
|
|
500
|
+
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
501
|
+
newDebug.log = this.log;
|
|
502
|
+
return newDebug;
|
|
503
|
+
}
|
|
504
|
+
function enable(namespaces) {
|
|
505
|
+
createDebug.save(namespaces);
|
|
506
|
+
createDebug.namespaces = namespaces;
|
|
507
|
+
createDebug.names = [];
|
|
508
|
+
createDebug.skips = [];
|
|
509
|
+
const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
510
|
+
for (const ns of split) {
|
|
511
|
+
if (ns[0] === "-") {
|
|
512
|
+
createDebug.skips.push(ns.slice(1));
|
|
513
|
+
} else {
|
|
514
|
+
createDebug.names.push(ns);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
function matchesTemplate(search, template) {
|
|
519
|
+
let searchIndex = 0;
|
|
520
|
+
let templateIndex = 0;
|
|
521
|
+
let starIndex = -1;
|
|
522
|
+
let matchIndex = 0;
|
|
523
|
+
while (searchIndex < search.length) {
|
|
524
|
+
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
|
|
525
|
+
if (template[templateIndex] === "*") {
|
|
526
|
+
starIndex = templateIndex;
|
|
527
|
+
matchIndex = searchIndex;
|
|
528
|
+
templateIndex++;
|
|
529
|
+
} else {
|
|
530
|
+
searchIndex++;
|
|
531
|
+
templateIndex++;
|
|
532
|
+
}
|
|
533
|
+
} else if (starIndex !== -1) {
|
|
534
|
+
templateIndex = starIndex + 1;
|
|
535
|
+
matchIndex++;
|
|
536
|
+
searchIndex = matchIndex;
|
|
537
|
+
} else {
|
|
538
|
+
return false;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
while (templateIndex < template.length && template[templateIndex] === "*") {
|
|
542
|
+
templateIndex++;
|
|
543
|
+
}
|
|
544
|
+
return templateIndex === template.length;
|
|
545
|
+
}
|
|
546
|
+
function disable() {
|
|
547
|
+
const namespaces = [
|
|
548
|
+
...createDebug.names,
|
|
549
|
+
...createDebug.skips.map((namespace) => "-" + namespace)
|
|
550
|
+
].join(",");
|
|
551
|
+
createDebug.enable("");
|
|
552
|
+
return namespaces;
|
|
553
|
+
}
|
|
554
|
+
function enabled(name) {
|
|
555
|
+
for (const skip of createDebug.skips) {
|
|
556
|
+
if (matchesTemplate(name, skip)) {
|
|
557
|
+
return false;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
for (const ns of createDebug.names) {
|
|
561
|
+
if (matchesTemplate(name, ns)) {
|
|
562
|
+
return true;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
return false;
|
|
566
|
+
}
|
|
567
|
+
function coerce(val) {
|
|
568
|
+
if (val instanceof Error) {
|
|
569
|
+
return val.stack || val.message;
|
|
570
|
+
}
|
|
571
|
+
return val;
|
|
572
|
+
}
|
|
573
|
+
function destroy() {
|
|
574
|
+
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
575
|
+
}
|
|
576
|
+
createDebug.enable(createDebug.load());
|
|
577
|
+
return createDebug;
|
|
578
|
+
}
|
|
579
|
+
module2.exports = setup;
|
|
580
|
+
}
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
// ../../node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/browser.js
|
|
584
|
+
var require_browser = __commonJS({
|
|
585
|
+
"../../node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/browser.js"(exports2, module2) {
|
|
586
|
+
"use strict";
|
|
587
|
+
exports2.formatArgs = formatArgs;
|
|
588
|
+
exports2.save = save;
|
|
589
|
+
exports2.load = load;
|
|
590
|
+
exports2.useColors = useColors;
|
|
591
|
+
exports2.storage = localstorage();
|
|
592
|
+
exports2.destroy = /* @__PURE__ */ (() => {
|
|
593
|
+
let warned = false;
|
|
594
|
+
return () => {
|
|
595
|
+
if (!warned) {
|
|
596
|
+
warned = true;
|
|
597
|
+
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
598
|
+
}
|
|
599
|
+
};
|
|
600
|
+
})();
|
|
601
|
+
exports2.colors = [
|
|
602
|
+
"#0000CC",
|
|
603
|
+
"#0000FF",
|
|
604
|
+
"#0033CC",
|
|
605
|
+
"#0033FF",
|
|
606
|
+
"#0066CC",
|
|
607
|
+
"#0066FF",
|
|
608
|
+
"#0099CC",
|
|
609
|
+
"#0099FF",
|
|
610
|
+
"#00CC00",
|
|
611
|
+
"#00CC33",
|
|
612
|
+
"#00CC66",
|
|
613
|
+
"#00CC99",
|
|
614
|
+
"#00CCCC",
|
|
615
|
+
"#00CCFF",
|
|
616
|
+
"#3300CC",
|
|
617
|
+
"#3300FF",
|
|
618
|
+
"#3333CC",
|
|
619
|
+
"#3333FF",
|
|
620
|
+
"#3366CC",
|
|
621
|
+
"#3366FF",
|
|
622
|
+
"#3399CC",
|
|
623
|
+
"#3399FF",
|
|
624
|
+
"#33CC00",
|
|
625
|
+
"#33CC33",
|
|
626
|
+
"#33CC66",
|
|
627
|
+
"#33CC99",
|
|
628
|
+
"#33CCCC",
|
|
629
|
+
"#33CCFF",
|
|
630
|
+
"#6600CC",
|
|
631
|
+
"#6600FF",
|
|
632
|
+
"#6633CC",
|
|
633
|
+
"#6633FF",
|
|
634
|
+
"#66CC00",
|
|
635
|
+
"#66CC33",
|
|
636
|
+
"#9900CC",
|
|
637
|
+
"#9900FF",
|
|
638
|
+
"#9933CC",
|
|
639
|
+
"#9933FF",
|
|
640
|
+
"#99CC00",
|
|
641
|
+
"#99CC33",
|
|
642
|
+
"#CC0000",
|
|
643
|
+
"#CC0033",
|
|
644
|
+
"#CC0066",
|
|
645
|
+
"#CC0099",
|
|
646
|
+
"#CC00CC",
|
|
647
|
+
"#CC00FF",
|
|
648
|
+
"#CC3300",
|
|
649
|
+
"#CC3333",
|
|
650
|
+
"#CC3366",
|
|
651
|
+
"#CC3399",
|
|
652
|
+
"#CC33CC",
|
|
653
|
+
"#CC33FF",
|
|
654
|
+
"#CC6600",
|
|
655
|
+
"#CC6633",
|
|
656
|
+
"#CC9900",
|
|
657
|
+
"#CC9933",
|
|
658
|
+
"#CCCC00",
|
|
659
|
+
"#CCCC33",
|
|
660
|
+
"#FF0000",
|
|
661
|
+
"#FF0033",
|
|
662
|
+
"#FF0066",
|
|
663
|
+
"#FF0099",
|
|
664
|
+
"#FF00CC",
|
|
665
|
+
"#FF00FF",
|
|
666
|
+
"#FF3300",
|
|
667
|
+
"#FF3333",
|
|
668
|
+
"#FF3366",
|
|
669
|
+
"#FF3399",
|
|
670
|
+
"#FF33CC",
|
|
671
|
+
"#FF33FF",
|
|
672
|
+
"#FF6600",
|
|
673
|
+
"#FF6633",
|
|
674
|
+
"#FF9900",
|
|
675
|
+
"#FF9933",
|
|
676
|
+
"#FFCC00",
|
|
677
|
+
"#FFCC33"
|
|
678
|
+
];
|
|
679
|
+
function useColors() {
|
|
680
|
+
if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
|
|
681
|
+
return true;
|
|
682
|
+
}
|
|
683
|
+
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
684
|
+
return false;
|
|
685
|
+
}
|
|
686
|
+
let m;
|
|
687
|
+
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
|
|
688
|
+
typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
|
|
689
|
+
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
690
|
+
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
|
|
691
|
+
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
692
|
+
}
|
|
693
|
+
function formatArgs(args) {
|
|
694
|
+
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module2.exports.humanize(this.diff);
|
|
695
|
+
if (!this.useColors) {
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
const c = "color: " + this.color;
|
|
699
|
+
args.splice(1, 0, c, "color: inherit");
|
|
700
|
+
let index = 0;
|
|
701
|
+
let lastC = 0;
|
|
702
|
+
args[0].replace(/%[a-zA-Z%]/g, (match) => {
|
|
703
|
+
if (match === "%%") {
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
706
|
+
index++;
|
|
707
|
+
if (match === "%c") {
|
|
708
|
+
lastC = index;
|
|
709
|
+
}
|
|
710
|
+
});
|
|
711
|
+
args.splice(lastC, 0, c);
|
|
712
|
+
}
|
|
713
|
+
exports2.log = console.debug || console.log || (() => {
|
|
714
|
+
});
|
|
715
|
+
function save(namespaces) {
|
|
716
|
+
try {
|
|
717
|
+
if (namespaces) {
|
|
718
|
+
exports2.storage.setItem("debug", namespaces);
|
|
719
|
+
} else {
|
|
720
|
+
exports2.storage.removeItem("debug");
|
|
721
|
+
}
|
|
722
|
+
} catch (error) {
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
function load() {
|
|
726
|
+
let r;
|
|
727
|
+
try {
|
|
728
|
+
r = exports2.storage.getItem("debug") || exports2.storage.getItem("DEBUG");
|
|
729
|
+
} catch (error) {
|
|
730
|
+
}
|
|
731
|
+
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
732
|
+
r = process.env.DEBUG;
|
|
733
|
+
}
|
|
734
|
+
return r;
|
|
735
|
+
}
|
|
736
|
+
function localstorage() {
|
|
737
|
+
try {
|
|
738
|
+
return localStorage;
|
|
739
|
+
} catch (error) {
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
module2.exports = require_common()(exports2);
|
|
743
|
+
var { formatters } = module2.exports;
|
|
744
|
+
formatters.j = function(v) {
|
|
745
|
+
try {
|
|
746
|
+
return JSON.stringify(v);
|
|
747
|
+
} catch (error) {
|
|
748
|
+
return "[UnexpectedJSONParseError]: " + error.message;
|
|
749
|
+
}
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
});
|
|
753
|
+
|
|
754
|
+
// ../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js
|
|
755
|
+
var require_has_flag = __commonJS({
|
|
756
|
+
"../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js"(exports2, module2) {
|
|
757
|
+
"use strict";
|
|
758
|
+
module2.exports = (flag, argv = process.argv) => {
|
|
759
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
760
|
+
const position = argv.indexOf(prefix + flag);
|
|
761
|
+
const terminatorPosition = argv.indexOf("--");
|
|
762
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
});
|
|
766
|
+
|
|
767
|
+
// ../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js
|
|
768
|
+
var require_supports_color = __commonJS({
|
|
769
|
+
"../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js"(exports2, module2) {
|
|
770
|
+
"use strict";
|
|
771
|
+
var os = require("os");
|
|
772
|
+
var tty = require("tty");
|
|
773
|
+
var hasFlag = require_has_flag();
|
|
774
|
+
var { env } = process;
|
|
775
|
+
var forceColor;
|
|
776
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
777
|
+
forceColor = 0;
|
|
778
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
779
|
+
forceColor = 1;
|
|
780
|
+
}
|
|
781
|
+
if ("FORCE_COLOR" in env) {
|
|
782
|
+
if (env.FORCE_COLOR === "true") {
|
|
783
|
+
forceColor = 1;
|
|
784
|
+
} else if (env.FORCE_COLOR === "false") {
|
|
785
|
+
forceColor = 0;
|
|
786
|
+
} else {
|
|
787
|
+
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
function translateLevel(level) {
|
|
791
|
+
if (level === 0) {
|
|
792
|
+
return false;
|
|
793
|
+
}
|
|
794
|
+
return {
|
|
795
|
+
level,
|
|
796
|
+
hasBasic: true,
|
|
797
|
+
has256: level >= 2,
|
|
798
|
+
has16m: level >= 3
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
function supportsColor(haveStream, streamIsTTY) {
|
|
802
|
+
if (forceColor === 0) {
|
|
803
|
+
return 0;
|
|
804
|
+
}
|
|
805
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
806
|
+
return 3;
|
|
807
|
+
}
|
|
808
|
+
if (hasFlag("color=256")) {
|
|
809
|
+
return 2;
|
|
810
|
+
}
|
|
811
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
812
|
+
return 0;
|
|
813
|
+
}
|
|
814
|
+
const min = forceColor || 0;
|
|
815
|
+
if (env.TERM === "dumb") {
|
|
816
|
+
return min;
|
|
817
|
+
}
|
|
818
|
+
if (process.platform === "win32") {
|
|
819
|
+
const osRelease = os.release().split(".");
|
|
820
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
821
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
822
|
+
}
|
|
823
|
+
return 1;
|
|
824
|
+
}
|
|
825
|
+
if ("CI" in env) {
|
|
826
|
+
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign3) => sign3 in env) || env.CI_NAME === "codeship") {
|
|
827
|
+
return 1;
|
|
828
|
+
}
|
|
829
|
+
return min;
|
|
830
|
+
}
|
|
831
|
+
if ("TEAMCITY_VERSION" in env) {
|
|
832
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
833
|
+
}
|
|
834
|
+
if (env.COLORTERM === "truecolor") {
|
|
835
|
+
return 3;
|
|
836
|
+
}
|
|
837
|
+
if ("TERM_PROGRAM" in env) {
|
|
838
|
+
const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
839
|
+
switch (env.TERM_PROGRAM) {
|
|
840
|
+
case "iTerm.app":
|
|
841
|
+
return version >= 3 ? 3 : 2;
|
|
842
|
+
case "Apple_Terminal":
|
|
843
|
+
return 2;
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
847
|
+
return 2;
|
|
848
|
+
}
|
|
849
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
850
|
+
return 1;
|
|
851
|
+
}
|
|
852
|
+
if ("COLORTERM" in env) {
|
|
853
|
+
return 1;
|
|
854
|
+
}
|
|
855
|
+
return min;
|
|
856
|
+
}
|
|
857
|
+
function getSupportLevel(stream) {
|
|
858
|
+
const level = supportsColor(stream, stream && stream.isTTY);
|
|
859
|
+
return translateLevel(level);
|
|
860
|
+
}
|
|
861
|
+
module2.exports = {
|
|
862
|
+
supportsColor: getSupportLevel,
|
|
863
|
+
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
|
864
|
+
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|
865
|
+
};
|
|
866
|
+
}
|
|
867
|
+
});
|
|
868
|
+
|
|
869
|
+
// ../../node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/node.js
|
|
870
|
+
var require_node = __commonJS({
|
|
871
|
+
"../../node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/node.js"(exports2, module2) {
|
|
872
|
+
"use strict";
|
|
873
|
+
var tty = require("tty");
|
|
874
|
+
var util3 = require("util");
|
|
875
|
+
exports2.init = init;
|
|
876
|
+
exports2.log = log;
|
|
877
|
+
exports2.formatArgs = formatArgs;
|
|
878
|
+
exports2.save = save;
|
|
879
|
+
exports2.load = load;
|
|
880
|
+
exports2.useColors = useColors;
|
|
881
|
+
exports2.destroy = util3.deprecate(
|
|
882
|
+
() => {
|
|
883
|
+
},
|
|
884
|
+
"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."
|
|
885
|
+
);
|
|
886
|
+
exports2.colors = [6, 2, 3, 4, 5, 1];
|
|
887
|
+
try {
|
|
888
|
+
const supportsColor = require_supports_color();
|
|
889
|
+
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
890
|
+
exports2.colors = [
|
|
891
|
+
20,
|
|
892
|
+
21,
|
|
893
|
+
26,
|
|
894
|
+
27,
|
|
895
|
+
32,
|
|
896
|
+
33,
|
|
897
|
+
38,
|
|
898
|
+
39,
|
|
899
|
+
40,
|
|
900
|
+
41,
|
|
901
|
+
42,
|
|
902
|
+
43,
|
|
903
|
+
44,
|
|
904
|
+
45,
|
|
905
|
+
56,
|
|
906
|
+
57,
|
|
907
|
+
62,
|
|
908
|
+
63,
|
|
909
|
+
68,
|
|
910
|
+
69,
|
|
911
|
+
74,
|
|
912
|
+
75,
|
|
913
|
+
76,
|
|
914
|
+
77,
|
|
915
|
+
78,
|
|
916
|
+
79,
|
|
917
|
+
80,
|
|
918
|
+
81,
|
|
919
|
+
92,
|
|
920
|
+
93,
|
|
921
|
+
98,
|
|
922
|
+
99,
|
|
923
|
+
112,
|
|
924
|
+
113,
|
|
925
|
+
128,
|
|
926
|
+
129,
|
|
927
|
+
134,
|
|
928
|
+
135,
|
|
929
|
+
148,
|
|
930
|
+
149,
|
|
931
|
+
160,
|
|
932
|
+
161,
|
|
933
|
+
162,
|
|
934
|
+
163,
|
|
935
|
+
164,
|
|
936
|
+
165,
|
|
937
|
+
166,
|
|
938
|
+
167,
|
|
939
|
+
168,
|
|
940
|
+
169,
|
|
941
|
+
170,
|
|
942
|
+
171,
|
|
943
|
+
172,
|
|
944
|
+
173,
|
|
945
|
+
178,
|
|
946
|
+
179,
|
|
947
|
+
184,
|
|
948
|
+
185,
|
|
949
|
+
196,
|
|
950
|
+
197,
|
|
951
|
+
198,
|
|
952
|
+
199,
|
|
953
|
+
200,
|
|
954
|
+
201,
|
|
955
|
+
202,
|
|
956
|
+
203,
|
|
957
|
+
204,
|
|
958
|
+
205,
|
|
959
|
+
206,
|
|
960
|
+
207,
|
|
961
|
+
208,
|
|
962
|
+
209,
|
|
963
|
+
214,
|
|
964
|
+
215,
|
|
965
|
+
220,
|
|
966
|
+
221
|
|
967
|
+
];
|
|
968
|
+
}
|
|
969
|
+
} catch (error) {
|
|
970
|
+
}
|
|
971
|
+
exports2.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
972
|
+
return /^debug_/i.test(key);
|
|
973
|
+
}).reduce((obj, key) => {
|
|
974
|
+
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
|
|
975
|
+
return k.toUpperCase();
|
|
976
|
+
});
|
|
977
|
+
let val = process.env[key];
|
|
978
|
+
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
|
979
|
+
val = true;
|
|
980
|
+
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
|
981
|
+
val = false;
|
|
982
|
+
} else if (val === "null") {
|
|
983
|
+
val = null;
|
|
984
|
+
} else {
|
|
985
|
+
val = Number(val);
|
|
986
|
+
}
|
|
987
|
+
obj[prop] = val;
|
|
988
|
+
return obj;
|
|
989
|
+
}, {});
|
|
990
|
+
function useColors() {
|
|
991
|
+
return "colors" in exports2.inspectOpts ? Boolean(exports2.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
992
|
+
}
|
|
993
|
+
function formatArgs(args) {
|
|
994
|
+
const { namespace: name, useColors: useColors2 } = this;
|
|
995
|
+
if (useColors2) {
|
|
996
|
+
const c = this.color;
|
|
997
|
+
const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
|
|
998
|
+
const prefix = ` ${colorCode};1m${name} \x1B[0m`;
|
|
999
|
+
args[0] = prefix + args[0].split("\n").join("\n" + prefix);
|
|
1000
|
+
args.push(colorCode + "m+" + module2.exports.humanize(this.diff) + "\x1B[0m");
|
|
1001
|
+
} else {
|
|
1002
|
+
args[0] = getDate() + name + " " + args[0];
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
function getDate() {
|
|
1006
|
+
if (exports2.inspectOpts.hideDate) {
|
|
1007
|
+
return "";
|
|
1008
|
+
}
|
|
1009
|
+
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
1010
|
+
}
|
|
1011
|
+
function log(...args) {
|
|
1012
|
+
return process.stderr.write(util3.formatWithOptions(exports2.inspectOpts, ...args) + "\n");
|
|
1013
|
+
}
|
|
1014
|
+
function save(namespaces) {
|
|
1015
|
+
if (namespaces) {
|
|
1016
|
+
process.env.DEBUG = namespaces;
|
|
1017
|
+
} else {
|
|
1018
|
+
delete process.env.DEBUG;
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
function load() {
|
|
1022
|
+
return process.env.DEBUG;
|
|
1023
|
+
}
|
|
1024
|
+
function init(debug) {
|
|
1025
|
+
debug.inspectOpts = {};
|
|
1026
|
+
const keys = Object.keys(exports2.inspectOpts);
|
|
1027
|
+
for (let i = 0; i < keys.length; i++) {
|
|
1028
|
+
debug.inspectOpts[keys[i]] = exports2.inspectOpts[keys[i]];
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
module2.exports = require_common()(exports2);
|
|
1032
|
+
var { formatters } = module2.exports;
|
|
1033
|
+
formatters.o = function(v) {
|
|
1034
|
+
this.inspectOpts.colors = this.useColors;
|
|
1035
|
+
return util3.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
|
|
1036
|
+
};
|
|
1037
|
+
formatters.O = function(v) {
|
|
1038
|
+
this.inspectOpts.colors = this.useColors;
|
|
1039
|
+
return util3.inspect(v, this.inspectOpts);
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
1042
|
+
});
|
|
1043
|
+
|
|
1044
|
+
// ../../node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/index.js
|
|
1045
|
+
var require_src = __commonJS({
|
|
1046
|
+
"../../node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/index.js"(exports2, module2) {
|
|
1047
|
+
"use strict";
|
|
1048
|
+
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
|
|
1049
|
+
module2.exports = require_browser();
|
|
1050
|
+
} else {
|
|
1051
|
+
module2.exports = require_node();
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
});
|
|
1055
|
+
|
|
1056
|
+
// ../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js
|
|
1057
|
+
var require_helpers = __commonJS({
|
|
1058
|
+
"../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js"(exports2) {
|
|
1059
|
+
"use strict";
|
|
1060
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
1061
|
+
if (k2 === void 0) k2 = k;
|
|
1062
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1063
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1064
|
+
desc = { enumerable: true, get: function() {
|
|
1065
|
+
return m[k];
|
|
1066
|
+
} };
|
|
1067
|
+
}
|
|
1068
|
+
Object.defineProperty(o, k2, desc);
|
|
1069
|
+
} : function(o, m, k, k2) {
|
|
1070
|
+
if (k2 === void 0) k2 = k;
|
|
1071
|
+
o[k2] = m[k];
|
|
1072
|
+
});
|
|
1073
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
|
|
1074
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
1075
|
+
} : function(o, v) {
|
|
1076
|
+
o["default"] = v;
|
|
1077
|
+
});
|
|
1078
|
+
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
1079
|
+
if (mod && mod.__esModule) return mod;
|
|
1080
|
+
var result = {};
|
|
1081
|
+
if (mod != null) {
|
|
1082
|
+
for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
1083
|
+
}
|
|
1084
|
+
__setModuleDefault(result, mod);
|
|
1085
|
+
return result;
|
|
1086
|
+
};
|
|
1087
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1088
|
+
exports2.req = exports2.json = exports2.toBuffer = void 0;
|
|
1089
|
+
var http2 = __importStar(require("http"));
|
|
1090
|
+
var https2 = __importStar(require("https"));
|
|
1091
|
+
async function toBuffer(stream) {
|
|
1092
|
+
let length = 0;
|
|
1093
|
+
const chunks = [];
|
|
1094
|
+
for await (const chunk of stream) {
|
|
1095
|
+
length += chunk.length;
|
|
1096
|
+
chunks.push(chunk);
|
|
1097
|
+
}
|
|
1098
|
+
return Buffer.concat(chunks, length);
|
|
1099
|
+
}
|
|
1100
|
+
exports2.toBuffer = toBuffer;
|
|
1101
|
+
async function json(stream) {
|
|
1102
|
+
const buf = await toBuffer(stream);
|
|
1103
|
+
const str = buf.toString("utf8");
|
|
1104
|
+
try {
|
|
1105
|
+
return JSON.parse(str);
|
|
1106
|
+
} catch (_err) {
|
|
1107
|
+
const err = _err;
|
|
1108
|
+
err.message += ` (input: ${str})`;
|
|
1109
|
+
throw err;
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
exports2.json = json;
|
|
1113
|
+
function req(url, opts = {}) {
|
|
1114
|
+
const href = typeof url === "string" ? url : url.href;
|
|
1115
|
+
const req2 = (href.startsWith("https:") ? https2 : http2).request(url, opts);
|
|
1116
|
+
const promise = new Promise((resolve, reject) => {
|
|
1117
|
+
req2.once("response", resolve).once("error", reject).end();
|
|
1118
|
+
});
|
|
1119
|
+
req2.then = promise.then.bind(promise);
|
|
1120
|
+
return req2;
|
|
1121
|
+
}
|
|
1122
|
+
exports2.req = req;
|
|
1123
|
+
}
|
|
1124
|
+
});
|
|
1125
|
+
|
|
1126
|
+
// ../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/index.js
|
|
1127
|
+
var require_dist = __commonJS({
|
|
1128
|
+
"../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/index.js"(exports2) {
|
|
1129
|
+
"use strict";
|
|
1130
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
1131
|
+
if (k2 === void 0) k2 = k;
|
|
1132
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1133
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1134
|
+
desc = { enumerable: true, get: function() {
|
|
1135
|
+
return m[k];
|
|
1136
|
+
} };
|
|
1137
|
+
}
|
|
1138
|
+
Object.defineProperty(o, k2, desc);
|
|
1139
|
+
} : function(o, m, k, k2) {
|
|
1140
|
+
if (k2 === void 0) k2 = k;
|
|
1141
|
+
o[k2] = m[k];
|
|
1142
|
+
});
|
|
1143
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
|
|
1144
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
1145
|
+
} : function(o, v) {
|
|
1146
|
+
o["default"] = v;
|
|
1147
|
+
});
|
|
1148
|
+
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
1149
|
+
if (mod && mod.__esModule) return mod;
|
|
1150
|
+
var result = {};
|
|
1151
|
+
if (mod != null) {
|
|
1152
|
+
for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
1153
|
+
}
|
|
1154
|
+
__setModuleDefault(result, mod);
|
|
1155
|
+
return result;
|
|
1156
|
+
};
|
|
1157
|
+
var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
|
|
1158
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
|
|
1159
|
+
};
|
|
1160
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1161
|
+
exports2.Agent = void 0;
|
|
1162
|
+
var net = __importStar(require("net"));
|
|
1163
|
+
var http2 = __importStar(require("http"));
|
|
1164
|
+
var https_1 = require("https");
|
|
1165
|
+
__exportStar(require_helpers(), exports2);
|
|
1166
|
+
var INTERNAL = Symbol("AgentBaseInternalState");
|
|
1167
|
+
var Agent = class extends http2.Agent {
|
|
1168
|
+
constructor(opts) {
|
|
1169
|
+
super(opts);
|
|
1170
|
+
this[INTERNAL] = {};
|
|
1171
|
+
}
|
|
1172
|
+
/**
|
|
1173
|
+
* Determine whether this is an `http` or `https` request.
|
|
1174
|
+
*/
|
|
1175
|
+
isSecureEndpoint(options) {
|
|
1176
|
+
if (options) {
|
|
1177
|
+
if (typeof options.secureEndpoint === "boolean") {
|
|
1178
|
+
return options.secureEndpoint;
|
|
1179
|
+
}
|
|
1180
|
+
if (typeof options.protocol === "string") {
|
|
1181
|
+
return options.protocol === "https:";
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
const { stack } = new Error();
|
|
1185
|
+
if (typeof stack !== "string")
|
|
1186
|
+
return false;
|
|
1187
|
+
return stack.split("\n").some((l) => l.indexOf("(https.js:") !== -1 || l.indexOf("node:https:") !== -1);
|
|
1188
|
+
}
|
|
1189
|
+
// In order to support async signatures in `connect()` and Node's native
|
|
1190
|
+
// connection pooling in `http.Agent`, the array of sockets for each origin
|
|
1191
|
+
// has to be updated synchronously. This is so the length of the array is
|
|
1192
|
+
// accurate when `addRequest()` is next called. We achieve this by creating a
|
|
1193
|
+
// fake socket and adding it to `sockets[origin]` and incrementing
|
|
1194
|
+
// `totalSocketCount`.
|
|
1195
|
+
incrementSockets(name) {
|
|
1196
|
+
if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) {
|
|
1197
|
+
return null;
|
|
1198
|
+
}
|
|
1199
|
+
if (!this.sockets[name]) {
|
|
1200
|
+
this.sockets[name] = [];
|
|
1201
|
+
}
|
|
1202
|
+
const fakeSocket = new net.Socket({ writable: false });
|
|
1203
|
+
this.sockets[name].push(fakeSocket);
|
|
1204
|
+
this.totalSocketCount++;
|
|
1205
|
+
return fakeSocket;
|
|
1206
|
+
}
|
|
1207
|
+
decrementSockets(name, socket) {
|
|
1208
|
+
if (!this.sockets[name] || socket === null) {
|
|
1209
|
+
return;
|
|
1210
|
+
}
|
|
1211
|
+
const sockets = this.sockets[name];
|
|
1212
|
+
const index = sockets.indexOf(socket);
|
|
1213
|
+
if (index !== -1) {
|
|
1214
|
+
sockets.splice(index, 1);
|
|
1215
|
+
this.totalSocketCount--;
|
|
1216
|
+
if (sockets.length === 0) {
|
|
1217
|
+
delete this.sockets[name];
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
// In order to properly update the socket pool, we need to call `getName()` on
|
|
1222
|
+
// the core `https.Agent` if it is a secureEndpoint.
|
|
1223
|
+
getName(options) {
|
|
1224
|
+
const secureEndpoint = this.isSecureEndpoint(options);
|
|
1225
|
+
if (secureEndpoint) {
|
|
1226
|
+
return https_1.Agent.prototype.getName.call(this, options);
|
|
1227
|
+
}
|
|
1228
|
+
return super.getName(options);
|
|
1229
|
+
}
|
|
1230
|
+
createSocket(req, options, cb) {
|
|
1231
|
+
const connectOpts = {
|
|
1232
|
+
...options,
|
|
1233
|
+
secureEndpoint: this.isSecureEndpoint(options)
|
|
1234
|
+
};
|
|
1235
|
+
const name = this.getName(connectOpts);
|
|
1236
|
+
const fakeSocket = this.incrementSockets(name);
|
|
1237
|
+
Promise.resolve().then(() => this.connect(req, connectOpts)).then((socket) => {
|
|
1238
|
+
this.decrementSockets(name, fakeSocket);
|
|
1239
|
+
if (socket instanceof http2.Agent) {
|
|
1240
|
+
try {
|
|
1241
|
+
return socket.addRequest(req, connectOpts);
|
|
1242
|
+
} catch (err) {
|
|
1243
|
+
return cb(err);
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
this[INTERNAL].currentSocket = socket;
|
|
1247
|
+
super.createSocket(req, options, cb);
|
|
1248
|
+
}, (err) => {
|
|
1249
|
+
this.decrementSockets(name, fakeSocket);
|
|
1250
|
+
cb(err);
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1253
|
+
createConnection() {
|
|
1254
|
+
const socket = this[INTERNAL].currentSocket;
|
|
1255
|
+
this[INTERNAL].currentSocket = void 0;
|
|
1256
|
+
if (!socket) {
|
|
1257
|
+
throw new Error("No socket was returned in the `connect()` function");
|
|
1258
|
+
}
|
|
1259
|
+
return socket;
|
|
1260
|
+
}
|
|
1261
|
+
get defaultPort() {
|
|
1262
|
+
return this[INTERNAL].defaultPort ?? (this.protocol === "https:" ? 443 : 80);
|
|
1263
|
+
}
|
|
1264
|
+
set defaultPort(v) {
|
|
1265
|
+
if (this[INTERNAL]) {
|
|
1266
|
+
this[INTERNAL].defaultPort = v;
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
get protocol() {
|
|
1270
|
+
return this[INTERNAL].protocol ?? (this.isSecureEndpoint() ? "https:" : "http:");
|
|
1271
|
+
}
|
|
1272
|
+
set protocol(v) {
|
|
1273
|
+
if (this[INTERNAL]) {
|
|
1274
|
+
this[INTERNAL].protocol = v;
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
};
|
|
1278
|
+
exports2.Agent = Agent;
|
|
1279
|
+
}
|
|
1280
|
+
});
|
|
1281
|
+
|
|
1282
|
+
// ../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/parse-proxy-response.js
|
|
1283
|
+
var require_parse_proxy_response = __commonJS({
|
|
1284
|
+
"../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/parse-proxy-response.js"(exports2) {
|
|
1285
|
+
"use strict";
|
|
1286
|
+
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
1287
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1288
|
+
};
|
|
1289
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1290
|
+
exports2.parseProxyResponse = void 0;
|
|
1291
|
+
var debug_1 = __importDefault(require_src());
|
|
1292
|
+
var debug = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
|
|
1293
|
+
function parseProxyResponse(socket) {
|
|
1294
|
+
return new Promise((resolve, reject) => {
|
|
1295
|
+
let buffersLength = 0;
|
|
1296
|
+
const buffers = [];
|
|
1297
|
+
function read() {
|
|
1298
|
+
const b = socket.read();
|
|
1299
|
+
if (b)
|
|
1300
|
+
ondata(b);
|
|
1301
|
+
else
|
|
1302
|
+
socket.once("readable", read);
|
|
1303
|
+
}
|
|
1304
|
+
function cleanup() {
|
|
1305
|
+
socket.removeListener("end", onend);
|
|
1306
|
+
socket.removeListener("error", onerror);
|
|
1307
|
+
socket.removeListener("readable", read);
|
|
1308
|
+
}
|
|
1309
|
+
function onend() {
|
|
1310
|
+
cleanup();
|
|
1311
|
+
debug("onend");
|
|
1312
|
+
reject(new Error("Proxy connection ended before receiving CONNECT response"));
|
|
1313
|
+
}
|
|
1314
|
+
function onerror(err) {
|
|
1315
|
+
cleanup();
|
|
1316
|
+
debug("onerror %o", err);
|
|
1317
|
+
reject(err);
|
|
1318
|
+
}
|
|
1319
|
+
function ondata(b) {
|
|
1320
|
+
buffers.push(b);
|
|
1321
|
+
buffersLength += b.length;
|
|
1322
|
+
const buffered = Buffer.concat(buffers, buffersLength);
|
|
1323
|
+
const endOfHeaders = buffered.indexOf("\r\n\r\n");
|
|
1324
|
+
if (endOfHeaders === -1) {
|
|
1325
|
+
debug("have not received end of HTTP headers yet...");
|
|
1326
|
+
read();
|
|
1327
|
+
return;
|
|
1328
|
+
}
|
|
1329
|
+
const headerParts = buffered.slice(0, endOfHeaders).toString("ascii").split("\r\n");
|
|
1330
|
+
const firstLine = headerParts.shift();
|
|
1331
|
+
if (!firstLine) {
|
|
1332
|
+
socket.destroy();
|
|
1333
|
+
return reject(new Error("No header received from proxy CONNECT response"));
|
|
1334
|
+
}
|
|
1335
|
+
const firstLineParts = firstLine.split(" ");
|
|
1336
|
+
const statusCode = +firstLineParts[1];
|
|
1337
|
+
const statusText = firstLineParts.slice(2).join(" ");
|
|
1338
|
+
const headers = {};
|
|
1339
|
+
for (const header of headerParts) {
|
|
1340
|
+
if (!header)
|
|
1341
|
+
continue;
|
|
1342
|
+
const firstColon = header.indexOf(":");
|
|
1343
|
+
if (firstColon === -1) {
|
|
1344
|
+
socket.destroy();
|
|
1345
|
+
return reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`));
|
|
1346
|
+
}
|
|
1347
|
+
const key = header.slice(0, firstColon).toLowerCase();
|
|
1348
|
+
const value = header.slice(firstColon + 1).trimStart();
|
|
1349
|
+
const current = headers[key];
|
|
1350
|
+
if (typeof current === "string") {
|
|
1351
|
+
headers[key] = [current, value];
|
|
1352
|
+
} else if (Array.isArray(current)) {
|
|
1353
|
+
current.push(value);
|
|
1354
|
+
} else {
|
|
1355
|
+
headers[key] = value;
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
debug("got proxy server response: %o %o", firstLine, headers);
|
|
1359
|
+
cleanup();
|
|
1360
|
+
resolve({
|
|
1361
|
+
connect: {
|
|
1362
|
+
statusCode,
|
|
1363
|
+
statusText,
|
|
1364
|
+
headers
|
|
1365
|
+
},
|
|
1366
|
+
buffered
|
|
1367
|
+
});
|
|
1368
|
+
}
|
|
1369
|
+
socket.on("error", onerror);
|
|
1370
|
+
socket.on("end", onend);
|
|
1371
|
+
read();
|
|
1372
|
+
});
|
|
1373
|
+
}
|
|
1374
|
+
exports2.parseProxyResponse = parseProxyResponse;
|
|
1375
|
+
}
|
|
1376
|
+
});
|
|
1377
|
+
|
|
1378
|
+
// ../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js
|
|
1379
|
+
var require_dist2 = __commonJS({
|
|
1380
|
+
"../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js"(exports2) {
|
|
1381
|
+
"use strict";
|
|
1382
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
1383
|
+
if (k2 === void 0) k2 = k;
|
|
1384
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1385
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1386
|
+
desc = { enumerable: true, get: function() {
|
|
1387
|
+
return m[k];
|
|
1388
|
+
} };
|
|
1389
|
+
}
|
|
1390
|
+
Object.defineProperty(o, k2, desc);
|
|
1391
|
+
} : function(o, m, k, k2) {
|
|
1392
|
+
if (k2 === void 0) k2 = k;
|
|
1393
|
+
o[k2] = m[k];
|
|
1394
|
+
});
|
|
1395
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
|
|
1396
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
1397
|
+
} : function(o, v) {
|
|
1398
|
+
o["default"] = v;
|
|
1399
|
+
});
|
|
1400
|
+
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
1401
|
+
if (mod && mod.__esModule) return mod;
|
|
1402
|
+
var result = {};
|
|
1403
|
+
if (mod != null) {
|
|
1404
|
+
for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
1405
|
+
}
|
|
1406
|
+
__setModuleDefault(result, mod);
|
|
1407
|
+
return result;
|
|
1408
|
+
};
|
|
1409
|
+
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
1410
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1411
|
+
};
|
|
1412
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1413
|
+
exports2.HttpsProxyAgent = void 0;
|
|
1414
|
+
var net = __importStar(require("net"));
|
|
1415
|
+
var tls = __importStar(require("tls"));
|
|
1416
|
+
var assert_1 = __importDefault(require("assert"));
|
|
1417
|
+
var debug_1 = __importDefault(require_src());
|
|
1418
|
+
var agent_base_1 = require_dist();
|
|
1419
|
+
var url_1 = require("url");
|
|
1420
|
+
var parse_proxy_response_1 = require_parse_proxy_response();
|
|
1421
|
+
var debug = (0, debug_1.default)("https-proxy-agent");
|
|
1422
|
+
var setServernameFromNonIpHost = (options) => {
|
|
1423
|
+
if (options.servername === void 0 && options.host && !net.isIP(options.host)) {
|
|
1424
|
+
return {
|
|
1425
|
+
...options,
|
|
1426
|
+
servername: options.host
|
|
1427
|
+
};
|
|
1428
|
+
}
|
|
1429
|
+
return options;
|
|
1430
|
+
};
|
|
1431
|
+
var HttpsProxyAgent2 = class extends agent_base_1.Agent {
|
|
1432
|
+
constructor(proxy, opts) {
|
|
1433
|
+
super(opts);
|
|
1434
|
+
this.options = { path: void 0 };
|
|
1435
|
+
this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy;
|
|
1436
|
+
this.proxyHeaders = opts?.headers ?? {};
|
|
1437
|
+
debug("Creating new HttpsProxyAgent instance: %o", this.proxy.href);
|
|
1438
|
+
const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, "");
|
|
1439
|
+
const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80;
|
|
1440
|
+
this.connectOpts = {
|
|
1441
|
+
// Attempt to negotiate http/1.1 for proxy servers that support http/2
|
|
1442
|
+
ALPNProtocols: ["http/1.1"],
|
|
1443
|
+
...opts ? omit(opts, "headers") : null,
|
|
1444
|
+
host,
|
|
1445
|
+
port
|
|
1446
|
+
};
|
|
1447
|
+
}
|
|
1448
|
+
/**
|
|
1449
|
+
* Called when the node-core HTTP client library is creating a
|
|
1450
|
+
* new HTTP request.
|
|
1451
|
+
*/
|
|
1452
|
+
async connect(req, opts) {
|
|
1453
|
+
const { proxy } = this;
|
|
1454
|
+
if (!opts.host) {
|
|
1455
|
+
throw new TypeError('No "host" provided');
|
|
1456
|
+
}
|
|
1457
|
+
let socket;
|
|
1458
|
+
if (proxy.protocol === "https:") {
|
|
1459
|
+
debug("Creating `tls.Socket`: %o", this.connectOpts);
|
|
1460
|
+
socket = tls.connect(setServernameFromNonIpHost(this.connectOpts));
|
|
1461
|
+
} else {
|
|
1462
|
+
debug("Creating `net.Socket`: %o", this.connectOpts);
|
|
1463
|
+
socket = net.connect(this.connectOpts);
|
|
1464
|
+
}
|
|
1465
|
+
const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders };
|
|
1466
|
+
const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
|
|
1467
|
+
let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r
|
|
1468
|
+
`;
|
|
1469
|
+
if (proxy.username || proxy.password) {
|
|
1470
|
+
const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;
|
|
1471
|
+
headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`;
|
|
1472
|
+
}
|
|
1473
|
+
headers.Host = `${host}:${opts.port}`;
|
|
1474
|
+
if (!headers["Proxy-Connection"]) {
|
|
1475
|
+
headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close";
|
|
1476
|
+
}
|
|
1477
|
+
for (const name of Object.keys(headers)) {
|
|
1478
|
+
payload += `${name}: ${headers[name]}\r
|
|
1479
|
+
`;
|
|
1480
|
+
}
|
|
1481
|
+
const proxyResponsePromise = (0, parse_proxy_response_1.parseProxyResponse)(socket);
|
|
1482
|
+
socket.write(`${payload}\r
|
|
1483
|
+
`);
|
|
1484
|
+
const { connect, buffered } = await proxyResponsePromise;
|
|
1485
|
+
req.emit("proxyConnect", connect);
|
|
1486
|
+
this.emit("proxyConnect", connect, req);
|
|
1487
|
+
if (connect.statusCode === 200) {
|
|
1488
|
+
req.once("socket", resume);
|
|
1489
|
+
if (opts.secureEndpoint) {
|
|
1490
|
+
debug("Upgrading socket connection to TLS");
|
|
1491
|
+
return tls.connect({
|
|
1492
|
+
...omit(setServernameFromNonIpHost(opts), "host", "path", "port"),
|
|
1493
|
+
socket
|
|
1494
|
+
});
|
|
1495
|
+
}
|
|
1496
|
+
return socket;
|
|
1497
|
+
}
|
|
1498
|
+
socket.destroy();
|
|
1499
|
+
const fakeSocket = new net.Socket({ writable: false });
|
|
1500
|
+
fakeSocket.readable = true;
|
|
1501
|
+
req.once("socket", (s) => {
|
|
1502
|
+
debug("Replaying proxy buffer for failed request");
|
|
1503
|
+
(0, assert_1.default)(s.listenerCount("data") > 0);
|
|
1504
|
+
s.push(buffered);
|
|
1505
|
+
s.push(null);
|
|
1506
|
+
});
|
|
1507
|
+
return fakeSocket;
|
|
1508
|
+
}
|
|
1509
|
+
};
|
|
1510
|
+
HttpsProxyAgent2.protocols = ["http", "https"];
|
|
1511
|
+
exports2.HttpsProxyAgent = HttpsProxyAgent2;
|
|
1512
|
+
function resume(socket) {
|
|
1513
|
+
socket.resume();
|
|
1514
|
+
}
|
|
1515
|
+
function omit(obj, ...keys) {
|
|
1516
|
+
const ret = {};
|
|
1517
|
+
let key;
|
|
1518
|
+
for (key in obj) {
|
|
1519
|
+
if (!keys.includes(key)) {
|
|
1520
|
+
ret[key] = obj[key];
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
return ret;
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
});
|
|
1527
|
+
|
|
1528
|
+
// src/index.ts
|
|
1529
|
+
var index_exports = {};
|
|
1530
|
+
__export(index_exports, {
|
|
1531
|
+
default: () => index_default
|
|
1532
|
+
});
|
|
1533
|
+
module.exports = __toCommonJS(index_exports);
|
|
1534
|
+
var import_sdk2 = __toESM(require("@eventcatalog/sdk"));
|
|
1535
|
+
var import_chalk5 = __toESM(require("chalk"));
|
|
1536
|
+
|
|
1537
|
+
// ../../node_modules/.pnpm/boxen@8.0.1/node_modules/boxen/index.js
|
|
1538
|
+
var import_node_process = __toESM(require("process"), 1);
|
|
1539
|
+
|
|
1540
|
+
// ../../node_modules/.pnpm/ansi-regex@6.1.0/node_modules/ansi-regex/index.js
|
|
1541
|
+
function ansiRegex({ onlyFirst = false } = {}) {
|
|
1542
|
+
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
1543
|
+
const pattern = [
|
|
1544
|
+
`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
|
|
1545
|
+
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
|
|
1546
|
+
].join("|");
|
|
1547
|
+
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
// ../../node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js
|
|
1551
|
+
var regex = ansiRegex();
|
|
1552
|
+
function stripAnsi(string) {
|
|
1553
|
+
if (typeof string !== "string") {
|
|
1554
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
1555
|
+
}
|
|
1556
|
+
return string.replace(regex, "");
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
// ../../node_modules/.pnpm/get-east-asian-width@1.3.0/node_modules/get-east-asian-width/lookup.js
|
|
1560
|
+
function isAmbiguous(x) {
|
|
1561
|
+
return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
|
|
1562
|
+
}
|
|
1563
|
+
function isFullWidth(x) {
|
|
1564
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
1565
|
+
}
|
|
1566
|
+
function isWide(x) {
|
|
1567
|
+
return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101631 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129673 || x >= 129679 && x <= 129734 || x >= 129742 && x <= 129756 || x >= 129759 && x <= 129769 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
// ../../node_modules/.pnpm/get-east-asian-width@1.3.0/node_modules/get-east-asian-width/index.js
|
|
1571
|
+
function validate(codePoint) {
|
|
1572
|
+
if (!Number.isSafeInteger(codePoint)) {
|
|
1573
|
+
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
1577
|
+
validate(codePoint);
|
|
1578
|
+
if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
|
|
1579
|
+
return 2;
|
|
1580
|
+
}
|
|
1581
|
+
return 1;
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
// ../../node_modules/.pnpm/emoji-regex@10.4.0/node_modules/emoji-regex/index.mjs
|
|
1585
|
+
var emoji_regex_default = () => {
|
|
1586
|
+
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
1587
|
+
};
|
|
1588
|
+
|
|
1589
|
+
// ../../node_modules/.pnpm/string-width@7.2.0/node_modules/string-width/index.js
|
|
1590
|
+
var segmenter = new Intl.Segmenter();
|
|
1591
|
+
var defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
1592
|
+
function stringWidth(string, options = {}) {
|
|
1593
|
+
if (typeof string !== "string" || string.length === 0) {
|
|
1594
|
+
return 0;
|
|
1595
|
+
}
|
|
1596
|
+
const {
|
|
1597
|
+
ambiguousIsNarrow = true,
|
|
1598
|
+
countAnsiEscapeCodes = false
|
|
1599
|
+
} = options;
|
|
1600
|
+
if (!countAnsiEscapeCodes) {
|
|
1601
|
+
string = stripAnsi(string);
|
|
1602
|
+
}
|
|
1603
|
+
if (string.length === 0) {
|
|
1604
|
+
return 0;
|
|
1605
|
+
}
|
|
1606
|
+
let width = 0;
|
|
1607
|
+
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
1608
|
+
for (const { segment: character } of segmenter.segment(string)) {
|
|
1609
|
+
const codePoint = character.codePointAt(0);
|
|
1610
|
+
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
|
1611
|
+
continue;
|
|
1612
|
+
}
|
|
1613
|
+
if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
|
|
1614
|
+
continue;
|
|
1615
|
+
}
|
|
1616
|
+
if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
|
|
1617
|
+
continue;
|
|
1618
|
+
}
|
|
1619
|
+
if (codePoint >= 55296 && codePoint <= 57343) {
|
|
1620
|
+
continue;
|
|
1621
|
+
}
|
|
1622
|
+
if (codePoint >= 65024 && codePoint <= 65039) {
|
|
1623
|
+
continue;
|
|
1624
|
+
}
|
|
1625
|
+
if (defaultIgnorableCodePointRegex.test(character)) {
|
|
1626
|
+
continue;
|
|
1627
|
+
}
|
|
1628
|
+
if (emoji_regex_default().test(character)) {
|
|
1629
|
+
width += 2;
|
|
1630
|
+
continue;
|
|
1631
|
+
}
|
|
1632
|
+
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
1633
|
+
}
|
|
1634
|
+
return width;
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
// ../../node_modules/.pnpm/boxen@8.0.1/node_modules/boxen/index.js
|
|
1638
|
+
var import_chalk = __toESM(require("chalk"), 1);
|
|
1639
|
+
|
|
1640
|
+
// ../../node_modules/.pnpm/widest-line@5.0.0/node_modules/widest-line/index.js
|
|
1641
|
+
function widestLine(string) {
|
|
1642
|
+
let lineWidth = 0;
|
|
1643
|
+
for (const line of string.split("\n")) {
|
|
1644
|
+
lineWidth = Math.max(lineWidth, stringWidth(line));
|
|
1645
|
+
}
|
|
1646
|
+
return lineWidth;
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
// ../../node_modules/.pnpm/boxen@8.0.1/node_modules/boxen/index.js
|
|
1650
|
+
var import_cli_boxes = __toESM(require_cli_boxes(), 1);
|
|
1651
|
+
|
|
1652
|
+
// ../../node_modules/.pnpm/camelcase@8.0.0/node_modules/camelcase/index.js
|
|
1653
|
+
var UPPERCASE = /[\p{Lu}]/u;
|
|
1654
|
+
var LOWERCASE = /[\p{Ll}]/u;
|
|
1655
|
+
var LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu;
|
|
1656
|
+
var IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
|
|
1657
|
+
var SEPARATORS = /[_.\- ]+/;
|
|
1658
|
+
var LEADING_SEPARATORS = new RegExp("^" + SEPARATORS.source);
|
|
1659
|
+
var SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, "gu");
|
|
1660
|
+
var NUMBERS_AND_IDENTIFIER = new RegExp("\\d+" + IDENTIFIER.source, "gu");
|
|
1661
|
+
var preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUppercase2) => {
|
|
1662
|
+
let isLastCharLower = false;
|
|
1663
|
+
let isLastCharUpper = false;
|
|
1664
|
+
let isLastLastCharUpper = false;
|
|
1665
|
+
let isLastLastCharPreserved = false;
|
|
1666
|
+
for (let index = 0; index < string.length; index++) {
|
|
1667
|
+
const character = string[index];
|
|
1668
|
+
isLastLastCharPreserved = index > 2 ? string[index - 3] === "-" : true;
|
|
1669
|
+
if (isLastCharLower && UPPERCASE.test(character)) {
|
|
1670
|
+
string = string.slice(0, index) + "-" + string.slice(index);
|
|
1671
|
+
isLastCharLower = false;
|
|
1672
|
+
isLastLastCharUpper = isLastCharUpper;
|
|
1673
|
+
isLastCharUpper = true;
|
|
1674
|
+
index++;
|
|
1675
|
+
} else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character) && (!isLastLastCharPreserved || preserveConsecutiveUppercase2)) {
|
|
1676
|
+
string = string.slice(0, index - 1) + "-" + string.slice(index - 1);
|
|
1677
|
+
isLastLastCharUpper = isLastCharUpper;
|
|
1678
|
+
isLastCharUpper = false;
|
|
1679
|
+
isLastCharLower = true;
|
|
1680
|
+
} else {
|
|
1681
|
+
isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;
|
|
1682
|
+
isLastLastCharUpper = isLastCharUpper;
|
|
1683
|
+
isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
return string;
|
|
1687
|
+
};
|
|
1688
|
+
var preserveConsecutiveUppercase = (input, toLowerCase) => {
|
|
1689
|
+
LEADING_CAPITAL.lastIndex = 0;
|
|
1690
|
+
return input.replaceAll(LEADING_CAPITAL, (match) => toLowerCase(match));
|
|
1691
|
+
};
|
|
1692
|
+
var postProcess = (input, toUpperCase) => {
|
|
1693
|
+
SEPARATORS_AND_IDENTIFIER.lastIndex = 0;
|
|
1694
|
+
NUMBERS_AND_IDENTIFIER.lastIndex = 0;
|
|
1695
|
+
return input.replaceAll(NUMBERS_AND_IDENTIFIER, (match, pattern, offset) => ["_", "-"].includes(input.charAt(offset + match.length)) ? match : toUpperCase(match)).replaceAll(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier));
|
|
1696
|
+
};
|
|
1697
|
+
function camelCase(input, options) {
|
|
1698
|
+
if (!(typeof input === "string" || Array.isArray(input))) {
|
|
1699
|
+
throw new TypeError("Expected the input to be `string | string[]`");
|
|
1700
|
+
}
|
|
1701
|
+
options = {
|
|
1702
|
+
pascalCase: false,
|
|
1703
|
+
preserveConsecutiveUppercase: false,
|
|
1704
|
+
...options
|
|
1705
|
+
};
|
|
1706
|
+
if (Array.isArray(input)) {
|
|
1707
|
+
input = input.map((x) => x.trim()).filter((x) => x.length).join("-");
|
|
1708
|
+
} else {
|
|
1709
|
+
input = input.trim();
|
|
1710
|
+
}
|
|
1711
|
+
if (input.length === 0) {
|
|
1712
|
+
return "";
|
|
1713
|
+
}
|
|
1714
|
+
const toLowerCase = options.locale === false ? (string) => string.toLowerCase() : (string) => string.toLocaleLowerCase(options.locale);
|
|
1715
|
+
const toUpperCase = options.locale === false ? (string) => string.toUpperCase() : (string) => string.toLocaleUpperCase(options.locale);
|
|
1716
|
+
if (input.length === 1) {
|
|
1717
|
+
if (SEPARATORS.test(input)) {
|
|
1718
|
+
return "";
|
|
1719
|
+
}
|
|
1720
|
+
return options.pascalCase ? toUpperCase(input) : toLowerCase(input);
|
|
1721
|
+
}
|
|
1722
|
+
const hasUpperCase = input !== toLowerCase(input);
|
|
1723
|
+
if (hasUpperCase) {
|
|
1724
|
+
input = preserveCamelCase(input, toLowerCase, toUpperCase, options.preserveConsecutiveUppercase);
|
|
1725
|
+
}
|
|
1726
|
+
input = input.replace(LEADING_SEPARATORS, "");
|
|
1727
|
+
input = options.preserveConsecutiveUppercase ? preserveConsecutiveUppercase(input, toLowerCase) : toLowerCase(input);
|
|
1728
|
+
if (options.pascalCase) {
|
|
1729
|
+
input = toUpperCase(input.charAt(0)) + input.slice(1);
|
|
1730
|
+
}
|
|
1731
|
+
return postProcess(input, toUpperCase);
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
// ../../node_modules/.pnpm/boxen@8.0.1/node_modules/boxen/index.js
|
|
1735
|
+
var import_ansi_align = __toESM(require_ansi_align(), 1);
|
|
1736
|
+
|
|
1737
|
+
// ../../node_modules/.pnpm/ansi-styles@6.2.1/node_modules/ansi-styles/index.js
|
|
1738
|
+
var ANSI_BACKGROUND_OFFSET = 10;
|
|
1739
|
+
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
1740
|
+
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
1741
|
+
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
1742
|
+
var styles = {
|
|
1743
|
+
modifier: {
|
|
1744
|
+
reset: [0, 0],
|
|
1745
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
1746
|
+
bold: [1, 22],
|
|
1747
|
+
dim: [2, 22],
|
|
1748
|
+
italic: [3, 23],
|
|
1749
|
+
underline: [4, 24],
|
|
1750
|
+
overline: [53, 55],
|
|
1751
|
+
inverse: [7, 27],
|
|
1752
|
+
hidden: [8, 28],
|
|
1753
|
+
strikethrough: [9, 29]
|
|
1754
|
+
},
|
|
1755
|
+
color: {
|
|
1756
|
+
black: [30, 39],
|
|
1757
|
+
red: [31, 39],
|
|
1758
|
+
green: [32, 39],
|
|
1759
|
+
yellow: [33, 39],
|
|
1760
|
+
blue: [34, 39],
|
|
1761
|
+
magenta: [35, 39],
|
|
1762
|
+
cyan: [36, 39],
|
|
1763
|
+
white: [37, 39],
|
|
1764
|
+
// Bright color
|
|
1765
|
+
blackBright: [90, 39],
|
|
1766
|
+
gray: [90, 39],
|
|
1767
|
+
// Alias of `blackBright`
|
|
1768
|
+
grey: [90, 39],
|
|
1769
|
+
// Alias of `blackBright`
|
|
1770
|
+
redBright: [91, 39],
|
|
1771
|
+
greenBright: [92, 39],
|
|
1772
|
+
yellowBright: [93, 39],
|
|
1773
|
+
blueBright: [94, 39],
|
|
1774
|
+
magentaBright: [95, 39],
|
|
1775
|
+
cyanBright: [96, 39],
|
|
1776
|
+
whiteBright: [97, 39]
|
|
1777
|
+
},
|
|
1778
|
+
bgColor: {
|
|
1779
|
+
bgBlack: [40, 49],
|
|
1780
|
+
bgRed: [41, 49],
|
|
1781
|
+
bgGreen: [42, 49],
|
|
1782
|
+
bgYellow: [43, 49],
|
|
1783
|
+
bgBlue: [44, 49],
|
|
1784
|
+
bgMagenta: [45, 49],
|
|
1785
|
+
bgCyan: [46, 49],
|
|
1786
|
+
bgWhite: [47, 49],
|
|
1787
|
+
// Bright color
|
|
1788
|
+
bgBlackBright: [100, 49],
|
|
1789
|
+
bgGray: [100, 49],
|
|
1790
|
+
// Alias of `bgBlackBright`
|
|
1791
|
+
bgGrey: [100, 49],
|
|
1792
|
+
// Alias of `bgBlackBright`
|
|
1793
|
+
bgRedBright: [101, 49],
|
|
1794
|
+
bgGreenBright: [102, 49],
|
|
1795
|
+
bgYellowBright: [103, 49],
|
|
1796
|
+
bgBlueBright: [104, 49],
|
|
1797
|
+
bgMagentaBright: [105, 49],
|
|
1798
|
+
bgCyanBright: [106, 49],
|
|
1799
|
+
bgWhiteBright: [107, 49]
|
|
1800
|
+
}
|
|
1801
|
+
};
|
|
1802
|
+
var modifierNames = Object.keys(styles.modifier);
|
|
1803
|
+
var foregroundColorNames = Object.keys(styles.color);
|
|
1804
|
+
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
1805
|
+
var colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
1806
|
+
function assembleStyles() {
|
|
1807
|
+
const codes = /* @__PURE__ */ new Map();
|
|
1808
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
1809
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
1810
|
+
styles[styleName] = {
|
|
1811
|
+
open: `\x1B[${style[0]}m`,
|
|
1812
|
+
close: `\x1B[${style[1]}m`
|
|
1813
|
+
};
|
|
1814
|
+
group[styleName] = styles[styleName];
|
|
1815
|
+
codes.set(style[0], style[1]);
|
|
1816
|
+
}
|
|
1817
|
+
Object.defineProperty(styles, groupName, {
|
|
1818
|
+
value: group,
|
|
1819
|
+
enumerable: false
|
|
1820
|
+
});
|
|
1821
|
+
}
|
|
1822
|
+
Object.defineProperty(styles, "codes", {
|
|
1823
|
+
value: codes,
|
|
1824
|
+
enumerable: false
|
|
1825
|
+
});
|
|
1826
|
+
styles.color.close = "\x1B[39m";
|
|
1827
|
+
styles.bgColor.close = "\x1B[49m";
|
|
1828
|
+
styles.color.ansi = wrapAnsi16();
|
|
1829
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
1830
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
1831
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
1832
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
1833
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
1834
|
+
Object.defineProperties(styles, {
|
|
1835
|
+
rgbToAnsi256: {
|
|
1836
|
+
value: (red, green, blue) => {
|
|
1837
|
+
if (red === green && green === blue) {
|
|
1838
|
+
if (red < 8) {
|
|
1839
|
+
return 16;
|
|
1840
|
+
}
|
|
1841
|
+
if (red > 248) {
|
|
1842
|
+
return 231;
|
|
1843
|
+
}
|
|
1844
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
1845
|
+
}
|
|
1846
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
1847
|
+
},
|
|
1848
|
+
enumerable: false
|
|
1849
|
+
},
|
|
1850
|
+
hexToRgb: {
|
|
1851
|
+
value: (hex) => {
|
|
1852
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
1853
|
+
if (!matches) {
|
|
1854
|
+
return [0, 0, 0];
|
|
1855
|
+
}
|
|
1856
|
+
let [colorString] = matches;
|
|
1857
|
+
if (colorString.length === 3) {
|
|
1858
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
|
1859
|
+
}
|
|
1860
|
+
const integer = Number.parseInt(colorString, 16);
|
|
1861
|
+
return [
|
|
1862
|
+
/* eslint-disable no-bitwise */
|
|
1863
|
+
integer >> 16 & 255,
|
|
1864
|
+
integer >> 8 & 255,
|
|
1865
|
+
integer & 255
|
|
1866
|
+
/* eslint-enable no-bitwise */
|
|
1867
|
+
];
|
|
1868
|
+
},
|
|
1869
|
+
enumerable: false
|
|
1870
|
+
},
|
|
1871
|
+
hexToAnsi256: {
|
|
1872
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
1873
|
+
enumerable: false
|
|
1874
|
+
},
|
|
1875
|
+
ansi256ToAnsi: {
|
|
1876
|
+
value: (code) => {
|
|
1877
|
+
if (code < 8) {
|
|
1878
|
+
return 30 + code;
|
|
1879
|
+
}
|
|
1880
|
+
if (code < 16) {
|
|
1881
|
+
return 90 + (code - 8);
|
|
1882
|
+
}
|
|
1883
|
+
let red;
|
|
1884
|
+
let green;
|
|
1885
|
+
let blue;
|
|
1886
|
+
if (code >= 232) {
|
|
1887
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
1888
|
+
green = red;
|
|
1889
|
+
blue = red;
|
|
1890
|
+
} else {
|
|
1891
|
+
code -= 16;
|
|
1892
|
+
const remainder = code % 36;
|
|
1893
|
+
red = Math.floor(code / 36) / 5;
|
|
1894
|
+
green = Math.floor(remainder / 6) / 5;
|
|
1895
|
+
blue = remainder % 6 / 5;
|
|
1896
|
+
}
|
|
1897
|
+
const value = Math.max(red, green, blue) * 2;
|
|
1898
|
+
if (value === 0) {
|
|
1899
|
+
return 30;
|
|
1900
|
+
}
|
|
1901
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
1902
|
+
if (value === 2) {
|
|
1903
|
+
result += 60;
|
|
1904
|
+
}
|
|
1905
|
+
return result;
|
|
1906
|
+
},
|
|
1907
|
+
enumerable: false
|
|
1908
|
+
},
|
|
1909
|
+
rgbToAnsi: {
|
|
1910
|
+
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
1911
|
+
enumerable: false
|
|
1912
|
+
},
|
|
1913
|
+
hexToAnsi: {
|
|
1914
|
+
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
1915
|
+
enumerable: false
|
|
1916
|
+
}
|
|
1917
|
+
});
|
|
1918
|
+
return styles;
|
|
1919
|
+
}
|
|
1920
|
+
var ansiStyles = assembleStyles();
|
|
1921
|
+
var ansi_styles_default = ansiStyles;
|
|
1922
|
+
|
|
1923
|
+
// ../../node_modules/.pnpm/wrap-ansi@9.0.0/node_modules/wrap-ansi/index.js
|
|
1924
|
+
var ESCAPES = /* @__PURE__ */ new Set([
|
|
1925
|
+
"\x1B",
|
|
1926
|
+
"\x9B"
|
|
1927
|
+
]);
|
|
1928
|
+
var END_CODE = 39;
|
|
1929
|
+
var ANSI_ESCAPE_BELL = "\x07";
|
|
1930
|
+
var ANSI_CSI = "[";
|
|
1931
|
+
var ANSI_OSC = "]";
|
|
1932
|
+
var ANSI_SGR_TERMINATOR = "m";
|
|
1933
|
+
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
1934
|
+
var wrapAnsiCode = (code) => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
1935
|
+
var wrapAnsiHyperlink = (url) => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
1936
|
+
var wordLengths = (string) => string.split(" ").map((character) => stringWidth(character));
|
|
1937
|
+
var wrapWord = (rows, word, columns) => {
|
|
1938
|
+
const characters = [...word];
|
|
1939
|
+
let isInsideEscape = false;
|
|
1940
|
+
let isInsideLinkEscape = false;
|
|
1941
|
+
let visible = stringWidth(stripAnsi(rows.at(-1)));
|
|
1942
|
+
for (const [index, character] of characters.entries()) {
|
|
1943
|
+
const characterLength = stringWidth(character);
|
|
1944
|
+
if (visible + characterLength <= columns) {
|
|
1945
|
+
rows[rows.length - 1] += character;
|
|
1946
|
+
} else {
|
|
1947
|
+
rows.push(character);
|
|
1948
|
+
visible = 0;
|
|
1949
|
+
}
|
|
1950
|
+
if (ESCAPES.has(character)) {
|
|
1951
|
+
isInsideEscape = true;
|
|
1952
|
+
const ansiEscapeLinkCandidate = characters.slice(index + 1, index + 1 + ANSI_ESCAPE_LINK.length).join("");
|
|
1953
|
+
isInsideLinkEscape = ansiEscapeLinkCandidate === ANSI_ESCAPE_LINK;
|
|
1954
|
+
}
|
|
1955
|
+
if (isInsideEscape) {
|
|
1956
|
+
if (isInsideLinkEscape) {
|
|
1957
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
1958
|
+
isInsideEscape = false;
|
|
1959
|
+
isInsideLinkEscape = false;
|
|
1960
|
+
}
|
|
1961
|
+
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
1962
|
+
isInsideEscape = false;
|
|
1963
|
+
}
|
|
1964
|
+
continue;
|
|
1965
|
+
}
|
|
1966
|
+
visible += characterLength;
|
|
1967
|
+
if (visible === columns && index < characters.length - 1) {
|
|
1968
|
+
rows.push("");
|
|
1969
|
+
visible = 0;
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
if (!visible && rows.at(-1).length > 0 && rows.length > 1) {
|
|
1973
|
+
rows[rows.length - 2] += rows.pop();
|
|
1974
|
+
}
|
|
1975
|
+
};
|
|
1976
|
+
var stringVisibleTrimSpacesRight = (string) => {
|
|
1977
|
+
const words = string.split(" ");
|
|
1978
|
+
let last = words.length;
|
|
1979
|
+
while (last > 0) {
|
|
1980
|
+
if (stringWidth(words[last - 1]) > 0) {
|
|
1981
|
+
break;
|
|
1982
|
+
}
|
|
1983
|
+
last--;
|
|
1984
|
+
}
|
|
1985
|
+
if (last === words.length) {
|
|
1986
|
+
return string;
|
|
1987
|
+
}
|
|
1988
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
1989
|
+
};
|
|
1990
|
+
var exec = (string, columns, options = {}) => {
|
|
1991
|
+
if (options.trim !== false && string.trim() === "") {
|
|
1992
|
+
return "";
|
|
1993
|
+
}
|
|
1994
|
+
let returnValue = "";
|
|
1995
|
+
let escapeCode;
|
|
1996
|
+
let escapeUrl;
|
|
1997
|
+
const lengths = wordLengths(string);
|
|
1998
|
+
let rows = [""];
|
|
1999
|
+
for (const [index, word] of string.split(" ").entries()) {
|
|
2000
|
+
if (options.trim !== false) {
|
|
2001
|
+
rows[rows.length - 1] = rows.at(-1).trimStart();
|
|
2002
|
+
}
|
|
2003
|
+
let rowLength = stringWidth(rows.at(-1));
|
|
2004
|
+
if (index !== 0) {
|
|
2005
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
2006
|
+
rows.push("");
|
|
2007
|
+
rowLength = 0;
|
|
2008
|
+
}
|
|
2009
|
+
if (rowLength > 0 || options.trim === false) {
|
|
2010
|
+
rows[rows.length - 1] += " ";
|
|
2011
|
+
rowLength++;
|
|
2012
|
+
}
|
|
2013
|
+
}
|
|
2014
|
+
if (options.hard && lengths[index] > columns) {
|
|
2015
|
+
const remainingColumns = columns - rowLength;
|
|
2016
|
+
const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
|
|
2017
|
+
const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);
|
|
2018
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
2019
|
+
rows.push("");
|
|
2020
|
+
}
|
|
2021
|
+
wrapWord(rows, word, columns);
|
|
2022
|
+
continue;
|
|
2023
|
+
}
|
|
2024
|
+
if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
|
|
2025
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
2026
|
+
wrapWord(rows, word, columns);
|
|
2027
|
+
continue;
|
|
2028
|
+
}
|
|
2029
|
+
rows.push("");
|
|
2030
|
+
}
|
|
2031
|
+
if (rowLength + lengths[index] > columns && options.wordWrap === false) {
|
|
2032
|
+
wrapWord(rows, word, columns);
|
|
2033
|
+
continue;
|
|
2034
|
+
}
|
|
2035
|
+
rows[rows.length - 1] += word;
|
|
2036
|
+
}
|
|
2037
|
+
if (options.trim !== false) {
|
|
2038
|
+
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
2039
|
+
}
|
|
2040
|
+
const preString = rows.join("\n");
|
|
2041
|
+
const pre = [...preString];
|
|
2042
|
+
let preStringIndex = 0;
|
|
2043
|
+
for (const [index, character] of pre.entries()) {
|
|
2044
|
+
returnValue += character;
|
|
2045
|
+
if (ESCAPES.has(character)) {
|
|
2046
|
+
const { groups } = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(preString.slice(preStringIndex)) || { groups: {} };
|
|
2047
|
+
if (groups.code !== void 0) {
|
|
2048
|
+
const code2 = Number.parseFloat(groups.code);
|
|
2049
|
+
escapeCode = code2 === END_CODE ? void 0 : code2;
|
|
2050
|
+
} else if (groups.uri !== void 0) {
|
|
2051
|
+
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
const code = ansi_styles_default.codes.get(Number(escapeCode));
|
|
2055
|
+
if (pre[index + 1] === "\n") {
|
|
2056
|
+
if (escapeUrl) {
|
|
2057
|
+
returnValue += wrapAnsiHyperlink("");
|
|
2058
|
+
}
|
|
2059
|
+
if (escapeCode && code) {
|
|
2060
|
+
returnValue += wrapAnsiCode(code);
|
|
2061
|
+
}
|
|
2062
|
+
} else if (character === "\n") {
|
|
2063
|
+
if (escapeCode && code) {
|
|
2064
|
+
returnValue += wrapAnsiCode(escapeCode);
|
|
2065
|
+
}
|
|
2066
|
+
if (escapeUrl) {
|
|
2067
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
preStringIndex += character.length;
|
|
2071
|
+
}
|
|
2072
|
+
return returnValue;
|
|
2073
|
+
};
|
|
2074
|
+
function wrapAnsi(string, columns, options) {
|
|
2075
|
+
return String(string).normalize().replaceAll("\r\n", "\n").split("\n").map((line) => exec(line, columns, options)).join("\n");
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
// ../../node_modules/.pnpm/boxen@8.0.1/node_modules/boxen/index.js
|
|
2079
|
+
var import_cli_boxes2 = __toESM(require_cli_boxes(), 1);
|
|
2080
|
+
var NEWLINE = "\n";
|
|
2081
|
+
var PAD = " ";
|
|
2082
|
+
var NONE = "none";
|
|
2083
|
+
var terminalColumns = () => {
|
|
2084
|
+
const { env, stdout, stderr } = import_node_process.default;
|
|
2085
|
+
if (stdout?.columns) {
|
|
2086
|
+
return stdout.columns;
|
|
2087
|
+
}
|
|
2088
|
+
if (stderr?.columns) {
|
|
2089
|
+
return stderr.columns;
|
|
2090
|
+
}
|
|
2091
|
+
if (env.COLUMNS) {
|
|
2092
|
+
return Number.parseInt(env.COLUMNS, 10);
|
|
2093
|
+
}
|
|
2094
|
+
return 80;
|
|
2095
|
+
};
|
|
2096
|
+
var getObject = (detail) => typeof detail === "number" ? {
|
|
2097
|
+
top: detail,
|
|
2098
|
+
right: detail * 3,
|
|
2099
|
+
bottom: detail,
|
|
2100
|
+
left: detail * 3
|
|
2101
|
+
} : {
|
|
2102
|
+
top: 0,
|
|
2103
|
+
right: 0,
|
|
2104
|
+
bottom: 0,
|
|
2105
|
+
left: 0,
|
|
2106
|
+
...detail
|
|
2107
|
+
};
|
|
2108
|
+
var getBorderWidth = (borderStyle) => borderStyle === NONE ? 0 : 2;
|
|
2109
|
+
var getBorderChars = (borderStyle) => {
|
|
2110
|
+
const sides = [
|
|
2111
|
+
"topLeft",
|
|
2112
|
+
"topRight",
|
|
2113
|
+
"bottomRight",
|
|
2114
|
+
"bottomLeft",
|
|
2115
|
+
"left",
|
|
2116
|
+
"right",
|
|
2117
|
+
"top",
|
|
2118
|
+
"bottom"
|
|
2119
|
+
];
|
|
2120
|
+
let characters;
|
|
2121
|
+
if (borderStyle === NONE) {
|
|
2122
|
+
borderStyle = {};
|
|
2123
|
+
for (const side of sides) {
|
|
2124
|
+
borderStyle[side] = "";
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
if (typeof borderStyle === "string") {
|
|
2128
|
+
characters = import_cli_boxes.default[borderStyle];
|
|
2129
|
+
if (!characters) {
|
|
2130
|
+
throw new TypeError(`Invalid border style: ${borderStyle}`);
|
|
2131
|
+
}
|
|
2132
|
+
} else {
|
|
2133
|
+
if (typeof borderStyle?.vertical === "string") {
|
|
2134
|
+
borderStyle.left = borderStyle.vertical;
|
|
2135
|
+
borderStyle.right = borderStyle.vertical;
|
|
2136
|
+
}
|
|
2137
|
+
if (typeof borderStyle?.horizontal === "string") {
|
|
2138
|
+
borderStyle.top = borderStyle.horizontal;
|
|
2139
|
+
borderStyle.bottom = borderStyle.horizontal;
|
|
2140
|
+
}
|
|
2141
|
+
for (const side of sides) {
|
|
2142
|
+
if (borderStyle[side] === null || typeof borderStyle[side] !== "string") {
|
|
2143
|
+
throw new TypeError(`Invalid border style: ${side}`);
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
characters = borderStyle;
|
|
2147
|
+
}
|
|
2148
|
+
return characters;
|
|
2149
|
+
};
|
|
2150
|
+
var makeTitle = (text, horizontal, alignment) => {
|
|
2151
|
+
let title = "";
|
|
2152
|
+
const textWidth = stringWidth(text);
|
|
2153
|
+
switch (alignment) {
|
|
2154
|
+
case "left": {
|
|
2155
|
+
title = text + horizontal.slice(textWidth);
|
|
2156
|
+
break;
|
|
2157
|
+
}
|
|
2158
|
+
case "right": {
|
|
2159
|
+
title = horizontal.slice(textWidth) + text;
|
|
2160
|
+
break;
|
|
2161
|
+
}
|
|
2162
|
+
default: {
|
|
2163
|
+
horizontal = horizontal.slice(textWidth);
|
|
2164
|
+
if (horizontal.length % 2 === 1) {
|
|
2165
|
+
horizontal = horizontal.slice(Math.floor(horizontal.length / 2));
|
|
2166
|
+
title = horizontal.slice(1) + text + horizontal;
|
|
2167
|
+
} else {
|
|
2168
|
+
horizontal = horizontal.slice(horizontal.length / 2);
|
|
2169
|
+
title = horizontal + text + horizontal;
|
|
2170
|
+
}
|
|
2171
|
+
break;
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
return title;
|
|
2175
|
+
};
|
|
2176
|
+
var makeContentText = (text, { padding, width, textAlignment, height }) => {
|
|
2177
|
+
text = (0, import_ansi_align.default)(text, { align: textAlignment });
|
|
2178
|
+
let lines = text.split(NEWLINE);
|
|
2179
|
+
const textWidth = widestLine(text);
|
|
2180
|
+
const max = width - padding.left - padding.right;
|
|
2181
|
+
if (textWidth > max) {
|
|
2182
|
+
const newLines = [];
|
|
2183
|
+
for (const line of lines) {
|
|
2184
|
+
const createdLines = wrapAnsi(line, max, { hard: true });
|
|
2185
|
+
const alignedLines = (0, import_ansi_align.default)(createdLines, { align: textAlignment });
|
|
2186
|
+
const alignedLinesArray = alignedLines.split("\n");
|
|
2187
|
+
const longestLength = Math.max(...alignedLinesArray.map((s) => stringWidth(s)));
|
|
2188
|
+
for (const alignedLine of alignedLinesArray) {
|
|
2189
|
+
let paddedLine;
|
|
2190
|
+
switch (textAlignment) {
|
|
2191
|
+
case "center": {
|
|
2192
|
+
paddedLine = PAD.repeat((max - longestLength) / 2) + alignedLine;
|
|
2193
|
+
break;
|
|
2194
|
+
}
|
|
2195
|
+
case "right": {
|
|
2196
|
+
paddedLine = PAD.repeat(max - longestLength) + alignedLine;
|
|
2197
|
+
break;
|
|
2198
|
+
}
|
|
2199
|
+
default: {
|
|
2200
|
+
paddedLine = alignedLine;
|
|
2201
|
+
break;
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2204
|
+
newLines.push(paddedLine);
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2207
|
+
lines = newLines;
|
|
2208
|
+
}
|
|
2209
|
+
if (textAlignment === "center" && textWidth < max) {
|
|
2210
|
+
lines = lines.map((line) => PAD.repeat((max - textWidth) / 2) + line);
|
|
2211
|
+
} else if (textAlignment === "right" && textWidth < max) {
|
|
2212
|
+
lines = lines.map((line) => PAD.repeat(max - textWidth) + line);
|
|
2213
|
+
}
|
|
2214
|
+
const paddingLeft = PAD.repeat(padding.left);
|
|
2215
|
+
const paddingRight = PAD.repeat(padding.right);
|
|
2216
|
+
lines = lines.map((line) => {
|
|
2217
|
+
const newLine = paddingLeft + line + paddingRight;
|
|
2218
|
+
return newLine + PAD.repeat(width - stringWidth(newLine));
|
|
2219
|
+
});
|
|
2220
|
+
if (padding.top > 0) {
|
|
2221
|
+
lines = [...Array.from({ length: padding.top }).fill(PAD.repeat(width)), ...lines];
|
|
2222
|
+
}
|
|
2223
|
+
if (padding.bottom > 0) {
|
|
2224
|
+
lines = [...lines, ...Array.from({ length: padding.bottom }).fill(PAD.repeat(width))];
|
|
2225
|
+
}
|
|
2226
|
+
if (height && lines.length > height) {
|
|
2227
|
+
lines = lines.slice(0, height);
|
|
2228
|
+
} else if (height && lines.length < height) {
|
|
2229
|
+
lines = [...lines, ...Array.from({ length: height - lines.length }).fill(PAD.repeat(width))];
|
|
2230
|
+
}
|
|
2231
|
+
return lines.join(NEWLINE);
|
|
2232
|
+
};
|
|
2233
|
+
var boxContent = (content, contentWidth, options) => {
|
|
2234
|
+
const colorizeBorder = (border) => {
|
|
2235
|
+
const newBorder = options.borderColor ? getColorFunction(options.borderColor)(border) : border;
|
|
2236
|
+
return options.dimBorder ? import_chalk.default.dim(newBorder) : newBorder;
|
|
2237
|
+
};
|
|
2238
|
+
const colorizeContent = (content2) => options.backgroundColor ? getBGColorFunction(options.backgroundColor)(content2) : content2;
|
|
2239
|
+
const chars = getBorderChars(options.borderStyle);
|
|
2240
|
+
const columns = terminalColumns();
|
|
2241
|
+
let marginLeft = PAD.repeat(options.margin.left);
|
|
2242
|
+
if (options.float === "center") {
|
|
2243
|
+
const marginWidth = Math.max((columns - contentWidth - getBorderWidth(options.borderStyle)) / 2, 0);
|
|
2244
|
+
marginLeft = PAD.repeat(marginWidth);
|
|
2245
|
+
} else if (options.float === "right") {
|
|
2246
|
+
const marginWidth = Math.max(columns - contentWidth - options.margin.right - getBorderWidth(options.borderStyle), 0);
|
|
2247
|
+
marginLeft = PAD.repeat(marginWidth);
|
|
2248
|
+
}
|
|
2249
|
+
let result = "";
|
|
2250
|
+
if (options.margin.top) {
|
|
2251
|
+
result += NEWLINE.repeat(options.margin.top);
|
|
2252
|
+
}
|
|
2253
|
+
if (options.borderStyle !== NONE || options.title) {
|
|
2254
|
+
result += colorizeBorder(marginLeft + chars.topLeft + (options.title ? makeTitle(options.title, chars.top.repeat(contentWidth), options.titleAlignment) : chars.top.repeat(contentWidth)) + chars.topRight) + NEWLINE;
|
|
2255
|
+
}
|
|
2256
|
+
const lines = content.split(NEWLINE);
|
|
2257
|
+
result += lines.map((line) => marginLeft + colorizeBorder(chars.left) + colorizeContent(line) + colorizeBorder(chars.right)).join(NEWLINE);
|
|
2258
|
+
if (options.borderStyle !== NONE) {
|
|
2259
|
+
result += NEWLINE + colorizeBorder(marginLeft + chars.bottomLeft + chars.bottom.repeat(contentWidth) + chars.bottomRight);
|
|
2260
|
+
}
|
|
2261
|
+
if (options.margin.bottom) {
|
|
2262
|
+
result += NEWLINE.repeat(options.margin.bottom);
|
|
2263
|
+
}
|
|
2264
|
+
return result;
|
|
2265
|
+
};
|
|
2266
|
+
var sanitizeOptions = (options) => {
|
|
2267
|
+
if (options.fullscreen && import_node_process.default?.stdout) {
|
|
2268
|
+
let newDimensions = [import_node_process.default.stdout.columns, import_node_process.default.stdout.rows];
|
|
2269
|
+
if (typeof options.fullscreen === "function") {
|
|
2270
|
+
newDimensions = options.fullscreen(...newDimensions);
|
|
2271
|
+
}
|
|
2272
|
+
options.width || (options.width = newDimensions[0]);
|
|
2273
|
+
options.height || (options.height = newDimensions[1]);
|
|
2274
|
+
}
|
|
2275
|
+
options.width && (options.width = Math.max(1, options.width - getBorderWidth(options.borderStyle)));
|
|
2276
|
+
options.height && (options.height = Math.max(1, options.height - getBorderWidth(options.borderStyle)));
|
|
2277
|
+
return options;
|
|
2278
|
+
};
|
|
2279
|
+
var formatTitle = (title, borderStyle) => borderStyle === NONE ? title : ` ${title} `;
|
|
2280
|
+
var determineDimensions = (text, options) => {
|
|
2281
|
+
options = sanitizeOptions(options);
|
|
2282
|
+
const widthOverride = options.width !== void 0;
|
|
2283
|
+
const columns = terminalColumns();
|
|
2284
|
+
const borderWidth = getBorderWidth(options.borderStyle);
|
|
2285
|
+
const maxWidth = columns - options.margin.left - options.margin.right - borderWidth;
|
|
2286
|
+
const widest = widestLine(wrapAnsi(text, columns - borderWidth, { hard: true, trim: false })) + options.padding.left + options.padding.right;
|
|
2287
|
+
if (options.title && widthOverride) {
|
|
2288
|
+
options.title = options.title.slice(0, Math.max(0, options.width - 2));
|
|
2289
|
+
options.title && (options.title = formatTitle(options.title, options.borderStyle));
|
|
2290
|
+
} else if (options.title) {
|
|
2291
|
+
options.title = options.title.slice(0, Math.max(0, maxWidth - 2));
|
|
2292
|
+
if (options.title) {
|
|
2293
|
+
options.title = formatTitle(options.title, options.borderStyle);
|
|
2294
|
+
if (stringWidth(options.title) > widest) {
|
|
2295
|
+
options.width = stringWidth(options.title);
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
options.width || (options.width = widest);
|
|
2300
|
+
if (!widthOverride) {
|
|
2301
|
+
if (options.margin.left && options.margin.right && options.width > maxWidth) {
|
|
2302
|
+
const spaceForMargins = columns - options.width - borderWidth;
|
|
2303
|
+
const multiplier = spaceForMargins / (options.margin.left + options.margin.right);
|
|
2304
|
+
options.margin.left = Math.max(0, Math.floor(options.margin.left * multiplier));
|
|
2305
|
+
options.margin.right = Math.max(0, Math.floor(options.margin.right * multiplier));
|
|
2306
|
+
}
|
|
2307
|
+
options.width = Math.min(options.width, columns - borderWidth - options.margin.left - options.margin.right);
|
|
2308
|
+
}
|
|
2309
|
+
if (options.width - (options.padding.left + options.padding.right) <= 0) {
|
|
2310
|
+
options.padding.left = 0;
|
|
2311
|
+
options.padding.right = 0;
|
|
2312
|
+
}
|
|
2313
|
+
if (options.height && options.height - (options.padding.top + options.padding.bottom) <= 0) {
|
|
2314
|
+
options.padding.top = 0;
|
|
2315
|
+
options.padding.bottom = 0;
|
|
2316
|
+
}
|
|
2317
|
+
return options;
|
|
2318
|
+
};
|
|
2319
|
+
var isHex = (color) => color.match(/^#(?:[0-f]{3}){1,2}$/i);
|
|
2320
|
+
var isColorValid = (color) => typeof color === "string" && (import_chalk.default[color] ?? isHex(color));
|
|
2321
|
+
var getColorFunction = (color) => isHex(color) ? import_chalk.default.hex(color) : import_chalk.default[color];
|
|
2322
|
+
var getBGColorFunction = (color) => isHex(color) ? import_chalk.default.bgHex(color) : import_chalk.default[camelCase(["bg", color])];
|
|
2323
|
+
function boxen(text, options) {
|
|
2324
|
+
options = {
|
|
2325
|
+
padding: 0,
|
|
2326
|
+
borderStyle: "single",
|
|
2327
|
+
dimBorder: false,
|
|
2328
|
+
textAlignment: "left",
|
|
2329
|
+
float: "left",
|
|
2330
|
+
titleAlignment: "left",
|
|
2331
|
+
...options
|
|
2332
|
+
};
|
|
2333
|
+
if (options.align) {
|
|
2334
|
+
options.textAlignment = options.align;
|
|
2335
|
+
}
|
|
2336
|
+
if (options.borderColor && !isColorValid(options.borderColor)) {
|
|
2337
|
+
throw new Error(`${options.borderColor} is not a valid borderColor`);
|
|
2338
|
+
}
|
|
2339
|
+
if (options.backgroundColor && !isColorValid(options.backgroundColor)) {
|
|
2340
|
+
throw new Error(`${options.backgroundColor} is not a valid backgroundColor`);
|
|
2341
|
+
}
|
|
2342
|
+
options.padding = getObject(options.padding);
|
|
2343
|
+
options.margin = getObject(options.margin);
|
|
2344
|
+
options = determineDimensions(text, options);
|
|
2345
|
+
text = makeContentText(text, options);
|
|
2346
|
+
return boxContent(text, options.width, options);
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2349
|
+
// ../../shared/check-for-package-update.ts
|
|
2350
|
+
var import_fs = __toESM(require("fs"));
|
|
2351
|
+
var import_path = __toESM(require("path"));
|
|
2352
|
+
var getInstalledVersionOfPackage = (packageName) => {
|
|
2353
|
+
try {
|
|
2354
|
+
const PROJECT_DIR = process.env.PROJECT_DIR || process.cwd();
|
|
2355
|
+
const pkg = import_fs.default.readFileSync(import_path.default.join(PROJECT_DIR, "package.json"), "utf8");
|
|
2356
|
+
const json = JSON.parse(pkg);
|
|
2357
|
+
const version = json.dependencies[packageName];
|
|
2358
|
+
return version?.replace(/[\^~><=]/g, "");
|
|
2359
|
+
} catch (error) {
|
|
2360
|
+
return null;
|
|
2361
|
+
}
|
|
2362
|
+
};
|
|
2363
|
+
async function checkForPackageUpdate(packageName) {
|
|
2364
|
+
const installedVersion = getInstalledVersionOfPackage(packageName);
|
|
2365
|
+
if (!installedVersion || installedVersion === "latest") return;
|
|
2366
|
+
try {
|
|
2367
|
+
const pkg = { name: packageName, version: installedVersion };
|
|
2368
|
+
const updateNotifierModule = await import("update-notifier");
|
|
2369
|
+
const notifier = updateNotifierModule.default({ pkg, updateCheckInterval: 0, shouldNotifyInNpmScript: true });
|
|
2370
|
+
const info = await notifier.fetchInfo();
|
|
2371
|
+
if (info?.type !== "latest") {
|
|
2372
|
+
const message2 = `Package ${packageName} update available ${info.current} \u2192 ${info.latest}
|
|
2373
|
+
Run npm i ${packageName} to update`;
|
|
2374
|
+
console.log(
|
|
2375
|
+
boxen(message2, {
|
|
2376
|
+
padding: 1,
|
|
2377
|
+
margin: 1,
|
|
2378
|
+
align: "center",
|
|
2379
|
+
borderColor: "yellow",
|
|
2380
|
+
borderStyle: {
|
|
2381
|
+
topLeft: " ",
|
|
2382
|
+
topRight: " ",
|
|
2383
|
+
bottomLeft: " ",
|
|
2384
|
+
bottomRight: " ",
|
|
2385
|
+
right: " ",
|
|
2386
|
+
top: "-",
|
|
2387
|
+
bottom: "-",
|
|
2388
|
+
left: " "
|
|
2389
|
+
}
|
|
2390
|
+
})
|
|
2391
|
+
);
|
|
2392
|
+
}
|
|
2393
|
+
} catch (error) {
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2396
|
+
|
|
2397
|
+
// ../../shared/checkLicense.ts
|
|
2398
|
+
var import_chalk3 = __toESM(require("chalk"));
|
|
2399
|
+
|
|
2400
|
+
// ../../node_modules/.pnpm/@eventcatalog+license@0.0.7/node_modules/@eventcatalog/license/dist/verify.js
|
|
2401
|
+
var import_fs2 = require("fs");
|
|
2402
|
+
|
|
2403
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/base64url.js
|
|
2404
|
+
var import_node_buffer = require("buffer");
|
|
2405
|
+
|
|
2406
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/buffer_utils.js
|
|
2407
|
+
var encoder = new TextEncoder();
|
|
2408
|
+
var decoder = new TextDecoder();
|
|
2409
|
+
var MAX_INT32 = 2 ** 32;
|
|
2410
|
+
function concat(...buffers) {
|
|
2411
|
+
const size = buffers.reduce((acc, { length }) => acc + length, 0);
|
|
2412
|
+
const buf = new Uint8Array(size);
|
|
2413
|
+
let i = 0;
|
|
2414
|
+
for (const buffer of buffers) {
|
|
2415
|
+
buf.set(buffer, i);
|
|
2416
|
+
i += buffer.length;
|
|
2417
|
+
}
|
|
2418
|
+
return buf;
|
|
2419
|
+
}
|
|
2420
|
+
|
|
2421
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/base64url.js
|
|
2422
|
+
function normalize(input) {
|
|
2423
|
+
let encoded = input;
|
|
2424
|
+
if (encoded instanceof Uint8Array) {
|
|
2425
|
+
encoded = decoder.decode(encoded);
|
|
2426
|
+
}
|
|
2427
|
+
return encoded;
|
|
2428
|
+
}
|
|
2429
|
+
var decode = (input) => new Uint8Array(import_node_buffer.Buffer.from(normalize(input), "base64url"));
|
|
2430
|
+
|
|
2431
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/util/errors.js
|
|
2432
|
+
var JOSEError = class extends Error {
|
|
2433
|
+
constructor(message2, options) {
|
|
2434
|
+
super(message2, options);
|
|
2435
|
+
__publicField(this, "code", "ERR_JOSE_GENERIC");
|
|
2436
|
+
this.name = this.constructor.name;
|
|
2437
|
+
Error.captureStackTrace?.(this, this.constructor);
|
|
2438
|
+
}
|
|
2439
|
+
};
|
|
2440
|
+
__publicField(JOSEError, "code", "ERR_JOSE_GENERIC");
|
|
2441
|
+
var JWTClaimValidationFailed = class extends JOSEError {
|
|
2442
|
+
constructor(message2, payload, claim = "unspecified", reason = "unspecified") {
|
|
2443
|
+
super(message2, { cause: { claim, reason, payload } });
|
|
2444
|
+
__publicField(this, "code", "ERR_JWT_CLAIM_VALIDATION_FAILED");
|
|
2445
|
+
__publicField(this, "claim");
|
|
2446
|
+
__publicField(this, "reason");
|
|
2447
|
+
__publicField(this, "payload");
|
|
2448
|
+
this.claim = claim;
|
|
2449
|
+
this.reason = reason;
|
|
2450
|
+
this.payload = payload;
|
|
2451
|
+
}
|
|
2452
|
+
};
|
|
2453
|
+
__publicField(JWTClaimValidationFailed, "code", "ERR_JWT_CLAIM_VALIDATION_FAILED");
|
|
2454
|
+
var JWTExpired = class extends JOSEError {
|
|
2455
|
+
constructor(message2, payload, claim = "unspecified", reason = "unspecified") {
|
|
2456
|
+
super(message2, { cause: { claim, reason, payload } });
|
|
2457
|
+
__publicField(this, "code", "ERR_JWT_EXPIRED");
|
|
2458
|
+
__publicField(this, "claim");
|
|
2459
|
+
__publicField(this, "reason");
|
|
2460
|
+
__publicField(this, "payload");
|
|
2461
|
+
this.claim = claim;
|
|
2462
|
+
this.reason = reason;
|
|
2463
|
+
this.payload = payload;
|
|
2464
|
+
}
|
|
2465
|
+
};
|
|
2466
|
+
__publicField(JWTExpired, "code", "ERR_JWT_EXPIRED");
|
|
2467
|
+
var JOSEAlgNotAllowed = class extends JOSEError {
|
|
2468
|
+
constructor() {
|
|
2469
|
+
super(...arguments);
|
|
2470
|
+
__publicField(this, "code", "ERR_JOSE_ALG_NOT_ALLOWED");
|
|
2471
|
+
}
|
|
2472
|
+
};
|
|
2473
|
+
__publicField(JOSEAlgNotAllowed, "code", "ERR_JOSE_ALG_NOT_ALLOWED");
|
|
2474
|
+
var JOSENotSupported = class extends JOSEError {
|
|
2475
|
+
constructor() {
|
|
2476
|
+
super(...arguments);
|
|
2477
|
+
__publicField(this, "code", "ERR_JOSE_NOT_SUPPORTED");
|
|
2478
|
+
}
|
|
2479
|
+
};
|
|
2480
|
+
__publicField(JOSENotSupported, "code", "ERR_JOSE_NOT_SUPPORTED");
|
|
2481
|
+
var JWSInvalid = class extends JOSEError {
|
|
2482
|
+
constructor() {
|
|
2483
|
+
super(...arguments);
|
|
2484
|
+
__publicField(this, "code", "ERR_JWS_INVALID");
|
|
2485
|
+
}
|
|
2486
|
+
};
|
|
2487
|
+
__publicField(JWSInvalid, "code", "ERR_JWS_INVALID");
|
|
2488
|
+
var JWTInvalid = class extends JOSEError {
|
|
2489
|
+
constructor() {
|
|
2490
|
+
super(...arguments);
|
|
2491
|
+
__publicField(this, "code", "ERR_JWT_INVALID");
|
|
2492
|
+
}
|
|
2493
|
+
};
|
|
2494
|
+
__publicField(JWTInvalid, "code", "ERR_JWT_INVALID");
|
|
2495
|
+
var _a, _b;
|
|
2496
|
+
var JWKSMultipleMatchingKeys = class extends (_b = JOSEError, _a = Symbol.asyncIterator, _b) {
|
|
2497
|
+
constructor(message2 = "multiple matching keys found in the JSON Web Key Set", options) {
|
|
2498
|
+
super(message2, options);
|
|
2499
|
+
__publicField(this, _a);
|
|
2500
|
+
__publicField(this, "code", "ERR_JWKS_MULTIPLE_MATCHING_KEYS");
|
|
2501
|
+
}
|
|
2502
|
+
};
|
|
2503
|
+
__publicField(JWKSMultipleMatchingKeys, "code", "ERR_JWKS_MULTIPLE_MATCHING_KEYS");
|
|
2504
|
+
var JWSSignatureVerificationFailed = class extends JOSEError {
|
|
2505
|
+
constructor(message2 = "signature verification failed", options) {
|
|
2506
|
+
super(message2, options);
|
|
2507
|
+
__publicField(this, "code", "ERR_JWS_SIGNATURE_VERIFICATION_FAILED");
|
|
2508
|
+
}
|
|
2509
|
+
};
|
|
2510
|
+
__publicField(JWSSignatureVerificationFailed, "code", "ERR_JWS_SIGNATURE_VERIFICATION_FAILED");
|
|
2511
|
+
|
|
2512
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/is_key_object.js
|
|
2513
|
+
var util = __toESM(require("util"), 1);
|
|
2514
|
+
var is_key_object_default = (obj) => util.types.isKeyObject(obj);
|
|
2515
|
+
|
|
2516
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/webcrypto.js
|
|
2517
|
+
var crypto = __toESM(require("crypto"), 1);
|
|
2518
|
+
var util2 = __toESM(require("util"), 1);
|
|
2519
|
+
var webcrypto2 = crypto.webcrypto;
|
|
2520
|
+
var webcrypto_default = webcrypto2;
|
|
2521
|
+
var isCryptoKey = (key) => util2.types.isCryptoKey(key);
|
|
2522
|
+
|
|
2523
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/crypto_key.js
|
|
2524
|
+
function unusable(name, prop = "algorithm.name") {
|
|
2525
|
+
return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);
|
|
2526
|
+
}
|
|
2527
|
+
function isAlgorithm(algorithm, name) {
|
|
2528
|
+
return algorithm.name === name;
|
|
2529
|
+
}
|
|
2530
|
+
function getHashLength(hash) {
|
|
2531
|
+
return parseInt(hash.name.slice(4), 10);
|
|
2532
|
+
}
|
|
2533
|
+
function getNamedCurve(alg) {
|
|
2534
|
+
switch (alg) {
|
|
2535
|
+
case "ES256":
|
|
2536
|
+
return "P-256";
|
|
2537
|
+
case "ES384":
|
|
2538
|
+
return "P-384";
|
|
2539
|
+
case "ES512":
|
|
2540
|
+
return "P-521";
|
|
2541
|
+
default:
|
|
2542
|
+
throw new Error("unreachable");
|
|
2543
|
+
}
|
|
2544
|
+
}
|
|
2545
|
+
function checkUsage(key, usages) {
|
|
2546
|
+
if (usages.length && !usages.some((expected) => key.usages.includes(expected))) {
|
|
2547
|
+
let msg = "CryptoKey does not support this operation, its usages must include ";
|
|
2548
|
+
if (usages.length > 2) {
|
|
2549
|
+
const last = usages.pop();
|
|
2550
|
+
msg += `one of ${usages.join(", ")}, or ${last}.`;
|
|
2551
|
+
} else if (usages.length === 2) {
|
|
2552
|
+
msg += `one of ${usages[0]} or ${usages[1]}.`;
|
|
2553
|
+
} else {
|
|
2554
|
+
msg += `${usages[0]}.`;
|
|
2555
|
+
}
|
|
2556
|
+
throw new TypeError(msg);
|
|
2557
|
+
}
|
|
2558
|
+
}
|
|
2559
|
+
function checkSigCryptoKey(key, alg, ...usages) {
|
|
2560
|
+
switch (alg) {
|
|
2561
|
+
case "HS256":
|
|
2562
|
+
case "HS384":
|
|
2563
|
+
case "HS512": {
|
|
2564
|
+
if (!isAlgorithm(key.algorithm, "HMAC"))
|
|
2565
|
+
throw unusable("HMAC");
|
|
2566
|
+
const expected = parseInt(alg.slice(2), 10);
|
|
2567
|
+
const actual = getHashLength(key.algorithm.hash);
|
|
2568
|
+
if (actual !== expected)
|
|
2569
|
+
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
2570
|
+
break;
|
|
2571
|
+
}
|
|
2572
|
+
case "RS256":
|
|
2573
|
+
case "RS384":
|
|
2574
|
+
case "RS512": {
|
|
2575
|
+
if (!isAlgorithm(key.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
2576
|
+
throw unusable("RSASSA-PKCS1-v1_5");
|
|
2577
|
+
const expected = parseInt(alg.slice(2), 10);
|
|
2578
|
+
const actual = getHashLength(key.algorithm.hash);
|
|
2579
|
+
if (actual !== expected)
|
|
2580
|
+
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
2581
|
+
break;
|
|
2582
|
+
}
|
|
2583
|
+
case "PS256":
|
|
2584
|
+
case "PS384":
|
|
2585
|
+
case "PS512": {
|
|
2586
|
+
if (!isAlgorithm(key.algorithm, "RSA-PSS"))
|
|
2587
|
+
throw unusable("RSA-PSS");
|
|
2588
|
+
const expected = parseInt(alg.slice(2), 10);
|
|
2589
|
+
const actual = getHashLength(key.algorithm.hash);
|
|
2590
|
+
if (actual !== expected)
|
|
2591
|
+
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
2592
|
+
break;
|
|
2593
|
+
}
|
|
2594
|
+
case "EdDSA": {
|
|
2595
|
+
if (key.algorithm.name !== "Ed25519" && key.algorithm.name !== "Ed448") {
|
|
2596
|
+
throw unusable("Ed25519 or Ed448");
|
|
2597
|
+
}
|
|
2598
|
+
break;
|
|
2599
|
+
}
|
|
2600
|
+
case "Ed25519": {
|
|
2601
|
+
if (!isAlgorithm(key.algorithm, "Ed25519"))
|
|
2602
|
+
throw unusable("Ed25519");
|
|
2603
|
+
break;
|
|
2604
|
+
}
|
|
2605
|
+
case "ES256":
|
|
2606
|
+
case "ES384":
|
|
2607
|
+
case "ES512": {
|
|
2608
|
+
if (!isAlgorithm(key.algorithm, "ECDSA"))
|
|
2609
|
+
throw unusable("ECDSA");
|
|
2610
|
+
const expected = getNamedCurve(alg);
|
|
2611
|
+
const actual = key.algorithm.namedCurve;
|
|
2612
|
+
if (actual !== expected)
|
|
2613
|
+
throw unusable(expected, "algorithm.namedCurve");
|
|
2614
|
+
break;
|
|
2615
|
+
}
|
|
2616
|
+
default:
|
|
2617
|
+
throw new TypeError("CryptoKey does not support this operation");
|
|
2618
|
+
}
|
|
2619
|
+
checkUsage(key, usages);
|
|
2620
|
+
}
|
|
2621
|
+
|
|
2622
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/invalid_key_input.js
|
|
2623
|
+
function message(msg, actual, ...types4) {
|
|
2624
|
+
types4 = types4.filter(Boolean);
|
|
2625
|
+
if (types4.length > 2) {
|
|
2626
|
+
const last = types4.pop();
|
|
2627
|
+
msg += `one of type ${types4.join(", ")}, or ${last}.`;
|
|
2628
|
+
} else if (types4.length === 2) {
|
|
2629
|
+
msg += `one of type ${types4[0]} or ${types4[1]}.`;
|
|
2630
|
+
} else {
|
|
2631
|
+
msg += `of type ${types4[0]}.`;
|
|
2632
|
+
}
|
|
2633
|
+
if (actual == null) {
|
|
2634
|
+
msg += ` Received ${actual}`;
|
|
2635
|
+
} else if (typeof actual === "function" && actual.name) {
|
|
2636
|
+
msg += ` Received function ${actual.name}`;
|
|
2637
|
+
} else if (typeof actual === "object" && actual != null) {
|
|
2638
|
+
if (actual.constructor?.name) {
|
|
2639
|
+
msg += ` Received an instance of ${actual.constructor.name}`;
|
|
2640
|
+
}
|
|
2641
|
+
}
|
|
2642
|
+
return msg;
|
|
2643
|
+
}
|
|
2644
|
+
var invalid_key_input_default = (actual, ...types4) => {
|
|
2645
|
+
return message("Key must be ", actual, ...types4);
|
|
2646
|
+
};
|
|
2647
|
+
function withAlg(alg, actual, ...types4) {
|
|
2648
|
+
return message(`Key for the ${alg} algorithm must be `, actual, ...types4);
|
|
2649
|
+
}
|
|
2650
|
+
|
|
2651
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/is_key_like.js
|
|
2652
|
+
var is_key_like_default = (key) => is_key_object_default(key) || isCryptoKey(key);
|
|
2653
|
+
var types3 = ["KeyObject"];
|
|
2654
|
+
if (globalThis.CryptoKey || webcrypto_default?.CryptoKey) {
|
|
2655
|
+
types3.push("CryptoKey");
|
|
2656
|
+
}
|
|
2657
|
+
|
|
2658
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_disjoint.js
|
|
2659
|
+
var isDisjoint = (...headers) => {
|
|
2660
|
+
const sources = headers.filter(Boolean);
|
|
2661
|
+
if (sources.length === 0 || sources.length === 1) {
|
|
2662
|
+
return true;
|
|
2663
|
+
}
|
|
2664
|
+
let acc;
|
|
2665
|
+
for (const header of sources) {
|
|
2666
|
+
const parameters = Object.keys(header);
|
|
2667
|
+
if (!acc || acc.size === 0) {
|
|
2668
|
+
acc = new Set(parameters);
|
|
2669
|
+
continue;
|
|
2670
|
+
}
|
|
2671
|
+
for (const parameter of parameters) {
|
|
2672
|
+
if (acc.has(parameter)) {
|
|
2673
|
+
return false;
|
|
2674
|
+
}
|
|
2675
|
+
acc.add(parameter);
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2678
|
+
return true;
|
|
2679
|
+
};
|
|
2680
|
+
var is_disjoint_default = isDisjoint;
|
|
2681
|
+
|
|
2682
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_object.js
|
|
2683
|
+
function isObjectLike(value) {
|
|
2684
|
+
return typeof value === "object" && value !== null;
|
|
2685
|
+
}
|
|
2686
|
+
function isObject(input) {
|
|
2687
|
+
if (!isObjectLike(input) || Object.prototype.toString.call(input) !== "[object Object]") {
|
|
2688
|
+
return false;
|
|
2689
|
+
}
|
|
2690
|
+
if (Object.getPrototypeOf(input) === null) {
|
|
2691
|
+
return true;
|
|
2692
|
+
}
|
|
2693
|
+
let proto = input;
|
|
2694
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
2695
|
+
proto = Object.getPrototypeOf(proto);
|
|
2696
|
+
}
|
|
2697
|
+
return Object.getPrototypeOf(input) === proto;
|
|
2698
|
+
}
|
|
2699
|
+
|
|
2700
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_named_curve.js
|
|
2701
|
+
var import_node_crypto = require("crypto");
|
|
2702
|
+
|
|
2703
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_jwk.js
|
|
2704
|
+
function isJWK(key) {
|
|
2705
|
+
return isObject(key) && typeof key.kty === "string";
|
|
2706
|
+
}
|
|
2707
|
+
function isPrivateJWK(key) {
|
|
2708
|
+
return key.kty !== "oct" && typeof key.d === "string";
|
|
2709
|
+
}
|
|
2710
|
+
function isPublicJWK(key) {
|
|
2711
|
+
return key.kty !== "oct" && typeof key.d === "undefined";
|
|
2712
|
+
}
|
|
2713
|
+
function isSecretJWK(key) {
|
|
2714
|
+
return isJWK(key) && key.kty === "oct" && typeof key.k === "string";
|
|
2715
|
+
}
|
|
2716
|
+
|
|
2717
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_named_curve.js
|
|
2718
|
+
var namedCurveToJOSE = (namedCurve) => {
|
|
2719
|
+
switch (namedCurve) {
|
|
2720
|
+
case "prime256v1":
|
|
2721
|
+
return "P-256";
|
|
2722
|
+
case "secp384r1":
|
|
2723
|
+
return "P-384";
|
|
2724
|
+
case "secp521r1":
|
|
2725
|
+
return "P-521";
|
|
2726
|
+
case "secp256k1":
|
|
2727
|
+
return "secp256k1";
|
|
2728
|
+
default:
|
|
2729
|
+
throw new JOSENotSupported("Unsupported key curve for this operation");
|
|
2730
|
+
}
|
|
2731
|
+
};
|
|
2732
|
+
var getNamedCurve2 = (kee, raw) => {
|
|
2733
|
+
let key;
|
|
2734
|
+
if (isCryptoKey(kee)) {
|
|
2735
|
+
key = import_node_crypto.KeyObject.from(kee);
|
|
2736
|
+
} else if (is_key_object_default(kee)) {
|
|
2737
|
+
key = kee;
|
|
2738
|
+
} else if (isJWK(kee)) {
|
|
2739
|
+
return kee.crv;
|
|
2740
|
+
} else {
|
|
2741
|
+
throw new TypeError(invalid_key_input_default(kee, ...types3));
|
|
2742
|
+
}
|
|
2743
|
+
if (key.type === "secret") {
|
|
2744
|
+
throw new TypeError('only "private" or "public" type keys can be used for this operation');
|
|
2745
|
+
}
|
|
2746
|
+
switch (key.asymmetricKeyType) {
|
|
2747
|
+
case "ed25519":
|
|
2748
|
+
case "ed448":
|
|
2749
|
+
return `Ed${key.asymmetricKeyType.slice(2)}`;
|
|
2750
|
+
case "x25519":
|
|
2751
|
+
case "x448":
|
|
2752
|
+
return `X${key.asymmetricKeyType.slice(1)}`;
|
|
2753
|
+
case "ec": {
|
|
2754
|
+
const namedCurve = key.asymmetricKeyDetails.namedCurve;
|
|
2755
|
+
if (raw) {
|
|
2756
|
+
return namedCurve;
|
|
2757
|
+
}
|
|
2758
|
+
return namedCurveToJOSE(namedCurve);
|
|
2759
|
+
}
|
|
2760
|
+
default:
|
|
2761
|
+
throw new TypeError("Invalid asymmetric key type for this operation");
|
|
2762
|
+
}
|
|
2763
|
+
};
|
|
2764
|
+
var get_named_curve_default = getNamedCurve2;
|
|
2765
|
+
|
|
2766
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/check_key_length.js
|
|
2767
|
+
var import_node_crypto2 = require("crypto");
|
|
2768
|
+
var check_key_length_default = (key, alg) => {
|
|
2769
|
+
let modulusLength;
|
|
2770
|
+
try {
|
|
2771
|
+
if (key instanceof import_node_crypto2.KeyObject) {
|
|
2772
|
+
modulusLength = key.asymmetricKeyDetails?.modulusLength;
|
|
2773
|
+
} else {
|
|
2774
|
+
modulusLength = Buffer.from(key.n, "base64url").byteLength << 3;
|
|
2775
|
+
}
|
|
2776
|
+
} catch {
|
|
2777
|
+
}
|
|
2778
|
+
if (typeof modulusLength !== "number" || modulusLength < 2048) {
|
|
2779
|
+
throw new TypeError(`${alg} requires key modulusLength to be 2048 bits or larger`);
|
|
2780
|
+
}
|
|
2781
|
+
};
|
|
2782
|
+
|
|
2783
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/asn1.js
|
|
2784
|
+
var import_node_crypto3 = require("crypto");
|
|
2785
|
+
var import_node_buffer2 = require("buffer");
|
|
2786
|
+
var fromSPKI = (pem) => (0, import_node_crypto3.createPublicKey)({
|
|
2787
|
+
key: import_node_buffer2.Buffer.from(pem.replace(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, ""), "base64"),
|
|
2788
|
+
type: "spki",
|
|
2789
|
+
format: "der"
|
|
2790
|
+
});
|
|
2791
|
+
|
|
2792
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/jwk_to_key.js
|
|
2793
|
+
var import_node_crypto4 = require("crypto");
|
|
2794
|
+
var parse = (key) => {
|
|
2795
|
+
if (key.d) {
|
|
2796
|
+
return (0, import_node_crypto4.createPrivateKey)({ format: "jwk", key });
|
|
2797
|
+
}
|
|
2798
|
+
return (0, import_node_crypto4.createPublicKey)({ format: "jwk", key });
|
|
2799
|
+
};
|
|
2800
|
+
var jwk_to_key_default = parse;
|
|
2801
|
+
|
|
2802
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/key/import.js
|
|
2803
|
+
async function importSPKI(spki, alg, options) {
|
|
2804
|
+
if (typeof spki !== "string" || spki.indexOf("-----BEGIN PUBLIC KEY-----") !== 0) {
|
|
2805
|
+
throw new TypeError('"spki" must be SPKI formatted string');
|
|
2806
|
+
}
|
|
2807
|
+
return fromSPKI(spki, alg, options);
|
|
2808
|
+
}
|
|
2809
|
+
async function importJWK(jwk, alg) {
|
|
2810
|
+
if (!isObject(jwk)) {
|
|
2811
|
+
throw new TypeError("JWK must be an object");
|
|
2812
|
+
}
|
|
2813
|
+
alg || (alg = jwk.alg);
|
|
2814
|
+
switch (jwk.kty) {
|
|
2815
|
+
case "oct":
|
|
2816
|
+
if (typeof jwk.k !== "string" || !jwk.k) {
|
|
2817
|
+
throw new TypeError('missing "k" (Key Value) Parameter value');
|
|
2818
|
+
}
|
|
2819
|
+
return decode(jwk.k);
|
|
2820
|
+
case "RSA":
|
|
2821
|
+
if ("oth" in jwk && jwk.oth !== void 0) {
|
|
2822
|
+
throw new JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
|
|
2823
|
+
}
|
|
2824
|
+
case "EC":
|
|
2825
|
+
case "OKP":
|
|
2826
|
+
return jwk_to_key_default({ ...jwk, alg });
|
|
2827
|
+
default:
|
|
2828
|
+
throw new JOSENotSupported('Unsupported "kty" (Key Type) Parameter value');
|
|
2829
|
+
}
|
|
2830
|
+
}
|
|
2831
|
+
|
|
2832
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/check_key_type.js
|
|
2833
|
+
var tag = (key) => key?.[Symbol.toStringTag];
|
|
2834
|
+
var jwkMatchesOp = (alg, key, usage) => {
|
|
2835
|
+
if (key.use !== void 0 && key.use !== "sig") {
|
|
2836
|
+
throw new TypeError("Invalid key for this operation, when present its use must be sig");
|
|
2837
|
+
}
|
|
2838
|
+
if (key.key_ops !== void 0 && key.key_ops.includes?.(usage) !== true) {
|
|
2839
|
+
throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${usage}`);
|
|
2840
|
+
}
|
|
2841
|
+
if (key.alg !== void 0 && key.alg !== alg) {
|
|
2842
|
+
throw new TypeError(`Invalid key for this operation, when present its alg must be ${alg}`);
|
|
2843
|
+
}
|
|
2844
|
+
return true;
|
|
2845
|
+
};
|
|
2846
|
+
var symmetricTypeCheck = (alg, key, usage, allowJwk) => {
|
|
2847
|
+
if (key instanceof Uint8Array)
|
|
2848
|
+
return;
|
|
2849
|
+
if (allowJwk && isJWK(key)) {
|
|
2850
|
+
if (isSecretJWK(key) && jwkMatchesOp(alg, key, usage))
|
|
2851
|
+
return;
|
|
2852
|
+
throw new TypeError(`JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present`);
|
|
2853
|
+
}
|
|
2854
|
+
if (!is_key_like_default(key)) {
|
|
2855
|
+
throw new TypeError(withAlg(alg, key, ...types3, "Uint8Array", allowJwk ? "JSON Web Key" : null));
|
|
2856
|
+
}
|
|
2857
|
+
if (key.type !== "secret") {
|
|
2858
|
+
throw new TypeError(`${tag(key)} instances for symmetric algorithms must be of type "secret"`);
|
|
2859
|
+
}
|
|
2860
|
+
};
|
|
2861
|
+
var asymmetricTypeCheck = (alg, key, usage, allowJwk) => {
|
|
2862
|
+
if (allowJwk && isJWK(key)) {
|
|
2863
|
+
switch (usage) {
|
|
2864
|
+
case "sign":
|
|
2865
|
+
if (isPrivateJWK(key) && jwkMatchesOp(alg, key, usage))
|
|
2866
|
+
return;
|
|
2867
|
+
throw new TypeError(`JSON Web Key for this operation be a private JWK`);
|
|
2868
|
+
case "verify":
|
|
2869
|
+
if (isPublicJWK(key) && jwkMatchesOp(alg, key, usage))
|
|
2870
|
+
return;
|
|
2871
|
+
throw new TypeError(`JSON Web Key for this operation be a public JWK`);
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2874
|
+
if (!is_key_like_default(key)) {
|
|
2875
|
+
throw new TypeError(withAlg(alg, key, ...types3, allowJwk ? "JSON Web Key" : null));
|
|
2876
|
+
}
|
|
2877
|
+
if (key.type === "secret") {
|
|
2878
|
+
throw new TypeError(`${tag(key)} instances for asymmetric algorithms must not be of type "secret"`);
|
|
2879
|
+
}
|
|
2880
|
+
if (usage === "sign" && key.type === "public") {
|
|
2881
|
+
throw new TypeError(`${tag(key)} instances for asymmetric algorithm signing must be of type "private"`);
|
|
2882
|
+
}
|
|
2883
|
+
if (usage === "decrypt" && key.type === "public") {
|
|
2884
|
+
throw new TypeError(`${tag(key)} instances for asymmetric algorithm decryption must be of type "private"`);
|
|
2885
|
+
}
|
|
2886
|
+
if (key.algorithm && usage === "verify" && key.type === "private") {
|
|
2887
|
+
throw new TypeError(`${tag(key)} instances for asymmetric algorithm verifying must be of type "public"`);
|
|
2888
|
+
}
|
|
2889
|
+
if (key.algorithm && usage === "encrypt" && key.type === "private") {
|
|
2890
|
+
throw new TypeError(`${tag(key)} instances for asymmetric algorithm encryption must be of type "public"`);
|
|
2891
|
+
}
|
|
2892
|
+
};
|
|
2893
|
+
function checkKeyType(allowJwk, alg, key, usage) {
|
|
2894
|
+
const symmetric = alg.startsWith("HS") || alg === "dir" || alg.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(alg);
|
|
2895
|
+
if (symmetric) {
|
|
2896
|
+
symmetricTypeCheck(alg, key, usage, allowJwk);
|
|
2897
|
+
} else {
|
|
2898
|
+
asymmetricTypeCheck(alg, key, usage, allowJwk);
|
|
2899
|
+
}
|
|
2900
|
+
}
|
|
2901
|
+
var check_key_type_default = checkKeyType.bind(void 0, false);
|
|
2902
|
+
var checkKeyTypeWithJwk = checkKeyType.bind(void 0, true);
|
|
2903
|
+
|
|
2904
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/validate_crit.js
|
|
2905
|
+
function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
|
|
2906
|
+
if (joseHeader.crit !== void 0 && protectedHeader?.crit === void 0) {
|
|
2907
|
+
throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
2908
|
+
}
|
|
2909
|
+
if (!protectedHeader || protectedHeader.crit === void 0) {
|
|
2910
|
+
return /* @__PURE__ */ new Set();
|
|
2911
|
+
}
|
|
2912
|
+
if (!Array.isArray(protectedHeader.crit) || protectedHeader.crit.length === 0 || protectedHeader.crit.some((input) => typeof input !== "string" || input.length === 0)) {
|
|
2913
|
+
throw new Err('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
|
|
2914
|
+
}
|
|
2915
|
+
let recognized;
|
|
2916
|
+
if (recognizedOption !== void 0) {
|
|
2917
|
+
recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]);
|
|
2918
|
+
} else {
|
|
2919
|
+
recognized = recognizedDefault;
|
|
2920
|
+
}
|
|
2921
|
+
for (const parameter of protectedHeader.crit) {
|
|
2922
|
+
if (!recognized.has(parameter)) {
|
|
2923
|
+
throw new JOSENotSupported(`Extension Header Parameter "${parameter}" is not recognized`);
|
|
2924
|
+
}
|
|
2925
|
+
if (joseHeader[parameter] === void 0) {
|
|
2926
|
+
throw new Err(`Extension Header Parameter "${parameter}" is missing`);
|
|
2927
|
+
}
|
|
2928
|
+
if (recognized.get(parameter) && protectedHeader[parameter] === void 0) {
|
|
2929
|
+
throw new Err(`Extension Header Parameter "${parameter}" MUST be integrity protected`);
|
|
2930
|
+
}
|
|
2931
|
+
}
|
|
2932
|
+
return new Set(protectedHeader.crit);
|
|
2933
|
+
}
|
|
2934
|
+
var validate_crit_default = validateCrit;
|
|
2935
|
+
|
|
2936
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/validate_algorithms.js
|
|
2937
|
+
var validateAlgorithms = (option, algorithms) => {
|
|
2938
|
+
if (algorithms !== void 0 && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
|
|
2939
|
+
throw new TypeError(`"${option}" option must be an array of strings`);
|
|
2940
|
+
}
|
|
2941
|
+
if (!algorithms) {
|
|
2942
|
+
return void 0;
|
|
2943
|
+
}
|
|
2944
|
+
return new Set(algorithms);
|
|
2945
|
+
};
|
|
2946
|
+
var validate_algorithms_default = validateAlgorithms;
|
|
2947
|
+
|
|
2948
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/verify.js
|
|
2949
|
+
var crypto3 = __toESM(require("crypto"), 1);
|
|
2950
|
+
var import_node_util2 = require("util");
|
|
2951
|
+
|
|
2952
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/dsa_digest.js
|
|
2953
|
+
function dsaDigest(alg) {
|
|
2954
|
+
switch (alg) {
|
|
2955
|
+
case "PS256":
|
|
2956
|
+
case "RS256":
|
|
2957
|
+
case "ES256":
|
|
2958
|
+
case "ES256K":
|
|
2959
|
+
return "sha256";
|
|
2960
|
+
case "PS384":
|
|
2961
|
+
case "RS384":
|
|
2962
|
+
case "ES384":
|
|
2963
|
+
return "sha384";
|
|
2964
|
+
case "PS512":
|
|
2965
|
+
case "RS512":
|
|
2966
|
+
case "ES512":
|
|
2967
|
+
return "sha512";
|
|
2968
|
+
case "Ed25519":
|
|
2969
|
+
case "EdDSA":
|
|
2970
|
+
return void 0;
|
|
2971
|
+
default:
|
|
2972
|
+
throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
2973
|
+
}
|
|
2974
|
+
}
|
|
2975
|
+
|
|
2976
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/node_key.js
|
|
2977
|
+
var import_node_crypto5 = require("crypto");
|
|
2978
|
+
var ecCurveAlgMap = /* @__PURE__ */ new Map([
|
|
2979
|
+
["ES256", "P-256"],
|
|
2980
|
+
["ES256K", "secp256k1"],
|
|
2981
|
+
["ES384", "P-384"],
|
|
2982
|
+
["ES512", "P-521"]
|
|
2983
|
+
]);
|
|
2984
|
+
function keyForCrypto(alg, key) {
|
|
2985
|
+
let asymmetricKeyType;
|
|
2986
|
+
let asymmetricKeyDetails;
|
|
2987
|
+
let isJWK2;
|
|
2988
|
+
if (key instanceof import_node_crypto5.KeyObject) {
|
|
2989
|
+
asymmetricKeyType = key.asymmetricKeyType;
|
|
2990
|
+
asymmetricKeyDetails = key.asymmetricKeyDetails;
|
|
2991
|
+
} else {
|
|
2992
|
+
isJWK2 = true;
|
|
2993
|
+
switch (key.kty) {
|
|
2994
|
+
case "RSA":
|
|
2995
|
+
asymmetricKeyType = "rsa";
|
|
2996
|
+
break;
|
|
2997
|
+
case "EC":
|
|
2998
|
+
asymmetricKeyType = "ec";
|
|
2999
|
+
break;
|
|
3000
|
+
case "OKP": {
|
|
3001
|
+
if (key.crv === "Ed25519") {
|
|
3002
|
+
asymmetricKeyType = "ed25519";
|
|
3003
|
+
break;
|
|
3004
|
+
}
|
|
3005
|
+
if (key.crv === "Ed448") {
|
|
3006
|
+
asymmetricKeyType = "ed448";
|
|
3007
|
+
break;
|
|
3008
|
+
}
|
|
3009
|
+
throw new TypeError("Invalid key for this operation, its crv must be Ed25519 or Ed448");
|
|
3010
|
+
}
|
|
3011
|
+
default:
|
|
3012
|
+
throw new TypeError("Invalid key for this operation, its kty must be RSA, OKP, or EC");
|
|
3013
|
+
}
|
|
3014
|
+
}
|
|
3015
|
+
let options;
|
|
3016
|
+
switch (alg) {
|
|
3017
|
+
case "Ed25519":
|
|
3018
|
+
if (asymmetricKeyType !== "ed25519") {
|
|
3019
|
+
throw new TypeError(`Invalid key for this operation, its asymmetricKeyType must be ed25519`);
|
|
3020
|
+
}
|
|
3021
|
+
break;
|
|
3022
|
+
case "EdDSA":
|
|
3023
|
+
if (!["ed25519", "ed448"].includes(asymmetricKeyType)) {
|
|
3024
|
+
throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be ed25519 or ed448");
|
|
3025
|
+
}
|
|
3026
|
+
break;
|
|
3027
|
+
case "RS256":
|
|
3028
|
+
case "RS384":
|
|
3029
|
+
case "RS512":
|
|
3030
|
+
if (asymmetricKeyType !== "rsa") {
|
|
3031
|
+
throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa");
|
|
3032
|
+
}
|
|
3033
|
+
check_key_length_default(key, alg);
|
|
3034
|
+
break;
|
|
3035
|
+
case "PS256":
|
|
3036
|
+
case "PS384":
|
|
3037
|
+
case "PS512":
|
|
3038
|
+
if (asymmetricKeyType === "rsa-pss") {
|
|
3039
|
+
const { hashAlgorithm, mgf1HashAlgorithm, saltLength } = asymmetricKeyDetails;
|
|
3040
|
+
const length = parseInt(alg.slice(-3), 10);
|
|
3041
|
+
if (hashAlgorithm !== void 0 && (hashAlgorithm !== `sha${length}` || mgf1HashAlgorithm !== hashAlgorithm)) {
|
|
3042
|
+
throw new TypeError(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${alg}`);
|
|
3043
|
+
}
|
|
3044
|
+
if (saltLength !== void 0 && saltLength > length >> 3) {
|
|
3045
|
+
throw new TypeError(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${alg}`);
|
|
3046
|
+
}
|
|
3047
|
+
} else if (asymmetricKeyType !== "rsa") {
|
|
3048
|
+
throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa or rsa-pss");
|
|
3049
|
+
}
|
|
3050
|
+
check_key_length_default(key, alg);
|
|
3051
|
+
options = {
|
|
3052
|
+
padding: import_node_crypto5.constants.RSA_PKCS1_PSS_PADDING,
|
|
3053
|
+
saltLength: import_node_crypto5.constants.RSA_PSS_SALTLEN_DIGEST
|
|
3054
|
+
};
|
|
3055
|
+
break;
|
|
3056
|
+
case "ES256":
|
|
3057
|
+
case "ES256K":
|
|
3058
|
+
case "ES384":
|
|
3059
|
+
case "ES512": {
|
|
3060
|
+
if (asymmetricKeyType !== "ec") {
|
|
3061
|
+
throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be ec");
|
|
3062
|
+
}
|
|
3063
|
+
const actual = get_named_curve_default(key);
|
|
3064
|
+
const expected = ecCurveAlgMap.get(alg);
|
|
3065
|
+
if (actual !== expected) {
|
|
3066
|
+
throw new TypeError(`Invalid key curve for the algorithm, its curve must be ${expected}, got ${actual}`);
|
|
3067
|
+
}
|
|
3068
|
+
options = { dsaEncoding: "ieee-p1363" };
|
|
3069
|
+
break;
|
|
3070
|
+
}
|
|
3071
|
+
default:
|
|
3072
|
+
throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
3073
|
+
}
|
|
3074
|
+
if (isJWK2) {
|
|
3075
|
+
return { format: "jwk", key, ...options };
|
|
3076
|
+
}
|
|
3077
|
+
return options ? { ...options, key } : key;
|
|
3078
|
+
}
|
|
3079
|
+
|
|
3080
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/sign.js
|
|
3081
|
+
var crypto2 = __toESM(require("crypto"), 1);
|
|
3082
|
+
var import_node_util = require("util");
|
|
3083
|
+
|
|
3084
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/hmac_digest.js
|
|
3085
|
+
function hmacDigest(alg) {
|
|
3086
|
+
switch (alg) {
|
|
3087
|
+
case "HS256":
|
|
3088
|
+
return "sha256";
|
|
3089
|
+
case "HS384":
|
|
3090
|
+
return "sha384";
|
|
3091
|
+
case "HS512":
|
|
3092
|
+
return "sha512";
|
|
3093
|
+
default:
|
|
3094
|
+
throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
3095
|
+
}
|
|
3096
|
+
}
|
|
3097
|
+
|
|
3098
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_sign_verify_key.js
|
|
3099
|
+
var import_node_crypto6 = require("crypto");
|
|
3100
|
+
function getSignVerifyKey(alg, key, usage) {
|
|
3101
|
+
if (key instanceof Uint8Array) {
|
|
3102
|
+
if (!alg.startsWith("HS")) {
|
|
3103
|
+
throw new TypeError(invalid_key_input_default(key, ...types3));
|
|
3104
|
+
}
|
|
3105
|
+
return (0, import_node_crypto6.createSecretKey)(key);
|
|
3106
|
+
}
|
|
3107
|
+
if (key instanceof import_node_crypto6.KeyObject) {
|
|
3108
|
+
return key;
|
|
3109
|
+
}
|
|
3110
|
+
if (isCryptoKey(key)) {
|
|
3111
|
+
checkSigCryptoKey(key, alg, usage);
|
|
3112
|
+
return import_node_crypto6.KeyObject.from(key);
|
|
3113
|
+
}
|
|
3114
|
+
if (isJWK(key)) {
|
|
3115
|
+
if (alg.startsWith("HS")) {
|
|
3116
|
+
return (0, import_node_crypto6.createSecretKey)(Buffer.from(key.k, "base64url"));
|
|
3117
|
+
}
|
|
3118
|
+
return key;
|
|
3119
|
+
}
|
|
3120
|
+
throw new TypeError(invalid_key_input_default(key, ...types3, "Uint8Array", "JSON Web Key"));
|
|
3121
|
+
}
|
|
3122
|
+
|
|
3123
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/sign.js
|
|
3124
|
+
var oneShotSign = (0, import_node_util.promisify)(crypto2.sign);
|
|
3125
|
+
var sign2 = async (alg, key, data) => {
|
|
3126
|
+
const k = getSignVerifyKey(alg, key, "sign");
|
|
3127
|
+
if (alg.startsWith("HS")) {
|
|
3128
|
+
const hmac = crypto2.createHmac(hmacDigest(alg), k);
|
|
3129
|
+
hmac.update(data);
|
|
3130
|
+
return hmac.digest();
|
|
3131
|
+
}
|
|
3132
|
+
return oneShotSign(dsaDigest(alg), data, keyForCrypto(alg, k));
|
|
3133
|
+
};
|
|
3134
|
+
var sign_default = sign2;
|
|
3135
|
+
|
|
3136
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/verify.js
|
|
3137
|
+
var oneShotVerify = (0, import_node_util2.promisify)(crypto3.verify);
|
|
3138
|
+
var verify2 = async (alg, key, signature, data) => {
|
|
3139
|
+
const k = getSignVerifyKey(alg, key, "verify");
|
|
3140
|
+
if (alg.startsWith("HS")) {
|
|
3141
|
+
const expected = await sign_default(alg, k, data);
|
|
3142
|
+
const actual = signature;
|
|
3143
|
+
try {
|
|
3144
|
+
return crypto3.timingSafeEqual(actual, expected);
|
|
3145
|
+
} catch {
|
|
3146
|
+
return false;
|
|
3147
|
+
}
|
|
3148
|
+
}
|
|
3149
|
+
const algorithm = dsaDigest(alg);
|
|
3150
|
+
const keyInput = keyForCrypto(alg, k);
|
|
3151
|
+
try {
|
|
3152
|
+
return await oneShotVerify(algorithm, data, keyInput, signature);
|
|
3153
|
+
} catch {
|
|
3154
|
+
return false;
|
|
3155
|
+
}
|
|
3156
|
+
};
|
|
3157
|
+
var verify_default = verify2;
|
|
3158
|
+
|
|
3159
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jws/flattened/verify.js
|
|
3160
|
+
async function flattenedVerify(jws, key, options) {
|
|
3161
|
+
if (!isObject(jws)) {
|
|
3162
|
+
throw new JWSInvalid("Flattened JWS must be an object");
|
|
3163
|
+
}
|
|
3164
|
+
if (jws.protected === void 0 && jws.header === void 0) {
|
|
3165
|
+
throw new JWSInvalid('Flattened JWS must have either of the "protected" or "header" members');
|
|
3166
|
+
}
|
|
3167
|
+
if (jws.protected !== void 0 && typeof jws.protected !== "string") {
|
|
3168
|
+
throw new JWSInvalid("JWS Protected Header incorrect type");
|
|
3169
|
+
}
|
|
3170
|
+
if (jws.payload === void 0) {
|
|
3171
|
+
throw new JWSInvalid("JWS Payload missing");
|
|
3172
|
+
}
|
|
3173
|
+
if (typeof jws.signature !== "string") {
|
|
3174
|
+
throw new JWSInvalid("JWS Signature missing or incorrect type");
|
|
3175
|
+
}
|
|
3176
|
+
if (jws.header !== void 0 && !isObject(jws.header)) {
|
|
3177
|
+
throw new JWSInvalid("JWS Unprotected Header incorrect type");
|
|
3178
|
+
}
|
|
3179
|
+
let parsedProt = {};
|
|
3180
|
+
if (jws.protected) {
|
|
3181
|
+
try {
|
|
3182
|
+
const protectedHeader = decode(jws.protected);
|
|
3183
|
+
parsedProt = JSON.parse(decoder.decode(protectedHeader));
|
|
3184
|
+
} catch {
|
|
3185
|
+
throw new JWSInvalid("JWS Protected Header is invalid");
|
|
3186
|
+
}
|
|
3187
|
+
}
|
|
3188
|
+
if (!is_disjoint_default(parsedProt, jws.header)) {
|
|
3189
|
+
throw new JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
|
|
3190
|
+
}
|
|
3191
|
+
const joseHeader = {
|
|
3192
|
+
...parsedProt,
|
|
3193
|
+
...jws.header
|
|
3194
|
+
};
|
|
3195
|
+
const extensions = validate_crit_default(JWSInvalid, /* @__PURE__ */ new Map([["b64", true]]), options?.crit, parsedProt, joseHeader);
|
|
3196
|
+
let b64 = true;
|
|
3197
|
+
if (extensions.has("b64")) {
|
|
3198
|
+
b64 = parsedProt.b64;
|
|
3199
|
+
if (typeof b64 !== "boolean") {
|
|
3200
|
+
throw new JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
|
|
3201
|
+
}
|
|
3202
|
+
}
|
|
3203
|
+
const { alg } = joseHeader;
|
|
3204
|
+
if (typeof alg !== "string" || !alg) {
|
|
3205
|
+
throw new JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');
|
|
3206
|
+
}
|
|
3207
|
+
const algorithms = options && validate_algorithms_default("algorithms", options.algorithms);
|
|
3208
|
+
if (algorithms && !algorithms.has(alg)) {
|
|
3209
|
+
throw new JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter value not allowed');
|
|
3210
|
+
}
|
|
3211
|
+
if (b64) {
|
|
3212
|
+
if (typeof jws.payload !== "string") {
|
|
3213
|
+
throw new JWSInvalid("JWS Payload must be a string");
|
|
3214
|
+
}
|
|
3215
|
+
} else if (typeof jws.payload !== "string" && !(jws.payload instanceof Uint8Array)) {
|
|
3216
|
+
throw new JWSInvalid("JWS Payload must be a string or an Uint8Array instance");
|
|
3217
|
+
}
|
|
3218
|
+
let resolvedKey = false;
|
|
3219
|
+
if (typeof key === "function") {
|
|
3220
|
+
key = await key(parsedProt, jws);
|
|
3221
|
+
resolvedKey = true;
|
|
3222
|
+
checkKeyTypeWithJwk(alg, key, "verify");
|
|
3223
|
+
if (isJWK(key)) {
|
|
3224
|
+
key = await importJWK(key, alg);
|
|
3225
|
+
}
|
|
3226
|
+
} else {
|
|
3227
|
+
checkKeyTypeWithJwk(alg, key, "verify");
|
|
3228
|
+
}
|
|
3229
|
+
const data = concat(encoder.encode(jws.protected ?? ""), encoder.encode("."), typeof jws.payload === "string" ? encoder.encode(jws.payload) : jws.payload);
|
|
3230
|
+
let signature;
|
|
3231
|
+
try {
|
|
3232
|
+
signature = decode(jws.signature);
|
|
3233
|
+
} catch {
|
|
3234
|
+
throw new JWSInvalid("Failed to base64url decode the signature");
|
|
3235
|
+
}
|
|
3236
|
+
const verified = await verify_default(alg, key, signature, data);
|
|
3237
|
+
if (!verified) {
|
|
3238
|
+
throw new JWSSignatureVerificationFailed();
|
|
3239
|
+
}
|
|
3240
|
+
let payload;
|
|
3241
|
+
if (b64) {
|
|
3242
|
+
try {
|
|
3243
|
+
payload = decode(jws.payload);
|
|
3244
|
+
} catch {
|
|
3245
|
+
throw new JWSInvalid("Failed to base64url decode the payload");
|
|
3246
|
+
}
|
|
3247
|
+
} else if (typeof jws.payload === "string") {
|
|
3248
|
+
payload = encoder.encode(jws.payload);
|
|
3249
|
+
} else {
|
|
3250
|
+
payload = jws.payload;
|
|
3251
|
+
}
|
|
3252
|
+
const result = { payload };
|
|
3253
|
+
if (jws.protected !== void 0) {
|
|
3254
|
+
result.protectedHeader = parsedProt;
|
|
3255
|
+
}
|
|
3256
|
+
if (jws.header !== void 0) {
|
|
3257
|
+
result.unprotectedHeader = jws.header;
|
|
3258
|
+
}
|
|
3259
|
+
if (resolvedKey) {
|
|
3260
|
+
return { ...result, key };
|
|
3261
|
+
}
|
|
3262
|
+
return result;
|
|
3263
|
+
}
|
|
3264
|
+
|
|
3265
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jws/compact/verify.js
|
|
3266
|
+
async function compactVerify(jws, key, options) {
|
|
3267
|
+
if (jws instanceof Uint8Array) {
|
|
3268
|
+
jws = decoder.decode(jws);
|
|
3269
|
+
}
|
|
3270
|
+
if (typeof jws !== "string") {
|
|
3271
|
+
throw new JWSInvalid("Compact JWS must be a string or Uint8Array");
|
|
3272
|
+
}
|
|
3273
|
+
const { 0: protectedHeader, 1: payload, 2: signature, length } = jws.split(".");
|
|
3274
|
+
if (length !== 3) {
|
|
3275
|
+
throw new JWSInvalid("Invalid Compact JWS");
|
|
3276
|
+
}
|
|
3277
|
+
const verified = await flattenedVerify({ payload, protected: protectedHeader, signature }, key, options);
|
|
3278
|
+
const result = { payload: verified.payload, protectedHeader: verified.protectedHeader };
|
|
3279
|
+
if (typeof key === "function") {
|
|
3280
|
+
return { ...result, key: verified.key };
|
|
3281
|
+
}
|
|
3282
|
+
return result;
|
|
3283
|
+
}
|
|
3284
|
+
|
|
3285
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/epoch.js
|
|
3286
|
+
var epoch_default = (date) => Math.floor(date.getTime() / 1e3);
|
|
3287
|
+
|
|
3288
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/secs.js
|
|
3289
|
+
var minute = 60;
|
|
3290
|
+
var hour = minute * 60;
|
|
3291
|
+
var day = hour * 24;
|
|
3292
|
+
var week = day * 7;
|
|
3293
|
+
var year = day * 365.25;
|
|
3294
|
+
var REGEX = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;
|
|
3295
|
+
var secs_default = (str) => {
|
|
3296
|
+
const matched = REGEX.exec(str);
|
|
3297
|
+
if (!matched || matched[4] && matched[1]) {
|
|
3298
|
+
throw new TypeError("Invalid time period format");
|
|
3299
|
+
}
|
|
3300
|
+
const value = parseFloat(matched[2]);
|
|
3301
|
+
const unit = matched[3].toLowerCase();
|
|
3302
|
+
let numericDate;
|
|
3303
|
+
switch (unit) {
|
|
3304
|
+
case "sec":
|
|
3305
|
+
case "secs":
|
|
3306
|
+
case "second":
|
|
3307
|
+
case "seconds":
|
|
3308
|
+
case "s":
|
|
3309
|
+
numericDate = Math.round(value);
|
|
3310
|
+
break;
|
|
3311
|
+
case "minute":
|
|
3312
|
+
case "minutes":
|
|
3313
|
+
case "min":
|
|
3314
|
+
case "mins":
|
|
3315
|
+
case "m":
|
|
3316
|
+
numericDate = Math.round(value * minute);
|
|
3317
|
+
break;
|
|
3318
|
+
case "hour":
|
|
3319
|
+
case "hours":
|
|
3320
|
+
case "hr":
|
|
3321
|
+
case "hrs":
|
|
3322
|
+
case "h":
|
|
3323
|
+
numericDate = Math.round(value * hour);
|
|
3324
|
+
break;
|
|
3325
|
+
case "day":
|
|
3326
|
+
case "days":
|
|
3327
|
+
case "d":
|
|
3328
|
+
numericDate = Math.round(value * day);
|
|
3329
|
+
break;
|
|
3330
|
+
case "week":
|
|
3331
|
+
case "weeks":
|
|
3332
|
+
case "w":
|
|
3333
|
+
numericDate = Math.round(value * week);
|
|
3334
|
+
break;
|
|
3335
|
+
default:
|
|
3336
|
+
numericDate = Math.round(value * year);
|
|
3337
|
+
break;
|
|
3338
|
+
}
|
|
3339
|
+
if (matched[1] === "-" || matched[4] === "ago") {
|
|
3340
|
+
return -numericDate;
|
|
3341
|
+
}
|
|
3342
|
+
return numericDate;
|
|
3343
|
+
};
|
|
3344
|
+
|
|
3345
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/jwt_claims_set.js
|
|
3346
|
+
var normalizeTyp = (value) => value.toLowerCase().replace(/^application\//, "");
|
|
3347
|
+
var checkAudiencePresence = (audPayload, audOption) => {
|
|
3348
|
+
if (typeof audPayload === "string") {
|
|
3349
|
+
return audOption.includes(audPayload);
|
|
3350
|
+
}
|
|
3351
|
+
if (Array.isArray(audPayload)) {
|
|
3352
|
+
return audOption.some(Set.prototype.has.bind(new Set(audPayload)));
|
|
3353
|
+
}
|
|
3354
|
+
return false;
|
|
3355
|
+
};
|
|
3356
|
+
var jwt_claims_set_default = (protectedHeader, encodedPayload, options = {}) => {
|
|
3357
|
+
let payload;
|
|
3358
|
+
try {
|
|
3359
|
+
payload = JSON.parse(decoder.decode(encodedPayload));
|
|
3360
|
+
} catch {
|
|
3361
|
+
}
|
|
3362
|
+
if (!isObject(payload)) {
|
|
3363
|
+
throw new JWTInvalid("JWT Claims Set must be a top-level JSON object");
|
|
3364
|
+
}
|
|
3365
|
+
const { typ } = options;
|
|
3366
|
+
if (typ && (typeof protectedHeader.typ !== "string" || normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ))) {
|
|
3367
|
+
throw new JWTClaimValidationFailed('unexpected "typ" JWT header value', payload, "typ", "check_failed");
|
|
3368
|
+
}
|
|
3369
|
+
const { requiredClaims = [], issuer, subject, audience, maxTokenAge } = options;
|
|
3370
|
+
const presenceCheck = [...requiredClaims];
|
|
3371
|
+
if (maxTokenAge !== void 0)
|
|
3372
|
+
presenceCheck.push("iat");
|
|
3373
|
+
if (audience !== void 0)
|
|
3374
|
+
presenceCheck.push("aud");
|
|
3375
|
+
if (subject !== void 0)
|
|
3376
|
+
presenceCheck.push("sub");
|
|
3377
|
+
if (issuer !== void 0)
|
|
3378
|
+
presenceCheck.push("iss");
|
|
3379
|
+
for (const claim of new Set(presenceCheck.reverse())) {
|
|
3380
|
+
if (!(claim in payload)) {
|
|
3381
|
+
throw new JWTClaimValidationFailed(`missing required "${claim}" claim`, payload, claim, "missing");
|
|
3382
|
+
}
|
|
3383
|
+
}
|
|
3384
|
+
if (issuer && !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) {
|
|
3385
|
+
throw new JWTClaimValidationFailed('unexpected "iss" claim value', payload, "iss", "check_failed");
|
|
3386
|
+
}
|
|
3387
|
+
if (subject && payload.sub !== subject) {
|
|
3388
|
+
throw new JWTClaimValidationFailed('unexpected "sub" claim value', payload, "sub", "check_failed");
|
|
3389
|
+
}
|
|
3390
|
+
if (audience && !checkAudiencePresence(payload.aud, typeof audience === "string" ? [audience] : audience)) {
|
|
3391
|
+
throw new JWTClaimValidationFailed('unexpected "aud" claim value', payload, "aud", "check_failed");
|
|
3392
|
+
}
|
|
3393
|
+
let tolerance;
|
|
3394
|
+
switch (typeof options.clockTolerance) {
|
|
3395
|
+
case "string":
|
|
3396
|
+
tolerance = secs_default(options.clockTolerance);
|
|
3397
|
+
break;
|
|
3398
|
+
case "number":
|
|
3399
|
+
tolerance = options.clockTolerance;
|
|
3400
|
+
break;
|
|
3401
|
+
case "undefined":
|
|
3402
|
+
tolerance = 0;
|
|
3403
|
+
break;
|
|
3404
|
+
default:
|
|
3405
|
+
throw new TypeError("Invalid clockTolerance option type");
|
|
3406
|
+
}
|
|
3407
|
+
const { currentDate } = options;
|
|
3408
|
+
const now = epoch_default(currentDate || /* @__PURE__ */ new Date());
|
|
3409
|
+
if ((payload.iat !== void 0 || maxTokenAge) && typeof payload.iat !== "number") {
|
|
3410
|
+
throw new JWTClaimValidationFailed('"iat" claim must be a number', payload, "iat", "invalid");
|
|
3411
|
+
}
|
|
3412
|
+
if (payload.nbf !== void 0) {
|
|
3413
|
+
if (typeof payload.nbf !== "number") {
|
|
3414
|
+
throw new JWTClaimValidationFailed('"nbf" claim must be a number', payload, "nbf", "invalid");
|
|
3415
|
+
}
|
|
3416
|
+
if (payload.nbf > now + tolerance) {
|
|
3417
|
+
throw new JWTClaimValidationFailed('"nbf" claim timestamp check failed', payload, "nbf", "check_failed");
|
|
3418
|
+
}
|
|
3419
|
+
}
|
|
3420
|
+
if (payload.exp !== void 0) {
|
|
3421
|
+
if (typeof payload.exp !== "number") {
|
|
3422
|
+
throw new JWTClaimValidationFailed('"exp" claim must be a number', payload, "exp", "invalid");
|
|
3423
|
+
}
|
|
3424
|
+
if (payload.exp <= now - tolerance) {
|
|
3425
|
+
throw new JWTExpired('"exp" claim timestamp check failed', payload, "exp", "check_failed");
|
|
3426
|
+
}
|
|
3427
|
+
}
|
|
3428
|
+
if (maxTokenAge) {
|
|
3429
|
+
const age = now - payload.iat;
|
|
3430
|
+
const max = typeof maxTokenAge === "number" ? maxTokenAge : secs_default(maxTokenAge);
|
|
3431
|
+
if (age - tolerance > max) {
|
|
3432
|
+
throw new JWTExpired('"iat" claim timestamp check failed (too far in the past)', payload, "iat", "check_failed");
|
|
3433
|
+
}
|
|
3434
|
+
if (age < 0 - tolerance) {
|
|
3435
|
+
throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', payload, "iat", "check_failed");
|
|
3436
|
+
}
|
|
3437
|
+
}
|
|
3438
|
+
return payload;
|
|
3439
|
+
};
|
|
3440
|
+
|
|
3441
|
+
// ../../node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jwt/verify.js
|
|
3442
|
+
async function jwtVerify(jwt, key, options) {
|
|
3443
|
+
const verified = await compactVerify(jwt, key, options);
|
|
3444
|
+
if (verified.protectedHeader.crit?.includes("b64") && verified.protectedHeader.b64 === false) {
|
|
3445
|
+
throw new JWTInvalid("JWTs MUST NOT use unencoded payload");
|
|
3446
|
+
}
|
|
3447
|
+
const payload = jwt_claims_set_default(verified.protectedHeader, verified.payload, options);
|
|
3448
|
+
const result = { payload, protectedHeader: verified.protectedHeader };
|
|
3449
|
+
if (typeof key === "function") {
|
|
3450
|
+
return { ...result, key: verified.key };
|
|
3451
|
+
}
|
|
3452
|
+
return result;
|
|
3453
|
+
}
|
|
3454
|
+
|
|
3455
|
+
// ../../node_modules/.pnpm/@eventcatalog+license@0.0.7/node_modules/@eventcatalog/license/dist/key.js
|
|
3456
|
+
var PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
|
|
3457
|
+
MCowBQYDK2VwAyEA599maqjKG7VW5bnj9fFA3msK691iHUYd+PkiZ7h9LpI=
|
|
3458
|
+
-----END PUBLIC KEY-----`;
|
|
3459
|
+
async function loadPublicPem() {
|
|
3460
|
+
return PUBLIC_KEY;
|
|
3461
|
+
}
|
|
3462
|
+
|
|
3463
|
+
// ../../node_modules/.pnpm/@eventcatalog+license@0.0.7/node_modules/@eventcatalog/license/dist/verify.js
|
|
3464
|
+
var import_path2 = __toESM(require("path"), 1);
|
|
3465
|
+
var import_chalk2 = __toESM(require("chalk"), 1);
|
|
3466
|
+
var import_https = __toESM(require("https"), 1);
|
|
3467
|
+
var import_http = __toESM(require("http"), 1);
|
|
3468
|
+
var import_url = require("url");
|
|
3469
|
+
var import_https_proxy_agent = __toESM(require_dist2(), 1);
|
|
3470
|
+
var cachedEntitlements = null;
|
|
3471
|
+
function makeHttpRequest(url, options) {
|
|
3472
|
+
return new Promise((resolve, reject) => {
|
|
3473
|
+
const urlObj = new import_url.URL(url);
|
|
3474
|
+
const isHttps = urlObj.protocol === "https:";
|
|
3475
|
+
const client = isHttps ? import_https.default : import_http.default;
|
|
3476
|
+
const requestOptions = {
|
|
3477
|
+
hostname: urlObj.hostname,
|
|
3478
|
+
port: urlObj.port || (isHttps ? 443 : 80),
|
|
3479
|
+
path: urlObj.pathname + urlObj.search,
|
|
3480
|
+
method: options.method || "GET",
|
|
3481
|
+
headers: options.headers || {}
|
|
3482
|
+
};
|
|
3483
|
+
const proxyUrl = process.env.PROXY_SERVER_URI || process.env.HTTPS_PROXY || process.env.HTTP_PROXY;
|
|
3484
|
+
if (proxyUrl) {
|
|
3485
|
+
requestOptions.agent = new import_https_proxy_agent.HttpsProxyAgent(proxyUrl);
|
|
3486
|
+
}
|
|
3487
|
+
const req = client.request(requestOptions, (res) => {
|
|
3488
|
+
let data = "";
|
|
3489
|
+
res.on("data", (chunk) => data += chunk);
|
|
3490
|
+
res.on("end", () => {
|
|
3491
|
+
resolve({
|
|
3492
|
+
status: res.statusCode,
|
|
3493
|
+
json: () => Promise.resolve(JSON.parse(data))
|
|
3494
|
+
});
|
|
3495
|
+
});
|
|
3496
|
+
});
|
|
3497
|
+
req.on("error", reject);
|
|
3498
|
+
if (options.body) {
|
|
3499
|
+
req.write(options.body);
|
|
3500
|
+
}
|
|
3501
|
+
req.end();
|
|
3502
|
+
});
|
|
3503
|
+
}
|
|
3504
|
+
async function verifyOfflineLicense(opts = {}) {
|
|
3505
|
+
if (cachedEntitlements) {
|
|
3506
|
+
return cachedEntitlements;
|
|
3507
|
+
}
|
|
3508
|
+
const { licensePath, audience = "EventCatalog", issuer = "EventCatalog Ltd", clockTolerance = "12h", currentVersion, fingerprintProvider } = opts;
|
|
3509
|
+
try {
|
|
3510
|
+
const licenseFilePath = licensePath || findLicenseFile();
|
|
3511
|
+
if (!licenseFilePath) {
|
|
3512
|
+
const licenseError = new Error("License file not found. Check EC_LICENSE environment variable or place license.jwt in current directory or /etc/eventcatalog/");
|
|
3513
|
+
licenseError.code = "LICENSE_FILE_NOT_FOUND";
|
|
3514
|
+
throw licenseError;
|
|
3515
|
+
}
|
|
3516
|
+
const token = (0, import_fs2.readFileSync)(licenseFilePath, "utf8").trim();
|
|
3517
|
+
if (!token) {
|
|
3518
|
+
const licenseError = new Error("License file is empty");
|
|
3519
|
+
licenseError.code = "LICENSE_FILE_EMPTY";
|
|
3520
|
+
throw licenseError;
|
|
3521
|
+
}
|
|
3522
|
+
const pemContent = await loadPublicPem();
|
|
3523
|
+
const publicKey = await importSPKI(pemContent, "EdDSA");
|
|
3524
|
+
const { payload } = await jwtVerify(token, publicKey, {
|
|
3525
|
+
issuer,
|
|
3526
|
+
audience,
|
|
3527
|
+
clockTolerance
|
|
3528
|
+
});
|
|
3529
|
+
const entitlements = payload;
|
|
3530
|
+
await performAdditionalChecks(entitlements, { currentVersion, fingerprintProvider });
|
|
3531
|
+
cachedEntitlements = entitlements;
|
|
3532
|
+
return entitlements;
|
|
3533
|
+
} catch (error) {
|
|
3534
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
3535
|
+
const errorName = error && typeof error === "object" && "name" in error ? error.name : "";
|
|
3536
|
+
const errorCode = error && typeof error === "object" && "code" in error ? error.code : "";
|
|
3537
|
+
if (errorName === "JWTExpired" || errorMessage.includes("JWTExpired") || errorCode === "JWTExpired") {
|
|
3538
|
+
const licenseError = new Error("License has expired");
|
|
3539
|
+
licenseError.code = "LICENSE_EXPIRED";
|
|
3540
|
+
console.error(import_chalk2.default.red(`You have an expired license. Please renew your license to continue using EventCatalog.`));
|
|
3541
|
+
throw licenseError;
|
|
3542
|
+
}
|
|
3543
|
+
if (errorName === "JWTNotYetValid" || errorMessage.includes("JWTNotYetValid") || errorCode === "JWTNotYetValid") {
|
|
3544
|
+
const licenseError = new Error("License is not yet valid");
|
|
3545
|
+
licenseError.code = "LICENSE_NOT_YET_VALID";
|
|
3546
|
+
console.error(import_chalk2.default.red(`License is not yet valid`));
|
|
3547
|
+
throw licenseError;
|
|
3548
|
+
}
|
|
3549
|
+
if (errorName === "JWTClaimValidationFailed" || errorMessage.includes("JWTClaimValidationFailed") || errorCode === "JWTClaimValidationFailed") {
|
|
3550
|
+
const licenseError = new Error("License validation failed - invalid issuer or audience");
|
|
3551
|
+
licenseError.code = "LICENSE_VALIDATION_FAILED";
|
|
3552
|
+
console.error(import_chalk2.default.red(`License validation failed - invalid issuer or audience`));
|
|
3553
|
+
throw licenseError;
|
|
3554
|
+
}
|
|
3555
|
+
if (errorName === "JWSSignatureVerificationFailed" || errorMessage.includes("JWSSignatureVerificationFailed") || errorCode === "JWSSignatureVerificationFailed") {
|
|
3556
|
+
const licenseError = new Error("License signature verification failed - invalid or tampered license");
|
|
3557
|
+
licenseError.code = "LICENSE_SIGNATURE_INVALID";
|
|
3558
|
+
console.error(import_chalk2.default.red(`License signature verification failed - invalid or tampered license`));
|
|
3559
|
+
throw licenseError;
|
|
3560
|
+
}
|
|
3561
|
+
throw error;
|
|
3562
|
+
}
|
|
3563
|
+
}
|
|
3564
|
+
async function verifyOnlineLicense(key, plugin) {
|
|
3565
|
+
if (!isValidLicenseKeyFormat(key)) {
|
|
3566
|
+
const licenseError = new Error("Invalid license key format. Expected format: XXXX-XXXX-XXXX-XXXX-XXXX-XXXX");
|
|
3567
|
+
licenseError.code = "INVALID_LICENSE_KEY_FORMAT";
|
|
3568
|
+
throw licenseError;
|
|
3569
|
+
}
|
|
3570
|
+
const PLANS = {
|
|
3571
|
+
"@eventcatalog/eventcatalog-starter": "EventCatalog Starter",
|
|
3572
|
+
"@eventcatalog/eventcatalog-scale": "EventCatalog Scale",
|
|
3573
|
+
"@eventcatalog/eventcatalog-enterprise": "EventCatalog Enterprise",
|
|
3574
|
+
"@eventcatalog/generator-amazon-apigateway": "Amazon API Gateway",
|
|
3575
|
+
"@eventcatalog/generator-asyncapi": "AsyncAPI",
|
|
3576
|
+
"@eventcatalog/generator-openapi": "OpenAPI",
|
|
3577
|
+
"@eventcatalog/backstage-plugin-eventcatalog": "Backstage",
|
|
3578
|
+
"@eventcatalog/generator-aws-glue": "AWS Glue",
|
|
3579
|
+
"@eventcatalog/generator-confluent-schema-registry": "Confluent Schema Registry",
|
|
3580
|
+
"@eventcatalog/generator-github": "GitHub",
|
|
3581
|
+
"@eventcatalog/generator-federation": "Federation"
|
|
3582
|
+
};
|
|
3583
|
+
const requestOptions = {
|
|
3584
|
+
method: "POST",
|
|
3585
|
+
headers: {
|
|
3586
|
+
Authorization: `Bearer ${key}`,
|
|
3587
|
+
"Content-Type": "application/json"
|
|
3588
|
+
}
|
|
3589
|
+
};
|
|
3590
|
+
let response;
|
|
3591
|
+
try {
|
|
3592
|
+
response = await makeHttpRequest("https://api.eventcatalog.cloud/functions/v1/license", requestOptions);
|
|
3593
|
+
} catch (err) {
|
|
3594
|
+
console.log(import_chalk2.default.redBright("Network Connection Error: Unable to establish a connection to license server. Check network or proxy settings."));
|
|
3595
|
+
console.log(import_chalk2.default.red(`Error details: ${err?.message || err}`));
|
|
3596
|
+
const proxyUrl = process.env.PROXY_SERVER_URI || process.env.HTTPS_PROXY || process.env.HTTP_PROXY;
|
|
3597
|
+
if (proxyUrl) {
|
|
3598
|
+
console.log(import_chalk2.default.yellow("\n\u{1F4A1} Proxy is configured but connection failed."));
|
|
3599
|
+
console.log(import_chalk2.default.yellow(` Proxy: ${proxyUrl}`));
|
|
3600
|
+
} else {
|
|
3601
|
+
console.log(import_chalk2.default.yellow("\n\u{1F4A1} For proxy support, set PROXY_SERVER_URI, HTTPS_PROXY, or HTTP_PROXY environment variable"));
|
|
3602
|
+
}
|
|
3603
|
+
process.exit(1);
|
|
3604
|
+
}
|
|
3605
|
+
if (response.status !== 200) {
|
|
3606
|
+
console.log(import_chalk2.default.bgRed(`
|
|
3607
|
+
Invalid license key`));
|
|
3608
|
+
console.log(`
|
|
3609
|
+
Tried to verify your ${PLANS[plugin]} license, but your license key is not valid. Please check your license key or purchase a license at https://eventcatalog.cloud/
|
|
3610
|
+
`);
|
|
3611
|
+
return false;
|
|
3612
|
+
}
|
|
3613
|
+
if (response.status === 200) {
|
|
3614
|
+
const data = await response.json();
|
|
3615
|
+
if (plugin !== data.plugin) {
|
|
3616
|
+
console.log(import_chalk2.default.bgRed(`
|
|
3617
|
+
Invalid license key for this plugin`));
|
|
3618
|
+
console.log(`
|
|
3619
|
+
Invalid license key for ${PLANS[plugin]} license, please check your license key or purchase a license at https://eventcatalog.cloud/
|
|
3620
|
+
`);
|
|
3621
|
+
return false;
|
|
3622
|
+
}
|
|
3623
|
+
let message2 = `${PLANS[plugin]} license is enabled for EventCatalog`;
|
|
3624
|
+
if (data.is_trial) {
|
|
3625
|
+
message2 += `
|
|
3626
|
+
You are using a trial license for ${PLANS[plugin]}. Please upgrade to a paid version to continue using EventCatalog.`;
|
|
3627
|
+
}
|
|
3628
|
+
if (PLANS[plugin]) {
|
|
3629
|
+
console.log(boxen(message2, {
|
|
3630
|
+
padding: 1,
|
|
3631
|
+
margin: 1,
|
|
3632
|
+
borderColor: "green",
|
|
3633
|
+
title: PLANS[plugin],
|
|
3634
|
+
titleAlignment: "center"
|
|
3635
|
+
}));
|
|
3636
|
+
}
|
|
3637
|
+
}
|
|
3638
|
+
return true;
|
|
3639
|
+
}
|
|
3640
|
+
function isFeatureEnabled(name) {
|
|
3641
|
+
if (!cachedEntitlements?.plugins) {
|
|
3642
|
+
return false;
|
|
3643
|
+
}
|
|
3644
|
+
const isEnabled = cachedEntitlements.plugins.some((plugin) => plugin === name);
|
|
3645
|
+
let message2 = `${name} is enabled for EventCatalog`;
|
|
3646
|
+
if (isEnabled) {
|
|
3647
|
+
console.log(boxen(message2, {
|
|
3648
|
+
padding: 1,
|
|
3649
|
+
margin: 1,
|
|
3650
|
+
borderColor: "green",
|
|
3651
|
+
title: name,
|
|
3652
|
+
titleAlignment: "center"
|
|
3653
|
+
}));
|
|
3654
|
+
}
|
|
3655
|
+
return isEnabled;
|
|
3656
|
+
}
|
|
3657
|
+
function hasOfflineLicenseKey() {
|
|
3658
|
+
return findLicenseFile() !== null;
|
|
3659
|
+
}
|
|
3660
|
+
function findLicenseFile() {
|
|
3661
|
+
const candidates = [
|
|
3662
|
+
process.env.EC_LICENSE,
|
|
3663
|
+
import_path2.default.join(process.env.PROJECT_DIR || process.cwd(), "license.jwt"),
|
|
3664
|
+
"./license.jwt",
|
|
3665
|
+
"/etc/eventcatalog/license.jwt"
|
|
3666
|
+
].filter(Boolean);
|
|
3667
|
+
for (const candidate of candidates) {
|
|
3668
|
+
if ((0, import_fs2.existsSync)(candidate)) {
|
|
3669
|
+
return candidate;
|
|
3670
|
+
}
|
|
3671
|
+
}
|
|
3672
|
+
return null;
|
|
3673
|
+
}
|
|
3674
|
+
async function performAdditionalChecks(entitlements, options) {
|
|
3675
|
+
const { currentVersion, fingerprintProvider } = options;
|
|
3676
|
+
if (entitlements.fingerprint && fingerprintProvider) {
|
|
3677
|
+
const actualFingerprint = fingerprintProvider();
|
|
3678
|
+
if (actualFingerprint && actualFingerprint !== entitlements.fingerprint) {
|
|
3679
|
+
const licenseError = new Error("License fingerprint mismatch - license is bound to a different machine");
|
|
3680
|
+
licenseError.code = "LICENSE_FINGERPRINT_MISMATCH";
|
|
3681
|
+
throw licenseError;
|
|
3682
|
+
}
|
|
3683
|
+
}
|
|
3684
|
+
}
|
|
3685
|
+
function isValidLicenseKeyFormat(key) {
|
|
3686
|
+
if (typeof key !== "string") {
|
|
3687
|
+
return false;
|
|
3688
|
+
}
|
|
3689
|
+
const trimmedKey = key.trim();
|
|
3690
|
+
const licenseKeyPattern = /^[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}$/;
|
|
3691
|
+
if (!licenseKeyPattern.test(trimmedKey)) {
|
|
3692
|
+
return false;
|
|
3693
|
+
}
|
|
3694
|
+
if (trimmedKey.length !== 29) {
|
|
3695
|
+
return false;
|
|
3696
|
+
}
|
|
3697
|
+
if (trimmedKey.includes("--") || /[^A-Z0-9-]/.test(trimmedKey)) {
|
|
3698
|
+
return false;
|
|
3699
|
+
}
|
|
3700
|
+
return true;
|
|
3701
|
+
}
|
|
3702
|
+
|
|
3703
|
+
// ../../node_modules/.pnpm/@eventcatalog+license@0.0.7/node_modules/@eventcatalog/license/dist/plans.js
|
|
3704
|
+
var isFeatureEnabled2 = async (feature, key) => {
|
|
3705
|
+
if (hasOfflineLicenseKey()) {
|
|
3706
|
+
await verifyOfflineLicense();
|
|
3707
|
+
return isFeatureEnabled(feature);
|
|
3708
|
+
}
|
|
3709
|
+
if (!key) {
|
|
3710
|
+
return false;
|
|
3711
|
+
}
|
|
3712
|
+
return verifyOnlineLicense(key, feature);
|
|
3713
|
+
};
|
|
3714
|
+
|
|
3715
|
+
// ../../shared/checkLicense.ts
|
|
3716
|
+
var checkLicense_default = async (pkgName, licenseKey) => {
|
|
3717
|
+
if (!hasOfflineLicenseKey() && !licenseKey) {
|
|
3718
|
+
console.log(import_chalk3.default.bgRed(`
|
|
3719
|
+
No license key provided for ${pkgName}`));
|
|
3720
|
+
console.log(import_chalk3.default.redBright("You can get a free 14 day trial license at https://eventcatalog.cloud/"));
|
|
3721
|
+
process.exit(1);
|
|
3722
|
+
}
|
|
3723
|
+
try {
|
|
3724
|
+
const featureEnabled = await isFeatureEnabled2(pkgName, licenseKey);
|
|
3725
|
+
if (!featureEnabled) {
|
|
3726
|
+
console.log(import_chalk3.default.bgRed(`
|
|
3727
|
+
Invalid license key`));
|
|
3728
|
+
console.log(import_chalk3.default.redBright("Please check your plugin license key or purchase a license at https://eventcatalog.cloud/"));
|
|
3729
|
+
process.exit(1);
|
|
3730
|
+
}
|
|
3731
|
+
return Promise.resolve();
|
|
3732
|
+
} catch (error) {
|
|
3733
|
+
console.log(error);
|
|
3734
|
+
console.log(import_chalk3.default.bgRed(`
|
|
3735
|
+
Failed to verify license key`));
|
|
3736
|
+
console.log(import_chalk3.default.redBright("Please check your plugin license key or purchase a license at https://eventcatalog.cloud/"));
|
|
3737
|
+
process.exit(1);
|
|
3738
|
+
}
|
|
3739
|
+
};
|
|
3740
|
+
|
|
3741
|
+
// src/utils/filters.ts
|
|
3742
|
+
var matchesFilterCriterion = (messageName, criterion) => {
|
|
3743
|
+
if (!criterion) return false;
|
|
3744
|
+
if (typeof criterion === "string") return messageName === criterion;
|
|
3745
|
+
if (Array.isArray(criterion) && criterion.every((item) => typeof item === "string")) {
|
|
3746
|
+
return criterion.includes(messageName);
|
|
3747
|
+
}
|
|
3748
|
+
if (typeof criterion === "object" && !Array.isArray(criterion)) {
|
|
3749
|
+
const checkCondition = (value, checkFn) => {
|
|
3750
|
+
if (!value) return false;
|
|
3751
|
+
const items = Array.isArray(value) ? value : [value];
|
|
3752
|
+
return items.some(checkFn);
|
|
3753
|
+
};
|
|
3754
|
+
return checkCondition(criterion.exact, (exact) => messageName === exact) || checkCondition(criterion.prefix, (prefix) => messageName.startsWith(prefix)) || checkCondition(criterion.suffix, (suffix) => messageName.endsWith(suffix)) || checkCondition(criterion.includes, (include) => messageName.includes(include));
|
|
3755
|
+
}
|
|
3756
|
+
return false;
|
|
3757
|
+
};
|
|
3758
|
+
var filterSchemas = (groupedSchemas, filters, includeAllVersions = false) => {
|
|
3759
|
+
const allMessageKeys = Object.keys(groupedSchemas);
|
|
3760
|
+
const uniqueMessageNames = [...new Set(allMessageKeys)];
|
|
3761
|
+
const filteredMessages = [];
|
|
3762
|
+
for (const messageName of uniqueMessageNames) {
|
|
3763
|
+
let assignedType = null;
|
|
3764
|
+
for (const filter of filters) {
|
|
3765
|
+
if (assignedType) break;
|
|
3766
|
+
if (filter.events && matchesFilterCriterion(messageName, filter.events)) {
|
|
3767
|
+
assignedType = "event";
|
|
3768
|
+
} else if (filter.commands && matchesFilterCriterion(messageName, filter.commands)) {
|
|
3769
|
+
assignedType = "command";
|
|
3770
|
+
} else if (filter.queries && matchesFilterCriterion(messageName, filter.queries)) {
|
|
3771
|
+
assignedType = "query";
|
|
3772
|
+
}
|
|
3773
|
+
}
|
|
3774
|
+
if (assignedType) {
|
|
3775
|
+
filteredMessages.push({ messageName, messageType: assignedType });
|
|
3776
|
+
}
|
|
3777
|
+
}
|
|
3778
|
+
if (filteredMessages.length === 0) {
|
|
3779
|
+
return [];
|
|
3780
|
+
}
|
|
3781
|
+
if (includeAllVersions) {
|
|
3782
|
+
const allVersionSchemas = filteredMessages.flatMap(({ messageName, messageType }) => {
|
|
3783
|
+
const schemas = groupedSchemas[messageName] || [];
|
|
3784
|
+
return schemas.map((schema) => ({ ...schema, messageType }));
|
|
3785
|
+
}).sort((a, b) => {
|
|
3786
|
+
if (a.artifactId !== b.artifactId) return a.artifactId.localeCompare(b.artifactId);
|
|
3787
|
+
return parseInt(a.version) - parseInt(b.version);
|
|
3788
|
+
});
|
|
3789
|
+
return allVersionSchemas;
|
|
3790
|
+
}
|
|
3791
|
+
const latestVersionSchemas = filteredMessages.map(({ messageName, messageType }) => {
|
|
3792
|
+
const schemas = groupedSchemas[messageName];
|
|
3793
|
+
const latestSchema = schemas?.find((schema) => schema.latestVersion);
|
|
3794
|
+
return latestSchema ? { ...latestSchema, messageType } : void 0;
|
|
3795
|
+
}).filter((schema) => schema !== void 0);
|
|
3796
|
+
return latestVersionSchemas;
|
|
3797
|
+
};
|
|
3798
|
+
|
|
3799
|
+
// package.json
|
|
3800
|
+
var package_default = {
|
|
3801
|
+
name: "@eventcatalog/generator-apicurio",
|
|
3802
|
+
version: "0.0.1",
|
|
3803
|
+
description: "Apicurio Registry generator for EventCatalog",
|
|
3804
|
+
scripts: {
|
|
3805
|
+
build: "tsup",
|
|
3806
|
+
test: "vitest",
|
|
3807
|
+
format: "prettier --write .",
|
|
3808
|
+
changeset: "changeset",
|
|
3809
|
+
"format:diff": "prettier --list-different .",
|
|
3810
|
+
release: "changeset publish"
|
|
3811
|
+
},
|
|
3812
|
+
publishConfig: {
|
|
3813
|
+
access: "public"
|
|
3814
|
+
},
|
|
3815
|
+
keywords: [],
|
|
3816
|
+
author: "",
|
|
3817
|
+
license: "Dual License",
|
|
3818
|
+
devDependencies: {
|
|
3819
|
+
"@types/node": "^20.16.1",
|
|
3820
|
+
prettier: "^3.3.3",
|
|
3821
|
+
tsup: "^8.1.0",
|
|
3822
|
+
typescript: "^5.5.3",
|
|
3823
|
+
vitest: "^2.0.2"
|
|
3824
|
+
},
|
|
3825
|
+
files: [
|
|
3826
|
+
"dist",
|
|
3827
|
+
"package.json"
|
|
3828
|
+
],
|
|
3829
|
+
main: "./dist/index.js",
|
|
3830
|
+
module: "./dist/index.mjs",
|
|
3831
|
+
types: "./dist/index.d.ts",
|
|
3832
|
+
dependencies: {
|
|
3833
|
+
"@changesets/cli": "^2.27.8",
|
|
3834
|
+
"@eventcatalog/sdk": "^2.8.3",
|
|
3835
|
+
axios: "^1.8.4",
|
|
3836
|
+
chalk: "4.1.2",
|
|
3837
|
+
"update-notifier": "^7.3.1"
|
|
3838
|
+
},
|
|
3839
|
+
peerDependencies: {
|
|
3840
|
+
"@eventcatalog/generator-openapi": ">=7.6.1",
|
|
3841
|
+
"@eventcatalog/generator-asyncapi": ">=5.1.1"
|
|
3842
|
+
},
|
|
3843
|
+
peerDependenciesMeta: {
|
|
3844
|
+
"@eventcatalog/generator-openapi": {
|
|
3845
|
+
optional: true
|
|
3846
|
+
},
|
|
3847
|
+
"@eventcatalog/generator-asyncapi": {
|
|
3848
|
+
optional: true
|
|
3849
|
+
}
|
|
3850
|
+
}
|
|
3851
|
+
};
|
|
3852
|
+
|
|
3853
|
+
// src/index.ts
|
|
3854
|
+
var import_path4 = __toESM(require("path"));
|
|
3855
|
+
var import_module = require("module");
|
|
3856
|
+
var import_fs3 = __toESM(require("fs"));
|
|
3857
|
+
|
|
3858
|
+
// src/client.ts
|
|
3859
|
+
var import_axios = __toESM(require("axios"));
|
|
3860
|
+
var ApicurioClient = class {
|
|
3861
|
+
constructor(baseUrl = "http://localhost:8080") {
|
|
3862
|
+
const normalizedUrl = baseUrl.replace(/\/$/, "");
|
|
3863
|
+
const apiPath = "/apis/registry/v3";
|
|
3864
|
+
this.baseUrl = normalizedUrl.includes("/apis/registry/") ? normalizedUrl : `${normalizedUrl}${apiPath}`;
|
|
3865
|
+
const headers = {
|
|
3866
|
+
"Content-Type": "application/json"
|
|
3867
|
+
};
|
|
3868
|
+
const accessToken = process.env.APICURIO_ACCESS_TOKEN;
|
|
3869
|
+
if (accessToken) {
|
|
3870
|
+
headers["Authorization"] = `Bearer ${accessToken}`;
|
|
3871
|
+
}
|
|
3872
|
+
this.client = import_axios.default.create({
|
|
3873
|
+
baseURL: this.baseUrl,
|
|
3874
|
+
headers
|
|
3875
|
+
});
|
|
3876
|
+
}
|
|
3877
|
+
async searchArtifacts(limit = 100, offset = 0) {
|
|
3878
|
+
const response = await this.client.get("/search/artifacts", {
|
|
3879
|
+
params: { limit, offset }
|
|
3880
|
+
});
|
|
3881
|
+
return response.data;
|
|
3882
|
+
}
|
|
3883
|
+
async getArtifactMetadata(groupId, artifactId) {
|
|
3884
|
+
const response = await this.client.get(`/groups/${groupId}/artifacts/${artifactId}`);
|
|
3885
|
+
return response.data;
|
|
3886
|
+
}
|
|
3887
|
+
async getArtifactVersions(groupId, artifactId) {
|
|
3888
|
+
const response = await this.client.get(`/groups/${groupId}/artifacts/${artifactId}/versions`);
|
|
3889
|
+
return response.data;
|
|
3890
|
+
}
|
|
3891
|
+
async getArtifactVersionMetadata(groupId, artifactId, version) {
|
|
3892
|
+
const response = await this.client.get(`/groups/${groupId}/artifacts/${artifactId}/versions/${version}`);
|
|
3893
|
+
return response.data;
|
|
3894
|
+
}
|
|
3895
|
+
async getArtifactContent(groupId, artifactId, version) {
|
|
3896
|
+
const versionExpr = version || "branch=latest";
|
|
3897
|
+
const url = `/groups/${groupId}/artifacts/${artifactId}/versions/${versionExpr}/content`;
|
|
3898
|
+
const response = await this.client.get(url);
|
|
3899
|
+
return response.data;
|
|
3900
|
+
}
|
|
3901
|
+
async getArtifactByName(artifactId) {
|
|
3902
|
+
try {
|
|
3903
|
+
let artifact = null;
|
|
3904
|
+
let offset = 0;
|
|
3905
|
+
const limit = 100;
|
|
3906
|
+
while (!artifact) {
|
|
3907
|
+
const searchResults = await this.searchArtifacts(limit, offset);
|
|
3908
|
+
if (!searchResults.artifacts || searchResults.artifacts.length === 0) {
|
|
3909
|
+
return null;
|
|
3910
|
+
}
|
|
3911
|
+
artifact = searchResults.artifacts.find((a) => (a.artifactId || a.id) === artifactId);
|
|
3912
|
+
if (!artifact) {
|
|
3913
|
+
if (searchResults.artifacts.length < limit) {
|
|
3914
|
+
return null;
|
|
3915
|
+
}
|
|
3916
|
+
offset += limit;
|
|
3917
|
+
}
|
|
3918
|
+
}
|
|
3919
|
+
const groupId = artifact.groupId || "default";
|
|
3920
|
+
const resolvedArtifactId = artifact.artifactId || artifact.id || artifactId;
|
|
3921
|
+
const versions = await this.getArtifactVersions(groupId, resolvedArtifactId);
|
|
3922
|
+
const latestVersion = versions.versions?.length > 0 ? versions.versions[versions.versions.length - 1]?.version : "1";
|
|
3923
|
+
const content = await this.getArtifactContent(groupId, resolvedArtifactId);
|
|
3924
|
+
return {
|
|
3925
|
+
artifact,
|
|
3926
|
+
versions: versions.versions || [],
|
|
3927
|
+
latestVersion,
|
|
3928
|
+
content
|
|
3929
|
+
};
|
|
3930
|
+
} catch (error) {
|
|
3931
|
+
console.error(`Error fetching artifact ${artifactId}:`, error);
|
|
3932
|
+
return null;
|
|
3933
|
+
}
|
|
3934
|
+
}
|
|
3935
|
+
async getArtifactByNameAndVersion(artifactId, version) {
|
|
3936
|
+
try {
|
|
3937
|
+
let artifact = null;
|
|
3938
|
+
let offset = 0;
|
|
3939
|
+
const limit = 100;
|
|
3940
|
+
while (!artifact) {
|
|
3941
|
+
const searchResults = await this.searchArtifacts(limit, offset);
|
|
3942
|
+
if (!searchResults.artifacts || searchResults.artifacts.length === 0) {
|
|
3943
|
+
return null;
|
|
3944
|
+
}
|
|
3945
|
+
artifact = searchResults.artifacts.find((a) => (a.artifactId || a.id) === artifactId);
|
|
3946
|
+
if (!artifact) {
|
|
3947
|
+
if (searchResults.artifacts.length < limit) {
|
|
3948
|
+
return null;
|
|
3949
|
+
}
|
|
3950
|
+
offset += limit;
|
|
3951
|
+
}
|
|
3952
|
+
}
|
|
3953
|
+
const groupId = artifact.groupId || "default";
|
|
3954
|
+
const resolvedArtifactId = artifact.artifactId || artifact.id || artifactId;
|
|
3955
|
+
const versions = await this.getArtifactVersions(groupId, resolvedArtifactId);
|
|
3956
|
+
const content = await this.getArtifactContent(groupId, resolvedArtifactId, version);
|
|
3957
|
+
return {
|
|
3958
|
+
artifact,
|
|
3959
|
+
versions: versions.versions || [],
|
|
3960
|
+
latestVersion: version,
|
|
3961
|
+
content
|
|
3962
|
+
};
|
|
3963
|
+
} catch (error) {
|
|
3964
|
+
console.error(`Error fetching artifact ${artifactId} version ${version}:`, error);
|
|
3965
|
+
return null;
|
|
3966
|
+
}
|
|
3967
|
+
}
|
|
3968
|
+
};
|
|
3969
|
+
|
|
3970
|
+
// src/lib/apicurio.ts
|
|
3971
|
+
var extractExactArtifactIds = (services) => {
|
|
3972
|
+
const exactIds = /* @__PURE__ */ new Set();
|
|
3973
|
+
let hasNonExactFilters = false;
|
|
3974
|
+
for (const service of services) {
|
|
3975
|
+
const allFilters = [...service.sends || [], ...service.receives || []];
|
|
3976
|
+
for (const filter of allFilters) {
|
|
3977
|
+
if (filter.events) {
|
|
3978
|
+
if (typeof filter.events === "string") {
|
|
3979
|
+
exactIds.add(filter.events);
|
|
3980
|
+
} else if (Array.isArray(filter.events)) {
|
|
3981
|
+
filter.events.forEach((e) => exactIds.add(e));
|
|
3982
|
+
} else if (typeof filter.events === "object") {
|
|
3983
|
+
if (filter.events.exact) {
|
|
3984
|
+
const exact = filter.events.exact;
|
|
3985
|
+
if (typeof exact === "string") {
|
|
3986
|
+
exactIds.add(exact);
|
|
3987
|
+
} else if (Array.isArray(exact)) {
|
|
3988
|
+
exact.forEach((e) => exactIds.add(e));
|
|
3989
|
+
}
|
|
3990
|
+
}
|
|
3991
|
+
if (filter.events.prefix || filter.events.suffix || filter.events.includes) {
|
|
3992
|
+
hasNonExactFilters = true;
|
|
3993
|
+
}
|
|
3994
|
+
}
|
|
3995
|
+
}
|
|
3996
|
+
if (filter.commands) {
|
|
3997
|
+
if (typeof filter.commands === "string") {
|
|
3998
|
+
exactIds.add(filter.commands);
|
|
3999
|
+
} else if (Array.isArray(filter.commands)) {
|
|
4000
|
+
filter.commands.forEach((c) => exactIds.add(c));
|
|
4001
|
+
} else if (typeof filter.commands === "object") {
|
|
4002
|
+
if (filter.commands.exact) {
|
|
4003
|
+
const exact = filter.commands.exact;
|
|
4004
|
+
if (typeof exact === "string") {
|
|
4005
|
+
exactIds.add(exact);
|
|
4006
|
+
} else if (Array.isArray(exact)) {
|
|
4007
|
+
exact.forEach((e) => exactIds.add(e));
|
|
4008
|
+
}
|
|
4009
|
+
}
|
|
4010
|
+
if (filter.commands.prefix || filter.commands.suffix || filter.commands.includes) {
|
|
4011
|
+
hasNonExactFilters = true;
|
|
4012
|
+
}
|
|
4013
|
+
}
|
|
4014
|
+
}
|
|
4015
|
+
if (filter.queries) {
|
|
4016
|
+
if (typeof filter.queries === "string") {
|
|
4017
|
+
exactIds.add(filter.queries);
|
|
4018
|
+
} else if (Array.isArray(filter.queries)) {
|
|
4019
|
+
filter.queries.forEach((q) => exactIds.add(q));
|
|
4020
|
+
} else if (typeof filter.queries === "object") {
|
|
4021
|
+
if (filter.queries.exact) {
|
|
4022
|
+
const exact = filter.queries.exact;
|
|
4023
|
+
if (typeof exact === "string") {
|
|
4024
|
+
exactIds.add(exact);
|
|
4025
|
+
} else if (Array.isArray(exact)) {
|
|
4026
|
+
exact.forEach((e) => exactIds.add(e));
|
|
4027
|
+
}
|
|
4028
|
+
}
|
|
4029
|
+
if (filter.queries.prefix || filter.queries.suffix || filter.queries.includes) {
|
|
4030
|
+
hasNonExactFilters = true;
|
|
4031
|
+
}
|
|
4032
|
+
}
|
|
4033
|
+
}
|
|
4034
|
+
}
|
|
4035
|
+
}
|
|
4036
|
+
if (hasNonExactFilters) {
|
|
4037
|
+
return null;
|
|
4038
|
+
}
|
|
4039
|
+
return Array.from(exactIds);
|
|
4040
|
+
};
|
|
4041
|
+
var getSchemasByArtifactIds = async (registryUrl, artifactIds, includeAllVersions = false) => {
|
|
4042
|
+
const client = new ApicurioClient(registryUrl);
|
|
4043
|
+
const schemas = [];
|
|
4044
|
+
for (const targetArtifactId of artifactIds) {
|
|
4045
|
+
try {
|
|
4046
|
+
const artifactData = await client.getArtifactByName(targetArtifactId);
|
|
4047
|
+
if (!artifactData) {
|
|
4048
|
+
console.warn(`Artifact '${targetArtifactId}' not found in registry`);
|
|
4049
|
+
continue;
|
|
4050
|
+
}
|
|
4051
|
+
const groupId = artifactData.artifact.groupId || "default";
|
|
4052
|
+
const artifactId = artifactData.artifact.artifactId || artifactData.artifact.id || targetArtifactId;
|
|
4053
|
+
const artifactType = artifactData.artifact.artifactType || artifactData.artifact.type;
|
|
4054
|
+
const latestVersion = artifactData.latestVersion;
|
|
4055
|
+
if (includeAllVersions && artifactData.versions && artifactData.versions.length > 0) {
|
|
4056
|
+
for (const version of artifactData.versions) {
|
|
4057
|
+
const versionContent = await client.getArtifactContent(groupId, artifactId, version.version);
|
|
4058
|
+
const schemaContent = typeof versionContent === "string" ? versionContent : JSON.stringify(versionContent, null, 2);
|
|
4059
|
+
schemas.push({
|
|
4060
|
+
artifactId,
|
|
4061
|
+
messageId: artifactId,
|
|
4062
|
+
version: version.version,
|
|
4063
|
+
globalId: version.globalId || 0,
|
|
4064
|
+
schemaType: artifactType,
|
|
4065
|
+
schema: schemaContent,
|
|
4066
|
+
latestVersion: version.version === latestVersion,
|
|
4067
|
+
groupId
|
|
4068
|
+
});
|
|
4069
|
+
}
|
|
4070
|
+
} else {
|
|
4071
|
+
const content = artifactData.content;
|
|
4072
|
+
const schemaContent = typeof content === "string" ? content : JSON.stringify(content, null, 2);
|
|
4073
|
+
schemas.push({
|
|
4074
|
+
artifactId,
|
|
4075
|
+
messageId: artifactId,
|
|
4076
|
+
version: latestVersion,
|
|
4077
|
+
globalId: 0,
|
|
4078
|
+
schemaType: artifactType,
|
|
4079
|
+
schema: schemaContent,
|
|
4080
|
+
latestVersion: true,
|
|
4081
|
+
groupId
|
|
4082
|
+
});
|
|
4083
|
+
}
|
|
4084
|
+
} catch (error) {
|
|
4085
|
+
console.error(`Error fetching artifact ${targetArtifactId}:`, error);
|
|
4086
|
+
}
|
|
4087
|
+
}
|
|
4088
|
+
return schemas;
|
|
4089
|
+
};
|
|
4090
|
+
var getSchemasFromRegistry = async (registryUrl) => {
|
|
4091
|
+
const client = new ApicurioClient(registryUrl);
|
|
4092
|
+
const schemas = [];
|
|
4093
|
+
const searchResults = await client.searchArtifacts(1e3, 0);
|
|
4094
|
+
for (const artifact of searchResults.artifacts) {
|
|
4095
|
+
const groupId = artifact.groupId || "default";
|
|
4096
|
+
const artifactId = artifact.artifactId || artifact.id;
|
|
4097
|
+
const artifactType = artifact.artifactType || artifact.type;
|
|
4098
|
+
try {
|
|
4099
|
+
const versionsResult = await client.getArtifactVersions(groupId, artifactId);
|
|
4100
|
+
const versions = versionsResult.versions || [];
|
|
4101
|
+
const latestVersion = versions.length > 0 ? versions[versions.length - 1]?.version : null;
|
|
4102
|
+
for (const version of versions) {
|
|
4103
|
+
const content = await client.getArtifactContent(groupId, artifactId, version.version);
|
|
4104
|
+
const schemaContent = typeof content === "string" ? content : JSON.stringify(content, null, 2);
|
|
4105
|
+
schemas.push({
|
|
4106
|
+
artifactId,
|
|
4107
|
+
messageId: artifactId,
|
|
4108
|
+
version: version.version,
|
|
4109
|
+
globalId: version.globalId,
|
|
4110
|
+
schemaType: artifactType,
|
|
4111
|
+
schema: schemaContent,
|
|
4112
|
+
latestVersion: version.version === latestVersion,
|
|
4113
|
+
groupId
|
|
4114
|
+
});
|
|
4115
|
+
}
|
|
4116
|
+
} catch (error) {
|
|
4117
|
+
console.error(`Error fetching versions for artifact ${artifactId}:`, error);
|
|
4118
|
+
}
|
|
4119
|
+
}
|
|
4120
|
+
return schemas;
|
|
4121
|
+
};
|
|
4122
|
+
var getSpecificationArtifact = async (registryUrl, artifactId, version) => {
|
|
4123
|
+
const client = new ApicurioClient(registryUrl);
|
|
4124
|
+
const effectiveVersion = version && version.toLowerCase() !== "latest" ? version : void 0;
|
|
4125
|
+
try {
|
|
4126
|
+
if (effectiveVersion) {
|
|
4127
|
+
const artifactData = await client.getArtifactByNameAndVersion(artifactId, effectiveVersion);
|
|
4128
|
+
if (!artifactData) {
|
|
4129
|
+
console.warn(`Specification artifact '${artifactId}' version '${effectiveVersion}' not found in registry`);
|
|
4130
|
+
return null;
|
|
4131
|
+
}
|
|
4132
|
+
const content = typeof artifactData.content === "string" ? artifactData.content : JSON.stringify(artifactData.content, null, 2);
|
|
4133
|
+
return {
|
|
4134
|
+
content,
|
|
4135
|
+
version,
|
|
4136
|
+
artifactType: artifactData.artifact.artifactType || artifactData.artifact.type || "OPENAPI"
|
|
4137
|
+
};
|
|
4138
|
+
} else {
|
|
4139
|
+
const artifactData = await client.getArtifactByName(artifactId);
|
|
4140
|
+
if (!artifactData) {
|
|
4141
|
+
console.warn(`Specification artifact '${artifactId}' not found in registry`);
|
|
4142
|
+
return null;
|
|
4143
|
+
}
|
|
4144
|
+
const content = typeof artifactData.content === "string" ? artifactData.content : JSON.stringify(artifactData.content, null, 2);
|
|
4145
|
+
return {
|
|
4146
|
+
content,
|
|
4147
|
+
version: artifactData.latestVersion,
|
|
4148
|
+
artifactType: artifactData.artifact.artifactType || artifactData.artifact.type || "OPENAPI"
|
|
4149
|
+
};
|
|
4150
|
+
}
|
|
4151
|
+
} catch (error) {
|
|
4152
|
+
console.error(`Error fetching specification artifact ${artifactId}:`, error);
|
|
4153
|
+
return null;
|
|
4154
|
+
}
|
|
4155
|
+
};
|
|
4156
|
+
|
|
4157
|
+
// src/utils/messages.ts
|
|
4158
|
+
var import_sdk = __toESM(require("@eventcatalog/sdk"));
|
|
4159
|
+
var import_chalk4 = __toESM(require("chalk"));
|
|
4160
|
+
|
|
4161
|
+
// src/utils/markdown.ts
|
|
4162
|
+
var getMarkdownForSchema = (schema) => {
|
|
4163
|
+
const schemaFileName = getSchemaFileName(schema);
|
|
4164
|
+
const useSchemaViewer = schema.schemaType === "JSON" /* JSON */ || schema.schemaType === "AVRO" /* AVRO */;
|
|
4165
|
+
const schemaComponent = useSchemaViewer ? `<SchemaViewer file="${schemaFileName}" />` : `<Schema file="${schemaFileName}" />`;
|
|
4166
|
+
return `
|
|
4167
|
+
## Architecture diagram
|
|
4168
|
+
|
|
4169
|
+
A visual representation of the {frontmatter.name} message.
|
|
4170
|
+
|
|
4171
|
+
<NodeGraph />
|
|
4172
|
+
|
|
4173
|
+
---
|
|
4174
|
+
|
|
4175
|
+
## Schema
|
|
4176
|
+
This is the schema for the {frontmatter.name} message.
|
|
4177
|
+
${schemaComponent}`;
|
|
4178
|
+
};
|
|
4179
|
+
var getMarkdownForService = ({ registryUrl }) => {
|
|
4180
|
+
return `This documentation is for the {frontmatter.name} service.
|
|
4181
|
+
|
|
4182
|
+
<Tiles columns={2}>
|
|
4183
|
+
<Tile icon="DocumentIcon" iconColor="text-purple-500" href="${registryUrl}" title="Apicurio Registry" target="_blank" description="View the Apicurio Registry" />
|
|
4184
|
+
<Tile icon="ChatBubbleLeftIcon" iconColor="text-yellow-500" href={\`/visualiser/services/\${frontmatter.id}\`} title="Explore the service in the visualizer" description="View the service in the EventCatalog Visualizer" />
|
|
4185
|
+
</Tiles>
|
|
4186
|
+
|
|
4187
|
+
:::tip
|
|
4188
|
+
You can edit this markdown file, the plugin will persist your changes and keep your schemas in sync.
|
|
4189
|
+
:::
|
|
4190
|
+
|
|
4191
|
+
## Architecture Diagram
|
|
4192
|
+
|
|
4193
|
+
The architecture diagram below shows the {frontmatter.name} service and its dependencies.
|
|
4194
|
+
|
|
4195
|
+
<NodeGraph />
|
|
4196
|
+
`;
|
|
4197
|
+
};
|
|
4198
|
+
var getMarkdownForDomain = () => {
|
|
4199
|
+
return `This is the {frontmatter.name} domain.
|
|
4200
|
+
|
|
4201
|
+
<Tiles columns={2}>
|
|
4202
|
+
<Tile icon="ArrowUpLeftIcon" iconColor="text-yellow-500" href={\`/visualiser/domains/\${ frontmatter.id } \`} title="Open domain in visualizer" description="View the domain architecture in EventCatalog Visualizer" />
|
|
4203
|
+
<Tile icon="ServerIcon" iconColor="text-pink-500" href={\`/discover/domains\`} title={\`Explore services in this domain\`} description="Explore the services in this domain" />
|
|
4204
|
+
</Tiles>
|
|
4205
|
+
|
|
4206
|
+
|
|
4207
|
+
### Domain Architecture
|
|
4208
|
+
The following is the architecture diagram for all the messages and services in the {frontmatter.name} domain.
|
|
4209
|
+
<NodeGraph />
|
|
4210
|
+
|
|
4211
|
+
### Messages
|
|
4212
|
+
|
|
4213
|
+
<MessageTable limit={10} showChannels={true} />`;
|
|
4214
|
+
};
|
|
4215
|
+
|
|
4216
|
+
// src/utils/messages.ts
|
|
4217
|
+
var import_path3 = require("path");
|
|
4218
|
+
var getSchemaFileName = (schema) => {
|
|
4219
|
+
const schemaType = schema.schemaType || "JSON" /* JSON */;
|
|
4220
|
+
let extension = "json";
|
|
4221
|
+
switch (schemaType) {
|
|
4222
|
+
case "PROTOBUF":
|
|
4223
|
+
extension = "proto";
|
|
4224
|
+
break;
|
|
4225
|
+
case "AVRO":
|
|
4226
|
+
extension = "avsc";
|
|
4227
|
+
break;
|
|
4228
|
+
case "JSON":
|
|
4229
|
+
extension = "json";
|
|
4230
|
+
break;
|
|
4231
|
+
case "ASYNCAPI":
|
|
4232
|
+
extension = "yaml";
|
|
4233
|
+
break;
|
|
4234
|
+
case "OPENAPI":
|
|
4235
|
+
extension = "yaml";
|
|
4236
|
+
break;
|
|
4237
|
+
default:
|
|
4238
|
+
extension = "json";
|
|
4239
|
+
}
|
|
4240
|
+
return `${schema.artifactId}.${extension}`;
|
|
4241
|
+
};
|
|
4242
|
+
var writeMessageToEventCatalog = async ({
|
|
4243
|
+
pathToCatalog,
|
|
4244
|
+
message: message2,
|
|
4245
|
+
rootPath = "",
|
|
4246
|
+
serviceId,
|
|
4247
|
+
messageType
|
|
4248
|
+
}) => {
|
|
4249
|
+
const {
|
|
4250
|
+
writeEvent,
|
|
4251
|
+
writeCommand,
|
|
4252
|
+
writeQuery,
|
|
4253
|
+
getCommand,
|
|
4254
|
+
getQuery,
|
|
4255
|
+
addSchemaToCommand,
|
|
4256
|
+
addSchemaToQuery,
|
|
4257
|
+
writeCommandToService,
|
|
4258
|
+
writeQueryToService,
|
|
4259
|
+
getEvent,
|
|
4260
|
+
versionEvent,
|
|
4261
|
+
versionCommand,
|
|
4262
|
+
versionQuery,
|
|
4263
|
+
addSchemaToEvent,
|
|
4264
|
+
writeEventToService
|
|
4265
|
+
} = (0, import_sdk.default)(pathToCatalog);
|
|
4266
|
+
const MESSAGE_OPERATIONS = {
|
|
4267
|
+
event: {
|
|
4268
|
+
write: writeEvent,
|
|
4269
|
+
version: versionEvent,
|
|
4270
|
+
get: getEvent,
|
|
4271
|
+
addSchema: addSchemaToEvent,
|
|
4272
|
+
addSchemaToMessage: addSchemaToEvent,
|
|
4273
|
+
writeMessageToService: writeEventToService,
|
|
4274
|
+
collection: "events"
|
|
4275
|
+
},
|
|
4276
|
+
command: {
|
|
4277
|
+
write: writeCommand,
|
|
4278
|
+
version: versionCommand,
|
|
4279
|
+
get: getCommand,
|
|
4280
|
+
addSchema: addSchemaToCommand,
|
|
4281
|
+
addSchemaToMessage: addSchemaToCommand,
|
|
4282
|
+
writeMessageToService: writeCommandToService,
|
|
4283
|
+
collection: "commands"
|
|
4284
|
+
},
|
|
4285
|
+
query: {
|
|
4286
|
+
write: writeQuery,
|
|
4287
|
+
version: versionQuery,
|
|
4288
|
+
get: getQuery,
|
|
4289
|
+
addSchema: addSchemaToQuery,
|
|
4290
|
+
addSchemaToMessage: addSchemaToQuery,
|
|
4291
|
+
writeMessageToService: writeQueryToService,
|
|
4292
|
+
collection: "queries"
|
|
4293
|
+
}
|
|
4294
|
+
};
|
|
4295
|
+
const {
|
|
4296
|
+
write: writeMessage,
|
|
4297
|
+
version: versionMessage,
|
|
4298
|
+
get: getMessage,
|
|
4299
|
+
addSchema: addSchemaToMessage,
|
|
4300
|
+
collection,
|
|
4301
|
+
writeMessageToService
|
|
4302
|
+
} = MESSAGE_OPERATIONS[messageType];
|
|
4303
|
+
const schemaFileName = getSchemaFileName(message2);
|
|
4304
|
+
let messagePath = (0, import_path3.join)(rootPath, collection, message2.messageId);
|
|
4305
|
+
const messageInCatalog = await getMessage(message2.messageId, "latest");
|
|
4306
|
+
const { channels, ...previousMessageInformation } = messageInCatalog || {};
|
|
4307
|
+
const existingVersionedMessage = await getMessage(message2.messageId, message2.version.toString());
|
|
4308
|
+
if (!message2.latestVersion) {
|
|
4309
|
+
if (existingVersionedMessage && existingVersionedMessage.version.toString() === message2.version.toString()) {
|
|
4310
|
+
console.log(import_chalk4.default.gray(` - Skipping ${message2.messageId} (v${message2.version}) - already exists in catalog`));
|
|
4311
|
+
return;
|
|
4312
|
+
}
|
|
4313
|
+
}
|
|
4314
|
+
let justVersioned = false;
|
|
4315
|
+
if (messageInCatalog && messageInCatalog.version.toString() !== message2.version.toString()) {
|
|
4316
|
+
await versionMessage(message2.messageId);
|
|
4317
|
+
console.log(import_chalk4.default.cyan(` - Versioned previous message: ${message2.messageId} (v${messageInCatalog.version})`));
|
|
4318
|
+
justVersioned = true;
|
|
4319
|
+
}
|
|
4320
|
+
const summary = messageInCatalog?.summary || "Message from Apicurio Registry";
|
|
4321
|
+
const badges = messageInCatalog?.badges || [
|
|
4322
|
+
{ backgroundColor: "blue", textColor: "white", content: "Apicurio", icon: "apicurio" }
|
|
4323
|
+
];
|
|
4324
|
+
const markdown = messageInCatalog?.markdown || getMarkdownForSchema(message2);
|
|
4325
|
+
const messageToWrite = {
|
|
4326
|
+
...previousMessageInformation,
|
|
4327
|
+
id: message2.messageId,
|
|
4328
|
+
name: message2.messageId,
|
|
4329
|
+
version: message2.version.toString(),
|
|
4330
|
+
schemaPath: schemaFileName,
|
|
4331
|
+
summary,
|
|
4332
|
+
badges,
|
|
4333
|
+
markdown
|
|
4334
|
+
};
|
|
4335
|
+
const shouldOverride = justVersioned || message2.latestVersion && messageInCatalog && messageInCatalog.version.toString() === message2.version.toString();
|
|
4336
|
+
try {
|
|
4337
|
+
if (serviceId) {
|
|
4338
|
+
await writeMessageToService(messageToWrite, { id: serviceId }, { override: shouldOverride });
|
|
4339
|
+
} else {
|
|
4340
|
+
await writeMessage(messageToWrite, {
|
|
4341
|
+
path: messagePath,
|
|
4342
|
+
override: shouldOverride
|
|
4343
|
+
});
|
|
4344
|
+
}
|
|
4345
|
+
await addSchemaToMessage(message2.messageId, { fileName: schemaFileName, schema: message2.schema });
|
|
4346
|
+
} catch (error) {
|
|
4347
|
+
if (!message2.latestVersion && error.message && error.message.includes("already exists")) {
|
|
4348
|
+
console.log(import_chalk4.default.gray(` - Skipping ${message2.messageId} (v${message2.version}) - already exists in catalog`));
|
|
4349
|
+
return;
|
|
4350
|
+
}
|
|
4351
|
+
throw error;
|
|
4352
|
+
}
|
|
4353
|
+
};
|
|
4354
|
+
|
|
4355
|
+
// src/index.ts
|
|
4356
|
+
async function runSpecificationGenerator(specConfig, specFilePath, serviceId, serviceName, serviceVersion, projectDir, domain) {
|
|
4357
|
+
if (!specConfig.generator) return;
|
|
4358
|
+
const [generatorPackage, generatorOptions = {}] = specConfig.generator;
|
|
4359
|
+
try {
|
|
4360
|
+
const projectRequire = (0, import_module.createRequire)(import_path4.default.join(projectDir, "package.json"));
|
|
4361
|
+
const generatorPath = projectRequire.resolve(generatorPackage);
|
|
4362
|
+
const generatorModule = await import(generatorPath);
|
|
4363
|
+
let generator = generatorModule.default || generatorModule;
|
|
4364
|
+
if (typeof generator !== "function" && generator?.default) {
|
|
4365
|
+
generator = generator.default;
|
|
4366
|
+
}
|
|
4367
|
+
if (typeof generator !== "function") {
|
|
4368
|
+
console.warn(import_chalk5.default.yellow(` - Generator ${generatorPackage} is not a valid function, skipping`));
|
|
4369
|
+
return;
|
|
4370
|
+
}
|
|
4371
|
+
const { service: serviceOptions, ...restOptions } = generatorOptions;
|
|
4372
|
+
const generatorServiceConfig = {
|
|
4373
|
+
id: serviceId,
|
|
4374
|
+
name: serviceName,
|
|
4375
|
+
path: specFilePath,
|
|
4376
|
+
version: serviceVersion,
|
|
4377
|
+
...serviceOptions
|
|
4378
|
+
// Allow overriding service options
|
|
4379
|
+
};
|
|
4380
|
+
const fullGeneratorOptions = {
|
|
4381
|
+
...restOptions,
|
|
4382
|
+
services: [generatorServiceConfig],
|
|
4383
|
+
// If domain is configured, pass it to the generator
|
|
4384
|
+
...domain ? { domain } : {}
|
|
4385
|
+
};
|
|
4386
|
+
console.log(import_chalk5.default.cyan(` - Running ${generatorPackage} generator for ${specConfig.artifactId}...`));
|
|
4387
|
+
await generator({}, fullGeneratorOptions);
|
|
4388
|
+
console.log(import_chalk5.default.cyan(` - Completed ${generatorPackage} generator for ${specConfig.artifactId}`));
|
|
4389
|
+
} catch (error) {
|
|
4390
|
+
if (error.code === "ERR_MODULE_NOT_FOUND" || error.code === "MODULE_NOT_FOUND") {
|
|
4391
|
+
console.error(import_chalk5.default.red(` - Generator ${generatorPackage} not found. Please install it: npm install ${generatorPackage}`));
|
|
4392
|
+
} else {
|
|
4393
|
+
console.error(import_chalk5.default.red(` - Error running generator ${generatorPackage}: ${error.message}`));
|
|
4394
|
+
}
|
|
4395
|
+
}
|
|
4396
|
+
}
|
|
4397
|
+
var index_default = async (config, options) => {
|
|
4398
|
+
const REGISTRY_URL = options.registryUrl;
|
|
4399
|
+
const INCLUDE_ALL_VERSIONS = options.includeAllVersions;
|
|
4400
|
+
if (!process.env.PROJECT_DIR) {
|
|
4401
|
+
process.env.PROJECT_DIR = process.cwd();
|
|
4402
|
+
}
|
|
4403
|
+
if (!REGISTRY_URL) {
|
|
4404
|
+
throw new Error("Please provide a url for the Apicurio Registry");
|
|
4405
|
+
}
|
|
4406
|
+
const eventCatalogDirectory = process.env.PROJECT_DIR;
|
|
4407
|
+
if (!eventCatalogDirectory) {
|
|
4408
|
+
throw new Error("Please provide catalog url (env variable PROJECT_DIR)");
|
|
4409
|
+
}
|
|
4410
|
+
const {
|
|
4411
|
+
writeService,
|
|
4412
|
+
getService,
|
|
4413
|
+
versionService,
|
|
4414
|
+
getDomain,
|
|
4415
|
+
versionDomain,
|
|
4416
|
+
writeDomain,
|
|
4417
|
+
addServiceToDomain,
|
|
4418
|
+
addFileToService,
|
|
4419
|
+
getSpecificationFilesForService
|
|
4420
|
+
} = (0, import_sdk2.default)(eventCatalogDirectory);
|
|
4421
|
+
const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_APICURIO || options.licenseKey || "";
|
|
4422
|
+
await checkLicense_default(package_default.name, LICENSE_KEY);
|
|
4423
|
+
await checkForPackageUpdate(package_default.name);
|
|
4424
|
+
const services = options.services || [];
|
|
4425
|
+
const documentMessagesWithService = services.length > 0;
|
|
4426
|
+
let schemas = [];
|
|
4427
|
+
if (documentMessagesWithService) {
|
|
4428
|
+
const exactArtifactIds = extractExactArtifactIds(services);
|
|
4429
|
+
if (exactArtifactIds && exactArtifactIds.length > 0) {
|
|
4430
|
+
console.log(
|
|
4431
|
+
import_chalk5.default.green(
|
|
4432
|
+
`Fetching ${exactArtifactIds.length} specific artifacts from registry: ${REGISTRY_URL}${INCLUDE_ALL_VERSIONS ? " (including all versions)" : ""}...`
|
|
4433
|
+
)
|
|
4434
|
+
);
|
|
4435
|
+
console.log(import_chalk5.default.cyan(` Artifacts: ${exactArtifactIds.join(", ")}`));
|
|
4436
|
+
schemas = await getSchemasByArtifactIds(REGISTRY_URL, exactArtifactIds, INCLUDE_ALL_VERSIONS);
|
|
4437
|
+
} else if (exactArtifactIds === null) {
|
|
4438
|
+
console.log(import_chalk5.default.green(`Fetching all schemas from registry (prefix/suffix filters detected): ${REGISTRY_URL}...`));
|
|
4439
|
+
schemas = await getSchemasFromRegistry(REGISTRY_URL);
|
|
4440
|
+
} else {
|
|
4441
|
+
console.log(import_chalk5.default.yellow(`No artifacts specified in services configuration`));
|
|
4442
|
+
}
|
|
4443
|
+
} else {
|
|
4444
|
+
console.log(import_chalk5.default.green(`Fetching all schemas from registry: ${REGISTRY_URL}...`));
|
|
4445
|
+
schemas = await getSchemasFromRegistry(REGISTRY_URL);
|
|
4446
|
+
}
|
|
4447
|
+
console.log(import_chalk5.default.green(`Found ${schemas.length} schemas in Apicurio Registry`));
|
|
4448
|
+
const groupedSchemas = schemas.reduce((acc, schema) => {
|
|
4449
|
+
acc[schema.artifactId] = [...acc[schema.artifactId] || [], schema];
|
|
4450
|
+
return acc;
|
|
4451
|
+
}, {});
|
|
4452
|
+
const allMessagesInRegistry = Object.keys(groupedSchemas);
|
|
4453
|
+
if (options.domain) {
|
|
4454
|
+
const { id: domainId, name: domainName, version: domainVersion } = options.domain;
|
|
4455
|
+
const domain = await getDomain(options.domain.id, domainVersion || "latest");
|
|
4456
|
+
const currentDomain = await getDomain(options.domain.id, "latest");
|
|
4457
|
+
console.log(import_chalk5.default.blue(`
|
|
4458
|
+
Processing domain: ${domainName} (v${domainVersion})`));
|
|
4459
|
+
if (currentDomain && currentDomain.version !== domainVersion) {
|
|
4460
|
+
await versionDomain(domainId);
|
|
4461
|
+
console.log(import_chalk5.default.cyan(` - Versioned previous domain (v${currentDomain.version})`));
|
|
4462
|
+
}
|
|
4463
|
+
if (!domain || domain && domain.version !== domainVersion) {
|
|
4464
|
+
await writeDomain({
|
|
4465
|
+
// Persist if we have previous information
|
|
4466
|
+
...currentDomain,
|
|
4467
|
+
id: domainId,
|
|
4468
|
+
name: domainName,
|
|
4469
|
+
version: domainVersion,
|
|
4470
|
+
markdown: currentDomain?.markdown || getMarkdownForDomain()
|
|
4471
|
+
});
|
|
4472
|
+
console.log(import_chalk5.default.cyan(` - Domain (v${domainVersion}) created`));
|
|
4473
|
+
}
|
|
4474
|
+
for (const service of services) {
|
|
4475
|
+
await addServiceToDomain(domainId, { id: service.id, version: service.version }, domainVersion);
|
|
4476
|
+
}
|
|
4477
|
+
}
|
|
4478
|
+
if (documentMessagesWithService) {
|
|
4479
|
+
for (const service of services) {
|
|
4480
|
+
const sends = filterSchemas(groupedSchemas, service.sends || [], INCLUDE_ALL_VERSIONS).filter(
|
|
4481
|
+
(message2) => message2 !== void 0
|
|
4482
|
+
);
|
|
4483
|
+
const receives = filterSchemas(groupedSchemas, service.receives || [], INCLUDE_ALL_VERSIONS).filter(
|
|
4484
|
+
(message2) => message2 !== void 0
|
|
4485
|
+
);
|
|
4486
|
+
const serviceInCatalog = await getService(service.id);
|
|
4487
|
+
const { sends: previousSends, receives: previousReceives, ...previousServiceInformation } = serviceInCatalog || {};
|
|
4488
|
+
if (serviceInCatalog && serviceInCatalog.version !== service.version) {
|
|
4489
|
+
await versionService(service.id);
|
|
4490
|
+
console.log(import_chalk5.default.cyan(` - Versioned previous service: (v${serviceInCatalog.version})`));
|
|
4491
|
+
}
|
|
4492
|
+
const pathToService = (0, import_path4.join)("../", "services", service.id);
|
|
4493
|
+
const summary = service.summary || serviceInCatalog?.summary || `${service.id} Service`;
|
|
4494
|
+
const latestSends = sends.filter((m) => m.latestVersion);
|
|
4495
|
+
const latestReceives = receives.filter((m) => m.latestVersion);
|
|
4496
|
+
const serviceToWrite = {
|
|
4497
|
+
// Persist if we have previous information
|
|
4498
|
+
...previousServiceInformation,
|
|
4499
|
+
// Regardless if we have previous information or not, we add this information always
|
|
4500
|
+
id: service.id,
|
|
4501
|
+
name: service.name || service.id,
|
|
4502
|
+
version: service.version,
|
|
4503
|
+
summary,
|
|
4504
|
+
...latestSends.length > 0 ? { sends: latestSends.map((message2) => ({ id: message2.messageId, version: message2.version.toString() })) } : {},
|
|
4505
|
+
...latestReceives.length > 0 ? { receives: latestReceives.map((message2) => ({ id: message2.messageId, version: message2.version.toString() })) } : {},
|
|
4506
|
+
...service.writesTo && { writesTo: service.writesTo },
|
|
4507
|
+
...service.readsFrom && { readsFrom: service.readsFrom },
|
|
4508
|
+
// If the service does not already exist we need to add fields for new documented topics
|
|
4509
|
+
...!serviceInCatalog ? {
|
|
4510
|
+
markdown: getMarkdownForService({ registryUrl: REGISTRY_URL })
|
|
4511
|
+
} : {}
|
|
4512
|
+
};
|
|
4513
|
+
let servicePath = options.domain ? import_path4.default.join("../", "domains", options.domain.id, "services", service.id) : pathToService;
|
|
4514
|
+
let existingSpecifications = {};
|
|
4515
|
+
if (serviceInCatalog?.specifications && typeof serviceInCatalog.specifications === "object" && !Array.isArray(serviceInCatalog.specifications)) {
|
|
4516
|
+
existingSpecifications = serviceInCatalog.specifications;
|
|
4517
|
+
}
|
|
4518
|
+
let existingSpecFiles = [];
|
|
4519
|
+
if (serviceInCatalog?.version === service.version) {
|
|
4520
|
+
existingSpecFiles = await getSpecificationFilesForService(service.id, service.version);
|
|
4521
|
+
}
|
|
4522
|
+
const specFilesToAdd = [...existingSpecFiles];
|
|
4523
|
+
const newSpecifications = { ...existingSpecifications };
|
|
4524
|
+
const specsWithGenerators = [];
|
|
4525
|
+
if (service.specifications && service.specifications.length > 0) {
|
|
4526
|
+
for (const specConfig of service.specifications) {
|
|
4527
|
+
const specArtifact = await getSpecificationArtifact(REGISTRY_URL, specConfig.artifactId, specConfig.version);
|
|
4528
|
+
if (specArtifact) {
|
|
4529
|
+
const extension = specConfig.type === "asyncapi" ? "asyncapi.yml" : "openapi.yml";
|
|
4530
|
+
const fileName = `${specConfig.artifactId.toLowerCase().replace(/\s+/g, "-")}.${extension}`;
|
|
4531
|
+
specFilesToAdd.push({
|
|
4532
|
+
content: specArtifact.content,
|
|
4533
|
+
fileName
|
|
4534
|
+
});
|
|
4535
|
+
const specKey = specConfig.type === "asyncapi" ? "asyncapiPath" : "openapiPath";
|
|
4536
|
+
newSpecifications[specKey] = fileName;
|
|
4537
|
+
console.log(
|
|
4538
|
+
import_chalk5.default.cyan(` - Added ${specConfig.type} specification: ${specConfig.artifactId} (v${specArtifact.version})`)
|
|
4539
|
+
);
|
|
4540
|
+
if (specConfig.generator) {
|
|
4541
|
+
specsWithGenerators.push({ specConfig, fileName, content: specArtifact.content });
|
|
4542
|
+
}
|
|
4543
|
+
}
|
|
4544
|
+
}
|
|
4545
|
+
}
|
|
4546
|
+
const serviceWithSpecs = {
|
|
4547
|
+
...serviceToWrite,
|
|
4548
|
+
...Object.keys(newSpecifications).length > 0 ? { specifications: newSpecifications } : {}
|
|
4549
|
+
};
|
|
4550
|
+
await writeService(serviceWithSpecs, { path: servicePath, override: serviceInCatalog?.version === service.version });
|
|
4551
|
+
for (const specFile of specFilesToAdd) {
|
|
4552
|
+
await addFileToService(service.id, { content: specFile.content, fileName: specFile.fileName });
|
|
4553
|
+
}
|
|
4554
|
+
for (const { specConfig, fileName, content } of specsWithGenerators) {
|
|
4555
|
+
const specFilePath = options.domain ? import_path4.default.join(eventCatalogDirectory, "domains", options.domain.id, "services", service.id, fileName) : import_path4.default.join(eventCatalogDirectory, "services", service.id, fileName);
|
|
4556
|
+
const specDir = import_path4.default.dirname(specFilePath);
|
|
4557
|
+
if (!import_fs3.default.existsSync(specDir)) {
|
|
4558
|
+
import_fs3.default.mkdirSync(specDir, { recursive: true });
|
|
4559
|
+
}
|
|
4560
|
+
import_fs3.default.writeFileSync(specFilePath, content, "utf-8");
|
|
4561
|
+
await runSpecificationGenerator(
|
|
4562
|
+
specConfig,
|
|
4563
|
+
specFilePath,
|
|
4564
|
+
service.id,
|
|
4565
|
+
service.name || service.id,
|
|
4566
|
+
service.version,
|
|
4567
|
+
eventCatalogDirectory,
|
|
4568
|
+
options.domain
|
|
4569
|
+
);
|
|
4570
|
+
}
|
|
4571
|
+
const messages = [...sends, ...receives];
|
|
4572
|
+
for (const message2 of messages) {
|
|
4573
|
+
await writeMessageToEventCatalog({
|
|
4574
|
+
pathToCatalog: eventCatalogDirectory,
|
|
4575
|
+
message: message2,
|
|
4576
|
+
rootPath: pathToService,
|
|
4577
|
+
serviceId: service.id,
|
|
4578
|
+
messageType: message2.messageType || "event"
|
|
4579
|
+
});
|
|
4580
|
+
console.log(import_chalk5.default.blue(` - Processed ${message2.messageId} (v${message2.version}), added schema to event catalog`));
|
|
4581
|
+
}
|
|
4582
|
+
console.log(import_chalk5.default.blue(` - Processed ${service.id} (v${service.version}), added service to event catalog`));
|
|
4583
|
+
}
|
|
4584
|
+
} else {
|
|
4585
|
+
for (const artifactId of allMessagesInRegistry) {
|
|
4586
|
+
const messages = groupedSchemas[artifactId];
|
|
4587
|
+
const messagesToWriteToEventCatalog = messages.filter((v) => INCLUDE_ALL_VERSIONS ? true : v.latestVersion);
|
|
4588
|
+
for (const message2 of messagesToWriteToEventCatalog) {
|
|
4589
|
+
await writeMessageToEventCatalog({
|
|
4590
|
+
pathToCatalog: eventCatalogDirectory,
|
|
4591
|
+
message: message2,
|
|
4592
|
+
rootPath: "../",
|
|
4593
|
+
messageType: "event"
|
|
4594
|
+
});
|
|
4595
|
+
console.log(import_chalk5.default.blue(` - Processed ${message2.messageId} (v${message2.version}), added schema to event catalog`));
|
|
4596
|
+
}
|
|
4597
|
+
}
|
|
4598
|
+
}
|
|
4599
|
+
console.log(import_chalk5.default.green(`
|
|
4600
|
+
Finished generating event catalog with Apicurio Registry ${REGISTRY_URL}`));
|
|
4601
|
+
};
|
|
4602
|
+
//# sourceMappingURL=index.js.map
|