node-karin 1.14.3 → 1.14.4
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/CHANGELOG.md +7 -0
- package/dist/index.d.ts +61 -3
- package/dist/index.mjs +186 -3919
- package/package.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs24 from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import require$$2 from 'os';
|
|
4
|
-
import require$$
|
|
4
|
+
import require$$3 from 'crypto';
|
|
5
5
|
import { fileURLToPath } from 'url';
|
|
6
6
|
import fs5, { promises, existsSync as existsSync$1 } from 'node:fs';
|
|
7
7
|
import YAML, { isMap, isSeq, isPair } from 'yaml';
|
|
@@ -17,9 +17,7 @@ import { createRequire } from 'module';
|
|
|
17
17
|
import crypto, { randomUUID, createHmac } from 'node:crypto';
|
|
18
18
|
import { EventEmitter } from 'node:events';
|
|
19
19
|
import WebSocket, { WebSocket as WebSocket$1, WebSocketServer } from 'ws';
|
|
20
|
-
import
|
|
21
|
-
import require$$32 from 'stream';
|
|
22
|
-
import require$$5 from 'util';
|
|
20
|
+
import jwt from 'jsonwebtoken';
|
|
23
21
|
import os, { homedir } from 'node:os';
|
|
24
22
|
import { isPromise } from 'util/types';
|
|
25
23
|
import { exec as exec$1, spawn as spawn$1 } from 'child_process';
|
|
@@ -79,7 +77,7 @@ function requireMain() {
|
|
|
79
77
|
const fs37 = fs24;
|
|
80
78
|
const path36 = path;
|
|
81
79
|
const os5 = require$$2;
|
|
82
|
-
const crypto9 = require$$
|
|
80
|
+
const crypto9 = require$$3;
|
|
83
81
|
const packageJson = require$$4;
|
|
84
82
|
const version2 = packageJson.version;
|
|
85
83
|
const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
@@ -1637,12 +1635,12 @@ var init_yaml = __esm({
|
|
|
1637
1635
|
logger.error("[YamlEditor] \u6307\u5B9A\u7684\u8DEF\u5F84\u4E0D\u662F\u6570\u7EC4");
|
|
1638
1636
|
return false;
|
|
1639
1637
|
}
|
|
1640
|
-
const
|
|
1641
|
-
if (
|
|
1638
|
+
const index4 = current.items.findIndex((item) => lodash3.isEqual(item.toJSON(), value));
|
|
1639
|
+
if (index4 < 0) {
|
|
1642
1640
|
logger.error("[YamlEditor] \u672A\u627E\u5230\u8981\u5220\u9664\u7684\u503C");
|
|
1643
1641
|
return false;
|
|
1644
1642
|
}
|
|
1645
|
-
current.items.splice(
|
|
1643
|
+
current.items.splice(index4, 1);
|
|
1646
1644
|
logger.debug(`[YamlEditor] \u5DF2\u4ECE ${path36} \u6570\u7EC4\u5220\u9664\u5143\u7D20\uFF1A${value}`);
|
|
1647
1645
|
return true;
|
|
1648
1646
|
} catch (error) {
|
|
@@ -1718,16 +1716,16 @@ var init_yaml = __esm({
|
|
|
1718
1716
|
* 根据索引从根节点数组删除元素
|
|
1719
1717
|
* @param index - 要删除元素的索引
|
|
1720
1718
|
*/
|
|
1721
|
-
delarr(
|
|
1719
|
+
delarr(index4) {
|
|
1722
1720
|
try {
|
|
1723
1721
|
if (!(this.document.contents instanceof YAML.YAMLSeq)) {
|
|
1724
1722
|
throw new Error("[YamlEditor] \u6839\u8282\u70B9\u4E0D\u662F\u6570\u7EC4");
|
|
1725
1723
|
}
|
|
1726
|
-
if (
|
|
1724
|
+
if (index4 < 0 || index4 >= this.document.contents.items.length) {
|
|
1727
1725
|
throw new Error("[YamlEditor] \u7D22\u5F15\u8D85\u51FA\u8303\u56F4");
|
|
1728
1726
|
}
|
|
1729
|
-
this.document.contents.items.splice(
|
|
1730
|
-
logger.debug("[YamlEditor] \u5DF2\u6839\u636E\u7D22\u5F15\u4ECE\u6839\u8282\u70B9\u6570\u7EC4\u5220\u9664\u5143\u7D20\uFF0C\u7D22\u5F15\uFF1A",
|
|
1727
|
+
this.document.contents.items.splice(index4, 1);
|
|
1728
|
+
logger.debug("[YamlEditor] \u5DF2\u6839\u636E\u7D22\u5F15\u4ECE\u6839\u8282\u70B9\u6570\u7EC4\u5220\u9664\u5143\u7D20\uFF0C\u7D22\u5F15\uFF1A", index4);
|
|
1731
1729
|
return true;
|
|
1732
1730
|
} catch (error) {
|
|
1733
1731
|
logger.error(`[YamlEditor] \u6839\u636E\u7D22\u5F15\u5220\u9664\u6839\u8282\u70B9\u6570\u7EC4\u5143\u7D20\u65F6\u51FA\u9519\uFF1A${error}`);
|
|
@@ -1974,9 +1972,9 @@ function logs(arg1, arg2, lengthParam = 1, reverseParam = false, optsParam) {
|
|
|
1974
1972
|
const keys = Object.keys(list2);
|
|
1975
1973
|
const startKey = findFallbackVersionKey(keys, version2, { compare: compareMode });
|
|
1976
1974
|
if (!startKey) return "";
|
|
1977
|
-
const
|
|
1978
|
-
const start3 = reverse ?
|
|
1979
|
-
const end = reverse ?
|
|
1975
|
+
const index4 = keys.indexOf(startKey);
|
|
1976
|
+
const start3 = reverse ? index4 - length : index4;
|
|
1977
|
+
const end = reverse ? index4 : index4 + length;
|
|
1980
1978
|
const sliceStart = Math.max(0, start3);
|
|
1981
1979
|
const sliceEnd = Math.min(keys.length, end);
|
|
1982
1980
|
const versions = keys.slice(sliceStart, sliceEnd).map((key) => list2[key] ? list2[key] : "");
|
|
@@ -3817,35 +3815,41 @@ var init_dist2 = __esm({
|
|
|
3817
3815
|
/**
|
|
3818
3816
|
* GoCQ扩展: 发送合并转发消息
|
|
3819
3817
|
* @param messages - 消息节点列表
|
|
3818
|
+
* @param options - 外显参数
|
|
3820
3819
|
* @returns 消息ID
|
|
3821
3820
|
*/
|
|
3822
|
-
async sendForwardMsg(messages) {
|
|
3821
|
+
async sendForwardMsg(messages, options) {
|
|
3823
3822
|
return this.sendApi("send_forward_msg", {
|
|
3824
|
-
messages
|
|
3823
|
+
messages,
|
|
3824
|
+
...options
|
|
3825
3825
|
});
|
|
3826
3826
|
}
|
|
3827
3827
|
/**
|
|
3828
3828
|
* GoCQ扩展: 发送合并转发(群聊)
|
|
3829
3829
|
* @param group_id - 群ID
|
|
3830
3830
|
* @param messages - 消息节点列表
|
|
3831
|
+
* @param options - 外显参数
|
|
3831
3832
|
* @returns 消息ID
|
|
3832
3833
|
*/
|
|
3833
|
-
async sendGroupForwardMsg(group_id, messages) {
|
|
3834
|
+
async sendGroupForwardMsg(group_id, messages, options) {
|
|
3834
3835
|
return this.sendApi("send_group_forward_msg", {
|
|
3835
3836
|
group_id,
|
|
3836
|
-
messages
|
|
3837
|
+
messages,
|
|
3838
|
+
...options
|
|
3837
3839
|
});
|
|
3838
3840
|
}
|
|
3839
3841
|
/**
|
|
3840
3842
|
* GoCQ扩展: 发送合并转发(好友)
|
|
3841
3843
|
* @param user_id - 用户ID
|
|
3842
3844
|
* @param messages - 消息节点列表
|
|
3845
|
+
* @param options - 外显参数
|
|
3843
3846
|
* @returns 消息ID
|
|
3844
3847
|
*/
|
|
3845
|
-
async sendPrivateForwardMsg(user_id, messages) {
|
|
3848
|
+
async sendPrivateForwardMsg(user_id, messages, options) {
|
|
3846
3849
|
return this.sendApi("send_private_forward_msg", {
|
|
3847
3850
|
user_id,
|
|
3848
|
-
messages
|
|
3851
|
+
messages,
|
|
3852
|
+
...options
|
|
3849
3853
|
});
|
|
3850
3854
|
}
|
|
3851
3855
|
/**
|
|
@@ -6037,8 +6041,8 @@ var init_dist2 = __esm({
|
|
|
6037
6041
|
if (typeof headers !== "object" || !headers["x-signature"]) {
|
|
6038
6042
|
return false;
|
|
6039
6043
|
}
|
|
6040
|
-
const
|
|
6041
|
-
return
|
|
6044
|
+
const sign = `sha1=${createHmac("sha1", this._options.accessToken).update(event).digest("hex")}`;
|
|
6045
|
+
return sign === headers["x-signature"];
|
|
6042
6046
|
}
|
|
6043
6047
|
/**
|
|
6044
6048
|
* 重新连接
|
|
@@ -6469,3741 +6473,6 @@ var init_tools = __esm({
|
|
|
6469
6473
|
};
|
|
6470
6474
|
}
|
|
6471
6475
|
});
|
|
6472
|
-
function _mergeNamespaces2(n, m) {
|
|
6473
|
-
for (var i = 0; i < m.length; i++) {
|
|
6474
|
-
const e = m[i];
|
|
6475
|
-
if (typeof e !== "string" && !Array.isArray(e)) {
|
|
6476
|
-
for (const k in e) {
|
|
6477
|
-
if (k !== "default" && !(k in n)) {
|
|
6478
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
6479
|
-
if (d) {
|
|
6480
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
6481
|
-
enumerable: true,
|
|
6482
|
-
get: () => e[k]
|
|
6483
|
-
});
|
|
6484
|
-
}
|
|
6485
|
-
}
|
|
6486
|
-
}
|
|
6487
|
-
}
|
|
6488
|
-
}
|
|
6489
|
-
return Object.freeze(Object.defineProperty(n, Symbol.toStringTag, { value: "Module" }));
|
|
6490
|
-
}
|
|
6491
|
-
function getDefaultExportFromCjs2(x) {
|
|
6492
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
6493
|
-
}
|
|
6494
|
-
function requireSafeBuffer() {
|
|
6495
|
-
if (hasRequiredSafeBuffer) return safeBuffer.exports;
|
|
6496
|
-
hasRequiredSafeBuffer = 1;
|
|
6497
|
-
(function(module, exports) {
|
|
6498
|
-
var buffer2 = require$$02;
|
|
6499
|
-
var Buffer2 = buffer2.Buffer;
|
|
6500
|
-
function copyProps(src, dst) {
|
|
6501
|
-
for (var key in src) {
|
|
6502
|
-
dst[key] = src[key];
|
|
6503
|
-
}
|
|
6504
|
-
}
|
|
6505
|
-
if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
|
|
6506
|
-
module.exports = buffer2;
|
|
6507
|
-
} else {
|
|
6508
|
-
copyProps(buffer2, exports);
|
|
6509
|
-
exports.Buffer = SafeBuffer;
|
|
6510
|
-
}
|
|
6511
|
-
function SafeBuffer(arg, encodingOrOffset, length) {
|
|
6512
|
-
return Buffer2(arg, encodingOrOffset, length);
|
|
6513
|
-
}
|
|
6514
|
-
SafeBuffer.prototype = Object.create(Buffer2.prototype);
|
|
6515
|
-
copyProps(Buffer2, SafeBuffer);
|
|
6516
|
-
SafeBuffer.from = function(arg, encodingOrOffset, length) {
|
|
6517
|
-
if (typeof arg === "number") {
|
|
6518
|
-
throw new TypeError("Argument must not be a number");
|
|
6519
|
-
}
|
|
6520
|
-
return Buffer2(arg, encodingOrOffset, length);
|
|
6521
|
-
};
|
|
6522
|
-
SafeBuffer.alloc = function(size, fill, encoding) {
|
|
6523
|
-
if (typeof size !== "number") {
|
|
6524
|
-
throw new TypeError("Argument must be a number");
|
|
6525
|
-
}
|
|
6526
|
-
var buf = Buffer2(size);
|
|
6527
|
-
if (fill !== void 0) {
|
|
6528
|
-
if (typeof encoding === "string") {
|
|
6529
|
-
buf.fill(fill, encoding);
|
|
6530
|
-
} else {
|
|
6531
|
-
buf.fill(fill);
|
|
6532
|
-
}
|
|
6533
|
-
} else {
|
|
6534
|
-
buf.fill(0);
|
|
6535
|
-
}
|
|
6536
|
-
return buf;
|
|
6537
|
-
};
|
|
6538
|
-
SafeBuffer.allocUnsafe = function(size) {
|
|
6539
|
-
if (typeof size !== "number") {
|
|
6540
|
-
throw new TypeError("Argument must be a number");
|
|
6541
|
-
}
|
|
6542
|
-
return Buffer2(size);
|
|
6543
|
-
};
|
|
6544
|
-
SafeBuffer.allocUnsafeSlow = function(size) {
|
|
6545
|
-
if (typeof size !== "number") {
|
|
6546
|
-
throw new TypeError("Argument must be a number");
|
|
6547
|
-
}
|
|
6548
|
-
return buffer2.SlowBuffer(size);
|
|
6549
|
-
};
|
|
6550
|
-
})(safeBuffer, safeBuffer.exports);
|
|
6551
|
-
return safeBuffer.exports;
|
|
6552
|
-
}
|
|
6553
|
-
function requireDataStream() {
|
|
6554
|
-
if (hasRequiredDataStream) return dataStream;
|
|
6555
|
-
hasRequiredDataStream = 1;
|
|
6556
|
-
var Buffer2 = requireSafeBuffer().Buffer;
|
|
6557
|
-
var Stream = require$$32;
|
|
6558
|
-
var util7 = require$$5;
|
|
6559
|
-
function DataStream(data) {
|
|
6560
|
-
this.buffer = null;
|
|
6561
|
-
this.writable = true;
|
|
6562
|
-
this.readable = true;
|
|
6563
|
-
if (!data) {
|
|
6564
|
-
this.buffer = Buffer2.alloc(0);
|
|
6565
|
-
return this;
|
|
6566
|
-
}
|
|
6567
|
-
if (typeof data.pipe === "function") {
|
|
6568
|
-
this.buffer = Buffer2.alloc(0);
|
|
6569
|
-
data.pipe(this);
|
|
6570
|
-
return this;
|
|
6571
|
-
}
|
|
6572
|
-
if (data.length || typeof data === "object") {
|
|
6573
|
-
this.buffer = data;
|
|
6574
|
-
this.writable = false;
|
|
6575
|
-
process.nextTick(function() {
|
|
6576
|
-
this.emit("end", data);
|
|
6577
|
-
this.readable = false;
|
|
6578
|
-
this.emit("close");
|
|
6579
|
-
}.bind(this));
|
|
6580
|
-
return this;
|
|
6581
|
-
}
|
|
6582
|
-
throw new TypeError("Unexpected data type (" + typeof data + ")");
|
|
6583
|
-
}
|
|
6584
|
-
util7.inherits(DataStream, Stream);
|
|
6585
|
-
DataStream.prototype.write = function write2(data) {
|
|
6586
|
-
this.buffer = Buffer2.concat([this.buffer, Buffer2.from(data)]);
|
|
6587
|
-
this.emit("data", data);
|
|
6588
|
-
};
|
|
6589
|
-
DataStream.prototype.end = function end(data) {
|
|
6590
|
-
if (data)
|
|
6591
|
-
this.write(data);
|
|
6592
|
-
this.emit("end", data);
|
|
6593
|
-
this.emit("close");
|
|
6594
|
-
this.writable = false;
|
|
6595
|
-
this.readable = false;
|
|
6596
|
-
};
|
|
6597
|
-
dataStream = DataStream;
|
|
6598
|
-
return dataStream;
|
|
6599
|
-
}
|
|
6600
|
-
function requireBufferEqualConstantTime() {
|
|
6601
|
-
if (hasRequiredBufferEqualConstantTime) return bufferEqualConstantTime;
|
|
6602
|
-
hasRequiredBufferEqualConstantTime = 1;
|
|
6603
|
-
var Buffer2 = require$$02.Buffer;
|
|
6604
|
-
var SlowBuffer = require$$02.SlowBuffer;
|
|
6605
|
-
bufferEqualConstantTime = bufferEq;
|
|
6606
|
-
function bufferEq(a, b) {
|
|
6607
|
-
if (!Buffer2.isBuffer(a) || !Buffer2.isBuffer(b)) {
|
|
6608
|
-
return false;
|
|
6609
|
-
}
|
|
6610
|
-
if (a.length !== b.length) {
|
|
6611
|
-
return false;
|
|
6612
|
-
}
|
|
6613
|
-
var c = 0;
|
|
6614
|
-
for (var i = 0; i < a.length; i++) {
|
|
6615
|
-
c |= a[i] ^ b[i];
|
|
6616
|
-
}
|
|
6617
|
-
return c === 0;
|
|
6618
|
-
}
|
|
6619
|
-
bufferEq.install = function() {
|
|
6620
|
-
Buffer2.prototype.equal = SlowBuffer.prototype.equal = function equal(that) {
|
|
6621
|
-
return bufferEq(this, that);
|
|
6622
|
-
};
|
|
6623
|
-
};
|
|
6624
|
-
var origBufEqual = Buffer2.prototype.equal;
|
|
6625
|
-
var origSlowBufEqual = SlowBuffer.prototype.equal;
|
|
6626
|
-
bufferEq.restore = function() {
|
|
6627
|
-
Buffer2.prototype.equal = origBufEqual;
|
|
6628
|
-
SlowBuffer.prototype.equal = origSlowBufEqual;
|
|
6629
|
-
};
|
|
6630
|
-
return bufferEqualConstantTime;
|
|
6631
|
-
}
|
|
6632
|
-
function requireParamBytesForAlg() {
|
|
6633
|
-
if (hasRequiredParamBytesForAlg) return paramBytesForAlg_1;
|
|
6634
|
-
hasRequiredParamBytesForAlg = 1;
|
|
6635
|
-
function getParamSize(keySize) {
|
|
6636
|
-
var result = (keySize / 8 | 0) + (keySize % 8 === 0 ? 0 : 1);
|
|
6637
|
-
return result;
|
|
6638
|
-
}
|
|
6639
|
-
var paramBytesForAlg = {
|
|
6640
|
-
ES256: getParamSize(256),
|
|
6641
|
-
ES384: getParamSize(384),
|
|
6642
|
-
ES512: getParamSize(521)
|
|
6643
|
-
};
|
|
6644
|
-
function getParamBytesForAlg(alg) {
|
|
6645
|
-
var paramBytes = paramBytesForAlg[alg];
|
|
6646
|
-
if (paramBytes) {
|
|
6647
|
-
return paramBytes;
|
|
6648
|
-
}
|
|
6649
|
-
throw new Error('Unknown algorithm "' + alg + '"');
|
|
6650
|
-
}
|
|
6651
|
-
paramBytesForAlg_1 = getParamBytesForAlg;
|
|
6652
|
-
return paramBytesForAlg_1;
|
|
6653
|
-
}
|
|
6654
|
-
function requireEcdsaSigFormatter() {
|
|
6655
|
-
if (hasRequiredEcdsaSigFormatter) return ecdsaSigFormatter;
|
|
6656
|
-
hasRequiredEcdsaSigFormatter = 1;
|
|
6657
|
-
var Buffer2 = requireSafeBuffer().Buffer;
|
|
6658
|
-
var getParamBytesForAlg = requireParamBytesForAlg();
|
|
6659
|
-
var MAX_OCTET = 128, CLASS_UNIVERSAL = 0, PRIMITIVE_BIT = 32, TAG_SEQ = 16, TAG_INT = 2, ENCODED_TAG_SEQ = TAG_SEQ | PRIMITIVE_BIT | CLASS_UNIVERSAL << 6, ENCODED_TAG_INT = TAG_INT | CLASS_UNIVERSAL << 6;
|
|
6660
|
-
function base64Url(base642) {
|
|
6661
|
-
return base642.replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
6662
|
-
}
|
|
6663
|
-
function signatureAsBuffer(signature) {
|
|
6664
|
-
if (Buffer2.isBuffer(signature)) {
|
|
6665
|
-
return signature;
|
|
6666
|
-
} else if ("string" === typeof signature) {
|
|
6667
|
-
return Buffer2.from(signature, "base64");
|
|
6668
|
-
}
|
|
6669
|
-
throw new TypeError("ECDSA signature must be a Base64 string or a Buffer");
|
|
6670
|
-
}
|
|
6671
|
-
function derToJose(signature, alg) {
|
|
6672
|
-
signature = signatureAsBuffer(signature);
|
|
6673
|
-
var paramBytes = getParamBytesForAlg(alg);
|
|
6674
|
-
var maxEncodedParamLength = paramBytes + 1;
|
|
6675
|
-
var inputLength = signature.length;
|
|
6676
|
-
var offset = 0;
|
|
6677
|
-
if (signature[offset++] !== ENCODED_TAG_SEQ) {
|
|
6678
|
-
throw new Error('Could not find expected "seq"');
|
|
6679
|
-
}
|
|
6680
|
-
var seqLength = signature[offset++];
|
|
6681
|
-
if (seqLength === (MAX_OCTET | 1)) {
|
|
6682
|
-
seqLength = signature[offset++];
|
|
6683
|
-
}
|
|
6684
|
-
if (inputLength - offset < seqLength) {
|
|
6685
|
-
throw new Error('"seq" specified length of "' + seqLength + '", only "' + (inputLength - offset) + '" remaining');
|
|
6686
|
-
}
|
|
6687
|
-
if (signature[offset++] !== ENCODED_TAG_INT) {
|
|
6688
|
-
throw new Error('Could not find expected "int" for "r"');
|
|
6689
|
-
}
|
|
6690
|
-
var rLength = signature[offset++];
|
|
6691
|
-
if (inputLength - offset - 2 < rLength) {
|
|
6692
|
-
throw new Error('"r" specified length of "' + rLength + '", only "' + (inputLength - offset - 2) + '" available');
|
|
6693
|
-
}
|
|
6694
|
-
if (maxEncodedParamLength < rLength) {
|
|
6695
|
-
throw new Error('"r" specified length of "' + rLength + '", max of "' + maxEncodedParamLength + '" is acceptable');
|
|
6696
|
-
}
|
|
6697
|
-
var rOffset = offset;
|
|
6698
|
-
offset += rLength;
|
|
6699
|
-
if (signature[offset++] !== ENCODED_TAG_INT) {
|
|
6700
|
-
throw new Error('Could not find expected "int" for "s"');
|
|
6701
|
-
}
|
|
6702
|
-
var sLength = signature[offset++];
|
|
6703
|
-
if (inputLength - offset !== sLength) {
|
|
6704
|
-
throw new Error('"s" specified length of "' + sLength + '", expected "' + (inputLength - offset) + '"');
|
|
6705
|
-
}
|
|
6706
|
-
if (maxEncodedParamLength < sLength) {
|
|
6707
|
-
throw new Error('"s" specified length of "' + sLength + '", max of "' + maxEncodedParamLength + '" is acceptable');
|
|
6708
|
-
}
|
|
6709
|
-
var sOffset = offset;
|
|
6710
|
-
offset += sLength;
|
|
6711
|
-
if (offset !== inputLength) {
|
|
6712
|
-
throw new Error('Expected to consume entire buffer, but "' + (inputLength - offset) + '" bytes remain');
|
|
6713
|
-
}
|
|
6714
|
-
var rPadding = paramBytes - rLength, sPadding = paramBytes - sLength;
|
|
6715
|
-
var dst = Buffer2.allocUnsafe(rPadding + rLength + sPadding + sLength);
|
|
6716
|
-
for (offset = 0; offset < rPadding; ++offset) {
|
|
6717
|
-
dst[offset] = 0;
|
|
6718
|
-
}
|
|
6719
|
-
signature.copy(dst, offset, rOffset + Math.max(-rPadding, 0), rOffset + rLength);
|
|
6720
|
-
offset = paramBytes;
|
|
6721
|
-
for (var o = offset; offset < o + sPadding; ++offset) {
|
|
6722
|
-
dst[offset] = 0;
|
|
6723
|
-
}
|
|
6724
|
-
signature.copy(dst, offset, sOffset + Math.max(-sPadding, 0), sOffset + sLength);
|
|
6725
|
-
dst = dst.toString("base64");
|
|
6726
|
-
dst = base64Url(dst);
|
|
6727
|
-
return dst;
|
|
6728
|
-
}
|
|
6729
|
-
function countPadding(buf, start3, stop) {
|
|
6730
|
-
var padding = 0;
|
|
6731
|
-
while (start3 + padding < stop && buf[start3 + padding] === 0) {
|
|
6732
|
-
++padding;
|
|
6733
|
-
}
|
|
6734
|
-
var needsSign = buf[start3 + padding] >= MAX_OCTET;
|
|
6735
|
-
if (needsSign) {
|
|
6736
|
-
--padding;
|
|
6737
|
-
}
|
|
6738
|
-
return padding;
|
|
6739
|
-
}
|
|
6740
|
-
function joseToDer(signature, alg) {
|
|
6741
|
-
signature = signatureAsBuffer(signature);
|
|
6742
|
-
var paramBytes = getParamBytesForAlg(alg);
|
|
6743
|
-
var signatureBytes = signature.length;
|
|
6744
|
-
if (signatureBytes !== paramBytes * 2) {
|
|
6745
|
-
throw new TypeError('"' + alg + '" signatures must be "' + paramBytes * 2 + '" bytes, saw "' + signatureBytes + '"');
|
|
6746
|
-
}
|
|
6747
|
-
var rPadding = countPadding(signature, 0, paramBytes);
|
|
6748
|
-
var sPadding = countPadding(signature, paramBytes, signature.length);
|
|
6749
|
-
var rLength = paramBytes - rPadding;
|
|
6750
|
-
var sLength = paramBytes - sPadding;
|
|
6751
|
-
var rsBytes = 1 + 1 + rLength + 1 + 1 + sLength;
|
|
6752
|
-
var shortLength = rsBytes < MAX_OCTET;
|
|
6753
|
-
var dst = Buffer2.allocUnsafe((shortLength ? 2 : 3) + rsBytes);
|
|
6754
|
-
var offset = 0;
|
|
6755
|
-
dst[offset++] = ENCODED_TAG_SEQ;
|
|
6756
|
-
if (shortLength) {
|
|
6757
|
-
dst[offset++] = rsBytes;
|
|
6758
|
-
} else {
|
|
6759
|
-
dst[offset++] = MAX_OCTET | 1;
|
|
6760
|
-
dst[offset++] = rsBytes & 255;
|
|
6761
|
-
}
|
|
6762
|
-
dst[offset++] = ENCODED_TAG_INT;
|
|
6763
|
-
dst[offset++] = rLength;
|
|
6764
|
-
if (rPadding < 0) {
|
|
6765
|
-
dst[offset++] = 0;
|
|
6766
|
-
offset += signature.copy(dst, offset, 0, paramBytes);
|
|
6767
|
-
} else {
|
|
6768
|
-
offset += signature.copy(dst, offset, rPadding, paramBytes);
|
|
6769
|
-
}
|
|
6770
|
-
dst[offset++] = ENCODED_TAG_INT;
|
|
6771
|
-
dst[offset++] = sLength;
|
|
6772
|
-
if (sPadding < 0) {
|
|
6773
|
-
dst[offset++] = 0;
|
|
6774
|
-
signature.copy(dst, offset, paramBytes);
|
|
6775
|
-
} else {
|
|
6776
|
-
signature.copy(dst, offset, paramBytes + sPadding);
|
|
6777
|
-
}
|
|
6778
|
-
return dst;
|
|
6779
|
-
}
|
|
6780
|
-
ecdsaSigFormatter = {
|
|
6781
|
-
derToJose,
|
|
6782
|
-
joseToDer
|
|
6783
|
-
};
|
|
6784
|
-
return ecdsaSigFormatter;
|
|
6785
|
-
}
|
|
6786
|
-
function requireJwa() {
|
|
6787
|
-
if (hasRequiredJwa) return jwa;
|
|
6788
|
-
hasRequiredJwa = 1;
|
|
6789
|
-
var bufferEqual = requireBufferEqualConstantTime();
|
|
6790
|
-
var Buffer2 = requireSafeBuffer().Buffer;
|
|
6791
|
-
var crypto9 = require$$22;
|
|
6792
|
-
var formatEcdsa = requireEcdsaSigFormatter();
|
|
6793
|
-
var util7 = require$$5;
|
|
6794
|
-
var MSG_INVALID_ALGORITHM = '"%s" is not a valid algorithm.\n Supported algorithms are:\n "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".';
|
|
6795
|
-
var MSG_INVALID_SECRET = "secret must be a string or buffer";
|
|
6796
|
-
var MSG_INVALID_VERIFIER_KEY = "key must be a string or a buffer";
|
|
6797
|
-
var MSG_INVALID_SIGNER_KEY = "key must be a string, a buffer or an object";
|
|
6798
|
-
var supportsKeyObjects = typeof crypto9.createPublicKey === "function";
|
|
6799
|
-
if (supportsKeyObjects) {
|
|
6800
|
-
MSG_INVALID_VERIFIER_KEY += " or a KeyObject";
|
|
6801
|
-
MSG_INVALID_SECRET += "or a KeyObject";
|
|
6802
|
-
}
|
|
6803
|
-
function checkIsPublicKey(key) {
|
|
6804
|
-
if (Buffer2.isBuffer(key)) {
|
|
6805
|
-
return;
|
|
6806
|
-
}
|
|
6807
|
-
if (typeof key === "string") {
|
|
6808
|
-
return;
|
|
6809
|
-
}
|
|
6810
|
-
if (!supportsKeyObjects) {
|
|
6811
|
-
throw typeError(MSG_INVALID_VERIFIER_KEY);
|
|
6812
|
-
}
|
|
6813
|
-
if (typeof key !== "object") {
|
|
6814
|
-
throw typeError(MSG_INVALID_VERIFIER_KEY);
|
|
6815
|
-
}
|
|
6816
|
-
if (typeof key.type !== "string") {
|
|
6817
|
-
throw typeError(MSG_INVALID_VERIFIER_KEY);
|
|
6818
|
-
}
|
|
6819
|
-
if (typeof key.asymmetricKeyType !== "string") {
|
|
6820
|
-
throw typeError(MSG_INVALID_VERIFIER_KEY);
|
|
6821
|
-
}
|
|
6822
|
-
if (typeof key.export !== "function") {
|
|
6823
|
-
throw typeError(MSG_INVALID_VERIFIER_KEY);
|
|
6824
|
-
}
|
|
6825
|
-
}
|
|
6826
|
-
function checkIsPrivateKey(key) {
|
|
6827
|
-
if (Buffer2.isBuffer(key)) {
|
|
6828
|
-
return;
|
|
6829
|
-
}
|
|
6830
|
-
if (typeof key === "string") {
|
|
6831
|
-
return;
|
|
6832
|
-
}
|
|
6833
|
-
if (typeof key === "object") {
|
|
6834
|
-
return;
|
|
6835
|
-
}
|
|
6836
|
-
throw typeError(MSG_INVALID_SIGNER_KEY);
|
|
6837
|
-
}
|
|
6838
|
-
function checkIsSecretKey(key) {
|
|
6839
|
-
if (Buffer2.isBuffer(key)) {
|
|
6840
|
-
return;
|
|
6841
|
-
}
|
|
6842
|
-
if (typeof key === "string") {
|
|
6843
|
-
return key;
|
|
6844
|
-
}
|
|
6845
|
-
if (!supportsKeyObjects) {
|
|
6846
|
-
throw typeError(MSG_INVALID_SECRET);
|
|
6847
|
-
}
|
|
6848
|
-
if (typeof key !== "object") {
|
|
6849
|
-
throw typeError(MSG_INVALID_SECRET);
|
|
6850
|
-
}
|
|
6851
|
-
if (key.type !== "secret") {
|
|
6852
|
-
throw typeError(MSG_INVALID_SECRET);
|
|
6853
|
-
}
|
|
6854
|
-
if (typeof key.export !== "function") {
|
|
6855
|
-
throw typeError(MSG_INVALID_SECRET);
|
|
6856
|
-
}
|
|
6857
|
-
}
|
|
6858
|
-
function fromBase64(base642) {
|
|
6859
|
-
return base642.replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
6860
|
-
}
|
|
6861
|
-
function toBase64(base64url) {
|
|
6862
|
-
base64url = base64url.toString();
|
|
6863
|
-
var padding = 4 - base64url.length % 4;
|
|
6864
|
-
if (padding !== 4) {
|
|
6865
|
-
for (var i = 0; i < padding; ++i) {
|
|
6866
|
-
base64url += "=";
|
|
6867
|
-
}
|
|
6868
|
-
}
|
|
6869
|
-
return base64url.replace(/\-/g, "+").replace(/_/g, "/");
|
|
6870
|
-
}
|
|
6871
|
-
function typeError(template2) {
|
|
6872
|
-
var args = [].slice.call(arguments, 1);
|
|
6873
|
-
var errMsg = util7.format.bind(util7, template2).apply(null, args);
|
|
6874
|
-
return new TypeError(errMsg);
|
|
6875
|
-
}
|
|
6876
|
-
function bufferOrString(obj) {
|
|
6877
|
-
return Buffer2.isBuffer(obj) || typeof obj === "string";
|
|
6878
|
-
}
|
|
6879
|
-
function normalizeInput(thing) {
|
|
6880
|
-
if (!bufferOrString(thing))
|
|
6881
|
-
thing = JSON.stringify(thing);
|
|
6882
|
-
return thing;
|
|
6883
|
-
}
|
|
6884
|
-
function createHmacSigner(bits) {
|
|
6885
|
-
return function sign2(thing, secret) {
|
|
6886
|
-
checkIsSecretKey(secret);
|
|
6887
|
-
thing = normalizeInput(thing);
|
|
6888
|
-
var hmac = crypto9.createHmac("sha" + bits, secret);
|
|
6889
|
-
var sig = (hmac.update(thing), hmac.digest("base64"));
|
|
6890
|
-
return fromBase64(sig);
|
|
6891
|
-
};
|
|
6892
|
-
}
|
|
6893
|
-
function createHmacVerifier(bits) {
|
|
6894
|
-
return function verify2(thing, signature, secret) {
|
|
6895
|
-
var computedSig = createHmacSigner(bits)(thing, secret);
|
|
6896
|
-
return bufferEqual(Buffer2.from(signature), Buffer2.from(computedSig));
|
|
6897
|
-
};
|
|
6898
|
-
}
|
|
6899
|
-
function createKeySigner(bits) {
|
|
6900
|
-
return function sign2(thing, privateKey) {
|
|
6901
|
-
checkIsPrivateKey(privateKey);
|
|
6902
|
-
thing = normalizeInput(thing);
|
|
6903
|
-
var signer = crypto9.createSign("RSA-SHA" + bits);
|
|
6904
|
-
var sig = (signer.update(thing), signer.sign(privateKey, "base64"));
|
|
6905
|
-
return fromBase64(sig);
|
|
6906
|
-
};
|
|
6907
|
-
}
|
|
6908
|
-
function createKeyVerifier(bits) {
|
|
6909
|
-
return function verify2(thing, signature, publicKey) {
|
|
6910
|
-
checkIsPublicKey(publicKey);
|
|
6911
|
-
thing = normalizeInput(thing);
|
|
6912
|
-
signature = toBase64(signature);
|
|
6913
|
-
var verifier = crypto9.createVerify("RSA-SHA" + bits);
|
|
6914
|
-
verifier.update(thing);
|
|
6915
|
-
return verifier.verify(publicKey, signature, "base64");
|
|
6916
|
-
};
|
|
6917
|
-
}
|
|
6918
|
-
function createPSSKeySigner(bits) {
|
|
6919
|
-
return function sign2(thing, privateKey) {
|
|
6920
|
-
checkIsPrivateKey(privateKey);
|
|
6921
|
-
thing = normalizeInput(thing);
|
|
6922
|
-
var signer = crypto9.createSign("RSA-SHA" + bits);
|
|
6923
|
-
var sig = (signer.update(thing), signer.sign({
|
|
6924
|
-
key: privateKey,
|
|
6925
|
-
padding: crypto9.constants.RSA_PKCS1_PSS_PADDING,
|
|
6926
|
-
saltLength: crypto9.constants.RSA_PSS_SALTLEN_DIGEST
|
|
6927
|
-
}, "base64"));
|
|
6928
|
-
return fromBase64(sig);
|
|
6929
|
-
};
|
|
6930
|
-
}
|
|
6931
|
-
function createPSSKeyVerifier(bits) {
|
|
6932
|
-
return function verify2(thing, signature, publicKey) {
|
|
6933
|
-
checkIsPublicKey(publicKey);
|
|
6934
|
-
thing = normalizeInput(thing);
|
|
6935
|
-
signature = toBase64(signature);
|
|
6936
|
-
var verifier = crypto9.createVerify("RSA-SHA" + bits);
|
|
6937
|
-
verifier.update(thing);
|
|
6938
|
-
return verifier.verify({
|
|
6939
|
-
key: publicKey,
|
|
6940
|
-
padding: crypto9.constants.RSA_PKCS1_PSS_PADDING,
|
|
6941
|
-
saltLength: crypto9.constants.RSA_PSS_SALTLEN_DIGEST
|
|
6942
|
-
}, signature, "base64");
|
|
6943
|
-
};
|
|
6944
|
-
}
|
|
6945
|
-
function createECDSASigner(bits) {
|
|
6946
|
-
var inner = createKeySigner(bits);
|
|
6947
|
-
return function sign2() {
|
|
6948
|
-
var signature = inner.apply(null, arguments);
|
|
6949
|
-
signature = formatEcdsa.derToJose(signature, "ES" + bits);
|
|
6950
|
-
return signature;
|
|
6951
|
-
};
|
|
6952
|
-
}
|
|
6953
|
-
function createECDSAVerifer(bits) {
|
|
6954
|
-
var inner = createKeyVerifier(bits);
|
|
6955
|
-
return function verify2(thing, signature, publicKey) {
|
|
6956
|
-
signature = formatEcdsa.joseToDer(signature, "ES" + bits).toString("base64");
|
|
6957
|
-
var result = inner(thing, signature, publicKey);
|
|
6958
|
-
return result;
|
|
6959
|
-
};
|
|
6960
|
-
}
|
|
6961
|
-
function createNoneSigner() {
|
|
6962
|
-
return function sign2() {
|
|
6963
|
-
return "";
|
|
6964
|
-
};
|
|
6965
|
-
}
|
|
6966
|
-
function createNoneVerifier() {
|
|
6967
|
-
return function verify2(thing, signature) {
|
|
6968
|
-
return signature === "";
|
|
6969
|
-
};
|
|
6970
|
-
}
|
|
6971
|
-
jwa = function jwa2(algorithm) {
|
|
6972
|
-
var signerFactories = {
|
|
6973
|
-
hs: createHmacSigner,
|
|
6974
|
-
rs: createKeySigner,
|
|
6975
|
-
ps: createPSSKeySigner,
|
|
6976
|
-
es: createECDSASigner,
|
|
6977
|
-
none: createNoneSigner
|
|
6978
|
-
};
|
|
6979
|
-
var verifierFactories = {
|
|
6980
|
-
hs: createHmacVerifier,
|
|
6981
|
-
rs: createKeyVerifier,
|
|
6982
|
-
ps: createPSSKeyVerifier,
|
|
6983
|
-
es: createECDSAVerifer,
|
|
6984
|
-
none: createNoneVerifier
|
|
6985
|
-
};
|
|
6986
|
-
var match = algorithm.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/i);
|
|
6987
|
-
if (!match)
|
|
6988
|
-
throw typeError(MSG_INVALID_ALGORITHM, algorithm);
|
|
6989
|
-
var algo = (match[1] || match[3]).toLowerCase();
|
|
6990
|
-
var bits = match[2];
|
|
6991
|
-
return {
|
|
6992
|
-
sign: signerFactories[algo](bits),
|
|
6993
|
-
verify: verifierFactories[algo](bits)
|
|
6994
|
-
};
|
|
6995
|
-
};
|
|
6996
|
-
return jwa;
|
|
6997
|
-
}
|
|
6998
|
-
function requireTostring() {
|
|
6999
|
-
if (hasRequiredTostring) return tostring;
|
|
7000
|
-
hasRequiredTostring = 1;
|
|
7001
|
-
var Buffer2 = require$$02.Buffer;
|
|
7002
|
-
tostring = function toString(obj) {
|
|
7003
|
-
if (typeof obj === "string")
|
|
7004
|
-
return obj;
|
|
7005
|
-
if (typeof obj === "number" || Buffer2.isBuffer(obj))
|
|
7006
|
-
return obj.toString();
|
|
7007
|
-
return JSON.stringify(obj);
|
|
7008
|
-
};
|
|
7009
|
-
return tostring;
|
|
7010
|
-
}
|
|
7011
|
-
function requireSignStream() {
|
|
7012
|
-
if (hasRequiredSignStream) return signStream;
|
|
7013
|
-
hasRequiredSignStream = 1;
|
|
7014
|
-
var Buffer2 = requireSafeBuffer().Buffer;
|
|
7015
|
-
var DataStream = requireDataStream();
|
|
7016
|
-
var jwa2 = requireJwa();
|
|
7017
|
-
var Stream = require$$32;
|
|
7018
|
-
var toString = requireTostring();
|
|
7019
|
-
var util7 = require$$5;
|
|
7020
|
-
function base64url(string, encoding) {
|
|
7021
|
-
return Buffer2.from(string, encoding).toString("base64").replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
7022
|
-
}
|
|
7023
|
-
function jwsSecuredInput(header, payload, encoding) {
|
|
7024
|
-
encoding = encoding || "utf8";
|
|
7025
|
-
var encodedHeader = base64url(toString(header), "binary");
|
|
7026
|
-
var encodedPayload = base64url(toString(payload), encoding);
|
|
7027
|
-
return util7.format("%s.%s", encodedHeader, encodedPayload);
|
|
7028
|
-
}
|
|
7029
|
-
function jwsSign(opts) {
|
|
7030
|
-
var header = opts.header;
|
|
7031
|
-
var payload = opts.payload;
|
|
7032
|
-
var secretOrKey = opts.secret || opts.privateKey;
|
|
7033
|
-
var encoding = opts.encoding;
|
|
7034
|
-
var algo = jwa2(header.alg);
|
|
7035
|
-
var securedInput = jwsSecuredInput(header, payload, encoding);
|
|
7036
|
-
var signature = algo.sign(securedInput, secretOrKey);
|
|
7037
|
-
return util7.format("%s.%s", securedInput, signature);
|
|
7038
|
-
}
|
|
7039
|
-
function SignStream(opts) {
|
|
7040
|
-
var secret = opts.secret || opts.privateKey || opts.key;
|
|
7041
|
-
var secretStream = new DataStream(secret);
|
|
7042
|
-
this.readable = true;
|
|
7043
|
-
this.header = opts.header;
|
|
7044
|
-
this.encoding = opts.encoding;
|
|
7045
|
-
this.secret = this.privateKey = this.key = secretStream;
|
|
7046
|
-
this.payload = new DataStream(opts.payload);
|
|
7047
|
-
this.secret.once("close", function() {
|
|
7048
|
-
if (!this.payload.writable && this.readable)
|
|
7049
|
-
this.sign();
|
|
7050
|
-
}.bind(this));
|
|
7051
|
-
this.payload.once("close", function() {
|
|
7052
|
-
if (!this.secret.writable && this.readable)
|
|
7053
|
-
this.sign();
|
|
7054
|
-
}.bind(this));
|
|
7055
|
-
}
|
|
7056
|
-
util7.inherits(SignStream, Stream);
|
|
7057
|
-
SignStream.prototype.sign = function sign2() {
|
|
7058
|
-
try {
|
|
7059
|
-
var signature = jwsSign({
|
|
7060
|
-
header: this.header,
|
|
7061
|
-
payload: this.payload.buffer,
|
|
7062
|
-
secret: this.secret.buffer,
|
|
7063
|
-
encoding: this.encoding
|
|
7064
|
-
});
|
|
7065
|
-
this.emit("done", signature);
|
|
7066
|
-
this.emit("data", signature);
|
|
7067
|
-
this.emit("end");
|
|
7068
|
-
this.readable = false;
|
|
7069
|
-
return signature;
|
|
7070
|
-
} catch (e) {
|
|
7071
|
-
this.readable = false;
|
|
7072
|
-
this.emit("error", e);
|
|
7073
|
-
this.emit("close");
|
|
7074
|
-
}
|
|
7075
|
-
};
|
|
7076
|
-
SignStream.sign = jwsSign;
|
|
7077
|
-
signStream = SignStream;
|
|
7078
|
-
return signStream;
|
|
7079
|
-
}
|
|
7080
|
-
function requireVerifyStream() {
|
|
7081
|
-
if (hasRequiredVerifyStream) return verifyStream;
|
|
7082
|
-
hasRequiredVerifyStream = 1;
|
|
7083
|
-
var Buffer2 = requireSafeBuffer().Buffer;
|
|
7084
|
-
var DataStream = requireDataStream();
|
|
7085
|
-
var jwa2 = requireJwa();
|
|
7086
|
-
var Stream = require$$32;
|
|
7087
|
-
var toString = requireTostring();
|
|
7088
|
-
var util7 = require$$5;
|
|
7089
|
-
var JWS_REGEX = /^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;
|
|
7090
|
-
function isObject(thing) {
|
|
7091
|
-
return Object.prototype.toString.call(thing) === "[object Object]";
|
|
7092
|
-
}
|
|
7093
|
-
function safeJsonParse(thing) {
|
|
7094
|
-
if (isObject(thing))
|
|
7095
|
-
return thing;
|
|
7096
|
-
try {
|
|
7097
|
-
return JSON.parse(thing);
|
|
7098
|
-
} catch (e) {
|
|
7099
|
-
return void 0;
|
|
7100
|
-
}
|
|
7101
|
-
}
|
|
7102
|
-
function headerFromJWS(jwsSig) {
|
|
7103
|
-
var encodedHeader = jwsSig.split(".", 1)[0];
|
|
7104
|
-
return safeJsonParse(Buffer2.from(encodedHeader, "base64").toString("binary"));
|
|
7105
|
-
}
|
|
7106
|
-
function securedInputFromJWS(jwsSig) {
|
|
7107
|
-
return jwsSig.split(".", 2).join(".");
|
|
7108
|
-
}
|
|
7109
|
-
function signatureFromJWS(jwsSig) {
|
|
7110
|
-
return jwsSig.split(".")[2];
|
|
7111
|
-
}
|
|
7112
|
-
function payloadFromJWS(jwsSig, encoding) {
|
|
7113
|
-
encoding = encoding || "utf8";
|
|
7114
|
-
var payload = jwsSig.split(".")[1];
|
|
7115
|
-
return Buffer2.from(payload, "base64").toString(encoding);
|
|
7116
|
-
}
|
|
7117
|
-
function isValidJws(string) {
|
|
7118
|
-
return JWS_REGEX.test(string) && !!headerFromJWS(string);
|
|
7119
|
-
}
|
|
7120
|
-
function jwsVerify(jwsSig, algorithm, secretOrKey) {
|
|
7121
|
-
if (!algorithm) {
|
|
7122
|
-
var err = new Error("Missing algorithm parameter for jws.verify");
|
|
7123
|
-
err.code = "MISSING_ALGORITHM";
|
|
7124
|
-
throw err;
|
|
7125
|
-
}
|
|
7126
|
-
jwsSig = toString(jwsSig);
|
|
7127
|
-
var signature = signatureFromJWS(jwsSig);
|
|
7128
|
-
var securedInput = securedInputFromJWS(jwsSig);
|
|
7129
|
-
var algo = jwa2(algorithm);
|
|
7130
|
-
return algo.verify(securedInput, signature, secretOrKey);
|
|
7131
|
-
}
|
|
7132
|
-
function jwsDecode(jwsSig, opts) {
|
|
7133
|
-
opts = opts || {};
|
|
7134
|
-
jwsSig = toString(jwsSig);
|
|
7135
|
-
if (!isValidJws(jwsSig))
|
|
7136
|
-
return null;
|
|
7137
|
-
var header = headerFromJWS(jwsSig);
|
|
7138
|
-
if (!header)
|
|
7139
|
-
return null;
|
|
7140
|
-
var payload = payloadFromJWS(jwsSig);
|
|
7141
|
-
if (header.typ === "JWT" || opts.json)
|
|
7142
|
-
payload = JSON.parse(payload, opts.encoding);
|
|
7143
|
-
return {
|
|
7144
|
-
header,
|
|
7145
|
-
payload,
|
|
7146
|
-
signature: signatureFromJWS(jwsSig)
|
|
7147
|
-
};
|
|
7148
|
-
}
|
|
7149
|
-
function VerifyStream(opts) {
|
|
7150
|
-
opts = opts || {};
|
|
7151
|
-
var secretOrKey = opts.secret || opts.publicKey || opts.key;
|
|
7152
|
-
var secretStream = new DataStream(secretOrKey);
|
|
7153
|
-
this.readable = true;
|
|
7154
|
-
this.algorithm = opts.algorithm;
|
|
7155
|
-
this.encoding = opts.encoding;
|
|
7156
|
-
this.secret = this.publicKey = this.key = secretStream;
|
|
7157
|
-
this.signature = new DataStream(opts.signature);
|
|
7158
|
-
this.secret.once("close", function() {
|
|
7159
|
-
if (!this.signature.writable && this.readable)
|
|
7160
|
-
this.verify();
|
|
7161
|
-
}.bind(this));
|
|
7162
|
-
this.signature.once("close", function() {
|
|
7163
|
-
if (!this.secret.writable && this.readable)
|
|
7164
|
-
this.verify();
|
|
7165
|
-
}.bind(this));
|
|
7166
|
-
}
|
|
7167
|
-
util7.inherits(VerifyStream, Stream);
|
|
7168
|
-
VerifyStream.prototype.verify = function verify2() {
|
|
7169
|
-
try {
|
|
7170
|
-
var valid2 = jwsVerify(this.signature.buffer, this.algorithm, this.key.buffer);
|
|
7171
|
-
var obj = jwsDecode(this.signature.buffer, this.encoding);
|
|
7172
|
-
this.emit("done", valid2, obj);
|
|
7173
|
-
this.emit("data", valid2);
|
|
7174
|
-
this.emit("end");
|
|
7175
|
-
this.readable = false;
|
|
7176
|
-
return valid2;
|
|
7177
|
-
} catch (e) {
|
|
7178
|
-
this.readable = false;
|
|
7179
|
-
this.emit("error", e);
|
|
7180
|
-
this.emit("close");
|
|
7181
|
-
}
|
|
7182
|
-
};
|
|
7183
|
-
VerifyStream.decode = jwsDecode;
|
|
7184
|
-
VerifyStream.isValid = isValidJws;
|
|
7185
|
-
VerifyStream.verify = jwsVerify;
|
|
7186
|
-
verifyStream = VerifyStream;
|
|
7187
|
-
return verifyStream;
|
|
7188
|
-
}
|
|
7189
|
-
function requireJws() {
|
|
7190
|
-
if (hasRequiredJws) return jws;
|
|
7191
|
-
hasRequiredJws = 1;
|
|
7192
|
-
var SignStream = requireSignStream();
|
|
7193
|
-
var VerifyStream = requireVerifyStream();
|
|
7194
|
-
var ALGORITHMS = [
|
|
7195
|
-
"HS256",
|
|
7196
|
-
"HS384",
|
|
7197
|
-
"HS512",
|
|
7198
|
-
"RS256",
|
|
7199
|
-
"RS384",
|
|
7200
|
-
"RS512",
|
|
7201
|
-
"PS256",
|
|
7202
|
-
"PS384",
|
|
7203
|
-
"PS512",
|
|
7204
|
-
"ES256",
|
|
7205
|
-
"ES384",
|
|
7206
|
-
"ES512"
|
|
7207
|
-
];
|
|
7208
|
-
jws.ALGORITHMS = ALGORITHMS;
|
|
7209
|
-
jws.sign = SignStream.sign;
|
|
7210
|
-
jws.verify = VerifyStream.verify;
|
|
7211
|
-
jws.decode = VerifyStream.decode;
|
|
7212
|
-
jws.isValid = VerifyStream.isValid;
|
|
7213
|
-
jws.createSign = function createSign(opts) {
|
|
7214
|
-
return new SignStream(opts);
|
|
7215
|
-
};
|
|
7216
|
-
jws.createVerify = function createVerify(opts) {
|
|
7217
|
-
return new VerifyStream(opts);
|
|
7218
|
-
};
|
|
7219
|
-
return jws;
|
|
7220
|
-
}
|
|
7221
|
-
function requireDecode() {
|
|
7222
|
-
if (hasRequiredDecode) return decode;
|
|
7223
|
-
hasRequiredDecode = 1;
|
|
7224
|
-
var jws2 = requireJws();
|
|
7225
|
-
decode = function(jwt, options) {
|
|
7226
|
-
options = options || {};
|
|
7227
|
-
var decoded = jws2.decode(jwt, options);
|
|
7228
|
-
if (!decoded) {
|
|
7229
|
-
return null;
|
|
7230
|
-
}
|
|
7231
|
-
var payload = decoded.payload;
|
|
7232
|
-
if (typeof payload === "string") {
|
|
7233
|
-
try {
|
|
7234
|
-
var obj = JSON.parse(payload);
|
|
7235
|
-
if (obj !== null && typeof obj === "object") {
|
|
7236
|
-
payload = obj;
|
|
7237
|
-
}
|
|
7238
|
-
} catch (e) {
|
|
7239
|
-
}
|
|
7240
|
-
}
|
|
7241
|
-
if (options.complete === true) {
|
|
7242
|
-
return {
|
|
7243
|
-
header: decoded.header,
|
|
7244
|
-
payload,
|
|
7245
|
-
signature: decoded.signature
|
|
7246
|
-
};
|
|
7247
|
-
}
|
|
7248
|
-
return payload;
|
|
7249
|
-
};
|
|
7250
|
-
return decode;
|
|
7251
|
-
}
|
|
7252
|
-
function requireJsonWebTokenError() {
|
|
7253
|
-
if (hasRequiredJsonWebTokenError) return JsonWebTokenError_1;
|
|
7254
|
-
hasRequiredJsonWebTokenError = 1;
|
|
7255
|
-
var JsonWebTokenError = function(message2, error) {
|
|
7256
|
-
Error.call(this, message2);
|
|
7257
|
-
if (Error.captureStackTrace) {
|
|
7258
|
-
Error.captureStackTrace(this, this.constructor);
|
|
7259
|
-
}
|
|
7260
|
-
this.name = "JsonWebTokenError";
|
|
7261
|
-
this.message = message2;
|
|
7262
|
-
if (error) this.inner = error;
|
|
7263
|
-
};
|
|
7264
|
-
JsonWebTokenError.prototype = Object.create(Error.prototype);
|
|
7265
|
-
JsonWebTokenError.prototype.constructor = JsonWebTokenError;
|
|
7266
|
-
JsonWebTokenError_1 = JsonWebTokenError;
|
|
7267
|
-
return JsonWebTokenError_1;
|
|
7268
|
-
}
|
|
7269
|
-
function requireNotBeforeError() {
|
|
7270
|
-
if (hasRequiredNotBeforeError) return NotBeforeError_1;
|
|
7271
|
-
hasRequiredNotBeforeError = 1;
|
|
7272
|
-
var JsonWebTokenError = requireJsonWebTokenError();
|
|
7273
|
-
var NotBeforeError = function(message2, date) {
|
|
7274
|
-
JsonWebTokenError.call(this, message2);
|
|
7275
|
-
this.name = "NotBeforeError";
|
|
7276
|
-
this.date = date;
|
|
7277
|
-
};
|
|
7278
|
-
NotBeforeError.prototype = Object.create(JsonWebTokenError.prototype);
|
|
7279
|
-
NotBeforeError.prototype.constructor = NotBeforeError;
|
|
7280
|
-
NotBeforeError_1 = NotBeforeError;
|
|
7281
|
-
return NotBeforeError_1;
|
|
7282
|
-
}
|
|
7283
|
-
function requireTokenExpiredError() {
|
|
7284
|
-
if (hasRequiredTokenExpiredError) return TokenExpiredError_1;
|
|
7285
|
-
hasRequiredTokenExpiredError = 1;
|
|
7286
|
-
var JsonWebTokenError = requireJsonWebTokenError();
|
|
7287
|
-
var TokenExpiredError = function(message2, expiredAt) {
|
|
7288
|
-
JsonWebTokenError.call(this, message2);
|
|
7289
|
-
this.name = "TokenExpiredError";
|
|
7290
|
-
this.expiredAt = expiredAt;
|
|
7291
|
-
};
|
|
7292
|
-
TokenExpiredError.prototype = Object.create(JsonWebTokenError.prototype);
|
|
7293
|
-
TokenExpiredError.prototype.constructor = TokenExpiredError;
|
|
7294
|
-
TokenExpiredError_1 = TokenExpiredError;
|
|
7295
|
-
return TokenExpiredError_1;
|
|
7296
|
-
}
|
|
7297
|
-
function requireMs() {
|
|
7298
|
-
if (hasRequiredMs) return ms;
|
|
7299
|
-
hasRequiredMs = 1;
|
|
7300
|
-
var s = 1e3;
|
|
7301
|
-
var m = s * 60;
|
|
7302
|
-
var h = m * 60;
|
|
7303
|
-
var d = h * 24;
|
|
7304
|
-
var w = d * 7;
|
|
7305
|
-
var y = d * 365.25;
|
|
7306
|
-
ms = function(val, options) {
|
|
7307
|
-
options = options || {};
|
|
7308
|
-
var type = typeof val;
|
|
7309
|
-
if (type === "string" && val.length > 0) {
|
|
7310
|
-
return parse2(val);
|
|
7311
|
-
} else if (type === "number" && isFinite(val)) {
|
|
7312
|
-
return options.long ? fmtLong(val) : fmtShort(val);
|
|
7313
|
-
}
|
|
7314
|
-
throw new Error(
|
|
7315
|
-
"val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
|
|
7316
|
-
);
|
|
7317
|
-
};
|
|
7318
|
-
function parse2(str) {
|
|
7319
|
-
str = String(str);
|
|
7320
|
-
if (str.length > 100) {
|
|
7321
|
-
return;
|
|
7322
|
-
}
|
|
7323
|
-
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(
|
|
7324
|
-
str
|
|
7325
|
-
);
|
|
7326
|
-
if (!match) {
|
|
7327
|
-
return;
|
|
7328
|
-
}
|
|
7329
|
-
var n = parseFloat(match[1]);
|
|
7330
|
-
var type = (match[2] || "ms").toLowerCase();
|
|
7331
|
-
switch (type) {
|
|
7332
|
-
case "years":
|
|
7333
|
-
case "year":
|
|
7334
|
-
case "yrs":
|
|
7335
|
-
case "yr":
|
|
7336
|
-
case "y":
|
|
7337
|
-
return n * y;
|
|
7338
|
-
case "weeks":
|
|
7339
|
-
case "week":
|
|
7340
|
-
case "w":
|
|
7341
|
-
return n * w;
|
|
7342
|
-
case "days":
|
|
7343
|
-
case "day":
|
|
7344
|
-
case "d":
|
|
7345
|
-
return n * d;
|
|
7346
|
-
case "hours":
|
|
7347
|
-
case "hour":
|
|
7348
|
-
case "hrs":
|
|
7349
|
-
case "hr":
|
|
7350
|
-
case "h":
|
|
7351
|
-
return n * h;
|
|
7352
|
-
case "minutes":
|
|
7353
|
-
case "minute":
|
|
7354
|
-
case "mins":
|
|
7355
|
-
case "min":
|
|
7356
|
-
case "m":
|
|
7357
|
-
return n * m;
|
|
7358
|
-
case "seconds":
|
|
7359
|
-
case "second":
|
|
7360
|
-
case "secs":
|
|
7361
|
-
case "sec":
|
|
7362
|
-
case "s":
|
|
7363
|
-
return n * s;
|
|
7364
|
-
case "milliseconds":
|
|
7365
|
-
case "millisecond":
|
|
7366
|
-
case "msecs":
|
|
7367
|
-
case "msec":
|
|
7368
|
-
case "ms":
|
|
7369
|
-
return n;
|
|
7370
|
-
default:
|
|
7371
|
-
return void 0;
|
|
7372
|
-
}
|
|
7373
|
-
}
|
|
7374
|
-
function fmtShort(ms2) {
|
|
7375
|
-
var msAbs = Math.abs(ms2);
|
|
7376
|
-
if (msAbs >= d) {
|
|
7377
|
-
return Math.round(ms2 / d) + "d";
|
|
7378
|
-
}
|
|
7379
|
-
if (msAbs >= h) {
|
|
7380
|
-
return Math.round(ms2 / h) + "h";
|
|
7381
|
-
}
|
|
7382
|
-
if (msAbs >= m) {
|
|
7383
|
-
return Math.round(ms2 / m) + "m";
|
|
7384
|
-
}
|
|
7385
|
-
if (msAbs >= s) {
|
|
7386
|
-
return Math.round(ms2 / s) + "s";
|
|
7387
|
-
}
|
|
7388
|
-
return ms2 + "ms";
|
|
7389
|
-
}
|
|
7390
|
-
function fmtLong(ms2) {
|
|
7391
|
-
var msAbs = Math.abs(ms2);
|
|
7392
|
-
if (msAbs >= d) {
|
|
7393
|
-
return plural(ms2, msAbs, d, "day");
|
|
7394
|
-
}
|
|
7395
|
-
if (msAbs >= h) {
|
|
7396
|
-
return plural(ms2, msAbs, h, "hour");
|
|
7397
|
-
}
|
|
7398
|
-
if (msAbs >= m) {
|
|
7399
|
-
return plural(ms2, msAbs, m, "minute");
|
|
7400
|
-
}
|
|
7401
|
-
if (msAbs >= s) {
|
|
7402
|
-
return plural(ms2, msAbs, s, "second");
|
|
7403
|
-
}
|
|
7404
|
-
return ms2 + " ms";
|
|
7405
|
-
}
|
|
7406
|
-
function plural(ms2, msAbs, n, name) {
|
|
7407
|
-
var isPlural = msAbs >= n * 1.5;
|
|
7408
|
-
return Math.round(ms2 / n) + " " + name + (isPlural ? "s" : "");
|
|
7409
|
-
}
|
|
7410
|
-
return ms;
|
|
7411
|
-
}
|
|
7412
|
-
function requireTimespan() {
|
|
7413
|
-
if (hasRequiredTimespan) return timespan;
|
|
7414
|
-
hasRequiredTimespan = 1;
|
|
7415
|
-
var ms2 = requireMs();
|
|
7416
|
-
timespan = function(time2, iat) {
|
|
7417
|
-
var timestamp = iat || Math.floor(Date.now() / 1e3);
|
|
7418
|
-
if (typeof time2 === "string") {
|
|
7419
|
-
var milliseconds = ms2(time2);
|
|
7420
|
-
if (typeof milliseconds === "undefined") {
|
|
7421
|
-
return;
|
|
7422
|
-
}
|
|
7423
|
-
return Math.floor(timestamp + milliseconds / 1e3);
|
|
7424
|
-
} else if (typeof time2 === "number") {
|
|
7425
|
-
return timestamp + time2;
|
|
7426
|
-
} else {
|
|
7427
|
-
return;
|
|
7428
|
-
}
|
|
7429
|
-
};
|
|
7430
|
-
return timespan;
|
|
7431
|
-
}
|
|
7432
|
-
function requireConstants() {
|
|
7433
|
-
if (hasRequiredConstants) return constants;
|
|
7434
|
-
hasRequiredConstants = 1;
|
|
7435
|
-
const SEMVER_SPEC_VERSION = "2.0.0";
|
|
7436
|
-
const MAX_LENGTH = 256;
|
|
7437
|
-
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
|
|
7438
|
-
9007199254740991;
|
|
7439
|
-
const MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
7440
|
-
const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
|
|
7441
|
-
const RELEASE_TYPES = [
|
|
7442
|
-
"major",
|
|
7443
|
-
"premajor",
|
|
7444
|
-
"minor",
|
|
7445
|
-
"preminor",
|
|
7446
|
-
"patch",
|
|
7447
|
-
"prepatch",
|
|
7448
|
-
"prerelease"
|
|
7449
|
-
];
|
|
7450
|
-
constants = {
|
|
7451
|
-
MAX_LENGTH,
|
|
7452
|
-
MAX_SAFE_COMPONENT_LENGTH,
|
|
7453
|
-
MAX_SAFE_BUILD_LENGTH,
|
|
7454
|
-
MAX_SAFE_INTEGER,
|
|
7455
|
-
RELEASE_TYPES,
|
|
7456
|
-
SEMVER_SPEC_VERSION,
|
|
7457
|
-
FLAG_INCLUDE_PRERELEASE: 1,
|
|
7458
|
-
FLAG_LOOSE: 2
|
|
7459
|
-
};
|
|
7460
|
-
return constants;
|
|
7461
|
-
}
|
|
7462
|
-
function requireDebug() {
|
|
7463
|
-
if (hasRequiredDebug) return debug_1;
|
|
7464
|
-
hasRequiredDebug = 1;
|
|
7465
|
-
const debug3 = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
|
|
7466
|
-
};
|
|
7467
|
-
debug_1 = debug3;
|
|
7468
|
-
return debug_1;
|
|
7469
|
-
}
|
|
7470
|
-
function requireRe() {
|
|
7471
|
-
if (hasRequiredRe) return re.exports;
|
|
7472
|
-
hasRequiredRe = 1;
|
|
7473
|
-
(function(module, exports) {
|
|
7474
|
-
const {
|
|
7475
|
-
MAX_SAFE_COMPONENT_LENGTH,
|
|
7476
|
-
MAX_SAFE_BUILD_LENGTH,
|
|
7477
|
-
MAX_LENGTH
|
|
7478
|
-
} = requireConstants();
|
|
7479
|
-
const debug3 = requireDebug();
|
|
7480
|
-
exports = module.exports = {};
|
|
7481
|
-
const re2 = exports.re = [];
|
|
7482
|
-
const safeRe = exports.safeRe = [];
|
|
7483
|
-
const src = exports.src = [];
|
|
7484
|
-
const safeSrc = exports.safeSrc = [];
|
|
7485
|
-
const t = exports.t = {};
|
|
7486
|
-
let R = 0;
|
|
7487
|
-
const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
7488
|
-
const safeRegexReplacements = [
|
|
7489
|
-
["\\s", 1],
|
|
7490
|
-
["\\d", MAX_LENGTH],
|
|
7491
|
-
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
7492
|
-
];
|
|
7493
|
-
const makeSafeRegex = (value) => {
|
|
7494
|
-
for (const [token, max] of safeRegexReplacements) {
|
|
7495
|
-
value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
7496
|
-
}
|
|
7497
|
-
return value;
|
|
7498
|
-
};
|
|
7499
|
-
const createToken = (name, value, isGlobal) => {
|
|
7500
|
-
const safe = makeSafeRegex(value);
|
|
7501
|
-
const index22 = R++;
|
|
7502
|
-
debug3(name, index22, value);
|
|
7503
|
-
t[name] = index22;
|
|
7504
|
-
src[index22] = value;
|
|
7505
|
-
safeSrc[index22] = safe;
|
|
7506
|
-
re2[index22] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
7507
|
-
safeRe[index22] = new RegExp(safe, isGlobal ? "g" : void 0);
|
|
7508
|
-
};
|
|
7509
|
-
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
7510
|
-
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
7511
|
-
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
7512
|
-
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
|
|
7513
|
-
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
7514
|
-
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`);
|
|
7515
|
-
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`);
|
|
7516
|
-
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
7517
|
-
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
7518
|
-
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
7519
|
-
createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
7520
|
-
createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
|
7521
|
-
createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
|
7522
|
-
createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
|
7523
|
-
createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
|
7524
|
-
createToken("GTLT", "((?:<|>)?=?)");
|
|
7525
|
-
createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
7526
|
-
createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
7527
|
-
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
|
|
7528
|
-
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
|
|
7529
|
-
createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
7530
|
-
createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
7531
|
-
createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
7532
|
-
createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
7533
|
-
createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
|
|
7534
|
-
createToken("COERCERTL", src[t.COERCE], true);
|
|
7535
|
-
createToken("COERCERTLFULL", src[t.COERCEFULL], true);
|
|
7536
|
-
createToken("LONETILDE", "(?:~>?)");
|
|
7537
|
-
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
7538
|
-
exports.tildeTrimReplace = "$1~";
|
|
7539
|
-
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
7540
|
-
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
7541
|
-
createToken("LONECARET", "(?:\\^)");
|
|
7542
|
-
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
7543
|
-
exports.caretTrimReplace = "$1^";
|
|
7544
|
-
createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
7545
|
-
createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
7546
|
-
createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
7547
|
-
createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
7548
|
-
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
7549
|
-
exports.comparatorTrimReplace = "$1$2$3";
|
|
7550
|
-
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
|
|
7551
|
-
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
|
|
7552
|
-
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
7553
|
-
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
7554
|
-
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
7555
|
-
})(re, re.exports);
|
|
7556
|
-
return re.exports;
|
|
7557
|
-
}
|
|
7558
|
-
function requireParseOptions() {
|
|
7559
|
-
if (hasRequiredParseOptions) return parseOptions_1;
|
|
7560
|
-
hasRequiredParseOptions = 1;
|
|
7561
|
-
const looseOption = Object.freeze({ loose: true });
|
|
7562
|
-
const emptyOpts = Object.freeze({});
|
|
7563
|
-
const parseOptions = (options) => {
|
|
7564
|
-
if (!options) {
|
|
7565
|
-
return emptyOpts;
|
|
7566
|
-
}
|
|
7567
|
-
if (typeof options !== "object") {
|
|
7568
|
-
return looseOption;
|
|
7569
|
-
}
|
|
7570
|
-
return options;
|
|
7571
|
-
};
|
|
7572
|
-
parseOptions_1 = parseOptions;
|
|
7573
|
-
return parseOptions_1;
|
|
7574
|
-
}
|
|
7575
|
-
function requireIdentifiers() {
|
|
7576
|
-
if (hasRequiredIdentifiers) return identifiers;
|
|
7577
|
-
hasRequiredIdentifiers = 1;
|
|
7578
|
-
const numeric = /^[0-9]+$/;
|
|
7579
|
-
const compareIdentifiers = (a, b) => {
|
|
7580
|
-
const anum = numeric.test(a);
|
|
7581
|
-
const bnum = numeric.test(b);
|
|
7582
|
-
if (anum && bnum) {
|
|
7583
|
-
a = +a;
|
|
7584
|
-
b = +b;
|
|
7585
|
-
}
|
|
7586
|
-
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
7587
|
-
};
|
|
7588
|
-
const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
|
7589
|
-
identifiers = {
|
|
7590
|
-
compareIdentifiers,
|
|
7591
|
-
rcompareIdentifiers
|
|
7592
|
-
};
|
|
7593
|
-
return identifiers;
|
|
7594
|
-
}
|
|
7595
|
-
function requireSemver$1() {
|
|
7596
|
-
if (hasRequiredSemver$1) return semver$1;
|
|
7597
|
-
hasRequiredSemver$1 = 1;
|
|
7598
|
-
const debug3 = requireDebug();
|
|
7599
|
-
const { MAX_LENGTH, MAX_SAFE_INTEGER } = requireConstants();
|
|
7600
|
-
const { safeRe: re2, safeSrc: src, t } = requireRe();
|
|
7601
|
-
const parseOptions = requireParseOptions();
|
|
7602
|
-
const { compareIdentifiers } = requireIdentifiers();
|
|
7603
|
-
class SemVer {
|
|
7604
|
-
constructor(version2, options) {
|
|
7605
|
-
options = parseOptions(options);
|
|
7606
|
-
if (version2 instanceof SemVer) {
|
|
7607
|
-
if (version2.loose === !!options.loose && version2.includePrerelease === !!options.includePrerelease) {
|
|
7608
|
-
return version2;
|
|
7609
|
-
} else {
|
|
7610
|
-
version2 = version2.version;
|
|
7611
|
-
}
|
|
7612
|
-
} else if (typeof version2 !== "string") {
|
|
7613
|
-
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version2}".`);
|
|
7614
|
-
}
|
|
7615
|
-
if (version2.length > MAX_LENGTH) {
|
|
7616
|
-
throw new TypeError(
|
|
7617
|
-
`version is longer than ${MAX_LENGTH} characters`
|
|
7618
|
-
);
|
|
7619
|
-
}
|
|
7620
|
-
debug3("SemVer", version2, options);
|
|
7621
|
-
this.options = options;
|
|
7622
|
-
this.loose = !!options.loose;
|
|
7623
|
-
this.includePrerelease = !!options.includePrerelease;
|
|
7624
|
-
const m = version2.trim().match(options.loose ? re2[t.LOOSE] : re2[t.FULL]);
|
|
7625
|
-
if (!m) {
|
|
7626
|
-
throw new TypeError(`Invalid Version: ${version2}`);
|
|
7627
|
-
}
|
|
7628
|
-
this.raw = version2;
|
|
7629
|
-
this.major = +m[1];
|
|
7630
|
-
this.minor = +m[2];
|
|
7631
|
-
this.patch = +m[3];
|
|
7632
|
-
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
7633
|
-
throw new TypeError("Invalid major version");
|
|
7634
|
-
}
|
|
7635
|
-
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
7636
|
-
throw new TypeError("Invalid minor version");
|
|
7637
|
-
}
|
|
7638
|
-
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
7639
|
-
throw new TypeError("Invalid patch version");
|
|
7640
|
-
}
|
|
7641
|
-
if (!m[4]) {
|
|
7642
|
-
this.prerelease = [];
|
|
7643
|
-
} else {
|
|
7644
|
-
this.prerelease = m[4].split(".").map((id) => {
|
|
7645
|
-
if (/^[0-9]+$/.test(id)) {
|
|
7646
|
-
const num = +id;
|
|
7647
|
-
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
7648
|
-
return num;
|
|
7649
|
-
}
|
|
7650
|
-
}
|
|
7651
|
-
return id;
|
|
7652
|
-
});
|
|
7653
|
-
}
|
|
7654
|
-
this.build = m[5] ? m[5].split(".") : [];
|
|
7655
|
-
this.format();
|
|
7656
|
-
}
|
|
7657
|
-
format() {
|
|
7658
|
-
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
7659
|
-
if (this.prerelease.length) {
|
|
7660
|
-
this.version += `-${this.prerelease.join(".")}`;
|
|
7661
|
-
}
|
|
7662
|
-
return this.version;
|
|
7663
|
-
}
|
|
7664
|
-
toString() {
|
|
7665
|
-
return this.version;
|
|
7666
|
-
}
|
|
7667
|
-
compare(other2) {
|
|
7668
|
-
debug3("SemVer.compare", this.version, this.options, other2);
|
|
7669
|
-
if (!(other2 instanceof SemVer)) {
|
|
7670
|
-
if (typeof other2 === "string" && other2 === this.version) {
|
|
7671
|
-
return 0;
|
|
7672
|
-
}
|
|
7673
|
-
other2 = new SemVer(other2, this.options);
|
|
7674
|
-
}
|
|
7675
|
-
if (other2.version === this.version) {
|
|
7676
|
-
return 0;
|
|
7677
|
-
}
|
|
7678
|
-
return this.compareMain(other2) || this.comparePre(other2);
|
|
7679
|
-
}
|
|
7680
|
-
compareMain(other2) {
|
|
7681
|
-
if (!(other2 instanceof SemVer)) {
|
|
7682
|
-
other2 = new SemVer(other2, this.options);
|
|
7683
|
-
}
|
|
7684
|
-
return compareIdentifiers(this.major, other2.major) || compareIdentifiers(this.minor, other2.minor) || compareIdentifiers(this.patch, other2.patch);
|
|
7685
|
-
}
|
|
7686
|
-
comparePre(other2) {
|
|
7687
|
-
if (!(other2 instanceof SemVer)) {
|
|
7688
|
-
other2 = new SemVer(other2, this.options);
|
|
7689
|
-
}
|
|
7690
|
-
if (this.prerelease.length && !other2.prerelease.length) {
|
|
7691
|
-
return -1;
|
|
7692
|
-
} else if (!this.prerelease.length && other2.prerelease.length) {
|
|
7693
|
-
return 1;
|
|
7694
|
-
} else if (!this.prerelease.length && !other2.prerelease.length) {
|
|
7695
|
-
return 0;
|
|
7696
|
-
}
|
|
7697
|
-
let i = 0;
|
|
7698
|
-
do {
|
|
7699
|
-
const a = this.prerelease[i];
|
|
7700
|
-
const b = other2.prerelease[i];
|
|
7701
|
-
debug3("prerelease compare", i, a, b);
|
|
7702
|
-
if (a === void 0 && b === void 0) {
|
|
7703
|
-
return 0;
|
|
7704
|
-
} else if (b === void 0) {
|
|
7705
|
-
return 1;
|
|
7706
|
-
} else if (a === void 0) {
|
|
7707
|
-
return -1;
|
|
7708
|
-
} else if (a === b) {
|
|
7709
|
-
continue;
|
|
7710
|
-
} else {
|
|
7711
|
-
return compareIdentifiers(a, b);
|
|
7712
|
-
}
|
|
7713
|
-
} while (++i);
|
|
7714
|
-
}
|
|
7715
|
-
compareBuild(other2) {
|
|
7716
|
-
if (!(other2 instanceof SemVer)) {
|
|
7717
|
-
other2 = new SemVer(other2, this.options);
|
|
7718
|
-
}
|
|
7719
|
-
let i = 0;
|
|
7720
|
-
do {
|
|
7721
|
-
const a = this.build[i];
|
|
7722
|
-
const b = other2.build[i];
|
|
7723
|
-
debug3("build compare", i, a, b);
|
|
7724
|
-
if (a === void 0 && b === void 0) {
|
|
7725
|
-
return 0;
|
|
7726
|
-
} else if (b === void 0) {
|
|
7727
|
-
return 1;
|
|
7728
|
-
} else if (a === void 0) {
|
|
7729
|
-
return -1;
|
|
7730
|
-
} else if (a === b) {
|
|
7731
|
-
continue;
|
|
7732
|
-
} else {
|
|
7733
|
-
return compareIdentifiers(a, b);
|
|
7734
|
-
}
|
|
7735
|
-
} while (++i);
|
|
7736
|
-
}
|
|
7737
|
-
// preminor will bump the version up to the next minor release, and immediately
|
|
7738
|
-
// down to pre-release. premajor and prepatch work the same way.
|
|
7739
|
-
inc(release, identifier, identifierBase) {
|
|
7740
|
-
if (release.startsWith("pre")) {
|
|
7741
|
-
if (!identifier && identifierBase === false) {
|
|
7742
|
-
throw new Error("invalid increment argument: identifier is empty");
|
|
7743
|
-
}
|
|
7744
|
-
if (identifier) {
|
|
7745
|
-
const r = new RegExp(`^${this.options.loose ? src[t.PRERELEASELOOSE] : src[t.PRERELEASE]}$`);
|
|
7746
|
-
const match = `-${identifier}`.match(r);
|
|
7747
|
-
if (!match || match[1] !== identifier) {
|
|
7748
|
-
throw new Error(`invalid identifier: ${identifier}`);
|
|
7749
|
-
}
|
|
7750
|
-
}
|
|
7751
|
-
}
|
|
7752
|
-
switch (release) {
|
|
7753
|
-
case "premajor":
|
|
7754
|
-
this.prerelease.length = 0;
|
|
7755
|
-
this.patch = 0;
|
|
7756
|
-
this.minor = 0;
|
|
7757
|
-
this.major++;
|
|
7758
|
-
this.inc("pre", identifier, identifierBase);
|
|
7759
|
-
break;
|
|
7760
|
-
case "preminor":
|
|
7761
|
-
this.prerelease.length = 0;
|
|
7762
|
-
this.patch = 0;
|
|
7763
|
-
this.minor++;
|
|
7764
|
-
this.inc("pre", identifier, identifierBase);
|
|
7765
|
-
break;
|
|
7766
|
-
case "prepatch":
|
|
7767
|
-
this.prerelease.length = 0;
|
|
7768
|
-
this.inc("patch", identifier, identifierBase);
|
|
7769
|
-
this.inc("pre", identifier, identifierBase);
|
|
7770
|
-
break;
|
|
7771
|
-
// If the input is a non-prerelease version, this acts the same as
|
|
7772
|
-
// prepatch.
|
|
7773
|
-
case "prerelease":
|
|
7774
|
-
if (this.prerelease.length === 0) {
|
|
7775
|
-
this.inc("patch", identifier, identifierBase);
|
|
7776
|
-
}
|
|
7777
|
-
this.inc("pre", identifier, identifierBase);
|
|
7778
|
-
break;
|
|
7779
|
-
case "release":
|
|
7780
|
-
if (this.prerelease.length === 0) {
|
|
7781
|
-
throw new Error(`version ${this.raw} is not a prerelease`);
|
|
7782
|
-
}
|
|
7783
|
-
this.prerelease.length = 0;
|
|
7784
|
-
break;
|
|
7785
|
-
case "major":
|
|
7786
|
-
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
7787
|
-
this.major++;
|
|
7788
|
-
}
|
|
7789
|
-
this.minor = 0;
|
|
7790
|
-
this.patch = 0;
|
|
7791
|
-
this.prerelease = [];
|
|
7792
|
-
break;
|
|
7793
|
-
case "minor":
|
|
7794
|
-
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
7795
|
-
this.minor++;
|
|
7796
|
-
}
|
|
7797
|
-
this.patch = 0;
|
|
7798
|
-
this.prerelease = [];
|
|
7799
|
-
break;
|
|
7800
|
-
case "patch":
|
|
7801
|
-
if (this.prerelease.length === 0) {
|
|
7802
|
-
this.patch++;
|
|
7803
|
-
}
|
|
7804
|
-
this.prerelease = [];
|
|
7805
|
-
break;
|
|
7806
|
-
// This probably shouldn't be used publicly.
|
|
7807
|
-
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
|
7808
|
-
case "pre": {
|
|
7809
|
-
const base = Number(identifierBase) ? 1 : 0;
|
|
7810
|
-
if (this.prerelease.length === 0) {
|
|
7811
|
-
this.prerelease = [base];
|
|
7812
|
-
} else {
|
|
7813
|
-
let i = this.prerelease.length;
|
|
7814
|
-
while (--i >= 0) {
|
|
7815
|
-
if (typeof this.prerelease[i] === "number") {
|
|
7816
|
-
this.prerelease[i]++;
|
|
7817
|
-
i = -2;
|
|
7818
|
-
}
|
|
7819
|
-
}
|
|
7820
|
-
if (i === -1) {
|
|
7821
|
-
if (identifier === this.prerelease.join(".") && identifierBase === false) {
|
|
7822
|
-
throw new Error("invalid increment argument: identifier already exists");
|
|
7823
|
-
}
|
|
7824
|
-
this.prerelease.push(base);
|
|
7825
|
-
}
|
|
7826
|
-
}
|
|
7827
|
-
if (identifier) {
|
|
7828
|
-
let prerelease = [identifier, base];
|
|
7829
|
-
if (identifierBase === false) {
|
|
7830
|
-
prerelease = [identifier];
|
|
7831
|
-
}
|
|
7832
|
-
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
|
7833
|
-
if (isNaN(this.prerelease[1])) {
|
|
7834
|
-
this.prerelease = prerelease;
|
|
7835
|
-
}
|
|
7836
|
-
} else {
|
|
7837
|
-
this.prerelease = prerelease;
|
|
7838
|
-
}
|
|
7839
|
-
}
|
|
7840
|
-
break;
|
|
7841
|
-
}
|
|
7842
|
-
default:
|
|
7843
|
-
throw new Error(`invalid increment argument: ${release}`);
|
|
7844
|
-
}
|
|
7845
|
-
this.raw = this.format();
|
|
7846
|
-
if (this.build.length) {
|
|
7847
|
-
this.raw += `+${this.build.join(".")}`;
|
|
7848
|
-
}
|
|
7849
|
-
return this;
|
|
7850
|
-
}
|
|
7851
|
-
}
|
|
7852
|
-
semver$1 = SemVer;
|
|
7853
|
-
return semver$1;
|
|
7854
|
-
}
|
|
7855
|
-
function requireParse() {
|
|
7856
|
-
if (hasRequiredParse) return parse_1;
|
|
7857
|
-
hasRequiredParse = 1;
|
|
7858
|
-
const SemVer = requireSemver$1();
|
|
7859
|
-
const parse2 = (version2, options, throwErrors = false) => {
|
|
7860
|
-
if (version2 instanceof SemVer) {
|
|
7861
|
-
return version2;
|
|
7862
|
-
}
|
|
7863
|
-
try {
|
|
7864
|
-
return new SemVer(version2, options);
|
|
7865
|
-
} catch (er) {
|
|
7866
|
-
if (!throwErrors) {
|
|
7867
|
-
return null;
|
|
7868
|
-
}
|
|
7869
|
-
throw er;
|
|
7870
|
-
}
|
|
7871
|
-
};
|
|
7872
|
-
parse_1 = parse2;
|
|
7873
|
-
return parse_1;
|
|
7874
|
-
}
|
|
7875
|
-
function requireValid$1() {
|
|
7876
|
-
if (hasRequiredValid$1) return valid_1;
|
|
7877
|
-
hasRequiredValid$1 = 1;
|
|
7878
|
-
const parse2 = requireParse();
|
|
7879
|
-
const valid2 = (version2, options) => {
|
|
7880
|
-
const v = parse2(version2, options);
|
|
7881
|
-
return v ? v.version : null;
|
|
7882
|
-
};
|
|
7883
|
-
valid_1 = valid2;
|
|
7884
|
-
return valid_1;
|
|
7885
|
-
}
|
|
7886
|
-
function requireClean() {
|
|
7887
|
-
if (hasRequiredClean) return clean_1;
|
|
7888
|
-
hasRequiredClean = 1;
|
|
7889
|
-
const parse2 = requireParse();
|
|
7890
|
-
const clean = (version2, options) => {
|
|
7891
|
-
const s = parse2(version2.trim().replace(/^[=v]+/, ""), options);
|
|
7892
|
-
return s ? s.version : null;
|
|
7893
|
-
};
|
|
7894
|
-
clean_1 = clean;
|
|
7895
|
-
return clean_1;
|
|
7896
|
-
}
|
|
7897
|
-
function requireInc() {
|
|
7898
|
-
if (hasRequiredInc) return inc_1;
|
|
7899
|
-
hasRequiredInc = 1;
|
|
7900
|
-
const SemVer = requireSemver$1();
|
|
7901
|
-
const inc = (version2, release, options, identifier, identifierBase) => {
|
|
7902
|
-
if (typeof options === "string") {
|
|
7903
|
-
identifierBase = identifier;
|
|
7904
|
-
identifier = options;
|
|
7905
|
-
options = void 0;
|
|
7906
|
-
}
|
|
7907
|
-
try {
|
|
7908
|
-
return new SemVer(
|
|
7909
|
-
version2 instanceof SemVer ? version2.version : version2,
|
|
7910
|
-
options
|
|
7911
|
-
).inc(release, identifier, identifierBase).version;
|
|
7912
|
-
} catch (er) {
|
|
7913
|
-
return null;
|
|
7914
|
-
}
|
|
7915
|
-
};
|
|
7916
|
-
inc_1 = inc;
|
|
7917
|
-
return inc_1;
|
|
7918
|
-
}
|
|
7919
|
-
function requireDiff() {
|
|
7920
|
-
if (hasRequiredDiff) return diff_1;
|
|
7921
|
-
hasRequiredDiff = 1;
|
|
7922
|
-
const parse2 = requireParse();
|
|
7923
|
-
const diff = (version1, version2) => {
|
|
7924
|
-
const v1 = parse2(version1, null, true);
|
|
7925
|
-
const v2 = parse2(version2, null, true);
|
|
7926
|
-
const comparison = v1.compare(v2);
|
|
7927
|
-
if (comparison === 0) {
|
|
7928
|
-
return null;
|
|
7929
|
-
}
|
|
7930
|
-
const v1Higher = comparison > 0;
|
|
7931
|
-
const highVersion = v1Higher ? v1 : v2;
|
|
7932
|
-
const lowVersion = v1Higher ? v2 : v1;
|
|
7933
|
-
const highHasPre = !!highVersion.prerelease.length;
|
|
7934
|
-
const lowHasPre = !!lowVersion.prerelease.length;
|
|
7935
|
-
if (lowHasPre && !highHasPre) {
|
|
7936
|
-
if (!lowVersion.patch && !lowVersion.minor) {
|
|
7937
|
-
return "major";
|
|
7938
|
-
}
|
|
7939
|
-
if (lowVersion.compareMain(highVersion) === 0) {
|
|
7940
|
-
if (lowVersion.minor && !lowVersion.patch) {
|
|
7941
|
-
return "minor";
|
|
7942
|
-
}
|
|
7943
|
-
return "patch";
|
|
7944
|
-
}
|
|
7945
|
-
}
|
|
7946
|
-
const prefix = highHasPre ? "pre" : "";
|
|
7947
|
-
if (v1.major !== v2.major) {
|
|
7948
|
-
return prefix + "major";
|
|
7949
|
-
}
|
|
7950
|
-
if (v1.minor !== v2.minor) {
|
|
7951
|
-
return prefix + "minor";
|
|
7952
|
-
}
|
|
7953
|
-
if (v1.patch !== v2.patch) {
|
|
7954
|
-
return prefix + "patch";
|
|
7955
|
-
}
|
|
7956
|
-
return "prerelease";
|
|
7957
|
-
};
|
|
7958
|
-
diff_1 = diff;
|
|
7959
|
-
return diff_1;
|
|
7960
|
-
}
|
|
7961
|
-
function requireMajor() {
|
|
7962
|
-
if (hasRequiredMajor) return major_1;
|
|
7963
|
-
hasRequiredMajor = 1;
|
|
7964
|
-
const SemVer = requireSemver$1();
|
|
7965
|
-
const major = (a, loose) => new SemVer(a, loose).major;
|
|
7966
|
-
major_1 = major;
|
|
7967
|
-
return major_1;
|
|
7968
|
-
}
|
|
7969
|
-
function requireMinor() {
|
|
7970
|
-
if (hasRequiredMinor) return minor_1;
|
|
7971
|
-
hasRequiredMinor = 1;
|
|
7972
|
-
const SemVer = requireSemver$1();
|
|
7973
|
-
const minor = (a, loose) => new SemVer(a, loose).minor;
|
|
7974
|
-
minor_1 = minor;
|
|
7975
|
-
return minor_1;
|
|
7976
|
-
}
|
|
7977
|
-
function requirePatch() {
|
|
7978
|
-
if (hasRequiredPatch) return patch_1;
|
|
7979
|
-
hasRequiredPatch = 1;
|
|
7980
|
-
const SemVer = requireSemver$1();
|
|
7981
|
-
const patch = (a, loose) => new SemVer(a, loose).patch;
|
|
7982
|
-
patch_1 = patch;
|
|
7983
|
-
return patch_1;
|
|
7984
|
-
}
|
|
7985
|
-
function requirePrerelease() {
|
|
7986
|
-
if (hasRequiredPrerelease) return prerelease_1;
|
|
7987
|
-
hasRequiredPrerelease = 1;
|
|
7988
|
-
const parse2 = requireParse();
|
|
7989
|
-
const prerelease = (version2, options) => {
|
|
7990
|
-
const parsed = parse2(version2, options);
|
|
7991
|
-
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
7992
|
-
};
|
|
7993
|
-
prerelease_1 = prerelease;
|
|
7994
|
-
return prerelease_1;
|
|
7995
|
-
}
|
|
7996
|
-
function requireCompare() {
|
|
7997
|
-
if (hasRequiredCompare) return compare_1;
|
|
7998
|
-
hasRequiredCompare = 1;
|
|
7999
|
-
const SemVer = requireSemver$1();
|
|
8000
|
-
const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
8001
|
-
compare_1 = compare;
|
|
8002
|
-
return compare_1;
|
|
8003
|
-
}
|
|
8004
|
-
function requireRcompare() {
|
|
8005
|
-
if (hasRequiredRcompare) return rcompare_1;
|
|
8006
|
-
hasRequiredRcompare = 1;
|
|
8007
|
-
const compare = requireCompare();
|
|
8008
|
-
const rcompare = (a, b, loose) => compare(b, a, loose);
|
|
8009
|
-
rcompare_1 = rcompare;
|
|
8010
|
-
return rcompare_1;
|
|
8011
|
-
}
|
|
8012
|
-
function requireCompareLoose() {
|
|
8013
|
-
if (hasRequiredCompareLoose) return compareLoose_1;
|
|
8014
|
-
hasRequiredCompareLoose = 1;
|
|
8015
|
-
const compare = requireCompare();
|
|
8016
|
-
const compareLoose = (a, b) => compare(a, b, true);
|
|
8017
|
-
compareLoose_1 = compareLoose;
|
|
8018
|
-
return compareLoose_1;
|
|
8019
|
-
}
|
|
8020
|
-
function requireCompareBuild() {
|
|
8021
|
-
if (hasRequiredCompareBuild) return compareBuild_1;
|
|
8022
|
-
hasRequiredCompareBuild = 1;
|
|
8023
|
-
const SemVer = requireSemver$1();
|
|
8024
|
-
const compareBuild = (a, b, loose) => {
|
|
8025
|
-
const versionA = new SemVer(a, loose);
|
|
8026
|
-
const versionB = new SemVer(b, loose);
|
|
8027
|
-
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
8028
|
-
};
|
|
8029
|
-
compareBuild_1 = compareBuild;
|
|
8030
|
-
return compareBuild_1;
|
|
8031
|
-
}
|
|
8032
|
-
function requireSort() {
|
|
8033
|
-
if (hasRequiredSort) return sort_1;
|
|
8034
|
-
hasRequiredSort = 1;
|
|
8035
|
-
const compareBuild = requireCompareBuild();
|
|
8036
|
-
const sort = (list2, loose) => list2.sort((a, b) => compareBuild(a, b, loose));
|
|
8037
|
-
sort_1 = sort;
|
|
8038
|
-
return sort_1;
|
|
8039
|
-
}
|
|
8040
|
-
function requireRsort() {
|
|
8041
|
-
if (hasRequiredRsort) return rsort_1;
|
|
8042
|
-
hasRequiredRsort = 1;
|
|
8043
|
-
const compareBuild = requireCompareBuild();
|
|
8044
|
-
const rsort = (list2, loose) => list2.sort((a, b) => compareBuild(b, a, loose));
|
|
8045
|
-
rsort_1 = rsort;
|
|
8046
|
-
return rsort_1;
|
|
8047
|
-
}
|
|
8048
|
-
function requireGt() {
|
|
8049
|
-
if (hasRequiredGt) return gt_1;
|
|
8050
|
-
hasRequiredGt = 1;
|
|
8051
|
-
const compare = requireCompare();
|
|
8052
|
-
const gt = (a, b, loose) => compare(a, b, loose) > 0;
|
|
8053
|
-
gt_1 = gt;
|
|
8054
|
-
return gt_1;
|
|
8055
|
-
}
|
|
8056
|
-
function requireLt() {
|
|
8057
|
-
if (hasRequiredLt) return lt_1;
|
|
8058
|
-
hasRequiredLt = 1;
|
|
8059
|
-
const compare = requireCompare();
|
|
8060
|
-
const lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
8061
|
-
lt_1 = lt;
|
|
8062
|
-
return lt_1;
|
|
8063
|
-
}
|
|
8064
|
-
function requireEq() {
|
|
8065
|
-
if (hasRequiredEq) return eq_1;
|
|
8066
|
-
hasRequiredEq = 1;
|
|
8067
|
-
const compare = requireCompare();
|
|
8068
|
-
const eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
8069
|
-
eq_1 = eq;
|
|
8070
|
-
return eq_1;
|
|
8071
|
-
}
|
|
8072
|
-
function requireNeq() {
|
|
8073
|
-
if (hasRequiredNeq) return neq_1;
|
|
8074
|
-
hasRequiredNeq = 1;
|
|
8075
|
-
const compare = requireCompare();
|
|
8076
|
-
const neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
8077
|
-
neq_1 = neq;
|
|
8078
|
-
return neq_1;
|
|
8079
|
-
}
|
|
8080
|
-
function requireGte() {
|
|
8081
|
-
if (hasRequiredGte) return gte_1;
|
|
8082
|
-
hasRequiredGte = 1;
|
|
8083
|
-
const compare = requireCompare();
|
|
8084
|
-
const gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
8085
|
-
gte_1 = gte;
|
|
8086
|
-
return gte_1;
|
|
8087
|
-
}
|
|
8088
|
-
function requireLte() {
|
|
8089
|
-
if (hasRequiredLte) return lte_1;
|
|
8090
|
-
hasRequiredLte = 1;
|
|
8091
|
-
const compare = requireCompare();
|
|
8092
|
-
const lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
8093
|
-
lte_1 = lte;
|
|
8094
|
-
return lte_1;
|
|
8095
|
-
}
|
|
8096
|
-
function requireCmp() {
|
|
8097
|
-
if (hasRequiredCmp) return cmp_1;
|
|
8098
|
-
hasRequiredCmp = 1;
|
|
8099
|
-
const eq = requireEq();
|
|
8100
|
-
const neq = requireNeq();
|
|
8101
|
-
const gt = requireGt();
|
|
8102
|
-
const gte = requireGte();
|
|
8103
|
-
const lt = requireLt();
|
|
8104
|
-
const lte = requireLte();
|
|
8105
|
-
const cmp = (a, op, b, loose) => {
|
|
8106
|
-
switch (op) {
|
|
8107
|
-
case "===":
|
|
8108
|
-
if (typeof a === "object") {
|
|
8109
|
-
a = a.version;
|
|
8110
|
-
}
|
|
8111
|
-
if (typeof b === "object") {
|
|
8112
|
-
b = b.version;
|
|
8113
|
-
}
|
|
8114
|
-
return a === b;
|
|
8115
|
-
case "!==":
|
|
8116
|
-
if (typeof a === "object") {
|
|
8117
|
-
a = a.version;
|
|
8118
|
-
}
|
|
8119
|
-
if (typeof b === "object") {
|
|
8120
|
-
b = b.version;
|
|
8121
|
-
}
|
|
8122
|
-
return a !== b;
|
|
8123
|
-
case "":
|
|
8124
|
-
case "=":
|
|
8125
|
-
case "==":
|
|
8126
|
-
return eq(a, b, loose);
|
|
8127
|
-
case "!=":
|
|
8128
|
-
return neq(a, b, loose);
|
|
8129
|
-
case ">":
|
|
8130
|
-
return gt(a, b, loose);
|
|
8131
|
-
case ">=":
|
|
8132
|
-
return gte(a, b, loose);
|
|
8133
|
-
case "<":
|
|
8134
|
-
return lt(a, b, loose);
|
|
8135
|
-
case "<=":
|
|
8136
|
-
return lte(a, b, loose);
|
|
8137
|
-
default:
|
|
8138
|
-
throw new TypeError(`Invalid operator: ${op}`);
|
|
8139
|
-
}
|
|
8140
|
-
};
|
|
8141
|
-
cmp_1 = cmp;
|
|
8142
|
-
return cmp_1;
|
|
8143
|
-
}
|
|
8144
|
-
function requireCoerce() {
|
|
8145
|
-
if (hasRequiredCoerce) return coerce_1;
|
|
8146
|
-
hasRequiredCoerce = 1;
|
|
8147
|
-
const SemVer = requireSemver$1();
|
|
8148
|
-
const parse2 = requireParse();
|
|
8149
|
-
const { safeRe: re2, t } = requireRe();
|
|
8150
|
-
const coerce = (version2, options) => {
|
|
8151
|
-
if (version2 instanceof SemVer) {
|
|
8152
|
-
return version2;
|
|
8153
|
-
}
|
|
8154
|
-
if (typeof version2 === "number") {
|
|
8155
|
-
version2 = String(version2);
|
|
8156
|
-
}
|
|
8157
|
-
if (typeof version2 !== "string") {
|
|
8158
|
-
return null;
|
|
8159
|
-
}
|
|
8160
|
-
options = options || {};
|
|
8161
|
-
let match = null;
|
|
8162
|
-
if (!options.rtl) {
|
|
8163
|
-
match = version2.match(options.includePrerelease ? re2[t.COERCEFULL] : re2[t.COERCE]);
|
|
8164
|
-
} else {
|
|
8165
|
-
const coerceRtlRegex = options.includePrerelease ? re2[t.COERCERTLFULL] : re2[t.COERCERTL];
|
|
8166
|
-
let next;
|
|
8167
|
-
while ((next = coerceRtlRegex.exec(version2)) && (!match || match.index + match[0].length !== version2.length)) {
|
|
8168
|
-
if (!match || next.index + next[0].length !== match.index + match[0].length) {
|
|
8169
|
-
match = next;
|
|
8170
|
-
}
|
|
8171
|
-
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
|
|
8172
|
-
}
|
|
8173
|
-
coerceRtlRegex.lastIndex = -1;
|
|
8174
|
-
}
|
|
8175
|
-
if (match === null) {
|
|
8176
|
-
return null;
|
|
8177
|
-
}
|
|
8178
|
-
const major = match[2];
|
|
8179
|
-
const minor = match[3] || "0";
|
|
8180
|
-
const patch = match[4] || "0";
|
|
8181
|
-
const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
|
|
8182
|
-
const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
|
|
8183
|
-
return parse2(`${major}.${minor}.${patch}${prerelease}${build}`, options);
|
|
8184
|
-
};
|
|
8185
|
-
coerce_1 = coerce;
|
|
8186
|
-
return coerce_1;
|
|
8187
|
-
}
|
|
8188
|
-
function requireLrucache() {
|
|
8189
|
-
if (hasRequiredLrucache) return lrucache;
|
|
8190
|
-
hasRequiredLrucache = 1;
|
|
8191
|
-
class LRUCache {
|
|
8192
|
-
constructor() {
|
|
8193
|
-
this.max = 1e3;
|
|
8194
|
-
this.map = /* @__PURE__ */ new Map();
|
|
8195
|
-
}
|
|
8196
|
-
get(key) {
|
|
8197
|
-
const value = this.map.get(key);
|
|
8198
|
-
if (value === void 0) {
|
|
8199
|
-
return void 0;
|
|
8200
|
-
} else {
|
|
8201
|
-
this.map.delete(key);
|
|
8202
|
-
this.map.set(key, value);
|
|
8203
|
-
return value;
|
|
8204
|
-
}
|
|
8205
|
-
}
|
|
8206
|
-
delete(key) {
|
|
8207
|
-
return this.map.delete(key);
|
|
8208
|
-
}
|
|
8209
|
-
set(key, value) {
|
|
8210
|
-
const deleted = this.delete(key);
|
|
8211
|
-
if (!deleted && value !== void 0) {
|
|
8212
|
-
if (this.map.size >= this.max) {
|
|
8213
|
-
const firstKey = this.map.keys().next().value;
|
|
8214
|
-
this.delete(firstKey);
|
|
8215
|
-
}
|
|
8216
|
-
this.map.set(key, value);
|
|
8217
|
-
}
|
|
8218
|
-
return this;
|
|
8219
|
-
}
|
|
8220
|
-
}
|
|
8221
|
-
lrucache = LRUCache;
|
|
8222
|
-
return lrucache;
|
|
8223
|
-
}
|
|
8224
|
-
function requireRange() {
|
|
8225
|
-
if (hasRequiredRange) return range2;
|
|
8226
|
-
hasRequiredRange = 1;
|
|
8227
|
-
const SPACE_CHARACTERS = /\s+/g;
|
|
8228
|
-
class Range {
|
|
8229
|
-
constructor(range22, options) {
|
|
8230
|
-
options = parseOptions(options);
|
|
8231
|
-
if (range22 instanceof Range) {
|
|
8232
|
-
if (range22.loose === !!options.loose && range22.includePrerelease === !!options.includePrerelease) {
|
|
8233
|
-
return range22;
|
|
8234
|
-
} else {
|
|
8235
|
-
return new Range(range22.raw, options);
|
|
8236
|
-
}
|
|
8237
|
-
}
|
|
8238
|
-
if (range22 instanceof Comparator) {
|
|
8239
|
-
this.raw = range22.value;
|
|
8240
|
-
this.set = [[range22]];
|
|
8241
|
-
this.formatted = void 0;
|
|
8242
|
-
return this;
|
|
8243
|
-
}
|
|
8244
|
-
this.options = options;
|
|
8245
|
-
this.loose = !!options.loose;
|
|
8246
|
-
this.includePrerelease = !!options.includePrerelease;
|
|
8247
|
-
this.raw = range22.trim().replace(SPACE_CHARACTERS, " ");
|
|
8248
|
-
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
8249
|
-
if (!this.set.length) {
|
|
8250
|
-
throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
8251
|
-
}
|
|
8252
|
-
if (this.set.length > 1) {
|
|
8253
|
-
const first = this.set[0];
|
|
8254
|
-
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
8255
|
-
if (this.set.length === 0) {
|
|
8256
|
-
this.set = [first];
|
|
8257
|
-
} else if (this.set.length > 1) {
|
|
8258
|
-
for (const c of this.set) {
|
|
8259
|
-
if (c.length === 1 && isAny(c[0])) {
|
|
8260
|
-
this.set = [c];
|
|
8261
|
-
break;
|
|
8262
|
-
}
|
|
8263
|
-
}
|
|
8264
|
-
}
|
|
8265
|
-
}
|
|
8266
|
-
this.formatted = void 0;
|
|
8267
|
-
}
|
|
8268
|
-
get range() {
|
|
8269
|
-
if (this.formatted === void 0) {
|
|
8270
|
-
this.formatted = "";
|
|
8271
|
-
for (let i = 0; i < this.set.length; i++) {
|
|
8272
|
-
if (i > 0) {
|
|
8273
|
-
this.formatted += "||";
|
|
8274
|
-
}
|
|
8275
|
-
const comps = this.set[i];
|
|
8276
|
-
for (let k = 0; k < comps.length; k++) {
|
|
8277
|
-
if (k > 0) {
|
|
8278
|
-
this.formatted += " ";
|
|
8279
|
-
}
|
|
8280
|
-
this.formatted += comps[k].toString().trim();
|
|
8281
|
-
}
|
|
8282
|
-
}
|
|
8283
|
-
}
|
|
8284
|
-
return this.formatted;
|
|
8285
|
-
}
|
|
8286
|
-
format() {
|
|
8287
|
-
return this.range;
|
|
8288
|
-
}
|
|
8289
|
-
toString() {
|
|
8290
|
-
return this.range;
|
|
8291
|
-
}
|
|
8292
|
-
parseRange(range22) {
|
|
8293
|
-
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
|
8294
|
-
const memoKey = memoOpts + ":" + range22;
|
|
8295
|
-
const cached = cache10.get(memoKey);
|
|
8296
|
-
if (cached) {
|
|
8297
|
-
return cached;
|
|
8298
|
-
}
|
|
8299
|
-
const loose = this.options.loose;
|
|
8300
|
-
const hr = loose ? re2[t.HYPHENRANGELOOSE] : re2[t.HYPHENRANGE];
|
|
8301
|
-
range22 = range22.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
8302
|
-
debug3("hyphen replace", range22);
|
|
8303
|
-
range22 = range22.replace(re2[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
8304
|
-
debug3("comparator trim", range22);
|
|
8305
|
-
range22 = range22.replace(re2[t.TILDETRIM], tildeTrimReplace);
|
|
8306
|
-
debug3("tilde trim", range22);
|
|
8307
|
-
range22 = range22.replace(re2[t.CARETTRIM], caretTrimReplace);
|
|
8308
|
-
debug3("caret trim", range22);
|
|
8309
|
-
let rangeList = range22.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
8310
|
-
if (loose) {
|
|
8311
|
-
rangeList = rangeList.filter((comp) => {
|
|
8312
|
-
debug3("loose invalid filter", comp, this.options);
|
|
8313
|
-
return !!comp.match(re2[t.COMPARATORLOOSE]);
|
|
8314
|
-
});
|
|
8315
|
-
}
|
|
8316
|
-
debug3("range list", rangeList);
|
|
8317
|
-
const rangeMap = /* @__PURE__ */ new Map();
|
|
8318
|
-
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
8319
|
-
for (const comp of comparators) {
|
|
8320
|
-
if (isNullSet(comp)) {
|
|
8321
|
-
return [comp];
|
|
8322
|
-
}
|
|
8323
|
-
rangeMap.set(comp.value, comp);
|
|
8324
|
-
}
|
|
8325
|
-
if (rangeMap.size > 1 && rangeMap.has("")) {
|
|
8326
|
-
rangeMap.delete("");
|
|
8327
|
-
}
|
|
8328
|
-
const result = [...rangeMap.values()];
|
|
8329
|
-
cache10.set(memoKey, result);
|
|
8330
|
-
return result;
|
|
8331
|
-
}
|
|
8332
|
-
intersects(range22, options) {
|
|
8333
|
-
if (!(range22 instanceof Range)) {
|
|
8334
|
-
throw new TypeError("a Range is required");
|
|
8335
|
-
}
|
|
8336
|
-
return this.set.some((thisComparators) => {
|
|
8337
|
-
return isSatisfiable(thisComparators, options) && range22.set.some((rangeComparators) => {
|
|
8338
|
-
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
8339
|
-
return rangeComparators.every((rangeComparator) => {
|
|
8340
|
-
return thisComparator.intersects(rangeComparator, options);
|
|
8341
|
-
});
|
|
8342
|
-
});
|
|
8343
|
-
});
|
|
8344
|
-
});
|
|
8345
|
-
}
|
|
8346
|
-
// if ANY of the sets match ALL of its comparators, then pass
|
|
8347
|
-
test(version2) {
|
|
8348
|
-
if (!version2) {
|
|
8349
|
-
return false;
|
|
8350
|
-
}
|
|
8351
|
-
if (typeof version2 === "string") {
|
|
8352
|
-
try {
|
|
8353
|
-
version2 = new SemVer(version2, this.options);
|
|
8354
|
-
} catch (er) {
|
|
8355
|
-
return false;
|
|
8356
|
-
}
|
|
8357
|
-
}
|
|
8358
|
-
for (let i = 0; i < this.set.length; i++) {
|
|
8359
|
-
if (testSet(this.set[i], version2, this.options)) {
|
|
8360
|
-
return true;
|
|
8361
|
-
}
|
|
8362
|
-
}
|
|
8363
|
-
return false;
|
|
8364
|
-
}
|
|
8365
|
-
}
|
|
8366
|
-
range2 = Range;
|
|
8367
|
-
const LRU = requireLrucache();
|
|
8368
|
-
const cache10 = new LRU();
|
|
8369
|
-
const parseOptions = requireParseOptions();
|
|
8370
|
-
const Comparator = requireComparator();
|
|
8371
|
-
const debug3 = requireDebug();
|
|
8372
|
-
const SemVer = requireSemver$1();
|
|
8373
|
-
const {
|
|
8374
|
-
safeRe: re2,
|
|
8375
|
-
t,
|
|
8376
|
-
comparatorTrimReplace,
|
|
8377
|
-
tildeTrimReplace,
|
|
8378
|
-
caretTrimReplace
|
|
8379
|
-
} = requireRe();
|
|
8380
|
-
const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = requireConstants();
|
|
8381
|
-
const isNullSet = (c) => c.value === "<0.0.0-0";
|
|
8382
|
-
const isAny = (c) => c.value === "";
|
|
8383
|
-
const isSatisfiable = (comparators, options) => {
|
|
8384
|
-
let result = true;
|
|
8385
|
-
const remainingComparators = comparators.slice();
|
|
8386
|
-
let testComparator = remainingComparators.pop();
|
|
8387
|
-
while (result && remainingComparators.length) {
|
|
8388
|
-
result = remainingComparators.every((otherComparator) => {
|
|
8389
|
-
return testComparator.intersects(otherComparator, options);
|
|
8390
|
-
});
|
|
8391
|
-
testComparator = remainingComparators.pop();
|
|
8392
|
-
}
|
|
8393
|
-
return result;
|
|
8394
|
-
};
|
|
8395
|
-
const parseComparator = (comp, options) => {
|
|
8396
|
-
debug3("comp", comp, options);
|
|
8397
|
-
comp = replaceCarets(comp, options);
|
|
8398
|
-
debug3("caret", comp);
|
|
8399
|
-
comp = replaceTildes(comp, options);
|
|
8400
|
-
debug3("tildes", comp);
|
|
8401
|
-
comp = replaceXRanges(comp, options);
|
|
8402
|
-
debug3("xrange", comp);
|
|
8403
|
-
comp = replaceStars(comp, options);
|
|
8404
|
-
debug3("stars", comp);
|
|
8405
|
-
return comp;
|
|
8406
|
-
};
|
|
8407
|
-
const isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
8408
|
-
const replaceTildes = (comp, options) => {
|
|
8409
|
-
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
8410
|
-
};
|
|
8411
|
-
const replaceTilde = (comp, options) => {
|
|
8412
|
-
const r = options.loose ? re2[t.TILDELOOSE] : re2[t.TILDE];
|
|
8413
|
-
return comp.replace(r, (_, M, m, p, pr) => {
|
|
8414
|
-
debug3("tilde", comp, _, M, m, p, pr);
|
|
8415
|
-
let ret;
|
|
8416
|
-
if (isX(M)) {
|
|
8417
|
-
ret = "";
|
|
8418
|
-
} else if (isX(m)) {
|
|
8419
|
-
ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
|
|
8420
|
-
} else if (isX(p)) {
|
|
8421
|
-
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
|
|
8422
|
-
} else if (pr) {
|
|
8423
|
-
debug3("replaceTilde pr", pr);
|
|
8424
|
-
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
8425
|
-
} else {
|
|
8426
|
-
ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
8427
|
-
}
|
|
8428
|
-
debug3("tilde return", ret);
|
|
8429
|
-
return ret;
|
|
8430
|
-
});
|
|
8431
|
-
};
|
|
8432
|
-
const replaceCarets = (comp, options) => {
|
|
8433
|
-
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
|
8434
|
-
};
|
|
8435
|
-
const replaceCaret = (comp, options) => {
|
|
8436
|
-
debug3("caret", comp, options);
|
|
8437
|
-
const r = options.loose ? re2[t.CARETLOOSE] : re2[t.CARET];
|
|
8438
|
-
const z = options.includePrerelease ? "-0" : "";
|
|
8439
|
-
return comp.replace(r, (_, M, m, p, pr) => {
|
|
8440
|
-
debug3("caret", comp, _, M, m, p, pr);
|
|
8441
|
-
let ret;
|
|
8442
|
-
if (isX(M)) {
|
|
8443
|
-
ret = "";
|
|
8444
|
-
} else if (isX(m)) {
|
|
8445
|
-
ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
8446
|
-
} else if (isX(p)) {
|
|
8447
|
-
if (M === "0") {
|
|
8448
|
-
ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
8449
|
-
} else {
|
|
8450
|
-
ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
8451
|
-
}
|
|
8452
|
-
} else if (pr) {
|
|
8453
|
-
debug3("replaceCaret pr", pr);
|
|
8454
|
-
if (M === "0") {
|
|
8455
|
-
if (m === "0") {
|
|
8456
|
-
ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
8457
|
-
} else {
|
|
8458
|
-
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
8459
|
-
}
|
|
8460
|
-
} else {
|
|
8461
|
-
ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
8462
|
-
}
|
|
8463
|
-
} else {
|
|
8464
|
-
debug3("no pr");
|
|
8465
|
-
if (M === "0") {
|
|
8466
|
-
if (m === "0") {
|
|
8467
|
-
ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
|
|
8468
|
-
} else {
|
|
8469
|
-
ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
|
|
8470
|
-
}
|
|
8471
|
-
} else {
|
|
8472
|
-
ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
8473
|
-
}
|
|
8474
|
-
}
|
|
8475
|
-
debug3("caret return", ret);
|
|
8476
|
-
return ret;
|
|
8477
|
-
});
|
|
8478
|
-
};
|
|
8479
|
-
const replaceXRanges = (comp, options) => {
|
|
8480
|
-
debug3("replaceXRanges", comp, options);
|
|
8481
|
-
return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
|
|
8482
|
-
};
|
|
8483
|
-
const replaceXRange = (comp, options) => {
|
|
8484
|
-
comp = comp.trim();
|
|
8485
|
-
const r = options.loose ? re2[t.XRANGELOOSE] : re2[t.XRANGE];
|
|
8486
|
-
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
8487
|
-
debug3("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
8488
|
-
const xM = isX(M);
|
|
8489
|
-
const xm = xM || isX(m);
|
|
8490
|
-
const xp = xm || isX(p);
|
|
8491
|
-
const anyX = xp;
|
|
8492
|
-
if (gtlt === "=" && anyX) {
|
|
8493
|
-
gtlt = "";
|
|
8494
|
-
}
|
|
8495
|
-
pr = options.includePrerelease ? "-0" : "";
|
|
8496
|
-
if (xM) {
|
|
8497
|
-
if (gtlt === ">" || gtlt === "<") {
|
|
8498
|
-
ret = "<0.0.0-0";
|
|
8499
|
-
} else {
|
|
8500
|
-
ret = "*";
|
|
8501
|
-
}
|
|
8502
|
-
} else if (gtlt && anyX) {
|
|
8503
|
-
if (xm) {
|
|
8504
|
-
m = 0;
|
|
8505
|
-
}
|
|
8506
|
-
p = 0;
|
|
8507
|
-
if (gtlt === ">") {
|
|
8508
|
-
gtlt = ">=";
|
|
8509
|
-
if (xm) {
|
|
8510
|
-
M = +M + 1;
|
|
8511
|
-
m = 0;
|
|
8512
|
-
p = 0;
|
|
8513
|
-
} else {
|
|
8514
|
-
m = +m + 1;
|
|
8515
|
-
p = 0;
|
|
8516
|
-
}
|
|
8517
|
-
} else if (gtlt === "<=") {
|
|
8518
|
-
gtlt = "<";
|
|
8519
|
-
if (xm) {
|
|
8520
|
-
M = +M + 1;
|
|
8521
|
-
} else {
|
|
8522
|
-
m = +m + 1;
|
|
8523
|
-
}
|
|
8524
|
-
}
|
|
8525
|
-
if (gtlt === "<") {
|
|
8526
|
-
pr = "-0";
|
|
8527
|
-
}
|
|
8528
|
-
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
8529
|
-
} else if (xm) {
|
|
8530
|
-
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
8531
|
-
} else if (xp) {
|
|
8532
|
-
ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
|
8533
|
-
}
|
|
8534
|
-
debug3("xRange return", ret);
|
|
8535
|
-
return ret;
|
|
8536
|
-
});
|
|
8537
|
-
};
|
|
8538
|
-
const replaceStars = (comp, options) => {
|
|
8539
|
-
debug3("replaceStars", comp, options);
|
|
8540
|
-
return comp.trim().replace(re2[t.STAR], "");
|
|
8541
|
-
};
|
|
8542
|
-
const replaceGTE0 = (comp, options) => {
|
|
8543
|
-
debug3("replaceGTE0", comp, options);
|
|
8544
|
-
return comp.trim().replace(re2[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
8545
|
-
};
|
|
8546
|
-
const hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
8547
|
-
if (isX(fM)) {
|
|
8548
|
-
from = "";
|
|
8549
|
-
} else if (isX(fm)) {
|
|
8550
|
-
from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
8551
|
-
} else if (isX(fp)) {
|
|
8552
|
-
from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
8553
|
-
} else if (fpr) {
|
|
8554
|
-
from = `>=${from}`;
|
|
8555
|
-
} else {
|
|
8556
|
-
from = `>=${from}${incPr ? "-0" : ""}`;
|
|
8557
|
-
}
|
|
8558
|
-
if (isX(tM)) {
|
|
8559
|
-
to = "";
|
|
8560
|
-
} else if (isX(tm)) {
|
|
8561
|
-
to = `<${+tM + 1}.0.0-0`;
|
|
8562
|
-
} else if (isX(tp)) {
|
|
8563
|
-
to = `<${tM}.${+tm + 1}.0-0`;
|
|
8564
|
-
} else if (tpr) {
|
|
8565
|
-
to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
8566
|
-
} else if (incPr) {
|
|
8567
|
-
to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
8568
|
-
} else {
|
|
8569
|
-
to = `<=${to}`;
|
|
8570
|
-
}
|
|
8571
|
-
return `${from} ${to}`.trim();
|
|
8572
|
-
};
|
|
8573
|
-
const testSet = (set, version2, options) => {
|
|
8574
|
-
for (let i = 0; i < set.length; i++) {
|
|
8575
|
-
if (!set[i].test(version2)) {
|
|
8576
|
-
return false;
|
|
8577
|
-
}
|
|
8578
|
-
}
|
|
8579
|
-
if (version2.prerelease.length && !options.includePrerelease) {
|
|
8580
|
-
for (let i = 0; i < set.length; i++) {
|
|
8581
|
-
debug3(set[i].semver);
|
|
8582
|
-
if (set[i].semver === Comparator.ANY) {
|
|
8583
|
-
continue;
|
|
8584
|
-
}
|
|
8585
|
-
if (set[i].semver.prerelease.length > 0) {
|
|
8586
|
-
const allowed = set[i].semver;
|
|
8587
|
-
if (allowed.major === version2.major && allowed.minor === version2.minor && allowed.patch === version2.patch) {
|
|
8588
|
-
return true;
|
|
8589
|
-
}
|
|
8590
|
-
}
|
|
8591
|
-
}
|
|
8592
|
-
return false;
|
|
8593
|
-
}
|
|
8594
|
-
return true;
|
|
8595
|
-
};
|
|
8596
|
-
return range2;
|
|
8597
|
-
}
|
|
8598
|
-
function requireComparator() {
|
|
8599
|
-
if (hasRequiredComparator) return comparator;
|
|
8600
|
-
hasRequiredComparator = 1;
|
|
8601
|
-
const ANY = Symbol("SemVer ANY");
|
|
8602
|
-
class Comparator {
|
|
8603
|
-
static get ANY() {
|
|
8604
|
-
return ANY;
|
|
8605
|
-
}
|
|
8606
|
-
constructor(comp, options) {
|
|
8607
|
-
options = parseOptions(options);
|
|
8608
|
-
if (comp instanceof Comparator) {
|
|
8609
|
-
if (comp.loose === !!options.loose) {
|
|
8610
|
-
return comp;
|
|
8611
|
-
} else {
|
|
8612
|
-
comp = comp.value;
|
|
8613
|
-
}
|
|
8614
|
-
}
|
|
8615
|
-
comp = comp.trim().split(/\s+/).join(" ");
|
|
8616
|
-
debug3("comparator", comp, options);
|
|
8617
|
-
this.options = options;
|
|
8618
|
-
this.loose = !!options.loose;
|
|
8619
|
-
this.parse(comp);
|
|
8620
|
-
if (this.semver === ANY) {
|
|
8621
|
-
this.value = "";
|
|
8622
|
-
} else {
|
|
8623
|
-
this.value = this.operator + this.semver.version;
|
|
8624
|
-
}
|
|
8625
|
-
debug3("comp", this);
|
|
8626
|
-
}
|
|
8627
|
-
parse(comp) {
|
|
8628
|
-
const r = this.options.loose ? re2[t.COMPARATORLOOSE] : re2[t.COMPARATOR];
|
|
8629
|
-
const m = comp.match(r);
|
|
8630
|
-
if (!m) {
|
|
8631
|
-
throw new TypeError(`Invalid comparator: ${comp}`);
|
|
8632
|
-
}
|
|
8633
|
-
this.operator = m[1] !== void 0 ? m[1] : "";
|
|
8634
|
-
if (this.operator === "=") {
|
|
8635
|
-
this.operator = "";
|
|
8636
|
-
}
|
|
8637
|
-
if (!m[2]) {
|
|
8638
|
-
this.semver = ANY;
|
|
8639
|
-
} else {
|
|
8640
|
-
this.semver = new SemVer(m[2], this.options.loose);
|
|
8641
|
-
}
|
|
8642
|
-
}
|
|
8643
|
-
toString() {
|
|
8644
|
-
return this.value;
|
|
8645
|
-
}
|
|
8646
|
-
test(version2) {
|
|
8647
|
-
debug3("Comparator.test", version2, this.options.loose);
|
|
8648
|
-
if (this.semver === ANY || version2 === ANY) {
|
|
8649
|
-
return true;
|
|
8650
|
-
}
|
|
8651
|
-
if (typeof version2 === "string") {
|
|
8652
|
-
try {
|
|
8653
|
-
version2 = new SemVer(version2, this.options);
|
|
8654
|
-
} catch (er) {
|
|
8655
|
-
return false;
|
|
8656
|
-
}
|
|
8657
|
-
}
|
|
8658
|
-
return cmp(version2, this.operator, this.semver, this.options);
|
|
8659
|
-
}
|
|
8660
|
-
intersects(comp, options) {
|
|
8661
|
-
if (!(comp instanceof Comparator)) {
|
|
8662
|
-
throw new TypeError("a Comparator is required");
|
|
8663
|
-
}
|
|
8664
|
-
if (this.operator === "") {
|
|
8665
|
-
if (this.value === "") {
|
|
8666
|
-
return true;
|
|
8667
|
-
}
|
|
8668
|
-
return new Range(comp.value, options).test(this.value);
|
|
8669
|
-
} else if (comp.operator === "") {
|
|
8670
|
-
if (comp.value === "") {
|
|
8671
|
-
return true;
|
|
8672
|
-
}
|
|
8673
|
-
return new Range(this.value, options).test(comp.semver);
|
|
8674
|
-
}
|
|
8675
|
-
options = parseOptions(options);
|
|
8676
|
-
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
|
|
8677
|
-
return false;
|
|
8678
|
-
}
|
|
8679
|
-
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
|
|
8680
|
-
return false;
|
|
8681
|
-
}
|
|
8682
|
-
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
|
|
8683
|
-
return true;
|
|
8684
|
-
}
|
|
8685
|
-
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
|
|
8686
|
-
return true;
|
|
8687
|
-
}
|
|
8688
|
-
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
|
|
8689
|
-
return true;
|
|
8690
|
-
}
|
|
8691
|
-
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
|
|
8692
|
-
return true;
|
|
8693
|
-
}
|
|
8694
|
-
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
|
|
8695
|
-
return true;
|
|
8696
|
-
}
|
|
8697
|
-
return false;
|
|
8698
|
-
}
|
|
8699
|
-
}
|
|
8700
|
-
comparator = Comparator;
|
|
8701
|
-
const parseOptions = requireParseOptions();
|
|
8702
|
-
const { safeRe: re2, t } = requireRe();
|
|
8703
|
-
const cmp = requireCmp();
|
|
8704
|
-
const debug3 = requireDebug();
|
|
8705
|
-
const SemVer = requireSemver$1();
|
|
8706
|
-
const Range = requireRange();
|
|
8707
|
-
return comparator;
|
|
8708
|
-
}
|
|
8709
|
-
function requireSatisfies() {
|
|
8710
|
-
if (hasRequiredSatisfies) return satisfies_1;
|
|
8711
|
-
hasRequiredSatisfies = 1;
|
|
8712
|
-
const Range = requireRange();
|
|
8713
|
-
const satisfies2 = (version2, range22, options) => {
|
|
8714
|
-
try {
|
|
8715
|
-
range22 = new Range(range22, options);
|
|
8716
|
-
} catch (er) {
|
|
8717
|
-
return false;
|
|
8718
|
-
}
|
|
8719
|
-
return range22.test(version2);
|
|
8720
|
-
};
|
|
8721
|
-
satisfies_1 = satisfies2;
|
|
8722
|
-
return satisfies_1;
|
|
8723
|
-
}
|
|
8724
|
-
function requireToComparators() {
|
|
8725
|
-
if (hasRequiredToComparators) return toComparators_1;
|
|
8726
|
-
hasRequiredToComparators = 1;
|
|
8727
|
-
const Range = requireRange();
|
|
8728
|
-
const toComparators = (range22, options) => new Range(range22, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
8729
|
-
toComparators_1 = toComparators;
|
|
8730
|
-
return toComparators_1;
|
|
8731
|
-
}
|
|
8732
|
-
function requireMaxSatisfying() {
|
|
8733
|
-
if (hasRequiredMaxSatisfying) return maxSatisfying_1;
|
|
8734
|
-
hasRequiredMaxSatisfying = 1;
|
|
8735
|
-
const SemVer = requireSemver$1();
|
|
8736
|
-
const Range = requireRange();
|
|
8737
|
-
const maxSatisfying = (versions, range22, options) => {
|
|
8738
|
-
let max = null;
|
|
8739
|
-
let maxSV = null;
|
|
8740
|
-
let rangeObj = null;
|
|
8741
|
-
try {
|
|
8742
|
-
rangeObj = new Range(range22, options);
|
|
8743
|
-
} catch (er) {
|
|
8744
|
-
return null;
|
|
8745
|
-
}
|
|
8746
|
-
versions.forEach((v) => {
|
|
8747
|
-
if (rangeObj.test(v)) {
|
|
8748
|
-
if (!max || maxSV.compare(v) === -1) {
|
|
8749
|
-
max = v;
|
|
8750
|
-
maxSV = new SemVer(max, options);
|
|
8751
|
-
}
|
|
8752
|
-
}
|
|
8753
|
-
});
|
|
8754
|
-
return max;
|
|
8755
|
-
};
|
|
8756
|
-
maxSatisfying_1 = maxSatisfying;
|
|
8757
|
-
return maxSatisfying_1;
|
|
8758
|
-
}
|
|
8759
|
-
function requireMinSatisfying() {
|
|
8760
|
-
if (hasRequiredMinSatisfying) return minSatisfying_1;
|
|
8761
|
-
hasRequiredMinSatisfying = 1;
|
|
8762
|
-
const SemVer = requireSemver$1();
|
|
8763
|
-
const Range = requireRange();
|
|
8764
|
-
const minSatisfying = (versions, range22, options) => {
|
|
8765
|
-
let min = null;
|
|
8766
|
-
let minSV = null;
|
|
8767
|
-
let rangeObj = null;
|
|
8768
|
-
try {
|
|
8769
|
-
rangeObj = new Range(range22, options);
|
|
8770
|
-
} catch (er) {
|
|
8771
|
-
return null;
|
|
8772
|
-
}
|
|
8773
|
-
versions.forEach((v) => {
|
|
8774
|
-
if (rangeObj.test(v)) {
|
|
8775
|
-
if (!min || minSV.compare(v) === 1) {
|
|
8776
|
-
min = v;
|
|
8777
|
-
minSV = new SemVer(min, options);
|
|
8778
|
-
}
|
|
8779
|
-
}
|
|
8780
|
-
});
|
|
8781
|
-
return min;
|
|
8782
|
-
};
|
|
8783
|
-
minSatisfying_1 = minSatisfying;
|
|
8784
|
-
return minSatisfying_1;
|
|
8785
|
-
}
|
|
8786
|
-
function requireMinVersion() {
|
|
8787
|
-
if (hasRequiredMinVersion) return minVersion_1;
|
|
8788
|
-
hasRequiredMinVersion = 1;
|
|
8789
|
-
const SemVer = requireSemver$1();
|
|
8790
|
-
const Range = requireRange();
|
|
8791
|
-
const gt = requireGt();
|
|
8792
|
-
const minVersion = (range22, loose) => {
|
|
8793
|
-
range22 = new Range(range22, loose);
|
|
8794
|
-
let minver = new SemVer("0.0.0");
|
|
8795
|
-
if (range22.test(minver)) {
|
|
8796
|
-
return minver;
|
|
8797
|
-
}
|
|
8798
|
-
minver = new SemVer("0.0.0-0");
|
|
8799
|
-
if (range22.test(minver)) {
|
|
8800
|
-
return minver;
|
|
8801
|
-
}
|
|
8802
|
-
minver = null;
|
|
8803
|
-
for (let i = 0; i < range22.set.length; ++i) {
|
|
8804
|
-
const comparators = range22.set[i];
|
|
8805
|
-
let setMin = null;
|
|
8806
|
-
comparators.forEach((comparator2) => {
|
|
8807
|
-
const compver = new SemVer(comparator2.semver.version);
|
|
8808
|
-
switch (comparator2.operator) {
|
|
8809
|
-
case ">":
|
|
8810
|
-
if (compver.prerelease.length === 0) {
|
|
8811
|
-
compver.patch++;
|
|
8812
|
-
} else {
|
|
8813
|
-
compver.prerelease.push(0);
|
|
8814
|
-
}
|
|
8815
|
-
compver.raw = compver.format();
|
|
8816
|
-
/* fallthrough */
|
|
8817
|
-
case "":
|
|
8818
|
-
case ">=":
|
|
8819
|
-
if (!setMin || gt(compver, setMin)) {
|
|
8820
|
-
setMin = compver;
|
|
8821
|
-
}
|
|
8822
|
-
break;
|
|
8823
|
-
case "<":
|
|
8824
|
-
case "<=":
|
|
8825
|
-
break;
|
|
8826
|
-
/* istanbul ignore next */
|
|
8827
|
-
default:
|
|
8828
|
-
throw new Error(`Unexpected operation: ${comparator2.operator}`);
|
|
8829
|
-
}
|
|
8830
|
-
});
|
|
8831
|
-
if (setMin && (!minver || gt(minver, setMin))) {
|
|
8832
|
-
minver = setMin;
|
|
8833
|
-
}
|
|
8834
|
-
}
|
|
8835
|
-
if (minver && range22.test(minver)) {
|
|
8836
|
-
return minver;
|
|
8837
|
-
}
|
|
8838
|
-
return null;
|
|
8839
|
-
};
|
|
8840
|
-
minVersion_1 = minVersion;
|
|
8841
|
-
return minVersion_1;
|
|
8842
|
-
}
|
|
8843
|
-
function requireValid() {
|
|
8844
|
-
if (hasRequiredValid) return valid;
|
|
8845
|
-
hasRequiredValid = 1;
|
|
8846
|
-
const Range = requireRange();
|
|
8847
|
-
const validRange = (range22, options) => {
|
|
8848
|
-
try {
|
|
8849
|
-
return new Range(range22, options).range || "*";
|
|
8850
|
-
} catch (er) {
|
|
8851
|
-
return null;
|
|
8852
|
-
}
|
|
8853
|
-
};
|
|
8854
|
-
valid = validRange;
|
|
8855
|
-
return valid;
|
|
8856
|
-
}
|
|
8857
|
-
function requireOutside() {
|
|
8858
|
-
if (hasRequiredOutside) return outside_1;
|
|
8859
|
-
hasRequiredOutside = 1;
|
|
8860
|
-
const SemVer = requireSemver$1();
|
|
8861
|
-
const Comparator = requireComparator();
|
|
8862
|
-
const { ANY } = Comparator;
|
|
8863
|
-
const Range = requireRange();
|
|
8864
|
-
const satisfies2 = requireSatisfies();
|
|
8865
|
-
const gt = requireGt();
|
|
8866
|
-
const lt = requireLt();
|
|
8867
|
-
const lte = requireLte();
|
|
8868
|
-
const gte = requireGte();
|
|
8869
|
-
const outside = (version2, range22, hilo, options) => {
|
|
8870
|
-
version2 = new SemVer(version2, options);
|
|
8871
|
-
range22 = new Range(range22, options);
|
|
8872
|
-
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
8873
|
-
switch (hilo) {
|
|
8874
|
-
case ">":
|
|
8875
|
-
gtfn = gt;
|
|
8876
|
-
ltefn = lte;
|
|
8877
|
-
ltfn = lt;
|
|
8878
|
-
comp = ">";
|
|
8879
|
-
ecomp = ">=";
|
|
8880
|
-
break;
|
|
8881
|
-
case "<":
|
|
8882
|
-
gtfn = lt;
|
|
8883
|
-
ltefn = gte;
|
|
8884
|
-
ltfn = gt;
|
|
8885
|
-
comp = "<";
|
|
8886
|
-
ecomp = "<=";
|
|
8887
|
-
break;
|
|
8888
|
-
default:
|
|
8889
|
-
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
8890
|
-
}
|
|
8891
|
-
if (satisfies2(version2, range22, options)) {
|
|
8892
|
-
return false;
|
|
8893
|
-
}
|
|
8894
|
-
for (let i = 0; i < range22.set.length; ++i) {
|
|
8895
|
-
const comparators = range22.set[i];
|
|
8896
|
-
let high = null;
|
|
8897
|
-
let low = null;
|
|
8898
|
-
comparators.forEach((comparator2) => {
|
|
8899
|
-
if (comparator2.semver === ANY) {
|
|
8900
|
-
comparator2 = new Comparator(">=0.0.0");
|
|
8901
|
-
}
|
|
8902
|
-
high = high || comparator2;
|
|
8903
|
-
low = low || comparator2;
|
|
8904
|
-
if (gtfn(comparator2.semver, high.semver, options)) {
|
|
8905
|
-
high = comparator2;
|
|
8906
|
-
} else if (ltfn(comparator2.semver, low.semver, options)) {
|
|
8907
|
-
low = comparator2;
|
|
8908
|
-
}
|
|
8909
|
-
});
|
|
8910
|
-
if (high.operator === comp || high.operator === ecomp) {
|
|
8911
|
-
return false;
|
|
8912
|
-
}
|
|
8913
|
-
if ((!low.operator || low.operator === comp) && ltefn(version2, low.semver)) {
|
|
8914
|
-
return false;
|
|
8915
|
-
} else if (low.operator === ecomp && ltfn(version2, low.semver)) {
|
|
8916
|
-
return false;
|
|
8917
|
-
}
|
|
8918
|
-
}
|
|
8919
|
-
return true;
|
|
8920
|
-
};
|
|
8921
|
-
outside_1 = outside;
|
|
8922
|
-
return outside_1;
|
|
8923
|
-
}
|
|
8924
|
-
function requireGtr() {
|
|
8925
|
-
if (hasRequiredGtr) return gtr_1;
|
|
8926
|
-
hasRequiredGtr = 1;
|
|
8927
|
-
const outside = requireOutside();
|
|
8928
|
-
const gtr = (version2, range22, options) => outside(version2, range22, ">", options);
|
|
8929
|
-
gtr_1 = gtr;
|
|
8930
|
-
return gtr_1;
|
|
8931
|
-
}
|
|
8932
|
-
function requireLtr() {
|
|
8933
|
-
if (hasRequiredLtr) return ltr_1;
|
|
8934
|
-
hasRequiredLtr = 1;
|
|
8935
|
-
const outside = requireOutside();
|
|
8936
|
-
const ltr = (version2, range22, options) => outside(version2, range22, "<", options);
|
|
8937
|
-
ltr_1 = ltr;
|
|
8938
|
-
return ltr_1;
|
|
8939
|
-
}
|
|
8940
|
-
function requireIntersects() {
|
|
8941
|
-
if (hasRequiredIntersects) return intersects_1;
|
|
8942
|
-
hasRequiredIntersects = 1;
|
|
8943
|
-
const Range = requireRange();
|
|
8944
|
-
const intersects = (r1, r2, options) => {
|
|
8945
|
-
r1 = new Range(r1, options);
|
|
8946
|
-
r2 = new Range(r2, options);
|
|
8947
|
-
return r1.intersects(r2, options);
|
|
8948
|
-
};
|
|
8949
|
-
intersects_1 = intersects;
|
|
8950
|
-
return intersects_1;
|
|
8951
|
-
}
|
|
8952
|
-
function requireSimplify() {
|
|
8953
|
-
if (hasRequiredSimplify) return simplify;
|
|
8954
|
-
hasRequiredSimplify = 1;
|
|
8955
|
-
const satisfies2 = requireSatisfies();
|
|
8956
|
-
const compare = requireCompare();
|
|
8957
|
-
simplify = (versions, range22, options) => {
|
|
8958
|
-
const set = [];
|
|
8959
|
-
let first = null;
|
|
8960
|
-
let prev = null;
|
|
8961
|
-
const v = versions.sort((a, b) => compare(a, b, options));
|
|
8962
|
-
for (const version2 of v) {
|
|
8963
|
-
const included = satisfies2(version2, range22, options);
|
|
8964
|
-
if (included) {
|
|
8965
|
-
prev = version2;
|
|
8966
|
-
if (!first) {
|
|
8967
|
-
first = version2;
|
|
8968
|
-
}
|
|
8969
|
-
} else {
|
|
8970
|
-
if (prev) {
|
|
8971
|
-
set.push([first, prev]);
|
|
8972
|
-
}
|
|
8973
|
-
prev = null;
|
|
8974
|
-
first = null;
|
|
8975
|
-
}
|
|
8976
|
-
}
|
|
8977
|
-
if (first) {
|
|
8978
|
-
set.push([first, null]);
|
|
8979
|
-
}
|
|
8980
|
-
const ranges = [];
|
|
8981
|
-
for (const [min, max] of set) {
|
|
8982
|
-
if (min === max) {
|
|
8983
|
-
ranges.push(min);
|
|
8984
|
-
} else if (!max && min === v[0]) {
|
|
8985
|
-
ranges.push("*");
|
|
8986
|
-
} else if (!max) {
|
|
8987
|
-
ranges.push(`>=${min}`);
|
|
8988
|
-
} else if (min === v[0]) {
|
|
8989
|
-
ranges.push(`<=${max}`);
|
|
8990
|
-
} else {
|
|
8991
|
-
ranges.push(`${min} - ${max}`);
|
|
8992
|
-
}
|
|
8993
|
-
}
|
|
8994
|
-
const simplified = ranges.join(" || ");
|
|
8995
|
-
const original = typeof range22.raw === "string" ? range22.raw : String(range22);
|
|
8996
|
-
return simplified.length < original.length ? simplified : range22;
|
|
8997
|
-
};
|
|
8998
|
-
return simplify;
|
|
8999
|
-
}
|
|
9000
|
-
function requireSubset() {
|
|
9001
|
-
if (hasRequiredSubset) return subset_1;
|
|
9002
|
-
hasRequiredSubset = 1;
|
|
9003
|
-
const Range = requireRange();
|
|
9004
|
-
const Comparator = requireComparator();
|
|
9005
|
-
const { ANY } = Comparator;
|
|
9006
|
-
const satisfies2 = requireSatisfies();
|
|
9007
|
-
const compare = requireCompare();
|
|
9008
|
-
const subset = (sub, dom, options = {}) => {
|
|
9009
|
-
if (sub === dom) {
|
|
9010
|
-
return true;
|
|
9011
|
-
}
|
|
9012
|
-
sub = new Range(sub, options);
|
|
9013
|
-
dom = new Range(dom, options);
|
|
9014
|
-
let sawNonNull = false;
|
|
9015
|
-
OUTER: for (const simpleSub of sub.set) {
|
|
9016
|
-
for (const simpleDom of dom.set) {
|
|
9017
|
-
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
9018
|
-
sawNonNull = sawNonNull || isSub !== null;
|
|
9019
|
-
if (isSub) {
|
|
9020
|
-
continue OUTER;
|
|
9021
|
-
}
|
|
9022
|
-
}
|
|
9023
|
-
if (sawNonNull) {
|
|
9024
|
-
return false;
|
|
9025
|
-
}
|
|
9026
|
-
}
|
|
9027
|
-
return true;
|
|
9028
|
-
};
|
|
9029
|
-
const minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
9030
|
-
const minimumVersion = [new Comparator(">=0.0.0")];
|
|
9031
|
-
const simpleSubset = (sub, dom, options) => {
|
|
9032
|
-
if (sub === dom) {
|
|
9033
|
-
return true;
|
|
9034
|
-
}
|
|
9035
|
-
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
9036
|
-
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
9037
|
-
return true;
|
|
9038
|
-
} else if (options.includePrerelease) {
|
|
9039
|
-
sub = minimumVersionWithPreRelease;
|
|
9040
|
-
} else {
|
|
9041
|
-
sub = minimumVersion;
|
|
9042
|
-
}
|
|
9043
|
-
}
|
|
9044
|
-
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
9045
|
-
if (options.includePrerelease) {
|
|
9046
|
-
return true;
|
|
9047
|
-
} else {
|
|
9048
|
-
dom = minimumVersion;
|
|
9049
|
-
}
|
|
9050
|
-
}
|
|
9051
|
-
const eqSet = /* @__PURE__ */ new Set();
|
|
9052
|
-
let gt, lt;
|
|
9053
|
-
for (const c of sub) {
|
|
9054
|
-
if (c.operator === ">" || c.operator === ">=") {
|
|
9055
|
-
gt = higherGT(gt, c, options);
|
|
9056
|
-
} else if (c.operator === "<" || c.operator === "<=") {
|
|
9057
|
-
lt = lowerLT(lt, c, options);
|
|
9058
|
-
} else {
|
|
9059
|
-
eqSet.add(c.semver);
|
|
9060
|
-
}
|
|
9061
|
-
}
|
|
9062
|
-
if (eqSet.size > 1) {
|
|
9063
|
-
return null;
|
|
9064
|
-
}
|
|
9065
|
-
let gtltComp;
|
|
9066
|
-
if (gt && lt) {
|
|
9067
|
-
gtltComp = compare(gt.semver, lt.semver, options);
|
|
9068
|
-
if (gtltComp > 0) {
|
|
9069
|
-
return null;
|
|
9070
|
-
} else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
|
|
9071
|
-
return null;
|
|
9072
|
-
}
|
|
9073
|
-
}
|
|
9074
|
-
for (const eq of eqSet) {
|
|
9075
|
-
if (gt && !satisfies2(eq, String(gt), options)) {
|
|
9076
|
-
return null;
|
|
9077
|
-
}
|
|
9078
|
-
if (lt && !satisfies2(eq, String(lt), options)) {
|
|
9079
|
-
return null;
|
|
9080
|
-
}
|
|
9081
|
-
for (const c of dom) {
|
|
9082
|
-
if (!satisfies2(eq, String(c), options)) {
|
|
9083
|
-
return false;
|
|
9084
|
-
}
|
|
9085
|
-
}
|
|
9086
|
-
return true;
|
|
9087
|
-
}
|
|
9088
|
-
let higher, lower;
|
|
9089
|
-
let hasDomLT, hasDomGT;
|
|
9090
|
-
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
9091
|
-
let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
9092
|
-
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
|
|
9093
|
-
needDomLTPre = false;
|
|
9094
|
-
}
|
|
9095
|
-
for (const c of dom) {
|
|
9096
|
-
hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
|
|
9097
|
-
hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
|
|
9098
|
-
if (gt) {
|
|
9099
|
-
if (needDomGTPre) {
|
|
9100
|
-
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) {
|
|
9101
|
-
needDomGTPre = false;
|
|
9102
|
-
}
|
|
9103
|
-
}
|
|
9104
|
-
if (c.operator === ">" || c.operator === ">=") {
|
|
9105
|
-
higher = higherGT(gt, c, options);
|
|
9106
|
-
if (higher === c && higher !== gt) {
|
|
9107
|
-
return false;
|
|
9108
|
-
}
|
|
9109
|
-
} else if (gt.operator === ">=" && !satisfies2(gt.semver, String(c), options)) {
|
|
9110
|
-
return false;
|
|
9111
|
-
}
|
|
9112
|
-
}
|
|
9113
|
-
if (lt) {
|
|
9114
|
-
if (needDomLTPre) {
|
|
9115
|
-
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) {
|
|
9116
|
-
needDomLTPre = false;
|
|
9117
|
-
}
|
|
9118
|
-
}
|
|
9119
|
-
if (c.operator === "<" || c.operator === "<=") {
|
|
9120
|
-
lower = lowerLT(lt, c, options);
|
|
9121
|
-
if (lower === c && lower !== lt) {
|
|
9122
|
-
return false;
|
|
9123
|
-
}
|
|
9124
|
-
} else if (lt.operator === "<=" && !satisfies2(lt.semver, String(c), options)) {
|
|
9125
|
-
return false;
|
|
9126
|
-
}
|
|
9127
|
-
}
|
|
9128
|
-
if (!c.operator && (lt || gt) && gtltComp !== 0) {
|
|
9129
|
-
return false;
|
|
9130
|
-
}
|
|
9131
|
-
}
|
|
9132
|
-
if (gt && hasDomLT && !lt && gtltComp !== 0) {
|
|
9133
|
-
return false;
|
|
9134
|
-
}
|
|
9135
|
-
if (lt && hasDomGT && !gt && gtltComp !== 0) {
|
|
9136
|
-
return false;
|
|
9137
|
-
}
|
|
9138
|
-
if (needDomGTPre || needDomLTPre) {
|
|
9139
|
-
return false;
|
|
9140
|
-
}
|
|
9141
|
-
return true;
|
|
9142
|
-
};
|
|
9143
|
-
const higherGT = (a, b, options) => {
|
|
9144
|
-
if (!a) {
|
|
9145
|
-
return b;
|
|
9146
|
-
}
|
|
9147
|
-
const comp = compare(a.semver, b.semver, options);
|
|
9148
|
-
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
9149
|
-
};
|
|
9150
|
-
const lowerLT = (a, b, options) => {
|
|
9151
|
-
if (!a) {
|
|
9152
|
-
return b;
|
|
9153
|
-
}
|
|
9154
|
-
const comp = compare(a.semver, b.semver, options);
|
|
9155
|
-
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
9156
|
-
};
|
|
9157
|
-
subset_1 = subset;
|
|
9158
|
-
return subset_1;
|
|
9159
|
-
}
|
|
9160
|
-
function requireSemver() {
|
|
9161
|
-
if (hasRequiredSemver) return semver;
|
|
9162
|
-
hasRequiredSemver = 1;
|
|
9163
|
-
const internalRe = requireRe();
|
|
9164
|
-
const constants2 = requireConstants();
|
|
9165
|
-
const SemVer = requireSemver$1();
|
|
9166
|
-
const identifiers2 = requireIdentifiers();
|
|
9167
|
-
const parse2 = requireParse();
|
|
9168
|
-
const valid2 = requireValid$1();
|
|
9169
|
-
const clean = requireClean();
|
|
9170
|
-
const inc = requireInc();
|
|
9171
|
-
const diff = requireDiff();
|
|
9172
|
-
const major = requireMajor();
|
|
9173
|
-
const minor = requireMinor();
|
|
9174
|
-
const patch = requirePatch();
|
|
9175
|
-
const prerelease = requirePrerelease();
|
|
9176
|
-
const compare = requireCompare();
|
|
9177
|
-
const rcompare = requireRcompare();
|
|
9178
|
-
const compareLoose = requireCompareLoose();
|
|
9179
|
-
const compareBuild = requireCompareBuild();
|
|
9180
|
-
const sort = requireSort();
|
|
9181
|
-
const rsort = requireRsort();
|
|
9182
|
-
const gt = requireGt();
|
|
9183
|
-
const lt = requireLt();
|
|
9184
|
-
const eq = requireEq();
|
|
9185
|
-
const neq = requireNeq();
|
|
9186
|
-
const gte = requireGte();
|
|
9187
|
-
const lte = requireLte();
|
|
9188
|
-
const cmp = requireCmp();
|
|
9189
|
-
const coerce = requireCoerce();
|
|
9190
|
-
const Comparator = requireComparator();
|
|
9191
|
-
const Range = requireRange();
|
|
9192
|
-
const satisfies2 = requireSatisfies();
|
|
9193
|
-
const toComparators = requireToComparators();
|
|
9194
|
-
const maxSatisfying = requireMaxSatisfying();
|
|
9195
|
-
const minSatisfying = requireMinSatisfying();
|
|
9196
|
-
const minVersion = requireMinVersion();
|
|
9197
|
-
const validRange = requireValid();
|
|
9198
|
-
const outside = requireOutside();
|
|
9199
|
-
const gtr = requireGtr();
|
|
9200
|
-
const ltr = requireLtr();
|
|
9201
|
-
const intersects = requireIntersects();
|
|
9202
|
-
const simplifyRange = requireSimplify();
|
|
9203
|
-
const subset = requireSubset();
|
|
9204
|
-
semver = {
|
|
9205
|
-
parse: parse2,
|
|
9206
|
-
valid: valid2,
|
|
9207
|
-
clean,
|
|
9208
|
-
inc,
|
|
9209
|
-
diff,
|
|
9210
|
-
major,
|
|
9211
|
-
minor,
|
|
9212
|
-
patch,
|
|
9213
|
-
prerelease,
|
|
9214
|
-
compare,
|
|
9215
|
-
rcompare,
|
|
9216
|
-
compareLoose,
|
|
9217
|
-
compareBuild,
|
|
9218
|
-
sort,
|
|
9219
|
-
rsort,
|
|
9220
|
-
gt,
|
|
9221
|
-
lt,
|
|
9222
|
-
eq,
|
|
9223
|
-
neq,
|
|
9224
|
-
gte,
|
|
9225
|
-
lte,
|
|
9226
|
-
cmp,
|
|
9227
|
-
coerce,
|
|
9228
|
-
Comparator,
|
|
9229
|
-
Range,
|
|
9230
|
-
satisfies: satisfies2,
|
|
9231
|
-
toComparators,
|
|
9232
|
-
maxSatisfying,
|
|
9233
|
-
minSatisfying,
|
|
9234
|
-
minVersion,
|
|
9235
|
-
validRange,
|
|
9236
|
-
outside,
|
|
9237
|
-
gtr,
|
|
9238
|
-
ltr,
|
|
9239
|
-
intersects,
|
|
9240
|
-
simplifyRange,
|
|
9241
|
-
subset,
|
|
9242
|
-
SemVer,
|
|
9243
|
-
re: internalRe.re,
|
|
9244
|
-
src: internalRe.src,
|
|
9245
|
-
tokens: internalRe.t,
|
|
9246
|
-
SEMVER_SPEC_VERSION: constants2.SEMVER_SPEC_VERSION,
|
|
9247
|
-
RELEASE_TYPES: constants2.RELEASE_TYPES,
|
|
9248
|
-
compareIdentifiers: identifiers2.compareIdentifiers,
|
|
9249
|
-
rcompareIdentifiers: identifiers2.rcompareIdentifiers
|
|
9250
|
-
};
|
|
9251
|
-
return semver;
|
|
9252
|
-
}
|
|
9253
|
-
function requireAsymmetricKeyDetailsSupported() {
|
|
9254
|
-
if (hasRequiredAsymmetricKeyDetailsSupported) return asymmetricKeyDetailsSupported;
|
|
9255
|
-
hasRequiredAsymmetricKeyDetailsSupported = 1;
|
|
9256
|
-
const semver2 = requireSemver();
|
|
9257
|
-
asymmetricKeyDetailsSupported = semver2.satisfies(process.version, ">=15.7.0");
|
|
9258
|
-
return asymmetricKeyDetailsSupported;
|
|
9259
|
-
}
|
|
9260
|
-
function requireRsaPssKeyDetailsSupported() {
|
|
9261
|
-
if (hasRequiredRsaPssKeyDetailsSupported) return rsaPssKeyDetailsSupported;
|
|
9262
|
-
hasRequiredRsaPssKeyDetailsSupported = 1;
|
|
9263
|
-
const semver2 = requireSemver();
|
|
9264
|
-
rsaPssKeyDetailsSupported = semver2.satisfies(process.version, ">=16.9.0");
|
|
9265
|
-
return rsaPssKeyDetailsSupported;
|
|
9266
|
-
}
|
|
9267
|
-
function requireValidateAsymmetricKey() {
|
|
9268
|
-
if (hasRequiredValidateAsymmetricKey) return validateAsymmetricKey;
|
|
9269
|
-
hasRequiredValidateAsymmetricKey = 1;
|
|
9270
|
-
const ASYMMETRIC_KEY_DETAILS_SUPPORTED = requireAsymmetricKeyDetailsSupported();
|
|
9271
|
-
const RSA_PSS_KEY_DETAILS_SUPPORTED = requireRsaPssKeyDetailsSupported();
|
|
9272
|
-
const allowedAlgorithmsForKeys = {
|
|
9273
|
-
"ec": ["ES256", "ES384", "ES512"],
|
|
9274
|
-
"rsa": ["RS256", "PS256", "RS384", "PS384", "RS512", "PS512"],
|
|
9275
|
-
"rsa-pss": ["PS256", "PS384", "PS512"]
|
|
9276
|
-
};
|
|
9277
|
-
const allowedCurves = {
|
|
9278
|
-
ES256: "prime256v1",
|
|
9279
|
-
ES384: "secp384r1",
|
|
9280
|
-
ES512: "secp521r1"
|
|
9281
|
-
};
|
|
9282
|
-
validateAsymmetricKey = function(algorithm, key) {
|
|
9283
|
-
if (!algorithm || !key) return;
|
|
9284
|
-
const keyType = key.asymmetricKeyType;
|
|
9285
|
-
if (!keyType) return;
|
|
9286
|
-
const allowedAlgorithms = allowedAlgorithmsForKeys[keyType];
|
|
9287
|
-
if (!allowedAlgorithms) {
|
|
9288
|
-
throw new Error(`Unknown key type "${keyType}".`);
|
|
9289
|
-
}
|
|
9290
|
-
if (!allowedAlgorithms.includes(algorithm)) {
|
|
9291
|
-
throw new Error(`"alg" parameter for "${keyType}" key type must be one of: ${allowedAlgorithms.join(", ")}.`);
|
|
9292
|
-
}
|
|
9293
|
-
if (ASYMMETRIC_KEY_DETAILS_SUPPORTED) {
|
|
9294
|
-
switch (keyType) {
|
|
9295
|
-
case "ec":
|
|
9296
|
-
const keyCurve = key.asymmetricKeyDetails.namedCurve;
|
|
9297
|
-
const allowedCurve = allowedCurves[algorithm];
|
|
9298
|
-
if (keyCurve !== allowedCurve) {
|
|
9299
|
-
throw new Error(`"alg" parameter "${algorithm}" requires curve "${allowedCurve}".`);
|
|
9300
|
-
}
|
|
9301
|
-
break;
|
|
9302
|
-
case "rsa-pss":
|
|
9303
|
-
if (RSA_PSS_KEY_DETAILS_SUPPORTED) {
|
|
9304
|
-
const length = parseInt(algorithm.slice(-3), 10);
|
|
9305
|
-
const { hashAlgorithm, mgf1HashAlgorithm, saltLength } = key.asymmetricKeyDetails;
|
|
9306
|
-
if (hashAlgorithm !== `sha${length}` || mgf1HashAlgorithm !== hashAlgorithm) {
|
|
9307
|
-
throw new Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${algorithm}.`);
|
|
9308
|
-
}
|
|
9309
|
-
if (saltLength !== void 0 && saltLength > length >> 3) {
|
|
9310
|
-
throw new Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${algorithm}.`);
|
|
9311
|
-
}
|
|
9312
|
-
}
|
|
9313
|
-
break;
|
|
9314
|
-
}
|
|
9315
|
-
}
|
|
9316
|
-
};
|
|
9317
|
-
return validateAsymmetricKey;
|
|
9318
|
-
}
|
|
9319
|
-
function requirePsSupported() {
|
|
9320
|
-
if (hasRequiredPsSupported) return psSupported;
|
|
9321
|
-
hasRequiredPsSupported = 1;
|
|
9322
|
-
var semver2 = requireSemver();
|
|
9323
|
-
psSupported = semver2.satisfies(process.version, "^6.12.0 || >=8.0.0");
|
|
9324
|
-
return psSupported;
|
|
9325
|
-
}
|
|
9326
|
-
function requireVerify() {
|
|
9327
|
-
if (hasRequiredVerify) return verify;
|
|
9328
|
-
hasRequiredVerify = 1;
|
|
9329
|
-
const JsonWebTokenError = requireJsonWebTokenError();
|
|
9330
|
-
const NotBeforeError = requireNotBeforeError();
|
|
9331
|
-
const TokenExpiredError = requireTokenExpiredError();
|
|
9332
|
-
const decode2 = requireDecode();
|
|
9333
|
-
const timespan2 = requireTimespan();
|
|
9334
|
-
const validateAsymmetricKey2 = requireValidateAsymmetricKey();
|
|
9335
|
-
const PS_SUPPORTED = requirePsSupported();
|
|
9336
|
-
const jws2 = requireJws();
|
|
9337
|
-
const { KeyObject, createSecretKey, createPublicKey } = require$$22;
|
|
9338
|
-
const PUB_KEY_ALGS = ["RS256", "RS384", "RS512"];
|
|
9339
|
-
const EC_KEY_ALGS = ["ES256", "ES384", "ES512"];
|
|
9340
|
-
const RSA_KEY_ALGS = ["RS256", "RS384", "RS512"];
|
|
9341
|
-
const HS_ALGS = ["HS256", "HS384", "HS512"];
|
|
9342
|
-
if (PS_SUPPORTED) {
|
|
9343
|
-
PUB_KEY_ALGS.splice(PUB_KEY_ALGS.length, 0, "PS256", "PS384", "PS512");
|
|
9344
|
-
RSA_KEY_ALGS.splice(RSA_KEY_ALGS.length, 0, "PS256", "PS384", "PS512");
|
|
9345
|
-
}
|
|
9346
|
-
verify = function(jwtString, secretOrPublicKey, options, callback) {
|
|
9347
|
-
if (typeof options === "function" && !callback) {
|
|
9348
|
-
callback = options;
|
|
9349
|
-
options = {};
|
|
9350
|
-
}
|
|
9351
|
-
if (!options) {
|
|
9352
|
-
options = {};
|
|
9353
|
-
}
|
|
9354
|
-
options = Object.assign({}, options);
|
|
9355
|
-
let done;
|
|
9356
|
-
if (callback) {
|
|
9357
|
-
done = callback;
|
|
9358
|
-
} else {
|
|
9359
|
-
done = function(err, data) {
|
|
9360
|
-
if (err) throw err;
|
|
9361
|
-
return data;
|
|
9362
|
-
};
|
|
9363
|
-
}
|
|
9364
|
-
if (options.clockTimestamp && typeof options.clockTimestamp !== "number") {
|
|
9365
|
-
return done(new JsonWebTokenError("clockTimestamp must be a number"));
|
|
9366
|
-
}
|
|
9367
|
-
if (options.nonce !== void 0 && (typeof options.nonce !== "string" || options.nonce.trim() === "")) {
|
|
9368
|
-
return done(new JsonWebTokenError("nonce must be a non-empty string"));
|
|
9369
|
-
}
|
|
9370
|
-
if (options.allowInvalidAsymmetricKeyTypes !== void 0 && typeof options.allowInvalidAsymmetricKeyTypes !== "boolean") {
|
|
9371
|
-
return done(new JsonWebTokenError("allowInvalidAsymmetricKeyTypes must be a boolean"));
|
|
9372
|
-
}
|
|
9373
|
-
const clockTimestamp = options.clockTimestamp || Math.floor(Date.now() / 1e3);
|
|
9374
|
-
if (!jwtString) {
|
|
9375
|
-
return done(new JsonWebTokenError("jwt must be provided"));
|
|
9376
|
-
}
|
|
9377
|
-
if (typeof jwtString !== "string") {
|
|
9378
|
-
return done(new JsonWebTokenError("jwt must be a string"));
|
|
9379
|
-
}
|
|
9380
|
-
const parts = jwtString.split(".");
|
|
9381
|
-
if (parts.length !== 3) {
|
|
9382
|
-
return done(new JsonWebTokenError("jwt malformed"));
|
|
9383
|
-
}
|
|
9384
|
-
let decodedToken;
|
|
9385
|
-
try {
|
|
9386
|
-
decodedToken = decode2(jwtString, { complete: true });
|
|
9387
|
-
} catch (err) {
|
|
9388
|
-
return done(err);
|
|
9389
|
-
}
|
|
9390
|
-
if (!decodedToken) {
|
|
9391
|
-
return done(new JsonWebTokenError("invalid token"));
|
|
9392
|
-
}
|
|
9393
|
-
const header = decodedToken.header;
|
|
9394
|
-
let getSecret;
|
|
9395
|
-
if (typeof secretOrPublicKey === "function") {
|
|
9396
|
-
if (!callback) {
|
|
9397
|
-
return done(new JsonWebTokenError("verify must be called asynchronous if secret or public key is provided as a callback"));
|
|
9398
|
-
}
|
|
9399
|
-
getSecret = secretOrPublicKey;
|
|
9400
|
-
} else {
|
|
9401
|
-
getSecret = function(header2, secretCallback) {
|
|
9402
|
-
return secretCallback(null, secretOrPublicKey);
|
|
9403
|
-
};
|
|
9404
|
-
}
|
|
9405
|
-
return getSecret(header, function(err, secretOrPublicKey2) {
|
|
9406
|
-
if (err) {
|
|
9407
|
-
return done(new JsonWebTokenError("error in secret or public key callback: " + err.message));
|
|
9408
|
-
}
|
|
9409
|
-
const hasSignature = parts[2].trim() !== "";
|
|
9410
|
-
if (!hasSignature && secretOrPublicKey2) {
|
|
9411
|
-
return done(new JsonWebTokenError("jwt signature is required"));
|
|
9412
|
-
}
|
|
9413
|
-
if (hasSignature && !secretOrPublicKey2) {
|
|
9414
|
-
return done(new JsonWebTokenError("secret or public key must be provided"));
|
|
9415
|
-
}
|
|
9416
|
-
if (!hasSignature && !options.algorithms) {
|
|
9417
|
-
return done(new JsonWebTokenError('please specify "none" in "algorithms" to verify unsigned tokens'));
|
|
9418
|
-
}
|
|
9419
|
-
if (secretOrPublicKey2 != null && !(secretOrPublicKey2 instanceof KeyObject)) {
|
|
9420
|
-
try {
|
|
9421
|
-
secretOrPublicKey2 = createPublicKey(secretOrPublicKey2);
|
|
9422
|
-
} catch (_) {
|
|
9423
|
-
try {
|
|
9424
|
-
secretOrPublicKey2 = createSecretKey(typeof secretOrPublicKey2 === "string" ? Buffer.from(secretOrPublicKey2) : secretOrPublicKey2);
|
|
9425
|
-
} catch (_2) {
|
|
9426
|
-
return done(new JsonWebTokenError("secretOrPublicKey is not valid key material"));
|
|
9427
|
-
}
|
|
9428
|
-
}
|
|
9429
|
-
}
|
|
9430
|
-
if (!options.algorithms) {
|
|
9431
|
-
if (secretOrPublicKey2.type === "secret") {
|
|
9432
|
-
options.algorithms = HS_ALGS;
|
|
9433
|
-
} else if (["rsa", "rsa-pss"].includes(secretOrPublicKey2.asymmetricKeyType)) {
|
|
9434
|
-
options.algorithms = RSA_KEY_ALGS;
|
|
9435
|
-
} else if (secretOrPublicKey2.asymmetricKeyType === "ec") {
|
|
9436
|
-
options.algorithms = EC_KEY_ALGS;
|
|
9437
|
-
} else {
|
|
9438
|
-
options.algorithms = PUB_KEY_ALGS;
|
|
9439
|
-
}
|
|
9440
|
-
}
|
|
9441
|
-
if (options.algorithms.indexOf(decodedToken.header.alg) === -1) {
|
|
9442
|
-
return done(new JsonWebTokenError("invalid algorithm"));
|
|
9443
|
-
}
|
|
9444
|
-
if (header.alg.startsWith("HS") && secretOrPublicKey2.type !== "secret") {
|
|
9445
|
-
return done(new JsonWebTokenError(`secretOrPublicKey must be a symmetric key when using ${header.alg}`));
|
|
9446
|
-
} else if (/^(?:RS|PS|ES)/.test(header.alg) && secretOrPublicKey2.type !== "public") {
|
|
9447
|
-
return done(new JsonWebTokenError(`secretOrPublicKey must be an asymmetric key when using ${header.alg}`));
|
|
9448
|
-
}
|
|
9449
|
-
if (!options.allowInvalidAsymmetricKeyTypes) {
|
|
9450
|
-
try {
|
|
9451
|
-
validateAsymmetricKey2(header.alg, secretOrPublicKey2);
|
|
9452
|
-
} catch (e) {
|
|
9453
|
-
return done(e);
|
|
9454
|
-
}
|
|
9455
|
-
}
|
|
9456
|
-
let valid2;
|
|
9457
|
-
try {
|
|
9458
|
-
valid2 = jws2.verify(jwtString, decodedToken.header.alg, secretOrPublicKey2);
|
|
9459
|
-
} catch (e) {
|
|
9460
|
-
return done(e);
|
|
9461
|
-
}
|
|
9462
|
-
if (!valid2) {
|
|
9463
|
-
return done(new JsonWebTokenError("invalid signature"));
|
|
9464
|
-
}
|
|
9465
|
-
const payload = decodedToken.payload;
|
|
9466
|
-
if (typeof payload.nbf !== "undefined" && !options.ignoreNotBefore) {
|
|
9467
|
-
if (typeof payload.nbf !== "number") {
|
|
9468
|
-
return done(new JsonWebTokenError("invalid nbf value"));
|
|
9469
|
-
}
|
|
9470
|
-
if (payload.nbf > clockTimestamp + (options.clockTolerance || 0)) {
|
|
9471
|
-
return done(new NotBeforeError("jwt not active", new Date(payload.nbf * 1e3)));
|
|
9472
|
-
}
|
|
9473
|
-
}
|
|
9474
|
-
if (typeof payload.exp !== "undefined" && !options.ignoreExpiration) {
|
|
9475
|
-
if (typeof payload.exp !== "number") {
|
|
9476
|
-
return done(new JsonWebTokenError("invalid exp value"));
|
|
9477
|
-
}
|
|
9478
|
-
if (clockTimestamp >= payload.exp + (options.clockTolerance || 0)) {
|
|
9479
|
-
return done(new TokenExpiredError("jwt expired", new Date(payload.exp * 1e3)));
|
|
9480
|
-
}
|
|
9481
|
-
}
|
|
9482
|
-
if (options.audience) {
|
|
9483
|
-
const audiences = Array.isArray(options.audience) ? options.audience : [options.audience];
|
|
9484
|
-
const target = Array.isArray(payload.aud) ? payload.aud : [payload.aud];
|
|
9485
|
-
const match = target.some(function(targetAudience) {
|
|
9486
|
-
return audiences.some(function(audience) {
|
|
9487
|
-
return audience instanceof RegExp ? audience.test(targetAudience) : audience === targetAudience;
|
|
9488
|
-
});
|
|
9489
|
-
});
|
|
9490
|
-
if (!match) {
|
|
9491
|
-
return done(new JsonWebTokenError("jwt audience invalid. expected: " + audiences.join(" or ")));
|
|
9492
|
-
}
|
|
9493
|
-
}
|
|
9494
|
-
if (options.issuer) {
|
|
9495
|
-
const invalid_issuer = typeof options.issuer === "string" && payload.iss !== options.issuer || Array.isArray(options.issuer) && options.issuer.indexOf(payload.iss) === -1;
|
|
9496
|
-
if (invalid_issuer) {
|
|
9497
|
-
return done(new JsonWebTokenError("jwt issuer invalid. expected: " + options.issuer));
|
|
9498
|
-
}
|
|
9499
|
-
}
|
|
9500
|
-
if (options.subject) {
|
|
9501
|
-
if (payload.sub !== options.subject) {
|
|
9502
|
-
return done(new JsonWebTokenError("jwt subject invalid. expected: " + options.subject));
|
|
9503
|
-
}
|
|
9504
|
-
}
|
|
9505
|
-
if (options.jwtid) {
|
|
9506
|
-
if (payload.jti !== options.jwtid) {
|
|
9507
|
-
return done(new JsonWebTokenError("jwt jwtid invalid. expected: " + options.jwtid));
|
|
9508
|
-
}
|
|
9509
|
-
}
|
|
9510
|
-
if (options.nonce) {
|
|
9511
|
-
if (payload.nonce !== options.nonce) {
|
|
9512
|
-
return done(new JsonWebTokenError("jwt nonce invalid. expected: " + options.nonce));
|
|
9513
|
-
}
|
|
9514
|
-
}
|
|
9515
|
-
if (options.maxAge) {
|
|
9516
|
-
if (typeof payload.iat !== "number") {
|
|
9517
|
-
return done(new JsonWebTokenError("iat required when maxAge is specified"));
|
|
9518
|
-
}
|
|
9519
|
-
const maxAgeTimestamp = timespan2(options.maxAge, payload.iat);
|
|
9520
|
-
if (typeof maxAgeTimestamp === "undefined") {
|
|
9521
|
-
return done(new JsonWebTokenError('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));
|
|
9522
|
-
}
|
|
9523
|
-
if (clockTimestamp >= maxAgeTimestamp + (options.clockTolerance || 0)) {
|
|
9524
|
-
return done(new TokenExpiredError("maxAge exceeded", new Date(maxAgeTimestamp * 1e3)));
|
|
9525
|
-
}
|
|
9526
|
-
}
|
|
9527
|
-
if (options.complete === true) {
|
|
9528
|
-
const signature = decodedToken.signature;
|
|
9529
|
-
return done(null, {
|
|
9530
|
-
header,
|
|
9531
|
-
payload,
|
|
9532
|
-
signature
|
|
9533
|
-
});
|
|
9534
|
-
}
|
|
9535
|
-
return done(null, payload);
|
|
9536
|
-
});
|
|
9537
|
-
};
|
|
9538
|
-
return verify;
|
|
9539
|
-
}
|
|
9540
|
-
function requireLodash_includes() {
|
|
9541
|
-
if (hasRequiredLodash_includes) return lodash_includes;
|
|
9542
|
-
hasRequiredLodash_includes = 1;
|
|
9543
|
-
var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN = 0 / 0;
|
|
9544
|
-
var argsTag = "[object Arguments]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", stringTag = "[object String]", symbolTag = "[object Symbol]";
|
|
9545
|
-
var reTrim = /^\s+|\s+$/g;
|
|
9546
|
-
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
9547
|
-
var reIsBinary = /^0b[01]+$/i;
|
|
9548
|
-
var reIsOctal = /^0o[0-7]+$/i;
|
|
9549
|
-
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
9550
|
-
var freeParseInt = parseInt;
|
|
9551
|
-
function arrayMap(array, iteratee) {
|
|
9552
|
-
var index22 = -1, length = array ? array.length : 0, result = Array(length);
|
|
9553
|
-
while (++index22 < length) {
|
|
9554
|
-
result[index22] = iteratee(array[index22], index22, array);
|
|
9555
|
-
}
|
|
9556
|
-
return result;
|
|
9557
|
-
}
|
|
9558
|
-
function baseFindIndex(array, predicate, fromIndex, fromRight) {
|
|
9559
|
-
var length = array.length, index22 = fromIndex + -1;
|
|
9560
|
-
while (++index22 < length) {
|
|
9561
|
-
if (predicate(array[index22], index22, array)) {
|
|
9562
|
-
return index22;
|
|
9563
|
-
}
|
|
9564
|
-
}
|
|
9565
|
-
return -1;
|
|
9566
|
-
}
|
|
9567
|
-
function baseIndexOf(array, value, fromIndex) {
|
|
9568
|
-
if (value !== value) {
|
|
9569
|
-
return baseFindIndex(array, baseIsNaN, fromIndex);
|
|
9570
|
-
}
|
|
9571
|
-
var index22 = fromIndex - 1, length = array.length;
|
|
9572
|
-
while (++index22 < length) {
|
|
9573
|
-
if (array[index22] === value) {
|
|
9574
|
-
return index22;
|
|
9575
|
-
}
|
|
9576
|
-
}
|
|
9577
|
-
return -1;
|
|
9578
|
-
}
|
|
9579
|
-
function baseIsNaN(value) {
|
|
9580
|
-
return value !== value;
|
|
9581
|
-
}
|
|
9582
|
-
function baseTimes(n, iteratee) {
|
|
9583
|
-
var index22 = -1, result = Array(n);
|
|
9584
|
-
while (++index22 < n) {
|
|
9585
|
-
result[index22] = iteratee(index22);
|
|
9586
|
-
}
|
|
9587
|
-
return result;
|
|
9588
|
-
}
|
|
9589
|
-
function baseValues(object, props) {
|
|
9590
|
-
return arrayMap(props, function(key) {
|
|
9591
|
-
return object[key];
|
|
9592
|
-
});
|
|
9593
|
-
}
|
|
9594
|
-
function overArg(func, transform) {
|
|
9595
|
-
return function(arg) {
|
|
9596
|
-
return func(transform(arg));
|
|
9597
|
-
};
|
|
9598
|
-
}
|
|
9599
|
-
var objectProto = Object.prototype;
|
|
9600
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
9601
|
-
var objectToString = objectProto.toString;
|
|
9602
|
-
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
|
9603
|
-
var nativeKeys = overArg(Object.keys, Object), nativeMax = Math.max;
|
|
9604
|
-
function arrayLikeKeys(value, inherited) {
|
|
9605
|
-
var result = isArray(value) || isArguments(value) ? baseTimes(value.length, String) : [];
|
|
9606
|
-
var length = result.length, skipIndexes = !!length;
|
|
9607
|
-
for (var key in value) {
|
|
9608
|
-
if (hasOwnProperty.call(value, key) && !(skipIndexes && (key == "length" || isIndex(key, length)))) {
|
|
9609
|
-
result.push(key);
|
|
9610
|
-
}
|
|
9611
|
-
}
|
|
9612
|
-
return result;
|
|
9613
|
-
}
|
|
9614
|
-
function baseKeys(object) {
|
|
9615
|
-
if (!isPrototype(object)) {
|
|
9616
|
-
return nativeKeys(object);
|
|
9617
|
-
}
|
|
9618
|
-
var result = [];
|
|
9619
|
-
for (var key in Object(object)) {
|
|
9620
|
-
if (hasOwnProperty.call(object, key) && key != "constructor") {
|
|
9621
|
-
result.push(key);
|
|
9622
|
-
}
|
|
9623
|
-
}
|
|
9624
|
-
return result;
|
|
9625
|
-
}
|
|
9626
|
-
function isIndex(value, length) {
|
|
9627
|
-
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
9628
|
-
return !!length && (typeof value == "number" || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
|
|
9629
|
-
}
|
|
9630
|
-
function isPrototype(value) {
|
|
9631
|
-
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
|
|
9632
|
-
return value === proto;
|
|
9633
|
-
}
|
|
9634
|
-
function includes(collection, value, fromIndex, guard) {
|
|
9635
|
-
collection = isArrayLike(collection) ? collection : values(collection);
|
|
9636
|
-
fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
|
|
9637
|
-
var length = collection.length;
|
|
9638
|
-
if (fromIndex < 0) {
|
|
9639
|
-
fromIndex = nativeMax(length + fromIndex, 0);
|
|
9640
|
-
}
|
|
9641
|
-
return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
|
|
9642
|
-
}
|
|
9643
|
-
function isArguments(value) {
|
|
9644
|
-
return isArrayLikeObject(value) && hasOwnProperty.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag);
|
|
9645
|
-
}
|
|
9646
|
-
var isArray = Array.isArray;
|
|
9647
|
-
function isArrayLike(value) {
|
|
9648
|
-
return value != null && isLength(value.length) && !isFunction(value);
|
|
9649
|
-
}
|
|
9650
|
-
function isArrayLikeObject(value) {
|
|
9651
|
-
return isObjectLike(value) && isArrayLike(value);
|
|
9652
|
-
}
|
|
9653
|
-
function isFunction(value) {
|
|
9654
|
-
var tag = isObject(value) ? objectToString.call(value) : "";
|
|
9655
|
-
return tag == funcTag || tag == genTag;
|
|
9656
|
-
}
|
|
9657
|
-
function isLength(value) {
|
|
9658
|
-
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
9659
|
-
}
|
|
9660
|
-
function isObject(value) {
|
|
9661
|
-
var type = typeof value;
|
|
9662
|
-
return !!value && (type == "object" || type == "function");
|
|
9663
|
-
}
|
|
9664
|
-
function isObjectLike(value) {
|
|
9665
|
-
return !!value && typeof value == "object";
|
|
9666
|
-
}
|
|
9667
|
-
function isString(value) {
|
|
9668
|
-
return typeof value == "string" || !isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag;
|
|
9669
|
-
}
|
|
9670
|
-
function isSymbol(value) {
|
|
9671
|
-
return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag;
|
|
9672
|
-
}
|
|
9673
|
-
function toFinite(value) {
|
|
9674
|
-
if (!value) {
|
|
9675
|
-
return value === 0 ? value : 0;
|
|
9676
|
-
}
|
|
9677
|
-
value = toNumber(value);
|
|
9678
|
-
if (value === INFINITY || value === -Infinity) {
|
|
9679
|
-
var sign2 = value < 0 ? -1 : 1;
|
|
9680
|
-
return sign2 * MAX_INTEGER;
|
|
9681
|
-
}
|
|
9682
|
-
return value === value ? value : 0;
|
|
9683
|
-
}
|
|
9684
|
-
function toInteger(value) {
|
|
9685
|
-
var result = toFinite(value), remainder = result % 1;
|
|
9686
|
-
return result === result ? remainder ? result - remainder : result : 0;
|
|
9687
|
-
}
|
|
9688
|
-
function toNumber(value) {
|
|
9689
|
-
if (typeof value == "number") {
|
|
9690
|
-
return value;
|
|
9691
|
-
}
|
|
9692
|
-
if (isSymbol(value)) {
|
|
9693
|
-
return NAN;
|
|
9694
|
-
}
|
|
9695
|
-
if (isObject(value)) {
|
|
9696
|
-
var other2 = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
9697
|
-
value = isObject(other2) ? other2 + "" : other2;
|
|
9698
|
-
}
|
|
9699
|
-
if (typeof value != "string") {
|
|
9700
|
-
return value === 0 ? value : +value;
|
|
9701
|
-
}
|
|
9702
|
-
value = value.replace(reTrim, "");
|
|
9703
|
-
var isBinary = reIsBinary.test(value);
|
|
9704
|
-
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
9705
|
-
}
|
|
9706
|
-
function keys(object) {
|
|
9707
|
-
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
9708
|
-
}
|
|
9709
|
-
function values(object) {
|
|
9710
|
-
return object ? baseValues(object, keys(object)) : [];
|
|
9711
|
-
}
|
|
9712
|
-
lodash_includes = includes;
|
|
9713
|
-
return lodash_includes;
|
|
9714
|
-
}
|
|
9715
|
-
function requireLodash_isboolean() {
|
|
9716
|
-
if (hasRequiredLodash_isboolean) return lodash_isboolean;
|
|
9717
|
-
hasRequiredLodash_isboolean = 1;
|
|
9718
|
-
var boolTag = "[object Boolean]";
|
|
9719
|
-
var objectProto = Object.prototype;
|
|
9720
|
-
var objectToString = objectProto.toString;
|
|
9721
|
-
function isBoolean(value) {
|
|
9722
|
-
return value === true || value === false || isObjectLike(value) && objectToString.call(value) == boolTag;
|
|
9723
|
-
}
|
|
9724
|
-
function isObjectLike(value) {
|
|
9725
|
-
return !!value && typeof value == "object";
|
|
9726
|
-
}
|
|
9727
|
-
lodash_isboolean = isBoolean;
|
|
9728
|
-
return lodash_isboolean;
|
|
9729
|
-
}
|
|
9730
|
-
function requireLodash_isinteger() {
|
|
9731
|
-
if (hasRequiredLodash_isinteger) return lodash_isinteger;
|
|
9732
|
-
hasRequiredLodash_isinteger = 1;
|
|
9733
|
-
var INFINITY = 1 / 0, MAX_INTEGER = 17976931348623157e292, NAN = 0 / 0;
|
|
9734
|
-
var symbolTag = "[object Symbol]";
|
|
9735
|
-
var reTrim = /^\s+|\s+$/g;
|
|
9736
|
-
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
9737
|
-
var reIsBinary = /^0b[01]+$/i;
|
|
9738
|
-
var reIsOctal = /^0o[0-7]+$/i;
|
|
9739
|
-
var freeParseInt = parseInt;
|
|
9740
|
-
var objectProto = Object.prototype;
|
|
9741
|
-
var objectToString = objectProto.toString;
|
|
9742
|
-
function isInteger(value) {
|
|
9743
|
-
return typeof value == "number" && value == toInteger(value);
|
|
9744
|
-
}
|
|
9745
|
-
function isObject(value) {
|
|
9746
|
-
var type = typeof value;
|
|
9747
|
-
return !!value && (type == "object" || type == "function");
|
|
9748
|
-
}
|
|
9749
|
-
function isObjectLike(value) {
|
|
9750
|
-
return !!value && typeof value == "object";
|
|
9751
|
-
}
|
|
9752
|
-
function isSymbol(value) {
|
|
9753
|
-
return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag;
|
|
9754
|
-
}
|
|
9755
|
-
function toFinite(value) {
|
|
9756
|
-
if (!value) {
|
|
9757
|
-
return value === 0 ? value : 0;
|
|
9758
|
-
}
|
|
9759
|
-
value = toNumber(value);
|
|
9760
|
-
if (value === INFINITY || value === -Infinity) {
|
|
9761
|
-
var sign2 = value < 0 ? -1 : 1;
|
|
9762
|
-
return sign2 * MAX_INTEGER;
|
|
9763
|
-
}
|
|
9764
|
-
return value === value ? value : 0;
|
|
9765
|
-
}
|
|
9766
|
-
function toInteger(value) {
|
|
9767
|
-
var result = toFinite(value), remainder = result % 1;
|
|
9768
|
-
return result === result ? remainder ? result - remainder : result : 0;
|
|
9769
|
-
}
|
|
9770
|
-
function toNumber(value) {
|
|
9771
|
-
if (typeof value == "number") {
|
|
9772
|
-
return value;
|
|
9773
|
-
}
|
|
9774
|
-
if (isSymbol(value)) {
|
|
9775
|
-
return NAN;
|
|
9776
|
-
}
|
|
9777
|
-
if (isObject(value)) {
|
|
9778
|
-
var other2 = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
9779
|
-
value = isObject(other2) ? other2 + "" : other2;
|
|
9780
|
-
}
|
|
9781
|
-
if (typeof value != "string") {
|
|
9782
|
-
return value === 0 ? value : +value;
|
|
9783
|
-
}
|
|
9784
|
-
value = value.replace(reTrim, "");
|
|
9785
|
-
var isBinary = reIsBinary.test(value);
|
|
9786
|
-
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
9787
|
-
}
|
|
9788
|
-
lodash_isinteger = isInteger;
|
|
9789
|
-
return lodash_isinteger;
|
|
9790
|
-
}
|
|
9791
|
-
function requireLodash_isnumber() {
|
|
9792
|
-
if (hasRequiredLodash_isnumber) return lodash_isnumber;
|
|
9793
|
-
hasRequiredLodash_isnumber = 1;
|
|
9794
|
-
var numberTag = "[object Number]";
|
|
9795
|
-
var objectProto = Object.prototype;
|
|
9796
|
-
var objectToString = objectProto.toString;
|
|
9797
|
-
function isObjectLike(value) {
|
|
9798
|
-
return !!value && typeof value == "object";
|
|
9799
|
-
}
|
|
9800
|
-
function isNumber2(value) {
|
|
9801
|
-
return typeof value == "number" || isObjectLike(value) && objectToString.call(value) == numberTag;
|
|
9802
|
-
}
|
|
9803
|
-
lodash_isnumber = isNumber2;
|
|
9804
|
-
return lodash_isnumber;
|
|
9805
|
-
}
|
|
9806
|
-
function requireLodash_isplainobject() {
|
|
9807
|
-
if (hasRequiredLodash_isplainobject) return lodash_isplainobject;
|
|
9808
|
-
hasRequiredLodash_isplainobject = 1;
|
|
9809
|
-
var objectTag = "[object Object]";
|
|
9810
|
-
function isHostObject(value) {
|
|
9811
|
-
var result = false;
|
|
9812
|
-
if (value != null && typeof value.toString != "function") {
|
|
9813
|
-
try {
|
|
9814
|
-
result = !!(value + "");
|
|
9815
|
-
} catch (e) {
|
|
9816
|
-
}
|
|
9817
|
-
}
|
|
9818
|
-
return result;
|
|
9819
|
-
}
|
|
9820
|
-
function overArg(func, transform) {
|
|
9821
|
-
return function(arg) {
|
|
9822
|
-
return func(transform(arg));
|
|
9823
|
-
};
|
|
9824
|
-
}
|
|
9825
|
-
var funcProto = Function.prototype, objectProto = Object.prototype;
|
|
9826
|
-
var funcToString = funcProto.toString;
|
|
9827
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
9828
|
-
var objectCtorString = funcToString.call(Object);
|
|
9829
|
-
var objectToString = objectProto.toString;
|
|
9830
|
-
var getPrototype = overArg(Object.getPrototypeOf, Object);
|
|
9831
|
-
function isObjectLike(value) {
|
|
9832
|
-
return !!value && typeof value == "object";
|
|
9833
|
-
}
|
|
9834
|
-
function isPlainObject(value) {
|
|
9835
|
-
if (!isObjectLike(value) || objectToString.call(value) != objectTag || isHostObject(value)) {
|
|
9836
|
-
return false;
|
|
9837
|
-
}
|
|
9838
|
-
var proto = getPrototype(value);
|
|
9839
|
-
if (proto === null) {
|
|
9840
|
-
return true;
|
|
9841
|
-
}
|
|
9842
|
-
var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
|
9843
|
-
return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
|
|
9844
|
-
}
|
|
9845
|
-
lodash_isplainobject = isPlainObject;
|
|
9846
|
-
return lodash_isplainobject;
|
|
9847
|
-
}
|
|
9848
|
-
function requireLodash_isstring() {
|
|
9849
|
-
if (hasRequiredLodash_isstring) return lodash_isstring;
|
|
9850
|
-
hasRequiredLodash_isstring = 1;
|
|
9851
|
-
var stringTag = "[object String]";
|
|
9852
|
-
var objectProto = Object.prototype;
|
|
9853
|
-
var objectToString = objectProto.toString;
|
|
9854
|
-
var isArray = Array.isArray;
|
|
9855
|
-
function isObjectLike(value) {
|
|
9856
|
-
return !!value && typeof value == "object";
|
|
9857
|
-
}
|
|
9858
|
-
function isString(value) {
|
|
9859
|
-
return typeof value == "string" || !isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag;
|
|
9860
|
-
}
|
|
9861
|
-
lodash_isstring = isString;
|
|
9862
|
-
return lodash_isstring;
|
|
9863
|
-
}
|
|
9864
|
-
function requireLodash_once() {
|
|
9865
|
-
if (hasRequiredLodash_once) return lodash_once;
|
|
9866
|
-
hasRequiredLodash_once = 1;
|
|
9867
|
-
var FUNC_ERROR_TEXT = "Expected a function";
|
|
9868
|
-
var INFINITY = 1 / 0, MAX_INTEGER = 17976931348623157e292, NAN = 0 / 0;
|
|
9869
|
-
var symbolTag = "[object Symbol]";
|
|
9870
|
-
var reTrim = /^\s+|\s+$/g;
|
|
9871
|
-
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
9872
|
-
var reIsBinary = /^0b[01]+$/i;
|
|
9873
|
-
var reIsOctal = /^0o[0-7]+$/i;
|
|
9874
|
-
var freeParseInt = parseInt;
|
|
9875
|
-
var objectProto = Object.prototype;
|
|
9876
|
-
var objectToString = objectProto.toString;
|
|
9877
|
-
function before(n, func) {
|
|
9878
|
-
var result;
|
|
9879
|
-
if (typeof func != "function") {
|
|
9880
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
9881
|
-
}
|
|
9882
|
-
n = toInteger(n);
|
|
9883
|
-
return function() {
|
|
9884
|
-
if (--n > 0) {
|
|
9885
|
-
result = func.apply(this, arguments);
|
|
9886
|
-
}
|
|
9887
|
-
if (n <= 1) {
|
|
9888
|
-
func = void 0;
|
|
9889
|
-
}
|
|
9890
|
-
return result;
|
|
9891
|
-
};
|
|
9892
|
-
}
|
|
9893
|
-
function once(func) {
|
|
9894
|
-
return before(2, func);
|
|
9895
|
-
}
|
|
9896
|
-
function isObject(value) {
|
|
9897
|
-
var type = typeof value;
|
|
9898
|
-
return !!value && (type == "object" || type == "function");
|
|
9899
|
-
}
|
|
9900
|
-
function isObjectLike(value) {
|
|
9901
|
-
return !!value && typeof value == "object";
|
|
9902
|
-
}
|
|
9903
|
-
function isSymbol(value) {
|
|
9904
|
-
return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag;
|
|
9905
|
-
}
|
|
9906
|
-
function toFinite(value) {
|
|
9907
|
-
if (!value) {
|
|
9908
|
-
return value === 0 ? value : 0;
|
|
9909
|
-
}
|
|
9910
|
-
value = toNumber(value);
|
|
9911
|
-
if (value === INFINITY || value === -Infinity) {
|
|
9912
|
-
var sign2 = value < 0 ? -1 : 1;
|
|
9913
|
-
return sign2 * MAX_INTEGER;
|
|
9914
|
-
}
|
|
9915
|
-
return value === value ? value : 0;
|
|
9916
|
-
}
|
|
9917
|
-
function toInteger(value) {
|
|
9918
|
-
var result = toFinite(value), remainder = result % 1;
|
|
9919
|
-
return result === result ? remainder ? result - remainder : result : 0;
|
|
9920
|
-
}
|
|
9921
|
-
function toNumber(value) {
|
|
9922
|
-
if (typeof value == "number") {
|
|
9923
|
-
return value;
|
|
9924
|
-
}
|
|
9925
|
-
if (isSymbol(value)) {
|
|
9926
|
-
return NAN;
|
|
9927
|
-
}
|
|
9928
|
-
if (isObject(value)) {
|
|
9929
|
-
var other2 = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
9930
|
-
value = isObject(other2) ? other2 + "" : other2;
|
|
9931
|
-
}
|
|
9932
|
-
if (typeof value != "string") {
|
|
9933
|
-
return value === 0 ? value : +value;
|
|
9934
|
-
}
|
|
9935
|
-
value = value.replace(reTrim, "");
|
|
9936
|
-
var isBinary = reIsBinary.test(value);
|
|
9937
|
-
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
9938
|
-
}
|
|
9939
|
-
lodash_once = once;
|
|
9940
|
-
return lodash_once;
|
|
9941
|
-
}
|
|
9942
|
-
function requireSign() {
|
|
9943
|
-
if (hasRequiredSign) return sign;
|
|
9944
|
-
hasRequiredSign = 1;
|
|
9945
|
-
const timespan2 = requireTimespan();
|
|
9946
|
-
const PS_SUPPORTED = requirePsSupported();
|
|
9947
|
-
const validateAsymmetricKey2 = requireValidateAsymmetricKey();
|
|
9948
|
-
const jws2 = requireJws();
|
|
9949
|
-
const includes = requireLodash_includes();
|
|
9950
|
-
const isBoolean = requireLodash_isboolean();
|
|
9951
|
-
const isInteger = requireLodash_isinteger();
|
|
9952
|
-
const isNumber2 = requireLodash_isnumber();
|
|
9953
|
-
const isPlainObject = requireLodash_isplainobject();
|
|
9954
|
-
const isString = requireLodash_isstring();
|
|
9955
|
-
const once = requireLodash_once();
|
|
9956
|
-
const { KeyObject, createSecretKey, createPrivateKey } = require$$22;
|
|
9957
|
-
const SUPPORTED_ALGS = ["RS256", "RS384", "RS512", "ES256", "ES384", "ES512", "HS256", "HS384", "HS512", "none"];
|
|
9958
|
-
if (PS_SUPPORTED) {
|
|
9959
|
-
SUPPORTED_ALGS.splice(3, 0, "PS256", "PS384", "PS512");
|
|
9960
|
-
}
|
|
9961
|
-
const sign_options_schema = {
|
|
9962
|
-
expiresIn: { isValid: function(value) {
|
|
9963
|
-
return isInteger(value) || isString(value) && value;
|
|
9964
|
-
}, message: '"expiresIn" should be a number of seconds or string representing a timespan' },
|
|
9965
|
-
notBefore: { isValid: function(value) {
|
|
9966
|
-
return isInteger(value) || isString(value) && value;
|
|
9967
|
-
}, message: '"notBefore" should be a number of seconds or string representing a timespan' },
|
|
9968
|
-
audience: { isValid: function(value) {
|
|
9969
|
-
return isString(value) || Array.isArray(value);
|
|
9970
|
-
}, message: '"audience" must be a string or array' },
|
|
9971
|
-
algorithm: { isValid: includes.bind(null, SUPPORTED_ALGS), message: '"algorithm" must be a valid string enum value' },
|
|
9972
|
-
header: { isValid: isPlainObject, message: '"header" must be an object' },
|
|
9973
|
-
encoding: { isValid: isString, message: '"encoding" must be a string' },
|
|
9974
|
-
issuer: { isValid: isString, message: '"issuer" must be a string' },
|
|
9975
|
-
subject: { isValid: isString, message: '"subject" must be a string' },
|
|
9976
|
-
jwtid: { isValid: isString, message: '"jwtid" must be a string' },
|
|
9977
|
-
noTimestamp: { isValid: isBoolean, message: '"noTimestamp" must be a boolean' },
|
|
9978
|
-
keyid: { isValid: isString, message: '"keyid" must be a string' },
|
|
9979
|
-
mutatePayload: { isValid: isBoolean, message: '"mutatePayload" must be a boolean' },
|
|
9980
|
-
allowInsecureKeySizes: { isValid: isBoolean, message: '"allowInsecureKeySizes" must be a boolean' },
|
|
9981
|
-
allowInvalidAsymmetricKeyTypes: { isValid: isBoolean, message: '"allowInvalidAsymmetricKeyTypes" must be a boolean' }
|
|
9982
|
-
};
|
|
9983
|
-
const registered_claims_schema = {
|
|
9984
|
-
iat: { isValid: isNumber2, message: '"iat" should be a number of seconds' },
|
|
9985
|
-
exp: { isValid: isNumber2, message: '"exp" should be a number of seconds' },
|
|
9986
|
-
nbf: { isValid: isNumber2, message: '"nbf" should be a number of seconds' }
|
|
9987
|
-
};
|
|
9988
|
-
function validate(schema, allowUnknown, object, parameterName) {
|
|
9989
|
-
if (!isPlainObject(object)) {
|
|
9990
|
-
throw new Error('Expected "' + parameterName + '" to be a plain object.');
|
|
9991
|
-
}
|
|
9992
|
-
Object.keys(object).forEach(function(key) {
|
|
9993
|
-
const validator = schema[key];
|
|
9994
|
-
if (!validator) {
|
|
9995
|
-
if (!allowUnknown) {
|
|
9996
|
-
throw new Error('"' + key + '" is not allowed in "' + parameterName + '"');
|
|
9997
|
-
}
|
|
9998
|
-
return;
|
|
9999
|
-
}
|
|
10000
|
-
if (!validator.isValid(object[key])) {
|
|
10001
|
-
throw new Error(validator.message);
|
|
10002
|
-
}
|
|
10003
|
-
});
|
|
10004
|
-
}
|
|
10005
|
-
function validateOptions(options) {
|
|
10006
|
-
return validate(sign_options_schema, false, options, "options");
|
|
10007
|
-
}
|
|
10008
|
-
function validatePayload(payload) {
|
|
10009
|
-
return validate(registered_claims_schema, true, payload, "payload");
|
|
10010
|
-
}
|
|
10011
|
-
const options_to_payload = {
|
|
10012
|
-
"audience": "aud",
|
|
10013
|
-
"issuer": "iss",
|
|
10014
|
-
"subject": "sub",
|
|
10015
|
-
"jwtid": "jti"
|
|
10016
|
-
};
|
|
10017
|
-
const options_for_objects = [
|
|
10018
|
-
"expiresIn",
|
|
10019
|
-
"notBefore",
|
|
10020
|
-
"noTimestamp",
|
|
10021
|
-
"audience",
|
|
10022
|
-
"issuer",
|
|
10023
|
-
"subject",
|
|
10024
|
-
"jwtid"
|
|
10025
|
-
];
|
|
10026
|
-
sign = function(payload, secretOrPrivateKey2, options, callback) {
|
|
10027
|
-
if (typeof options === "function") {
|
|
10028
|
-
callback = options;
|
|
10029
|
-
options = {};
|
|
10030
|
-
} else {
|
|
10031
|
-
options = options || {};
|
|
10032
|
-
}
|
|
10033
|
-
const isObjectPayload = typeof payload === "object" && !Buffer.isBuffer(payload);
|
|
10034
|
-
const header = Object.assign({
|
|
10035
|
-
alg: options.algorithm || "HS256",
|
|
10036
|
-
typ: isObjectPayload ? "JWT" : void 0,
|
|
10037
|
-
kid: options.keyid
|
|
10038
|
-
}, options.header);
|
|
10039
|
-
function failure(err) {
|
|
10040
|
-
if (callback) {
|
|
10041
|
-
return callback(err);
|
|
10042
|
-
}
|
|
10043
|
-
throw err;
|
|
10044
|
-
}
|
|
10045
|
-
if (!secretOrPrivateKey2 && options.algorithm !== "none") {
|
|
10046
|
-
return failure(new Error("secretOrPrivateKey must have a value"));
|
|
10047
|
-
}
|
|
10048
|
-
if (secretOrPrivateKey2 != null && !(secretOrPrivateKey2 instanceof KeyObject)) {
|
|
10049
|
-
try {
|
|
10050
|
-
secretOrPrivateKey2 = createPrivateKey(secretOrPrivateKey2);
|
|
10051
|
-
} catch (_) {
|
|
10052
|
-
try {
|
|
10053
|
-
secretOrPrivateKey2 = createSecretKey(typeof secretOrPrivateKey2 === "string" ? Buffer.from(secretOrPrivateKey2) : secretOrPrivateKey2);
|
|
10054
|
-
} catch (_2) {
|
|
10055
|
-
return failure(new Error("secretOrPrivateKey is not valid key material"));
|
|
10056
|
-
}
|
|
10057
|
-
}
|
|
10058
|
-
}
|
|
10059
|
-
if (header.alg.startsWith("HS") && secretOrPrivateKey2.type !== "secret") {
|
|
10060
|
-
return failure(new Error(`secretOrPrivateKey must be a symmetric key when using ${header.alg}`));
|
|
10061
|
-
} else if (/^(?:RS|PS|ES)/.test(header.alg)) {
|
|
10062
|
-
if (secretOrPrivateKey2.type !== "private") {
|
|
10063
|
-
return failure(new Error(`secretOrPrivateKey must be an asymmetric key when using ${header.alg}`));
|
|
10064
|
-
}
|
|
10065
|
-
if (!options.allowInsecureKeySizes && !header.alg.startsWith("ES") && secretOrPrivateKey2.asymmetricKeyDetails !== void 0 && //KeyObject.asymmetricKeyDetails is supported in Node 15+
|
|
10066
|
-
secretOrPrivateKey2.asymmetricKeyDetails.modulusLength < 2048) {
|
|
10067
|
-
return failure(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${header.alg}`));
|
|
10068
|
-
}
|
|
10069
|
-
}
|
|
10070
|
-
if (typeof payload === "undefined") {
|
|
10071
|
-
return failure(new Error("payload is required"));
|
|
10072
|
-
} else if (isObjectPayload) {
|
|
10073
|
-
try {
|
|
10074
|
-
validatePayload(payload);
|
|
10075
|
-
} catch (error) {
|
|
10076
|
-
return failure(error);
|
|
10077
|
-
}
|
|
10078
|
-
if (!options.mutatePayload) {
|
|
10079
|
-
payload = Object.assign({}, payload);
|
|
10080
|
-
}
|
|
10081
|
-
} else {
|
|
10082
|
-
const invalid_options = options_for_objects.filter(function(opt) {
|
|
10083
|
-
return typeof options[opt] !== "undefined";
|
|
10084
|
-
});
|
|
10085
|
-
if (invalid_options.length > 0) {
|
|
10086
|
-
return failure(new Error("invalid " + invalid_options.join(",") + " option for " + typeof payload + " payload"));
|
|
10087
|
-
}
|
|
10088
|
-
}
|
|
10089
|
-
if (typeof payload.exp !== "undefined" && typeof options.expiresIn !== "undefined") {
|
|
10090
|
-
return failure(new Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));
|
|
10091
|
-
}
|
|
10092
|
-
if (typeof payload.nbf !== "undefined" && typeof options.notBefore !== "undefined") {
|
|
10093
|
-
return failure(new Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));
|
|
10094
|
-
}
|
|
10095
|
-
try {
|
|
10096
|
-
validateOptions(options);
|
|
10097
|
-
} catch (error) {
|
|
10098
|
-
return failure(error);
|
|
10099
|
-
}
|
|
10100
|
-
if (!options.allowInvalidAsymmetricKeyTypes) {
|
|
10101
|
-
try {
|
|
10102
|
-
validateAsymmetricKey2(header.alg, secretOrPrivateKey2);
|
|
10103
|
-
} catch (error) {
|
|
10104
|
-
return failure(error);
|
|
10105
|
-
}
|
|
10106
|
-
}
|
|
10107
|
-
const timestamp = payload.iat || Math.floor(Date.now() / 1e3);
|
|
10108
|
-
if (options.noTimestamp) {
|
|
10109
|
-
delete payload.iat;
|
|
10110
|
-
} else if (isObjectPayload) {
|
|
10111
|
-
payload.iat = timestamp;
|
|
10112
|
-
}
|
|
10113
|
-
if (typeof options.notBefore !== "undefined") {
|
|
10114
|
-
try {
|
|
10115
|
-
payload.nbf = timespan2(options.notBefore, timestamp);
|
|
10116
|
-
} catch (err) {
|
|
10117
|
-
return failure(err);
|
|
10118
|
-
}
|
|
10119
|
-
if (typeof payload.nbf === "undefined") {
|
|
10120
|
-
return failure(new Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));
|
|
10121
|
-
}
|
|
10122
|
-
}
|
|
10123
|
-
if (typeof options.expiresIn !== "undefined" && typeof payload === "object") {
|
|
10124
|
-
try {
|
|
10125
|
-
payload.exp = timespan2(options.expiresIn, timestamp);
|
|
10126
|
-
} catch (err) {
|
|
10127
|
-
return failure(err);
|
|
10128
|
-
}
|
|
10129
|
-
if (typeof payload.exp === "undefined") {
|
|
10130
|
-
return failure(new Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));
|
|
10131
|
-
}
|
|
10132
|
-
}
|
|
10133
|
-
Object.keys(options_to_payload).forEach(function(key) {
|
|
10134
|
-
const claim = options_to_payload[key];
|
|
10135
|
-
if (typeof options[key] !== "undefined") {
|
|
10136
|
-
if (typeof payload[claim] !== "undefined") {
|
|
10137
|
-
return failure(new Error('Bad "options.' + key + '" option. The payload already has an "' + claim + '" property.'));
|
|
10138
|
-
}
|
|
10139
|
-
payload[claim] = options[key];
|
|
10140
|
-
}
|
|
10141
|
-
});
|
|
10142
|
-
const encoding = options.encoding || "utf8";
|
|
10143
|
-
if (typeof callback === "function") {
|
|
10144
|
-
callback = callback && once(callback);
|
|
10145
|
-
jws2.createSign({
|
|
10146
|
-
header,
|
|
10147
|
-
privateKey: secretOrPrivateKey2,
|
|
10148
|
-
payload,
|
|
10149
|
-
encoding
|
|
10150
|
-
}).once("error", callback).once("done", function(signature) {
|
|
10151
|
-
if (!options.allowInsecureKeySizes && /^(?:RS|PS)/.test(header.alg) && signature.length < 256) {
|
|
10152
|
-
return callback(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${header.alg}`));
|
|
10153
|
-
}
|
|
10154
|
-
callback(null, signature);
|
|
10155
|
-
});
|
|
10156
|
-
} else {
|
|
10157
|
-
let signature = jws2.sign({ header, payload, secret: secretOrPrivateKey2, encoding });
|
|
10158
|
-
if (!options.allowInsecureKeySizes && /^(?:RS|PS)/.test(header.alg) && signature.length < 256) {
|
|
10159
|
-
throw new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${header.alg}`);
|
|
10160
|
-
}
|
|
10161
|
-
return signature;
|
|
10162
|
-
}
|
|
10163
|
-
};
|
|
10164
|
-
return sign;
|
|
10165
|
-
}
|
|
10166
|
-
function requireJsonwebtoken() {
|
|
10167
|
-
if (hasRequiredJsonwebtoken) return jsonwebtoken;
|
|
10168
|
-
hasRequiredJsonwebtoken = 1;
|
|
10169
|
-
jsonwebtoken = {
|
|
10170
|
-
decode: requireDecode(),
|
|
10171
|
-
verify: requireVerify(),
|
|
10172
|
-
sign: requireSign(),
|
|
10173
|
-
JsonWebTokenError: requireJsonWebTokenError(),
|
|
10174
|
-
NotBeforeError: requireNotBeforeError(),
|
|
10175
|
-
TokenExpiredError: requireTokenExpiredError()
|
|
10176
|
-
};
|
|
10177
|
-
return jsonwebtoken;
|
|
10178
|
-
}
|
|
10179
|
-
var jws, safeBuffer, hasRequiredSafeBuffer, dataStream, hasRequiredDataStream, bufferEqualConstantTime, hasRequiredBufferEqualConstantTime, paramBytesForAlg_1, hasRequiredParamBytesForAlg, ecdsaSigFormatter, hasRequiredEcdsaSigFormatter, jwa, hasRequiredJwa, tostring, hasRequiredTostring, signStream, hasRequiredSignStream, verifyStream, hasRequiredVerifyStream, hasRequiredJws, decode, hasRequiredDecode, JsonWebTokenError_1, hasRequiredJsonWebTokenError, NotBeforeError_1, hasRequiredNotBeforeError, TokenExpiredError_1, hasRequiredTokenExpiredError, ms, hasRequiredMs, timespan, hasRequiredTimespan, re, constants, hasRequiredConstants, debug_1, hasRequiredDebug, hasRequiredRe, parseOptions_1, hasRequiredParseOptions, identifiers, hasRequiredIdentifiers, semver$1, hasRequiredSemver$1, parse_1, hasRequiredParse, valid_1, hasRequiredValid$1, clean_1, hasRequiredClean, inc_1, hasRequiredInc, diff_1, hasRequiredDiff, major_1, hasRequiredMajor, minor_1, hasRequiredMinor, patch_1, hasRequiredPatch, prerelease_1, hasRequiredPrerelease, compare_1, hasRequiredCompare, rcompare_1, hasRequiredRcompare, compareLoose_1, hasRequiredCompareLoose, compareBuild_1, hasRequiredCompareBuild, sort_1, hasRequiredSort, rsort_1, hasRequiredRsort, gt_1, hasRequiredGt, lt_1, hasRequiredLt, eq_1, hasRequiredEq, neq_1, hasRequiredNeq, gte_1, hasRequiredGte, lte_1, hasRequiredLte, cmp_1, hasRequiredCmp, coerce_1, hasRequiredCoerce, lrucache, hasRequiredLrucache, range2, hasRequiredRange, comparator, hasRequiredComparator, satisfies_1, hasRequiredSatisfies, toComparators_1, hasRequiredToComparators, maxSatisfying_1, hasRequiredMaxSatisfying, minSatisfying_1, hasRequiredMinSatisfying, minVersion_1, hasRequiredMinVersion, valid, hasRequiredValid, outside_1, hasRequiredOutside, gtr_1, hasRequiredGtr, ltr_1, hasRequiredLtr, intersects_1, hasRequiredIntersects, simplify, hasRequiredSimplify, subset_1, hasRequiredSubset, semver, hasRequiredSemver, asymmetricKeyDetailsSupported, hasRequiredAsymmetricKeyDetailsSupported, rsaPssKeyDetailsSupported, hasRequiredRsaPssKeyDetailsSupported, validateAsymmetricKey, hasRequiredValidateAsymmetricKey, psSupported, hasRequiredPsSupported, verify, hasRequiredVerify, lodash_includes, hasRequiredLodash_includes, lodash_isboolean, hasRequiredLodash_isboolean, lodash_isinteger, hasRequiredLodash_isinteger, lodash_isnumber, hasRequiredLodash_isnumber, lodash_isplainobject, hasRequiredLodash_isplainobject, lodash_isstring, hasRequiredLodash_isstring, lodash_once, hasRequiredLodash_once, sign, hasRequiredSign, jsonwebtoken, hasRequiredJsonwebtoken, jsonwebtokenExports, index, index$1;
|
|
10180
|
-
var init_jsonwebtoken = __esm({
|
|
10181
|
-
"../../node_modules/.pnpm/@karinjs+jsonwebtoken@1.1.1/node_modules/@karinjs/jsonwebtoken/dist/jsonwebtoken.js"() {
|
|
10182
|
-
jws = {};
|
|
10183
|
-
safeBuffer = { exports: {} };
|
|
10184
|
-
re = { exports: {} };
|
|
10185
|
-
jsonwebtokenExports = requireJsonwebtoken();
|
|
10186
|
-
index = /* @__PURE__ */ getDefaultExportFromCjs2(jsonwebtokenExports);
|
|
10187
|
-
index$1 = /* @__PURE__ */ _mergeNamespaces2({
|
|
10188
|
-
__proto__: null,
|
|
10189
|
-
default: index
|
|
10190
|
-
}, [jsonwebtokenExports]);
|
|
10191
|
-
jsonwebtokenExports.decode;
|
|
10192
|
-
jsonwebtokenExports.sign;
|
|
10193
|
-
jsonwebtokenExports.verify;
|
|
10194
|
-
}
|
|
10195
|
-
});
|
|
10196
|
-
|
|
10197
|
-
// ../../node_modules/.pnpm/@karinjs+jsonwebtoken@1.1.1/node_modules/@karinjs/jsonwebtoken/index.js
|
|
10198
|
-
var app2, jsonwebtoken_default;
|
|
10199
|
-
var init_jsonwebtoken2 = __esm({
|
|
10200
|
-
"../../node_modules/.pnpm/@karinjs+jsonwebtoken@1.1.1/node_modules/@karinjs/jsonwebtoken/index.js"() {
|
|
10201
|
-
init_jsonwebtoken();
|
|
10202
|
-
init_jsonwebtoken();
|
|
10203
|
-
app2 = index$1.default;
|
|
10204
|
-
jsonwebtoken_default = app2;
|
|
10205
|
-
}
|
|
10206
|
-
});
|
|
10207
6476
|
|
|
10208
6477
|
// src/server/utils/response.ts
|
|
10209
6478
|
var HTTPStatusCode, createResponse, createSuccessResponse, createUnauthorizedResponse, createAccessTokenExpiredResponse, createRefreshTokenExpiredResponse, createNotFoundResponse, createServerErrorResponse, createBadRequestResponse, createPayloadTooLargeResponse, createMethodNotAllowedResponse, createForbiddenResponse;
|
|
@@ -10271,7 +6540,6 @@ message: ${message2}
|
|
|
10271
6540
|
var EXPIRES_IN, REFRESH_EXPIRES_IN, secretOrPrivateKey, initSecretOrPrivateKey, getSecretOrPrivateKey, createJwt, verifyJwt, verifyRefreshToken, refreshAccessToken, updateJwt;
|
|
10272
6541
|
var init_jwt = __esm({
|
|
10273
6542
|
"src/server/auth/jwt.ts"() {
|
|
10274
|
-
init_jsonwebtoken2();
|
|
10275
6543
|
init_config();
|
|
10276
6544
|
init_response();
|
|
10277
6545
|
EXPIRES_IN = process.env.EXPIRES_IN || "7d";
|
|
@@ -10289,20 +6557,20 @@ var init_jwt = __esm({
|
|
|
10289
6557
|
createJwt = () => {
|
|
10290
6558
|
initSecretOrPrivateKey();
|
|
10291
6559
|
const userId = crypto.randomUUID();
|
|
10292
|
-
const accessToken =
|
|
10293
|
-
const refreshToken =
|
|
6560
|
+
const accessToken = jwt.sign({ userId, type: "access" }, secretOrPrivateKey, { expiresIn: EXPIRES_IN });
|
|
6561
|
+
const refreshToken = jwt.sign({ userId, type: "refresh" }, secretOrPrivateKey, { expiresIn: REFRESH_EXPIRES_IN });
|
|
10294
6562
|
return { userId, accessToken, refreshToken };
|
|
10295
6563
|
};
|
|
10296
6564
|
verifyJwt = (token, userId) => {
|
|
10297
6565
|
try {
|
|
10298
6566
|
initSecretOrPrivateKey();
|
|
10299
|
-
const decoded =
|
|
6567
|
+
const decoded = jwt.verify(token, secretOrPrivateKey);
|
|
10300
6568
|
if (decoded.userId === userId) {
|
|
10301
6569
|
return { status: 200 /* OK */, data: decoded.userId };
|
|
10302
6570
|
}
|
|
10303
6571
|
return { status: 401 /* Unauthorized */, data: "jwt\u9274\u6743\u5931\u8D25 \u7528\u6237id\u4E0D\u5339\u914D" };
|
|
10304
6572
|
} catch (error) {
|
|
10305
|
-
if (error instanceof
|
|
6573
|
+
if (error instanceof jwt.JsonWebTokenError) {
|
|
10306
6574
|
if (error.name === "TokenExpiredError") {
|
|
10307
6575
|
return { status: 419 /* AccessTokenExpired */, data: "jwt\u4EE4\u724C\u5DF2\u8FC7\u671F" };
|
|
10308
6576
|
}
|
|
@@ -10315,13 +6583,13 @@ var init_jwt = __esm({
|
|
|
10315
6583
|
verifyRefreshToken = (token) => {
|
|
10316
6584
|
try {
|
|
10317
6585
|
initSecretOrPrivateKey();
|
|
10318
|
-
const decoded =
|
|
6586
|
+
const decoded = jwt.verify(token, secretOrPrivateKey);
|
|
10319
6587
|
if (decoded && decoded.userId && decoded.type === "refresh") {
|
|
10320
6588
|
return { status: true, data: decoded.userId };
|
|
10321
6589
|
}
|
|
10322
6590
|
return { status: false, data: "\u65E0\u6548\u4EE4\u724C" };
|
|
10323
6591
|
} catch (error) {
|
|
10324
|
-
if (error instanceof
|
|
6592
|
+
if (error instanceof jwt.JsonWebTokenError) {
|
|
10325
6593
|
if (error.name === "TokenExpiredError") {
|
|
10326
6594
|
return { status: false, data: "\u5237\u65B0\u4EE4\u724C\u5DF2\u8FC7\u671F" };
|
|
10327
6595
|
}
|
|
@@ -10333,7 +6601,7 @@ var init_jwt = __esm({
|
|
|
10333
6601
|
};
|
|
10334
6602
|
refreshAccessToken = (userId) => {
|
|
10335
6603
|
initSecretOrPrivateKey();
|
|
10336
|
-
const accessToken =
|
|
6604
|
+
const accessToken = jwt.sign({ userId }, secretOrPrivateKey, { expiresIn: EXPIRES_IN });
|
|
10337
6605
|
return accessToken;
|
|
10338
6606
|
};
|
|
10339
6607
|
updateJwt = () => {
|
|
@@ -10356,10 +6624,10 @@ var init_env3 = __esm({
|
|
|
10356
6624
|
const lines = content.split("\n");
|
|
10357
6625
|
const list2 = [];
|
|
10358
6626
|
const obj = {};
|
|
10359
|
-
lines.forEach((line,
|
|
10360
|
-
obj[
|
|
6627
|
+
lines.forEach((line, index4) => {
|
|
6628
|
+
obj[index4] = line;
|
|
10361
6629
|
});
|
|
10362
|
-
lines.forEach((line,
|
|
6630
|
+
lines.forEach((line, index4) => {
|
|
10363
6631
|
if (!line.includes("=")) return;
|
|
10364
6632
|
let comment2 = "";
|
|
10365
6633
|
let [key, value] = line.split("=").map((item) => item.trim());
|
|
@@ -10375,7 +6643,7 @@ var init_env3 = __esm({
|
|
|
10375
6643
|
}
|
|
10376
6644
|
}
|
|
10377
6645
|
if (!comment2) {
|
|
10378
|
-
const data = obj[
|
|
6646
|
+
const data = obj[index4 - 1]?.trim();
|
|
10379
6647
|
if (data?.startsWith("#")) comment2 = data;
|
|
10380
6648
|
}
|
|
10381
6649
|
value = value?.replace(/^"|"$/g, "") || "";
|
|
@@ -10666,8 +6934,8 @@ var init_status_listener = __esm({
|
|
|
10666
6934
|
}
|
|
10667
6935
|
sysCpuInfo() {
|
|
10668
6936
|
const currentTimes = os.cpus().map((cpu) => cpu.times);
|
|
10669
|
-
const { total, active } = currentTimes.map((times,
|
|
10670
|
-
const prevTimes = this.cpuTimes[
|
|
6937
|
+
const { total, active } = currentTimes.map((times, index4) => {
|
|
6938
|
+
const prevTimes = this.cpuTimes[index4];
|
|
10671
6939
|
const totalCurrent = times.user + times.nice + times.sys + times.idle + times.irq;
|
|
10672
6940
|
const totalPrev = prevTimes.user + prevTimes.nice + prevTimes.sys + prevTimes.idle + prevTimes.irq;
|
|
10673
6941
|
const activeCurrent = totalCurrent - times.idle;
|
|
@@ -11477,7 +7745,7 @@ var init_class = __esm({
|
|
|
11477
7745
|
var sleep;
|
|
11478
7746
|
var init_sleep = __esm({
|
|
11479
7747
|
"src/utils/common/sleep.ts"() {
|
|
11480
|
-
sleep = (
|
|
7748
|
+
sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
11481
7749
|
}
|
|
11482
7750
|
});
|
|
11483
7751
|
var checkPort, waitPort, killApp;
|
|
@@ -12776,8 +9044,8 @@ var init_versionCheck = __esm({
|
|
|
12776
9044
|
const [maj, min, pat] = core.split(".").map((n) => parseInt(n, 10) || 0);
|
|
12777
9045
|
return `${maj}.${min}.${pat + 1}`;
|
|
12778
9046
|
};
|
|
12779
|
-
calcLowerBoundSingle = (
|
|
12780
|
-
const tokens =
|
|
9047
|
+
calcLowerBoundSingle = (range2) => {
|
|
9048
|
+
const tokens = range2.split(/\s+/).map((t) => t.trim()).filter((t) => t && t !== "&&");
|
|
12781
9049
|
const candidates = [];
|
|
12782
9050
|
for (const tk of tokens) {
|
|
12783
9051
|
const m = tk.match(/^(\^|>=|>|~)?(.+)$/);
|
|
@@ -12790,16 +9058,16 @@ var init_versionCheck = __esm({
|
|
|
12790
9058
|
}
|
|
12791
9059
|
let lower = null;
|
|
12792
9060
|
for (const v of candidates) {
|
|
12793
|
-
if (!satisfies(
|
|
9061
|
+
if (!satisfies(range2, v)) continue;
|
|
12794
9062
|
if (!lower || cmpVer(v, lower) < 0) {
|
|
12795
9063
|
lower = v;
|
|
12796
9064
|
}
|
|
12797
9065
|
}
|
|
12798
9066
|
return lower;
|
|
12799
9067
|
};
|
|
12800
|
-
calcLowerBoundBySatisfies = (
|
|
12801
|
-
const parts =
|
|
12802
|
-
if (parts.length <= 1) return calcLowerBoundSingle(
|
|
9068
|
+
calcLowerBoundBySatisfies = (range2) => {
|
|
9069
|
+
const parts = range2.split("||").map((s) => s.trim()).filter(Boolean);
|
|
9070
|
+
if (parts.length <= 1) return calcLowerBoundSingle(range2);
|
|
12803
9071
|
let best = null;
|
|
12804
9072
|
for (const part of parts) {
|
|
12805
9073
|
const lb = calcLowerBoundSingle(part);
|
|
@@ -12928,11 +9196,11 @@ var init_list = __esm({
|
|
|
12928
9196
|
const apps = [];
|
|
12929
9197
|
const files = [];
|
|
12930
9198
|
const allApps = [];
|
|
12931
|
-
const pushApps = (
|
|
12932
|
-
if (typeof
|
|
12933
|
-
files.push(
|
|
12934
|
-
} else if (Array.isArray(
|
|
12935
|
-
files.push(...
|
|
9199
|
+
const pushApps = (app4) => {
|
|
9200
|
+
if (typeof app4 === "string") {
|
|
9201
|
+
files.push(app4);
|
|
9202
|
+
} else if (Array.isArray(app4)) {
|
|
9203
|
+
files.push(...app4);
|
|
12936
9204
|
}
|
|
12937
9205
|
};
|
|
12938
9206
|
if (isTs()) {
|
|
@@ -12941,8 +9209,8 @@ var init_list = __esm({
|
|
|
12941
9209
|
pkg2.karin.apps && pushApps(pkg2.karin.apps);
|
|
12942
9210
|
}
|
|
12943
9211
|
await Promise.allSettled(
|
|
12944
|
-
files.map(async (
|
|
12945
|
-
const appPath = path4.join(dir,
|
|
9212
|
+
files.map(async (app4) => {
|
|
9213
|
+
const appPath = path4.join(dir, app4);
|
|
12946
9214
|
if (!fs5.existsSync(appPath)) return;
|
|
12947
9215
|
apps.push(...filesByExt(appPath, ext, "abs"));
|
|
12948
9216
|
allApps.push(appPath);
|
|
@@ -12969,8 +9237,8 @@ var init_list = __esm({
|
|
|
12969
9237
|
files.push(...pkg2.karin.apps);
|
|
12970
9238
|
}
|
|
12971
9239
|
await Promise.allSettled(
|
|
12972
|
-
files.map(async (
|
|
12973
|
-
const appPath = path4.join(dir,
|
|
9240
|
+
files.map(async (app4) => {
|
|
9241
|
+
const appPath = path4.join(dir, app4);
|
|
12974
9242
|
if (!fs5.existsSync(appPath)) return;
|
|
12975
9243
|
apps.push(...filesByExt(appPath, ext, "abs"));
|
|
12976
9244
|
allApps.push(appPath);
|
|
@@ -13036,12 +9304,12 @@ var init_list = __esm({
|
|
|
13036
9304
|
if (typeof pkg2?.engines?.karin === "string") fallback = pkg2.engines.karin.trim();
|
|
13037
9305
|
else if (typeof pkg2?.engines?.["node-karin"] === "string") fallback = pkg2.engines["node-karin"].trim();
|
|
13038
9306
|
}
|
|
13039
|
-
const
|
|
13040
|
-
if (
|
|
9307
|
+
const range2 = preferred || fallback;
|
|
9308
|
+
if (range2 && !satisfies(range2, process.env.KARIN_VERSION)) {
|
|
13041
9309
|
if (ignore) {
|
|
13042
9310
|
list2.push(`git:${v.name}`);
|
|
13043
9311
|
} else {
|
|
13044
|
-
reporter.add(v.name,
|
|
9312
|
+
reporter.add(v.name, range2);
|
|
13045
9313
|
}
|
|
13046
9314
|
} else {
|
|
13047
9315
|
list2.push(`git:${v.name}`);
|
|
@@ -13097,12 +9365,12 @@ var init_list = __esm({
|
|
|
13097
9365
|
if (typeof depPkg?.engines?.karin === "string") fallback = depPkg.engines.karin.trim();
|
|
13098
9366
|
else if (typeof depPkg?.engines?.["node-karin"] === "string") fallback = depPkg.engines["node-karin"].trim();
|
|
13099
9367
|
}
|
|
13100
|
-
const
|
|
13101
|
-
if (
|
|
9368
|
+
const range2 = preferred || fallback;
|
|
9369
|
+
if (range2 && !satisfies(range2, process.env.KARIN_VERSION)) {
|
|
13102
9370
|
if (ignore) {
|
|
13103
9371
|
list2.push(`npm:${name}`);
|
|
13104
9372
|
} else {
|
|
13105
|
-
reporter.add(name,
|
|
9373
|
+
reporter.add(name, range2);
|
|
13106
9374
|
}
|
|
13107
9375
|
} else {
|
|
13108
9376
|
list2.push(`npm:${name}`);
|
|
@@ -13499,12 +9767,12 @@ var init_common = __esm({
|
|
|
13499
9767
|
};
|
|
13500
9768
|
getAbsPath = (images, root) => {
|
|
13501
9769
|
const files = [];
|
|
13502
|
-
images.forEach((image2,
|
|
9770
|
+
images.forEach((image2, index4) => {
|
|
13503
9771
|
if (typeof image2 !== "string") throw TypeError("\u4F20\u5165\u7684\u56FE\u7247\u53EA\u652F\u6301\u672C\u5730\u8DEF\u5F84 \u6216 \u5E26\u524D\u7F00base64://\u5B57\u7B26\u4E32");
|
|
13504
9772
|
if (image2.startsWith("base64://")) {
|
|
13505
9773
|
const base642 = image2.replace(/^base64:\/\//, "");
|
|
13506
9774
|
const buffer2 = Buffer.from(base642, "base64");
|
|
13507
|
-
const file3 = path4.join(root, `${
|
|
9775
|
+
const file3 = path4.join(root, `${index4}.png`);
|
|
13508
9776
|
fs5.writeFileSync(file3, buffer2);
|
|
13509
9777
|
files.push(file3);
|
|
13510
9778
|
return;
|
|
@@ -13522,9 +9790,9 @@ var init_common = __esm({
|
|
|
13522
9790
|
return { width, height };
|
|
13523
9791
|
};
|
|
13524
9792
|
generateLayout = (dimensions, perRow, maxWidth, maxHeight) => {
|
|
13525
|
-
const layouts = dimensions.map((_,
|
|
13526
|
-
const row = Math.floor(
|
|
13527
|
-
const col =
|
|
9793
|
+
const layouts = dimensions.map((_, index4) => {
|
|
9794
|
+
const row = Math.floor(index4 / perRow);
|
|
9795
|
+
const col = index4 % perRow;
|
|
13528
9796
|
return `${col * maxWidth}_${row * maxHeight}`;
|
|
13529
9797
|
}).join("|");
|
|
13530
9798
|
return layouts;
|
|
@@ -13539,11 +9807,11 @@ var init_common = __esm({
|
|
|
13539
9807
|
const maxWidth = Math.max(...list2.map((d) => d.width));
|
|
13540
9808
|
const maxHeight = Math.max(...list2.map((d) => d.height));
|
|
13541
9809
|
let cmd = "";
|
|
13542
|
-
list2.forEach((_,
|
|
13543
|
-
cmd += `[${
|
|
9810
|
+
list2.forEach((_, index4) => {
|
|
9811
|
+
cmd += `[${index4}:v]pad=${maxWidth}:${maxHeight}:(ow-iw)/2:(oh-ih)/2[p${index4}]; `;
|
|
13544
9812
|
});
|
|
13545
9813
|
const layouts = generateLayout(list2, perRow, maxWidth, maxHeight);
|
|
13546
|
-
cmd += `${list2.map((_,
|
|
9814
|
+
cmd += `${list2.map((_, index4) => `[p${index4}]`).join("")}xstack=inputs=${list2.length}:layout=${layouts}[out]`;
|
|
13547
9815
|
return cmd;
|
|
13548
9816
|
};
|
|
13549
9817
|
}
|
|
@@ -17380,7 +13648,7 @@ var init_sendMsg = __esm({
|
|
|
17380
13648
|
});
|
|
17381
13649
|
|
|
17382
13650
|
// src/service/bot.ts
|
|
17383
|
-
var
|
|
13651
|
+
var index, list, getBot, getAllBot, getAllBotList, getAllBotID, getBotCount, unregisterBot, registerBot, sendMsg2;
|
|
17384
13652
|
var init_bot = __esm({
|
|
17385
13653
|
"src/service/bot.ts"() {
|
|
17386
13654
|
init_message2();
|
|
@@ -17388,7 +13656,7 @@ var init_bot = __esm({
|
|
|
17388
13656
|
init_sendMsg();
|
|
17389
13657
|
init_listeners();
|
|
17390
13658
|
init_common();
|
|
17391
|
-
|
|
13659
|
+
index = 0;
|
|
17392
13660
|
list = [];
|
|
17393
13661
|
getBot = (id, isProtocol = false) => {
|
|
17394
13662
|
try {
|
|
@@ -17417,9 +13685,9 @@ var init_bot = __esm({
|
|
|
17417
13685
|
};
|
|
17418
13686
|
unregisterBot = (type, idOrIndex, address) => {
|
|
17419
13687
|
const findIndexAndRemove = (predicate) => {
|
|
17420
|
-
const
|
|
17421
|
-
if (
|
|
17422
|
-
const [removed] = list.splice(
|
|
13688
|
+
const index4 = list.findIndex(predicate);
|
|
13689
|
+
if (index4 !== -1) {
|
|
13690
|
+
const [removed] = list.splice(index4, 1);
|
|
17423
13691
|
listeners.emit(BOT_DISCONNECT, removed.bot);
|
|
17424
13692
|
logger.bot("info", removed.bot.selfId, `${logger.red("[service][\u5378\u8F7DBot]")} ${removed.bot.adapter.name}`);
|
|
17425
13693
|
return true;
|
|
@@ -17440,7 +13708,7 @@ var init_bot = __esm({
|
|
|
17440
13708
|
return false;
|
|
17441
13709
|
};
|
|
17442
13710
|
registerBot = (_, bot) => {
|
|
17443
|
-
const id = ++
|
|
13711
|
+
const id = ++index;
|
|
17444
13712
|
list.push({ index: id, bot });
|
|
17445
13713
|
const originSendMsg = bot.sendMsg;
|
|
17446
13714
|
const originSendForwardMsg = bot.sendForwardMsg;
|
|
@@ -19021,11 +15289,13 @@ var init_core = __esm({
|
|
|
19021
15289
|
}
|
|
19022
15290
|
};
|
|
19023
15291
|
if (typeof elem.options === "object") {
|
|
15292
|
+
if (elem.options.news) node2.data.news = elem.options.news;
|
|
19024
15293
|
if (elem.options.prompt) node2.data.prompt = elem.options.prompt;
|
|
19025
15294
|
if (elem.options.summary) node2.data.summary = elem.options.summary;
|
|
19026
15295
|
if (elem.options.source) node2.data.source = elem.options.source;
|
|
19027
15296
|
}
|
|
19028
15297
|
if (options && messages.length === 0) {
|
|
15298
|
+
node2.data.news = options.news;
|
|
19029
15299
|
node2.data.prompt = options.prompt;
|
|
19030
15300
|
node2.data.summary = options.summary;
|
|
19031
15301
|
node2.data.source = options.source;
|
|
@@ -19046,13 +15316,15 @@ var init_core = __esm({
|
|
|
19046
15316
|
if (contact3.scene === "group") {
|
|
19047
15317
|
return this._onebot.sendGroupForwardMsg(
|
|
19048
15318
|
Number(contact3.peer),
|
|
19049
|
-
this.forwardKarinConvertAdapter(elements, options)
|
|
15319
|
+
this.forwardKarinConvertAdapter(elements, options),
|
|
15320
|
+
options
|
|
19050
15321
|
);
|
|
19051
15322
|
}
|
|
19052
15323
|
if (contact3.scene === "friend") {
|
|
19053
15324
|
return this._onebot.sendPrivateForwardMsg(
|
|
19054
15325
|
Number(contact3.peer),
|
|
19055
|
-
this.forwardKarinConvertAdapter(elements, options)
|
|
15326
|
+
this.forwardKarinConvertAdapter(elements, options),
|
|
15327
|
+
options
|
|
19056
15328
|
);
|
|
19057
15329
|
}
|
|
19058
15330
|
throw TypeError(`\u4E0D\u652F\u6301\u7684\u573A\u666F\u7C7B\u578B: ${contact3.scene}`);
|
|
@@ -19670,12 +15942,12 @@ var init_key3 = __esm({
|
|
|
19670
15942
|
});
|
|
19671
15943
|
|
|
19672
15944
|
// src/adapter/snapka/request.ts
|
|
19673
|
-
var
|
|
15945
|
+
var index2, createRequestError, sendWsRequest, sendWsScreenshotRequest;
|
|
19674
15946
|
var init_request4 = __esm({
|
|
19675
15947
|
"src/adapter/snapka/request.ts"() {
|
|
19676
15948
|
init_internal();
|
|
19677
15949
|
init_key3();
|
|
19678
|
-
|
|
15950
|
+
index2 = 0;
|
|
19679
15951
|
createRequestError = (options, errorType, cause) => {
|
|
19680
15952
|
return new Error(
|
|
19681
15953
|
`[sendRequest] \u8BF7\u6C42\u9519\u8BEF:
|
|
@@ -19694,10 +15966,10 @@ var init_request4 = __esm({
|
|
|
19694
15966
|
));
|
|
19695
15967
|
}
|
|
19696
15968
|
if (options.onRequest) {
|
|
19697
|
-
if (
|
|
19698
|
-
|
|
15969
|
+
if (index2 >= Number.MAX_SAFE_INTEGER) {
|
|
15970
|
+
index2 = 0;
|
|
19699
15971
|
}
|
|
19700
|
-
const echo = (++
|
|
15972
|
+
const echo = (++index2).toString();
|
|
19701
15973
|
const key = createWsResponseKey(echo);
|
|
19702
15974
|
const str = JSON.stringify({ ...data, echo });
|
|
19703
15975
|
const result = (data2) => {
|
|
@@ -19861,41 +16133,41 @@ var init_template = __esm({
|
|
|
19861
16133
|
});
|
|
19862
16134
|
|
|
19863
16135
|
// src/adapter/render/admin/cache.ts
|
|
19864
|
-
var
|
|
16136
|
+
var index3, cache8, registerRender, unregisterRender, getRender, callRender, getRenderCount, getRenderList, renderHtml, renderMultiHtml, RenderCache, render, Renderer;
|
|
19865
16137
|
var init_cache4 = __esm({
|
|
19866
16138
|
"src/adapter/render/admin/cache.ts"() {
|
|
19867
|
-
|
|
16139
|
+
index3 = 0;
|
|
19868
16140
|
cache8 = [];
|
|
19869
16141
|
registerRender = (id, render4) => {
|
|
19870
|
-
const i = ++
|
|
16142
|
+
const i = ++index3;
|
|
19871
16143
|
cache8.push({ index: i, id, render: render4 });
|
|
19872
|
-
logger.mark(`[render:${
|
|
16144
|
+
logger.mark(`[render:${index3}] ${logger.green("\u6CE8\u518C\u6210\u529F")}: ${id}`);
|
|
19873
16145
|
return i;
|
|
19874
16146
|
};
|
|
19875
|
-
unregisterRender = (
|
|
19876
|
-
const
|
|
19877
|
-
if (!
|
|
19878
|
-
logger.error(`[render] \u5378\u8F7D\u5931\u8D25: \u4E0D\u5B58\u5728\u7D22\u5F15 ${
|
|
16147
|
+
unregisterRender = (index4) => {
|
|
16148
|
+
const app4 = cache8.find((app5) => app5.index === index4);
|
|
16149
|
+
if (!app4) {
|
|
16150
|
+
logger.error(`[render] \u5378\u8F7D\u5931\u8D25: \u4E0D\u5B58\u5728\u7D22\u5F15 ${index4}`);
|
|
19879
16151
|
return false;
|
|
19880
16152
|
}
|
|
19881
|
-
cache8.splice(cache8.findIndex((
|
|
19882
|
-
logger.mark(`[render] ${logger.yellow("\u5378\u8F7D\u6210\u529F")}: ${
|
|
16153
|
+
cache8.splice(cache8.findIndex((app5) => app5.index === index4), 1);
|
|
16154
|
+
logger.mark(`[render] ${logger.yellow("\u5378\u8F7D\u6210\u529F")}: ${app4.id}`);
|
|
19883
16155
|
return true;
|
|
19884
16156
|
};
|
|
19885
16157
|
getRender = (id) => {
|
|
19886
16158
|
if (cache8.length === 0) throw new Error("\u6E32\u67D3\u5668\u5217\u8868\u4E3A\u7A7A: \u8BF7\u524D\u5F80\u63D2\u4EF6\u5E02\u573A\u5B89\u88C5\u3010@karinjs/plugin-puppeteer\u3011\u63D2\u4EF6");
|
|
19887
16159
|
if (!id) {
|
|
19888
|
-
const
|
|
19889
|
-
return
|
|
16160
|
+
const app5 = cache8[Math.floor(Math.random() * cache8.length)];
|
|
16161
|
+
return app5;
|
|
19890
16162
|
}
|
|
19891
16163
|
if (typeof id === "number") {
|
|
19892
|
-
const
|
|
19893
|
-
if (!
|
|
19894
|
-
return
|
|
16164
|
+
const app5 = cache8.find((app6) => app6.index === id);
|
|
16165
|
+
if (!app5) throw new Error(`\u672A\u627E\u5230\u6E32\u67D3\u5668\uFF1A${id}`);
|
|
16166
|
+
return app5;
|
|
19895
16167
|
}
|
|
19896
|
-
const
|
|
19897
|
-
if (!
|
|
19898
|
-
return
|
|
16168
|
+
const app4 = cache8.find((app5) => app5.id === id);
|
|
16169
|
+
if (!app4) throw new Error(`\u672A\u627E\u5230\u6E32\u67D3\u5668\uFF1A${id}`);
|
|
16170
|
+
return app4;
|
|
19899
16171
|
};
|
|
19900
16172
|
callRender = async (options, id) => {
|
|
19901
16173
|
const res = getRender(id);
|
|
@@ -19904,7 +16176,7 @@ var init_cache4 = __esm({
|
|
|
19904
16176
|
};
|
|
19905
16177
|
getRenderCount = () => cache8.length;
|
|
19906
16178
|
getRenderList = () => {
|
|
19907
|
-
const list2 = cache8.map((
|
|
16179
|
+
const list2 = cache8.map((app4) => app4);
|
|
19908
16180
|
return list2;
|
|
19909
16181
|
};
|
|
19910
16182
|
renderHtml = (data) => {
|
|
@@ -19946,8 +16218,8 @@ var init_cache4 = __esm({
|
|
|
19946
16218
|
* @param index 渲染器索引
|
|
19947
16219
|
* @returns 是否卸载成功
|
|
19948
16220
|
*/
|
|
19949
|
-
unapp(
|
|
19950
|
-
return unregisterRender(
|
|
16221
|
+
unapp(index4) {
|
|
16222
|
+
return unregisterRender(index4);
|
|
19951
16223
|
}
|
|
19952
16224
|
/**
|
|
19953
16225
|
* 返回渲染器实例 未键入id返回第一个
|
|
@@ -19996,7 +16268,7 @@ var init_client = __esm({
|
|
|
19996
16268
|
PREFIX = "[snapka-ws-clinet] ";
|
|
19997
16269
|
snapkaMap = /* @__PURE__ */ new Map();
|
|
19998
16270
|
createSnapkaClient = (clientOptions) => {
|
|
19999
|
-
let
|
|
16271
|
+
let index4 = -1;
|
|
20000
16272
|
let isReconnect = true;
|
|
20001
16273
|
let reconnectTimer;
|
|
20002
16274
|
const { enable, url, token, reconnectTime = 5e3, heartbeatTime = 3e4, isSnapka = false } = clientOptions;
|
|
@@ -20019,7 +16291,7 @@ var init_client = __esm({
|
|
|
20019
16291
|
const fnc2 = (isPrint = true) => {
|
|
20020
16292
|
client.removeAllListeners();
|
|
20021
16293
|
client?.close();
|
|
20022
|
-
|
|
16294
|
+
index4 > 0 && unregisterRender(index4);
|
|
20023
16295
|
if (!isReconnect) {
|
|
20024
16296
|
isPrint && logger.error(`${PREFIX}\u8FDE\u63A5\u5173\u95ED: ${url}`);
|
|
20025
16297
|
return;
|
|
@@ -20038,7 +16310,7 @@ var init_client = __esm({
|
|
|
20038
16310
|
setTimeout(() => {
|
|
20039
16311
|
if (client.readyState !== WebSocket$1.OPEN) return;
|
|
20040
16312
|
logger.info(`${PREFIX}\u8FDE\u63A5\u6210\u529F: ${url}`);
|
|
20041
|
-
|
|
16313
|
+
index4 = registerRender("snapka", render4);
|
|
20042
16314
|
client.on("message", async (event) => onMessage(client, url, event, authorization));
|
|
20043
16315
|
}, 3e3);
|
|
20044
16316
|
});
|
|
@@ -20153,7 +16425,7 @@ var init_server = __esm({
|
|
|
20153
16425
|
init_template();
|
|
20154
16426
|
init_cache4();
|
|
20155
16427
|
WebSocketPuppeteerServer = async (socket, request3) => {
|
|
20156
|
-
let
|
|
16428
|
+
let index4 = -1;
|
|
20157
16429
|
const authorization = request3.headers["authorization"];
|
|
20158
16430
|
if (!auth(authorization)) {
|
|
20159
16431
|
socket.close();
|
|
@@ -20165,7 +16437,7 @@ var init_server = __esm({
|
|
|
20165
16437
|
return sendWsScreenshotRequest(socket, options);
|
|
20166
16438
|
};
|
|
20167
16439
|
socket.on("close", () => {
|
|
20168
|
-
|
|
16440
|
+
index4 > 0 && unregisterRender(index4);
|
|
20169
16441
|
socket.removeAllListeners();
|
|
20170
16442
|
socket.close();
|
|
20171
16443
|
});
|
|
@@ -20182,7 +16454,7 @@ var init_server = __esm({
|
|
|
20182
16454
|
listeners.emit(key, { status, data });
|
|
20183
16455
|
});
|
|
20184
16456
|
const name = request3.headers["x-client-name"] || "snapka";
|
|
20185
|
-
|
|
16457
|
+
index4 = registerRender(name, render4);
|
|
20186
16458
|
};
|
|
20187
16459
|
initWebSocketPuppeteerServer = () => {
|
|
20188
16460
|
listeners.on(WS_SNAPKA, (socket, request3, call2) => {
|
|
@@ -20234,14 +16506,14 @@ var init_http = __esm({
|
|
|
20234
16506
|
};
|
|
20235
16507
|
let pingTimer;
|
|
20236
16508
|
let consecutiveFailures = 0;
|
|
20237
|
-
const
|
|
16509
|
+
const index4 = registerRender("snapka-http", render4);
|
|
20238
16510
|
const close = () => {
|
|
20239
16511
|
if (pingTimer) {
|
|
20240
16512
|
clearInterval(pingTimer);
|
|
20241
16513
|
pingTimer = void 0;
|
|
20242
16514
|
}
|
|
20243
16515
|
snapkaMap2.delete(options.url);
|
|
20244
|
-
unregisterRender(
|
|
16516
|
+
unregisterRender(index4);
|
|
20245
16517
|
};
|
|
20246
16518
|
const startPingInterval = () => {
|
|
20247
16519
|
pingTimer = setInterval(async () => {
|
|
@@ -21538,11 +17810,11 @@ var init_mock = __esm({
|
|
|
21538
17810
|
this.store[key].expire = -1;
|
|
21539
17811
|
this.#zset[key] = [];
|
|
21540
17812
|
}
|
|
21541
|
-
const
|
|
21542
|
-
if (
|
|
17813
|
+
const index4 = this.#zset[key].findIndex((entry) => entry.member === member.toString());
|
|
17814
|
+
if (index4 === -1) {
|
|
21543
17815
|
this.#zset[key].push({ score, member });
|
|
21544
17816
|
} else {
|
|
21545
|
-
this.#zset[key][
|
|
17817
|
+
this.#zset[key][index4] = { score, member };
|
|
21546
17818
|
}
|
|
21547
17819
|
this.#sqlite.set(key, JSON.stringify(this.#zset[key]), "zset" /* ZSET */, this.store[key].expire);
|
|
21548
17820
|
return 1;
|
|
@@ -21566,8 +17838,8 @@ var init_mock = __esm({
|
|
|
21566
17838
|
async zRank(key, member) {
|
|
21567
17839
|
if (!this.#list[key]) return null;
|
|
21568
17840
|
if (this.checkExpire(key)) return null;
|
|
21569
|
-
const
|
|
21570
|
-
return
|
|
17841
|
+
const index4 = this.#list[key].findIndex((entry) => entry === member.toString());
|
|
17842
|
+
return index4 !== -1 ? index4 : null;
|
|
21571
17843
|
}
|
|
21572
17844
|
/**
|
|
21573
17845
|
* 返回有序集合中指定成员的分数
|
|
@@ -21793,17 +18065,17 @@ var init_mock = __esm({
|
|
|
21793
18065
|
* @param index 索引,0表示第一个元素,-1表示最后一个元素
|
|
21794
18066
|
* @returns 返回元素值,索引超出范围返回null
|
|
21795
18067
|
*/
|
|
21796
|
-
async lIndex(key,
|
|
18068
|
+
async lIndex(key, index4) {
|
|
21797
18069
|
if (!this.#list[key]) return null;
|
|
21798
18070
|
if (this.checkExpire(key)) return null;
|
|
21799
18071
|
const list2 = this.#list[key];
|
|
21800
|
-
if (
|
|
21801
|
-
|
|
18072
|
+
if (index4 < 0) {
|
|
18073
|
+
index4 = list2.length + index4;
|
|
21802
18074
|
}
|
|
21803
|
-
if (
|
|
18075
|
+
if (index4 < 0 || index4 >= list2.length) {
|
|
21804
18076
|
return null;
|
|
21805
18077
|
}
|
|
21806
|
-
return list2[
|
|
18078
|
+
return list2[index4].toString();
|
|
21807
18079
|
}
|
|
21808
18080
|
/**
|
|
21809
18081
|
* 设置列表指定索引的元素值
|
|
@@ -21812,17 +18084,17 @@ var init_mock = __esm({
|
|
|
21812
18084
|
* @param value 值
|
|
21813
18085
|
* @returns 成功返回"OK",失败返回错误
|
|
21814
18086
|
*/
|
|
21815
|
-
async lSet(key,
|
|
18087
|
+
async lSet(key, index4, value) {
|
|
21816
18088
|
if (!this.#list[key]) return null;
|
|
21817
18089
|
if (this.checkExpire(key)) return null;
|
|
21818
18090
|
const list2 = this.#list[key];
|
|
21819
|
-
if (
|
|
21820
|
-
|
|
18091
|
+
if (index4 < 0) {
|
|
18092
|
+
index4 = list2.length + index4;
|
|
21821
18093
|
}
|
|
21822
|
-
if (
|
|
18094
|
+
if (index4 < 0 || index4 >= list2.length) {
|
|
21823
18095
|
return null;
|
|
21824
18096
|
}
|
|
21825
|
-
list2[
|
|
18097
|
+
list2[index4] = value;
|
|
21826
18098
|
this.#sqlite.set(key, JSON.stringify(list2), "list" /* LIST */, this.store[key].expire);
|
|
21827
18099
|
return "OK";
|
|
21828
18100
|
}
|
|
@@ -22036,9 +18308,9 @@ var init_mock = __esm({
|
|
|
22036
18308
|
if (!this.#zset[key]) return 0;
|
|
22037
18309
|
if (this.checkExpire(key)) return 0;
|
|
22038
18310
|
const strMember = member.toString();
|
|
22039
|
-
const
|
|
22040
|
-
if (
|
|
22041
|
-
this.#zset[key].splice(
|
|
18311
|
+
const index4 = this.#zset[key].findIndex((entry) => entry.member.toString() === strMember);
|
|
18312
|
+
if (index4 !== -1) {
|
|
18313
|
+
this.#zset[key].splice(index4, 1);
|
|
22042
18314
|
this.#sqlite.set(key, JSON.stringify(this.#zset[key]), "zset" /* ZSET */, this.store[key].expire);
|
|
22043
18315
|
return 1;
|
|
22044
18316
|
}
|
|
@@ -22945,11 +19217,11 @@ var init_load = __esm({
|
|
|
22945
19217
|
if (typeof pkg2.pkgData?.engines?.karin === "string") fallback = String(pkg2.pkgData.engines.karin).trim();
|
|
22946
19218
|
else if (typeof pkg2.pkgData?.engines?.["node-karin"] === "string") fallback = String(pkg2.pkgData.engines["node-karin"]).trim();
|
|
22947
19219
|
}
|
|
22948
|
-
const
|
|
22949
|
-
isCompatible = !
|
|
22950
|
-
if (
|
|
19220
|
+
const range2 = preferred || fallback;
|
|
19221
|
+
isCompatible = !range2 || satisfies(range2, process.env.KARIN_VERSION);
|
|
19222
|
+
if (range2 && !isCompatible) {
|
|
22951
19223
|
if (!ignoreEngines) {
|
|
22952
|
-
reporter.add(pkg2.name,
|
|
19224
|
+
reporter.add(pkg2.name, range2);
|
|
22953
19225
|
await reporter.flush(true, process.env.KARIN_VERSION);
|
|
22954
19226
|
shouldLoad = false;
|
|
22955
19227
|
}
|
|
@@ -22978,10 +19250,10 @@ var init_load = __esm({
|
|
|
22978
19250
|
}
|
|
22979
19251
|
}
|
|
22980
19252
|
}
|
|
22981
|
-
shouldLoad && pkg2.apps.forEach((
|
|
19253
|
+
shouldLoad && pkg2.apps.forEach((app4) => {
|
|
22982
19254
|
const promise = async () => {
|
|
22983
|
-
const result = await pkgLoadModule(pkg2.name,
|
|
22984
|
-
pkgCache(result, pkg2,
|
|
19255
|
+
const result = await pkgLoadModule(pkg2.name, app4);
|
|
19256
|
+
pkgCache(result, pkg2, app4);
|
|
22985
19257
|
};
|
|
22986
19258
|
allPromises.push(promise());
|
|
22987
19259
|
});
|
|
@@ -23011,12 +19283,12 @@ var init_load = __esm({
|
|
|
23011
19283
|
isType = (val, type) => {
|
|
23012
19284
|
return val.file?.type === type;
|
|
23013
19285
|
};
|
|
23014
|
-
pkgCache = (result, pkg2,
|
|
19286
|
+
pkgCache = (result, pkg2, app4) => {
|
|
23015
19287
|
const cacheHandler = (val, key) => {
|
|
23016
19288
|
if (typeof val !== "object") return;
|
|
23017
19289
|
if (!val?.pkg || !val.file) return;
|
|
23018
19290
|
val.pkg = pkg2;
|
|
23019
|
-
val.file = createFile2(
|
|
19291
|
+
val.file = createFile2(app4, val.file.type, key, val.file.name);
|
|
23020
19292
|
if (isType(val, "accept")) {
|
|
23021
19293
|
cache3.count.accept++;
|
|
23022
19294
|
cache3.accept.push(val);
|
|
@@ -23067,7 +19339,7 @@ var init_load = __esm({
|
|
|
23067
19339
|
if (key === "default") continue;
|
|
23068
19340
|
if (typeof result[key] === "function") {
|
|
23069
19341
|
if (!isClass(result[key])) continue;
|
|
23070
|
-
cacheClassPlugin(result[key], pkg2,
|
|
19342
|
+
cacheClassPlugin(result[key], pkg2, app4, key);
|
|
23071
19343
|
continue;
|
|
23072
19344
|
}
|
|
23073
19345
|
const data = result[key];
|
|
@@ -23076,9 +19348,9 @@ var init_load = __esm({
|
|
|
23076
19348
|
}
|
|
23077
19349
|
}
|
|
23078
19350
|
};
|
|
23079
|
-
createFile2 = (
|
|
19351
|
+
createFile2 = (app4, type, method, name) => {
|
|
23080
19352
|
return {
|
|
23081
|
-
absPath:
|
|
19353
|
+
absPath: app4,
|
|
23082
19354
|
get dirname() {
|
|
23083
19355
|
return path4.dirname(this.absPath);
|
|
23084
19356
|
},
|
|
@@ -23090,14 +19362,14 @@ var init_load = __esm({
|
|
|
23090
19362
|
name: name || type
|
|
23091
19363
|
};
|
|
23092
19364
|
};
|
|
23093
|
-
cacheClassPlugin = (Method, pkg2,
|
|
19365
|
+
cacheClassPlugin = (Method, pkg2, app4, _) => {
|
|
23094
19366
|
const command2 = new Method();
|
|
23095
19367
|
if (!command2.name) {
|
|
23096
|
-
logger.error(`[load][${
|
|
19368
|
+
logger.error(`[load][${app4}] plugin.name \u4E0D\u80FD\u4E3A\u7A7A`);
|
|
23097
19369
|
return;
|
|
23098
19370
|
}
|
|
23099
19371
|
if (!command2.rule || !Array.isArray(command2.rule) || command2.rule?.length === 0) {
|
|
23100
|
-
logger.error(`[load][${
|
|
19372
|
+
logger.error(`[load][${app4}] ${command2.name} plugin.rule \u4E0D\u80FD\u4E3A\u7A7A`);
|
|
23101
19373
|
return;
|
|
23102
19374
|
}
|
|
23103
19375
|
command2.rule.forEach((v) => {
|
|
@@ -23114,7 +19386,7 @@ var init_load = __esm({
|
|
|
23114
19386
|
permission: v.permission || "all",
|
|
23115
19387
|
event: v.event || command2.event || "message",
|
|
23116
19388
|
priority: v.priority || 1e4,
|
|
23117
|
-
file: createFile2(
|
|
19389
|
+
file: createFile2(app4, "command", v.fnc, command2.name),
|
|
23118
19390
|
authFailMsg: v.authFailMsg || true
|
|
23119
19391
|
});
|
|
23120
19392
|
});
|
|
@@ -23196,7 +19468,7 @@ var init_http2 = __esm({
|
|
|
23196
19468
|
}
|
|
23197
19469
|
return;
|
|
23198
19470
|
}
|
|
23199
|
-
const
|
|
19471
|
+
const index4 = registerRender("puppeteer", async (options) => {
|
|
23200
19472
|
try {
|
|
23201
19473
|
const result = await axios8.post(`${url}/puppeteer`, options, { headers });
|
|
23202
19474
|
if (result.status !== 200) {
|
|
@@ -23206,7 +19478,7 @@ var init_http2 = __esm({
|
|
|
23206
19478
|
} catch (error) {
|
|
23207
19479
|
if (axios8.isAxiosError(error)) {
|
|
23208
19480
|
if (!error.response) {
|
|
23209
|
-
unregisterRender(
|
|
19481
|
+
unregisterRender(index4);
|
|
23210
19482
|
throw new Error(`[render][http] \u7F51\u7EDC\u8FDE\u63A5\u5931\u8D25: ${error.message}`);
|
|
23211
19483
|
}
|
|
23212
19484
|
const { response } = error;
|
|
@@ -23580,11 +19852,11 @@ var init_middleware = __esm({
|
|
|
23580
19852
|
return;
|
|
23581
19853
|
}
|
|
23582
19854
|
if (req.method === "POST") {
|
|
23583
|
-
const
|
|
23584
|
-
if (!
|
|
19855
|
+
const verify = await auth2.postAuth(req, res);
|
|
19856
|
+
if (!verify) return;
|
|
23585
19857
|
} else if (req.method === "GET") {
|
|
23586
|
-
const
|
|
23587
|
-
if (!
|
|
19858
|
+
const verify = await auth2.getAuth(req, res);
|
|
19859
|
+
if (!verify) return;
|
|
23588
19860
|
} else {
|
|
23589
19861
|
createMethodNotAllowedResponse(res);
|
|
23590
19862
|
return;
|
|
@@ -25474,8 +21746,8 @@ var init_installMarket = __esm({
|
|
|
25474
21746
|
);
|
|
25475
21747
|
}
|
|
25476
21748
|
let isRace = false;
|
|
25477
|
-
for (const
|
|
25478
|
-
if (
|
|
21749
|
+
for (const app4 of urls) {
|
|
21750
|
+
if (app4.url.startsWith("https://raw.githubusercontent.com")) {
|
|
25479
21751
|
isRace = true;
|
|
25480
21752
|
break;
|
|
25481
21753
|
}
|
|
@@ -25501,11 +21773,11 @@ var init_installMarket = __esm({
|
|
|
25501
21773
|
const dir = path4.join(karinPathPlugins, "karin-plugin-example");
|
|
25502
21774
|
mkdirSync(dir);
|
|
25503
21775
|
emitLog("\u5F00\u59CB\u4E0B\u8F7D\u63D2\u4EF6\u6587\u4EF6...");
|
|
25504
|
-
await Promise.all(urls.map(async (
|
|
25505
|
-
const filename2 = path4.basename(
|
|
21776
|
+
await Promise.all(urls.map(async (app4) => {
|
|
21777
|
+
const filename2 = path4.basename(app4.url);
|
|
25506
21778
|
const fileUrl = path4.join(dir, filename2);
|
|
25507
21779
|
emitLog(`\u6B63\u5728\u4E0B\u8F7D: ${filename2}`);
|
|
25508
|
-
const result = await downloadFile(
|
|
21780
|
+
const result = await downloadFile(app4.url, fileUrl);
|
|
25509
21781
|
if (!result.success) {
|
|
25510
21782
|
let err = `${filename2} \u4E0B\u8F7D\u5931\u8D25: `;
|
|
25511
21783
|
if (result.data instanceof AxiosError) {
|
|
@@ -25516,14 +21788,14 @@ var init_installMarket = __esm({
|
|
|
25516
21788
|
err += String(result.data);
|
|
25517
21789
|
}
|
|
25518
21790
|
logger.error(`[install] \u4E0B\u8F7Dapp\u63D2\u4EF6\u5931\u8D25:
|
|
25519
|
-
url: ${
|
|
21791
|
+
url: ${app4.url}
|
|
25520
21792
|
message: ${err}`);
|
|
25521
21793
|
msg.push(err);
|
|
25522
21794
|
emitLog(err);
|
|
25523
21795
|
return;
|
|
25524
21796
|
}
|
|
25525
|
-
msg.push(`${
|
|
25526
|
-
emitLog(`${
|
|
21797
|
+
msg.push(`${app4.url} \u4E0B\u8F7D\u6210\u529F`);
|
|
21798
|
+
emitLog(`${app4.url} \u4E0B\u8F7D\u6210\u529F`);
|
|
25527
21799
|
}));
|
|
25528
21800
|
emitLog("\u5B89\u88C5\u5B8C\u6210");
|
|
25529
21801
|
return true;
|
|
@@ -25701,7 +21973,7 @@ var init_uninstall = __esm({
|
|
|
25701
21973
|
const performUninstall = async (emitLog) => {
|
|
25702
21974
|
const npm2 = [];
|
|
25703
21975
|
const git2 = [];
|
|
25704
|
-
const
|
|
21976
|
+
const app4 = [];
|
|
25705
21977
|
const notExist = [];
|
|
25706
21978
|
const list2 = await getPlugins("all");
|
|
25707
21979
|
target.forEach(async (v) => {
|
|
@@ -25714,7 +21986,7 @@ var init_uninstall = __esm({
|
|
|
25714
21986
|
return;
|
|
25715
21987
|
}
|
|
25716
21988
|
if (v.type === "app") {
|
|
25717
|
-
|
|
21989
|
+
app4.push(v.name);
|
|
25718
21990
|
return;
|
|
25719
21991
|
}
|
|
25720
21992
|
notExist.push(v.name);
|
|
@@ -25756,7 +22028,7 @@ var init_uninstall = __esm({
|
|
|
25756
22028
|
}
|
|
25757
22029
|
emitLog("-----------------------\n\n");
|
|
25758
22030
|
}
|
|
25759
|
-
for (const v of
|
|
22031
|
+
for (const v of app4) {
|
|
25760
22032
|
emitLog("-----------------------");
|
|
25761
22033
|
emitLog(`\u5F00\u59CB\u5378\u8F7D app \u63D2\u4EF6: ${v}`);
|
|
25762
22034
|
if (v.includes("..")) {
|
|
@@ -26531,7 +22803,7 @@ var init_webConfig = __esm({
|
|
|
26531
22803
|
};
|
|
26532
22804
|
}
|
|
26533
22805
|
});
|
|
26534
|
-
var git, npm,
|
|
22806
|
+
var git, npm, app2, getPluginLocalList, getPluginListPluginAdmin, getLoadedCommandPluginCacheList, getFrontendInstalledPluginList;
|
|
26535
22807
|
var init_list4 = __esm({
|
|
26536
22808
|
"src/server/plugins/detail/list.ts"() {
|
|
26537
22809
|
init_system3();
|
|
@@ -26576,7 +22848,7 @@ var init_list4 = __esm({
|
|
|
26576
22848
|
webConfig: defaultWebConfig()
|
|
26577
22849
|
};
|
|
26578
22850
|
};
|
|
26579
|
-
|
|
22851
|
+
app2 = async (plugin) => {
|
|
26580
22852
|
return plugin.apps.map((v) => {
|
|
26581
22853
|
return {
|
|
26582
22854
|
type: "app",
|
|
@@ -26605,7 +22877,7 @@ var init_list4 = __esm({
|
|
|
26605
22877
|
return list2.push(await npm(plugin2));
|
|
26606
22878
|
}
|
|
26607
22879
|
if (plugin2.type === "app") {
|
|
26608
|
-
const result = await
|
|
22880
|
+
const result = await app2(plugin2);
|
|
26609
22881
|
return list2.push(...result);
|
|
26610
22882
|
}
|
|
26611
22883
|
}));
|
|
@@ -27115,11 +23387,11 @@ headers: ${JSON.stringify(request3.headers, null, 2)}`
|
|
|
27115
23387
|
// src/server/app/app.ts
|
|
27116
23388
|
var app_exports = {};
|
|
27117
23389
|
__export(app_exports, {
|
|
27118
|
-
app: () =>
|
|
23390
|
+
app: () => app3,
|
|
27119
23391
|
initExpress: () => initExpress,
|
|
27120
23392
|
server: () => server
|
|
27121
23393
|
});
|
|
27122
|
-
var
|
|
23394
|
+
var app3, server, listen, web, initExpress;
|
|
27123
23395
|
var init_app = __esm({
|
|
27124
23396
|
"src/server/app/app.ts"() {
|
|
27125
23397
|
init_env2();
|
|
@@ -27128,8 +23400,8 @@ var init_app = __esm({
|
|
|
27128
23400
|
init_getMimeType();
|
|
27129
23401
|
init_router();
|
|
27130
23402
|
init_listeners();
|
|
27131
|
-
|
|
27132
|
-
server = createServer(
|
|
23403
|
+
app3 = express2();
|
|
23404
|
+
server = createServer(app3);
|
|
27133
23405
|
listen = (port2, host2) => {
|
|
27134
23406
|
server.listen(port2, host2, () => {
|
|
27135
23407
|
logger.info(`[server] express \u6B63\u5728\u76D1\u542C: http://${host2}:${port2}`);
|
|
@@ -27147,17 +23419,17 @@ var init_app = __esm({
|
|
|
27147
23419
|
};
|
|
27148
23420
|
web = (dir) => {
|
|
27149
23421
|
const webDir = path4.join(dir.karinDir, "dist/web");
|
|
27150
|
-
|
|
27151
|
-
|
|
27152
|
-
|
|
27153
|
-
|
|
23422
|
+
app3.use("/web", express2.static(webDir));
|
|
23423
|
+
app3.use("/sandbox/data", express2.static(dir.sandboxDataPath));
|
|
23424
|
+
app3.use("/sandbox/file", express2.static(dir.sandboxTempPath));
|
|
23425
|
+
app3.get("/web/{*splat}", (_, res) => {
|
|
27154
23426
|
res.sendFile("index.html", {
|
|
27155
23427
|
root: path4.resolve(webDir)
|
|
27156
23428
|
});
|
|
27157
23429
|
});
|
|
27158
23430
|
listeners.once(ONLINE, () => {
|
|
27159
23431
|
setTimeout(() => {
|
|
27160
|
-
|
|
23432
|
+
app3.all("/{*splat}", (_, res) => {
|
|
27161
23433
|
res.redirect("/web");
|
|
27162
23434
|
});
|
|
27163
23435
|
}, 5e3);
|
|
@@ -27165,7 +23437,7 @@ var init_app = __esm({
|
|
|
27165
23437
|
};
|
|
27166
23438
|
initExpress = async (dir, port2, host2) => {
|
|
27167
23439
|
const webDir = path4.join(dir.karinDir, "dist/web");
|
|
27168
|
-
|
|
23440
|
+
app3.use("/web", (req, res, next) => {
|
|
27169
23441
|
const filePath = path4.join(webDir, req.path);
|
|
27170
23442
|
const brPath = `${filePath}.br`;
|
|
27171
23443
|
const acceptEncoding = req.headers["accept-encoding"] || "";
|
|
@@ -27193,8 +23465,8 @@ var init_app = __esm({
|
|
|
27193
23465
|
next();
|
|
27194
23466
|
});
|
|
27195
23467
|
await Promise.resolve().then(() => (init_ws2(), ws_exports));
|
|
27196
|
-
|
|
27197
|
-
|
|
23468
|
+
app3.use(BASE_ROUTER, router);
|
|
23469
|
+
app3.get("/", rootRouter);
|
|
27198
23470
|
web(dir);
|
|
27199
23471
|
listen(port2, host2);
|
|
27200
23472
|
};
|
|
@@ -27741,7 +24013,7 @@ var oneBotEventDispatchRouter = async (req, res) => {
|
|
|
27741
24013
|
var createOneBotEventDispatchRouter = () => {
|
|
27742
24014
|
const router2 = Router();
|
|
27743
24015
|
router2.post("/", oneBotEventDispatchRouter);
|
|
27744
|
-
|
|
24016
|
+
app3.use("/onebot", router2);
|
|
27745
24017
|
};
|
|
27746
24018
|
|
|
27747
24019
|
// src/adapter/onebot/create/init.ts
|
|
@@ -28076,8 +24348,8 @@ var Other = class extends EventEmitter {
|
|
|
28076
24348
|
* 根据索引获取Bot
|
|
28077
24349
|
* @param index - Bot的索引id
|
|
28078
24350
|
*/
|
|
28079
|
-
getBotByIndex(
|
|
28080
|
-
return getBot(
|
|
24351
|
+
getBotByIndex(index4) {
|
|
24352
|
+
return getBot(index4);
|
|
28081
24353
|
}
|
|
28082
24354
|
/**
|
|
28083
24355
|
* 获取注册的Bot数量
|
|
@@ -28965,10 +25237,5 @@ var start2 = async () => {
|
|
|
28965
25237
|
listeners.emit(ONLINE, {});
|
|
28966
25238
|
logger.mark(`karin \u542F\u52A8\u5B8C\u6210: \u8017\u65F6 ${logger.green(process.uptime().toFixed(2))} \u79D2...`);
|
|
28967
25239
|
};
|
|
28968
|
-
/*! Bundled license information:
|
|
28969
|
-
|
|
28970
|
-
@karinjs/jsonwebtoken/dist/jsonwebtoken.js:
|
|
28971
|
-
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
28972
|
-
*/
|
|
28973
25240
|
|
|
28974
|
-
export { AdapterBase, AdapterConvertKarin, AdapterOneBot, BASE_ROUTER, BATCH_UPDATE_PLUGINS_ROUTER, BOT_CONNECT, BOT_DISCONNECT, BaseEvent, Bot, CHECK_PLUGIN_ROUTER, CLOSE_TERMINAL_ROUTER, CONSOLE_ROUTER, CREATE_TERMINAL_ROUTER, DirectMessage, EVENT_COUNT, EXIT_ROUTER, FILE_CHANGE, FriendDecreaseNotice, FriendIncreaseNotice, FriendMessage, GET_BOTS_ROUTER, GET_CONFIG_ROUTER, GET_DEPENDENCIES_LIST_ROUTER, GET_LOADED_COMMAND_PLUGIN_CACHE_LIST_ROUTER, GET_LOCAL_PLUGIN_FRONTEND_LIST_ROUTER, GET_LOCAL_PLUGIN_LIST_ROUTER, GET_LOG_FILE_LIST_ROUTER, GET_LOG_FILE_ROUTER, GET_LOG_ROUTER, GET_NETWORK_STATUS_ROUTER, GET_NPMRC_LIST_ROUTER, GET_NPM_BASE_CONFIG_ROUTER, GET_NPM_CONFIG_ROUTER, GET_ONLINE_PLUGIN_LIST_ROUTER, GET_PLUGIN_APPS_ROUTER, GET_PLUGIN_CONFIG_ROUTER, GET_PLUGIN_FILE_ROUTER, GET_PLUGIN_LIST_PLUGIN_ADMIN_ROUTER, GET_PLUGIN_LIST_ROUTER, GET_PLUGIN_MARKET_LIST_ROUTER, GET_TASK_LIST_ROUTER, GET_TASK_STATUS_ROUTER, GET_TERMINAL_LIST_ROUTER, GET_UPDATABLE_PLUGINS_ROUTER, GET_WEBUI_PLUGIN_LIST_ROUTER, GET_WEBUI_PLUGIN_VERSIONS_ROUTER, GroupAdminChangedNotice, GroupApplyRequest, GroupCardChangedNotice, GroupFileUploadedNotice, GroupHlightsChangedNotice, GroupHonorChangedNotice, GroupInviteRequest, GroupLuckKingNotice, GroupMemberBanNotice, GroupMemberDecreaseNotice, GroupMemberIncreaseNotice, GroupMemberTitleUpdatedNotice, GroupMessage, GroupMessageReactionNotice, GroupNotice, GroupPokeNotice, GroupRecallNotice, GroupSignInNotice, GroupTempMessage, GroupWholeBanNotice, GuildMessage, HTTPStatusCode, INSTALL_PLUGIN_ROUTER, INSTALL_WEBUI_PLUGIN_ROUTER, IS_PLUGIN_CONFIG_EXIST_ROUTER, KarinConvertAdapter, LOGIN_ROUTER, MANAGE_DEPENDENCIES_ROUTER, MessageBase, NoticeBase, createMessage as OneBotCreateMessage, createNotice as OneBotCreateNotice, createRequest as OneBotCreateRequest, PING_ROUTER, PLUGIN_ADMIN_ROUTER, Plugin, PrivateApplyRequest, PrivateFileUploadedNotice, PrivatePokeNotice, PrivateRecallNotice, RECV_MSG, REFRESH_ROUTER, RESTART_ROUTER, ReceiveLikeNotice, Renderer, RequestBase, SAVE_CONFIG_ROUTER, SAVE_NPMRC_ROUTER, SAVE_PLUGIN_CONFIG_ROUTER, SEND_MSG, SET_LOG_LEVEL_ROUTER, SYSTEM_INFO_ROUTER, SYSTEM_STATUS_KARIN_ROUTER, SYSTEM_STATUS_ROUTER, SYSTEM_STATUS_WS_ROUTER, TASK_DELETE_ROUTER, TASK_LIST_ROUTER, TASK_LOGS_ROUTER, TASK_RUN_ROUTER, UNINSTALL_PLUGIN_ROUTER, UNINSTALL_WEBUI_PLUGIN_ROUTER, UPDATE_CORE_ROUTER, UPDATE_PLUGIN_ROUTER, UPDATE_TASK_STATUS_ROUTER, UPDATE_WEBUI_PLUGIN_VERSION_ROUTER, WS_CLOSE, WS_CLOSE_ONEBOT, WS_CLOSE_PUPPETEER, WS_CLOSE_SANDBOX, WS_CONNECTION, WS_CONNECTION_ONEBOT, WS_CONNECTION_PUPPETEER, WS_CONNECTION_SANDBOX, WS_CONNECTION_TERMINAL, WS_SNAPKA, Watch, Watcher, YamlEditor, absPath, accordion, accordionItem, accordionPro,
|
|
25241
|
+
export { AdapterBase, AdapterConvertKarin, AdapterOneBot, BASE_ROUTER, BATCH_UPDATE_PLUGINS_ROUTER, BOT_CONNECT, BOT_DISCONNECT, BaseEvent, Bot, CHECK_PLUGIN_ROUTER, CLOSE_TERMINAL_ROUTER, CONSOLE_ROUTER, CREATE_TERMINAL_ROUTER, DirectMessage, EVENT_COUNT, EXIT_ROUTER, FILE_CHANGE, FriendDecreaseNotice, FriendIncreaseNotice, FriendMessage, GET_BOTS_ROUTER, GET_CONFIG_ROUTER, GET_DEPENDENCIES_LIST_ROUTER, GET_LOADED_COMMAND_PLUGIN_CACHE_LIST_ROUTER, GET_LOCAL_PLUGIN_FRONTEND_LIST_ROUTER, GET_LOCAL_PLUGIN_LIST_ROUTER, GET_LOG_FILE_LIST_ROUTER, GET_LOG_FILE_ROUTER, GET_LOG_ROUTER, GET_NETWORK_STATUS_ROUTER, GET_NPMRC_LIST_ROUTER, GET_NPM_BASE_CONFIG_ROUTER, GET_NPM_CONFIG_ROUTER, GET_ONLINE_PLUGIN_LIST_ROUTER, GET_PLUGIN_APPS_ROUTER, GET_PLUGIN_CONFIG_ROUTER, GET_PLUGIN_FILE_ROUTER, GET_PLUGIN_LIST_PLUGIN_ADMIN_ROUTER, GET_PLUGIN_LIST_ROUTER, GET_PLUGIN_MARKET_LIST_ROUTER, GET_TASK_LIST_ROUTER, GET_TASK_STATUS_ROUTER, GET_TERMINAL_LIST_ROUTER, GET_UPDATABLE_PLUGINS_ROUTER, GET_WEBUI_PLUGIN_LIST_ROUTER, GET_WEBUI_PLUGIN_VERSIONS_ROUTER, GroupAdminChangedNotice, GroupApplyRequest, GroupCardChangedNotice, GroupFileUploadedNotice, GroupHlightsChangedNotice, GroupHonorChangedNotice, GroupInviteRequest, GroupLuckKingNotice, GroupMemberBanNotice, GroupMemberDecreaseNotice, GroupMemberIncreaseNotice, GroupMemberTitleUpdatedNotice, GroupMessage, GroupMessageReactionNotice, GroupNotice, GroupPokeNotice, GroupRecallNotice, GroupSignInNotice, GroupTempMessage, GroupWholeBanNotice, GuildMessage, HTTPStatusCode, INSTALL_PLUGIN_ROUTER, INSTALL_WEBUI_PLUGIN_ROUTER, IS_PLUGIN_CONFIG_EXIST_ROUTER, KarinConvertAdapter, LOGIN_ROUTER, MANAGE_DEPENDENCIES_ROUTER, MessageBase, NoticeBase, createMessage as OneBotCreateMessage, createNotice as OneBotCreateNotice, createRequest as OneBotCreateRequest, PING_ROUTER, PLUGIN_ADMIN_ROUTER, Plugin, PrivateApplyRequest, PrivateFileUploadedNotice, PrivatePokeNotice, PrivateRecallNotice, RECV_MSG, REFRESH_ROUTER, RESTART_ROUTER, ReceiveLikeNotice, Renderer, RequestBase, SAVE_CONFIG_ROUTER, SAVE_NPMRC_ROUTER, SAVE_PLUGIN_CONFIG_ROUTER, SEND_MSG, SET_LOG_LEVEL_ROUTER, SYSTEM_INFO_ROUTER, SYSTEM_STATUS_KARIN_ROUTER, SYSTEM_STATUS_ROUTER, SYSTEM_STATUS_WS_ROUTER, TASK_DELETE_ROUTER, TASK_LIST_ROUTER, TASK_LOGS_ROUTER, TASK_RUN_ROUTER, UNINSTALL_PLUGIN_ROUTER, UNINSTALL_WEBUI_PLUGIN_ROUTER, UPDATE_CORE_ROUTER, UPDATE_PLUGIN_ROUTER, UPDATE_TASK_STATUS_ROUTER, UPDATE_WEBUI_PLUGIN_VERSION_ROUTER, WS_CLOSE, WS_CLOSE_ONEBOT, WS_CLOSE_PUPPETEER, WS_CLOSE_SANDBOX, WS_CONNECTION, WS_CONNECTION_ONEBOT, WS_CONNECTION_PUPPETEER, WS_CONNECTION_SANDBOX, WS_CONNECTION_TERMINAL, WS_SNAPKA, Watch, Watcher, YamlEditor, absPath, accordion, accordionItem, accordionPro, app3 as app, applyComments, authMiddleware, base64, basePath, buffer, buildError, buildGithub, buttonHandle, cacheMap, callRender, changelog_exports as changelog, checkGitPluginUpdate, checkPkgUpdate, checkPort, clearRequire, clearRequireFile, comment, commentPath, common_exports as common, components, config_exports as config, configPath, consolePath, contact2 as contact, contactDirect, contactFriend, contactGroup, contactGroupTemp, contactGuild, convertOneBotMessageToKarin, copyConfig, copyConfigSync, copyFiles, copyFilesSync, createAccessTokenExpiredResponse, createBadRequestResponse, createDirectMessage, createForbiddenResponse, createFriendDecreaseNotice, createFriendIncreaseNotice, createFriendMessage, createGroupAdminChangedNotice, createGroupApplyRequest, createGroupCardChangedNotice, createGroupFileUploadedNotice, createGroupHlightsChangedNotice, createGroupHonorChangedNotice, createGroupInviteRequest, createGroupLuckKingNotice, createGroupMemberAddNotice, createGroupMemberBanNotice, createGroupMemberDelNotice, createGroupMemberTitleUpdatedNotice, createGroupMessage, createGroupMessageReactionNotice, createGroupPokeNotice, createGroupRecallNotice, createGroupSignInNotice, createGroupTempMessage, createGroupWholeBanNotice, createGuildMessage, createINIParser, createMethodNotAllowedResponse, createNotFoundResponse, createOneBotClient, createOneBotHttp, createOneBotWsServer, createPayloadTooLargeResponse, createPluginDir, createPrivateApplyRequest, createPrivateFileUploadedNotice, createPrivatePokeNotice, createPrivateRecallNotice, createRawMessage, createReceiveLikeNotice, createRefreshTokenExpiredResponse, createResponse, createServerErrorResponse, createSuccessResponse, createTaskDatabase, createUnauthorizedResponse, cron, dataPath, db, dbPath, debug2 as debug, karin as default, defaultConfigPath, defaultViewPath, defineConfig, disconnectAllOneBotServer, divider, downFile, downloadFile, errorToString, exec, executeTask, existToMkdir, existToMkdirSync, exists, existsSync, ffmpeg, ffplay, ffprobe, fs_exports as file, fileToBase64, fileToUrl, fileToUrlHandlerKey, filesByExt, formatLogString, formatPath, formatTime, fs_exports2 as fs, getAllBot, getAllBotID, getAllBotList, getAllFiles, getAllFilesSync, getBot, getBotCount, getCommit, getDefaultBranch, getFastGithub, getFastRegistry, getFileMessage, getFiles, getHash, getLocalBranches, getLocalCommitHash, getMimeType, getPackageJson, getPid, getPkgVersion, getPluginInfo, getPlugins, getRelPath, getRemoteBranches, getRemoteCommitHash, getRemotePkgVersion, getRender, getRenderCount, getRenderList, getRequestIp, getTaskCallback, getTaskDatabase, getTime, gitPull, handler, hooks, htmlPath, importModule, imports, ini, initOneBotAdapter, initTaskSystem, input, isClass, isDir, isDirSync, isDocker, isFile, isFileSync, isIPv4Loop, isIPv6Loop, isLinux, isLocalRequest, isLoopback, isMac, isPackaged, isPathEqual, isPkg, isPlugin, isPublic, isRoot, isSubPath, isWin2 as isWin, json, karin, karinDir, karinMain, karinPathBase, karinPathComment, karinPathConfig, karinPathConsole, karinPathData, karinPathDb, karinPathDefaultConfig, karinPathDefaultView, karinPathHtml, karinPathKv, karinPathLogs, karinPathMain, karinPathPlugins, karinPathPm2Config, karinPathRedisSqlite3, karinPathResource, karinPathRoot, karinPathSandboxData, karinPathSandboxTemp, karinPathTaskDb, karinPathTemp, karinToQQBot, key_exports as key, killApp, kvPath, lock, lockMethod, lockProp, log, logger2 as logger, logs, logsPath, makeForward, makeMessage, mkdir, mkdirSync, parseChangelog, parseGithubUrl, pingRequest, pkgRoot, pluginDir, pm2Path, qqbotToKarin, raceRequest, randomStr, range, read, readFile, readJson, readJsonSync, redis2 as redis, redisSqlite3Path, registerBot, registerRender, removeTaskCallback, render, renderHtml, renderMultiHtml, renderTpl, requireFile, requireFileSync, resourcePath, restart, restartDirect, rmSync, router, sandboxDataPath, sandboxTempPath, satisfies, save, segment_exports as segment, select, sendMsg2 as sendMsg, sender, senderDirect, senderFriend, senderGroup, senderGroupTemp, senderGuild, sep, server, setTaskCallback, setTaskDatabase, splitPath, start2 as start, stream, stringifyError, switchComponent, system_exports as system, taskAdd, taskExists, taskGet, taskList, taskSystem, taskUpdateLogs, taskUpdateStatus, tempPath, unregisterBot, unregisterRender, updateAllGitPlugin, updateAllPkg, updateGitPlugin, updatePkg, updateTaskLogs, updateTaskStatus, uptime, urlToPath, waitPort, watch, watchAndMerge, write, writeJson, writeJsonSync, yaml3 as yaml };
|