@nhtio/validation 2.20251203.0 → 2.20251203.1
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/index.cjs +906 -1043
- package/index.cjs.map +1 -1
- package/index.mjs +906 -1043
- package/index.mjs.map +1 -1
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -33,7 +33,7 @@ var __require = ((x) => typeof require !== "undefined" ? require : typeof Proxy
|
|
|
33
33
|
throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function.");
|
|
34
34
|
});
|
|
35
35
|
var require_assertError = __commonJSMin((exports, module) => {
|
|
36
|
-
module.exports = class AssertError$
|
|
36
|
+
module.exports = class AssertError$3 extends Error {
|
|
37
37
|
name = "AssertError";
|
|
38
38
|
constructor(message, ctor) {
|
|
39
39
|
super(message || "Unknown error");
|
|
@@ -51,7 +51,7 @@ var require_stringify = __commonJSMin((exports, module) => {
|
|
|
51
51
|
};
|
|
52
52
|
});
|
|
53
53
|
var require_assert$1 = __commonJSMin((exports, module) => {
|
|
54
|
-
const AssertError$
|
|
54
|
+
const AssertError$2 = require_assertError();
|
|
55
55
|
const Stringify = require_stringify();
|
|
56
56
|
const assert$54 = module.exports = function(condition, ...args$1) {
|
|
57
57
|
if (condition) return;
|
|
@@ -59,7 +59,7 @@ var require_assert$1 = __commonJSMin((exports, module) => {
|
|
|
59
59
|
const msgs = args$1.filter((arg) => arg !== "").map((arg) => {
|
|
60
60
|
return typeof arg === "string" ? arg : arg instanceof Error ? arg.message : Stringify(arg);
|
|
61
61
|
});
|
|
62
|
-
throw new AssertError$
|
|
62
|
+
throw new AssertError$2(msgs.join(" "), assert$54);
|
|
63
63
|
};
|
|
64
64
|
});
|
|
65
65
|
var dist_exports = {};
|
|
@@ -247,15 +247,15 @@ var init_dist$1 = __esmMin(() => {
|
|
|
247
247
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
248
248
|
* @license MIT
|
|
249
249
|
*/
|
|
250
|
-
(function(exports$
|
|
250
|
+
(function(exports$1) {
|
|
251
251
|
const base64 = base64Js;
|
|
252
252
|
const ieee754$1 = ieee754;
|
|
253
253
|
const customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;
|
|
254
|
-
exports$
|
|
255
|
-
exports$
|
|
256
|
-
exports$
|
|
254
|
+
exports$1.Buffer = Buffer$27;
|
|
255
|
+
exports$1.SlowBuffer = SlowBuffer$1;
|
|
256
|
+
exports$1.INSPECT_MAX_BYTES = 50;
|
|
257
257
|
const K_MAX_LENGTH = 2147483647;
|
|
258
|
-
exports$
|
|
258
|
+
exports$1.kMaxLength = K_MAX_LENGTH;
|
|
259
259
|
const { Uint8Array: GlobalUint8Array, ArrayBuffer: GlobalArrayBuffer, SharedArrayBuffer: GlobalSharedArrayBuffer } = globalThis;
|
|
260
260
|
Buffer$27.TYPED_ARRAY_SUPPORT = typedArraySupport();
|
|
261
261
|
if (!Buffer$27.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");
|
|
@@ -554,7 +554,7 @@ var init_dist$1 = __esmMin(() => {
|
|
|
554
554
|
};
|
|
555
555
|
Buffer$27.prototype.inspect = function inspect$5() {
|
|
556
556
|
let str = "";
|
|
557
|
-
const max$4 = exports$
|
|
557
|
+
const max$4 = exports$1.INSPECT_MAX_BYTES;
|
|
558
558
|
str = this.toString("hex", 0, max$4).replace(/(.{2})/g, "$1 ").trim();
|
|
559
559
|
if (this.length > max$4) str += " ... ";
|
|
560
560
|
return "<Buffer " + str + ">";
|
|
@@ -1506,26 +1506,26 @@ var init_dist$1 = __esmMin(() => {
|
|
|
1506
1506
|
transcode = buffer$1.transcode;
|
|
1507
1507
|
});
|
|
1508
1508
|
var require_reach = __commonJSMin((exports, module) => {
|
|
1509
|
-
const Assert$
|
|
1510
|
-
const internals$
|
|
1509
|
+
const Assert$5 = require_assert$1();
|
|
1510
|
+
const internals$41 = {};
|
|
1511
1511
|
module.exports = function(obj, chain, options) {
|
|
1512
1512
|
if (chain === false || chain === null || chain === void 0) return obj;
|
|
1513
1513
|
options = options || {};
|
|
1514
1514
|
if (typeof options === "string") options = { separator: options };
|
|
1515
1515
|
const isChainArray = Array.isArray(chain);
|
|
1516
|
-
Assert$
|
|
1516
|
+
Assert$5(!isChainArray || !options.separator, "Separator option is not valid for array-based chain");
|
|
1517
1517
|
const path = isChainArray ? chain : chain.split(options.separator || ".");
|
|
1518
1518
|
let ref = obj;
|
|
1519
1519
|
for (let i$1 = 0; i$1 < path.length; ++i$1) {
|
|
1520
1520
|
let key = path[i$1];
|
|
1521
|
-
const type = options.iterables && internals$
|
|
1521
|
+
const type = options.iterables && internals$41.iterables(ref);
|
|
1522
1522
|
if (Array.isArray(ref) || type === "set") {
|
|
1523
1523
|
const number = Number(key);
|
|
1524
1524
|
if (Number.isInteger(number)) key = number < 0 ? ref.length + number : number;
|
|
1525
1525
|
}
|
|
1526
1526
|
if (!ref || typeof ref === "function" && options.functions === false || !type && ref[key] === void 0) {
|
|
1527
|
-
Assert$
|
|
1528
|
-
Assert$
|
|
1527
|
+
Assert$5(!options.strict || i$1 + 1 === path.length, "Missing segment", key, "in reach path ", chain);
|
|
1528
|
+
Assert$5(typeof ref === "object" || options.functions === true || typeof ref !== "function", "Invalid segment", key, "in reach path ", chain);
|
|
1529
1529
|
ref = options.default;
|
|
1530
1530
|
break;
|
|
1531
1531
|
}
|
|
@@ -1535,14 +1535,14 @@ var require_reach = __commonJSMin((exports, module) => {
|
|
|
1535
1535
|
}
|
|
1536
1536
|
return ref;
|
|
1537
1537
|
};
|
|
1538
|
-
internals$
|
|
1538
|
+
internals$41.iterables = function(ref) {
|
|
1539
1539
|
if (ref instanceof Set) return "set";
|
|
1540
1540
|
if (ref instanceof Map) return "map";
|
|
1541
1541
|
};
|
|
1542
1542
|
});
|
|
1543
1543
|
var require_types$1 = __commonJSMin((exports, module) => {
|
|
1544
1544
|
init_dist$1();
|
|
1545
|
-
const internals$
|
|
1545
|
+
const internals$40 = {};
|
|
1546
1546
|
exports = module.exports = {
|
|
1547
1547
|
array: Array.prototype,
|
|
1548
1548
|
buffer: Buffer$1 && Buffer$1.prototype,
|
|
@@ -1557,7 +1557,7 @@ var require_types$1 = __commonJSMin((exports, module) => {
|
|
|
1557
1557
|
weakMap: WeakMap.prototype,
|
|
1558
1558
|
weakSet: WeakSet.prototype
|
|
1559
1559
|
};
|
|
1560
|
-
internals$
|
|
1560
|
+
internals$40.typeMap = new Map([
|
|
1561
1561
|
["[object Error]", exports.error],
|
|
1562
1562
|
["[object Map]", exports.map],
|
|
1563
1563
|
["[object Promise]", exports.promise],
|
|
@@ -1573,7 +1573,7 @@ var require_types$1 = __commonJSMin((exports, module) => {
|
|
|
1573
1573
|
if (obj instanceof RegExp) return exports.regex;
|
|
1574
1574
|
if (obj instanceof Error) return exports.error;
|
|
1575
1575
|
const objName = Object.prototype.toString.call(obj);
|
|
1576
|
-
return internals$
|
|
1576
|
+
return internals$40.typeMap.get(objName) || exports.generic;
|
|
1577
1577
|
};
|
|
1578
1578
|
});
|
|
1579
1579
|
var require_utils$7 = __commonJSMin((exports) => {
|
|
@@ -1586,7 +1586,7 @@ var require_clone$1 = __commonJSMin((exports, module) => {
|
|
|
1586
1586
|
const Reach$2 = require_reach();
|
|
1587
1587
|
const Types$1 = require_types$1();
|
|
1588
1588
|
const Utils$3 = require_utils$7();
|
|
1589
|
-
const internals$
|
|
1589
|
+
const internals$39 = {
|
|
1590
1590
|
needsProtoHack: new Set([
|
|
1591
1591
|
Types$1.set,
|
|
1592
1592
|
Types$1.map,
|
|
@@ -1595,12 +1595,12 @@ var require_clone$1 = __commonJSMin((exports, module) => {
|
|
|
1595
1595
|
]),
|
|
1596
1596
|
structuredCloneExists: typeof structuredClone === "function"
|
|
1597
1597
|
};
|
|
1598
|
-
module.exports = internals$
|
|
1598
|
+
module.exports = internals$39.clone = function(obj, options = {}, _seen = null) {
|
|
1599
1599
|
if (typeof obj !== "object" || obj === null) return obj;
|
|
1600
|
-
let clone$20 = internals$
|
|
1600
|
+
let clone$20 = internals$39.clone;
|
|
1601
1601
|
let seen = _seen;
|
|
1602
1602
|
if (options.shallow) {
|
|
1603
|
-
if (options.shallow !== true) return internals$
|
|
1603
|
+
if (options.shallow !== true) return internals$39.cloneWithShallow(obj, options);
|
|
1604
1604
|
clone$20 = (value) => value;
|
|
1605
1605
|
} else if (seen) {
|
|
1606
1606
|
const lookup$1 = seen.get(obj);
|
|
@@ -1613,7 +1613,7 @@ var require_clone$1 = __commonJSMin((exports, module) => {
|
|
|
1613
1613
|
case Types$1.regex:
|
|
1614
1614
|
case Types$1.url: return new baseProto.constructor(obj);
|
|
1615
1615
|
}
|
|
1616
|
-
const newObj = internals$
|
|
1616
|
+
const newObj = internals$39.base(obj, baseProto, options);
|
|
1617
1617
|
if (newObj === obj) return obj;
|
|
1618
1618
|
if (seen) seen.set(obj, newObj);
|
|
1619
1619
|
if (baseProto === Types$1.set) for (const value of obj) newObj.add(clone$20(value, options, seen));
|
|
@@ -1625,7 +1625,7 @@ var require_clone$1 = __commonJSMin((exports, module) => {
|
|
|
1625
1625
|
newObj.length = obj.length;
|
|
1626
1626
|
continue;
|
|
1627
1627
|
}
|
|
1628
|
-
if (internals$
|
|
1628
|
+
if (internals$39.structuredCloneExists && baseProto === Types$1.error && key === "stack") continue;
|
|
1629
1629
|
const descriptor = Object.getOwnPropertyDescriptor(obj, key);
|
|
1630
1630
|
if (descriptor) if (descriptor.get || descriptor.set) Object.defineProperty(newObj, key, descriptor);
|
|
1631
1631
|
else if (descriptor.enumerable) newObj[key] = clone$20(obj[key], options, seen);
|
|
@@ -1644,7 +1644,7 @@ var require_clone$1 = __commonJSMin((exports, module) => {
|
|
|
1644
1644
|
}
|
|
1645
1645
|
return newObj;
|
|
1646
1646
|
};
|
|
1647
|
-
internals$
|
|
1647
|
+
internals$39.cloneWithShallow = function(source, options) {
|
|
1648
1648
|
const keys$10 = options.shallow;
|
|
1649
1649
|
options = Object.assign({}, options);
|
|
1650
1650
|
options.shallow = false;
|
|
@@ -1653,11 +1653,11 @@ var require_clone$1 = __commonJSMin((exports, module) => {
|
|
|
1653
1653
|
const ref = Reach$2(source, key);
|
|
1654
1654
|
if (typeof ref === "object" || typeof ref === "function") seen.set(ref, ref);
|
|
1655
1655
|
}
|
|
1656
|
-
return internals$
|
|
1656
|
+
return internals$39.clone(source, options, seen);
|
|
1657
1657
|
};
|
|
1658
|
-
internals$
|
|
1658
|
+
internals$39.base = function(obj, baseProto, options) {
|
|
1659
1659
|
if (options.prototype === false) {
|
|
1660
|
-
if (internals$
|
|
1660
|
+
if (internals$39.needsProtoHack.has(baseProto)) return new baseProto.constructor();
|
|
1661
1661
|
return baseProto === Types$1.array ? [] : {};
|
|
1662
1662
|
}
|
|
1663
1663
|
const proto = Object.getPrototypeOf(obj);
|
|
@@ -1666,12 +1666,12 @@ var require_clone$1 = __commonJSMin((exports, module) => {
|
|
|
1666
1666
|
const newObj = [];
|
|
1667
1667
|
if (proto !== baseProto) Object.setPrototypeOf(newObj, proto);
|
|
1668
1668
|
return newObj;
|
|
1669
|
-
} else if (baseProto === Types$1.error && internals$
|
|
1669
|
+
} else if (baseProto === Types$1.error && internals$39.structuredCloneExists && (proto === baseProto || Error.isPrototypeOf(proto.constructor))) {
|
|
1670
1670
|
const err = structuredClone(obj);
|
|
1671
1671
|
if (Object.getPrototypeOf(err) !== proto) Object.setPrototypeOf(err, proto);
|
|
1672
1672
|
return err;
|
|
1673
1673
|
}
|
|
1674
|
-
if (internals$
|
|
1674
|
+
if (internals$39.needsProtoHack.has(baseProto)) {
|
|
1675
1675
|
const newObj = new proto.constructor();
|
|
1676
1676
|
if (proto !== baseProto) Object.setPrototypeOf(newObj, proto);
|
|
1677
1677
|
return newObj;
|
|
@@ -1681,20 +1681,20 @@ var require_clone$1 = __commonJSMin((exports, module) => {
|
|
|
1681
1681
|
});
|
|
1682
1682
|
var require_merge = __commonJSMin((exports, module) => {
|
|
1683
1683
|
init_dist$1();
|
|
1684
|
-
const Assert$
|
|
1684
|
+
const Assert$4 = require_assert$1();
|
|
1685
1685
|
const Clone$2 = require_clone$1();
|
|
1686
1686
|
const Utils$2 = require_utils$7();
|
|
1687
|
-
const internals$
|
|
1688
|
-
module.exports = internals$
|
|
1689
|
-
Assert$
|
|
1690
|
-
Assert$
|
|
1687
|
+
const internals$38 = {};
|
|
1688
|
+
module.exports = internals$38.merge = function(target, source, options) {
|
|
1689
|
+
Assert$4(target && typeof target === "object", "Invalid target value: must be an object");
|
|
1690
|
+
Assert$4(source === null || source === void 0 || typeof source === "object", "Invalid source value: must be null, undefined, or an object");
|
|
1691
1691
|
if (!source) return target;
|
|
1692
1692
|
options = Object.assign({
|
|
1693
1693
|
nullOverride: true,
|
|
1694
1694
|
mergeArrays: true
|
|
1695
1695
|
}, options);
|
|
1696
1696
|
if (Array.isArray(source)) {
|
|
1697
|
-
Assert$
|
|
1697
|
+
Assert$4(Array.isArray(target), "Cannot merge array onto an object");
|
|
1698
1698
|
if (!options.mergeArrays) target.length = 0;
|
|
1699
1699
|
for (let i$1 = 0; i$1 < source.length; ++i$1) target.push(Clone$2(source[i$1], { symbols: options.symbols }));
|
|
1700
1700
|
return target;
|
|
@@ -1707,7 +1707,7 @@ var require_merge = __commonJSMin((exports, module) => {
|
|
|
1707
1707
|
if (value && typeof value === "object") {
|
|
1708
1708
|
if (target[key] === value) continue;
|
|
1709
1709
|
if (!target[key] || typeof target[key] !== "object" || Array.isArray(target[key]) !== Array.isArray(value) || value instanceof Date || Buffer$1 && Buffer$1.isBuffer(value) || value instanceof RegExp) target[key] = Clone$2(value, { symbols: options.symbols });
|
|
1710
|
-
else internals$
|
|
1710
|
+
else internals$38.merge(target[key], value, options);
|
|
1711
1711
|
} else if (value !== null && value !== void 0) target[key] = value;
|
|
1712
1712
|
else if (options.nullOverride) target[key] = value;
|
|
1713
1713
|
}
|
|
@@ -1715,17 +1715,17 @@ var require_merge = __commonJSMin((exports, module) => {
|
|
|
1715
1715
|
};
|
|
1716
1716
|
});
|
|
1717
1717
|
var require_applyToDefaults = __commonJSMin((exports, module) => {
|
|
1718
|
-
const Assert$
|
|
1718
|
+
const Assert$3 = require_assert$1();
|
|
1719
1719
|
const Clone$1 = require_clone$1();
|
|
1720
1720
|
const Merge = require_merge();
|
|
1721
1721
|
const Reach$1 = require_reach();
|
|
1722
|
-
const internals$
|
|
1722
|
+
const internals$37 = {};
|
|
1723
1723
|
module.exports = function(defaults$3, source, options = {}) {
|
|
1724
|
-
Assert$
|
|
1725
|
-
Assert$
|
|
1726
|
-
Assert$
|
|
1724
|
+
Assert$3(defaults$3 && typeof defaults$3 === "object", "Invalid defaults value: must be an object");
|
|
1725
|
+
Assert$3(!source || source === true || typeof source === "object", "Invalid source value: must be true, falsy or an object");
|
|
1726
|
+
Assert$3(typeof options === "object", "Invalid options: must be an object");
|
|
1727
1727
|
if (!source) return null;
|
|
1728
|
-
if (options.shallow) return internals$
|
|
1728
|
+
if (options.shallow) return internals$37.applyToDefaultsWithShallow(defaults$3, source, options);
|
|
1729
1729
|
const copy$1 = Clone$1(defaults$3);
|
|
1730
1730
|
if (source === true) return copy$1;
|
|
1731
1731
|
const nullOverride = options.nullOverride !== void 0 ? options.nullOverride : false;
|
|
@@ -1734,9 +1734,9 @@ var require_applyToDefaults = __commonJSMin((exports, module) => {
|
|
|
1734
1734
|
mergeArrays: false
|
|
1735
1735
|
});
|
|
1736
1736
|
};
|
|
1737
|
-
internals$
|
|
1737
|
+
internals$37.applyToDefaultsWithShallow = function(defaults$3, source, options) {
|
|
1738
1738
|
const keys$10 = options.shallow;
|
|
1739
|
-
Assert$
|
|
1739
|
+
Assert$3(Array.isArray(keys$10), "Invalid keys");
|
|
1740
1740
|
const seen = new Map();
|
|
1741
1741
|
const merge$4 = source === true ? null : new Set();
|
|
1742
1742
|
for (let key of keys$10) {
|
|
@@ -1747,14 +1747,14 @@ var require_applyToDefaults = __commonJSMin((exports, module) => {
|
|
|
1747
1747
|
}
|
|
1748
1748
|
const copy$1 = Clone$1(defaults$3, {}, seen);
|
|
1749
1749
|
if (!merge$4) return copy$1;
|
|
1750
|
-
for (const key of merge$4) internals$
|
|
1750
|
+
for (const key of merge$4) internals$37.reachCopy(copy$1, source, key);
|
|
1751
1751
|
const nullOverride = options.nullOverride !== void 0 ? options.nullOverride : false;
|
|
1752
1752
|
return Merge(copy$1, source, {
|
|
1753
1753
|
nullOverride,
|
|
1754
1754
|
mergeArrays: false
|
|
1755
1755
|
});
|
|
1756
1756
|
};
|
|
1757
|
-
internals$
|
|
1757
|
+
internals$37.reachCopy = function(dst, src$1, path) {
|
|
1758
1758
|
for (const segment of path) {
|
|
1759
1759
|
if (!(segment in src$1)) return;
|
|
1760
1760
|
const val = src$1[segment];
|
|
@@ -1905,17 +1905,17 @@ var init_dist = __esmMin(() => {
|
|
|
1905
1905
|
});
|
|
1906
1906
|
var require_bench = __commonJSMin((exports, module) => {
|
|
1907
1907
|
init_dist();
|
|
1908
|
-
const internals$
|
|
1909
|
-
module.exports = internals$
|
|
1908
|
+
const internals$36 = {};
|
|
1909
|
+
module.exports = internals$36.Bench = class {
|
|
1910
1910
|
constructor() {
|
|
1911
1911
|
this.ts = 0;
|
|
1912
1912
|
this.reset();
|
|
1913
1913
|
}
|
|
1914
1914
|
reset() {
|
|
1915
|
-
this.ts = internals$
|
|
1915
|
+
this.ts = internals$36.Bench.now();
|
|
1916
1916
|
}
|
|
1917
1917
|
elapsed() {
|
|
1918
|
-
return internals$
|
|
1918
|
+
return internals$36.Bench.now() - this.ts;
|
|
1919
1919
|
}
|
|
1920
1920
|
static now() {
|
|
1921
1921
|
const ts = process$1.hrtime();
|
|
@@ -1935,12 +1935,12 @@ var require_block = __commonJSMin((exports, module) => {
|
|
|
1935
1935
|
var require_deepEqual = __commonJSMin((exports, module) => {
|
|
1936
1936
|
init_dist$1();
|
|
1937
1937
|
const Types = require_types$1();
|
|
1938
|
-
const internals$
|
|
1938
|
+
const internals$35 = { mismatched: null };
|
|
1939
1939
|
module.exports = function(obj, ref, options) {
|
|
1940
1940
|
options = Object.assign({ prototype: true }, options);
|
|
1941
|
-
return !!internals$
|
|
1941
|
+
return !!internals$35.isDeepEqual(obj, ref, options, []);
|
|
1942
1942
|
};
|
|
1943
|
-
internals$
|
|
1943
|
+
internals$35.isDeepEqual = function(obj, ref, options, seen) {
|
|
1944
1944
|
if (obj === ref) return obj !== 0 || 1 / obj === 1 / ref;
|
|
1945
1945
|
const type = typeof obj;
|
|
1946
1946
|
if (type !== typeof ref) return false;
|
|
@@ -1948,32 +1948,32 @@ var require_deepEqual = __commonJSMin((exports, module) => {
|
|
|
1948
1948
|
if (type === "function") {
|
|
1949
1949
|
if (!options.deepFunction || obj.toString() !== ref.toString()) return false;
|
|
1950
1950
|
} else if (type !== "object") return obj !== obj && ref !== ref;
|
|
1951
|
-
const instanceType = internals$
|
|
1951
|
+
const instanceType = internals$35.getSharedType(obj, ref, !!options.prototype);
|
|
1952
1952
|
switch (instanceType) {
|
|
1953
1953
|
case Types.buffer: return Buffer$1 && Buffer$1.prototype.equals.call(obj, ref);
|
|
1954
1954
|
case Types.promise: return obj === ref;
|
|
1955
1955
|
case Types.regex:
|
|
1956
1956
|
case Types.url: return obj.toString() === ref.toString();
|
|
1957
|
-
case internals$
|
|
1957
|
+
case internals$35.mismatched: return false;
|
|
1958
1958
|
}
|
|
1959
1959
|
for (let i$1 = seen.length - 1; i$1 >= 0; --i$1) if (seen[i$1].isSame(obj, ref)) return true;
|
|
1960
|
-
seen.push(new internals$
|
|
1960
|
+
seen.push(new internals$35.SeenEntry(obj, ref));
|
|
1961
1961
|
try {
|
|
1962
|
-
return !!internals$
|
|
1962
|
+
return !!internals$35.isDeepEqualObj(instanceType, obj, ref, options, seen);
|
|
1963
1963
|
} finally {
|
|
1964
1964
|
seen.pop();
|
|
1965
1965
|
}
|
|
1966
1966
|
};
|
|
1967
|
-
internals$
|
|
1967
|
+
internals$35.getSharedType = function(obj, ref, checkPrototype) {
|
|
1968
1968
|
if (checkPrototype) {
|
|
1969
|
-
if (Object.getPrototypeOf(obj) !== Object.getPrototypeOf(ref)) return internals$
|
|
1969
|
+
if (Object.getPrototypeOf(obj) !== Object.getPrototypeOf(ref)) return internals$35.mismatched;
|
|
1970
1970
|
return Types.getInternalProto(obj);
|
|
1971
1971
|
}
|
|
1972
1972
|
const type = Types.getInternalProto(obj);
|
|
1973
|
-
if (type !== Types.getInternalProto(ref)) return internals$
|
|
1973
|
+
if (type !== Types.getInternalProto(ref)) return internals$35.mismatched;
|
|
1974
1974
|
return type;
|
|
1975
1975
|
};
|
|
1976
|
-
internals$
|
|
1976
|
+
internals$35.valueOf = function(obj) {
|
|
1977
1977
|
const objValueOf = obj.valueOf;
|
|
1978
1978
|
if (objValueOf === void 0) return obj;
|
|
1979
1979
|
try {
|
|
@@ -1982,15 +1982,15 @@ var require_deepEqual = __commonJSMin((exports, module) => {
|
|
|
1982
1982
|
return err;
|
|
1983
1983
|
}
|
|
1984
1984
|
};
|
|
1985
|
-
internals$
|
|
1985
|
+
internals$35.hasOwnEnumerableProperty = function(obj, key) {
|
|
1986
1986
|
return Object.prototype.propertyIsEnumerable.call(obj, key);
|
|
1987
1987
|
};
|
|
1988
|
-
internals$
|
|
1988
|
+
internals$35.isSetSimpleEqual = function(obj, ref) {
|
|
1989
1989
|
for (const entry of Set.prototype.values.call(obj)) if (!Set.prototype.has.call(ref, entry)) return false;
|
|
1990
1990
|
return true;
|
|
1991
1991
|
};
|
|
1992
|
-
internals$
|
|
1993
|
-
const { isDeepEqual: isDeepEqual$2, valueOf, hasOwnEnumerableProperty } = internals$
|
|
1992
|
+
internals$35.isDeepEqualObj = function(instanceType, obj, ref, options, seen) {
|
|
1993
|
+
const { isDeepEqual: isDeepEqual$2, valueOf, hasOwnEnumerableProperty } = internals$35;
|
|
1994
1994
|
const { keys: keys$10, getOwnPropertySymbols: getOwnPropertySymbols$1 } = Object;
|
|
1995
1995
|
if (instanceType === Types.array) if (options.part) {
|
|
1996
1996
|
for (const objValue of obj) for (const refValue of ref) if (isDeepEqual$2(objValue, refValue, options, seen)) return true;
|
|
@@ -2001,7 +2001,7 @@ var require_deepEqual = __commonJSMin((exports, module) => {
|
|
|
2001
2001
|
}
|
|
2002
2002
|
else if (instanceType === Types.set) {
|
|
2003
2003
|
if (obj.size !== ref.size) return false;
|
|
2004
|
-
if (!internals$
|
|
2004
|
+
if (!internals$35.isSetSimpleEqual(obj, ref)) {
|
|
2005
2005
|
const ref2 = new Set(Set.prototype.values.call(ref));
|
|
2006
2006
|
for (const objEntry of Set.prototype.values.call(obj)) {
|
|
2007
2007
|
if (ref2.delete(objEntry)) continue;
|
|
@@ -2054,7 +2054,7 @@ var require_deepEqual = __commonJSMin((exports, module) => {
|
|
|
2054
2054
|
}
|
|
2055
2055
|
return true;
|
|
2056
2056
|
};
|
|
2057
|
-
internals$
|
|
2057
|
+
internals$35.SeenEntry = class {
|
|
2058
2058
|
constructor(obj, ref) {
|
|
2059
2059
|
this.obj = obj;
|
|
2060
2060
|
this.ref = ref;
|
|
@@ -2070,20 +2070,20 @@ var require_escapeRegex = __commonJSMin((exports, module) => {
|
|
|
2070
2070
|
};
|
|
2071
2071
|
});
|
|
2072
2072
|
var require_contain = __commonJSMin((exports, module) => {
|
|
2073
|
-
const Assert$
|
|
2073
|
+
const Assert$2 = require_assert$1();
|
|
2074
2074
|
const DeepEqual = require_deepEqual();
|
|
2075
2075
|
const EscapeRegex = require_escapeRegex();
|
|
2076
2076
|
const Utils$1 = require_utils$7();
|
|
2077
|
-
const internals$
|
|
2077
|
+
const internals$34 = {};
|
|
2078
2078
|
module.exports = function(ref, values$3, options = {}) {
|
|
2079
2079
|
if (typeof values$3 !== "object") values$3 = [values$3];
|
|
2080
|
-
Assert$
|
|
2081
|
-
if (typeof ref === "string") return internals$
|
|
2082
|
-
if (Array.isArray(ref)) return internals$
|
|
2083
|
-
Assert$
|
|
2084
|
-
return internals$
|
|
2080
|
+
Assert$2(!Array.isArray(values$3) || values$3.length, "Values array cannot be empty");
|
|
2081
|
+
if (typeof ref === "string") return internals$34.string(ref, values$3, options);
|
|
2082
|
+
if (Array.isArray(ref)) return internals$34.array(ref, values$3, options);
|
|
2083
|
+
Assert$2(typeof ref === "object", "Reference must be string or an object");
|
|
2084
|
+
return internals$34.object(ref, values$3, options);
|
|
2085
2085
|
};
|
|
2086
|
-
internals$
|
|
2086
|
+
internals$34.array = function(ref, values$3, options) {
|
|
2087
2087
|
if (!Array.isArray(values$3)) values$3 = [values$3];
|
|
2088
2088
|
if (!ref.length) return false;
|
|
2089
2089
|
if (options.only && options.once && ref.length !== values$3.length) return false;
|
|
@@ -2097,7 +2097,7 @@ var require_contain = __commonJSMin((exports, module) => {
|
|
|
2097
2097
|
hits: 0
|
|
2098
2098
|
});
|
|
2099
2099
|
} else {
|
|
2100
|
-
compare$16 = compare$16 ?? internals$
|
|
2100
|
+
compare$16 = compare$16 ?? internals$34.compare(options);
|
|
2101
2101
|
let found = false;
|
|
2102
2102
|
for (const [key, existing] of map$8.entries()) if (compare$16(key, value)) {
|
|
2103
2103
|
++existing.allowed;
|
|
@@ -2114,7 +2114,7 @@ var require_contain = __commonJSMin((exports, module) => {
|
|
|
2114
2114
|
let match$2;
|
|
2115
2115
|
if (!options.deep || !item || typeof item !== "object") match$2 = map$8.get(item);
|
|
2116
2116
|
else {
|
|
2117
|
-
compare$16 = compare$16 ?? internals$
|
|
2117
|
+
compare$16 = compare$16 ?? internals$34.compare(options);
|
|
2118
2118
|
for (const [key, existing] of map$8.entries()) if (compare$16(key, item)) {
|
|
2119
2119
|
match$2 = existing;
|
|
2120
2120
|
break;
|
|
@@ -2133,14 +2133,14 @@ var require_contain = __commonJSMin((exports, module) => {
|
|
|
2133
2133
|
}
|
|
2134
2134
|
return !!hits;
|
|
2135
2135
|
};
|
|
2136
|
-
internals$
|
|
2137
|
-
Assert$
|
|
2136
|
+
internals$34.object = function(ref, values$3, options) {
|
|
2137
|
+
Assert$2(options.once === void 0, "Cannot use option once with object");
|
|
2138
2138
|
const keys$10 = Utils$1.keys(ref, options);
|
|
2139
2139
|
if (!keys$10.length) return false;
|
|
2140
|
-
if (Array.isArray(values$3)) return internals$
|
|
2140
|
+
if (Array.isArray(values$3)) return internals$34.array(keys$10, values$3, options);
|
|
2141
2141
|
const symbols = Object.getOwnPropertySymbols(values$3).filter((sym) => values$3.propertyIsEnumerable(sym));
|
|
2142
2142
|
const targets = [...Object.keys(values$3), ...symbols];
|
|
2143
|
-
const compare$16 = internals$
|
|
2143
|
+
const compare$16 = internals$34.compare(options);
|
|
2144
2144
|
const set = new Set(targets);
|
|
2145
2145
|
for (const key of keys$10) {
|
|
2146
2146
|
if (!set.has(key)) {
|
|
@@ -2153,12 +2153,12 @@ var require_contain = __commonJSMin((exports, module) => {
|
|
|
2153
2153
|
if (set.size) return options.part ? set.size < targets.length : false;
|
|
2154
2154
|
return true;
|
|
2155
2155
|
};
|
|
2156
|
-
internals$
|
|
2156
|
+
internals$34.string = function(ref, values$3, options) {
|
|
2157
2157
|
if (ref === "") return values$3.length === 1 && values$3[0] === "" || !options.once && !values$3.some((v$1) => v$1 !== "");
|
|
2158
2158
|
const map$8 = new Map();
|
|
2159
2159
|
const patterns = [];
|
|
2160
2160
|
for (const value of values$3) {
|
|
2161
|
-
Assert$
|
|
2161
|
+
Assert$2(typeof value === "string", "Cannot compare string reference to non-string value");
|
|
2162
2162
|
if (value) {
|
|
2163
2163
|
const existing = map$8.get(value);
|
|
2164
2164
|
if (existing) ++existing.allowed;
|
|
@@ -2187,8 +2187,8 @@ var require_contain = __commonJSMin((exports, module) => {
|
|
|
2187
2187
|
}
|
|
2188
2188
|
return !!any;
|
|
2189
2189
|
};
|
|
2190
|
-
internals$
|
|
2191
|
-
if (!options.deep) return internals$
|
|
2190
|
+
internals$34.compare = function(options) {
|
|
2191
|
+
if (!options.deep) return internals$34.shallow;
|
|
2192
2192
|
const hasOnly = options.only !== void 0;
|
|
2193
2193
|
const hasPart = options.part !== void 0;
|
|
2194
2194
|
const flags = {
|
|
@@ -2197,40 +2197,40 @@ var require_contain = __commonJSMin((exports, module) => {
|
|
|
2197
2197
|
};
|
|
2198
2198
|
return (a$2, b) => DeepEqual(a$2, b, flags);
|
|
2199
2199
|
};
|
|
2200
|
-
internals$
|
|
2200
|
+
internals$34.shallow = function(a$2, b) {
|
|
2201
2201
|
return a$2 === b;
|
|
2202
2202
|
};
|
|
2203
2203
|
});
|
|
2204
2204
|
var require_escapeHeaderAttribute = __commonJSMin((exports, module) => {
|
|
2205
|
-
const Assert$
|
|
2205
|
+
const Assert$1 = require_assert$1();
|
|
2206
2206
|
module.exports = function(attribute) {
|
|
2207
|
-
Assert$
|
|
2207
|
+
Assert$1(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$/.test(attribute), "Bad attribute value (" + attribute + ")");
|
|
2208
2208
|
return attribute.replace(/\\/g, "\\\\").replace(/\"/g, "\\\"");
|
|
2209
2209
|
};
|
|
2210
2210
|
});
|
|
2211
2211
|
var require_escapeHtml = __commonJSMin((exports, module) => {
|
|
2212
|
-
const internals$
|
|
2212
|
+
const internals$33 = {};
|
|
2213
2213
|
module.exports = function(input) {
|
|
2214
2214
|
if (!input) return "";
|
|
2215
2215
|
let escaped = "";
|
|
2216
2216
|
for (let i$1 = 0; i$1 < input.length; ++i$1) {
|
|
2217
2217
|
const charCode = input.charCodeAt(i$1);
|
|
2218
|
-
if (internals$
|
|
2219
|
-
else escaped += internals$
|
|
2218
|
+
if (internals$33.isSafe(charCode)) escaped += input[i$1];
|
|
2219
|
+
else escaped += internals$33.escapeHtmlChar(charCode);
|
|
2220
2220
|
}
|
|
2221
2221
|
return escaped;
|
|
2222
2222
|
};
|
|
2223
|
-
internals$
|
|
2224
|
-
const namedEscape = internals$
|
|
2223
|
+
internals$33.escapeHtmlChar = function(charCode) {
|
|
2224
|
+
const namedEscape = internals$33.namedHtml.get(charCode);
|
|
2225
2225
|
if (namedEscape) return namedEscape;
|
|
2226
2226
|
if (charCode >= 256) return "&#" + charCode + ";";
|
|
2227
2227
|
const hexValue = charCode.toString(16).padStart(2, "0");
|
|
2228
2228
|
return `&#x${hexValue};`;
|
|
2229
2229
|
};
|
|
2230
|
-
internals$
|
|
2231
|
-
return internals$
|
|
2230
|
+
internals$33.isSafe = function(charCode) {
|
|
2231
|
+
return internals$33.safeCharCodes.has(charCode);
|
|
2232
2232
|
};
|
|
2233
|
-
internals$
|
|
2233
|
+
internals$33.namedHtml = new Map([
|
|
2234
2234
|
[38, "&"],
|
|
2235
2235
|
[60, "<"],
|
|
2236
2236
|
[62, ">"],
|
|
@@ -2242,22 +2242,22 @@ var require_escapeHtml = __commonJSMin((exports, module) => {
|
|
|
2242
2242
|
[169, "©"],
|
|
2243
2243
|
[174, "®"]
|
|
2244
2244
|
]);
|
|
2245
|
-
internals$
|
|
2245
|
+
internals$33.safeCharCodes = function() {
|
|
2246
2246
|
const safe = new Set();
|
|
2247
2247
|
for (let i$1 = 32; i$1 < 123; ++i$1) if (i$1 >= 97 || i$1 >= 65 && i$1 <= 90 || i$1 >= 48 && i$1 <= 57 || i$1 === 32 || i$1 === 46 || i$1 === 44 || i$1 === 45 || i$1 === 58 || i$1 === 95) safe.add(i$1);
|
|
2248
2248
|
return safe;
|
|
2249
2249
|
}();
|
|
2250
2250
|
});
|
|
2251
2251
|
var require_escapeJson = __commonJSMin((exports, module) => {
|
|
2252
|
-
const internals$
|
|
2252
|
+
const internals$32 = {};
|
|
2253
2253
|
module.exports = function(input) {
|
|
2254
2254
|
if (!input) return "";
|
|
2255
|
-
return input.replace(/[<>&\u2028\u2029]/g, internals$
|
|
2255
|
+
return input.replace(/[<>&\u2028\u2029]/g, internals$32.escape);
|
|
2256
2256
|
};
|
|
2257
|
-
internals$
|
|
2258
|
-
return internals$
|
|
2257
|
+
internals$32.escape = function(char) {
|
|
2258
|
+
return internals$32.replacements.get(char);
|
|
2259
2259
|
};
|
|
2260
|
-
internals$
|
|
2260
|
+
internals$32.replacements = new Map([
|
|
2261
2261
|
["<", "\\u003c"],
|
|
2262
2262
|
[">", "\\u003e"],
|
|
2263
2263
|
["&", "\\u0026"],
|
|
@@ -2266,29 +2266,29 @@ var require_escapeJson = __commonJSMin((exports, module) => {
|
|
|
2266
2266
|
]);
|
|
2267
2267
|
});
|
|
2268
2268
|
var require_flatten$1 = __commonJSMin((exports, module) => {
|
|
2269
|
-
const internals$
|
|
2270
|
-
module.exports = internals$
|
|
2269
|
+
const internals$31 = {};
|
|
2270
|
+
module.exports = internals$31.flatten = function(array, target) {
|
|
2271
2271
|
const result = target || [];
|
|
2272
|
-
for (const entry of array) if (Array.isArray(entry)) internals$
|
|
2272
|
+
for (const entry of array) if (Array.isArray(entry)) internals$31.flatten(entry, result);
|
|
2273
2273
|
else result.push(entry);
|
|
2274
2274
|
return result;
|
|
2275
2275
|
};
|
|
2276
2276
|
});
|
|
2277
2277
|
var require_intersect = __commonJSMin((exports, module) => {
|
|
2278
|
-
const internals$
|
|
2278
|
+
const internals$30 = {};
|
|
2279
2279
|
module.exports = function(array1, array2, options = {}) {
|
|
2280
2280
|
if (!array1 || !array2) return options.first ? null : [];
|
|
2281
2281
|
const common$4 = [];
|
|
2282
2282
|
const hash$4 = Array.isArray(array1) ? new Set(array1) : array1;
|
|
2283
2283
|
const found = new Set();
|
|
2284
|
-
for (const value of array2) if (internals$
|
|
2284
|
+
for (const value of array2) if (internals$30.has(hash$4, value) && !found.has(value)) {
|
|
2285
2285
|
if (options.first) return value;
|
|
2286
2286
|
common$4.push(value);
|
|
2287
2287
|
found.add(value);
|
|
2288
2288
|
}
|
|
2289
2289
|
return options.first ? null : common$4;
|
|
2290
2290
|
};
|
|
2291
|
-
internals$
|
|
2291
|
+
internals$30.has = function(ref, key) {
|
|
2292
2292
|
if (typeof ref.has === "function") return ref.has(key);
|
|
2293
2293
|
return ref[key] !== void 0;
|
|
2294
2294
|
};
|
|
@@ -2299,9 +2299,9 @@ var require_isPromise = __commonJSMin((exports, module) => {
|
|
|
2299
2299
|
};
|
|
2300
2300
|
});
|
|
2301
2301
|
var require_once = __commonJSMin((exports, module) => {
|
|
2302
|
-
const internals$
|
|
2302
|
+
const internals$29 = { wrapped: Symbol("wrapped") };
|
|
2303
2303
|
module.exports = function(method$1) {
|
|
2304
|
-
if (method$1[internals$
|
|
2304
|
+
if (method$1[internals$29.wrapped]) return method$1;
|
|
2305
2305
|
let once$4 = false;
|
|
2306
2306
|
const wrappedFn = function(...args$1) {
|
|
2307
2307
|
if (!once$4) {
|
|
@@ -2309,7 +2309,7 @@ var require_once = __commonJSMin((exports, module) => {
|
|
|
2309
2309
|
method$1(...args$1);
|
|
2310
2310
|
}
|
|
2311
2311
|
};
|
|
2312
|
-
wrappedFn[internals$
|
|
2312
|
+
wrappedFn[internals$29.wrapped] = true;
|
|
2313
2313
|
return wrappedFn;
|
|
2314
2314
|
};
|
|
2315
2315
|
});
|
|
@@ -2323,7 +2323,7 @@ var require_reachTemplate = __commonJSMin((exports, module) => {
|
|
|
2323
2323
|
};
|
|
2324
2324
|
});
|
|
2325
2325
|
var require_wait = __commonJSMin((exports, module) => {
|
|
2326
|
-
const internals$
|
|
2326
|
+
const internals$28 = { maxTimer: 2 ** 31 - 1 };
|
|
2327
2327
|
module.exports = function(timeout$5, returnValue, options) {
|
|
2328
2328
|
if (typeof timeout$5 === "bigint") timeout$5 = Number(timeout$5);
|
|
2329
2329
|
if (timeout$5 >= Number.MAX_SAFE_INTEGER) timeout$5 = Infinity;
|
|
@@ -2331,7 +2331,7 @@ var require_wait = __commonJSMin((exports, module) => {
|
|
|
2331
2331
|
return new Promise((resolve) => {
|
|
2332
2332
|
const _setTimeout = options ? options.setTimeout : setTimeout;
|
|
2333
2333
|
const activate = () => {
|
|
2334
|
-
const time = Math.min(timeout$5, internals$
|
|
2334
|
+
const time = Math.min(timeout$5, internals$28.maxTimer);
|
|
2335
2335
|
timeout$5 -= time;
|
|
2336
2336
|
_setTimeout(() => timeout$5 > 0 ? activate() : resolve(returnValue), time);
|
|
2337
2337
|
};
|
|
@@ -2363,8 +2363,169 @@ var require_lib$4 = __commonJSMin((exports) => {
|
|
|
2363
2363
|
exports.stringify = require_stringify();
|
|
2364
2364
|
exports.wait = require_wait();
|
|
2365
2365
|
});
|
|
2366
|
+
var package_exports$1 = {};
|
|
2367
|
+
__export(package_exports$1, {
|
|
2368
|
+
browser: () => browser,
|
|
2369
|
+
default: () => package_default$1,
|
|
2370
|
+
dependencies: () => dependencies$1,
|
|
2371
|
+
description: () => description$1,
|
|
2372
|
+
devDependencies: () => devDependencies$1,
|
|
2373
|
+
engines: () => engines,
|
|
2374
|
+
files: () => files$1,
|
|
2375
|
+
keywords: () => keywords$1,
|
|
2376
|
+
license: () => license$1,
|
|
2377
|
+
main: () => main$1,
|
|
2378
|
+
name: () => name$2,
|
|
2379
|
+
repository: () => repository$1,
|
|
2380
|
+
scripts: () => scripts$1,
|
|
2381
|
+
types: () => types,
|
|
2382
|
+
version: () => version$3
|
|
2383
|
+
});
|
|
2384
|
+
var name$2, description$1, version$3, repository$1, engines, main$1, types, browser, files$1, keywords$1, dependencies$1, devDependencies$1, scripts$1, license$1, package_default$1;
|
|
2385
|
+
var init_package$1 = __esmMin(() => {
|
|
2386
|
+
name$2 = "joi";
|
|
2387
|
+
description$1 = "Object schema validation";
|
|
2388
|
+
version$3 = "18.0.2";
|
|
2389
|
+
repository$1 = {
|
|
2390
|
+
"url": "git://github.com/hapijs/joi",
|
|
2391
|
+
"type": "git"
|
|
2392
|
+
};
|
|
2393
|
+
engines = { "node": ">= 20" };
|
|
2394
|
+
main$1 = "lib/index.js";
|
|
2395
|
+
types = "lib/index.d.ts";
|
|
2396
|
+
browser = "dist/joi-browser.min.js";
|
|
2397
|
+
files$1 = ["lib/**/*", "dist/*"];
|
|
2398
|
+
keywords$1 = ["schema", "validation"];
|
|
2399
|
+
dependencies$1 = {
|
|
2400
|
+
"@hapi/address": "^5.1.1",
|
|
2401
|
+
"@hapi/formula": "^3.0.2",
|
|
2402
|
+
"@hapi/hoek": "^11.0.7",
|
|
2403
|
+
"@hapi/pinpoint": "^2.0.1",
|
|
2404
|
+
"@hapi/tlds": "^1.1.1",
|
|
2405
|
+
"@hapi/topo": "^6.0.2",
|
|
2406
|
+
"@standard-schema/spec": "^1.0.0"
|
|
2407
|
+
};
|
|
2408
|
+
devDependencies$1 = {
|
|
2409
|
+
"@hapi/bourne": "^3.0.0",
|
|
2410
|
+
"@hapi/code": "^9.0.3",
|
|
2411
|
+
"@hapi/eslint-plugin": "^7.0.0",
|
|
2412
|
+
"@hapi/joi-legacy-test": "npm:@hapi/joi@15.x.x",
|
|
2413
|
+
"@hapi/lab": "^26.0.0",
|
|
2414
|
+
"@types/node": "^20.17.47",
|
|
2415
|
+
"typescript": "^5.8.3"
|
|
2416
|
+
};
|
|
2417
|
+
scripts$1 = {
|
|
2418
|
+
"prepublishOnly": "cd browser && npm install && npm run build",
|
|
2419
|
+
"test": "lab -t 100 -a @hapi/code -L -Y",
|
|
2420
|
+
"test-cov-html": "lab -r html -o coverage.html -a @hapi/code"
|
|
2421
|
+
};
|
|
2422
|
+
license$1 = "BSD-3-Clause";
|
|
2423
|
+
package_default$1 = {
|
|
2424
|
+
name: name$2,
|
|
2425
|
+
description: description$1,
|
|
2426
|
+
version: version$3,
|
|
2427
|
+
repository: repository$1,
|
|
2428
|
+
engines,
|
|
2429
|
+
main: main$1,
|
|
2430
|
+
types,
|
|
2431
|
+
browser,
|
|
2432
|
+
files: files$1,
|
|
2433
|
+
keywords: keywords$1,
|
|
2434
|
+
dependencies: dependencies$1,
|
|
2435
|
+
devDependencies: devDependencies$1,
|
|
2436
|
+
scripts: scripts$1,
|
|
2437
|
+
license: license$1
|
|
2438
|
+
};
|
|
2439
|
+
});
|
|
2440
|
+
var require_cache = __commonJSMin((exports) => {
|
|
2441
|
+
const { assert: assert$53, clone: clone$19 } = require_lib$4();
|
|
2442
|
+
const Common$25 = require_common$3();
|
|
2443
|
+
const internals$27 = {
|
|
2444
|
+
max: 1e3,
|
|
2445
|
+
supported: new Set([
|
|
2446
|
+
"undefined",
|
|
2447
|
+
"boolean",
|
|
2448
|
+
"number",
|
|
2449
|
+
"string"
|
|
2450
|
+
])
|
|
2451
|
+
};
|
|
2452
|
+
exports.provider = { provision(options) {
|
|
2453
|
+
return new internals$27.Cache(options);
|
|
2454
|
+
} };
|
|
2455
|
+
internals$27.Cache = class {
|
|
2456
|
+
constructor(options = {}) {
|
|
2457
|
+
Common$25.assertOptions(options, ["max"]);
|
|
2458
|
+
assert$53(options.max === void 0 || options.max && options.max > 0 && isFinite(options.max), "Invalid max cache size");
|
|
2459
|
+
this._max = options.max || internals$27.max;
|
|
2460
|
+
this._map = new Map();
|
|
2461
|
+
this._list = new internals$27.List();
|
|
2462
|
+
}
|
|
2463
|
+
get length() {
|
|
2464
|
+
return this._map.size;
|
|
2465
|
+
}
|
|
2466
|
+
set(key, value) {
|
|
2467
|
+
if (key !== null && !internals$27.supported.has(typeof key)) return;
|
|
2468
|
+
let node = this._map.get(key);
|
|
2469
|
+
if (node) {
|
|
2470
|
+
node.value = value;
|
|
2471
|
+
this._list.first(node);
|
|
2472
|
+
return;
|
|
2473
|
+
}
|
|
2474
|
+
node = this._list.unshift({
|
|
2475
|
+
key,
|
|
2476
|
+
value
|
|
2477
|
+
});
|
|
2478
|
+
this._map.set(key, node);
|
|
2479
|
+
this._compact();
|
|
2480
|
+
}
|
|
2481
|
+
get(key) {
|
|
2482
|
+
const node = this._map.get(key);
|
|
2483
|
+
if (node) {
|
|
2484
|
+
this._list.first(node);
|
|
2485
|
+
return clone$19(node.value);
|
|
2486
|
+
}
|
|
2487
|
+
}
|
|
2488
|
+
_compact() {
|
|
2489
|
+
if (this._map.size > this._max) {
|
|
2490
|
+
const node = this._list.pop();
|
|
2491
|
+
this._map.delete(node.key);
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2494
|
+
};
|
|
2495
|
+
internals$27.List = class {
|
|
2496
|
+
constructor() {
|
|
2497
|
+
this.tail = null;
|
|
2498
|
+
this.head = null;
|
|
2499
|
+
}
|
|
2500
|
+
unshift(node) {
|
|
2501
|
+
node.next = null;
|
|
2502
|
+
node.prev = this.head;
|
|
2503
|
+
if (this.head) this.head.next = node;
|
|
2504
|
+
this.head = node;
|
|
2505
|
+
if (!this.tail) this.tail = node;
|
|
2506
|
+
return node;
|
|
2507
|
+
}
|
|
2508
|
+
first(node) {
|
|
2509
|
+
if (node === this.head) return;
|
|
2510
|
+
this._remove(node);
|
|
2511
|
+
this.unshift(node);
|
|
2512
|
+
}
|
|
2513
|
+
pop() {
|
|
2514
|
+
return this._remove(this.tail);
|
|
2515
|
+
}
|
|
2516
|
+
_remove(node) {
|
|
2517
|
+
const { next, prev } = node;
|
|
2518
|
+
next.prev = prev;
|
|
2519
|
+
if (prev) prev.next = next;
|
|
2520
|
+
if (node === this.tail) this.tail = next;
|
|
2521
|
+
node.prev = null;
|
|
2522
|
+
node.next = null;
|
|
2523
|
+
return node;
|
|
2524
|
+
}
|
|
2525
|
+
};
|
|
2526
|
+
});
|
|
2366
2527
|
var require_lib$3 = __commonJSMin((exports) => {
|
|
2367
|
-
const internals$
|
|
2528
|
+
const internals$26 = {
|
|
2368
2529
|
operators: [
|
|
2369
2530
|
"!",
|
|
2370
2531
|
"^",
|
|
@@ -2430,7 +2591,7 @@ var require_lib$3 = __commonJSMin((exports) => {
|
|
|
2430
2591
|
};
|
|
2431
2592
|
exports.Parser = class {
|
|
2432
2593
|
constructor(string, options = {}) {
|
|
2433
|
-
if (!options[internals$
|
|
2594
|
+
if (!options[internals$26.settings] && options.constants) for (const constant$3 in options.constants) {
|
|
2434
2595
|
const value = options.constants[constant$3];
|
|
2435
2596
|
if (value !== null && ![
|
|
2436
2597
|
"boolean",
|
|
@@ -2438,8 +2599,8 @@ var require_lib$3 = __commonJSMin((exports) => {
|
|
|
2438
2599
|
"string"
|
|
2439
2600
|
].includes(typeof value)) throw new Error(`Formula constant ${constant$3} contains invalid ${typeof value} value type`);
|
|
2440
2601
|
}
|
|
2441
|
-
this.settings = options[internals$
|
|
2442
|
-
[internals$
|
|
2602
|
+
this.settings = options[internals$26.settings] ? options : Object.assign({
|
|
2603
|
+
[internals$26.settings]: true,
|
|
2443
2604
|
constants: {},
|
|
2444
2605
|
functions: {}
|
|
2445
2606
|
}, options);
|
|
@@ -2481,12 +2642,12 @@ var require_lib$3 = __commonJSMin((exports) => {
|
|
|
2481
2642
|
type: "literal",
|
|
2482
2643
|
value: current
|
|
2483
2644
|
});
|
|
2484
|
-
} else if (internals$
|
|
2645
|
+
} else if (internals$26.operatorCharacters.includes(current)) if (last$2 && last$2.type === "operator" && internals$26.operators.includes(last$2.value + current)) last$2.value += current;
|
|
2485
2646
|
else parts.push({
|
|
2486
2647
|
type: "operator",
|
|
2487
2648
|
value: current
|
|
2488
2649
|
});
|
|
2489
|
-
else if (current.match(internals$
|
|
2650
|
+
else if (current.match(internals$26.numberRx)) parts.push({
|
|
2490
2651
|
type: "constant",
|
|
2491
2652
|
value: parseFloat(current)
|
|
2492
2653
|
});
|
|
@@ -2495,7 +2656,7 @@ var require_lib$3 = __commonJSMin((exports) => {
|
|
|
2495
2656
|
value: this.settings.constants[current]
|
|
2496
2657
|
});
|
|
2497
2658
|
else {
|
|
2498
|
-
if (!current.match(internals$
|
|
2659
|
+
if (!current.match(internals$26.tokenRx)) throw new Error(`Formula contains invalid token: ${current}`);
|
|
2499
2660
|
parts.push({
|
|
2500
2661
|
type: "reference",
|
|
2501
2662
|
value: current
|
|
@@ -2515,11 +2676,11 @@ var require_lib$3 = __commonJSMin((exports) => {
|
|
|
2515
2676
|
if (!parenthesis) flush(c);
|
|
2516
2677
|
else current += c;
|
|
2517
2678
|
} else current += c;
|
|
2518
|
-
else if (c in internals$
|
|
2679
|
+
else if (c in internals$26.literals) literal = internals$26.literals[c];
|
|
2519
2680
|
else if (c === "(") {
|
|
2520
2681
|
flush();
|
|
2521
2682
|
++parenthesis;
|
|
2522
|
-
} else if (internals$
|
|
2683
|
+
} else if (internals$26.operatorCharacters.includes(c)) {
|
|
2523
2684
|
flush();
|
|
2524
2685
|
current = c;
|
|
2525
2686
|
flush();
|
|
@@ -2536,9 +2697,9 @@ var require_lib$3 = __commonJSMin((exports) => {
|
|
|
2536
2697
|
let operator$1 = false;
|
|
2537
2698
|
for (const part of parts) {
|
|
2538
2699
|
if (part.type === "operator") {
|
|
2539
|
-
if (internals$
|
|
2700
|
+
if (internals$26.operatorsPrefix.includes(part.value)) continue;
|
|
2540
2701
|
if (!operator$1) throw new Error("Formula contains an operator in invalid position");
|
|
2541
|
-
if (!internals$
|
|
2702
|
+
if (!internals$26.operators.includes(part.value)) throw new Error(`Formula contains an unknown operator ${part.value}`);
|
|
2542
2703
|
} else if (operator$1) throw new Error("Formula missing expected operator");
|
|
2543
2704
|
operator$1 = !operator$1;
|
|
2544
2705
|
}
|
|
@@ -2552,11 +2713,11 @@ var require_lib$3 = __commonJSMin((exports) => {
|
|
|
2552
2713
|
value: parts[0].value
|
|
2553
2714
|
};
|
|
2554
2715
|
this._parts = parts.map((part) => {
|
|
2555
|
-
if (part.type === "operator") return internals$
|
|
2716
|
+
if (part.type === "operator") return internals$26.operatorsPrefix.includes(part.value) ? part : part.value;
|
|
2556
2717
|
if (part.type !== "reference") return part.value;
|
|
2557
2718
|
if (this.settings.tokenRx && !this.settings.tokenRx.test(part.value)) throw new Error(`Formula contains invalid reference ${part.value}`);
|
|
2558
2719
|
if (this.settings.reference) return this.settings.reference(part.value);
|
|
2559
|
-
return internals$
|
|
2720
|
+
return internals$26.reference(part.value);
|
|
2560
2721
|
});
|
|
2561
2722
|
}
|
|
2562
2723
|
_subFormula(string, name$3) {
|
|
@@ -2577,9 +2738,9 @@ var require_lib$3 = __commonJSMin((exports) => {
|
|
|
2577
2738
|
if (literal) {
|
|
2578
2739
|
current += c;
|
|
2579
2740
|
if (c === literal) literal = false;
|
|
2580
|
-
} else if (c in internals$
|
|
2741
|
+
} else if (c in internals$26.literals && !parenthesis) {
|
|
2581
2742
|
current += c;
|
|
2582
|
-
literal = internals$
|
|
2743
|
+
literal = internals$26.literals[c];
|
|
2583
2744
|
} else if (c === "," && !parenthesis) flush();
|
|
2584
2745
|
else {
|
|
2585
2746
|
current += c;
|
|
@@ -2603,47 +2764,47 @@ var require_lib$3 = __commonJSMin((exports) => {
|
|
|
2603
2764
|
if (part && part.type === "operator") {
|
|
2604
2765
|
const current = parts[i$1 + 1];
|
|
2605
2766
|
parts.splice(i$1 + 1, 1);
|
|
2606
|
-
const value = internals$
|
|
2607
|
-
parts[i$1] = internals$
|
|
2767
|
+
const value = internals$26.evaluate(current, context);
|
|
2768
|
+
parts[i$1] = internals$26.single(part.value, value);
|
|
2608
2769
|
}
|
|
2609
2770
|
}
|
|
2610
|
-
internals$
|
|
2771
|
+
internals$26.operatorsOrder.forEach((set) => {
|
|
2611
2772
|
for (let i$1 = 1; i$1 < parts.length - 1;) if (set.includes(parts[i$1])) {
|
|
2612
2773
|
const operator$1 = parts[i$1];
|
|
2613
|
-
const left = internals$
|
|
2614
|
-
const right = internals$
|
|
2774
|
+
const left = internals$26.evaluate(parts[i$1 - 1], context);
|
|
2775
|
+
const right = internals$26.evaluate(parts[i$1 + 1], context);
|
|
2615
2776
|
parts.splice(i$1, 2);
|
|
2616
|
-
const result = internals$
|
|
2777
|
+
const result = internals$26.calculate(operator$1, left, right);
|
|
2617
2778
|
parts[i$1 - 1] = result === 0 ? 0 : result;
|
|
2618
2779
|
} else i$1 += 2;
|
|
2619
2780
|
});
|
|
2620
|
-
return internals$
|
|
2781
|
+
return internals$26.evaluate(parts[0], context);
|
|
2621
2782
|
}
|
|
2622
2783
|
};
|
|
2623
|
-
exports.Parser.prototype[internals$
|
|
2624
|
-
internals$
|
|
2784
|
+
exports.Parser.prototype[internals$26.symbol] = true;
|
|
2785
|
+
internals$26.reference = function(name$3) {
|
|
2625
2786
|
return function(context) {
|
|
2626
2787
|
return context && context[name$3] !== void 0 ? context[name$3] : null;
|
|
2627
2788
|
};
|
|
2628
2789
|
};
|
|
2629
|
-
internals$
|
|
2790
|
+
internals$26.evaluate = function(part, context) {
|
|
2630
2791
|
if (part === null) return null;
|
|
2631
2792
|
if (typeof part === "function") return part(context);
|
|
2632
|
-
if (part[internals$
|
|
2793
|
+
if (part[internals$26.symbol]) return part.evaluate(context);
|
|
2633
2794
|
return part;
|
|
2634
2795
|
};
|
|
2635
|
-
internals$
|
|
2796
|
+
internals$26.single = function(operator$1, value) {
|
|
2636
2797
|
if (operator$1 === "!") return value ? false : true;
|
|
2637
2798
|
const negative = -value;
|
|
2638
2799
|
if (negative === 0) return 0;
|
|
2639
2800
|
return negative;
|
|
2640
2801
|
};
|
|
2641
|
-
internals$
|
|
2642
|
-
if (operator$1 === "??") return internals$
|
|
2802
|
+
internals$26.calculate = function(operator$1, left, right) {
|
|
2803
|
+
if (operator$1 === "??") return internals$26.exists(left) ? left : right;
|
|
2643
2804
|
if (typeof left === "string" || typeof right === "string") {
|
|
2644
2805
|
if (operator$1 === "+") {
|
|
2645
|
-
left = internals$
|
|
2646
|
-
right = internals$
|
|
2806
|
+
left = internals$26.exists(left) ? left : "";
|
|
2807
|
+
right = internals$26.exists(right) ? right : "";
|
|
2647
2808
|
return left + right;
|
|
2648
2809
|
}
|
|
2649
2810
|
} else switch (operator$1) {
|
|
@@ -2666,267 +2827,17 @@ var require_lib$3 = __commonJSMin((exports) => {
|
|
|
2666
2827
|
}
|
|
2667
2828
|
return null;
|
|
2668
2829
|
};
|
|
2669
|
-
internals$
|
|
2830
|
+
internals$26.exists = function(value) {
|
|
2670
2831
|
return value !== null && value !== void 0;
|
|
2671
2832
|
};
|
|
2672
2833
|
});
|
|
2673
|
-
var require_ref$2 = __commonJSMin((exports) => {
|
|
2674
|
-
const { assert: assert$53, clone: clone$19, reach: reach$4 } = require_lib$4();
|
|
2675
|
-
const Common$25 = require_common$3();
|
|
2676
|
-
let Template$7;
|
|
2677
|
-
const internals$27 = {
|
|
2678
|
-
symbol: Symbol("ref"),
|
|
2679
|
-
defaults: {
|
|
2680
|
-
adjust: null,
|
|
2681
|
-
in: false,
|
|
2682
|
-
iterables: null,
|
|
2683
|
-
map: null,
|
|
2684
|
-
separator: ".",
|
|
2685
|
-
type: "value"
|
|
2686
|
-
}
|
|
2687
|
-
};
|
|
2688
|
-
exports.create = function(key, options = {}) {
|
|
2689
|
-
assert$53(typeof key === "string", "Invalid reference key:", key);
|
|
2690
|
-
Common$25.assertOptions(options, [
|
|
2691
|
-
"adjust",
|
|
2692
|
-
"ancestor",
|
|
2693
|
-
"in",
|
|
2694
|
-
"iterables",
|
|
2695
|
-
"map",
|
|
2696
|
-
"prefix",
|
|
2697
|
-
"render",
|
|
2698
|
-
"separator"
|
|
2699
|
-
]);
|
|
2700
|
-
assert$53(!options.prefix || typeof options.prefix === "object", "options.prefix must be of type object");
|
|
2701
|
-
const ref = Object.assign({}, internals$27.defaults, options);
|
|
2702
|
-
delete ref.prefix;
|
|
2703
|
-
const separator = ref.separator;
|
|
2704
|
-
const context = internals$27.context(key, separator, options.prefix);
|
|
2705
|
-
ref.type = context.type;
|
|
2706
|
-
key = context.key;
|
|
2707
|
-
if (ref.type === "value") {
|
|
2708
|
-
if (context.root) {
|
|
2709
|
-
assert$53(!separator || key[0] !== separator, "Cannot specify relative path with root prefix");
|
|
2710
|
-
ref.ancestor = "root";
|
|
2711
|
-
if (!key) key = null;
|
|
2712
|
-
}
|
|
2713
|
-
if (separator && separator === key) {
|
|
2714
|
-
key = null;
|
|
2715
|
-
ref.ancestor = 0;
|
|
2716
|
-
} else if (ref.ancestor !== void 0) assert$53(!separator || !key || key[0] !== separator, "Cannot combine prefix with ancestor option");
|
|
2717
|
-
else {
|
|
2718
|
-
const [ancestor, slice$1] = internals$27.ancestor(key, separator);
|
|
2719
|
-
if (slice$1) {
|
|
2720
|
-
key = key.slice(slice$1);
|
|
2721
|
-
if (key === "") key = null;
|
|
2722
|
-
}
|
|
2723
|
-
ref.ancestor = ancestor;
|
|
2724
|
-
}
|
|
2725
|
-
}
|
|
2726
|
-
ref.path = separator ? key === null ? [] : key.split(separator) : [key];
|
|
2727
|
-
return new internals$27.Ref(ref);
|
|
2728
|
-
};
|
|
2729
|
-
exports.in = function(key, options = {}) {
|
|
2730
|
-
return exports.create(key, {
|
|
2731
|
-
...options,
|
|
2732
|
-
in: true
|
|
2733
|
-
});
|
|
2734
|
-
};
|
|
2735
|
-
exports.isRef = function(ref) {
|
|
2736
|
-
return ref ? !!ref[Common$25.symbols.ref] : false;
|
|
2737
|
-
};
|
|
2738
|
-
internals$27.Ref = class {
|
|
2739
|
-
constructor(options) {
|
|
2740
|
-
assert$53(typeof options === "object", "Invalid reference construction");
|
|
2741
|
-
Common$25.assertOptions(options, [
|
|
2742
|
-
"adjust",
|
|
2743
|
-
"ancestor",
|
|
2744
|
-
"in",
|
|
2745
|
-
"iterables",
|
|
2746
|
-
"map",
|
|
2747
|
-
"path",
|
|
2748
|
-
"render",
|
|
2749
|
-
"separator",
|
|
2750
|
-
"type",
|
|
2751
|
-
"depth",
|
|
2752
|
-
"key",
|
|
2753
|
-
"root",
|
|
2754
|
-
"display"
|
|
2755
|
-
]);
|
|
2756
|
-
assert$53([false, void 0].includes(options.separator) || typeof options.separator === "string" && options.separator.length === 1, "Invalid separator");
|
|
2757
|
-
assert$53(!options.adjust || typeof options.adjust === "function", "options.adjust must be a function");
|
|
2758
|
-
assert$53(!options.map || Array.isArray(options.map), "options.map must be an array");
|
|
2759
|
-
assert$53(!options.map || !options.adjust, "Cannot set both map and adjust options");
|
|
2760
|
-
Object.assign(this, internals$27.defaults, options);
|
|
2761
|
-
assert$53(this.type === "value" || this.ancestor === void 0, "Non-value references cannot reference ancestors");
|
|
2762
|
-
if (Array.isArray(this.map)) this.map = new Map(this.map);
|
|
2763
|
-
this.depth = this.path.length;
|
|
2764
|
-
this.key = this.path.length ? this.path.join(this.separator) : null;
|
|
2765
|
-
this.root = this.path[0];
|
|
2766
|
-
this.updateDisplay();
|
|
2767
|
-
}
|
|
2768
|
-
resolve(value, state, prefs, local, options = {}) {
|
|
2769
|
-
assert$53(!this.in || options.in, "Invalid in() reference usage");
|
|
2770
|
-
if (this.type === "global") return this._resolve(prefs.context, state, options);
|
|
2771
|
-
if (this.type === "local") return this._resolve(local, state, options);
|
|
2772
|
-
if (!this.ancestor) return this._resolve(value, state, options);
|
|
2773
|
-
if (this.ancestor === "root") return this._resolve(state.ancestors[state.ancestors.length - 1], state, options);
|
|
2774
|
-
assert$53(this.ancestor <= state.ancestors.length, "Invalid reference exceeds the schema root:", this.display);
|
|
2775
|
-
return this._resolve(state.ancestors[this.ancestor - 1], state, options);
|
|
2776
|
-
}
|
|
2777
|
-
_resolve(target, state, options) {
|
|
2778
|
-
let resolved;
|
|
2779
|
-
if (this.type === "value" && state.mainstay.shadow && options.shadow !== false) resolved = state.mainstay.shadow.get(this.absolute(state));
|
|
2780
|
-
if (resolved === void 0) resolved = reach$4(target, this.path, {
|
|
2781
|
-
iterables: this.iterables,
|
|
2782
|
-
functions: true
|
|
2783
|
-
});
|
|
2784
|
-
if (this.adjust) resolved = this.adjust(resolved);
|
|
2785
|
-
if (this.map) {
|
|
2786
|
-
const mapped = this.map.get(resolved);
|
|
2787
|
-
if (mapped !== void 0) resolved = mapped;
|
|
2788
|
-
}
|
|
2789
|
-
if (state.mainstay) state.mainstay.tracer.resolve(state, this, resolved);
|
|
2790
|
-
return resolved;
|
|
2791
|
-
}
|
|
2792
|
-
toString() {
|
|
2793
|
-
return this.display;
|
|
2794
|
-
}
|
|
2795
|
-
absolute(state) {
|
|
2796
|
-
return [...state.path.slice(0, -this.ancestor), ...this.path];
|
|
2797
|
-
}
|
|
2798
|
-
clone() {
|
|
2799
|
-
return new internals$27.Ref(this);
|
|
2800
|
-
}
|
|
2801
|
-
describe() {
|
|
2802
|
-
const ref = { path: this.path };
|
|
2803
|
-
if (this.type !== "value") ref.type = this.type;
|
|
2804
|
-
if (this.separator !== ".") ref.separator = this.separator;
|
|
2805
|
-
if (this.type === "value" && this.ancestor !== 1) ref.ancestor = this.ancestor;
|
|
2806
|
-
if (this.map) ref.map = [...this.map];
|
|
2807
|
-
for (const key of [
|
|
2808
|
-
"adjust",
|
|
2809
|
-
"iterables",
|
|
2810
|
-
"render"
|
|
2811
|
-
]) if (this[key] !== null && this[key] !== void 0) ref[key] = this[key];
|
|
2812
|
-
if (this.in !== false) ref.in = true;
|
|
2813
|
-
return { ref };
|
|
2814
|
-
}
|
|
2815
|
-
updateDisplay() {
|
|
2816
|
-
const key = this.key !== null ? this.key : "";
|
|
2817
|
-
if (this.type !== "value") {
|
|
2818
|
-
this.display = `ref:${this.type}:${key}`;
|
|
2819
|
-
return;
|
|
2820
|
-
}
|
|
2821
|
-
if (!this.separator) {
|
|
2822
|
-
this.display = `ref:${key}`;
|
|
2823
|
-
return;
|
|
2824
|
-
}
|
|
2825
|
-
if (!this.ancestor) {
|
|
2826
|
-
this.display = `ref:${this.separator}${key}`;
|
|
2827
|
-
return;
|
|
2828
|
-
}
|
|
2829
|
-
if (this.ancestor === "root") {
|
|
2830
|
-
this.display = `ref:root:${key}`;
|
|
2831
|
-
return;
|
|
2832
|
-
}
|
|
2833
|
-
if (this.ancestor === 1) {
|
|
2834
|
-
this.display = `ref:${key || ".."}`;
|
|
2835
|
-
return;
|
|
2836
|
-
}
|
|
2837
|
-
const lead = new Array(this.ancestor + 1).fill(this.separator).join("");
|
|
2838
|
-
this.display = `ref:${lead}${key || ""}`;
|
|
2839
|
-
}
|
|
2840
|
-
};
|
|
2841
|
-
internals$27.Ref.prototype[Common$25.symbols.ref] = true;
|
|
2842
|
-
exports.build = function(desc$1) {
|
|
2843
|
-
desc$1 = Object.assign({}, internals$27.defaults, desc$1);
|
|
2844
|
-
if (desc$1.type === "value" && desc$1.ancestor === void 0) desc$1.ancestor = 1;
|
|
2845
|
-
return new internals$27.Ref(desc$1);
|
|
2846
|
-
};
|
|
2847
|
-
internals$27.context = function(key, separator, prefix = {}) {
|
|
2848
|
-
key = key.trim();
|
|
2849
|
-
if (prefix) {
|
|
2850
|
-
const globalp = prefix.global === void 0 ? "$" : prefix.global;
|
|
2851
|
-
if (globalp !== separator && key.startsWith(globalp)) return {
|
|
2852
|
-
key: key.slice(globalp.length),
|
|
2853
|
-
type: "global"
|
|
2854
|
-
};
|
|
2855
|
-
const local = prefix.local === void 0 ? "#" : prefix.local;
|
|
2856
|
-
if (local !== separator && key.startsWith(local)) return {
|
|
2857
|
-
key: key.slice(local.length),
|
|
2858
|
-
type: "local"
|
|
2859
|
-
};
|
|
2860
|
-
const root$11 = prefix.root === void 0 ? "/" : prefix.root;
|
|
2861
|
-
if (root$11 !== separator && key.startsWith(root$11)) return {
|
|
2862
|
-
key: key.slice(root$11.length),
|
|
2863
|
-
type: "value",
|
|
2864
|
-
root: true
|
|
2865
|
-
};
|
|
2866
|
-
}
|
|
2867
|
-
return {
|
|
2868
|
-
key,
|
|
2869
|
-
type: "value"
|
|
2870
|
-
};
|
|
2871
|
-
};
|
|
2872
|
-
internals$27.ancestor = function(key, separator) {
|
|
2873
|
-
if (!separator) return [1, 0];
|
|
2874
|
-
if (key[0] !== separator) return [1, 0];
|
|
2875
|
-
if (key[1] !== separator) return [0, 1];
|
|
2876
|
-
let i$1 = 2;
|
|
2877
|
-
while (key[i$1] === separator) ++i$1;
|
|
2878
|
-
return [i$1 - 1, i$1];
|
|
2879
|
-
};
|
|
2880
|
-
exports.toSibling = 0;
|
|
2881
|
-
exports.toParent = 1;
|
|
2882
|
-
exports.Manager = class {
|
|
2883
|
-
constructor() {
|
|
2884
|
-
this.refs = [];
|
|
2885
|
-
}
|
|
2886
|
-
register(source, target) {
|
|
2887
|
-
if (!source) return;
|
|
2888
|
-
target = target === void 0 ? exports.toParent : target;
|
|
2889
|
-
if (Array.isArray(source)) {
|
|
2890
|
-
for (const ref of source) this.register(ref, target);
|
|
2891
|
-
return;
|
|
2892
|
-
}
|
|
2893
|
-
if (Common$25.isSchema(source)) {
|
|
2894
|
-
for (const item of source._refs.refs) if (item.ancestor - target >= 0) this.refs.push({
|
|
2895
|
-
ancestor: item.ancestor - target,
|
|
2896
|
-
root: item.root
|
|
2897
|
-
});
|
|
2898
|
-
return;
|
|
2899
|
-
}
|
|
2900
|
-
if (exports.isRef(source) && source.type === "value" && source.ancestor - target >= 0) this.refs.push({
|
|
2901
|
-
ancestor: source.ancestor - target,
|
|
2902
|
-
root: source.root
|
|
2903
|
-
});
|
|
2904
|
-
Template$7 = Template$7 || require_template();
|
|
2905
|
-
if (Template$7.isTemplate(source)) this.register(source.refs(), target);
|
|
2906
|
-
}
|
|
2907
|
-
get length() {
|
|
2908
|
-
return this.refs.length;
|
|
2909
|
-
}
|
|
2910
|
-
clone() {
|
|
2911
|
-
const copy$1 = new exports.Manager();
|
|
2912
|
-
copy$1.refs = clone$19(this.refs);
|
|
2913
|
-
return copy$1;
|
|
2914
|
-
}
|
|
2915
|
-
reset() {
|
|
2916
|
-
this.refs = [];
|
|
2917
|
-
}
|
|
2918
|
-
roots() {
|
|
2919
|
-
return this.refs.filter((ref) => !ref.ancestor).map((ref) => ref.root);
|
|
2920
|
-
}
|
|
2921
|
-
};
|
|
2922
|
-
});
|
|
2923
2834
|
var require_template = __commonJSMin((exports, module) => {
|
|
2924
2835
|
const { assert: assert$52, clone: clone$18, escapeHtml: escapeHtml$1 } = require_lib$4();
|
|
2925
2836
|
const Formula = require_lib$3();
|
|
2926
2837
|
const Common$24 = require_common$3();
|
|
2927
2838
|
const Errors$8 = require_errors$2();
|
|
2928
2839
|
const Ref$12 = require_ref$2();
|
|
2929
|
-
const internals$
|
|
2840
|
+
const internals$25 = {
|
|
2930
2841
|
symbol: Symbol("template"),
|
|
2931
2842
|
opens: new Array(1e3).join("\0"),
|
|
2932
2843
|
closes: new Array(1e3).join(""),
|
|
@@ -2938,7 +2849,7 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
2938
2849
|
utc: Date.prototype.toUTCString
|
|
2939
2850
|
}
|
|
2940
2851
|
};
|
|
2941
|
-
module.exports = exports = internals$
|
|
2852
|
+
module.exports = exports = internals$25.Template = class {
|
|
2942
2853
|
constructor(source, options) {
|
|
2943
2854
|
assert$52(typeof source === "string", "Template source must be a string");
|
|
2944
2855
|
assert$52(!source.includes("\0") && !source.includes(""), "Template source cannot contain reserved control characters");
|
|
@@ -2961,8 +2872,8 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
2961
2872
|
}
|
|
2962
2873
|
_parse() {
|
|
2963
2874
|
if (!this.source.includes("{")) return;
|
|
2964
|
-
const encoded = internals$
|
|
2965
|
-
const parts = internals$
|
|
2875
|
+
const encoded = internals$25.encode(this.source);
|
|
2876
|
+
const parts = internals$25.split(encoded);
|
|
2966
2877
|
let refs = false;
|
|
2967
2878
|
const processed = [];
|
|
2968
2879
|
const head$1 = parts.shift();
|
|
@@ -2972,20 +2883,20 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
2972
2883
|
const ender = raw ? "}" : "}}";
|
|
2973
2884
|
const end = part.indexOf(ender);
|
|
2974
2885
|
if (end === -1 || part[1] === "{") {
|
|
2975
|
-
processed.push(`{${internals$
|
|
2886
|
+
processed.push(`{${internals$25.decode(part)}`);
|
|
2976
2887
|
continue;
|
|
2977
2888
|
}
|
|
2978
2889
|
let variable = part.slice(raw ? 0 : 1, end);
|
|
2979
2890
|
const wrapped = variable[0] === ":";
|
|
2980
2891
|
if (wrapped) variable = variable.slice(1);
|
|
2981
|
-
const dynamic = this._ref(internals$
|
|
2892
|
+
const dynamic = this._ref(internals$25.decode(variable), {
|
|
2982
2893
|
raw,
|
|
2983
2894
|
wrapped
|
|
2984
2895
|
});
|
|
2985
2896
|
processed.push(dynamic);
|
|
2986
2897
|
if (typeof dynamic !== "string") refs = true;
|
|
2987
2898
|
const rest = part.slice(end + ender.length);
|
|
2988
|
-
if (rest) processed.push(internals$
|
|
2899
|
+
if (rest) processed.push(internals$25.decode(rest));
|
|
2989
2900
|
}
|
|
2990
2901
|
if (!refs) {
|
|
2991
2902
|
this.rendered = processed.join("");
|
|
@@ -2994,7 +2905,7 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
2994
2905
|
this._template = processed;
|
|
2995
2906
|
}
|
|
2996
2907
|
static date(date, prefs) {
|
|
2997
|
-
return internals$
|
|
2908
|
+
return internals$25.dateFormat[prefs.dateFormat].call(date);
|
|
2998
2909
|
}
|
|
2999
2910
|
describe(options = {}) {
|
|
3000
2911
|
if (!this._settings && options.compact) return this.source;
|
|
@@ -3004,7 +2915,7 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
3004
2915
|
return desc$1;
|
|
3005
2916
|
}
|
|
3006
2917
|
static build(desc$1) {
|
|
3007
|
-
return new internals$
|
|
2918
|
+
return new internals$25.Template(desc$1.template, desc$1.options || desc$1.functions ? {
|
|
3008
2919
|
...desc$1.options,
|
|
3009
2920
|
functions: desc$1.functions
|
|
3010
2921
|
} : void 0);
|
|
@@ -3035,10 +2946,10 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
3035
2946
|
for (const part of this._template) if (typeof part === "string") parts.push(part);
|
|
3036
2947
|
else {
|
|
3037
2948
|
const rendered = this._part(part, value, state, prefs, local, options);
|
|
3038
|
-
const string = internals$
|
|
2949
|
+
const string = internals$25.stringify(rendered, value, state, prefs, local, options);
|
|
3039
2950
|
if (string !== void 0) {
|
|
3040
2951
|
const result = part.raw || (options.errors && options.errors.escapeHtml) === false ? string : escapeHtml$1(string);
|
|
3041
|
-
parts.push(internals$
|
|
2952
|
+
parts.push(internals$25.wrap(result, part.wrapped && prefs.errors.wrap.label));
|
|
3042
2953
|
}
|
|
3043
2954
|
}
|
|
3044
2955
|
return parts.join("");
|
|
@@ -3055,13 +2966,13 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
3055
2966
|
};
|
|
3056
2967
|
try {
|
|
3057
2968
|
const functions = this._functions ? {
|
|
3058
|
-
...internals$
|
|
2969
|
+
...internals$25.functions,
|
|
3059
2970
|
...this._functions
|
|
3060
|
-
} : internals$
|
|
2971
|
+
} : internals$25.functions;
|
|
3061
2972
|
var formula = new Formula.Parser(content, {
|
|
3062
2973
|
reference,
|
|
3063
2974
|
functions,
|
|
3064
|
-
constants: internals$
|
|
2975
|
+
constants: internals$25.constants
|
|
3065
2976
|
});
|
|
3066
2977
|
} catch (err) {
|
|
3067
2978
|
err.message = `Invalid template variable "${content}" fails due to: ${err.message}`;
|
|
@@ -3077,7 +2988,7 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
3077
2988
|
wrapped: wrapped || ref.type === "local" && ref.key === "label"
|
|
3078
2989
|
};
|
|
3079
2990
|
}
|
|
3080
|
-
return internals$
|
|
2991
|
+
return internals$25.stringify(formula.single.value);
|
|
3081
2992
|
}
|
|
3082
2993
|
return {
|
|
3083
2994
|
formula,
|
|
@@ -3089,19 +3000,19 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
3089
3000
|
return this.source;
|
|
3090
3001
|
}
|
|
3091
3002
|
};
|
|
3092
|
-
internals$
|
|
3093
|
-
internals$
|
|
3094
|
-
internals$
|
|
3003
|
+
internals$25.Template.prototype[Common$24.symbols.template] = true;
|
|
3004
|
+
internals$25.Template.prototype.isImmutable = true;
|
|
3005
|
+
internals$25.encode = function(string) {
|
|
3095
3006
|
return string.replace(/\\(\{+)/g, ($0, $1) => {
|
|
3096
|
-
return internals$
|
|
3007
|
+
return internals$25.opens.slice(0, $1.length);
|
|
3097
3008
|
}).replace(/\\(\}+)/g, ($0, $1) => {
|
|
3098
|
-
return internals$
|
|
3009
|
+
return internals$25.closes.slice(0, $1.length);
|
|
3099
3010
|
});
|
|
3100
3011
|
};
|
|
3101
|
-
internals$
|
|
3012
|
+
internals$25.decode = function(string) {
|
|
3102
3013
|
return string.replace(/\u0000/g, "{").replace(/\u0001/g, "}");
|
|
3103
3014
|
};
|
|
3104
|
-
internals$
|
|
3015
|
+
internals$25.split = function(string) {
|
|
3105
3016
|
const parts = [];
|
|
3106
3017
|
let current = "";
|
|
3107
3018
|
for (let i$1 = 0; i$1 < string.length; ++i$1) {
|
|
@@ -3119,12 +3030,12 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
3119
3030
|
parts.push(current);
|
|
3120
3031
|
return parts;
|
|
3121
3032
|
};
|
|
3122
|
-
internals$
|
|
3033
|
+
internals$25.wrap = function(value, ends) {
|
|
3123
3034
|
if (!ends) return value;
|
|
3124
3035
|
if (ends.length === 1) return `${ends}${value}${ends}`;
|
|
3125
3036
|
return `${ends[0]}${value}${ends[1]}`;
|
|
3126
3037
|
};
|
|
3127
|
-
internals$
|
|
3038
|
+
internals$25.stringify = function(value, original, state, prefs, local, options = {}) {
|
|
3128
3039
|
const type = typeof value;
|
|
3129
3040
|
const wrap$2 = prefs && prefs.errors && prefs.errors.wrap || {};
|
|
3130
3041
|
let skipWrap = false;
|
|
@@ -3136,10 +3047,10 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
3136
3047
|
});
|
|
3137
3048
|
}
|
|
3138
3049
|
if (value === null) return "null";
|
|
3139
|
-
if (type === "string") return internals$
|
|
3050
|
+
if (type === "string") return internals$25.wrap(value, options.arrayItems && wrap$2.string);
|
|
3140
3051
|
if (type === "number" || type === "function" || type === "symbol") return value.toString();
|
|
3141
3052
|
if (type !== "object") return JSON.stringify(value);
|
|
3142
|
-
if (value instanceof Date) return internals$
|
|
3053
|
+
if (value instanceof Date) return internals$25.Template.date(value, prefs);
|
|
3143
3054
|
if (value instanceof Map) {
|
|
3144
3055
|
const pairs = [];
|
|
3145
3056
|
for (const [key, sym] of value.entries()) pairs.push(`${key.toString()} -> ${sym.toString()}`);
|
|
@@ -3147,13 +3058,13 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
3147
3058
|
}
|
|
3148
3059
|
if (!Array.isArray(value)) return value.toString();
|
|
3149
3060
|
const values$3 = [];
|
|
3150
|
-
for (const item of value) values$3.push(internals$
|
|
3061
|
+
for (const item of value) values$3.push(internals$25.stringify(item, original, state, prefs, local, {
|
|
3151
3062
|
arrayItems: true,
|
|
3152
3063
|
...options
|
|
3153
3064
|
}));
|
|
3154
|
-
return internals$
|
|
3065
|
+
return internals$25.wrap(values$3.join(", "), !skipWrap && wrap$2.array);
|
|
3155
3066
|
};
|
|
3156
|
-
internals$
|
|
3067
|
+
internals$25.constants = {
|
|
3157
3068
|
true: true,
|
|
3158
3069
|
false: false,
|
|
3159
3070
|
null: null,
|
|
@@ -3162,7 +3073,7 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
3162
3073
|
hour: 60 * 60 * 1e3,
|
|
3163
3074
|
day: 24 * 60 * 60 * 1e3
|
|
3164
3075
|
};
|
|
3165
|
-
internals$
|
|
3076
|
+
internals$25.functions = {
|
|
3166
3077
|
if(condition, then, otherwise) {
|
|
3167
3078
|
return condition ? then : otherwise;
|
|
3168
3079
|
},
|
|
@@ -3189,186 +3100,253 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
3189
3100
|
}
|
|
3190
3101
|
};
|
|
3191
3102
|
});
|
|
3192
|
-
var
|
|
3193
|
-
const { assert: assert$51, clone: clone$17 } = require_lib$4();
|
|
3194
|
-
const
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3103
|
+
var require_ref$2 = __commonJSMin((exports) => {
|
|
3104
|
+
const { assert: assert$51, clone: clone$17, reach: reach$4 } = require_lib$4();
|
|
3105
|
+
const Common$23 = require_common$3();
|
|
3106
|
+
let Template$7;
|
|
3107
|
+
const internals$24 = {
|
|
3108
|
+
symbol: Symbol("ref"),
|
|
3109
|
+
defaults: {
|
|
3110
|
+
adjust: null,
|
|
3111
|
+
in: false,
|
|
3112
|
+
iterables: null,
|
|
3113
|
+
map: null,
|
|
3114
|
+
separator: ".",
|
|
3115
|
+
type: "value"
|
|
3203
3116
|
}
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3117
|
+
};
|
|
3118
|
+
exports.create = function(key, options = {}) {
|
|
3119
|
+
assert$51(typeof key === "string", "Invalid reference key:", key);
|
|
3120
|
+
Common$23.assertOptions(options, [
|
|
3121
|
+
"adjust",
|
|
3122
|
+
"ancestor",
|
|
3123
|
+
"in",
|
|
3124
|
+
"iterables",
|
|
3125
|
+
"map",
|
|
3126
|
+
"prefix",
|
|
3127
|
+
"render",
|
|
3128
|
+
"separator"
|
|
3129
|
+
]);
|
|
3130
|
+
assert$51(!options.prefix || typeof options.prefix === "object", "options.prefix must be of type object");
|
|
3131
|
+
const ref = Object.assign({}, internals$24.defaults, options);
|
|
3132
|
+
delete ref.prefix;
|
|
3133
|
+
const separator = ref.separator;
|
|
3134
|
+
const context = internals$24.context(key, separator, options.prefix);
|
|
3135
|
+
ref.type = context.type;
|
|
3136
|
+
key = context.key;
|
|
3137
|
+
if (ref.type === "value") {
|
|
3138
|
+
if (context.root) {
|
|
3139
|
+
assert$51(!separator || key[0] !== separator, "Cannot specify relative path with root prefix");
|
|
3140
|
+
ref.ancestor = "root";
|
|
3141
|
+
if (!key) key = null;
|
|
3215
3142
|
}
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3143
|
+
if (separator && separator === key) {
|
|
3144
|
+
key = null;
|
|
3145
|
+
ref.ancestor = 0;
|
|
3146
|
+
} else if (ref.ancestor !== void 0) assert$51(!separator || !key || key[0] !== separator, "Cannot combine prefix with ancestor option");
|
|
3147
|
+
else {
|
|
3148
|
+
const [ancestor, slice$1] = internals$24.ancestor(key, separator);
|
|
3149
|
+
if (slice$1) {
|
|
3150
|
+
key = key.slice(slice$1);
|
|
3151
|
+
if (key === "") key = null;
|
|
3224
3152
|
}
|
|
3225
|
-
|
|
3226
|
-
target[language][code$1] = new Template$6(localized);
|
|
3153
|
+
ref.ancestor = ancestor;
|
|
3227
3154
|
}
|
|
3228
3155
|
}
|
|
3229
|
-
|
|
3156
|
+
ref.path = separator ? key === null ? [] : key.split(separator) : [key];
|
|
3157
|
+
return new internals$24.Ref(ref);
|
|
3230
3158
|
};
|
|
3231
|
-
exports.
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3159
|
+
exports.in = function(key, options = {}) {
|
|
3160
|
+
return exports.create(key, {
|
|
3161
|
+
...options,
|
|
3162
|
+
in: true
|
|
3163
|
+
});
|
|
3164
|
+
};
|
|
3165
|
+
exports.isRef = function(ref) {
|
|
3166
|
+
return ref ? !!ref[Common$23.symbols.ref] : false;
|
|
3167
|
+
};
|
|
3168
|
+
internals$24.Ref = class {
|
|
3169
|
+
constructor(options) {
|
|
3170
|
+
assert$51(typeof options === "object", "Invalid reference construction");
|
|
3171
|
+
Common$23.assertOptions(options, [
|
|
3172
|
+
"adjust",
|
|
3173
|
+
"ancestor",
|
|
3174
|
+
"in",
|
|
3175
|
+
"iterables",
|
|
3176
|
+
"map",
|
|
3177
|
+
"path",
|
|
3178
|
+
"render",
|
|
3179
|
+
"separator",
|
|
3180
|
+
"type",
|
|
3181
|
+
"depth",
|
|
3182
|
+
"key",
|
|
3183
|
+
"root",
|
|
3184
|
+
"display"
|
|
3185
|
+
]);
|
|
3186
|
+
assert$51([false, void 0].includes(options.separator) || typeof options.separator === "string" && options.separator.length === 1, "Invalid separator");
|
|
3187
|
+
assert$51(!options.adjust || typeof options.adjust === "function", "options.adjust must be a function");
|
|
3188
|
+
assert$51(!options.map || Array.isArray(options.map), "options.map must be an array");
|
|
3189
|
+
assert$51(!options.map || !options.adjust, "Cannot set both map and adjust options");
|
|
3190
|
+
Object.assign(this, internals$24.defaults, options);
|
|
3191
|
+
assert$51(this.type === "value" || this.ancestor === void 0, "Non-value references cannot reference ancestors");
|
|
3192
|
+
if (Array.isArray(this.map)) this.map = new Map(this.map);
|
|
3193
|
+
this.depth = this.path.length;
|
|
3194
|
+
this.key = this.path.length ? this.path.join(this.separator) : null;
|
|
3195
|
+
this.root = this.path[0];
|
|
3196
|
+
this.updateDisplay();
|
|
3197
|
+
}
|
|
3198
|
+
resolve(value, state, prefs, local, options = {}) {
|
|
3199
|
+
assert$51(!this.in || options.in, "Invalid in() reference usage");
|
|
3200
|
+
if (this.type === "global") return this._resolve(prefs.context, state, options);
|
|
3201
|
+
if (this.type === "local") return this._resolve(local, state, options);
|
|
3202
|
+
if (!this.ancestor) return this._resolve(value, state, options);
|
|
3203
|
+
if (this.ancestor === "root") return this._resolve(state.ancestors[state.ancestors.length - 1], state, options);
|
|
3204
|
+
assert$51(this.ancestor <= state.ancestors.length, "Invalid reference exceeds the schema root:", this.display);
|
|
3205
|
+
return this._resolve(state.ancestors[this.ancestor - 1], state, options);
|
|
3206
|
+
}
|
|
3207
|
+
_resolve(target, state, options) {
|
|
3208
|
+
let resolved;
|
|
3209
|
+
if (this.type === "value" && state.mainstay.shadow && options.shadow !== false) resolved = state.mainstay.shadow.get(this.absolute(state));
|
|
3210
|
+
if (resolved === void 0) resolved = reach$4(target, this.path, {
|
|
3211
|
+
iterables: this.iterables,
|
|
3212
|
+
functions: true
|
|
3213
|
+
});
|
|
3214
|
+
if (this.adjust) resolved = this.adjust(resolved);
|
|
3215
|
+
if (this.map) {
|
|
3216
|
+
const mapped = this.map.get(resolved);
|
|
3217
|
+
if (mapped !== void 0) resolved = mapped;
|
|
3238
3218
|
}
|
|
3239
|
-
if (
|
|
3240
|
-
|
|
3241
|
-
|
|
3219
|
+
if (state.mainstay) state.mainstay.tracer.resolve(state, this, resolved);
|
|
3220
|
+
return resolved;
|
|
3221
|
+
}
|
|
3222
|
+
toString() {
|
|
3223
|
+
return this.display;
|
|
3224
|
+
}
|
|
3225
|
+
absolute(state) {
|
|
3226
|
+
return [...state.path.slice(0, -this.ancestor), ...this.path];
|
|
3227
|
+
}
|
|
3228
|
+
clone() {
|
|
3229
|
+
return new internals$24.Ref(this);
|
|
3230
|
+
}
|
|
3231
|
+
describe() {
|
|
3232
|
+
const ref = { path: this.path };
|
|
3233
|
+
if (this.type !== "value") ref.type = this.type;
|
|
3234
|
+
if (this.separator !== ".") ref.separator = this.separator;
|
|
3235
|
+
if (this.type === "value" && this.ancestor !== 1) ref.ancestor = this.ancestor;
|
|
3236
|
+
if (this.map) ref.map = [...this.map];
|
|
3237
|
+
for (const key of [
|
|
3238
|
+
"adjust",
|
|
3239
|
+
"iterables",
|
|
3240
|
+
"render"
|
|
3241
|
+
]) if (this[key] !== null && this[key] !== void 0) ref[key] = this[key];
|
|
3242
|
+
if (this.in !== false) ref.in = true;
|
|
3243
|
+
return { ref };
|
|
3244
|
+
}
|
|
3245
|
+
updateDisplay() {
|
|
3246
|
+
const key = this.key !== null ? this.key : "";
|
|
3247
|
+
if (this.type !== "value") {
|
|
3248
|
+
this.display = `ref:${this.type}:${key}`;
|
|
3249
|
+
return;
|
|
3242
3250
|
}
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
const localized = message[code$1];
|
|
3247
|
-
if (code$1 === "root") {
|
|
3248
|
-
target[language].root = localized;
|
|
3249
|
-
continue;
|
|
3250
|
-
}
|
|
3251
|
-
target[language][code$1] = localized.describe({ compact: true });
|
|
3251
|
+
if (!this.separator) {
|
|
3252
|
+
this.display = `ref:${key}`;
|
|
3253
|
+
return;
|
|
3252
3254
|
}
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
exports.merge = function(base$3, extended) {
|
|
3257
|
-
if (!base$3) return exports.compile(extended);
|
|
3258
|
-
if (!extended) return base$3;
|
|
3259
|
-
if (typeof extended === "string") return new Template$6(extended);
|
|
3260
|
-
if (Template$6.isTemplate(extended)) return extended;
|
|
3261
|
-
const target = clone$17(base$3);
|
|
3262
|
-
for (let code$1 in extended) {
|
|
3263
|
-
const message = extended[code$1];
|
|
3264
|
-
if (code$1 === "root" || Template$6.isTemplate(message)) {
|
|
3265
|
-
target[code$1] = message;
|
|
3266
|
-
continue;
|
|
3255
|
+
if (!this.ancestor) {
|
|
3256
|
+
this.display = `ref:${this.separator}${key}`;
|
|
3257
|
+
return;
|
|
3267
3258
|
}
|
|
3268
|
-
if (
|
|
3269
|
-
|
|
3270
|
-
|
|
3259
|
+
if (this.ancestor === "root") {
|
|
3260
|
+
this.display = `ref:root:${key}`;
|
|
3261
|
+
return;
|
|
3271
3262
|
}
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
for (code$1 in message) {
|
|
3276
|
-
const localized = message[code$1];
|
|
3277
|
-
if (code$1 === "root" || Template$6.isTemplate(localized)) {
|
|
3278
|
-
target[language][code$1] = localized;
|
|
3279
|
-
continue;
|
|
3280
|
-
}
|
|
3281
|
-
assert$51(typeof localized === "string", "Invalid message for", code$1, "in", language);
|
|
3282
|
-
target[language][code$1] = new Template$6(localized);
|
|
3263
|
+
if (this.ancestor === 1) {
|
|
3264
|
+
this.display = `ref:${key || ".."}`;
|
|
3265
|
+
return;
|
|
3283
3266
|
}
|
|
3267
|
+
const lead = new Array(this.ancestor + 1).fill(this.separator).join("");
|
|
3268
|
+
this.display = `ref:${lead}${key || ""}`;
|
|
3284
3269
|
}
|
|
3285
|
-
return target;
|
|
3286
3270
|
};
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
max: 1e3,
|
|
3293
|
-
supported: new Set([
|
|
3294
|
-
"undefined",
|
|
3295
|
-
"boolean",
|
|
3296
|
-
"number",
|
|
3297
|
-
"string"
|
|
3298
|
-
])
|
|
3271
|
+
internals$24.Ref.prototype[Common$23.symbols.ref] = true;
|
|
3272
|
+
exports.build = function(desc$1) {
|
|
3273
|
+
desc$1 = Object.assign({}, internals$24.defaults, desc$1);
|
|
3274
|
+
if (desc$1.type === "value" && desc$1.ancestor === void 0) desc$1.ancestor = 1;
|
|
3275
|
+
return new internals$24.Ref(desc$1);
|
|
3299
3276
|
};
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3277
|
+
internals$24.context = function(key, separator, prefix = {}) {
|
|
3278
|
+
key = key.trim();
|
|
3279
|
+
if (prefix) {
|
|
3280
|
+
const globalp = prefix.global === void 0 ? "$" : prefix.global;
|
|
3281
|
+
if (globalp !== separator && key.startsWith(globalp)) return {
|
|
3282
|
+
key: key.slice(globalp.length),
|
|
3283
|
+
type: "global"
|
|
3284
|
+
};
|
|
3285
|
+
const local = prefix.local === void 0 ? "#" : prefix.local;
|
|
3286
|
+
if (local !== separator && key.startsWith(local)) return {
|
|
3287
|
+
key: key.slice(local.length),
|
|
3288
|
+
type: "local"
|
|
3289
|
+
};
|
|
3290
|
+
const root$11 = prefix.root === void 0 ? "/" : prefix.root;
|
|
3291
|
+
if (root$11 !== separator && key.startsWith(root$11)) return {
|
|
3292
|
+
key: key.slice(root$11.length),
|
|
3293
|
+
type: "value",
|
|
3294
|
+
root: true
|
|
3295
|
+
};
|
|
3310
3296
|
}
|
|
3311
|
-
|
|
3312
|
-
|
|
3297
|
+
return {
|
|
3298
|
+
key,
|
|
3299
|
+
type: "value"
|
|
3300
|
+
};
|
|
3301
|
+
};
|
|
3302
|
+
internals$24.ancestor = function(key, separator) {
|
|
3303
|
+
if (!separator) return [1, 0];
|
|
3304
|
+
if (key[0] !== separator) return [1, 0];
|
|
3305
|
+
if (key[1] !== separator) return [0, 1];
|
|
3306
|
+
let i$1 = 2;
|
|
3307
|
+
while (key[i$1] === separator) ++i$1;
|
|
3308
|
+
return [i$1 - 1, i$1];
|
|
3309
|
+
};
|
|
3310
|
+
exports.toSibling = 0;
|
|
3311
|
+
exports.toParent = 1;
|
|
3312
|
+
exports.Manager = class {
|
|
3313
|
+
constructor() {
|
|
3314
|
+
this.refs = [];
|
|
3313
3315
|
}
|
|
3314
|
-
|
|
3315
|
-
if (
|
|
3316
|
-
|
|
3317
|
-
if (
|
|
3318
|
-
|
|
3319
|
-
this._list.first(node);
|
|
3316
|
+
register(source, target) {
|
|
3317
|
+
if (!source) return;
|
|
3318
|
+
target = target === void 0 ? exports.toParent : target;
|
|
3319
|
+
if (Array.isArray(source)) {
|
|
3320
|
+
for (const ref of source) this.register(ref, target);
|
|
3320
3321
|
return;
|
|
3321
3322
|
}
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
}
|
|
3329
|
-
get(key) {
|
|
3330
|
-
const node = this._map.get(key);
|
|
3331
|
-
if (node) {
|
|
3332
|
-
this._list.first(node);
|
|
3333
|
-
return clone$16(node.value);
|
|
3334
|
-
}
|
|
3335
|
-
}
|
|
3336
|
-
_compact() {
|
|
3337
|
-
if (this._map.size > this._max) {
|
|
3338
|
-
const node = this._list.pop();
|
|
3339
|
-
this._map.delete(node.key);
|
|
3323
|
+
if (Common$23.isSchema(source)) {
|
|
3324
|
+
for (const item of source._refs.refs) if (item.ancestor - target >= 0) this.refs.push({
|
|
3325
|
+
ancestor: item.ancestor - target,
|
|
3326
|
+
root: item.root
|
|
3327
|
+
});
|
|
3328
|
+
return;
|
|
3340
3329
|
}
|
|
3330
|
+
if (exports.isRef(source) && source.type === "value" && source.ancestor - target >= 0) this.refs.push({
|
|
3331
|
+
ancestor: source.ancestor - target,
|
|
3332
|
+
root: source.root
|
|
3333
|
+
});
|
|
3334
|
+
Template$7 = Template$7 || require_template();
|
|
3335
|
+
if (Template$7.isTemplate(source)) this.register(source.refs(), target);
|
|
3341
3336
|
}
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
constructor() {
|
|
3345
|
-
this.tail = null;
|
|
3346
|
-
this.head = null;
|
|
3347
|
-
}
|
|
3348
|
-
unshift(node) {
|
|
3349
|
-
node.next = null;
|
|
3350
|
-
node.prev = this.head;
|
|
3351
|
-
if (this.head) this.head.next = node;
|
|
3352
|
-
this.head = node;
|
|
3353
|
-
if (!this.tail) this.tail = node;
|
|
3354
|
-
return node;
|
|
3337
|
+
get length() {
|
|
3338
|
+
return this.refs.length;
|
|
3355
3339
|
}
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
this.
|
|
3359
|
-
|
|
3340
|
+
clone() {
|
|
3341
|
+
const copy$1 = new exports.Manager();
|
|
3342
|
+
copy$1.refs = clone$17(this.refs);
|
|
3343
|
+
return copy$1;
|
|
3360
3344
|
}
|
|
3361
|
-
|
|
3362
|
-
|
|
3345
|
+
reset() {
|
|
3346
|
+
this.refs = [];
|
|
3363
3347
|
}
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
next.prev = prev;
|
|
3367
|
-
if (prev) prev.next = next;
|
|
3368
|
-
if (node === this.tail) this.tail = next;
|
|
3369
|
-
node.prev = null;
|
|
3370
|
-
node.next = null;
|
|
3371
|
-
return node;
|
|
3348
|
+
roots() {
|
|
3349
|
+
return this.refs.filter((ref) => !ref.ancestor).map((ref) => ref.root);
|
|
3372
3350
|
}
|
|
3373
3351
|
};
|
|
3374
3352
|
});
|
|
@@ -3397,27 +3375,23 @@ var init_lib = __esmMin(() => {
|
|
|
3397
3375
|
import_stringify = __toESM(require_stringify(), 1);
|
|
3398
3376
|
import_wait = __toESM(require_wait(), 1);
|
|
3399
3377
|
});
|
|
3400
|
-
var
|
|
3401
|
-
|
|
3402
|
-
var
|
|
3403
|
-
var init_compile = __esmMin(() => {
|
|
3404
|
-
import_ref$3 = __toESM(require_ref$2());
|
|
3405
|
-
import_common$3 = __toESM(require_common$3());
|
|
3378
|
+
var require_compile$1 = __commonJSMin((exports) => {
|
|
3379
|
+
var import_ref$3 = __toESM(require_ref$2());
|
|
3380
|
+
var import_common$3 = __toESM(require_common$3());
|
|
3406
3381
|
init_lib();
|
|
3407
|
-
Common$22 = import_common$3.default;
|
|
3408
|
-
Ref$11 = import_ref$3.default;
|
|
3409
|
-
internals$
|
|
3410
|
-
exports$
|
|
3411
|
-
exports$3.schema = function(Joi$2, config, options = {}) {
|
|
3382
|
+
const Common$22 = import_common$3.default;
|
|
3383
|
+
const Ref$11 = import_ref$3.default;
|
|
3384
|
+
const internals$23 = {};
|
|
3385
|
+
exports.schema = function(Joi$2, config, options = {}) {
|
|
3412
3386
|
Common$22.assertOptions(options, ["appendPath", "override"]);
|
|
3413
3387
|
try {
|
|
3414
|
-
return internals$
|
|
3388
|
+
return internals$23.schema(Joi$2, config, options);
|
|
3415
3389
|
} catch (err) {
|
|
3416
3390
|
if (options.appendPath && err.path !== void 0) err.message = `${err.message} (${err.path})`;
|
|
3417
3391
|
throw err;
|
|
3418
3392
|
}
|
|
3419
3393
|
};
|
|
3420
|
-
internals$
|
|
3394
|
+
internals$23.schema = function(Joi$2, config, options) {
|
|
3421
3395
|
(0, import_assert.default)(config !== void 0, "Invalid undefined schema");
|
|
3422
3396
|
if (Array.isArray(config)) {
|
|
3423
3397
|
(0, import_assert.default)(config.length, "Invalid empty array schema");
|
|
@@ -3427,13 +3401,13 @@ var init_compile = __esmMin(() => {
|
|
|
3427
3401
|
if (options.override !== false) return base$3.valid(Joi$2.override, ...values$3);
|
|
3428
3402
|
return base$3.valid(...values$3);
|
|
3429
3403
|
};
|
|
3430
|
-
if (internals$
|
|
3404
|
+
if (internals$23.simple(config)) return valid$2(Joi$2, config);
|
|
3431
3405
|
if (typeof config === "function") return Joi$2.custom(config);
|
|
3432
3406
|
(0, import_assert.default)(typeof config === "object", "Invalid schema content:", typeof config);
|
|
3433
3407
|
if (Common$22.isResolvable(config)) return valid$2(Joi$2, config);
|
|
3434
3408
|
if (Common$22.isSchema(config)) return config;
|
|
3435
3409
|
if (Array.isArray(config)) {
|
|
3436
|
-
for (const item of config) if (!internals$
|
|
3410
|
+
for (const item of config) if (!internals$23.simple(item)) return Joi$2.alternatives().try(...config);
|
|
3437
3411
|
return valid$2(Joi$2, ...config);
|
|
3438
3412
|
}
|
|
3439
3413
|
if (config instanceof RegExp) return Joi$2.string().regex(config);
|
|
@@ -3441,23 +3415,23 @@ var init_compile = __esmMin(() => {
|
|
|
3441
3415
|
(0, import_assert.default)(Object.getPrototypeOf(config) === Object.getPrototypeOf({}), "Schema can only contain plain objects");
|
|
3442
3416
|
return Joi$2.object().keys(config);
|
|
3443
3417
|
};
|
|
3444
|
-
exports
|
|
3418
|
+
exports.ref = function(id, options) {
|
|
3445
3419
|
return Ref$11.isRef(id) ? id : Ref$11.create(id, options);
|
|
3446
3420
|
};
|
|
3447
|
-
exports
|
|
3421
|
+
exports.compile = function(root$11, schema$2, options = {}) {
|
|
3448
3422
|
Common$22.assertOptions(options, ["legacy"]);
|
|
3449
3423
|
const any = schema$2 && schema$2[Common$22.symbols.any];
|
|
3450
3424
|
if (any) return schema$2;
|
|
3451
|
-
if (typeof schema$2 !== "object" || !options.legacy) return exports
|
|
3452
|
-
const compiler = internals$
|
|
3453
|
-
if (!compiler) return exports
|
|
3425
|
+
if (typeof schema$2 !== "object" || !options.legacy) return exports.schema(root$11, schema$2, { appendPath: true });
|
|
3426
|
+
const compiler = internals$23.walk(schema$2);
|
|
3427
|
+
if (!compiler) return exports.schema(root$11, schema$2, { appendPath: true });
|
|
3454
3428
|
return compiler.compile(compiler.root, schema$2);
|
|
3455
3429
|
};
|
|
3456
|
-
internals$
|
|
3430
|
+
internals$23.walk = function(schema$2) {
|
|
3457
3431
|
if (typeof schema$2 !== "object") return null;
|
|
3458
3432
|
if (Array.isArray(schema$2)) {
|
|
3459
3433
|
for (const item of schema$2) {
|
|
3460
|
-
const compiler = internals$
|
|
3434
|
+
const compiler = internals$23.walk(item);
|
|
3461
3435
|
if (compiler) return compiler;
|
|
3462
3436
|
}
|
|
3463
3437
|
return null;
|
|
@@ -3469,19 +3443,19 @@ var init_compile = __esmMin(() => {
|
|
|
3469
3443
|
};
|
|
3470
3444
|
(0, import_assert.default)(Object.getPrototypeOf(schema$2) === Object.getPrototypeOf({}), "Schema can only contain plain objects");
|
|
3471
3445
|
for (const key in schema$2) {
|
|
3472
|
-
const compiler = internals$
|
|
3446
|
+
const compiler = internals$23.walk(schema$2[key]);
|
|
3473
3447
|
if (compiler) return compiler;
|
|
3474
3448
|
}
|
|
3475
3449
|
return null;
|
|
3476
3450
|
};
|
|
3477
|
-
internals$
|
|
3451
|
+
internals$23.simple = function(value) {
|
|
3478
3452
|
return value === null || [
|
|
3479
3453
|
"boolean",
|
|
3480
3454
|
"string",
|
|
3481
3455
|
"number"
|
|
3482
3456
|
].includes(typeof value);
|
|
3483
3457
|
};
|
|
3484
|
-
exports
|
|
3458
|
+
exports.when = function(schema$2, condition, options) {
|
|
3485
3459
|
if (options === void 0) {
|
|
3486
3460
|
(0, import_assert.default)(condition && typeof condition === "object", "Missing options");
|
|
3487
3461
|
options = condition;
|
|
@@ -3500,7 +3474,7 @@ var init_compile = __esmMin(() => {
|
|
|
3500
3474
|
(0, import_assert.default)(options.is === void 0, "\"is\" can not be used with a schema condition");
|
|
3501
3475
|
(0, import_assert.default)(options.not === void 0, "\"not\" can not be used with a schema condition");
|
|
3502
3476
|
(0, import_assert.default)(options.switch === void 0, "\"switch\" can not be used with a schema condition");
|
|
3503
|
-
return internals$
|
|
3477
|
+
return internals$23.condition(schema$2, {
|
|
3504
3478
|
is: condition,
|
|
3505
3479
|
then: options.then,
|
|
3506
3480
|
otherwise: options.otherwise,
|
|
@@ -3521,8 +3495,8 @@ var init_compile = __esmMin(() => {
|
|
|
3521
3495
|
(0, import_assert.default)(rule$1.then !== void 0 || rule$1.otherwise !== void 0, "options must have at least one of \"then\", \"otherwise\", or \"switch\"");
|
|
3522
3496
|
(0, import_assert.default)(rule$1.break === void 0 || rule$1.then === void 0 || rule$1.otherwise === void 0, "Cannot specify then, otherwise, and break all together");
|
|
3523
3497
|
if (options.is !== void 0 && !Ref$11.isRef(options.is) && !Common$22.isSchema(options.is)) is = is.required();
|
|
3524
|
-
return internals$
|
|
3525
|
-
ref: exports
|
|
3498
|
+
return internals$23.condition(schema$2, {
|
|
3499
|
+
ref: exports.ref(condition),
|
|
3526
3500
|
is,
|
|
3527
3501
|
then: rule$1.then,
|
|
3528
3502
|
otherwise: rule$1.otherwise,
|
|
@@ -3534,7 +3508,7 @@ var init_compile = __esmMin(() => {
|
|
|
3534
3508
|
(0, import_assert.default)(options.not === void 0, "Cannot combine \"switch\" with \"not\"");
|
|
3535
3509
|
(0, import_assert.default)(options.then === void 0, "Cannot combine \"switch\" with \"then\"");
|
|
3536
3510
|
const rule = {
|
|
3537
|
-
ref: exports
|
|
3511
|
+
ref: exports.ref(condition),
|
|
3538
3512
|
switch: [],
|
|
3539
3513
|
break: options.break
|
|
3540
3514
|
};
|
|
@@ -3565,18 +3539,113 @@ var init_compile = __esmMin(() => {
|
|
|
3565
3539
|
}
|
|
3566
3540
|
return rule;
|
|
3567
3541
|
};
|
|
3568
|
-
internals$
|
|
3542
|
+
internals$23.condition = function(schema$2, condition) {
|
|
3569
3543
|
for (const key of ["then", "otherwise"]) if (condition[key] === void 0) delete condition[key];
|
|
3570
3544
|
else condition[key] = schema$2.$_compile(condition[key]);
|
|
3571
3545
|
return condition;
|
|
3572
3546
|
};
|
|
3573
|
-
|
|
3547
|
+
});
|
|
3548
|
+
var require_messages = __commonJSMin((exports) => {
|
|
3549
|
+
const { assert: assert$48, clone: clone$15 } = require_lib$4();
|
|
3550
|
+
const Template$6 = require_template();
|
|
3551
|
+
exports.compile = function(messages$3, target) {
|
|
3552
|
+
if (typeof messages$3 === "string") {
|
|
3553
|
+
assert$48(!target, "Cannot set single message string");
|
|
3554
|
+
return new Template$6(messages$3);
|
|
3555
|
+
}
|
|
3556
|
+
if (Template$6.isTemplate(messages$3)) {
|
|
3557
|
+
assert$48(!target, "Cannot set single message template");
|
|
3558
|
+
return messages$3;
|
|
3559
|
+
}
|
|
3560
|
+
assert$48(typeof messages$3 === "object" && !Array.isArray(messages$3), "Invalid message options");
|
|
3561
|
+
target = target ? clone$15(target) : {};
|
|
3562
|
+
for (let code$1 in messages$3) {
|
|
3563
|
+
const message = messages$3[code$1];
|
|
3564
|
+
if (code$1 === "root" || Template$6.isTemplate(message)) {
|
|
3565
|
+
target[code$1] = message;
|
|
3566
|
+
continue;
|
|
3567
|
+
}
|
|
3568
|
+
if (typeof message === "string") {
|
|
3569
|
+
target[code$1] = new Template$6(message);
|
|
3570
|
+
continue;
|
|
3571
|
+
}
|
|
3572
|
+
assert$48(typeof message === "object" && !Array.isArray(message), "Invalid message for", code$1);
|
|
3573
|
+
const language = code$1;
|
|
3574
|
+
target[language] = target[language] || {};
|
|
3575
|
+
for (code$1 in message) {
|
|
3576
|
+
const localized = message[code$1];
|
|
3577
|
+
if (code$1 === "root" || Template$6.isTemplate(localized)) {
|
|
3578
|
+
target[language][code$1] = localized;
|
|
3579
|
+
continue;
|
|
3580
|
+
}
|
|
3581
|
+
assert$48(typeof localized === "string", "Invalid message for", code$1, "in", language);
|
|
3582
|
+
target[language][code$1] = new Template$6(localized);
|
|
3583
|
+
}
|
|
3584
|
+
}
|
|
3585
|
+
return target;
|
|
3586
|
+
};
|
|
3587
|
+
exports.decompile = function(messages$3) {
|
|
3588
|
+
const target = {};
|
|
3589
|
+
for (let code$1 in messages$3) {
|
|
3590
|
+
const message = messages$3[code$1];
|
|
3591
|
+
if (code$1 === "root") {
|
|
3592
|
+
target.root = message;
|
|
3593
|
+
continue;
|
|
3594
|
+
}
|
|
3595
|
+
if (Template$6.isTemplate(message)) {
|
|
3596
|
+
target[code$1] = message.describe({ compact: true });
|
|
3597
|
+
continue;
|
|
3598
|
+
}
|
|
3599
|
+
const language = code$1;
|
|
3600
|
+
target[language] = {};
|
|
3601
|
+
for (code$1 in message) {
|
|
3602
|
+
const localized = message[code$1];
|
|
3603
|
+
if (code$1 === "root") {
|
|
3604
|
+
target[language].root = localized;
|
|
3605
|
+
continue;
|
|
3606
|
+
}
|
|
3607
|
+
target[language][code$1] = localized.describe({ compact: true });
|
|
3608
|
+
}
|
|
3609
|
+
}
|
|
3610
|
+
return target;
|
|
3611
|
+
};
|
|
3612
|
+
exports.merge = function(base$3, extended) {
|
|
3613
|
+
if (!base$3) return exports.compile(extended);
|
|
3614
|
+
if (!extended) return base$3;
|
|
3615
|
+
if (typeof extended === "string") return new Template$6(extended);
|
|
3616
|
+
if (Template$6.isTemplate(extended)) return extended;
|
|
3617
|
+
const target = clone$15(base$3);
|
|
3618
|
+
for (let code$1 in extended) {
|
|
3619
|
+
const message = extended[code$1];
|
|
3620
|
+
if (code$1 === "root" || Template$6.isTemplate(message)) {
|
|
3621
|
+
target[code$1] = message;
|
|
3622
|
+
continue;
|
|
3623
|
+
}
|
|
3624
|
+
if (typeof message === "string") {
|
|
3625
|
+
target[code$1] = new Template$6(message);
|
|
3626
|
+
continue;
|
|
3627
|
+
}
|
|
3628
|
+
assert$48(typeof message === "object" && !Array.isArray(message), "Invalid message for", code$1);
|
|
3629
|
+
const language = code$1;
|
|
3630
|
+
target[language] = target[language] || {};
|
|
3631
|
+
for (code$1 in message) {
|
|
3632
|
+
const localized = message[code$1];
|
|
3633
|
+
if (code$1 === "root" || Template$6.isTemplate(localized)) {
|
|
3634
|
+
target[language][code$1] = localized;
|
|
3635
|
+
continue;
|
|
3636
|
+
}
|
|
3637
|
+
assert$48(typeof localized === "string", "Invalid message for", code$1, "in", language);
|
|
3638
|
+
target[language][code$1] = new Template$6(localized);
|
|
3639
|
+
}
|
|
3640
|
+
}
|
|
3641
|
+
return target;
|
|
3642
|
+
};
|
|
3574
3643
|
});
|
|
3575
3644
|
var require_extend$1 = __commonJSMin((exports) => {
|
|
3576
3645
|
const { assert: assert$47, clone: clone$14 } = require_lib$4();
|
|
3577
3646
|
const Common$21 = require_common$3();
|
|
3578
|
-
const Messages$
|
|
3579
|
-
const internals$
|
|
3647
|
+
const Messages$6 = require_messages();
|
|
3648
|
+
const internals$22 = {};
|
|
3580
3649
|
exports.type = function(from$2, options) {
|
|
3581
3650
|
const base$3 = Object.getPrototypeOf(from$2);
|
|
3582
3651
|
const prototype = clone$14(base$3);
|
|
@@ -3585,7 +3654,7 @@ var require_extend$1 = __commonJSMin((exports) => {
|
|
|
3585
3654
|
delete def.base;
|
|
3586
3655
|
prototype._definition = def;
|
|
3587
3656
|
const parent = base$3._definition || {};
|
|
3588
|
-
def.messages = Messages$
|
|
3657
|
+
def.messages = Messages$6.merge(parent.messages, def.messages);
|
|
3589
3658
|
def.properties = Object.assign({}, parent.properties, def.properties);
|
|
3590
3659
|
schema$2.type = def.type;
|
|
3591
3660
|
def.flags = Object.assign({}, parent.flags, def.flags);
|
|
@@ -3598,7 +3667,7 @@ var require_extend$1 = __commonJSMin((exports) => {
|
|
|
3598
3667
|
}
|
|
3599
3668
|
def.terms = terms;
|
|
3600
3669
|
if (!def.args) def.args = parent.args;
|
|
3601
|
-
def.prepare = internals$
|
|
3670
|
+
def.prepare = internals$22.prepare(def.prepare, parent.prepare);
|
|
3602
3671
|
if (def.coerce) {
|
|
3603
3672
|
if (typeof def.coerce === "function") def.coerce = { method: def.coerce };
|
|
3604
3673
|
if (def.coerce.from && !Array.isArray(def.coerce.from)) def.coerce = {
|
|
@@ -3606,8 +3675,8 @@ var require_extend$1 = __commonJSMin((exports) => {
|
|
|
3606
3675
|
from: [].concat(def.coerce.from)
|
|
3607
3676
|
};
|
|
3608
3677
|
}
|
|
3609
|
-
def.coerce = internals$
|
|
3610
|
-
def.validate = internals$
|
|
3678
|
+
def.coerce = internals$22.coerce(def.coerce, parent.coerce);
|
|
3679
|
+
def.validate = internals$22.validate(def.validate, parent.validate);
|
|
3611
3680
|
const rules = Object.assign({}, parent.rules);
|
|
3612
3681
|
if (def.rules) for (const name$3 in def.rules) {
|
|
3613
3682
|
const rule = def.rules[name$3];
|
|
@@ -3662,18 +3731,18 @@ var require_extend$1 = __commonJSMin((exports) => {
|
|
|
3662
3731
|
}
|
|
3663
3732
|
def.cast = Object.assign({}, parent.cast, def.cast);
|
|
3664
3733
|
const manifest = Object.assign({}, parent.manifest, def.manifest);
|
|
3665
|
-
manifest.build = internals$
|
|
3734
|
+
manifest.build = internals$22.build(def.manifest && def.manifest.build, parent.manifest && parent.manifest.build);
|
|
3666
3735
|
def.manifest = manifest;
|
|
3667
|
-
def.rebuild = internals$
|
|
3736
|
+
def.rebuild = internals$22.rebuild(def.rebuild, parent.rebuild);
|
|
3668
3737
|
return schema$2;
|
|
3669
3738
|
};
|
|
3670
|
-
internals$
|
|
3739
|
+
internals$22.build = function(child, parent) {
|
|
3671
3740
|
if (!child || !parent) return child || parent;
|
|
3672
3741
|
return function(obj, desc$1) {
|
|
3673
3742
|
return parent(child(obj, desc$1), desc$1);
|
|
3674
3743
|
};
|
|
3675
3744
|
};
|
|
3676
|
-
internals$
|
|
3745
|
+
internals$22.coerce = function(child, parent) {
|
|
3677
3746
|
if (!child || !parent) return child || parent;
|
|
3678
3747
|
return {
|
|
3679
3748
|
from: child.from && parent.from ? [...new Set([...child.from, ...parent.from])] : null,
|
|
@@ -3694,7 +3763,7 @@ var require_extend$1 = __commonJSMin((exports) => {
|
|
|
3694
3763
|
}
|
|
3695
3764
|
};
|
|
3696
3765
|
};
|
|
3697
|
-
internals$
|
|
3766
|
+
internals$22.prepare = function(child, parent) {
|
|
3698
3767
|
if (!child || !parent) return child || parent;
|
|
3699
3768
|
return function(value, helpers$8) {
|
|
3700
3769
|
const prepared = child(value, helpers$8);
|
|
@@ -3705,14 +3774,14 @@ var require_extend$1 = __commonJSMin((exports) => {
|
|
|
3705
3774
|
return parent(value, helpers$8) || prepared;
|
|
3706
3775
|
};
|
|
3707
3776
|
};
|
|
3708
|
-
internals$
|
|
3777
|
+
internals$22.rebuild = function(child, parent) {
|
|
3709
3778
|
if (!child || !parent) return child || parent;
|
|
3710
3779
|
return function(schema$2) {
|
|
3711
3780
|
parent(schema$2);
|
|
3712
3781
|
child(schema$2);
|
|
3713
3782
|
};
|
|
3714
3783
|
};
|
|
3715
|
-
internals$
|
|
3784
|
+
internals$22.validate = function(child, parent) {
|
|
3716
3785
|
if (!child || !parent) return child || parent;
|
|
3717
3786
|
return function(value, helpers$8) {
|
|
3718
3787
|
const result = parent(value, helpers$8);
|
|
@@ -3724,16 +3793,16 @@ var require_extend$1 = __commonJSMin((exports) => {
|
|
|
3724
3793
|
};
|
|
3725
3794
|
};
|
|
3726
3795
|
});
|
|
3727
|
-
var require_manifest = __commonJSMin((exports
|
|
3796
|
+
var require_manifest = __commonJSMin((exports) => {
|
|
3728
3797
|
init_dist$1();
|
|
3729
|
-
var import_schemas$
|
|
3798
|
+
var import_schemas$1 = __toESM(require_schemas());
|
|
3730
3799
|
var import_template$2 = __toESM(require_template());
|
|
3731
3800
|
var import_ref$2 = __toESM(require_ref$2());
|
|
3732
|
-
var import_messages$
|
|
3801
|
+
var import_messages$2 = __toESM(require_messages());
|
|
3733
3802
|
var import_common$2 = __toESM(require_common$3());
|
|
3734
3803
|
init_lib();
|
|
3735
3804
|
const Common$20 = import_common$2.default;
|
|
3736
|
-
const Messages$
|
|
3805
|
+
const Messages$5 = import_messages$2.default;
|
|
3737
3806
|
const Ref$10 = import_ref$2.default;
|
|
3738
3807
|
const Template$5 = import_template$2.default;
|
|
3739
3808
|
const ManifestDescriptionCache = new Map();
|
|
@@ -3753,10 +3822,9 @@ var require_manifest = __commonJSMin((exports, module) => {
|
|
|
3753
3822
|
}
|
|
3754
3823
|
};
|
|
3755
3824
|
const ManifestItemCache = new ManifestItemCacheClass();
|
|
3756
|
-
let Schemas$
|
|
3757
|
-
const internals$
|
|
3758
|
-
|
|
3759
|
-
exports$2.describe = function(schema$2) {
|
|
3825
|
+
let Schemas$3;
|
|
3826
|
+
const internals$21 = {};
|
|
3827
|
+
exports.describe = function(schema$2) {
|
|
3760
3828
|
const cached$1 = ManifestDescriptionCache.get(schema$2);
|
|
3761
3829
|
if (cached$1) return cached$1;
|
|
3762
3830
|
const def = schema$2._definition;
|
|
@@ -3765,12 +3833,12 @@ var require_manifest = __commonJSMin((exports, module) => {
|
|
|
3765
3833
|
flags: {},
|
|
3766
3834
|
rules: []
|
|
3767
3835
|
};
|
|
3768
|
-
for (const flag in schema$2._flags) if (flag[0] !== "_") desc$1.flags[flag] = internals$
|
|
3836
|
+
for (const flag in schema$2._flags) if (flag[0] !== "_") desc$1.flags[flag] = internals$21.describe(schema$2._flags[flag]);
|
|
3769
3837
|
if (!Object.keys(desc$1.flags).length) delete desc$1.flags;
|
|
3770
3838
|
if (schema$2._preferences) {
|
|
3771
3839
|
desc$1.preferences = (0, import_clone.default)(schema$2._preferences, { shallow: ["messages"] });
|
|
3772
3840
|
delete desc$1.preferences[Common$20.symbols.prefs];
|
|
3773
|
-
if (desc$1.preferences.messages) desc$1.preferences.messages = Messages$
|
|
3841
|
+
if (desc$1.preferences.messages) desc$1.preferences.messages = Messages$5.decompile(desc$1.preferences.messages);
|
|
3774
3842
|
}
|
|
3775
3843
|
if (schema$2._valids) desc$1.allow = schema$2._valids.describe();
|
|
3776
3844
|
if (schema$2._invalids) desc$1.invalid = schema$2._invalids.describe();
|
|
@@ -3778,13 +3846,13 @@ var require_manifest = __commonJSMin((exports, module) => {
|
|
|
3778
3846
|
const ruleDef = def.rules[rule.name];
|
|
3779
3847
|
if (ruleDef.manifest === false) continue;
|
|
3780
3848
|
const item = { name: rule.name };
|
|
3781
|
-
for (const custom$1 in def.modifiers) if (rule[custom$1] !== void 0) item[custom$1] = internals$
|
|
3849
|
+
for (const custom$1 in def.modifiers) if (rule[custom$1] !== void 0) item[custom$1] = internals$21.describe(rule[custom$1]);
|
|
3782
3850
|
if (rule.args) {
|
|
3783
3851
|
item.args = {};
|
|
3784
3852
|
for (const key in rule.args) {
|
|
3785
3853
|
const arg = rule.args[key];
|
|
3786
3854
|
if (key === "options" && !Object.keys(arg).length) continue;
|
|
3787
|
-
item.args[key] = internals$
|
|
3855
|
+
item.args[key] = internals$21.describe(arg, { assign: key });
|
|
3788
3856
|
}
|
|
3789
3857
|
if (!Object.keys(item.args).length) delete item.args;
|
|
3790
3858
|
}
|
|
@@ -3809,7 +3877,7 @@ var require_manifest = __commonJSMin((exports, module) => {
|
|
|
3809
3877
|
const mapped = typeof manifest === "object";
|
|
3810
3878
|
if (!items.length && !mapped) continue;
|
|
3811
3879
|
const normalized = [];
|
|
3812
|
-
for (const item of items) normalized.push(internals$
|
|
3880
|
+
for (const item of items) normalized.push(internals$21.describe(item));
|
|
3813
3881
|
if (mapped) {
|
|
3814
3882
|
const { from: from$2, to } = manifest.mapped;
|
|
3815
3883
|
desc$1[term] = {};
|
|
@@ -3823,14 +3891,14 @@ var require_manifest = __commonJSMin((exports, module) => {
|
|
|
3823
3891
|
}
|
|
3824
3892
|
desc$1[term] = normalized;
|
|
3825
3893
|
}
|
|
3826
|
-
internals$
|
|
3894
|
+
internals$21.validate(schema$2.$_root, desc$1);
|
|
3827
3895
|
ManifestDescriptionCache.set(schema$2, desc$1);
|
|
3828
3896
|
return desc$1;
|
|
3829
3897
|
};
|
|
3830
|
-
internals$
|
|
3898
|
+
internals$21.describe = function(item, options = {}) {
|
|
3831
3899
|
const cached$1 = ManifestItemCache.get(item, options);
|
|
3832
3900
|
if (cached$1) return cached$1;
|
|
3833
|
-
if (Array.isArray(item)) return ManifestItemCache.setAndReturn(item, options, item.map(internals$
|
|
3901
|
+
if (Array.isArray(item)) return ManifestItemCache.setAndReturn(item, options, item.map(internals$21.describe));
|
|
3834
3902
|
if (item === Common$20.symbols.deepDefault) return ManifestItemCache.setAndReturn(item, options, { special: "deep" });
|
|
3835
3903
|
if (typeof item !== "object" || item === null) return ManifestItemCache.setAndReturn(item, options, item);
|
|
3836
3904
|
if (options.assign === "options") return ManifestItemCache.setAndReturn(item, options, (0, import_clone.default)(item));
|
|
@@ -3850,20 +3918,20 @@ var require_manifest = __commonJSMin((exports, module) => {
|
|
|
3850
3918
|
for (const key in item) {
|
|
3851
3919
|
const value = item[key];
|
|
3852
3920
|
if (value === void 0) continue;
|
|
3853
|
-
normalized[key] = internals$
|
|
3921
|
+
normalized[key] = internals$21.describe(value, { assign: key });
|
|
3854
3922
|
}
|
|
3855
3923
|
return ManifestItemCache.setAndReturn(item, options, normalized);
|
|
3856
3924
|
};
|
|
3857
|
-
exports
|
|
3858
|
-
const builder = new internals$
|
|
3925
|
+
exports.build = function(joi$1, desc$1) {
|
|
3926
|
+
const builder = new internals$21.Builder(joi$1);
|
|
3859
3927
|
return builder.parse(desc$1);
|
|
3860
3928
|
};
|
|
3861
|
-
internals$
|
|
3929
|
+
internals$21.Builder = class {
|
|
3862
3930
|
constructor(joi$1) {
|
|
3863
3931
|
this.joi = joi$1;
|
|
3864
3932
|
}
|
|
3865
3933
|
parse(desc$1) {
|
|
3866
|
-
internals$
|
|
3934
|
+
internals$21.validate(this.joi, desc$1);
|
|
3867
3935
|
let schema$2 = this.joi[desc$1.type]()._bare();
|
|
3868
3936
|
const def = schema$2._definition;
|
|
3869
3937
|
if (desc$1.flags) for (const flag in desc$1.flags) {
|
|
@@ -3940,7 +4008,7 @@ var require_manifest = __commonJSMin((exports, module) => {
|
|
|
3940
4008
|
if (Array.isArray(desc$1)) return desc$1.map((item) => this.build(item));
|
|
3941
4009
|
if (desc$1 instanceof Error) return desc$1;
|
|
3942
4010
|
if (options.assign === "options") return (0, import_clone.default)(desc$1);
|
|
3943
|
-
if (options.assign === "regex") return internals$
|
|
4011
|
+
if (options.assign === "regex") return internals$21.regex(desc$1);
|
|
3944
4012
|
if (options.assign === "ref") return Ref$10.build(desc$1);
|
|
3945
4013
|
if (typeof desc$1 !== "object") return desc$1;
|
|
3946
4014
|
if (Object.keys(desc$1).length === 1) {
|
|
@@ -3954,7 +4022,7 @@ var require_manifest = __commonJSMin((exports, module) => {
|
|
|
3954
4022
|
};
|
|
3955
4023
|
if (desc$1.override) return Common$20.symbols.override;
|
|
3956
4024
|
if (desc$1.ref) return Ref$10.build(desc$1.ref);
|
|
3957
|
-
if (desc$1.regex) return internals$
|
|
4025
|
+
if (desc$1.regex) return internals$21.regex(desc$1.regex);
|
|
3958
4026
|
if (desc$1.special) {
|
|
3959
4027
|
(0, import_assert.default)(["deep"].includes(desc$1.special), "Unknown special value", desc$1.special);
|
|
3960
4028
|
return Common$20.symbols.deepDefault;
|
|
@@ -3968,17 +4036,16 @@ var require_manifest = __commonJSMin((exports, module) => {
|
|
|
3968
4036
|
return normalized;
|
|
3969
4037
|
}
|
|
3970
4038
|
};
|
|
3971
|
-
internals$
|
|
4039
|
+
internals$21.regex = function(string) {
|
|
3972
4040
|
const end = string.lastIndexOf("/");
|
|
3973
4041
|
const exp = string.slice(1, end);
|
|
3974
4042
|
const flags = string.slice(end + 1);
|
|
3975
4043
|
return new RegExp(exp, flags);
|
|
3976
4044
|
};
|
|
3977
|
-
internals$
|
|
3978
|
-
Schemas$
|
|
3979
|
-
joi$1.assert(desc$1, Schemas$
|
|
4045
|
+
internals$21.validate = function(joi$1, desc$1) {
|
|
4046
|
+
Schemas$3 = Schemas$3 || import_schemas$1.default;
|
|
4047
|
+
joi$1.assert(desc$1, Schemas$3.description);
|
|
3980
4048
|
};
|
|
3981
|
-
module.exports = exports$2;
|
|
3982
4049
|
});
|
|
3983
4050
|
var require_lib$2 = __commonJSMin((exports) => {
|
|
3984
4051
|
exports.location = function(depth = 0) {
|
|
@@ -3998,7 +4065,7 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
3998
4065
|
const { deepEqual: deepEqual$3 } = require_lib$4();
|
|
3999
4066
|
const Pinpoint = require_lib$2();
|
|
4000
4067
|
const Errors$7 = require_errors$2();
|
|
4001
|
-
const internals$
|
|
4068
|
+
const internals$20 = {
|
|
4002
4069
|
codes: {
|
|
4003
4070
|
error: 1,
|
|
4004
4071
|
pass: 2,
|
|
@@ -4012,7 +4079,7 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
4012
4079
|
};
|
|
4013
4080
|
exports.setup = function(root$11) {
|
|
4014
4081
|
const trace = function() {
|
|
4015
|
-
root$11._tracer = root$11._tracer || new internals$
|
|
4082
|
+
root$11._tracer = root$11._tracer || new internals$20.Tracer();
|
|
4016
4083
|
return root$11._tracer;
|
|
4017
4084
|
};
|
|
4018
4085
|
root$11.trace = trace;
|
|
@@ -4024,7 +4091,7 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
4024
4091
|
exports.location = function(schema$2) {
|
|
4025
4092
|
return schema$2.$_setFlag("_tracerLocation", Pinpoint.location(2));
|
|
4026
4093
|
};
|
|
4027
|
-
internals$
|
|
4094
|
+
internals$20.Tracer = class {
|
|
4028
4095
|
constructor() {
|
|
4029
4096
|
this.name = "Joi";
|
|
4030
4097
|
this._schemas = new Map();
|
|
@@ -4032,7 +4099,7 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
4032
4099
|
_register(schema$2) {
|
|
4033
4100
|
const existing = this._schemas.get(schema$2);
|
|
4034
4101
|
if (existing) return existing.store;
|
|
4035
|
-
const store = new internals$
|
|
4102
|
+
const store = new internals$20.Store(schema$2);
|
|
4036
4103
|
const { filename, line } = schema$2._flags._tracerLocation || Pinpoint.location(5);
|
|
4037
4104
|
this._schemas.set(schema$2, {
|
|
4038
4105
|
filename,
|
|
@@ -4051,7 +4118,7 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
4051
4118
|
const missing = [];
|
|
4052
4119
|
const skipped = [];
|
|
4053
4120
|
for (const [schema$2, log$1] of store._sources.entries()) {
|
|
4054
|
-
if (internals$
|
|
4121
|
+
if (internals$20.sub(log$1.paths, skipped)) continue;
|
|
4055
4122
|
if (!log$1.entry) {
|
|
4056
4123
|
missing.push({
|
|
4057
4124
|
status: "never reached",
|
|
@@ -4077,7 +4144,7 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
4077
4144
|
const rules = schema$2._rules.map((rule) => rule.name);
|
|
4078
4145
|
for (const type of ["default", "failover"]) if (schema$2._flags[type] !== void 0) rules.push(type);
|
|
4079
4146
|
for (const name$3 of rules) {
|
|
4080
|
-
const status = internals$
|
|
4147
|
+
const status = internals$20.labels[log$1.rule[name$3] || 0];
|
|
4081
4148
|
if (status) {
|
|
4082
4149
|
const report = {
|
|
4083
4150
|
rule: name$3,
|
|
@@ -4093,13 +4160,13 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
4093
4160
|
line,
|
|
4094
4161
|
missing,
|
|
4095
4162
|
severity: "error",
|
|
4096
|
-
message: `Schema missing tests for ${missing.map(internals$
|
|
4163
|
+
message: `Schema missing tests for ${missing.map(internals$20.message).join(", ")}`
|
|
4097
4164
|
});
|
|
4098
4165
|
}
|
|
4099
4166
|
return coverage.length ? coverage : null;
|
|
4100
4167
|
}
|
|
4101
4168
|
};
|
|
4102
|
-
internals$
|
|
4169
|
+
internals$20.Store = class {
|
|
4103
4170
|
constructor(schema$2) {
|
|
4104
4171
|
this.active = true;
|
|
4105
4172
|
this._sources = new Map();
|
|
@@ -4115,13 +4182,13 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
4115
4182
|
});
|
|
4116
4183
|
}
|
|
4117
4184
|
entry(schema$2, state) {
|
|
4118
|
-
internals$
|
|
4185
|
+
internals$20.debug(state, { type: "entry" });
|
|
4119
4186
|
this._record(schema$2, (log$1) => {
|
|
4120
4187
|
log$1.entry = true;
|
|
4121
4188
|
});
|
|
4122
4189
|
}
|
|
4123
4190
|
filter(schema$2, state, source, value) {
|
|
4124
|
-
internals$
|
|
4191
|
+
internals$20.debug(state, {
|
|
4125
4192
|
type: source,
|
|
4126
4193
|
...value
|
|
4127
4194
|
});
|
|
@@ -4130,14 +4197,14 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
4130
4197
|
});
|
|
4131
4198
|
}
|
|
4132
4199
|
log(schema$2, state, source, name$3, result) {
|
|
4133
|
-
internals$
|
|
4200
|
+
internals$20.debug(state, {
|
|
4134
4201
|
type: source,
|
|
4135
4202
|
name: name$3,
|
|
4136
4203
|
result: result === "full" ? "pass" : result
|
|
4137
4204
|
});
|
|
4138
4205
|
this._record(schema$2, (log$1) => {
|
|
4139
4206
|
log$1[source][name$3] = log$1[source][name$3] || 0;
|
|
4140
|
-
log$1[source][name$3] |= internals$
|
|
4207
|
+
log$1[source][name$3] |= internals$20.codes[result];
|
|
4141
4208
|
});
|
|
4142
4209
|
}
|
|
4143
4210
|
resolve(state, ref, to) {
|
|
@@ -4186,7 +4253,7 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
4186
4253
|
}
|
|
4187
4254
|
if (path.length) log$1.paths.add(path);
|
|
4188
4255
|
const each$5 = (sub, source) => {
|
|
4189
|
-
const subId = internals$
|
|
4256
|
+
const subId = internals$20.id(sub, source);
|
|
4190
4257
|
this._scan(sub, path.concat(subId));
|
|
4191
4258
|
};
|
|
4192
4259
|
schema$2.$_modify({
|
|
@@ -4198,22 +4265,22 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
4198
4265
|
this._combos.set(merged, sources);
|
|
4199
4266
|
}
|
|
4200
4267
|
};
|
|
4201
|
-
internals$
|
|
4268
|
+
internals$20.message = function(item) {
|
|
4202
4269
|
const path = item.paths ? Errors$7.path(item.paths[0]) + (item.rule ? ":" : "") : "";
|
|
4203
4270
|
return `${path}${item.rule || ""} (${item.status})`;
|
|
4204
4271
|
};
|
|
4205
|
-
internals$
|
|
4272
|
+
internals$20.id = function(schema$2, { source, name: name$3, path, key }) {
|
|
4206
4273
|
if (schema$2._flags.id) return schema$2._flags.id;
|
|
4207
4274
|
if (key) return key;
|
|
4208
4275
|
name$3 = `@${name$3}`;
|
|
4209
4276
|
if (source === "terms") return [name$3, path[Math.min(path.length - 1, 1)]];
|
|
4210
4277
|
return name$3;
|
|
4211
4278
|
};
|
|
4212
|
-
internals$
|
|
4279
|
+
internals$20.sub = function(paths, skipped) {
|
|
4213
4280
|
for (const path of paths) for (const skip of skipped) if (deepEqual$3(path.slice(0, skip.length), skip)) return true;
|
|
4214
4281
|
return false;
|
|
4215
4282
|
};
|
|
4216
|
-
internals$
|
|
4283
|
+
internals$20.debug = function(state, event) {
|
|
4217
4284
|
if (state.mainstay.debug) {
|
|
4218
4285
|
event.path = state.debug ? [...state.path, state.debug] : state.path;
|
|
4219
4286
|
state.mainstay.debug.push(event);
|
|
@@ -4224,15 +4291,15 @@ var require_modify = __commonJSMin((exports) => {
|
|
|
4224
4291
|
const { assert: assert$45 } = require_lib$4();
|
|
4225
4292
|
const Common$19 = require_common$3();
|
|
4226
4293
|
const Ref$9 = require_ref$2();
|
|
4227
|
-
const internals$
|
|
4228
|
-
exports.Ids = internals$
|
|
4294
|
+
const internals$19 = {};
|
|
4295
|
+
exports.Ids = internals$19.Ids = class {
|
|
4229
4296
|
constructor() {
|
|
4230
4297
|
this._byId = new Map();
|
|
4231
4298
|
this._byKey = new Map();
|
|
4232
4299
|
this._schemaChain = false;
|
|
4233
4300
|
}
|
|
4234
4301
|
clone() {
|
|
4235
|
-
const clone$20 = new internals$
|
|
4302
|
+
const clone$20 = new internals$19.Ids();
|
|
4236
4303
|
clone$20._byId = new Map(this._byId);
|
|
4237
4304
|
clone$20._byKey = new Map(this._byKey);
|
|
4238
4305
|
clone$20._schemaChain = this._schemaChain;
|
|
@@ -4260,7 +4327,7 @@ var require_modify = __commonJSMin((exports) => {
|
|
|
4260
4327
|
assert$45(Common$19.isSchema(adjusted.schema), "adjuster function failed to return a joi schema type");
|
|
4261
4328
|
for (const node of chain) adjusted = {
|
|
4262
4329
|
id: node.id,
|
|
4263
|
-
schema: internals$
|
|
4330
|
+
schema: internals$19.fork(node.schema, adjusted.id, adjusted.schema)
|
|
4264
4331
|
};
|
|
4265
4332
|
return adjusted.schema;
|
|
4266
4333
|
}
|
|
@@ -4321,7 +4388,7 @@ var require_modify = __commonJSMin((exports) => {
|
|
|
4321
4388
|
return this._byId.get(id) || this._byKey.get(id);
|
|
4322
4389
|
}
|
|
4323
4390
|
};
|
|
4324
|
-
internals$
|
|
4391
|
+
internals$19.fork = function(schema$2, id, replacement) {
|
|
4325
4392
|
const each$5 = (item, { key }) => {
|
|
4326
4393
|
if (id === (item._flags.id || key)) return replacement;
|
|
4327
4394
|
};
|
|
@@ -4335,7 +4402,7 @@ var require_modify = __commonJSMin((exports) => {
|
|
|
4335
4402
|
let obj;
|
|
4336
4403
|
for (const name$3 in schema$2._flags) {
|
|
4337
4404
|
if (name$3[0] === "_") continue;
|
|
4338
|
-
const result = internals$
|
|
4405
|
+
const result = internals$19.scan(schema$2._flags[name$3], {
|
|
4339
4406
|
source: "flags",
|
|
4340
4407
|
name: name$3
|
|
4341
4408
|
}, options);
|
|
@@ -4346,7 +4413,7 @@ var require_modify = __commonJSMin((exports) => {
|
|
|
4346
4413
|
}
|
|
4347
4414
|
for (let i$1 = 0; i$1 < schema$2._rules.length; ++i$1) {
|
|
4348
4415
|
const rule = schema$2._rules[i$1];
|
|
4349
|
-
const result = internals$
|
|
4416
|
+
const result = internals$19.scan(rule.args, {
|
|
4350
4417
|
source: "rules",
|
|
4351
4418
|
name: rule.name
|
|
4352
4419
|
}, options);
|
|
@@ -4361,7 +4428,7 @@ var require_modify = __commonJSMin((exports) => {
|
|
|
4361
4428
|
}
|
|
4362
4429
|
for (const name$3 in schema$2.$_terms) {
|
|
4363
4430
|
if (name$3[0] === "_") continue;
|
|
4364
|
-
const result = internals$
|
|
4431
|
+
const result = internals$19.scan(schema$2.$_terms[name$3], {
|
|
4365
4432
|
source: "terms",
|
|
4366
4433
|
name: name$3
|
|
4367
4434
|
}, options);
|
|
@@ -4372,14 +4439,14 @@ var require_modify = __commonJSMin((exports) => {
|
|
|
4372
4439
|
}
|
|
4373
4440
|
return obj;
|
|
4374
4441
|
};
|
|
4375
|
-
internals$
|
|
4442
|
+
internals$19.scan = function(item, source, options, _path, _key) {
|
|
4376
4443
|
const path = _path || [];
|
|
4377
4444
|
if (item === null || typeof item !== "object") return;
|
|
4378
4445
|
let clone$20;
|
|
4379
4446
|
if (Array.isArray(item)) {
|
|
4380
4447
|
for (let i$1 = 0; i$1 < item.length; ++i$1) {
|
|
4381
4448
|
const key = source.source === "terms" && source.name === "keys" && item[i$1].key;
|
|
4382
|
-
const result = internals$
|
|
4449
|
+
const result = internals$19.scan(item[i$1], source, options, [i$1, ...path], key);
|
|
4383
4450
|
if (result !== void 0) {
|
|
4384
4451
|
clone$20 = clone$20 || item.slice();
|
|
4385
4452
|
clone$20[i$1] = result;
|
|
@@ -4398,7 +4465,7 @@ var require_modify = __commonJSMin((exports) => {
|
|
|
4398
4465
|
}
|
|
4399
4466
|
for (const key in item) {
|
|
4400
4467
|
if (key[0] === "_") continue;
|
|
4401
|
-
const result = internals$
|
|
4468
|
+
const result = internals$19.scan(item[key], source, options, [key, ...path], _key);
|
|
4402
4469
|
if (result !== void 0) {
|
|
4403
4470
|
clone$20 = clone$20 || Object.assign({}, item);
|
|
4404
4471
|
clone$20[key] = result;
|
|
@@ -4410,8 +4477,8 @@ var require_modify = __commonJSMin((exports) => {
|
|
|
4410
4477
|
var require_state$1 = __commonJSMin((exports, module) => {
|
|
4411
4478
|
const { clone: clone$12, reach: reach$2 } = require_lib$4();
|
|
4412
4479
|
const Common$18 = require_common$3();
|
|
4413
|
-
const internals$
|
|
4414
|
-
module.exports = internals$
|
|
4480
|
+
const internals$18 = { value: Symbol("value") };
|
|
4481
|
+
module.exports = internals$18.State = class {
|
|
4415
4482
|
constructor(path, ancestors, state) {
|
|
4416
4483
|
this.path = path;
|
|
4417
4484
|
this.ancestors = ancestors;
|
|
@@ -4420,18 +4487,18 @@ var require_state$1 = __commonJSMin((exports, module) => {
|
|
|
4420
4487
|
this.debug = null;
|
|
4421
4488
|
}
|
|
4422
4489
|
localize(path, ancestors = null, schema$2 = null) {
|
|
4423
|
-
const state = new internals$
|
|
4424
|
-
if (schema$2 && state.schemas) state.schemas = [internals$
|
|
4490
|
+
const state = new internals$18.State(path, ancestors, this);
|
|
4491
|
+
if (schema$2 && state.schemas) state.schemas = [internals$18.schemas(schema$2), ...state.schemas];
|
|
4425
4492
|
return state;
|
|
4426
4493
|
}
|
|
4427
4494
|
nest(schema$2, debug$13) {
|
|
4428
|
-
const state = new internals$
|
|
4429
|
-
state.schemas = state.schemas && [internals$
|
|
4495
|
+
const state = new internals$18.State(this.path, this.ancestors, this);
|
|
4496
|
+
state.schemas = state.schemas && [internals$18.schemas(schema$2), ...state.schemas];
|
|
4430
4497
|
state.debug = debug$13;
|
|
4431
4498
|
return state;
|
|
4432
4499
|
}
|
|
4433
4500
|
shadow(value, reason) {
|
|
4434
|
-
this.mainstay.shadow = this.mainstay.shadow || new internals$
|
|
4501
|
+
this.mainstay.shadow = this.mainstay.shadow || new internals$18.Shadow();
|
|
4435
4502
|
this.mainstay.shadow.set(this.path, value, reason);
|
|
4436
4503
|
}
|
|
4437
4504
|
snapshot() {
|
|
@@ -4453,11 +4520,11 @@ var require_state$1 = __commonJSMin((exports, module) => {
|
|
|
4453
4520
|
this.mainstay.commit();
|
|
4454
4521
|
}
|
|
4455
4522
|
};
|
|
4456
|
-
internals$
|
|
4523
|
+
internals$18.schemas = function(schema$2) {
|
|
4457
4524
|
if (Common$18.isSchema(schema$2)) return { schema: schema$2 };
|
|
4458
4525
|
return schema$2;
|
|
4459
4526
|
};
|
|
4460
|
-
internals$
|
|
4527
|
+
internals$18.Shadow = class {
|
|
4461
4528
|
constructor() {
|
|
4462
4529
|
this._values = null;
|
|
4463
4530
|
}
|
|
@@ -4475,11 +4542,11 @@ var require_state$1 = __commonJSMin((exports, module) => {
|
|
|
4475
4542
|
}
|
|
4476
4543
|
node = next;
|
|
4477
4544
|
}
|
|
4478
|
-
node[internals$
|
|
4545
|
+
node[internals$18.value] = value;
|
|
4479
4546
|
}
|
|
4480
4547
|
get(path) {
|
|
4481
4548
|
const node = this.node(path);
|
|
4482
|
-
if (node) return node[internals$
|
|
4549
|
+
if (node) return node[internals$18.value];
|
|
4483
4550
|
}
|
|
4484
4551
|
node(path) {
|
|
4485
4552
|
if (!this._values) return;
|
|
@@ -4503,7 +4570,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4503
4570
|
const Common$17 = require_common$3();
|
|
4504
4571
|
const Errors$6 = require_errors$2();
|
|
4505
4572
|
const State = require_state$1();
|
|
4506
|
-
const internals$
|
|
4573
|
+
const internals$17 = { result: Symbol("result") };
|
|
4507
4574
|
exports.entry = function(value, schema$2, prefs) {
|
|
4508
4575
|
let settings = Common$17.defaults;
|
|
4509
4576
|
if (prefs) {
|
|
@@ -4511,7 +4578,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4511
4578
|
assert$44(prefs.artifacts === void 0, "Cannot override artifacts preference in synchronous validation");
|
|
4512
4579
|
settings = Common$17.preferences(Common$17.defaults, prefs);
|
|
4513
4580
|
}
|
|
4514
|
-
const result = internals$
|
|
4581
|
+
const result = internals$17.entry(value, schema$2, settings);
|
|
4515
4582
|
assert$44(!result.mainstay.externals.length, "Schema with external rules must use validateAsync()");
|
|
4516
4583
|
const outcome = { value: result.value };
|
|
4517
4584
|
if (result.error) outcome.error = result.error;
|
|
@@ -4523,7 +4590,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4523
4590
|
exports.entryAsync = async function(value, schema$2, prefs) {
|
|
4524
4591
|
let settings = Common$17.defaults;
|
|
4525
4592
|
if (prefs) settings = Common$17.preferences(Common$17.defaults, prefs);
|
|
4526
|
-
const result = internals$
|
|
4593
|
+
const result = internals$17.entry(value, schema$2, settings);
|
|
4527
4594
|
const mainstay = result.mainstay;
|
|
4528
4595
|
if (result.error) {
|
|
4529
4596
|
if (mainstay.debug) result.error.debug = mainstay.debug;
|
|
@@ -4559,7 +4626,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4559
4626
|
prefs,
|
|
4560
4627
|
original,
|
|
4561
4628
|
error: createError,
|
|
4562
|
-
errorsArray: internals$
|
|
4629
|
+
errorsArray: internals$17.errorsArray,
|
|
4563
4630
|
warn: (code$1, local) => mainstay.warnings.push((linked || external.schema).$_createError(code$1, node, local, external.state, settings)),
|
|
4564
4631
|
message: (messages$3, local) => (linked || external.schema).$_createError("external", node, local, external.state, settings, { messages: messages$3 })
|
|
4565
4632
|
});
|
|
@@ -4606,7 +4673,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4606
4673
|
if (schema$2.isAsync()) return exports.entryAsync(value, schema$2);
|
|
4607
4674
|
return exports.entry(value, schema$2);
|
|
4608
4675
|
};
|
|
4609
|
-
internals$
|
|
4676
|
+
internals$17.Mainstay = class {
|
|
4610
4677
|
constructor(tracer, debug$13, links) {
|
|
4611
4678
|
this.externals = [];
|
|
4612
4679
|
this.warnings = [];
|
|
@@ -4632,11 +4699,11 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4632
4699
|
this._snapshots.pop();
|
|
4633
4700
|
}
|
|
4634
4701
|
};
|
|
4635
|
-
internals$
|
|
4636
|
-
const { tracer, cleanup } = internals$
|
|
4702
|
+
internals$17.entry = function(value, schema$2, prefs) {
|
|
4703
|
+
const { tracer, cleanup } = internals$17.tracer(schema$2, prefs);
|
|
4637
4704
|
const debug$13 = prefs.debug ? [] : null;
|
|
4638
4705
|
const links = schema$2._ids._schemaChain ? new Map() : null;
|
|
4639
|
-
const mainstay = new internals$
|
|
4706
|
+
const mainstay = new internals$17.Mainstay(tracer, debug$13, links);
|
|
4640
4707
|
const schemas = schema$2._ids._schemaChain ? [{ schema: schema$2 }] : null;
|
|
4641
4708
|
const state = new State([], [], {
|
|
4642
4709
|
mainstay,
|
|
@@ -4651,7 +4718,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4651
4718
|
mainstay
|
|
4652
4719
|
};
|
|
4653
4720
|
};
|
|
4654
|
-
internals$
|
|
4721
|
+
internals$17.tracer = function(schema$2, prefs) {
|
|
4655
4722
|
if (schema$2.$_root._tracer) return { tracer: schema$2.$_root._tracer._register(schema$2) };
|
|
4656
4723
|
if (prefs.debug) {
|
|
4657
4724
|
assert$44(schema$2.$_root.trace, "Debug mode not supported");
|
|
@@ -4660,11 +4727,11 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4660
4727
|
cleanup: true
|
|
4661
4728
|
};
|
|
4662
4729
|
}
|
|
4663
|
-
return { tracer: internals$
|
|
4730
|
+
return { tracer: internals$17.ignore };
|
|
4664
4731
|
};
|
|
4665
4732
|
exports.validate = function(value, schema$2, state, prefs, overrides = {}) {
|
|
4666
4733
|
if (schema$2.$_terms.whens) schema$2 = schema$2._generate(value, state, prefs).schema;
|
|
4667
|
-
if (schema$2._preferences) prefs = internals$
|
|
4734
|
+
if (schema$2._preferences) prefs = internals$17.prefs(schema$2, prefs);
|
|
4668
4735
|
if (schema$2._cache && prefs.cache) {
|
|
4669
4736
|
const result = schema$2._cache.get(value);
|
|
4670
4737
|
state.mainstay.tracer.debug(state, "validate", "cached", !!result);
|
|
@@ -4677,7 +4744,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4677
4744
|
schema: schema$2,
|
|
4678
4745
|
state,
|
|
4679
4746
|
error: createError,
|
|
4680
|
-
errorsArray: internals$
|
|
4747
|
+
errorsArray: internals$17.errorsArray,
|
|
4681
4748
|
warn: (code$1, local, localState) => state.mainstay.warnings.push(createError(code$1, local, localState)),
|
|
4682
4749
|
message: (messages$3, local) => schema$2.$_createError("custom", value, local, state, prefs, { messages: messages$3 })
|
|
4683
4750
|
};
|
|
@@ -4687,7 +4754,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4687
4754
|
const prepared = def.prepare(value, helpers$8);
|
|
4688
4755
|
if (prepared) {
|
|
4689
4756
|
state.mainstay.tracer.value(state, "prepare", value, prepared.value);
|
|
4690
|
-
if (prepared.errors) return internals$
|
|
4757
|
+
if (prepared.errors) return internals$17.finalize(prepared.value, [].concat(prepared.errors), helpers$8);
|
|
4691
4758
|
value = prepared.value;
|
|
4692
4759
|
}
|
|
4693
4760
|
}
|
|
@@ -4695,25 +4762,25 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4695
4762
|
const coerced = def.coerce.method(value, helpers$8);
|
|
4696
4763
|
if (coerced) {
|
|
4697
4764
|
state.mainstay.tracer.value(state, "coerced", value, coerced.value);
|
|
4698
|
-
if (coerced.errors) return internals$
|
|
4765
|
+
if (coerced.errors) return internals$17.finalize(coerced.value, [].concat(coerced.errors), helpers$8);
|
|
4699
4766
|
value = coerced.value;
|
|
4700
4767
|
}
|
|
4701
4768
|
}
|
|
4702
4769
|
const empty$2 = schema$2._flags.empty;
|
|
4703
|
-
if (empty$2 && empty$2.$_match(internals$
|
|
4770
|
+
if (empty$2 && empty$2.$_match(internals$17.trim(value, schema$2), state.nest(empty$2), Common$17.defaults)) {
|
|
4704
4771
|
state.mainstay.tracer.value(state, "empty", value, void 0);
|
|
4705
4772
|
value = void 0;
|
|
4706
4773
|
}
|
|
4707
4774
|
const presence = overrides.presence || schema$2._flags.presence || (schema$2._flags._endedSwitch ? null : prefs.presence);
|
|
4708
4775
|
if (value === void 0) {
|
|
4709
|
-
if (presence === "forbidden") return internals$
|
|
4710
|
-
if (presence === "required") return internals$
|
|
4776
|
+
if (presence === "forbidden") return internals$17.finalize(value, null, helpers$8);
|
|
4777
|
+
if (presence === "required") return internals$17.finalize(value, [schema$2.$_createError("any.required", value, null, state, prefs)], helpers$8);
|
|
4711
4778
|
if (presence === "optional") {
|
|
4712
|
-
if (schema$2._flags.default !== Common$17.symbols.deepDefault) return internals$
|
|
4779
|
+
if (schema$2._flags.default !== Common$17.symbols.deepDefault) return internals$17.finalize(value, null, helpers$8);
|
|
4713
4780
|
state.mainstay.tracer.value(state, "default", value, {});
|
|
4714
4781
|
value = {};
|
|
4715
4782
|
}
|
|
4716
|
-
} else if (presence === "forbidden") return internals$
|
|
4783
|
+
} else if (presence === "forbidden") return internals$17.finalize(value, [schema$2.$_createError("any.unknown", value, null, state, prefs)], helpers$8);
|
|
4717
4784
|
const errors = [];
|
|
4718
4785
|
if (schema$2._valids) {
|
|
4719
4786
|
const match$2 = schema$2._valids.get(value, state, prefs, schema$2._flags.insensitive);
|
|
@@ -4723,11 +4790,11 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4723
4790
|
value = match$2.value;
|
|
4724
4791
|
}
|
|
4725
4792
|
state.mainstay.tracer.filter(schema$2, state, "valid", match$2);
|
|
4726
|
-
return internals$
|
|
4793
|
+
return internals$17.finalize(value, null, helpers$8);
|
|
4727
4794
|
}
|
|
4728
4795
|
if (schema$2._flags.only) {
|
|
4729
4796
|
const report = schema$2.$_createError("any.only", value, { valids: schema$2._valids.values({ display: true }) }, state, prefs);
|
|
4730
|
-
if (prefs.abortEarly) return internals$
|
|
4797
|
+
if (prefs.abortEarly) return internals$17.finalize(value, [report], helpers$8);
|
|
4731
4798
|
errors.push(report);
|
|
4732
4799
|
}
|
|
4733
4800
|
}
|
|
@@ -4736,7 +4803,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4736
4803
|
if (match$2) {
|
|
4737
4804
|
state.mainstay.tracer.filter(schema$2, state, "invalid", match$2);
|
|
4738
4805
|
const report = schema$2.$_createError("any.invalid", value, { invalids: schema$2._invalids.values({ display: true }) }, state, prefs);
|
|
4739
|
-
if (prefs.abortEarly) return internals$
|
|
4806
|
+
if (prefs.abortEarly) return internals$17.finalize(value, [report], helpers$8);
|
|
4740
4807
|
errors.push(report);
|
|
4741
4808
|
}
|
|
4742
4809
|
}
|
|
@@ -4748,19 +4815,19 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4748
4815
|
if (base$3.errors) {
|
|
4749
4816
|
if (!Array.isArray(base$3.errors)) {
|
|
4750
4817
|
errors.push(base$3.errors);
|
|
4751
|
-
return internals$
|
|
4818
|
+
return internals$17.finalize(value, errors, helpers$8);
|
|
4752
4819
|
}
|
|
4753
4820
|
if (base$3.errors.length) {
|
|
4754
4821
|
errors.push(...base$3.errors);
|
|
4755
|
-
return internals$
|
|
4822
|
+
return internals$17.finalize(value, errors, helpers$8);
|
|
4756
4823
|
}
|
|
4757
4824
|
}
|
|
4758
4825
|
}
|
|
4759
4826
|
}
|
|
4760
|
-
if (!schema$2._rules.length) return internals$
|
|
4761
|
-
return internals$
|
|
4827
|
+
if (!schema$2._rules.length) return internals$17.finalize(value, errors, helpers$8);
|
|
4828
|
+
return internals$17.rules(value, errors, helpers$8);
|
|
4762
4829
|
};
|
|
4763
|
-
internals$
|
|
4830
|
+
internals$17.rules = function(value, errors, helpers$8) {
|
|
4764
4831
|
const { schema: schema$2, state, prefs } = helpers$8;
|
|
4765
4832
|
for (const rule of schema$2._rules) {
|
|
4766
4833
|
const definition = schema$2._definition.rules[rule.method];
|
|
@@ -4789,14 +4856,14 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4789
4856
|
}
|
|
4790
4857
|
}
|
|
4791
4858
|
ret = ret || definition.validate(value, helpers$8, args$1, rule);
|
|
4792
|
-
const result = internals$
|
|
4859
|
+
const result = internals$17.rule(ret, rule);
|
|
4793
4860
|
if (result.errors) {
|
|
4794
4861
|
state.mainstay.tracer.log(schema$2, state, "rule", rule.name, "error");
|
|
4795
4862
|
if (rule.warn) {
|
|
4796
4863
|
state.mainstay.warnings.push(...result.errors);
|
|
4797
4864
|
continue;
|
|
4798
4865
|
}
|
|
4799
|
-
if (prefs.abortEarly) return internals$
|
|
4866
|
+
if (prefs.abortEarly) return internals$17.finalize(value, result.errors, helpers$8);
|
|
4800
4867
|
errors.push(...result.errors);
|
|
4801
4868
|
} else {
|
|
4802
4869
|
state.mainstay.tracer.log(schema$2, state, "rule", rule.name, "pass");
|
|
@@ -4804,18 +4871,18 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4804
4871
|
value = result.value;
|
|
4805
4872
|
}
|
|
4806
4873
|
}
|
|
4807
|
-
return internals$
|
|
4874
|
+
return internals$17.finalize(value, errors, helpers$8);
|
|
4808
4875
|
};
|
|
4809
|
-
internals$
|
|
4876
|
+
internals$17.rule = function(ret, rule) {
|
|
4810
4877
|
if (ret instanceof Errors$6.Report) {
|
|
4811
|
-
internals$
|
|
4878
|
+
internals$17.error(ret, rule);
|
|
4812
4879
|
return {
|
|
4813
4880
|
errors: [ret],
|
|
4814
4881
|
value: null
|
|
4815
4882
|
};
|
|
4816
4883
|
}
|
|
4817
4884
|
if (Array.isArray(ret) && ret[Common$17.symbols.errors]) {
|
|
4818
|
-
ret.forEach((report) => internals$
|
|
4885
|
+
ret.forEach((report) => internals$17.error(report, rule));
|
|
4819
4886
|
return {
|
|
4820
4887
|
errors: ret,
|
|
4821
4888
|
value: null
|
|
@@ -4826,15 +4893,15 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4826
4893
|
value: ret
|
|
4827
4894
|
};
|
|
4828
4895
|
};
|
|
4829
|
-
internals$
|
|
4896
|
+
internals$17.error = function(report, rule) {
|
|
4830
4897
|
if (rule.message) report._setTemplate(rule.message);
|
|
4831
4898
|
return report;
|
|
4832
4899
|
};
|
|
4833
|
-
internals$
|
|
4900
|
+
internals$17.finalize = function(value, errors, helpers$8) {
|
|
4834
4901
|
errors = errors || [];
|
|
4835
4902
|
const { schema: schema$2, state, prefs } = helpers$8;
|
|
4836
4903
|
if (errors.length) {
|
|
4837
|
-
const failover = internals$
|
|
4904
|
+
const failover = internals$17.default("failover", void 0, errors, helpers$8);
|
|
4838
4905
|
if (failover !== void 0) {
|
|
4839
4906
|
state.mainstay.tracer.value(state, "failover", value, failover);
|
|
4840
4907
|
value = failover;
|
|
@@ -4847,7 +4914,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4847
4914
|
for (const error of errors) assert$44(error instanceof Error || error instanceof Errors$6.Report, "error() must return an Error object");
|
|
4848
4915
|
} else errors = [schema$2._flags.error];
|
|
4849
4916
|
if (value === void 0) {
|
|
4850
|
-
const defaulted = internals$
|
|
4917
|
+
const defaulted = internals$17.default("default", value, errors, helpers$8);
|
|
4851
4918
|
state.mainstay.tracer.value(state, "default", value, defaulted);
|
|
4852
4919
|
value = defaulted;
|
|
4853
4920
|
}
|
|
@@ -4882,14 +4949,14 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4882
4949
|
}
|
|
4883
4950
|
return result;
|
|
4884
4951
|
};
|
|
4885
|
-
internals$
|
|
4952
|
+
internals$17.prefs = function(schema$2, prefs) {
|
|
4886
4953
|
const isDefaultOptions = prefs === Common$17.defaults;
|
|
4887
4954
|
if (isDefaultOptions && schema$2._preferences[Common$17.symbols.prefs]) return schema$2._preferences[Common$17.symbols.prefs];
|
|
4888
4955
|
prefs = Common$17.preferences(prefs, schema$2._preferences);
|
|
4889
4956
|
if (isDefaultOptions) schema$2._preferences[Common$17.symbols.prefs] = prefs;
|
|
4890
4957
|
return prefs;
|
|
4891
4958
|
};
|
|
4892
|
-
internals$
|
|
4959
|
+
internals$17.default = function(flag, value, errors, helpers$8) {
|
|
4893
4960
|
const { schema: schema$2, state, prefs } = helpers$8;
|
|
4894
4961
|
const source = schema$2._flags[flag];
|
|
4895
4962
|
if (prefs.noDefaults || source === void 0) return value;
|
|
@@ -4909,13 +4976,13 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4909
4976
|
if (Common$17.isResolvable(source)) return source.resolve(value, state, prefs);
|
|
4910
4977
|
return clone$11(source);
|
|
4911
4978
|
};
|
|
4912
|
-
internals$
|
|
4979
|
+
internals$17.trim = function(value, schema$2) {
|
|
4913
4980
|
if (typeof value !== "string") return value;
|
|
4914
4981
|
const trim = schema$2.$_getRule("trim");
|
|
4915
4982
|
if (!trim || !trim.args.enabled) return value;
|
|
4916
4983
|
return value.trim();
|
|
4917
4984
|
};
|
|
4918
|
-
internals$
|
|
4985
|
+
internals$17.ignore = {
|
|
4919
4986
|
active: false,
|
|
4920
4987
|
debug: ignore,
|
|
4921
4988
|
entry: ignore,
|
|
@@ -4924,7 +4991,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4924
4991
|
resolve: ignore,
|
|
4925
4992
|
value: ignore
|
|
4926
4993
|
};
|
|
4927
|
-
internals$
|
|
4994
|
+
internals$17.errorsArray = function() {
|
|
4928
4995
|
const errors = [];
|
|
4929
4996
|
errors[Common$17.symbols.errors] = true;
|
|
4930
4997
|
return errors;
|
|
@@ -4933,12 +5000,12 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4933
5000
|
var require_values$1 = __commonJSMin((exports, module) => {
|
|
4934
5001
|
const { assert: assert$43, deepEqual: deepEqual$2 } = require_lib$4();
|
|
4935
5002
|
const Common$16 = require_common$3();
|
|
4936
|
-
const internals$
|
|
4937
|
-
module.exports = internals$
|
|
5003
|
+
const internals$16 = {};
|
|
5004
|
+
module.exports = internals$16.Values = class {
|
|
4938
5005
|
constructor(values$3, refs) {
|
|
4939
5006
|
this._values = new Set(values$3);
|
|
4940
5007
|
this._refs = new Set(refs);
|
|
4941
|
-
this._lowercase = internals$
|
|
5008
|
+
this._lowercase = internals$16.lowercases(values$3);
|
|
4942
5009
|
this._override = false;
|
|
4943
5010
|
}
|
|
4944
5011
|
get length() {
|
|
@@ -4958,7 +5025,7 @@ var require_values$1 = __commonJSMin((exports, module) => {
|
|
|
4958
5025
|
}
|
|
4959
5026
|
}
|
|
4960
5027
|
static merge(target, source, remove$1) {
|
|
4961
|
-
target = target || new internals$
|
|
5028
|
+
target = target || new internals$16.Values();
|
|
4962
5029
|
if (source) {
|
|
4963
5030
|
if (source._override) return source.clone();
|
|
4964
5031
|
for (const item of [...source._values, ...source._refs]) target.add(item);
|
|
@@ -5019,13 +5086,13 @@ var require_values$1 = __commonJSMin((exports, module) => {
|
|
|
5019
5086
|
return Array.from([...this._values, ...this._refs]);
|
|
5020
5087
|
}
|
|
5021
5088
|
clone() {
|
|
5022
|
-
const set = new internals$
|
|
5089
|
+
const set = new internals$16.Values(this._values, this._refs);
|
|
5023
5090
|
set._override = this._override;
|
|
5024
5091
|
return set;
|
|
5025
5092
|
}
|
|
5026
5093
|
concat(source) {
|
|
5027
5094
|
assert$43(!source._override, "Cannot concat override set of values");
|
|
5028
|
-
const set = new internals$
|
|
5095
|
+
const set = new internals$16.Values([...this._values, ...source._values], [...this._refs, ...source._refs]);
|
|
5029
5096
|
set._override = this._override;
|
|
5030
5097
|
return set;
|
|
5031
5098
|
}
|
|
@@ -5037,9 +5104,9 @@ var require_values$1 = __commonJSMin((exports, module) => {
|
|
|
5037
5104
|
return normalized;
|
|
5038
5105
|
}
|
|
5039
5106
|
};
|
|
5040
|
-
internals$
|
|
5041
|
-
internals$
|
|
5042
|
-
internals$
|
|
5107
|
+
internals$16.Values.prototype[Common$16.symbols.values] = true;
|
|
5108
|
+
internals$16.Values.prototype.slice = internals$16.Values.prototype.clone;
|
|
5109
|
+
internals$16.lowercases = function(from$2) {
|
|
5043
5110
|
const map$8 = new Map();
|
|
5044
5111
|
if (from$2) {
|
|
5045
5112
|
for (const value of from$2) if (typeof value === "string") map$8.set(value.toLowerCase(), value);
|
|
@@ -5051,18 +5118,18 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5051
5118
|
const { assert: assert$42, clone: clone$10, deepEqual: deepEqual$1, merge: merge$2 } = require_lib$4();
|
|
5052
5119
|
const Cache$2 = require_cache();
|
|
5053
5120
|
const Common$15 = require_common$3();
|
|
5054
|
-
const Compile$
|
|
5121
|
+
const Compile$6 = require_compile$1();
|
|
5055
5122
|
const Errors$5 = require_errors$2();
|
|
5056
5123
|
const Extend$2 = require_extend$1();
|
|
5057
5124
|
const Manifest$2 = require_manifest();
|
|
5058
|
-
const Messages$
|
|
5125
|
+
const Messages$4 = require_messages();
|
|
5059
5126
|
const Modify = require_modify();
|
|
5060
5127
|
const Ref$8 = require_ref$2();
|
|
5061
5128
|
const Trace$2 = require_trace();
|
|
5062
5129
|
const Validator = require_validator();
|
|
5063
5130
|
const Values$1 = require_values$1();
|
|
5064
|
-
const internals$
|
|
5065
|
-
internals$
|
|
5131
|
+
const internals$15 = {};
|
|
5132
|
+
internals$15.Base = class {
|
|
5066
5133
|
constructor(type) {
|
|
5067
5134
|
this.type = type;
|
|
5068
5135
|
this.$_root = null;
|
|
@@ -5248,7 +5315,7 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5248
5315
|
when(condition, options) {
|
|
5249
5316
|
const obj = this.clone();
|
|
5250
5317
|
if (!obj.$_terms.whens) obj.$_terms.whens = [];
|
|
5251
|
-
const when = Compile$
|
|
5318
|
+
const when = Compile$6.when(obj, condition, options);
|
|
5252
5319
|
if (!["any", "link"].includes(obj.type)) {
|
|
5253
5320
|
const conditions = when.is ? [when] : when.switch;
|
|
5254
5321
|
for (const item of conditions) {
|
|
@@ -5456,11 +5523,11 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5456
5523
|
return obj;
|
|
5457
5524
|
}
|
|
5458
5525
|
$_compile(schema$2, options) {
|
|
5459
|
-
return Compile$
|
|
5526
|
+
return Compile$6.schema(this.$_root, schema$2, options);
|
|
5460
5527
|
}
|
|
5461
5528
|
$_createError(code$1, value, local, state, prefs, options = {}) {
|
|
5462
5529
|
const flags = options.flags !== false ? this._flags : {};
|
|
5463
|
-
const messages$3 = options.messages ? Messages$
|
|
5530
|
+
const messages$3 = options.messages ? Messages$4.merge(this._definition.messages, options.messages) : this._definition.messages;
|
|
5464
5531
|
return new Errors$5.Report(code$1, value, local, flags, messages$3, state, prefs);
|
|
5465
5532
|
}
|
|
5466
5533
|
$_getFlag(name$3) {
|
|
@@ -5710,225 +5777,25 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5710
5777
|
};
|
|
5711
5778
|
}
|
|
5712
5779
|
};
|
|
5713
|
-
internals$
|
|
5780
|
+
internals$15.Base.prototype[Common$15.symbols.any] = {
|
|
5714
5781
|
version: Common$15.version,
|
|
5715
|
-
compile: Compile$
|
|
5782
|
+
compile: Compile$6.compile,
|
|
5716
5783
|
root: "$_root"
|
|
5717
5784
|
};
|
|
5718
|
-
internals$
|
|
5719
|
-
internals$
|
|
5720
|
-
internals$
|
|
5721
|
-
internals$
|
|
5722
|
-
internals$
|
|
5723
|
-
internals$
|
|
5724
|
-
internals$
|
|
5725
|
-
internals$
|
|
5726
|
-
module.exports = new internals$
|
|
5727
|
-
});
|
|
5728
|
-
var package_exports$1 = {};
|
|
5729
|
-
__export(package_exports$1, {
|
|
5730
|
-
browser: () => browser,
|
|
5731
|
-
default: () => package_default$1,
|
|
5732
|
-
dependencies: () => dependencies$1,
|
|
5733
|
-
description: () => description$1,
|
|
5734
|
-
devDependencies: () => devDependencies$1,
|
|
5735
|
-
engines: () => engines,
|
|
5736
|
-
files: () => files$1,
|
|
5737
|
-
keywords: () => keywords$1,
|
|
5738
|
-
license: () => license$1,
|
|
5739
|
-
main: () => main$1,
|
|
5740
|
-
name: () => name$2,
|
|
5741
|
-
repository: () => repository$1,
|
|
5742
|
-
scripts: () => scripts$1,
|
|
5743
|
-
types: () => types,
|
|
5744
|
-
version: () => version$3
|
|
5745
|
-
});
|
|
5746
|
-
var name$2, description$1, version$3, repository$1, engines, main$1, types, browser, files$1, keywords$1, dependencies$1, devDependencies$1, scripts$1, license$1, package_default$1;
|
|
5747
|
-
var init_package$1 = __esmMin(() => {
|
|
5748
|
-
name$2 = "joi";
|
|
5749
|
-
description$1 = "Object schema validation";
|
|
5750
|
-
version$3 = "18.0.2";
|
|
5751
|
-
repository$1 = {
|
|
5752
|
-
"url": "git://github.com/hapijs/joi",
|
|
5753
|
-
"type": "git"
|
|
5754
|
-
};
|
|
5755
|
-
engines = { "node": ">= 20" };
|
|
5756
|
-
main$1 = "lib/index.js";
|
|
5757
|
-
types = "lib/index.d.ts";
|
|
5758
|
-
browser = "dist/joi-browser.min.js";
|
|
5759
|
-
files$1 = ["lib/**/*", "dist/*"];
|
|
5760
|
-
keywords$1 = ["schema", "validation"];
|
|
5761
|
-
dependencies$1 = {
|
|
5762
|
-
"@hapi/address": "^5.1.1",
|
|
5763
|
-
"@hapi/formula": "^3.0.2",
|
|
5764
|
-
"@hapi/hoek": "^11.0.7",
|
|
5765
|
-
"@hapi/pinpoint": "^2.0.1",
|
|
5766
|
-
"@hapi/tlds": "^1.1.1",
|
|
5767
|
-
"@hapi/topo": "^6.0.2",
|
|
5768
|
-
"@standard-schema/spec": "^1.0.0"
|
|
5769
|
-
};
|
|
5770
|
-
devDependencies$1 = {
|
|
5771
|
-
"@hapi/bourne": "^3.0.0",
|
|
5772
|
-
"@hapi/code": "^9.0.3",
|
|
5773
|
-
"@hapi/eslint-plugin": "^7.0.0",
|
|
5774
|
-
"@hapi/joi-legacy-test": "npm:@hapi/joi@15.x.x",
|
|
5775
|
-
"@hapi/lab": "^26.0.0",
|
|
5776
|
-
"@types/node": "^20.17.47",
|
|
5777
|
-
"typescript": "^5.8.3"
|
|
5778
|
-
};
|
|
5779
|
-
scripts$1 = {
|
|
5780
|
-
"prepublishOnly": "cd browser && npm install && npm run build",
|
|
5781
|
-
"test": "lab -t 100 -a @hapi/code -L -Y",
|
|
5782
|
-
"test-cov-html": "lab -r html -o coverage.html -a @hapi/code"
|
|
5783
|
-
};
|
|
5784
|
-
license$1 = "BSD-3-Clause";
|
|
5785
|
-
package_default$1 = {
|
|
5786
|
-
name: name$2,
|
|
5787
|
-
description: description$1,
|
|
5788
|
-
version: version$3,
|
|
5789
|
-
repository: repository$1,
|
|
5790
|
-
engines,
|
|
5791
|
-
main: main$1,
|
|
5792
|
-
types,
|
|
5793
|
-
browser,
|
|
5794
|
-
files: files$1,
|
|
5795
|
-
keywords: keywords$1,
|
|
5796
|
-
dependencies: dependencies$1,
|
|
5797
|
-
devDependencies: devDependencies$1,
|
|
5798
|
-
scripts: scripts$1,
|
|
5799
|
-
license: license$1
|
|
5800
|
-
};
|
|
5801
|
-
});
|
|
5802
|
-
var require_common$4 = __commonJSMin((exports) => {
|
|
5803
|
-
const { assert: Assert$1, AssertError: AssertError$1 } = require_lib$4();
|
|
5804
|
-
const Pkg = (init_package$1(), __toCommonJS(package_exports$1).default);
|
|
5805
|
-
let Messages$4;
|
|
5806
|
-
let Schemas$3;
|
|
5807
|
-
const internals$15 = { isoDate: /^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/ };
|
|
5808
|
-
exports.version = Pkg.version;
|
|
5809
|
-
exports.defaults = {
|
|
5810
|
-
abortEarly: true,
|
|
5811
|
-
allowUnknown: false,
|
|
5812
|
-
artifacts: false,
|
|
5813
|
-
cache: true,
|
|
5814
|
-
context: null,
|
|
5815
|
-
convert: true,
|
|
5816
|
-
dateFormat: "iso",
|
|
5817
|
-
errors: {
|
|
5818
|
-
escapeHtml: false,
|
|
5819
|
-
label: "path",
|
|
5820
|
-
language: null,
|
|
5821
|
-
render: true,
|
|
5822
|
-
stack: false,
|
|
5823
|
-
wrap: {
|
|
5824
|
-
label: "\"",
|
|
5825
|
-
array: "[]"
|
|
5826
|
-
}
|
|
5827
|
-
},
|
|
5828
|
-
externals: true,
|
|
5829
|
-
messages: {},
|
|
5830
|
-
nonEnumerables: false,
|
|
5831
|
-
noDefaults: false,
|
|
5832
|
-
presence: "optional",
|
|
5833
|
-
skipFunctions: false,
|
|
5834
|
-
stripUnknown: false,
|
|
5835
|
-
warnings: false
|
|
5836
|
-
};
|
|
5837
|
-
exports.symbols = {
|
|
5838
|
-
any: Symbol.for("@hapi/joi/schema"),
|
|
5839
|
-
arraySingle: Symbol("arraySingle"),
|
|
5840
|
-
deepDefault: Symbol("deepDefault"),
|
|
5841
|
-
errors: Symbol("errors"),
|
|
5842
|
-
literal: Symbol("literal"),
|
|
5843
|
-
override: Symbol("override"),
|
|
5844
|
-
parent: Symbol("parent"),
|
|
5845
|
-
prefs: Symbol("prefs"),
|
|
5846
|
-
ref: Symbol("ref"),
|
|
5847
|
-
template: Symbol("template"),
|
|
5848
|
-
values: Symbol("values")
|
|
5849
|
-
};
|
|
5850
|
-
exports.assertOptions = function(options, keys$10, name$3 = "Options") {
|
|
5851
|
-
Assert$1(options && typeof options === "object" && !Array.isArray(options), "Options must be of type object");
|
|
5852
|
-
const unknownKeys = Object.keys(options).filter((k) => !keys$10.includes(k));
|
|
5853
|
-
Assert$1(unknownKeys.length === 0, `${name$3} contain unknown keys: ${unknownKeys}`);
|
|
5854
|
-
};
|
|
5855
|
-
exports.checkPreferences = function(prefs) {
|
|
5856
|
-
Schemas$3 = Schemas$3 || require_schemas();
|
|
5857
|
-
const result = Schemas$3.preferences.validate(prefs);
|
|
5858
|
-
if (result.error) throw new AssertError$1([result.error.details[0].message]);
|
|
5859
|
-
};
|
|
5860
|
-
exports.compare = function(a$2, b, operator$1) {
|
|
5861
|
-
switch (operator$1) {
|
|
5862
|
-
case "=": return a$2 === b;
|
|
5863
|
-
case ">": return a$2 > b;
|
|
5864
|
-
case "<": return a$2 < b;
|
|
5865
|
-
case ">=": return a$2 >= b;
|
|
5866
|
-
case "<=": return a$2 <= b;
|
|
5867
|
-
}
|
|
5868
|
-
};
|
|
5869
|
-
exports.default = function(value, defaultValue) {
|
|
5870
|
-
return value === void 0 ? defaultValue : value;
|
|
5871
|
-
};
|
|
5872
|
-
exports.isIsoDate = function(date) {
|
|
5873
|
-
return internals$15.isoDate.test(date);
|
|
5874
|
-
};
|
|
5875
|
-
exports.isNumber = function(value) {
|
|
5876
|
-
return typeof value === "number" && !isNaN(value);
|
|
5877
|
-
};
|
|
5878
|
-
exports.isResolvable = function(obj) {
|
|
5879
|
-
if (!obj) return false;
|
|
5880
|
-
return obj[exports.symbols.ref] || obj[exports.symbols.template];
|
|
5881
|
-
};
|
|
5882
|
-
exports.isSchema = function(schema$2, options = {}) {
|
|
5883
|
-
const any = schema$2 && schema$2[exports.symbols.any];
|
|
5884
|
-
if (!any) return false;
|
|
5885
|
-
Assert$1(options.legacy || any.version === exports.version, "Cannot mix different versions of joi schemas");
|
|
5886
|
-
return true;
|
|
5887
|
-
};
|
|
5888
|
-
exports.isValues = function(obj) {
|
|
5889
|
-
return obj[exports.symbols.values];
|
|
5890
|
-
};
|
|
5891
|
-
exports.limit = function(value) {
|
|
5892
|
-
return Number.isSafeInteger(value) && value >= 0;
|
|
5893
|
-
};
|
|
5894
|
-
exports.preferences = function(target, source) {
|
|
5895
|
-
Messages$4 = Messages$4 || require_messages();
|
|
5896
|
-
target = target || {};
|
|
5897
|
-
source = source || {};
|
|
5898
|
-
const merged = Object.assign({}, target, source);
|
|
5899
|
-
if (source.errors && target.errors) {
|
|
5900
|
-
merged.errors = Object.assign({}, target.errors, source.errors);
|
|
5901
|
-
merged.errors.wrap = Object.assign({}, target.errors.wrap, source.errors.wrap);
|
|
5902
|
-
}
|
|
5903
|
-
if (source.messages) merged.messages = Messages$4.compile(source.messages, target.messages);
|
|
5904
|
-
delete merged[exports.symbols.prefs];
|
|
5905
|
-
return merged;
|
|
5906
|
-
};
|
|
5907
|
-
exports.tryWithPath = function(fn$1, key, options = {}) {
|
|
5908
|
-
try {
|
|
5909
|
-
return fn$1();
|
|
5910
|
-
} catch (err) {
|
|
5911
|
-
if (err.path !== void 0) err.path = key + "." + err.path;
|
|
5912
|
-
else err.path = key;
|
|
5913
|
-
if (options.append) err.message = `${err.message} (${err.path})`;
|
|
5914
|
-
throw err;
|
|
5915
|
-
}
|
|
5916
|
-
};
|
|
5917
|
-
exports.validateArg = function(value, label, { assert: assert$55, message }) {
|
|
5918
|
-
if (exports.isSchema(assert$55)) {
|
|
5919
|
-
const result = assert$55.validate(value);
|
|
5920
|
-
if (!result.error) return;
|
|
5921
|
-
return result.error.message;
|
|
5922
|
-
} else if (!assert$55(value)) return label ? `${label} ${message}` : message;
|
|
5923
|
-
};
|
|
5924
|
-
exports.verifyFlat = function(args$1, method$1) {
|
|
5925
|
-
for (const arg of args$1) Assert$1(!Array.isArray(arg), "Method no longer accepts array arguments:", method$1);
|
|
5926
|
-
};
|
|
5785
|
+
internals$15.Base.prototype.isImmutable = true;
|
|
5786
|
+
internals$15.Base.prototype.deny = internals$15.Base.prototype.invalid;
|
|
5787
|
+
internals$15.Base.prototype.disallow = internals$15.Base.prototype.invalid;
|
|
5788
|
+
internals$15.Base.prototype.equal = internals$15.Base.prototype.valid;
|
|
5789
|
+
internals$15.Base.prototype.exist = internals$15.Base.prototype.required;
|
|
5790
|
+
internals$15.Base.prototype.not = internals$15.Base.prototype.invalid;
|
|
5791
|
+
internals$15.Base.prototype.options = internals$15.Base.prototype.prefs;
|
|
5792
|
+
internals$15.Base.prototype.preferences = internals$15.Base.prototype.prefs;
|
|
5793
|
+
module.exports = new internals$15.Base();
|
|
5927
5794
|
});
|
|
5928
5795
|
var require_any = __commonJSMin((exports, module) => {
|
|
5929
5796
|
const { assert: assert$41 } = require_lib$4();
|
|
5930
5797
|
const Base$3 = require_base$2();
|
|
5931
|
-
const Common$14 = require_common$
|
|
5798
|
+
const Common$14 = require_common$3();
|
|
5932
5799
|
const Messages$3 = require_messages();
|
|
5933
5800
|
module.exports = Base$3.extend({
|
|
5934
5801
|
type: "any",
|
|
@@ -6236,8 +6103,8 @@ var require_compile = __commonJSMin((exports) => {
|
|
|
6236
6103
|
var require_alternatives = __commonJSMin((exports, module) => {
|
|
6237
6104
|
const { assert: assert$39, merge: merge$1 } = require_lib$4();
|
|
6238
6105
|
const Any$9 = require_any();
|
|
6239
|
-
const Common$12 = require_common$
|
|
6240
|
-
const Compile$
|
|
6106
|
+
const Common$12 = require_common$3();
|
|
6107
|
+
const Compile$5 = require_compile();
|
|
6241
6108
|
const Errors$4 = require_errors$2();
|
|
6242
6109
|
const Ref$6 = require_ref$2();
|
|
6243
6110
|
const internals$13 = {};
|
|
@@ -6325,7 +6192,7 @@ var require_alternatives = __commonJSMin((exports, module) => {
|
|
|
6325
6192
|
assert$39(!this._flags.match, "Cannot combine match mode", this._flags.match, "with conditional rule");
|
|
6326
6193
|
assert$39(options.break === void 0, "Cannot use break option with alternatives conditional");
|
|
6327
6194
|
const obj = this.clone();
|
|
6328
|
-
const match$2 = Compile$
|
|
6195
|
+
const match$2 = Compile$5.when(obj, condition, options);
|
|
6329
6196
|
const conditions = match$2.is ? [match$2] : match$2.switch;
|
|
6330
6197
|
for (const item of conditions) if (item.then && item.otherwise) {
|
|
6331
6198
|
obj.$_setFlag("_endedSwitch", true, { clone: false });
|
|
@@ -6446,8 +6313,8 @@ var require_alternatives = __commonJSMin((exports, module) => {
|
|
|
6446
6313
|
var require_array = __commonJSMin((exports, module) => {
|
|
6447
6314
|
const { assert: assert$38, deepEqual, reach } = require_lib$4();
|
|
6448
6315
|
const Any$8 = require_any();
|
|
6449
|
-
const Common$11 = require_common$
|
|
6450
|
-
const Compile$
|
|
6316
|
+
const Common$11 = require_common$3();
|
|
6317
|
+
const Compile$4 = require_compile();
|
|
6451
6318
|
const internals$12 = {};
|
|
6452
6319
|
module.exports = Any$8.extend({
|
|
6453
6320
|
type: "array",
|
|
@@ -6748,7 +6615,7 @@ var require_array = __commonJSMin((exports, module) => {
|
|
|
6748
6615
|
Common$11.assertOptions(options, ["by", "order"]);
|
|
6749
6616
|
const settings = { order: options.order || "ascending" };
|
|
6750
6617
|
if (options.by) {
|
|
6751
|
-
settings.by = Compile$
|
|
6618
|
+
settings.by = Compile$4.ref(options.by, { ancestor: 0 });
|
|
6752
6619
|
assert$38(!settings.by.ancestor, "Cannot sort by ancestor");
|
|
6753
6620
|
}
|
|
6754
6621
|
return this.$_addRule({
|
|
@@ -6975,7 +6842,7 @@ var require_array = __commonJSMin((exports, module) => {
|
|
|
6975
6842
|
var require_boolean = __commonJSMin((exports, module) => {
|
|
6976
6843
|
const { assert: assert$37 } = require_lib$4();
|
|
6977
6844
|
const Any$7 = require_any();
|
|
6978
|
-
const Common$10 = require_common$
|
|
6845
|
+
const Common$10 = require_common$3();
|
|
6979
6846
|
const Values = require_values$1();
|
|
6980
6847
|
const internals$11 = {};
|
|
6981
6848
|
internals$11.isBool = function(value) {
|
|
@@ -7062,7 +6929,7 @@ var require_boolean = __commonJSMin((exports, module) => {
|
|
|
7062
6929
|
var require_date = __commonJSMin((exports, module) => {
|
|
7063
6930
|
const { assert: assert$36 } = require_lib$4();
|
|
7064
6931
|
const Any$6 = require_any();
|
|
7065
|
-
const Common$9 = require_common$
|
|
6932
|
+
const Common$9 = require_common$3();
|
|
7066
6933
|
const Template$4 = require_template();
|
|
7067
6934
|
const internals$10 = {};
|
|
7068
6935
|
internals$10.isDate = function(value) {
|
|
@@ -7333,8 +7200,8 @@ var require_keys$1 = __commonJSMin((exports, module) => {
|
|
|
7333
7200
|
const { applyToDefaults, assert: assert$34, clone: Clone } = require_lib$4();
|
|
7334
7201
|
const Topo = require_lib$1();
|
|
7335
7202
|
const Any$5 = require_any();
|
|
7336
|
-
const Common$8 = require_common$
|
|
7337
|
-
const Compile$
|
|
7203
|
+
const Common$8 = require_common$3();
|
|
7204
|
+
const Compile$3 = require_compile();
|
|
7338
7205
|
const Errors$3 = require_errors$2();
|
|
7339
7206
|
const Ref$5 = require_ref$2();
|
|
7340
7207
|
const Template$3 = require_template();
|
|
@@ -7430,7 +7297,7 @@ var require_keys$1 = __commonJSMin((exports, module) => {
|
|
|
7430
7297
|
} },
|
|
7431
7298
|
assert: {
|
|
7432
7299
|
method(subject, schema$2, message) {
|
|
7433
|
-
if (!Template$3.isTemplate(subject)) subject = Compile$
|
|
7300
|
+
if (!Template$3.isTemplate(subject)) subject = Compile$3.ref(subject);
|
|
7434
7301
|
assert$34(message === void 0 || typeof message === "string", "Message must be a string");
|
|
7435
7302
|
schema$2 = this.$_compile(schema$2, { appendPath: true });
|
|
7436
7303
|
const obj = this.$_addRule({
|
|
@@ -7725,13 +7592,13 @@ var require_keys$1 = __commonJSMin((exports, module) => {
|
|
|
7725
7592
|
const paths = [];
|
|
7726
7593
|
for (const peer of peers) {
|
|
7727
7594
|
assert$34(typeof peer === "string", rel, "peers must be strings");
|
|
7728
|
-
paths.push(Compile$
|
|
7595
|
+
paths.push(Compile$3.ref(peer, {
|
|
7729
7596
|
separator,
|
|
7730
7597
|
ancestor: 0,
|
|
7731
7598
|
prefix: false
|
|
7732
7599
|
}));
|
|
7733
7600
|
}
|
|
7734
|
-
if (key !== null) key = Compile$
|
|
7601
|
+
if (key !== null) key = Compile$3.ref(key, {
|
|
7735
7602
|
separator,
|
|
7736
7603
|
ancestor: 0,
|
|
7737
7604
|
prefix: false
|
|
@@ -8087,8 +7954,8 @@ var require_function = __commonJSMin((exports, module) => {
|
|
|
8087
7954
|
var require_link = __commonJSMin((exports, module) => {
|
|
8088
7955
|
const { assert: assert$32 } = require_lib$4();
|
|
8089
7956
|
const Any$4 = require_any();
|
|
8090
|
-
const Common$7 = require_common$
|
|
8091
|
-
const Compile$
|
|
7957
|
+
const Common$7 = require_common$3();
|
|
7958
|
+
const Compile$2 = require_compile();
|
|
8092
7959
|
const Errors$2 = require_errors$2();
|
|
8093
7960
|
const internals$7 = {};
|
|
8094
7961
|
module.exports = Any$4.extend({
|
|
@@ -8114,7 +7981,7 @@ var require_link = __commonJSMin((exports, module) => {
|
|
|
8114
7981
|
rules: {
|
|
8115
7982
|
ref: { method(ref) {
|
|
8116
7983
|
assert$32(!this.$_terms.link, "Cannot reinitialize schema");
|
|
8117
|
-
ref = Compile$
|
|
7984
|
+
ref = Compile$2.ref(ref);
|
|
8118
7985
|
assert$32(ref.type === "value" || ref.type === "local", "Invalid reference type:", ref.type);
|
|
8119
7986
|
assert$32(ref.type === "local" || ref.ancestor === "root" || ref.ancestor > 0, "Link cannot reference itself");
|
|
8120
7987
|
const obj = this.clone();
|
|
@@ -8191,7 +8058,7 @@ var require_link = __commonJSMin((exports, module) => {
|
|
|
8191
8058
|
var require_number = __commonJSMin((exports, module) => {
|
|
8192
8059
|
const { assert: assert$31 } = require_lib$4();
|
|
8193
8060
|
const Any$3 = require_any();
|
|
8194
|
-
const Common$6 = require_common$
|
|
8061
|
+
const Common$6 = require_common$3();
|
|
8195
8062
|
const internals$6 = {
|
|
8196
8063
|
numberRx: /^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,
|
|
8197
8064
|
precisionRx: /(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,
|
|
@@ -12478,7 +12345,7 @@ var require_string$1 = __commonJSMin((exports, module) => {
|
|
|
12478
12345
|
const { isDomainValid, isEmailValid, ipRegex, uriRegex } = (init_esm(), __toCommonJS(esm_exports));
|
|
12479
12346
|
const Tlds = require_commonjs();
|
|
12480
12347
|
const Any$2 = require_any();
|
|
12481
|
-
const Common$5 = require_common$
|
|
12348
|
+
const Common$5 = require_common$3();
|
|
12482
12349
|
const internals$5 = {
|
|
12483
12350
|
tlds: Tlds.tlds instanceof Set ? { tlds: {
|
|
12484
12351
|
allow: Tlds.tlds,
|
|
@@ -13195,7 +13062,7 @@ var require_binary = __commonJSMin((exports, module) => {
|
|
|
13195
13062
|
init_dist$1();
|
|
13196
13063
|
const { assert: assert$26 } = require_lib$4();
|
|
13197
13064
|
const Any = require_any();
|
|
13198
|
-
const Common$4 = require_common$
|
|
13065
|
+
const Common$4 = require_common$3();
|
|
13199
13066
|
module.exports = Any.extend({
|
|
13200
13067
|
type: "binary",
|
|
13201
13068
|
coerce: {
|
|
@@ -13276,7 +13143,7 @@ var require_lib = __commonJSMin((exports, module) => {
|
|
|
13276
13143
|
const { assert: assert$25, clone: clone$9 } = require_lib$4();
|
|
13277
13144
|
const Cache$1 = require_cache();
|
|
13278
13145
|
const Common$3 = require_common$3();
|
|
13279
|
-
const Compile = (
|
|
13146
|
+
const Compile$1 = require_compile$1();
|
|
13280
13147
|
const Errors$1 = require_errors$2();
|
|
13281
13148
|
const Extend$1 = require_extend$1();
|
|
13282
13149
|
const Manifest$1 = require_manifest();
|
|
@@ -13363,7 +13230,7 @@ var require_lib = __commonJSMin((exports, module) => {
|
|
|
13363
13230
|
Common$3.checkPreferences(prefs);
|
|
13364
13231
|
},
|
|
13365
13232
|
compile(schema$2, options) {
|
|
13366
|
-
return Compile.compile(this, schema$2, options);
|
|
13233
|
+
return Compile$1.compile(this, schema$2, options);
|
|
13367
13234
|
},
|
|
13368
13235
|
defaults(modifier) {
|
|
13369
13236
|
assert$25(typeof modifier === "function", "modifier must be a function");
|
|
@@ -13665,16 +13532,14 @@ var require_schemas = __commonJSMin((exports) => {
|
|
|
13665
13532
|
link: internals$2.desc.ref
|
|
13666
13533
|
}).pattern(/^[a-z]\w*$/, Joi$1.any());
|
|
13667
13534
|
});
|
|
13668
|
-
var require_common$3 = __commonJSMin((exports
|
|
13669
|
-
|
|
13670
|
-
|
|
13671
|
-
init_lib();
|
|
13535
|
+
var require_common$3 = __commonJSMin((exports) => {
|
|
13536
|
+
const { assert: Assert, AssertError } = require_lib$4();
|
|
13537
|
+
const Pkg = (init_package$1(), __toCommonJS(package_exports$1).default);
|
|
13672
13538
|
let Messages$2;
|
|
13673
13539
|
let Schemas$1;
|
|
13674
13540
|
const internals$1 = { isoDate: /^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/ };
|
|
13675
|
-
|
|
13676
|
-
exports
|
|
13677
|
-
exports$1.defaults = {
|
|
13541
|
+
exports.version = Pkg.version;
|
|
13542
|
+
exports.defaults = {
|
|
13678
13543
|
abortEarly: true,
|
|
13679
13544
|
allowUnknown: false,
|
|
13680
13545
|
artifacts: false,
|
|
@@ -13702,7 +13567,7 @@ var require_common$3 = __commonJSMin((exports, module) => {
|
|
|
13702
13567
|
stripUnknown: false,
|
|
13703
13568
|
warnings: false
|
|
13704
13569
|
};
|
|
13705
|
-
exports
|
|
13570
|
+
exports.symbols = {
|
|
13706
13571
|
any: Symbol.for("@hapi/joi/schema"),
|
|
13707
13572
|
arraySingle: Symbol("arraySingle"),
|
|
13708
13573
|
deepDefault: Symbol("deepDefault"),
|
|
@@ -13713,20 +13578,19 @@ var require_common$3 = __commonJSMin((exports, module) => {
|
|
|
13713
13578
|
prefs: Symbol("prefs"),
|
|
13714
13579
|
ref: Symbol("ref"),
|
|
13715
13580
|
template: Symbol("template"),
|
|
13716
|
-
values: Symbol("values")
|
|
13717
|
-
override: Symbol("override")
|
|
13581
|
+
values: Symbol("values")
|
|
13718
13582
|
};
|
|
13719
|
-
exports
|
|
13720
|
-
(
|
|
13583
|
+
exports.assertOptions = function(options, keys$10, name$3 = "Options") {
|
|
13584
|
+
Assert(options && typeof options === "object" && !Array.isArray(options), "Options must be of type object");
|
|
13721
13585
|
const unknownKeys = Object.keys(options).filter((k) => !keys$10.includes(k));
|
|
13722
|
-
(
|
|
13586
|
+
Assert(unknownKeys.length === 0, `${name$3} contain unknown keys: ${unknownKeys}`);
|
|
13723
13587
|
};
|
|
13724
|
-
exports
|
|
13725
|
-
Schemas$1 = Schemas$1 ||
|
|
13588
|
+
exports.checkPreferences = function(prefs) {
|
|
13589
|
+
Schemas$1 = Schemas$1 || require_schemas();
|
|
13726
13590
|
const result = Schemas$1.preferences.validate(prefs);
|
|
13727
|
-
if (result.error) throw new
|
|
13591
|
+
if (result.error) throw new AssertError([result.error.details[0].message]);
|
|
13728
13592
|
};
|
|
13729
|
-
exports
|
|
13593
|
+
exports.compare = function(a$2, b, operator$1) {
|
|
13730
13594
|
switch (operator$1) {
|
|
13731
13595
|
case "=": return a$2 === b;
|
|
13732
13596
|
case ">": return a$2 > b;
|
|
@@ -13735,32 +13599,32 @@ var require_common$3 = __commonJSMin((exports, module) => {
|
|
|
13735
13599
|
case "<=": return a$2 <= b;
|
|
13736
13600
|
}
|
|
13737
13601
|
};
|
|
13738
|
-
exports
|
|
13602
|
+
exports.default = function(value, defaultValue) {
|
|
13739
13603
|
return value === void 0 ? defaultValue : value;
|
|
13740
13604
|
};
|
|
13741
|
-
exports
|
|
13605
|
+
exports.isIsoDate = function(date) {
|
|
13742
13606
|
return internals$1.isoDate.test(date);
|
|
13743
13607
|
};
|
|
13744
|
-
exports
|
|
13608
|
+
exports.isNumber = function(value) {
|
|
13745
13609
|
return typeof value === "number" && !isNaN(value);
|
|
13746
13610
|
};
|
|
13747
|
-
exports
|
|
13611
|
+
exports.isResolvable = function(obj) {
|
|
13748
13612
|
if (!obj) return false;
|
|
13749
|
-
return obj[exports
|
|
13613
|
+
return obj[exports.symbols.ref] || obj[exports.symbols.template];
|
|
13750
13614
|
};
|
|
13751
|
-
exports
|
|
13752
|
-
const any = schema$2 && schema$2[exports
|
|
13615
|
+
exports.isSchema = function(schema$2, options = {}) {
|
|
13616
|
+
const any = schema$2 && schema$2[exports.symbols.any];
|
|
13753
13617
|
if (!any) return false;
|
|
13754
13618
|
return true;
|
|
13755
13619
|
};
|
|
13756
|
-
exports
|
|
13757
|
-
return obj[exports
|
|
13620
|
+
exports.isValues = function(obj) {
|
|
13621
|
+
return obj[exports.symbols.values];
|
|
13758
13622
|
};
|
|
13759
|
-
exports
|
|
13623
|
+
exports.limit = function(value) {
|
|
13760
13624
|
return Number.isSafeInteger(value) && value >= 0;
|
|
13761
13625
|
};
|
|
13762
|
-
exports
|
|
13763
|
-
Messages$2 = Messages$2 ||
|
|
13626
|
+
exports.preferences = function(target, source) {
|
|
13627
|
+
Messages$2 = Messages$2 || require_messages();
|
|
13764
13628
|
target = target || {};
|
|
13765
13629
|
source = source || {};
|
|
13766
13630
|
const merged = Object.assign({}, target, source);
|
|
@@ -13769,10 +13633,10 @@ var require_common$3 = __commonJSMin((exports, module) => {
|
|
|
13769
13633
|
merged.errors.wrap = Object.assign({}, target.errors.wrap, source.errors.wrap);
|
|
13770
13634
|
}
|
|
13771
13635
|
if (source.messages) merged.messages = Messages$2.compile(source.messages, target.messages);
|
|
13772
|
-
delete merged[exports
|
|
13636
|
+
delete merged[exports.symbols.prefs];
|
|
13773
13637
|
return merged;
|
|
13774
13638
|
};
|
|
13775
|
-
exports
|
|
13639
|
+
exports.tryWithPath = function(fn$1, key, options = {}) {
|
|
13776
13640
|
try {
|
|
13777
13641
|
return fn$1();
|
|
13778
13642
|
} catch (err) {
|
|
@@ -13782,17 +13646,16 @@ var require_common$3 = __commonJSMin((exports, module) => {
|
|
|
13782
13646
|
throw err;
|
|
13783
13647
|
}
|
|
13784
13648
|
};
|
|
13785
|
-
exports
|
|
13786
|
-
if (exports
|
|
13649
|
+
exports.validateArg = function(value, label, { assert: assert$55, message }) {
|
|
13650
|
+
if (exports.isSchema(assert$55)) {
|
|
13787
13651
|
const result = assert$55.validate(value);
|
|
13788
13652
|
if (!result.error) return;
|
|
13789
13653
|
return result.error.message;
|
|
13790
13654
|
} else if (!assert$55(value)) return label ? `${label} ${message}` : message;
|
|
13791
13655
|
};
|
|
13792
|
-
exports
|
|
13793
|
-
for (const arg of args$1) (
|
|
13656
|
+
exports.verifyFlat = function(args$1, method$1) {
|
|
13657
|
+
for (const arg of args$1) Assert(!Array.isArray(arg), "Method no longer accepts array arguments:", method$1);
|
|
13794
13658
|
};
|
|
13795
|
-
module.exports = exports$1;
|
|
13796
13659
|
});
|
|
13797
13660
|
var require_annotate = __commonJSMin((exports) => {
|
|
13798
13661
|
const { clone: clone$8 } = require_lib$4();
|
|
@@ -33089,7 +32952,7 @@ var init_package = __esmMin(() => {
|
|
|
33089
32952
|
};
|
|
33090
32953
|
});
|
|
33091
32954
|
var require_bn$1 = __commonJSMin((exports, module) => {
|
|
33092
|
-
(function(module$1, exports$
|
|
32955
|
+
(function(module$1, exports$1) {
|
|
33093
32956
|
"use strict";
|
|
33094
32957
|
function assert$55(val, msg) {
|
|
33095
32958
|
if (!val) throw new Error(msg || "Assertion failed");
|
|
@@ -33116,7 +32979,7 @@ var require_bn$1 = __commonJSMin((exports, module) => {
|
|
|
33116
32979
|
}
|
|
33117
32980
|
}
|
|
33118
32981
|
if (typeof module$1 === "object") module$1.exports = BN$14;
|
|
33119
|
-
else exports$
|
|
32982
|
+
else exports$1.BN = BN$14;
|
|
33120
32983
|
BN$14.BN = BN$14;
|
|
33121
32984
|
BN$14.wordSize = 26;
|
|
33122
32985
|
var Buffer$27;
|
|
@@ -41229,7 +41092,7 @@ var require_withPublic = __commonJSMin((exports, module) => {
|
|
|
41229
41092
|
module.exports = withPublic$2;
|
|
41230
41093
|
});
|
|
41231
41094
|
var require_bn = __commonJSMin((exports, module) => {
|
|
41232
|
-
(function(module$1, exports$
|
|
41095
|
+
(function(module$1, exports$1) {
|
|
41233
41096
|
"use strict";
|
|
41234
41097
|
function assert$55(val, msg) {
|
|
41235
41098
|
if (!val) throw new Error(msg || "Assertion failed");
|
|
@@ -41256,7 +41119,7 @@ var require_bn = __commonJSMin((exports, module) => {
|
|
|
41256
41119
|
}
|
|
41257
41120
|
}
|
|
41258
41121
|
if (typeof module$1 === "object") module$1.exports = BN$14;
|
|
41259
|
-
else exports$
|
|
41122
|
+
else exports$1.BN = BN$14;
|
|
41260
41123
|
BN$14.BN = BN$14;
|
|
41261
41124
|
BN$14.wordSize = 26;
|
|
41262
41125
|
var Buffer$27;
|
|
@@ -45975,7 +45838,7 @@ var import_trace = __toESM(require_trace());
|
|
|
45975
45838
|
var import_common = __toESM(require_common$3());
|
|
45976
45839
|
var import_errors = __toESM(require_errors$2());
|
|
45977
45840
|
var import_extend = __toESM(require_extend$1());
|
|
45978
|
-
|
|
45841
|
+
var import_compile = __toESM(require_compile$1());
|
|
45979
45842
|
var import_schemas = __toESM(require_schemas());
|
|
45980
45843
|
var import_manifest = __toESM(require_manifest());
|
|
45981
45844
|
var import_template = __toESM(require_template());
|
|
@@ -46015,7 +45878,7 @@ var RootFactory = class RootFactory {
|
|
|
46015
45878
|
static assertValue(value, schema$2, annotate, args$1) {
|
|
46016
45879
|
const message = args$1[0] instanceof Error || typeof args$1[0] === "string" ? args$1[0] : null;
|
|
46017
45880
|
const options = message !== null ? args$1[1] : args$1[0];
|
|
46018
|
-
const result = schema$2.validate(value, import_common.
|
|
45881
|
+
const result = schema$2.validate(value, import_common.preferences({ errors: { stack: true } }, options || {}));
|
|
46019
45882
|
let error = result.error;
|
|
46020
45883
|
if (!error) return result.value;
|
|
46021
45884
|
if (message instanceof Error) throw message;
|
|
@@ -46044,7 +45907,7 @@ var RootFactory = class RootFactory {
|
|
|
46044
45907
|
static getMethods() {
|
|
46045
45908
|
return {
|
|
46046
45909
|
ValidationError: import_errors.ValidationError,
|
|
46047
|
-
version: import_common.
|
|
45910
|
+
version: import_common.version,
|
|
46048
45911
|
cache: import_cache.provider,
|
|
46049
45912
|
assert(value, schema$2, ...args$1) {
|
|
46050
45913
|
RootFactory.assertValue(value, schema$2, true, args$1);
|
|
@@ -46053,21 +45916,21 @@ var RootFactory = class RootFactory {
|
|
|
46053
45916
|
return RootFactory.assertValue(value, schema$2, false, args$1);
|
|
46054
45917
|
},
|
|
46055
45918
|
build(desc$1) {
|
|
46056
|
-
(0, import_assert.default)(typeof import_manifest.
|
|
46057
|
-
return import_manifest.
|
|
45919
|
+
(0, import_assert.default)(typeof import_manifest.build === "function", "Manifest functionality disabled");
|
|
45920
|
+
return import_manifest.build(this, desc$1);
|
|
46058
45921
|
},
|
|
46059
45922
|
checkPreferences(prefs) {
|
|
46060
|
-
import_common.
|
|
45923
|
+
import_common.checkPreferences(prefs);
|
|
46061
45924
|
},
|
|
46062
45925
|
compile(schema$2, options) {
|
|
46063
|
-
return
|
|
45926
|
+
return import_compile.compile(this, schema$2, options);
|
|
46064
45927
|
},
|
|
46065
45928
|
defaults(modifier) {
|
|
46066
45929
|
(0, import_assert.default)(typeof modifier === "function", "modifier must be a function");
|
|
46067
45930
|
const joi$1 = { ...this };
|
|
46068
45931
|
for (const type of joi$1._types) {
|
|
46069
45932
|
const schema$2 = modifier(joi$1[type]());
|
|
46070
|
-
(0, import_assert.default)(import_common.
|
|
45933
|
+
(0, import_assert.default)(import_common.isSchema(schema$2), "modifier must return a valid schema object");
|
|
46071
45934
|
joi$1[type] = function(...args$1) {
|
|
46072
45935
|
return RootFactory.generate(this, schema$2, args$1);
|
|
46073
45936
|
};
|
|
@@ -46078,7 +45941,7 @@ var RootFactory = class RootFactory {
|
|
|
46078
45941
|
return new import_template.default(...args$1);
|
|
46079
45942
|
},
|
|
46080
45943
|
extend(...extensions) {
|
|
46081
|
-
import_common.
|
|
45944
|
+
import_common.verifyFlat(extensions, "extend");
|
|
46082
45945
|
(0, import_assert.default)(extensions.length, "You need to provide at least one extension");
|
|
46083
45946
|
this.assert(extensions, import_schemas.extensions);
|
|
46084
45947
|
const joi$1 = { ...this };
|
|
@@ -46102,11 +45965,11 @@ var RootFactory = class RootFactory {
|
|
|
46102
45965
|
isError: import_errors.ValidationError.isError,
|
|
46103
45966
|
isExpression: import_template.default.isTemplate,
|
|
46104
45967
|
isRef: import_ref.isRef,
|
|
46105
|
-
isSchema: import_common.
|
|
45968
|
+
isSchema: import_common.isSchema,
|
|
46106
45969
|
in(...args$1) {
|
|
46107
45970
|
return import_ref.in(...args$1);
|
|
46108
45971
|
},
|
|
46109
|
-
override: import_common.
|
|
45972
|
+
override: import_common.symbols.override,
|
|
46110
45973
|
ref(...args$1) {
|
|
46111
45974
|
return import_ref.create(...args$1);
|
|
46112
45975
|
},
|
|
@@ -52503,7 +52366,7 @@ var libphonenumber = { exports: {} };
|
|
|
52503
52366
|
libphonenumber.exports;
|
|
52504
52367
|
var hasRequiredLibphonenumber;
|
|
52505
52368
|
function requireLibphonenumber() {
|
|
52506
|
-
return hasRequiredLibphonenumber || (hasRequiredLibphonenumber = 1, function(module$1, exports$1
|
|
52369
|
+
return hasRequiredLibphonenumber || (hasRequiredLibphonenumber = 1, function(module$1, exports$1) {
|
|
52507
52370
|
(function(t$7) {
|
|
52508
52371
|
module$1.exports = t$7();
|
|
52509
52372
|
})(function() {
|
|
@@ -52530,7 +52393,7 @@ function requireLibphonenumber() {
|
|
|
52530
52393
|
return u;
|
|
52531
52394
|
}
|
|
52532
52395
|
return t$7;
|
|
52533
|
-
}()({ 1: [function(require$1, module$2, exports$1$
|
|
52396
|
+
}()({ 1: [function(require$1, module$2, exports$1$1) {
|
|
52534
52397
|
(function(global) {
|
|
52535
52398
|
(function() {
|
|
52536
52399
|
var $jscomp = $jscomp || {};
|
|
@@ -134337,7 +134200,7 @@ function requireLibphonenumber() {
|
|
|
134337
134200
|
return t$7 = o$2.replace(this.DIGIT_PATTERN_, t$7), this.formattingTemplate_.clear(), this.formattingTemplate_.append(t$7), this.lastMatchPosition_ = r$2, t$7.substring(0, this.lastMatchPosition_ + 1);
|
|
134338
134201
|
}
|
|
134339
134202
|
return this.possibleFormats_.length == 1 && (this.ableToFormat_ = !1), this.currentFormattingPattern_ = "", this.accruedInput_.toString();
|
|
134340
|
-
}, Object.defineProperty(exports$1$
|
|
134203
|
+
}, Object.defineProperty(exports$1$1, "__esModule", { value: !0 }), exports$1$1.default = i18n$1.phonenumbers, module$2.exports = exports$1$1.default;
|
|
134341
134204
|
}).call(this);
|
|
134342
134205
|
}).call(this, typeof commonjsGlobal < "u" ? commonjsGlobal : typeof self < "u" ? self : typeof window < "u" ? window : {});
|
|
134343
134206
|
}, {}] }, {}, [1])(1);
|
|
@@ -145090,7 +144953,7 @@ const encode = (schema$2, options = {}) => {
|
|
|
145090
144953
|
});
|
|
145091
144954
|
const flattened = flattie(sanitized);
|
|
145092
144955
|
return encode$1({
|
|
145093
|
-
version: "2.20251203.
|
|
144956
|
+
version: "2.20251203.1",
|
|
145094
144957
|
schema: flattened
|
|
145095
144958
|
});
|
|
145096
144959
|
};
|
|
@@ -145107,9 +144970,9 @@ const decode = (base64, options = {}) => {
|
|
|
145107
144970
|
}
|
|
145108
144971
|
if (!isPlainObject(decoded) || !("version" in decoded) || !("schema" in decoded) || typeof decoded.version !== "string" || !isPlainObject(decoded.schema)) throw new TypeError("Not a valid encoded schema");
|
|
145109
144972
|
const { version: schemaVersion, schema: schema$2 } = decoded;
|
|
145110
|
-
if (import_semver.valid("2.20251203.
|
|
144973
|
+
if (import_semver.valid("2.20251203.1")) {
|
|
145111
144974
|
if (!import_semver.valid(import_semver.coerce(schemaVersion))) throw new TypeError(`Invalid schema version: ${schemaVersion}`);
|
|
145112
|
-
if (import_semver.gt(import_semver.coerce(schemaVersion), "2.20251203.
|
|
144975
|
+
if (import_semver.gt(import_semver.coerce(schemaVersion), "2.20251203.1")) throw new TypeError(`Schema version ${schemaVersion} is not compatible with current version 2.20251203.1`);
|
|
145113
144976
|
if (import_semver.lt(import_semver.coerce(schemaVersion), "1.20251201.3") && import_semver.gt(import_semver.coerce(schemaVersion), "1.0.0")) throw new TypeError(`Legacy schema version ${schemaVersion} is unsupported due to encoding format changes`);
|
|
145114
144977
|
}
|
|
145115
144978
|
const description$2 = nestie(schema$2);
|
|
@@ -146576,7 +146439,7 @@ const ValidationError = import_lib$2.default.ValidationError;
|
|
|
146576
146439
|
init_esm();
|
|
146577
146440
|
var import_lib = __toESM(require_lib$3());
|
|
146578
146441
|
var import_lib$1 = __toESM(require_lib$2());
|
|
146579
|
-
const version = "2.20251203.
|
|
146442
|
+
const version = "2.20251203.1";
|
|
146580
146443
|
var location = import_lib$1.location;
|
|
146581
146444
|
export { ValidationError, esm_exports as address, decode, encode, import_lib as formula, location, tlds, validator, version };
|
|
146582
146445
|
|