@arcote.tech/arc-host 0.7.26 → 0.7.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +166 -3776
- package/dist/index.js.map +8 -84
- package/dist/src/context-handler.d.ts +31 -0
- package/dist/src/context-handler.d.ts.map +1 -1
- package/dist/src/create-server.d.ts +17 -0
- package/dist/src/create-server.d.ts.map +1 -1
- package/dist/src/event-auth.d.ts.map +1 -1
- package/dist/src/middleware/http.d.ts.map +1 -1
- package/dist/src/middleware/types.d.ts +1 -1
- package/dist/src/middleware/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/context-handler.ts +155 -1
- package/src/create-server.ts +74 -41
- package/src/event-auth.ts +8 -1
- package/src/middleware/http.ts +34 -16
- package/src/middleware/types.ts +1 -1
- package/src/middleware/ws.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -1,3735 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
function __accessProp(key) {
|
|
8
|
-
return this[key];
|
|
9
|
-
}
|
|
10
|
-
var __toESMCache_node;
|
|
11
|
-
var __toESMCache_esm;
|
|
12
|
-
var __toESM = (mod, isNodeMode, target) => {
|
|
13
|
-
var canCache = mod != null && typeof mod === "object";
|
|
14
|
-
if (canCache) {
|
|
15
|
-
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
16
|
-
var cached = cache.get(mod);
|
|
17
|
-
if (cached)
|
|
18
|
-
return cached;
|
|
19
|
-
}
|
|
20
|
-
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
21
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
22
|
-
for (let key of __getOwnPropNames(mod))
|
|
23
|
-
if (!__hasOwnProp.call(to, key))
|
|
24
|
-
__defProp(to, key, {
|
|
25
|
-
get: __accessProp.bind(mod, key),
|
|
26
|
-
enumerable: true
|
|
27
|
-
});
|
|
28
|
-
if (canCache)
|
|
29
|
-
cache.set(mod, to);
|
|
30
|
-
return to;
|
|
31
|
-
};
|
|
32
|
-
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
33
|
-
var __require = import.meta.require;
|
|
34
|
-
|
|
35
|
-
// ../../node_modules/.bun/safe-buffer@5.2.1/node_modules/safe-buffer/index.js
|
|
36
|
-
var require_safe_buffer = __commonJS((exports, module) => {
|
|
37
|
-
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
38
|
-
var buffer = __require("buffer");
|
|
39
|
-
var Buffer2 = buffer.Buffer;
|
|
40
|
-
function copyProps(src, dst) {
|
|
41
|
-
for (var key in src) {
|
|
42
|
-
dst[key] = src[key];
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
|
|
46
|
-
module.exports = buffer;
|
|
47
|
-
} else {
|
|
48
|
-
copyProps(buffer, exports);
|
|
49
|
-
exports.Buffer = SafeBuffer;
|
|
50
|
-
}
|
|
51
|
-
function SafeBuffer(arg, encodingOrOffset, length) {
|
|
52
|
-
return Buffer2(arg, encodingOrOffset, length);
|
|
53
|
-
}
|
|
54
|
-
SafeBuffer.prototype = Object.create(Buffer2.prototype);
|
|
55
|
-
copyProps(Buffer2, SafeBuffer);
|
|
56
|
-
SafeBuffer.from = function(arg, encodingOrOffset, length) {
|
|
57
|
-
if (typeof arg === "number") {
|
|
58
|
-
throw new TypeError("Argument must not be a number");
|
|
59
|
-
}
|
|
60
|
-
return Buffer2(arg, encodingOrOffset, length);
|
|
61
|
-
};
|
|
62
|
-
SafeBuffer.alloc = function(size, fill, encoding) {
|
|
63
|
-
if (typeof size !== "number") {
|
|
64
|
-
throw new TypeError("Argument must be a number");
|
|
65
|
-
}
|
|
66
|
-
var buf = Buffer2(size);
|
|
67
|
-
if (fill !== undefined) {
|
|
68
|
-
if (typeof encoding === "string") {
|
|
69
|
-
buf.fill(fill, encoding);
|
|
70
|
-
} else {
|
|
71
|
-
buf.fill(fill);
|
|
72
|
-
}
|
|
73
|
-
} else {
|
|
74
|
-
buf.fill(0);
|
|
75
|
-
}
|
|
76
|
-
return buf;
|
|
77
|
-
};
|
|
78
|
-
SafeBuffer.allocUnsafe = function(size) {
|
|
79
|
-
if (typeof size !== "number") {
|
|
80
|
-
throw new TypeError("Argument must be a number");
|
|
81
|
-
}
|
|
82
|
-
return Buffer2(size);
|
|
83
|
-
};
|
|
84
|
-
SafeBuffer.allocUnsafeSlow = function(size) {
|
|
85
|
-
if (typeof size !== "number") {
|
|
86
|
-
throw new TypeError("Argument must be a number");
|
|
87
|
-
}
|
|
88
|
-
return buffer.SlowBuffer(size);
|
|
89
|
-
};
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
// ../../node_modules/.bun/jws@4.0.1/node_modules/jws/lib/data-stream.js
|
|
93
|
-
var require_data_stream = __commonJS((exports, module) => {
|
|
94
|
-
var Buffer2 = require_safe_buffer().Buffer;
|
|
95
|
-
var Stream = __require("stream");
|
|
96
|
-
var util = __require("util");
|
|
97
|
-
function DataStream(data) {
|
|
98
|
-
this.buffer = null;
|
|
99
|
-
this.writable = true;
|
|
100
|
-
this.readable = true;
|
|
101
|
-
if (!data) {
|
|
102
|
-
this.buffer = Buffer2.alloc(0);
|
|
103
|
-
return this;
|
|
104
|
-
}
|
|
105
|
-
if (typeof data.pipe === "function") {
|
|
106
|
-
this.buffer = Buffer2.alloc(0);
|
|
107
|
-
data.pipe(this);
|
|
108
|
-
return this;
|
|
109
|
-
}
|
|
110
|
-
if (data.length || typeof data === "object") {
|
|
111
|
-
this.buffer = data;
|
|
112
|
-
this.writable = false;
|
|
113
|
-
process.nextTick(function() {
|
|
114
|
-
this.emit("end", data);
|
|
115
|
-
this.readable = false;
|
|
116
|
-
this.emit("close");
|
|
117
|
-
}.bind(this));
|
|
118
|
-
return this;
|
|
119
|
-
}
|
|
120
|
-
throw new TypeError("Unexpected data type (" + typeof data + ")");
|
|
121
|
-
}
|
|
122
|
-
util.inherits(DataStream, Stream);
|
|
123
|
-
DataStream.prototype.write = function write(data) {
|
|
124
|
-
this.buffer = Buffer2.concat([this.buffer, Buffer2.from(data)]);
|
|
125
|
-
this.emit("data", data);
|
|
126
|
-
};
|
|
127
|
-
DataStream.prototype.end = function end(data) {
|
|
128
|
-
if (data)
|
|
129
|
-
this.write(data);
|
|
130
|
-
this.emit("end", data);
|
|
131
|
-
this.emit("close");
|
|
132
|
-
this.writable = false;
|
|
133
|
-
this.readable = false;
|
|
134
|
-
};
|
|
135
|
-
module.exports = DataStream;
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
// ../../node_modules/.bun/ecdsa-sig-formatter@1.0.11/node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js
|
|
139
|
-
var require_param_bytes_for_alg = __commonJS((exports, module) => {
|
|
140
|
-
function getParamSize(keySize) {
|
|
141
|
-
var result = (keySize / 8 | 0) + (keySize % 8 === 0 ? 0 : 1);
|
|
142
|
-
return result;
|
|
143
|
-
}
|
|
144
|
-
var paramBytesForAlg = {
|
|
145
|
-
ES256: getParamSize(256),
|
|
146
|
-
ES384: getParamSize(384),
|
|
147
|
-
ES512: getParamSize(521)
|
|
148
|
-
};
|
|
149
|
-
function getParamBytesForAlg(alg) {
|
|
150
|
-
var paramBytes = paramBytesForAlg[alg];
|
|
151
|
-
if (paramBytes) {
|
|
152
|
-
return paramBytes;
|
|
153
|
-
}
|
|
154
|
-
throw new Error('Unknown algorithm "' + alg + '"');
|
|
155
|
-
}
|
|
156
|
-
module.exports = getParamBytesForAlg;
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
// ../../node_modules/.bun/ecdsa-sig-formatter@1.0.11/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js
|
|
160
|
-
var require_ecdsa_sig_formatter = __commonJS((exports, module) => {
|
|
161
|
-
var Buffer2 = require_safe_buffer().Buffer;
|
|
162
|
-
var getParamBytesForAlg = require_param_bytes_for_alg();
|
|
163
|
-
var MAX_OCTET = 128;
|
|
164
|
-
var CLASS_UNIVERSAL = 0;
|
|
165
|
-
var PRIMITIVE_BIT = 32;
|
|
166
|
-
var TAG_SEQ = 16;
|
|
167
|
-
var TAG_INT = 2;
|
|
168
|
-
var ENCODED_TAG_SEQ = TAG_SEQ | PRIMITIVE_BIT | CLASS_UNIVERSAL << 6;
|
|
169
|
-
var ENCODED_TAG_INT = TAG_INT | CLASS_UNIVERSAL << 6;
|
|
170
|
-
function base64Url(base64) {
|
|
171
|
-
return base64.replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
172
|
-
}
|
|
173
|
-
function signatureAsBuffer(signature) {
|
|
174
|
-
if (Buffer2.isBuffer(signature)) {
|
|
175
|
-
return signature;
|
|
176
|
-
} else if (typeof signature === "string") {
|
|
177
|
-
return Buffer2.from(signature, "base64");
|
|
178
|
-
}
|
|
179
|
-
throw new TypeError("ECDSA signature must be a Base64 string or a Buffer");
|
|
180
|
-
}
|
|
181
|
-
function derToJose(signature, alg) {
|
|
182
|
-
signature = signatureAsBuffer(signature);
|
|
183
|
-
var paramBytes = getParamBytesForAlg(alg);
|
|
184
|
-
var maxEncodedParamLength = paramBytes + 1;
|
|
185
|
-
var inputLength = signature.length;
|
|
186
|
-
var offset = 0;
|
|
187
|
-
if (signature[offset++] !== ENCODED_TAG_SEQ) {
|
|
188
|
-
throw new Error('Could not find expected "seq"');
|
|
189
|
-
}
|
|
190
|
-
var seqLength = signature[offset++];
|
|
191
|
-
if (seqLength === (MAX_OCTET | 1)) {
|
|
192
|
-
seqLength = signature[offset++];
|
|
193
|
-
}
|
|
194
|
-
if (inputLength - offset < seqLength) {
|
|
195
|
-
throw new Error('"seq" specified length of "' + seqLength + '", only "' + (inputLength - offset) + '" remaining');
|
|
196
|
-
}
|
|
197
|
-
if (signature[offset++] !== ENCODED_TAG_INT) {
|
|
198
|
-
throw new Error('Could not find expected "int" for "r"');
|
|
199
|
-
}
|
|
200
|
-
var rLength = signature[offset++];
|
|
201
|
-
if (inputLength - offset - 2 < rLength) {
|
|
202
|
-
throw new Error('"r" specified length of "' + rLength + '", only "' + (inputLength - offset - 2) + '" available');
|
|
203
|
-
}
|
|
204
|
-
if (maxEncodedParamLength < rLength) {
|
|
205
|
-
throw new Error('"r" specified length of "' + rLength + '", max of "' + maxEncodedParamLength + '" is acceptable');
|
|
206
|
-
}
|
|
207
|
-
var rOffset = offset;
|
|
208
|
-
offset += rLength;
|
|
209
|
-
if (signature[offset++] !== ENCODED_TAG_INT) {
|
|
210
|
-
throw new Error('Could not find expected "int" for "s"');
|
|
211
|
-
}
|
|
212
|
-
var sLength = signature[offset++];
|
|
213
|
-
if (inputLength - offset !== sLength) {
|
|
214
|
-
throw new Error('"s" specified length of "' + sLength + '", expected "' + (inputLength - offset) + '"');
|
|
215
|
-
}
|
|
216
|
-
if (maxEncodedParamLength < sLength) {
|
|
217
|
-
throw new Error('"s" specified length of "' + sLength + '", max of "' + maxEncodedParamLength + '" is acceptable');
|
|
218
|
-
}
|
|
219
|
-
var sOffset = offset;
|
|
220
|
-
offset += sLength;
|
|
221
|
-
if (offset !== inputLength) {
|
|
222
|
-
throw new Error('Expected to consume entire buffer, but "' + (inputLength - offset) + '" bytes remain');
|
|
223
|
-
}
|
|
224
|
-
var rPadding = paramBytes - rLength, sPadding = paramBytes - sLength;
|
|
225
|
-
var dst = Buffer2.allocUnsafe(rPadding + rLength + sPadding + sLength);
|
|
226
|
-
for (offset = 0;offset < rPadding; ++offset) {
|
|
227
|
-
dst[offset] = 0;
|
|
228
|
-
}
|
|
229
|
-
signature.copy(dst, offset, rOffset + Math.max(-rPadding, 0), rOffset + rLength);
|
|
230
|
-
offset = paramBytes;
|
|
231
|
-
for (var o = offset;offset < o + sPadding; ++offset) {
|
|
232
|
-
dst[offset] = 0;
|
|
233
|
-
}
|
|
234
|
-
signature.copy(dst, offset, sOffset + Math.max(-sPadding, 0), sOffset + sLength);
|
|
235
|
-
dst = dst.toString("base64");
|
|
236
|
-
dst = base64Url(dst);
|
|
237
|
-
return dst;
|
|
238
|
-
}
|
|
239
|
-
function countPadding(buf, start, stop) {
|
|
240
|
-
var padding = 0;
|
|
241
|
-
while (start + padding < stop && buf[start + padding] === 0) {
|
|
242
|
-
++padding;
|
|
243
|
-
}
|
|
244
|
-
var needsSign = buf[start + padding] >= MAX_OCTET;
|
|
245
|
-
if (needsSign) {
|
|
246
|
-
--padding;
|
|
247
|
-
}
|
|
248
|
-
return padding;
|
|
249
|
-
}
|
|
250
|
-
function joseToDer(signature, alg) {
|
|
251
|
-
signature = signatureAsBuffer(signature);
|
|
252
|
-
var paramBytes = getParamBytesForAlg(alg);
|
|
253
|
-
var signatureBytes = signature.length;
|
|
254
|
-
if (signatureBytes !== paramBytes * 2) {
|
|
255
|
-
throw new TypeError('"' + alg + '" signatures must be "' + paramBytes * 2 + '" bytes, saw "' + signatureBytes + '"');
|
|
256
|
-
}
|
|
257
|
-
var rPadding = countPadding(signature, 0, paramBytes);
|
|
258
|
-
var sPadding = countPadding(signature, paramBytes, signature.length);
|
|
259
|
-
var rLength = paramBytes - rPadding;
|
|
260
|
-
var sLength = paramBytes - sPadding;
|
|
261
|
-
var rsBytes = 1 + 1 + rLength + 1 + 1 + sLength;
|
|
262
|
-
var shortLength = rsBytes < MAX_OCTET;
|
|
263
|
-
var dst = Buffer2.allocUnsafe((shortLength ? 2 : 3) + rsBytes);
|
|
264
|
-
var offset = 0;
|
|
265
|
-
dst[offset++] = ENCODED_TAG_SEQ;
|
|
266
|
-
if (shortLength) {
|
|
267
|
-
dst[offset++] = rsBytes;
|
|
268
|
-
} else {
|
|
269
|
-
dst[offset++] = MAX_OCTET | 1;
|
|
270
|
-
dst[offset++] = rsBytes & 255;
|
|
271
|
-
}
|
|
272
|
-
dst[offset++] = ENCODED_TAG_INT;
|
|
273
|
-
dst[offset++] = rLength;
|
|
274
|
-
if (rPadding < 0) {
|
|
275
|
-
dst[offset++] = 0;
|
|
276
|
-
offset += signature.copy(dst, offset, 0, paramBytes);
|
|
277
|
-
} else {
|
|
278
|
-
offset += signature.copy(dst, offset, rPadding, paramBytes);
|
|
279
|
-
}
|
|
280
|
-
dst[offset++] = ENCODED_TAG_INT;
|
|
281
|
-
dst[offset++] = sLength;
|
|
282
|
-
if (sPadding < 0) {
|
|
283
|
-
dst[offset++] = 0;
|
|
284
|
-
signature.copy(dst, offset, paramBytes);
|
|
285
|
-
} else {
|
|
286
|
-
signature.copy(dst, offset, paramBytes + sPadding);
|
|
287
|
-
}
|
|
288
|
-
return dst;
|
|
289
|
-
}
|
|
290
|
-
module.exports = {
|
|
291
|
-
derToJose,
|
|
292
|
-
joseToDer
|
|
293
|
-
};
|
|
294
|
-
});
|
|
295
|
-
|
|
296
|
-
// ../../node_modules/.bun/buffer-equal-constant-time@1.0.1/node_modules/buffer-equal-constant-time/index.js
|
|
297
|
-
var require_buffer_equal_constant_time = __commonJS((exports, module) => {
|
|
298
|
-
var Buffer2 = __require("buffer").Buffer;
|
|
299
|
-
var SlowBuffer = __require("buffer").SlowBuffer;
|
|
300
|
-
module.exports = bufferEq;
|
|
301
|
-
function bufferEq(a, b) {
|
|
302
|
-
if (!Buffer2.isBuffer(a) || !Buffer2.isBuffer(b)) {
|
|
303
|
-
return false;
|
|
304
|
-
}
|
|
305
|
-
if (a.length !== b.length) {
|
|
306
|
-
return false;
|
|
307
|
-
}
|
|
308
|
-
var c = 0;
|
|
309
|
-
for (var i = 0;i < a.length; i++) {
|
|
310
|
-
c |= a[i] ^ b[i];
|
|
311
|
-
}
|
|
312
|
-
return c === 0;
|
|
313
|
-
}
|
|
314
|
-
bufferEq.install = function() {
|
|
315
|
-
Buffer2.prototype.equal = SlowBuffer.prototype.equal = function equal(that) {
|
|
316
|
-
return bufferEq(this, that);
|
|
317
|
-
};
|
|
318
|
-
};
|
|
319
|
-
var origBufEqual = Buffer2.prototype.equal;
|
|
320
|
-
var origSlowBufEqual = SlowBuffer.prototype.equal;
|
|
321
|
-
bufferEq.restore = function() {
|
|
322
|
-
Buffer2.prototype.equal = origBufEqual;
|
|
323
|
-
SlowBuffer.prototype.equal = origSlowBufEqual;
|
|
324
|
-
};
|
|
325
|
-
});
|
|
326
|
-
|
|
327
|
-
// ../../node_modules/.bun/jwa@2.0.1/node_modules/jwa/index.js
|
|
328
|
-
var require_jwa = __commonJS((exports, module) => {
|
|
329
|
-
var Buffer2 = require_safe_buffer().Buffer;
|
|
330
|
-
var crypto = __require("crypto");
|
|
331
|
-
var formatEcdsa = require_ecdsa_sig_formatter();
|
|
332
|
-
var util = __require("util");
|
|
333
|
-
var MSG_INVALID_ALGORITHM = `"%s" is not a valid algorithm.
|
|
334
|
-
Supported algorithms are:
|
|
335
|
-
"HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".`;
|
|
336
|
-
var MSG_INVALID_SECRET = "secret must be a string or buffer";
|
|
337
|
-
var MSG_INVALID_VERIFIER_KEY = "key must be a string or a buffer";
|
|
338
|
-
var MSG_INVALID_SIGNER_KEY = "key must be a string, a buffer or an object";
|
|
339
|
-
var supportsKeyObjects = typeof crypto.createPublicKey === "function";
|
|
340
|
-
if (supportsKeyObjects) {
|
|
341
|
-
MSG_INVALID_VERIFIER_KEY += " or a KeyObject";
|
|
342
|
-
MSG_INVALID_SECRET += "or a KeyObject";
|
|
343
|
-
}
|
|
344
|
-
function checkIsPublicKey(key) {
|
|
345
|
-
if (Buffer2.isBuffer(key)) {
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
if (typeof key === "string") {
|
|
349
|
-
return;
|
|
350
|
-
}
|
|
351
|
-
if (!supportsKeyObjects) {
|
|
352
|
-
throw typeError(MSG_INVALID_VERIFIER_KEY);
|
|
353
|
-
}
|
|
354
|
-
if (typeof key !== "object") {
|
|
355
|
-
throw typeError(MSG_INVALID_VERIFIER_KEY);
|
|
356
|
-
}
|
|
357
|
-
if (typeof key.type !== "string") {
|
|
358
|
-
throw typeError(MSG_INVALID_VERIFIER_KEY);
|
|
359
|
-
}
|
|
360
|
-
if (typeof key.asymmetricKeyType !== "string") {
|
|
361
|
-
throw typeError(MSG_INVALID_VERIFIER_KEY);
|
|
362
|
-
}
|
|
363
|
-
if (typeof key.export !== "function") {
|
|
364
|
-
throw typeError(MSG_INVALID_VERIFIER_KEY);
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
function checkIsPrivateKey(key) {
|
|
368
|
-
if (Buffer2.isBuffer(key)) {
|
|
369
|
-
return;
|
|
370
|
-
}
|
|
371
|
-
if (typeof key === "string") {
|
|
372
|
-
return;
|
|
373
|
-
}
|
|
374
|
-
if (typeof key === "object") {
|
|
375
|
-
return;
|
|
376
|
-
}
|
|
377
|
-
throw typeError(MSG_INVALID_SIGNER_KEY);
|
|
378
|
-
}
|
|
379
|
-
function checkIsSecretKey(key) {
|
|
380
|
-
if (Buffer2.isBuffer(key)) {
|
|
381
|
-
return;
|
|
382
|
-
}
|
|
383
|
-
if (typeof key === "string") {
|
|
384
|
-
return key;
|
|
385
|
-
}
|
|
386
|
-
if (!supportsKeyObjects) {
|
|
387
|
-
throw typeError(MSG_INVALID_SECRET);
|
|
388
|
-
}
|
|
389
|
-
if (typeof key !== "object") {
|
|
390
|
-
throw typeError(MSG_INVALID_SECRET);
|
|
391
|
-
}
|
|
392
|
-
if (key.type !== "secret") {
|
|
393
|
-
throw typeError(MSG_INVALID_SECRET);
|
|
394
|
-
}
|
|
395
|
-
if (typeof key.export !== "function") {
|
|
396
|
-
throw typeError(MSG_INVALID_SECRET);
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
function fromBase64(base64) {
|
|
400
|
-
return base64.replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
401
|
-
}
|
|
402
|
-
function toBase64(base64url) {
|
|
403
|
-
base64url = base64url.toString();
|
|
404
|
-
var padding = 4 - base64url.length % 4;
|
|
405
|
-
if (padding !== 4) {
|
|
406
|
-
for (var i = 0;i < padding; ++i) {
|
|
407
|
-
base64url += "=";
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
return base64url.replace(/\-/g, "+").replace(/_/g, "/");
|
|
411
|
-
}
|
|
412
|
-
function typeError(template) {
|
|
413
|
-
var args = [].slice.call(arguments, 1);
|
|
414
|
-
var errMsg = util.format.bind(util, template).apply(null, args);
|
|
415
|
-
return new TypeError(errMsg);
|
|
416
|
-
}
|
|
417
|
-
function bufferOrString(obj) {
|
|
418
|
-
return Buffer2.isBuffer(obj) || typeof obj === "string";
|
|
419
|
-
}
|
|
420
|
-
function normalizeInput(thing) {
|
|
421
|
-
if (!bufferOrString(thing))
|
|
422
|
-
thing = JSON.stringify(thing);
|
|
423
|
-
return thing;
|
|
424
|
-
}
|
|
425
|
-
function createHmacSigner(bits) {
|
|
426
|
-
return function sign(thing, secret) {
|
|
427
|
-
checkIsSecretKey(secret);
|
|
428
|
-
thing = normalizeInput(thing);
|
|
429
|
-
var hmac = crypto.createHmac("sha" + bits, secret);
|
|
430
|
-
var sig = (hmac.update(thing), hmac.digest("base64"));
|
|
431
|
-
return fromBase64(sig);
|
|
432
|
-
};
|
|
433
|
-
}
|
|
434
|
-
var bufferEqual;
|
|
435
|
-
var timingSafeEqual = "timingSafeEqual" in crypto ? function timingSafeEqual2(a, b) {
|
|
436
|
-
if (a.byteLength !== b.byteLength) {
|
|
437
|
-
return false;
|
|
438
|
-
}
|
|
439
|
-
return crypto.timingSafeEqual(a, b);
|
|
440
|
-
} : function timingSafeEqual2(a, b) {
|
|
441
|
-
if (!bufferEqual) {
|
|
442
|
-
bufferEqual = require_buffer_equal_constant_time();
|
|
443
|
-
}
|
|
444
|
-
return bufferEqual(a, b);
|
|
445
|
-
};
|
|
446
|
-
function createHmacVerifier(bits) {
|
|
447
|
-
return function verify(thing, signature, secret) {
|
|
448
|
-
var computedSig = createHmacSigner(bits)(thing, secret);
|
|
449
|
-
return timingSafeEqual(Buffer2.from(signature), Buffer2.from(computedSig));
|
|
450
|
-
};
|
|
451
|
-
}
|
|
452
|
-
function createKeySigner(bits) {
|
|
453
|
-
return function sign(thing, privateKey) {
|
|
454
|
-
checkIsPrivateKey(privateKey);
|
|
455
|
-
thing = normalizeInput(thing);
|
|
456
|
-
var signer = crypto.createSign("RSA-SHA" + bits);
|
|
457
|
-
var sig = (signer.update(thing), signer.sign(privateKey, "base64"));
|
|
458
|
-
return fromBase64(sig);
|
|
459
|
-
};
|
|
460
|
-
}
|
|
461
|
-
function createKeyVerifier(bits) {
|
|
462
|
-
return function verify(thing, signature, publicKey) {
|
|
463
|
-
checkIsPublicKey(publicKey);
|
|
464
|
-
thing = normalizeInput(thing);
|
|
465
|
-
signature = toBase64(signature);
|
|
466
|
-
var verifier = crypto.createVerify("RSA-SHA" + bits);
|
|
467
|
-
verifier.update(thing);
|
|
468
|
-
return verifier.verify(publicKey, signature, "base64");
|
|
469
|
-
};
|
|
470
|
-
}
|
|
471
|
-
function createPSSKeySigner(bits) {
|
|
472
|
-
return function sign(thing, privateKey) {
|
|
473
|
-
checkIsPrivateKey(privateKey);
|
|
474
|
-
thing = normalizeInput(thing);
|
|
475
|
-
var signer = crypto.createSign("RSA-SHA" + bits);
|
|
476
|
-
var sig = (signer.update(thing), signer.sign({
|
|
477
|
-
key: privateKey,
|
|
478
|
-
padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
|
|
479
|
-
saltLength: crypto.constants.RSA_PSS_SALTLEN_DIGEST
|
|
480
|
-
}, "base64"));
|
|
481
|
-
return fromBase64(sig);
|
|
482
|
-
};
|
|
483
|
-
}
|
|
484
|
-
function createPSSKeyVerifier(bits) {
|
|
485
|
-
return function verify(thing, signature, publicKey) {
|
|
486
|
-
checkIsPublicKey(publicKey);
|
|
487
|
-
thing = normalizeInput(thing);
|
|
488
|
-
signature = toBase64(signature);
|
|
489
|
-
var verifier = crypto.createVerify("RSA-SHA" + bits);
|
|
490
|
-
verifier.update(thing);
|
|
491
|
-
return verifier.verify({
|
|
492
|
-
key: publicKey,
|
|
493
|
-
padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
|
|
494
|
-
saltLength: crypto.constants.RSA_PSS_SALTLEN_DIGEST
|
|
495
|
-
}, signature, "base64");
|
|
496
|
-
};
|
|
497
|
-
}
|
|
498
|
-
function createECDSASigner(bits) {
|
|
499
|
-
var inner = createKeySigner(bits);
|
|
500
|
-
return function sign() {
|
|
501
|
-
var signature = inner.apply(null, arguments);
|
|
502
|
-
signature = formatEcdsa.derToJose(signature, "ES" + bits);
|
|
503
|
-
return signature;
|
|
504
|
-
};
|
|
505
|
-
}
|
|
506
|
-
function createECDSAVerifer(bits) {
|
|
507
|
-
var inner = createKeyVerifier(bits);
|
|
508
|
-
return function verify(thing, signature, publicKey) {
|
|
509
|
-
signature = formatEcdsa.joseToDer(signature, "ES" + bits).toString("base64");
|
|
510
|
-
var result = inner(thing, signature, publicKey);
|
|
511
|
-
return result;
|
|
512
|
-
};
|
|
513
|
-
}
|
|
514
|
-
function createNoneSigner() {
|
|
515
|
-
return function sign() {
|
|
516
|
-
return "";
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
function createNoneVerifier() {
|
|
520
|
-
return function verify(thing, signature) {
|
|
521
|
-
return signature === "";
|
|
522
|
-
};
|
|
523
|
-
}
|
|
524
|
-
module.exports = function jwa(algorithm) {
|
|
525
|
-
var signerFactories = {
|
|
526
|
-
hs: createHmacSigner,
|
|
527
|
-
rs: createKeySigner,
|
|
528
|
-
ps: createPSSKeySigner,
|
|
529
|
-
es: createECDSASigner,
|
|
530
|
-
none: createNoneSigner
|
|
531
|
-
};
|
|
532
|
-
var verifierFactories = {
|
|
533
|
-
hs: createHmacVerifier,
|
|
534
|
-
rs: createKeyVerifier,
|
|
535
|
-
ps: createPSSKeyVerifier,
|
|
536
|
-
es: createECDSAVerifer,
|
|
537
|
-
none: createNoneVerifier
|
|
538
|
-
};
|
|
539
|
-
var match = algorithm.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);
|
|
540
|
-
if (!match)
|
|
541
|
-
throw typeError(MSG_INVALID_ALGORITHM, algorithm);
|
|
542
|
-
var algo = (match[1] || match[3]).toLowerCase();
|
|
543
|
-
var bits = match[2];
|
|
544
|
-
return {
|
|
545
|
-
sign: signerFactories[algo](bits),
|
|
546
|
-
verify: verifierFactories[algo](bits)
|
|
547
|
-
};
|
|
548
|
-
};
|
|
549
|
-
});
|
|
550
|
-
|
|
551
|
-
// ../../node_modules/.bun/jws@4.0.1/node_modules/jws/lib/tostring.js
|
|
552
|
-
var require_tostring = __commonJS((exports, module) => {
|
|
553
|
-
var Buffer2 = __require("buffer").Buffer;
|
|
554
|
-
module.exports = function toString(obj) {
|
|
555
|
-
if (typeof obj === "string")
|
|
556
|
-
return obj;
|
|
557
|
-
if (typeof obj === "number" || Buffer2.isBuffer(obj))
|
|
558
|
-
return obj.toString();
|
|
559
|
-
return JSON.stringify(obj);
|
|
560
|
-
};
|
|
561
|
-
});
|
|
562
|
-
|
|
563
|
-
// ../../node_modules/.bun/jws@4.0.1/node_modules/jws/lib/sign-stream.js
|
|
564
|
-
var require_sign_stream = __commonJS((exports, module) => {
|
|
565
|
-
var Buffer2 = require_safe_buffer().Buffer;
|
|
566
|
-
var DataStream = require_data_stream();
|
|
567
|
-
var jwa = require_jwa();
|
|
568
|
-
var Stream = __require("stream");
|
|
569
|
-
var toString = require_tostring();
|
|
570
|
-
var util = __require("util");
|
|
571
|
-
function base64url(string, encoding) {
|
|
572
|
-
return Buffer2.from(string, encoding).toString("base64").replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
573
|
-
}
|
|
574
|
-
function jwsSecuredInput(header, payload, encoding) {
|
|
575
|
-
encoding = encoding || "utf8";
|
|
576
|
-
var encodedHeader = base64url(toString(header), "binary");
|
|
577
|
-
var encodedPayload = base64url(toString(payload), encoding);
|
|
578
|
-
return util.format("%s.%s", encodedHeader, encodedPayload);
|
|
579
|
-
}
|
|
580
|
-
function jwsSign(opts) {
|
|
581
|
-
var header = opts.header;
|
|
582
|
-
var payload = opts.payload;
|
|
583
|
-
var secretOrKey = opts.secret || opts.privateKey;
|
|
584
|
-
var encoding = opts.encoding;
|
|
585
|
-
var algo = jwa(header.alg);
|
|
586
|
-
var securedInput = jwsSecuredInput(header, payload, encoding);
|
|
587
|
-
var signature = algo.sign(securedInput, secretOrKey);
|
|
588
|
-
return util.format("%s.%s", securedInput, signature);
|
|
589
|
-
}
|
|
590
|
-
function SignStream(opts) {
|
|
591
|
-
var secret = opts.secret;
|
|
592
|
-
secret = secret == null ? opts.privateKey : secret;
|
|
593
|
-
secret = secret == null ? opts.key : secret;
|
|
594
|
-
if (/^hs/i.test(opts.header.alg) === true && secret == null) {
|
|
595
|
-
throw new TypeError("secret must be a string or buffer or a KeyObject");
|
|
596
|
-
}
|
|
597
|
-
var secretStream = new DataStream(secret);
|
|
598
|
-
this.readable = true;
|
|
599
|
-
this.header = opts.header;
|
|
600
|
-
this.encoding = opts.encoding;
|
|
601
|
-
this.secret = this.privateKey = this.key = secretStream;
|
|
602
|
-
this.payload = new DataStream(opts.payload);
|
|
603
|
-
this.secret.once("close", function() {
|
|
604
|
-
if (!this.payload.writable && this.readable)
|
|
605
|
-
this.sign();
|
|
606
|
-
}.bind(this));
|
|
607
|
-
this.payload.once("close", function() {
|
|
608
|
-
if (!this.secret.writable && this.readable)
|
|
609
|
-
this.sign();
|
|
610
|
-
}.bind(this));
|
|
611
|
-
}
|
|
612
|
-
util.inherits(SignStream, Stream);
|
|
613
|
-
SignStream.prototype.sign = function sign() {
|
|
614
|
-
try {
|
|
615
|
-
var signature = jwsSign({
|
|
616
|
-
header: this.header,
|
|
617
|
-
payload: this.payload.buffer,
|
|
618
|
-
secret: this.secret.buffer,
|
|
619
|
-
encoding: this.encoding
|
|
620
|
-
});
|
|
621
|
-
this.emit("done", signature);
|
|
622
|
-
this.emit("data", signature);
|
|
623
|
-
this.emit("end");
|
|
624
|
-
this.readable = false;
|
|
625
|
-
return signature;
|
|
626
|
-
} catch (e) {
|
|
627
|
-
this.readable = false;
|
|
628
|
-
this.emit("error", e);
|
|
629
|
-
this.emit("close");
|
|
630
|
-
}
|
|
631
|
-
};
|
|
632
|
-
SignStream.sign = jwsSign;
|
|
633
|
-
module.exports = SignStream;
|
|
634
|
-
});
|
|
635
|
-
|
|
636
|
-
// ../../node_modules/.bun/jws@4.0.1/node_modules/jws/lib/verify-stream.js
|
|
637
|
-
var require_verify_stream = __commonJS((exports, module) => {
|
|
638
|
-
var Buffer2 = require_safe_buffer().Buffer;
|
|
639
|
-
var DataStream = require_data_stream();
|
|
640
|
-
var jwa = require_jwa();
|
|
641
|
-
var Stream = __require("stream");
|
|
642
|
-
var toString = require_tostring();
|
|
643
|
-
var util = __require("util");
|
|
644
|
-
var JWS_REGEX = /^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;
|
|
645
|
-
function isObject(thing) {
|
|
646
|
-
return Object.prototype.toString.call(thing) === "[object Object]";
|
|
647
|
-
}
|
|
648
|
-
function safeJsonParse(thing) {
|
|
649
|
-
if (isObject(thing))
|
|
650
|
-
return thing;
|
|
651
|
-
try {
|
|
652
|
-
return JSON.parse(thing);
|
|
653
|
-
} catch (e) {
|
|
654
|
-
return;
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
function headerFromJWS(jwsSig) {
|
|
658
|
-
var encodedHeader = jwsSig.split(".", 1)[0];
|
|
659
|
-
return safeJsonParse(Buffer2.from(encodedHeader, "base64").toString("binary"));
|
|
660
|
-
}
|
|
661
|
-
function securedInputFromJWS(jwsSig) {
|
|
662
|
-
return jwsSig.split(".", 2).join(".");
|
|
663
|
-
}
|
|
664
|
-
function signatureFromJWS(jwsSig) {
|
|
665
|
-
return jwsSig.split(".")[2];
|
|
666
|
-
}
|
|
667
|
-
function payloadFromJWS(jwsSig, encoding) {
|
|
668
|
-
encoding = encoding || "utf8";
|
|
669
|
-
var payload = jwsSig.split(".")[1];
|
|
670
|
-
return Buffer2.from(payload, "base64").toString(encoding);
|
|
671
|
-
}
|
|
672
|
-
function isValidJws(string) {
|
|
673
|
-
return JWS_REGEX.test(string) && !!headerFromJWS(string);
|
|
674
|
-
}
|
|
675
|
-
function jwsVerify(jwsSig, algorithm, secretOrKey) {
|
|
676
|
-
if (!algorithm) {
|
|
677
|
-
var err = new Error("Missing algorithm parameter for jws.verify");
|
|
678
|
-
err.code = "MISSING_ALGORITHM";
|
|
679
|
-
throw err;
|
|
680
|
-
}
|
|
681
|
-
jwsSig = toString(jwsSig);
|
|
682
|
-
var signature = signatureFromJWS(jwsSig);
|
|
683
|
-
var securedInput = securedInputFromJWS(jwsSig);
|
|
684
|
-
var algo = jwa(algorithm);
|
|
685
|
-
return algo.verify(securedInput, signature, secretOrKey);
|
|
686
|
-
}
|
|
687
|
-
function jwsDecode(jwsSig, opts) {
|
|
688
|
-
opts = opts || {};
|
|
689
|
-
jwsSig = toString(jwsSig);
|
|
690
|
-
if (!isValidJws(jwsSig))
|
|
691
|
-
return null;
|
|
692
|
-
var header = headerFromJWS(jwsSig);
|
|
693
|
-
if (!header)
|
|
694
|
-
return null;
|
|
695
|
-
var payload = payloadFromJWS(jwsSig);
|
|
696
|
-
if (header.typ === "JWT" || opts.json)
|
|
697
|
-
payload = JSON.parse(payload, opts.encoding);
|
|
698
|
-
return {
|
|
699
|
-
header,
|
|
700
|
-
payload,
|
|
701
|
-
signature: signatureFromJWS(jwsSig)
|
|
702
|
-
};
|
|
703
|
-
}
|
|
704
|
-
function VerifyStream(opts) {
|
|
705
|
-
opts = opts || {};
|
|
706
|
-
var secretOrKey = opts.secret;
|
|
707
|
-
secretOrKey = secretOrKey == null ? opts.publicKey : secretOrKey;
|
|
708
|
-
secretOrKey = secretOrKey == null ? opts.key : secretOrKey;
|
|
709
|
-
if (/^hs/i.test(opts.algorithm) === true && secretOrKey == null) {
|
|
710
|
-
throw new TypeError("secret must be a string or buffer or a KeyObject");
|
|
711
|
-
}
|
|
712
|
-
var secretStream = new DataStream(secretOrKey);
|
|
713
|
-
this.readable = true;
|
|
714
|
-
this.algorithm = opts.algorithm;
|
|
715
|
-
this.encoding = opts.encoding;
|
|
716
|
-
this.secret = this.publicKey = this.key = secretStream;
|
|
717
|
-
this.signature = new DataStream(opts.signature);
|
|
718
|
-
this.secret.once("close", function() {
|
|
719
|
-
if (!this.signature.writable && this.readable)
|
|
720
|
-
this.verify();
|
|
721
|
-
}.bind(this));
|
|
722
|
-
this.signature.once("close", function() {
|
|
723
|
-
if (!this.secret.writable && this.readable)
|
|
724
|
-
this.verify();
|
|
725
|
-
}.bind(this));
|
|
726
|
-
}
|
|
727
|
-
util.inherits(VerifyStream, Stream);
|
|
728
|
-
VerifyStream.prototype.verify = function verify() {
|
|
729
|
-
try {
|
|
730
|
-
var valid = jwsVerify(this.signature.buffer, this.algorithm, this.key.buffer);
|
|
731
|
-
var obj = jwsDecode(this.signature.buffer, this.encoding);
|
|
732
|
-
this.emit("done", valid, obj);
|
|
733
|
-
this.emit("data", valid);
|
|
734
|
-
this.emit("end");
|
|
735
|
-
this.readable = false;
|
|
736
|
-
return valid;
|
|
737
|
-
} catch (e) {
|
|
738
|
-
this.readable = false;
|
|
739
|
-
this.emit("error", e);
|
|
740
|
-
this.emit("close");
|
|
741
|
-
}
|
|
742
|
-
};
|
|
743
|
-
VerifyStream.decode = jwsDecode;
|
|
744
|
-
VerifyStream.isValid = isValidJws;
|
|
745
|
-
VerifyStream.verify = jwsVerify;
|
|
746
|
-
module.exports = VerifyStream;
|
|
747
|
-
});
|
|
748
|
-
|
|
749
|
-
// ../../node_modules/.bun/jws@4.0.1/node_modules/jws/index.js
|
|
750
|
-
var require_jws = __commonJS((exports) => {
|
|
751
|
-
var SignStream = require_sign_stream();
|
|
752
|
-
var VerifyStream = require_verify_stream();
|
|
753
|
-
var ALGORITHMS = [
|
|
754
|
-
"HS256",
|
|
755
|
-
"HS384",
|
|
756
|
-
"HS512",
|
|
757
|
-
"RS256",
|
|
758
|
-
"RS384",
|
|
759
|
-
"RS512",
|
|
760
|
-
"PS256",
|
|
761
|
-
"PS384",
|
|
762
|
-
"PS512",
|
|
763
|
-
"ES256",
|
|
764
|
-
"ES384",
|
|
765
|
-
"ES512"
|
|
766
|
-
];
|
|
767
|
-
exports.ALGORITHMS = ALGORITHMS;
|
|
768
|
-
exports.sign = SignStream.sign;
|
|
769
|
-
exports.verify = VerifyStream.verify;
|
|
770
|
-
exports.decode = VerifyStream.decode;
|
|
771
|
-
exports.isValid = VerifyStream.isValid;
|
|
772
|
-
exports.createSign = function createSign(opts) {
|
|
773
|
-
return new SignStream(opts);
|
|
774
|
-
};
|
|
775
|
-
exports.createVerify = function createVerify(opts) {
|
|
776
|
-
return new VerifyStream(opts);
|
|
777
|
-
};
|
|
778
|
-
});
|
|
779
|
-
|
|
780
|
-
// ../../node_modules/.bun/jsonwebtoken@9.0.3/node_modules/jsonwebtoken/decode.js
|
|
781
|
-
var require_decode = __commonJS((exports, module) => {
|
|
782
|
-
var jws = require_jws();
|
|
783
|
-
module.exports = function(jwt, options) {
|
|
784
|
-
options = options || {};
|
|
785
|
-
var decoded = jws.decode(jwt, options);
|
|
786
|
-
if (!decoded) {
|
|
787
|
-
return null;
|
|
788
|
-
}
|
|
789
|
-
var payload = decoded.payload;
|
|
790
|
-
if (typeof payload === "string") {
|
|
791
|
-
try {
|
|
792
|
-
var obj = JSON.parse(payload);
|
|
793
|
-
if (obj !== null && typeof obj === "object") {
|
|
794
|
-
payload = obj;
|
|
795
|
-
}
|
|
796
|
-
} catch (e) {}
|
|
797
|
-
}
|
|
798
|
-
if (options.complete === true) {
|
|
799
|
-
return {
|
|
800
|
-
header: decoded.header,
|
|
801
|
-
payload,
|
|
802
|
-
signature: decoded.signature
|
|
803
|
-
};
|
|
804
|
-
}
|
|
805
|
-
return payload;
|
|
806
|
-
};
|
|
807
|
-
});
|
|
808
|
-
|
|
809
|
-
// ../../node_modules/.bun/jsonwebtoken@9.0.3/node_modules/jsonwebtoken/lib/JsonWebTokenError.js
|
|
810
|
-
var require_JsonWebTokenError = __commonJS((exports, module) => {
|
|
811
|
-
var JsonWebTokenError = function(message, error) {
|
|
812
|
-
Error.call(this, message);
|
|
813
|
-
if (Error.captureStackTrace) {
|
|
814
|
-
Error.captureStackTrace(this, this.constructor);
|
|
815
|
-
}
|
|
816
|
-
this.name = "JsonWebTokenError";
|
|
817
|
-
this.message = message;
|
|
818
|
-
if (error)
|
|
819
|
-
this.inner = error;
|
|
820
|
-
};
|
|
821
|
-
JsonWebTokenError.prototype = Object.create(Error.prototype);
|
|
822
|
-
JsonWebTokenError.prototype.constructor = JsonWebTokenError;
|
|
823
|
-
module.exports = JsonWebTokenError;
|
|
824
|
-
});
|
|
825
|
-
|
|
826
|
-
// ../../node_modules/.bun/jsonwebtoken@9.0.3/node_modules/jsonwebtoken/lib/NotBeforeError.js
|
|
827
|
-
var require_NotBeforeError = __commonJS((exports, module) => {
|
|
828
|
-
var JsonWebTokenError = require_JsonWebTokenError();
|
|
829
|
-
var NotBeforeError = function(message, date) {
|
|
830
|
-
JsonWebTokenError.call(this, message);
|
|
831
|
-
this.name = "NotBeforeError";
|
|
832
|
-
this.date = date;
|
|
833
|
-
};
|
|
834
|
-
NotBeforeError.prototype = Object.create(JsonWebTokenError.prototype);
|
|
835
|
-
NotBeforeError.prototype.constructor = NotBeforeError;
|
|
836
|
-
module.exports = NotBeforeError;
|
|
837
|
-
});
|
|
838
|
-
|
|
839
|
-
// ../../node_modules/.bun/jsonwebtoken@9.0.3/node_modules/jsonwebtoken/lib/TokenExpiredError.js
|
|
840
|
-
var require_TokenExpiredError = __commonJS((exports, module) => {
|
|
841
|
-
var JsonWebTokenError = require_JsonWebTokenError();
|
|
842
|
-
var TokenExpiredError = function(message, expiredAt) {
|
|
843
|
-
JsonWebTokenError.call(this, message);
|
|
844
|
-
this.name = "TokenExpiredError";
|
|
845
|
-
this.expiredAt = expiredAt;
|
|
846
|
-
};
|
|
847
|
-
TokenExpiredError.prototype = Object.create(JsonWebTokenError.prototype);
|
|
848
|
-
TokenExpiredError.prototype.constructor = TokenExpiredError;
|
|
849
|
-
module.exports = TokenExpiredError;
|
|
850
|
-
});
|
|
851
|
-
|
|
852
|
-
// ../../node_modules/.bun/ms@2.1.3/node_modules/ms/index.js
|
|
853
|
-
var require_ms = __commonJS((exports, module) => {
|
|
854
|
-
var s = 1000;
|
|
855
|
-
var m = s * 60;
|
|
856
|
-
var h = m * 60;
|
|
857
|
-
var d = h * 24;
|
|
858
|
-
var w = d * 7;
|
|
859
|
-
var y = d * 365.25;
|
|
860
|
-
module.exports = function(val, options) {
|
|
861
|
-
options = options || {};
|
|
862
|
-
var type = typeof val;
|
|
863
|
-
if (type === "string" && val.length > 0) {
|
|
864
|
-
return parse(val);
|
|
865
|
-
} else if (type === "number" && isFinite(val)) {
|
|
866
|
-
return options.long ? fmtLong(val) : fmtShort(val);
|
|
867
|
-
}
|
|
868
|
-
throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
|
|
869
|
-
};
|
|
870
|
-
function parse(str) {
|
|
871
|
-
str = String(str);
|
|
872
|
-
if (str.length > 100) {
|
|
873
|
-
return;
|
|
874
|
-
}
|
|
875
|
-
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(str);
|
|
876
|
-
if (!match) {
|
|
877
|
-
return;
|
|
878
|
-
}
|
|
879
|
-
var n = parseFloat(match[1]);
|
|
880
|
-
var type = (match[2] || "ms").toLowerCase();
|
|
881
|
-
switch (type) {
|
|
882
|
-
case "years":
|
|
883
|
-
case "year":
|
|
884
|
-
case "yrs":
|
|
885
|
-
case "yr":
|
|
886
|
-
case "y":
|
|
887
|
-
return n * y;
|
|
888
|
-
case "weeks":
|
|
889
|
-
case "week":
|
|
890
|
-
case "w":
|
|
891
|
-
return n * w;
|
|
892
|
-
case "days":
|
|
893
|
-
case "day":
|
|
894
|
-
case "d":
|
|
895
|
-
return n * d;
|
|
896
|
-
case "hours":
|
|
897
|
-
case "hour":
|
|
898
|
-
case "hrs":
|
|
899
|
-
case "hr":
|
|
900
|
-
case "h":
|
|
901
|
-
return n * h;
|
|
902
|
-
case "minutes":
|
|
903
|
-
case "minute":
|
|
904
|
-
case "mins":
|
|
905
|
-
case "min":
|
|
906
|
-
case "m":
|
|
907
|
-
return n * m;
|
|
908
|
-
case "seconds":
|
|
909
|
-
case "second":
|
|
910
|
-
case "secs":
|
|
911
|
-
case "sec":
|
|
912
|
-
case "s":
|
|
913
|
-
return n * s;
|
|
914
|
-
case "milliseconds":
|
|
915
|
-
case "millisecond":
|
|
916
|
-
case "msecs":
|
|
917
|
-
case "msec":
|
|
918
|
-
case "ms":
|
|
919
|
-
return n;
|
|
920
|
-
default:
|
|
921
|
-
return;
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
function fmtShort(ms) {
|
|
925
|
-
var msAbs = Math.abs(ms);
|
|
926
|
-
if (msAbs >= d) {
|
|
927
|
-
return Math.round(ms / d) + "d";
|
|
928
|
-
}
|
|
929
|
-
if (msAbs >= h) {
|
|
930
|
-
return Math.round(ms / h) + "h";
|
|
931
|
-
}
|
|
932
|
-
if (msAbs >= m) {
|
|
933
|
-
return Math.round(ms / m) + "m";
|
|
934
|
-
}
|
|
935
|
-
if (msAbs >= s) {
|
|
936
|
-
return Math.round(ms / s) + "s";
|
|
937
|
-
}
|
|
938
|
-
return ms + "ms";
|
|
939
|
-
}
|
|
940
|
-
function fmtLong(ms) {
|
|
941
|
-
var msAbs = Math.abs(ms);
|
|
942
|
-
if (msAbs >= d) {
|
|
943
|
-
return plural(ms, msAbs, d, "day");
|
|
944
|
-
}
|
|
945
|
-
if (msAbs >= h) {
|
|
946
|
-
return plural(ms, msAbs, h, "hour");
|
|
947
|
-
}
|
|
948
|
-
if (msAbs >= m) {
|
|
949
|
-
return plural(ms, msAbs, m, "minute");
|
|
950
|
-
}
|
|
951
|
-
if (msAbs >= s) {
|
|
952
|
-
return plural(ms, msAbs, s, "second");
|
|
953
|
-
}
|
|
954
|
-
return ms + " ms";
|
|
955
|
-
}
|
|
956
|
-
function plural(ms, msAbs, n, name) {
|
|
957
|
-
var isPlural = msAbs >= n * 1.5;
|
|
958
|
-
return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
|
|
959
|
-
}
|
|
960
|
-
});
|
|
961
|
-
|
|
962
|
-
// ../../node_modules/.bun/jsonwebtoken@9.0.3/node_modules/jsonwebtoken/lib/timespan.js
|
|
963
|
-
var require_timespan = __commonJS((exports, module) => {
|
|
964
|
-
var ms = require_ms();
|
|
965
|
-
module.exports = function(time, iat) {
|
|
966
|
-
var timestamp = iat || Math.floor(Date.now() / 1000);
|
|
967
|
-
if (typeof time === "string") {
|
|
968
|
-
var milliseconds = ms(time);
|
|
969
|
-
if (typeof milliseconds === "undefined") {
|
|
970
|
-
return;
|
|
971
|
-
}
|
|
972
|
-
return Math.floor(timestamp + milliseconds / 1000);
|
|
973
|
-
} else if (typeof time === "number") {
|
|
974
|
-
return timestamp + time;
|
|
975
|
-
} else {
|
|
976
|
-
return;
|
|
977
|
-
}
|
|
978
|
-
};
|
|
979
|
-
});
|
|
980
|
-
|
|
981
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/internal/constants.js
|
|
982
|
-
var require_constants = __commonJS((exports, module) => {
|
|
983
|
-
var SEMVER_SPEC_VERSION = "2.0.0";
|
|
984
|
-
var MAX_LENGTH = 256;
|
|
985
|
-
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
|
986
|
-
var MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
987
|
-
var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
|
|
988
|
-
var RELEASE_TYPES = [
|
|
989
|
-
"major",
|
|
990
|
-
"premajor",
|
|
991
|
-
"minor",
|
|
992
|
-
"preminor",
|
|
993
|
-
"patch",
|
|
994
|
-
"prepatch",
|
|
995
|
-
"prerelease"
|
|
996
|
-
];
|
|
997
|
-
module.exports = {
|
|
998
|
-
MAX_LENGTH,
|
|
999
|
-
MAX_SAFE_COMPONENT_LENGTH,
|
|
1000
|
-
MAX_SAFE_BUILD_LENGTH,
|
|
1001
|
-
MAX_SAFE_INTEGER,
|
|
1002
|
-
RELEASE_TYPES,
|
|
1003
|
-
SEMVER_SPEC_VERSION,
|
|
1004
|
-
FLAG_INCLUDE_PRERELEASE: 1,
|
|
1005
|
-
FLAG_LOOSE: 2
|
|
1006
|
-
};
|
|
1007
|
-
});
|
|
1008
|
-
|
|
1009
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/internal/debug.js
|
|
1010
|
-
var require_debug = __commonJS((exports, module) => {
|
|
1011
|
-
var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
|
|
1012
|
-
module.exports = debug;
|
|
1013
|
-
});
|
|
1014
|
-
|
|
1015
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/internal/re.js
|
|
1016
|
-
var require_re = __commonJS((exports, module) => {
|
|
1017
|
-
var {
|
|
1018
|
-
MAX_SAFE_COMPONENT_LENGTH,
|
|
1019
|
-
MAX_SAFE_BUILD_LENGTH,
|
|
1020
|
-
MAX_LENGTH
|
|
1021
|
-
} = require_constants();
|
|
1022
|
-
var debug = require_debug();
|
|
1023
|
-
exports = module.exports = {};
|
|
1024
|
-
var re = exports.re = [];
|
|
1025
|
-
var safeRe = exports.safeRe = [];
|
|
1026
|
-
var src = exports.src = [];
|
|
1027
|
-
var safeSrc = exports.safeSrc = [];
|
|
1028
|
-
var t = exports.t = {};
|
|
1029
|
-
var R = 0;
|
|
1030
|
-
var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
1031
|
-
var safeRegexReplacements = [
|
|
1032
|
-
["\\s", 1],
|
|
1033
|
-
["\\d", MAX_LENGTH],
|
|
1034
|
-
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
1035
|
-
];
|
|
1036
|
-
var makeSafeRegex = (value) => {
|
|
1037
|
-
for (const [token, max] of safeRegexReplacements) {
|
|
1038
|
-
value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
1039
|
-
}
|
|
1040
|
-
return value;
|
|
1041
|
-
};
|
|
1042
|
-
var createToken = (name, value, isGlobal) => {
|
|
1043
|
-
const safe = makeSafeRegex(value);
|
|
1044
|
-
const index = R++;
|
|
1045
|
-
debug(name, index, value);
|
|
1046
|
-
t[name] = index;
|
|
1047
|
-
src[index] = value;
|
|
1048
|
-
safeSrc[index] = safe;
|
|
1049
|
-
re[index] = new RegExp(value, isGlobal ? "g" : undefined);
|
|
1050
|
-
safeRe[index] = new RegExp(safe, isGlobal ? "g" : undefined);
|
|
1051
|
-
};
|
|
1052
|
-
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
1053
|
-
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
1054
|
-
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
1055
|
-
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})`);
|
|
1056
|
-
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
1057
|
-
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
|
|
1058
|
-
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
1059
|
-
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
1060
|
-
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
1061
|
-
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
1062
|
-
createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
1063
|
-
createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
|
1064
|
-
createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
|
1065
|
-
createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
|
1066
|
-
createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
|
1067
|
-
createToken("GTLT", "((?:<|>)?=?)");
|
|
1068
|
-
createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
1069
|
-
createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
1070
|
-
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?` + `)?)?`);
|
|
1071
|
-
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?` + `)?)?`);
|
|
1072
|
-
createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
1073
|
-
createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
1074
|
-
createToken("COERCEPLAIN", `${"(^|[^\\d])" + "(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
1075
|
-
createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
1076
|
-
createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?` + `(?:${src[t.BUILD]})?` + `(?:$|[^\\d])`);
|
|
1077
|
-
createToken("COERCERTL", src[t.COERCE], true);
|
|
1078
|
-
createToken("COERCERTLFULL", src[t.COERCEFULL], true);
|
|
1079
|
-
createToken("LONETILDE", "(?:~>?)");
|
|
1080
|
-
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
1081
|
-
exports.tildeTrimReplace = "$1~";
|
|
1082
|
-
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
1083
|
-
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
1084
|
-
createToken("LONECARET", "(?:\\^)");
|
|
1085
|
-
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
1086
|
-
exports.caretTrimReplace = "$1^";
|
|
1087
|
-
createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
1088
|
-
createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
1089
|
-
createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
1090
|
-
createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
1091
|
-
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
1092
|
-
exports.comparatorTrimReplace = "$1$2$3";
|
|
1093
|
-
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAIN]})` + `\\s*$`);
|
|
1094
|
-
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAINLOOSE]})` + `\\s*$`);
|
|
1095
|
-
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
1096
|
-
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
1097
|
-
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
1098
|
-
});
|
|
1099
|
-
|
|
1100
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/internal/parse-options.js
|
|
1101
|
-
var require_parse_options = __commonJS((exports, module) => {
|
|
1102
|
-
var looseOption = Object.freeze({ loose: true });
|
|
1103
|
-
var emptyOpts = Object.freeze({});
|
|
1104
|
-
var parseOptions = (options) => {
|
|
1105
|
-
if (!options) {
|
|
1106
|
-
return emptyOpts;
|
|
1107
|
-
}
|
|
1108
|
-
if (typeof options !== "object") {
|
|
1109
|
-
return looseOption;
|
|
1110
|
-
}
|
|
1111
|
-
return options;
|
|
1112
|
-
};
|
|
1113
|
-
module.exports = parseOptions;
|
|
1114
|
-
});
|
|
1115
|
-
|
|
1116
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/internal/identifiers.js
|
|
1117
|
-
var require_identifiers = __commonJS((exports, module) => {
|
|
1118
|
-
var numeric = /^[0-9]+$/;
|
|
1119
|
-
var compareIdentifiers = (a, b) => {
|
|
1120
|
-
if (typeof a === "number" && typeof b === "number") {
|
|
1121
|
-
return a === b ? 0 : a < b ? -1 : 1;
|
|
1122
|
-
}
|
|
1123
|
-
const anum = numeric.test(a);
|
|
1124
|
-
const bnum = numeric.test(b);
|
|
1125
|
-
if (anum && bnum) {
|
|
1126
|
-
a = +a;
|
|
1127
|
-
b = +b;
|
|
1128
|
-
}
|
|
1129
|
-
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
1130
|
-
};
|
|
1131
|
-
var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
|
1132
|
-
module.exports = {
|
|
1133
|
-
compareIdentifiers,
|
|
1134
|
-
rcompareIdentifiers
|
|
1135
|
-
};
|
|
1136
|
-
});
|
|
1137
|
-
|
|
1138
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/classes/semver.js
|
|
1139
|
-
var require_semver = __commonJS((exports, module) => {
|
|
1140
|
-
var debug = require_debug();
|
|
1141
|
-
var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
1142
|
-
var { safeRe: re, t } = require_re();
|
|
1143
|
-
var parseOptions = require_parse_options();
|
|
1144
|
-
var { compareIdentifiers } = require_identifiers();
|
|
1145
|
-
|
|
1146
|
-
class SemVer {
|
|
1147
|
-
constructor(version, options) {
|
|
1148
|
-
options = parseOptions(options);
|
|
1149
|
-
if (version instanceof SemVer) {
|
|
1150
|
-
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
|
|
1151
|
-
return version;
|
|
1152
|
-
} else {
|
|
1153
|
-
version = version.version;
|
|
1154
|
-
}
|
|
1155
|
-
} else if (typeof version !== "string") {
|
|
1156
|
-
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
1157
|
-
}
|
|
1158
|
-
if (version.length > MAX_LENGTH) {
|
|
1159
|
-
throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
|
|
1160
|
-
}
|
|
1161
|
-
debug("SemVer", version, options);
|
|
1162
|
-
this.options = options;
|
|
1163
|
-
this.loose = !!options.loose;
|
|
1164
|
-
this.includePrerelease = !!options.includePrerelease;
|
|
1165
|
-
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
1166
|
-
if (!m) {
|
|
1167
|
-
throw new TypeError(`Invalid Version: ${version}`);
|
|
1168
|
-
}
|
|
1169
|
-
this.raw = version;
|
|
1170
|
-
this.major = +m[1];
|
|
1171
|
-
this.minor = +m[2];
|
|
1172
|
-
this.patch = +m[3];
|
|
1173
|
-
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
1174
|
-
throw new TypeError("Invalid major version");
|
|
1175
|
-
}
|
|
1176
|
-
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
1177
|
-
throw new TypeError("Invalid minor version");
|
|
1178
|
-
}
|
|
1179
|
-
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
1180
|
-
throw new TypeError("Invalid patch version");
|
|
1181
|
-
}
|
|
1182
|
-
if (!m[4]) {
|
|
1183
|
-
this.prerelease = [];
|
|
1184
|
-
} else {
|
|
1185
|
-
this.prerelease = m[4].split(".").map((id) => {
|
|
1186
|
-
if (/^[0-9]+$/.test(id)) {
|
|
1187
|
-
const num = +id;
|
|
1188
|
-
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
1189
|
-
return num;
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
return id;
|
|
1193
|
-
});
|
|
1194
|
-
}
|
|
1195
|
-
this.build = m[5] ? m[5].split(".") : [];
|
|
1196
|
-
this.format();
|
|
1197
|
-
}
|
|
1198
|
-
format() {
|
|
1199
|
-
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
1200
|
-
if (this.prerelease.length) {
|
|
1201
|
-
this.version += `-${this.prerelease.join(".")}`;
|
|
1202
|
-
}
|
|
1203
|
-
return this.version;
|
|
1204
|
-
}
|
|
1205
|
-
toString() {
|
|
1206
|
-
return this.version;
|
|
1207
|
-
}
|
|
1208
|
-
compare(other) {
|
|
1209
|
-
debug("SemVer.compare", this.version, this.options, other);
|
|
1210
|
-
if (!(other instanceof SemVer)) {
|
|
1211
|
-
if (typeof other === "string" && other === this.version) {
|
|
1212
|
-
return 0;
|
|
1213
|
-
}
|
|
1214
|
-
other = new SemVer(other, this.options);
|
|
1215
|
-
}
|
|
1216
|
-
if (other.version === this.version) {
|
|
1217
|
-
return 0;
|
|
1218
|
-
}
|
|
1219
|
-
return this.compareMain(other) || this.comparePre(other);
|
|
1220
|
-
}
|
|
1221
|
-
compareMain(other) {
|
|
1222
|
-
if (!(other instanceof SemVer)) {
|
|
1223
|
-
other = new SemVer(other, this.options);
|
|
1224
|
-
}
|
|
1225
|
-
if (this.major < other.major) {
|
|
1226
|
-
return -1;
|
|
1227
|
-
}
|
|
1228
|
-
if (this.major > other.major) {
|
|
1229
|
-
return 1;
|
|
1230
|
-
}
|
|
1231
|
-
if (this.minor < other.minor) {
|
|
1232
|
-
return -1;
|
|
1233
|
-
}
|
|
1234
|
-
if (this.minor > other.minor) {
|
|
1235
|
-
return 1;
|
|
1236
|
-
}
|
|
1237
|
-
if (this.patch < other.patch) {
|
|
1238
|
-
return -1;
|
|
1239
|
-
}
|
|
1240
|
-
if (this.patch > other.patch) {
|
|
1241
|
-
return 1;
|
|
1242
|
-
}
|
|
1243
|
-
return 0;
|
|
1244
|
-
}
|
|
1245
|
-
comparePre(other) {
|
|
1246
|
-
if (!(other instanceof SemVer)) {
|
|
1247
|
-
other = new SemVer(other, this.options);
|
|
1248
|
-
}
|
|
1249
|
-
if (this.prerelease.length && !other.prerelease.length) {
|
|
1250
|
-
return -1;
|
|
1251
|
-
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
1252
|
-
return 1;
|
|
1253
|
-
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
1254
|
-
return 0;
|
|
1255
|
-
}
|
|
1256
|
-
let i = 0;
|
|
1257
|
-
do {
|
|
1258
|
-
const a = this.prerelease[i];
|
|
1259
|
-
const b = other.prerelease[i];
|
|
1260
|
-
debug("prerelease compare", i, a, b);
|
|
1261
|
-
if (a === undefined && b === undefined) {
|
|
1262
|
-
return 0;
|
|
1263
|
-
} else if (b === undefined) {
|
|
1264
|
-
return 1;
|
|
1265
|
-
} else if (a === undefined) {
|
|
1266
|
-
return -1;
|
|
1267
|
-
} else if (a === b) {
|
|
1268
|
-
continue;
|
|
1269
|
-
} else {
|
|
1270
|
-
return compareIdentifiers(a, b);
|
|
1271
|
-
}
|
|
1272
|
-
} while (++i);
|
|
1273
|
-
}
|
|
1274
|
-
compareBuild(other) {
|
|
1275
|
-
if (!(other instanceof SemVer)) {
|
|
1276
|
-
other = new SemVer(other, this.options);
|
|
1277
|
-
}
|
|
1278
|
-
let i = 0;
|
|
1279
|
-
do {
|
|
1280
|
-
const a = this.build[i];
|
|
1281
|
-
const b = other.build[i];
|
|
1282
|
-
debug("build compare", i, a, b);
|
|
1283
|
-
if (a === undefined && b === undefined) {
|
|
1284
|
-
return 0;
|
|
1285
|
-
} else if (b === undefined) {
|
|
1286
|
-
return 1;
|
|
1287
|
-
} else if (a === undefined) {
|
|
1288
|
-
return -1;
|
|
1289
|
-
} else if (a === b) {
|
|
1290
|
-
continue;
|
|
1291
|
-
} else {
|
|
1292
|
-
return compareIdentifiers(a, b);
|
|
1293
|
-
}
|
|
1294
|
-
} while (++i);
|
|
1295
|
-
}
|
|
1296
|
-
inc(release, identifier, identifierBase) {
|
|
1297
|
-
if (release.startsWith("pre")) {
|
|
1298
|
-
if (!identifier && identifierBase === false) {
|
|
1299
|
-
throw new Error("invalid increment argument: identifier is empty");
|
|
1300
|
-
}
|
|
1301
|
-
if (identifier) {
|
|
1302
|
-
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
|
|
1303
|
-
if (!match || match[1] !== identifier) {
|
|
1304
|
-
throw new Error(`invalid identifier: ${identifier}`);
|
|
1305
|
-
}
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1308
|
-
switch (release) {
|
|
1309
|
-
case "premajor":
|
|
1310
|
-
this.prerelease.length = 0;
|
|
1311
|
-
this.patch = 0;
|
|
1312
|
-
this.minor = 0;
|
|
1313
|
-
this.major++;
|
|
1314
|
-
this.inc("pre", identifier, identifierBase);
|
|
1315
|
-
break;
|
|
1316
|
-
case "preminor":
|
|
1317
|
-
this.prerelease.length = 0;
|
|
1318
|
-
this.patch = 0;
|
|
1319
|
-
this.minor++;
|
|
1320
|
-
this.inc("pre", identifier, identifierBase);
|
|
1321
|
-
break;
|
|
1322
|
-
case "prepatch":
|
|
1323
|
-
this.prerelease.length = 0;
|
|
1324
|
-
this.inc("patch", identifier, identifierBase);
|
|
1325
|
-
this.inc("pre", identifier, identifierBase);
|
|
1326
|
-
break;
|
|
1327
|
-
case "prerelease":
|
|
1328
|
-
if (this.prerelease.length === 0) {
|
|
1329
|
-
this.inc("patch", identifier, identifierBase);
|
|
1330
|
-
}
|
|
1331
|
-
this.inc("pre", identifier, identifierBase);
|
|
1332
|
-
break;
|
|
1333
|
-
case "release":
|
|
1334
|
-
if (this.prerelease.length === 0) {
|
|
1335
|
-
throw new Error(`version ${this.raw} is not a prerelease`);
|
|
1336
|
-
}
|
|
1337
|
-
this.prerelease.length = 0;
|
|
1338
|
-
break;
|
|
1339
|
-
case "major":
|
|
1340
|
-
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
1341
|
-
this.major++;
|
|
1342
|
-
}
|
|
1343
|
-
this.minor = 0;
|
|
1344
|
-
this.patch = 0;
|
|
1345
|
-
this.prerelease = [];
|
|
1346
|
-
break;
|
|
1347
|
-
case "minor":
|
|
1348
|
-
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
1349
|
-
this.minor++;
|
|
1350
|
-
}
|
|
1351
|
-
this.patch = 0;
|
|
1352
|
-
this.prerelease = [];
|
|
1353
|
-
break;
|
|
1354
|
-
case "patch":
|
|
1355
|
-
if (this.prerelease.length === 0) {
|
|
1356
|
-
this.patch++;
|
|
1357
|
-
}
|
|
1358
|
-
this.prerelease = [];
|
|
1359
|
-
break;
|
|
1360
|
-
case "pre": {
|
|
1361
|
-
const base = Number(identifierBase) ? 1 : 0;
|
|
1362
|
-
if (this.prerelease.length === 0) {
|
|
1363
|
-
this.prerelease = [base];
|
|
1364
|
-
} else {
|
|
1365
|
-
let i = this.prerelease.length;
|
|
1366
|
-
while (--i >= 0) {
|
|
1367
|
-
if (typeof this.prerelease[i] === "number") {
|
|
1368
|
-
this.prerelease[i]++;
|
|
1369
|
-
i = -2;
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
if (i === -1) {
|
|
1373
|
-
if (identifier === this.prerelease.join(".") && identifierBase === false) {
|
|
1374
|
-
throw new Error("invalid increment argument: identifier already exists");
|
|
1375
|
-
}
|
|
1376
|
-
this.prerelease.push(base);
|
|
1377
|
-
}
|
|
1378
|
-
}
|
|
1379
|
-
if (identifier) {
|
|
1380
|
-
let prerelease = [identifier, base];
|
|
1381
|
-
if (identifierBase === false) {
|
|
1382
|
-
prerelease = [identifier];
|
|
1383
|
-
}
|
|
1384
|
-
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
|
1385
|
-
if (isNaN(this.prerelease[1])) {
|
|
1386
|
-
this.prerelease = prerelease;
|
|
1387
|
-
}
|
|
1388
|
-
} else {
|
|
1389
|
-
this.prerelease = prerelease;
|
|
1390
|
-
}
|
|
1391
|
-
}
|
|
1392
|
-
break;
|
|
1393
|
-
}
|
|
1394
|
-
default:
|
|
1395
|
-
throw new Error(`invalid increment argument: ${release}`);
|
|
1396
|
-
}
|
|
1397
|
-
this.raw = this.format();
|
|
1398
|
-
if (this.build.length) {
|
|
1399
|
-
this.raw += `+${this.build.join(".")}`;
|
|
1400
|
-
}
|
|
1401
|
-
return this;
|
|
1402
|
-
}
|
|
1403
|
-
}
|
|
1404
|
-
module.exports = SemVer;
|
|
1405
|
-
});
|
|
1406
|
-
|
|
1407
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/parse.js
|
|
1408
|
-
var require_parse = __commonJS((exports, module) => {
|
|
1409
|
-
var SemVer = require_semver();
|
|
1410
|
-
var parse = (version, options, throwErrors = false) => {
|
|
1411
|
-
if (version instanceof SemVer) {
|
|
1412
|
-
return version;
|
|
1413
|
-
}
|
|
1414
|
-
try {
|
|
1415
|
-
return new SemVer(version, options);
|
|
1416
|
-
} catch (er) {
|
|
1417
|
-
if (!throwErrors) {
|
|
1418
|
-
return null;
|
|
1419
|
-
}
|
|
1420
|
-
throw er;
|
|
1421
|
-
}
|
|
1422
|
-
};
|
|
1423
|
-
module.exports = parse;
|
|
1424
|
-
});
|
|
1425
|
-
|
|
1426
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/valid.js
|
|
1427
|
-
var require_valid = __commonJS((exports, module) => {
|
|
1428
|
-
var parse = require_parse();
|
|
1429
|
-
var valid = (version, options) => {
|
|
1430
|
-
const v = parse(version, options);
|
|
1431
|
-
return v ? v.version : null;
|
|
1432
|
-
};
|
|
1433
|
-
module.exports = valid;
|
|
1434
|
-
});
|
|
1435
|
-
|
|
1436
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/clean.js
|
|
1437
|
-
var require_clean = __commonJS((exports, module) => {
|
|
1438
|
-
var parse = require_parse();
|
|
1439
|
-
var clean = (version, options) => {
|
|
1440
|
-
const s = parse(version.trim().replace(/^[=v]+/, ""), options);
|
|
1441
|
-
return s ? s.version : null;
|
|
1442
|
-
};
|
|
1443
|
-
module.exports = clean;
|
|
1444
|
-
});
|
|
1445
|
-
|
|
1446
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/inc.js
|
|
1447
|
-
var require_inc = __commonJS((exports, module) => {
|
|
1448
|
-
var SemVer = require_semver();
|
|
1449
|
-
var inc = (version, release, options, identifier, identifierBase) => {
|
|
1450
|
-
if (typeof options === "string") {
|
|
1451
|
-
identifierBase = identifier;
|
|
1452
|
-
identifier = options;
|
|
1453
|
-
options = undefined;
|
|
1454
|
-
}
|
|
1455
|
-
try {
|
|
1456
|
-
return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
|
|
1457
|
-
} catch (er) {
|
|
1458
|
-
return null;
|
|
1459
|
-
}
|
|
1460
|
-
};
|
|
1461
|
-
module.exports = inc;
|
|
1462
|
-
});
|
|
1463
|
-
|
|
1464
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/diff.js
|
|
1465
|
-
var require_diff = __commonJS((exports, module) => {
|
|
1466
|
-
var parse = require_parse();
|
|
1467
|
-
var diff = (version1, version2) => {
|
|
1468
|
-
const v1 = parse(version1, null, true);
|
|
1469
|
-
const v2 = parse(version2, null, true);
|
|
1470
|
-
const comparison = v1.compare(v2);
|
|
1471
|
-
if (comparison === 0) {
|
|
1472
|
-
return null;
|
|
1473
|
-
}
|
|
1474
|
-
const v1Higher = comparison > 0;
|
|
1475
|
-
const highVersion = v1Higher ? v1 : v2;
|
|
1476
|
-
const lowVersion = v1Higher ? v2 : v1;
|
|
1477
|
-
const highHasPre = !!highVersion.prerelease.length;
|
|
1478
|
-
const lowHasPre = !!lowVersion.prerelease.length;
|
|
1479
|
-
if (lowHasPre && !highHasPre) {
|
|
1480
|
-
if (!lowVersion.patch && !lowVersion.minor) {
|
|
1481
|
-
return "major";
|
|
1482
|
-
}
|
|
1483
|
-
if (lowVersion.compareMain(highVersion) === 0) {
|
|
1484
|
-
if (lowVersion.minor && !lowVersion.patch) {
|
|
1485
|
-
return "minor";
|
|
1486
|
-
}
|
|
1487
|
-
return "patch";
|
|
1488
|
-
}
|
|
1489
|
-
}
|
|
1490
|
-
const prefix = highHasPre ? "pre" : "";
|
|
1491
|
-
if (v1.major !== v2.major) {
|
|
1492
|
-
return prefix + "major";
|
|
1493
|
-
}
|
|
1494
|
-
if (v1.minor !== v2.minor) {
|
|
1495
|
-
return prefix + "minor";
|
|
1496
|
-
}
|
|
1497
|
-
if (v1.patch !== v2.patch) {
|
|
1498
|
-
return prefix + "patch";
|
|
1499
|
-
}
|
|
1500
|
-
return "prerelease";
|
|
1501
|
-
};
|
|
1502
|
-
module.exports = diff;
|
|
1503
|
-
});
|
|
1504
|
-
|
|
1505
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/major.js
|
|
1506
|
-
var require_major = __commonJS((exports, module) => {
|
|
1507
|
-
var SemVer = require_semver();
|
|
1508
|
-
var major = (a, loose) => new SemVer(a, loose).major;
|
|
1509
|
-
module.exports = major;
|
|
1510
|
-
});
|
|
1511
|
-
|
|
1512
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/minor.js
|
|
1513
|
-
var require_minor = __commonJS((exports, module) => {
|
|
1514
|
-
var SemVer = require_semver();
|
|
1515
|
-
var minor = (a, loose) => new SemVer(a, loose).minor;
|
|
1516
|
-
module.exports = minor;
|
|
1517
|
-
});
|
|
1518
|
-
|
|
1519
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/patch.js
|
|
1520
|
-
var require_patch = __commonJS((exports, module) => {
|
|
1521
|
-
var SemVer = require_semver();
|
|
1522
|
-
var patch = (a, loose) => new SemVer(a, loose).patch;
|
|
1523
|
-
module.exports = patch;
|
|
1524
|
-
});
|
|
1525
|
-
|
|
1526
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/prerelease.js
|
|
1527
|
-
var require_prerelease = __commonJS((exports, module) => {
|
|
1528
|
-
var parse = require_parse();
|
|
1529
|
-
var prerelease = (version, options) => {
|
|
1530
|
-
const parsed = parse(version, options);
|
|
1531
|
-
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
1532
|
-
};
|
|
1533
|
-
module.exports = prerelease;
|
|
1534
|
-
});
|
|
1535
|
-
|
|
1536
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/compare.js
|
|
1537
|
-
var require_compare = __commonJS((exports, module) => {
|
|
1538
|
-
var SemVer = require_semver();
|
|
1539
|
-
var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
1540
|
-
module.exports = compare;
|
|
1541
|
-
});
|
|
1542
|
-
|
|
1543
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/rcompare.js
|
|
1544
|
-
var require_rcompare = __commonJS((exports, module) => {
|
|
1545
|
-
var compare = require_compare();
|
|
1546
|
-
var rcompare = (a, b, loose) => compare(b, a, loose);
|
|
1547
|
-
module.exports = rcompare;
|
|
1548
|
-
});
|
|
1549
|
-
|
|
1550
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/compare-loose.js
|
|
1551
|
-
var require_compare_loose = __commonJS((exports, module) => {
|
|
1552
|
-
var compare = require_compare();
|
|
1553
|
-
var compareLoose = (a, b) => compare(a, b, true);
|
|
1554
|
-
module.exports = compareLoose;
|
|
1555
|
-
});
|
|
1556
|
-
|
|
1557
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/compare-build.js
|
|
1558
|
-
var require_compare_build = __commonJS((exports, module) => {
|
|
1559
|
-
var SemVer = require_semver();
|
|
1560
|
-
var compareBuild = (a, b, loose) => {
|
|
1561
|
-
const versionA = new SemVer(a, loose);
|
|
1562
|
-
const versionB = new SemVer(b, loose);
|
|
1563
|
-
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
1564
|
-
};
|
|
1565
|
-
module.exports = compareBuild;
|
|
1566
|
-
});
|
|
1567
|
-
|
|
1568
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/sort.js
|
|
1569
|
-
var require_sort = __commonJS((exports, module) => {
|
|
1570
|
-
var compareBuild = require_compare_build();
|
|
1571
|
-
var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
|
|
1572
|
-
module.exports = sort;
|
|
1573
|
-
});
|
|
1574
|
-
|
|
1575
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/rsort.js
|
|
1576
|
-
var require_rsort = __commonJS((exports, module) => {
|
|
1577
|
-
var compareBuild = require_compare_build();
|
|
1578
|
-
var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
|
|
1579
|
-
module.exports = rsort;
|
|
1580
|
-
});
|
|
1581
|
-
|
|
1582
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/gt.js
|
|
1583
|
-
var require_gt = __commonJS((exports, module) => {
|
|
1584
|
-
var compare = require_compare();
|
|
1585
|
-
var gt = (a, b, loose) => compare(a, b, loose) > 0;
|
|
1586
|
-
module.exports = gt;
|
|
1587
|
-
});
|
|
1588
|
-
|
|
1589
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/lt.js
|
|
1590
|
-
var require_lt = __commonJS((exports, module) => {
|
|
1591
|
-
var compare = require_compare();
|
|
1592
|
-
var lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
1593
|
-
module.exports = lt;
|
|
1594
|
-
});
|
|
1595
|
-
|
|
1596
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/eq.js
|
|
1597
|
-
var require_eq = __commonJS((exports, module) => {
|
|
1598
|
-
var compare = require_compare();
|
|
1599
|
-
var eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
1600
|
-
module.exports = eq;
|
|
1601
|
-
});
|
|
1602
|
-
|
|
1603
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/neq.js
|
|
1604
|
-
var require_neq = __commonJS((exports, module) => {
|
|
1605
|
-
var compare = require_compare();
|
|
1606
|
-
var neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
1607
|
-
module.exports = neq;
|
|
1608
|
-
});
|
|
1609
|
-
|
|
1610
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/gte.js
|
|
1611
|
-
var require_gte = __commonJS((exports, module) => {
|
|
1612
|
-
var compare = require_compare();
|
|
1613
|
-
var gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
1614
|
-
module.exports = gte;
|
|
1615
|
-
});
|
|
1616
|
-
|
|
1617
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/lte.js
|
|
1618
|
-
var require_lte = __commonJS((exports, module) => {
|
|
1619
|
-
var compare = require_compare();
|
|
1620
|
-
var lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
1621
|
-
module.exports = lte;
|
|
1622
|
-
});
|
|
1623
|
-
|
|
1624
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/cmp.js
|
|
1625
|
-
var require_cmp = __commonJS((exports, module) => {
|
|
1626
|
-
var eq = require_eq();
|
|
1627
|
-
var neq = require_neq();
|
|
1628
|
-
var gt = require_gt();
|
|
1629
|
-
var gte = require_gte();
|
|
1630
|
-
var lt = require_lt();
|
|
1631
|
-
var lte = require_lte();
|
|
1632
|
-
var cmp = (a, op, b, loose) => {
|
|
1633
|
-
switch (op) {
|
|
1634
|
-
case "===":
|
|
1635
|
-
if (typeof a === "object") {
|
|
1636
|
-
a = a.version;
|
|
1637
|
-
}
|
|
1638
|
-
if (typeof b === "object") {
|
|
1639
|
-
b = b.version;
|
|
1640
|
-
}
|
|
1641
|
-
return a === b;
|
|
1642
|
-
case "!==":
|
|
1643
|
-
if (typeof a === "object") {
|
|
1644
|
-
a = a.version;
|
|
1645
|
-
}
|
|
1646
|
-
if (typeof b === "object") {
|
|
1647
|
-
b = b.version;
|
|
1648
|
-
}
|
|
1649
|
-
return a !== b;
|
|
1650
|
-
case "":
|
|
1651
|
-
case "=":
|
|
1652
|
-
case "==":
|
|
1653
|
-
return eq(a, b, loose);
|
|
1654
|
-
case "!=":
|
|
1655
|
-
return neq(a, b, loose);
|
|
1656
|
-
case ">":
|
|
1657
|
-
return gt(a, b, loose);
|
|
1658
|
-
case ">=":
|
|
1659
|
-
return gte(a, b, loose);
|
|
1660
|
-
case "<":
|
|
1661
|
-
return lt(a, b, loose);
|
|
1662
|
-
case "<=":
|
|
1663
|
-
return lte(a, b, loose);
|
|
1664
|
-
default:
|
|
1665
|
-
throw new TypeError(`Invalid operator: ${op}`);
|
|
1666
|
-
}
|
|
1667
|
-
};
|
|
1668
|
-
module.exports = cmp;
|
|
1669
|
-
});
|
|
1670
|
-
|
|
1671
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/coerce.js
|
|
1672
|
-
var require_coerce = __commonJS((exports, module) => {
|
|
1673
|
-
var SemVer = require_semver();
|
|
1674
|
-
var parse = require_parse();
|
|
1675
|
-
var { safeRe: re, t } = require_re();
|
|
1676
|
-
var coerce = (version, options) => {
|
|
1677
|
-
if (version instanceof SemVer) {
|
|
1678
|
-
return version;
|
|
1679
|
-
}
|
|
1680
|
-
if (typeof version === "number") {
|
|
1681
|
-
version = String(version);
|
|
1682
|
-
}
|
|
1683
|
-
if (typeof version !== "string") {
|
|
1684
|
-
return null;
|
|
1685
|
-
}
|
|
1686
|
-
options = options || {};
|
|
1687
|
-
let match = null;
|
|
1688
|
-
if (!options.rtl) {
|
|
1689
|
-
match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
|
|
1690
|
-
} else {
|
|
1691
|
-
const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
|
|
1692
|
-
let next;
|
|
1693
|
-
while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
|
|
1694
|
-
if (!match || next.index + next[0].length !== match.index + match[0].length) {
|
|
1695
|
-
match = next;
|
|
1696
|
-
}
|
|
1697
|
-
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
|
|
1698
|
-
}
|
|
1699
|
-
coerceRtlRegex.lastIndex = -1;
|
|
1700
|
-
}
|
|
1701
|
-
if (match === null) {
|
|
1702
|
-
return null;
|
|
1703
|
-
}
|
|
1704
|
-
const major = match[2];
|
|
1705
|
-
const minor = match[3] || "0";
|
|
1706
|
-
const patch = match[4] || "0";
|
|
1707
|
-
const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
|
|
1708
|
-
const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
|
|
1709
|
-
return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
|
|
1710
|
-
};
|
|
1711
|
-
module.exports = coerce;
|
|
1712
|
-
});
|
|
1713
|
-
|
|
1714
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/truncate.js
|
|
1715
|
-
var require_truncate = __commonJS((exports, module) => {
|
|
1716
|
-
var parse = require_parse();
|
|
1717
|
-
var constants = require_constants();
|
|
1718
|
-
var SemVer = require_semver();
|
|
1719
|
-
var truncate = (version, truncation, options) => {
|
|
1720
|
-
if (!constants.RELEASE_TYPES.includes(truncation)) {
|
|
1721
|
-
return null;
|
|
1722
|
-
}
|
|
1723
|
-
const clonedVersion = cloneInputVersion(version, options);
|
|
1724
|
-
return clonedVersion && doTruncation(clonedVersion, truncation);
|
|
1725
|
-
};
|
|
1726
|
-
var cloneInputVersion = (version, options) => {
|
|
1727
|
-
const versionStringToParse = version instanceof SemVer ? version.version : version;
|
|
1728
|
-
return parse(versionStringToParse, options);
|
|
1729
|
-
};
|
|
1730
|
-
var doTruncation = (version, truncation) => {
|
|
1731
|
-
if (isPrerelease(truncation)) {
|
|
1732
|
-
return version.version;
|
|
1733
|
-
}
|
|
1734
|
-
version.prerelease = [];
|
|
1735
|
-
switch (truncation) {
|
|
1736
|
-
case "major":
|
|
1737
|
-
version.minor = 0;
|
|
1738
|
-
version.patch = 0;
|
|
1739
|
-
break;
|
|
1740
|
-
case "minor":
|
|
1741
|
-
version.patch = 0;
|
|
1742
|
-
break;
|
|
1743
|
-
}
|
|
1744
|
-
return version.format();
|
|
1745
|
-
};
|
|
1746
|
-
var isPrerelease = (type) => {
|
|
1747
|
-
return type.startsWith("pre");
|
|
1748
|
-
};
|
|
1749
|
-
module.exports = truncate;
|
|
1750
|
-
});
|
|
1751
|
-
|
|
1752
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/internal/lrucache.js
|
|
1753
|
-
var require_lrucache = __commonJS((exports, module) => {
|
|
1754
|
-
class LRUCache {
|
|
1755
|
-
constructor() {
|
|
1756
|
-
this.max = 1000;
|
|
1757
|
-
this.map = new Map;
|
|
1758
|
-
}
|
|
1759
|
-
get(key) {
|
|
1760
|
-
const value = this.map.get(key);
|
|
1761
|
-
if (value === undefined) {
|
|
1762
|
-
return;
|
|
1763
|
-
} else {
|
|
1764
|
-
this.map.delete(key);
|
|
1765
|
-
this.map.set(key, value);
|
|
1766
|
-
return value;
|
|
1767
|
-
}
|
|
1768
|
-
}
|
|
1769
|
-
delete(key) {
|
|
1770
|
-
return this.map.delete(key);
|
|
1771
|
-
}
|
|
1772
|
-
set(key, value) {
|
|
1773
|
-
const deleted = this.delete(key);
|
|
1774
|
-
if (!deleted && value !== undefined) {
|
|
1775
|
-
if (this.map.size >= this.max) {
|
|
1776
|
-
const firstKey = this.map.keys().next().value;
|
|
1777
|
-
this.delete(firstKey);
|
|
1778
|
-
}
|
|
1779
|
-
this.map.set(key, value);
|
|
1780
|
-
}
|
|
1781
|
-
return this;
|
|
1782
|
-
}
|
|
1783
|
-
}
|
|
1784
|
-
module.exports = LRUCache;
|
|
1785
|
-
});
|
|
1786
|
-
|
|
1787
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/classes/range.js
|
|
1788
|
-
var require_range = __commonJS((exports, module) => {
|
|
1789
|
-
var SPACE_CHARACTERS = /\s+/g;
|
|
1790
|
-
|
|
1791
|
-
class Range {
|
|
1792
|
-
constructor(range, options) {
|
|
1793
|
-
options = parseOptions(options);
|
|
1794
|
-
if (range instanceof Range) {
|
|
1795
|
-
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
|
|
1796
|
-
return range;
|
|
1797
|
-
} else {
|
|
1798
|
-
return new Range(range.raw, options);
|
|
1799
|
-
}
|
|
1800
|
-
}
|
|
1801
|
-
if (range instanceof Comparator) {
|
|
1802
|
-
this.raw = range.value;
|
|
1803
|
-
this.set = [[range]];
|
|
1804
|
-
this.formatted = undefined;
|
|
1805
|
-
return this;
|
|
1806
|
-
}
|
|
1807
|
-
this.options = options;
|
|
1808
|
-
this.loose = !!options.loose;
|
|
1809
|
-
this.includePrerelease = !!options.includePrerelease;
|
|
1810
|
-
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
|
|
1811
|
-
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
1812
|
-
if (!this.set.length) {
|
|
1813
|
-
throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
1814
|
-
}
|
|
1815
|
-
if (this.set.length > 1) {
|
|
1816
|
-
const first = this.set[0];
|
|
1817
|
-
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
1818
|
-
if (this.set.length === 0) {
|
|
1819
|
-
this.set = [first];
|
|
1820
|
-
} else if (this.set.length > 1) {
|
|
1821
|
-
for (const c of this.set) {
|
|
1822
|
-
if (c.length === 1 && isAny(c[0])) {
|
|
1823
|
-
this.set = [c];
|
|
1824
|
-
break;
|
|
1825
|
-
}
|
|
1826
|
-
}
|
|
1827
|
-
}
|
|
1828
|
-
}
|
|
1829
|
-
this.formatted = undefined;
|
|
1830
|
-
}
|
|
1831
|
-
get range() {
|
|
1832
|
-
if (this.formatted === undefined) {
|
|
1833
|
-
this.formatted = "";
|
|
1834
|
-
for (let i = 0;i < this.set.length; i++) {
|
|
1835
|
-
if (i > 0) {
|
|
1836
|
-
this.formatted += "||";
|
|
1837
|
-
}
|
|
1838
|
-
const comps = this.set[i];
|
|
1839
|
-
for (let k = 0;k < comps.length; k++) {
|
|
1840
|
-
if (k > 0) {
|
|
1841
|
-
this.formatted += " ";
|
|
1842
|
-
}
|
|
1843
|
-
this.formatted += comps[k].toString().trim();
|
|
1844
|
-
}
|
|
1845
|
-
}
|
|
1846
|
-
}
|
|
1847
|
-
return this.formatted;
|
|
1848
|
-
}
|
|
1849
|
-
format() {
|
|
1850
|
-
return this.range;
|
|
1851
|
-
}
|
|
1852
|
-
toString() {
|
|
1853
|
-
return this.range;
|
|
1854
|
-
}
|
|
1855
|
-
parseRange(range) {
|
|
1856
|
-
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
|
1857
|
-
const memoKey = memoOpts + ":" + range;
|
|
1858
|
-
const cached = cache.get(memoKey);
|
|
1859
|
-
if (cached) {
|
|
1860
|
-
return cached;
|
|
1861
|
-
}
|
|
1862
|
-
const loose = this.options.loose;
|
|
1863
|
-
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
1864
|
-
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
1865
|
-
debug("hyphen replace", range);
|
|
1866
|
-
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
1867
|
-
debug("comparator trim", range);
|
|
1868
|
-
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
1869
|
-
debug("tilde trim", range);
|
|
1870
|
-
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
1871
|
-
debug("caret trim", range);
|
|
1872
|
-
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
1873
|
-
if (loose) {
|
|
1874
|
-
rangeList = rangeList.filter((comp) => {
|
|
1875
|
-
debug("loose invalid filter", comp, this.options);
|
|
1876
|
-
return !!comp.match(re[t.COMPARATORLOOSE]);
|
|
1877
|
-
});
|
|
1878
|
-
}
|
|
1879
|
-
debug("range list", rangeList);
|
|
1880
|
-
const rangeMap = new Map;
|
|
1881
|
-
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
1882
|
-
for (const comp of comparators) {
|
|
1883
|
-
if (isNullSet(comp)) {
|
|
1884
|
-
return [comp];
|
|
1885
|
-
}
|
|
1886
|
-
rangeMap.set(comp.value, comp);
|
|
1887
|
-
}
|
|
1888
|
-
if (rangeMap.size > 1 && rangeMap.has("")) {
|
|
1889
|
-
rangeMap.delete("");
|
|
1890
|
-
}
|
|
1891
|
-
const result = [...rangeMap.values()];
|
|
1892
|
-
cache.set(memoKey, result);
|
|
1893
|
-
return result;
|
|
1894
|
-
}
|
|
1895
|
-
intersects(range, options) {
|
|
1896
|
-
if (!(range instanceof Range)) {
|
|
1897
|
-
throw new TypeError("a Range is required");
|
|
1898
|
-
}
|
|
1899
|
-
return this.set.some((thisComparators) => {
|
|
1900
|
-
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
|
|
1901
|
-
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
1902
|
-
return rangeComparators.every((rangeComparator) => {
|
|
1903
|
-
return thisComparator.intersects(rangeComparator, options);
|
|
1904
|
-
});
|
|
1905
|
-
});
|
|
1906
|
-
});
|
|
1907
|
-
});
|
|
1908
|
-
}
|
|
1909
|
-
test(version) {
|
|
1910
|
-
if (!version) {
|
|
1911
|
-
return false;
|
|
1912
|
-
}
|
|
1913
|
-
if (typeof version === "string") {
|
|
1914
|
-
try {
|
|
1915
|
-
version = new SemVer(version, this.options);
|
|
1916
|
-
} catch (er) {
|
|
1917
|
-
return false;
|
|
1918
|
-
}
|
|
1919
|
-
}
|
|
1920
|
-
for (let i = 0;i < this.set.length; i++) {
|
|
1921
|
-
if (testSet(this.set[i], version, this.options)) {
|
|
1922
|
-
return true;
|
|
1923
|
-
}
|
|
1924
|
-
}
|
|
1925
|
-
return false;
|
|
1926
|
-
}
|
|
1927
|
-
}
|
|
1928
|
-
module.exports = Range;
|
|
1929
|
-
var LRU = require_lrucache();
|
|
1930
|
-
var cache = new LRU;
|
|
1931
|
-
var parseOptions = require_parse_options();
|
|
1932
|
-
var Comparator = require_comparator();
|
|
1933
|
-
var debug = require_debug();
|
|
1934
|
-
var SemVer = require_semver();
|
|
1935
|
-
var {
|
|
1936
|
-
safeRe: re,
|
|
1937
|
-
t,
|
|
1938
|
-
comparatorTrimReplace,
|
|
1939
|
-
tildeTrimReplace,
|
|
1940
|
-
caretTrimReplace
|
|
1941
|
-
} = require_re();
|
|
1942
|
-
var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
|
|
1943
|
-
var isNullSet = (c) => c.value === "<0.0.0-0";
|
|
1944
|
-
var isAny = (c) => c.value === "";
|
|
1945
|
-
var isSatisfiable = (comparators, options) => {
|
|
1946
|
-
let result = true;
|
|
1947
|
-
const remainingComparators = comparators.slice();
|
|
1948
|
-
let testComparator = remainingComparators.pop();
|
|
1949
|
-
while (result && remainingComparators.length) {
|
|
1950
|
-
result = remainingComparators.every((otherComparator) => {
|
|
1951
|
-
return testComparator.intersects(otherComparator, options);
|
|
1952
|
-
});
|
|
1953
|
-
testComparator = remainingComparators.pop();
|
|
1954
|
-
}
|
|
1955
|
-
return result;
|
|
1956
|
-
};
|
|
1957
|
-
var parseComparator = (comp, options) => {
|
|
1958
|
-
comp = comp.replace(re[t.BUILD], "");
|
|
1959
|
-
debug("comp", comp, options);
|
|
1960
|
-
comp = replaceCarets(comp, options);
|
|
1961
|
-
debug("caret", comp);
|
|
1962
|
-
comp = replaceTildes(comp, options);
|
|
1963
|
-
debug("tildes", comp);
|
|
1964
|
-
comp = replaceXRanges(comp, options);
|
|
1965
|
-
debug("xrange", comp);
|
|
1966
|
-
comp = replaceStars(comp, options);
|
|
1967
|
-
debug("stars", comp);
|
|
1968
|
-
return comp;
|
|
1969
|
-
};
|
|
1970
|
-
var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
1971
|
-
var replaceTildes = (comp, options) => {
|
|
1972
|
-
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
1973
|
-
};
|
|
1974
|
-
var replaceTilde = (comp, options) => {
|
|
1975
|
-
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
1976
|
-
return comp.replace(r, (_, M, m, p, pr) => {
|
|
1977
|
-
debug("tilde", comp, _, M, m, p, pr);
|
|
1978
|
-
let ret;
|
|
1979
|
-
if (isX(M)) {
|
|
1980
|
-
ret = "";
|
|
1981
|
-
} else if (isX(m)) {
|
|
1982
|
-
ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
|
|
1983
|
-
} else if (isX(p)) {
|
|
1984
|
-
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
|
|
1985
|
-
} else if (pr) {
|
|
1986
|
-
debug("replaceTilde pr", pr);
|
|
1987
|
-
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
1988
|
-
} else {
|
|
1989
|
-
ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
1990
|
-
}
|
|
1991
|
-
debug("tilde return", ret);
|
|
1992
|
-
return ret;
|
|
1993
|
-
});
|
|
1994
|
-
};
|
|
1995
|
-
var replaceCarets = (comp, options) => {
|
|
1996
|
-
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
|
1997
|
-
};
|
|
1998
|
-
var replaceCaret = (comp, options) => {
|
|
1999
|
-
debug("caret", comp, options);
|
|
2000
|
-
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
2001
|
-
const z = options.includePrerelease ? "-0" : "";
|
|
2002
|
-
return comp.replace(r, (_, M, m, p, pr) => {
|
|
2003
|
-
debug("caret", comp, _, M, m, p, pr);
|
|
2004
|
-
let ret;
|
|
2005
|
-
if (isX(M)) {
|
|
2006
|
-
ret = "";
|
|
2007
|
-
} else if (isX(m)) {
|
|
2008
|
-
ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
2009
|
-
} else if (isX(p)) {
|
|
2010
|
-
if (M === "0") {
|
|
2011
|
-
ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
2012
|
-
} else {
|
|
2013
|
-
ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
2014
|
-
}
|
|
2015
|
-
} else if (pr) {
|
|
2016
|
-
debug("replaceCaret pr", pr);
|
|
2017
|
-
if (M === "0") {
|
|
2018
|
-
if (m === "0") {
|
|
2019
|
-
ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
2020
|
-
} else {
|
|
2021
|
-
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
2022
|
-
}
|
|
2023
|
-
} else {
|
|
2024
|
-
ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
2025
|
-
}
|
|
2026
|
-
} else {
|
|
2027
|
-
debug("no pr");
|
|
2028
|
-
if (M === "0") {
|
|
2029
|
-
if (m === "0") {
|
|
2030
|
-
ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
|
|
2031
|
-
} else {
|
|
2032
|
-
ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
|
|
2033
|
-
}
|
|
2034
|
-
} else {
|
|
2035
|
-
ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
2036
|
-
}
|
|
2037
|
-
}
|
|
2038
|
-
debug("caret return", ret);
|
|
2039
|
-
return ret;
|
|
2040
|
-
});
|
|
2041
|
-
};
|
|
2042
|
-
var replaceXRanges = (comp, options) => {
|
|
2043
|
-
debug("replaceXRanges", comp, options);
|
|
2044
|
-
return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
|
|
2045
|
-
};
|
|
2046
|
-
var replaceXRange = (comp, options) => {
|
|
2047
|
-
comp = comp.trim();
|
|
2048
|
-
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
2049
|
-
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
2050
|
-
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
2051
|
-
const xM = isX(M);
|
|
2052
|
-
const xm = xM || isX(m);
|
|
2053
|
-
const xp = xm || isX(p);
|
|
2054
|
-
const anyX = xp;
|
|
2055
|
-
if (gtlt === "=" && anyX) {
|
|
2056
|
-
gtlt = "";
|
|
2057
|
-
}
|
|
2058
|
-
pr = options.includePrerelease ? "-0" : "";
|
|
2059
|
-
if (xM) {
|
|
2060
|
-
if (gtlt === ">" || gtlt === "<") {
|
|
2061
|
-
ret = "<0.0.0-0";
|
|
2062
|
-
} else {
|
|
2063
|
-
ret = "*";
|
|
2064
|
-
}
|
|
2065
|
-
} else if (gtlt && anyX) {
|
|
2066
|
-
if (xm) {
|
|
2067
|
-
m = 0;
|
|
2068
|
-
}
|
|
2069
|
-
p = 0;
|
|
2070
|
-
if (gtlt === ">") {
|
|
2071
|
-
gtlt = ">=";
|
|
2072
|
-
if (xm) {
|
|
2073
|
-
M = +M + 1;
|
|
2074
|
-
m = 0;
|
|
2075
|
-
p = 0;
|
|
2076
|
-
} else {
|
|
2077
|
-
m = +m + 1;
|
|
2078
|
-
p = 0;
|
|
2079
|
-
}
|
|
2080
|
-
} else if (gtlt === "<=") {
|
|
2081
|
-
gtlt = "<";
|
|
2082
|
-
if (xm) {
|
|
2083
|
-
M = +M + 1;
|
|
2084
|
-
} else {
|
|
2085
|
-
m = +m + 1;
|
|
2086
|
-
}
|
|
2087
|
-
}
|
|
2088
|
-
if (gtlt === "<") {
|
|
2089
|
-
pr = "-0";
|
|
2090
|
-
}
|
|
2091
|
-
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
2092
|
-
} else if (xm) {
|
|
2093
|
-
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
2094
|
-
} else if (xp) {
|
|
2095
|
-
ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
|
2096
|
-
}
|
|
2097
|
-
debug("xRange return", ret);
|
|
2098
|
-
return ret;
|
|
2099
|
-
});
|
|
2100
|
-
};
|
|
2101
|
-
var replaceStars = (comp, options) => {
|
|
2102
|
-
debug("replaceStars", comp, options);
|
|
2103
|
-
return comp.trim().replace(re[t.STAR], "");
|
|
2104
|
-
};
|
|
2105
|
-
var replaceGTE0 = (comp, options) => {
|
|
2106
|
-
debug("replaceGTE0", comp, options);
|
|
2107
|
-
return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
2108
|
-
};
|
|
2109
|
-
var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
2110
|
-
if (isX(fM)) {
|
|
2111
|
-
from = "";
|
|
2112
|
-
} else if (isX(fm)) {
|
|
2113
|
-
from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
2114
|
-
} else if (isX(fp)) {
|
|
2115
|
-
from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
2116
|
-
} else if (fpr) {
|
|
2117
|
-
from = `>=${from}`;
|
|
2118
|
-
} else {
|
|
2119
|
-
from = `>=${from}${incPr ? "-0" : ""}`;
|
|
2120
|
-
}
|
|
2121
|
-
if (isX(tM)) {
|
|
2122
|
-
to = "";
|
|
2123
|
-
} else if (isX(tm)) {
|
|
2124
|
-
to = `<${+tM + 1}.0.0-0`;
|
|
2125
|
-
} else if (isX(tp)) {
|
|
2126
|
-
to = `<${tM}.${+tm + 1}.0-0`;
|
|
2127
|
-
} else if (tpr) {
|
|
2128
|
-
to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
2129
|
-
} else if (incPr) {
|
|
2130
|
-
to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
2131
|
-
} else {
|
|
2132
|
-
to = `<=${to}`;
|
|
2133
|
-
}
|
|
2134
|
-
return `${from} ${to}`.trim();
|
|
2135
|
-
};
|
|
2136
|
-
var testSet = (set, version, options) => {
|
|
2137
|
-
for (let i = 0;i < set.length; i++) {
|
|
2138
|
-
if (!set[i].test(version)) {
|
|
2139
|
-
return false;
|
|
2140
|
-
}
|
|
2141
|
-
}
|
|
2142
|
-
if (version.prerelease.length && !options.includePrerelease) {
|
|
2143
|
-
for (let i = 0;i < set.length; i++) {
|
|
2144
|
-
debug(set[i].semver);
|
|
2145
|
-
if (set[i].semver === Comparator.ANY) {
|
|
2146
|
-
continue;
|
|
2147
|
-
}
|
|
2148
|
-
if (set[i].semver.prerelease.length > 0) {
|
|
2149
|
-
const allowed = set[i].semver;
|
|
2150
|
-
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
|
|
2151
|
-
return true;
|
|
2152
|
-
}
|
|
2153
|
-
}
|
|
2154
|
-
}
|
|
2155
|
-
return false;
|
|
2156
|
-
}
|
|
2157
|
-
return true;
|
|
2158
|
-
};
|
|
2159
|
-
});
|
|
2160
|
-
|
|
2161
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/classes/comparator.js
|
|
2162
|
-
var require_comparator = __commonJS((exports, module) => {
|
|
2163
|
-
var ANY = Symbol("SemVer ANY");
|
|
2164
|
-
|
|
2165
|
-
class Comparator {
|
|
2166
|
-
static get ANY() {
|
|
2167
|
-
return ANY;
|
|
2168
|
-
}
|
|
2169
|
-
constructor(comp, options) {
|
|
2170
|
-
options = parseOptions(options);
|
|
2171
|
-
if (comp instanceof Comparator) {
|
|
2172
|
-
if (comp.loose === !!options.loose) {
|
|
2173
|
-
return comp;
|
|
2174
|
-
} else {
|
|
2175
|
-
comp = comp.value;
|
|
2176
|
-
}
|
|
2177
|
-
}
|
|
2178
|
-
comp = comp.trim().split(/\s+/).join(" ");
|
|
2179
|
-
debug("comparator", comp, options);
|
|
2180
|
-
this.options = options;
|
|
2181
|
-
this.loose = !!options.loose;
|
|
2182
|
-
this.parse(comp);
|
|
2183
|
-
if (this.semver === ANY) {
|
|
2184
|
-
this.value = "";
|
|
2185
|
-
} else {
|
|
2186
|
-
this.value = this.operator + this.semver.version;
|
|
2187
|
-
}
|
|
2188
|
-
debug("comp", this);
|
|
2189
|
-
}
|
|
2190
|
-
parse(comp) {
|
|
2191
|
-
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
2192
|
-
const m = comp.match(r);
|
|
2193
|
-
if (!m) {
|
|
2194
|
-
throw new TypeError(`Invalid comparator: ${comp}`);
|
|
2195
|
-
}
|
|
2196
|
-
this.operator = m[1] !== undefined ? m[1] : "";
|
|
2197
|
-
if (this.operator === "=") {
|
|
2198
|
-
this.operator = "";
|
|
2199
|
-
}
|
|
2200
|
-
if (!m[2]) {
|
|
2201
|
-
this.semver = ANY;
|
|
2202
|
-
} else {
|
|
2203
|
-
this.semver = new SemVer(m[2], this.options.loose);
|
|
2204
|
-
}
|
|
2205
|
-
}
|
|
2206
|
-
toString() {
|
|
2207
|
-
return this.value;
|
|
2208
|
-
}
|
|
2209
|
-
test(version) {
|
|
2210
|
-
debug("Comparator.test", version, this.options.loose);
|
|
2211
|
-
if (this.semver === ANY || version === ANY) {
|
|
2212
|
-
return true;
|
|
2213
|
-
}
|
|
2214
|
-
if (typeof version === "string") {
|
|
2215
|
-
try {
|
|
2216
|
-
version = new SemVer(version, this.options);
|
|
2217
|
-
} catch (er) {
|
|
2218
|
-
return false;
|
|
2219
|
-
}
|
|
2220
|
-
}
|
|
2221
|
-
return cmp(version, this.operator, this.semver, this.options);
|
|
2222
|
-
}
|
|
2223
|
-
intersects(comp, options) {
|
|
2224
|
-
if (!(comp instanceof Comparator)) {
|
|
2225
|
-
throw new TypeError("a Comparator is required");
|
|
2226
|
-
}
|
|
2227
|
-
if (this.operator === "") {
|
|
2228
|
-
if (this.value === "") {
|
|
2229
|
-
return true;
|
|
2230
|
-
}
|
|
2231
|
-
return new Range(comp.value, options).test(this.value);
|
|
2232
|
-
} else if (comp.operator === "") {
|
|
2233
|
-
if (comp.value === "") {
|
|
2234
|
-
return true;
|
|
2235
|
-
}
|
|
2236
|
-
return new Range(this.value, options).test(comp.semver);
|
|
2237
|
-
}
|
|
2238
|
-
options = parseOptions(options);
|
|
2239
|
-
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
|
|
2240
|
-
return false;
|
|
2241
|
-
}
|
|
2242
|
-
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
|
|
2243
|
-
return false;
|
|
2244
|
-
}
|
|
2245
|
-
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
|
|
2246
|
-
return true;
|
|
2247
|
-
}
|
|
2248
|
-
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
|
|
2249
|
-
return true;
|
|
2250
|
-
}
|
|
2251
|
-
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
|
|
2252
|
-
return true;
|
|
2253
|
-
}
|
|
2254
|
-
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
|
|
2255
|
-
return true;
|
|
2256
|
-
}
|
|
2257
|
-
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
|
|
2258
|
-
return true;
|
|
2259
|
-
}
|
|
2260
|
-
return false;
|
|
2261
|
-
}
|
|
2262
|
-
}
|
|
2263
|
-
module.exports = Comparator;
|
|
2264
|
-
var parseOptions = require_parse_options();
|
|
2265
|
-
var { safeRe: re, t } = require_re();
|
|
2266
|
-
var cmp = require_cmp();
|
|
2267
|
-
var debug = require_debug();
|
|
2268
|
-
var SemVer = require_semver();
|
|
2269
|
-
var Range = require_range();
|
|
2270
|
-
});
|
|
2271
|
-
|
|
2272
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/functions/satisfies.js
|
|
2273
|
-
var require_satisfies = __commonJS((exports, module) => {
|
|
2274
|
-
var Range = require_range();
|
|
2275
|
-
var satisfies = (version, range, options) => {
|
|
2276
|
-
try {
|
|
2277
|
-
range = new Range(range, options);
|
|
2278
|
-
} catch (er) {
|
|
2279
|
-
return false;
|
|
2280
|
-
}
|
|
2281
|
-
return range.test(version);
|
|
2282
|
-
};
|
|
2283
|
-
module.exports = satisfies;
|
|
2284
|
-
});
|
|
2285
|
-
|
|
2286
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/ranges/to-comparators.js
|
|
2287
|
-
var require_to_comparators = __commonJS((exports, module) => {
|
|
2288
|
-
var Range = require_range();
|
|
2289
|
-
var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
2290
|
-
module.exports = toComparators;
|
|
2291
|
-
});
|
|
2292
|
-
|
|
2293
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/ranges/max-satisfying.js
|
|
2294
|
-
var require_max_satisfying = __commonJS((exports, module) => {
|
|
2295
|
-
var SemVer = require_semver();
|
|
2296
|
-
var Range = require_range();
|
|
2297
|
-
var maxSatisfying = (versions, range, options) => {
|
|
2298
|
-
let max = null;
|
|
2299
|
-
let maxSV = null;
|
|
2300
|
-
let rangeObj = null;
|
|
2301
|
-
try {
|
|
2302
|
-
rangeObj = new Range(range, options);
|
|
2303
|
-
} catch (er) {
|
|
2304
|
-
return null;
|
|
2305
|
-
}
|
|
2306
|
-
versions.forEach((v) => {
|
|
2307
|
-
if (rangeObj.test(v)) {
|
|
2308
|
-
if (!max || maxSV.compare(v) === -1) {
|
|
2309
|
-
max = v;
|
|
2310
|
-
maxSV = new SemVer(max, options);
|
|
2311
|
-
}
|
|
2312
|
-
}
|
|
2313
|
-
});
|
|
2314
|
-
return max;
|
|
2315
|
-
};
|
|
2316
|
-
module.exports = maxSatisfying;
|
|
2317
|
-
});
|
|
2318
|
-
|
|
2319
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/ranges/min-satisfying.js
|
|
2320
|
-
var require_min_satisfying = __commonJS((exports, module) => {
|
|
2321
|
-
var SemVer = require_semver();
|
|
2322
|
-
var Range = require_range();
|
|
2323
|
-
var minSatisfying = (versions, range, options) => {
|
|
2324
|
-
let min = null;
|
|
2325
|
-
let minSV = null;
|
|
2326
|
-
let rangeObj = null;
|
|
2327
|
-
try {
|
|
2328
|
-
rangeObj = new Range(range, options);
|
|
2329
|
-
} catch (er) {
|
|
2330
|
-
return null;
|
|
2331
|
-
}
|
|
2332
|
-
versions.forEach((v) => {
|
|
2333
|
-
if (rangeObj.test(v)) {
|
|
2334
|
-
if (!min || minSV.compare(v) === 1) {
|
|
2335
|
-
min = v;
|
|
2336
|
-
minSV = new SemVer(min, options);
|
|
2337
|
-
}
|
|
2338
|
-
}
|
|
2339
|
-
});
|
|
2340
|
-
return min;
|
|
2341
|
-
};
|
|
2342
|
-
module.exports = minSatisfying;
|
|
2343
|
-
});
|
|
2344
|
-
|
|
2345
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/ranges/min-version.js
|
|
2346
|
-
var require_min_version = __commonJS((exports, module) => {
|
|
2347
|
-
var SemVer = require_semver();
|
|
2348
|
-
var Range = require_range();
|
|
2349
|
-
var gt = require_gt();
|
|
2350
|
-
var minVersion = (range, loose) => {
|
|
2351
|
-
range = new Range(range, loose);
|
|
2352
|
-
let minver = new SemVer("0.0.0");
|
|
2353
|
-
if (range.test(minver)) {
|
|
2354
|
-
return minver;
|
|
2355
|
-
}
|
|
2356
|
-
minver = new SemVer("0.0.0-0");
|
|
2357
|
-
if (range.test(minver)) {
|
|
2358
|
-
return minver;
|
|
2359
|
-
}
|
|
2360
|
-
minver = null;
|
|
2361
|
-
for (let i = 0;i < range.set.length; ++i) {
|
|
2362
|
-
const comparators = range.set[i];
|
|
2363
|
-
let setMin = null;
|
|
2364
|
-
comparators.forEach((comparator) => {
|
|
2365
|
-
const compver = new SemVer(comparator.semver.version);
|
|
2366
|
-
switch (comparator.operator) {
|
|
2367
|
-
case ">":
|
|
2368
|
-
if (compver.prerelease.length === 0) {
|
|
2369
|
-
compver.patch++;
|
|
2370
|
-
} else {
|
|
2371
|
-
compver.prerelease.push(0);
|
|
2372
|
-
}
|
|
2373
|
-
compver.raw = compver.format();
|
|
2374
|
-
case "":
|
|
2375
|
-
case ">=":
|
|
2376
|
-
if (!setMin || gt(compver, setMin)) {
|
|
2377
|
-
setMin = compver;
|
|
2378
|
-
}
|
|
2379
|
-
break;
|
|
2380
|
-
case "<":
|
|
2381
|
-
case "<=":
|
|
2382
|
-
break;
|
|
2383
|
-
default:
|
|
2384
|
-
throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
2385
|
-
}
|
|
2386
|
-
});
|
|
2387
|
-
if (setMin && (!minver || gt(minver, setMin))) {
|
|
2388
|
-
minver = setMin;
|
|
2389
|
-
}
|
|
2390
|
-
}
|
|
2391
|
-
if (minver && range.test(minver)) {
|
|
2392
|
-
return minver;
|
|
2393
|
-
}
|
|
2394
|
-
return null;
|
|
2395
|
-
};
|
|
2396
|
-
module.exports = minVersion;
|
|
2397
|
-
});
|
|
2398
|
-
|
|
2399
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/ranges/valid.js
|
|
2400
|
-
var require_valid2 = __commonJS((exports, module) => {
|
|
2401
|
-
var Range = require_range();
|
|
2402
|
-
var validRange = (range, options) => {
|
|
2403
|
-
try {
|
|
2404
|
-
return new Range(range, options).range || "*";
|
|
2405
|
-
} catch (er) {
|
|
2406
|
-
return null;
|
|
2407
|
-
}
|
|
2408
|
-
};
|
|
2409
|
-
module.exports = validRange;
|
|
2410
|
-
});
|
|
2411
|
-
|
|
2412
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/ranges/outside.js
|
|
2413
|
-
var require_outside = __commonJS((exports, module) => {
|
|
2414
|
-
var SemVer = require_semver();
|
|
2415
|
-
var Comparator = require_comparator();
|
|
2416
|
-
var { ANY } = Comparator;
|
|
2417
|
-
var Range = require_range();
|
|
2418
|
-
var satisfies = require_satisfies();
|
|
2419
|
-
var gt = require_gt();
|
|
2420
|
-
var lt = require_lt();
|
|
2421
|
-
var lte = require_lte();
|
|
2422
|
-
var gte = require_gte();
|
|
2423
|
-
var outside = (version, range, hilo, options) => {
|
|
2424
|
-
version = new SemVer(version, options);
|
|
2425
|
-
range = new Range(range, options);
|
|
2426
|
-
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
2427
|
-
switch (hilo) {
|
|
2428
|
-
case ">":
|
|
2429
|
-
gtfn = gt;
|
|
2430
|
-
ltefn = lte;
|
|
2431
|
-
ltfn = lt;
|
|
2432
|
-
comp = ">";
|
|
2433
|
-
ecomp = ">=";
|
|
2434
|
-
break;
|
|
2435
|
-
case "<":
|
|
2436
|
-
gtfn = lt;
|
|
2437
|
-
ltefn = gte;
|
|
2438
|
-
ltfn = gt;
|
|
2439
|
-
comp = "<";
|
|
2440
|
-
ecomp = "<=";
|
|
2441
|
-
break;
|
|
2442
|
-
default:
|
|
2443
|
-
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
2444
|
-
}
|
|
2445
|
-
if (satisfies(version, range, options)) {
|
|
2446
|
-
return false;
|
|
2447
|
-
}
|
|
2448
|
-
for (let i = 0;i < range.set.length; ++i) {
|
|
2449
|
-
const comparators = range.set[i];
|
|
2450
|
-
let high = null;
|
|
2451
|
-
let low = null;
|
|
2452
|
-
comparators.forEach((comparator) => {
|
|
2453
|
-
if (comparator.semver === ANY) {
|
|
2454
|
-
comparator = new Comparator(">=0.0.0");
|
|
2455
|
-
}
|
|
2456
|
-
high = high || comparator;
|
|
2457
|
-
low = low || comparator;
|
|
2458
|
-
if (gtfn(comparator.semver, high.semver, options)) {
|
|
2459
|
-
high = comparator;
|
|
2460
|
-
} else if (ltfn(comparator.semver, low.semver, options)) {
|
|
2461
|
-
low = comparator;
|
|
2462
|
-
}
|
|
2463
|
-
});
|
|
2464
|
-
if (high.operator === comp || high.operator === ecomp) {
|
|
2465
|
-
return false;
|
|
2466
|
-
}
|
|
2467
|
-
if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
|
|
2468
|
-
return false;
|
|
2469
|
-
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
|
|
2470
|
-
return false;
|
|
2471
|
-
}
|
|
2472
|
-
}
|
|
2473
|
-
return true;
|
|
2474
|
-
};
|
|
2475
|
-
module.exports = outside;
|
|
2476
|
-
});
|
|
2477
|
-
|
|
2478
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/ranges/gtr.js
|
|
2479
|
-
var require_gtr = __commonJS((exports, module) => {
|
|
2480
|
-
var outside = require_outside();
|
|
2481
|
-
var gtr = (version, range, options) => outside(version, range, ">", options);
|
|
2482
|
-
module.exports = gtr;
|
|
2483
|
-
});
|
|
2484
|
-
|
|
2485
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/ranges/ltr.js
|
|
2486
|
-
var require_ltr = __commonJS((exports, module) => {
|
|
2487
|
-
var outside = require_outside();
|
|
2488
|
-
var ltr = (version, range, options) => outside(version, range, "<", options);
|
|
2489
|
-
module.exports = ltr;
|
|
2490
|
-
});
|
|
2491
|
-
|
|
2492
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/ranges/intersects.js
|
|
2493
|
-
var require_intersects = __commonJS((exports, module) => {
|
|
2494
|
-
var Range = require_range();
|
|
2495
|
-
var intersects = (r1, r2, options) => {
|
|
2496
|
-
r1 = new Range(r1, options);
|
|
2497
|
-
r2 = new Range(r2, options);
|
|
2498
|
-
return r1.intersects(r2, options);
|
|
2499
|
-
};
|
|
2500
|
-
module.exports = intersects;
|
|
2501
|
-
});
|
|
2502
|
-
|
|
2503
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/ranges/simplify.js
|
|
2504
|
-
var require_simplify = __commonJS((exports, module) => {
|
|
2505
|
-
var satisfies = require_satisfies();
|
|
2506
|
-
var compare = require_compare();
|
|
2507
|
-
module.exports = (versions, range, options) => {
|
|
2508
|
-
const set = [];
|
|
2509
|
-
let first = null;
|
|
2510
|
-
let prev = null;
|
|
2511
|
-
const v = versions.sort((a, b) => compare(a, b, options));
|
|
2512
|
-
for (const version of v) {
|
|
2513
|
-
const included = satisfies(version, range, options);
|
|
2514
|
-
if (included) {
|
|
2515
|
-
prev = version;
|
|
2516
|
-
if (!first) {
|
|
2517
|
-
first = version;
|
|
2518
|
-
}
|
|
2519
|
-
} else {
|
|
2520
|
-
if (prev) {
|
|
2521
|
-
set.push([first, prev]);
|
|
2522
|
-
}
|
|
2523
|
-
prev = null;
|
|
2524
|
-
first = null;
|
|
2525
|
-
}
|
|
2526
|
-
}
|
|
2527
|
-
if (first) {
|
|
2528
|
-
set.push([first, null]);
|
|
2529
|
-
}
|
|
2530
|
-
const ranges = [];
|
|
2531
|
-
for (const [min, max] of set) {
|
|
2532
|
-
if (min === max) {
|
|
2533
|
-
ranges.push(min);
|
|
2534
|
-
} else if (!max && min === v[0]) {
|
|
2535
|
-
ranges.push("*");
|
|
2536
|
-
} else if (!max) {
|
|
2537
|
-
ranges.push(`>=${min}`);
|
|
2538
|
-
} else if (min === v[0]) {
|
|
2539
|
-
ranges.push(`<=${max}`);
|
|
2540
|
-
} else {
|
|
2541
|
-
ranges.push(`${min} - ${max}`);
|
|
2542
|
-
}
|
|
2543
|
-
}
|
|
2544
|
-
const simplified = ranges.join(" || ");
|
|
2545
|
-
const original = typeof range.raw === "string" ? range.raw : String(range);
|
|
2546
|
-
return simplified.length < original.length ? simplified : range;
|
|
2547
|
-
};
|
|
2548
|
-
});
|
|
2549
|
-
|
|
2550
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/ranges/subset.js
|
|
2551
|
-
var require_subset = __commonJS((exports, module) => {
|
|
2552
|
-
var Range = require_range();
|
|
2553
|
-
var Comparator = require_comparator();
|
|
2554
|
-
var { ANY } = Comparator;
|
|
2555
|
-
var satisfies = require_satisfies();
|
|
2556
|
-
var compare = require_compare();
|
|
2557
|
-
var subset = (sub, dom, options = {}) => {
|
|
2558
|
-
if (sub === dom) {
|
|
2559
|
-
return true;
|
|
2560
|
-
}
|
|
2561
|
-
sub = new Range(sub, options);
|
|
2562
|
-
dom = new Range(dom, options);
|
|
2563
|
-
let sawNonNull = false;
|
|
2564
|
-
OUTER:
|
|
2565
|
-
for (const simpleSub of sub.set) {
|
|
2566
|
-
for (const simpleDom of dom.set) {
|
|
2567
|
-
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
2568
|
-
sawNonNull = sawNonNull || isSub !== null;
|
|
2569
|
-
if (isSub) {
|
|
2570
|
-
continue OUTER;
|
|
2571
|
-
}
|
|
2572
|
-
}
|
|
2573
|
-
if (sawNonNull) {
|
|
2574
|
-
return false;
|
|
2575
|
-
}
|
|
2576
|
-
}
|
|
2577
|
-
return true;
|
|
2578
|
-
};
|
|
2579
|
-
var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
2580
|
-
var minimumVersion = [new Comparator(">=0.0.0")];
|
|
2581
|
-
var simpleSubset = (sub, dom, options) => {
|
|
2582
|
-
if (sub === dom) {
|
|
2583
|
-
return true;
|
|
2584
|
-
}
|
|
2585
|
-
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
2586
|
-
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
2587
|
-
return true;
|
|
2588
|
-
} else if (options.includePrerelease) {
|
|
2589
|
-
sub = minimumVersionWithPreRelease;
|
|
2590
|
-
} else {
|
|
2591
|
-
sub = minimumVersion;
|
|
2592
|
-
}
|
|
2593
|
-
}
|
|
2594
|
-
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
2595
|
-
if (options.includePrerelease) {
|
|
2596
|
-
return true;
|
|
2597
|
-
} else {
|
|
2598
|
-
dom = minimumVersion;
|
|
2599
|
-
}
|
|
2600
|
-
}
|
|
2601
|
-
const eqSet = new Set;
|
|
2602
|
-
let gt, lt;
|
|
2603
|
-
for (const c of sub) {
|
|
2604
|
-
if (c.operator === ">" || c.operator === ">=") {
|
|
2605
|
-
gt = higherGT(gt, c, options);
|
|
2606
|
-
} else if (c.operator === "<" || c.operator === "<=") {
|
|
2607
|
-
lt = lowerLT(lt, c, options);
|
|
2608
|
-
} else {
|
|
2609
|
-
eqSet.add(c.semver);
|
|
2610
|
-
}
|
|
2611
|
-
}
|
|
2612
|
-
if (eqSet.size > 1) {
|
|
2613
|
-
return null;
|
|
2614
|
-
}
|
|
2615
|
-
let gtltComp;
|
|
2616
|
-
if (gt && lt) {
|
|
2617
|
-
gtltComp = compare(gt.semver, lt.semver, options);
|
|
2618
|
-
if (gtltComp > 0) {
|
|
2619
|
-
return null;
|
|
2620
|
-
} else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
|
|
2621
|
-
return null;
|
|
2622
|
-
}
|
|
2623
|
-
}
|
|
2624
|
-
for (const eq of eqSet) {
|
|
2625
|
-
if (gt && !satisfies(eq, String(gt), options)) {
|
|
2626
|
-
return null;
|
|
2627
|
-
}
|
|
2628
|
-
if (lt && !satisfies(eq, String(lt), options)) {
|
|
2629
|
-
return null;
|
|
2630
|
-
}
|
|
2631
|
-
for (const c of dom) {
|
|
2632
|
-
if (!satisfies(eq, String(c), options)) {
|
|
2633
|
-
return false;
|
|
2634
|
-
}
|
|
2635
|
-
}
|
|
2636
|
-
return true;
|
|
2637
|
-
}
|
|
2638
|
-
let higher, lower;
|
|
2639
|
-
let hasDomLT, hasDomGT;
|
|
2640
|
-
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
2641
|
-
let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
2642
|
-
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
|
|
2643
|
-
needDomLTPre = false;
|
|
2644
|
-
}
|
|
2645
|
-
for (const c of dom) {
|
|
2646
|
-
hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
|
|
2647
|
-
hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
|
|
2648
|
-
if (gt) {
|
|
2649
|
-
if (needDomGTPre) {
|
|
2650
|
-
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) {
|
|
2651
|
-
needDomGTPre = false;
|
|
2652
|
-
}
|
|
2653
|
-
}
|
|
2654
|
-
if (c.operator === ">" || c.operator === ">=") {
|
|
2655
|
-
higher = higherGT(gt, c, options);
|
|
2656
|
-
if (higher === c && higher !== gt) {
|
|
2657
|
-
return false;
|
|
2658
|
-
}
|
|
2659
|
-
} else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) {
|
|
2660
|
-
return false;
|
|
2661
|
-
}
|
|
2662
|
-
}
|
|
2663
|
-
if (lt) {
|
|
2664
|
-
if (needDomLTPre) {
|
|
2665
|
-
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) {
|
|
2666
|
-
needDomLTPre = false;
|
|
2667
|
-
}
|
|
2668
|
-
}
|
|
2669
|
-
if (c.operator === "<" || c.operator === "<=") {
|
|
2670
|
-
lower = lowerLT(lt, c, options);
|
|
2671
|
-
if (lower === c && lower !== lt) {
|
|
2672
|
-
return false;
|
|
2673
|
-
}
|
|
2674
|
-
} else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) {
|
|
2675
|
-
return false;
|
|
2676
|
-
}
|
|
2677
|
-
}
|
|
2678
|
-
if (!c.operator && (lt || gt) && gtltComp !== 0) {
|
|
2679
|
-
return false;
|
|
2680
|
-
}
|
|
2681
|
-
}
|
|
2682
|
-
if (gt && hasDomLT && !lt && gtltComp !== 0) {
|
|
2683
|
-
return false;
|
|
2684
|
-
}
|
|
2685
|
-
if (lt && hasDomGT && !gt && gtltComp !== 0) {
|
|
2686
|
-
return false;
|
|
2687
|
-
}
|
|
2688
|
-
if (needDomGTPre || needDomLTPre) {
|
|
2689
|
-
return false;
|
|
2690
|
-
}
|
|
2691
|
-
return true;
|
|
2692
|
-
};
|
|
2693
|
-
var higherGT = (a, b, options) => {
|
|
2694
|
-
if (!a) {
|
|
2695
|
-
return b;
|
|
2696
|
-
}
|
|
2697
|
-
const comp = compare(a.semver, b.semver, options);
|
|
2698
|
-
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
2699
|
-
};
|
|
2700
|
-
var lowerLT = (a, b, options) => {
|
|
2701
|
-
if (!a) {
|
|
2702
|
-
return b;
|
|
2703
|
-
}
|
|
2704
|
-
const comp = compare(a.semver, b.semver, options);
|
|
2705
|
-
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
2706
|
-
};
|
|
2707
|
-
module.exports = subset;
|
|
2708
|
-
});
|
|
2709
|
-
|
|
2710
|
-
// ../../node_modules/.bun/semver@7.8.0/node_modules/semver/index.js
|
|
2711
|
-
var require_semver2 = __commonJS((exports, module) => {
|
|
2712
|
-
var internalRe = require_re();
|
|
2713
|
-
var constants = require_constants();
|
|
2714
|
-
var SemVer = require_semver();
|
|
2715
|
-
var identifiers = require_identifiers();
|
|
2716
|
-
var parse = require_parse();
|
|
2717
|
-
var valid = require_valid();
|
|
2718
|
-
var clean = require_clean();
|
|
2719
|
-
var inc = require_inc();
|
|
2720
|
-
var diff = require_diff();
|
|
2721
|
-
var major = require_major();
|
|
2722
|
-
var minor = require_minor();
|
|
2723
|
-
var patch = require_patch();
|
|
2724
|
-
var prerelease = require_prerelease();
|
|
2725
|
-
var compare = require_compare();
|
|
2726
|
-
var rcompare = require_rcompare();
|
|
2727
|
-
var compareLoose = require_compare_loose();
|
|
2728
|
-
var compareBuild = require_compare_build();
|
|
2729
|
-
var sort = require_sort();
|
|
2730
|
-
var rsort = require_rsort();
|
|
2731
|
-
var gt = require_gt();
|
|
2732
|
-
var lt = require_lt();
|
|
2733
|
-
var eq = require_eq();
|
|
2734
|
-
var neq = require_neq();
|
|
2735
|
-
var gte = require_gte();
|
|
2736
|
-
var lte = require_lte();
|
|
2737
|
-
var cmp = require_cmp();
|
|
2738
|
-
var coerce = require_coerce();
|
|
2739
|
-
var truncate = require_truncate();
|
|
2740
|
-
var Comparator = require_comparator();
|
|
2741
|
-
var Range = require_range();
|
|
2742
|
-
var satisfies = require_satisfies();
|
|
2743
|
-
var toComparators = require_to_comparators();
|
|
2744
|
-
var maxSatisfying = require_max_satisfying();
|
|
2745
|
-
var minSatisfying = require_min_satisfying();
|
|
2746
|
-
var minVersion = require_min_version();
|
|
2747
|
-
var validRange = require_valid2();
|
|
2748
|
-
var outside = require_outside();
|
|
2749
|
-
var gtr = require_gtr();
|
|
2750
|
-
var ltr = require_ltr();
|
|
2751
|
-
var intersects = require_intersects();
|
|
2752
|
-
var simplifyRange = require_simplify();
|
|
2753
|
-
var subset = require_subset();
|
|
2754
|
-
module.exports = {
|
|
2755
|
-
parse,
|
|
2756
|
-
valid,
|
|
2757
|
-
clean,
|
|
2758
|
-
inc,
|
|
2759
|
-
diff,
|
|
2760
|
-
major,
|
|
2761
|
-
minor,
|
|
2762
|
-
patch,
|
|
2763
|
-
prerelease,
|
|
2764
|
-
compare,
|
|
2765
|
-
rcompare,
|
|
2766
|
-
compareLoose,
|
|
2767
|
-
compareBuild,
|
|
2768
|
-
sort,
|
|
2769
|
-
rsort,
|
|
2770
|
-
gt,
|
|
2771
|
-
lt,
|
|
2772
|
-
eq,
|
|
2773
|
-
neq,
|
|
2774
|
-
gte,
|
|
2775
|
-
lte,
|
|
2776
|
-
cmp,
|
|
2777
|
-
coerce,
|
|
2778
|
-
truncate,
|
|
2779
|
-
Comparator,
|
|
2780
|
-
Range,
|
|
2781
|
-
satisfies,
|
|
2782
|
-
toComparators,
|
|
2783
|
-
maxSatisfying,
|
|
2784
|
-
minSatisfying,
|
|
2785
|
-
minVersion,
|
|
2786
|
-
validRange,
|
|
2787
|
-
outside,
|
|
2788
|
-
gtr,
|
|
2789
|
-
ltr,
|
|
2790
|
-
intersects,
|
|
2791
|
-
simplifyRange,
|
|
2792
|
-
subset,
|
|
2793
|
-
SemVer,
|
|
2794
|
-
re: internalRe.re,
|
|
2795
|
-
src: internalRe.src,
|
|
2796
|
-
tokens: internalRe.t,
|
|
2797
|
-
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
|
2798
|
-
RELEASE_TYPES: constants.RELEASE_TYPES,
|
|
2799
|
-
compareIdentifiers: identifiers.compareIdentifiers,
|
|
2800
|
-
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
2801
|
-
};
|
|
2802
|
-
});
|
|
2803
|
-
|
|
2804
|
-
// ../../node_modules/.bun/jsonwebtoken@9.0.3/node_modules/jsonwebtoken/lib/asymmetricKeyDetailsSupported.js
|
|
2805
|
-
var require_asymmetricKeyDetailsSupported = __commonJS((exports, module) => {
|
|
2806
|
-
var semver = require_semver2();
|
|
2807
|
-
module.exports = semver.satisfies(process.version, ">=15.7.0");
|
|
2808
|
-
});
|
|
2809
|
-
|
|
2810
|
-
// ../../node_modules/.bun/jsonwebtoken@9.0.3/node_modules/jsonwebtoken/lib/rsaPssKeyDetailsSupported.js
|
|
2811
|
-
var require_rsaPssKeyDetailsSupported = __commonJS((exports, module) => {
|
|
2812
|
-
var semver = require_semver2();
|
|
2813
|
-
module.exports = semver.satisfies(process.version, ">=16.9.0");
|
|
2814
|
-
});
|
|
2815
|
-
|
|
2816
|
-
// ../../node_modules/.bun/jsonwebtoken@9.0.3/node_modules/jsonwebtoken/lib/validateAsymmetricKey.js
|
|
2817
|
-
var require_validateAsymmetricKey = __commonJS((exports, module) => {
|
|
2818
|
-
var ASYMMETRIC_KEY_DETAILS_SUPPORTED = require_asymmetricKeyDetailsSupported();
|
|
2819
|
-
var RSA_PSS_KEY_DETAILS_SUPPORTED = require_rsaPssKeyDetailsSupported();
|
|
2820
|
-
var allowedAlgorithmsForKeys = {
|
|
2821
|
-
ec: ["ES256", "ES384", "ES512"],
|
|
2822
|
-
rsa: ["RS256", "PS256", "RS384", "PS384", "RS512", "PS512"],
|
|
2823
|
-
"rsa-pss": ["PS256", "PS384", "PS512"]
|
|
2824
|
-
};
|
|
2825
|
-
var allowedCurves = {
|
|
2826
|
-
ES256: "prime256v1",
|
|
2827
|
-
ES384: "secp384r1",
|
|
2828
|
-
ES512: "secp521r1"
|
|
2829
|
-
};
|
|
2830
|
-
module.exports = function(algorithm, key) {
|
|
2831
|
-
if (!algorithm || !key)
|
|
2832
|
-
return;
|
|
2833
|
-
const keyType = key.asymmetricKeyType;
|
|
2834
|
-
if (!keyType)
|
|
2835
|
-
return;
|
|
2836
|
-
const allowedAlgorithms = allowedAlgorithmsForKeys[keyType];
|
|
2837
|
-
if (!allowedAlgorithms) {
|
|
2838
|
-
throw new Error(`Unknown key type "${keyType}".`);
|
|
2839
|
-
}
|
|
2840
|
-
if (!allowedAlgorithms.includes(algorithm)) {
|
|
2841
|
-
throw new Error(`"alg" parameter for "${keyType}" key type must be one of: ${allowedAlgorithms.join(", ")}.`);
|
|
2842
|
-
}
|
|
2843
|
-
if (ASYMMETRIC_KEY_DETAILS_SUPPORTED) {
|
|
2844
|
-
switch (keyType) {
|
|
2845
|
-
case "ec":
|
|
2846
|
-
const keyCurve = key.asymmetricKeyDetails.namedCurve;
|
|
2847
|
-
const allowedCurve = allowedCurves[algorithm];
|
|
2848
|
-
if (keyCurve !== allowedCurve) {
|
|
2849
|
-
throw new Error(`"alg" parameter "${algorithm}" requires curve "${allowedCurve}".`);
|
|
2850
|
-
}
|
|
2851
|
-
break;
|
|
2852
|
-
case "rsa-pss":
|
|
2853
|
-
if (RSA_PSS_KEY_DETAILS_SUPPORTED) {
|
|
2854
|
-
const length = parseInt(algorithm.slice(-3), 10);
|
|
2855
|
-
const { hashAlgorithm, mgf1HashAlgorithm, saltLength } = key.asymmetricKeyDetails;
|
|
2856
|
-
if (hashAlgorithm !== `sha${length}` || mgf1HashAlgorithm !== hashAlgorithm) {
|
|
2857
|
-
throw new Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${algorithm}.`);
|
|
2858
|
-
}
|
|
2859
|
-
if (saltLength !== undefined && saltLength > length >> 3) {
|
|
2860
|
-
throw new Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${algorithm}.`);
|
|
2861
|
-
}
|
|
2862
|
-
}
|
|
2863
|
-
break;
|
|
2864
|
-
}
|
|
2865
|
-
}
|
|
2866
|
-
};
|
|
2867
|
-
});
|
|
2868
|
-
|
|
2869
|
-
// ../../node_modules/.bun/jsonwebtoken@9.0.3/node_modules/jsonwebtoken/lib/psSupported.js
|
|
2870
|
-
var require_psSupported = __commonJS((exports, module) => {
|
|
2871
|
-
var semver = require_semver2();
|
|
2872
|
-
module.exports = semver.satisfies(process.version, "^6.12.0 || >=8.0.0");
|
|
2873
|
-
});
|
|
2874
|
-
|
|
2875
|
-
// ../../node_modules/.bun/jsonwebtoken@9.0.3/node_modules/jsonwebtoken/verify.js
|
|
2876
|
-
var require_verify = __commonJS((exports, module) => {
|
|
2877
|
-
var JsonWebTokenError = require_JsonWebTokenError();
|
|
2878
|
-
var NotBeforeError = require_NotBeforeError();
|
|
2879
|
-
var TokenExpiredError = require_TokenExpiredError();
|
|
2880
|
-
var decode = require_decode();
|
|
2881
|
-
var timespan = require_timespan();
|
|
2882
|
-
var validateAsymmetricKey = require_validateAsymmetricKey();
|
|
2883
|
-
var PS_SUPPORTED = require_psSupported();
|
|
2884
|
-
var jws = require_jws();
|
|
2885
|
-
var { KeyObject, createSecretKey, createPublicKey } = __require("crypto");
|
|
2886
|
-
var PUB_KEY_ALGS = ["RS256", "RS384", "RS512"];
|
|
2887
|
-
var EC_KEY_ALGS = ["ES256", "ES384", "ES512"];
|
|
2888
|
-
var RSA_KEY_ALGS = ["RS256", "RS384", "RS512"];
|
|
2889
|
-
var HS_ALGS = ["HS256", "HS384", "HS512"];
|
|
2890
|
-
if (PS_SUPPORTED) {
|
|
2891
|
-
PUB_KEY_ALGS.splice(PUB_KEY_ALGS.length, 0, "PS256", "PS384", "PS512");
|
|
2892
|
-
RSA_KEY_ALGS.splice(RSA_KEY_ALGS.length, 0, "PS256", "PS384", "PS512");
|
|
2893
|
-
}
|
|
2894
|
-
module.exports = function(jwtString, secretOrPublicKey, options, callback) {
|
|
2895
|
-
if (typeof options === "function" && !callback) {
|
|
2896
|
-
callback = options;
|
|
2897
|
-
options = {};
|
|
2898
|
-
}
|
|
2899
|
-
if (!options) {
|
|
2900
|
-
options = {};
|
|
2901
|
-
}
|
|
2902
|
-
options = Object.assign({}, options);
|
|
2903
|
-
let done;
|
|
2904
|
-
if (callback) {
|
|
2905
|
-
done = callback;
|
|
2906
|
-
} else {
|
|
2907
|
-
done = function(err, data) {
|
|
2908
|
-
if (err)
|
|
2909
|
-
throw err;
|
|
2910
|
-
return data;
|
|
2911
|
-
};
|
|
2912
|
-
}
|
|
2913
|
-
if (options.clockTimestamp && typeof options.clockTimestamp !== "number") {
|
|
2914
|
-
return done(new JsonWebTokenError("clockTimestamp must be a number"));
|
|
2915
|
-
}
|
|
2916
|
-
if (options.nonce !== undefined && (typeof options.nonce !== "string" || options.nonce.trim() === "")) {
|
|
2917
|
-
return done(new JsonWebTokenError("nonce must be a non-empty string"));
|
|
2918
|
-
}
|
|
2919
|
-
if (options.allowInvalidAsymmetricKeyTypes !== undefined && typeof options.allowInvalidAsymmetricKeyTypes !== "boolean") {
|
|
2920
|
-
return done(new JsonWebTokenError("allowInvalidAsymmetricKeyTypes must be a boolean"));
|
|
2921
|
-
}
|
|
2922
|
-
const clockTimestamp = options.clockTimestamp || Math.floor(Date.now() / 1000);
|
|
2923
|
-
if (!jwtString) {
|
|
2924
|
-
return done(new JsonWebTokenError("jwt must be provided"));
|
|
2925
|
-
}
|
|
2926
|
-
if (typeof jwtString !== "string") {
|
|
2927
|
-
return done(new JsonWebTokenError("jwt must be a string"));
|
|
2928
|
-
}
|
|
2929
|
-
const parts = jwtString.split(".");
|
|
2930
|
-
if (parts.length !== 3) {
|
|
2931
|
-
return done(new JsonWebTokenError("jwt malformed"));
|
|
2932
|
-
}
|
|
2933
|
-
let decodedToken;
|
|
2934
|
-
try {
|
|
2935
|
-
decodedToken = decode(jwtString, { complete: true });
|
|
2936
|
-
} catch (err) {
|
|
2937
|
-
return done(err);
|
|
2938
|
-
}
|
|
2939
|
-
if (!decodedToken) {
|
|
2940
|
-
return done(new JsonWebTokenError("invalid token"));
|
|
2941
|
-
}
|
|
2942
|
-
const header = decodedToken.header;
|
|
2943
|
-
let getSecret;
|
|
2944
|
-
if (typeof secretOrPublicKey === "function") {
|
|
2945
|
-
if (!callback) {
|
|
2946
|
-
return done(new JsonWebTokenError("verify must be called asynchronous if secret or public key is provided as a callback"));
|
|
2947
|
-
}
|
|
2948
|
-
getSecret = secretOrPublicKey;
|
|
2949
|
-
} else {
|
|
2950
|
-
getSecret = function(header2, secretCallback) {
|
|
2951
|
-
return secretCallback(null, secretOrPublicKey);
|
|
2952
|
-
};
|
|
2953
|
-
}
|
|
2954
|
-
return getSecret(header, function(err, secretOrPublicKey2) {
|
|
2955
|
-
if (err) {
|
|
2956
|
-
return done(new JsonWebTokenError("error in secret or public key callback: " + err.message));
|
|
2957
|
-
}
|
|
2958
|
-
const hasSignature = parts[2].trim() !== "";
|
|
2959
|
-
if (!hasSignature && secretOrPublicKey2) {
|
|
2960
|
-
return done(new JsonWebTokenError("jwt signature is required"));
|
|
2961
|
-
}
|
|
2962
|
-
if (hasSignature && !secretOrPublicKey2) {
|
|
2963
|
-
return done(new JsonWebTokenError("secret or public key must be provided"));
|
|
2964
|
-
}
|
|
2965
|
-
if (!hasSignature && !options.algorithms) {
|
|
2966
|
-
return done(new JsonWebTokenError('please specify "none" in "algorithms" to verify unsigned tokens'));
|
|
2967
|
-
}
|
|
2968
|
-
if (secretOrPublicKey2 != null && !(secretOrPublicKey2 instanceof KeyObject)) {
|
|
2969
|
-
try {
|
|
2970
|
-
secretOrPublicKey2 = createPublicKey(secretOrPublicKey2);
|
|
2971
|
-
} catch (_) {
|
|
2972
|
-
try {
|
|
2973
|
-
secretOrPublicKey2 = createSecretKey(typeof secretOrPublicKey2 === "string" ? Buffer.from(secretOrPublicKey2) : secretOrPublicKey2);
|
|
2974
|
-
} catch (_2) {
|
|
2975
|
-
return done(new JsonWebTokenError("secretOrPublicKey is not valid key material"));
|
|
2976
|
-
}
|
|
2977
|
-
}
|
|
2978
|
-
}
|
|
2979
|
-
if (!options.algorithms) {
|
|
2980
|
-
if (secretOrPublicKey2.type === "secret") {
|
|
2981
|
-
options.algorithms = HS_ALGS;
|
|
2982
|
-
} else if (["rsa", "rsa-pss"].includes(secretOrPublicKey2.asymmetricKeyType)) {
|
|
2983
|
-
options.algorithms = RSA_KEY_ALGS;
|
|
2984
|
-
} else if (secretOrPublicKey2.asymmetricKeyType === "ec") {
|
|
2985
|
-
options.algorithms = EC_KEY_ALGS;
|
|
2986
|
-
} else {
|
|
2987
|
-
options.algorithms = PUB_KEY_ALGS;
|
|
2988
|
-
}
|
|
2989
|
-
}
|
|
2990
|
-
if (options.algorithms.indexOf(decodedToken.header.alg) === -1) {
|
|
2991
|
-
return done(new JsonWebTokenError("invalid algorithm"));
|
|
2992
|
-
}
|
|
2993
|
-
if (header.alg.startsWith("HS") && secretOrPublicKey2.type !== "secret") {
|
|
2994
|
-
return done(new JsonWebTokenError(`secretOrPublicKey must be a symmetric key when using ${header.alg}`));
|
|
2995
|
-
} else if (/^(?:RS|PS|ES)/.test(header.alg) && secretOrPublicKey2.type !== "public") {
|
|
2996
|
-
return done(new JsonWebTokenError(`secretOrPublicKey must be an asymmetric key when using ${header.alg}`));
|
|
2997
|
-
}
|
|
2998
|
-
if (!options.allowInvalidAsymmetricKeyTypes) {
|
|
2999
|
-
try {
|
|
3000
|
-
validateAsymmetricKey(header.alg, secretOrPublicKey2);
|
|
3001
|
-
} catch (e) {
|
|
3002
|
-
return done(e);
|
|
3003
|
-
}
|
|
3004
|
-
}
|
|
3005
|
-
let valid;
|
|
3006
|
-
try {
|
|
3007
|
-
valid = jws.verify(jwtString, decodedToken.header.alg, secretOrPublicKey2);
|
|
3008
|
-
} catch (e) {
|
|
3009
|
-
return done(e);
|
|
3010
|
-
}
|
|
3011
|
-
if (!valid) {
|
|
3012
|
-
return done(new JsonWebTokenError("invalid signature"));
|
|
3013
|
-
}
|
|
3014
|
-
const payload = decodedToken.payload;
|
|
3015
|
-
if (typeof payload.nbf !== "undefined" && !options.ignoreNotBefore) {
|
|
3016
|
-
if (typeof payload.nbf !== "number") {
|
|
3017
|
-
return done(new JsonWebTokenError("invalid nbf value"));
|
|
3018
|
-
}
|
|
3019
|
-
if (payload.nbf > clockTimestamp + (options.clockTolerance || 0)) {
|
|
3020
|
-
return done(new NotBeforeError("jwt not active", new Date(payload.nbf * 1000)));
|
|
3021
|
-
}
|
|
3022
|
-
}
|
|
3023
|
-
if (typeof payload.exp !== "undefined" && !options.ignoreExpiration) {
|
|
3024
|
-
if (typeof payload.exp !== "number") {
|
|
3025
|
-
return done(new JsonWebTokenError("invalid exp value"));
|
|
3026
|
-
}
|
|
3027
|
-
if (clockTimestamp >= payload.exp + (options.clockTolerance || 0)) {
|
|
3028
|
-
return done(new TokenExpiredError("jwt expired", new Date(payload.exp * 1000)));
|
|
3029
|
-
}
|
|
3030
|
-
}
|
|
3031
|
-
if (options.audience) {
|
|
3032
|
-
const audiences = Array.isArray(options.audience) ? options.audience : [options.audience];
|
|
3033
|
-
const target = Array.isArray(payload.aud) ? payload.aud : [payload.aud];
|
|
3034
|
-
const match = target.some(function(targetAudience) {
|
|
3035
|
-
return audiences.some(function(audience) {
|
|
3036
|
-
return audience instanceof RegExp ? audience.test(targetAudience) : audience === targetAudience;
|
|
3037
|
-
});
|
|
3038
|
-
});
|
|
3039
|
-
if (!match) {
|
|
3040
|
-
return done(new JsonWebTokenError("jwt audience invalid. expected: " + audiences.join(" or ")));
|
|
3041
|
-
}
|
|
3042
|
-
}
|
|
3043
|
-
if (options.issuer) {
|
|
3044
|
-
const invalid_issuer = typeof options.issuer === "string" && payload.iss !== options.issuer || Array.isArray(options.issuer) && options.issuer.indexOf(payload.iss) === -1;
|
|
3045
|
-
if (invalid_issuer) {
|
|
3046
|
-
return done(new JsonWebTokenError("jwt issuer invalid. expected: " + options.issuer));
|
|
3047
|
-
}
|
|
3048
|
-
}
|
|
3049
|
-
if (options.subject) {
|
|
3050
|
-
if (payload.sub !== options.subject) {
|
|
3051
|
-
return done(new JsonWebTokenError("jwt subject invalid. expected: " + options.subject));
|
|
3052
|
-
}
|
|
3053
|
-
}
|
|
3054
|
-
if (options.jwtid) {
|
|
3055
|
-
if (payload.jti !== options.jwtid) {
|
|
3056
|
-
return done(new JsonWebTokenError("jwt jwtid invalid. expected: " + options.jwtid));
|
|
3057
|
-
}
|
|
3058
|
-
}
|
|
3059
|
-
if (options.nonce) {
|
|
3060
|
-
if (payload.nonce !== options.nonce) {
|
|
3061
|
-
return done(new JsonWebTokenError("jwt nonce invalid. expected: " + options.nonce));
|
|
3062
|
-
}
|
|
3063
|
-
}
|
|
3064
|
-
if (options.maxAge) {
|
|
3065
|
-
if (typeof payload.iat !== "number") {
|
|
3066
|
-
return done(new JsonWebTokenError("iat required when maxAge is specified"));
|
|
3067
|
-
}
|
|
3068
|
-
const maxAgeTimestamp = timespan(options.maxAge, payload.iat);
|
|
3069
|
-
if (typeof maxAgeTimestamp === "undefined") {
|
|
3070
|
-
return done(new JsonWebTokenError('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));
|
|
3071
|
-
}
|
|
3072
|
-
if (clockTimestamp >= maxAgeTimestamp + (options.clockTolerance || 0)) {
|
|
3073
|
-
return done(new TokenExpiredError("maxAge exceeded", new Date(maxAgeTimestamp * 1000)));
|
|
3074
|
-
}
|
|
3075
|
-
}
|
|
3076
|
-
if (options.complete === true) {
|
|
3077
|
-
const signature = decodedToken.signature;
|
|
3078
|
-
return done(null, {
|
|
3079
|
-
header,
|
|
3080
|
-
payload,
|
|
3081
|
-
signature
|
|
3082
|
-
});
|
|
3083
|
-
}
|
|
3084
|
-
return done(null, payload);
|
|
3085
|
-
});
|
|
3086
|
-
};
|
|
3087
|
-
});
|
|
3088
|
-
|
|
3089
|
-
// ../../node_modules/.bun/lodash.includes@4.3.0/node_modules/lodash.includes/index.js
|
|
3090
|
-
var require_lodash = __commonJS((exports, module) => {
|
|
3091
|
-
var INFINITY = 1 / 0;
|
|
3092
|
-
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
3093
|
-
var MAX_INTEGER = 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;
|
|
3094
|
-
var NAN = 0 / 0;
|
|
3095
|
-
var argsTag = "[object Arguments]";
|
|
3096
|
-
var funcTag = "[object Function]";
|
|
3097
|
-
var genTag = "[object GeneratorFunction]";
|
|
3098
|
-
var stringTag = "[object String]";
|
|
3099
|
-
var symbolTag = "[object Symbol]";
|
|
3100
|
-
var reTrim = /^\s+|\s+$/g;
|
|
3101
|
-
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
3102
|
-
var reIsBinary = /^0b[01]+$/i;
|
|
3103
|
-
var reIsOctal = /^0o[0-7]+$/i;
|
|
3104
|
-
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
3105
|
-
var freeParseInt = parseInt;
|
|
3106
|
-
function arrayMap(array, iteratee) {
|
|
3107
|
-
var index = -1, length = array ? array.length : 0, result = Array(length);
|
|
3108
|
-
while (++index < length) {
|
|
3109
|
-
result[index] = iteratee(array[index], index, array);
|
|
3110
|
-
}
|
|
3111
|
-
return result;
|
|
3112
|
-
}
|
|
3113
|
-
function baseFindIndex(array, predicate, fromIndex, fromRight) {
|
|
3114
|
-
var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
|
|
3115
|
-
while (fromRight ? index-- : ++index < length) {
|
|
3116
|
-
if (predicate(array[index], index, array)) {
|
|
3117
|
-
return index;
|
|
3118
|
-
}
|
|
3119
|
-
}
|
|
3120
|
-
return -1;
|
|
3121
|
-
}
|
|
3122
|
-
function baseIndexOf(array, value, fromIndex) {
|
|
3123
|
-
if (value !== value) {
|
|
3124
|
-
return baseFindIndex(array, baseIsNaN, fromIndex);
|
|
3125
|
-
}
|
|
3126
|
-
var index = fromIndex - 1, length = array.length;
|
|
3127
|
-
while (++index < length) {
|
|
3128
|
-
if (array[index] === value) {
|
|
3129
|
-
return index;
|
|
3130
|
-
}
|
|
3131
|
-
}
|
|
3132
|
-
return -1;
|
|
3133
|
-
}
|
|
3134
|
-
function baseIsNaN(value) {
|
|
3135
|
-
return value !== value;
|
|
3136
|
-
}
|
|
3137
|
-
function baseTimes(n, iteratee) {
|
|
3138
|
-
var index = -1, result = Array(n);
|
|
3139
|
-
while (++index < n) {
|
|
3140
|
-
result[index] = iteratee(index);
|
|
3141
|
-
}
|
|
3142
|
-
return result;
|
|
3143
|
-
}
|
|
3144
|
-
function baseValues(object, props) {
|
|
3145
|
-
return arrayMap(props, function(key) {
|
|
3146
|
-
return object[key];
|
|
3147
|
-
});
|
|
3148
|
-
}
|
|
3149
|
-
function overArg(func, transform) {
|
|
3150
|
-
return function(arg) {
|
|
3151
|
-
return func(transform(arg));
|
|
3152
|
-
};
|
|
3153
|
-
}
|
|
3154
|
-
var objectProto = Object.prototype;
|
|
3155
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
3156
|
-
var objectToString = objectProto.toString;
|
|
3157
|
-
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
|
3158
|
-
var nativeKeys = overArg(Object.keys, Object);
|
|
3159
|
-
var nativeMax = Math.max;
|
|
3160
|
-
function arrayLikeKeys(value, inherited) {
|
|
3161
|
-
var result = isArray(value) || isArguments(value) ? baseTimes(value.length, String) : [];
|
|
3162
|
-
var length = result.length, skipIndexes = !!length;
|
|
3163
|
-
for (var key in value) {
|
|
3164
|
-
if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (key == "length" || isIndex(key, length)))) {
|
|
3165
|
-
result.push(key);
|
|
3166
|
-
}
|
|
3167
|
-
}
|
|
3168
|
-
return result;
|
|
3169
|
-
}
|
|
3170
|
-
function baseKeys(object) {
|
|
3171
|
-
if (!isPrototype(object)) {
|
|
3172
|
-
return nativeKeys(object);
|
|
3173
|
-
}
|
|
3174
|
-
var result = [];
|
|
3175
|
-
for (var key in Object(object)) {
|
|
3176
|
-
if (hasOwnProperty.call(object, key) && key != "constructor") {
|
|
3177
|
-
result.push(key);
|
|
3178
|
-
}
|
|
3179
|
-
}
|
|
3180
|
-
return result;
|
|
3181
|
-
}
|
|
3182
|
-
function isIndex(value, length) {
|
|
3183
|
-
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
3184
|
-
return !!length && (typeof value == "number" || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
|
|
3185
|
-
}
|
|
3186
|
-
function isPrototype(value) {
|
|
3187
|
-
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
|
|
3188
|
-
return value === proto;
|
|
3189
|
-
}
|
|
3190
|
-
function includes(collection, value, fromIndex, guard) {
|
|
3191
|
-
collection = isArrayLike(collection) ? collection : values(collection);
|
|
3192
|
-
fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
|
|
3193
|
-
var length = collection.length;
|
|
3194
|
-
if (fromIndex < 0) {
|
|
3195
|
-
fromIndex = nativeMax(length + fromIndex, 0);
|
|
3196
|
-
}
|
|
3197
|
-
return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
|
|
3198
|
-
}
|
|
3199
|
-
function isArguments(value) {
|
|
3200
|
-
return isArrayLikeObject(value) && hasOwnProperty.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag);
|
|
3201
|
-
}
|
|
3202
|
-
var isArray = Array.isArray;
|
|
3203
|
-
function isArrayLike(value) {
|
|
3204
|
-
return value != null && isLength(value.length) && !isFunction(value);
|
|
3205
|
-
}
|
|
3206
|
-
function isArrayLikeObject(value) {
|
|
3207
|
-
return isObjectLike(value) && isArrayLike(value);
|
|
3208
|
-
}
|
|
3209
|
-
function isFunction(value) {
|
|
3210
|
-
var tag = isObject(value) ? objectToString.call(value) : "";
|
|
3211
|
-
return tag == funcTag || tag == genTag;
|
|
3212
|
-
}
|
|
3213
|
-
function isLength(value) {
|
|
3214
|
-
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
3215
|
-
}
|
|
3216
|
-
function isObject(value) {
|
|
3217
|
-
var type = typeof value;
|
|
3218
|
-
return !!value && (type == "object" || type == "function");
|
|
3219
|
-
}
|
|
3220
|
-
function isObjectLike(value) {
|
|
3221
|
-
return !!value && typeof value == "object";
|
|
3222
|
-
}
|
|
3223
|
-
function isString(value) {
|
|
3224
|
-
return typeof value == "string" || !isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag;
|
|
3225
|
-
}
|
|
3226
|
-
function isSymbol(value) {
|
|
3227
|
-
return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag;
|
|
3228
|
-
}
|
|
3229
|
-
function toFinite(value) {
|
|
3230
|
-
if (!value) {
|
|
3231
|
-
return value === 0 ? value : 0;
|
|
3232
|
-
}
|
|
3233
|
-
value = toNumber(value);
|
|
3234
|
-
if (value === INFINITY || value === -INFINITY) {
|
|
3235
|
-
var sign = value < 0 ? -1 : 1;
|
|
3236
|
-
return sign * MAX_INTEGER;
|
|
3237
|
-
}
|
|
3238
|
-
return value === value ? value : 0;
|
|
3239
|
-
}
|
|
3240
|
-
function toInteger(value) {
|
|
3241
|
-
var result = toFinite(value), remainder = result % 1;
|
|
3242
|
-
return result === result ? remainder ? result - remainder : result : 0;
|
|
3243
|
-
}
|
|
3244
|
-
function toNumber(value) {
|
|
3245
|
-
if (typeof value == "number") {
|
|
3246
|
-
return value;
|
|
3247
|
-
}
|
|
3248
|
-
if (isSymbol(value)) {
|
|
3249
|
-
return NAN;
|
|
3250
|
-
}
|
|
3251
|
-
if (isObject(value)) {
|
|
3252
|
-
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
3253
|
-
value = isObject(other) ? other + "" : other;
|
|
3254
|
-
}
|
|
3255
|
-
if (typeof value != "string") {
|
|
3256
|
-
return value === 0 ? value : +value;
|
|
3257
|
-
}
|
|
3258
|
-
value = value.replace(reTrim, "");
|
|
3259
|
-
var isBinary = reIsBinary.test(value);
|
|
3260
|
-
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
3261
|
-
}
|
|
3262
|
-
function keys(object) {
|
|
3263
|
-
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
3264
|
-
}
|
|
3265
|
-
function values(object) {
|
|
3266
|
-
return object ? baseValues(object, keys(object)) : [];
|
|
3267
|
-
}
|
|
3268
|
-
module.exports = includes;
|
|
3269
|
-
});
|
|
3270
|
-
|
|
3271
|
-
// ../../node_modules/.bun/lodash.isboolean@3.0.3/node_modules/lodash.isboolean/index.js
|
|
3272
|
-
var require_lodash2 = __commonJS((exports, module) => {
|
|
3273
|
-
var boolTag = "[object Boolean]";
|
|
3274
|
-
var objectProto = Object.prototype;
|
|
3275
|
-
var objectToString = objectProto.toString;
|
|
3276
|
-
function isBoolean(value) {
|
|
3277
|
-
return value === true || value === false || isObjectLike(value) && objectToString.call(value) == boolTag;
|
|
3278
|
-
}
|
|
3279
|
-
function isObjectLike(value) {
|
|
3280
|
-
return !!value && typeof value == "object";
|
|
3281
|
-
}
|
|
3282
|
-
module.exports = isBoolean;
|
|
3283
|
-
});
|
|
3284
|
-
|
|
3285
|
-
// ../../node_modules/.bun/lodash.isinteger@4.0.4/node_modules/lodash.isinteger/index.js
|
|
3286
|
-
var require_lodash3 = __commonJS((exports, module) => {
|
|
3287
|
-
var INFINITY = 1 / 0;
|
|
3288
|
-
var MAX_INTEGER = 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;
|
|
3289
|
-
var NAN = 0 / 0;
|
|
3290
|
-
var symbolTag = "[object Symbol]";
|
|
3291
|
-
var reTrim = /^\s+|\s+$/g;
|
|
3292
|
-
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
3293
|
-
var reIsBinary = /^0b[01]+$/i;
|
|
3294
|
-
var reIsOctal = /^0o[0-7]+$/i;
|
|
3295
|
-
var freeParseInt = parseInt;
|
|
3296
|
-
var objectProto = Object.prototype;
|
|
3297
|
-
var objectToString = objectProto.toString;
|
|
3298
|
-
function isInteger(value) {
|
|
3299
|
-
return typeof value == "number" && value == toInteger(value);
|
|
3300
|
-
}
|
|
3301
|
-
function isObject(value) {
|
|
3302
|
-
var type = typeof value;
|
|
3303
|
-
return !!value && (type == "object" || type == "function");
|
|
3304
|
-
}
|
|
3305
|
-
function isObjectLike(value) {
|
|
3306
|
-
return !!value && typeof value == "object";
|
|
3307
|
-
}
|
|
3308
|
-
function isSymbol(value) {
|
|
3309
|
-
return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag;
|
|
3310
|
-
}
|
|
3311
|
-
function toFinite(value) {
|
|
3312
|
-
if (!value) {
|
|
3313
|
-
return value === 0 ? value : 0;
|
|
3314
|
-
}
|
|
3315
|
-
value = toNumber(value);
|
|
3316
|
-
if (value === INFINITY || value === -INFINITY) {
|
|
3317
|
-
var sign = value < 0 ? -1 : 1;
|
|
3318
|
-
return sign * MAX_INTEGER;
|
|
3319
|
-
}
|
|
3320
|
-
return value === value ? value : 0;
|
|
3321
|
-
}
|
|
3322
|
-
function toInteger(value) {
|
|
3323
|
-
var result = toFinite(value), remainder = result % 1;
|
|
3324
|
-
return result === result ? remainder ? result - remainder : result : 0;
|
|
3325
|
-
}
|
|
3326
|
-
function toNumber(value) {
|
|
3327
|
-
if (typeof value == "number") {
|
|
3328
|
-
return value;
|
|
3329
|
-
}
|
|
3330
|
-
if (isSymbol(value)) {
|
|
3331
|
-
return NAN;
|
|
3332
|
-
}
|
|
3333
|
-
if (isObject(value)) {
|
|
3334
|
-
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
3335
|
-
value = isObject(other) ? other + "" : other;
|
|
3336
|
-
}
|
|
3337
|
-
if (typeof value != "string") {
|
|
3338
|
-
return value === 0 ? value : +value;
|
|
3339
|
-
}
|
|
3340
|
-
value = value.replace(reTrim, "");
|
|
3341
|
-
var isBinary = reIsBinary.test(value);
|
|
3342
|
-
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
3343
|
-
}
|
|
3344
|
-
module.exports = isInteger;
|
|
3345
|
-
});
|
|
3346
|
-
|
|
3347
|
-
// ../../node_modules/.bun/lodash.isnumber@3.0.3/node_modules/lodash.isnumber/index.js
|
|
3348
|
-
var require_lodash4 = __commonJS((exports, module) => {
|
|
3349
|
-
var numberTag = "[object Number]";
|
|
3350
|
-
var objectProto = Object.prototype;
|
|
3351
|
-
var objectToString = objectProto.toString;
|
|
3352
|
-
function isObjectLike(value) {
|
|
3353
|
-
return !!value && typeof value == "object";
|
|
3354
|
-
}
|
|
3355
|
-
function isNumber(value) {
|
|
3356
|
-
return typeof value == "number" || isObjectLike(value) && objectToString.call(value) == numberTag;
|
|
3357
|
-
}
|
|
3358
|
-
module.exports = isNumber;
|
|
3359
|
-
});
|
|
3360
|
-
|
|
3361
|
-
// ../../node_modules/.bun/lodash.isplainobject@4.0.6/node_modules/lodash.isplainobject/index.js
|
|
3362
|
-
var require_lodash5 = __commonJS((exports, module) => {
|
|
3363
|
-
var objectTag = "[object Object]";
|
|
3364
|
-
function isHostObject(value) {
|
|
3365
|
-
var result = false;
|
|
3366
|
-
if (value != null && typeof value.toString != "function") {
|
|
3367
|
-
try {
|
|
3368
|
-
result = !!(value + "");
|
|
3369
|
-
} catch (e) {}
|
|
3370
|
-
}
|
|
3371
|
-
return result;
|
|
3372
|
-
}
|
|
3373
|
-
function overArg(func, transform) {
|
|
3374
|
-
return function(arg) {
|
|
3375
|
-
return func(transform(arg));
|
|
3376
|
-
};
|
|
3377
|
-
}
|
|
3378
|
-
var funcProto = Function.prototype;
|
|
3379
|
-
var objectProto = Object.prototype;
|
|
3380
|
-
var funcToString = funcProto.toString;
|
|
3381
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
3382
|
-
var objectCtorString = funcToString.call(Object);
|
|
3383
|
-
var objectToString = objectProto.toString;
|
|
3384
|
-
var getPrototype = overArg(Object.getPrototypeOf, Object);
|
|
3385
|
-
function isObjectLike(value) {
|
|
3386
|
-
return !!value && typeof value == "object";
|
|
3387
|
-
}
|
|
3388
|
-
function isPlainObject(value) {
|
|
3389
|
-
if (!isObjectLike(value) || objectToString.call(value) != objectTag || isHostObject(value)) {
|
|
3390
|
-
return false;
|
|
3391
|
-
}
|
|
3392
|
-
var proto = getPrototype(value);
|
|
3393
|
-
if (proto === null) {
|
|
3394
|
-
return true;
|
|
3395
|
-
}
|
|
3396
|
-
var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
|
3397
|
-
return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
|
|
3398
|
-
}
|
|
3399
|
-
module.exports = isPlainObject;
|
|
3400
|
-
});
|
|
3401
|
-
|
|
3402
|
-
// ../../node_modules/.bun/lodash.isstring@4.0.1/node_modules/lodash.isstring/index.js
|
|
3403
|
-
var require_lodash6 = __commonJS((exports, module) => {
|
|
3404
|
-
var stringTag = "[object String]";
|
|
3405
|
-
var objectProto = Object.prototype;
|
|
3406
|
-
var objectToString = objectProto.toString;
|
|
3407
|
-
var isArray = Array.isArray;
|
|
3408
|
-
function isObjectLike(value) {
|
|
3409
|
-
return !!value && typeof value == "object";
|
|
3410
|
-
}
|
|
3411
|
-
function isString(value) {
|
|
3412
|
-
return typeof value == "string" || !isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag;
|
|
3413
|
-
}
|
|
3414
|
-
module.exports = isString;
|
|
3415
|
-
});
|
|
3416
|
-
|
|
3417
|
-
// ../../node_modules/.bun/lodash.once@4.1.1/node_modules/lodash.once/index.js
|
|
3418
|
-
var require_lodash7 = __commonJS((exports, module) => {
|
|
3419
|
-
var FUNC_ERROR_TEXT = "Expected a function";
|
|
3420
|
-
var INFINITY = 1 / 0;
|
|
3421
|
-
var MAX_INTEGER = 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;
|
|
3422
|
-
var NAN = 0 / 0;
|
|
3423
|
-
var symbolTag = "[object Symbol]";
|
|
3424
|
-
var reTrim = /^\s+|\s+$/g;
|
|
3425
|
-
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
3426
|
-
var reIsBinary = /^0b[01]+$/i;
|
|
3427
|
-
var reIsOctal = /^0o[0-7]+$/i;
|
|
3428
|
-
var freeParseInt = parseInt;
|
|
3429
|
-
var objectProto = Object.prototype;
|
|
3430
|
-
var objectToString = objectProto.toString;
|
|
3431
|
-
function before(n, func) {
|
|
3432
|
-
var result;
|
|
3433
|
-
if (typeof func != "function") {
|
|
3434
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
3435
|
-
}
|
|
3436
|
-
n = toInteger(n);
|
|
3437
|
-
return function() {
|
|
3438
|
-
if (--n > 0) {
|
|
3439
|
-
result = func.apply(this, arguments);
|
|
3440
|
-
}
|
|
3441
|
-
if (n <= 1) {
|
|
3442
|
-
func = undefined;
|
|
3443
|
-
}
|
|
3444
|
-
return result;
|
|
3445
|
-
};
|
|
3446
|
-
}
|
|
3447
|
-
function once(func) {
|
|
3448
|
-
return before(2, func);
|
|
3449
|
-
}
|
|
3450
|
-
function isObject(value) {
|
|
3451
|
-
var type = typeof value;
|
|
3452
|
-
return !!value && (type == "object" || type == "function");
|
|
3453
|
-
}
|
|
3454
|
-
function isObjectLike(value) {
|
|
3455
|
-
return !!value && typeof value == "object";
|
|
3456
|
-
}
|
|
3457
|
-
function isSymbol(value) {
|
|
3458
|
-
return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag;
|
|
3459
|
-
}
|
|
3460
|
-
function toFinite(value) {
|
|
3461
|
-
if (!value) {
|
|
3462
|
-
return value === 0 ? value : 0;
|
|
3463
|
-
}
|
|
3464
|
-
value = toNumber(value);
|
|
3465
|
-
if (value === INFINITY || value === -INFINITY) {
|
|
3466
|
-
var sign = value < 0 ? -1 : 1;
|
|
3467
|
-
return sign * MAX_INTEGER;
|
|
3468
|
-
}
|
|
3469
|
-
return value === value ? value : 0;
|
|
3470
|
-
}
|
|
3471
|
-
function toInteger(value) {
|
|
3472
|
-
var result = toFinite(value), remainder = result % 1;
|
|
3473
|
-
return result === result ? remainder ? result - remainder : result : 0;
|
|
3474
|
-
}
|
|
3475
|
-
function toNumber(value) {
|
|
3476
|
-
if (typeof value == "number") {
|
|
3477
|
-
return value;
|
|
3478
|
-
}
|
|
3479
|
-
if (isSymbol(value)) {
|
|
3480
|
-
return NAN;
|
|
3481
|
-
}
|
|
3482
|
-
if (isObject(value)) {
|
|
3483
|
-
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
3484
|
-
value = isObject(other) ? other + "" : other;
|
|
3485
|
-
}
|
|
3486
|
-
if (typeof value != "string") {
|
|
3487
|
-
return value === 0 ? value : +value;
|
|
3488
|
-
}
|
|
3489
|
-
value = value.replace(reTrim, "");
|
|
3490
|
-
var isBinary = reIsBinary.test(value);
|
|
3491
|
-
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
3492
|
-
}
|
|
3493
|
-
module.exports = once;
|
|
3494
|
-
});
|
|
3495
|
-
|
|
3496
|
-
// ../../node_modules/.bun/jsonwebtoken@9.0.3/node_modules/jsonwebtoken/sign.js
|
|
3497
|
-
var require_sign = __commonJS((exports, module) => {
|
|
3498
|
-
var timespan = require_timespan();
|
|
3499
|
-
var PS_SUPPORTED = require_psSupported();
|
|
3500
|
-
var validateAsymmetricKey = require_validateAsymmetricKey();
|
|
3501
|
-
var jws = require_jws();
|
|
3502
|
-
var includes = require_lodash();
|
|
3503
|
-
var isBoolean = require_lodash2();
|
|
3504
|
-
var isInteger = require_lodash3();
|
|
3505
|
-
var isNumber = require_lodash4();
|
|
3506
|
-
var isPlainObject = require_lodash5();
|
|
3507
|
-
var isString = require_lodash6();
|
|
3508
|
-
var once = require_lodash7();
|
|
3509
|
-
var { KeyObject, createSecretKey, createPrivateKey } = __require("crypto");
|
|
3510
|
-
var SUPPORTED_ALGS = ["RS256", "RS384", "RS512", "ES256", "ES384", "ES512", "HS256", "HS384", "HS512", "none"];
|
|
3511
|
-
if (PS_SUPPORTED) {
|
|
3512
|
-
SUPPORTED_ALGS.splice(3, 0, "PS256", "PS384", "PS512");
|
|
3513
|
-
}
|
|
3514
|
-
var sign_options_schema = {
|
|
3515
|
-
expiresIn: { isValid: function(value) {
|
|
3516
|
-
return isInteger(value) || isString(value) && value;
|
|
3517
|
-
}, message: '"expiresIn" should be a number of seconds or string representing a timespan' },
|
|
3518
|
-
notBefore: { isValid: function(value) {
|
|
3519
|
-
return isInteger(value) || isString(value) && value;
|
|
3520
|
-
}, message: '"notBefore" should be a number of seconds or string representing a timespan' },
|
|
3521
|
-
audience: { isValid: function(value) {
|
|
3522
|
-
return isString(value) || Array.isArray(value);
|
|
3523
|
-
}, message: '"audience" must be a string or array' },
|
|
3524
|
-
algorithm: { isValid: includes.bind(null, SUPPORTED_ALGS), message: '"algorithm" must be a valid string enum value' },
|
|
3525
|
-
header: { isValid: isPlainObject, message: '"header" must be an object' },
|
|
3526
|
-
encoding: { isValid: isString, message: '"encoding" must be a string' },
|
|
3527
|
-
issuer: { isValid: isString, message: '"issuer" must be a string' },
|
|
3528
|
-
subject: { isValid: isString, message: '"subject" must be a string' },
|
|
3529
|
-
jwtid: { isValid: isString, message: '"jwtid" must be a string' },
|
|
3530
|
-
noTimestamp: { isValid: isBoolean, message: '"noTimestamp" must be a boolean' },
|
|
3531
|
-
keyid: { isValid: isString, message: '"keyid" must be a string' },
|
|
3532
|
-
mutatePayload: { isValid: isBoolean, message: '"mutatePayload" must be a boolean' },
|
|
3533
|
-
allowInsecureKeySizes: { isValid: isBoolean, message: '"allowInsecureKeySizes" must be a boolean' },
|
|
3534
|
-
allowInvalidAsymmetricKeyTypes: { isValid: isBoolean, message: '"allowInvalidAsymmetricKeyTypes" must be a boolean' }
|
|
3535
|
-
};
|
|
3536
|
-
var registered_claims_schema = {
|
|
3537
|
-
iat: { isValid: isNumber, message: '"iat" should be a number of seconds' },
|
|
3538
|
-
exp: { isValid: isNumber, message: '"exp" should be a number of seconds' },
|
|
3539
|
-
nbf: { isValid: isNumber, message: '"nbf" should be a number of seconds' }
|
|
3540
|
-
};
|
|
3541
|
-
function validate(schema, allowUnknown, object, parameterName) {
|
|
3542
|
-
if (!isPlainObject(object)) {
|
|
3543
|
-
throw new Error('Expected "' + parameterName + '" to be a plain object.');
|
|
3544
|
-
}
|
|
3545
|
-
Object.keys(object).forEach(function(key) {
|
|
3546
|
-
const validator = schema[key];
|
|
3547
|
-
if (!validator) {
|
|
3548
|
-
if (!allowUnknown) {
|
|
3549
|
-
throw new Error('"' + key + '" is not allowed in "' + parameterName + '"');
|
|
3550
|
-
}
|
|
3551
|
-
return;
|
|
3552
|
-
}
|
|
3553
|
-
if (!validator.isValid(object[key])) {
|
|
3554
|
-
throw new Error(validator.message);
|
|
3555
|
-
}
|
|
3556
|
-
});
|
|
3557
|
-
}
|
|
3558
|
-
function validateOptions(options) {
|
|
3559
|
-
return validate(sign_options_schema, false, options, "options");
|
|
3560
|
-
}
|
|
3561
|
-
function validatePayload(payload) {
|
|
3562
|
-
return validate(registered_claims_schema, true, payload, "payload");
|
|
3563
|
-
}
|
|
3564
|
-
var options_to_payload = {
|
|
3565
|
-
audience: "aud",
|
|
3566
|
-
issuer: "iss",
|
|
3567
|
-
subject: "sub",
|
|
3568
|
-
jwtid: "jti"
|
|
3569
|
-
};
|
|
3570
|
-
var options_for_objects = [
|
|
3571
|
-
"expiresIn",
|
|
3572
|
-
"notBefore",
|
|
3573
|
-
"noTimestamp",
|
|
3574
|
-
"audience",
|
|
3575
|
-
"issuer",
|
|
3576
|
-
"subject",
|
|
3577
|
-
"jwtid"
|
|
3578
|
-
];
|
|
3579
|
-
module.exports = function(payload, secretOrPrivateKey, options, callback) {
|
|
3580
|
-
if (typeof options === "function") {
|
|
3581
|
-
callback = options;
|
|
3582
|
-
options = {};
|
|
3583
|
-
} else {
|
|
3584
|
-
options = options || {};
|
|
3585
|
-
}
|
|
3586
|
-
const isObjectPayload = typeof payload === "object" && !Buffer.isBuffer(payload);
|
|
3587
|
-
const header = Object.assign({
|
|
3588
|
-
alg: options.algorithm || "HS256",
|
|
3589
|
-
typ: isObjectPayload ? "JWT" : undefined,
|
|
3590
|
-
kid: options.keyid
|
|
3591
|
-
}, options.header);
|
|
3592
|
-
function failure(err) {
|
|
3593
|
-
if (callback) {
|
|
3594
|
-
return callback(err);
|
|
3595
|
-
}
|
|
3596
|
-
throw err;
|
|
3597
|
-
}
|
|
3598
|
-
if (!secretOrPrivateKey && options.algorithm !== "none") {
|
|
3599
|
-
return failure(new Error("secretOrPrivateKey must have a value"));
|
|
3600
|
-
}
|
|
3601
|
-
if (secretOrPrivateKey != null && !(secretOrPrivateKey instanceof KeyObject)) {
|
|
3602
|
-
try {
|
|
3603
|
-
secretOrPrivateKey = createPrivateKey(secretOrPrivateKey);
|
|
3604
|
-
} catch (_) {
|
|
3605
|
-
try {
|
|
3606
|
-
secretOrPrivateKey = createSecretKey(typeof secretOrPrivateKey === "string" ? Buffer.from(secretOrPrivateKey) : secretOrPrivateKey);
|
|
3607
|
-
} catch (_2) {
|
|
3608
|
-
return failure(new Error("secretOrPrivateKey is not valid key material"));
|
|
3609
|
-
}
|
|
3610
|
-
}
|
|
3611
|
-
}
|
|
3612
|
-
if (header.alg.startsWith("HS") && secretOrPrivateKey.type !== "secret") {
|
|
3613
|
-
return failure(new Error(`secretOrPrivateKey must be a symmetric key when using ${header.alg}`));
|
|
3614
|
-
} else if (/^(?:RS|PS|ES)/.test(header.alg)) {
|
|
3615
|
-
if (secretOrPrivateKey.type !== "private") {
|
|
3616
|
-
return failure(new Error(`secretOrPrivateKey must be an asymmetric key when using ${header.alg}`));
|
|
3617
|
-
}
|
|
3618
|
-
if (!options.allowInsecureKeySizes && !header.alg.startsWith("ES") && secretOrPrivateKey.asymmetricKeyDetails !== undefined && secretOrPrivateKey.asymmetricKeyDetails.modulusLength < 2048) {
|
|
3619
|
-
return failure(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${header.alg}`));
|
|
3620
|
-
}
|
|
3621
|
-
}
|
|
3622
|
-
if (typeof payload === "undefined") {
|
|
3623
|
-
return failure(new Error("payload is required"));
|
|
3624
|
-
} else if (isObjectPayload) {
|
|
3625
|
-
try {
|
|
3626
|
-
validatePayload(payload);
|
|
3627
|
-
} catch (error) {
|
|
3628
|
-
return failure(error);
|
|
3629
|
-
}
|
|
3630
|
-
if (!options.mutatePayload) {
|
|
3631
|
-
payload = Object.assign({}, payload);
|
|
3632
|
-
}
|
|
3633
|
-
} else {
|
|
3634
|
-
const invalid_options = options_for_objects.filter(function(opt) {
|
|
3635
|
-
return typeof options[opt] !== "undefined";
|
|
3636
|
-
});
|
|
3637
|
-
if (invalid_options.length > 0) {
|
|
3638
|
-
return failure(new Error("invalid " + invalid_options.join(",") + " option for " + typeof payload + " payload"));
|
|
3639
|
-
}
|
|
3640
|
-
}
|
|
3641
|
-
if (typeof payload.exp !== "undefined" && typeof options.expiresIn !== "undefined") {
|
|
3642
|
-
return failure(new Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));
|
|
3643
|
-
}
|
|
3644
|
-
if (typeof payload.nbf !== "undefined" && typeof options.notBefore !== "undefined") {
|
|
3645
|
-
return failure(new Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));
|
|
3646
|
-
}
|
|
3647
|
-
try {
|
|
3648
|
-
validateOptions(options);
|
|
3649
|
-
} catch (error) {
|
|
3650
|
-
return failure(error);
|
|
3651
|
-
}
|
|
3652
|
-
if (!options.allowInvalidAsymmetricKeyTypes) {
|
|
3653
|
-
try {
|
|
3654
|
-
validateAsymmetricKey(header.alg, secretOrPrivateKey);
|
|
3655
|
-
} catch (error) {
|
|
3656
|
-
return failure(error);
|
|
3657
|
-
}
|
|
3658
|
-
}
|
|
3659
|
-
const timestamp = payload.iat || Math.floor(Date.now() / 1000);
|
|
3660
|
-
if (options.noTimestamp) {
|
|
3661
|
-
delete payload.iat;
|
|
3662
|
-
} else if (isObjectPayload) {
|
|
3663
|
-
payload.iat = timestamp;
|
|
3664
|
-
}
|
|
3665
|
-
if (typeof options.notBefore !== "undefined") {
|
|
3666
|
-
try {
|
|
3667
|
-
payload.nbf = timespan(options.notBefore, timestamp);
|
|
3668
|
-
} catch (err) {
|
|
3669
|
-
return failure(err);
|
|
3670
|
-
}
|
|
3671
|
-
if (typeof payload.nbf === "undefined") {
|
|
3672
|
-
return failure(new Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));
|
|
3673
|
-
}
|
|
3674
|
-
}
|
|
3675
|
-
if (typeof options.expiresIn !== "undefined" && typeof payload === "object") {
|
|
3676
|
-
try {
|
|
3677
|
-
payload.exp = timespan(options.expiresIn, timestamp);
|
|
3678
|
-
} catch (err) {
|
|
3679
|
-
return failure(err);
|
|
3680
|
-
}
|
|
3681
|
-
if (typeof payload.exp === "undefined") {
|
|
3682
|
-
return failure(new Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));
|
|
3683
|
-
}
|
|
3684
|
-
}
|
|
3685
|
-
Object.keys(options_to_payload).forEach(function(key) {
|
|
3686
|
-
const claim = options_to_payload[key];
|
|
3687
|
-
if (typeof options[key] !== "undefined") {
|
|
3688
|
-
if (typeof payload[claim] !== "undefined") {
|
|
3689
|
-
return failure(new Error('Bad "options.' + key + '" option. The payload already has an "' + claim + '" property.'));
|
|
3690
|
-
}
|
|
3691
|
-
payload[claim] = options[key];
|
|
3692
|
-
}
|
|
3693
|
-
});
|
|
3694
|
-
const encoding = options.encoding || "utf8";
|
|
3695
|
-
if (typeof callback === "function") {
|
|
3696
|
-
callback = callback && once(callback);
|
|
3697
|
-
jws.createSign({
|
|
3698
|
-
header,
|
|
3699
|
-
privateKey: secretOrPrivateKey,
|
|
3700
|
-
payload,
|
|
3701
|
-
encoding
|
|
3702
|
-
}).once("error", callback).once("done", function(signature) {
|
|
3703
|
-
if (!options.allowInsecureKeySizes && /^(?:RS|PS)/.test(header.alg) && signature.length < 256) {
|
|
3704
|
-
return callback(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${header.alg}`));
|
|
3705
|
-
}
|
|
3706
|
-
callback(null, signature);
|
|
3707
|
-
});
|
|
3708
|
-
} else {
|
|
3709
|
-
let signature = jws.sign({ header, payload, secret: secretOrPrivateKey, encoding });
|
|
3710
|
-
if (!options.allowInsecureKeySizes && /^(?:RS|PS)/.test(header.alg) && signature.length < 256) {
|
|
3711
|
-
throw new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${header.alg}`);
|
|
3712
|
-
}
|
|
3713
|
-
return signature;
|
|
3714
|
-
}
|
|
3715
|
-
};
|
|
3716
|
-
});
|
|
3717
|
-
|
|
3718
|
-
// ../../node_modules/.bun/jsonwebtoken@9.0.3/node_modules/jsonwebtoken/index.js
|
|
3719
|
-
var require_jsonwebtoken = __commonJS((exports, module) => {
|
|
3720
|
-
module.exports = {
|
|
3721
|
-
decode: require_decode(),
|
|
3722
|
-
verify: require_verify(),
|
|
3723
|
-
sign: require_sign(),
|
|
3724
|
-
JsonWebTokenError: require_JsonWebTokenError(),
|
|
3725
|
-
NotBeforeError: require_NotBeforeError(),
|
|
3726
|
-
TokenExpiredError: require_TokenExpiredError()
|
|
3727
|
-
};
|
|
3728
|
-
});
|
|
3729
|
-
|
|
3730
|
-
// src/create-server.ts
|
|
3731
|
-
var import_jsonwebtoken = __toESM(require_jsonwebtoken(), 1);
|
|
3732
|
-
|
|
3733
2
|
// src/connection-manager.ts
|
|
3734
3
|
class ConnectionManager {
|
|
3735
4
|
clients = new Map;
|
|
@@ -3809,10 +78,12 @@ class ConnectionManager {
|
|
|
3809
78
|
|
|
3810
79
|
// src/context-handler.ts
|
|
3811
80
|
import {
|
|
81
|
+
ArcAuthorizationError,
|
|
3812
82
|
LocalEventPublisher,
|
|
3813
83
|
MasterDataStorage,
|
|
3814
84
|
Model,
|
|
3815
85
|
ScopedModel,
|
|
86
|
+
collectTokens,
|
|
3816
87
|
mutationExecutor
|
|
3817
88
|
} from "@arcote.tech/arc";
|
|
3818
89
|
|
|
@@ -3864,6 +135,9 @@ function canTokenEmitEvent(token, event, payload) {
|
|
|
3864
135
|
}
|
|
3865
136
|
function checkConditionsMatch(conditions, data) {
|
|
3866
137
|
for (const [key, expectedValue] of Object.entries(conditions)) {
|
|
138
|
+
if (expectedValue === undefined) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
3867
141
|
const actualValue = data[key];
|
|
3868
142
|
if (actualValue !== expectedValue) {
|
|
3869
143
|
return false;
|
|
@@ -3900,6 +174,7 @@ class ContextHandler {
|
|
|
3900
174
|
dataStorage;
|
|
3901
175
|
eventPublisher;
|
|
3902
176
|
eventDefinitions = new Map;
|
|
177
|
+
tokenRegistry = new Map;
|
|
3903
178
|
hostEventIdCounter = 0;
|
|
3904
179
|
initialized = false;
|
|
3905
180
|
constructor(context, dbAdapter, telemetry) {
|
|
@@ -3919,6 +194,38 @@ class ContextHandler {
|
|
|
3919
194
|
this.eventDefinitions.set(element.name, element);
|
|
3920
195
|
}
|
|
3921
196
|
}
|
|
197
|
+
for (const tok of collectTokens(context)) {
|
|
198
|
+
this.tokenRegistry.set(tok.name, tok);
|
|
199
|
+
if (!tok.hasSecret) {
|
|
200
|
+
console.error(`[ARC] SECURITY: token "${tok.name}" has no secret configured \u2014 its JWTs cannot be verified and will be rejected. Set .secret(process.env.\u2026).`);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
async verifyToken(token) {
|
|
205
|
+
let tokenName;
|
|
206
|
+
try {
|
|
207
|
+
const parts = token.split(".");
|
|
208
|
+
if (parts.length !== 3)
|
|
209
|
+
return null;
|
|
210
|
+
const payload = JSON.parse(atob(parts[1].replace(/-/g, "+").replace(/_/g, "/")));
|
|
211
|
+
tokenName = payload?.tokenName;
|
|
212
|
+
} catch {
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
if (!tokenName)
|
|
216
|
+
return null;
|
|
217
|
+
const def = this.tokenRegistry.get(tokenName);
|
|
218
|
+
if (!def)
|
|
219
|
+
return null;
|
|
220
|
+
const verified = await def.verifyJWT(token);
|
|
221
|
+
if (!verified)
|
|
222
|
+
return null;
|
|
223
|
+
return {
|
|
224
|
+
tokenType: verified.tokenName,
|
|
225
|
+
params: verified.params || {},
|
|
226
|
+
iat: verified.iat,
|
|
227
|
+
exp: verified.exp
|
|
228
|
+
};
|
|
3922
229
|
}
|
|
3923
230
|
async init() {
|
|
3924
231
|
if (this.initialized)
|
|
@@ -3977,7 +284,7 @@ class ContextHandler {
|
|
|
3977
284
|
throw new Error(`Command '${commandName}' not found`);
|
|
3978
285
|
}
|
|
3979
286
|
if (!options?.internal && command.__isPrivate) {
|
|
3980
|
-
throw new
|
|
287
|
+
throw new ArcAuthorizationError(`Command '${commandName}' is private and not callable from a client.`);
|
|
3981
288
|
}
|
|
3982
289
|
try {
|
|
3983
290
|
return await command(params);
|
|
@@ -4000,6 +307,66 @@ class ContextHandler {
|
|
|
4000
307
|
});
|
|
4001
308
|
}
|
|
4002
309
|
}
|
|
310
|
+
async executeRoute(routeName, options, rawToken) {
|
|
311
|
+
const element = this.context.get(routeName);
|
|
312
|
+
if (!element || typeof element.getHandler !== "function") {
|
|
313
|
+
return Response.json({ error: "Route not found" }, { status: 404 });
|
|
314
|
+
}
|
|
315
|
+
const method = options.method ?? "POST";
|
|
316
|
+
const handler = element.getHandler(method);
|
|
317
|
+
if (!handler) {
|
|
318
|
+
return Response.json({ error: `Method ${method} not allowed` }, { status: 405 });
|
|
319
|
+
}
|
|
320
|
+
const tokenPayload = rawToken ? await this.verifyToken(rawToken) : null;
|
|
321
|
+
if (rawToken && !tokenPayload) {
|
|
322
|
+
return Response.json({ error: "Unauthorized" }, { status: 401 });
|
|
323
|
+
}
|
|
324
|
+
if (!element.isPublic && element.hasProtections) {
|
|
325
|
+
if (!tokenPayload) {
|
|
326
|
+
return Response.json({ error: "Unauthorized" }, { status: 401 });
|
|
327
|
+
}
|
|
328
|
+
let isAuthorized = false;
|
|
329
|
+
for (const protection of element.protections) {
|
|
330
|
+
if (protection.token.name === tokenPayload.tokenType) {
|
|
331
|
+
const mockTokenInstance = {
|
|
332
|
+
params: tokenPayload.params,
|
|
333
|
+
getTokenDefinition: () => protection.token
|
|
334
|
+
};
|
|
335
|
+
if (await protection.check(mockTokenInstance)) {
|
|
336
|
+
isAuthorized = true;
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
if (!isAuthorized) {
|
|
342
|
+
return Response.json({ error: "Forbidden" }, { status: 403 });
|
|
343
|
+
}
|
|
344
|
+
} else if (!element.isPublic && !element.hasProtections) {
|
|
345
|
+
if (!tokenPayload) {
|
|
346
|
+
return Response.json({ error: "Unauthorized" }, { status: 401 });
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
const scoped = new ScopedModel(this.model, "request");
|
|
350
|
+
if (rawToken)
|
|
351
|
+
scoped.setToken(rawToken);
|
|
352
|
+
const authParams = tokenPayload ? { params: tokenPayload.params, tokenName: tokenPayload.tokenType } : undefined;
|
|
353
|
+
const routeContext = element.buildContext(scoped.getAdapters(), authParams);
|
|
354
|
+
const url = new URL(`http://harness.local${element.fullPath}`);
|
|
355
|
+
if (options.query) {
|
|
356
|
+
for (const [k, v] of Object.entries(options.query)) {
|
|
357
|
+
url.searchParams.set(k, v);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
const headers = new Headers(options.headers ?? {});
|
|
361
|
+
if (!headers.has("Content-Type"))
|
|
362
|
+
headers.set("Content-Type", "application/json");
|
|
363
|
+
const req = new Request(url, {
|
|
364
|
+
method,
|
|
365
|
+
headers,
|
|
366
|
+
body: method === "GET" || options.body == null ? undefined : JSON.stringify(options.body)
|
|
367
|
+
});
|
|
368
|
+
return handler(routeContext, req, {}, url);
|
|
369
|
+
}
|
|
4003
370
|
async persistEvents(events, clientId, token) {
|
|
4004
371
|
const persistedEvents = [];
|
|
4005
372
|
for (const event of events) {
|
|
@@ -4598,7 +965,18 @@ class CronScheduler {
|
|
|
4598
965
|
}
|
|
4599
966
|
|
|
4600
967
|
// src/middleware/http.ts
|
|
4601
|
-
import { ScopedModel as ScopedModel2 } from "@arcote.tech/arc";
|
|
968
|
+
import { ArcValidationError, arcErrorStatus, ScopedModel as ScopedModel2 } from "@arcote.tech/arc";
|
|
969
|
+
function errorBody(error) {
|
|
970
|
+
const status = arcErrorStatus(error) ?? 500;
|
|
971
|
+
if (error instanceof ArcValidationError) {
|
|
972
|
+
return { status, body: { error: "Invalid parameters", fields: error.fields } };
|
|
973
|
+
}
|
|
974
|
+
if (status === 401)
|
|
975
|
+
return { status, body: { error: "Unauthorized" } };
|
|
976
|
+
if (status === 403)
|
|
977
|
+
return { status, body: { error: "Forbidden" } };
|
|
978
|
+
return { status: 500, body: { error: "Internal server error" } };
|
|
979
|
+
}
|
|
4602
980
|
async function parseCommandParams(req) {
|
|
4603
981
|
const contentType = req.headers.get("Content-Type") || "";
|
|
4604
982
|
if (contentType.includes("multipart/form-data")) {
|
|
@@ -4644,8 +1022,11 @@ function commandHandler(ch) {
|
|
|
4644
1022
|
headers: ctx.corsHeaders
|
|
4645
1023
|
});
|
|
4646
1024
|
} catch (error) {
|
|
4647
|
-
|
|
4648
|
-
|
|
1025
|
+
const { status, body } = errorBody(error);
|
|
1026
|
+
if (status === 500) {
|
|
1027
|
+
console.error(`[ARC] Command '${commandName}' error:`, error);
|
|
1028
|
+
}
|
|
1029
|
+
return Response.json(body, { status, headers: ctx.corsHeaders });
|
|
4649
1030
|
}
|
|
4650
1031
|
};
|
|
4651
1032
|
}
|
|
@@ -4673,7 +1054,10 @@ function queryHandler(ch) {
|
|
|
4673
1054
|
const result = await queryCtx.find(params);
|
|
4674
1055
|
return Response.json(result, { headers: ctx.corsHeaders });
|
|
4675
1056
|
} catch (error) {
|
|
4676
|
-
|
|
1057
|
+
const { status, body } = errorBody(error);
|
|
1058
|
+
if (status === 500)
|
|
1059
|
+
console.error(`[ARC] Query error:`, error);
|
|
1060
|
+
return Response.json(body, { status, headers: ctx.corsHeaders });
|
|
4677
1061
|
}
|
|
4678
1062
|
};
|
|
4679
1063
|
}
|
|
@@ -4692,7 +1076,10 @@ function eventSyncHandler(ch) {
|
|
|
4692
1076
|
})), "http-sync", ctx.tokenPayload);
|
|
4693
1077
|
return Response.json({ success: true, syncedIds: persisted.map((e) => e.localId) }, { headers: ctx.corsHeaders });
|
|
4694
1078
|
} catch (error) {
|
|
4695
|
-
|
|
1079
|
+
const { status, body } = errorBody(error);
|
|
1080
|
+
if (status === 500)
|
|
1081
|
+
console.error(`[ARC] Event sync error:`, error);
|
|
1082
|
+
return Response.json({ success: false, ...body }, { status, headers: ctx.corsHeaders });
|
|
4696
1083
|
}
|
|
4697
1084
|
};
|
|
4698
1085
|
}
|
|
@@ -4768,7 +1155,10 @@ function routeHandler(ch) {
|
|
|
4768
1155
|
headers: newHeaders
|
|
4769
1156
|
});
|
|
4770
1157
|
} catch (error) {
|
|
4771
|
-
|
|
1158
|
+
const { status, body: errBody } = errorBody(error);
|
|
1159
|
+
if (status === 500)
|
|
1160
|
+
console.error(`[ARC] Route error:`, error);
|
|
1161
|
+
return Response.json(errBody, { status, headers: ctx.corsHeaders });
|
|
4772
1162
|
}
|
|
4773
1163
|
};
|
|
4774
1164
|
}
|
|
@@ -4796,7 +1186,7 @@ function scopeAuthHandler() {
|
|
|
4796
1186
|
return async (client, message, ctx) => {
|
|
4797
1187
|
if (message.type !== "scope:auth")
|
|
4798
1188
|
return false;
|
|
4799
|
-
const decoded = ctx.verifyToken(message.token);
|
|
1189
|
+
const decoded = await ctx.verifyToken(message.token);
|
|
4800
1190
|
if (decoded) {
|
|
4801
1191
|
ctx.connectionManager.setScopeToken(client.id, message.scope, decoded, message.token);
|
|
4802
1192
|
}
|
|
@@ -4960,7 +1350,6 @@ function arcWsHandlers() {
|
|
|
4960
1350
|
}
|
|
4961
1351
|
// src/create-server.ts
|
|
4962
1352
|
async function createArcServer(config) {
|
|
4963
|
-
const jwtSecret = config.jwtSecret || process.env.JWT_SECRET || "arc-host-secret-change-in-production";
|
|
4964
1353
|
const port = config.port || 5005;
|
|
4965
1354
|
const dbAdapter = config.dbAdapterFactory(config.context);
|
|
4966
1355
|
const contextHandler = new ContextHandler(config.context, dbAdapter, config.telemetry);
|
|
@@ -4969,48 +1358,39 @@ async function createArcServer(config) {
|
|
|
4969
1358
|
cronScheduler.start();
|
|
4970
1359
|
const connectionManager = new ConnectionManager;
|
|
4971
1360
|
const coep = config.coep ?? "unsafe-none";
|
|
1361
|
+
const corsOrigins = config.corsOrigins;
|
|
1362
|
+
const maxRequestBodySize = config.maxRequestBodySize ?? 10 * 1024 * 1024;
|
|
1363
|
+
const securityHeaders = {
|
|
1364
|
+
"X-Content-Type-Options": "nosniff",
|
|
1365
|
+
"X-Frame-Options": "DENY",
|
|
1366
|
+
"Referrer-Policy": "no-referrer",
|
|
1367
|
+
...config.securityHeaders ?? {}
|
|
1368
|
+
};
|
|
4972
1369
|
function buildCorsHeaders(req) {
|
|
4973
|
-
const origin = req?.headers.get("Origin") ||
|
|
4974
|
-
|
|
4975
|
-
"Access-Control-Allow-Origin": origin,
|
|
1370
|
+
const origin = req?.headers.get("Origin") || null;
|
|
1371
|
+
const headers = {
|
|
4976
1372
|
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
|
|
4977
1373
|
"Access-Control-Allow-Headers": "Content-Type, Authorization, X-Arc-Scope, X-Arc-Tokens",
|
|
4978
|
-
"Access-Control-Allow-Credentials": "true",
|
|
4979
1374
|
"Cross-Origin-Opener-Policy": "same-origin",
|
|
4980
1375
|
"Cross-Origin-Embedder-Policy": coep,
|
|
4981
|
-
"Cross-Origin-Resource-Policy": "cross-origin"
|
|
1376
|
+
"Cross-Origin-Resource-Policy": "cross-origin",
|
|
1377
|
+
...securityHeaders
|
|
4982
1378
|
};
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
if (decoded.tokenName && !decoded.tokenType) {
|
|
4989
|
-
return {
|
|
4990
|
-
tokenType: decoded.tokenName,
|
|
4991
|
-
params: decoded.params || {},
|
|
4992
|
-
iat: decoded.iat,
|
|
4993
|
-
exp: decoded.exp
|
|
4994
|
-
};
|
|
4995
|
-
}
|
|
4996
|
-
return decoded;
|
|
4997
|
-
} catch {
|
|
4998
|
-
try {
|
|
4999
|
-
const parts = token.split(".");
|
|
5000
|
-
if (parts.length !== 3)
|
|
5001
|
-
return null;
|
|
5002
|
-
const payload = JSON.parse(atob(parts[1]));
|
|
5003
|
-
return {
|
|
5004
|
-
tokenType: payload.tokenName,
|
|
5005
|
-
params: payload.params || {},
|
|
5006
|
-
iat: payload.iat,
|
|
5007
|
-
exp: payload.exp
|
|
5008
|
-
};
|
|
5009
|
-
} catch {
|
|
5010
|
-
return null;
|
|
1379
|
+
if (corsOrigins && corsOrigins.length > 0) {
|
|
1380
|
+
if (origin && corsOrigins.includes(origin)) {
|
|
1381
|
+
headers["Access-Control-Allow-Origin"] = origin;
|
|
1382
|
+
headers["Access-Control-Allow-Credentials"] = "true";
|
|
1383
|
+
headers["Vary"] = "Origin";
|
|
5011
1384
|
}
|
|
1385
|
+
} else {
|
|
1386
|
+
headers["Access-Control-Allow-Origin"] = origin ?? "*";
|
|
1387
|
+
if (origin)
|
|
1388
|
+
headers["Vary"] = "Origin";
|
|
5012
1389
|
}
|
|
1390
|
+
return headers;
|
|
5013
1391
|
}
|
|
1392
|
+
const corsHeaders = buildCorsHeaders();
|
|
1393
|
+
const verifyToken = (token) => contextHandler.verifyToken(token);
|
|
5014
1394
|
const defaultHttp = arcHttpHandlers(contextHandler, connectionManager);
|
|
5015
1395
|
const defaultWs = arcWsHandlers();
|
|
5016
1396
|
const httpHandlers = config.httpHandlers ? [...defaultHttp, ...config.httpHandlers] : defaultHttp;
|
|
@@ -5030,8 +1410,15 @@ async function createArcServer(config) {
|
|
|
5030
1410
|
return new Response(null, { headers: corsHeaders2 });
|
|
5031
1411
|
}
|
|
5032
1412
|
const handleRequest = async (span) => {
|
|
1413
|
+
const contentLength = Number(req.headers.get("Content-Length") ?? 0);
|
|
1414
|
+
if (contentLength > maxRequestBodySize) {
|
|
1415
|
+
return Response.json({ error: "Payload too large" }, { status: 413, headers: corsHeaders2 });
|
|
1416
|
+
}
|
|
5033
1417
|
const authHeader = req.headers.get("Authorization");
|
|
5034
|
-
let rawToken = authHeader?.replace("Bearer ", "") ||
|
|
1418
|
+
let rawToken = authHeader?.replace("Bearer ", "") || null;
|
|
1419
|
+
if (!rawToken && config.allowTokenInQuery) {
|
|
1420
|
+
rawToken = url.searchParams.get("token");
|
|
1421
|
+
}
|
|
5035
1422
|
if (!rawToken) {
|
|
5036
1423
|
const cookieHeader = req.headers.get("Cookie");
|
|
5037
1424
|
if (cookieHeader) {
|
|
@@ -5040,7 +1427,10 @@ async function createArcServer(config) {
|
|
|
5040
1427
|
rawToken = decodeURIComponent(match[1]);
|
|
5041
1428
|
}
|
|
5042
1429
|
}
|
|
5043
|
-
const tokenPayload = rawToken ? verifyToken(rawToken) : null;
|
|
1430
|
+
const tokenPayload = rawToken ? await verifyToken(rawToken) : null;
|
|
1431
|
+
if (rawToken && !tokenPayload) {
|
|
1432
|
+
return Response.json({ error: "Unauthorized" }, { status: 401, headers: corsHeaders2 });
|
|
1433
|
+
}
|
|
5044
1434
|
if (url.pathname === "/ws" && req.headers.get("Upgrade") === "websocket") {
|
|
5045
1435
|
if (server2.upgrade(req, { data: { clientId: "" } }))
|
|
5046
1436
|
return;
|
|
@@ -5180,5 +1570,5 @@ export {
|
|
|
5180
1570
|
ConnectionManager
|
|
5181
1571
|
};
|
|
5182
1572
|
|
|
5183
|
-
//# debugId=
|
|
1573
|
+
//# debugId=12A4B163A015796864756E2164756E21
|
|
5184
1574
|
//# sourceMappingURL=index.js.map
|