@pactflow/openapi-pact-comparator 1.13.1 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +519 -278
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +517 -276
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +517 -276
- package/dist/index.mjs.map +1 -1
- package/package.json +18 -18
package/dist/index.mjs
CHANGED
|
@@ -3099,7 +3099,7 @@ function setCacheAdd(value) {
|
|
|
3099
3099
|
* @name has
|
|
3100
3100
|
* @memberOf SetCache
|
|
3101
3101
|
* @param {*} value The value to search for.
|
|
3102
|
-
* @returns {
|
|
3102
|
+
* @returns {boolean} Returns `true` if `value` is found, else `false`.
|
|
3103
3103
|
*/
|
|
3104
3104
|
function setCacheHas(value) {
|
|
3105
3105
|
return this.__data__.has(value);
|
|
@@ -3597,7 +3597,9 @@ var hasOwnProperty = objectProto.hasOwnProperty;
|
|
|
3597
3597
|
function baseUnset(object, path) {
|
|
3598
3598
|
path = castPath(path, object);
|
|
3599
3599
|
|
|
3600
|
-
// Prevent prototype pollution
|
|
3600
|
+
// Prevent prototype pollution:
|
|
3601
|
+
// https://github.com/lodash/lodash/security/advisories/GHSA-xxjr-mmjv-4gpg
|
|
3602
|
+
// https://github.com/lodash/lodash/security/advisories/GHSA-f23m-r3pf-42rh
|
|
3601
3603
|
var index = -1,
|
|
3602
3604
|
length = path.length;
|
|
3603
3605
|
|
|
@@ -3605,32 +3607,17 @@ function baseUnset(object, path) {
|
|
|
3605
3607
|
return true;
|
|
3606
3608
|
}
|
|
3607
3609
|
|
|
3608
|
-
var isRootPrimitive = object == null || (typeof object !== 'object' && typeof object !== 'function');
|
|
3609
|
-
|
|
3610
3610
|
while (++index < length) {
|
|
3611
|
-
var key = path[index];
|
|
3612
|
-
|
|
3613
|
-
// skip non-string keys (e.g., Symbols, numbers)
|
|
3614
|
-
if (typeof key !== 'string') {
|
|
3615
|
-
continue;
|
|
3616
|
-
}
|
|
3611
|
+
var key = toKey(path[index]);
|
|
3617
3612
|
|
|
3618
3613
|
// Always block "__proto__" anywhere in the path if it's not expected
|
|
3619
3614
|
if (key === '__proto__' && !hasOwnProperty.call(object, '__proto__')) {
|
|
3620
3615
|
return false;
|
|
3621
3616
|
}
|
|
3622
3617
|
|
|
3623
|
-
// Block
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
typeof path[index + 1] === 'string' &&
|
|
3627
|
-
path[index + 1] === 'prototype') {
|
|
3628
|
-
|
|
3629
|
-
// Allow ONLY when the path starts at a primitive root, e.g., _.unset(0, 'constructor.prototype.a')
|
|
3630
|
-
if (isRootPrimitive && index === 0) {
|
|
3631
|
-
continue;
|
|
3632
|
-
}
|
|
3633
|
-
|
|
3618
|
+
// Block constructor/prototype as non-terminal traversal keys to prevent
|
|
3619
|
+
// escaping the object graph into built-in constructors and prototypes.
|
|
3620
|
+
if ((key === 'constructor' || key === 'prototype') && index < length - 1) {
|
|
3634
3621
|
return false;
|
|
3635
3622
|
}
|
|
3636
3623
|
}
|
|
@@ -3967,6 +3954,25 @@ const transformResponseSchema = (schema, noTransformNonNullableResponseSchema) =
|
|
|
3967
3954
|
return schema;
|
|
3968
3955
|
};
|
|
3969
3956
|
|
|
3957
|
+
function _inlinePropertyRefs(s, root) {
|
|
3958
|
+
if (!s.properties)
|
|
3959
|
+
return s;
|
|
3960
|
+
const properties = {};
|
|
3961
|
+
let changed = false;
|
|
3962
|
+
for (const key in s.properties) {
|
|
3963
|
+
const prop = s.properties[key];
|
|
3964
|
+
if (prop.$ref && Object.keys(prop).length === 1) {
|
|
3965
|
+
const deref = get$1(root, splitPath(prop.$ref));
|
|
3966
|
+
if (deref) {
|
|
3967
|
+
properties[key] = _flat(deref, root);
|
|
3968
|
+
changed = true;
|
|
3969
|
+
continue;
|
|
3970
|
+
}
|
|
3971
|
+
}
|
|
3972
|
+
properties[key] = prop;
|
|
3973
|
+
}
|
|
3974
|
+
return changed ? { ...s, properties } : s;
|
|
3975
|
+
}
|
|
3970
3976
|
function _flat(s, root) {
|
|
3971
3977
|
if (s.allOf) {
|
|
3972
3978
|
const { allOf, ...others } = s;
|
|
@@ -3979,7 +3985,10 @@ function _flat(s, root) {
|
|
|
3979
3985
|
...get$1(root, splitPath($ref)),
|
|
3980
3986
|
};
|
|
3981
3987
|
}
|
|
3982
|
-
|
|
3988
|
+
// Inline pure $ref property schemas before merging so that lodash merge
|
|
3989
|
+
// doesn't produce broken { $ref, properties } hybrids when two allOf
|
|
3990
|
+
// branches define the same property key differently.
|
|
3991
|
+
return _inlinePropertyRefs(_flat(dereferenced || ss, root), root);
|
|
3983
3992
|
}));
|
|
3984
3993
|
}
|
|
3985
3994
|
if (s.properties) {
|
|
@@ -4782,9 +4791,8 @@ function requireSideChannelList () {
|
|
|
4782
4791
|
}
|
|
4783
4792
|
},
|
|
4784
4793
|
'delete': function (key) {
|
|
4785
|
-
var root = $o && $o.next;
|
|
4786
4794
|
var deletedNode = listDelete($o, key);
|
|
4787
|
-
if (deletedNode &&
|
|
4795
|
+
if (deletedNode && $o && !$o.next) {
|
|
4788
4796
|
$o = void undefined;
|
|
4789
4797
|
}
|
|
4790
4798
|
return !!deletedNode;
|
|
@@ -4806,7 +4814,6 @@ function requireSideChannelList () {
|
|
|
4806
4814
|
listSet(/** @type {NonNullable<typeof $o>} */ ($o), key, value);
|
|
4807
4815
|
}
|
|
4808
4816
|
};
|
|
4809
|
-
// @ts-expect-error TODO: figure out why this is erroring
|
|
4810
4817
|
return channel;
|
|
4811
4818
|
};
|
|
4812
4819
|
return sideChannelList;
|
|
@@ -6881,10 +6888,10 @@ function requireParse$1 () {
|
|
|
6881
6888
|
var limit = options.parameterLimit === Infinity ? void undefined : options.parameterLimit;
|
|
6882
6889
|
var parts = cleanStr.split(
|
|
6883
6890
|
options.delimiter,
|
|
6884
|
-
options.throwOnLimitExceeded ? limit + 1 : limit
|
|
6891
|
+
options.throwOnLimitExceeded && typeof limit !== 'undefined' ? limit + 1 : limit
|
|
6885
6892
|
);
|
|
6886
6893
|
|
|
6887
|
-
if (options.throwOnLimitExceeded && parts.length > limit) {
|
|
6894
|
+
if (options.throwOnLimitExceeded && typeof limit !== 'undefined' && parts.length > limit) {
|
|
6888
6895
|
throw new RangeError('Parameter limit exceeded. Only ' + limit + ' parameter' + (limit === 1 ? '' : 's') + ' allowed.');
|
|
6889
6896
|
}
|
|
6890
6897
|
|
|
@@ -7866,7 +7873,7 @@ function* compareReqBody(ajv, route, interaction, index, config) {
|
|
|
7866
7873
|
pathName: path,
|
|
7867
7874
|
value: get$1(operation, "requestBody.content"),
|
|
7868
7875
|
},
|
|
7869
|
-
type: "
|
|
7876
|
+
type: "warning",
|
|
7870
7877
|
};
|
|
7871
7878
|
}
|
|
7872
7879
|
}
|
|
@@ -12364,18 +12371,18 @@ var hasRequiredCode$1;
|
|
|
12364
12371
|
function requireCode$1 () {
|
|
12365
12372
|
if (hasRequiredCode$1) return code$1;
|
|
12366
12373
|
hasRequiredCode$1 = 1;
|
|
12367
|
-
(function (exports
|
|
12368
|
-
Object.defineProperty(exports
|
|
12369
|
-
exports
|
|
12374
|
+
(function (exports) {
|
|
12375
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12376
|
+
exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
|
|
12370
12377
|
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
12371
12378
|
class _CodeOrName {
|
|
12372
12379
|
}
|
|
12373
|
-
exports
|
|
12374
|
-
exports
|
|
12380
|
+
exports._CodeOrName = _CodeOrName;
|
|
12381
|
+
exports.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
|
|
12375
12382
|
class Name extends _CodeOrName {
|
|
12376
12383
|
constructor(s) {
|
|
12377
12384
|
super();
|
|
12378
|
-
if (!exports
|
|
12385
|
+
if (!exports.IDENTIFIER.test(s))
|
|
12379
12386
|
throw new Error("CodeGen: name must be a valid identifier");
|
|
12380
12387
|
this.str = s;
|
|
12381
12388
|
}
|
|
@@ -12389,7 +12396,7 @@ function requireCode$1 () {
|
|
|
12389
12396
|
return { [this.str]: 1 };
|
|
12390
12397
|
}
|
|
12391
12398
|
}
|
|
12392
|
-
exports
|
|
12399
|
+
exports.Name = Name;
|
|
12393
12400
|
class _Code extends _CodeOrName {
|
|
12394
12401
|
constructor(code) {
|
|
12395
12402
|
super();
|
|
@@ -12417,8 +12424,8 @@ function requireCode$1 () {
|
|
|
12417
12424
|
}, {})));
|
|
12418
12425
|
}
|
|
12419
12426
|
}
|
|
12420
|
-
exports
|
|
12421
|
-
exports
|
|
12427
|
+
exports._Code = _Code;
|
|
12428
|
+
exports.nil = new _Code("");
|
|
12422
12429
|
function _(strs, ...args) {
|
|
12423
12430
|
const code = [strs[0]];
|
|
12424
12431
|
let i = 0;
|
|
@@ -12428,7 +12435,7 @@ function requireCode$1 () {
|
|
|
12428
12435
|
}
|
|
12429
12436
|
return new _Code(code);
|
|
12430
12437
|
}
|
|
12431
|
-
exports
|
|
12438
|
+
exports._ = _;
|
|
12432
12439
|
const plus = new _Code("+");
|
|
12433
12440
|
function str(strs, ...args) {
|
|
12434
12441
|
const expr = [safeStringify(strs[0])];
|
|
@@ -12441,7 +12448,7 @@ function requireCode$1 () {
|
|
|
12441
12448
|
optimize(expr);
|
|
12442
12449
|
return new _Code(expr);
|
|
12443
12450
|
}
|
|
12444
|
-
exports
|
|
12451
|
+
exports.str = str;
|
|
12445
12452
|
function addCodeArg(code, arg) {
|
|
12446
12453
|
if (arg instanceof _Code)
|
|
12447
12454
|
code.push(...arg._items);
|
|
@@ -12450,7 +12457,7 @@ function requireCode$1 () {
|
|
|
12450
12457
|
else
|
|
12451
12458
|
code.push(interpolate(arg));
|
|
12452
12459
|
}
|
|
12453
|
-
exports
|
|
12460
|
+
exports.addCodeArg = addCodeArg;
|
|
12454
12461
|
function optimize(expr) {
|
|
12455
12462
|
let i = 1;
|
|
12456
12463
|
while (i < expr.length - 1) {
|
|
@@ -12486,7 +12493,7 @@ function requireCode$1 () {
|
|
|
12486
12493
|
function strConcat(c1, c2) {
|
|
12487
12494
|
return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str `${c1}${c2}`;
|
|
12488
12495
|
}
|
|
12489
|
-
exports
|
|
12496
|
+
exports.strConcat = strConcat;
|
|
12490
12497
|
// TODO do not allow arrays here
|
|
12491
12498
|
function interpolate(x) {
|
|
12492
12499
|
return typeof x == "number" || typeof x == "boolean" || x === null
|
|
@@ -12496,29 +12503,29 @@ function requireCode$1 () {
|
|
|
12496
12503
|
function stringify(x) {
|
|
12497
12504
|
return new _Code(safeStringify(x));
|
|
12498
12505
|
}
|
|
12499
|
-
exports
|
|
12506
|
+
exports.stringify = stringify;
|
|
12500
12507
|
function safeStringify(x) {
|
|
12501
12508
|
return JSON.stringify(x)
|
|
12502
12509
|
.replace(/\u2028/g, "\\u2028")
|
|
12503
12510
|
.replace(/\u2029/g, "\\u2029");
|
|
12504
12511
|
}
|
|
12505
|
-
exports
|
|
12512
|
+
exports.safeStringify = safeStringify;
|
|
12506
12513
|
function getProperty(key) {
|
|
12507
|
-
return typeof key == "string" && exports
|
|
12514
|
+
return typeof key == "string" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _ `[${key}]`;
|
|
12508
12515
|
}
|
|
12509
|
-
exports
|
|
12516
|
+
exports.getProperty = getProperty;
|
|
12510
12517
|
//Does best effort to format the name properly
|
|
12511
12518
|
function getEsmExportName(key) {
|
|
12512
|
-
if (typeof key == "string" && exports
|
|
12519
|
+
if (typeof key == "string" && exports.IDENTIFIER.test(key)) {
|
|
12513
12520
|
return new _Code(`${key}`);
|
|
12514
12521
|
}
|
|
12515
12522
|
throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`);
|
|
12516
12523
|
}
|
|
12517
|
-
exports
|
|
12524
|
+
exports.getEsmExportName = getEsmExportName;
|
|
12518
12525
|
function regexpCode(rx) {
|
|
12519
12526
|
return new _Code(rx.toString());
|
|
12520
12527
|
}
|
|
12521
|
-
exports
|
|
12528
|
+
exports.regexpCode = regexpCode;
|
|
12522
12529
|
|
|
12523
12530
|
} (code$1));
|
|
12524
12531
|
return code$1;
|
|
@@ -12531,9 +12538,9 @@ var hasRequiredScope;
|
|
|
12531
12538
|
function requireScope () {
|
|
12532
12539
|
if (hasRequiredScope) return scope;
|
|
12533
12540
|
hasRequiredScope = 1;
|
|
12534
|
-
(function (exports
|
|
12535
|
-
Object.defineProperty(exports
|
|
12536
|
-
exports
|
|
12541
|
+
(function (exports) {
|
|
12542
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12543
|
+
exports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = exports.UsedValueState = void 0;
|
|
12537
12544
|
const code_1 = /*@__PURE__*/ requireCode$1();
|
|
12538
12545
|
class ValueError extends Error {
|
|
12539
12546
|
constructor(name) {
|
|
@@ -12545,8 +12552,8 @@ function requireScope () {
|
|
|
12545
12552
|
(function (UsedValueState) {
|
|
12546
12553
|
UsedValueState[UsedValueState["Started"] = 0] = "Started";
|
|
12547
12554
|
UsedValueState[UsedValueState["Completed"] = 1] = "Completed";
|
|
12548
|
-
})(UsedValueState || (exports
|
|
12549
|
-
exports
|
|
12555
|
+
})(UsedValueState || (exports.UsedValueState = UsedValueState = {}));
|
|
12556
|
+
exports.varKinds = {
|
|
12550
12557
|
const: new code_1.Name("const"),
|
|
12551
12558
|
let: new code_1.Name("let"),
|
|
12552
12559
|
var: new code_1.Name("var"),
|
|
@@ -12575,7 +12582,7 @@ function requireScope () {
|
|
|
12575
12582
|
return (this._names[prefix] = { prefix, index: 0 });
|
|
12576
12583
|
}
|
|
12577
12584
|
}
|
|
12578
|
-
exports
|
|
12585
|
+
exports.Scope = Scope;
|
|
12579
12586
|
class ValueScopeName extends code_1.Name {
|
|
12580
12587
|
constructor(prefix, nameStr) {
|
|
12581
12588
|
super(nameStr);
|
|
@@ -12586,7 +12593,7 @@ function requireScope () {
|
|
|
12586
12593
|
this.scopePath = (0, code_1._) `.${new code_1.Name(property)}[${itemIndex}]`;
|
|
12587
12594
|
}
|
|
12588
12595
|
}
|
|
12589
|
-
exports
|
|
12596
|
+
exports.ValueScopeName = ValueScopeName;
|
|
12590
12597
|
const line = (0, code_1._) `\n`;
|
|
12591
12598
|
class ValueScope extends Scope {
|
|
12592
12599
|
constructor(opts) {
|
|
@@ -12657,7 +12664,7 @@ function requireScope () {
|
|
|
12657
12664
|
nameSet.set(name, UsedValueState.Started);
|
|
12658
12665
|
let c = valueCode(name);
|
|
12659
12666
|
if (c) {
|
|
12660
|
-
const def = this.opts.es5 ? exports
|
|
12667
|
+
const def = this.opts.es5 ? exports.varKinds.var : exports.varKinds.const;
|
|
12661
12668
|
code = (0, code_1._) `${code}${def} ${name} = ${c};${this.opts._n}`;
|
|
12662
12669
|
}
|
|
12663
12670
|
else if ((c = getCode === null || getCode === void 0 ? void 0 : getCode(name))) {
|
|
@@ -12672,7 +12679,7 @@ function requireScope () {
|
|
|
12672
12679
|
return code;
|
|
12673
12680
|
}
|
|
12674
12681
|
}
|
|
12675
|
-
exports
|
|
12682
|
+
exports.ValueScope = ValueScope;
|
|
12676
12683
|
|
|
12677
12684
|
} (scope));
|
|
12678
12685
|
return scope;
|
|
@@ -12683,26 +12690,26 @@ var hasRequiredCodegen;
|
|
|
12683
12690
|
function requireCodegen () {
|
|
12684
12691
|
if (hasRequiredCodegen) return codegen;
|
|
12685
12692
|
hasRequiredCodegen = 1;
|
|
12686
|
-
(function (exports
|
|
12687
|
-
Object.defineProperty(exports
|
|
12688
|
-
exports
|
|
12693
|
+
(function (exports) {
|
|
12694
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12695
|
+
exports.or = exports.and = exports.not = exports.CodeGen = exports.operators = exports.varKinds = exports.ValueScopeName = exports.ValueScope = exports.Scope = exports.Name = exports.regexpCode = exports.stringify = exports.getProperty = exports.nil = exports.strConcat = exports.str = exports._ = void 0;
|
|
12689
12696
|
const code_1 = /*@__PURE__*/ requireCode$1();
|
|
12690
12697
|
const scope_1 = /*@__PURE__*/ requireScope();
|
|
12691
12698
|
var code_2 = /*@__PURE__*/ requireCode$1();
|
|
12692
|
-
Object.defineProperty(exports
|
|
12693
|
-
Object.defineProperty(exports
|
|
12694
|
-
Object.defineProperty(exports
|
|
12695
|
-
Object.defineProperty(exports
|
|
12696
|
-
Object.defineProperty(exports
|
|
12697
|
-
Object.defineProperty(exports
|
|
12698
|
-
Object.defineProperty(exports
|
|
12699
|
-
Object.defineProperty(exports
|
|
12699
|
+
Object.defineProperty(exports, "_", { enumerable: true, get: function () { return code_2._; } });
|
|
12700
|
+
Object.defineProperty(exports, "str", { enumerable: true, get: function () { return code_2.str; } });
|
|
12701
|
+
Object.defineProperty(exports, "strConcat", { enumerable: true, get: function () { return code_2.strConcat; } });
|
|
12702
|
+
Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return code_2.nil; } });
|
|
12703
|
+
Object.defineProperty(exports, "getProperty", { enumerable: true, get: function () { return code_2.getProperty; } });
|
|
12704
|
+
Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return code_2.stringify; } });
|
|
12705
|
+
Object.defineProperty(exports, "regexpCode", { enumerable: true, get: function () { return code_2.regexpCode; } });
|
|
12706
|
+
Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return code_2.Name; } });
|
|
12700
12707
|
var scope_2 = /*@__PURE__*/ requireScope();
|
|
12701
|
-
Object.defineProperty(exports
|
|
12702
|
-
Object.defineProperty(exports
|
|
12703
|
-
Object.defineProperty(exports
|
|
12704
|
-
Object.defineProperty(exports
|
|
12705
|
-
exports
|
|
12708
|
+
Object.defineProperty(exports, "Scope", { enumerable: true, get: function () { return scope_2.Scope; } });
|
|
12709
|
+
Object.defineProperty(exports, "ValueScope", { enumerable: true, get: function () { return scope_2.ValueScope; } });
|
|
12710
|
+
Object.defineProperty(exports, "ValueScopeName", { enumerable: true, get: function () { return scope_2.ValueScopeName; } });
|
|
12711
|
+
Object.defineProperty(exports, "varKinds", { enumerable: true, get: function () { return scope_2.varKinds; } });
|
|
12712
|
+
exports.operators = {
|
|
12706
12713
|
GT: new code_1._Code(">"),
|
|
12707
12714
|
GTE: new code_1._Code(">="),
|
|
12708
12715
|
LT: new code_1._Code("<"),
|
|
@@ -13116,7 +13123,7 @@ function requireCodegen () {
|
|
|
13116
13123
|
}
|
|
13117
13124
|
// `+=` code
|
|
13118
13125
|
add(lhs, rhs) {
|
|
13119
|
-
return this._leafNode(new AssignOp(lhs, exports
|
|
13126
|
+
return this._leafNode(new AssignOp(lhs, exports.operators.ADD, rhs));
|
|
13120
13127
|
}
|
|
13121
13128
|
// appends passed SafeExpr to code or executes Block
|
|
13122
13129
|
code(c) {
|
|
@@ -13318,7 +13325,7 @@ function requireCodegen () {
|
|
|
13318
13325
|
ns[ns.length - 1] = node;
|
|
13319
13326
|
}
|
|
13320
13327
|
}
|
|
13321
|
-
exports
|
|
13328
|
+
exports.CodeGen = CodeGen;
|
|
13322
13329
|
function addNames(names, from) {
|
|
13323
13330
|
for (const n in from)
|
|
13324
13331
|
names[n] = (names[n] || 0) + (from[n] || 0);
|
|
@@ -13360,19 +13367,19 @@ function requireCodegen () {
|
|
|
13360
13367
|
function not(x) {
|
|
13361
13368
|
return typeof x == "boolean" || typeof x == "number" || x === null ? !x : (0, code_1._) `!${par(x)}`;
|
|
13362
13369
|
}
|
|
13363
|
-
exports
|
|
13364
|
-
const andCode = mappend(exports
|
|
13370
|
+
exports.not = not;
|
|
13371
|
+
const andCode = mappend(exports.operators.AND);
|
|
13365
13372
|
// boolean AND (&&) expression with the passed arguments
|
|
13366
13373
|
function and(...args) {
|
|
13367
13374
|
return args.reduce(andCode);
|
|
13368
13375
|
}
|
|
13369
|
-
exports
|
|
13370
|
-
const orCode = mappend(exports
|
|
13376
|
+
exports.and = and;
|
|
13377
|
+
const orCode = mappend(exports.operators.OR);
|
|
13371
13378
|
// boolean OR (||) expression with the passed arguments
|
|
13372
13379
|
function or(...args) {
|
|
13373
13380
|
return args.reduce(orCode);
|
|
13374
13381
|
}
|
|
13375
|
-
exports
|
|
13382
|
+
exports.or = or;
|
|
13376
13383
|
function mappend(op) {
|
|
13377
13384
|
return (x, y) => (x === code_1.nil ? y : y === code_1.nil ? x : (0, code_1._) `${par(x)} ${op} ${par(y)}`);
|
|
13378
13385
|
}
|
|
@@ -13613,21 +13620,21 @@ var hasRequiredErrors;
|
|
|
13613
13620
|
function requireErrors () {
|
|
13614
13621
|
if (hasRequiredErrors) return errors;
|
|
13615
13622
|
hasRequiredErrors = 1;
|
|
13616
|
-
(function (exports
|
|
13617
|
-
Object.defineProperty(exports
|
|
13618
|
-
exports
|
|
13623
|
+
(function (exports) {
|
|
13624
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13625
|
+
exports.extendErrors = exports.resetErrorsCount = exports.reportExtraError = exports.reportError = exports.keyword$DataError = exports.keywordError = void 0;
|
|
13619
13626
|
const codegen_1 = /*@__PURE__*/ requireCodegen();
|
|
13620
13627
|
const util_1 = /*@__PURE__*/ requireUtil$1();
|
|
13621
13628
|
const names_1 = /*@__PURE__*/ requireNames();
|
|
13622
|
-
exports
|
|
13629
|
+
exports.keywordError = {
|
|
13623
13630
|
message: ({ keyword }) => (0, codegen_1.str) `must pass "${keyword}" keyword validation`,
|
|
13624
13631
|
};
|
|
13625
|
-
exports
|
|
13632
|
+
exports.keyword$DataError = {
|
|
13626
13633
|
message: ({ keyword, schemaType }) => schemaType
|
|
13627
13634
|
? (0, codegen_1.str) `"${keyword}" keyword must be ${schemaType} ($data)`
|
|
13628
13635
|
: (0, codegen_1.str) `"${keyword}" keyword is invalid ($data)`,
|
|
13629
13636
|
};
|
|
13630
|
-
function reportError(cxt, error = exports
|
|
13637
|
+
function reportError(cxt, error = exports.keywordError, errorPaths, overrideAllErrors) {
|
|
13631
13638
|
const { it } = cxt;
|
|
13632
13639
|
const { gen, compositeRule, allErrors } = it;
|
|
13633
13640
|
const errObj = errorObjectCode(cxt, error, errorPaths);
|
|
@@ -13638,8 +13645,8 @@ function requireErrors () {
|
|
|
13638
13645
|
returnErrors(it, (0, codegen_1._) `[${errObj}]`);
|
|
13639
13646
|
}
|
|
13640
13647
|
}
|
|
13641
|
-
exports
|
|
13642
|
-
function reportExtraError(cxt, error = exports
|
|
13648
|
+
exports.reportError = reportError;
|
|
13649
|
+
function reportExtraError(cxt, error = exports.keywordError, errorPaths) {
|
|
13643
13650
|
const { it } = cxt;
|
|
13644
13651
|
const { gen, compositeRule, allErrors } = it;
|
|
13645
13652
|
const errObj = errorObjectCode(cxt, error, errorPaths);
|
|
@@ -13648,12 +13655,12 @@ function requireErrors () {
|
|
|
13648
13655
|
returnErrors(it, names_1.default.vErrors);
|
|
13649
13656
|
}
|
|
13650
13657
|
}
|
|
13651
|
-
exports
|
|
13658
|
+
exports.reportExtraError = reportExtraError;
|
|
13652
13659
|
function resetErrorsCount(gen, errsCount) {
|
|
13653
13660
|
gen.assign(names_1.default.errors, errsCount);
|
|
13654
13661
|
gen.if((0, codegen_1._) `${names_1.default.vErrors} !== null`, () => gen.if(errsCount, () => gen.assign((0, codegen_1._) `${names_1.default.vErrors}.length`, errsCount), () => gen.assign(names_1.default.vErrors, null)));
|
|
13655
13662
|
}
|
|
13656
|
-
exports
|
|
13663
|
+
exports.resetErrorsCount = resetErrorsCount;
|
|
13657
13664
|
function extendErrors({ gen, keyword, schemaValue, data, errsCount, it, }) {
|
|
13658
13665
|
/* istanbul ignore if */
|
|
13659
13666
|
if (errsCount === undefined)
|
|
@@ -13669,7 +13676,7 @@ function requireErrors () {
|
|
|
13669
13676
|
}
|
|
13670
13677
|
});
|
|
13671
13678
|
}
|
|
13672
|
-
exports
|
|
13679
|
+
exports.extendErrors = extendErrors;
|
|
13673
13680
|
function addError(gen, errObj) {
|
|
13674
13681
|
const err = gen.const("err", errObj);
|
|
13675
13682
|
gen.if((0, codegen_1._) `${names_1.default.vErrors} === null`, () => gen.assign(names_1.default.vErrors, (0, codegen_1._) `[${err}]`), (0, codegen_1._) `${names_1.default.vErrors}.push(${err})`);
|
|
@@ -15663,6 +15670,15 @@ function requireUtils () {
|
|
|
15663
15670
|
/** @type {(value: string) => boolean} */
|
|
15664
15671
|
const isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
|
|
15665
15672
|
|
|
15673
|
+
/** @type {(value: string) => boolean} */
|
|
15674
|
+
const isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
|
|
15675
|
+
|
|
15676
|
+
/** @type {(value: string) => boolean} */
|
|
15677
|
+
const isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
|
|
15678
|
+
|
|
15679
|
+
/** @type {(value: string) => boolean} */
|
|
15680
|
+
const isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
|
|
15681
|
+
|
|
15666
15682
|
/**
|
|
15667
15683
|
* @param {Array<string>} input
|
|
15668
15684
|
* @returns {string}
|
|
@@ -15921,31 +15937,126 @@ function requireUtils () {
|
|
|
15921
15937
|
}
|
|
15922
15938
|
|
|
15923
15939
|
/**
|
|
15924
|
-
*
|
|
15925
|
-
*
|
|
15926
|
-
*
|
|
15940
|
+
* Re-escape RFC 3986 gen-delims that must not appear literally in the host.
|
|
15941
|
+
* After the URI regex parses, these characters cannot be literal in the host
|
|
15942
|
+
* field, so any that appear after decoding came from percent-encoding and
|
|
15943
|
+
* must be restored to prevent authority structure changes.
|
|
15944
|
+
*
|
|
15945
|
+
* @param {string} host
|
|
15946
|
+
* @param {boolean} isIP - true for IPv4/IPv6 hosts (skip colon re-escaping)
|
|
15947
|
+
* @returns {string}
|
|
15927
15948
|
*/
|
|
15928
|
-
|
|
15929
|
-
|
|
15930
|
-
|
|
15931
|
-
|
|
15932
|
-
|
|
15933
|
-
|
|
15934
|
-
|
|
15935
|
-
|
|
15936
|
-
|
|
15937
|
-
|
|
15949
|
+
const HOST_DELIMS = { '@': '%40', '/': '%2F', '?': '%3F', '#': '%23', ':': '%3A' };
|
|
15950
|
+
const HOST_DELIM_RE = /[@/?#:]/g;
|
|
15951
|
+
const HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
|
|
15952
|
+
|
|
15953
|
+
function reescapeHostDelimiters (host, isIP) {
|
|
15954
|
+
const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
|
|
15955
|
+
re.lastIndex = 0;
|
|
15956
|
+
return host.replace(re, (ch) => HOST_DELIMS[ch])
|
|
15957
|
+
}
|
|
15958
|
+
|
|
15959
|
+
/**
|
|
15960
|
+
* Normalizes percent escapes and optionally decodes only unreserved ASCII bytes.
|
|
15961
|
+
* Reserved delimiters such as `%2F` and `%2E` stay escaped.
|
|
15962
|
+
*
|
|
15963
|
+
* @param {string} input
|
|
15964
|
+
* @param {boolean} [decodeUnreserved=false]
|
|
15965
|
+
* @returns {string}
|
|
15966
|
+
*/
|
|
15967
|
+
function normalizePercentEncoding (input, decodeUnreserved = false) {
|
|
15968
|
+
if (input.indexOf('%') === -1) {
|
|
15969
|
+
return input
|
|
15938
15970
|
}
|
|
15939
|
-
|
|
15940
|
-
|
|
15971
|
+
|
|
15972
|
+
let output = '';
|
|
15973
|
+
|
|
15974
|
+
for (let i = 0; i < input.length; i++) {
|
|
15975
|
+
if (input[i] === '%' && i + 2 < input.length) {
|
|
15976
|
+
const hex = input.slice(i + 1, i + 3);
|
|
15977
|
+
if (isHexPair(hex)) {
|
|
15978
|
+
const normalizedHex = hex.toUpperCase();
|
|
15979
|
+
const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
|
|
15980
|
+
|
|
15981
|
+
if (decodeUnreserved && isUnreserved(decoded)) {
|
|
15982
|
+
output += decoded;
|
|
15983
|
+
} else {
|
|
15984
|
+
output += '%' + normalizedHex;
|
|
15985
|
+
}
|
|
15986
|
+
|
|
15987
|
+
i += 2;
|
|
15988
|
+
continue
|
|
15989
|
+
}
|
|
15990
|
+
}
|
|
15991
|
+
|
|
15992
|
+
output += input[i];
|
|
15941
15993
|
}
|
|
15942
|
-
|
|
15943
|
-
|
|
15994
|
+
|
|
15995
|
+
return output
|
|
15996
|
+
}
|
|
15997
|
+
|
|
15998
|
+
/**
|
|
15999
|
+
* Normalizes path data without turning reserved escapes into live path syntax.
|
|
16000
|
+
* Valid escapes are uppercased, raw unsafe characters are escaped, and only
|
|
16001
|
+
* unreserved bytes that are not `.` are decoded.
|
|
16002
|
+
*
|
|
16003
|
+
* @param {string} input
|
|
16004
|
+
* @returns {string}
|
|
16005
|
+
*/
|
|
16006
|
+
function normalizePathEncoding (input) {
|
|
16007
|
+
let output = '';
|
|
16008
|
+
|
|
16009
|
+
for (let i = 0; i < input.length; i++) {
|
|
16010
|
+
if (input[i] === '%' && i + 2 < input.length) {
|
|
16011
|
+
const hex = input.slice(i + 1, i + 3);
|
|
16012
|
+
if (isHexPair(hex)) {
|
|
16013
|
+
const normalizedHex = hex.toUpperCase();
|
|
16014
|
+
const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
|
|
16015
|
+
|
|
16016
|
+
if (decoded !== '.' && isUnreserved(decoded)) {
|
|
16017
|
+
output += decoded;
|
|
16018
|
+
} else {
|
|
16019
|
+
output += '%' + normalizedHex;
|
|
16020
|
+
}
|
|
16021
|
+
|
|
16022
|
+
i += 2;
|
|
16023
|
+
continue
|
|
16024
|
+
}
|
|
16025
|
+
}
|
|
16026
|
+
|
|
16027
|
+
if (isPathCharacter(input[i])) {
|
|
16028
|
+
output += input[i];
|
|
16029
|
+
} else {
|
|
16030
|
+
output += escape(input[i]);
|
|
16031
|
+
}
|
|
15944
16032
|
}
|
|
15945
|
-
|
|
15946
|
-
|
|
16033
|
+
|
|
16034
|
+
return output
|
|
16035
|
+
}
|
|
16036
|
+
|
|
16037
|
+
/**
|
|
16038
|
+
* Escapes a component while preserving existing valid percent escapes.
|
|
16039
|
+
*
|
|
16040
|
+
* @param {string} input
|
|
16041
|
+
* @returns {string}
|
|
16042
|
+
*/
|
|
16043
|
+
function escapePreservingEscapes (input) {
|
|
16044
|
+
let output = '';
|
|
16045
|
+
|
|
16046
|
+
for (let i = 0; i < input.length; i++) {
|
|
16047
|
+
if (input[i] === '%' && i + 2 < input.length) {
|
|
16048
|
+
const hex = input.slice(i + 1, i + 3);
|
|
16049
|
+
if (isHexPair(hex)) {
|
|
16050
|
+
output += '%' + hex.toUpperCase();
|
|
16051
|
+
i += 2;
|
|
16052
|
+
continue
|
|
16053
|
+
}
|
|
16054
|
+
}
|
|
16055
|
+
|
|
16056
|
+
output += escape(input[i]);
|
|
15947
16057
|
}
|
|
15948
|
-
|
|
16058
|
+
|
|
16059
|
+
return output
|
|
15949
16060
|
}
|
|
15950
16061
|
|
|
15951
16062
|
/**
|
|
@@ -15967,7 +16078,7 @@ function requireUtils () {
|
|
|
15967
16078
|
if (ipV6res.isIPV6 === true) {
|
|
15968
16079
|
host = `[${ipV6res.escapedHost}]`;
|
|
15969
16080
|
} else {
|
|
15970
|
-
host =
|
|
16081
|
+
host = reescapeHostDelimiters(host, false);
|
|
15971
16082
|
}
|
|
15972
16083
|
}
|
|
15973
16084
|
uriTokens.push(host);
|
|
@@ -15983,7 +16094,10 @@ function requireUtils () {
|
|
|
15983
16094
|
utils = {
|
|
15984
16095
|
nonSimpleDomain,
|
|
15985
16096
|
recomposeAuthority,
|
|
15986
|
-
|
|
16097
|
+
reescapeHostDelimiters,
|
|
16098
|
+
normalizePercentEncoding,
|
|
16099
|
+
normalizePathEncoding,
|
|
16100
|
+
escapePreservingEscapes,
|
|
15987
16101
|
removeDotSegments,
|
|
15988
16102
|
isIPv4,
|
|
15989
16103
|
isUUID,
|
|
@@ -16274,7 +16388,7 @@ function requireFastUri () {
|
|
|
16274
16388
|
if (hasRequiredFastUri) return fastUri.exports;
|
|
16275
16389
|
hasRequiredFastUri = 1;
|
|
16276
16390
|
|
|
16277
|
-
const { normalizeIPv6, removeDotSegments, recomposeAuthority,
|
|
16391
|
+
const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = requireUtils();
|
|
16278
16392
|
const { SCHEMES, getSchemeHandler } = requireSchemes();
|
|
16279
16393
|
|
|
16280
16394
|
/**
|
|
@@ -16285,7 +16399,7 @@ function requireFastUri () {
|
|
|
16285
16399
|
*/
|
|
16286
16400
|
function normalize (uri, options) {
|
|
16287
16401
|
if (typeof uri === 'string') {
|
|
16288
|
-
uri = /** @type {T} */ (
|
|
16402
|
+
uri = /** @type {T} */ (normalizeString(uri, options));
|
|
16289
16403
|
} else if (typeof uri === 'object') {
|
|
16290
16404
|
uri = /** @type {T} */ (parse(serialize(uri, options), options));
|
|
16291
16405
|
}
|
|
@@ -16380,21 +16494,10 @@ function requireFastUri () {
|
|
|
16380
16494
|
* @returns {boolean}
|
|
16381
16495
|
*/
|
|
16382
16496
|
function equal (uriA, uriB, options) {
|
|
16383
|
-
|
|
16384
|
-
|
|
16385
|
-
uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true });
|
|
16386
|
-
} else if (typeof uriA === 'object') {
|
|
16387
|
-
uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
|
|
16388
|
-
}
|
|
16389
|
-
|
|
16390
|
-
if (typeof uriB === 'string') {
|
|
16391
|
-
uriB = unescape(uriB);
|
|
16392
|
-
uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true });
|
|
16393
|
-
} else if (typeof uriB === 'object') {
|
|
16394
|
-
uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
|
|
16395
|
-
}
|
|
16497
|
+
const normalizedA = normalizeComparableURI(uriA, options);
|
|
16498
|
+
const normalizedB = normalizeComparableURI(uriB, options);
|
|
16396
16499
|
|
|
16397
|
-
return
|
|
16500
|
+
return normalizedA !== undefined && normalizedB !== undefined && normalizedA.toLowerCase() === normalizedB.toLowerCase()
|
|
16398
16501
|
}
|
|
16399
16502
|
|
|
16400
16503
|
/**
|
|
@@ -16430,13 +16533,13 @@ function requireFastUri () {
|
|
|
16430
16533
|
|
|
16431
16534
|
if (component.path !== undefined) {
|
|
16432
16535
|
if (!options.skipEscape) {
|
|
16433
|
-
component.path =
|
|
16536
|
+
component.path = escapePreservingEscapes(component.path);
|
|
16434
16537
|
|
|
16435
16538
|
if (component.scheme !== undefined) {
|
|
16436
16539
|
component.path = component.path.split('%3A').join(':');
|
|
16437
16540
|
}
|
|
16438
16541
|
} else {
|
|
16439
|
-
component.path =
|
|
16542
|
+
component.path = normalizePercentEncoding(component.path);
|
|
16440
16543
|
}
|
|
16441
16544
|
}
|
|
16442
16545
|
|
|
@@ -16487,12 +16590,29 @@ function requireFastUri () {
|
|
|
16487
16590
|
|
|
16488
16591
|
const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
16489
16592
|
|
|
16593
|
+
/**
|
|
16594
|
+
* @param {import('./types/index').URIComponent} parsed
|
|
16595
|
+
* @param {RegExpMatchArray} matches
|
|
16596
|
+
* @returns {string|undefined}
|
|
16597
|
+
*/
|
|
16598
|
+
function getParseError (parsed, matches) {
|
|
16599
|
+
if (matches[2] !== undefined && parsed.path && parsed.path[0] !== '/') {
|
|
16600
|
+
return 'URI path must start with "/" when authority is present.'
|
|
16601
|
+
}
|
|
16602
|
+
|
|
16603
|
+
if (typeof parsed.port === 'number' && (parsed.port < 0 || parsed.port > 65535)) {
|
|
16604
|
+
return 'URI port is malformed.'
|
|
16605
|
+
}
|
|
16606
|
+
|
|
16607
|
+
return undefined
|
|
16608
|
+
}
|
|
16609
|
+
|
|
16490
16610
|
/**
|
|
16491
16611
|
* @param {string} uri
|
|
16492
16612
|
* @param {import('./types/index').Options} [opts]
|
|
16493
|
-
* @returns
|
|
16613
|
+
* @returns {{ parsed: import('./types/index').URIComponent, malformedAuthorityOrPort: boolean }}
|
|
16494
16614
|
*/
|
|
16495
|
-
function
|
|
16615
|
+
function parseWithStatus (uri, opts) {
|
|
16496
16616
|
const options = Object.assign({}, opts);
|
|
16497
16617
|
/** @type {import('./types/index').URIComponent} */
|
|
16498
16618
|
const parsed = {
|
|
@@ -16505,6 +16625,8 @@ function requireFastUri () {
|
|
|
16505
16625
|
fragment: undefined
|
|
16506
16626
|
};
|
|
16507
16627
|
|
|
16628
|
+
let malformedAuthorityOrPort = false;
|
|
16629
|
+
|
|
16508
16630
|
let isIP = false;
|
|
16509
16631
|
if (options.reference === 'suffix') {
|
|
16510
16632
|
if (options.scheme) {
|
|
@@ -16530,6 +16652,13 @@ function requireFastUri () {
|
|
|
16530
16652
|
if (isNaN(parsed.port)) {
|
|
16531
16653
|
parsed.port = matches[5];
|
|
16532
16654
|
}
|
|
16655
|
+
|
|
16656
|
+
const parseError = getParseError(parsed, matches);
|
|
16657
|
+
if (parseError !== undefined) {
|
|
16658
|
+
parsed.error = parsed.error || parseError;
|
|
16659
|
+
malformedAuthorityOrPort = true;
|
|
16660
|
+
}
|
|
16661
|
+
|
|
16533
16662
|
if (parsed.host) {
|
|
16534
16663
|
const ipv4result = isIPv4(parsed.host);
|
|
16535
16664
|
if (ipv4result === false) {
|
|
@@ -16578,14 +16707,18 @@ function requireFastUri () {
|
|
|
16578
16707
|
parsed.scheme = unescape(parsed.scheme);
|
|
16579
16708
|
}
|
|
16580
16709
|
if (parsed.host !== undefined) {
|
|
16581
|
-
parsed.host = unescape(parsed.host);
|
|
16710
|
+
parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
|
|
16582
16711
|
}
|
|
16583
16712
|
}
|
|
16584
16713
|
if (parsed.path) {
|
|
16585
|
-
parsed.path =
|
|
16714
|
+
parsed.path = normalizePathEncoding(parsed.path);
|
|
16586
16715
|
}
|
|
16587
16716
|
if (parsed.fragment) {
|
|
16588
|
-
|
|
16717
|
+
try {
|
|
16718
|
+
parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
|
|
16719
|
+
} catch {
|
|
16720
|
+
parsed.error = parsed.error || 'URI malformed';
|
|
16721
|
+
}
|
|
16589
16722
|
}
|
|
16590
16723
|
}
|
|
16591
16724
|
|
|
@@ -16596,7 +16729,54 @@ function requireFastUri () {
|
|
|
16596
16729
|
} else {
|
|
16597
16730
|
parsed.error = parsed.error || 'URI can not be parsed.';
|
|
16598
16731
|
}
|
|
16599
|
-
return parsed
|
|
16732
|
+
return { parsed, malformedAuthorityOrPort }
|
|
16733
|
+
}
|
|
16734
|
+
|
|
16735
|
+
/**
|
|
16736
|
+
* @param {string} uri
|
|
16737
|
+
* @param {import('./types/index').Options} [opts]
|
|
16738
|
+
* @returns
|
|
16739
|
+
*/
|
|
16740
|
+
function parse (uri, opts) {
|
|
16741
|
+
return parseWithStatus(uri, opts).parsed
|
|
16742
|
+
}
|
|
16743
|
+
|
|
16744
|
+
/**
|
|
16745
|
+
* @param {string} uri
|
|
16746
|
+
* @param {import('./types/index').Options} [opts]
|
|
16747
|
+
* @returns {string}
|
|
16748
|
+
*/
|
|
16749
|
+
function normalizeString (uri, opts) {
|
|
16750
|
+
return normalizeStringWithStatus(uri, opts).normalized
|
|
16751
|
+
}
|
|
16752
|
+
|
|
16753
|
+
/**
|
|
16754
|
+
* @param {string} uri
|
|
16755
|
+
* @param {import('./types/index').Options} [opts]
|
|
16756
|
+
* @returns {{ normalized: string, malformedAuthorityOrPort: boolean }}
|
|
16757
|
+
*/
|
|
16758
|
+
function normalizeStringWithStatus (uri, opts) {
|
|
16759
|
+
const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
|
|
16760
|
+
return {
|
|
16761
|
+
normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
|
|
16762
|
+
malformedAuthorityOrPort
|
|
16763
|
+
}
|
|
16764
|
+
}
|
|
16765
|
+
|
|
16766
|
+
/**
|
|
16767
|
+
* @param {import ('./types/index').URIComponent|string} uri
|
|
16768
|
+
* @param {import('./types/index').Options} [opts]
|
|
16769
|
+
* @returns {string|undefined}
|
|
16770
|
+
*/
|
|
16771
|
+
function normalizeComparableURI (uri, opts) {
|
|
16772
|
+
if (typeof uri === 'string') {
|
|
16773
|
+
const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
|
|
16774
|
+
return malformedAuthorityOrPort ? undefined : normalized
|
|
16775
|
+
}
|
|
16776
|
+
|
|
16777
|
+
if (typeof uri === 'object') {
|
|
16778
|
+
return serialize(uri, opts)
|
|
16779
|
+
}
|
|
16600
16780
|
}
|
|
16601
16781
|
|
|
16602
16782
|
const fastUri$1 = {
|
|
@@ -16633,18 +16813,18 @@ var hasRequiredCore$1;
|
|
|
16633
16813
|
function requireCore$1 () {
|
|
16634
16814
|
if (hasRequiredCore$1) return core$1;
|
|
16635
16815
|
hasRequiredCore$1 = 1;
|
|
16636
|
-
(function (exports
|
|
16637
|
-
Object.defineProperty(exports
|
|
16638
|
-
exports
|
|
16816
|
+
(function (exports) {
|
|
16817
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16818
|
+
exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
|
|
16639
16819
|
var validate_1 = /*@__PURE__*/ requireValidate();
|
|
16640
|
-
Object.defineProperty(exports
|
|
16820
|
+
Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
|
|
16641
16821
|
var codegen_1 = /*@__PURE__*/ requireCodegen();
|
|
16642
|
-
Object.defineProperty(exports
|
|
16643
|
-
Object.defineProperty(exports
|
|
16644
|
-
Object.defineProperty(exports
|
|
16645
|
-
Object.defineProperty(exports
|
|
16646
|
-
Object.defineProperty(exports
|
|
16647
|
-
Object.defineProperty(exports
|
|
16822
|
+
Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } });
|
|
16823
|
+
Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } });
|
|
16824
|
+
Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
|
|
16825
|
+
Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
|
|
16826
|
+
Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
|
|
16827
|
+
Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
|
|
16648
16828
|
const validation_error_1 = /*@__PURE__*/ requireValidation_error();
|
|
16649
16829
|
const ref_error_1 = /*@__PURE__*/ requireRef_error();
|
|
16650
16830
|
const rules_1 = /*@__PURE__*/ requireRules();
|
|
@@ -16729,7 +16909,7 @@ function requireCore$1 () {
|
|
|
16729
16909
|
constructor(opts = {}) {
|
|
16730
16910
|
this.schemas = {};
|
|
16731
16911
|
this.refs = {};
|
|
16732
|
-
this.formats =
|
|
16912
|
+
this.formats = Object.create(null);
|
|
16733
16913
|
this._compilations = new Set();
|
|
16734
16914
|
this._loading = {};
|
|
16735
16915
|
this._cache = new Map();
|
|
@@ -17124,7 +17304,7 @@ function requireCore$1 () {
|
|
|
17124
17304
|
}
|
|
17125
17305
|
Ajv.ValidationError = validation_error_1.default;
|
|
17126
17306
|
Ajv.MissingRefError = ref_error_1.default;
|
|
17127
|
-
exports
|
|
17307
|
+
exports.default = Ajv;
|
|
17128
17308
|
function checkOptions(checkOpts, options, msg, log = "error") {
|
|
17129
17309
|
for (const key in checkOpts) {
|
|
17130
17310
|
const opt = key;
|
|
@@ -18282,13 +18462,13 @@ var hasRequiredDependencies;
|
|
|
18282
18462
|
function requireDependencies () {
|
|
18283
18463
|
if (hasRequiredDependencies) return dependencies;
|
|
18284
18464
|
hasRequiredDependencies = 1;
|
|
18285
|
-
(function (exports
|
|
18286
|
-
Object.defineProperty(exports
|
|
18287
|
-
exports
|
|
18465
|
+
(function (exports) {
|
|
18466
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18467
|
+
exports.validateSchemaDeps = exports.validatePropertyDeps = exports.error = void 0;
|
|
18288
18468
|
const codegen_1 = /*@__PURE__*/ requireCodegen();
|
|
18289
18469
|
const util_1 = /*@__PURE__*/ requireUtil$1();
|
|
18290
18470
|
const code_1 = /*@__PURE__*/ requireCode();
|
|
18291
|
-
exports
|
|
18471
|
+
exports.error = {
|
|
18292
18472
|
message: ({ params: { property, depsCount, deps } }) => {
|
|
18293
18473
|
const property_ies = depsCount === 1 ? "property" : "properties";
|
|
18294
18474
|
return (0, codegen_1.str) `must have ${property_ies} ${deps} when property ${property} is present`;
|
|
@@ -18302,7 +18482,7 @@ function requireDependencies () {
|
|
|
18302
18482
|
keyword: "dependencies",
|
|
18303
18483
|
type: "object",
|
|
18304
18484
|
schemaType: "object",
|
|
18305
|
-
error: exports
|
|
18485
|
+
error: exports.error,
|
|
18306
18486
|
code(cxt) {
|
|
18307
18487
|
const [propDeps, schDeps] = splitDependencies(cxt);
|
|
18308
18488
|
validatePropertyDeps(cxt, propDeps);
|
|
@@ -18349,7 +18529,7 @@ function requireDependencies () {
|
|
|
18349
18529
|
}
|
|
18350
18530
|
}
|
|
18351
18531
|
}
|
|
18352
|
-
exports
|
|
18532
|
+
exports.validatePropertyDeps = validatePropertyDeps;
|
|
18353
18533
|
function validateSchemaDeps(cxt, schemaDeps = cxt.schema) {
|
|
18354
18534
|
const { gen, data, keyword, it } = cxt;
|
|
18355
18535
|
const valid = gen.name("valid");
|
|
@@ -18364,8 +18544,8 @@ function requireDependencies () {
|
|
|
18364
18544
|
cxt.ok(valid);
|
|
18365
18545
|
}
|
|
18366
18546
|
}
|
|
18367
|
-
exports
|
|
18368
|
-
exports
|
|
18547
|
+
exports.validateSchemaDeps = validateSchemaDeps;
|
|
18548
|
+
exports.default = def;
|
|
18369
18549
|
|
|
18370
18550
|
} (dependencies));
|
|
18371
18551
|
return dependencies;
|
|
@@ -19540,9 +19720,9 @@ var hasRequiredAjv;
|
|
|
19540
19720
|
function requireAjv () {
|
|
19541
19721
|
if (hasRequiredAjv) return ajv$1.exports;
|
|
19542
19722
|
hasRequiredAjv = 1;
|
|
19543
|
-
(function (module, exports
|
|
19544
|
-
Object.defineProperty(exports
|
|
19545
|
-
exports
|
|
19723
|
+
(function (module, exports) {
|
|
19724
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19725
|
+
exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv = void 0;
|
|
19546
19726
|
const core_1 = /*@__PURE__*/ requireCore$1();
|
|
19547
19727
|
const draft7_1 = /*@__PURE__*/ requireDraft7();
|
|
19548
19728
|
const discriminator_1 = /*@__PURE__*/ requireDiscriminator();
|
|
@@ -19571,24 +19751,24 @@ function requireAjv () {
|
|
|
19571
19751
|
super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined));
|
|
19572
19752
|
}
|
|
19573
19753
|
}
|
|
19574
|
-
exports
|
|
19575
|
-
module.exports = exports
|
|
19754
|
+
exports.Ajv = Ajv;
|
|
19755
|
+
module.exports = exports = Ajv;
|
|
19576
19756
|
module.exports.Ajv = Ajv;
|
|
19577
|
-
Object.defineProperty(exports
|
|
19578
|
-
exports
|
|
19757
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19758
|
+
exports.default = Ajv;
|
|
19579
19759
|
var validate_1 = /*@__PURE__*/ requireValidate();
|
|
19580
|
-
Object.defineProperty(exports
|
|
19760
|
+
Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
|
|
19581
19761
|
var codegen_1 = /*@__PURE__*/ requireCodegen();
|
|
19582
|
-
Object.defineProperty(exports
|
|
19583
|
-
Object.defineProperty(exports
|
|
19584
|
-
Object.defineProperty(exports
|
|
19585
|
-
Object.defineProperty(exports
|
|
19586
|
-
Object.defineProperty(exports
|
|
19587
|
-
Object.defineProperty(exports
|
|
19762
|
+
Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } });
|
|
19763
|
+
Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } });
|
|
19764
|
+
Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
|
|
19765
|
+
Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
|
|
19766
|
+
Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
|
|
19767
|
+
Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
|
|
19588
19768
|
var validation_error_1 = /*@__PURE__*/ requireValidation_error();
|
|
19589
|
-
Object.defineProperty(exports
|
|
19769
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validation_error_1.default; } });
|
|
19590
19770
|
var ref_error_1 = /*@__PURE__*/ requireRef_error();
|
|
19591
|
-
Object.defineProperty(exports
|
|
19771
|
+
Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function () { return ref_error_1.default; } });
|
|
19592
19772
|
|
|
19593
19773
|
} (ajv$1, ajv$1.exports));
|
|
19594
19774
|
return ajv$1.exports;
|
|
@@ -20686,9 +20866,9 @@ var hasRequired_2019;
|
|
|
20686
20866
|
function require_2019 () {
|
|
20687
20867
|
if (hasRequired_2019) return _2019.exports;
|
|
20688
20868
|
hasRequired_2019 = 1;
|
|
20689
|
-
(function (module, exports
|
|
20690
|
-
Object.defineProperty(exports
|
|
20691
|
-
exports
|
|
20869
|
+
(function (module, exports) {
|
|
20870
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20871
|
+
exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv2019 = void 0;
|
|
20692
20872
|
const core_1 = /*@__PURE__*/ requireCore$1();
|
|
20693
20873
|
const draft7_1 = /*@__PURE__*/ requireDraft7();
|
|
20694
20874
|
const dynamic_1 = /*@__PURE__*/ requireDynamic();
|
|
@@ -20728,24 +20908,24 @@ function require_2019 () {
|
|
|
20728
20908
|
super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined));
|
|
20729
20909
|
}
|
|
20730
20910
|
}
|
|
20731
|
-
exports
|
|
20732
|
-
module.exports = exports
|
|
20911
|
+
exports.Ajv2019 = Ajv2019;
|
|
20912
|
+
module.exports = exports = Ajv2019;
|
|
20733
20913
|
module.exports.Ajv2019 = Ajv2019;
|
|
20734
|
-
Object.defineProperty(exports
|
|
20735
|
-
exports
|
|
20914
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20915
|
+
exports.default = Ajv2019;
|
|
20736
20916
|
var validate_1 = /*@__PURE__*/ requireValidate();
|
|
20737
|
-
Object.defineProperty(exports
|
|
20917
|
+
Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
|
|
20738
20918
|
var codegen_1 = /*@__PURE__*/ requireCodegen();
|
|
20739
|
-
Object.defineProperty(exports
|
|
20740
|
-
Object.defineProperty(exports
|
|
20741
|
-
Object.defineProperty(exports
|
|
20742
|
-
Object.defineProperty(exports
|
|
20743
|
-
Object.defineProperty(exports
|
|
20744
|
-
Object.defineProperty(exports
|
|
20919
|
+
Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } });
|
|
20920
|
+
Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } });
|
|
20921
|
+
Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
|
|
20922
|
+
Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
|
|
20923
|
+
Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
|
|
20924
|
+
Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
|
|
20745
20925
|
var validation_error_1 = /*@__PURE__*/ requireValidation_error();
|
|
20746
|
-
Object.defineProperty(exports
|
|
20926
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validation_error_1.default; } });
|
|
20747
20927
|
var ref_error_1 = /*@__PURE__*/ requireRef_error();
|
|
20748
|
-
Object.defineProperty(exports
|
|
20928
|
+
Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function () { return ref_error_1.default; } });
|
|
20749
20929
|
|
|
20750
20930
|
} (_2019, _2019.exports));
|
|
20751
20931
|
return _2019.exports;
|
|
@@ -20763,13 +20943,13 @@ var hasRequiredFormats;
|
|
|
20763
20943
|
function requireFormats () {
|
|
20764
20944
|
if (hasRequiredFormats) return formats;
|
|
20765
20945
|
hasRequiredFormats = 1;
|
|
20766
|
-
(function (exports
|
|
20767
|
-
Object.defineProperty(exports
|
|
20768
|
-
exports
|
|
20946
|
+
(function (exports) {
|
|
20947
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20948
|
+
exports.formatNames = exports.fastFormats = exports.fullFormats = void 0;
|
|
20769
20949
|
function fmtDef(validate, compare) {
|
|
20770
20950
|
return { validate, compare };
|
|
20771
20951
|
}
|
|
20772
|
-
exports
|
|
20952
|
+
exports.fullFormats = {
|
|
20773
20953
|
// date: http://tools.ietf.org/html/rfc3339#section-5.6
|
|
20774
20954
|
date: fmtDef(date, compareDate),
|
|
20775
20955
|
// date-time: http://tools.ietf.org/html/rfc3339#section-5.6
|
|
@@ -20816,8 +20996,8 @@ function requireFormats () {
|
|
|
20816
20996
|
// unchecked string payload
|
|
20817
20997
|
binary: true,
|
|
20818
20998
|
};
|
|
20819
|
-
exports
|
|
20820
|
-
...exports
|
|
20999
|
+
exports.fastFormats = {
|
|
21000
|
+
...exports.fullFormats,
|
|
20821
21001
|
date: fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d$/, compareDate),
|
|
20822
21002
|
time: fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareTime),
|
|
20823
21003
|
"date-time": fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareDateTime),
|
|
@@ -20831,7 +21011,7 @@ function requireFormats () {
|
|
|
20831
21011
|
// http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'wilful violation')
|
|
20832
21012
|
email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,
|
|
20833
21013
|
};
|
|
20834
|
-
exports
|
|
21014
|
+
exports.formatNames = Object.keys(exports.fullFormats);
|
|
20835
21015
|
function isLeapYear(year) {
|
|
20836
21016
|
// https://tools.ietf.org/html/rfc3339#appendix-C
|
|
20837
21017
|
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
@@ -20982,9 +21162,9 @@ var hasRequiredLimit;
|
|
|
20982
21162
|
function requireLimit () {
|
|
20983
21163
|
if (hasRequiredLimit) return limit;
|
|
20984
21164
|
hasRequiredLimit = 1;
|
|
20985
|
-
(function (exports
|
|
20986
|
-
Object.defineProperty(exports
|
|
20987
|
-
exports
|
|
21165
|
+
(function (exports) {
|
|
21166
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21167
|
+
exports.formatLimitDefinition = void 0;
|
|
20988
21168
|
const ajv_1 = /*@__PURE__*/ requireAjv();
|
|
20989
21169
|
const codegen_1 = /*@__PURE__*/ requireCodegen();
|
|
20990
21170
|
const ops = codegen_1.operators;
|
|
@@ -20998,7 +21178,7 @@ function requireLimit () {
|
|
|
20998
21178
|
message: ({ keyword, schemaCode }) => (0, codegen_1.str) `should be ${KWDs[keyword].okStr} ${schemaCode}`,
|
|
20999
21179
|
params: ({ keyword, schemaCode }) => (0, codegen_1._) `{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`,
|
|
21000
21180
|
};
|
|
21001
|
-
exports
|
|
21181
|
+
exports.formatLimitDefinition = {
|
|
21002
21182
|
keyword: Object.keys(KWDs),
|
|
21003
21183
|
type: "string",
|
|
21004
21184
|
schemaType: "string",
|
|
@@ -21046,10 +21226,10 @@ function requireLimit () {
|
|
|
21046
21226
|
dependencies: ["format"],
|
|
21047
21227
|
};
|
|
21048
21228
|
const formatLimitPlugin = (ajv) => {
|
|
21049
|
-
ajv.addKeyword(exports
|
|
21229
|
+
ajv.addKeyword(exports.formatLimitDefinition);
|
|
21050
21230
|
return ajv;
|
|
21051
21231
|
};
|
|
21052
|
-
exports
|
|
21232
|
+
exports.default = formatLimitPlugin;
|
|
21053
21233
|
|
|
21054
21234
|
} (limit));
|
|
21055
21235
|
return limit;
|
|
@@ -21060,8 +21240,8 @@ var hasRequiredDist$1;
|
|
|
21060
21240
|
function requireDist$1 () {
|
|
21061
21241
|
if (hasRequiredDist$1) return dist$2.exports;
|
|
21062
21242
|
hasRequiredDist$1 = 1;
|
|
21063
|
-
(function (module, exports
|
|
21064
|
-
Object.defineProperty(exports
|
|
21243
|
+
(function (module, exports) {
|
|
21244
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21065
21245
|
const formats_1 = requireFormats();
|
|
21066
21246
|
const limit_1 = requireLimit();
|
|
21067
21247
|
const codegen_1 = /*@__PURE__*/ requireCodegen();
|
|
@@ -21093,9 +21273,9 @@ function requireDist$1 () {
|
|
|
21093
21273
|
for (const f of list)
|
|
21094
21274
|
ajv.addFormat(f, fs[f]);
|
|
21095
21275
|
}
|
|
21096
|
-
module.exports = exports
|
|
21097
|
-
Object.defineProperty(exports
|
|
21098
|
-
exports
|
|
21276
|
+
module.exports = exports = formatsPlugin;
|
|
21277
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21278
|
+
exports.default = formatsPlugin;
|
|
21099
21279
|
|
|
21100
21280
|
} (dist$2, dist$2.exports));
|
|
21101
21281
|
return dist$2.exports;
|
|
@@ -21597,9 +21777,9 @@ var hasRequiredTypes$1;
|
|
|
21597
21777
|
function requireTypes$1 () {
|
|
21598
21778
|
if (hasRequiredTypes$1) return types;
|
|
21599
21779
|
hasRequiredTypes$1 = 1;
|
|
21600
|
-
(function (exports
|
|
21601
|
-
Object.defineProperty(exports
|
|
21602
|
-
exports
|
|
21780
|
+
(function (exports) {
|
|
21781
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21782
|
+
exports.types = void 0;
|
|
21603
21783
|
(function (types) {
|
|
21604
21784
|
types[types["ROOT"] = 0] = "ROOT";
|
|
21605
21785
|
types[types["GROUP"] = 1] = "GROUP";
|
|
@@ -21609,7 +21789,7 @@ function requireTypes$1 () {
|
|
|
21609
21789
|
types[types["REPETITION"] = 5] = "REPETITION";
|
|
21610
21790
|
types[types["REFERENCE"] = 6] = "REFERENCE";
|
|
21611
21791
|
types[types["CHAR"] = 7] = "CHAR";
|
|
21612
|
-
})(exports
|
|
21792
|
+
})(exports.types || (exports.types = {}));
|
|
21613
21793
|
|
|
21614
21794
|
} (types));
|
|
21615
21795
|
return types;
|
|
@@ -21632,7 +21812,7 @@ var hasRequiredTypes;
|
|
|
21632
21812
|
function requireTypes () {
|
|
21633
21813
|
if (hasRequiredTypes) return types$1;
|
|
21634
21814
|
hasRequiredTypes = 1;
|
|
21635
|
-
(function (exports
|
|
21815
|
+
(function (exports) {
|
|
21636
21816
|
var __createBinding = (types$1 && types$1.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21637
21817
|
if (k2 === undefined) k2 = k;
|
|
21638
21818
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
@@ -21640,13 +21820,13 @@ function requireTypes () {
|
|
|
21640
21820
|
if (k2 === undefined) k2 = k;
|
|
21641
21821
|
o[k2] = m[k];
|
|
21642
21822
|
}));
|
|
21643
|
-
var __exportStar = (types$1 && types$1.__exportStar) || function(m, exports
|
|
21644
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports
|
|
21823
|
+
var __exportStar = (types$1 && types$1.__exportStar) || function(m, exports) {
|
|
21824
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21645
21825
|
};
|
|
21646
|
-
Object.defineProperty(exports
|
|
21647
|
-
__exportStar(requireTokens(), exports
|
|
21648
|
-
__exportStar(requireTypes$1(), exports
|
|
21649
|
-
__exportStar(requireSetLookup(), exports
|
|
21826
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21827
|
+
__exportStar(requireTokens(), exports);
|
|
21828
|
+
__exportStar(requireTypes$1(), exports);
|
|
21829
|
+
__exportStar(requireSetLookup(), exports);
|
|
21650
21830
|
|
|
21651
21831
|
} (types$1));
|
|
21652
21832
|
return types$1;
|
|
@@ -22349,12 +22529,12 @@ var hasRequiredReconstruct;
|
|
|
22349
22529
|
function requireReconstruct () {
|
|
22350
22530
|
if (hasRequiredReconstruct) return reconstruct;
|
|
22351
22531
|
hasRequiredReconstruct = 1;
|
|
22352
|
-
(function (exports
|
|
22353
|
-
Object.defineProperty(exports
|
|
22354
|
-
exports
|
|
22532
|
+
(function (exports) {
|
|
22533
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22534
|
+
exports.reconstruct = void 0;
|
|
22355
22535
|
const types_1 = requireTypes();
|
|
22356
22536
|
const write_set_tokens_1 = requireWriteSetTokens();
|
|
22357
|
-
const reduceStack = (stack) => stack.map(exports
|
|
22537
|
+
const reduceStack = (stack) => stack.map(exports.reconstruct).join('');
|
|
22358
22538
|
const createAlternate = (token) => {
|
|
22359
22539
|
if ('options' in token) {
|
|
22360
22540
|
return token.options.map(reduceStack).join('|');
|
|
@@ -22366,7 +22546,7 @@ function requireReconstruct () {
|
|
|
22366
22546
|
throw new Error(`options or stack must be Root or Group token`);
|
|
22367
22547
|
}
|
|
22368
22548
|
};
|
|
22369
|
-
exports
|
|
22549
|
+
exports.reconstruct = (token) => {
|
|
22370
22550
|
switch (token.type) {
|
|
22371
22551
|
case types_1.types.ROOT:
|
|
22372
22552
|
return createAlternate(token);
|
|
@@ -22417,7 +22597,7 @@ function requireReconstruct () {
|
|
|
22417
22597
|
else {
|
|
22418
22598
|
endWith = `{${min},${max}}`;
|
|
22419
22599
|
}
|
|
22420
|
-
return `${exports
|
|
22600
|
+
return `${exports.reconstruct(token.value)}${endWith}`;
|
|
22421
22601
|
}
|
|
22422
22602
|
case types_1.types.RANGE:
|
|
22423
22603
|
return `${write_set_tokens_1.setChar(token.from)}-${write_set_tokens_1.setChar(token.to)}`;
|
|
@@ -22437,7 +22617,7 @@ var hasRequiredDist;
|
|
|
22437
22617
|
function requireDist () {
|
|
22438
22618
|
if (hasRequiredDist) return dist$1.exports;
|
|
22439
22619
|
hasRequiredDist = 1;
|
|
22440
|
-
(function (module, exports
|
|
22620
|
+
(function (module, exports) {
|
|
22441
22621
|
var __createBinding = (dist && dist.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
22442
22622
|
if (k2 === undefined) k2 = k;
|
|
22443
22623
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
@@ -22445,20 +22625,20 @@ function requireDist () {
|
|
|
22445
22625
|
if (k2 === undefined) k2 = k;
|
|
22446
22626
|
o[k2] = m[k];
|
|
22447
22627
|
}));
|
|
22448
|
-
var __exportStar = (dist && dist.__exportStar) || function(m, exports
|
|
22449
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports
|
|
22628
|
+
var __exportStar = (dist && dist.__exportStar) || function(m, exports) {
|
|
22629
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
22450
22630
|
};
|
|
22451
|
-
Object.defineProperty(exports
|
|
22452
|
-
exports
|
|
22631
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22632
|
+
exports.types = void 0;
|
|
22453
22633
|
/* istanbul ignore file */
|
|
22454
22634
|
const types_1 = requireTypes();
|
|
22455
|
-
Object.defineProperty(exports
|
|
22456
|
-
__exportStar(requireTokenizer(), exports
|
|
22457
|
-
__exportStar(requireReconstruct(), exports
|
|
22635
|
+
Object.defineProperty(exports, "types", { enumerable: true, get: function () { return types_1.types; } });
|
|
22636
|
+
__exportStar(requireTokenizer(), exports);
|
|
22637
|
+
__exportStar(requireReconstruct(), exports);
|
|
22458
22638
|
const tokenizer_1 = requireTokenizer();
|
|
22459
22639
|
const reconstruct_1 = requireReconstruct();
|
|
22460
|
-
__exportStar(requireTypes(), exports
|
|
22461
|
-
exports
|
|
22640
|
+
__exportStar(requireTypes(), exports);
|
|
22641
|
+
exports.default = tokenizer_1.tokenizer;
|
|
22462
22642
|
module.exports = tokenizer_1.tokenizer;
|
|
22463
22643
|
module.exports.types = types_1.types;
|
|
22464
22644
|
module.exports.reconstruct = reconstruct_1.reconstruct;
|
|
@@ -22474,52 +22654,74 @@ function requireSafeRegex2 () {
|
|
|
22474
22654
|
hasRequiredSafeRegex2 = 1;
|
|
22475
22655
|
|
|
22476
22656
|
const parse = requireDist();
|
|
22477
|
-
const types =
|
|
22478
|
-
|
|
22479
|
-
function safeRegex (re, opts) {
|
|
22480
|
-
if (!opts) opts = {};
|
|
22481
|
-
/* c8 ignore next */
|
|
22482
|
-
const replimit = opts.limit === undefined ? 25 : opts.limit;
|
|
22657
|
+
const { types } = requireDist();
|
|
22483
22658
|
|
|
22484
|
-
|
|
22485
|
-
|
|
22486
|
-
|
|
22659
|
+
/**
|
|
22660
|
+
* @param {*} node
|
|
22661
|
+
* @param {object} opts
|
|
22662
|
+
* @param {number} opts.reps - The number of repetitions encountered
|
|
22663
|
+
* @param {number} opts.limit - The maximum number of repetitions allowed
|
|
22664
|
+
* @param {number} starHeight - The current height of the star in the regex tree
|
|
22665
|
+
* @returns {boolean}
|
|
22666
|
+
*/
|
|
22667
|
+
function walk (node, opts, starHeight) {
|
|
22668
|
+
let i;
|
|
22669
|
+
let ok;
|
|
22670
|
+
let len;
|
|
22671
|
+
|
|
22672
|
+
if (node.type === types.REPETITION) {
|
|
22673
|
+
starHeight++;
|
|
22674
|
+
opts.reps++;
|
|
22675
|
+
if (starHeight > 1) return false
|
|
22676
|
+
if (opts.reps > opts.limit) return false
|
|
22677
|
+
}
|
|
22487
22678
|
|
|
22488
|
-
|
|
22679
|
+
const options = node.options || node.value?.options;
|
|
22680
|
+
if (options) {
|
|
22681
|
+
for (i = 0, len = options.length; i < len; i++) {
|
|
22682
|
+
ok = walk({ stack: options[i] }, opts, starHeight);
|
|
22683
|
+
if (!ok) return false
|
|
22684
|
+
}
|
|
22685
|
+
}
|
|
22686
|
+
const stack = node.stack || node.value?.stack;
|
|
22687
|
+
if (!stack) return true
|
|
22489
22688
|
|
|
22490
|
-
|
|
22491
|
-
|
|
22492
|
-
|
|
22493
|
-
|
|
22494
|
-
let len;
|
|
22689
|
+
for (i = 0, len = stack.length; i < len; i++) {
|
|
22690
|
+
ok = walk(stack[i], opts, starHeight);
|
|
22691
|
+
if (!ok) return false
|
|
22692
|
+
}
|
|
22495
22693
|
|
|
22496
|
-
|
|
22497
|
-
|
|
22498
|
-
reps++;
|
|
22499
|
-
if (starHeight > 1) return false
|
|
22500
|
-
if (reps > replimit) return false
|
|
22501
|
-
}
|
|
22694
|
+
return true
|
|
22695
|
+
}
|
|
22502
22696
|
|
|
22503
|
-
|
|
22504
|
-
|
|
22505
|
-
|
|
22506
|
-
|
|
22507
|
-
|
|
22508
|
-
|
|
22509
|
-
|
|
22510
|
-
|
|
22697
|
+
/**
|
|
22698
|
+
* @param {string|RegExp} re - The regular expression to check, can be a string or RegExp object
|
|
22699
|
+
* @param {object} [options]
|
|
22700
|
+
* @param {number} [options.limit=25] - The maximum number of repetitions allowed
|
|
22701
|
+
* @returns {boolean} - Returns true if the regex is safe, false if it is unsafe or invalid
|
|
22702
|
+
*/
|
|
22703
|
+
function safeRegex (re, options) {
|
|
22704
|
+
const opts = {
|
|
22705
|
+
reps: 0,
|
|
22706
|
+
limit: options?.limit ?? 25
|
|
22707
|
+
};
|
|
22511
22708
|
|
|
22512
|
-
|
|
22513
|
-
|
|
22514
|
-
if (!ok) return false
|
|
22515
|
-
}
|
|
22709
|
+
if (isRegExp(re)) re = re.source;
|
|
22710
|
+
else if (typeof re !== 'string') re = String(re);
|
|
22516
22711
|
|
|
22517
|
-
|
|
22518
|
-
|
|
22712
|
+
try {
|
|
22713
|
+
return walk(parse(re), opts, 0)
|
|
22714
|
+
} catch {
|
|
22715
|
+
return false
|
|
22716
|
+
}
|
|
22519
22717
|
}
|
|
22520
22718
|
|
|
22719
|
+
/**
|
|
22720
|
+
* @param {*} x
|
|
22721
|
+
* @returns {x is RegExp}
|
|
22722
|
+
*/
|
|
22521
22723
|
function isRegExp (x) {
|
|
22522
|
-
return
|
|
22724
|
+
return Object.prototype.toString.call(x) === '[object RegExp]'
|
|
22523
22725
|
}
|
|
22524
22726
|
|
|
22525
22727
|
safeRegex2.exports = safeRegex;
|
|
@@ -22908,14 +23110,15 @@ function requireHandlerStorage () {
|
|
|
22908
23110
|
// An example: a request comes in for version 1.x, and this node has a handler that matches the path, but there's no version constraint. For SemVer, the find-my-way semantics do not match this handler to that request.
|
|
22909
23111
|
// This function is used by Nodes with handlers to match when they don't have any constrained routes to exclude request that do have must match derived constraints present.
|
|
22910
23112
|
for (const constraint in constrainer.strategies) {
|
|
23113
|
+
if (!Object.hasOwn(constrainer.strategies, constraint)) continue
|
|
22911
23114
|
const strategy = constrainer.strategies[constraint];
|
|
22912
23115
|
if (strategy.mustMatchWhenDerived && !this.constraints.includes(constraint)) {
|
|
22913
23116
|
lines.push(`if (derivedConstraints.${constraint} !== undefined) return null`);
|
|
22914
23117
|
}
|
|
22915
23118
|
}
|
|
22916
23119
|
|
|
22917
|
-
// Return the
|
|
22918
|
-
lines.push('return this.handlers[Math.
|
|
23120
|
+
// Return the highest set bit index in the candidates bitmask.
|
|
23121
|
+
lines.push('return this.handlers[31 - Math.clz32(candidates)]');
|
|
22919
23122
|
|
|
22920
23123
|
this._getHandlerMatchingConstraints = new Function('derivedConstraints', lines.join('\n')); // eslint-disable-line
|
|
22921
23124
|
}
|
|
@@ -23361,6 +23564,7 @@ function requireConstrainer () {
|
|
|
23361
23564
|
if (constraints) {
|
|
23362
23565
|
const beforeSize = this.strategiesInUse.size;
|
|
23363
23566
|
for (const key in constraints) {
|
|
23567
|
+
if (!Object.hasOwn(constraints, key)) continue
|
|
23364
23568
|
const strategy = this.strategies[key];
|
|
23365
23569
|
if (strategy.isAsync) {
|
|
23366
23570
|
this.asyncStrategiesInUse.add(key);
|
|
@@ -23383,6 +23587,7 @@ function requireConstrainer () {
|
|
|
23383
23587
|
|
|
23384
23588
|
validateConstraints (constraints) {
|
|
23385
23589
|
for (const key in constraints) {
|
|
23590
|
+
if (!Object.hasOwn(constraints, key)) continue
|
|
23386
23591
|
const value = constraints[key];
|
|
23387
23592
|
if (typeof value === 'undefined') {
|
|
23388
23593
|
throw new Error('Can\'t pass an undefined constraint value, must pass null or no key at all')
|
|
@@ -23692,6 +23897,7 @@ function requireFindMyWay () {
|
|
|
23692
23897
|
this.ignoreTrailingSlash = opts.ignoreTrailingSlash || false;
|
|
23693
23898
|
this.ignoreDuplicateSlashes = opts.ignoreDuplicateSlashes || false;
|
|
23694
23899
|
this.maxParamLength = opts.maxParamLength || 100;
|
|
23900
|
+
this.onMaxParamLength = opts.onMaxParamLength || null;
|
|
23695
23901
|
this.allowUnsafeRegex = opts.allowUnsafeRegex || false;
|
|
23696
23902
|
this.constrainer = new Constrainer(opts.constraints);
|
|
23697
23903
|
this.useSemicolonDelimiter = opts.useSemicolonDelimiter || false;
|
|
@@ -24199,6 +24405,7 @@ function requireFindMyWay () {
|
|
|
24199
24405
|
const pathLen = path.length;
|
|
24200
24406
|
|
|
24201
24407
|
const brothersNodesStack = [];
|
|
24408
|
+
let maxParamLengthExceeded = false;
|
|
24202
24409
|
|
|
24203
24410
|
while (true) {
|
|
24204
24411
|
if (pathIndex === pathLen && currentNode.isLeafNode) {
|
|
@@ -24217,6 +24424,9 @@ function requireFindMyWay () {
|
|
|
24217
24424
|
|
|
24218
24425
|
if (node === null) {
|
|
24219
24426
|
if (brothersNodesStack.length === 0) {
|
|
24427
|
+
if (maxParamLengthExceeded && this.onMaxParamLength) {
|
|
24428
|
+
return this._onMaxParamLength(originPath)
|
|
24429
|
+
}
|
|
24220
24430
|
return null
|
|
24221
24431
|
}
|
|
24222
24432
|
|
|
@@ -24258,18 +24468,34 @@ function requireFindMyWay () {
|
|
|
24258
24468
|
|
|
24259
24469
|
if (currentNode.isRegex) {
|
|
24260
24470
|
const matchedParameters = currentNode.regex.exec(param);
|
|
24261
|
-
if (matchedParameters === null)
|
|
24471
|
+
if (matchedParameters === null) {
|
|
24472
|
+
node = null;
|
|
24473
|
+
continue
|
|
24474
|
+
}
|
|
24262
24475
|
|
|
24476
|
+
let regexMaxParamLengthExceeded = false;
|
|
24263
24477
|
for (let i = 1; i < matchedParameters.length; i++) {
|
|
24264
24478
|
const matchedParam = matchedParameters[i];
|
|
24265
24479
|
if (matchedParam.length > maxParamLength) {
|
|
24266
|
-
|
|
24480
|
+
regexMaxParamLengthExceeded = true;
|
|
24481
|
+
break
|
|
24267
24482
|
}
|
|
24268
|
-
|
|
24483
|
+
}
|
|
24484
|
+
|
|
24485
|
+
if (regexMaxParamLengthExceeded) {
|
|
24486
|
+
maxParamLengthExceeded = true;
|
|
24487
|
+
node = null;
|
|
24488
|
+
continue
|
|
24489
|
+
}
|
|
24490
|
+
|
|
24491
|
+
for (let i = 1; i < matchedParameters.length; i++) {
|
|
24492
|
+
params.push(matchedParameters[i]);
|
|
24269
24493
|
}
|
|
24270
24494
|
} else {
|
|
24271
24495
|
if (param.length > maxParamLength) {
|
|
24272
|
-
|
|
24496
|
+
maxParamLengthExceeded = true;
|
|
24497
|
+
node = null;
|
|
24498
|
+
continue
|
|
24273
24499
|
}
|
|
24274
24500
|
params.push(param);
|
|
24275
24501
|
}
|
|
@@ -24310,6 +24536,18 @@ function requireFindMyWay () {
|
|
|
24310
24536
|
}
|
|
24311
24537
|
};
|
|
24312
24538
|
|
|
24539
|
+
Router.prototype._onMaxParamLength = function (path) {
|
|
24540
|
+
if (this.onMaxParamLength === null) {
|
|
24541
|
+
return null
|
|
24542
|
+
}
|
|
24543
|
+
const onMaxParamLength = this.onMaxParamLength;
|
|
24544
|
+
return {
|
|
24545
|
+
handler: (req, res, ctx) => onMaxParamLength(path, req, res),
|
|
24546
|
+
params: {},
|
|
24547
|
+
store: null
|
|
24548
|
+
}
|
|
24549
|
+
};
|
|
24550
|
+
|
|
24313
24551
|
Router.prototype.prettyPrint = function (options = {}) {
|
|
24314
24552
|
const method = options.method;
|
|
24315
24553
|
|
|
@@ -24361,6 +24599,9 @@ function requireFindMyWay () {
|
|
|
24361
24599
|
return decoded.path
|
|
24362
24600
|
};
|
|
24363
24601
|
|
|
24602
|
+
Router.removeDuplicateSlashes = removeDuplicateSlashes;
|
|
24603
|
+
Router.trimLastSlash = trimLastSlash;
|
|
24604
|
+
|
|
24364
24605
|
findMyWay = Router;
|
|
24365
24606
|
|
|
24366
24607
|
function escapeRegExp (string) {
|