claude-threads 1.9.4 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/index.js +1199 -3173
- package/dist/mcp/permission-server.js +690 -2143
- package/package.json +2 -6
|
@@ -3352,49 +3352,49 @@ var require_schemes = __commonJS((exports, module) => {
|
|
|
3352
3352
|
wsComponent.fragment = undefined;
|
|
3353
3353
|
return wsComponent;
|
|
3354
3354
|
}
|
|
3355
|
-
function urnParse(urnComponent,
|
|
3355
|
+
function urnParse(urnComponent, options) {
|
|
3356
3356
|
if (!urnComponent.path) {
|
|
3357
3357
|
urnComponent.error = "URN can not be parsed";
|
|
3358
3358
|
return urnComponent;
|
|
3359
3359
|
}
|
|
3360
3360
|
const matches = urnComponent.path.match(URN_REG);
|
|
3361
3361
|
if (matches) {
|
|
3362
|
-
const scheme =
|
|
3362
|
+
const scheme = options.scheme || urnComponent.scheme || "urn";
|
|
3363
3363
|
urnComponent.nid = matches[1].toLowerCase();
|
|
3364
3364
|
urnComponent.nss = matches[2];
|
|
3365
|
-
const urnScheme = `${scheme}:${
|
|
3365
|
+
const urnScheme = `${scheme}:${options.nid || urnComponent.nid}`;
|
|
3366
3366
|
const schemeHandler = getSchemeHandler(urnScheme);
|
|
3367
3367
|
urnComponent.path = undefined;
|
|
3368
3368
|
if (schemeHandler) {
|
|
3369
|
-
urnComponent = schemeHandler.parse(urnComponent,
|
|
3369
|
+
urnComponent = schemeHandler.parse(urnComponent, options);
|
|
3370
3370
|
}
|
|
3371
3371
|
} else {
|
|
3372
3372
|
urnComponent.error = urnComponent.error || "URN can not be parsed.";
|
|
3373
3373
|
}
|
|
3374
3374
|
return urnComponent;
|
|
3375
3375
|
}
|
|
3376
|
-
function urnSerialize(urnComponent,
|
|
3376
|
+
function urnSerialize(urnComponent, options) {
|
|
3377
3377
|
if (urnComponent.nid === undefined) {
|
|
3378
3378
|
throw new Error("URN without nid cannot be serialized");
|
|
3379
3379
|
}
|
|
3380
|
-
const scheme =
|
|
3380
|
+
const scheme = options.scheme || urnComponent.scheme || "urn";
|
|
3381
3381
|
const nid = urnComponent.nid.toLowerCase();
|
|
3382
|
-
const urnScheme = `${scheme}:${
|
|
3382
|
+
const urnScheme = `${scheme}:${options.nid || nid}`;
|
|
3383
3383
|
const schemeHandler = getSchemeHandler(urnScheme);
|
|
3384
3384
|
if (schemeHandler) {
|
|
3385
|
-
urnComponent = schemeHandler.serialize(urnComponent,
|
|
3385
|
+
urnComponent = schemeHandler.serialize(urnComponent, options);
|
|
3386
3386
|
}
|
|
3387
3387
|
const uriComponent = urnComponent;
|
|
3388
3388
|
const nss = urnComponent.nss;
|
|
3389
|
-
uriComponent.path = `${nid ||
|
|
3390
|
-
|
|
3389
|
+
uriComponent.path = `${nid || options.nid}:${nss}`;
|
|
3390
|
+
options.skipEscape = true;
|
|
3391
3391
|
return uriComponent;
|
|
3392
3392
|
}
|
|
3393
|
-
function urnuuidParse(urnComponent,
|
|
3393
|
+
function urnuuidParse(urnComponent, options) {
|
|
3394
3394
|
const uuidComponent = urnComponent;
|
|
3395
3395
|
uuidComponent.uuid = uuidComponent.nss;
|
|
3396
3396
|
uuidComponent.nss = undefined;
|
|
3397
|
-
if (!
|
|
3397
|
+
if (!options.tolerant && (!uuidComponent.uuid || !isUUID(uuidComponent.uuid))) {
|
|
3398
3398
|
uuidComponent.error = uuidComponent.error || "UUID is not valid.";
|
|
3399
3399
|
}
|
|
3400
3400
|
return uuidComponent;
|
|
@@ -3464,28 +3464,28 @@ var require_schemes = __commonJS((exports, module) => {
|
|
|
3464
3464
|
var require_fast_uri = __commonJS((exports, module) => {
|
|
3465
3465
|
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils();
|
|
3466
3466
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
3467
|
-
function normalize(uri,
|
|
3467
|
+
function normalize(uri, options) {
|
|
3468
3468
|
if (typeof uri === "string") {
|
|
3469
|
-
uri = serialize(parse6(uri,
|
|
3469
|
+
uri = serialize(parse6(uri, options), options);
|
|
3470
3470
|
} else if (typeof uri === "object") {
|
|
3471
|
-
uri = parse6(serialize(uri,
|
|
3471
|
+
uri = parse6(serialize(uri, options), options);
|
|
3472
3472
|
}
|
|
3473
3473
|
return uri;
|
|
3474
3474
|
}
|
|
3475
|
-
function resolve(baseURI, relativeURI,
|
|
3476
|
-
const schemelessOptions =
|
|
3475
|
+
function resolve(baseURI, relativeURI, options) {
|
|
3476
|
+
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
3477
3477
|
const resolved = resolveComponent(parse6(baseURI, schemelessOptions), parse6(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
3478
3478
|
schemelessOptions.skipEscape = true;
|
|
3479
3479
|
return serialize(resolved, schemelessOptions);
|
|
3480
3480
|
}
|
|
3481
|
-
function resolveComponent(base, relative,
|
|
3481
|
+
function resolveComponent(base, relative, options, skipNormalization) {
|
|
3482
3482
|
const target = {};
|
|
3483
3483
|
if (!skipNormalization) {
|
|
3484
|
-
base = parse6(serialize(base,
|
|
3485
|
-
relative = parse6(serialize(relative,
|
|
3484
|
+
base = parse6(serialize(base, options), options);
|
|
3485
|
+
relative = parse6(serialize(relative, options), options);
|
|
3486
3486
|
}
|
|
3487
|
-
|
|
3488
|
-
if (!
|
|
3487
|
+
options = options || {};
|
|
3488
|
+
if (!options.tolerant && relative.scheme) {
|
|
3489
3489
|
target.scheme = relative.scheme;
|
|
3490
3490
|
target.userinfo = relative.userinfo;
|
|
3491
3491
|
target.host = relative.host;
|
|
@@ -3531,18 +3531,18 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
3531
3531
|
target.fragment = relative.fragment;
|
|
3532
3532
|
return target;
|
|
3533
3533
|
}
|
|
3534
|
-
function equal(uriA, uriB,
|
|
3534
|
+
function equal(uriA, uriB, options) {
|
|
3535
3535
|
if (typeof uriA === "string") {
|
|
3536
3536
|
uriA = unescape(uriA);
|
|
3537
|
-
uriA = serialize(normalizeComponentEncoding(parse6(uriA,
|
|
3537
|
+
uriA = serialize(normalizeComponentEncoding(parse6(uriA, options), true), { ...options, skipEscape: true });
|
|
3538
3538
|
} else if (typeof uriA === "object") {
|
|
3539
|
-
uriA = serialize(normalizeComponentEncoding(uriA, true), { ...
|
|
3539
|
+
uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
|
|
3540
3540
|
}
|
|
3541
3541
|
if (typeof uriB === "string") {
|
|
3542
3542
|
uriB = unescape(uriB);
|
|
3543
|
-
uriB = serialize(normalizeComponentEncoding(parse6(uriB,
|
|
3543
|
+
uriB = serialize(normalizeComponentEncoding(parse6(uriB, options), true), { ...options, skipEscape: true });
|
|
3544
3544
|
} else if (typeof uriB === "object") {
|
|
3545
|
-
uriB = serialize(normalizeComponentEncoding(uriB, true), { ...
|
|
3545
|
+
uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
|
|
3546
3546
|
}
|
|
3547
3547
|
return uriA.toLowerCase() === uriB.toLowerCase();
|
|
3548
3548
|
}
|
|
@@ -3563,13 +3563,13 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
3563
3563
|
secure: cmpts.secure,
|
|
3564
3564
|
error: ""
|
|
3565
3565
|
};
|
|
3566
|
-
const
|
|
3566
|
+
const options = Object.assign({}, opts);
|
|
3567
3567
|
const uriTokens = [];
|
|
3568
|
-
const schemeHandler = getSchemeHandler(
|
|
3568
|
+
const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
|
|
3569
3569
|
if (schemeHandler && schemeHandler.serialize)
|
|
3570
|
-
schemeHandler.serialize(component,
|
|
3570
|
+
schemeHandler.serialize(component, options);
|
|
3571
3571
|
if (component.path !== undefined) {
|
|
3572
|
-
if (!
|
|
3572
|
+
if (!options.skipEscape) {
|
|
3573
3573
|
component.path = escape(component.path);
|
|
3574
3574
|
if (component.scheme !== undefined) {
|
|
3575
3575
|
component.path = component.path.split("%3A").join(":");
|
|
@@ -3578,12 +3578,12 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
3578
3578
|
component.path = unescape(component.path);
|
|
3579
3579
|
}
|
|
3580
3580
|
}
|
|
3581
|
-
if (
|
|
3581
|
+
if (options.reference !== "suffix" && component.scheme) {
|
|
3582
3582
|
uriTokens.push(component.scheme, ":");
|
|
3583
3583
|
}
|
|
3584
3584
|
const authority = recomposeAuthority(component);
|
|
3585
3585
|
if (authority !== undefined) {
|
|
3586
|
-
if (
|
|
3586
|
+
if (options.reference !== "suffix") {
|
|
3587
3587
|
uriTokens.push("//");
|
|
3588
3588
|
}
|
|
3589
3589
|
uriTokens.push(authority);
|
|
@@ -3593,7 +3593,7 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
3593
3593
|
}
|
|
3594
3594
|
if (component.path !== undefined) {
|
|
3595
3595
|
let s = component.path;
|
|
3596
|
-
if (!
|
|
3596
|
+
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
|
|
3597
3597
|
s = removeDotSegments(s);
|
|
3598
3598
|
}
|
|
3599
3599
|
if (authority === undefined && s[0] === "/" && s[1] === "/") {
|
|
@@ -3611,7 +3611,7 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
3611
3611
|
}
|
|
3612
3612
|
var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
3613
3613
|
function parse6(uri, opts) {
|
|
3614
|
-
const
|
|
3614
|
+
const options = Object.assign({}, opts);
|
|
3615
3615
|
const parsed = {
|
|
3616
3616
|
scheme: undefined,
|
|
3617
3617
|
userinfo: undefined,
|
|
@@ -3622,9 +3622,9 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
3622
3622
|
fragment: undefined
|
|
3623
3623
|
};
|
|
3624
3624
|
let isIP = false;
|
|
3625
|
-
if (
|
|
3626
|
-
if (
|
|
3627
|
-
uri =
|
|
3625
|
+
if (options.reference === "suffix") {
|
|
3626
|
+
if (options.scheme) {
|
|
3627
|
+
uri = options.scheme + ":" + uri;
|
|
3628
3628
|
} else {
|
|
3629
3629
|
uri = "//" + uri;
|
|
3630
3630
|
}
|
|
@@ -3660,12 +3660,12 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
3660
3660
|
} else {
|
|
3661
3661
|
parsed.reference = "uri";
|
|
3662
3662
|
}
|
|
3663
|
-
if (
|
|
3664
|
-
parsed.error = parsed.error || "URI is not a " +
|
|
3663
|
+
if (options.reference && options.reference !== "suffix" && options.reference !== parsed.reference) {
|
|
3664
|
+
parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
|
|
3665
3665
|
}
|
|
3666
|
-
const schemeHandler = getSchemeHandler(
|
|
3667
|
-
if (!
|
|
3668
|
-
if (parsed.host && (
|
|
3666
|
+
const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
|
|
3667
|
+
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
|
|
3668
|
+
if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
|
|
3669
3669
|
try {
|
|
3670
3670
|
parsed.host = URL.domainToASCII(parsed.host.toLowerCase());
|
|
3671
3671
|
} catch (e) {
|
|
@@ -3690,7 +3690,7 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
3690
3690
|
}
|
|
3691
3691
|
}
|
|
3692
3692
|
if (schemeHandler && schemeHandler.parse) {
|
|
3693
|
-
schemeHandler.parse(parsed,
|
|
3693
|
+
schemeHandler.parse(parsed, options);
|
|
3694
3694
|
}
|
|
3695
3695
|
} else {
|
|
3696
3696
|
parsed.error = parsed.error || "URI can not be parsed.";
|
|
@@ -4186,10 +4186,10 @@ var require_core = __commonJS((exports) => {
|
|
|
4186
4186
|
Ajv.ValidationError = validation_error_1.default;
|
|
4187
4187
|
Ajv.MissingRefError = ref_error_1.default;
|
|
4188
4188
|
exports.default = Ajv;
|
|
4189
|
-
function checkOptions(checkOpts,
|
|
4189
|
+
function checkOptions(checkOpts, options, msg, log = "error") {
|
|
4190
4190
|
for (const key in checkOpts) {
|
|
4191
4191
|
const opt = key;
|
|
4192
|
-
if (opt in
|
|
4192
|
+
if (opt in options)
|
|
4193
4193
|
this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`);
|
|
4194
4194
|
}
|
|
4195
4195
|
}
|
|
@@ -9819,10 +9819,10 @@ var require_core3 = __commonJS((exports) => {
|
|
|
9819
9819
|
Ajv.ValidationError = validation_error_1.default;
|
|
9820
9820
|
Ajv.MissingRefError = ref_error_1.default;
|
|
9821
9821
|
exports.default = Ajv;
|
|
9822
|
-
function checkOptions(checkOpts,
|
|
9822
|
+
function checkOptions(checkOpts, options, msg, log = "error") {
|
|
9823
9823
|
for (const key in checkOpts) {
|
|
9824
9824
|
const opt = key;
|
|
9825
|
-
if (opt in
|
|
9825
|
+
if (opt in options)
|
|
9826
9826
|
this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`);
|
|
9827
9827
|
}
|
|
9828
9828
|
}
|
|
@@ -12141,14 +12141,14 @@ var require_re = __commonJS((exports, module) => {
|
|
|
12141
12141
|
var require_parse_options = __commonJS((exports, module) => {
|
|
12142
12142
|
var looseOption = Object.freeze({ loose: true });
|
|
12143
12143
|
var emptyOpts = Object.freeze({});
|
|
12144
|
-
var parseOptions = (
|
|
12145
|
-
if (!
|
|
12144
|
+
var parseOptions = (options) => {
|
|
12145
|
+
if (!options) {
|
|
12146
12146
|
return emptyOpts;
|
|
12147
12147
|
}
|
|
12148
|
-
if (typeof
|
|
12148
|
+
if (typeof options !== "object") {
|
|
12149
12149
|
return looseOption;
|
|
12150
12150
|
}
|
|
12151
|
-
return
|
|
12151
|
+
return options;
|
|
12152
12152
|
};
|
|
12153
12153
|
module.exports = parseOptions;
|
|
12154
12154
|
});
|
|
@@ -12184,10 +12184,10 @@ var require_semver = __commonJS((exports, module) => {
|
|
|
12184
12184
|
var { compareIdentifiers } = require_identifiers();
|
|
12185
12185
|
|
|
12186
12186
|
class SemVer {
|
|
12187
|
-
constructor(version3,
|
|
12188
|
-
|
|
12187
|
+
constructor(version3, options) {
|
|
12188
|
+
options = parseOptions(options);
|
|
12189
12189
|
if (version3 instanceof SemVer) {
|
|
12190
|
-
if (version3.loose === !!
|
|
12190
|
+
if (version3.loose === !!options.loose && version3.includePrerelease === !!options.includePrerelease) {
|
|
12191
12191
|
return version3;
|
|
12192
12192
|
} else {
|
|
12193
12193
|
version3 = version3.version;
|
|
@@ -12198,11 +12198,11 @@ var require_semver = __commonJS((exports, module) => {
|
|
|
12198
12198
|
if (version3.length > MAX_LENGTH) {
|
|
12199
12199
|
throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
|
|
12200
12200
|
}
|
|
12201
|
-
debug("SemVer", version3,
|
|
12202
|
-
this.options =
|
|
12203
|
-
this.loose = !!
|
|
12204
|
-
this.includePrerelease = !!
|
|
12205
|
-
const m = version3.trim().match(
|
|
12201
|
+
debug("SemVer", version3, options);
|
|
12202
|
+
this.options = options;
|
|
12203
|
+
this.loose = !!options.loose;
|
|
12204
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
12205
|
+
const m = version3.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
12206
12206
|
if (!m) {
|
|
12207
12207
|
throw new TypeError(`Invalid Version: ${version3}`);
|
|
12208
12208
|
}
|
|
@@ -12447,12 +12447,12 @@ var require_semver = __commonJS((exports, module) => {
|
|
|
12447
12447
|
// node_modules/semver/functions/parse.js
|
|
12448
12448
|
var require_parse = __commonJS((exports, module) => {
|
|
12449
12449
|
var SemVer = require_semver();
|
|
12450
|
-
var parse10 = (version3,
|
|
12450
|
+
var parse10 = (version3, options, throwErrors = false) => {
|
|
12451
12451
|
if (version3 instanceof SemVer) {
|
|
12452
12452
|
return version3;
|
|
12453
12453
|
}
|
|
12454
12454
|
try {
|
|
12455
|
-
return new SemVer(version3,
|
|
12455
|
+
return new SemVer(version3, options);
|
|
12456
12456
|
} catch (er) {
|
|
12457
12457
|
if (!throwErrors) {
|
|
12458
12458
|
return null;
|
|
@@ -12466,8 +12466,8 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
12466
12466
|
// node_modules/semver/functions/valid.js
|
|
12467
12467
|
var require_valid = __commonJS((exports, module) => {
|
|
12468
12468
|
var parse10 = require_parse();
|
|
12469
|
-
var valid = (version3,
|
|
12470
|
-
const v = parse10(version3,
|
|
12469
|
+
var valid = (version3, options) => {
|
|
12470
|
+
const v = parse10(version3, options);
|
|
12471
12471
|
return v ? v.version : null;
|
|
12472
12472
|
};
|
|
12473
12473
|
module.exports = valid;
|
|
@@ -12476,8 +12476,8 @@ var require_valid = __commonJS((exports, module) => {
|
|
|
12476
12476
|
// node_modules/semver/functions/clean.js
|
|
12477
12477
|
var require_clean = __commonJS((exports, module) => {
|
|
12478
12478
|
var parse10 = require_parse();
|
|
12479
|
-
var clean = (version3,
|
|
12480
|
-
const s = parse10(version3.trim().replace(/^[=v]+/, ""),
|
|
12479
|
+
var clean = (version3, options) => {
|
|
12480
|
+
const s = parse10(version3.trim().replace(/^[=v]+/, ""), options);
|
|
12481
12481
|
return s ? s.version : null;
|
|
12482
12482
|
};
|
|
12483
12483
|
module.exports = clean;
|
|
@@ -12486,14 +12486,14 @@ var require_clean = __commonJS((exports, module) => {
|
|
|
12486
12486
|
// node_modules/semver/functions/inc.js
|
|
12487
12487
|
var require_inc = __commonJS((exports, module) => {
|
|
12488
12488
|
var SemVer = require_semver();
|
|
12489
|
-
var inc = (version3, release,
|
|
12490
|
-
if (typeof
|
|
12489
|
+
var inc = (version3, release, options, identifier, identifierBase) => {
|
|
12490
|
+
if (typeof options === "string") {
|
|
12491
12491
|
identifierBase = identifier;
|
|
12492
|
-
identifier =
|
|
12493
|
-
|
|
12492
|
+
identifier = options;
|
|
12493
|
+
options = undefined;
|
|
12494
12494
|
}
|
|
12495
12495
|
try {
|
|
12496
|
-
return new SemVer(version3 instanceof SemVer ? version3.version : version3,
|
|
12496
|
+
return new SemVer(version3 instanceof SemVer ? version3.version : version3, options).inc(release, identifier, identifierBase).version;
|
|
12497
12497
|
} catch (er) {
|
|
12498
12498
|
return null;
|
|
12499
12499
|
}
|
|
@@ -12566,8 +12566,8 @@ var require_patch = __commonJS((exports, module) => {
|
|
|
12566
12566
|
// node_modules/semver/functions/prerelease.js
|
|
12567
12567
|
var require_prerelease = __commonJS((exports, module) => {
|
|
12568
12568
|
var parse10 = require_parse();
|
|
12569
|
-
var prerelease = (version3,
|
|
12570
|
-
const parsed = parse10(version3,
|
|
12569
|
+
var prerelease = (version3, options) => {
|
|
12570
|
+
const parsed = parse10(version3, options);
|
|
12571
12571
|
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
12572
12572
|
};
|
|
12573
12573
|
module.exports = prerelease;
|
|
@@ -12713,7 +12713,7 @@ var require_coerce = __commonJS((exports, module) => {
|
|
|
12713
12713
|
var SemVer = require_semver();
|
|
12714
12714
|
var parse10 = require_parse();
|
|
12715
12715
|
var { safeRe: re, t } = require_re();
|
|
12716
|
-
var coerce = (version3,
|
|
12716
|
+
var coerce = (version3, options) => {
|
|
12717
12717
|
if (version3 instanceof SemVer) {
|
|
12718
12718
|
return version3;
|
|
12719
12719
|
}
|
|
@@ -12723,12 +12723,12 @@ var require_coerce = __commonJS((exports, module) => {
|
|
|
12723
12723
|
if (typeof version3 !== "string") {
|
|
12724
12724
|
return null;
|
|
12725
12725
|
}
|
|
12726
|
-
|
|
12726
|
+
options = options || {};
|
|
12727
12727
|
let match = null;
|
|
12728
|
-
if (!
|
|
12729
|
-
match = version3.match(
|
|
12728
|
+
if (!options.rtl) {
|
|
12729
|
+
match = version3.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
|
|
12730
12730
|
} else {
|
|
12731
|
-
const coerceRtlRegex =
|
|
12731
|
+
const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
|
|
12732
12732
|
let next;
|
|
12733
12733
|
while ((next = coerceRtlRegex.exec(version3)) && (!match || match.index + match[0].length !== version3.length)) {
|
|
12734
12734
|
if (!match || next.index + next[0].length !== match.index + match[0].length) {
|
|
@@ -12744,9 +12744,9 @@ var require_coerce = __commonJS((exports, module) => {
|
|
|
12744
12744
|
const major = match[2];
|
|
12745
12745
|
const minor = match[3] || "0";
|
|
12746
12746
|
const patch = match[4] || "0";
|
|
12747
|
-
const prerelease =
|
|
12748
|
-
const build =
|
|
12749
|
-
return parse10(`${major}.${minor}.${patch}${prerelease}${build}`,
|
|
12747
|
+
const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
|
|
12748
|
+
const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
|
|
12749
|
+
return parse10(`${major}.${minor}.${patch}${prerelease}${build}`, options);
|
|
12750
12750
|
};
|
|
12751
12751
|
module.exports = coerce;
|
|
12752
12752
|
});
|
|
@@ -12791,13 +12791,13 @@ var require_range = __commonJS((exports, module) => {
|
|
|
12791
12791
|
var SPACE_CHARACTERS = /\s+/g;
|
|
12792
12792
|
|
|
12793
12793
|
class Range {
|
|
12794
|
-
constructor(range,
|
|
12795
|
-
|
|
12794
|
+
constructor(range, options) {
|
|
12795
|
+
options = parseOptions(options);
|
|
12796
12796
|
if (range instanceof Range) {
|
|
12797
|
-
if (range.loose === !!
|
|
12797
|
+
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
|
|
12798
12798
|
return range;
|
|
12799
12799
|
} else {
|
|
12800
|
-
return new Range(range.raw,
|
|
12800
|
+
return new Range(range.raw, options);
|
|
12801
12801
|
}
|
|
12802
12802
|
}
|
|
12803
12803
|
if (range instanceof Comparator) {
|
|
@@ -12806,9 +12806,9 @@ var require_range = __commonJS((exports, module) => {
|
|
|
12806
12806
|
this.formatted = undefined;
|
|
12807
12807
|
return this;
|
|
12808
12808
|
}
|
|
12809
|
-
this.options =
|
|
12810
|
-
this.loose = !!
|
|
12811
|
-
this.includePrerelease = !!
|
|
12809
|
+
this.options = options;
|
|
12810
|
+
this.loose = !!options.loose;
|
|
12811
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
12812
12812
|
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
|
|
12813
12813
|
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
12814
12814
|
if (!this.set.length) {
|
|
@@ -12894,15 +12894,15 @@ var require_range = __commonJS((exports, module) => {
|
|
|
12894
12894
|
cache.set(memoKey, result);
|
|
12895
12895
|
return result;
|
|
12896
12896
|
}
|
|
12897
|
-
intersects(range,
|
|
12897
|
+
intersects(range, options) {
|
|
12898
12898
|
if (!(range instanceof Range)) {
|
|
12899
12899
|
throw new TypeError("a Range is required");
|
|
12900
12900
|
}
|
|
12901
12901
|
return this.set.some((thisComparators) => {
|
|
12902
|
-
return isSatisfiable(thisComparators,
|
|
12903
|
-
return isSatisfiable(rangeComparators,
|
|
12902
|
+
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
|
|
12903
|
+
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
12904
12904
|
return rangeComparators.every((rangeComparator) => {
|
|
12905
|
-
return thisComparator.intersects(rangeComparator,
|
|
12905
|
+
return thisComparator.intersects(rangeComparator, options);
|
|
12906
12906
|
});
|
|
12907
12907
|
});
|
|
12908
12908
|
});
|
|
@@ -12944,37 +12944,37 @@ var require_range = __commonJS((exports, module) => {
|
|
|
12944
12944
|
var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
|
|
12945
12945
|
var isNullSet = (c) => c.value === "<0.0.0-0";
|
|
12946
12946
|
var isAny = (c) => c.value === "";
|
|
12947
|
-
var isSatisfiable = (comparators,
|
|
12947
|
+
var isSatisfiable = (comparators, options) => {
|
|
12948
12948
|
let result = true;
|
|
12949
12949
|
const remainingComparators = comparators.slice();
|
|
12950
12950
|
let testComparator = remainingComparators.pop();
|
|
12951
12951
|
while (result && remainingComparators.length) {
|
|
12952
12952
|
result = remainingComparators.every((otherComparator) => {
|
|
12953
|
-
return testComparator.intersects(otherComparator,
|
|
12953
|
+
return testComparator.intersects(otherComparator, options);
|
|
12954
12954
|
});
|
|
12955
12955
|
testComparator = remainingComparators.pop();
|
|
12956
12956
|
}
|
|
12957
12957
|
return result;
|
|
12958
12958
|
};
|
|
12959
|
-
var parseComparator = (comp,
|
|
12959
|
+
var parseComparator = (comp, options) => {
|
|
12960
12960
|
comp = comp.replace(re[t.BUILD], "");
|
|
12961
|
-
debug("comp", comp,
|
|
12962
|
-
comp = replaceCarets(comp,
|
|
12961
|
+
debug("comp", comp, options);
|
|
12962
|
+
comp = replaceCarets(comp, options);
|
|
12963
12963
|
debug("caret", comp);
|
|
12964
|
-
comp = replaceTildes(comp,
|
|
12964
|
+
comp = replaceTildes(comp, options);
|
|
12965
12965
|
debug("tildes", comp);
|
|
12966
|
-
comp = replaceXRanges(comp,
|
|
12966
|
+
comp = replaceXRanges(comp, options);
|
|
12967
12967
|
debug("xrange", comp);
|
|
12968
|
-
comp = replaceStars(comp,
|
|
12968
|
+
comp = replaceStars(comp, options);
|
|
12969
12969
|
debug("stars", comp);
|
|
12970
12970
|
return comp;
|
|
12971
12971
|
};
|
|
12972
12972
|
var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
12973
|
-
var replaceTildes = (comp,
|
|
12974
|
-
return comp.trim().split(/\s+/).map((c) => replaceTilde(c,
|
|
12973
|
+
var replaceTildes = (comp, options) => {
|
|
12974
|
+
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
12975
12975
|
};
|
|
12976
|
-
var replaceTilde = (comp,
|
|
12977
|
-
const r =
|
|
12976
|
+
var replaceTilde = (comp, options) => {
|
|
12977
|
+
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
12978
12978
|
return comp.replace(r, (_, M, m, p, pr) => {
|
|
12979
12979
|
debug("tilde", comp, _, M, m, p, pr);
|
|
12980
12980
|
let ret;
|
|
@@ -12994,13 +12994,13 @@ var require_range = __commonJS((exports, module) => {
|
|
|
12994
12994
|
return ret;
|
|
12995
12995
|
});
|
|
12996
12996
|
};
|
|
12997
|
-
var replaceCarets = (comp,
|
|
12998
|
-
return comp.trim().split(/\s+/).map((c) => replaceCaret(c,
|
|
12997
|
+
var replaceCarets = (comp, options) => {
|
|
12998
|
+
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
|
12999
12999
|
};
|
|
13000
|
-
var replaceCaret = (comp,
|
|
13001
|
-
debug("caret", comp,
|
|
13002
|
-
const r =
|
|
13003
|
-
const z2 =
|
|
13000
|
+
var replaceCaret = (comp, options) => {
|
|
13001
|
+
debug("caret", comp, options);
|
|
13002
|
+
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
13003
|
+
const z2 = options.includePrerelease ? "-0" : "";
|
|
13004
13004
|
return comp.replace(r, (_, M, m, p, pr) => {
|
|
13005
13005
|
debug("caret", comp, _, M, m, p, pr);
|
|
13006
13006
|
let ret;
|
|
@@ -13041,13 +13041,13 @@ var require_range = __commonJS((exports, module) => {
|
|
|
13041
13041
|
return ret;
|
|
13042
13042
|
});
|
|
13043
13043
|
};
|
|
13044
|
-
var replaceXRanges = (comp,
|
|
13045
|
-
debug("replaceXRanges", comp,
|
|
13046
|
-
return comp.split(/\s+/).map((c) => replaceXRange(c,
|
|
13044
|
+
var replaceXRanges = (comp, options) => {
|
|
13045
|
+
debug("replaceXRanges", comp, options);
|
|
13046
|
+
return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
|
|
13047
13047
|
};
|
|
13048
|
-
var replaceXRange = (comp,
|
|
13048
|
+
var replaceXRange = (comp, options) => {
|
|
13049
13049
|
comp = comp.trim();
|
|
13050
|
-
const r =
|
|
13050
|
+
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
13051
13051
|
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
13052
13052
|
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
13053
13053
|
const xM = isX(M);
|
|
@@ -13057,7 +13057,7 @@ var require_range = __commonJS((exports, module) => {
|
|
|
13057
13057
|
if (gtlt === "=" && anyX) {
|
|
13058
13058
|
gtlt = "";
|
|
13059
13059
|
}
|
|
13060
|
-
pr =
|
|
13060
|
+
pr = options.includePrerelease ? "-0" : "";
|
|
13061
13061
|
if (xM) {
|
|
13062
13062
|
if (gtlt === ">" || gtlt === "<") {
|
|
13063
13063
|
ret = "<0.0.0-0";
|
|
@@ -13100,13 +13100,13 @@ var require_range = __commonJS((exports, module) => {
|
|
|
13100
13100
|
return ret;
|
|
13101
13101
|
});
|
|
13102
13102
|
};
|
|
13103
|
-
var replaceStars = (comp,
|
|
13104
|
-
debug("replaceStars", comp,
|
|
13103
|
+
var replaceStars = (comp, options) => {
|
|
13104
|
+
debug("replaceStars", comp, options);
|
|
13105
13105
|
return comp.trim().replace(re[t.STAR], "");
|
|
13106
13106
|
};
|
|
13107
|
-
var replaceGTE0 = (comp,
|
|
13108
|
-
debug("replaceGTE0", comp,
|
|
13109
|
-
return comp.trim().replace(re[
|
|
13107
|
+
var replaceGTE0 = (comp, options) => {
|
|
13108
|
+
debug("replaceGTE0", comp, options);
|
|
13109
|
+
return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
13110
13110
|
};
|
|
13111
13111
|
var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
13112
13112
|
if (isX(fM)) {
|
|
@@ -13135,13 +13135,13 @@ var require_range = __commonJS((exports, module) => {
|
|
|
13135
13135
|
}
|
|
13136
13136
|
return `${from} ${to}`.trim();
|
|
13137
13137
|
};
|
|
13138
|
-
var testSet = (set3, version3,
|
|
13138
|
+
var testSet = (set3, version3, options) => {
|
|
13139
13139
|
for (let i = 0;i < set3.length; i++) {
|
|
13140
13140
|
if (!set3[i].test(version3)) {
|
|
13141
13141
|
return false;
|
|
13142
13142
|
}
|
|
13143
13143
|
}
|
|
13144
|
-
if (version3.prerelease.length && !
|
|
13144
|
+
if (version3.prerelease.length && !options.includePrerelease) {
|
|
13145
13145
|
for (let i = 0;i < set3.length; i++) {
|
|
13146
13146
|
debug(set3[i].semver);
|
|
13147
13147
|
if (set3[i].semver === Comparator.ANY) {
|
|
@@ -13168,19 +13168,19 @@ var require_comparator = __commonJS((exports, module) => {
|
|
|
13168
13168
|
static get ANY() {
|
|
13169
13169
|
return ANY;
|
|
13170
13170
|
}
|
|
13171
|
-
constructor(comp,
|
|
13172
|
-
|
|
13171
|
+
constructor(comp, options) {
|
|
13172
|
+
options = parseOptions(options);
|
|
13173
13173
|
if (comp instanceof Comparator) {
|
|
13174
|
-
if (comp.loose === !!
|
|
13174
|
+
if (comp.loose === !!options.loose) {
|
|
13175
13175
|
return comp;
|
|
13176
13176
|
} else {
|
|
13177
13177
|
comp = comp.value;
|
|
13178
13178
|
}
|
|
13179
13179
|
}
|
|
13180
13180
|
comp = comp.trim().split(/\s+/).join(" ");
|
|
13181
|
-
debug("comparator", comp,
|
|
13182
|
-
this.options =
|
|
13183
|
-
this.loose = !!
|
|
13181
|
+
debug("comparator", comp, options);
|
|
13182
|
+
this.options = options;
|
|
13183
|
+
this.loose = !!options.loose;
|
|
13184
13184
|
this.parse(comp);
|
|
13185
13185
|
if (this.semver === ANY) {
|
|
13186
13186
|
this.value = "";
|
|
@@ -13222,7 +13222,7 @@ var require_comparator = __commonJS((exports, module) => {
|
|
|
13222
13222
|
}
|
|
13223
13223
|
return cmp(version3, this.operator, this.semver, this.options);
|
|
13224
13224
|
}
|
|
13225
|
-
intersects(comp,
|
|
13225
|
+
intersects(comp, options) {
|
|
13226
13226
|
if (!(comp instanceof Comparator)) {
|
|
13227
13227
|
throw new TypeError("a Comparator is required");
|
|
13228
13228
|
}
|
|
@@ -13230,18 +13230,18 @@ var require_comparator = __commonJS((exports, module) => {
|
|
|
13230
13230
|
if (this.value === "") {
|
|
13231
13231
|
return true;
|
|
13232
13232
|
}
|
|
13233
|
-
return new Range(comp.value,
|
|
13233
|
+
return new Range(comp.value, options).test(this.value);
|
|
13234
13234
|
} else if (comp.operator === "") {
|
|
13235
13235
|
if (comp.value === "") {
|
|
13236
13236
|
return true;
|
|
13237
13237
|
}
|
|
13238
|
-
return new Range(this.value,
|
|
13238
|
+
return new Range(this.value, options).test(comp.semver);
|
|
13239
13239
|
}
|
|
13240
|
-
|
|
13241
|
-
if (
|
|
13240
|
+
options = parseOptions(options);
|
|
13241
|
+
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
|
|
13242
13242
|
return false;
|
|
13243
13243
|
}
|
|
13244
|
-
if (!
|
|
13244
|
+
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
|
|
13245
13245
|
return false;
|
|
13246
13246
|
}
|
|
13247
13247
|
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
|
|
@@ -13253,10 +13253,10 @@ var require_comparator = __commonJS((exports, module) => {
|
|
|
13253
13253
|
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
|
|
13254
13254
|
return true;
|
|
13255
13255
|
}
|
|
13256
|
-
if (cmp(this.semver, "<", comp.semver,
|
|
13256
|
+
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
|
|
13257
13257
|
return true;
|
|
13258
13258
|
}
|
|
13259
|
-
if (cmp(this.semver, ">", comp.semver,
|
|
13259
|
+
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
|
|
13260
13260
|
return true;
|
|
13261
13261
|
}
|
|
13262
13262
|
return false;
|
|
@@ -13274,9 +13274,9 @@ var require_comparator = __commonJS((exports, module) => {
|
|
|
13274
13274
|
// node_modules/semver/functions/satisfies.js
|
|
13275
13275
|
var require_satisfies = __commonJS((exports, module) => {
|
|
13276
13276
|
var Range = require_range();
|
|
13277
|
-
var satisfies = (version3, range,
|
|
13277
|
+
var satisfies = (version3, range, options) => {
|
|
13278
13278
|
try {
|
|
13279
|
-
range = new Range(range,
|
|
13279
|
+
range = new Range(range, options);
|
|
13280
13280
|
} catch (er) {
|
|
13281
13281
|
return false;
|
|
13282
13282
|
}
|
|
@@ -13288,7 +13288,7 @@ var require_satisfies = __commonJS((exports, module) => {
|
|
|
13288
13288
|
// node_modules/semver/ranges/to-comparators.js
|
|
13289
13289
|
var require_to_comparators = __commonJS((exports, module) => {
|
|
13290
13290
|
var Range = require_range();
|
|
13291
|
-
var toComparators = (range,
|
|
13291
|
+
var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
13292
13292
|
module.exports = toComparators;
|
|
13293
13293
|
});
|
|
13294
13294
|
|
|
@@ -13296,12 +13296,12 @@ var require_to_comparators = __commonJS((exports, module) => {
|
|
|
13296
13296
|
var require_max_satisfying = __commonJS((exports, module) => {
|
|
13297
13297
|
var SemVer = require_semver();
|
|
13298
13298
|
var Range = require_range();
|
|
13299
|
-
var maxSatisfying = (versions3, range,
|
|
13299
|
+
var maxSatisfying = (versions3, range, options) => {
|
|
13300
13300
|
let max = null;
|
|
13301
13301
|
let maxSV = null;
|
|
13302
13302
|
let rangeObj = null;
|
|
13303
13303
|
try {
|
|
13304
|
-
rangeObj = new Range(range,
|
|
13304
|
+
rangeObj = new Range(range, options);
|
|
13305
13305
|
} catch (er) {
|
|
13306
13306
|
return null;
|
|
13307
13307
|
}
|
|
@@ -13309,7 +13309,7 @@ var require_max_satisfying = __commonJS((exports, module) => {
|
|
|
13309
13309
|
if (rangeObj.test(v)) {
|
|
13310
13310
|
if (!max || maxSV.compare(v) === -1) {
|
|
13311
13311
|
max = v;
|
|
13312
|
-
maxSV = new SemVer(max,
|
|
13312
|
+
maxSV = new SemVer(max, options);
|
|
13313
13313
|
}
|
|
13314
13314
|
}
|
|
13315
13315
|
});
|
|
@@ -13322,12 +13322,12 @@ var require_max_satisfying = __commonJS((exports, module) => {
|
|
|
13322
13322
|
var require_min_satisfying = __commonJS((exports, module) => {
|
|
13323
13323
|
var SemVer = require_semver();
|
|
13324
13324
|
var Range = require_range();
|
|
13325
|
-
var minSatisfying = (versions3, range,
|
|
13325
|
+
var minSatisfying = (versions3, range, options) => {
|
|
13326
13326
|
let min = null;
|
|
13327
13327
|
let minSV = null;
|
|
13328
13328
|
let rangeObj = null;
|
|
13329
13329
|
try {
|
|
13330
|
-
rangeObj = new Range(range,
|
|
13330
|
+
rangeObj = new Range(range, options);
|
|
13331
13331
|
} catch (er) {
|
|
13332
13332
|
return null;
|
|
13333
13333
|
}
|
|
@@ -13335,7 +13335,7 @@ var require_min_satisfying = __commonJS((exports, module) => {
|
|
|
13335
13335
|
if (rangeObj.test(v)) {
|
|
13336
13336
|
if (!min || minSV.compare(v) === 1) {
|
|
13337
13337
|
min = v;
|
|
13338
|
-
minSV = new SemVer(min,
|
|
13338
|
+
minSV = new SemVer(min, options);
|
|
13339
13339
|
}
|
|
13340
13340
|
}
|
|
13341
13341
|
});
|
|
@@ -13401,9 +13401,9 @@ var require_min_version = __commonJS((exports, module) => {
|
|
|
13401
13401
|
// node_modules/semver/ranges/valid.js
|
|
13402
13402
|
var require_valid2 = __commonJS((exports, module) => {
|
|
13403
13403
|
var Range = require_range();
|
|
13404
|
-
var validRange = (range,
|
|
13404
|
+
var validRange = (range, options) => {
|
|
13405
13405
|
try {
|
|
13406
|
-
return new Range(range,
|
|
13406
|
+
return new Range(range, options).range || "*";
|
|
13407
13407
|
} catch (er) {
|
|
13408
13408
|
return null;
|
|
13409
13409
|
}
|
|
@@ -13422,9 +13422,9 @@ var require_outside = __commonJS((exports, module) => {
|
|
|
13422
13422
|
var lt = require_lt();
|
|
13423
13423
|
var lte = require_lte();
|
|
13424
13424
|
var gte = require_gte();
|
|
13425
|
-
var outside = (version3, range, hilo,
|
|
13426
|
-
version3 = new SemVer(version3,
|
|
13427
|
-
range = new Range(range,
|
|
13425
|
+
var outside = (version3, range, hilo, options) => {
|
|
13426
|
+
version3 = new SemVer(version3, options);
|
|
13427
|
+
range = new Range(range, options);
|
|
13428
13428
|
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
13429
13429
|
switch (hilo) {
|
|
13430
13430
|
case ">":
|
|
@@ -13444,7 +13444,7 @@ var require_outside = __commonJS((exports, module) => {
|
|
|
13444
13444
|
default:
|
|
13445
13445
|
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
13446
13446
|
}
|
|
13447
|
-
if (satisfies(version3, range,
|
|
13447
|
+
if (satisfies(version3, range, options)) {
|
|
13448
13448
|
return false;
|
|
13449
13449
|
}
|
|
13450
13450
|
for (let i = 0;i < range.set.length; ++i) {
|
|
@@ -13457,9 +13457,9 @@ var require_outside = __commonJS((exports, module) => {
|
|
|
13457
13457
|
}
|
|
13458
13458
|
high = high || comparator;
|
|
13459
13459
|
low = low || comparator;
|
|
13460
|
-
if (gtfn(comparator.semver, high.semver,
|
|
13460
|
+
if (gtfn(comparator.semver, high.semver, options)) {
|
|
13461
13461
|
high = comparator;
|
|
13462
|
-
} else if (ltfn(comparator.semver, low.semver,
|
|
13462
|
+
} else if (ltfn(comparator.semver, low.semver, options)) {
|
|
13463
13463
|
low = comparator;
|
|
13464
13464
|
}
|
|
13465
13465
|
});
|
|
@@ -13480,24 +13480,24 @@ var require_outside = __commonJS((exports, module) => {
|
|
|
13480
13480
|
// node_modules/semver/ranges/gtr.js
|
|
13481
13481
|
var require_gtr = __commonJS((exports, module) => {
|
|
13482
13482
|
var outside = require_outside();
|
|
13483
|
-
var gtr = (version3, range,
|
|
13483
|
+
var gtr = (version3, range, options) => outside(version3, range, ">", options);
|
|
13484
13484
|
module.exports = gtr;
|
|
13485
13485
|
});
|
|
13486
13486
|
|
|
13487
13487
|
// node_modules/semver/ranges/ltr.js
|
|
13488
13488
|
var require_ltr = __commonJS((exports, module) => {
|
|
13489
13489
|
var outside = require_outside();
|
|
13490
|
-
var ltr = (version3, range,
|
|
13490
|
+
var ltr = (version3, range, options) => outside(version3, range, "<", options);
|
|
13491
13491
|
module.exports = ltr;
|
|
13492
13492
|
});
|
|
13493
13493
|
|
|
13494
13494
|
// node_modules/semver/ranges/intersects.js
|
|
13495
13495
|
var require_intersects = __commonJS((exports, module) => {
|
|
13496
13496
|
var Range = require_range();
|
|
13497
|
-
var intersects = (r1, r2,
|
|
13498
|
-
r1 = new Range(r1,
|
|
13499
|
-
r2 = new Range(r2,
|
|
13500
|
-
return r1.intersects(r2,
|
|
13497
|
+
var intersects = (r1, r2, options) => {
|
|
13498
|
+
r1 = new Range(r1, options);
|
|
13499
|
+
r2 = new Range(r2, options);
|
|
13500
|
+
return r1.intersects(r2, options);
|
|
13501
13501
|
};
|
|
13502
13502
|
module.exports = intersects;
|
|
13503
13503
|
});
|
|
@@ -13506,13 +13506,13 @@ var require_intersects = __commonJS((exports, module) => {
|
|
|
13506
13506
|
var require_simplify = __commonJS((exports, module) => {
|
|
13507
13507
|
var satisfies = require_satisfies();
|
|
13508
13508
|
var compare = require_compare();
|
|
13509
|
-
module.exports = (versions3, range,
|
|
13509
|
+
module.exports = (versions3, range, options) => {
|
|
13510
13510
|
const set3 = [];
|
|
13511
13511
|
let first = null;
|
|
13512
13512
|
let prev = null;
|
|
13513
|
-
const v = versions3.sort((a, b) => compare(a, b,
|
|
13513
|
+
const v = versions3.sort((a, b) => compare(a, b, options));
|
|
13514
13514
|
for (const version3 of v) {
|
|
13515
|
-
const included = satisfies(version3, range,
|
|
13515
|
+
const included = satisfies(version3, range, options);
|
|
13516
13516
|
if (included) {
|
|
13517
13517
|
prev = version3;
|
|
13518
13518
|
if (!first) {
|
|
@@ -13556,17 +13556,17 @@ var require_subset = __commonJS((exports, module) => {
|
|
|
13556
13556
|
var { ANY } = Comparator;
|
|
13557
13557
|
var satisfies = require_satisfies();
|
|
13558
13558
|
var compare = require_compare();
|
|
13559
|
-
var subset = (sub, dom,
|
|
13559
|
+
var subset = (sub, dom, options = {}) => {
|
|
13560
13560
|
if (sub === dom) {
|
|
13561
13561
|
return true;
|
|
13562
13562
|
}
|
|
13563
|
-
sub = new Range(sub,
|
|
13564
|
-
dom = new Range(dom,
|
|
13563
|
+
sub = new Range(sub, options);
|
|
13564
|
+
dom = new Range(dom, options);
|
|
13565
13565
|
let sawNonNull = false;
|
|
13566
13566
|
OUTER:
|
|
13567
13567
|
for (const simpleSub of sub.set) {
|
|
13568
13568
|
for (const simpleDom of dom.set) {
|
|
13569
|
-
const isSub = simpleSubset(simpleSub, simpleDom,
|
|
13569
|
+
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
13570
13570
|
sawNonNull = sawNonNull || isSub !== null;
|
|
13571
13571
|
if (isSub) {
|
|
13572
13572
|
continue OUTER;
|
|
@@ -13580,21 +13580,21 @@ var require_subset = __commonJS((exports, module) => {
|
|
|
13580
13580
|
};
|
|
13581
13581
|
var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
13582
13582
|
var minimumVersion = [new Comparator(">=0.0.0")];
|
|
13583
|
-
var simpleSubset = (sub, dom,
|
|
13583
|
+
var simpleSubset = (sub, dom, options) => {
|
|
13584
13584
|
if (sub === dom) {
|
|
13585
13585
|
return true;
|
|
13586
13586
|
}
|
|
13587
13587
|
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
13588
13588
|
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
13589
13589
|
return true;
|
|
13590
|
-
} else if (
|
|
13590
|
+
} else if (options.includePrerelease) {
|
|
13591
13591
|
sub = minimumVersionWithPreRelease;
|
|
13592
13592
|
} else {
|
|
13593
13593
|
sub = minimumVersion;
|
|
13594
13594
|
}
|
|
13595
13595
|
}
|
|
13596
13596
|
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
13597
|
-
if (
|
|
13597
|
+
if (options.includePrerelease) {
|
|
13598
13598
|
return true;
|
|
13599
13599
|
} else {
|
|
13600
13600
|
dom = minimumVersion;
|
|
@@ -13604,9 +13604,9 @@ var require_subset = __commonJS((exports, module) => {
|
|
|
13604
13604
|
let gt, lt;
|
|
13605
13605
|
for (const c of sub) {
|
|
13606
13606
|
if (c.operator === ">" || c.operator === ">=") {
|
|
13607
|
-
gt = higherGT(gt, c,
|
|
13607
|
+
gt = higherGT(gt, c, options);
|
|
13608
13608
|
} else if (c.operator === "<" || c.operator === "<=") {
|
|
13609
|
-
lt = lowerLT(lt, c,
|
|
13609
|
+
lt = lowerLT(lt, c, options);
|
|
13610
13610
|
} else {
|
|
13611
13611
|
eqSet.add(c.semver);
|
|
13612
13612
|
}
|
|
@@ -13616,7 +13616,7 @@ var require_subset = __commonJS((exports, module) => {
|
|
|
13616
13616
|
}
|
|
13617
13617
|
let gtltComp;
|
|
13618
13618
|
if (gt && lt) {
|
|
13619
|
-
gtltComp = compare(gt.semver, lt.semver,
|
|
13619
|
+
gtltComp = compare(gt.semver, lt.semver, options);
|
|
13620
13620
|
if (gtltComp > 0) {
|
|
13621
13621
|
return null;
|
|
13622
13622
|
} else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
|
|
@@ -13624,14 +13624,14 @@ var require_subset = __commonJS((exports, module) => {
|
|
|
13624
13624
|
}
|
|
13625
13625
|
}
|
|
13626
13626
|
for (const eq of eqSet) {
|
|
13627
|
-
if (gt && !satisfies(eq, String(gt),
|
|
13627
|
+
if (gt && !satisfies(eq, String(gt), options)) {
|
|
13628
13628
|
return null;
|
|
13629
13629
|
}
|
|
13630
|
-
if (lt && !satisfies(eq, String(lt),
|
|
13630
|
+
if (lt && !satisfies(eq, String(lt), options)) {
|
|
13631
13631
|
return null;
|
|
13632
13632
|
}
|
|
13633
13633
|
for (const c of dom) {
|
|
13634
|
-
if (!satisfies(eq, String(c),
|
|
13634
|
+
if (!satisfies(eq, String(c), options)) {
|
|
13635
13635
|
return false;
|
|
13636
13636
|
}
|
|
13637
13637
|
}
|
|
@@ -13639,8 +13639,8 @@ var require_subset = __commonJS((exports, module) => {
|
|
|
13639
13639
|
}
|
|
13640
13640
|
let higher, lower;
|
|
13641
13641
|
let hasDomLT, hasDomGT;
|
|
13642
|
-
let needDomLTPre = lt && !
|
|
13643
|
-
let needDomGTPre = gt && !
|
|
13642
|
+
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
13643
|
+
let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
13644
13644
|
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
|
|
13645
13645
|
needDomLTPre = false;
|
|
13646
13646
|
}
|
|
@@ -13654,11 +13654,11 @@ var require_subset = __commonJS((exports, module) => {
|
|
|
13654
13654
|
}
|
|
13655
13655
|
}
|
|
13656
13656
|
if (c.operator === ">" || c.operator === ">=") {
|
|
13657
|
-
higher = higherGT(gt, c,
|
|
13657
|
+
higher = higherGT(gt, c, options);
|
|
13658
13658
|
if (higher === c && higher !== gt) {
|
|
13659
13659
|
return false;
|
|
13660
13660
|
}
|
|
13661
|
-
} else if (gt.operator === ">=" && !satisfies(gt.semver, String(c),
|
|
13661
|
+
} else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) {
|
|
13662
13662
|
return false;
|
|
13663
13663
|
}
|
|
13664
13664
|
}
|
|
@@ -13669,11 +13669,11 @@ var require_subset = __commonJS((exports, module) => {
|
|
|
13669
13669
|
}
|
|
13670
13670
|
}
|
|
13671
13671
|
if (c.operator === "<" || c.operator === "<=") {
|
|
13672
|
-
lower = lowerLT(lt, c,
|
|
13672
|
+
lower = lowerLT(lt, c, options);
|
|
13673
13673
|
if (lower === c && lower !== lt) {
|
|
13674
13674
|
return false;
|
|
13675
13675
|
}
|
|
13676
|
-
} else if (lt.operator === "<=" && !satisfies(lt.semver, String(c),
|
|
13676
|
+
} else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) {
|
|
13677
13677
|
return false;
|
|
13678
13678
|
}
|
|
13679
13679
|
}
|
|
@@ -13692,18 +13692,18 @@ var require_subset = __commonJS((exports, module) => {
|
|
|
13692
13692
|
}
|
|
13693
13693
|
return true;
|
|
13694
13694
|
};
|
|
13695
|
-
var higherGT = (a, b,
|
|
13695
|
+
var higherGT = (a, b, options) => {
|
|
13696
13696
|
if (!a) {
|
|
13697
13697
|
return b;
|
|
13698
13698
|
}
|
|
13699
|
-
const comp = compare(a.semver, b.semver,
|
|
13699
|
+
const comp = compare(a.semver, b.semver, options);
|
|
13700
13700
|
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
13701
13701
|
};
|
|
13702
|
-
var lowerLT = (a, b,
|
|
13702
|
+
var lowerLT = (a, b, options) => {
|
|
13703
13703
|
if (!a) {
|
|
13704
13704
|
return b;
|
|
13705
13705
|
}
|
|
13706
|
-
const comp = compare(a.semver, b.semver,
|
|
13706
|
+
const comp = compare(a.semver, b.semver, options);
|
|
13707
13707
|
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
13708
13708
|
};
|
|
13709
13709
|
module.exports = subset;
|
|
@@ -13801,1454 +13801,6 @@ var require_semver2 = __commonJS((exports, module) => {
|
|
|
13801
13801
|
};
|
|
13802
13802
|
});
|
|
13803
13803
|
|
|
13804
|
-
// node_modules/pend/index.js
|
|
13805
|
-
var require_pend = __commonJS((exports, module) => {
|
|
13806
|
-
module.exports = Pend;
|
|
13807
|
-
function Pend() {
|
|
13808
|
-
this.pending = 0;
|
|
13809
|
-
this.max = Infinity;
|
|
13810
|
-
this.listeners = [];
|
|
13811
|
-
this.waiting = [];
|
|
13812
|
-
this.error = null;
|
|
13813
|
-
}
|
|
13814
|
-
Pend.prototype.go = function(fn) {
|
|
13815
|
-
if (this.pending < this.max) {
|
|
13816
|
-
pendGo(this, fn);
|
|
13817
|
-
} else {
|
|
13818
|
-
this.waiting.push(fn);
|
|
13819
|
-
}
|
|
13820
|
-
};
|
|
13821
|
-
Pend.prototype.wait = function(cb) {
|
|
13822
|
-
if (this.pending === 0) {
|
|
13823
|
-
cb(this.error);
|
|
13824
|
-
} else {
|
|
13825
|
-
this.listeners.push(cb);
|
|
13826
|
-
}
|
|
13827
|
-
};
|
|
13828
|
-
Pend.prototype.hold = function() {
|
|
13829
|
-
return pendHold(this);
|
|
13830
|
-
};
|
|
13831
|
-
function pendHold(self) {
|
|
13832
|
-
self.pending += 1;
|
|
13833
|
-
var called = false;
|
|
13834
|
-
return onCb;
|
|
13835
|
-
function onCb(err) {
|
|
13836
|
-
if (called)
|
|
13837
|
-
throw new Error("callback called twice");
|
|
13838
|
-
called = true;
|
|
13839
|
-
self.error = self.error || err;
|
|
13840
|
-
self.pending -= 1;
|
|
13841
|
-
if (self.waiting.length > 0 && self.pending < self.max) {
|
|
13842
|
-
pendGo(self, self.waiting.shift());
|
|
13843
|
-
} else if (self.pending === 0) {
|
|
13844
|
-
var listeners = self.listeners;
|
|
13845
|
-
self.listeners = [];
|
|
13846
|
-
listeners.forEach(cbListener);
|
|
13847
|
-
}
|
|
13848
|
-
}
|
|
13849
|
-
function cbListener(listener) {
|
|
13850
|
-
listener(self.error);
|
|
13851
|
-
}
|
|
13852
|
-
}
|
|
13853
|
-
function pendGo(self, fn) {
|
|
13854
|
-
fn(pendHold(self));
|
|
13855
|
-
}
|
|
13856
|
-
});
|
|
13857
|
-
|
|
13858
|
-
// node_modules/yauzl/fd-slicer.js
|
|
13859
|
-
var require_fd_slicer = __commonJS((exports) => {
|
|
13860
|
-
var fs = __require("fs");
|
|
13861
|
-
var util3 = __require("util");
|
|
13862
|
-
var stream = __require("stream");
|
|
13863
|
-
var Readable = stream.Readable;
|
|
13864
|
-
var Writable = stream.Writable;
|
|
13865
|
-
var PassThrough = stream.PassThrough;
|
|
13866
|
-
var Pend = require_pend();
|
|
13867
|
-
var EventEmitter2 = __require("events").EventEmitter;
|
|
13868
|
-
exports.createFromBuffer = createFromBuffer;
|
|
13869
|
-
exports.createFromFd = createFromFd;
|
|
13870
|
-
exports.BufferSlicer = BufferSlicer;
|
|
13871
|
-
exports.FdSlicer = FdSlicer;
|
|
13872
|
-
util3.inherits(FdSlicer, EventEmitter2);
|
|
13873
|
-
function FdSlicer(fd, options2) {
|
|
13874
|
-
options2 = options2 || {};
|
|
13875
|
-
EventEmitter2.call(this);
|
|
13876
|
-
this.fd = fd;
|
|
13877
|
-
this.pend = new Pend;
|
|
13878
|
-
this.pend.max = 1;
|
|
13879
|
-
this.refCount = 0;
|
|
13880
|
-
this.autoClose = !!options2.autoClose;
|
|
13881
|
-
}
|
|
13882
|
-
FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
|
|
13883
|
-
var self = this;
|
|
13884
|
-
self.pend.go(function(cb) {
|
|
13885
|
-
fs.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer2) {
|
|
13886
|
-
cb();
|
|
13887
|
-
callback(err, bytesRead, buffer2);
|
|
13888
|
-
});
|
|
13889
|
-
});
|
|
13890
|
-
};
|
|
13891
|
-
FdSlicer.prototype.write = function(buffer, offset, length, position, callback) {
|
|
13892
|
-
var self = this;
|
|
13893
|
-
self.pend.go(function(cb) {
|
|
13894
|
-
fs.write(self.fd, buffer, offset, length, position, function(err, written, buffer2) {
|
|
13895
|
-
cb();
|
|
13896
|
-
callback(err, written, buffer2);
|
|
13897
|
-
});
|
|
13898
|
-
});
|
|
13899
|
-
};
|
|
13900
|
-
FdSlicer.prototype.createReadStream = function(options2) {
|
|
13901
|
-
return new ReadStream(this, options2);
|
|
13902
|
-
};
|
|
13903
|
-
FdSlicer.prototype.createWriteStream = function(options2) {
|
|
13904
|
-
return new WriteStream(this, options2);
|
|
13905
|
-
};
|
|
13906
|
-
FdSlicer.prototype.ref = function() {
|
|
13907
|
-
this.refCount += 1;
|
|
13908
|
-
};
|
|
13909
|
-
FdSlicer.prototype.unref = function() {
|
|
13910
|
-
var self = this;
|
|
13911
|
-
self.refCount -= 1;
|
|
13912
|
-
if (self.refCount > 0)
|
|
13913
|
-
return;
|
|
13914
|
-
if (self.refCount < 0)
|
|
13915
|
-
throw new Error("invalid unref");
|
|
13916
|
-
if (self.autoClose) {
|
|
13917
|
-
fs.close(self.fd, onCloseDone);
|
|
13918
|
-
}
|
|
13919
|
-
function onCloseDone(err) {
|
|
13920
|
-
if (err) {
|
|
13921
|
-
self.emit("error", err);
|
|
13922
|
-
} else {
|
|
13923
|
-
self.emit("close");
|
|
13924
|
-
}
|
|
13925
|
-
}
|
|
13926
|
-
};
|
|
13927
|
-
util3.inherits(ReadStream, Readable);
|
|
13928
|
-
function ReadStream(context, options2) {
|
|
13929
|
-
options2 = options2 || {};
|
|
13930
|
-
Readable.call(this, options2);
|
|
13931
|
-
this.context = context;
|
|
13932
|
-
this.context.ref();
|
|
13933
|
-
this.start = options2.start || 0;
|
|
13934
|
-
this.endOffset = options2.end;
|
|
13935
|
-
this.pos = this.start;
|
|
13936
|
-
this.destroyed = false;
|
|
13937
|
-
}
|
|
13938
|
-
ReadStream.prototype._read = function(n) {
|
|
13939
|
-
var self = this;
|
|
13940
|
-
if (self.destroyed)
|
|
13941
|
-
return;
|
|
13942
|
-
var toRead = Math.min(self._readableState.highWaterMark, n);
|
|
13943
|
-
if (self.endOffset != null) {
|
|
13944
|
-
toRead = Math.min(toRead, self.endOffset - self.pos);
|
|
13945
|
-
}
|
|
13946
|
-
if (toRead <= 0) {
|
|
13947
|
-
self.destroyed = true;
|
|
13948
|
-
self.push(null);
|
|
13949
|
-
self.context.unref();
|
|
13950
|
-
return;
|
|
13951
|
-
}
|
|
13952
|
-
self.context.pend.go(function(cb) {
|
|
13953
|
-
if (self.destroyed)
|
|
13954
|
-
return cb();
|
|
13955
|
-
var buffer = Buffer.allocUnsafe(toRead);
|
|
13956
|
-
fs.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
|
|
13957
|
-
if (err) {
|
|
13958
|
-
self.destroy(err);
|
|
13959
|
-
} else if (bytesRead === 0) {
|
|
13960
|
-
self.destroyed = true;
|
|
13961
|
-
self.push(null);
|
|
13962
|
-
self.context.unref();
|
|
13963
|
-
} else {
|
|
13964
|
-
self.pos += bytesRead;
|
|
13965
|
-
self.push(buffer.slice(0, bytesRead));
|
|
13966
|
-
}
|
|
13967
|
-
cb();
|
|
13968
|
-
});
|
|
13969
|
-
});
|
|
13970
|
-
};
|
|
13971
|
-
ReadStream.prototype.destroy = function(err) {
|
|
13972
|
-
if (this.destroyed)
|
|
13973
|
-
return;
|
|
13974
|
-
err = err || new Error("stream destroyed");
|
|
13975
|
-
this.destroyed = true;
|
|
13976
|
-
this.emit("error", err);
|
|
13977
|
-
this.context.unref();
|
|
13978
|
-
};
|
|
13979
|
-
util3.inherits(WriteStream, Writable);
|
|
13980
|
-
function WriteStream(context, options2) {
|
|
13981
|
-
options2 = options2 || {};
|
|
13982
|
-
Writable.call(this, options2);
|
|
13983
|
-
this.context = context;
|
|
13984
|
-
this.context.ref();
|
|
13985
|
-
this.start = options2.start || 0;
|
|
13986
|
-
this.endOffset = options2.end == null ? Infinity : +options2.end;
|
|
13987
|
-
this.bytesWritten = 0;
|
|
13988
|
-
this.pos = this.start;
|
|
13989
|
-
this.destroyed = false;
|
|
13990
|
-
this.on("finish", this.destroy.bind(this));
|
|
13991
|
-
}
|
|
13992
|
-
WriteStream.prototype._write = function(buffer, encoding, callback) {
|
|
13993
|
-
var self = this;
|
|
13994
|
-
if (self.destroyed)
|
|
13995
|
-
return;
|
|
13996
|
-
if (self.pos + buffer.length > self.endOffset) {
|
|
13997
|
-
var err = new Error("maximum file length exceeded");
|
|
13998
|
-
err.code = "ETOOBIG";
|
|
13999
|
-
self.destroy();
|
|
14000
|
-
callback(err);
|
|
14001
|
-
return;
|
|
14002
|
-
}
|
|
14003
|
-
self.context.pend.go(function(cb) {
|
|
14004
|
-
if (self.destroyed)
|
|
14005
|
-
return cb();
|
|
14006
|
-
fs.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err2, bytes) {
|
|
14007
|
-
if (err2) {
|
|
14008
|
-
self.destroy();
|
|
14009
|
-
cb();
|
|
14010
|
-
callback(err2);
|
|
14011
|
-
} else {
|
|
14012
|
-
self.bytesWritten += bytes;
|
|
14013
|
-
self.pos += bytes;
|
|
14014
|
-
self.emit("progress");
|
|
14015
|
-
cb();
|
|
14016
|
-
callback();
|
|
14017
|
-
}
|
|
14018
|
-
});
|
|
14019
|
-
});
|
|
14020
|
-
};
|
|
14021
|
-
WriteStream.prototype.destroy = function() {
|
|
14022
|
-
if (this.destroyed)
|
|
14023
|
-
return;
|
|
14024
|
-
this.destroyed = true;
|
|
14025
|
-
this.context.unref();
|
|
14026
|
-
};
|
|
14027
|
-
util3.inherits(BufferSlicer, EventEmitter2);
|
|
14028
|
-
function BufferSlicer(buffer, options2) {
|
|
14029
|
-
EventEmitter2.call(this);
|
|
14030
|
-
options2 = options2 || {};
|
|
14031
|
-
this.refCount = 0;
|
|
14032
|
-
this.buffer = buffer;
|
|
14033
|
-
this.maxChunkSize = options2.maxChunkSize || Number.MAX_SAFE_INTEGER;
|
|
14034
|
-
}
|
|
14035
|
-
BufferSlicer.prototype.read = function(buffer, offset, length, position, callback) {
|
|
14036
|
-
if (!(0 <= offset && offset <= buffer.length))
|
|
14037
|
-
throw new RangeError("offset outside buffer: 0 <= " + offset + " <= " + buffer.length);
|
|
14038
|
-
if (position < 0)
|
|
14039
|
-
throw new RangeError("position is negative: " + position);
|
|
14040
|
-
if (offset + length > buffer.length) {
|
|
14041
|
-
length = buffer.length - offset;
|
|
14042
|
-
}
|
|
14043
|
-
if (position + length > this.buffer.length) {
|
|
14044
|
-
length = this.buffer.length - position;
|
|
14045
|
-
}
|
|
14046
|
-
if (length <= 0) {
|
|
14047
|
-
setImmediate(function() {
|
|
14048
|
-
callback(null, 0);
|
|
14049
|
-
});
|
|
14050
|
-
return;
|
|
14051
|
-
}
|
|
14052
|
-
this.buffer.copy(buffer, offset, position, position + length);
|
|
14053
|
-
setImmediate(function() {
|
|
14054
|
-
callback(null, length);
|
|
14055
|
-
});
|
|
14056
|
-
};
|
|
14057
|
-
BufferSlicer.prototype.write = function(buffer, offset, length, position, callback) {
|
|
14058
|
-
buffer.copy(this.buffer, position, offset, offset + length);
|
|
14059
|
-
setImmediate(function() {
|
|
14060
|
-
callback(null, length, buffer);
|
|
14061
|
-
});
|
|
14062
|
-
};
|
|
14063
|
-
BufferSlicer.prototype.createReadStream = function(options2) {
|
|
14064
|
-
options2 = options2 || {};
|
|
14065
|
-
var readStream = new PassThrough(options2);
|
|
14066
|
-
readStream.destroyed = false;
|
|
14067
|
-
readStream.start = options2.start || 0;
|
|
14068
|
-
readStream.endOffset = options2.end;
|
|
14069
|
-
readStream.pos = readStream.endOffset || this.buffer.length;
|
|
14070
|
-
var entireSlice = this.buffer.slice(readStream.start, readStream.pos);
|
|
14071
|
-
var offset = 0;
|
|
14072
|
-
while (true) {
|
|
14073
|
-
var nextOffset = offset + this.maxChunkSize;
|
|
14074
|
-
if (nextOffset >= entireSlice.length) {
|
|
14075
|
-
if (offset < entireSlice.length) {
|
|
14076
|
-
readStream.write(entireSlice.slice(offset, entireSlice.length));
|
|
14077
|
-
}
|
|
14078
|
-
break;
|
|
14079
|
-
}
|
|
14080
|
-
readStream.write(entireSlice.slice(offset, nextOffset));
|
|
14081
|
-
offset = nextOffset;
|
|
14082
|
-
}
|
|
14083
|
-
readStream.end();
|
|
14084
|
-
readStream.destroy = function() {
|
|
14085
|
-
readStream.destroyed = true;
|
|
14086
|
-
};
|
|
14087
|
-
return readStream;
|
|
14088
|
-
};
|
|
14089
|
-
BufferSlicer.prototype.createWriteStream = function(options2) {
|
|
14090
|
-
var bufferSlicer = this;
|
|
14091
|
-
options2 = options2 || {};
|
|
14092
|
-
var writeStream = new Writable(options2);
|
|
14093
|
-
writeStream.start = options2.start || 0;
|
|
14094
|
-
writeStream.endOffset = options2.end == null ? this.buffer.length : +options2.end;
|
|
14095
|
-
writeStream.bytesWritten = 0;
|
|
14096
|
-
writeStream.pos = writeStream.start;
|
|
14097
|
-
writeStream.destroyed = false;
|
|
14098
|
-
writeStream._write = function(buffer, encoding, callback) {
|
|
14099
|
-
if (writeStream.destroyed)
|
|
14100
|
-
return;
|
|
14101
|
-
var end = writeStream.pos + buffer.length;
|
|
14102
|
-
if (end > writeStream.endOffset) {
|
|
14103
|
-
var err = new Error("maximum file length exceeded");
|
|
14104
|
-
err.code = "ETOOBIG";
|
|
14105
|
-
writeStream.destroyed = true;
|
|
14106
|
-
callback(err);
|
|
14107
|
-
return;
|
|
14108
|
-
}
|
|
14109
|
-
buffer.copy(bufferSlicer.buffer, writeStream.pos, 0, buffer.length);
|
|
14110
|
-
writeStream.bytesWritten += buffer.length;
|
|
14111
|
-
writeStream.pos = end;
|
|
14112
|
-
writeStream.emit("progress");
|
|
14113
|
-
callback();
|
|
14114
|
-
};
|
|
14115
|
-
writeStream.destroy = function() {
|
|
14116
|
-
writeStream.destroyed = true;
|
|
14117
|
-
};
|
|
14118
|
-
return writeStream;
|
|
14119
|
-
};
|
|
14120
|
-
BufferSlicer.prototype.ref = function() {
|
|
14121
|
-
this.refCount += 1;
|
|
14122
|
-
};
|
|
14123
|
-
BufferSlicer.prototype.unref = function() {
|
|
14124
|
-
this.refCount -= 1;
|
|
14125
|
-
if (this.refCount < 0) {
|
|
14126
|
-
throw new Error("invalid unref");
|
|
14127
|
-
}
|
|
14128
|
-
};
|
|
14129
|
-
function createFromBuffer(buffer, options2) {
|
|
14130
|
-
return new BufferSlicer(buffer, options2);
|
|
14131
|
-
}
|
|
14132
|
-
function createFromFd(fd, options2) {
|
|
14133
|
-
return new FdSlicer(fd, options2);
|
|
14134
|
-
}
|
|
14135
|
-
});
|
|
14136
|
-
|
|
14137
|
-
// node_modules/yauzl/node_modules/buffer-crc32/index.js
|
|
14138
|
-
var require_buffer_crc32 = __commonJS((exports, module) => {
|
|
14139
|
-
var Buffer2 = __require("buffer").Buffer;
|
|
14140
|
-
var CRC_TABLE = [
|
|
14141
|
-
0,
|
|
14142
|
-
1996959894,
|
|
14143
|
-
3993919788,
|
|
14144
|
-
2567524794,
|
|
14145
|
-
124634137,
|
|
14146
|
-
1886057615,
|
|
14147
|
-
3915621685,
|
|
14148
|
-
2657392035,
|
|
14149
|
-
249268274,
|
|
14150
|
-
2044508324,
|
|
14151
|
-
3772115230,
|
|
14152
|
-
2547177864,
|
|
14153
|
-
162941995,
|
|
14154
|
-
2125561021,
|
|
14155
|
-
3887607047,
|
|
14156
|
-
2428444049,
|
|
14157
|
-
498536548,
|
|
14158
|
-
1789927666,
|
|
14159
|
-
4089016648,
|
|
14160
|
-
2227061214,
|
|
14161
|
-
450548861,
|
|
14162
|
-
1843258603,
|
|
14163
|
-
4107580753,
|
|
14164
|
-
2211677639,
|
|
14165
|
-
325883990,
|
|
14166
|
-
1684777152,
|
|
14167
|
-
4251122042,
|
|
14168
|
-
2321926636,
|
|
14169
|
-
335633487,
|
|
14170
|
-
1661365465,
|
|
14171
|
-
4195302755,
|
|
14172
|
-
2366115317,
|
|
14173
|
-
997073096,
|
|
14174
|
-
1281953886,
|
|
14175
|
-
3579855332,
|
|
14176
|
-
2724688242,
|
|
14177
|
-
1006888145,
|
|
14178
|
-
1258607687,
|
|
14179
|
-
3524101629,
|
|
14180
|
-
2768942443,
|
|
14181
|
-
901097722,
|
|
14182
|
-
1119000684,
|
|
14183
|
-
3686517206,
|
|
14184
|
-
2898065728,
|
|
14185
|
-
853044451,
|
|
14186
|
-
1172266101,
|
|
14187
|
-
3705015759,
|
|
14188
|
-
2882616665,
|
|
14189
|
-
651767980,
|
|
14190
|
-
1373503546,
|
|
14191
|
-
3369554304,
|
|
14192
|
-
3218104598,
|
|
14193
|
-
565507253,
|
|
14194
|
-
1454621731,
|
|
14195
|
-
3485111705,
|
|
14196
|
-
3099436303,
|
|
14197
|
-
671266974,
|
|
14198
|
-
1594198024,
|
|
14199
|
-
3322730930,
|
|
14200
|
-
2970347812,
|
|
14201
|
-
795835527,
|
|
14202
|
-
1483230225,
|
|
14203
|
-
3244367275,
|
|
14204
|
-
3060149565,
|
|
14205
|
-
1994146192,
|
|
14206
|
-
31158534,
|
|
14207
|
-
2563907772,
|
|
14208
|
-
4023717930,
|
|
14209
|
-
1907459465,
|
|
14210
|
-
112637215,
|
|
14211
|
-
2680153253,
|
|
14212
|
-
3904427059,
|
|
14213
|
-
2013776290,
|
|
14214
|
-
251722036,
|
|
14215
|
-
2517215374,
|
|
14216
|
-
3775830040,
|
|
14217
|
-
2137656763,
|
|
14218
|
-
141376813,
|
|
14219
|
-
2439277719,
|
|
14220
|
-
3865271297,
|
|
14221
|
-
1802195444,
|
|
14222
|
-
476864866,
|
|
14223
|
-
2238001368,
|
|
14224
|
-
4066508878,
|
|
14225
|
-
1812370925,
|
|
14226
|
-
453092731,
|
|
14227
|
-
2181625025,
|
|
14228
|
-
4111451223,
|
|
14229
|
-
1706088902,
|
|
14230
|
-
314042704,
|
|
14231
|
-
2344532202,
|
|
14232
|
-
4240017532,
|
|
14233
|
-
1658658271,
|
|
14234
|
-
366619977,
|
|
14235
|
-
2362670323,
|
|
14236
|
-
4224994405,
|
|
14237
|
-
1303535960,
|
|
14238
|
-
984961486,
|
|
14239
|
-
2747007092,
|
|
14240
|
-
3569037538,
|
|
14241
|
-
1256170817,
|
|
14242
|
-
1037604311,
|
|
14243
|
-
2765210733,
|
|
14244
|
-
3554079995,
|
|
14245
|
-
1131014506,
|
|
14246
|
-
879679996,
|
|
14247
|
-
2909243462,
|
|
14248
|
-
3663771856,
|
|
14249
|
-
1141124467,
|
|
14250
|
-
855842277,
|
|
14251
|
-
2852801631,
|
|
14252
|
-
3708648649,
|
|
14253
|
-
1342533948,
|
|
14254
|
-
654459306,
|
|
14255
|
-
3188396048,
|
|
14256
|
-
3373015174,
|
|
14257
|
-
1466479909,
|
|
14258
|
-
544179635,
|
|
14259
|
-
3110523913,
|
|
14260
|
-
3462522015,
|
|
14261
|
-
1591671054,
|
|
14262
|
-
702138776,
|
|
14263
|
-
2966460450,
|
|
14264
|
-
3352799412,
|
|
14265
|
-
1504918807,
|
|
14266
|
-
783551873,
|
|
14267
|
-
3082640443,
|
|
14268
|
-
3233442989,
|
|
14269
|
-
3988292384,
|
|
14270
|
-
2596254646,
|
|
14271
|
-
62317068,
|
|
14272
|
-
1957810842,
|
|
14273
|
-
3939845945,
|
|
14274
|
-
2647816111,
|
|
14275
|
-
81470997,
|
|
14276
|
-
1943803523,
|
|
14277
|
-
3814918930,
|
|
14278
|
-
2489596804,
|
|
14279
|
-
225274430,
|
|
14280
|
-
2053790376,
|
|
14281
|
-
3826175755,
|
|
14282
|
-
2466906013,
|
|
14283
|
-
167816743,
|
|
14284
|
-
2097651377,
|
|
14285
|
-
4027552580,
|
|
14286
|
-
2265490386,
|
|
14287
|
-
503444072,
|
|
14288
|
-
1762050814,
|
|
14289
|
-
4150417245,
|
|
14290
|
-
2154129355,
|
|
14291
|
-
426522225,
|
|
14292
|
-
1852507879,
|
|
14293
|
-
4275313526,
|
|
14294
|
-
2312317920,
|
|
14295
|
-
282753626,
|
|
14296
|
-
1742555852,
|
|
14297
|
-
4189708143,
|
|
14298
|
-
2394877945,
|
|
14299
|
-
397917763,
|
|
14300
|
-
1622183637,
|
|
14301
|
-
3604390888,
|
|
14302
|
-
2714866558,
|
|
14303
|
-
953729732,
|
|
14304
|
-
1340076626,
|
|
14305
|
-
3518719985,
|
|
14306
|
-
2797360999,
|
|
14307
|
-
1068828381,
|
|
14308
|
-
1219638859,
|
|
14309
|
-
3624741850,
|
|
14310
|
-
2936675148,
|
|
14311
|
-
906185462,
|
|
14312
|
-
1090812512,
|
|
14313
|
-
3747672003,
|
|
14314
|
-
2825379669,
|
|
14315
|
-
829329135,
|
|
14316
|
-
1181335161,
|
|
14317
|
-
3412177804,
|
|
14318
|
-
3160834842,
|
|
14319
|
-
628085408,
|
|
14320
|
-
1382605366,
|
|
14321
|
-
3423369109,
|
|
14322
|
-
3138078467,
|
|
14323
|
-
570562233,
|
|
14324
|
-
1426400815,
|
|
14325
|
-
3317316542,
|
|
14326
|
-
2998733608,
|
|
14327
|
-
733239954,
|
|
14328
|
-
1555261956,
|
|
14329
|
-
3268935591,
|
|
14330
|
-
3050360625,
|
|
14331
|
-
752459403,
|
|
14332
|
-
1541320221,
|
|
14333
|
-
2607071920,
|
|
14334
|
-
3965973030,
|
|
14335
|
-
1969922972,
|
|
14336
|
-
40735498,
|
|
14337
|
-
2617837225,
|
|
14338
|
-
3943577151,
|
|
14339
|
-
1913087877,
|
|
14340
|
-
83908371,
|
|
14341
|
-
2512341634,
|
|
14342
|
-
3803740692,
|
|
14343
|
-
2075208622,
|
|
14344
|
-
213261112,
|
|
14345
|
-
2463272603,
|
|
14346
|
-
3855990285,
|
|
14347
|
-
2094854071,
|
|
14348
|
-
198958881,
|
|
14349
|
-
2262029012,
|
|
14350
|
-
4057260610,
|
|
14351
|
-
1759359992,
|
|
14352
|
-
534414190,
|
|
14353
|
-
2176718541,
|
|
14354
|
-
4139329115,
|
|
14355
|
-
1873836001,
|
|
14356
|
-
414664567,
|
|
14357
|
-
2282248934,
|
|
14358
|
-
4279200368,
|
|
14359
|
-
1711684554,
|
|
14360
|
-
285281116,
|
|
14361
|
-
2405801727,
|
|
14362
|
-
4167216745,
|
|
14363
|
-
1634467795,
|
|
14364
|
-
376229701,
|
|
14365
|
-
2685067896,
|
|
14366
|
-
3608007406,
|
|
14367
|
-
1308918612,
|
|
14368
|
-
956543938,
|
|
14369
|
-
2808555105,
|
|
14370
|
-
3495958263,
|
|
14371
|
-
1231636301,
|
|
14372
|
-
1047427035,
|
|
14373
|
-
2932959818,
|
|
14374
|
-
3654703836,
|
|
14375
|
-
1088359270,
|
|
14376
|
-
936918000,
|
|
14377
|
-
2847714899,
|
|
14378
|
-
3736837829,
|
|
14379
|
-
1202900863,
|
|
14380
|
-
817233897,
|
|
14381
|
-
3183342108,
|
|
14382
|
-
3401237130,
|
|
14383
|
-
1404277552,
|
|
14384
|
-
615818150,
|
|
14385
|
-
3134207493,
|
|
14386
|
-
3453421203,
|
|
14387
|
-
1423857449,
|
|
14388
|
-
601450431,
|
|
14389
|
-
3009837614,
|
|
14390
|
-
3294710456,
|
|
14391
|
-
1567103746,
|
|
14392
|
-
711928724,
|
|
14393
|
-
3020668471,
|
|
14394
|
-
3272380065,
|
|
14395
|
-
1510334235,
|
|
14396
|
-
755167117
|
|
14397
|
-
];
|
|
14398
|
-
if (typeof Int32Array !== "undefined") {
|
|
14399
|
-
CRC_TABLE = new Int32Array(CRC_TABLE);
|
|
14400
|
-
}
|
|
14401
|
-
function ensureBuffer(input) {
|
|
14402
|
-
if (Buffer2.isBuffer(input)) {
|
|
14403
|
-
return input;
|
|
14404
|
-
}
|
|
14405
|
-
var hasNewBufferAPI = typeof Buffer2.alloc === "function" && typeof Buffer2.from === "function";
|
|
14406
|
-
if (typeof input === "number") {
|
|
14407
|
-
return hasNewBufferAPI ? Buffer2.alloc(input) : new Buffer2(input);
|
|
14408
|
-
} else if (typeof input === "string") {
|
|
14409
|
-
return hasNewBufferAPI ? Buffer2.from(input) : new Buffer2(input);
|
|
14410
|
-
} else {
|
|
14411
|
-
throw new Error("input must be buffer, number, or string, received " + typeof input);
|
|
14412
|
-
}
|
|
14413
|
-
}
|
|
14414
|
-
function bufferizeInt(num) {
|
|
14415
|
-
var tmp = ensureBuffer(4);
|
|
14416
|
-
tmp.writeInt32BE(num, 0);
|
|
14417
|
-
return tmp;
|
|
14418
|
-
}
|
|
14419
|
-
function _crc32(buf, previous) {
|
|
14420
|
-
buf = ensureBuffer(buf);
|
|
14421
|
-
if (Buffer2.isBuffer(previous)) {
|
|
14422
|
-
previous = previous.readUInt32BE(0);
|
|
14423
|
-
}
|
|
14424
|
-
var crc = ~~previous ^ -1;
|
|
14425
|
-
for (var n = 0;n < buf.length; n++) {
|
|
14426
|
-
crc = CRC_TABLE[(crc ^ buf[n]) & 255] ^ crc >>> 8;
|
|
14427
|
-
}
|
|
14428
|
-
return crc ^ -1;
|
|
14429
|
-
}
|
|
14430
|
-
function crc32() {
|
|
14431
|
-
return bufferizeInt(_crc32.apply(null, arguments));
|
|
14432
|
-
}
|
|
14433
|
-
crc32.signed = function() {
|
|
14434
|
-
return _crc32.apply(null, arguments);
|
|
14435
|
-
};
|
|
14436
|
-
crc32.unsigned = function() {
|
|
14437
|
-
return _crc32.apply(null, arguments) >>> 0;
|
|
14438
|
-
};
|
|
14439
|
-
module.exports = crc32;
|
|
14440
|
-
});
|
|
14441
|
-
|
|
14442
|
-
// node_modules/yauzl/index.js
|
|
14443
|
-
var require_yauzl = __commonJS((exports) => {
|
|
14444
|
-
var fs = __require("fs");
|
|
14445
|
-
var zlib = __require("zlib");
|
|
14446
|
-
var fd_slicer = require_fd_slicer();
|
|
14447
|
-
var crc32 = require_buffer_crc32();
|
|
14448
|
-
var util3 = __require("util");
|
|
14449
|
-
var EventEmitter2 = __require("events").EventEmitter;
|
|
14450
|
-
var Transform = __require("stream").Transform;
|
|
14451
|
-
var PassThrough = __require("stream").PassThrough;
|
|
14452
|
-
var Writable = __require("stream").Writable;
|
|
14453
|
-
exports.open = open;
|
|
14454
|
-
exports.fromFd = fromFd;
|
|
14455
|
-
exports.fromBuffer = fromBuffer;
|
|
14456
|
-
exports.fromRandomAccessReader = fromRandomAccessReader;
|
|
14457
|
-
exports.dosDateTimeToDate = dosDateTimeToDate;
|
|
14458
|
-
exports.getFileNameLowLevel = getFileNameLowLevel;
|
|
14459
|
-
exports.validateFileName = validateFileName;
|
|
14460
|
-
exports.parseExtraFields = parseExtraFields;
|
|
14461
|
-
exports.ZipFile = ZipFile;
|
|
14462
|
-
exports.Entry = Entry;
|
|
14463
|
-
exports.LocalFileHeader = LocalFileHeader;
|
|
14464
|
-
exports.RandomAccessReader = RandomAccessReader;
|
|
14465
|
-
function open(path, options2, callback) {
|
|
14466
|
-
if (typeof options2 === "function") {
|
|
14467
|
-
callback = options2;
|
|
14468
|
-
options2 = null;
|
|
14469
|
-
}
|
|
14470
|
-
if (options2 == null)
|
|
14471
|
-
options2 = {};
|
|
14472
|
-
if (options2.autoClose == null)
|
|
14473
|
-
options2.autoClose = true;
|
|
14474
|
-
if (options2.lazyEntries == null)
|
|
14475
|
-
options2.lazyEntries = false;
|
|
14476
|
-
if (options2.decodeStrings == null)
|
|
14477
|
-
options2.decodeStrings = true;
|
|
14478
|
-
if (options2.validateEntrySizes == null)
|
|
14479
|
-
options2.validateEntrySizes = true;
|
|
14480
|
-
if (options2.strictFileNames == null)
|
|
14481
|
-
options2.strictFileNames = false;
|
|
14482
|
-
if (callback == null)
|
|
14483
|
-
callback = defaultCallback;
|
|
14484
|
-
fs.open(path, "r", function(err, fd) {
|
|
14485
|
-
if (err)
|
|
14486
|
-
return callback(err);
|
|
14487
|
-
fromFd(fd, options2, function(err2, zipfile) {
|
|
14488
|
-
if (err2)
|
|
14489
|
-
fs.close(fd, defaultCallback);
|
|
14490
|
-
callback(err2, zipfile);
|
|
14491
|
-
});
|
|
14492
|
-
});
|
|
14493
|
-
}
|
|
14494
|
-
function fromFd(fd, options2, callback) {
|
|
14495
|
-
if (typeof options2 === "function") {
|
|
14496
|
-
callback = options2;
|
|
14497
|
-
options2 = null;
|
|
14498
|
-
}
|
|
14499
|
-
if (options2 == null)
|
|
14500
|
-
options2 = {};
|
|
14501
|
-
if (options2.autoClose == null)
|
|
14502
|
-
options2.autoClose = false;
|
|
14503
|
-
if (options2.lazyEntries == null)
|
|
14504
|
-
options2.lazyEntries = false;
|
|
14505
|
-
if (options2.decodeStrings == null)
|
|
14506
|
-
options2.decodeStrings = true;
|
|
14507
|
-
if (options2.validateEntrySizes == null)
|
|
14508
|
-
options2.validateEntrySizes = true;
|
|
14509
|
-
if (options2.strictFileNames == null)
|
|
14510
|
-
options2.strictFileNames = false;
|
|
14511
|
-
if (callback == null)
|
|
14512
|
-
callback = defaultCallback;
|
|
14513
|
-
fs.fstat(fd, function(err, stats) {
|
|
14514
|
-
if (err)
|
|
14515
|
-
return callback(err);
|
|
14516
|
-
var reader = fd_slicer.createFromFd(fd, { autoClose: true });
|
|
14517
|
-
fromRandomAccessReader(reader, stats.size, options2, callback);
|
|
14518
|
-
});
|
|
14519
|
-
}
|
|
14520
|
-
function fromBuffer(buffer, options2, callback) {
|
|
14521
|
-
if (typeof options2 === "function") {
|
|
14522
|
-
callback = options2;
|
|
14523
|
-
options2 = null;
|
|
14524
|
-
}
|
|
14525
|
-
if (options2 == null)
|
|
14526
|
-
options2 = {};
|
|
14527
|
-
options2.autoClose = false;
|
|
14528
|
-
if (options2.lazyEntries == null)
|
|
14529
|
-
options2.lazyEntries = false;
|
|
14530
|
-
if (options2.decodeStrings == null)
|
|
14531
|
-
options2.decodeStrings = true;
|
|
14532
|
-
if (options2.validateEntrySizes == null)
|
|
14533
|
-
options2.validateEntrySizes = true;
|
|
14534
|
-
if (options2.strictFileNames == null)
|
|
14535
|
-
options2.strictFileNames = false;
|
|
14536
|
-
var reader = fd_slicer.createFromBuffer(buffer, { maxChunkSize: 65536 });
|
|
14537
|
-
fromRandomAccessReader(reader, buffer.length, options2, callback);
|
|
14538
|
-
}
|
|
14539
|
-
function fromRandomAccessReader(reader, totalSize, options2, callback) {
|
|
14540
|
-
if (typeof options2 === "function") {
|
|
14541
|
-
callback = options2;
|
|
14542
|
-
options2 = null;
|
|
14543
|
-
}
|
|
14544
|
-
if (options2 == null)
|
|
14545
|
-
options2 = {};
|
|
14546
|
-
if (options2.autoClose == null)
|
|
14547
|
-
options2.autoClose = true;
|
|
14548
|
-
if (options2.lazyEntries == null)
|
|
14549
|
-
options2.lazyEntries = false;
|
|
14550
|
-
if (options2.decodeStrings == null)
|
|
14551
|
-
options2.decodeStrings = true;
|
|
14552
|
-
var decodeStrings = !!options2.decodeStrings;
|
|
14553
|
-
if (options2.validateEntrySizes == null)
|
|
14554
|
-
options2.validateEntrySizes = true;
|
|
14555
|
-
if (options2.strictFileNames == null)
|
|
14556
|
-
options2.strictFileNames = false;
|
|
14557
|
-
if (callback == null)
|
|
14558
|
-
callback = defaultCallback;
|
|
14559
|
-
if (typeof totalSize !== "number")
|
|
14560
|
-
throw new Error("expected totalSize parameter to be a number");
|
|
14561
|
-
if (totalSize > Number.MAX_SAFE_INTEGER) {
|
|
14562
|
-
throw new Error("zip file too large. only file sizes up to 2^52 are supported due to JavaScript's Number type being an IEEE 754 double.");
|
|
14563
|
-
}
|
|
14564
|
-
reader.ref();
|
|
14565
|
-
var eocdrWithoutCommentSize = 22;
|
|
14566
|
-
var zip64EocdlSize = 20;
|
|
14567
|
-
var maxCommentSize = 65535;
|
|
14568
|
-
var bufferSize = Math.min(zip64EocdlSize + eocdrWithoutCommentSize + maxCommentSize, totalSize);
|
|
14569
|
-
var buffer = newBuffer(bufferSize);
|
|
14570
|
-
var bufferReadStart = totalSize - buffer.length;
|
|
14571
|
-
readAndAssertNoEof(reader, buffer, 0, bufferSize, bufferReadStart, function(err) {
|
|
14572
|
-
if (err)
|
|
14573
|
-
return callback(err);
|
|
14574
|
-
for (var i = bufferSize - eocdrWithoutCommentSize;i >= 0; i -= 1) {
|
|
14575
|
-
if (buffer.readUInt32LE(i) !== 101010256)
|
|
14576
|
-
continue;
|
|
14577
|
-
var eocdrBuffer = buffer.subarray(i);
|
|
14578
|
-
var diskNumber = eocdrBuffer.readUInt16LE(4);
|
|
14579
|
-
var entryCount = eocdrBuffer.readUInt16LE(10);
|
|
14580
|
-
var centralDirectoryOffset = eocdrBuffer.readUInt32LE(16);
|
|
14581
|
-
var commentLength = eocdrBuffer.readUInt16LE(20);
|
|
14582
|
-
var expectedCommentLength = eocdrBuffer.length - eocdrWithoutCommentSize;
|
|
14583
|
-
if (commentLength !== expectedCommentLength) {
|
|
14584
|
-
return callback(new Error("Invalid comment length. Expected: " + expectedCommentLength + ". Found: " + commentLength + ". Are there extra bytes at the end of the file? Or is the end of central dir signature `PK☺☻` in the comment?"));
|
|
14585
|
-
}
|
|
14586
|
-
var comment = decodeStrings ? decodeBuffer(eocdrBuffer.subarray(22), false) : eocdrBuffer.subarray(22);
|
|
14587
|
-
if (i - zip64EocdlSize >= 0 && buffer.readUInt32LE(i - zip64EocdlSize) === 117853008) {
|
|
14588
|
-
var zip64EocdlBuffer = buffer.subarray(i - zip64EocdlSize, i - zip64EocdlSize + zip64EocdlSize);
|
|
14589
|
-
var zip64EocdrOffset = readUInt64LE(zip64EocdlBuffer, 8);
|
|
14590
|
-
var zip64EocdrBuffer = newBuffer(56);
|
|
14591
|
-
return readAndAssertNoEof(reader, zip64EocdrBuffer, 0, zip64EocdrBuffer.length, zip64EocdrOffset, function(err2) {
|
|
14592
|
-
if (err2)
|
|
14593
|
-
return callback(err2);
|
|
14594
|
-
if (zip64EocdrBuffer.readUInt32LE(0) !== 101075792) {
|
|
14595
|
-
return callback(new Error("invalid zip64 end of central directory record signature"));
|
|
14596
|
-
}
|
|
14597
|
-
diskNumber = zip64EocdrBuffer.readUInt32LE(16);
|
|
14598
|
-
if (diskNumber !== 0) {
|
|
14599
|
-
return callback(new Error("multi-disk zip files are not supported: found disk number: " + diskNumber));
|
|
14600
|
-
}
|
|
14601
|
-
entryCount = readUInt64LE(zip64EocdrBuffer, 32);
|
|
14602
|
-
centralDirectoryOffset = readUInt64LE(zip64EocdrBuffer, 48);
|
|
14603
|
-
return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment, options2.autoClose, options2.lazyEntries, decodeStrings, options2.validateEntrySizes, options2.strictFileNames));
|
|
14604
|
-
});
|
|
14605
|
-
}
|
|
14606
|
-
if (diskNumber !== 0) {
|
|
14607
|
-
return callback(new Error("multi-disk zip files are not supported: found disk number: " + diskNumber));
|
|
14608
|
-
}
|
|
14609
|
-
return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment, options2.autoClose, options2.lazyEntries, decodeStrings, options2.validateEntrySizes, options2.strictFileNames));
|
|
14610
|
-
}
|
|
14611
|
-
callback(new Error("End of central directory record signature not found. Either not a zip file, or file is truncated."));
|
|
14612
|
-
});
|
|
14613
|
-
}
|
|
14614
|
-
util3.inherits(ZipFile, EventEmitter2);
|
|
14615
|
-
function ZipFile(reader, centralDirectoryOffset, fileSize, entryCount, comment, autoClose, lazyEntries, decodeStrings, validateEntrySizes, strictFileNames) {
|
|
14616
|
-
var self = this;
|
|
14617
|
-
EventEmitter2.call(self);
|
|
14618
|
-
self.reader = reader;
|
|
14619
|
-
self.reader.on("error", function(err) {
|
|
14620
|
-
emitError(self, err);
|
|
14621
|
-
});
|
|
14622
|
-
self.reader.once("close", function() {
|
|
14623
|
-
self.emit("close");
|
|
14624
|
-
});
|
|
14625
|
-
self.readEntryCursor = centralDirectoryOffset;
|
|
14626
|
-
self.fileSize = fileSize;
|
|
14627
|
-
self.entryCount = entryCount;
|
|
14628
|
-
self.comment = comment;
|
|
14629
|
-
self.entriesRead = 0;
|
|
14630
|
-
self.autoClose = !!autoClose;
|
|
14631
|
-
self.lazyEntries = !!lazyEntries;
|
|
14632
|
-
self.decodeStrings = !!decodeStrings;
|
|
14633
|
-
self.validateEntrySizes = !!validateEntrySizes;
|
|
14634
|
-
self.strictFileNames = !!strictFileNames;
|
|
14635
|
-
self.isOpen = true;
|
|
14636
|
-
self.emittedError = false;
|
|
14637
|
-
if (!self.lazyEntries)
|
|
14638
|
-
self._readEntry();
|
|
14639
|
-
}
|
|
14640
|
-
ZipFile.prototype.close = function() {
|
|
14641
|
-
if (!this.isOpen)
|
|
14642
|
-
return;
|
|
14643
|
-
this.isOpen = false;
|
|
14644
|
-
this.reader.unref();
|
|
14645
|
-
};
|
|
14646
|
-
function emitErrorAndAutoClose(self, err) {
|
|
14647
|
-
if (self.autoClose)
|
|
14648
|
-
self.close();
|
|
14649
|
-
emitError(self, err);
|
|
14650
|
-
}
|
|
14651
|
-
function emitError(self, err) {
|
|
14652
|
-
if (self.emittedError)
|
|
14653
|
-
return;
|
|
14654
|
-
self.emittedError = true;
|
|
14655
|
-
self.emit("error", err);
|
|
14656
|
-
}
|
|
14657
|
-
ZipFile.prototype.readEntry = function() {
|
|
14658
|
-
if (!this.lazyEntries)
|
|
14659
|
-
throw new Error("readEntry() called without lazyEntries:true");
|
|
14660
|
-
this._readEntry();
|
|
14661
|
-
};
|
|
14662
|
-
ZipFile.prototype._readEntry = function() {
|
|
14663
|
-
var self = this;
|
|
14664
|
-
if (self.entryCount === self.entriesRead) {
|
|
14665
|
-
setImmediate(function() {
|
|
14666
|
-
if (self.autoClose)
|
|
14667
|
-
self.close();
|
|
14668
|
-
if (self.emittedError)
|
|
14669
|
-
return;
|
|
14670
|
-
self.emit("end");
|
|
14671
|
-
});
|
|
14672
|
-
return;
|
|
14673
|
-
}
|
|
14674
|
-
if (self.emittedError)
|
|
14675
|
-
return;
|
|
14676
|
-
var buffer = newBuffer(46);
|
|
14677
|
-
readAndAssertNoEof(self.reader, buffer, 0, buffer.length, self.readEntryCursor, function(err) {
|
|
14678
|
-
if (err)
|
|
14679
|
-
return emitErrorAndAutoClose(self, err);
|
|
14680
|
-
if (self.emittedError)
|
|
14681
|
-
return;
|
|
14682
|
-
var entry = new Entry;
|
|
14683
|
-
var signature = buffer.readUInt32LE(0);
|
|
14684
|
-
if (signature !== 33639248)
|
|
14685
|
-
return emitErrorAndAutoClose(self, new Error("invalid central directory file header signature: 0x" + signature.toString(16)));
|
|
14686
|
-
entry.versionMadeBy = buffer.readUInt16LE(4);
|
|
14687
|
-
entry.versionNeededToExtract = buffer.readUInt16LE(6);
|
|
14688
|
-
entry.generalPurposeBitFlag = buffer.readUInt16LE(8);
|
|
14689
|
-
entry.compressionMethod = buffer.readUInt16LE(10);
|
|
14690
|
-
entry.lastModFileTime = buffer.readUInt16LE(12);
|
|
14691
|
-
entry.lastModFileDate = buffer.readUInt16LE(14);
|
|
14692
|
-
entry.crc32 = buffer.readUInt32LE(16);
|
|
14693
|
-
entry.compressedSize = buffer.readUInt32LE(20);
|
|
14694
|
-
entry.uncompressedSize = buffer.readUInt32LE(24);
|
|
14695
|
-
entry.fileNameLength = buffer.readUInt16LE(28);
|
|
14696
|
-
entry.extraFieldLength = buffer.readUInt16LE(30);
|
|
14697
|
-
entry.fileCommentLength = buffer.readUInt16LE(32);
|
|
14698
|
-
entry.internalFileAttributes = buffer.readUInt16LE(36);
|
|
14699
|
-
entry.externalFileAttributes = buffer.readUInt32LE(38);
|
|
14700
|
-
entry.relativeOffsetOfLocalHeader = buffer.readUInt32LE(42);
|
|
14701
|
-
if (entry.generalPurposeBitFlag & 64)
|
|
14702
|
-
return emitErrorAndAutoClose(self, new Error("strong encryption is not supported"));
|
|
14703
|
-
self.readEntryCursor += 46;
|
|
14704
|
-
buffer = newBuffer(entry.fileNameLength + entry.extraFieldLength + entry.fileCommentLength);
|
|
14705
|
-
readAndAssertNoEof(self.reader, buffer, 0, buffer.length, self.readEntryCursor, function(err2) {
|
|
14706
|
-
if (err2)
|
|
14707
|
-
return emitErrorAndAutoClose(self, err2);
|
|
14708
|
-
if (self.emittedError)
|
|
14709
|
-
return;
|
|
14710
|
-
entry.fileNameRaw = buffer.subarray(0, entry.fileNameLength);
|
|
14711
|
-
var fileCommentStart = entry.fileNameLength + entry.extraFieldLength;
|
|
14712
|
-
entry.extraFieldRaw = buffer.subarray(entry.fileNameLength, fileCommentStart);
|
|
14713
|
-
entry.fileCommentRaw = buffer.subarray(fileCommentStart, fileCommentStart + entry.fileCommentLength);
|
|
14714
|
-
try {
|
|
14715
|
-
entry.extraFields = parseExtraFields(entry.extraFieldRaw);
|
|
14716
|
-
} catch (err3) {
|
|
14717
|
-
return emitErrorAndAutoClose(self, err3);
|
|
14718
|
-
}
|
|
14719
|
-
if (self.decodeStrings) {
|
|
14720
|
-
var isUtf8 = (entry.generalPurposeBitFlag & 2048) !== 0;
|
|
14721
|
-
entry.fileComment = decodeBuffer(entry.fileCommentRaw, isUtf8);
|
|
14722
|
-
entry.fileName = getFileNameLowLevel(entry.generalPurposeBitFlag, entry.fileNameRaw, entry.extraFields, self.strictFileNames);
|
|
14723
|
-
var errorMessage = validateFileName(entry.fileName);
|
|
14724
|
-
if (errorMessage != null)
|
|
14725
|
-
return emitErrorAndAutoClose(self, new Error(errorMessage));
|
|
14726
|
-
} else {
|
|
14727
|
-
entry.fileComment = entry.fileCommentRaw;
|
|
14728
|
-
entry.fileName = entry.fileNameRaw;
|
|
14729
|
-
}
|
|
14730
|
-
entry.comment = entry.fileComment;
|
|
14731
|
-
self.readEntryCursor += buffer.length;
|
|
14732
|
-
self.entriesRead += 1;
|
|
14733
|
-
for (var i = 0;i < entry.extraFields.length; i++) {
|
|
14734
|
-
var extraField = entry.extraFields[i];
|
|
14735
|
-
if (extraField.id !== 1)
|
|
14736
|
-
continue;
|
|
14737
|
-
var zip64EiefBuffer = extraField.data;
|
|
14738
|
-
var index = 0;
|
|
14739
|
-
if (entry.uncompressedSize === 4294967295) {
|
|
14740
|
-
if (index + 8 > zip64EiefBuffer.length) {
|
|
14741
|
-
return emitErrorAndAutoClose(self, new Error("zip64 extended information extra field does not include uncompressed size"));
|
|
14742
|
-
}
|
|
14743
|
-
entry.uncompressedSize = readUInt64LE(zip64EiefBuffer, index);
|
|
14744
|
-
index += 8;
|
|
14745
|
-
}
|
|
14746
|
-
if (entry.compressedSize === 4294967295) {
|
|
14747
|
-
if (index + 8 > zip64EiefBuffer.length) {
|
|
14748
|
-
return emitErrorAndAutoClose(self, new Error("zip64 extended information extra field does not include compressed size"));
|
|
14749
|
-
}
|
|
14750
|
-
entry.compressedSize = readUInt64LE(zip64EiefBuffer, index);
|
|
14751
|
-
index += 8;
|
|
14752
|
-
}
|
|
14753
|
-
if (entry.relativeOffsetOfLocalHeader === 4294967295) {
|
|
14754
|
-
if (index + 8 > zip64EiefBuffer.length) {
|
|
14755
|
-
return emitErrorAndAutoClose(self, new Error("zip64 extended information extra field does not include relative header offset"));
|
|
14756
|
-
}
|
|
14757
|
-
entry.relativeOffsetOfLocalHeader = readUInt64LE(zip64EiefBuffer, index);
|
|
14758
|
-
index += 8;
|
|
14759
|
-
}
|
|
14760
|
-
break;
|
|
14761
|
-
}
|
|
14762
|
-
if (self.validateEntrySizes && entry.compressionMethod === 0) {
|
|
14763
|
-
var expectedCompressedSize = entry.uncompressedSize;
|
|
14764
|
-
if (entry.isEncrypted()) {
|
|
14765
|
-
expectedCompressedSize += 12;
|
|
14766
|
-
}
|
|
14767
|
-
if (entry.compressedSize !== expectedCompressedSize) {
|
|
14768
|
-
var msg = "compressed/uncompressed size mismatch for stored file: " + entry.compressedSize + " != " + entry.uncompressedSize;
|
|
14769
|
-
return emitErrorAndAutoClose(self, new Error(msg));
|
|
14770
|
-
}
|
|
14771
|
-
}
|
|
14772
|
-
self.emit("entry", entry);
|
|
14773
|
-
if (!self.lazyEntries)
|
|
14774
|
-
self._readEntry();
|
|
14775
|
-
});
|
|
14776
|
-
});
|
|
14777
|
-
};
|
|
14778
|
-
ZipFile.prototype.openReadStream = function(entry, options2, callback) {
|
|
14779
|
-
var self = this;
|
|
14780
|
-
var relativeStart = 0;
|
|
14781
|
-
var relativeEnd = entry.compressedSize;
|
|
14782
|
-
if (callback == null) {
|
|
14783
|
-
callback = options2;
|
|
14784
|
-
options2 = null;
|
|
14785
|
-
}
|
|
14786
|
-
if (options2 == null) {
|
|
14787
|
-
options2 = {};
|
|
14788
|
-
} else {
|
|
14789
|
-
if (options2.decrypt != null) {
|
|
14790
|
-
if (!entry.isEncrypted()) {
|
|
14791
|
-
throw new Error("options.decrypt can only be specified for encrypted entries");
|
|
14792
|
-
}
|
|
14793
|
-
if (options2.decrypt !== false)
|
|
14794
|
-
throw new Error("invalid options.decrypt value: " + options2.decrypt);
|
|
14795
|
-
if (entry.isCompressed()) {
|
|
14796
|
-
if (options2.decompress !== false)
|
|
14797
|
-
throw new Error("entry is encrypted and compressed, and options.decompress !== false");
|
|
14798
|
-
}
|
|
14799
|
-
}
|
|
14800
|
-
if (options2.decompress != null) {
|
|
14801
|
-
if (!entry.isCompressed()) {
|
|
14802
|
-
throw new Error("options.decompress can only be specified for compressed entries");
|
|
14803
|
-
}
|
|
14804
|
-
if (!(options2.decompress === false || options2.decompress === true)) {
|
|
14805
|
-
throw new Error("invalid options.decompress value: " + options2.decompress);
|
|
14806
|
-
}
|
|
14807
|
-
}
|
|
14808
|
-
if (options2.start != null || options2.end != null) {
|
|
14809
|
-
if (entry.isCompressed() && options2.decompress !== false) {
|
|
14810
|
-
throw new Error("start/end range not allowed for compressed entry without options.decompress === false");
|
|
14811
|
-
}
|
|
14812
|
-
if (entry.isEncrypted() && options2.decrypt !== false) {
|
|
14813
|
-
throw new Error("start/end range not allowed for encrypted entry without options.decrypt === false");
|
|
14814
|
-
}
|
|
14815
|
-
}
|
|
14816
|
-
if (options2.start != null) {
|
|
14817
|
-
relativeStart = options2.start;
|
|
14818
|
-
if (relativeStart < 0)
|
|
14819
|
-
throw new Error("options.start < 0");
|
|
14820
|
-
if (relativeStart > entry.compressedSize)
|
|
14821
|
-
throw new Error("options.start > entry.compressedSize");
|
|
14822
|
-
}
|
|
14823
|
-
if (options2.end != null) {
|
|
14824
|
-
relativeEnd = options2.end;
|
|
14825
|
-
if (relativeEnd < 0)
|
|
14826
|
-
throw new Error("options.end < 0");
|
|
14827
|
-
if (relativeEnd > entry.compressedSize)
|
|
14828
|
-
throw new Error("options.end > entry.compressedSize");
|
|
14829
|
-
if (relativeEnd < relativeStart)
|
|
14830
|
-
throw new Error("options.end < options.start");
|
|
14831
|
-
}
|
|
14832
|
-
}
|
|
14833
|
-
if (!self.isOpen)
|
|
14834
|
-
return callback(new Error("closed"));
|
|
14835
|
-
if (entry.isEncrypted()) {
|
|
14836
|
-
if (options2.decrypt !== false)
|
|
14837
|
-
return callback(new Error("entry is encrypted, and options.decrypt !== false"));
|
|
14838
|
-
}
|
|
14839
|
-
var decompress;
|
|
14840
|
-
if (entry.compressionMethod === 0) {
|
|
14841
|
-
decompress = false;
|
|
14842
|
-
} else if (entry.compressionMethod === 8) {
|
|
14843
|
-
decompress = options2.decompress != null ? options2.decompress : true;
|
|
14844
|
-
} else {
|
|
14845
|
-
return callback(new Error("unsupported compression method: " + entry.compressionMethod));
|
|
14846
|
-
}
|
|
14847
|
-
self.readLocalFileHeader(entry, { minimal: true }, function(err, localFileHeader) {
|
|
14848
|
-
if (err)
|
|
14849
|
-
return callback(err);
|
|
14850
|
-
self.openReadStreamLowLevel(localFileHeader.fileDataStart, entry.compressedSize, relativeStart, relativeEnd, decompress, entry.uncompressedSize, callback);
|
|
14851
|
-
});
|
|
14852
|
-
};
|
|
14853
|
-
ZipFile.prototype.openReadStreamLowLevel = function(fileDataStart, compressedSize, relativeStart, relativeEnd, decompress, uncompressedSize, callback) {
|
|
14854
|
-
var self = this;
|
|
14855
|
-
var fileDataEnd = fileDataStart + compressedSize;
|
|
14856
|
-
var readStream = self.reader.createReadStream({
|
|
14857
|
-
start: fileDataStart + relativeStart,
|
|
14858
|
-
end: fileDataStart + relativeEnd
|
|
14859
|
-
});
|
|
14860
|
-
var endpointStream = readStream;
|
|
14861
|
-
if (decompress) {
|
|
14862
|
-
var destroyed = false;
|
|
14863
|
-
var inflateFilter = zlib.createInflateRaw();
|
|
14864
|
-
readStream.on("error", function(err) {
|
|
14865
|
-
setImmediate(function() {
|
|
14866
|
-
if (!destroyed)
|
|
14867
|
-
inflateFilter.emit("error", err);
|
|
14868
|
-
});
|
|
14869
|
-
});
|
|
14870
|
-
readStream.pipe(inflateFilter);
|
|
14871
|
-
if (self.validateEntrySizes) {
|
|
14872
|
-
endpointStream = new AssertByteCountStream(uncompressedSize);
|
|
14873
|
-
inflateFilter.on("error", function(err) {
|
|
14874
|
-
setImmediate(function() {
|
|
14875
|
-
if (!destroyed)
|
|
14876
|
-
endpointStream.emit("error", err);
|
|
14877
|
-
});
|
|
14878
|
-
});
|
|
14879
|
-
inflateFilter.pipe(endpointStream);
|
|
14880
|
-
} else {
|
|
14881
|
-
endpointStream = inflateFilter;
|
|
14882
|
-
}
|
|
14883
|
-
installDestroyFn(endpointStream, function() {
|
|
14884
|
-
destroyed = true;
|
|
14885
|
-
if (inflateFilter !== endpointStream)
|
|
14886
|
-
inflateFilter.unpipe(endpointStream);
|
|
14887
|
-
readStream.unpipe(inflateFilter);
|
|
14888
|
-
readStream.destroy();
|
|
14889
|
-
});
|
|
14890
|
-
}
|
|
14891
|
-
callback(null, endpointStream);
|
|
14892
|
-
};
|
|
14893
|
-
ZipFile.prototype.readLocalFileHeader = function(entry, options2, callback) {
|
|
14894
|
-
var self = this;
|
|
14895
|
-
if (callback == null) {
|
|
14896
|
-
callback = options2;
|
|
14897
|
-
options2 = null;
|
|
14898
|
-
}
|
|
14899
|
-
if (options2 == null)
|
|
14900
|
-
options2 = {};
|
|
14901
|
-
self.reader.ref();
|
|
14902
|
-
var buffer = newBuffer(30);
|
|
14903
|
-
readAndAssertNoEof(self.reader, buffer, 0, buffer.length, entry.relativeOffsetOfLocalHeader, function(err) {
|
|
14904
|
-
try {
|
|
14905
|
-
if (err)
|
|
14906
|
-
return callback(err);
|
|
14907
|
-
var signature = buffer.readUInt32LE(0);
|
|
14908
|
-
if (signature !== 67324752) {
|
|
14909
|
-
return callback(new Error("invalid local file header signature: 0x" + signature.toString(16)));
|
|
14910
|
-
}
|
|
14911
|
-
var fileNameLength = buffer.readUInt16LE(26);
|
|
14912
|
-
var extraFieldLength = buffer.readUInt16LE(28);
|
|
14913
|
-
var fileDataStart = entry.relativeOffsetOfLocalHeader + 30 + fileNameLength + extraFieldLength;
|
|
14914
|
-
if (fileDataStart + entry.compressedSize > self.fileSize) {
|
|
14915
|
-
return callback(new Error("file data overflows file bounds: " + fileDataStart + " + " + entry.compressedSize + " > " + self.fileSize));
|
|
14916
|
-
}
|
|
14917
|
-
if (options2.minimal) {
|
|
14918
|
-
return callback(null, { fileDataStart });
|
|
14919
|
-
}
|
|
14920
|
-
var localFileHeader = new LocalFileHeader;
|
|
14921
|
-
localFileHeader.fileDataStart = fileDataStart;
|
|
14922
|
-
localFileHeader.versionNeededToExtract = buffer.readUInt16LE(4);
|
|
14923
|
-
localFileHeader.generalPurposeBitFlag = buffer.readUInt16LE(6);
|
|
14924
|
-
localFileHeader.compressionMethod = buffer.readUInt16LE(8);
|
|
14925
|
-
localFileHeader.lastModFileTime = buffer.readUInt16LE(10);
|
|
14926
|
-
localFileHeader.lastModFileDate = buffer.readUInt16LE(12);
|
|
14927
|
-
localFileHeader.crc32 = buffer.readUInt32LE(14);
|
|
14928
|
-
localFileHeader.compressedSize = buffer.readUInt32LE(18);
|
|
14929
|
-
localFileHeader.uncompressedSize = buffer.readUInt32LE(22);
|
|
14930
|
-
localFileHeader.fileNameLength = fileNameLength;
|
|
14931
|
-
localFileHeader.extraFieldLength = extraFieldLength;
|
|
14932
|
-
buffer = newBuffer(fileNameLength + extraFieldLength);
|
|
14933
|
-
self.reader.ref();
|
|
14934
|
-
readAndAssertNoEof(self.reader, buffer, 0, buffer.length, entry.relativeOffsetOfLocalHeader + 30, function(err2) {
|
|
14935
|
-
try {
|
|
14936
|
-
if (err2)
|
|
14937
|
-
return callback(err2);
|
|
14938
|
-
localFileHeader.fileName = buffer.subarray(0, fileNameLength);
|
|
14939
|
-
localFileHeader.extraField = buffer.subarray(fileNameLength);
|
|
14940
|
-
return callback(null, localFileHeader);
|
|
14941
|
-
} finally {
|
|
14942
|
-
self.reader.unref();
|
|
14943
|
-
}
|
|
14944
|
-
});
|
|
14945
|
-
} finally {
|
|
14946
|
-
self.reader.unref();
|
|
14947
|
-
}
|
|
14948
|
-
});
|
|
14949
|
-
};
|
|
14950
|
-
function Entry() {}
|
|
14951
|
-
Entry.prototype.getLastModDate = function(options2) {
|
|
14952
|
-
if (options2 == null)
|
|
14953
|
-
options2 = {};
|
|
14954
|
-
if (!options2.forceDosFormat) {
|
|
14955
|
-
for (var i = 0;i < this.extraFields.length; i++) {
|
|
14956
|
-
var extraField = this.extraFields[i];
|
|
14957
|
-
if (extraField.id === 21589) {
|
|
14958
|
-
var data = extraField.data;
|
|
14959
|
-
if (data.length < 5)
|
|
14960
|
-
continue;
|
|
14961
|
-
var flags = data[0];
|
|
14962
|
-
var HAS_MTIME = 1;
|
|
14963
|
-
if (!(flags & HAS_MTIME))
|
|
14964
|
-
continue;
|
|
14965
|
-
var posixTimestamp = data.readInt32LE(1);
|
|
14966
|
-
return new Date(posixTimestamp * 1000);
|
|
14967
|
-
} else if (extraField.id === 10) {
|
|
14968
|
-
var data = extraField.data;
|
|
14969
|
-
var cursor = 4;
|
|
14970
|
-
while (cursor < data.length + 4) {
|
|
14971
|
-
var tag = data.readUInt16LE(cursor);
|
|
14972
|
-
cursor += 2;
|
|
14973
|
-
var size = data.readUInt16LE(cursor);
|
|
14974
|
-
cursor += 2;
|
|
14975
|
-
if (tag !== 1) {
|
|
14976
|
-
cursor += size;
|
|
14977
|
-
continue;
|
|
14978
|
-
}
|
|
14979
|
-
if (size < 8 || cursor + size > data.length)
|
|
14980
|
-
break;
|
|
14981
|
-
var hundredNanoSecondsSince1601 = 4294967296 * data.readInt32LE(cursor + 4) + data.readUInt32LE(cursor);
|
|
14982
|
-
var millisecondsSince1970 = hundredNanoSecondsSince1601 / 1e4 - 11644473600000;
|
|
14983
|
-
return new Date(millisecondsSince1970);
|
|
14984
|
-
}
|
|
14985
|
-
}
|
|
14986
|
-
}
|
|
14987
|
-
}
|
|
14988
|
-
return dosDateTimeToDate(this.lastModFileDate, this.lastModFileTime, options2.timezone);
|
|
14989
|
-
};
|
|
14990
|
-
Entry.prototype.isEncrypted = function() {
|
|
14991
|
-
return (this.generalPurposeBitFlag & 1) !== 0;
|
|
14992
|
-
};
|
|
14993
|
-
Entry.prototype.isCompressed = function() {
|
|
14994
|
-
return this.compressionMethod === 8;
|
|
14995
|
-
};
|
|
14996
|
-
function LocalFileHeader() {}
|
|
14997
|
-
function dosDateTimeToDate(date8, time5, timezone) {
|
|
14998
|
-
var day = date8 & 31;
|
|
14999
|
-
var month = (date8 >> 5 & 15) - 1;
|
|
15000
|
-
var year = (date8 >> 9 & 127) + 1980;
|
|
15001
|
-
var millisecond = 0;
|
|
15002
|
-
var second = (time5 & 31) * 2;
|
|
15003
|
-
var minute = time5 >> 5 & 63;
|
|
15004
|
-
var hour = time5 >> 11 & 31;
|
|
15005
|
-
if (timezone == null || timezone === "local") {
|
|
15006
|
-
return new Date(year, month, day, hour, minute, second, millisecond);
|
|
15007
|
-
} else if (timezone === "UTC") {
|
|
15008
|
-
return new Date(Date.UTC(year, month, day, hour, minute, second, millisecond));
|
|
15009
|
-
} else {
|
|
15010
|
-
throw new Error("unrecognized options.timezone: " + options.timezone);
|
|
15011
|
-
}
|
|
15012
|
-
}
|
|
15013
|
-
function getFileNameLowLevel(generalPurposeBitFlag, fileNameBuffer, extraFields, strictFileNames) {
|
|
15014
|
-
var fileName = null;
|
|
15015
|
-
for (var i = 0;i < extraFields.length; i++) {
|
|
15016
|
-
var extraField = extraFields[i];
|
|
15017
|
-
if (extraField.id === 28789) {
|
|
15018
|
-
if (extraField.data.length < 6) {
|
|
15019
|
-
continue;
|
|
15020
|
-
}
|
|
15021
|
-
if (extraField.data.readUInt8(0) !== 1) {
|
|
15022
|
-
continue;
|
|
15023
|
-
}
|
|
15024
|
-
var oldNameCrc32 = extraField.data.readUInt32LE(1);
|
|
15025
|
-
if (crc32.unsigned(fileNameBuffer) !== oldNameCrc32) {
|
|
15026
|
-
continue;
|
|
15027
|
-
}
|
|
15028
|
-
fileName = decodeBuffer(extraField.data.subarray(5), true);
|
|
15029
|
-
break;
|
|
15030
|
-
}
|
|
15031
|
-
}
|
|
15032
|
-
if (fileName == null) {
|
|
15033
|
-
var isUtf8 = (generalPurposeBitFlag & 2048) !== 0;
|
|
15034
|
-
fileName = decodeBuffer(fileNameBuffer, isUtf8);
|
|
15035
|
-
}
|
|
15036
|
-
if (!strictFileNames) {
|
|
15037
|
-
fileName = fileName.replace(/\\/g, "/");
|
|
15038
|
-
}
|
|
15039
|
-
return fileName;
|
|
15040
|
-
}
|
|
15041
|
-
function validateFileName(fileName) {
|
|
15042
|
-
if (fileName.indexOf("\\") !== -1) {
|
|
15043
|
-
return "invalid characters in fileName: " + fileName;
|
|
15044
|
-
}
|
|
15045
|
-
if (/^[a-zA-Z]:/.test(fileName) || /^\//.test(fileName)) {
|
|
15046
|
-
return "absolute path: " + fileName;
|
|
15047
|
-
}
|
|
15048
|
-
if (fileName.split("/").indexOf("..") !== -1) {
|
|
15049
|
-
return "invalid relative path: " + fileName;
|
|
15050
|
-
}
|
|
15051
|
-
return null;
|
|
15052
|
-
}
|
|
15053
|
-
function parseExtraFields(extraFieldBuffer) {
|
|
15054
|
-
var extraFields = [];
|
|
15055
|
-
var i = 0;
|
|
15056
|
-
while (i < extraFieldBuffer.length - 3) {
|
|
15057
|
-
var headerId = extraFieldBuffer.readUInt16LE(i + 0);
|
|
15058
|
-
var dataSize = extraFieldBuffer.readUInt16LE(i + 2);
|
|
15059
|
-
var dataStart = i + 4;
|
|
15060
|
-
var dataEnd = dataStart + dataSize;
|
|
15061
|
-
if (dataEnd > extraFieldBuffer.length)
|
|
15062
|
-
throw new Error("extra field length exceeds extra field buffer size");
|
|
15063
|
-
var dataBuffer = extraFieldBuffer.subarray(dataStart, dataEnd);
|
|
15064
|
-
extraFields.push({
|
|
15065
|
-
id: headerId,
|
|
15066
|
-
data: dataBuffer
|
|
15067
|
-
});
|
|
15068
|
-
i = dataEnd;
|
|
15069
|
-
}
|
|
15070
|
-
return extraFields;
|
|
15071
|
-
}
|
|
15072
|
-
function readAndAssertNoEof(reader, buffer, offset, length, position, callback) {
|
|
15073
|
-
if (length === 0) {
|
|
15074
|
-
return setImmediate(function() {
|
|
15075
|
-
callback(null, newBuffer(0));
|
|
15076
|
-
});
|
|
15077
|
-
}
|
|
15078
|
-
reader.read(buffer, offset, length, position, function(err, bytesRead) {
|
|
15079
|
-
if (err)
|
|
15080
|
-
return callback(err);
|
|
15081
|
-
if (bytesRead < length) {
|
|
15082
|
-
return callback(new Error("unexpected EOF"));
|
|
15083
|
-
}
|
|
15084
|
-
callback();
|
|
15085
|
-
});
|
|
15086
|
-
}
|
|
15087
|
-
util3.inherits(AssertByteCountStream, Transform);
|
|
15088
|
-
function AssertByteCountStream(byteCount) {
|
|
15089
|
-
Transform.call(this);
|
|
15090
|
-
this.actualByteCount = 0;
|
|
15091
|
-
this.expectedByteCount = byteCount;
|
|
15092
|
-
}
|
|
15093
|
-
AssertByteCountStream.prototype._transform = function(chunk, encoding, cb) {
|
|
15094
|
-
this.actualByteCount += chunk.length;
|
|
15095
|
-
if (this.actualByteCount > this.expectedByteCount) {
|
|
15096
|
-
var msg = "too many bytes in the stream. expected " + this.expectedByteCount + ". got at least " + this.actualByteCount;
|
|
15097
|
-
return cb(new Error(msg));
|
|
15098
|
-
}
|
|
15099
|
-
cb(null, chunk);
|
|
15100
|
-
};
|
|
15101
|
-
AssertByteCountStream.prototype._flush = function(cb) {
|
|
15102
|
-
if (this.actualByteCount < this.expectedByteCount) {
|
|
15103
|
-
var msg = "not enough bytes in the stream. expected " + this.expectedByteCount + ". got only " + this.actualByteCount;
|
|
15104
|
-
return cb(new Error(msg));
|
|
15105
|
-
}
|
|
15106
|
-
cb();
|
|
15107
|
-
};
|
|
15108
|
-
util3.inherits(RandomAccessReader, EventEmitter2);
|
|
15109
|
-
function RandomAccessReader() {
|
|
15110
|
-
EventEmitter2.call(this);
|
|
15111
|
-
this.refCount = 0;
|
|
15112
|
-
}
|
|
15113
|
-
RandomAccessReader.prototype.ref = function() {
|
|
15114
|
-
this.refCount += 1;
|
|
15115
|
-
};
|
|
15116
|
-
RandomAccessReader.prototype.unref = function() {
|
|
15117
|
-
var self = this;
|
|
15118
|
-
self.refCount -= 1;
|
|
15119
|
-
if (self.refCount > 0)
|
|
15120
|
-
return;
|
|
15121
|
-
if (self.refCount < 0)
|
|
15122
|
-
throw new Error("invalid unref");
|
|
15123
|
-
self.close(onCloseDone);
|
|
15124
|
-
function onCloseDone(err) {
|
|
15125
|
-
if (err)
|
|
15126
|
-
return self.emit("error", err);
|
|
15127
|
-
self.emit("close");
|
|
15128
|
-
}
|
|
15129
|
-
};
|
|
15130
|
-
RandomAccessReader.prototype.createReadStream = function(options2) {
|
|
15131
|
-
if (options2 == null)
|
|
15132
|
-
options2 = {};
|
|
15133
|
-
var start = options2.start;
|
|
15134
|
-
var end = options2.end;
|
|
15135
|
-
if (start === end) {
|
|
15136
|
-
var emptyStream = new PassThrough;
|
|
15137
|
-
setImmediate(function() {
|
|
15138
|
-
emptyStream.end();
|
|
15139
|
-
});
|
|
15140
|
-
return emptyStream;
|
|
15141
|
-
}
|
|
15142
|
-
var stream = this._readStreamForRange(start, end);
|
|
15143
|
-
var destroyed = false;
|
|
15144
|
-
var refUnrefFilter = new RefUnrefFilter(this);
|
|
15145
|
-
stream.on("error", function(err) {
|
|
15146
|
-
setImmediate(function() {
|
|
15147
|
-
if (!destroyed)
|
|
15148
|
-
refUnrefFilter.emit("error", err);
|
|
15149
|
-
});
|
|
15150
|
-
});
|
|
15151
|
-
installDestroyFn(refUnrefFilter, function() {
|
|
15152
|
-
stream.unpipe(refUnrefFilter);
|
|
15153
|
-
refUnrefFilter.unref();
|
|
15154
|
-
stream.destroy();
|
|
15155
|
-
});
|
|
15156
|
-
var byteCounter = new AssertByteCountStream(end - start);
|
|
15157
|
-
refUnrefFilter.on("error", function(err) {
|
|
15158
|
-
setImmediate(function() {
|
|
15159
|
-
if (!destroyed)
|
|
15160
|
-
byteCounter.emit("error", err);
|
|
15161
|
-
});
|
|
15162
|
-
});
|
|
15163
|
-
installDestroyFn(byteCounter, function() {
|
|
15164
|
-
destroyed = true;
|
|
15165
|
-
refUnrefFilter.unpipe(byteCounter);
|
|
15166
|
-
refUnrefFilter.destroy();
|
|
15167
|
-
});
|
|
15168
|
-
return stream.pipe(refUnrefFilter).pipe(byteCounter);
|
|
15169
|
-
};
|
|
15170
|
-
RandomAccessReader.prototype._readStreamForRange = function(start, end) {
|
|
15171
|
-
throw new Error("not implemented");
|
|
15172
|
-
};
|
|
15173
|
-
RandomAccessReader.prototype.read = function(buffer, offset, length, position, callback) {
|
|
15174
|
-
var readStream = this.createReadStream({ start: position, end: position + length });
|
|
15175
|
-
var writeStream = new Writable;
|
|
15176
|
-
var written = 0;
|
|
15177
|
-
writeStream._write = function(chunk, encoding, cb) {
|
|
15178
|
-
chunk.copy(buffer, offset + written, 0, chunk.length);
|
|
15179
|
-
written += chunk.length;
|
|
15180
|
-
cb();
|
|
15181
|
-
};
|
|
15182
|
-
writeStream.on("finish", callback);
|
|
15183
|
-
readStream.on("error", function(error49) {
|
|
15184
|
-
callback(error49);
|
|
15185
|
-
});
|
|
15186
|
-
readStream.pipe(writeStream);
|
|
15187
|
-
};
|
|
15188
|
-
RandomAccessReader.prototype.close = function(callback) {
|
|
15189
|
-
setImmediate(callback);
|
|
15190
|
-
};
|
|
15191
|
-
util3.inherits(RefUnrefFilter, PassThrough);
|
|
15192
|
-
function RefUnrefFilter(context) {
|
|
15193
|
-
PassThrough.call(this);
|
|
15194
|
-
this.context = context;
|
|
15195
|
-
this.context.ref();
|
|
15196
|
-
this.unreffedYet = false;
|
|
15197
|
-
}
|
|
15198
|
-
RefUnrefFilter.prototype._flush = function(cb) {
|
|
15199
|
-
this.unref();
|
|
15200
|
-
cb();
|
|
15201
|
-
};
|
|
15202
|
-
RefUnrefFilter.prototype.unref = function(cb) {
|
|
15203
|
-
if (this.unreffedYet)
|
|
15204
|
-
return;
|
|
15205
|
-
this.unreffedYet = true;
|
|
15206
|
-
this.context.unref();
|
|
15207
|
-
};
|
|
15208
|
-
var cp437 = "\x00☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ";
|
|
15209
|
-
function decodeBuffer(buffer, isUtf8) {
|
|
15210
|
-
if (isUtf8) {
|
|
15211
|
-
return buffer.toString("utf8");
|
|
15212
|
-
} else {
|
|
15213
|
-
var result = "";
|
|
15214
|
-
for (var i = 0;i < buffer.length; i++) {
|
|
15215
|
-
result += cp437[buffer[i]];
|
|
15216
|
-
}
|
|
15217
|
-
return result;
|
|
15218
|
-
}
|
|
15219
|
-
}
|
|
15220
|
-
function readUInt64LE(buffer, offset) {
|
|
15221
|
-
var lower32 = buffer.readUInt32LE(offset);
|
|
15222
|
-
var upper32 = buffer.readUInt32LE(offset + 4);
|
|
15223
|
-
return upper32 * 4294967296 + lower32;
|
|
15224
|
-
}
|
|
15225
|
-
var newBuffer;
|
|
15226
|
-
if (typeof Buffer.allocUnsafe === "function") {
|
|
15227
|
-
newBuffer = function(len) {
|
|
15228
|
-
return Buffer.allocUnsafe(len);
|
|
15229
|
-
};
|
|
15230
|
-
} else {
|
|
15231
|
-
newBuffer = function(len) {
|
|
15232
|
-
return new Buffer(len);
|
|
15233
|
-
};
|
|
15234
|
-
}
|
|
15235
|
-
function installDestroyFn(stream, fn) {
|
|
15236
|
-
if (typeof stream.destroy === "function") {
|
|
15237
|
-
stream._destroy = function(err, cb) {
|
|
15238
|
-
fn();
|
|
15239
|
-
if (cb != null)
|
|
15240
|
-
cb(err);
|
|
15241
|
-
};
|
|
15242
|
-
} else {
|
|
15243
|
-
stream.destroy = fn;
|
|
15244
|
-
}
|
|
15245
|
-
}
|
|
15246
|
-
function defaultCallback(err) {
|
|
15247
|
-
if (err)
|
|
15248
|
-
throw err;
|
|
15249
|
-
}
|
|
15250
|
-
});
|
|
15251
|
-
|
|
15252
13804
|
// node_modules/ws/lib/constants.js
|
|
15253
13805
|
var require_constants2 = __commonJS((exports, module) => {
|
|
15254
13806
|
var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
|
|
@@ -15394,9 +13946,9 @@ var require_permessage_deflate = __commonJS((exports, module) => {
|
|
|
15394
13946
|
var zlibLimiter;
|
|
15395
13947
|
|
|
15396
13948
|
class PerMessageDeflate {
|
|
15397
|
-
constructor(
|
|
13949
|
+
constructor(options, isServer, maxPayload) {
|
|
15398
13950
|
this._maxPayload = maxPayload | 0;
|
|
15399
|
-
this._options =
|
|
13951
|
+
this._options = options || {};
|
|
15400
13952
|
this._threshold = this._options.threshold !== undefined ? this._options.threshold : 1024;
|
|
15401
13953
|
this._isServer = !!isServer;
|
|
15402
13954
|
this._deflate = null;
|
|
@@ -15851,14 +14403,14 @@ var require_receiver = __commonJS((exports, module) => {
|
|
|
15851
14403
|
var DEFER_EVENT = 6;
|
|
15852
14404
|
|
|
15853
14405
|
class Receiver extends Writable {
|
|
15854
|
-
constructor(
|
|
14406
|
+
constructor(options = {}) {
|
|
15855
14407
|
super();
|
|
15856
|
-
this._allowSynchronousEvents =
|
|
15857
|
-
this._binaryType =
|
|
15858
|
-
this._extensions =
|
|
15859
|
-
this._isServer = !!
|
|
15860
|
-
this._maxPayload =
|
|
15861
|
-
this._skipUTF8Validation = !!
|
|
14408
|
+
this._allowSynchronousEvents = options.allowSynchronousEvents !== undefined ? options.allowSynchronousEvents : true;
|
|
14409
|
+
this._binaryType = options.binaryType || BINARY_TYPES[0];
|
|
14410
|
+
this._extensions = options.extensions || {};
|
|
14411
|
+
this._isServer = !!options.isServer;
|
|
14412
|
+
this._maxPayload = options.maxPayload | 0;
|
|
14413
|
+
this._skipUTF8Validation = !!options.skipUTF8Validation;
|
|
15862
14414
|
this[kWebSocket] = undefined;
|
|
15863
14415
|
this._bufferedBytes = 0;
|
|
15864
14416
|
this._buffers = [];
|
|
@@ -16243,15 +14795,15 @@ var require_sender = __commonJS((exports, module) => {
|
|
|
16243
14795
|
this.onerror = NOOP;
|
|
16244
14796
|
this[kWebSocket] = undefined;
|
|
16245
14797
|
}
|
|
16246
|
-
static frame(data,
|
|
14798
|
+
static frame(data, options) {
|
|
16247
14799
|
let mask;
|
|
16248
14800
|
let merge4 = false;
|
|
16249
14801
|
let offset = 2;
|
|
16250
14802
|
let skipMasking = false;
|
|
16251
|
-
if (
|
|
16252
|
-
mask =
|
|
16253
|
-
if (
|
|
16254
|
-
|
|
14803
|
+
if (options.mask) {
|
|
14804
|
+
mask = options.maskBuffer || maskBuffer;
|
|
14805
|
+
if (options.generateMask) {
|
|
14806
|
+
options.generateMask(mask);
|
|
16255
14807
|
} else {
|
|
16256
14808
|
if (randomPoolPointer === RANDOM_POOL_SIZE) {
|
|
16257
14809
|
if (randomPool === undefined) {
|
|
@@ -16270,15 +14822,15 @@ var require_sender = __commonJS((exports, module) => {
|
|
|
16270
14822
|
}
|
|
16271
14823
|
let dataLength;
|
|
16272
14824
|
if (typeof data === "string") {
|
|
16273
|
-
if ((!
|
|
16274
|
-
dataLength =
|
|
14825
|
+
if ((!options.mask || skipMasking) && options[kByteLength] !== undefined) {
|
|
14826
|
+
dataLength = options[kByteLength];
|
|
16275
14827
|
} else {
|
|
16276
14828
|
data = Buffer.from(data);
|
|
16277
14829
|
dataLength = data.length;
|
|
16278
14830
|
}
|
|
16279
14831
|
} else {
|
|
16280
14832
|
dataLength = data.length;
|
|
16281
|
-
merge4 =
|
|
14833
|
+
merge4 = options.mask && options.readOnly && !skipMasking;
|
|
16282
14834
|
}
|
|
16283
14835
|
let payloadLength = dataLength;
|
|
16284
14836
|
if (dataLength >= 65536) {
|
|
@@ -16289,8 +14841,8 @@ var require_sender = __commonJS((exports, module) => {
|
|
|
16289
14841
|
payloadLength = 126;
|
|
16290
14842
|
}
|
|
16291
14843
|
const target = Buffer.allocUnsafe(merge4 ? dataLength + offset : offset);
|
|
16292
|
-
target[0] =
|
|
16293
|
-
if (
|
|
14844
|
+
target[0] = options.fin ? options.opcode | 128 : options.opcode;
|
|
14845
|
+
if (options.rsv1)
|
|
16294
14846
|
target[0] |= 64;
|
|
16295
14847
|
target[1] = payloadLength;
|
|
16296
14848
|
if (payloadLength === 126) {
|
|
@@ -16299,7 +14851,7 @@ var require_sender = __commonJS((exports, module) => {
|
|
|
16299
14851
|
target[2] = target[3] = 0;
|
|
16300
14852
|
target.writeUIntBE(dataLength, 4, 6);
|
|
16301
14853
|
}
|
|
16302
|
-
if (!
|
|
14854
|
+
if (!options.mask)
|
|
16303
14855
|
return [target, data];
|
|
16304
14856
|
target[1] |= 128;
|
|
16305
14857
|
target[offset - 4] = mask[0];
|
|
@@ -16337,7 +14889,7 @@ var require_sender = __commonJS((exports, module) => {
|
|
|
16337
14889
|
buf.set(data, 2);
|
|
16338
14890
|
}
|
|
16339
14891
|
}
|
|
16340
|
-
const
|
|
14892
|
+
const options = {
|
|
16341
14893
|
[kByteLength]: buf.length,
|
|
16342
14894
|
fin: true,
|
|
16343
14895
|
generateMask: this._generateMask,
|
|
@@ -16348,9 +14900,9 @@ var require_sender = __commonJS((exports, module) => {
|
|
|
16348
14900
|
rsv1: false
|
|
16349
14901
|
};
|
|
16350
14902
|
if (this._state !== DEFAULT) {
|
|
16351
|
-
this.enqueue([this.dispatch, buf, false,
|
|
14903
|
+
this.enqueue([this.dispatch, buf, false, options, cb]);
|
|
16352
14904
|
} else {
|
|
16353
|
-
this.sendFrame(Sender.frame(buf,
|
|
14905
|
+
this.sendFrame(Sender.frame(buf, options), cb);
|
|
16354
14906
|
}
|
|
16355
14907
|
}
|
|
16356
14908
|
ping(data, mask, cb) {
|
|
@@ -16370,7 +14922,7 @@ var require_sender = __commonJS((exports, module) => {
|
|
|
16370
14922
|
if (byteLength > 125) {
|
|
16371
14923
|
throw new RangeError("The data size must not be greater than 125 bytes");
|
|
16372
14924
|
}
|
|
16373
|
-
const
|
|
14925
|
+
const options = {
|
|
16374
14926
|
[kByteLength]: byteLength,
|
|
16375
14927
|
fin: true,
|
|
16376
14928
|
generateMask: this._generateMask,
|
|
@@ -16382,14 +14934,14 @@ var require_sender = __commonJS((exports, module) => {
|
|
|
16382
14934
|
};
|
|
16383
14935
|
if (isBlob(data)) {
|
|
16384
14936
|
if (this._state !== DEFAULT) {
|
|
16385
|
-
this.enqueue([this.getBlobData, data, false,
|
|
14937
|
+
this.enqueue([this.getBlobData, data, false, options, cb]);
|
|
16386
14938
|
} else {
|
|
16387
|
-
this.getBlobData(data, false,
|
|
14939
|
+
this.getBlobData(data, false, options, cb);
|
|
16388
14940
|
}
|
|
16389
14941
|
} else if (this._state !== DEFAULT) {
|
|
16390
|
-
this.enqueue([this.dispatch, data, false,
|
|
14942
|
+
this.enqueue([this.dispatch, data, false, options, cb]);
|
|
16391
14943
|
} else {
|
|
16392
|
-
this.sendFrame(Sender.frame(data,
|
|
14944
|
+
this.sendFrame(Sender.frame(data, options), cb);
|
|
16393
14945
|
}
|
|
16394
14946
|
}
|
|
16395
14947
|
pong(data, mask, cb) {
|
|
@@ -16409,7 +14961,7 @@ var require_sender = __commonJS((exports, module) => {
|
|
|
16409
14961
|
if (byteLength > 125) {
|
|
16410
14962
|
throw new RangeError("The data size must not be greater than 125 bytes");
|
|
16411
14963
|
}
|
|
16412
|
-
const
|
|
14964
|
+
const options = {
|
|
16413
14965
|
[kByteLength]: byteLength,
|
|
16414
14966
|
fin: true,
|
|
16415
14967
|
generateMask: this._generateMask,
|
|
@@ -16421,20 +14973,20 @@ var require_sender = __commonJS((exports, module) => {
|
|
|
16421
14973
|
};
|
|
16422
14974
|
if (isBlob(data)) {
|
|
16423
14975
|
if (this._state !== DEFAULT) {
|
|
16424
|
-
this.enqueue([this.getBlobData, data, false,
|
|
14976
|
+
this.enqueue([this.getBlobData, data, false, options, cb]);
|
|
16425
14977
|
} else {
|
|
16426
|
-
this.getBlobData(data, false,
|
|
14978
|
+
this.getBlobData(data, false, options, cb);
|
|
16427
14979
|
}
|
|
16428
14980
|
} else if (this._state !== DEFAULT) {
|
|
16429
|
-
this.enqueue([this.dispatch, data, false,
|
|
14981
|
+
this.enqueue([this.dispatch, data, false, options, cb]);
|
|
16430
14982
|
} else {
|
|
16431
|
-
this.sendFrame(Sender.frame(data,
|
|
14983
|
+
this.sendFrame(Sender.frame(data, options), cb);
|
|
16432
14984
|
}
|
|
16433
14985
|
}
|
|
16434
|
-
send(data,
|
|
14986
|
+
send(data, options, cb) {
|
|
16435
14987
|
const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
|
|
16436
|
-
let opcode =
|
|
16437
|
-
let rsv1 =
|
|
14988
|
+
let opcode = options.binary ? 2 : 1;
|
|
14989
|
+
let rsv1 = options.compress;
|
|
16438
14990
|
let byteLength;
|
|
16439
14991
|
let readOnly;
|
|
16440
14992
|
if (typeof data === "string") {
|
|
@@ -16458,13 +15010,13 @@ var require_sender = __commonJS((exports, module) => {
|
|
|
16458
15010
|
rsv1 = false;
|
|
16459
15011
|
opcode = 0;
|
|
16460
15012
|
}
|
|
16461
|
-
if (
|
|
15013
|
+
if (options.fin)
|
|
16462
15014
|
this._firstFragment = true;
|
|
16463
15015
|
const opts = {
|
|
16464
15016
|
[kByteLength]: byteLength,
|
|
16465
|
-
fin:
|
|
15017
|
+
fin: options.fin,
|
|
16466
15018
|
generateMask: this._generateMask,
|
|
16467
|
-
mask:
|
|
15019
|
+
mask: options.mask,
|
|
16468
15020
|
maskBuffer: this._maskBuffer,
|
|
16469
15021
|
opcode,
|
|
16470
15022
|
readOnly,
|
|
@@ -16482,8 +15034,8 @@ var require_sender = __commonJS((exports, module) => {
|
|
|
16482
15034
|
this.dispatch(data, this._compress, opts, cb);
|
|
16483
15035
|
}
|
|
16484
15036
|
}
|
|
16485
|
-
getBlobData(blob, compress,
|
|
16486
|
-
this._bufferedBytes +=
|
|
15037
|
+
getBlobData(blob, compress, options, cb) {
|
|
15038
|
+
this._bufferedBytes += options[kByteLength];
|
|
16487
15039
|
this._state = GET_BLOB_DATA;
|
|
16488
15040
|
blob.arrayBuffer().then((arrayBuffer) => {
|
|
16489
15041
|
if (this._socket.destroyed) {
|
|
@@ -16491,37 +15043,37 @@ var require_sender = __commonJS((exports, module) => {
|
|
|
16491
15043
|
process.nextTick(callCallbacks, this, err, cb);
|
|
16492
15044
|
return;
|
|
16493
15045
|
}
|
|
16494
|
-
this._bufferedBytes -=
|
|
15046
|
+
this._bufferedBytes -= options[kByteLength];
|
|
16495
15047
|
const data = toBuffer(arrayBuffer);
|
|
16496
15048
|
if (!compress) {
|
|
16497
15049
|
this._state = DEFAULT;
|
|
16498
|
-
this.sendFrame(Sender.frame(data,
|
|
15050
|
+
this.sendFrame(Sender.frame(data, options), cb);
|
|
16499
15051
|
this.dequeue();
|
|
16500
15052
|
} else {
|
|
16501
|
-
this.dispatch(data, compress,
|
|
15053
|
+
this.dispatch(data, compress, options, cb);
|
|
16502
15054
|
}
|
|
16503
15055
|
}).catch((err) => {
|
|
16504
15056
|
process.nextTick(onError, this, err, cb);
|
|
16505
15057
|
});
|
|
16506
15058
|
}
|
|
16507
|
-
dispatch(data, compress,
|
|
15059
|
+
dispatch(data, compress, options, cb) {
|
|
16508
15060
|
if (!compress) {
|
|
16509
|
-
this.sendFrame(Sender.frame(data,
|
|
15061
|
+
this.sendFrame(Sender.frame(data, options), cb);
|
|
16510
15062
|
return;
|
|
16511
15063
|
}
|
|
16512
15064
|
const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
|
|
16513
|
-
this._bufferedBytes +=
|
|
15065
|
+
this._bufferedBytes += options[kByteLength];
|
|
16514
15066
|
this._state = DEFLATING;
|
|
16515
|
-
perMessageDeflate.compress(data,
|
|
15067
|
+
perMessageDeflate.compress(data, options.fin, (_, buf) => {
|
|
16516
15068
|
if (this._socket.destroyed) {
|
|
16517
15069
|
const err = new Error("The socket was closed while data was being compressed");
|
|
16518
15070
|
callCallbacks(this, err, cb);
|
|
16519
15071
|
return;
|
|
16520
15072
|
}
|
|
16521
|
-
this._bufferedBytes -=
|
|
15073
|
+
this._bufferedBytes -= options[kByteLength];
|
|
16522
15074
|
this._state = DEFAULT;
|
|
16523
|
-
|
|
16524
|
-
this.sendFrame(Sender.frame(buf,
|
|
15075
|
+
options.readOnly = false;
|
|
15076
|
+
this.sendFrame(Sender.frame(buf, options), cb);
|
|
16525
15077
|
this.dequeue();
|
|
16526
15078
|
});
|
|
16527
15079
|
}
|
|
@@ -16592,11 +15144,11 @@ var require_event_target = __commonJS((exports, module) => {
|
|
|
16592
15144
|
Object.defineProperty(Event.prototype, "type", { enumerable: true });
|
|
16593
15145
|
|
|
16594
15146
|
class CloseEvent extends Event {
|
|
16595
|
-
constructor(type2,
|
|
15147
|
+
constructor(type2, options = {}) {
|
|
16596
15148
|
super(type2);
|
|
16597
|
-
this[kCode] =
|
|
16598
|
-
this[kReason] =
|
|
16599
|
-
this[kWasClean] =
|
|
15149
|
+
this[kCode] = options.code === undefined ? 0 : options.code;
|
|
15150
|
+
this[kReason] = options.reason === undefined ? "" : options.reason;
|
|
15151
|
+
this[kWasClean] = options.wasClean === undefined ? false : options.wasClean;
|
|
16600
15152
|
}
|
|
16601
15153
|
get code() {
|
|
16602
15154
|
return this[kCode];
|
|
@@ -16613,10 +15165,10 @@ var require_event_target = __commonJS((exports, module) => {
|
|
|
16613
15165
|
Object.defineProperty(CloseEvent.prototype, "wasClean", { enumerable: true });
|
|
16614
15166
|
|
|
16615
15167
|
class ErrorEvent extends Event {
|
|
16616
|
-
constructor(type2,
|
|
15168
|
+
constructor(type2, options = {}) {
|
|
16617
15169
|
super(type2);
|
|
16618
|
-
this[kError] =
|
|
16619
|
-
this[kMessage] =
|
|
15170
|
+
this[kError] = options.error === undefined ? null : options.error;
|
|
15171
|
+
this[kMessage] = options.message === undefined ? "" : options.message;
|
|
16620
15172
|
}
|
|
16621
15173
|
get error() {
|
|
16622
15174
|
return this[kError];
|
|
@@ -16629,9 +15181,9 @@ var require_event_target = __commonJS((exports, module) => {
|
|
|
16629
15181
|
Object.defineProperty(ErrorEvent.prototype, "message", { enumerable: true });
|
|
16630
15182
|
|
|
16631
15183
|
class MessageEvent extends Event {
|
|
16632
|
-
constructor(type2,
|
|
15184
|
+
constructor(type2, options = {}) {
|
|
16633
15185
|
super(type2);
|
|
16634
|
-
this[kData] =
|
|
15186
|
+
this[kData] = options.data === undefined ? null : options.data;
|
|
16635
15187
|
}
|
|
16636
15188
|
get data() {
|
|
16637
15189
|
return this[kData];
|
|
@@ -16639,9 +15191,9 @@ var require_event_target = __commonJS((exports, module) => {
|
|
|
16639
15191
|
}
|
|
16640
15192
|
Object.defineProperty(MessageEvent.prototype, "data", { enumerable: true });
|
|
16641
15193
|
var EventTarget = {
|
|
16642
|
-
addEventListener(type2, handler2,
|
|
15194
|
+
addEventListener(type2, handler2, options = {}) {
|
|
16643
15195
|
for (const listener of this.listeners(type2)) {
|
|
16644
|
-
if (!
|
|
15196
|
+
if (!options[kForOnEventAttribute] && listener[kListener] === handler2 && !listener[kForOnEventAttribute]) {
|
|
16645
15197
|
return;
|
|
16646
15198
|
}
|
|
16647
15199
|
}
|
|
@@ -16682,9 +15234,9 @@ var require_event_target = __commonJS((exports, module) => {
|
|
|
16682
15234
|
} else {
|
|
16683
15235
|
return;
|
|
16684
15236
|
}
|
|
16685
|
-
wrapper[kForOnEventAttribute] = !!
|
|
15237
|
+
wrapper[kForOnEventAttribute] = !!options[kForOnEventAttribute];
|
|
16686
15238
|
wrapper[kListener] = handler2;
|
|
16687
|
-
if (
|
|
15239
|
+
if (options.once) {
|
|
16688
15240
|
this.once(type2, wrapper);
|
|
16689
15241
|
} else {
|
|
16690
15242
|
this.on(type2, wrapper);
|
|
@@ -16916,7 +15468,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
16916
15468
|
var subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
|
|
16917
15469
|
|
|
16918
15470
|
class WebSocket extends EventEmitter3 {
|
|
16919
|
-
constructor(address, protocols,
|
|
15471
|
+
constructor(address, protocols, options) {
|
|
16920
15472
|
super();
|
|
16921
15473
|
this._binaryType = BINARY_TYPES[0];
|
|
16922
15474
|
this._closeCode = 1006;
|
|
@@ -16940,15 +15492,15 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
16940
15492
|
protocols = [];
|
|
16941
15493
|
} else if (!Array.isArray(protocols)) {
|
|
16942
15494
|
if (typeof protocols === "object" && protocols !== null) {
|
|
16943
|
-
|
|
15495
|
+
options = protocols;
|
|
16944
15496
|
protocols = [];
|
|
16945
15497
|
} else {
|
|
16946
15498
|
protocols = [protocols];
|
|
16947
15499
|
}
|
|
16948
15500
|
}
|
|
16949
|
-
initAsClient(this, address, protocols,
|
|
15501
|
+
initAsClient(this, address, protocols, options);
|
|
16950
15502
|
} else {
|
|
16951
|
-
this._autoPong =
|
|
15503
|
+
this._autoPong = options.autoPong;
|
|
16952
15504
|
this._isServer = true;
|
|
16953
15505
|
}
|
|
16954
15506
|
}
|
|
@@ -16994,16 +15546,16 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
16994
15546
|
get url() {
|
|
16995
15547
|
return this._url;
|
|
16996
15548
|
}
|
|
16997
|
-
setSocket(socket, head,
|
|
15549
|
+
setSocket(socket, head, options) {
|
|
16998
15550
|
const receiver = new Receiver({
|
|
16999
|
-
allowSynchronousEvents:
|
|
15551
|
+
allowSynchronousEvents: options.allowSynchronousEvents,
|
|
17000
15552
|
binaryType: this.binaryType,
|
|
17001
15553
|
extensions: this._extensions,
|
|
17002
15554
|
isServer: this._isServer,
|
|
17003
|
-
maxPayload:
|
|
17004
|
-
skipUTF8Validation:
|
|
15555
|
+
maxPayload: options.maxPayload,
|
|
15556
|
+
skipUTF8Validation: options.skipUTF8Validation
|
|
17005
15557
|
});
|
|
17006
|
-
const sender = new Sender(socket, this._extensions,
|
|
15558
|
+
const sender = new Sender(socket, this._extensions, options.generateMask);
|
|
17007
15559
|
this._receiver = receiver;
|
|
17008
15560
|
this._sender = sender;
|
|
17009
15561
|
this._socket = socket;
|
|
@@ -17125,13 +15677,13 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
17125
15677
|
if (!this._receiver._writableState.needDrain)
|
|
17126
15678
|
this._socket.resume();
|
|
17127
15679
|
}
|
|
17128
|
-
send(data,
|
|
15680
|
+
send(data, options, cb) {
|
|
17129
15681
|
if (this.readyState === WebSocket.CONNECTING) {
|
|
17130
15682
|
throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
17131
15683
|
}
|
|
17132
|
-
if (typeof
|
|
17133
|
-
cb =
|
|
17134
|
-
|
|
15684
|
+
if (typeof options === "function") {
|
|
15685
|
+
cb = options;
|
|
15686
|
+
options = {};
|
|
17135
15687
|
}
|
|
17136
15688
|
if (typeof data === "number")
|
|
17137
15689
|
data = data.toString();
|
|
@@ -17144,7 +15696,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
17144
15696
|
mask: !this._isServer,
|
|
17145
15697
|
compress: true,
|
|
17146
15698
|
fin: true,
|
|
17147
|
-
...
|
|
15699
|
+
...options
|
|
17148
15700
|
};
|
|
17149
15701
|
if (!this._extensions[PerMessageDeflate.extensionName]) {
|
|
17150
15702
|
opts.compress = false;
|
|
@@ -17236,7 +15788,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
17236
15788
|
WebSocket.prototype.addEventListener = addEventListener;
|
|
17237
15789
|
WebSocket.prototype.removeEventListener = removeEventListener;
|
|
17238
15790
|
module.exports = WebSocket;
|
|
17239
|
-
function initAsClient(websocket, address, protocols,
|
|
15791
|
+
function initAsClient(websocket, address, protocols, options) {
|
|
17240
15792
|
const opts = {
|
|
17241
15793
|
allowSynchronousEvents: true,
|
|
17242
15794
|
autoPong: true,
|
|
@@ -17246,7 +15798,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
17246
15798
|
perMessageDeflate: true,
|
|
17247
15799
|
followRedirects: false,
|
|
17248
15800
|
maxRedirects: 10,
|
|
17249
|
-
...
|
|
15801
|
+
...options,
|
|
17250
15802
|
socketPath: undefined,
|
|
17251
15803
|
hostname: undefined,
|
|
17252
15804
|
protocol: undefined,
|
|
@@ -17349,11 +15901,11 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
17349
15901
|
websocket._originalIpc = isIpcUrl;
|
|
17350
15902
|
websocket._originalSecure = isSecure;
|
|
17351
15903
|
websocket._originalHostOrSocketPath = isIpcUrl ? opts.socketPath : parsedUrl.host;
|
|
17352
|
-
const headers =
|
|
17353
|
-
|
|
15904
|
+
const headers = options && options.headers;
|
|
15905
|
+
options = { ...options, headers: {} };
|
|
17354
15906
|
if (headers) {
|
|
17355
15907
|
for (const [key2, value] of Object.entries(headers)) {
|
|
17356
|
-
|
|
15908
|
+
options.headers[key2.toLowerCase()] = value;
|
|
17357
15909
|
}
|
|
17358
15910
|
}
|
|
17359
15911
|
} else if (websocket.listenerCount("redirect") === 0) {
|
|
@@ -17366,8 +15918,8 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
17366
15918
|
opts.auth = undefined;
|
|
17367
15919
|
}
|
|
17368
15920
|
}
|
|
17369
|
-
if (opts.auth && !
|
|
17370
|
-
|
|
15921
|
+
if (opts.auth && !options.headers.authorization) {
|
|
15922
|
+
options.headers.authorization = "Basic " + Buffer.from(opts.auth).toString("base64");
|
|
17371
15923
|
}
|
|
17372
15924
|
req = websocket._req = request(opts);
|
|
17373
15925
|
if (websocket._redirects) {
|
|
@@ -17404,7 +15956,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
17404
15956
|
emitErrorAndClose(websocket, err);
|
|
17405
15957
|
return;
|
|
17406
15958
|
}
|
|
17407
|
-
initAsClient(websocket, addr, protocols,
|
|
15959
|
+
initAsClient(websocket, addr, protocols, options);
|
|
17408
15960
|
} else if (!websocket.emit("unexpected-response", req, res)) {
|
|
17409
15961
|
abortHandshake(websocket, req, `Unexpected server response: ${res.statusCode}`);
|
|
17410
15962
|
}
|
|
@@ -17490,16 +16042,16 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
17490
16042
|
websocket.emit("error", err);
|
|
17491
16043
|
websocket.emitClose();
|
|
17492
16044
|
}
|
|
17493
|
-
function netConnect(
|
|
17494
|
-
|
|
17495
|
-
return net.connect(
|
|
16045
|
+
function netConnect(options) {
|
|
16046
|
+
options.path = options.socketPath;
|
|
16047
|
+
return net.connect(options);
|
|
17496
16048
|
}
|
|
17497
|
-
function tlsConnect(
|
|
17498
|
-
|
|
17499
|
-
if (!
|
|
17500
|
-
|
|
16049
|
+
function tlsConnect(options) {
|
|
16050
|
+
options.path = undefined;
|
|
16051
|
+
if (!options.servername && options.servername !== "") {
|
|
16052
|
+
options.servername = net.isIP(options.host) ? "" : options.host;
|
|
17501
16053
|
}
|
|
17502
|
-
return tls.connect(
|
|
16054
|
+
return tls.connect(options);
|
|
17503
16055
|
}
|
|
17504
16056
|
function abortHandshake(websocket, stream, message) {
|
|
17505
16057
|
websocket._readyState = WebSocket.CLOSING;
|
|
@@ -17658,10 +16210,10 @@ var require_stream = __commonJS((exports, module) => {
|
|
|
17658
16210
|
this.emit("error", err);
|
|
17659
16211
|
}
|
|
17660
16212
|
}
|
|
17661
|
-
function createWebSocketStream(ws,
|
|
16213
|
+
function createWebSocketStream(ws, options) {
|
|
17662
16214
|
let terminateOnDestroy = true;
|
|
17663
16215
|
const duplex = new Duplex({
|
|
17664
|
-
...
|
|
16216
|
+
...options,
|
|
17665
16217
|
autoDestroy: false,
|
|
17666
16218
|
emitClose: false,
|
|
17667
16219
|
objectMode: false,
|
|
@@ -17804,9 +16356,9 @@ var require_websocket_server = __commonJS((exports, module) => {
|
|
|
17804
16356
|
var CLOSED = 2;
|
|
17805
16357
|
|
|
17806
16358
|
class WebSocketServer extends EventEmitter3 {
|
|
17807
|
-
constructor(
|
|
16359
|
+
constructor(options, callback) {
|
|
17808
16360
|
super();
|
|
17809
|
-
|
|
16361
|
+
options = {
|
|
17810
16362
|
allowSynchronousEvents: true,
|
|
17811
16363
|
autoPong: true,
|
|
17812
16364
|
maxPayload: 100 * 1024 * 1024,
|
|
@@ -17822,12 +16374,12 @@ var require_websocket_server = __commonJS((exports, module) => {
|
|
|
17822
16374
|
path: null,
|
|
17823
16375
|
port: null,
|
|
17824
16376
|
WebSocket,
|
|
17825
|
-
...
|
|
16377
|
+
...options
|
|
17826
16378
|
};
|
|
17827
|
-
if (
|
|
16379
|
+
if (options.port == null && !options.server && !options.noServer || options.port != null && (options.server || options.noServer) || options.server && options.noServer) {
|
|
17828
16380
|
throw new TypeError('One and only one of the "port", "server", or "noServer" options ' + "must be specified");
|
|
17829
16381
|
}
|
|
17830
|
-
if (
|
|
16382
|
+
if (options.port != null) {
|
|
17831
16383
|
this._server = http.createServer((req, res) => {
|
|
17832
16384
|
const body = http.STATUS_CODES[426];
|
|
17833
16385
|
res.writeHead(426, {
|
|
@@ -17836,9 +16388,9 @@ var require_websocket_server = __commonJS((exports, module) => {
|
|
|
17836
16388
|
});
|
|
17837
16389
|
res.end(body);
|
|
17838
16390
|
});
|
|
17839
|
-
this._server.listen(
|
|
17840
|
-
} else if (
|
|
17841
|
-
this._server =
|
|
16391
|
+
this._server.listen(options.port, options.host, options.backlog, callback);
|
|
16392
|
+
} else if (options.server) {
|
|
16393
|
+
this._server = options.server;
|
|
17842
16394
|
}
|
|
17843
16395
|
if (this._server) {
|
|
17844
16396
|
const emitConnection = this.emit.bind(this, "connection");
|
|
@@ -17850,13 +16402,13 @@ var require_websocket_server = __commonJS((exports, module) => {
|
|
|
17850
16402
|
}
|
|
17851
16403
|
});
|
|
17852
16404
|
}
|
|
17853
|
-
if (
|
|
17854
|
-
|
|
17855
|
-
if (
|
|
16405
|
+
if (options.perMessageDeflate === true)
|
|
16406
|
+
options.perMessageDeflate = {};
|
|
16407
|
+
if (options.clientTracking) {
|
|
17856
16408
|
this.clients = new Set;
|
|
17857
16409
|
this._shouldEmitClose = false;
|
|
17858
16410
|
}
|
|
17859
|
-
this.options =
|
|
16411
|
+
this.options = options;
|
|
17860
16412
|
this._state = RUNNING;
|
|
17861
16413
|
}
|
|
17862
16414
|
address() {
|
|
@@ -19342,48 +17894,48 @@ class ZodString extends ZodType {
|
|
|
19342
17894
|
...errorUtil.errToObj(message)
|
|
19343
17895
|
});
|
|
19344
17896
|
}
|
|
19345
|
-
jwt(
|
|
19346
|
-
return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(
|
|
17897
|
+
jwt(options) {
|
|
17898
|
+
return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
|
|
19347
17899
|
}
|
|
19348
|
-
ip(
|
|
19349
|
-
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(
|
|
17900
|
+
ip(options) {
|
|
17901
|
+
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
|
19350
17902
|
}
|
|
19351
|
-
cidr(
|
|
19352
|
-
return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(
|
|
17903
|
+
cidr(options) {
|
|
17904
|
+
return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
|
|
19353
17905
|
}
|
|
19354
|
-
datetime(
|
|
19355
|
-
if (typeof
|
|
17906
|
+
datetime(options) {
|
|
17907
|
+
if (typeof options === "string") {
|
|
19356
17908
|
return this._addCheck({
|
|
19357
17909
|
kind: "datetime",
|
|
19358
17910
|
precision: null,
|
|
19359
17911
|
offset: false,
|
|
19360
17912
|
local: false,
|
|
19361
|
-
message:
|
|
17913
|
+
message: options
|
|
19362
17914
|
});
|
|
19363
17915
|
}
|
|
19364
17916
|
return this._addCheck({
|
|
19365
17917
|
kind: "datetime",
|
|
19366
|
-
precision: typeof
|
|
19367
|
-
offset:
|
|
19368
|
-
local:
|
|
19369
|
-
...errorUtil.errToObj(
|
|
17918
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
|
17919
|
+
offset: options?.offset ?? false,
|
|
17920
|
+
local: options?.local ?? false,
|
|
17921
|
+
...errorUtil.errToObj(options?.message)
|
|
19370
17922
|
});
|
|
19371
17923
|
}
|
|
19372
17924
|
date(message) {
|
|
19373
17925
|
return this._addCheck({ kind: "date", message });
|
|
19374
17926
|
}
|
|
19375
|
-
time(
|
|
19376
|
-
if (typeof
|
|
17927
|
+
time(options) {
|
|
17928
|
+
if (typeof options === "string") {
|
|
19377
17929
|
return this._addCheck({
|
|
19378
17930
|
kind: "time",
|
|
19379
17931
|
precision: null,
|
|
19380
|
-
message:
|
|
17932
|
+
message: options
|
|
19381
17933
|
});
|
|
19382
17934
|
}
|
|
19383
17935
|
return this._addCheck({
|
|
19384
17936
|
kind: "time",
|
|
19385
|
-
precision: typeof
|
|
19386
|
-
...errorUtil.errToObj(
|
|
17937
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
|
17938
|
+
...errorUtil.errToObj(options?.message)
|
|
19387
17939
|
});
|
|
19388
17940
|
}
|
|
19389
17941
|
duration(message) {
|
|
@@ -19396,12 +17948,12 @@ class ZodString extends ZodType {
|
|
|
19396
17948
|
...errorUtil.errToObj(message)
|
|
19397
17949
|
});
|
|
19398
17950
|
}
|
|
19399
|
-
includes(value,
|
|
17951
|
+
includes(value, options) {
|
|
19400
17952
|
return this._addCheck({
|
|
19401
17953
|
kind: "includes",
|
|
19402
17954
|
value,
|
|
19403
|
-
position:
|
|
19404
|
-
...errorUtil.errToObj(
|
|
17955
|
+
position: options?.position,
|
|
17956
|
+
...errorUtil.errToObj(options?.message)
|
|
19405
17957
|
});
|
|
19406
17958
|
}
|
|
19407
17959
|
startsWith(value, message) {
|
|
@@ -20611,7 +19163,7 @@ ZodObject.lazycreate = (shape, params) => {
|
|
|
20611
19163
|
class ZodUnion extends ZodType {
|
|
20612
19164
|
_parse(input) {
|
|
20613
19165
|
const { ctx } = this._processInputParams(input);
|
|
20614
|
-
const
|
|
19166
|
+
const options = this._def.options;
|
|
20615
19167
|
function handleResults(results) {
|
|
20616
19168
|
for (const result of results) {
|
|
20617
19169
|
if (result.result.status === "valid") {
|
|
@@ -20632,7 +19184,7 @@ class ZodUnion extends ZodType {
|
|
|
20632
19184
|
return INVALID;
|
|
20633
19185
|
}
|
|
20634
19186
|
if (ctx.common.async) {
|
|
20635
|
-
return Promise.all(
|
|
19187
|
+
return Promise.all(options.map(async (option) => {
|
|
20636
19188
|
const childCtx = {
|
|
20637
19189
|
...ctx,
|
|
20638
19190
|
common: {
|
|
@@ -20653,7 +19205,7 @@ class ZodUnion extends ZodType {
|
|
|
20653
19205
|
} else {
|
|
20654
19206
|
let dirty = undefined;
|
|
20655
19207
|
const issues = [];
|
|
20656
|
-
for (const option of
|
|
19208
|
+
for (const option of options) {
|
|
20657
19209
|
const childCtx = {
|
|
20658
19210
|
...ctx,
|
|
20659
19211
|
common: {
|
|
@@ -20776,9 +19328,9 @@ class ZodDiscriminatedUnion extends ZodType {
|
|
|
20776
19328
|
get optionsMap() {
|
|
20777
19329
|
return this._def.optionsMap;
|
|
20778
19330
|
}
|
|
20779
|
-
static create(discriminator,
|
|
19331
|
+
static create(discriminator, options, params) {
|
|
20780
19332
|
const optionsMap = new Map;
|
|
20781
|
-
for (const type of
|
|
19333
|
+
for (const type of options) {
|
|
20782
19334
|
const discriminatorValues = getDiscriminator(type.shape[discriminator]);
|
|
20783
19335
|
if (!discriminatorValues.length) {
|
|
20784
19336
|
throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
|
|
@@ -20793,7 +19345,7 @@ class ZodDiscriminatedUnion extends ZodType {
|
|
|
20793
19345
|
return new ZodDiscriminatedUnion({
|
|
20794
19346
|
typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
|
|
20795
19347
|
discriminator,
|
|
20796
|
-
options
|
|
19348
|
+
options,
|
|
20797
19349
|
optionsMap,
|
|
20798
19350
|
...processCreateParams(params)
|
|
20799
19351
|
});
|
|
@@ -25791,14 +24343,14 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
25791
24343
|
var unionProcessor = (schema, ctx, json, params) => {
|
|
25792
24344
|
const def = schema._zod.def;
|
|
25793
24345
|
const isExclusive = def.inclusive === false;
|
|
25794
|
-
const
|
|
24346
|
+
const options = def.options.map((x, i) => process2(x, ctx, {
|
|
25795
24347
|
...params,
|
|
25796
24348
|
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
|
|
25797
24349
|
}));
|
|
25798
24350
|
if (isExclusive) {
|
|
25799
|
-
json.oneOf =
|
|
24351
|
+
json.oneOf = options;
|
|
25800
24352
|
} else {
|
|
25801
|
-
json.anyOf =
|
|
24353
|
+
json.anyOf = options;
|
|
25802
24354
|
}
|
|
25803
24355
|
};
|
|
25804
24356
|
var intersectionProcessor = (schema, ctx, json, params) => {
|
|
@@ -26646,10 +25198,10 @@ var ZodUnion2 = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
|
26646
25198
|
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
26647
25199
|
inst.options = def.options;
|
|
26648
25200
|
});
|
|
26649
|
-
function union(
|
|
25201
|
+
function union(options, params) {
|
|
26650
25202
|
return new ZodUnion2({
|
|
26651
25203
|
type: "union",
|
|
26652
|
-
options
|
|
25204
|
+
options,
|
|
26653
25205
|
...exports_util.normalizeParams(params)
|
|
26654
25206
|
});
|
|
26655
25207
|
}
|
|
@@ -26657,10 +25209,10 @@ var ZodDiscriminatedUnion2 = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion
|
|
|
26657
25209
|
ZodUnion2.init(inst, def);
|
|
26658
25210
|
$ZodDiscriminatedUnion.init(inst, def);
|
|
26659
25211
|
});
|
|
26660
|
-
function discriminatedUnion(discriminator,
|
|
25212
|
+
function discriminatedUnion(discriminator, options, params) {
|
|
26661
25213
|
return new ZodDiscriminatedUnion2({
|
|
26662
25214
|
type: "union",
|
|
26663
|
-
options
|
|
25215
|
+
options,
|
|
26664
25216
|
discriminator,
|
|
26665
25217
|
...exports_util.normalizeParams(params)
|
|
26666
25218
|
});
|
|
@@ -27798,16 +26350,16 @@ var defaultOptions = {
|
|
|
27798
26350
|
nameStrategy: "ref",
|
|
27799
26351
|
openAiAnyTypeName: "OpenAiAnyType"
|
|
27800
26352
|
};
|
|
27801
|
-
var getDefaultOptions = (
|
|
26353
|
+
var getDefaultOptions = (options) => typeof options === "string" ? {
|
|
27802
26354
|
...defaultOptions,
|
|
27803
|
-
name:
|
|
26355
|
+
name: options
|
|
27804
26356
|
} : {
|
|
27805
26357
|
...defaultOptions,
|
|
27806
|
-
...
|
|
26358
|
+
...options
|
|
27807
26359
|
};
|
|
27808
26360
|
// node_modules/zod-to-json-schema/dist/esm/Refs.js
|
|
27809
|
-
var getRefs = (
|
|
27810
|
-
const _options = getDefaultOptions(
|
|
26361
|
+
var getRefs = (options) => {
|
|
26362
|
+
const _options = getDefaultOptions(options);
|
|
27811
26363
|
const currentPath = _options.name !== undefined ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
|
|
27812
26364
|
return {
|
|
27813
26365
|
..._options,
|
|
@@ -29090,48 +27642,48 @@ class ZodString3 extends ZodType3 {
|
|
|
29090
27642
|
...errorUtil2.errToObj(message)
|
|
29091
27643
|
});
|
|
29092
27644
|
}
|
|
29093
|
-
jwt(
|
|
29094
|
-
return this._addCheck({ kind: "jwt", ...errorUtil2.errToObj(
|
|
27645
|
+
jwt(options) {
|
|
27646
|
+
return this._addCheck({ kind: "jwt", ...errorUtil2.errToObj(options) });
|
|
29095
27647
|
}
|
|
29096
|
-
ip(
|
|
29097
|
-
return this._addCheck({ kind: "ip", ...errorUtil2.errToObj(
|
|
27648
|
+
ip(options) {
|
|
27649
|
+
return this._addCheck({ kind: "ip", ...errorUtil2.errToObj(options) });
|
|
29098
27650
|
}
|
|
29099
|
-
cidr(
|
|
29100
|
-
return this._addCheck({ kind: "cidr", ...errorUtil2.errToObj(
|
|
27651
|
+
cidr(options) {
|
|
27652
|
+
return this._addCheck({ kind: "cidr", ...errorUtil2.errToObj(options) });
|
|
29101
27653
|
}
|
|
29102
|
-
datetime(
|
|
29103
|
-
if (typeof
|
|
27654
|
+
datetime(options) {
|
|
27655
|
+
if (typeof options === "string") {
|
|
29104
27656
|
return this._addCheck({
|
|
29105
27657
|
kind: "datetime",
|
|
29106
27658
|
precision: null,
|
|
29107
27659
|
offset: false,
|
|
29108
27660
|
local: false,
|
|
29109
|
-
message:
|
|
27661
|
+
message: options
|
|
29110
27662
|
});
|
|
29111
27663
|
}
|
|
29112
27664
|
return this._addCheck({
|
|
29113
27665
|
kind: "datetime",
|
|
29114
|
-
precision: typeof
|
|
29115
|
-
offset:
|
|
29116
|
-
local:
|
|
29117
|
-
...errorUtil2.errToObj(
|
|
27666
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
|
27667
|
+
offset: options?.offset ?? false,
|
|
27668
|
+
local: options?.local ?? false,
|
|
27669
|
+
...errorUtil2.errToObj(options?.message)
|
|
29118
27670
|
});
|
|
29119
27671
|
}
|
|
29120
27672
|
date(message) {
|
|
29121
27673
|
return this._addCheck({ kind: "date", message });
|
|
29122
27674
|
}
|
|
29123
|
-
time(
|
|
29124
|
-
if (typeof
|
|
27675
|
+
time(options) {
|
|
27676
|
+
if (typeof options === "string") {
|
|
29125
27677
|
return this._addCheck({
|
|
29126
27678
|
kind: "time",
|
|
29127
27679
|
precision: null,
|
|
29128
|
-
message:
|
|
27680
|
+
message: options
|
|
29129
27681
|
});
|
|
29130
27682
|
}
|
|
29131
27683
|
return this._addCheck({
|
|
29132
27684
|
kind: "time",
|
|
29133
|
-
precision: typeof
|
|
29134
|
-
...errorUtil2.errToObj(
|
|
27685
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
|
27686
|
+
...errorUtil2.errToObj(options?.message)
|
|
29135
27687
|
});
|
|
29136
27688
|
}
|
|
29137
27689
|
duration(message) {
|
|
@@ -29144,12 +27696,12 @@ class ZodString3 extends ZodType3 {
|
|
|
29144
27696
|
...errorUtil2.errToObj(message)
|
|
29145
27697
|
});
|
|
29146
27698
|
}
|
|
29147
|
-
includes(value,
|
|
27699
|
+
includes(value, options) {
|
|
29148
27700
|
return this._addCheck({
|
|
29149
27701
|
kind: "includes",
|
|
29150
27702
|
value,
|
|
29151
|
-
position:
|
|
29152
|
-
...errorUtil2.errToObj(
|
|
27703
|
+
position: options?.position,
|
|
27704
|
+
...errorUtil2.errToObj(options?.message)
|
|
29153
27705
|
});
|
|
29154
27706
|
}
|
|
29155
27707
|
startsWith(value, message) {
|
|
@@ -30359,7 +28911,7 @@ ZodObject3.lazycreate = (shape, params) => {
|
|
|
30359
28911
|
class ZodUnion3 extends ZodType3 {
|
|
30360
28912
|
_parse(input) {
|
|
30361
28913
|
const { ctx } = this._processInputParams(input);
|
|
30362
|
-
const
|
|
28914
|
+
const options = this._def.options;
|
|
30363
28915
|
function handleResults(results) {
|
|
30364
28916
|
for (const result of results) {
|
|
30365
28917
|
if (result.result.status === "valid") {
|
|
@@ -30380,7 +28932,7 @@ class ZodUnion3 extends ZodType3 {
|
|
|
30380
28932
|
return INVALID2;
|
|
30381
28933
|
}
|
|
30382
28934
|
if (ctx.common.async) {
|
|
30383
|
-
return Promise.all(
|
|
28935
|
+
return Promise.all(options.map(async (option) => {
|
|
30384
28936
|
const childCtx = {
|
|
30385
28937
|
...ctx,
|
|
30386
28938
|
common: {
|
|
@@ -30401,7 +28953,7 @@ class ZodUnion3 extends ZodType3 {
|
|
|
30401
28953
|
} else {
|
|
30402
28954
|
let dirty = undefined;
|
|
30403
28955
|
const issues = [];
|
|
30404
|
-
for (const option of
|
|
28956
|
+
for (const option of options) {
|
|
30405
28957
|
const childCtx = {
|
|
30406
28958
|
...ctx,
|
|
30407
28959
|
common: {
|
|
@@ -30524,9 +29076,9 @@ class ZodDiscriminatedUnion3 extends ZodType3 {
|
|
|
30524
29076
|
get optionsMap() {
|
|
30525
29077
|
return this._def.optionsMap;
|
|
30526
29078
|
}
|
|
30527
|
-
static create(discriminator,
|
|
29079
|
+
static create(discriminator, options, params) {
|
|
30528
29080
|
const optionsMap = new Map;
|
|
30529
|
-
for (const type of
|
|
29081
|
+
for (const type of options) {
|
|
30530
29082
|
const discriminatorValues = getDiscriminator2(type.shape[discriminator]);
|
|
30531
29083
|
if (!discriminatorValues.length) {
|
|
30532
29084
|
throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
|
|
@@ -30541,7 +29093,7 @@ class ZodDiscriminatedUnion3 extends ZodType3 {
|
|
|
30541
29093
|
return new ZodDiscriminatedUnion3({
|
|
30542
29094
|
typeName: ZodFirstPartyTypeKind2.ZodDiscriminatedUnion,
|
|
30543
29095
|
discriminator,
|
|
30544
|
-
options
|
|
29096
|
+
options,
|
|
30545
29097
|
optionsMap,
|
|
30546
29098
|
...processCreateParams2(params)
|
|
30547
29099
|
});
|
|
@@ -32309,17 +30861,17 @@ var primitiveMappings = {
|
|
|
32309
30861
|
function parseUnionDef(def, refs) {
|
|
32310
30862
|
if (refs.target === "openApi3")
|
|
32311
30863
|
return asAnyOf(def, refs);
|
|
32312
|
-
const
|
|
32313
|
-
if (
|
|
32314
|
-
const types =
|
|
30864
|
+
const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
|
|
30865
|
+
if (options.every((x) => (x._def.typeName in primitiveMappings) && (!x._def.checks || !x._def.checks.length))) {
|
|
30866
|
+
const types = options.reduce((types2, x) => {
|
|
32315
30867
|
const type = primitiveMappings[x._def.typeName];
|
|
32316
30868
|
return type && !types2.includes(type) ? [...types2, type] : types2;
|
|
32317
30869
|
}, []);
|
|
32318
30870
|
return {
|
|
32319
30871
|
type: types.length > 1 ? types : types[0]
|
|
32320
30872
|
};
|
|
32321
|
-
} else if (
|
|
32322
|
-
const types =
|
|
30873
|
+
} else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
|
|
30874
|
+
const types = options.reduce((acc, x) => {
|
|
32323
30875
|
const type = typeof x._def.value;
|
|
32324
30876
|
switch (type) {
|
|
32325
30877
|
case "string":
|
|
@@ -32338,19 +30890,19 @@ function parseUnionDef(def, refs) {
|
|
|
32338
30890
|
return acc;
|
|
32339
30891
|
}
|
|
32340
30892
|
}, []);
|
|
32341
|
-
if (types.length ===
|
|
30893
|
+
if (types.length === options.length) {
|
|
32342
30894
|
const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);
|
|
32343
30895
|
return {
|
|
32344
30896
|
type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
|
|
32345
|
-
enum:
|
|
30897
|
+
enum: options.reduce((acc, x) => {
|
|
32346
30898
|
return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
|
|
32347
30899
|
}, [])
|
|
32348
30900
|
};
|
|
32349
30901
|
}
|
|
32350
|
-
} else if (
|
|
30902
|
+
} else if (options.every((x) => x._def.typeName === "ZodEnum")) {
|
|
32351
30903
|
return {
|
|
32352
30904
|
type: "string",
|
|
32353
|
-
enum:
|
|
30905
|
+
enum: options.reduce((acc, x) => [
|
|
32354
30906
|
...acc,
|
|
32355
30907
|
...x._def.values.filter((x2) => !acc.includes(x2))
|
|
32356
30908
|
], [])
|
|
@@ -32760,21 +31312,21 @@ var addMeta = (def, refs, jsonSchema) => {
|
|
|
32760
31312
|
return jsonSchema;
|
|
32761
31313
|
};
|
|
32762
31314
|
// node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
|
|
32763
|
-
var zodToJsonSchema = (schema,
|
|
32764
|
-
const refs = getRefs(
|
|
32765
|
-
let definitions = typeof
|
|
31315
|
+
var zodToJsonSchema = (schema, options) => {
|
|
31316
|
+
const refs = getRefs(options);
|
|
31317
|
+
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name2, schema2]) => ({
|
|
32766
31318
|
...acc,
|
|
32767
31319
|
[name2]: parseDef(schema2._def, {
|
|
32768
31320
|
...refs,
|
|
32769
31321
|
currentPath: [...refs.basePath, refs.definitionPath, name2]
|
|
32770
31322
|
}, true) ?? parseAnyDef(refs)
|
|
32771
31323
|
}), {}) : undefined;
|
|
32772
|
-
const name = typeof
|
|
31324
|
+
const name = typeof options === "string" ? options : options?.nameStrategy === "title" ? undefined : options?.name;
|
|
32773
31325
|
const main = parseDef(schema._def, name === undefined ? refs : {
|
|
32774
31326
|
...refs,
|
|
32775
31327
|
currentPath: [...refs.basePath, refs.definitionPath, name]
|
|
32776
31328
|
}, false) ?? parseAnyDef(refs);
|
|
32777
|
-
const title = typeof
|
|
31329
|
+
const title = typeof options === "object" && options.name !== undefined && options.nameStrategy === "title" ? options.name : undefined;
|
|
32778
31330
|
if (title !== undefined) {
|
|
32779
31331
|
main.title = title;
|
|
32780
31332
|
}
|
|
@@ -33127,11 +31679,11 @@ class Protocol {
|
|
|
33127
31679
|
}
|
|
33128
31680
|
await this.notification(notification, notificationOptions);
|
|
33129
31681
|
},
|
|
33130
|
-
sendRequest: async (r, resultSchema,
|
|
31682
|
+
sendRequest: async (r, resultSchema, options) => {
|
|
33131
31683
|
if (abortController.signal.aborted) {
|
|
33132
31684
|
throw new McpError(ErrorCode.ConnectionClosed, "Request was cancelled");
|
|
33133
31685
|
}
|
|
33134
|
-
const requestOptions = { ...
|
|
31686
|
+
const requestOptions = { ...options, relatedRequestId: request.id };
|
|
33135
31687
|
if (relatedTaskId && !requestOptions.relatedTask) {
|
|
33136
31688
|
requestOptions.relatedTask = { taskId: relatedTaskId };
|
|
33137
31689
|
}
|
|
@@ -33268,11 +31820,11 @@ class Protocol {
|
|
|
33268
31820
|
async close() {
|
|
33269
31821
|
await this._transport?.close();
|
|
33270
31822
|
}
|
|
33271
|
-
async* requestStream(request, resultSchema,
|
|
33272
|
-
const { task } =
|
|
31823
|
+
async* requestStream(request, resultSchema, options) {
|
|
31824
|
+
const { task } = options ?? {};
|
|
33273
31825
|
if (!task) {
|
|
33274
31826
|
try {
|
|
33275
|
-
const result = await this.request(request, resultSchema,
|
|
31827
|
+
const result = await this.request(request, resultSchema, options);
|
|
33276
31828
|
yield { type: "result", result };
|
|
33277
31829
|
} catch (error2) {
|
|
33278
31830
|
yield {
|
|
@@ -33284,7 +31836,7 @@ class Protocol {
|
|
|
33284
31836
|
}
|
|
33285
31837
|
let taskId;
|
|
33286
31838
|
try {
|
|
33287
|
-
const createResult = await this.request(request, CreateTaskResultSchema,
|
|
31839
|
+
const createResult = await this.request(request, CreateTaskResultSchema, options);
|
|
33288
31840
|
if (createResult.task) {
|
|
33289
31841
|
taskId = createResult.task.taskId;
|
|
33290
31842
|
yield { type: "taskCreated", task: createResult.task };
|
|
@@ -33292,11 +31844,11 @@ class Protocol {
|
|
|
33292
31844
|
throw new McpError(ErrorCode.InternalError, "Task creation did not return a task");
|
|
33293
31845
|
}
|
|
33294
31846
|
while (true) {
|
|
33295
|
-
const task2 = await this.getTask({ taskId },
|
|
31847
|
+
const task2 = await this.getTask({ taskId }, options);
|
|
33296
31848
|
yield { type: "taskStatus", task: task2 };
|
|
33297
31849
|
if (isTerminal(task2.status)) {
|
|
33298
31850
|
if (task2.status === "completed") {
|
|
33299
|
-
const result = await this.getTaskResult({ taskId }, resultSchema,
|
|
31851
|
+
const result = await this.getTaskResult({ taskId }, resultSchema, options);
|
|
33300
31852
|
yield { type: "result", result };
|
|
33301
31853
|
} else if (task2.status === "failed") {
|
|
33302
31854
|
yield {
|
|
@@ -33312,13 +31864,13 @@ class Protocol {
|
|
|
33312
31864
|
return;
|
|
33313
31865
|
}
|
|
33314
31866
|
if (task2.status === "input_required") {
|
|
33315
|
-
const result = await this.getTaskResult({ taskId }, resultSchema,
|
|
31867
|
+
const result = await this.getTaskResult({ taskId }, resultSchema, options);
|
|
33316
31868
|
yield { type: "result", result };
|
|
33317
31869
|
return;
|
|
33318
31870
|
}
|
|
33319
31871
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1000;
|
|
33320
31872
|
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
33321
|
-
|
|
31873
|
+
options?.signal?.throwIfAborted();
|
|
33322
31874
|
}
|
|
33323
31875
|
} catch (error2) {
|
|
33324
31876
|
yield {
|
|
@@ -33327,8 +31879,8 @@ class Protocol {
|
|
|
33327
31879
|
};
|
|
33328
31880
|
}
|
|
33329
31881
|
}
|
|
33330
|
-
request(request, resultSchema,
|
|
33331
|
-
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } =
|
|
31882
|
+
request(request, resultSchema, options) {
|
|
31883
|
+
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
33332
31884
|
return new Promise((resolve, reject) => {
|
|
33333
31885
|
const earlyReject = (error2) => {
|
|
33334
31886
|
reject(error2);
|
|
@@ -33348,15 +31900,15 @@ class Protocol {
|
|
|
33348
31900
|
return;
|
|
33349
31901
|
}
|
|
33350
31902
|
}
|
|
33351
|
-
|
|
31903
|
+
options?.signal?.throwIfAborted();
|
|
33352
31904
|
const messageId = this._requestMessageId++;
|
|
33353
31905
|
const jsonrpcRequest = {
|
|
33354
31906
|
...request,
|
|
33355
31907
|
jsonrpc: "2.0",
|
|
33356
31908
|
id: messageId
|
|
33357
31909
|
};
|
|
33358
|
-
if (
|
|
33359
|
-
this._progressHandlers.set(messageId,
|
|
31910
|
+
if (options?.onprogress) {
|
|
31911
|
+
this._progressHandlers.set(messageId, options.onprogress);
|
|
33360
31912
|
jsonrpcRequest.params = {
|
|
33361
31913
|
...request.params,
|
|
33362
31914
|
_meta: {
|
|
@@ -33396,7 +31948,7 @@ class Protocol {
|
|
|
33396
31948
|
reject(error2);
|
|
33397
31949
|
};
|
|
33398
31950
|
this._responseHandlers.set(messageId, (response) => {
|
|
33399
|
-
if (
|
|
31951
|
+
if (options?.signal?.aborted) {
|
|
33400
31952
|
return;
|
|
33401
31953
|
}
|
|
33402
31954
|
if (response instanceof Error) {
|
|
@@ -33413,12 +31965,12 @@ class Protocol {
|
|
|
33413
31965
|
reject(error2);
|
|
33414
31966
|
}
|
|
33415
31967
|
});
|
|
33416
|
-
|
|
33417
|
-
cancel(
|
|
31968
|
+
options?.signal?.addEventListener("abort", () => {
|
|
31969
|
+
cancel(options?.signal?.reason);
|
|
33418
31970
|
});
|
|
33419
|
-
const timeout =
|
|
31971
|
+
const timeout = options?.timeout ?? DEFAULT_REQUEST_TIMEOUT_MSEC;
|
|
33420
31972
|
const timeoutHandler = () => cancel(McpError.fromError(ErrorCode.RequestTimeout, "Request timed out", { timeout }));
|
|
33421
|
-
this._setupTimeout(messageId, timeout,
|
|
31973
|
+
this._setupTimeout(messageId, timeout, options?.maxTotalTimeout, timeoutHandler, options?.resetTimeoutOnProgress ?? false);
|
|
33422
31974
|
const relatedTaskId = relatedTask?.taskId;
|
|
33423
31975
|
if (relatedTaskId) {
|
|
33424
31976
|
const responseResolver = (response) => {
|
|
@@ -33446,24 +31998,24 @@ class Protocol {
|
|
|
33446
31998
|
}
|
|
33447
31999
|
});
|
|
33448
32000
|
}
|
|
33449
|
-
async getTask(params,
|
|
33450
|
-
return this.request({ method: "tasks/get", params }, GetTaskResultSchema,
|
|
32001
|
+
async getTask(params, options) {
|
|
32002
|
+
return this.request({ method: "tasks/get", params }, GetTaskResultSchema, options);
|
|
33451
32003
|
}
|
|
33452
|
-
async getTaskResult(params, resultSchema,
|
|
33453
|
-
return this.request({ method: "tasks/result", params }, resultSchema,
|
|
32004
|
+
async getTaskResult(params, resultSchema, options) {
|
|
32005
|
+
return this.request({ method: "tasks/result", params }, resultSchema, options);
|
|
33454
32006
|
}
|
|
33455
|
-
async listTasks(params,
|
|
33456
|
-
return this.request({ method: "tasks/list", params }, ListTasksResultSchema,
|
|
32007
|
+
async listTasks(params, options) {
|
|
32008
|
+
return this.request({ method: "tasks/list", params }, ListTasksResultSchema, options);
|
|
33457
32009
|
}
|
|
33458
|
-
async cancelTask(params,
|
|
33459
|
-
return this.request({ method: "tasks/cancel", params }, CancelTaskResultSchema,
|
|
32010
|
+
async cancelTask(params, options) {
|
|
32011
|
+
return this.request({ method: "tasks/cancel", params }, CancelTaskResultSchema, options);
|
|
33460
32012
|
}
|
|
33461
|
-
async notification(notification,
|
|
32013
|
+
async notification(notification, options) {
|
|
33462
32014
|
if (!this._transport) {
|
|
33463
32015
|
throw new Error("Not connected");
|
|
33464
32016
|
}
|
|
33465
32017
|
this.assertNotificationCapability(notification.method);
|
|
33466
|
-
const relatedTaskId =
|
|
32018
|
+
const relatedTaskId = options?.relatedTask?.taskId;
|
|
33467
32019
|
if (relatedTaskId) {
|
|
33468
32020
|
const jsonrpcNotification2 = {
|
|
33469
32021
|
...notification,
|
|
@@ -33472,7 +32024,7 @@ class Protocol {
|
|
|
33472
32024
|
...notification.params,
|
|
33473
32025
|
_meta: {
|
|
33474
32026
|
...notification.params?._meta || {},
|
|
33475
|
-
[RELATED_TASK_META_KEY]:
|
|
32027
|
+
[RELATED_TASK_META_KEY]: options.relatedTask
|
|
33476
32028
|
}
|
|
33477
32029
|
}
|
|
33478
32030
|
};
|
|
@@ -33484,7 +32036,7 @@ class Protocol {
|
|
|
33484
32036
|
return;
|
|
33485
32037
|
}
|
|
33486
32038
|
const debouncedMethods = this._options?.debouncedNotificationMethods ?? [];
|
|
33487
|
-
const canDebounce = debouncedMethods.includes(notification.method) && !notification.params && !
|
|
32039
|
+
const canDebounce = debouncedMethods.includes(notification.method) && !notification.params && !options?.relatedRequestId && !options?.relatedTask;
|
|
33488
32040
|
if (canDebounce) {
|
|
33489
32041
|
if (this._pendingDebouncedNotifications.has(notification.method)) {
|
|
33490
32042
|
return;
|
|
@@ -33499,19 +32051,19 @@ class Protocol {
|
|
|
33499
32051
|
...notification,
|
|
33500
32052
|
jsonrpc: "2.0"
|
|
33501
32053
|
};
|
|
33502
|
-
if (
|
|
32054
|
+
if (options?.relatedTask) {
|
|
33503
32055
|
jsonrpcNotification2 = {
|
|
33504
32056
|
...jsonrpcNotification2,
|
|
33505
32057
|
params: {
|
|
33506
32058
|
...jsonrpcNotification2.params,
|
|
33507
32059
|
_meta: {
|
|
33508
32060
|
...jsonrpcNotification2.params?._meta || {},
|
|
33509
|
-
[RELATED_TASK_META_KEY]:
|
|
32061
|
+
[RELATED_TASK_META_KEY]: options.relatedTask
|
|
33510
32062
|
}
|
|
33511
32063
|
}
|
|
33512
32064
|
};
|
|
33513
32065
|
}
|
|
33514
|
-
this._transport?.send(jsonrpcNotification2,
|
|
32066
|
+
this._transport?.send(jsonrpcNotification2, options).catch((error2) => this._onerror(error2));
|
|
33515
32067
|
});
|
|
33516
32068
|
return;
|
|
33517
32069
|
}
|
|
@@ -33519,19 +32071,19 @@ class Protocol {
|
|
|
33519
32071
|
...notification,
|
|
33520
32072
|
jsonrpc: "2.0"
|
|
33521
32073
|
};
|
|
33522
|
-
if (
|
|
32074
|
+
if (options?.relatedTask) {
|
|
33523
32075
|
jsonrpcNotification = {
|
|
33524
32076
|
...jsonrpcNotification,
|
|
33525
32077
|
params: {
|
|
33526
32078
|
...jsonrpcNotification.params,
|
|
33527
32079
|
_meta: {
|
|
33528
32080
|
...jsonrpcNotification.params?._meta || {},
|
|
33529
|
-
[RELATED_TASK_META_KEY]:
|
|
32081
|
+
[RELATED_TASK_META_KEY]: options.relatedTask
|
|
33530
32082
|
}
|
|
33531
32083
|
}
|
|
33532
32084
|
};
|
|
33533
32085
|
}
|
|
33534
|
-
await this._transport.send(jsonrpcNotification,
|
|
32086
|
+
await this._transport.send(jsonrpcNotification, options);
|
|
33535
32087
|
}
|
|
33536
32088
|
setRequestHandler(requestSchema, handler) {
|
|
33537
32089
|
const method = getMethodLiteral(requestSchema);
|
|
@@ -33741,20 +32293,20 @@ class ExperimentalServerTasks {
|
|
|
33741
32293
|
constructor(_server) {
|
|
33742
32294
|
this._server = _server;
|
|
33743
32295
|
}
|
|
33744
|
-
requestStream(request, resultSchema,
|
|
33745
|
-
return this._server.requestStream(request, resultSchema,
|
|
32296
|
+
requestStream(request, resultSchema, options) {
|
|
32297
|
+
return this._server.requestStream(request, resultSchema, options);
|
|
33746
32298
|
}
|
|
33747
|
-
async getTask(taskId,
|
|
33748
|
-
return this._server.getTask({ taskId },
|
|
32299
|
+
async getTask(taskId, options) {
|
|
32300
|
+
return this._server.getTask({ taskId }, options);
|
|
33749
32301
|
}
|
|
33750
|
-
async getTaskResult(taskId, resultSchema,
|
|
33751
|
-
return this._server.getTaskResult({ taskId }, resultSchema,
|
|
32302
|
+
async getTaskResult(taskId, resultSchema, options) {
|
|
32303
|
+
return this._server.getTaskResult({ taskId }, resultSchema, options);
|
|
33752
32304
|
}
|
|
33753
|
-
async listTasks(cursor,
|
|
33754
|
-
return this._server.listTasks(cursor ? { cursor } : undefined,
|
|
32305
|
+
async listTasks(cursor, options) {
|
|
32306
|
+
return this._server.listTasks(cursor ? { cursor } : undefined, options);
|
|
33755
32307
|
}
|
|
33756
|
-
async cancelTask(taskId,
|
|
33757
|
-
return this._server.cancelTask({ taskId },
|
|
32308
|
+
async cancelTask(taskId, options) {
|
|
32309
|
+
return this._server.cancelTask({ taskId }, options);
|
|
33758
32310
|
}
|
|
33759
32311
|
}
|
|
33760
32312
|
|
|
@@ -33795,8 +32347,8 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
|
|
|
33795
32347
|
|
|
33796
32348
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
|
|
33797
32349
|
class Server extends Protocol {
|
|
33798
|
-
constructor(_serverInfo,
|
|
33799
|
-
super(
|
|
32350
|
+
constructor(_serverInfo, options) {
|
|
32351
|
+
super(options);
|
|
33800
32352
|
this._serverInfo = _serverInfo;
|
|
33801
32353
|
this._loggingLevels = new Map;
|
|
33802
32354
|
this.LOG_LEVEL_SEVERITY = new Map(LoggingLevelSchema.options.map((level, index) => [level, index]));
|
|
@@ -33804,9 +32356,9 @@ class Server extends Protocol {
|
|
|
33804
32356
|
const currentLevel = this._loggingLevels.get(sessionId);
|
|
33805
32357
|
return currentLevel ? this.LOG_LEVEL_SEVERITY.get(level) < this.LOG_LEVEL_SEVERITY.get(currentLevel) : false;
|
|
33806
32358
|
};
|
|
33807
|
-
this._capabilities =
|
|
33808
|
-
this._instructions =
|
|
33809
|
-
this._jsonSchemaValidator =
|
|
32359
|
+
this._capabilities = options?.capabilities ?? {};
|
|
32360
|
+
this._instructions = options?.instructions;
|
|
32361
|
+
this._jsonSchemaValidator = options?.jsonSchemaValidator ?? new AjvJsonSchemaValidator;
|
|
33810
32362
|
this.setRequestHandler(InitializeRequestSchema, (request) => this._oninitialize(request));
|
|
33811
32363
|
this.setNotificationHandler(InitializedNotificationSchema, () => this.oninitialized?.());
|
|
33812
32364
|
if (this._capabilities.logging) {
|
|
@@ -34018,7 +32570,7 @@ class Server extends Protocol {
|
|
|
34018
32570
|
async ping() {
|
|
34019
32571
|
return this.request({ method: "ping" }, EmptyResultSchema);
|
|
34020
32572
|
}
|
|
34021
|
-
async createMessage(params,
|
|
32573
|
+
async createMessage(params, options) {
|
|
34022
32574
|
if (params.tools || params.toolChoice) {
|
|
34023
32575
|
if (!this._clientCapabilities?.sampling?.tools) {
|
|
34024
32576
|
throw new Error("Client does not support sampling tools capability.");
|
|
@@ -34048,11 +32600,11 @@ class Server extends Protocol {
|
|
|
34048
32600
|
}
|
|
34049
32601
|
}
|
|
34050
32602
|
if (params.tools) {
|
|
34051
|
-
return this.request({ method: "sampling/createMessage", params }, CreateMessageResultWithToolsSchema,
|
|
32603
|
+
return this.request({ method: "sampling/createMessage", params }, CreateMessageResultWithToolsSchema, options);
|
|
34052
32604
|
}
|
|
34053
|
-
return this.request({ method: "sampling/createMessage", params }, CreateMessageResultSchema,
|
|
32605
|
+
return this.request({ method: "sampling/createMessage", params }, CreateMessageResultSchema, options);
|
|
34054
32606
|
}
|
|
34055
|
-
async elicitInput(params,
|
|
32607
|
+
async elicitInput(params, options) {
|
|
34056
32608
|
const mode = params.mode ?? "form";
|
|
34057
32609
|
switch (mode) {
|
|
34058
32610
|
case "url": {
|
|
@@ -34060,14 +32612,14 @@ class Server extends Protocol {
|
|
|
34060
32612
|
throw new Error("Client does not support url elicitation.");
|
|
34061
32613
|
}
|
|
34062
32614
|
const urlParams = params;
|
|
34063
|
-
return this.request({ method: "elicitation/create", params: urlParams }, ElicitResultSchema,
|
|
32615
|
+
return this.request({ method: "elicitation/create", params: urlParams }, ElicitResultSchema, options);
|
|
34064
32616
|
}
|
|
34065
32617
|
case "form": {
|
|
34066
32618
|
if (!this._clientCapabilities?.elicitation?.form) {
|
|
34067
32619
|
throw new Error("Client does not support form elicitation.");
|
|
34068
32620
|
}
|
|
34069
32621
|
const formParams = params.mode === "form" ? params : { ...params, mode: "form" };
|
|
34070
|
-
const result = await this.request({ method: "elicitation/create", params: formParams }, ElicitResultSchema,
|
|
32622
|
+
const result = await this.request({ method: "elicitation/create", params: formParams }, ElicitResultSchema, options);
|
|
34071
32623
|
if (result.action === "accept" && result.content && formParams.requestedSchema) {
|
|
34072
32624
|
try {
|
|
34073
32625
|
const validator = this._jsonSchemaValidator.getValidator(formParams.requestedSchema);
|
|
@@ -34086,7 +32638,7 @@ class Server extends Protocol {
|
|
|
34086
32638
|
}
|
|
34087
32639
|
}
|
|
34088
32640
|
}
|
|
34089
|
-
createElicitationCompletionNotifier(elicitationId,
|
|
32641
|
+
createElicitationCompletionNotifier(elicitationId, options) {
|
|
34090
32642
|
if (!this._clientCapabilities?.elicitation?.url) {
|
|
34091
32643
|
throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");
|
|
34092
32644
|
}
|
|
@@ -34095,10 +32647,10 @@ class Server extends Protocol {
|
|
|
34095
32647
|
params: {
|
|
34096
32648
|
elicitationId
|
|
34097
32649
|
}
|
|
34098
|
-
},
|
|
32650
|
+
}, options);
|
|
34099
32651
|
}
|
|
34100
|
-
async listRoots(params,
|
|
34101
|
-
return this.request({ method: "roots/list", params }, ListRootsResultSchema,
|
|
32652
|
+
async listRoots(params, options) {
|
|
32653
|
+
return this.request({ method: "roots/list", params }, ListRootsResultSchema, options);
|
|
34102
32654
|
}
|
|
34103
32655
|
async sendLoggingMessage(params, sessionId) {
|
|
34104
32656
|
if (this._capabilities.logging) {
|
|
@@ -34215,7 +32767,7 @@ class ExperimentalMcpServerTasks {
|
|
|
34215
32767
|
|
|
34216
32768
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
|
|
34217
32769
|
class McpServer {
|
|
34218
|
-
constructor(serverInfo,
|
|
32770
|
+
constructor(serverInfo, options) {
|
|
34219
32771
|
this._registeredResources = {};
|
|
34220
32772
|
this._registeredResourceTemplates = {};
|
|
34221
32773
|
this._registeredTools = {};
|
|
@@ -34224,7 +32776,7 @@ class McpServer {
|
|
|
34224
32776
|
this._completionHandlerInitialized = false;
|
|
34225
32777
|
this._resourceHandlersInitialized = false;
|
|
34226
32778
|
this._promptHandlersInitialized = false;
|
|
34227
|
-
this.server = new Server(serverInfo,
|
|
32779
|
+
this.server = new Server(serverInfo, options);
|
|
34228
32780
|
}
|
|
34229
32781
|
get experimental() {
|
|
34230
32782
|
if (!this._experimental) {
|
|
@@ -45417,25 +43969,25 @@ function _array2(Class3, element, params) {
|
|
|
45417
43969
|
...normalizeParams2(params)
|
|
45418
43970
|
});
|
|
45419
43971
|
}
|
|
45420
|
-
function _union(Class3,
|
|
43972
|
+
function _union(Class3, options, params) {
|
|
45421
43973
|
return new Class3({
|
|
45422
43974
|
type: "union",
|
|
45423
|
-
options
|
|
43975
|
+
options,
|
|
45424
43976
|
...normalizeParams2(params)
|
|
45425
43977
|
});
|
|
45426
43978
|
}
|
|
45427
|
-
function _xor(Class3,
|
|
43979
|
+
function _xor(Class3, options, params) {
|
|
45428
43980
|
return new Class3({
|
|
45429
43981
|
type: "union",
|
|
45430
|
-
options
|
|
43982
|
+
options,
|
|
45431
43983
|
inclusive: false,
|
|
45432
43984
|
...normalizeParams2(params)
|
|
45433
43985
|
});
|
|
45434
43986
|
}
|
|
45435
|
-
function _discriminatedUnion(Class3, discriminator,
|
|
43987
|
+
function _discriminatedUnion(Class3, discriminator, options, params) {
|
|
45436
43988
|
return new Class3({
|
|
45437
43989
|
type: "union",
|
|
45438
|
-
options
|
|
43990
|
+
options,
|
|
45439
43991
|
discriminator,
|
|
45440
43992
|
...normalizeParams2(params)
|
|
45441
43993
|
});
|
|
@@ -46357,14 +44909,14 @@ var objectProcessor2 = (schema, ctx, _json, params) => {
|
|
|
46357
44909
|
var unionProcessor2 = (schema, ctx, json, params) => {
|
|
46358
44910
|
const def = schema._zod.def;
|
|
46359
44911
|
const isExclusive = def.inclusive === false;
|
|
46360
|
-
const
|
|
44912
|
+
const options = def.options.map((x, i) => process4(x, ctx, {
|
|
46361
44913
|
...params,
|
|
46362
44914
|
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
|
|
46363
44915
|
}));
|
|
46364
44916
|
if (isExclusive) {
|
|
46365
|
-
json.oneOf =
|
|
44917
|
+
json.oneOf = options;
|
|
46366
44918
|
} else {
|
|
46367
|
-
json.anyOf =
|
|
44919
|
+
json.anyOf = options;
|
|
46368
44920
|
}
|
|
46369
44921
|
};
|
|
46370
44922
|
var intersectionProcessor2 = (schema, ctx, json, params) => {
|
|
@@ -47524,10 +46076,10 @@ var ZodUnion4 = /* @__PURE__ */ $constructor2("ZodUnion", (inst, def) => {
|
|
|
47524
46076
|
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor2(inst, ctx, json, params);
|
|
47525
46077
|
inst.options = def.options;
|
|
47526
46078
|
});
|
|
47527
|
-
function union3(
|
|
46079
|
+
function union3(options, params) {
|
|
47528
46080
|
return new ZodUnion4({
|
|
47529
46081
|
type: "union",
|
|
47530
|
-
options
|
|
46082
|
+
options,
|
|
47531
46083
|
...exports_util2.normalizeParams(params)
|
|
47532
46084
|
});
|
|
47533
46085
|
}
|
|
@@ -47537,10 +46089,10 @@ var ZodXor = /* @__PURE__ */ $constructor2("ZodXor", (inst, def) => {
|
|
|
47537
46089
|
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor2(inst, ctx, json, params);
|
|
47538
46090
|
inst.options = def.options;
|
|
47539
46091
|
});
|
|
47540
|
-
function xor(
|
|
46092
|
+
function xor(options, params) {
|
|
47541
46093
|
return new ZodXor({
|
|
47542
46094
|
type: "union",
|
|
47543
|
-
options
|
|
46095
|
+
options,
|
|
47544
46096
|
inclusive: false,
|
|
47545
46097
|
...exports_util2.normalizeParams(params)
|
|
47546
46098
|
});
|
|
@@ -47549,10 +46101,10 @@ var ZodDiscriminatedUnion4 = /* @__PURE__ */ $constructor2("ZodDiscriminatedUnio
|
|
|
47549
46101
|
ZodUnion4.init(inst, def);
|
|
47550
46102
|
$ZodDiscriminatedUnion2.init(inst, def);
|
|
47551
46103
|
});
|
|
47552
|
-
function discriminatedUnion2(discriminator,
|
|
46104
|
+
function discriminatedUnion2(discriminator, options, params) {
|
|
47553
46105
|
return new ZodDiscriminatedUnion4({
|
|
47554
46106
|
type: "union",
|
|
47555
|
-
options
|
|
46107
|
+
options,
|
|
47556
46108
|
discriminator,
|
|
47557
46109
|
...exports_util2.normalizeParams(params)
|
|
47558
46110
|
});
|
|
@@ -48463,13 +47015,13 @@ function convertSchema(schema, ctx) {
|
|
|
48463
47015
|
let baseSchema = convertBaseSchema(schema, ctx);
|
|
48464
47016
|
const hasExplicitType = schema.type || schema.enum !== undefined || schema.const !== undefined;
|
|
48465
47017
|
if (schema.anyOf && Array.isArray(schema.anyOf)) {
|
|
48466
|
-
const
|
|
48467
|
-
const anyOfUnion = z.union(
|
|
47018
|
+
const options = schema.anyOf.map((s) => convertSchema(s, ctx));
|
|
47019
|
+
const anyOfUnion = z.union(options);
|
|
48468
47020
|
baseSchema = hasExplicitType ? z.intersection(baseSchema, anyOfUnion) : anyOfUnion;
|
|
48469
47021
|
}
|
|
48470
47022
|
if (schema.oneOf && Array.isArray(schema.oneOf)) {
|
|
48471
|
-
const
|
|
48472
|
-
const oneOfUnion = z.xor(
|
|
47023
|
+
const options = schema.oneOf.map((s) => convertSchema(s, ctx));
|
|
47024
|
+
const oneOfUnion = z.xor(options);
|
|
48473
47025
|
baseSchema = hasExplicitType ? z.intersection(baseSchema, oneOfUnion) : oneOfUnion;
|
|
48474
47026
|
}
|
|
48475
47027
|
if (schema.allOf && Array.isArray(schema.allOf)) {
|
|
@@ -48771,16 +47323,16 @@ function splitContentForHeight(content, contentBreaker) {
|
|
|
48771
47323
|
class PostTracker {
|
|
48772
47324
|
posts = new Map;
|
|
48773
47325
|
sessionIndex = new Map;
|
|
48774
|
-
register(postId, threadId, sessionId,
|
|
47326
|
+
register(postId, threadId, sessionId, options = {}) {
|
|
48775
47327
|
const info = {
|
|
48776
47328
|
postId,
|
|
48777
47329
|
threadId,
|
|
48778
47330
|
sessionId,
|
|
48779
|
-
type:
|
|
48780
|
-
interactionType:
|
|
48781
|
-
toolUseId:
|
|
47331
|
+
type: options.type ?? "content",
|
|
47332
|
+
interactionType: options.interactionType,
|
|
47333
|
+
toolUseId: options.toolUseId,
|
|
48782
47334
|
createdAt: Date.now(),
|
|
48783
|
-
metadata:
|
|
47335
|
+
metadata: options.metadata
|
|
48784
47336
|
};
|
|
48785
47337
|
this.posts.set(postId, info);
|
|
48786
47338
|
let sessionPosts = this.sessionIndex.get(sessionId);
|
|
@@ -48911,17 +47463,17 @@ class ToolFormatterRegistry {
|
|
|
48911
47463
|
}
|
|
48912
47464
|
return;
|
|
48913
47465
|
}
|
|
48914
|
-
format(toolName, input,
|
|
47466
|
+
format(toolName, input, options) {
|
|
48915
47467
|
const formatter = this.findFormatter(toolName);
|
|
48916
47468
|
if (formatter) {
|
|
48917
|
-
const result = formatter.format(toolName, input,
|
|
47469
|
+
const result = formatter.format(toolName, input, options);
|
|
48918
47470
|
if (result)
|
|
48919
47471
|
return result;
|
|
48920
47472
|
}
|
|
48921
|
-
return this.formatGeneric(toolName,
|
|
47473
|
+
return this.formatGeneric(toolName, options);
|
|
48922
47474
|
}
|
|
48923
|
-
formatGeneric(toolName,
|
|
48924
|
-
const { formatter } =
|
|
47475
|
+
formatGeneric(toolName, options) {
|
|
47476
|
+
const { formatter } = options;
|
|
48925
47477
|
const mcpParts = parseMcpToolName(toolName);
|
|
48926
47478
|
if (mcpParts) {
|
|
48927
47479
|
return {
|
|
@@ -48945,24 +47497,24 @@ class ToolFormatterRegistry {
|
|
|
48945
47497
|
var toolFormatterRegistry = new ToolFormatterRegistry;
|
|
48946
47498
|
// node_modules/diff/libesm/diff/base.js
|
|
48947
47499
|
class Diff {
|
|
48948
|
-
diff(oldStr, newStr,
|
|
47500
|
+
diff(oldStr, newStr, options = {}) {
|
|
48949
47501
|
let callback;
|
|
48950
|
-
if (typeof
|
|
48951
|
-
callback =
|
|
48952
|
-
|
|
48953
|
-
} else if ("callback" in
|
|
48954
|
-
callback =
|
|
48955
|
-
}
|
|
48956
|
-
const oldString = this.castInput(oldStr,
|
|
48957
|
-
const newString = this.castInput(newStr,
|
|
48958
|
-
const oldTokens = this.removeEmpty(this.tokenize(oldString,
|
|
48959
|
-
const newTokens = this.removeEmpty(this.tokenize(newString,
|
|
48960
|
-
return this.diffWithOptionsObj(oldTokens, newTokens,
|
|
48961
|
-
}
|
|
48962
|
-
diffWithOptionsObj(oldTokens, newTokens,
|
|
47502
|
+
if (typeof options === "function") {
|
|
47503
|
+
callback = options;
|
|
47504
|
+
options = {};
|
|
47505
|
+
} else if ("callback" in options) {
|
|
47506
|
+
callback = options.callback;
|
|
47507
|
+
}
|
|
47508
|
+
const oldString = this.castInput(oldStr, options);
|
|
47509
|
+
const newString = this.castInput(newStr, options);
|
|
47510
|
+
const oldTokens = this.removeEmpty(this.tokenize(oldString, options));
|
|
47511
|
+
const newTokens = this.removeEmpty(this.tokenize(newString, options));
|
|
47512
|
+
return this.diffWithOptionsObj(oldTokens, newTokens, options, callback);
|
|
47513
|
+
}
|
|
47514
|
+
diffWithOptionsObj(oldTokens, newTokens, options, callback) {
|
|
48963
47515
|
var _a3;
|
|
48964
47516
|
const done = (value) => {
|
|
48965
|
-
value = this.postProcess(value,
|
|
47517
|
+
value = this.postProcess(value, options);
|
|
48966
47518
|
if (callback) {
|
|
48967
47519
|
setTimeout(function() {
|
|
48968
47520
|
callback(value);
|
|
@@ -48975,13 +47527,13 @@ class Diff {
|
|
|
48975
47527
|
const newLen = newTokens.length, oldLen = oldTokens.length;
|
|
48976
47528
|
let editLength = 1;
|
|
48977
47529
|
let maxEditLength = newLen + oldLen;
|
|
48978
|
-
if (
|
|
48979
|
-
maxEditLength = Math.min(maxEditLength,
|
|
47530
|
+
if (options.maxEditLength != null) {
|
|
47531
|
+
maxEditLength = Math.min(maxEditLength, options.maxEditLength);
|
|
48980
47532
|
}
|
|
48981
|
-
const maxExecutionTime = (_a3 =
|
|
47533
|
+
const maxExecutionTime = (_a3 = options.timeout) !== null && _a3 !== undefined ? _a3 : Infinity;
|
|
48982
47534
|
const abortAfterTimestamp = Date.now() + maxExecutionTime;
|
|
48983
47535
|
const bestPath = [{ oldPos: -1, lastComponent: undefined }];
|
|
48984
|
-
let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0,
|
|
47536
|
+
let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options);
|
|
48985
47537
|
if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
|
48986
47538
|
return done(this.buildValues(bestPath[0].lastComponent, newTokens, oldTokens));
|
|
48987
47539
|
}
|
|
@@ -49004,11 +47556,11 @@ class Diff {
|
|
|
49004
47556
|
continue;
|
|
49005
47557
|
}
|
|
49006
47558
|
if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) {
|
|
49007
|
-
basePath = this.addToPath(addPath, true, false, 0,
|
|
47559
|
+
basePath = this.addToPath(addPath, true, false, 0, options);
|
|
49008
47560
|
} else {
|
|
49009
|
-
basePath = this.addToPath(removePath, false, true, 1,
|
|
47561
|
+
basePath = this.addToPath(removePath, false, true, 1, options);
|
|
49010
47562
|
}
|
|
49011
|
-
newPos = this.extractCommon(basePath, newTokens, oldTokens, diagonalPath,
|
|
47563
|
+
newPos = this.extractCommon(basePath, newTokens, oldTokens, diagonalPath, options);
|
|
49012
47564
|
if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
|
49013
47565
|
return done(this.buildValues(basePath.lastComponent, newTokens, oldTokens)) || true;
|
|
49014
47566
|
} else {
|
|
@@ -49043,9 +47595,9 @@ class Diff {
|
|
|
49043
47595
|
}
|
|
49044
47596
|
}
|
|
49045
47597
|
}
|
|
49046
|
-
addToPath(path, added, removed, oldPosInc,
|
|
47598
|
+
addToPath(path, added, removed, oldPosInc, options) {
|
|
49047
47599
|
const last = path.lastComponent;
|
|
49048
|
-
if (last && !
|
|
47600
|
+
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
49049
47601
|
return {
|
|
49050
47602
|
oldPos: path.oldPos + oldPosInc,
|
|
49051
47603
|
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
@@ -49057,28 +47609,28 @@ class Diff {
|
|
|
49057
47609
|
};
|
|
49058
47610
|
}
|
|
49059
47611
|
}
|
|
49060
|
-
extractCommon(basePath, newTokens, oldTokens, diagonalPath,
|
|
47612
|
+
extractCommon(basePath, newTokens, oldTokens, diagonalPath, options) {
|
|
49061
47613
|
const newLen = newTokens.length, oldLen = oldTokens.length;
|
|
49062
47614
|
let oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
|
|
49063
|
-
while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldTokens[oldPos + 1], newTokens[newPos + 1],
|
|
47615
|
+
while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldTokens[oldPos + 1], newTokens[newPos + 1], options)) {
|
|
49064
47616
|
newPos++;
|
|
49065
47617
|
oldPos++;
|
|
49066
47618
|
commonCount++;
|
|
49067
|
-
if (
|
|
47619
|
+
if (options.oneChangePerToken) {
|
|
49068
47620
|
basePath.lastComponent = { count: 1, previousComponent: basePath.lastComponent, added: false, removed: false };
|
|
49069
47621
|
}
|
|
49070
47622
|
}
|
|
49071
|
-
if (commonCount && !
|
|
47623
|
+
if (commonCount && !options.oneChangePerToken) {
|
|
49072
47624
|
basePath.lastComponent = { count: commonCount, previousComponent: basePath.lastComponent, added: false, removed: false };
|
|
49073
47625
|
}
|
|
49074
47626
|
basePath.oldPos = oldPos;
|
|
49075
47627
|
return newPos;
|
|
49076
47628
|
}
|
|
49077
|
-
equals(left, right,
|
|
49078
|
-
if (
|
|
49079
|
-
return
|
|
47629
|
+
equals(left, right, options) {
|
|
47630
|
+
if (options.comparator) {
|
|
47631
|
+
return options.comparator(left, right);
|
|
49080
47632
|
} else {
|
|
49081
|
-
return left === right || !!
|
|
47633
|
+
return left === right || !!options.ignoreCase && left.toLowerCase() === right.toLowerCase();
|
|
49082
47634
|
}
|
|
49083
47635
|
}
|
|
49084
47636
|
removeEmpty(array4) {
|
|
@@ -49090,16 +47642,16 @@ class Diff {
|
|
|
49090
47642
|
}
|
|
49091
47643
|
return ret;
|
|
49092
47644
|
}
|
|
49093
|
-
castInput(value,
|
|
47645
|
+
castInput(value, options) {
|
|
49094
47646
|
return value;
|
|
49095
47647
|
}
|
|
49096
|
-
tokenize(value,
|
|
47648
|
+
tokenize(value, options) {
|
|
49097
47649
|
return Array.from(value);
|
|
49098
47650
|
}
|
|
49099
47651
|
join(chars) {
|
|
49100
47652
|
return chars.join("");
|
|
49101
47653
|
}
|
|
49102
|
-
postProcess(changeObjects,
|
|
47654
|
+
postProcess(changeObjects, options) {
|
|
49103
47655
|
return changeObjects;
|
|
49104
47656
|
}
|
|
49105
47657
|
get useLongestToken() {
|
|
@@ -49249,17 +47801,17 @@ var extendedWordChars = "a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-
|
|
|
49249
47801
|
var tokenizeIncludingWhitespace = new RegExp(`[${extendedWordChars}]+|\\s+|[^${extendedWordChars}]`, "ug");
|
|
49250
47802
|
|
|
49251
47803
|
class WordDiff extends Diff {
|
|
49252
|
-
equals(left, right,
|
|
49253
|
-
if (
|
|
47804
|
+
equals(left, right, options) {
|
|
47805
|
+
if (options.ignoreCase) {
|
|
49254
47806
|
left = left.toLowerCase();
|
|
49255
47807
|
right = right.toLowerCase();
|
|
49256
47808
|
}
|
|
49257
47809
|
return left.trim() === right.trim();
|
|
49258
47810
|
}
|
|
49259
|
-
tokenize(value,
|
|
47811
|
+
tokenize(value, options = {}) {
|
|
49260
47812
|
let parts;
|
|
49261
|
-
if (
|
|
49262
|
-
const segmenter =
|
|
47813
|
+
if (options.intlSegmenter) {
|
|
47814
|
+
const segmenter = options.intlSegmenter;
|
|
49263
47815
|
if (segmenter.resolvedOptions().granularity != "word") {
|
|
49264
47816
|
throw new Error('The segmenter passed must have a granularity of "word"');
|
|
49265
47817
|
}
|
|
@@ -49306,8 +47858,8 @@ class WordDiff extends Diff {
|
|
|
49306
47858
|
}
|
|
49307
47859
|
}).join("");
|
|
49308
47860
|
}
|
|
49309
|
-
postProcess(changes,
|
|
49310
|
-
if (!changes ||
|
|
47861
|
+
postProcess(changes, options) {
|
|
47862
|
+
if (!changes || options.oneChangePerToken) {
|
|
49311
47863
|
return changes;
|
|
49312
47864
|
}
|
|
49313
47865
|
let lastKeep = null;
|
|
@@ -49396,17 +47948,17 @@ class LineDiff extends Diff {
|
|
|
49396
47948
|
super(...arguments);
|
|
49397
47949
|
this.tokenize = tokenize;
|
|
49398
47950
|
}
|
|
49399
|
-
equals(left, right,
|
|
49400
|
-
if (
|
|
49401
|
-
if (!
|
|
47951
|
+
equals(left, right, options) {
|
|
47952
|
+
if (options.ignoreWhitespace) {
|
|
47953
|
+
if (!options.newlineIsToken || !left.includes(`
|
|
49402
47954
|
`)) {
|
|
49403
47955
|
left = left.trim();
|
|
49404
47956
|
}
|
|
49405
|
-
if (!
|
|
47957
|
+
if (!options.newlineIsToken || !right.includes(`
|
|
49406
47958
|
`)) {
|
|
49407
47959
|
right = right.trim();
|
|
49408
47960
|
}
|
|
49409
|
-
} else if (
|
|
47961
|
+
} else if (options.ignoreNewlineAtEof && !options.newlineIsToken) {
|
|
49410
47962
|
if (left.endsWith(`
|
|
49411
47963
|
`)) {
|
|
49412
47964
|
left = left.slice(0, -1);
|
|
@@ -49416,15 +47968,15 @@ class LineDiff extends Diff {
|
|
|
49416
47968
|
right = right.slice(0, -1);
|
|
49417
47969
|
}
|
|
49418
47970
|
}
|
|
49419
|
-
return super.equals(left, right,
|
|
47971
|
+
return super.equals(left, right, options);
|
|
49420
47972
|
}
|
|
49421
47973
|
}
|
|
49422
47974
|
var lineDiff = new LineDiff;
|
|
49423
|
-
function diffLines(oldStr, newStr,
|
|
49424
|
-
return lineDiff.diff(oldStr, newStr,
|
|
47975
|
+
function diffLines(oldStr, newStr, options) {
|
|
47976
|
+
return lineDiff.diff(oldStr, newStr, options);
|
|
49425
47977
|
}
|
|
49426
|
-
function tokenize(value,
|
|
49427
|
-
if (
|
|
47978
|
+
function tokenize(value, options) {
|
|
47979
|
+
if (options.stripTrailingCr) {
|
|
49428
47980
|
value = value.replace(/\r\n/g, `
|
|
49429
47981
|
`);
|
|
49430
47982
|
}
|
|
@@ -49434,7 +47986,7 @@ function tokenize(value, options2) {
|
|
|
49434
47986
|
}
|
|
49435
47987
|
for (let i = 0;i < linesAndNewlines.length; i++) {
|
|
49436
47988
|
const line = linesAndNewlines[i];
|
|
49437
|
-
if (i % 2 && !
|
|
47989
|
+
if (i % 2 && !options.newlineIsToken) {
|
|
49438
47990
|
retLines[retLines.length - 1] += line;
|
|
49439
47991
|
} else {
|
|
49440
47992
|
retLines.push(line);
|
|
@@ -49490,12 +48042,12 @@ class JsonDiff extends Diff {
|
|
|
49490
48042
|
get useLongestToken() {
|
|
49491
48043
|
return true;
|
|
49492
48044
|
}
|
|
49493
|
-
castInput(value,
|
|
49494
|
-
const { undefinedReplacement, stringifyReplacer = (k, v) => typeof v === "undefined" ? undefinedReplacement : v } =
|
|
48045
|
+
castInput(value, options) {
|
|
48046
|
+
const { undefinedReplacement, stringifyReplacer = (k, v) => typeof v === "undefined" ? undefinedReplacement : v } = options;
|
|
49495
48047
|
return typeof value === "string" ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), null, " ");
|
|
49496
48048
|
}
|
|
49497
|
-
equals(left, right,
|
|
49498
|
-
return super.equals(left.replace(/,([\r\n])/g, "$1"), right.replace(/,([\r\n])/g, "$1"),
|
|
48049
|
+
equals(left, right, options) {
|
|
48050
|
+
return super.equals(left.replace(/,([\r\n])/g, "$1"), right.replace(/,([\r\n])/g, "$1"), options);
|
|
49499
48051
|
}
|
|
49500
48052
|
}
|
|
49501
48053
|
var jsonDiff = new JsonDiff;
|
|
@@ -49567,8 +48119,8 @@ var arrayDiff = new ArrayDiff;
|
|
|
49567
48119
|
// src/operations/tool-formatters/file-tools.ts
|
|
49568
48120
|
var fileToolsFormatter = {
|
|
49569
48121
|
toolNames: ["Read", "Write", "Edit", "Glob", "Grep"],
|
|
49570
|
-
format(toolName, input,
|
|
49571
|
-
const { formatter, detailed = false, maxPreviewLines = 20, worktreeInfo } =
|
|
48122
|
+
format(toolName, input, options) {
|
|
48123
|
+
const { formatter, detailed = false, maxPreviewLines = 20, worktreeInfo } = options;
|
|
49572
48124
|
const short = (p) => shortenPath(p, undefined, worktreeInfo);
|
|
49573
48125
|
switch (toolName) {
|
|
49574
48126
|
case "Read": {
|
|
@@ -49685,10 +48237,10 @@ var fileToolsFormatter = {
|
|
|
49685
48237
|
// src/operations/tool-formatters/bash-tools.ts
|
|
49686
48238
|
var bashToolFormatter = {
|
|
49687
48239
|
toolNames: ["Bash"],
|
|
49688
|
-
format(toolName, input,
|
|
48240
|
+
format(toolName, input, options) {
|
|
49689
48241
|
if (toolName !== "Bash")
|
|
49690
48242
|
return null;
|
|
49691
|
-
const { formatter, maxCommandLength = 50, worktreeInfo } =
|
|
48243
|
+
const { formatter, maxCommandLength = 50, worktreeInfo } = options;
|
|
49692
48244
|
let cmd = input.command || "";
|
|
49693
48245
|
if (worktreeInfo?.path) {
|
|
49694
48246
|
cmd = cmd.replace(new RegExp(escapeRegExp(worktreeInfo.path), "g"), `[${worktreeInfo.branch}]`);
|
|
@@ -49705,8 +48257,8 @@ var bashToolFormatter = {
|
|
|
49705
48257
|
// src/operations/tool-formatters/task-tools.ts
|
|
49706
48258
|
var taskToolsFormatter = {
|
|
49707
48259
|
toolNames: ["TodoWrite", "Task", "EnterPlanMode", "ExitPlanMode", "AskUserQuestion"],
|
|
49708
|
-
format(toolName, _input,
|
|
49709
|
-
const { formatter } =
|
|
48260
|
+
format(toolName, _input, options) {
|
|
48261
|
+
const { formatter } = options;
|
|
49710
48262
|
switch (toolName) {
|
|
49711
48263
|
case "TodoWrite":
|
|
49712
48264
|
return { display: null, hidden: true };
|
|
@@ -49729,8 +48281,8 @@ var taskToolsFormatter = {
|
|
|
49729
48281
|
// src/operations/tool-formatters/chrome-tools.ts
|
|
49730
48282
|
var chromeToolsFormatter = {
|
|
49731
48283
|
toolNames: ["mcp__claude-in-chrome__*"],
|
|
49732
|
-
format(toolName, input,
|
|
49733
|
-
const { formatter } =
|
|
48284
|
+
format(toolName, input, options) {
|
|
48285
|
+
const { formatter } = options;
|
|
49734
48286
|
const mcpParts = parseMcpToolName(toolName);
|
|
49735
48287
|
if (!mcpParts || mcpParts.server !== "claude-in-chrome") {
|
|
49736
48288
|
return null;
|
|
@@ -49824,8 +48376,8 @@ var chromeToolsFormatter = {
|
|
|
49824
48376
|
// src/operations/tool-formatters/web-tools.ts
|
|
49825
48377
|
var webToolsFormatter = {
|
|
49826
48378
|
toolNames: ["WebFetch", "WebSearch"],
|
|
49827
|
-
format(toolName, input,
|
|
49828
|
-
const { formatter } =
|
|
48379
|
+
format(toolName, input, options) {
|
|
48380
|
+
const { formatter } = options;
|
|
49829
48381
|
switch (toolName) {
|
|
49830
48382
|
case "WebFetch": {
|
|
49831
48383
|
const url2 = (input.url || "").substring(0, 40);
|
|
@@ -49865,10 +48417,10 @@ function truncateText(text, maxLength) {
|
|
|
49865
48417
|
}
|
|
49866
48418
|
var skillToolsFormatter = {
|
|
49867
48419
|
toolNames: ["Skill"],
|
|
49868
|
-
format(toolName, input,
|
|
48420
|
+
format(toolName, input, options) {
|
|
49869
48421
|
if (toolName !== "Skill")
|
|
49870
48422
|
return null;
|
|
49871
|
-
const { formatter } =
|
|
48423
|
+
const { formatter } = options;
|
|
49872
48424
|
const skillInput = input;
|
|
49873
48425
|
const skillName = skillInput.skill || "unknown";
|
|
49874
48426
|
const args = skillInput.args;
|
|
@@ -49900,8 +48452,8 @@ var skillToolsFormatter = {
|
|
|
49900
48452
|
// src/operations/tool-formatters/shell-tools.ts
|
|
49901
48453
|
var shellToolsFormatter = {
|
|
49902
48454
|
toolNames: ["TaskOutput", "BashOutput", "KillShell"],
|
|
49903
|
-
format(toolName, input,
|
|
49904
|
-
const { formatter } =
|
|
48455
|
+
format(toolName, input, options) {
|
|
48456
|
+
const { formatter } = options;
|
|
49905
48457
|
switch (toolName) {
|
|
49906
48458
|
case "TaskOutput": {
|
|
49907
48459
|
const taskId = input.task_id || "unknown";
|
|
@@ -49950,10 +48502,10 @@ var shellToolsFormatter = {
|
|
|
49950
48502
|
// src/operations/tool-formatters/notebook-tools.ts
|
|
49951
48503
|
var notebookToolsFormatter = {
|
|
49952
48504
|
toolNames: ["NotebookEdit"],
|
|
49953
|
-
format(toolName, input,
|
|
48505
|
+
format(toolName, input, options) {
|
|
49954
48506
|
if (toolName !== "NotebookEdit")
|
|
49955
48507
|
return null;
|
|
49956
|
-
const { formatter, worktreeInfo } =
|
|
48508
|
+
const { formatter, worktreeInfo } = options;
|
|
49957
48509
|
const notebookPath = input.notebook_path || "";
|
|
49958
48510
|
const cellId = input.cell_id || "";
|
|
49959
48511
|
const editMode = input.edit_mode || "replace";
|
|
@@ -49982,11 +48534,11 @@ var notebookToolsFormatter = {
|
|
|
49982
48534
|
// src/operations/tool-formatters/playwright-tools.ts
|
|
49983
48535
|
var playwrightToolsFormatter = {
|
|
49984
48536
|
toolNames: ["mcp__playwright__*"],
|
|
49985
|
-
format(toolName, input,
|
|
48537
|
+
format(toolName, input, options) {
|
|
49986
48538
|
const mcpParts = parseMcpToolName(toolName);
|
|
49987
48539
|
if (!mcpParts || mcpParts.server !== "playwright")
|
|
49988
48540
|
return null;
|
|
49989
|
-
const { formatter } =
|
|
48541
|
+
const { formatter } = options;
|
|
49990
48542
|
const tool = mcpParts.tool;
|
|
49991
48543
|
switch (tool) {
|
|
49992
48544
|
case "browser_navigate": {
|
|
@@ -50054,14 +48606,14 @@ var playwrightToolsFormatter = {
|
|
|
50054
48606
|
// src/operations/tool-formatters/figma-tools.ts
|
|
50055
48607
|
var figmaToolsFormatter = {
|
|
50056
48608
|
toolNames: ["mcp__plugin_figma_figma__*", "mcp__figma__*"],
|
|
50057
|
-
format(toolName, input,
|
|
48609
|
+
format(toolName, input, options) {
|
|
50058
48610
|
const mcpParts = parseMcpToolName(toolName);
|
|
50059
48611
|
if (!mcpParts)
|
|
50060
48612
|
return null;
|
|
50061
48613
|
const isFigma = mcpParts.server === "plugin_figma_figma" || mcpParts.server === "figma";
|
|
50062
48614
|
if (!isFigma)
|
|
50063
48615
|
return null;
|
|
50064
|
-
const { formatter } =
|
|
48616
|
+
const { formatter } = options;
|
|
50065
48617
|
const tool = mcpParts.tool;
|
|
50066
48618
|
const fileKey = input.fileKey || "";
|
|
50067
48619
|
const nodeId = input.nodeId || "";
|
|
@@ -50103,11 +48655,11 @@ var figmaToolsFormatter = {
|
|
|
50103
48655
|
// src/operations/tool-formatters/context7-tools.ts
|
|
50104
48656
|
var context7ToolsFormatter = {
|
|
50105
48657
|
toolNames: ["mcp__plugin_context7_context7__*"],
|
|
50106
|
-
format(toolName, input,
|
|
48658
|
+
format(toolName, input, options) {
|
|
50107
48659
|
const mcpParts = parseMcpToolName(toolName);
|
|
50108
48660
|
if (!mcpParts || mcpParts.server !== "plugin_context7_context7")
|
|
50109
48661
|
return null;
|
|
50110
|
-
const { formatter } =
|
|
48662
|
+
const { formatter } = options;
|
|
50111
48663
|
const tool = mcpParts.tool;
|
|
50112
48664
|
switch (tool) {
|
|
50113
48665
|
case "resolve-library-id": {
|
|
@@ -50159,11 +48711,11 @@ toolFormatterRegistry.register(notebookToolsFormatter);
|
|
|
50159
48711
|
toolFormatterRegistry.register(playwrightToolsFormatter);
|
|
50160
48712
|
toolFormatterRegistry.register(figmaToolsFormatter);
|
|
50161
48713
|
toolFormatterRegistry.register(context7ToolsFormatter);
|
|
50162
|
-
function formatToolForPermission(toolName, input, formatter,
|
|
48714
|
+
function formatToolForPermission(toolName, input, formatter, options = {}) {
|
|
50163
48715
|
const result = toolFormatterRegistry.format(toolName, input, {
|
|
50164
48716
|
formatter,
|
|
50165
48717
|
detailed: false,
|
|
50166
|
-
worktreeInfo:
|
|
48718
|
+
worktreeInfo: options.worktreeInfo
|
|
50167
48719
|
});
|
|
50168
48720
|
return result.permissionText ?? toolName;
|
|
50169
48721
|
}
|
|
@@ -50242,7 +48794,7 @@ function createApprovalOp(sessionId, toolUseId, approvalType, content) {
|
|
|
50242
48794
|
content
|
|
50243
48795
|
};
|
|
50244
48796
|
}
|
|
50245
|
-
function createSubagentOp(sessionId, toolUseId, action, description, subagentType,
|
|
48797
|
+
function createSubagentOp(sessionId, toolUseId, action, description, subagentType, options) {
|
|
50246
48798
|
return {
|
|
50247
48799
|
type: "subagent",
|
|
50248
48800
|
sessionId,
|
|
@@ -50251,16 +48803,16 @@ function createSubagentOp(sessionId, toolUseId, action, description, subagentTyp
|
|
|
50251
48803
|
action,
|
|
50252
48804
|
description,
|
|
50253
48805
|
subagentType,
|
|
50254
|
-
isMinimized:
|
|
50255
|
-
result:
|
|
48806
|
+
isMinimized: options?.isMinimized,
|
|
48807
|
+
result: options?.result
|
|
50256
48808
|
};
|
|
50257
48809
|
}
|
|
50258
|
-
function createStatusUpdateOp(sessionId,
|
|
48810
|
+
function createStatusUpdateOp(sessionId, options) {
|
|
50259
48811
|
return {
|
|
50260
48812
|
type: "status_update",
|
|
50261
48813
|
sessionId,
|
|
50262
48814
|
timestamp: Date.now(),
|
|
50263
|
-
...
|
|
48815
|
+
...options
|
|
50264
48816
|
};
|
|
50265
48817
|
}
|
|
50266
48818
|
// src/operations/transformer.ts
|
|
@@ -50442,11 +48994,11 @@ class BaseExecutor {
|
|
|
50442
48994
|
registerPost;
|
|
50443
48995
|
updateLastMessage;
|
|
50444
48996
|
events;
|
|
50445
|
-
constructor(
|
|
48997
|
+
constructor(options, initialState) {
|
|
50446
48998
|
this.state = initialState;
|
|
50447
|
-
this.registerPost =
|
|
50448
|
-
this.updateLastMessage =
|
|
50449
|
-
this.events =
|
|
48999
|
+
this.registerPost = options.registerPost;
|
|
49000
|
+
this.updateLastMessage = options.updateLastMessage;
|
|
49001
|
+
this.events = options.events;
|
|
50450
49002
|
}
|
|
50451
49003
|
getState() {
|
|
50452
49004
|
return { ...this.state };
|
|
@@ -50660,10 +49212,10 @@ function formatDuration(ms) {
|
|
|
50660
49212
|
class ContentExecutor extends BaseExecutor {
|
|
50661
49213
|
onBumpTaskList;
|
|
50662
49214
|
onBumpTaskListToBottom;
|
|
50663
|
-
constructor(
|
|
50664
|
-
super(
|
|
50665
|
-
this.onBumpTaskList =
|
|
50666
|
-
this.onBumpTaskListToBottom =
|
|
49215
|
+
constructor(options) {
|
|
49216
|
+
super(options, ContentExecutor.createInitialState());
|
|
49217
|
+
this.onBumpTaskList = options.onBumpTaskList;
|
|
49218
|
+
this.onBumpTaskListToBottom = options.onBumpTaskListToBottom;
|
|
50667
49219
|
}
|
|
50668
49220
|
static createInitialState() {
|
|
50669
49221
|
return {
|
|
@@ -50960,8 +49512,8 @@ class ContentExecutor extends BaseExecutor {
|
|
|
50960
49512
|
init_emoji();
|
|
50961
49513
|
class TaskListExecutor extends BaseExecutor {
|
|
50962
49514
|
bumpQueue = Promise.resolve();
|
|
50963
|
-
constructor(
|
|
50964
|
-
super(
|
|
49515
|
+
constructor(options) {
|
|
49516
|
+
super(options, TaskListExecutor.createInitialState());
|
|
50965
49517
|
}
|
|
50966
49518
|
static createInitialState() {
|
|
50967
49519
|
return {
|
|
@@ -51329,9 +49881,9 @@ var SUBAGENT_UPDATE_INTERVAL_MS = 5000;
|
|
|
51329
49881
|
|
|
51330
49882
|
class SubagentExecutor extends BaseExecutor {
|
|
51331
49883
|
onBumpTaskList;
|
|
51332
|
-
constructor(
|
|
51333
|
-
super(
|
|
51334
|
-
this.onBumpTaskList =
|
|
49884
|
+
constructor(options) {
|
|
49885
|
+
super(options, SubagentExecutor.createInitialState());
|
|
49886
|
+
this.onBumpTaskList = options.onBumpTaskList;
|
|
51335
49887
|
}
|
|
51336
49888
|
static createInitialState() {
|
|
51337
49889
|
return {
|
|
@@ -51532,8 +50084,8 @@ ${formatter.formatBlockquote(subagent.description)}
|
|
|
51532
50084
|
}
|
|
51533
50085
|
// src/operations/executors/system.ts
|
|
51534
50086
|
class SystemExecutor extends BaseExecutor {
|
|
51535
|
-
constructor(
|
|
51536
|
-
super(
|
|
50087
|
+
constructor(options) {
|
|
50088
|
+
super(options, SystemExecutor.createInitialState());
|
|
51537
50089
|
}
|
|
51538
50090
|
static createInitialState() {
|
|
51539
50091
|
return {
|
|
@@ -51645,8 +50197,8 @@ class SystemExecutor extends BaseExecutor {
|
|
|
51645
50197
|
// src/operations/executors/question-approval.ts
|
|
51646
50198
|
init_emoji();
|
|
51647
50199
|
class QuestionApprovalExecutor extends BaseExecutor {
|
|
51648
|
-
constructor(
|
|
51649
|
-
super(
|
|
50200
|
+
constructor(options) {
|
|
50201
|
+
super(options, QuestionApprovalExecutor.createInitialState());
|
|
51650
50202
|
}
|
|
51651
50203
|
static createInitialState() {
|
|
51652
50204
|
return {
|
|
@@ -51880,8 +50432,8 @@ class QuestionApprovalExecutor extends BaseExecutor {
|
|
|
51880
50432
|
// src/operations/executors/message-approval.ts
|
|
51881
50433
|
init_emoji();
|
|
51882
50434
|
class MessageApprovalExecutor extends BaseExecutor {
|
|
51883
|
-
constructor(
|
|
51884
|
-
super(
|
|
50435
|
+
constructor(options) {
|
|
50436
|
+
super(options, MessageApprovalExecutor.createInitialState());
|
|
51885
50437
|
}
|
|
51886
50438
|
static createInitialState() {
|
|
51887
50439
|
return {
|
|
@@ -51976,8 +50528,8 @@ class MessageApprovalExecutor extends BaseExecutor {
|
|
|
51976
50528
|
// src/operations/executors/prompt.ts
|
|
51977
50529
|
init_emoji();
|
|
51978
50530
|
class PromptExecutor extends BaseExecutor {
|
|
51979
|
-
constructor(
|
|
51980
|
-
super(
|
|
50531
|
+
constructor(options) {
|
|
50532
|
+
super(options, PromptExecutor.createInitialState());
|
|
51981
50533
|
}
|
|
51982
50534
|
static createInitialState() {
|
|
51983
50535
|
return {
|
|
@@ -52196,8 +50748,8 @@ class PromptExecutor extends BaseExecutor {
|
|
|
52196
50748
|
// src/operations/executors/bug-report.ts
|
|
52197
50749
|
init_emoji();
|
|
52198
50750
|
class BugReportExecutor extends BaseExecutor {
|
|
52199
|
-
constructor(
|
|
52200
|
-
super(
|
|
50751
|
+
constructor(options) {
|
|
50752
|
+
super(options, BugReportExecutor.createInitialState());
|
|
52201
50753
|
}
|
|
52202
50754
|
static createInitialState() {
|
|
52203
50755
|
return {
|
|
@@ -52383,13 +50935,8 @@ function createMessageManagerEvents() {
|
|
|
52383
50935
|
}
|
|
52384
50936
|
|
|
52385
50937
|
// src/operations/streaming/handler.ts
|
|
52386
|
-
var import_yauzl = __toESM(require_yauzl(), 1);
|
|
52387
50938
|
var log2 = createLogger("streaming");
|
|
52388
|
-
var
|
|
52389
|
-
var MAX_TEXT_FILE_SIZE = 1 * 1024 * 1024;
|
|
52390
|
-
var MAX_DECOMPRESSED_SIZE = 10 * 1024 * 1024;
|
|
52391
|
-
var MAX_ZIP_SIZE = 50 * 1024 * 1024;
|
|
52392
|
-
var MAX_GZIP_SIZE = 50 * 1024 * 1024;
|
|
50939
|
+
var MAX_UPLOAD_SIZE = 100 * 1024 * 1024;
|
|
52393
50940
|
async function postSkippedFilesFeedback(platform, threadId, skipped) {
|
|
52394
50941
|
if (skipped.length === 0)
|
|
52395
50942
|
return;
|
|
@@ -52438,25 +50985,25 @@ class MessageManager {
|
|
|
52438
50985
|
static DEFAULT_FLUSH_DELAY_MS = 500;
|
|
52439
50986
|
flushDelayMs;
|
|
52440
50987
|
events;
|
|
52441
|
-
constructor(
|
|
52442
|
-
this.session =
|
|
52443
|
-
this.platform =
|
|
52444
|
-
this.postTracker =
|
|
52445
|
-
this.sessionId =
|
|
52446
|
-
this.threadId =
|
|
52447
|
-
this.worktreePath =
|
|
52448
|
-
this.worktreeBranch =
|
|
52449
|
-
this.registerPost =
|
|
52450
|
-
this.updateLastMessage =
|
|
52451
|
-
this.buildMessageContentCallback =
|
|
52452
|
-
this.startTypingCallback =
|
|
52453
|
-
this.emitSessionUpdateCallback =
|
|
52454
|
-
this.flushDelayMs =
|
|
50988
|
+
constructor(options) {
|
|
50989
|
+
this.session = options.session;
|
|
50990
|
+
this.platform = options.platform;
|
|
50991
|
+
this.postTracker = options.postTracker;
|
|
50992
|
+
this.sessionId = options.sessionId;
|
|
50993
|
+
this.threadId = options.threadId;
|
|
50994
|
+
this.worktreePath = options.worktreePath;
|
|
50995
|
+
this.worktreeBranch = options.worktreeBranch;
|
|
50996
|
+
this.registerPost = options.registerPost;
|
|
50997
|
+
this.updateLastMessage = options.updateLastMessage;
|
|
50998
|
+
this.buildMessageContentCallback = options.buildMessageContent;
|
|
50999
|
+
this.startTypingCallback = options.startTyping;
|
|
51000
|
+
this.emitSessionUpdateCallback = options.emitSessionUpdate;
|
|
51001
|
+
this.flushDelayMs = options.flushDelayMs ?? MessageManager.DEFAULT_FLUSH_DELAY_MS;
|
|
52455
51002
|
this.events = createMessageManagerEvents();
|
|
52456
51003
|
this.contentBreaker = new DefaultContentBreaker;
|
|
52457
51004
|
this.contentExecutor = new ContentExecutor({
|
|
52458
|
-
registerPost:
|
|
52459
|
-
updateLastMessage:
|
|
51005
|
+
registerPost: options.registerPost,
|
|
51006
|
+
updateLastMessage: options.updateLastMessage,
|
|
52460
51007
|
onBumpTaskList: async (content, ctx) => {
|
|
52461
51008
|
return this.taskListExecutor.bumpAndGetOldPost(ctx, content);
|
|
52462
51009
|
},
|
|
@@ -52465,36 +51012,36 @@ class MessageManager {
|
|
|
52465
51012
|
}
|
|
52466
51013
|
});
|
|
52467
51014
|
this.taskListExecutor = new TaskListExecutor({
|
|
52468
|
-
registerPost:
|
|
52469
|
-
updateLastMessage:
|
|
51015
|
+
registerPost: options.registerPost,
|
|
51016
|
+
updateLastMessage: options.updateLastMessage
|
|
52470
51017
|
});
|
|
52471
51018
|
this.questionApprovalExecutor = new QuestionApprovalExecutor({
|
|
52472
|
-
registerPost:
|
|
52473
|
-
updateLastMessage:
|
|
51019
|
+
registerPost: options.registerPost,
|
|
51020
|
+
updateLastMessage: options.updateLastMessage,
|
|
52474
51021
|
events: this.events
|
|
52475
51022
|
});
|
|
52476
51023
|
this.messageApprovalExecutor = new MessageApprovalExecutor({
|
|
52477
|
-
registerPost:
|
|
52478
|
-
updateLastMessage:
|
|
51024
|
+
registerPost: options.registerPost,
|
|
51025
|
+
updateLastMessage: options.updateLastMessage,
|
|
52479
51026
|
events: this.events
|
|
52480
51027
|
});
|
|
52481
51028
|
this.promptExecutor = new PromptExecutor({
|
|
52482
|
-
registerPost:
|
|
52483
|
-
updateLastMessage:
|
|
51029
|
+
registerPost: options.registerPost,
|
|
51030
|
+
updateLastMessage: options.updateLastMessage,
|
|
52484
51031
|
events: this.events
|
|
52485
51032
|
});
|
|
52486
51033
|
this.bugReportExecutor = new BugReportExecutor({
|
|
52487
|
-
registerPost:
|
|
52488
|
-
updateLastMessage:
|
|
51034
|
+
registerPost: options.registerPost,
|
|
51035
|
+
updateLastMessage: options.updateLastMessage,
|
|
52489
51036
|
events: this.events
|
|
52490
51037
|
});
|
|
52491
51038
|
this.subagentExecutor = new SubagentExecutor({
|
|
52492
|
-
registerPost:
|
|
52493
|
-
updateLastMessage:
|
|
51039
|
+
registerPost: options.registerPost,
|
|
51040
|
+
updateLastMessage: options.updateLastMessage
|
|
52494
51041
|
});
|
|
52495
51042
|
this.systemExecutor = new SystemExecutor({
|
|
52496
|
-
registerPost:
|
|
52497
|
-
updateLastMessage:
|
|
51043
|
+
registerPost: options.registerPost,
|
|
51044
|
+
updateLastMessage: options.updateLastMessage,
|
|
52498
51045
|
events: this.events
|
|
52499
51046
|
});
|
|
52500
51047
|
}
|
|
@@ -52621,15 +51168,15 @@ class MessageManager {
|
|
|
52621
51168
|
postTracker: this.postTracker,
|
|
52622
51169
|
contentBreaker: this.contentBreaker,
|
|
52623
51170
|
threadLogger: this.session.threadLogger,
|
|
52624
|
-
createPost: async (content,
|
|
51171
|
+
createPost: async (content, options) => {
|
|
52625
51172
|
const post = await this.platform.createPost(content, this.threadId);
|
|
52626
|
-
this.registerPost(post.id,
|
|
51173
|
+
this.registerPost(post.id, options);
|
|
52627
51174
|
this.updateLastMessage(post);
|
|
52628
51175
|
return post;
|
|
52629
51176
|
},
|
|
52630
|
-
createInteractivePost: async (content, reactions,
|
|
51177
|
+
createInteractivePost: async (content, reactions, options) => {
|
|
52631
51178
|
const post = await this.platform.createInteractivePost(content, reactions, this.threadId);
|
|
52632
|
-
this.registerPost(post.id,
|
|
51179
|
+
this.registerPost(post.id, options);
|
|
52633
51180
|
this.updateLastMessage(post);
|
|
52634
51181
|
return post;
|
|
52635
51182
|
}
|
|
@@ -53036,18 +51583,18 @@ function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
|
|
|
53036
51583
|
function padStart(string7, max) {
|
|
53037
51584
|
return common.repeat(" ", max - string7.length) + string7;
|
|
53038
51585
|
}
|
|
53039
|
-
function makeSnippet(mark,
|
|
53040
|
-
|
|
51586
|
+
function makeSnippet(mark, options) {
|
|
51587
|
+
options = Object.create(options || null);
|
|
53041
51588
|
if (!mark.buffer)
|
|
53042
51589
|
return null;
|
|
53043
|
-
if (!
|
|
53044
|
-
|
|
53045
|
-
if (typeof
|
|
53046
|
-
|
|
53047
|
-
if (typeof
|
|
53048
|
-
|
|
53049
|
-
if (typeof
|
|
53050
|
-
|
|
51590
|
+
if (!options.maxLength)
|
|
51591
|
+
options.maxLength = 79;
|
|
51592
|
+
if (typeof options.indent !== "number")
|
|
51593
|
+
options.indent = 1;
|
|
51594
|
+
if (typeof options.linesBefore !== "number")
|
|
51595
|
+
options.linesBefore = 3;
|
|
51596
|
+
if (typeof options.linesAfter !== "number")
|
|
51597
|
+
options.linesAfter = 2;
|
|
53051
51598
|
var re = /\r?\n|\r|\0/g;
|
|
53052
51599
|
var lineStarts = [0];
|
|
53053
51600
|
var lineEnds = [];
|
|
@@ -53063,25 +51610,25 @@ function makeSnippet(mark, options2) {
|
|
|
53063
51610
|
if (foundLineNo < 0)
|
|
53064
51611
|
foundLineNo = lineStarts.length - 1;
|
|
53065
51612
|
var result = "", i, line;
|
|
53066
|
-
var lineNoLength = Math.min(mark.line +
|
|
53067
|
-
var maxLineLength =
|
|
53068
|
-
for (i = 1;i <=
|
|
51613
|
+
var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
|
|
51614
|
+
var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
|
|
51615
|
+
for (i = 1;i <= options.linesBefore; i++) {
|
|
53069
51616
|
if (foundLineNo - i < 0)
|
|
53070
51617
|
break;
|
|
53071
51618
|
line = getLine(mark.buffer, lineStarts[foundLineNo - i], lineEnds[foundLineNo - i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), maxLineLength);
|
|
53072
|
-
result = common.repeat(" ",
|
|
51619
|
+
result = common.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + `
|
|
53073
51620
|
` + result;
|
|
53074
51621
|
}
|
|
53075
51622
|
line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
|
|
53076
|
-
result += common.repeat(" ",
|
|
51623
|
+
result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + `
|
|
53077
51624
|
`;
|
|
53078
|
-
result += common.repeat("-",
|
|
51625
|
+
result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^" + `
|
|
53079
51626
|
`;
|
|
53080
|
-
for (i = 1;i <=
|
|
51627
|
+
for (i = 1;i <= options.linesAfter; i++) {
|
|
53081
51628
|
if (foundLineNo + i >= lineEnds.length)
|
|
53082
51629
|
break;
|
|
53083
51630
|
line = getLine(mark.buffer, lineStarts[foundLineNo + i], lineEnds[foundLineNo + i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), maxLineLength);
|
|
53084
|
-
result += common.repeat(" ",
|
|
51631
|
+
result += common.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + `
|
|
53085
51632
|
`;
|
|
53086
51633
|
}
|
|
53087
51634
|
return result.replace(/\n$/, "");
|
|
@@ -53115,29 +51662,29 @@ function compileStyleAliases(map3) {
|
|
|
53115
51662
|
}
|
|
53116
51663
|
return result;
|
|
53117
51664
|
}
|
|
53118
|
-
function Type$1(tag,
|
|
53119
|
-
|
|
53120
|
-
Object.keys(
|
|
51665
|
+
function Type$1(tag, options) {
|
|
51666
|
+
options = options || {};
|
|
51667
|
+
Object.keys(options).forEach(function(name) {
|
|
53121
51668
|
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
|
53122
51669
|
throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
|
53123
51670
|
}
|
|
53124
51671
|
});
|
|
53125
|
-
this.options =
|
|
51672
|
+
this.options = options;
|
|
53126
51673
|
this.tag = tag;
|
|
53127
|
-
this.kind =
|
|
53128
|
-
this.resolve =
|
|
51674
|
+
this.kind = options["kind"] || null;
|
|
51675
|
+
this.resolve = options["resolve"] || function() {
|
|
53129
51676
|
return true;
|
|
53130
51677
|
};
|
|
53131
|
-
this.construct =
|
|
51678
|
+
this.construct = options["construct"] || function(data) {
|
|
53132
51679
|
return data;
|
|
53133
51680
|
};
|
|
53134
|
-
this.instanceOf =
|
|
53135
|
-
this.predicate =
|
|
53136
|
-
this.represent =
|
|
53137
|
-
this.representName =
|
|
53138
|
-
this.defaultStyle =
|
|
53139
|
-
this.multi =
|
|
53140
|
-
this.styleAliases = compileStyleAliases(
|
|
51681
|
+
this.instanceOf = options["instanceOf"] || null;
|
|
51682
|
+
this.predicate = options["predicate"] || null;
|
|
51683
|
+
this.represent = options["represent"] || null;
|
|
51684
|
+
this.representName = options["representName"] || null;
|
|
51685
|
+
this.defaultStyle = options["defaultStyle"] || null;
|
|
51686
|
+
this.multi = options["multi"] || false;
|
|
51687
|
+
this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
|
|
53141
51688
|
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
|
|
53142
51689
|
throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
|
53143
51690
|
}
|
|
@@ -53855,14 +52402,14 @@ for (i = 0;i < 256; i++) {
|
|
|
53855
52402
|
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
|
53856
52403
|
}
|
|
53857
52404
|
var i;
|
|
53858
|
-
function State$1(input,
|
|
52405
|
+
function State$1(input, options) {
|
|
53859
52406
|
this.input = input;
|
|
53860
|
-
this.filename =
|
|
53861
|
-
this.schema =
|
|
53862
|
-
this.onWarning =
|
|
53863
|
-
this.legacy =
|
|
53864
|
-
this.json =
|
|
53865
|
-
this.listener =
|
|
52407
|
+
this.filename = options["filename"] || null;
|
|
52408
|
+
this.schema = options["schema"] || _default4;
|
|
52409
|
+
this.onWarning = options["onWarning"] || null;
|
|
52410
|
+
this.legacy = options["legacy"] || false;
|
|
52411
|
+
this.json = options["json"] || false;
|
|
52412
|
+
this.listener = options["listener"] || null;
|
|
53866
52413
|
this.implicitTypes = this.schema.compiledImplicit;
|
|
53867
52414
|
this.typeMap = this.schema.compiledTypeMap;
|
|
53868
52415
|
this.length = input.length;
|
|
@@ -54882,9 +53429,9 @@ function readDocument(state) {
|
|
|
54882
53429
|
return;
|
|
54883
53430
|
}
|
|
54884
53431
|
}
|
|
54885
|
-
function loadDocuments(input,
|
|
53432
|
+
function loadDocuments(input, options) {
|
|
54886
53433
|
input = String(input);
|
|
54887
|
-
|
|
53434
|
+
options = options || {};
|
|
54888
53435
|
if (input.length !== 0) {
|
|
54889
53436
|
if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
|
|
54890
53437
|
input += `
|
|
@@ -54894,7 +53441,7 @@ function loadDocuments(input, options2) {
|
|
|
54894
53441
|
input = input.slice(1);
|
|
54895
53442
|
}
|
|
54896
53443
|
}
|
|
54897
|
-
var state = new State$1(input,
|
|
53444
|
+
var state = new State$1(input, options);
|
|
54898
53445
|
var nullpos = input.indexOf("\x00");
|
|
54899
53446
|
if (nullpos !== -1) {
|
|
54900
53447
|
state.position = nullpos;
|
|
@@ -54910,12 +53457,12 @@ function loadDocuments(input, options2) {
|
|
|
54910
53457
|
}
|
|
54911
53458
|
return state.documents;
|
|
54912
53459
|
}
|
|
54913
|
-
function loadAll$1(input, iterator,
|
|
54914
|
-
if (iterator !== null && typeof iterator === "object" && typeof
|
|
54915
|
-
|
|
53460
|
+
function loadAll$1(input, iterator, options) {
|
|
53461
|
+
if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
|
|
53462
|
+
options = iterator;
|
|
54916
53463
|
iterator = null;
|
|
54917
53464
|
}
|
|
54918
|
-
var documents = loadDocuments(input,
|
|
53465
|
+
var documents = loadDocuments(input, options);
|
|
54919
53466
|
if (typeof iterator !== "function") {
|
|
54920
53467
|
return documents;
|
|
54921
53468
|
}
|
|
@@ -54923,8 +53470,8 @@ function loadAll$1(input, iterator, options2) {
|
|
|
54923
53470
|
iterator(documents[index]);
|
|
54924
53471
|
}
|
|
54925
53472
|
}
|
|
54926
|
-
function load$1(input,
|
|
54927
|
-
var documents = loadDocuments(input,
|
|
53473
|
+
function load$1(input, options) {
|
|
53474
|
+
var documents = loadDocuments(input, options);
|
|
54928
53475
|
if (documents.length === 0) {
|
|
54929
53476
|
return;
|
|
54930
53477
|
} else if (documents.length === 1) {
|
|
@@ -55039,21 +53586,21 @@ function encodeHex(character) {
|
|
|
55039
53586
|
}
|
|
55040
53587
|
var QUOTING_TYPE_SINGLE = 1;
|
|
55041
53588
|
var QUOTING_TYPE_DOUBLE = 2;
|
|
55042
|
-
function State(
|
|
55043
|
-
this.schema =
|
|
55044
|
-
this.indent = Math.max(1,
|
|
55045
|
-
this.noArrayIndent =
|
|
55046
|
-
this.skipInvalid =
|
|
55047
|
-
this.flowLevel = common.isNothing(
|
|
55048
|
-
this.styleMap = compileStyleMap(this.schema,
|
|
55049
|
-
this.sortKeys =
|
|
55050
|
-
this.lineWidth =
|
|
55051
|
-
this.noRefs =
|
|
55052
|
-
this.noCompatMode =
|
|
55053
|
-
this.condenseFlow =
|
|
55054
|
-
this.quotingType =
|
|
55055
|
-
this.forceQuotes =
|
|
55056
|
-
this.replacer = typeof
|
|
53589
|
+
function State(options) {
|
|
53590
|
+
this.schema = options["schema"] || _default4;
|
|
53591
|
+
this.indent = Math.max(1, options["indent"] || 2);
|
|
53592
|
+
this.noArrayIndent = options["noArrayIndent"] || false;
|
|
53593
|
+
this.skipInvalid = options["skipInvalid"] || false;
|
|
53594
|
+
this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
|
|
53595
|
+
this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
|
|
53596
|
+
this.sortKeys = options["sortKeys"] || false;
|
|
53597
|
+
this.lineWidth = options["lineWidth"] || 80;
|
|
53598
|
+
this.noRefs = options["noRefs"] || false;
|
|
53599
|
+
this.noCompatMode = options["noCompatMode"] || false;
|
|
53600
|
+
this.condenseFlow = options["condenseFlow"] || false;
|
|
53601
|
+
this.quotingType = options["quotingType"] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
|
|
53602
|
+
this.forceQuotes = options["forceQuotes"] || false;
|
|
53603
|
+
this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
|
|
55057
53604
|
this.implicitTypes = this.schema.compiledImplicit;
|
|
55058
53605
|
this.explicitTypes = this.schema.compiledExplicit;
|
|
55059
53606
|
this.tag = null;
|
|
@@ -55550,9 +54097,9 @@ function inspectNode(object5, objects, duplicatesIndexes) {
|
|
|
55550
54097
|
}
|
|
55551
54098
|
}
|
|
55552
54099
|
}
|
|
55553
|
-
function dump$1(input,
|
|
55554
|
-
|
|
55555
|
-
var state = new State(
|
|
54100
|
+
function dump$1(input, options) {
|
|
54101
|
+
options = options || {};
|
|
54102
|
+
var state = new State(options);
|
|
55556
54103
|
if (!state.noRefs)
|
|
55557
54104
|
getDuplicateReferences(input, state);
|
|
55558
54105
|
var value = input;
|
|
@@ -55894,8 +54441,8 @@ class Redactor {
|
|
|
55894
54441
|
aggressive;
|
|
55895
54442
|
anonymizationMap = new Map;
|
|
55896
54443
|
anonymizationCounters = new Map;
|
|
55897
|
-
constructor(
|
|
55898
|
-
const { apiKey, apiUrl, failSilent = true, hookTimeout = 500, rules, customRules = [], globalReplaceWith, anonymize = false, aggressive = false } =
|
|
54444
|
+
constructor(options = {}) {
|
|
54445
|
+
const { apiKey, apiUrl, failSilent = true, hookTimeout = 500, rules, customRules = [], globalReplaceWith, anonymize = false, aggressive = false } = options;
|
|
55899
54446
|
const hasApiKey = apiKey !== null && apiKey !== undefined && apiKey !== "";
|
|
55900
54447
|
this.apiUrl = hasApiKey ? apiUrl ?? "https://api.redactpii.com/v1/events" : apiUrl ?? "";
|
|
55901
54448
|
this.apiKey = apiKey ?? null;
|
|
@@ -56137,14 +54684,14 @@ class UsernameAnonymizer {
|
|
|
56137
54684
|
// src/utils/spawn.ts
|
|
56138
54685
|
import { spawn as nodeSpawn, spawnSync as nodeSpawnSync } from "child_process";
|
|
56139
54686
|
var isWindows = process.platform === "win32";
|
|
56140
|
-
function addWindowsShell(
|
|
56141
|
-
if (isWindows &&
|
|
56142
|
-
return { ...
|
|
54687
|
+
function addWindowsShell(options) {
|
|
54688
|
+
if (isWindows && options.shell === undefined) {
|
|
54689
|
+
return { ...options, shell: true };
|
|
56143
54690
|
}
|
|
56144
|
-
return
|
|
54691
|
+
return options;
|
|
56145
54692
|
}
|
|
56146
|
-
function crossSpawn(command, args,
|
|
56147
|
-
return nodeSpawn(command, args, addWindowsShell(
|
|
54693
|
+
function crossSpawn(command, args, options) {
|
|
54694
|
+
return nodeSpawn(command, args, addWindowsShell(options ?? {}));
|
|
56148
54695
|
}
|
|
56149
54696
|
|
|
56150
54697
|
// src/claude/cli.ts
|
|
@@ -56335,10 +54882,10 @@ class ClaudeCli extends EventEmitter2 {
|
|
|
56335
54882
|
mcpConfigTempFile = null;
|
|
56336
54883
|
lastEmittedRateLimitDeadline = 0;
|
|
56337
54884
|
log;
|
|
56338
|
-
constructor(
|
|
54885
|
+
constructor(options) {
|
|
56339
54886
|
super();
|
|
56340
|
-
this.options =
|
|
56341
|
-
this.log =
|
|
54887
|
+
this.options = options;
|
|
54888
|
+
this.log = options.logSessionId ? createLogger("claude").forSession(options.logSessionId) : createLogger("claude");
|
|
56342
54889
|
}
|
|
56343
54890
|
getStatusFilePath() {
|
|
56344
54891
|
return this.statusFilePath;
|
|
@@ -56489,7 +55036,7 @@ class ClaudeCli extends EventEmitter2 {
|
|
|
56489
55036
|
message: { role: "user", content }
|
|
56490
55037
|
}) + `
|
|
56491
55038
|
`;
|
|
56492
|
-
const preview =
|
|
55039
|
+
const preview = content.substring(0, 50);
|
|
56493
55040
|
this.log.debug(`Sending: ${preview}...`);
|
|
56494
55041
|
if (process.env.INTEGRATION_TEST === "1") {
|
|
56495
55042
|
const stack = new Error().stack?.split(`
|