@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.cjs
CHANGED
|
@@ -29,7 +29,7 @@ var __toESM = (mod$1, isNodeMode, target) => (target = mod$1 != null ? __create(
|
|
|
29
29
|
var __toCommonJS = (mod$1) => __copyProps(__defProp({}, "__esModule", { value: true }), mod$1);
|
|
30
30
|
const __nhtio_encoder = __toESM(require("@nhtio/encoder"));
|
|
31
31
|
var require_assertError = __commonJSMin((exports, module) => {
|
|
32
|
-
module.exports = class AssertError$
|
|
32
|
+
module.exports = class AssertError$3 extends Error {
|
|
33
33
|
name = "AssertError";
|
|
34
34
|
constructor(message, ctor) {
|
|
35
35
|
super(message || "Unknown error");
|
|
@@ -47,7 +47,7 @@ var require_stringify = __commonJSMin((exports, module) => {
|
|
|
47
47
|
};
|
|
48
48
|
});
|
|
49
49
|
var require_assert$1 = __commonJSMin((exports, module) => {
|
|
50
|
-
const AssertError$
|
|
50
|
+
const AssertError$2 = require_assertError();
|
|
51
51
|
const Stringify = require_stringify();
|
|
52
52
|
const assert$54 = module.exports = function(condition, ...args$1) {
|
|
53
53
|
if (condition) return;
|
|
@@ -55,7 +55,7 @@ var require_assert$1 = __commonJSMin((exports, module) => {
|
|
|
55
55
|
const msgs = args$1.filter((arg) => arg !== "").map((arg) => {
|
|
56
56
|
return typeof arg === "string" ? arg : arg instanceof Error ? arg.message : Stringify(arg);
|
|
57
57
|
});
|
|
58
|
-
throw new AssertError$
|
|
58
|
+
throw new AssertError$2(msgs.join(" "), assert$54);
|
|
59
59
|
};
|
|
60
60
|
});
|
|
61
61
|
var dist_exports = {};
|
|
@@ -243,15 +243,15 @@ var init_dist$1 = __esmMin(() => {
|
|
|
243
243
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
244
244
|
* @license MIT
|
|
245
245
|
*/
|
|
246
|
-
(function(exports$
|
|
246
|
+
(function(exports$1) {
|
|
247
247
|
const base64 = base64Js;
|
|
248
248
|
const ieee754$1 = ieee754;
|
|
249
249
|
const customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;
|
|
250
|
-
exports$
|
|
251
|
-
exports$
|
|
252
|
-
exports$
|
|
250
|
+
exports$1.Buffer = Buffer$27;
|
|
251
|
+
exports$1.SlowBuffer = SlowBuffer$1;
|
|
252
|
+
exports$1.INSPECT_MAX_BYTES = 50;
|
|
253
253
|
const K_MAX_LENGTH = 2147483647;
|
|
254
|
-
exports$
|
|
254
|
+
exports$1.kMaxLength = K_MAX_LENGTH;
|
|
255
255
|
const { Uint8Array: GlobalUint8Array, ArrayBuffer: GlobalArrayBuffer, SharedArrayBuffer: GlobalSharedArrayBuffer } = globalThis;
|
|
256
256
|
Buffer$27.TYPED_ARRAY_SUPPORT = typedArraySupport();
|
|
257
257
|
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.");
|
|
@@ -550,7 +550,7 @@ var init_dist$1 = __esmMin(() => {
|
|
|
550
550
|
};
|
|
551
551
|
Buffer$27.prototype.inspect = function inspect$5() {
|
|
552
552
|
let str = "";
|
|
553
|
-
const max$4 = exports$
|
|
553
|
+
const max$4 = exports$1.INSPECT_MAX_BYTES;
|
|
554
554
|
str = this.toString("hex", 0, max$4).replace(/(.{2})/g, "$1 ").trim();
|
|
555
555
|
if (this.length > max$4) str += " ... ";
|
|
556
556
|
return "<Buffer " + str + ">";
|
|
@@ -1502,26 +1502,26 @@ var init_dist$1 = __esmMin(() => {
|
|
|
1502
1502
|
transcode = buffer$1.transcode;
|
|
1503
1503
|
});
|
|
1504
1504
|
var require_reach = __commonJSMin((exports, module) => {
|
|
1505
|
-
const Assert$
|
|
1506
|
-
const internals$
|
|
1505
|
+
const Assert$5 = require_assert$1();
|
|
1506
|
+
const internals$41 = {};
|
|
1507
1507
|
module.exports = function(obj, chain, options) {
|
|
1508
1508
|
if (chain === false || chain === null || chain === void 0) return obj;
|
|
1509
1509
|
options = options || {};
|
|
1510
1510
|
if (typeof options === "string") options = { separator: options };
|
|
1511
1511
|
const isChainArray = Array.isArray(chain);
|
|
1512
|
-
Assert$
|
|
1512
|
+
Assert$5(!isChainArray || !options.separator, "Separator option is not valid for array-based chain");
|
|
1513
1513
|
const path = isChainArray ? chain : chain.split(options.separator || ".");
|
|
1514
1514
|
let ref = obj;
|
|
1515
1515
|
for (let i$1 = 0; i$1 < path.length; ++i$1) {
|
|
1516
1516
|
let key = path[i$1];
|
|
1517
|
-
const type = options.iterables && internals$
|
|
1517
|
+
const type = options.iterables && internals$41.iterables(ref);
|
|
1518
1518
|
if (Array.isArray(ref) || type === "set") {
|
|
1519
1519
|
const number = Number(key);
|
|
1520
1520
|
if (Number.isInteger(number)) key = number < 0 ? ref.length + number : number;
|
|
1521
1521
|
}
|
|
1522
1522
|
if (!ref || typeof ref === "function" && options.functions === false || !type && ref[key] === void 0) {
|
|
1523
|
-
Assert$
|
|
1524
|
-
Assert$
|
|
1523
|
+
Assert$5(!options.strict || i$1 + 1 === path.length, "Missing segment", key, "in reach path ", chain);
|
|
1524
|
+
Assert$5(typeof ref === "object" || options.functions === true || typeof ref !== "function", "Invalid segment", key, "in reach path ", chain);
|
|
1525
1525
|
ref = options.default;
|
|
1526
1526
|
break;
|
|
1527
1527
|
}
|
|
@@ -1531,14 +1531,14 @@ var require_reach = __commonJSMin((exports, module) => {
|
|
|
1531
1531
|
}
|
|
1532
1532
|
return ref;
|
|
1533
1533
|
};
|
|
1534
|
-
internals$
|
|
1534
|
+
internals$41.iterables = function(ref) {
|
|
1535
1535
|
if (ref instanceof Set) return "set";
|
|
1536
1536
|
if (ref instanceof Map) return "map";
|
|
1537
1537
|
};
|
|
1538
1538
|
});
|
|
1539
1539
|
var require_types$1 = __commonJSMin((exports, module) => {
|
|
1540
1540
|
init_dist$1();
|
|
1541
|
-
const internals$
|
|
1541
|
+
const internals$40 = {};
|
|
1542
1542
|
exports = module.exports = {
|
|
1543
1543
|
array: Array.prototype,
|
|
1544
1544
|
buffer: Buffer$1 && Buffer$1.prototype,
|
|
@@ -1553,7 +1553,7 @@ var require_types$1 = __commonJSMin((exports, module) => {
|
|
|
1553
1553
|
weakMap: WeakMap.prototype,
|
|
1554
1554
|
weakSet: WeakSet.prototype
|
|
1555
1555
|
};
|
|
1556
|
-
internals$
|
|
1556
|
+
internals$40.typeMap = new Map([
|
|
1557
1557
|
["[object Error]", exports.error],
|
|
1558
1558
|
["[object Map]", exports.map],
|
|
1559
1559
|
["[object Promise]", exports.promise],
|
|
@@ -1569,7 +1569,7 @@ var require_types$1 = __commonJSMin((exports, module) => {
|
|
|
1569
1569
|
if (obj instanceof RegExp) return exports.regex;
|
|
1570
1570
|
if (obj instanceof Error) return exports.error;
|
|
1571
1571
|
const objName = Object.prototype.toString.call(obj);
|
|
1572
|
-
return internals$
|
|
1572
|
+
return internals$40.typeMap.get(objName) || exports.generic;
|
|
1573
1573
|
};
|
|
1574
1574
|
});
|
|
1575
1575
|
var require_utils$7 = __commonJSMin((exports) => {
|
|
@@ -1582,7 +1582,7 @@ var require_clone$1 = __commonJSMin((exports, module) => {
|
|
|
1582
1582
|
const Reach$2 = require_reach();
|
|
1583
1583
|
const Types$1 = require_types$1();
|
|
1584
1584
|
const Utils$3 = require_utils$7();
|
|
1585
|
-
const internals$
|
|
1585
|
+
const internals$39 = {
|
|
1586
1586
|
needsProtoHack: new Set([
|
|
1587
1587
|
Types$1.set,
|
|
1588
1588
|
Types$1.map,
|
|
@@ -1591,12 +1591,12 @@ var require_clone$1 = __commonJSMin((exports, module) => {
|
|
|
1591
1591
|
]),
|
|
1592
1592
|
structuredCloneExists: typeof structuredClone === "function"
|
|
1593
1593
|
};
|
|
1594
|
-
module.exports = internals$
|
|
1594
|
+
module.exports = internals$39.clone = function(obj, options = {}, _seen = null) {
|
|
1595
1595
|
if (typeof obj !== "object" || obj === null) return obj;
|
|
1596
|
-
let clone$20 = internals$
|
|
1596
|
+
let clone$20 = internals$39.clone;
|
|
1597
1597
|
let seen = _seen;
|
|
1598
1598
|
if (options.shallow) {
|
|
1599
|
-
if (options.shallow !== true) return internals$
|
|
1599
|
+
if (options.shallow !== true) return internals$39.cloneWithShallow(obj, options);
|
|
1600
1600
|
clone$20 = (value) => value;
|
|
1601
1601
|
} else if (seen) {
|
|
1602
1602
|
const lookup$1 = seen.get(obj);
|
|
@@ -1609,7 +1609,7 @@ var require_clone$1 = __commonJSMin((exports, module) => {
|
|
|
1609
1609
|
case Types$1.regex:
|
|
1610
1610
|
case Types$1.url: return new baseProto.constructor(obj);
|
|
1611
1611
|
}
|
|
1612
|
-
const newObj = internals$
|
|
1612
|
+
const newObj = internals$39.base(obj, baseProto, options);
|
|
1613
1613
|
if (newObj === obj) return obj;
|
|
1614
1614
|
if (seen) seen.set(obj, newObj);
|
|
1615
1615
|
if (baseProto === Types$1.set) for (const value of obj) newObj.add(clone$20(value, options, seen));
|
|
@@ -1621,7 +1621,7 @@ var require_clone$1 = __commonJSMin((exports, module) => {
|
|
|
1621
1621
|
newObj.length = obj.length;
|
|
1622
1622
|
continue;
|
|
1623
1623
|
}
|
|
1624
|
-
if (internals$
|
|
1624
|
+
if (internals$39.structuredCloneExists && baseProto === Types$1.error && key === "stack") continue;
|
|
1625
1625
|
const descriptor = Object.getOwnPropertyDescriptor(obj, key);
|
|
1626
1626
|
if (descriptor) if (descriptor.get || descriptor.set) Object.defineProperty(newObj, key, descriptor);
|
|
1627
1627
|
else if (descriptor.enumerable) newObj[key] = clone$20(obj[key], options, seen);
|
|
@@ -1640,7 +1640,7 @@ var require_clone$1 = __commonJSMin((exports, module) => {
|
|
|
1640
1640
|
}
|
|
1641
1641
|
return newObj;
|
|
1642
1642
|
};
|
|
1643
|
-
internals$
|
|
1643
|
+
internals$39.cloneWithShallow = function(source, options) {
|
|
1644
1644
|
const keys$10 = options.shallow;
|
|
1645
1645
|
options = Object.assign({}, options);
|
|
1646
1646
|
options.shallow = false;
|
|
@@ -1649,11 +1649,11 @@ var require_clone$1 = __commonJSMin((exports, module) => {
|
|
|
1649
1649
|
const ref = Reach$2(source, key);
|
|
1650
1650
|
if (typeof ref === "object" || typeof ref === "function") seen.set(ref, ref);
|
|
1651
1651
|
}
|
|
1652
|
-
return internals$
|
|
1652
|
+
return internals$39.clone(source, options, seen);
|
|
1653
1653
|
};
|
|
1654
|
-
internals$
|
|
1654
|
+
internals$39.base = function(obj, baseProto, options) {
|
|
1655
1655
|
if (options.prototype === false) {
|
|
1656
|
-
if (internals$
|
|
1656
|
+
if (internals$39.needsProtoHack.has(baseProto)) return new baseProto.constructor();
|
|
1657
1657
|
return baseProto === Types$1.array ? [] : {};
|
|
1658
1658
|
}
|
|
1659
1659
|
const proto = Object.getPrototypeOf(obj);
|
|
@@ -1662,12 +1662,12 @@ var require_clone$1 = __commonJSMin((exports, module) => {
|
|
|
1662
1662
|
const newObj = [];
|
|
1663
1663
|
if (proto !== baseProto) Object.setPrototypeOf(newObj, proto);
|
|
1664
1664
|
return newObj;
|
|
1665
|
-
} else if (baseProto === Types$1.error && internals$
|
|
1665
|
+
} else if (baseProto === Types$1.error && internals$39.structuredCloneExists && (proto === baseProto || Error.isPrototypeOf(proto.constructor))) {
|
|
1666
1666
|
const err = structuredClone(obj);
|
|
1667
1667
|
if (Object.getPrototypeOf(err) !== proto) Object.setPrototypeOf(err, proto);
|
|
1668
1668
|
return err;
|
|
1669
1669
|
}
|
|
1670
|
-
if (internals$
|
|
1670
|
+
if (internals$39.needsProtoHack.has(baseProto)) {
|
|
1671
1671
|
const newObj = new proto.constructor();
|
|
1672
1672
|
if (proto !== baseProto) Object.setPrototypeOf(newObj, proto);
|
|
1673
1673
|
return newObj;
|
|
@@ -1677,20 +1677,20 @@ var require_clone$1 = __commonJSMin((exports, module) => {
|
|
|
1677
1677
|
});
|
|
1678
1678
|
var require_merge = __commonJSMin((exports, module) => {
|
|
1679
1679
|
init_dist$1();
|
|
1680
|
-
const Assert$
|
|
1680
|
+
const Assert$4 = require_assert$1();
|
|
1681
1681
|
const Clone$2 = require_clone$1();
|
|
1682
1682
|
const Utils$2 = require_utils$7();
|
|
1683
|
-
const internals$
|
|
1684
|
-
module.exports = internals$
|
|
1685
|
-
Assert$
|
|
1686
|
-
Assert$
|
|
1683
|
+
const internals$38 = {};
|
|
1684
|
+
module.exports = internals$38.merge = function(target, source, options) {
|
|
1685
|
+
Assert$4(target && typeof target === "object", "Invalid target value: must be an object");
|
|
1686
|
+
Assert$4(source === null || source === void 0 || typeof source === "object", "Invalid source value: must be null, undefined, or an object");
|
|
1687
1687
|
if (!source) return target;
|
|
1688
1688
|
options = Object.assign({
|
|
1689
1689
|
nullOverride: true,
|
|
1690
1690
|
mergeArrays: true
|
|
1691
1691
|
}, options);
|
|
1692
1692
|
if (Array.isArray(source)) {
|
|
1693
|
-
Assert$
|
|
1693
|
+
Assert$4(Array.isArray(target), "Cannot merge array onto an object");
|
|
1694
1694
|
if (!options.mergeArrays) target.length = 0;
|
|
1695
1695
|
for (let i$1 = 0; i$1 < source.length; ++i$1) target.push(Clone$2(source[i$1], { symbols: options.symbols }));
|
|
1696
1696
|
return target;
|
|
@@ -1703,7 +1703,7 @@ var require_merge = __commonJSMin((exports, module) => {
|
|
|
1703
1703
|
if (value && typeof value === "object") {
|
|
1704
1704
|
if (target[key] === value) continue;
|
|
1705
1705
|
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 });
|
|
1706
|
-
else internals$
|
|
1706
|
+
else internals$38.merge(target[key], value, options);
|
|
1707
1707
|
} else if (value !== null && value !== void 0) target[key] = value;
|
|
1708
1708
|
else if (options.nullOverride) target[key] = value;
|
|
1709
1709
|
}
|
|
@@ -1711,17 +1711,17 @@ var require_merge = __commonJSMin((exports, module) => {
|
|
|
1711
1711
|
};
|
|
1712
1712
|
});
|
|
1713
1713
|
var require_applyToDefaults = __commonJSMin((exports, module) => {
|
|
1714
|
-
const Assert$
|
|
1714
|
+
const Assert$3 = require_assert$1();
|
|
1715
1715
|
const Clone$1 = require_clone$1();
|
|
1716
1716
|
const Merge = require_merge();
|
|
1717
1717
|
const Reach$1 = require_reach();
|
|
1718
|
-
const internals$
|
|
1718
|
+
const internals$37 = {};
|
|
1719
1719
|
module.exports = function(defaults$3, source, options = {}) {
|
|
1720
|
-
Assert$
|
|
1721
|
-
Assert$
|
|
1722
|
-
Assert$
|
|
1720
|
+
Assert$3(defaults$3 && typeof defaults$3 === "object", "Invalid defaults value: must be an object");
|
|
1721
|
+
Assert$3(!source || source === true || typeof source === "object", "Invalid source value: must be true, falsy or an object");
|
|
1722
|
+
Assert$3(typeof options === "object", "Invalid options: must be an object");
|
|
1723
1723
|
if (!source) return null;
|
|
1724
|
-
if (options.shallow) return internals$
|
|
1724
|
+
if (options.shallow) return internals$37.applyToDefaultsWithShallow(defaults$3, source, options);
|
|
1725
1725
|
const copy$1 = Clone$1(defaults$3);
|
|
1726
1726
|
if (source === true) return copy$1;
|
|
1727
1727
|
const nullOverride = options.nullOverride !== void 0 ? options.nullOverride : false;
|
|
@@ -1730,9 +1730,9 @@ var require_applyToDefaults = __commonJSMin((exports, module) => {
|
|
|
1730
1730
|
mergeArrays: false
|
|
1731
1731
|
});
|
|
1732
1732
|
};
|
|
1733
|
-
internals$
|
|
1733
|
+
internals$37.applyToDefaultsWithShallow = function(defaults$3, source, options) {
|
|
1734
1734
|
const keys$10 = options.shallow;
|
|
1735
|
-
Assert$
|
|
1735
|
+
Assert$3(Array.isArray(keys$10), "Invalid keys");
|
|
1736
1736
|
const seen = new Map();
|
|
1737
1737
|
const merge$4 = source === true ? null : new Set();
|
|
1738
1738
|
for (let key of keys$10) {
|
|
@@ -1743,14 +1743,14 @@ var require_applyToDefaults = __commonJSMin((exports, module) => {
|
|
|
1743
1743
|
}
|
|
1744
1744
|
const copy$1 = Clone$1(defaults$3, {}, seen);
|
|
1745
1745
|
if (!merge$4) return copy$1;
|
|
1746
|
-
for (const key of merge$4) internals$
|
|
1746
|
+
for (const key of merge$4) internals$37.reachCopy(copy$1, source, key);
|
|
1747
1747
|
const nullOverride = options.nullOverride !== void 0 ? options.nullOverride : false;
|
|
1748
1748
|
return Merge(copy$1, source, {
|
|
1749
1749
|
nullOverride,
|
|
1750
1750
|
mergeArrays: false
|
|
1751
1751
|
});
|
|
1752
1752
|
};
|
|
1753
|
-
internals$
|
|
1753
|
+
internals$37.reachCopy = function(dst, src$1, path) {
|
|
1754
1754
|
for (const segment of path) {
|
|
1755
1755
|
if (!(segment in src$1)) return;
|
|
1756
1756
|
const val = src$1[segment];
|
|
@@ -1901,17 +1901,17 @@ var init_dist = __esmMin(() => {
|
|
|
1901
1901
|
});
|
|
1902
1902
|
var require_bench = __commonJSMin((exports, module) => {
|
|
1903
1903
|
init_dist();
|
|
1904
|
-
const internals$
|
|
1905
|
-
module.exports = internals$
|
|
1904
|
+
const internals$36 = {};
|
|
1905
|
+
module.exports = internals$36.Bench = class {
|
|
1906
1906
|
constructor() {
|
|
1907
1907
|
this.ts = 0;
|
|
1908
1908
|
this.reset();
|
|
1909
1909
|
}
|
|
1910
1910
|
reset() {
|
|
1911
|
-
this.ts = internals$
|
|
1911
|
+
this.ts = internals$36.Bench.now();
|
|
1912
1912
|
}
|
|
1913
1913
|
elapsed() {
|
|
1914
|
-
return internals$
|
|
1914
|
+
return internals$36.Bench.now() - this.ts;
|
|
1915
1915
|
}
|
|
1916
1916
|
static now() {
|
|
1917
1917
|
const ts = process$1.hrtime();
|
|
@@ -1931,12 +1931,12 @@ var require_block = __commonJSMin((exports, module) => {
|
|
|
1931
1931
|
var require_deepEqual = __commonJSMin((exports, module) => {
|
|
1932
1932
|
init_dist$1();
|
|
1933
1933
|
const Types = require_types$1();
|
|
1934
|
-
const internals$
|
|
1934
|
+
const internals$35 = { mismatched: null };
|
|
1935
1935
|
module.exports = function(obj, ref, options) {
|
|
1936
1936
|
options = Object.assign({ prototype: true }, options);
|
|
1937
|
-
return !!internals$
|
|
1937
|
+
return !!internals$35.isDeepEqual(obj, ref, options, []);
|
|
1938
1938
|
};
|
|
1939
|
-
internals$
|
|
1939
|
+
internals$35.isDeepEqual = function(obj, ref, options, seen) {
|
|
1940
1940
|
if (obj === ref) return obj !== 0 || 1 / obj === 1 / ref;
|
|
1941
1941
|
const type = typeof obj;
|
|
1942
1942
|
if (type !== typeof ref) return false;
|
|
@@ -1944,32 +1944,32 @@ var require_deepEqual = __commonJSMin((exports, module) => {
|
|
|
1944
1944
|
if (type === "function") {
|
|
1945
1945
|
if (!options.deepFunction || obj.toString() !== ref.toString()) return false;
|
|
1946
1946
|
} else if (type !== "object") return obj !== obj && ref !== ref;
|
|
1947
|
-
const instanceType = internals$
|
|
1947
|
+
const instanceType = internals$35.getSharedType(obj, ref, !!options.prototype);
|
|
1948
1948
|
switch (instanceType) {
|
|
1949
1949
|
case Types.buffer: return Buffer$1 && Buffer$1.prototype.equals.call(obj, ref);
|
|
1950
1950
|
case Types.promise: return obj === ref;
|
|
1951
1951
|
case Types.regex:
|
|
1952
1952
|
case Types.url: return obj.toString() === ref.toString();
|
|
1953
|
-
case internals$
|
|
1953
|
+
case internals$35.mismatched: return false;
|
|
1954
1954
|
}
|
|
1955
1955
|
for (let i$1 = seen.length - 1; i$1 >= 0; --i$1) if (seen[i$1].isSame(obj, ref)) return true;
|
|
1956
|
-
seen.push(new internals$
|
|
1956
|
+
seen.push(new internals$35.SeenEntry(obj, ref));
|
|
1957
1957
|
try {
|
|
1958
|
-
return !!internals$
|
|
1958
|
+
return !!internals$35.isDeepEqualObj(instanceType, obj, ref, options, seen);
|
|
1959
1959
|
} finally {
|
|
1960
1960
|
seen.pop();
|
|
1961
1961
|
}
|
|
1962
1962
|
};
|
|
1963
|
-
internals$
|
|
1963
|
+
internals$35.getSharedType = function(obj, ref, checkPrototype) {
|
|
1964
1964
|
if (checkPrototype) {
|
|
1965
|
-
if (Object.getPrototypeOf(obj) !== Object.getPrototypeOf(ref)) return internals$
|
|
1965
|
+
if (Object.getPrototypeOf(obj) !== Object.getPrototypeOf(ref)) return internals$35.mismatched;
|
|
1966
1966
|
return Types.getInternalProto(obj);
|
|
1967
1967
|
}
|
|
1968
1968
|
const type = Types.getInternalProto(obj);
|
|
1969
|
-
if (type !== Types.getInternalProto(ref)) return internals$
|
|
1969
|
+
if (type !== Types.getInternalProto(ref)) return internals$35.mismatched;
|
|
1970
1970
|
return type;
|
|
1971
1971
|
};
|
|
1972
|
-
internals$
|
|
1972
|
+
internals$35.valueOf = function(obj) {
|
|
1973
1973
|
const objValueOf = obj.valueOf;
|
|
1974
1974
|
if (objValueOf === void 0) return obj;
|
|
1975
1975
|
try {
|
|
@@ -1978,15 +1978,15 @@ var require_deepEqual = __commonJSMin((exports, module) => {
|
|
|
1978
1978
|
return err;
|
|
1979
1979
|
}
|
|
1980
1980
|
};
|
|
1981
|
-
internals$
|
|
1981
|
+
internals$35.hasOwnEnumerableProperty = function(obj, key) {
|
|
1982
1982
|
return Object.prototype.propertyIsEnumerable.call(obj, key);
|
|
1983
1983
|
};
|
|
1984
|
-
internals$
|
|
1984
|
+
internals$35.isSetSimpleEqual = function(obj, ref) {
|
|
1985
1985
|
for (const entry of Set.prototype.values.call(obj)) if (!Set.prototype.has.call(ref, entry)) return false;
|
|
1986
1986
|
return true;
|
|
1987
1987
|
};
|
|
1988
|
-
internals$
|
|
1989
|
-
const { isDeepEqual: isDeepEqual$2, valueOf, hasOwnEnumerableProperty } = internals$
|
|
1988
|
+
internals$35.isDeepEqualObj = function(instanceType, obj, ref, options, seen) {
|
|
1989
|
+
const { isDeepEqual: isDeepEqual$2, valueOf, hasOwnEnumerableProperty } = internals$35;
|
|
1990
1990
|
const { keys: keys$10, getOwnPropertySymbols: getOwnPropertySymbols$1 } = Object;
|
|
1991
1991
|
if (instanceType === Types.array) if (options.part) {
|
|
1992
1992
|
for (const objValue of obj) for (const refValue of ref) if (isDeepEqual$2(objValue, refValue, options, seen)) return true;
|
|
@@ -1997,7 +1997,7 @@ var require_deepEqual = __commonJSMin((exports, module) => {
|
|
|
1997
1997
|
}
|
|
1998
1998
|
else if (instanceType === Types.set) {
|
|
1999
1999
|
if (obj.size !== ref.size) return false;
|
|
2000
|
-
if (!internals$
|
|
2000
|
+
if (!internals$35.isSetSimpleEqual(obj, ref)) {
|
|
2001
2001
|
const ref2 = new Set(Set.prototype.values.call(ref));
|
|
2002
2002
|
for (const objEntry of Set.prototype.values.call(obj)) {
|
|
2003
2003
|
if (ref2.delete(objEntry)) continue;
|
|
@@ -2050,7 +2050,7 @@ var require_deepEqual = __commonJSMin((exports, module) => {
|
|
|
2050
2050
|
}
|
|
2051
2051
|
return true;
|
|
2052
2052
|
};
|
|
2053
|
-
internals$
|
|
2053
|
+
internals$35.SeenEntry = class {
|
|
2054
2054
|
constructor(obj, ref) {
|
|
2055
2055
|
this.obj = obj;
|
|
2056
2056
|
this.ref = ref;
|
|
@@ -2066,20 +2066,20 @@ var require_escapeRegex = __commonJSMin((exports, module) => {
|
|
|
2066
2066
|
};
|
|
2067
2067
|
});
|
|
2068
2068
|
var require_contain = __commonJSMin((exports, module) => {
|
|
2069
|
-
const Assert$
|
|
2069
|
+
const Assert$2 = require_assert$1();
|
|
2070
2070
|
const DeepEqual = require_deepEqual();
|
|
2071
2071
|
const EscapeRegex = require_escapeRegex();
|
|
2072
2072
|
const Utils$1 = require_utils$7();
|
|
2073
|
-
const internals$
|
|
2073
|
+
const internals$34 = {};
|
|
2074
2074
|
module.exports = function(ref, values$3, options = {}) {
|
|
2075
2075
|
if (typeof values$3 !== "object") values$3 = [values$3];
|
|
2076
|
-
Assert$
|
|
2077
|
-
if (typeof ref === "string") return internals$
|
|
2078
|
-
if (Array.isArray(ref)) return internals$
|
|
2079
|
-
Assert$
|
|
2080
|
-
return internals$
|
|
2076
|
+
Assert$2(!Array.isArray(values$3) || values$3.length, "Values array cannot be empty");
|
|
2077
|
+
if (typeof ref === "string") return internals$34.string(ref, values$3, options);
|
|
2078
|
+
if (Array.isArray(ref)) return internals$34.array(ref, values$3, options);
|
|
2079
|
+
Assert$2(typeof ref === "object", "Reference must be string or an object");
|
|
2080
|
+
return internals$34.object(ref, values$3, options);
|
|
2081
2081
|
};
|
|
2082
|
-
internals$
|
|
2082
|
+
internals$34.array = function(ref, values$3, options) {
|
|
2083
2083
|
if (!Array.isArray(values$3)) values$3 = [values$3];
|
|
2084
2084
|
if (!ref.length) return false;
|
|
2085
2085
|
if (options.only && options.once && ref.length !== values$3.length) return false;
|
|
@@ -2093,7 +2093,7 @@ var require_contain = __commonJSMin((exports, module) => {
|
|
|
2093
2093
|
hits: 0
|
|
2094
2094
|
});
|
|
2095
2095
|
} else {
|
|
2096
|
-
compare$16 = compare$16 ?? internals$
|
|
2096
|
+
compare$16 = compare$16 ?? internals$34.compare(options);
|
|
2097
2097
|
let found = false;
|
|
2098
2098
|
for (const [key, existing] of map$8.entries()) if (compare$16(key, value)) {
|
|
2099
2099
|
++existing.allowed;
|
|
@@ -2110,7 +2110,7 @@ var require_contain = __commonJSMin((exports, module) => {
|
|
|
2110
2110
|
let match$2;
|
|
2111
2111
|
if (!options.deep || !item || typeof item !== "object") match$2 = map$8.get(item);
|
|
2112
2112
|
else {
|
|
2113
|
-
compare$16 = compare$16 ?? internals$
|
|
2113
|
+
compare$16 = compare$16 ?? internals$34.compare(options);
|
|
2114
2114
|
for (const [key, existing] of map$8.entries()) if (compare$16(key, item)) {
|
|
2115
2115
|
match$2 = existing;
|
|
2116
2116
|
break;
|
|
@@ -2129,14 +2129,14 @@ var require_contain = __commonJSMin((exports, module) => {
|
|
|
2129
2129
|
}
|
|
2130
2130
|
return !!hits;
|
|
2131
2131
|
};
|
|
2132
|
-
internals$
|
|
2133
|
-
Assert$
|
|
2132
|
+
internals$34.object = function(ref, values$3, options) {
|
|
2133
|
+
Assert$2(options.once === void 0, "Cannot use option once with object");
|
|
2134
2134
|
const keys$10 = Utils$1.keys(ref, options);
|
|
2135
2135
|
if (!keys$10.length) return false;
|
|
2136
|
-
if (Array.isArray(values$3)) return internals$
|
|
2136
|
+
if (Array.isArray(values$3)) return internals$34.array(keys$10, values$3, options);
|
|
2137
2137
|
const symbols = Object.getOwnPropertySymbols(values$3).filter((sym) => values$3.propertyIsEnumerable(sym));
|
|
2138
2138
|
const targets = [...Object.keys(values$3), ...symbols];
|
|
2139
|
-
const compare$16 = internals$
|
|
2139
|
+
const compare$16 = internals$34.compare(options);
|
|
2140
2140
|
const set = new Set(targets);
|
|
2141
2141
|
for (const key of keys$10) {
|
|
2142
2142
|
if (!set.has(key)) {
|
|
@@ -2149,12 +2149,12 @@ var require_contain = __commonJSMin((exports, module) => {
|
|
|
2149
2149
|
if (set.size) return options.part ? set.size < targets.length : false;
|
|
2150
2150
|
return true;
|
|
2151
2151
|
};
|
|
2152
|
-
internals$
|
|
2152
|
+
internals$34.string = function(ref, values$3, options) {
|
|
2153
2153
|
if (ref === "") return values$3.length === 1 && values$3[0] === "" || !options.once && !values$3.some((v$1) => v$1 !== "");
|
|
2154
2154
|
const map$8 = new Map();
|
|
2155
2155
|
const patterns = [];
|
|
2156
2156
|
for (const value of values$3) {
|
|
2157
|
-
Assert$
|
|
2157
|
+
Assert$2(typeof value === "string", "Cannot compare string reference to non-string value");
|
|
2158
2158
|
if (value) {
|
|
2159
2159
|
const existing = map$8.get(value);
|
|
2160
2160
|
if (existing) ++existing.allowed;
|
|
@@ -2183,8 +2183,8 @@ var require_contain = __commonJSMin((exports, module) => {
|
|
|
2183
2183
|
}
|
|
2184
2184
|
return !!any;
|
|
2185
2185
|
};
|
|
2186
|
-
internals$
|
|
2187
|
-
if (!options.deep) return internals$
|
|
2186
|
+
internals$34.compare = function(options) {
|
|
2187
|
+
if (!options.deep) return internals$34.shallow;
|
|
2188
2188
|
const hasOnly = options.only !== void 0;
|
|
2189
2189
|
const hasPart = options.part !== void 0;
|
|
2190
2190
|
const flags = {
|
|
@@ -2193,40 +2193,40 @@ var require_contain = __commonJSMin((exports, module) => {
|
|
|
2193
2193
|
};
|
|
2194
2194
|
return (a$2, b) => DeepEqual(a$2, b, flags);
|
|
2195
2195
|
};
|
|
2196
|
-
internals$
|
|
2196
|
+
internals$34.shallow = function(a$2, b) {
|
|
2197
2197
|
return a$2 === b;
|
|
2198
2198
|
};
|
|
2199
2199
|
});
|
|
2200
2200
|
var require_escapeHeaderAttribute = __commonJSMin((exports, module) => {
|
|
2201
|
-
const Assert$
|
|
2201
|
+
const Assert$1 = require_assert$1();
|
|
2202
2202
|
module.exports = function(attribute) {
|
|
2203
|
-
Assert$
|
|
2203
|
+
Assert$1(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$/.test(attribute), "Bad attribute value (" + attribute + ")");
|
|
2204
2204
|
return attribute.replace(/\\/g, "\\\\").replace(/\"/g, "\\\"");
|
|
2205
2205
|
};
|
|
2206
2206
|
});
|
|
2207
2207
|
var require_escapeHtml = __commonJSMin((exports, module) => {
|
|
2208
|
-
const internals$
|
|
2208
|
+
const internals$33 = {};
|
|
2209
2209
|
module.exports = function(input) {
|
|
2210
2210
|
if (!input) return "";
|
|
2211
2211
|
let escaped = "";
|
|
2212
2212
|
for (let i$1 = 0; i$1 < input.length; ++i$1) {
|
|
2213
2213
|
const charCode = input.charCodeAt(i$1);
|
|
2214
|
-
if (internals$
|
|
2215
|
-
else escaped += internals$
|
|
2214
|
+
if (internals$33.isSafe(charCode)) escaped += input[i$1];
|
|
2215
|
+
else escaped += internals$33.escapeHtmlChar(charCode);
|
|
2216
2216
|
}
|
|
2217
2217
|
return escaped;
|
|
2218
2218
|
};
|
|
2219
|
-
internals$
|
|
2220
|
-
const namedEscape = internals$
|
|
2219
|
+
internals$33.escapeHtmlChar = function(charCode) {
|
|
2220
|
+
const namedEscape = internals$33.namedHtml.get(charCode);
|
|
2221
2221
|
if (namedEscape) return namedEscape;
|
|
2222
2222
|
if (charCode >= 256) return "&#" + charCode + ";";
|
|
2223
2223
|
const hexValue = charCode.toString(16).padStart(2, "0");
|
|
2224
2224
|
return `&#x${hexValue};`;
|
|
2225
2225
|
};
|
|
2226
|
-
internals$
|
|
2227
|
-
return internals$
|
|
2226
|
+
internals$33.isSafe = function(charCode) {
|
|
2227
|
+
return internals$33.safeCharCodes.has(charCode);
|
|
2228
2228
|
};
|
|
2229
|
-
internals$
|
|
2229
|
+
internals$33.namedHtml = new Map([
|
|
2230
2230
|
[38, "&"],
|
|
2231
2231
|
[60, "<"],
|
|
2232
2232
|
[62, ">"],
|
|
@@ -2238,22 +2238,22 @@ var require_escapeHtml = __commonJSMin((exports, module) => {
|
|
|
2238
2238
|
[169, "©"],
|
|
2239
2239
|
[174, "®"]
|
|
2240
2240
|
]);
|
|
2241
|
-
internals$
|
|
2241
|
+
internals$33.safeCharCodes = function() {
|
|
2242
2242
|
const safe = new Set();
|
|
2243
2243
|
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);
|
|
2244
2244
|
return safe;
|
|
2245
2245
|
}();
|
|
2246
2246
|
});
|
|
2247
2247
|
var require_escapeJson = __commonJSMin((exports, module) => {
|
|
2248
|
-
const internals$
|
|
2248
|
+
const internals$32 = {};
|
|
2249
2249
|
module.exports = function(input) {
|
|
2250
2250
|
if (!input) return "";
|
|
2251
|
-
return input.replace(/[<>&\u2028\u2029]/g, internals$
|
|
2251
|
+
return input.replace(/[<>&\u2028\u2029]/g, internals$32.escape);
|
|
2252
2252
|
};
|
|
2253
|
-
internals$
|
|
2254
|
-
return internals$
|
|
2253
|
+
internals$32.escape = function(char) {
|
|
2254
|
+
return internals$32.replacements.get(char);
|
|
2255
2255
|
};
|
|
2256
|
-
internals$
|
|
2256
|
+
internals$32.replacements = new Map([
|
|
2257
2257
|
["<", "\\u003c"],
|
|
2258
2258
|
[">", "\\u003e"],
|
|
2259
2259
|
["&", "\\u0026"],
|
|
@@ -2262,29 +2262,29 @@ var require_escapeJson = __commonJSMin((exports, module) => {
|
|
|
2262
2262
|
]);
|
|
2263
2263
|
});
|
|
2264
2264
|
var require_flatten$1 = __commonJSMin((exports, module) => {
|
|
2265
|
-
const internals$
|
|
2266
|
-
module.exports = internals$
|
|
2265
|
+
const internals$31 = {};
|
|
2266
|
+
module.exports = internals$31.flatten = function(array, target) {
|
|
2267
2267
|
const result = target || [];
|
|
2268
|
-
for (const entry of array) if (Array.isArray(entry)) internals$
|
|
2268
|
+
for (const entry of array) if (Array.isArray(entry)) internals$31.flatten(entry, result);
|
|
2269
2269
|
else result.push(entry);
|
|
2270
2270
|
return result;
|
|
2271
2271
|
};
|
|
2272
2272
|
});
|
|
2273
2273
|
var require_intersect = __commonJSMin((exports, module) => {
|
|
2274
|
-
const internals$
|
|
2274
|
+
const internals$30 = {};
|
|
2275
2275
|
module.exports = function(array1, array2, options = {}) {
|
|
2276
2276
|
if (!array1 || !array2) return options.first ? null : [];
|
|
2277
2277
|
const common$4 = [];
|
|
2278
2278
|
const hash$4 = Array.isArray(array1) ? new Set(array1) : array1;
|
|
2279
2279
|
const found = new Set();
|
|
2280
|
-
for (const value of array2) if (internals$
|
|
2280
|
+
for (const value of array2) if (internals$30.has(hash$4, value) && !found.has(value)) {
|
|
2281
2281
|
if (options.first) return value;
|
|
2282
2282
|
common$4.push(value);
|
|
2283
2283
|
found.add(value);
|
|
2284
2284
|
}
|
|
2285
2285
|
return options.first ? null : common$4;
|
|
2286
2286
|
};
|
|
2287
|
-
internals$
|
|
2287
|
+
internals$30.has = function(ref, key) {
|
|
2288
2288
|
if (typeof ref.has === "function") return ref.has(key);
|
|
2289
2289
|
return ref[key] !== void 0;
|
|
2290
2290
|
};
|
|
@@ -2295,9 +2295,9 @@ var require_isPromise = __commonJSMin((exports, module) => {
|
|
|
2295
2295
|
};
|
|
2296
2296
|
});
|
|
2297
2297
|
var require_once = __commonJSMin((exports, module) => {
|
|
2298
|
-
const internals$
|
|
2298
|
+
const internals$29 = { wrapped: Symbol("wrapped") };
|
|
2299
2299
|
module.exports = function(method$1) {
|
|
2300
|
-
if (method$1[internals$
|
|
2300
|
+
if (method$1[internals$29.wrapped]) return method$1;
|
|
2301
2301
|
let once$4 = false;
|
|
2302
2302
|
const wrappedFn = function(...args$1) {
|
|
2303
2303
|
if (!once$4) {
|
|
@@ -2305,7 +2305,7 @@ var require_once = __commonJSMin((exports, module) => {
|
|
|
2305
2305
|
method$1(...args$1);
|
|
2306
2306
|
}
|
|
2307
2307
|
};
|
|
2308
|
-
wrappedFn[internals$
|
|
2308
|
+
wrappedFn[internals$29.wrapped] = true;
|
|
2309
2309
|
return wrappedFn;
|
|
2310
2310
|
};
|
|
2311
2311
|
});
|
|
@@ -2319,7 +2319,7 @@ var require_reachTemplate = __commonJSMin((exports, module) => {
|
|
|
2319
2319
|
};
|
|
2320
2320
|
});
|
|
2321
2321
|
var require_wait = __commonJSMin((exports, module) => {
|
|
2322
|
-
const internals$
|
|
2322
|
+
const internals$28 = { maxTimer: 2 ** 31 - 1 };
|
|
2323
2323
|
module.exports = function(timeout$5, returnValue, options) {
|
|
2324
2324
|
if (typeof timeout$5 === "bigint") timeout$5 = Number(timeout$5);
|
|
2325
2325
|
if (timeout$5 >= Number.MAX_SAFE_INTEGER) timeout$5 = Infinity;
|
|
@@ -2327,7 +2327,7 @@ var require_wait = __commonJSMin((exports, module) => {
|
|
|
2327
2327
|
return new Promise((resolve) => {
|
|
2328
2328
|
const _setTimeout = options ? options.setTimeout : setTimeout;
|
|
2329
2329
|
const activate = () => {
|
|
2330
|
-
const time = Math.min(timeout$5, internals$
|
|
2330
|
+
const time = Math.min(timeout$5, internals$28.maxTimer);
|
|
2331
2331
|
timeout$5 -= time;
|
|
2332
2332
|
_setTimeout(() => timeout$5 > 0 ? activate() : resolve(returnValue), time);
|
|
2333
2333
|
};
|
|
@@ -2359,8 +2359,169 @@ var require_lib$4 = __commonJSMin((exports) => {
|
|
|
2359
2359
|
exports.stringify = require_stringify();
|
|
2360
2360
|
exports.wait = require_wait();
|
|
2361
2361
|
});
|
|
2362
|
+
var package_exports$1 = {};
|
|
2363
|
+
__export(package_exports$1, {
|
|
2364
|
+
browser: () => browser,
|
|
2365
|
+
default: () => package_default$1,
|
|
2366
|
+
dependencies: () => dependencies$1,
|
|
2367
|
+
description: () => description$1,
|
|
2368
|
+
devDependencies: () => devDependencies$1,
|
|
2369
|
+
engines: () => engines,
|
|
2370
|
+
files: () => files$1,
|
|
2371
|
+
keywords: () => keywords$1,
|
|
2372
|
+
license: () => license$1,
|
|
2373
|
+
main: () => main$1,
|
|
2374
|
+
name: () => name$2,
|
|
2375
|
+
repository: () => repository$1,
|
|
2376
|
+
scripts: () => scripts$1,
|
|
2377
|
+
types: () => types,
|
|
2378
|
+
version: () => version$3
|
|
2379
|
+
});
|
|
2380
|
+
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;
|
|
2381
|
+
var init_package$1 = __esmMin(() => {
|
|
2382
|
+
name$2 = "joi";
|
|
2383
|
+
description$1 = "Object schema validation";
|
|
2384
|
+
version$3 = "18.0.2";
|
|
2385
|
+
repository$1 = {
|
|
2386
|
+
"url": "git://github.com/hapijs/joi",
|
|
2387
|
+
"type": "git"
|
|
2388
|
+
};
|
|
2389
|
+
engines = { "node": ">= 20" };
|
|
2390
|
+
main$1 = "lib/index.js";
|
|
2391
|
+
types = "lib/index.d.ts";
|
|
2392
|
+
browser = "dist/joi-browser.min.js";
|
|
2393
|
+
files$1 = ["lib/**/*", "dist/*"];
|
|
2394
|
+
keywords$1 = ["schema", "validation"];
|
|
2395
|
+
dependencies$1 = {
|
|
2396
|
+
"@hapi/address": "^5.1.1",
|
|
2397
|
+
"@hapi/formula": "^3.0.2",
|
|
2398
|
+
"@hapi/hoek": "^11.0.7",
|
|
2399
|
+
"@hapi/pinpoint": "^2.0.1",
|
|
2400
|
+
"@hapi/tlds": "^1.1.1",
|
|
2401
|
+
"@hapi/topo": "^6.0.2",
|
|
2402
|
+
"@standard-schema/spec": "^1.0.0"
|
|
2403
|
+
};
|
|
2404
|
+
devDependencies$1 = {
|
|
2405
|
+
"@hapi/bourne": "^3.0.0",
|
|
2406
|
+
"@hapi/code": "^9.0.3",
|
|
2407
|
+
"@hapi/eslint-plugin": "^7.0.0",
|
|
2408
|
+
"@hapi/joi-legacy-test": "npm:@hapi/joi@15.x.x",
|
|
2409
|
+
"@hapi/lab": "^26.0.0",
|
|
2410
|
+
"@types/node": "^20.17.47",
|
|
2411
|
+
"typescript": "^5.8.3"
|
|
2412
|
+
};
|
|
2413
|
+
scripts$1 = {
|
|
2414
|
+
"prepublishOnly": "cd browser && npm install && npm run build",
|
|
2415
|
+
"test": "lab -t 100 -a @hapi/code -L -Y",
|
|
2416
|
+
"test-cov-html": "lab -r html -o coverage.html -a @hapi/code"
|
|
2417
|
+
};
|
|
2418
|
+
license$1 = "BSD-3-Clause";
|
|
2419
|
+
package_default$1 = {
|
|
2420
|
+
name: name$2,
|
|
2421
|
+
description: description$1,
|
|
2422
|
+
version: version$3,
|
|
2423
|
+
repository: repository$1,
|
|
2424
|
+
engines,
|
|
2425
|
+
main: main$1,
|
|
2426
|
+
types,
|
|
2427
|
+
browser,
|
|
2428
|
+
files: files$1,
|
|
2429
|
+
keywords: keywords$1,
|
|
2430
|
+
dependencies: dependencies$1,
|
|
2431
|
+
devDependencies: devDependencies$1,
|
|
2432
|
+
scripts: scripts$1,
|
|
2433
|
+
license: license$1
|
|
2434
|
+
};
|
|
2435
|
+
});
|
|
2436
|
+
var require_cache = __commonJSMin((exports) => {
|
|
2437
|
+
const { assert: assert$53, clone: clone$19 } = require_lib$4();
|
|
2438
|
+
const Common$25 = require_common$3();
|
|
2439
|
+
const internals$27 = {
|
|
2440
|
+
max: 1e3,
|
|
2441
|
+
supported: new Set([
|
|
2442
|
+
"undefined",
|
|
2443
|
+
"boolean",
|
|
2444
|
+
"number",
|
|
2445
|
+
"string"
|
|
2446
|
+
])
|
|
2447
|
+
};
|
|
2448
|
+
exports.provider = { provision(options) {
|
|
2449
|
+
return new internals$27.Cache(options);
|
|
2450
|
+
} };
|
|
2451
|
+
internals$27.Cache = class {
|
|
2452
|
+
constructor(options = {}) {
|
|
2453
|
+
Common$25.assertOptions(options, ["max"]);
|
|
2454
|
+
assert$53(options.max === void 0 || options.max && options.max > 0 && isFinite(options.max), "Invalid max cache size");
|
|
2455
|
+
this._max = options.max || internals$27.max;
|
|
2456
|
+
this._map = new Map();
|
|
2457
|
+
this._list = new internals$27.List();
|
|
2458
|
+
}
|
|
2459
|
+
get length() {
|
|
2460
|
+
return this._map.size;
|
|
2461
|
+
}
|
|
2462
|
+
set(key, value) {
|
|
2463
|
+
if (key !== null && !internals$27.supported.has(typeof key)) return;
|
|
2464
|
+
let node = this._map.get(key);
|
|
2465
|
+
if (node) {
|
|
2466
|
+
node.value = value;
|
|
2467
|
+
this._list.first(node);
|
|
2468
|
+
return;
|
|
2469
|
+
}
|
|
2470
|
+
node = this._list.unshift({
|
|
2471
|
+
key,
|
|
2472
|
+
value
|
|
2473
|
+
});
|
|
2474
|
+
this._map.set(key, node);
|
|
2475
|
+
this._compact();
|
|
2476
|
+
}
|
|
2477
|
+
get(key) {
|
|
2478
|
+
const node = this._map.get(key);
|
|
2479
|
+
if (node) {
|
|
2480
|
+
this._list.first(node);
|
|
2481
|
+
return clone$19(node.value);
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
_compact() {
|
|
2485
|
+
if (this._map.size > this._max) {
|
|
2486
|
+
const node = this._list.pop();
|
|
2487
|
+
this._map.delete(node.key);
|
|
2488
|
+
}
|
|
2489
|
+
}
|
|
2490
|
+
};
|
|
2491
|
+
internals$27.List = class {
|
|
2492
|
+
constructor() {
|
|
2493
|
+
this.tail = null;
|
|
2494
|
+
this.head = null;
|
|
2495
|
+
}
|
|
2496
|
+
unshift(node) {
|
|
2497
|
+
node.next = null;
|
|
2498
|
+
node.prev = this.head;
|
|
2499
|
+
if (this.head) this.head.next = node;
|
|
2500
|
+
this.head = node;
|
|
2501
|
+
if (!this.tail) this.tail = node;
|
|
2502
|
+
return node;
|
|
2503
|
+
}
|
|
2504
|
+
first(node) {
|
|
2505
|
+
if (node === this.head) return;
|
|
2506
|
+
this._remove(node);
|
|
2507
|
+
this.unshift(node);
|
|
2508
|
+
}
|
|
2509
|
+
pop() {
|
|
2510
|
+
return this._remove(this.tail);
|
|
2511
|
+
}
|
|
2512
|
+
_remove(node) {
|
|
2513
|
+
const { next, prev } = node;
|
|
2514
|
+
next.prev = prev;
|
|
2515
|
+
if (prev) prev.next = next;
|
|
2516
|
+
if (node === this.tail) this.tail = next;
|
|
2517
|
+
node.prev = null;
|
|
2518
|
+
node.next = null;
|
|
2519
|
+
return node;
|
|
2520
|
+
}
|
|
2521
|
+
};
|
|
2522
|
+
});
|
|
2362
2523
|
var require_lib$3 = __commonJSMin((exports) => {
|
|
2363
|
-
const internals$
|
|
2524
|
+
const internals$26 = {
|
|
2364
2525
|
operators: [
|
|
2365
2526
|
"!",
|
|
2366
2527
|
"^",
|
|
@@ -2426,7 +2587,7 @@ var require_lib$3 = __commonJSMin((exports) => {
|
|
|
2426
2587
|
};
|
|
2427
2588
|
exports.Parser = class {
|
|
2428
2589
|
constructor(string, options = {}) {
|
|
2429
|
-
if (!options[internals$
|
|
2590
|
+
if (!options[internals$26.settings] && options.constants) for (const constant$3 in options.constants) {
|
|
2430
2591
|
const value = options.constants[constant$3];
|
|
2431
2592
|
if (value !== null && ![
|
|
2432
2593
|
"boolean",
|
|
@@ -2434,8 +2595,8 @@ var require_lib$3 = __commonJSMin((exports) => {
|
|
|
2434
2595
|
"string"
|
|
2435
2596
|
].includes(typeof value)) throw new Error(`Formula constant ${constant$3} contains invalid ${typeof value} value type`);
|
|
2436
2597
|
}
|
|
2437
|
-
this.settings = options[internals$
|
|
2438
|
-
[internals$
|
|
2598
|
+
this.settings = options[internals$26.settings] ? options : Object.assign({
|
|
2599
|
+
[internals$26.settings]: true,
|
|
2439
2600
|
constants: {},
|
|
2440
2601
|
functions: {}
|
|
2441
2602
|
}, options);
|
|
@@ -2477,12 +2638,12 @@ var require_lib$3 = __commonJSMin((exports) => {
|
|
|
2477
2638
|
type: "literal",
|
|
2478
2639
|
value: current
|
|
2479
2640
|
});
|
|
2480
|
-
} else if (internals$
|
|
2641
|
+
} 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;
|
|
2481
2642
|
else parts.push({
|
|
2482
2643
|
type: "operator",
|
|
2483
2644
|
value: current
|
|
2484
2645
|
});
|
|
2485
|
-
else if (current.match(internals$
|
|
2646
|
+
else if (current.match(internals$26.numberRx)) parts.push({
|
|
2486
2647
|
type: "constant",
|
|
2487
2648
|
value: parseFloat(current)
|
|
2488
2649
|
});
|
|
@@ -2491,7 +2652,7 @@ var require_lib$3 = __commonJSMin((exports) => {
|
|
|
2491
2652
|
value: this.settings.constants[current]
|
|
2492
2653
|
});
|
|
2493
2654
|
else {
|
|
2494
|
-
if (!current.match(internals$
|
|
2655
|
+
if (!current.match(internals$26.tokenRx)) throw new Error(`Formula contains invalid token: ${current}`);
|
|
2495
2656
|
parts.push({
|
|
2496
2657
|
type: "reference",
|
|
2497
2658
|
value: current
|
|
@@ -2511,11 +2672,11 @@ var require_lib$3 = __commonJSMin((exports) => {
|
|
|
2511
2672
|
if (!parenthesis) flush(c);
|
|
2512
2673
|
else current += c;
|
|
2513
2674
|
} else current += c;
|
|
2514
|
-
else if (c in internals$
|
|
2675
|
+
else if (c in internals$26.literals) literal = internals$26.literals[c];
|
|
2515
2676
|
else if (c === "(") {
|
|
2516
2677
|
flush();
|
|
2517
2678
|
++parenthesis;
|
|
2518
|
-
} else if (internals$
|
|
2679
|
+
} else if (internals$26.operatorCharacters.includes(c)) {
|
|
2519
2680
|
flush();
|
|
2520
2681
|
current = c;
|
|
2521
2682
|
flush();
|
|
@@ -2532,9 +2693,9 @@ var require_lib$3 = __commonJSMin((exports) => {
|
|
|
2532
2693
|
let operator$1 = false;
|
|
2533
2694
|
for (const part of parts) {
|
|
2534
2695
|
if (part.type === "operator") {
|
|
2535
|
-
if (internals$
|
|
2696
|
+
if (internals$26.operatorsPrefix.includes(part.value)) continue;
|
|
2536
2697
|
if (!operator$1) throw new Error("Formula contains an operator in invalid position");
|
|
2537
|
-
if (!internals$
|
|
2698
|
+
if (!internals$26.operators.includes(part.value)) throw new Error(`Formula contains an unknown operator ${part.value}`);
|
|
2538
2699
|
} else if (operator$1) throw new Error("Formula missing expected operator");
|
|
2539
2700
|
operator$1 = !operator$1;
|
|
2540
2701
|
}
|
|
@@ -2548,11 +2709,11 @@ var require_lib$3 = __commonJSMin((exports) => {
|
|
|
2548
2709
|
value: parts[0].value
|
|
2549
2710
|
};
|
|
2550
2711
|
this._parts = parts.map((part) => {
|
|
2551
|
-
if (part.type === "operator") return internals$
|
|
2712
|
+
if (part.type === "operator") return internals$26.operatorsPrefix.includes(part.value) ? part : part.value;
|
|
2552
2713
|
if (part.type !== "reference") return part.value;
|
|
2553
2714
|
if (this.settings.tokenRx && !this.settings.tokenRx.test(part.value)) throw new Error(`Formula contains invalid reference ${part.value}`);
|
|
2554
2715
|
if (this.settings.reference) return this.settings.reference(part.value);
|
|
2555
|
-
return internals$
|
|
2716
|
+
return internals$26.reference(part.value);
|
|
2556
2717
|
});
|
|
2557
2718
|
}
|
|
2558
2719
|
_subFormula(string, name$3) {
|
|
@@ -2573,9 +2734,9 @@ var require_lib$3 = __commonJSMin((exports) => {
|
|
|
2573
2734
|
if (literal) {
|
|
2574
2735
|
current += c;
|
|
2575
2736
|
if (c === literal) literal = false;
|
|
2576
|
-
} else if (c in internals$
|
|
2737
|
+
} else if (c in internals$26.literals && !parenthesis) {
|
|
2577
2738
|
current += c;
|
|
2578
|
-
literal = internals$
|
|
2739
|
+
literal = internals$26.literals[c];
|
|
2579
2740
|
} else if (c === "," && !parenthesis) flush();
|
|
2580
2741
|
else {
|
|
2581
2742
|
current += c;
|
|
@@ -2599,47 +2760,47 @@ var require_lib$3 = __commonJSMin((exports) => {
|
|
|
2599
2760
|
if (part && part.type === "operator") {
|
|
2600
2761
|
const current = parts[i$1 + 1];
|
|
2601
2762
|
parts.splice(i$1 + 1, 1);
|
|
2602
|
-
const value = internals$
|
|
2603
|
-
parts[i$1] = internals$
|
|
2763
|
+
const value = internals$26.evaluate(current, context);
|
|
2764
|
+
parts[i$1] = internals$26.single(part.value, value);
|
|
2604
2765
|
}
|
|
2605
2766
|
}
|
|
2606
|
-
internals$
|
|
2767
|
+
internals$26.operatorsOrder.forEach((set) => {
|
|
2607
2768
|
for (let i$1 = 1; i$1 < parts.length - 1;) if (set.includes(parts[i$1])) {
|
|
2608
2769
|
const operator$1 = parts[i$1];
|
|
2609
|
-
const left = internals$
|
|
2610
|
-
const right = internals$
|
|
2770
|
+
const left = internals$26.evaluate(parts[i$1 - 1], context);
|
|
2771
|
+
const right = internals$26.evaluate(parts[i$1 + 1], context);
|
|
2611
2772
|
parts.splice(i$1, 2);
|
|
2612
|
-
const result = internals$
|
|
2773
|
+
const result = internals$26.calculate(operator$1, left, right);
|
|
2613
2774
|
parts[i$1 - 1] = result === 0 ? 0 : result;
|
|
2614
2775
|
} else i$1 += 2;
|
|
2615
2776
|
});
|
|
2616
|
-
return internals$
|
|
2777
|
+
return internals$26.evaluate(parts[0], context);
|
|
2617
2778
|
}
|
|
2618
2779
|
};
|
|
2619
|
-
exports.Parser.prototype[internals$
|
|
2620
|
-
internals$
|
|
2780
|
+
exports.Parser.prototype[internals$26.symbol] = true;
|
|
2781
|
+
internals$26.reference = function(name$3) {
|
|
2621
2782
|
return function(context) {
|
|
2622
2783
|
return context && context[name$3] !== void 0 ? context[name$3] : null;
|
|
2623
2784
|
};
|
|
2624
2785
|
};
|
|
2625
|
-
internals$
|
|
2786
|
+
internals$26.evaluate = function(part, context) {
|
|
2626
2787
|
if (part === null) return null;
|
|
2627
2788
|
if (typeof part === "function") return part(context);
|
|
2628
|
-
if (part[internals$
|
|
2789
|
+
if (part[internals$26.symbol]) return part.evaluate(context);
|
|
2629
2790
|
return part;
|
|
2630
2791
|
};
|
|
2631
|
-
internals$
|
|
2792
|
+
internals$26.single = function(operator$1, value) {
|
|
2632
2793
|
if (operator$1 === "!") return value ? false : true;
|
|
2633
2794
|
const negative = -value;
|
|
2634
2795
|
if (negative === 0) return 0;
|
|
2635
2796
|
return negative;
|
|
2636
2797
|
};
|
|
2637
|
-
internals$
|
|
2638
|
-
if (operator$1 === "??") return internals$
|
|
2798
|
+
internals$26.calculate = function(operator$1, left, right) {
|
|
2799
|
+
if (operator$1 === "??") return internals$26.exists(left) ? left : right;
|
|
2639
2800
|
if (typeof left === "string" || typeof right === "string") {
|
|
2640
2801
|
if (operator$1 === "+") {
|
|
2641
|
-
left = internals$
|
|
2642
|
-
right = internals$
|
|
2802
|
+
left = internals$26.exists(left) ? left : "";
|
|
2803
|
+
right = internals$26.exists(right) ? right : "";
|
|
2643
2804
|
return left + right;
|
|
2644
2805
|
}
|
|
2645
2806
|
} else switch (operator$1) {
|
|
@@ -2662,267 +2823,17 @@ var require_lib$3 = __commonJSMin((exports) => {
|
|
|
2662
2823
|
}
|
|
2663
2824
|
return null;
|
|
2664
2825
|
};
|
|
2665
|
-
internals$
|
|
2826
|
+
internals$26.exists = function(value) {
|
|
2666
2827
|
return value !== null && value !== void 0;
|
|
2667
2828
|
};
|
|
2668
2829
|
});
|
|
2669
|
-
var require_ref$2 = __commonJSMin((exports) => {
|
|
2670
|
-
const { assert: assert$53, clone: clone$19, reach: reach$4 } = require_lib$4();
|
|
2671
|
-
const Common$25 = require_common$3();
|
|
2672
|
-
let Template$7;
|
|
2673
|
-
const internals$27 = {
|
|
2674
|
-
symbol: Symbol("ref"),
|
|
2675
|
-
defaults: {
|
|
2676
|
-
adjust: null,
|
|
2677
|
-
in: false,
|
|
2678
|
-
iterables: null,
|
|
2679
|
-
map: null,
|
|
2680
|
-
separator: ".",
|
|
2681
|
-
type: "value"
|
|
2682
|
-
}
|
|
2683
|
-
};
|
|
2684
|
-
exports.create = function(key, options = {}) {
|
|
2685
|
-
assert$53(typeof key === "string", "Invalid reference key:", key);
|
|
2686
|
-
Common$25.assertOptions(options, [
|
|
2687
|
-
"adjust",
|
|
2688
|
-
"ancestor",
|
|
2689
|
-
"in",
|
|
2690
|
-
"iterables",
|
|
2691
|
-
"map",
|
|
2692
|
-
"prefix",
|
|
2693
|
-
"render",
|
|
2694
|
-
"separator"
|
|
2695
|
-
]);
|
|
2696
|
-
assert$53(!options.prefix || typeof options.prefix === "object", "options.prefix must be of type object");
|
|
2697
|
-
const ref = Object.assign({}, internals$27.defaults, options);
|
|
2698
|
-
delete ref.prefix;
|
|
2699
|
-
const separator = ref.separator;
|
|
2700
|
-
const context = internals$27.context(key, separator, options.prefix);
|
|
2701
|
-
ref.type = context.type;
|
|
2702
|
-
key = context.key;
|
|
2703
|
-
if (ref.type === "value") {
|
|
2704
|
-
if (context.root) {
|
|
2705
|
-
assert$53(!separator || key[0] !== separator, "Cannot specify relative path with root prefix");
|
|
2706
|
-
ref.ancestor = "root";
|
|
2707
|
-
if (!key) key = null;
|
|
2708
|
-
}
|
|
2709
|
-
if (separator && separator === key) {
|
|
2710
|
-
key = null;
|
|
2711
|
-
ref.ancestor = 0;
|
|
2712
|
-
} else if (ref.ancestor !== void 0) assert$53(!separator || !key || key[0] !== separator, "Cannot combine prefix with ancestor option");
|
|
2713
|
-
else {
|
|
2714
|
-
const [ancestor, slice$1] = internals$27.ancestor(key, separator);
|
|
2715
|
-
if (slice$1) {
|
|
2716
|
-
key = key.slice(slice$1);
|
|
2717
|
-
if (key === "") key = null;
|
|
2718
|
-
}
|
|
2719
|
-
ref.ancestor = ancestor;
|
|
2720
|
-
}
|
|
2721
|
-
}
|
|
2722
|
-
ref.path = separator ? key === null ? [] : key.split(separator) : [key];
|
|
2723
|
-
return new internals$27.Ref(ref);
|
|
2724
|
-
};
|
|
2725
|
-
exports.in = function(key, options = {}) {
|
|
2726
|
-
return exports.create(key, {
|
|
2727
|
-
...options,
|
|
2728
|
-
in: true
|
|
2729
|
-
});
|
|
2730
|
-
};
|
|
2731
|
-
exports.isRef = function(ref) {
|
|
2732
|
-
return ref ? !!ref[Common$25.symbols.ref] : false;
|
|
2733
|
-
};
|
|
2734
|
-
internals$27.Ref = class {
|
|
2735
|
-
constructor(options) {
|
|
2736
|
-
assert$53(typeof options === "object", "Invalid reference construction");
|
|
2737
|
-
Common$25.assertOptions(options, [
|
|
2738
|
-
"adjust",
|
|
2739
|
-
"ancestor",
|
|
2740
|
-
"in",
|
|
2741
|
-
"iterables",
|
|
2742
|
-
"map",
|
|
2743
|
-
"path",
|
|
2744
|
-
"render",
|
|
2745
|
-
"separator",
|
|
2746
|
-
"type",
|
|
2747
|
-
"depth",
|
|
2748
|
-
"key",
|
|
2749
|
-
"root",
|
|
2750
|
-
"display"
|
|
2751
|
-
]);
|
|
2752
|
-
assert$53([false, void 0].includes(options.separator) || typeof options.separator === "string" && options.separator.length === 1, "Invalid separator");
|
|
2753
|
-
assert$53(!options.adjust || typeof options.adjust === "function", "options.adjust must be a function");
|
|
2754
|
-
assert$53(!options.map || Array.isArray(options.map), "options.map must be an array");
|
|
2755
|
-
assert$53(!options.map || !options.adjust, "Cannot set both map and adjust options");
|
|
2756
|
-
Object.assign(this, internals$27.defaults, options);
|
|
2757
|
-
assert$53(this.type === "value" || this.ancestor === void 0, "Non-value references cannot reference ancestors");
|
|
2758
|
-
if (Array.isArray(this.map)) this.map = new Map(this.map);
|
|
2759
|
-
this.depth = this.path.length;
|
|
2760
|
-
this.key = this.path.length ? this.path.join(this.separator) : null;
|
|
2761
|
-
this.root = this.path[0];
|
|
2762
|
-
this.updateDisplay();
|
|
2763
|
-
}
|
|
2764
|
-
resolve(value, state, prefs, local, options = {}) {
|
|
2765
|
-
assert$53(!this.in || options.in, "Invalid in() reference usage");
|
|
2766
|
-
if (this.type === "global") return this._resolve(prefs.context, state, options);
|
|
2767
|
-
if (this.type === "local") return this._resolve(local, state, options);
|
|
2768
|
-
if (!this.ancestor) return this._resolve(value, state, options);
|
|
2769
|
-
if (this.ancestor === "root") return this._resolve(state.ancestors[state.ancestors.length - 1], state, options);
|
|
2770
|
-
assert$53(this.ancestor <= state.ancestors.length, "Invalid reference exceeds the schema root:", this.display);
|
|
2771
|
-
return this._resolve(state.ancestors[this.ancestor - 1], state, options);
|
|
2772
|
-
}
|
|
2773
|
-
_resolve(target, state, options) {
|
|
2774
|
-
let resolved;
|
|
2775
|
-
if (this.type === "value" && state.mainstay.shadow && options.shadow !== false) resolved = state.mainstay.shadow.get(this.absolute(state));
|
|
2776
|
-
if (resolved === void 0) resolved = reach$4(target, this.path, {
|
|
2777
|
-
iterables: this.iterables,
|
|
2778
|
-
functions: true
|
|
2779
|
-
});
|
|
2780
|
-
if (this.adjust) resolved = this.adjust(resolved);
|
|
2781
|
-
if (this.map) {
|
|
2782
|
-
const mapped = this.map.get(resolved);
|
|
2783
|
-
if (mapped !== void 0) resolved = mapped;
|
|
2784
|
-
}
|
|
2785
|
-
if (state.mainstay) state.mainstay.tracer.resolve(state, this, resolved);
|
|
2786
|
-
return resolved;
|
|
2787
|
-
}
|
|
2788
|
-
toString() {
|
|
2789
|
-
return this.display;
|
|
2790
|
-
}
|
|
2791
|
-
absolute(state) {
|
|
2792
|
-
return [...state.path.slice(0, -this.ancestor), ...this.path];
|
|
2793
|
-
}
|
|
2794
|
-
clone() {
|
|
2795
|
-
return new internals$27.Ref(this);
|
|
2796
|
-
}
|
|
2797
|
-
describe() {
|
|
2798
|
-
const ref = { path: this.path };
|
|
2799
|
-
if (this.type !== "value") ref.type = this.type;
|
|
2800
|
-
if (this.separator !== ".") ref.separator = this.separator;
|
|
2801
|
-
if (this.type === "value" && this.ancestor !== 1) ref.ancestor = this.ancestor;
|
|
2802
|
-
if (this.map) ref.map = [...this.map];
|
|
2803
|
-
for (const key of [
|
|
2804
|
-
"adjust",
|
|
2805
|
-
"iterables",
|
|
2806
|
-
"render"
|
|
2807
|
-
]) if (this[key] !== null && this[key] !== void 0) ref[key] = this[key];
|
|
2808
|
-
if (this.in !== false) ref.in = true;
|
|
2809
|
-
return { ref };
|
|
2810
|
-
}
|
|
2811
|
-
updateDisplay() {
|
|
2812
|
-
const key = this.key !== null ? this.key : "";
|
|
2813
|
-
if (this.type !== "value") {
|
|
2814
|
-
this.display = `ref:${this.type}:${key}`;
|
|
2815
|
-
return;
|
|
2816
|
-
}
|
|
2817
|
-
if (!this.separator) {
|
|
2818
|
-
this.display = `ref:${key}`;
|
|
2819
|
-
return;
|
|
2820
|
-
}
|
|
2821
|
-
if (!this.ancestor) {
|
|
2822
|
-
this.display = `ref:${this.separator}${key}`;
|
|
2823
|
-
return;
|
|
2824
|
-
}
|
|
2825
|
-
if (this.ancestor === "root") {
|
|
2826
|
-
this.display = `ref:root:${key}`;
|
|
2827
|
-
return;
|
|
2828
|
-
}
|
|
2829
|
-
if (this.ancestor === 1) {
|
|
2830
|
-
this.display = `ref:${key || ".."}`;
|
|
2831
|
-
return;
|
|
2832
|
-
}
|
|
2833
|
-
const lead = new Array(this.ancestor + 1).fill(this.separator).join("");
|
|
2834
|
-
this.display = `ref:${lead}${key || ""}`;
|
|
2835
|
-
}
|
|
2836
|
-
};
|
|
2837
|
-
internals$27.Ref.prototype[Common$25.symbols.ref] = true;
|
|
2838
|
-
exports.build = function(desc$1) {
|
|
2839
|
-
desc$1 = Object.assign({}, internals$27.defaults, desc$1);
|
|
2840
|
-
if (desc$1.type === "value" && desc$1.ancestor === void 0) desc$1.ancestor = 1;
|
|
2841
|
-
return new internals$27.Ref(desc$1);
|
|
2842
|
-
};
|
|
2843
|
-
internals$27.context = function(key, separator, prefix = {}) {
|
|
2844
|
-
key = key.trim();
|
|
2845
|
-
if (prefix) {
|
|
2846
|
-
const globalp = prefix.global === void 0 ? "$" : prefix.global;
|
|
2847
|
-
if (globalp !== separator && key.startsWith(globalp)) return {
|
|
2848
|
-
key: key.slice(globalp.length),
|
|
2849
|
-
type: "global"
|
|
2850
|
-
};
|
|
2851
|
-
const local = prefix.local === void 0 ? "#" : prefix.local;
|
|
2852
|
-
if (local !== separator && key.startsWith(local)) return {
|
|
2853
|
-
key: key.slice(local.length),
|
|
2854
|
-
type: "local"
|
|
2855
|
-
};
|
|
2856
|
-
const root$11 = prefix.root === void 0 ? "/" : prefix.root;
|
|
2857
|
-
if (root$11 !== separator && key.startsWith(root$11)) return {
|
|
2858
|
-
key: key.slice(root$11.length),
|
|
2859
|
-
type: "value",
|
|
2860
|
-
root: true
|
|
2861
|
-
};
|
|
2862
|
-
}
|
|
2863
|
-
return {
|
|
2864
|
-
key,
|
|
2865
|
-
type: "value"
|
|
2866
|
-
};
|
|
2867
|
-
};
|
|
2868
|
-
internals$27.ancestor = function(key, separator) {
|
|
2869
|
-
if (!separator) return [1, 0];
|
|
2870
|
-
if (key[0] !== separator) return [1, 0];
|
|
2871
|
-
if (key[1] !== separator) return [0, 1];
|
|
2872
|
-
let i$1 = 2;
|
|
2873
|
-
while (key[i$1] === separator) ++i$1;
|
|
2874
|
-
return [i$1 - 1, i$1];
|
|
2875
|
-
};
|
|
2876
|
-
exports.toSibling = 0;
|
|
2877
|
-
exports.toParent = 1;
|
|
2878
|
-
exports.Manager = class {
|
|
2879
|
-
constructor() {
|
|
2880
|
-
this.refs = [];
|
|
2881
|
-
}
|
|
2882
|
-
register(source, target) {
|
|
2883
|
-
if (!source) return;
|
|
2884
|
-
target = target === void 0 ? exports.toParent : target;
|
|
2885
|
-
if (Array.isArray(source)) {
|
|
2886
|
-
for (const ref of source) this.register(ref, target);
|
|
2887
|
-
return;
|
|
2888
|
-
}
|
|
2889
|
-
if (Common$25.isSchema(source)) {
|
|
2890
|
-
for (const item of source._refs.refs) if (item.ancestor - target >= 0) this.refs.push({
|
|
2891
|
-
ancestor: item.ancestor - target,
|
|
2892
|
-
root: item.root
|
|
2893
|
-
});
|
|
2894
|
-
return;
|
|
2895
|
-
}
|
|
2896
|
-
if (exports.isRef(source) && source.type === "value" && source.ancestor - target >= 0) this.refs.push({
|
|
2897
|
-
ancestor: source.ancestor - target,
|
|
2898
|
-
root: source.root
|
|
2899
|
-
});
|
|
2900
|
-
Template$7 = Template$7 || require_template();
|
|
2901
|
-
if (Template$7.isTemplate(source)) this.register(source.refs(), target);
|
|
2902
|
-
}
|
|
2903
|
-
get length() {
|
|
2904
|
-
return this.refs.length;
|
|
2905
|
-
}
|
|
2906
|
-
clone() {
|
|
2907
|
-
const copy$1 = new exports.Manager();
|
|
2908
|
-
copy$1.refs = clone$19(this.refs);
|
|
2909
|
-
return copy$1;
|
|
2910
|
-
}
|
|
2911
|
-
reset() {
|
|
2912
|
-
this.refs = [];
|
|
2913
|
-
}
|
|
2914
|
-
roots() {
|
|
2915
|
-
return this.refs.filter((ref) => !ref.ancestor).map((ref) => ref.root);
|
|
2916
|
-
}
|
|
2917
|
-
};
|
|
2918
|
-
});
|
|
2919
2830
|
var require_template = __commonJSMin((exports, module) => {
|
|
2920
2831
|
const { assert: assert$52, clone: clone$18, escapeHtml: escapeHtml$1 } = require_lib$4();
|
|
2921
2832
|
const Formula = require_lib$3();
|
|
2922
2833
|
const Common$24 = require_common$3();
|
|
2923
2834
|
const Errors$8 = require_errors$2();
|
|
2924
2835
|
const Ref$12 = require_ref$2();
|
|
2925
|
-
const internals$
|
|
2836
|
+
const internals$25 = {
|
|
2926
2837
|
symbol: Symbol("template"),
|
|
2927
2838
|
opens: new Array(1e3).join("\0"),
|
|
2928
2839
|
closes: new Array(1e3).join(""),
|
|
@@ -2934,7 +2845,7 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
2934
2845
|
utc: Date.prototype.toUTCString
|
|
2935
2846
|
}
|
|
2936
2847
|
};
|
|
2937
|
-
module.exports = exports = internals$
|
|
2848
|
+
module.exports = exports = internals$25.Template = class {
|
|
2938
2849
|
constructor(source, options) {
|
|
2939
2850
|
assert$52(typeof source === "string", "Template source must be a string");
|
|
2940
2851
|
assert$52(!source.includes("\0") && !source.includes(""), "Template source cannot contain reserved control characters");
|
|
@@ -2957,8 +2868,8 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
2957
2868
|
}
|
|
2958
2869
|
_parse() {
|
|
2959
2870
|
if (!this.source.includes("{")) return;
|
|
2960
|
-
const encoded = internals$
|
|
2961
|
-
const parts = internals$
|
|
2871
|
+
const encoded = internals$25.encode(this.source);
|
|
2872
|
+
const parts = internals$25.split(encoded);
|
|
2962
2873
|
let refs = false;
|
|
2963
2874
|
const processed = [];
|
|
2964
2875
|
const head$1 = parts.shift();
|
|
@@ -2968,20 +2879,20 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
2968
2879
|
const ender = raw ? "}" : "}}";
|
|
2969
2880
|
const end = part.indexOf(ender);
|
|
2970
2881
|
if (end === -1 || part[1] === "{") {
|
|
2971
|
-
processed.push(`{${internals$
|
|
2882
|
+
processed.push(`{${internals$25.decode(part)}`);
|
|
2972
2883
|
continue;
|
|
2973
2884
|
}
|
|
2974
2885
|
let variable = part.slice(raw ? 0 : 1, end);
|
|
2975
2886
|
const wrapped = variable[0] === ":";
|
|
2976
2887
|
if (wrapped) variable = variable.slice(1);
|
|
2977
|
-
const dynamic = this._ref(internals$
|
|
2888
|
+
const dynamic = this._ref(internals$25.decode(variable), {
|
|
2978
2889
|
raw,
|
|
2979
2890
|
wrapped
|
|
2980
2891
|
});
|
|
2981
2892
|
processed.push(dynamic);
|
|
2982
2893
|
if (typeof dynamic !== "string") refs = true;
|
|
2983
2894
|
const rest = part.slice(end + ender.length);
|
|
2984
|
-
if (rest) processed.push(internals$
|
|
2895
|
+
if (rest) processed.push(internals$25.decode(rest));
|
|
2985
2896
|
}
|
|
2986
2897
|
if (!refs) {
|
|
2987
2898
|
this.rendered = processed.join("");
|
|
@@ -2990,7 +2901,7 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
2990
2901
|
this._template = processed;
|
|
2991
2902
|
}
|
|
2992
2903
|
static date(date, prefs) {
|
|
2993
|
-
return internals$
|
|
2904
|
+
return internals$25.dateFormat[prefs.dateFormat].call(date);
|
|
2994
2905
|
}
|
|
2995
2906
|
describe(options = {}) {
|
|
2996
2907
|
if (!this._settings && options.compact) return this.source;
|
|
@@ -3000,7 +2911,7 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
3000
2911
|
return desc$1;
|
|
3001
2912
|
}
|
|
3002
2913
|
static build(desc$1) {
|
|
3003
|
-
return new internals$
|
|
2914
|
+
return new internals$25.Template(desc$1.template, desc$1.options || desc$1.functions ? {
|
|
3004
2915
|
...desc$1.options,
|
|
3005
2916
|
functions: desc$1.functions
|
|
3006
2917
|
} : void 0);
|
|
@@ -3031,10 +2942,10 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
3031
2942
|
for (const part of this._template) if (typeof part === "string") parts.push(part);
|
|
3032
2943
|
else {
|
|
3033
2944
|
const rendered = this._part(part, value, state, prefs, local, options);
|
|
3034
|
-
const string = internals$
|
|
2945
|
+
const string = internals$25.stringify(rendered, value, state, prefs, local, options);
|
|
3035
2946
|
if (string !== void 0) {
|
|
3036
2947
|
const result = part.raw || (options.errors && options.errors.escapeHtml) === false ? string : escapeHtml$1(string);
|
|
3037
|
-
parts.push(internals$
|
|
2948
|
+
parts.push(internals$25.wrap(result, part.wrapped && prefs.errors.wrap.label));
|
|
3038
2949
|
}
|
|
3039
2950
|
}
|
|
3040
2951
|
return parts.join("");
|
|
@@ -3051,13 +2962,13 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
3051
2962
|
};
|
|
3052
2963
|
try {
|
|
3053
2964
|
const functions = this._functions ? {
|
|
3054
|
-
...internals$
|
|
2965
|
+
...internals$25.functions,
|
|
3055
2966
|
...this._functions
|
|
3056
|
-
} : internals$
|
|
2967
|
+
} : internals$25.functions;
|
|
3057
2968
|
var formula = new Formula.Parser(content, {
|
|
3058
2969
|
reference,
|
|
3059
2970
|
functions,
|
|
3060
|
-
constants: internals$
|
|
2971
|
+
constants: internals$25.constants
|
|
3061
2972
|
});
|
|
3062
2973
|
} catch (err) {
|
|
3063
2974
|
err.message = `Invalid template variable "${content}" fails due to: ${err.message}`;
|
|
@@ -3073,7 +2984,7 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
3073
2984
|
wrapped: wrapped || ref.type === "local" && ref.key === "label"
|
|
3074
2985
|
};
|
|
3075
2986
|
}
|
|
3076
|
-
return internals$
|
|
2987
|
+
return internals$25.stringify(formula.single.value);
|
|
3077
2988
|
}
|
|
3078
2989
|
return {
|
|
3079
2990
|
formula,
|
|
@@ -3085,19 +2996,19 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
3085
2996
|
return this.source;
|
|
3086
2997
|
}
|
|
3087
2998
|
};
|
|
3088
|
-
internals$
|
|
3089
|
-
internals$
|
|
3090
|
-
internals$
|
|
2999
|
+
internals$25.Template.prototype[Common$24.symbols.template] = true;
|
|
3000
|
+
internals$25.Template.prototype.isImmutable = true;
|
|
3001
|
+
internals$25.encode = function(string) {
|
|
3091
3002
|
return string.replace(/\\(\{+)/g, ($0, $1) => {
|
|
3092
|
-
return internals$
|
|
3003
|
+
return internals$25.opens.slice(0, $1.length);
|
|
3093
3004
|
}).replace(/\\(\}+)/g, ($0, $1) => {
|
|
3094
|
-
return internals$
|
|
3005
|
+
return internals$25.closes.slice(0, $1.length);
|
|
3095
3006
|
});
|
|
3096
3007
|
};
|
|
3097
|
-
internals$
|
|
3008
|
+
internals$25.decode = function(string) {
|
|
3098
3009
|
return string.replace(/\u0000/g, "{").replace(/\u0001/g, "}");
|
|
3099
3010
|
};
|
|
3100
|
-
internals$
|
|
3011
|
+
internals$25.split = function(string) {
|
|
3101
3012
|
const parts = [];
|
|
3102
3013
|
let current = "";
|
|
3103
3014
|
for (let i$1 = 0; i$1 < string.length; ++i$1) {
|
|
@@ -3115,12 +3026,12 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
3115
3026
|
parts.push(current);
|
|
3116
3027
|
return parts;
|
|
3117
3028
|
};
|
|
3118
|
-
internals$
|
|
3029
|
+
internals$25.wrap = function(value, ends) {
|
|
3119
3030
|
if (!ends) return value;
|
|
3120
3031
|
if (ends.length === 1) return `${ends}${value}${ends}`;
|
|
3121
3032
|
return `${ends[0]}${value}${ends[1]}`;
|
|
3122
3033
|
};
|
|
3123
|
-
internals$
|
|
3034
|
+
internals$25.stringify = function(value, original, state, prefs, local, options = {}) {
|
|
3124
3035
|
const type = typeof value;
|
|
3125
3036
|
const wrap$2 = prefs && prefs.errors && prefs.errors.wrap || {};
|
|
3126
3037
|
let skipWrap = false;
|
|
@@ -3132,10 +3043,10 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
3132
3043
|
});
|
|
3133
3044
|
}
|
|
3134
3045
|
if (value === null) return "null";
|
|
3135
|
-
if (type === "string") return internals$
|
|
3046
|
+
if (type === "string") return internals$25.wrap(value, options.arrayItems && wrap$2.string);
|
|
3136
3047
|
if (type === "number" || type === "function" || type === "symbol") return value.toString();
|
|
3137
3048
|
if (type !== "object") return JSON.stringify(value);
|
|
3138
|
-
if (value instanceof Date) return internals$
|
|
3049
|
+
if (value instanceof Date) return internals$25.Template.date(value, prefs);
|
|
3139
3050
|
if (value instanceof Map) {
|
|
3140
3051
|
const pairs = [];
|
|
3141
3052
|
for (const [key, sym] of value.entries()) pairs.push(`${key.toString()} -> ${sym.toString()}`);
|
|
@@ -3143,13 +3054,13 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
3143
3054
|
}
|
|
3144
3055
|
if (!Array.isArray(value)) return value.toString();
|
|
3145
3056
|
const values$3 = [];
|
|
3146
|
-
for (const item of value) values$3.push(internals$
|
|
3057
|
+
for (const item of value) values$3.push(internals$25.stringify(item, original, state, prefs, local, {
|
|
3147
3058
|
arrayItems: true,
|
|
3148
3059
|
...options
|
|
3149
3060
|
}));
|
|
3150
|
-
return internals$
|
|
3061
|
+
return internals$25.wrap(values$3.join(", "), !skipWrap && wrap$2.array);
|
|
3151
3062
|
};
|
|
3152
|
-
internals$
|
|
3063
|
+
internals$25.constants = {
|
|
3153
3064
|
true: true,
|
|
3154
3065
|
false: false,
|
|
3155
3066
|
null: null,
|
|
@@ -3158,7 +3069,7 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
3158
3069
|
hour: 60 * 60 * 1e3,
|
|
3159
3070
|
day: 24 * 60 * 60 * 1e3
|
|
3160
3071
|
};
|
|
3161
|
-
internals$
|
|
3072
|
+
internals$25.functions = {
|
|
3162
3073
|
if(condition, then, otherwise) {
|
|
3163
3074
|
return condition ? then : otherwise;
|
|
3164
3075
|
},
|
|
@@ -3185,186 +3096,253 @@ var require_template = __commonJSMin((exports, module) => {
|
|
|
3185
3096
|
}
|
|
3186
3097
|
};
|
|
3187
3098
|
});
|
|
3188
|
-
var
|
|
3189
|
-
const { assert: assert$51, clone: clone$17 } = require_lib$4();
|
|
3190
|
-
const
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3099
|
+
var require_ref$2 = __commonJSMin((exports) => {
|
|
3100
|
+
const { assert: assert$51, clone: clone$17, reach: reach$4 } = require_lib$4();
|
|
3101
|
+
const Common$23 = require_common$3();
|
|
3102
|
+
let Template$7;
|
|
3103
|
+
const internals$24 = {
|
|
3104
|
+
symbol: Symbol("ref"),
|
|
3105
|
+
defaults: {
|
|
3106
|
+
adjust: null,
|
|
3107
|
+
in: false,
|
|
3108
|
+
iterables: null,
|
|
3109
|
+
map: null,
|
|
3110
|
+
separator: ".",
|
|
3111
|
+
type: "value"
|
|
3199
3112
|
}
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3113
|
+
};
|
|
3114
|
+
exports.create = function(key, options = {}) {
|
|
3115
|
+
assert$51(typeof key === "string", "Invalid reference key:", key);
|
|
3116
|
+
Common$23.assertOptions(options, [
|
|
3117
|
+
"adjust",
|
|
3118
|
+
"ancestor",
|
|
3119
|
+
"in",
|
|
3120
|
+
"iterables",
|
|
3121
|
+
"map",
|
|
3122
|
+
"prefix",
|
|
3123
|
+
"render",
|
|
3124
|
+
"separator"
|
|
3125
|
+
]);
|
|
3126
|
+
assert$51(!options.prefix || typeof options.prefix === "object", "options.prefix must be of type object");
|
|
3127
|
+
const ref = Object.assign({}, internals$24.defaults, options);
|
|
3128
|
+
delete ref.prefix;
|
|
3129
|
+
const separator = ref.separator;
|
|
3130
|
+
const context = internals$24.context(key, separator, options.prefix);
|
|
3131
|
+
ref.type = context.type;
|
|
3132
|
+
key = context.key;
|
|
3133
|
+
if (ref.type === "value") {
|
|
3134
|
+
if (context.root) {
|
|
3135
|
+
assert$51(!separator || key[0] !== separator, "Cannot specify relative path with root prefix");
|
|
3136
|
+
ref.ancestor = "root";
|
|
3137
|
+
if (!key) key = null;
|
|
3211
3138
|
}
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3139
|
+
if (separator && separator === key) {
|
|
3140
|
+
key = null;
|
|
3141
|
+
ref.ancestor = 0;
|
|
3142
|
+
} else if (ref.ancestor !== void 0) assert$51(!separator || !key || key[0] !== separator, "Cannot combine prefix with ancestor option");
|
|
3143
|
+
else {
|
|
3144
|
+
const [ancestor, slice$1] = internals$24.ancestor(key, separator);
|
|
3145
|
+
if (slice$1) {
|
|
3146
|
+
key = key.slice(slice$1);
|
|
3147
|
+
if (key === "") key = null;
|
|
3220
3148
|
}
|
|
3221
|
-
|
|
3222
|
-
target[language][code$1] = new Template$6(localized);
|
|
3149
|
+
ref.ancestor = ancestor;
|
|
3223
3150
|
}
|
|
3224
3151
|
}
|
|
3225
|
-
|
|
3152
|
+
ref.path = separator ? key === null ? [] : key.split(separator) : [key];
|
|
3153
|
+
return new internals$24.Ref(ref);
|
|
3226
3154
|
};
|
|
3227
|
-
exports.
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3155
|
+
exports.in = function(key, options = {}) {
|
|
3156
|
+
return exports.create(key, {
|
|
3157
|
+
...options,
|
|
3158
|
+
in: true
|
|
3159
|
+
});
|
|
3160
|
+
};
|
|
3161
|
+
exports.isRef = function(ref) {
|
|
3162
|
+
return ref ? !!ref[Common$23.symbols.ref] : false;
|
|
3163
|
+
};
|
|
3164
|
+
internals$24.Ref = class {
|
|
3165
|
+
constructor(options) {
|
|
3166
|
+
assert$51(typeof options === "object", "Invalid reference construction");
|
|
3167
|
+
Common$23.assertOptions(options, [
|
|
3168
|
+
"adjust",
|
|
3169
|
+
"ancestor",
|
|
3170
|
+
"in",
|
|
3171
|
+
"iterables",
|
|
3172
|
+
"map",
|
|
3173
|
+
"path",
|
|
3174
|
+
"render",
|
|
3175
|
+
"separator",
|
|
3176
|
+
"type",
|
|
3177
|
+
"depth",
|
|
3178
|
+
"key",
|
|
3179
|
+
"root",
|
|
3180
|
+
"display"
|
|
3181
|
+
]);
|
|
3182
|
+
assert$51([false, void 0].includes(options.separator) || typeof options.separator === "string" && options.separator.length === 1, "Invalid separator");
|
|
3183
|
+
assert$51(!options.adjust || typeof options.adjust === "function", "options.adjust must be a function");
|
|
3184
|
+
assert$51(!options.map || Array.isArray(options.map), "options.map must be an array");
|
|
3185
|
+
assert$51(!options.map || !options.adjust, "Cannot set both map and adjust options");
|
|
3186
|
+
Object.assign(this, internals$24.defaults, options);
|
|
3187
|
+
assert$51(this.type === "value" || this.ancestor === void 0, "Non-value references cannot reference ancestors");
|
|
3188
|
+
if (Array.isArray(this.map)) this.map = new Map(this.map);
|
|
3189
|
+
this.depth = this.path.length;
|
|
3190
|
+
this.key = this.path.length ? this.path.join(this.separator) : null;
|
|
3191
|
+
this.root = this.path[0];
|
|
3192
|
+
this.updateDisplay();
|
|
3193
|
+
}
|
|
3194
|
+
resolve(value, state, prefs, local, options = {}) {
|
|
3195
|
+
assert$51(!this.in || options.in, "Invalid in() reference usage");
|
|
3196
|
+
if (this.type === "global") return this._resolve(prefs.context, state, options);
|
|
3197
|
+
if (this.type === "local") return this._resolve(local, state, options);
|
|
3198
|
+
if (!this.ancestor) return this._resolve(value, state, options);
|
|
3199
|
+
if (this.ancestor === "root") return this._resolve(state.ancestors[state.ancestors.length - 1], state, options);
|
|
3200
|
+
assert$51(this.ancestor <= state.ancestors.length, "Invalid reference exceeds the schema root:", this.display);
|
|
3201
|
+
return this._resolve(state.ancestors[this.ancestor - 1], state, options);
|
|
3202
|
+
}
|
|
3203
|
+
_resolve(target, state, options) {
|
|
3204
|
+
let resolved;
|
|
3205
|
+
if (this.type === "value" && state.mainstay.shadow && options.shadow !== false) resolved = state.mainstay.shadow.get(this.absolute(state));
|
|
3206
|
+
if (resolved === void 0) resolved = reach$4(target, this.path, {
|
|
3207
|
+
iterables: this.iterables,
|
|
3208
|
+
functions: true
|
|
3209
|
+
});
|
|
3210
|
+
if (this.adjust) resolved = this.adjust(resolved);
|
|
3211
|
+
if (this.map) {
|
|
3212
|
+
const mapped = this.map.get(resolved);
|
|
3213
|
+
if (mapped !== void 0) resolved = mapped;
|
|
3234
3214
|
}
|
|
3235
|
-
if (
|
|
3236
|
-
|
|
3237
|
-
|
|
3215
|
+
if (state.mainstay) state.mainstay.tracer.resolve(state, this, resolved);
|
|
3216
|
+
return resolved;
|
|
3217
|
+
}
|
|
3218
|
+
toString() {
|
|
3219
|
+
return this.display;
|
|
3220
|
+
}
|
|
3221
|
+
absolute(state) {
|
|
3222
|
+
return [...state.path.slice(0, -this.ancestor), ...this.path];
|
|
3223
|
+
}
|
|
3224
|
+
clone() {
|
|
3225
|
+
return new internals$24.Ref(this);
|
|
3226
|
+
}
|
|
3227
|
+
describe() {
|
|
3228
|
+
const ref = { path: this.path };
|
|
3229
|
+
if (this.type !== "value") ref.type = this.type;
|
|
3230
|
+
if (this.separator !== ".") ref.separator = this.separator;
|
|
3231
|
+
if (this.type === "value" && this.ancestor !== 1) ref.ancestor = this.ancestor;
|
|
3232
|
+
if (this.map) ref.map = [...this.map];
|
|
3233
|
+
for (const key of [
|
|
3234
|
+
"adjust",
|
|
3235
|
+
"iterables",
|
|
3236
|
+
"render"
|
|
3237
|
+
]) if (this[key] !== null && this[key] !== void 0) ref[key] = this[key];
|
|
3238
|
+
if (this.in !== false) ref.in = true;
|
|
3239
|
+
return { ref };
|
|
3240
|
+
}
|
|
3241
|
+
updateDisplay() {
|
|
3242
|
+
const key = this.key !== null ? this.key : "";
|
|
3243
|
+
if (this.type !== "value") {
|
|
3244
|
+
this.display = `ref:${this.type}:${key}`;
|
|
3245
|
+
return;
|
|
3238
3246
|
}
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
const localized = message[code$1];
|
|
3243
|
-
if (code$1 === "root") {
|
|
3244
|
-
target[language].root = localized;
|
|
3245
|
-
continue;
|
|
3246
|
-
}
|
|
3247
|
-
target[language][code$1] = localized.describe({ compact: true });
|
|
3247
|
+
if (!this.separator) {
|
|
3248
|
+
this.display = `ref:${key}`;
|
|
3249
|
+
return;
|
|
3248
3250
|
}
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
exports.merge = function(base$3, extended) {
|
|
3253
|
-
if (!base$3) return exports.compile(extended);
|
|
3254
|
-
if (!extended) return base$3;
|
|
3255
|
-
if (typeof extended === "string") return new Template$6(extended);
|
|
3256
|
-
if (Template$6.isTemplate(extended)) return extended;
|
|
3257
|
-
const target = clone$17(base$3);
|
|
3258
|
-
for (let code$1 in extended) {
|
|
3259
|
-
const message = extended[code$1];
|
|
3260
|
-
if (code$1 === "root" || Template$6.isTemplate(message)) {
|
|
3261
|
-
target[code$1] = message;
|
|
3262
|
-
continue;
|
|
3251
|
+
if (!this.ancestor) {
|
|
3252
|
+
this.display = `ref:${this.separator}${key}`;
|
|
3253
|
+
return;
|
|
3263
3254
|
}
|
|
3264
|
-
if (
|
|
3265
|
-
|
|
3266
|
-
|
|
3255
|
+
if (this.ancestor === "root") {
|
|
3256
|
+
this.display = `ref:root:${key}`;
|
|
3257
|
+
return;
|
|
3267
3258
|
}
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
for (code$1 in message) {
|
|
3272
|
-
const localized = message[code$1];
|
|
3273
|
-
if (code$1 === "root" || Template$6.isTemplate(localized)) {
|
|
3274
|
-
target[language][code$1] = localized;
|
|
3275
|
-
continue;
|
|
3276
|
-
}
|
|
3277
|
-
assert$51(typeof localized === "string", "Invalid message for", code$1, "in", language);
|
|
3278
|
-
target[language][code$1] = new Template$6(localized);
|
|
3259
|
+
if (this.ancestor === 1) {
|
|
3260
|
+
this.display = `ref:${key || ".."}`;
|
|
3261
|
+
return;
|
|
3279
3262
|
}
|
|
3263
|
+
const lead = new Array(this.ancestor + 1).fill(this.separator).join("");
|
|
3264
|
+
this.display = `ref:${lead}${key || ""}`;
|
|
3280
3265
|
}
|
|
3281
|
-
return target;
|
|
3282
3266
|
};
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
max: 1e3,
|
|
3289
|
-
supported: new Set([
|
|
3290
|
-
"undefined",
|
|
3291
|
-
"boolean",
|
|
3292
|
-
"number",
|
|
3293
|
-
"string"
|
|
3294
|
-
])
|
|
3267
|
+
internals$24.Ref.prototype[Common$23.symbols.ref] = true;
|
|
3268
|
+
exports.build = function(desc$1) {
|
|
3269
|
+
desc$1 = Object.assign({}, internals$24.defaults, desc$1);
|
|
3270
|
+
if (desc$1.type === "value" && desc$1.ancestor === void 0) desc$1.ancestor = 1;
|
|
3271
|
+
return new internals$24.Ref(desc$1);
|
|
3295
3272
|
};
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3273
|
+
internals$24.context = function(key, separator, prefix = {}) {
|
|
3274
|
+
key = key.trim();
|
|
3275
|
+
if (prefix) {
|
|
3276
|
+
const globalp = prefix.global === void 0 ? "$" : prefix.global;
|
|
3277
|
+
if (globalp !== separator && key.startsWith(globalp)) return {
|
|
3278
|
+
key: key.slice(globalp.length),
|
|
3279
|
+
type: "global"
|
|
3280
|
+
};
|
|
3281
|
+
const local = prefix.local === void 0 ? "#" : prefix.local;
|
|
3282
|
+
if (local !== separator && key.startsWith(local)) return {
|
|
3283
|
+
key: key.slice(local.length),
|
|
3284
|
+
type: "local"
|
|
3285
|
+
};
|
|
3286
|
+
const root$11 = prefix.root === void 0 ? "/" : prefix.root;
|
|
3287
|
+
if (root$11 !== separator && key.startsWith(root$11)) return {
|
|
3288
|
+
key: key.slice(root$11.length),
|
|
3289
|
+
type: "value",
|
|
3290
|
+
root: true
|
|
3291
|
+
};
|
|
3306
3292
|
}
|
|
3307
|
-
|
|
3308
|
-
|
|
3293
|
+
return {
|
|
3294
|
+
key,
|
|
3295
|
+
type: "value"
|
|
3296
|
+
};
|
|
3297
|
+
};
|
|
3298
|
+
internals$24.ancestor = function(key, separator) {
|
|
3299
|
+
if (!separator) return [1, 0];
|
|
3300
|
+
if (key[0] !== separator) return [1, 0];
|
|
3301
|
+
if (key[1] !== separator) return [0, 1];
|
|
3302
|
+
let i$1 = 2;
|
|
3303
|
+
while (key[i$1] === separator) ++i$1;
|
|
3304
|
+
return [i$1 - 1, i$1];
|
|
3305
|
+
};
|
|
3306
|
+
exports.toSibling = 0;
|
|
3307
|
+
exports.toParent = 1;
|
|
3308
|
+
exports.Manager = class {
|
|
3309
|
+
constructor() {
|
|
3310
|
+
this.refs = [];
|
|
3309
3311
|
}
|
|
3310
|
-
|
|
3311
|
-
if (
|
|
3312
|
-
|
|
3313
|
-
if (
|
|
3314
|
-
|
|
3315
|
-
this._list.first(node);
|
|
3312
|
+
register(source, target) {
|
|
3313
|
+
if (!source) return;
|
|
3314
|
+
target = target === void 0 ? exports.toParent : target;
|
|
3315
|
+
if (Array.isArray(source)) {
|
|
3316
|
+
for (const ref of source) this.register(ref, target);
|
|
3316
3317
|
return;
|
|
3317
3318
|
}
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
}
|
|
3325
|
-
get(key) {
|
|
3326
|
-
const node = this._map.get(key);
|
|
3327
|
-
if (node) {
|
|
3328
|
-
this._list.first(node);
|
|
3329
|
-
return clone$16(node.value);
|
|
3330
|
-
}
|
|
3331
|
-
}
|
|
3332
|
-
_compact() {
|
|
3333
|
-
if (this._map.size > this._max) {
|
|
3334
|
-
const node = this._list.pop();
|
|
3335
|
-
this._map.delete(node.key);
|
|
3319
|
+
if (Common$23.isSchema(source)) {
|
|
3320
|
+
for (const item of source._refs.refs) if (item.ancestor - target >= 0) this.refs.push({
|
|
3321
|
+
ancestor: item.ancestor - target,
|
|
3322
|
+
root: item.root
|
|
3323
|
+
});
|
|
3324
|
+
return;
|
|
3336
3325
|
}
|
|
3326
|
+
if (exports.isRef(source) && source.type === "value" && source.ancestor - target >= 0) this.refs.push({
|
|
3327
|
+
ancestor: source.ancestor - target,
|
|
3328
|
+
root: source.root
|
|
3329
|
+
});
|
|
3330
|
+
Template$7 = Template$7 || require_template();
|
|
3331
|
+
if (Template$7.isTemplate(source)) this.register(source.refs(), target);
|
|
3337
3332
|
}
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
constructor() {
|
|
3341
|
-
this.tail = null;
|
|
3342
|
-
this.head = null;
|
|
3343
|
-
}
|
|
3344
|
-
unshift(node) {
|
|
3345
|
-
node.next = null;
|
|
3346
|
-
node.prev = this.head;
|
|
3347
|
-
if (this.head) this.head.next = node;
|
|
3348
|
-
this.head = node;
|
|
3349
|
-
if (!this.tail) this.tail = node;
|
|
3350
|
-
return node;
|
|
3333
|
+
get length() {
|
|
3334
|
+
return this.refs.length;
|
|
3351
3335
|
}
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
this.
|
|
3355
|
-
|
|
3336
|
+
clone() {
|
|
3337
|
+
const copy$1 = new exports.Manager();
|
|
3338
|
+
copy$1.refs = clone$17(this.refs);
|
|
3339
|
+
return copy$1;
|
|
3356
3340
|
}
|
|
3357
|
-
|
|
3358
|
-
|
|
3341
|
+
reset() {
|
|
3342
|
+
this.refs = [];
|
|
3359
3343
|
}
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
next.prev = prev;
|
|
3363
|
-
if (prev) prev.next = next;
|
|
3364
|
-
if (node === this.tail) this.tail = next;
|
|
3365
|
-
node.prev = null;
|
|
3366
|
-
node.next = null;
|
|
3367
|
-
return node;
|
|
3344
|
+
roots() {
|
|
3345
|
+
return this.refs.filter((ref) => !ref.ancestor).map((ref) => ref.root);
|
|
3368
3346
|
}
|
|
3369
3347
|
};
|
|
3370
3348
|
});
|
|
@@ -3393,27 +3371,23 @@ var init_lib = __esmMin(() => {
|
|
|
3393
3371
|
import_stringify = __toESM(require_stringify(), 1);
|
|
3394
3372
|
import_wait = __toESM(require_wait(), 1);
|
|
3395
3373
|
});
|
|
3396
|
-
var
|
|
3397
|
-
|
|
3398
|
-
var
|
|
3399
|
-
var init_compile = __esmMin(() => {
|
|
3400
|
-
import_ref$3 = __toESM(require_ref$2());
|
|
3401
|
-
import_common$3 = __toESM(require_common$3());
|
|
3374
|
+
var require_compile$1 = __commonJSMin((exports) => {
|
|
3375
|
+
var import_ref$3 = __toESM(require_ref$2());
|
|
3376
|
+
var import_common$3 = __toESM(require_common$3());
|
|
3402
3377
|
init_lib();
|
|
3403
|
-
Common$22 = import_common$3.default;
|
|
3404
|
-
Ref$11 = import_ref$3.default;
|
|
3405
|
-
internals$
|
|
3406
|
-
exports$
|
|
3407
|
-
exports$3.schema = function(Joi$2, config, options = {}) {
|
|
3378
|
+
const Common$22 = import_common$3.default;
|
|
3379
|
+
const Ref$11 = import_ref$3.default;
|
|
3380
|
+
const internals$23 = {};
|
|
3381
|
+
exports.schema = function(Joi$2, config, options = {}) {
|
|
3408
3382
|
Common$22.assertOptions(options, ["appendPath", "override"]);
|
|
3409
3383
|
try {
|
|
3410
|
-
return internals$
|
|
3384
|
+
return internals$23.schema(Joi$2, config, options);
|
|
3411
3385
|
} catch (err) {
|
|
3412
3386
|
if (options.appendPath && err.path !== void 0) err.message = `${err.message} (${err.path})`;
|
|
3413
3387
|
throw err;
|
|
3414
3388
|
}
|
|
3415
3389
|
};
|
|
3416
|
-
internals$
|
|
3390
|
+
internals$23.schema = function(Joi$2, config, options) {
|
|
3417
3391
|
(0, import_assert.default)(config !== void 0, "Invalid undefined schema");
|
|
3418
3392
|
if (Array.isArray(config)) {
|
|
3419
3393
|
(0, import_assert.default)(config.length, "Invalid empty array schema");
|
|
@@ -3423,13 +3397,13 @@ var init_compile = __esmMin(() => {
|
|
|
3423
3397
|
if (options.override !== false) return base$3.valid(Joi$2.override, ...values$3);
|
|
3424
3398
|
return base$3.valid(...values$3);
|
|
3425
3399
|
};
|
|
3426
|
-
if (internals$
|
|
3400
|
+
if (internals$23.simple(config)) return valid$2(Joi$2, config);
|
|
3427
3401
|
if (typeof config === "function") return Joi$2.custom(config);
|
|
3428
3402
|
(0, import_assert.default)(typeof config === "object", "Invalid schema content:", typeof config);
|
|
3429
3403
|
if (Common$22.isResolvable(config)) return valid$2(Joi$2, config);
|
|
3430
3404
|
if (Common$22.isSchema(config)) return config;
|
|
3431
3405
|
if (Array.isArray(config)) {
|
|
3432
|
-
for (const item of config) if (!internals$
|
|
3406
|
+
for (const item of config) if (!internals$23.simple(item)) return Joi$2.alternatives().try(...config);
|
|
3433
3407
|
return valid$2(Joi$2, ...config);
|
|
3434
3408
|
}
|
|
3435
3409
|
if (config instanceof RegExp) return Joi$2.string().regex(config);
|
|
@@ -3437,23 +3411,23 @@ var init_compile = __esmMin(() => {
|
|
|
3437
3411
|
(0, import_assert.default)(Object.getPrototypeOf(config) === Object.getPrototypeOf({}), "Schema can only contain plain objects");
|
|
3438
3412
|
return Joi$2.object().keys(config);
|
|
3439
3413
|
};
|
|
3440
|
-
exports
|
|
3414
|
+
exports.ref = function(id, options) {
|
|
3441
3415
|
return Ref$11.isRef(id) ? id : Ref$11.create(id, options);
|
|
3442
3416
|
};
|
|
3443
|
-
exports
|
|
3417
|
+
exports.compile = function(root$11, schema$2, options = {}) {
|
|
3444
3418
|
Common$22.assertOptions(options, ["legacy"]);
|
|
3445
3419
|
const any = schema$2 && schema$2[Common$22.symbols.any];
|
|
3446
3420
|
if (any) return schema$2;
|
|
3447
|
-
if (typeof schema$2 !== "object" || !options.legacy) return exports
|
|
3448
|
-
const compiler = internals$
|
|
3449
|
-
if (!compiler) return exports
|
|
3421
|
+
if (typeof schema$2 !== "object" || !options.legacy) return exports.schema(root$11, schema$2, { appendPath: true });
|
|
3422
|
+
const compiler = internals$23.walk(schema$2);
|
|
3423
|
+
if (!compiler) return exports.schema(root$11, schema$2, { appendPath: true });
|
|
3450
3424
|
return compiler.compile(compiler.root, schema$2);
|
|
3451
3425
|
};
|
|
3452
|
-
internals$
|
|
3426
|
+
internals$23.walk = function(schema$2) {
|
|
3453
3427
|
if (typeof schema$2 !== "object") return null;
|
|
3454
3428
|
if (Array.isArray(schema$2)) {
|
|
3455
3429
|
for (const item of schema$2) {
|
|
3456
|
-
const compiler = internals$
|
|
3430
|
+
const compiler = internals$23.walk(item);
|
|
3457
3431
|
if (compiler) return compiler;
|
|
3458
3432
|
}
|
|
3459
3433
|
return null;
|
|
@@ -3465,19 +3439,19 @@ var init_compile = __esmMin(() => {
|
|
|
3465
3439
|
};
|
|
3466
3440
|
(0, import_assert.default)(Object.getPrototypeOf(schema$2) === Object.getPrototypeOf({}), "Schema can only contain plain objects");
|
|
3467
3441
|
for (const key in schema$2) {
|
|
3468
|
-
const compiler = internals$
|
|
3442
|
+
const compiler = internals$23.walk(schema$2[key]);
|
|
3469
3443
|
if (compiler) return compiler;
|
|
3470
3444
|
}
|
|
3471
3445
|
return null;
|
|
3472
3446
|
};
|
|
3473
|
-
internals$
|
|
3447
|
+
internals$23.simple = function(value) {
|
|
3474
3448
|
return value === null || [
|
|
3475
3449
|
"boolean",
|
|
3476
3450
|
"string",
|
|
3477
3451
|
"number"
|
|
3478
3452
|
].includes(typeof value);
|
|
3479
3453
|
};
|
|
3480
|
-
exports
|
|
3454
|
+
exports.when = function(schema$2, condition, options) {
|
|
3481
3455
|
if (options === void 0) {
|
|
3482
3456
|
(0, import_assert.default)(condition && typeof condition === "object", "Missing options");
|
|
3483
3457
|
options = condition;
|
|
@@ -3496,7 +3470,7 @@ var init_compile = __esmMin(() => {
|
|
|
3496
3470
|
(0, import_assert.default)(options.is === void 0, "\"is\" can not be used with a schema condition");
|
|
3497
3471
|
(0, import_assert.default)(options.not === void 0, "\"not\" can not be used with a schema condition");
|
|
3498
3472
|
(0, import_assert.default)(options.switch === void 0, "\"switch\" can not be used with a schema condition");
|
|
3499
|
-
return internals$
|
|
3473
|
+
return internals$23.condition(schema$2, {
|
|
3500
3474
|
is: condition,
|
|
3501
3475
|
then: options.then,
|
|
3502
3476
|
otherwise: options.otherwise,
|
|
@@ -3517,8 +3491,8 @@ var init_compile = __esmMin(() => {
|
|
|
3517
3491
|
(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\"");
|
|
3518
3492
|
(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");
|
|
3519
3493
|
if (options.is !== void 0 && !Ref$11.isRef(options.is) && !Common$22.isSchema(options.is)) is = is.required();
|
|
3520
|
-
return internals$
|
|
3521
|
-
ref: exports
|
|
3494
|
+
return internals$23.condition(schema$2, {
|
|
3495
|
+
ref: exports.ref(condition),
|
|
3522
3496
|
is,
|
|
3523
3497
|
then: rule$1.then,
|
|
3524
3498
|
otherwise: rule$1.otherwise,
|
|
@@ -3530,7 +3504,7 @@ var init_compile = __esmMin(() => {
|
|
|
3530
3504
|
(0, import_assert.default)(options.not === void 0, "Cannot combine \"switch\" with \"not\"");
|
|
3531
3505
|
(0, import_assert.default)(options.then === void 0, "Cannot combine \"switch\" with \"then\"");
|
|
3532
3506
|
const rule = {
|
|
3533
|
-
ref: exports
|
|
3507
|
+
ref: exports.ref(condition),
|
|
3534
3508
|
switch: [],
|
|
3535
3509
|
break: options.break
|
|
3536
3510
|
};
|
|
@@ -3561,18 +3535,113 @@ var init_compile = __esmMin(() => {
|
|
|
3561
3535
|
}
|
|
3562
3536
|
return rule;
|
|
3563
3537
|
};
|
|
3564
|
-
internals$
|
|
3538
|
+
internals$23.condition = function(schema$2, condition) {
|
|
3565
3539
|
for (const key of ["then", "otherwise"]) if (condition[key] === void 0) delete condition[key];
|
|
3566
3540
|
else condition[key] = schema$2.$_compile(condition[key]);
|
|
3567
3541
|
return condition;
|
|
3568
3542
|
};
|
|
3569
|
-
|
|
3543
|
+
});
|
|
3544
|
+
var require_messages = __commonJSMin((exports) => {
|
|
3545
|
+
const { assert: assert$48, clone: clone$15 } = require_lib$4();
|
|
3546
|
+
const Template$6 = require_template();
|
|
3547
|
+
exports.compile = function(messages$3, target) {
|
|
3548
|
+
if (typeof messages$3 === "string") {
|
|
3549
|
+
assert$48(!target, "Cannot set single message string");
|
|
3550
|
+
return new Template$6(messages$3);
|
|
3551
|
+
}
|
|
3552
|
+
if (Template$6.isTemplate(messages$3)) {
|
|
3553
|
+
assert$48(!target, "Cannot set single message template");
|
|
3554
|
+
return messages$3;
|
|
3555
|
+
}
|
|
3556
|
+
assert$48(typeof messages$3 === "object" && !Array.isArray(messages$3), "Invalid message options");
|
|
3557
|
+
target = target ? clone$15(target) : {};
|
|
3558
|
+
for (let code$1 in messages$3) {
|
|
3559
|
+
const message = messages$3[code$1];
|
|
3560
|
+
if (code$1 === "root" || Template$6.isTemplate(message)) {
|
|
3561
|
+
target[code$1] = message;
|
|
3562
|
+
continue;
|
|
3563
|
+
}
|
|
3564
|
+
if (typeof message === "string") {
|
|
3565
|
+
target[code$1] = new Template$6(message);
|
|
3566
|
+
continue;
|
|
3567
|
+
}
|
|
3568
|
+
assert$48(typeof message === "object" && !Array.isArray(message), "Invalid message for", code$1);
|
|
3569
|
+
const language = code$1;
|
|
3570
|
+
target[language] = target[language] || {};
|
|
3571
|
+
for (code$1 in message) {
|
|
3572
|
+
const localized = message[code$1];
|
|
3573
|
+
if (code$1 === "root" || Template$6.isTemplate(localized)) {
|
|
3574
|
+
target[language][code$1] = localized;
|
|
3575
|
+
continue;
|
|
3576
|
+
}
|
|
3577
|
+
assert$48(typeof localized === "string", "Invalid message for", code$1, "in", language);
|
|
3578
|
+
target[language][code$1] = new Template$6(localized);
|
|
3579
|
+
}
|
|
3580
|
+
}
|
|
3581
|
+
return target;
|
|
3582
|
+
};
|
|
3583
|
+
exports.decompile = function(messages$3) {
|
|
3584
|
+
const target = {};
|
|
3585
|
+
for (let code$1 in messages$3) {
|
|
3586
|
+
const message = messages$3[code$1];
|
|
3587
|
+
if (code$1 === "root") {
|
|
3588
|
+
target.root = message;
|
|
3589
|
+
continue;
|
|
3590
|
+
}
|
|
3591
|
+
if (Template$6.isTemplate(message)) {
|
|
3592
|
+
target[code$1] = message.describe({ compact: true });
|
|
3593
|
+
continue;
|
|
3594
|
+
}
|
|
3595
|
+
const language = code$1;
|
|
3596
|
+
target[language] = {};
|
|
3597
|
+
for (code$1 in message) {
|
|
3598
|
+
const localized = message[code$1];
|
|
3599
|
+
if (code$1 === "root") {
|
|
3600
|
+
target[language].root = localized;
|
|
3601
|
+
continue;
|
|
3602
|
+
}
|
|
3603
|
+
target[language][code$1] = localized.describe({ compact: true });
|
|
3604
|
+
}
|
|
3605
|
+
}
|
|
3606
|
+
return target;
|
|
3607
|
+
};
|
|
3608
|
+
exports.merge = function(base$3, extended) {
|
|
3609
|
+
if (!base$3) return exports.compile(extended);
|
|
3610
|
+
if (!extended) return base$3;
|
|
3611
|
+
if (typeof extended === "string") return new Template$6(extended);
|
|
3612
|
+
if (Template$6.isTemplate(extended)) return extended;
|
|
3613
|
+
const target = clone$15(base$3);
|
|
3614
|
+
for (let code$1 in extended) {
|
|
3615
|
+
const message = extended[code$1];
|
|
3616
|
+
if (code$1 === "root" || Template$6.isTemplate(message)) {
|
|
3617
|
+
target[code$1] = message;
|
|
3618
|
+
continue;
|
|
3619
|
+
}
|
|
3620
|
+
if (typeof message === "string") {
|
|
3621
|
+
target[code$1] = new Template$6(message);
|
|
3622
|
+
continue;
|
|
3623
|
+
}
|
|
3624
|
+
assert$48(typeof message === "object" && !Array.isArray(message), "Invalid message for", code$1);
|
|
3625
|
+
const language = code$1;
|
|
3626
|
+
target[language] = target[language] || {};
|
|
3627
|
+
for (code$1 in message) {
|
|
3628
|
+
const localized = message[code$1];
|
|
3629
|
+
if (code$1 === "root" || Template$6.isTemplate(localized)) {
|
|
3630
|
+
target[language][code$1] = localized;
|
|
3631
|
+
continue;
|
|
3632
|
+
}
|
|
3633
|
+
assert$48(typeof localized === "string", "Invalid message for", code$1, "in", language);
|
|
3634
|
+
target[language][code$1] = new Template$6(localized);
|
|
3635
|
+
}
|
|
3636
|
+
}
|
|
3637
|
+
return target;
|
|
3638
|
+
};
|
|
3570
3639
|
});
|
|
3571
3640
|
var require_extend$1 = __commonJSMin((exports) => {
|
|
3572
3641
|
const { assert: assert$47, clone: clone$14 } = require_lib$4();
|
|
3573
3642
|
const Common$21 = require_common$3();
|
|
3574
|
-
const Messages$
|
|
3575
|
-
const internals$
|
|
3643
|
+
const Messages$6 = require_messages();
|
|
3644
|
+
const internals$22 = {};
|
|
3576
3645
|
exports.type = function(from$2, options) {
|
|
3577
3646
|
const base$3 = Object.getPrototypeOf(from$2);
|
|
3578
3647
|
const prototype = clone$14(base$3);
|
|
@@ -3581,7 +3650,7 @@ var require_extend$1 = __commonJSMin((exports) => {
|
|
|
3581
3650
|
delete def.base;
|
|
3582
3651
|
prototype._definition = def;
|
|
3583
3652
|
const parent = base$3._definition || {};
|
|
3584
|
-
def.messages = Messages$
|
|
3653
|
+
def.messages = Messages$6.merge(parent.messages, def.messages);
|
|
3585
3654
|
def.properties = Object.assign({}, parent.properties, def.properties);
|
|
3586
3655
|
schema$2.type = def.type;
|
|
3587
3656
|
def.flags = Object.assign({}, parent.flags, def.flags);
|
|
@@ -3594,7 +3663,7 @@ var require_extend$1 = __commonJSMin((exports) => {
|
|
|
3594
3663
|
}
|
|
3595
3664
|
def.terms = terms;
|
|
3596
3665
|
if (!def.args) def.args = parent.args;
|
|
3597
|
-
def.prepare = internals$
|
|
3666
|
+
def.prepare = internals$22.prepare(def.prepare, parent.prepare);
|
|
3598
3667
|
if (def.coerce) {
|
|
3599
3668
|
if (typeof def.coerce === "function") def.coerce = { method: def.coerce };
|
|
3600
3669
|
if (def.coerce.from && !Array.isArray(def.coerce.from)) def.coerce = {
|
|
@@ -3602,8 +3671,8 @@ var require_extend$1 = __commonJSMin((exports) => {
|
|
|
3602
3671
|
from: [].concat(def.coerce.from)
|
|
3603
3672
|
};
|
|
3604
3673
|
}
|
|
3605
|
-
def.coerce = internals$
|
|
3606
|
-
def.validate = internals$
|
|
3674
|
+
def.coerce = internals$22.coerce(def.coerce, parent.coerce);
|
|
3675
|
+
def.validate = internals$22.validate(def.validate, parent.validate);
|
|
3607
3676
|
const rules = Object.assign({}, parent.rules);
|
|
3608
3677
|
if (def.rules) for (const name$3 in def.rules) {
|
|
3609
3678
|
const rule = def.rules[name$3];
|
|
@@ -3658,18 +3727,18 @@ var require_extend$1 = __commonJSMin((exports) => {
|
|
|
3658
3727
|
}
|
|
3659
3728
|
def.cast = Object.assign({}, parent.cast, def.cast);
|
|
3660
3729
|
const manifest = Object.assign({}, parent.manifest, def.manifest);
|
|
3661
|
-
manifest.build = internals$
|
|
3730
|
+
manifest.build = internals$22.build(def.manifest && def.manifest.build, parent.manifest && parent.manifest.build);
|
|
3662
3731
|
def.manifest = manifest;
|
|
3663
|
-
def.rebuild = internals$
|
|
3732
|
+
def.rebuild = internals$22.rebuild(def.rebuild, parent.rebuild);
|
|
3664
3733
|
return schema$2;
|
|
3665
3734
|
};
|
|
3666
|
-
internals$
|
|
3735
|
+
internals$22.build = function(child, parent) {
|
|
3667
3736
|
if (!child || !parent) return child || parent;
|
|
3668
3737
|
return function(obj, desc$1) {
|
|
3669
3738
|
return parent(child(obj, desc$1), desc$1);
|
|
3670
3739
|
};
|
|
3671
3740
|
};
|
|
3672
|
-
internals$
|
|
3741
|
+
internals$22.coerce = function(child, parent) {
|
|
3673
3742
|
if (!child || !parent) return child || parent;
|
|
3674
3743
|
return {
|
|
3675
3744
|
from: child.from && parent.from ? [...new Set([...child.from, ...parent.from])] : null,
|
|
@@ -3690,7 +3759,7 @@ var require_extend$1 = __commonJSMin((exports) => {
|
|
|
3690
3759
|
}
|
|
3691
3760
|
};
|
|
3692
3761
|
};
|
|
3693
|
-
internals$
|
|
3762
|
+
internals$22.prepare = function(child, parent) {
|
|
3694
3763
|
if (!child || !parent) return child || parent;
|
|
3695
3764
|
return function(value, helpers$8) {
|
|
3696
3765
|
const prepared = child(value, helpers$8);
|
|
@@ -3701,14 +3770,14 @@ var require_extend$1 = __commonJSMin((exports) => {
|
|
|
3701
3770
|
return parent(value, helpers$8) || prepared;
|
|
3702
3771
|
};
|
|
3703
3772
|
};
|
|
3704
|
-
internals$
|
|
3773
|
+
internals$22.rebuild = function(child, parent) {
|
|
3705
3774
|
if (!child || !parent) return child || parent;
|
|
3706
3775
|
return function(schema$2) {
|
|
3707
3776
|
parent(schema$2);
|
|
3708
3777
|
child(schema$2);
|
|
3709
3778
|
};
|
|
3710
3779
|
};
|
|
3711
|
-
internals$
|
|
3780
|
+
internals$22.validate = function(child, parent) {
|
|
3712
3781
|
if (!child || !parent) return child || parent;
|
|
3713
3782
|
return function(value, helpers$8) {
|
|
3714
3783
|
const result = parent(value, helpers$8);
|
|
@@ -3720,16 +3789,16 @@ var require_extend$1 = __commonJSMin((exports) => {
|
|
|
3720
3789
|
};
|
|
3721
3790
|
};
|
|
3722
3791
|
});
|
|
3723
|
-
var require_manifest = __commonJSMin((exports
|
|
3792
|
+
var require_manifest = __commonJSMin((exports) => {
|
|
3724
3793
|
init_dist$1();
|
|
3725
|
-
var import_schemas$
|
|
3794
|
+
var import_schemas$1 = __toESM(require_schemas());
|
|
3726
3795
|
var import_template$2 = __toESM(require_template());
|
|
3727
3796
|
var import_ref$2 = __toESM(require_ref$2());
|
|
3728
|
-
var import_messages$
|
|
3797
|
+
var import_messages$2 = __toESM(require_messages());
|
|
3729
3798
|
var import_common$2 = __toESM(require_common$3());
|
|
3730
3799
|
init_lib();
|
|
3731
3800
|
const Common$20 = import_common$2.default;
|
|
3732
|
-
const Messages$
|
|
3801
|
+
const Messages$5 = import_messages$2.default;
|
|
3733
3802
|
const Ref$10 = import_ref$2.default;
|
|
3734
3803
|
const Template$5 = import_template$2.default;
|
|
3735
3804
|
const ManifestDescriptionCache = new Map();
|
|
@@ -3749,10 +3818,9 @@ var require_manifest = __commonJSMin((exports, module) => {
|
|
|
3749
3818
|
}
|
|
3750
3819
|
};
|
|
3751
3820
|
const ManifestItemCache = new ManifestItemCacheClass();
|
|
3752
|
-
let Schemas$
|
|
3753
|
-
const internals$
|
|
3754
|
-
|
|
3755
|
-
exports$2.describe = function(schema$2) {
|
|
3821
|
+
let Schemas$3;
|
|
3822
|
+
const internals$21 = {};
|
|
3823
|
+
exports.describe = function(schema$2) {
|
|
3756
3824
|
const cached$1 = ManifestDescriptionCache.get(schema$2);
|
|
3757
3825
|
if (cached$1) return cached$1;
|
|
3758
3826
|
const def = schema$2._definition;
|
|
@@ -3761,12 +3829,12 @@ var require_manifest = __commonJSMin((exports, module) => {
|
|
|
3761
3829
|
flags: {},
|
|
3762
3830
|
rules: []
|
|
3763
3831
|
};
|
|
3764
|
-
for (const flag in schema$2._flags) if (flag[0] !== "_") desc$1.flags[flag] = internals$
|
|
3832
|
+
for (const flag in schema$2._flags) if (flag[0] !== "_") desc$1.flags[flag] = internals$21.describe(schema$2._flags[flag]);
|
|
3765
3833
|
if (!Object.keys(desc$1.flags).length) delete desc$1.flags;
|
|
3766
3834
|
if (schema$2._preferences) {
|
|
3767
3835
|
desc$1.preferences = (0, import_clone.default)(schema$2._preferences, { shallow: ["messages"] });
|
|
3768
3836
|
delete desc$1.preferences[Common$20.symbols.prefs];
|
|
3769
|
-
if (desc$1.preferences.messages) desc$1.preferences.messages = Messages$
|
|
3837
|
+
if (desc$1.preferences.messages) desc$1.preferences.messages = Messages$5.decompile(desc$1.preferences.messages);
|
|
3770
3838
|
}
|
|
3771
3839
|
if (schema$2._valids) desc$1.allow = schema$2._valids.describe();
|
|
3772
3840
|
if (schema$2._invalids) desc$1.invalid = schema$2._invalids.describe();
|
|
@@ -3774,13 +3842,13 @@ var require_manifest = __commonJSMin((exports, module) => {
|
|
|
3774
3842
|
const ruleDef = def.rules[rule.name];
|
|
3775
3843
|
if (ruleDef.manifest === false) continue;
|
|
3776
3844
|
const item = { name: rule.name };
|
|
3777
|
-
for (const custom$1 in def.modifiers) if (rule[custom$1] !== void 0) item[custom$1] = internals$
|
|
3845
|
+
for (const custom$1 in def.modifiers) if (rule[custom$1] !== void 0) item[custom$1] = internals$21.describe(rule[custom$1]);
|
|
3778
3846
|
if (rule.args) {
|
|
3779
3847
|
item.args = {};
|
|
3780
3848
|
for (const key in rule.args) {
|
|
3781
3849
|
const arg = rule.args[key];
|
|
3782
3850
|
if (key === "options" && !Object.keys(arg).length) continue;
|
|
3783
|
-
item.args[key] = internals$
|
|
3851
|
+
item.args[key] = internals$21.describe(arg, { assign: key });
|
|
3784
3852
|
}
|
|
3785
3853
|
if (!Object.keys(item.args).length) delete item.args;
|
|
3786
3854
|
}
|
|
@@ -3805,7 +3873,7 @@ var require_manifest = __commonJSMin((exports, module) => {
|
|
|
3805
3873
|
const mapped = typeof manifest === "object";
|
|
3806
3874
|
if (!items.length && !mapped) continue;
|
|
3807
3875
|
const normalized = [];
|
|
3808
|
-
for (const item of items) normalized.push(internals$
|
|
3876
|
+
for (const item of items) normalized.push(internals$21.describe(item));
|
|
3809
3877
|
if (mapped) {
|
|
3810
3878
|
const { from: from$2, to } = manifest.mapped;
|
|
3811
3879
|
desc$1[term] = {};
|
|
@@ -3819,14 +3887,14 @@ var require_manifest = __commonJSMin((exports, module) => {
|
|
|
3819
3887
|
}
|
|
3820
3888
|
desc$1[term] = normalized;
|
|
3821
3889
|
}
|
|
3822
|
-
internals$
|
|
3890
|
+
internals$21.validate(schema$2.$_root, desc$1);
|
|
3823
3891
|
ManifestDescriptionCache.set(schema$2, desc$1);
|
|
3824
3892
|
return desc$1;
|
|
3825
3893
|
};
|
|
3826
|
-
internals$
|
|
3894
|
+
internals$21.describe = function(item, options = {}) {
|
|
3827
3895
|
const cached$1 = ManifestItemCache.get(item, options);
|
|
3828
3896
|
if (cached$1) return cached$1;
|
|
3829
|
-
if (Array.isArray(item)) return ManifestItemCache.setAndReturn(item, options, item.map(internals$
|
|
3897
|
+
if (Array.isArray(item)) return ManifestItemCache.setAndReturn(item, options, item.map(internals$21.describe));
|
|
3830
3898
|
if (item === Common$20.symbols.deepDefault) return ManifestItemCache.setAndReturn(item, options, { special: "deep" });
|
|
3831
3899
|
if (typeof item !== "object" || item === null) return ManifestItemCache.setAndReturn(item, options, item);
|
|
3832
3900
|
if (options.assign === "options") return ManifestItemCache.setAndReturn(item, options, (0, import_clone.default)(item));
|
|
@@ -3846,20 +3914,20 @@ var require_manifest = __commonJSMin((exports, module) => {
|
|
|
3846
3914
|
for (const key in item) {
|
|
3847
3915
|
const value = item[key];
|
|
3848
3916
|
if (value === void 0) continue;
|
|
3849
|
-
normalized[key] = internals$
|
|
3917
|
+
normalized[key] = internals$21.describe(value, { assign: key });
|
|
3850
3918
|
}
|
|
3851
3919
|
return ManifestItemCache.setAndReturn(item, options, normalized);
|
|
3852
3920
|
};
|
|
3853
|
-
exports
|
|
3854
|
-
const builder = new internals$
|
|
3921
|
+
exports.build = function(joi$1, desc$1) {
|
|
3922
|
+
const builder = new internals$21.Builder(joi$1);
|
|
3855
3923
|
return builder.parse(desc$1);
|
|
3856
3924
|
};
|
|
3857
|
-
internals$
|
|
3925
|
+
internals$21.Builder = class {
|
|
3858
3926
|
constructor(joi$1) {
|
|
3859
3927
|
this.joi = joi$1;
|
|
3860
3928
|
}
|
|
3861
3929
|
parse(desc$1) {
|
|
3862
|
-
internals$
|
|
3930
|
+
internals$21.validate(this.joi, desc$1);
|
|
3863
3931
|
let schema$2 = this.joi[desc$1.type]()._bare();
|
|
3864
3932
|
const def = schema$2._definition;
|
|
3865
3933
|
if (desc$1.flags) for (const flag in desc$1.flags) {
|
|
@@ -3936,7 +4004,7 @@ var require_manifest = __commonJSMin((exports, module) => {
|
|
|
3936
4004
|
if (Array.isArray(desc$1)) return desc$1.map((item) => this.build(item));
|
|
3937
4005
|
if (desc$1 instanceof Error) return desc$1;
|
|
3938
4006
|
if (options.assign === "options") return (0, import_clone.default)(desc$1);
|
|
3939
|
-
if (options.assign === "regex") return internals$
|
|
4007
|
+
if (options.assign === "regex") return internals$21.regex(desc$1);
|
|
3940
4008
|
if (options.assign === "ref") return Ref$10.build(desc$1);
|
|
3941
4009
|
if (typeof desc$1 !== "object") return desc$1;
|
|
3942
4010
|
if (Object.keys(desc$1).length === 1) {
|
|
@@ -3950,7 +4018,7 @@ var require_manifest = __commonJSMin((exports, module) => {
|
|
|
3950
4018
|
};
|
|
3951
4019
|
if (desc$1.override) return Common$20.symbols.override;
|
|
3952
4020
|
if (desc$1.ref) return Ref$10.build(desc$1.ref);
|
|
3953
|
-
if (desc$1.regex) return internals$
|
|
4021
|
+
if (desc$1.regex) return internals$21.regex(desc$1.regex);
|
|
3954
4022
|
if (desc$1.special) {
|
|
3955
4023
|
(0, import_assert.default)(["deep"].includes(desc$1.special), "Unknown special value", desc$1.special);
|
|
3956
4024
|
return Common$20.symbols.deepDefault;
|
|
@@ -3964,17 +4032,16 @@ var require_manifest = __commonJSMin((exports, module) => {
|
|
|
3964
4032
|
return normalized;
|
|
3965
4033
|
}
|
|
3966
4034
|
};
|
|
3967
|
-
internals$
|
|
4035
|
+
internals$21.regex = function(string) {
|
|
3968
4036
|
const end = string.lastIndexOf("/");
|
|
3969
4037
|
const exp = string.slice(1, end);
|
|
3970
4038
|
const flags = string.slice(end + 1);
|
|
3971
4039
|
return new RegExp(exp, flags);
|
|
3972
4040
|
};
|
|
3973
|
-
internals$
|
|
3974
|
-
Schemas$
|
|
3975
|
-
joi$1.assert(desc$1, Schemas$
|
|
4041
|
+
internals$21.validate = function(joi$1, desc$1) {
|
|
4042
|
+
Schemas$3 = Schemas$3 || import_schemas$1.default;
|
|
4043
|
+
joi$1.assert(desc$1, Schemas$3.description);
|
|
3976
4044
|
};
|
|
3977
|
-
module.exports = exports$2;
|
|
3978
4045
|
});
|
|
3979
4046
|
var require_lib$2 = __commonJSMin((exports) => {
|
|
3980
4047
|
exports.location = function(depth = 0) {
|
|
@@ -3994,7 +4061,7 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
3994
4061
|
const { deepEqual: deepEqual$3 } = require_lib$4();
|
|
3995
4062
|
const Pinpoint = require_lib$2();
|
|
3996
4063
|
const Errors$7 = require_errors$2();
|
|
3997
|
-
const internals$
|
|
4064
|
+
const internals$20 = {
|
|
3998
4065
|
codes: {
|
|
3999
4066
|
error: 1,
|
|
4000
4067
|
pass: 2,
|
|
@@ -4008,7 +4075,7 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
4008
4075
|
};
|
|
4009
4076
|
exports.setup = function(root$11) {
|
|
4010
4077
|
const trace = function() {
|
|
4011
|
-
root$11._tracer = root$11._tracer || new internals$
|
|
4078
|
+
root$11._tracer = root$11._tracer || new internals$20.Tracer();
|
|
4012
4079
|
return root$11._tracer;
|
|
4013
4080
|
};
|
|
4014
4081
|
root$11.trace = trace;
|
|
@@ -4020,7 +4087,7 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
4020
4087
|
exports.location = function(schema$2) {
|
|
4021
4088
|
return schema$2.$_setFlag("_tracerLocation", Pinpoint.location(2));
|
|
4022
4089
|
};
|
|
4023
|
-
internals$
|
|
4090
|
+
internals$20.Tracer = class {
|
|
4024
4091
|
constructor() {
|
|
4025
4092
|
this.name = "Joi";
|
|
4026
4093
|
this._schemas = new Map();
|
|
@@ -4028,7 +4095,7 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
4028
4095
|
_register(schema$2) {
|
|
4029
4096
|
const existing = this._schemas.get(schema$2);
|
|
4030
4097
|
if (existing) return existing.store;
|
|
4031
|
-
const store = new internals$
|
|
4098
|
+
const store = new internals$20.Store(schema$2);
|
|
4032
4099
|
const { filename, line } = schema$2._flags._tracerLocation || Pinpoint.location(5);
|
|
4033
4100
|
this._schemas.set(schema$2, {
|
|
4034
4101
|
filename,
|
|
@@ -4047,7 +4114,7 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
4047
4114
|
const missing = [];
|
|
4048
4115
|
const skipped = [];
|
|
4049
4116
|
for (const [schema$2, log$1] of store._sources.entries()) {
|
|
4050
|
-
if (internals$
|
|
4117
|
+
if (internals$20.sub(log$1.paths, skipped)) continue;
|
|
4051
4118
|
if (!log$1.entry) {
|
|
4052
4119
|
missing.push({
|
|
4053
4120
|
status: "never reached",
|
|
@@ -4073,7 +4140,7 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
4073
4140
|
const rules = schema$2._rules.map((rule) => rule.name);
|
|
4074
4141
|
for (const type of ["default", "failover"]) if (schema$2._flags[type] !== void 0) rules.push(type);
|
|
4075
4142
|
for (const name$3 of rules) {
|
|
4076
|
-
const status = internals$
|
|
4143
|
+
const status = internals$20.labels[log$1.rule[name$3] || 0];
|
|
4077
4144
|
if (status) {
|
|
4078
4145
|
const report = {
|
|
4079
4146
|
rule: name$3,
|
|
@@ -4089,13 +4156,13 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
4089
4156
|
line,
|
|
4090
4157
|
missing,
|
|
4091
4158
|
severity: "error",
|
|
4092
|
-
message: `Schema missing tests for ${missing.map(internals$
|
|
4159
|
+
message: `Schema missing tests for ${missing.map(internals$20.message).join(", ")}`
|
|
4093
4160
|
});
|
|
4094
4161
|
}
|
|
4095
4162
|
return coverage.length ? coverage : null;
|
|
4096
4163
|
}
|
|
4097
4164
|
};
|
|
4098
|
-
internals$
|
|
4165
|
+
internals$20.Store = class {
|
|
4099
4166
|
constructor(schema$2) {
|
|
4100
4167
|
this.active = true;
|
|
4101
4168
|
this._sources = new Map();
|
|
@@ -4111,13 +4178,13 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
4111
4178
|
});
|
|
4112
4179
|
}
|
|
4113
4180
|
entry(schema$2, state) {
|
|
4114
|
-
internals$
|
|
4181
|
+
internals$20.debug(state, { type: "entry" });
|
|
4115
4182
|
this._record(schema$2, (log$1) => {
|
|
4116
4183
|
log$1.entry = true;
|
|
4117
4184
|
});
|
|
4118
4185
|
}
|
|
4119
4186
|
filter(schema$2, state, source, value) {
|
|
4120
|
-
internals$
|
|
4187
|
+
internals$20.debug(state, {
|
|
4121
4188
|
type: source,
|
|
4122
4189
|
...value
|
|
4123
4190
|
});
|
|
@@ -4126,14 +4193,14 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
4126
4193
|
});
|
|
4127
4194
|
}
|
|
4128
4195
|
log(schema$2, state, source, name$3, result) {
|
|
4129
|
-
internals$
|
|
4196
|
+
internals$20.debug(state, {
|
|
4130
4197
|
type: source,
|
|
4131
4198
|
name: name$3,
|
|
4132
4199
|
result: result === "full" ? "pass" : result
|
|
4133
4200
|
});
|
|
4134
4201
|
this._record(schema$2, (log$1) => {
|
|
4135
4202
|
log$1[source][name$3] = log$1[source][name$3] || 0;
|
|
4136
|
-
log$1[source][name$3] |= internals$
|
|
4203
|
+
log$1[source][name$3] |= internals$20.codes[result];
|
|
4137
4204
|
});
|
|
4138
4205
|
}
|
|
4139
4206
|
resolve(state, ref, to) {
|
|
@@ -4182,7 +4249,7 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
4182
4249
|
}
|
|
4183
4250
|
if (path.length) log$1.paths.add(path);
|
|
4184
4251
|
const each$5 = (sub, source) => {
|
|
4185
|
-
const subId = internals$
|
|
4252
|
+
const subId = internals$20.id(sub, source);
|
|
4186
4253
|
this._scan(sub, path.concat(subId));
|
|
4187
4254
|
};
|
|
4188
4255
|
schema$2.$_modify({
|
|
@@ -4194,22 +4261,22 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
4194
4261
|
this._combos.set(merged, sources);
|
|
4195
4262
|
}
|
|
4196
4263
|
};
|
|
4197
|
-
internals$
|
|
4264
|
+
internals$20.message = function(item) {
|
|
4198
4265
|
const path = item.paths ? Errors$7.path(item.paths[0]) + (item.rule ? ":" : "") : "";
|
|
4199
4266
|
return `${path}${item.rule || ""} (${item.status})`;
|
|
4200
4267
|
};
|
|
4201
|
-
internals$
|
|
4268
|
+
internals$20.id = function(schema$2, { source, name: name$3, path, key }) {
|
|
4202
4269
|
if (schema$2._flags.id) return schema$2._flags.id;
|
|
4203
4270
|
if (key) return key;
|
|
4204
4271
|
name$3 = `@${name$3}`;
|
|
4205
4272
|
if (source === "terms") return [name$3, path[Math.min(path.length - 1, 1)]];
|
|
4206
4273
|
return name$3;
|
|
4207
4274
|
};
|
|
4208
|
-
internals$
|
|
4275
|
+
internals$20.sub = function(paths, skipped) {
|
|
4209
4276
|
for (const path of paths) for (const skip of skipped) if (deepEqual$3(path.slice(0, skip.length), skip)) return true;
|
|
4210
4277
|
return false;
|
|
4211
4278
|
};
|
|
4212
|
-
internals$
|
|
4279
|
+
internals$20.debug = function(state, event) {
|
|
4213
4280
|
if (state.mainstay.debug) {
|
|
4214
4281
|
event.path = state.debug ? [...state.path, state.debug] : state.path;
|
|
4215
4282
|
state.mainstay.debug.push(event);
|
|
@@ -4220,15 +4287,15 @@ var require_modify = __commonJSMin((exports) => {
|
|
|
4220
4287
|
const { assert: assert$45 } = require_lib$4();
|
|
4221
4288
|
const Common$19 = require_common$3();
|
|
4222
4289
|
const Ref$9 = require_ref$2();
|
|
4223
|
-
const internals$
|
|
4224
|
-
exports.Ids = internals$
|
|
4290
|
+
const internals$19 = {};
|
|
4291
|
+
exports.Ids = internals$19.Ids = class {
|
|
4225
4292
|
constructor() {
|
|
4226
4293
|
this._byId = new Map();
|
|
4227
4294
|
this._byKey = new Map();
|
|
4228
4295
|
this._schemaChain = false;
|
|
4229
4296
|
}
|
|
4230
4297
|
clone() {
|
|
4231
|
-
const clone$20 = new internals$
|
|
4298
|
+
const clone$20 = new internals$19.Ids();
|
|
4232
4299
|
clone$20._byId = new Map(this._byId);
|
|
4233
4300
|
clone$20._byKey = new Map(this._byKey);
|
|
4234
4301
|
clone$20._schemaChain = this._schemaChain;
|
|
@@ -4256,7 +4323,7 @@ var require_modify = __commonJSMin((exports) => {
|
|
|
4256
4323
|
assert$45(Common$19.isSchema(adjusted.schema), "adjuster function failed to return a joi schema type");
|
|
4257
4324
|
for (const node of chain) adjusted = {
|
|
4258
4325
|
id: node.id,
|
|
4259
|
-
schema: internals$
|
|
4326
|
+
schema: internals$19.fork(node.schema, adjusted.id, adjusted.schema)
|
|
4260
4327
|
};
|
|
4261
4328
|
return adjusted.schema;
|
|
4262
4329
|
}
|
|
@@ -4317,7 +4384,7 @@ var require_modify = __commonJSMin((exports) => {
|
|
|
4317
4384
|
return this._byId.get(id) || this._byKey.get(id);
|
|
4318
4385
|
}
|
|
4319
4386
|
};
|
|
4320
|
-
internals$
|
|
4387
|
+
internals$19.fork = function(schema$2, id, replacement) {
|
|
4321
4388
|
const each$5 = (item, { key }) => {
|
|
4322
4389
|
if (id === (item._flags.id || key)) return replacement;
|
|
4323
4390
|
};
|
|
@@ -4331,7 +4398,7 @@ var require_modify = __commonJSMin((exports) => {
|
|
|
4331
4398
|
let obj;
|
|
4332
4399
|
for (const name$3 in schema$2._flags) {
|
|
4333
4400
|
if (name$3[0] === "_") continue;
|
|
4334
|
-
const result = internals$
|
|
4401
|
+
const result = internals$19.scan(schema$2._flags[name$3], {
|
|
4335
4402
|
source: "flags",
|
|
4336
4403
|
name: name$3
|
|
4337
4404
|
}, options);
|
|
@@ -4342,7 +4409,7 @@ var require_modify = __commonJSMin((exports) => {
|
|
|
4342
4409
|
}
|
|
4343
4410
|
for (let i$1 = 0; i$1 < schema$2._rules.length; ++i$1) {
|
|
4344
4411
|
const rule = schema$2._rules[i$1];
|
|
4345
|
-
const result = internals$
|
|
4412
|
+
const result = internals$19.scan(rule.args, {
|
|
4346
4413
|
source: "rules",
|
|
4347
4414
|
name: rule.name
|
|
4348
4415
|
}, options);
|
|
@@ -4357,7 +4424,7 @@ var require_modify = __commonJSMin((exports) => {
|
|
|
4357
4424
|
}
|
|
4358
4425
|
for (const name$3 in schema$2.$_terms) {
|
|
4359
4426
|
if (name$3[0] === "_") continue;
|
|
4360
|
-
const result = internals$
|
|
4427
|
+
const result = internals$19.scan(schema$2.$_terms[name$3], {
|
|
4361
4428
|
source: "terms",
|
|
4362
4429
|
name: name$3
|
|
4363
4430
|
}, options);
|
|
@@ -4368,14 +4435,14 @@ var require_modify = __commonJSMin((exports) => {
|
|
|
4368
4435
|
}
|
|
4369
4436
|
return obj;
|
|
4370
4437
|
};
|
|
4371
|
-
internals$
|
|
4438
|
+
internals$19.scan = function(item, source, options, _path, _key) {
|
|
4372
4439
|
const path = _path || [];
|
|
4373
4440
|
if (item === null || typeof item !== "object") return;
|
|
4374
4441
|
let clone$20;
|
|
4375
4442
|
if (Array.isArray(item)) {
|
|
4376
4443
|
for (let i$1 = 0; i$1 < item.length; ++i$1) {
|
|
4377
4444
|
const key = source.source === "terms" && source.name === "keys" && item[i$1].key;
|
|
4378
|
-
const result = internals$
|
|
4445
|
+
const result = internals$19.scan(item[i$1], source, options, [i$1, ...path], key);
|
|
4379
4446
|
if (result !== void 0) {
|
|
4380
4447
|
clone$20 = clone$20 || item.slice();
|
|
4381
4448
|
clone$20[i$1] = result;
|
|
@@ -4394,7 +4461,7 @@ var require_modify = __commonJSMin((exports) => {
|
|
|
4394
4461
|
}
|
|
4395
4462
|
for (const key in item) {
|
|
4396
4463
|
if (key[0] === "_") continue;
|
|
4397
|
-
const result = internals$
|
|
4464
|
+
const result = internals$19.scan(item[key], source, options, [key, ...path], _key);
|
|
4398
4465
|
if (result !== void 0) {
|
|
4399
4466
|
clone$20 = clone$20 || Object.assign({}, item);
|
|
4400
4467
|
clone$20[key] = result;
|
|
@@ -4406,8 +4473,8 @@ var require_modify = __commonJSMin((exports) => {
|
|
|
4406
4473
|
var require_state$1 = __commonJSMin((exports, module) => {
|
|
4407
4474
|
const { clone: clone$12, reach: reach$2 } = require_lib$4();
|
|
4408
4475
|
const Common$18 = require_common$3();
|
|
4409
|
-
const internals$
|
|
4410
|
-
module.exports = internals$
|
|
4476
|
+
const internals$18 = { value: Symbol("value") };
|
|
4477
|
+
module.exports = internals$18.State = class {
|
|
4411
4478
|
constructor(path, ancestors, state) {
|
|
4412
4479
|
this.path = path;
|
|
4413
4480
|
this.ancestors = ancestors;
|
|
@@ -4416,18 +4483,18 @@ var require_state$1 = __commonJSMin((exports, module) => {
|
|
|
4416
4483
|
this.debug = null;
|
|
4417
4484
|
}
|
|
4418
4485
|
localize(path, ancestors = null, schema$2 = null) {
|
|
4419
|
-
const state = new internals$
|
|
4420
|
-
if (schema$2 && state.schemas) state.schemas = [internals$
|
|
4486
|
+
const state = new internals$18.State(path, ancestors, this);
|
|
4487
|
+
if (schema$2 && state.schemas) state.schemas = [internals$18.schemas(schema$2), ...state.schemas];
|
|
4421
4488
|
return state;
|
|
4422
4489
|
}
|
|
4423
4490
|
nest(schema$2, debug$13) {
|
|
4424
|
-
const state = new internals$
|
|
4425
|
-
state.schemas = state.schemas && [internals$
|
|
4491
|
+
const state = new internals$18.State(this.path, this.ancestors, this);
|
|
4492
|
+
state.schemas = state.schemas && [internals$18.schemas(schema$2), ...state.schemas];
|
|
4426
4493
|
state.debug = debug$13;
|
|
4427
4494
|
return state;
|
|
4428
4495
|
}
|
|
4429
4496
|
shadow(value, reason) {
|
|
4430
|
-
this.mainstay.shadow = this.mainstay.shadow || new internals$
|
|
4497
|
+
this.mainstay.shadow = this.mainstay.shadow || new internals$18.Shadow();
|
|
4431
4498
|
this.mainstay.shadow.set(this.path, value, reason);
|
|
4432
4499
|
}
|
|
4433
4500
|
snapshot() {
|
|
@@ -4449,11 +4516,11 @@ var require_state$1 = __commonJSMin((exports, module) => {
|
|
|
4449
4516
|
this.mainstay.commit();
|
|
4450
4517
|
}
|
|
4451
4518
|
};
|
|
4452
|
-
internals$
|
|
4519
|
+
internals$18.schemas = function(schema$2) {
|
|
4453
4520
|
if (Common$18.isSchema(schema$2)) return { schema: schema$2 };
|
|
4454
4521
|
return schema$2;
|
|
4455
4522
|
};
|
|
4456
|
-
internals$
|
|
4523
|
+
internals$18.Shadow = class {
|
|
4457
4524
|
constructor() {
|
|
4458
4525
|
this._values = null;
|
|
4459
4526
|
}
|
|
@@ -4471,11 +4538,11 @@ var require_state$1 = __commonJSMin((exports, module) => {
|
|
|
4471
4538
|
}
|
|
4472
4539
|
node = next;
|
|
4473
4540
|
}
|
|
4474
|
-
node[internals$
|
|
4541
|
+
node[internals$18.value] = value;
|
|
4475
4542
|
}
|
|
4476
4543
|
get(path) {
|
|
4477
4544
|
const node = this.node(path);
|
|
4478
|
-
if (node) return node[internals$
|
|
4545
|
+
if (node) return node[internals$18.value];
|
|
4479
4546
|
}
|
|
4480
4547
|
node(path) {
|
|
4481
4548
|
if (!this._values) return;
|
|
@@ -4499,7 +4566,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4499
4566
|
const Common$17 = require_common$3();
|
|
4500
4567
|
const Errors$6 = require_errors$2();
|
|
4501
4568
|
const State = require_state$1();
|
|
4502
|
-
const internals$
|
|
4569
|
+
const internals$17 = { result: Symbol("result") };
|
|
4503
4570
|
exports.entry = function(value, schema$2, prefs) {
|
|
4504
4571
|
let settings = Common$17.defaults;
|
|
4505
4572
|
if (prefs) {
|
|
@@ -4507,7 +4574,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4507
4574
|
assert$44(prefs.artifacts === void 0, "Cannot override artifacts preference in synchronous validation");
|
|
4508
4575
|
settings = Common$17.preferences(Common$17.defaults, prefs);
|
|
4509
4576
|
}
|
|
4510
|
-
const result = internals$
|
|
4577
|
+
const result = internals$17.entry(value, schema$2, settings);
|
|
4511
4578
|
assert$44(!result.mainstay.externals.length, "Schema with external rules must use validateAsync()");
|
|
4512
4579
|
const outcome = { value: result.value };
|
|
4513
4580
|
if (result.error) outcome.error = result.error;
|
|
@@ -4519,7 +4586,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4519
4586
|
exports.entryAsync = async function(value, schema$2, prefs) {
|
|
4520
4587
|
let settings = Common$17.defaults;
|
|
4521
4588
|
if (prefs) settings = Common$17.preferences(Common$17.defaults, prefs);
|
|
4522
|
-
const result = internals$
|
|
4589
|
+
const result = internals$17.entry(value, schema$2, settings);
|
|
4523
4590
|
const mainstay = result.mainstay;
|
|
4524
4591
|
if (result.error) {
|
|
4525
4592
|
if (mainstay.debug) result.error.debug = mainstay.debug;
|
|
@@ -4555,7 +4622,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4555
4622
|
prefs,
|
|
4556
4623
|
original,
|
|
4557
4624
|
error: createError,
|
|
4558
|
-
errorsArray: internals$
|
|
4625
|
+
errorsArray: internals$17.errorsArray,
|
|
4559
4626
|
warn: (code$1, local) => mainstay.warnings.push((linked || external.schema).$_createError(code$1, node, local, external.state, settings)),
|
|
4560
4627
|
message: (messages$3, local) => (linked || external.schema).$_createError("external", node, local, external.state, settings, { messages: messages$3 })
|
|
4561
4628
|
});
|
|
@@ -4602,7 +4669,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4602
4669
|
if (schema$2.isAsync()) return exports.entryAsync(value, schema$2);
|
|
4603
4670
|
return exports.entry(value, schema$2);
|
|
4604
4671
|
};
|
|
4605
|
-
internals$
|
|
4672
|
+
internals$17.Mainstay = class {
|
|
4606
4673
|
constructor(tracer, debug$13, links) {
|
|
4607
4674
|
this.externals = [];
|
|
4608
4675
|
this.warnings = [];
|
|
@@ -4628,11 +4695,11 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4628
4695
|
this._snapshots.pop();
|
|
4629
4696
|
}
|
|
4630
4697
|
};
|
|
4631
|
-
internals$
|
|
4632
|
-
const { tracer, cleanup } = internals$
|
|
4698
|
+
internals$17.entry = function(value, schema$2, prefs) {
|
|
4699
|
+
const { tracer, cleanup } = internals$17.tracer(schema$2, prefs);
|
|
4633
4700
|
const debug$13 = prefs.debug ? [] : null;
|
|
4634
4701
|
const links = schema$2._ids._schemaChain ? new Map() : null;
|
|
4635
|
-
const mainstay = new internals$
|
|
4702
|
+
const mainstay = new internals$17.Mainstay(tracer, debug$13, links);
|
|
4636
4703
|
const schemas = schema$2._ids._schemaChain ? [{ schema: schema$2 }] : null;
|
|
4637
4704
|
const state = new State([], [], {
|
|
4638
4705
|
mainstay,
|
|
@@ -4647,7 +4714,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4647
4714
|
mainstay
|
|
4648
4715
|
};
|
|
4649
4716
|
};
|
|
4650
|
-
internals$
|
|
4717
|
+
internals$17.tracer = function(schema$2, prefs) {
|
|
4651
4718
|
if (schema$2.$_root._tracer) return { tracer: schema$2.$_root._tracer._register(schema$2) };
|
|
4652
4719
|
if (prefs.debug) {
|
|
4653
4720
|
assert$44(schema$2.$_root.trace, "Debug mode not supported");
|
|
@@ -4656,11 +4723,11 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4656
4723
|
cleanup: true
|
|
4657
4724
|
};
|
|
4658
4725
|
}
|
|
4659
|
-
return { tracer: internals$
|
|
4726
|
+
return { tracer: internals$17.ignore };
|
|
4660
4727
|
};
|
|
4661
4728
|
exports.validate = function(value, schema$2, state, prefs, overrides = {}) {
|
|
4662
4729
|
if (schema$2.$_terms.whens) schema$2 = schema$2._generate(value, state, prefs).schema;
|
|
4663
|
-
if (schema$2._preferences) prefs = internals$
|
|
4730
|
+
if (schema$2._preferences) prefs = internals$17.prefs(schema$2, prefs);
|
|
4664
4731
|
if (schema$2._cache && prefs.cache) {
|
|
4665
4732
|
const result = schema$2._cache.get(value);
|
|
4666
4733
|
state.mainstay.tracer.debug(state, "validate", "cached", !!result);
|
|
@@ -4673,7 +4740,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4673
4740
|
schema: schema$2,
|
|
4674
4741
|
state,
|
|
4675
4742
|
error: createError,
|
|
4676
|
-
errorsArray: internals$
|
|
4743
|
+
errorsArray: internals$17.errorsArray,
|
|
4677
4744
|
warn: (code$1, local, localState) => state.mainstay.warnings.push(createError(code$1, local, localState)),
|
|
4678
4745
|
message: (messages$3, local) => schema$2.$_createError("custom", value, local, state, prefs, { messages: messages$3 })
|
|
4679
4746
|
};
|
|
@@ -4683,7 +4750,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4683
4750
|
const prepared = def.prepare(value, helpers$8);
|
|
4684
4751
|
if (prepared) {
|
|
4685
4752
|
state.mainstay.tracer.value(state, "prepare", value, prepared.value);
|
|
4686
|
-
if (prepared.errors) return internals$
|
|
4753
|
+
if (prepared.errors) return internals$17.finalize(prepared.value, [].concat(prepared.errors), helpers$8);
|
|
4687
4754
|
value = prepared.value;
|
|
4688
4755
|
}
|
|
4689
4756
|
}
|
|
@@ -4691,25 +4758,25 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4691
4758
|
const coerced = def.coerce.method(value, helpers$8);
|
|
4692
4759
|
if (coerced) {
|
|
4693
4760
|
state.mainstay.tracer.value(state, "coerced", value, coerced.value);
|
|
4694
|
-
if (coerced.errors) return internals$
|
|
4761
|
+
if (coerced.errors) return internals$17.finalize(coerced.value, [].concat(coerced.errors), helpers$8);
|
|
4695
4762
|
value = coerced.value;
|
|
4696
4763
|
}
|
|
4697
4764
|
}
|
|
4698
4765
|
const empty$2 = schema$2._flags.empty;
|
|
4699
|
-
if (empty$2 && empty$2.$_match(internals$
|
|
4766
|
+
if (empty$2 && empty$2.$_match(internals$17.trim(value, schema$2), state.nest(empty$2), Common$17.defaults)) {
|
|
4700
4767
|
state.mainstay.tracer.value(state, "empty", value, void 0);
|
|
4701
4768
|
value = void 0;
|
|
4702
4769
|
}
|
|
4703
4770
|
const presence = overrides.presence || schema$2._flags.presence || (schema$2._flags._endedSwitch ? null : prefs.presence);
|
|
4704
4771
|
if (value === void 0) {
|
|
4705
|
-
if (presence === "forbidden") return internals$
|
|
4706
|
-
if (presence === "required") return internals$
|
|
4772
|
+
if (presence === "forbidden") return internals$17.finalize(value, null, helpers$8);
|
|
4773
|
+
if (presence === "required") return internals$17.finalize(value, [schema$2.$_createError("any.required", value, null, state, prefs)], helpers$8);
|
|
4707
4774
|
if (presence === "optional") {
|
|
4708
|
-
if (schema$2._flags.default !== Common$17.symbols.deepDefault) return internals$
|
|
4775
|
+
if (schema$2._flags.default !== Common$17.symbols.deepDefault) return internals$17.finalize(value, null, helpers$8);
|
|
4709
4776
|
state.mainstay.tracer.value(state, "default", value, {});
|
|
4710
4777
|
value = {};
|
|
4711
4778
|
}
|
|
4712
|
-
} else if (presence === "forbidden") return internals$
|
|
4779
|
+
} else if (presence === "forbidden") return internals$17.finalize(value, [schema$2.$_createError("any.unknown", value, null, state, prefs)], helpers$8);
|
|
4713
4780
|
const errors = [];
|
|
4714
4781
|
if (schema$2._valids) {
|
|
4715
4782
|
const match$2 = schema$2._valids.get(value, state, prefs, schema$2._flags.insensitive);
|
|
@@ -4719,11 +4786,11 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4719
4786
|
value = match$2.value;
|
|
4720
4787
|
}
|
|
4721
4788
|
state.mainstay.tracer.filter(schema$2, state, "valid", match$2);
|
|
4722
|
-
return internals$
|
|
4789
|
+
return internals$17.finalize(value, null, helpers$8);
|
|
4723
4790
|
}
|
|
4724
4791
|
if (schema$2._flags.only) {
|
|
4725
4792
|
const report = schema$2.$_createError("any.only", value, { valids: schema$2._valids.values({ display: true }) }, state, prefs);
|
|
4726
|
-
if (prefs.abortEarly) return internals$
|
|
4793
|
+
if (prefs.abortEarly) return internals$17.finalize(value, [report], helpers$8);
|
|
4727
4794
|
errors.push(report);
|
|
4728
4795
|
}
|
|
4729
4796
|
}
|
|
@@ -4732,7 +4799,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4732
4799
|
if (match$2) {
|
|
4733
4800
|
state.mainstay.tracer.filter(schema$2, state, "invalid", match$2);
|
|
4734
4801
|
const report = schema$2.$_createError("any.invalid", value, { invalids: schema$2._invalids.values({ display: true }) }, state, prefs);
|
|
4735
|
-
if (prefs.abortEarly) return internals$
|
|
4802
|
+
if (prefs.abortEarly) return internals$17.finalize(value, [report], helpers$8);
|
|
4736
4803
|
errors.push(report);
|
|
4737
4804
|
}
|
|
4738
4805
|
}
|
|
@@ -4744,19 +4811,19 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4744
4811
|
if (base$3.errors) {
|
|
4745
4812
|
if (!Array.isArray(base$3.errors)) {
|
|
4746
4813
|
errors.push(base$3.errors);
|
|
4747
|
-
return internals$
|
|
4814
|
+
return internals$17.finalize(value, errors, helpers$8);
|
|
4748
4815
|
}
|
|
4749
4816
|
if (base$3.errors.length) {
|
|
4750
4817
|
errors.push(...base$3.errors);
|
|
4751
|
-
return internals$
|
|
4818
|
+
return internals$17.finalize(value, errors, helpers$8);
|
|
4752
4819
|
}
|
|
4753
4820
|
}
|
|
4754
4821
|
}
|
|
4755
4822
|
}
|
|
4756
|
-
if (!schema$2._rules.length) return internals$
|
|
4757
|
-
return internals$
|
|
4823
|
+
if (!schema$2._rules.length) return internals$17.finalize(value, errors, helpers$8);
|
|
4824
|
+
return internals$17.rules(value, errors, helpers$8);
|
|
4758
4825
|
};
|
|
4759
|
-
internals$
|
|
4826
|
+
internals$17.rules = function(value, errors, helpers$8) {
|
|
4760
4827
|
const { schema: schema$2, state, prefs } = helpers$8;
|
|
4761
4828
|
for (const rule of schema$2._rules) {
|
|
4762
4829
|
const definition = schema$2._definition.rules[rule.method];
|
|
@@ -4785,14 +4852,14 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4785
4852
|
}
|
|
4786
4853
|
}
|
|
4787
4854
|
ret = ret || definition.validate(value, helpers$8, args$1, rule);
|
|
4788
|
-
const result = internals$
|
|
4855
|
+
const result = internals$17.rule(ret, rule);
|
|
4789
4856
|
if (result.errors) {
|
|
4790
4857
|
state.mainstay.tracer.log(schema$2, state, "rule", rule.name, "error");
|
|
4791
4858
|
if (rule.warn) {
|
|
4792
4859
|
state.mainstay.warnings.push(...result.errors);
|
|
4793
4860
|
continue;
|
|
4794
4861
|
}
|
|
4795
|
-
if (prefs.abortEarly) return internals$
|
|
4862
|
+
if (prefs.abortEarly) return internals$17.finalize(value, result.errors, helpers$8);
|
|
4796
4863
|
errors.push(...result.errors);
|
|
4797
4864
|
} else {
|
|
4798
4865
|
state.mainstay.tracer.log(schema$2, state, "rule", rule.name, "pass");
|
|
@@ -4800,18 +4867,18 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4800
4867
|
value = result.value;
|
|
4801
4868
|
}
|
|
4802
4869
|
}
|
|
4803
|
-
return internals$
|
|
4870
|
+
return internals$17.finalize(value, errors, helpers$8);
|
|
4804
4871
|
};
|
|
4805
|
-
internals$
|
|
4872
|
+
internals$17.rule = function(ret, rule) {
|
|
4806
4873
|
if (ret instanceof Errors$6.Report) {
|
|
4807
|
-
internals$
|
|
4874
|
+
internals$17.error(ret, rule);
|
|
4808
4875
|
return {
|
|
4809
4876
|
errors: [ret],
|
|
4810
4877
|
value: null
|
|
4811
4878
|
};
|
|
4812
4879
|
}
|
|
4813
4880
|
if (Array.isArray(ret) && ret[Common$17.symbols.errors]) {
|
|
4814
|
-
ret.forEach((report) => internals$
|
|
4881
|
+
ret.forEach((report) => internals$17.error(report, rule));
|
|
4815
4882
|
return {
|
|
4816
4883
|
errors: ret,
|
|
4817
4884
|
value: null
|
|
@@ -4822,15 +4889,15 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4822
4889
|
value: ret
|
|
4823
4890
|
};
|
|
4824
4891
|
};
|
|
4825
|
-
internals$
|
|
4892
|
+
internals$17.error = function(report, rule) {
|
|
4826
4893
|
if (rule.message) report._setTemplate(rule.message);
|
|
4827
4894
|
return report;
|
|
4828
4895
|
};
|
|
4829
|
-
internals$
|
|
4896
|
+
internals$17.finalize = function(value, errors, helpers$8) {
|
|
4830
4897
|
errors = errors || [];
|
|
4831
4898
|
const { schema: schema$2, state, prefs } = helpers$8;
|
|
4832
4899
|
if (errors.length) {
|
|
4833
|
-
const failover = internals$
|
|
4900
|
+
const failover = internals$17.default("failover", void 0, errors, helpers$8);
|
|
4834
4901
|
if (failover !== void 0) {
|
|
4835
4902
|
state.mainstay.tracer.value(state, "failover", value, failover);
|
|
4836
4903
|
value = failover;
|
|
@@ -4843,7 +4910,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4843
4910
|
for (const error of errors) assert$44(error instanceof Error || error instanceof Errors$6.Report, "error() must return an Error object");
|
|
4844
4911
|
} else errors = [schema$2._flags.error];
|
|
4845
4912
|
if (value === void 0) {
|
|
4846
|
-
const defaulted = internals$
|
|
4913
|
+
const defaulted = internals$17.default("default", value, errors, helpers$8);
|
|
4847
4914
|
state.mainstay.tracer.value(state, "default", value, defaulted);
|
|
4848
4915
|
value = defaulted;
|
|
4849
4916
|
}
|
|
@@ -4878,14 +4945,14 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4878
4945
|
}
|
|
4879
4946
|
return result;
|
|
4880
4947
|
};
|
|
4881
|
-
internals$
|
|
4948
|
+
internals$17.prefs = function(schema$2, prefs) {
|
|
4882
4949
|
const isDefaultOptions = prefs === Common$17.defaults;
|
|
4883
4950
|
if (isDefaultOptions && schema$2._preferences[Common$17.symbols.prefs]) return schema$2._preferences[Common$17.symbols.prefs];
|
|
4884
4951
|
prefs = Common$17.preferences(prefs, schema$2._preferences);
|
|
4885
4952
|
if (isDefaultOptions) schema$2._preferences[Common$17.symbols.prefs] = prefs;
|
|
4886
4953
|
return prefs;
|
|
4887
4954
|
};
|
|
4888
|
-
internals$
|
|
4955
|
+
internals$17.default = function(flag, value, errors, helpers$8) {
|
|
4889
4956
|
const { schema: schema$2, state, prefs } = helpers$8;
|
|
4890
4957
|
const source = schema$2._flags[flag];
|
|
4891
4958
|
if (prefs.noDefaults || source === void 0) return value;
|
|
@@ -4905,13 +4972,13 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4905
4972
|
if (Common$17.isResolvable(source)) return source.resolve(value, state, prefs);
|
|
4906
4973
|
return clone$11(source);
|
|
4907
4974
|
};
|
|
4908
|
-
internals$
|
|
4975
|
+
internals$17.trim = function(value, schema$2) {
|
|
4909
4976
|
if (typeof value !== "string") return value;
|
|
4910
4977
|
const trim = schema$2.$_getRule("trim");
|
|
4911
4978
|
if (!trim || !trim.args.enabled) return value;
|
|
4912
4979
|
return value.trim();
|
|
4913
4980
|
};
|
|
4914
|
-
internals$
|
|
4981
|
+
internals$17.ignore = {
|
|
4915
4982
|
active: false,
|
|
4916
4983
|
debug: ignore,
|
|
4917
4984
|
entry: ignore,
|
|
@@ -4920,7 +4987,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4920
4987
|
resolve: ignore,
|
|
4921
4988
|
value: ignore
|
|
4922
4989
|
};
|
|
4923
|
-
internals$
|
|
4990
|
+
internals$17.errorsArray = function() {
|
|
4924
4991
|
const errors = [];
|
|
4925
4992
|
errors[Common$17.symbols.errors] = true;
|
|
4926
4993
|
return errors;
|
|
@@ -4929,12 +4996,12 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4929
4996
|
var require_values$1 = __commonJSMin((exports, module) => {
|
|
4930
4997
|
const { assert: assert$43, deepEqual: deepEqual$2 } = require_lib$4();
|
|
4931
4998
|
const Common$16 = require_common$3();
|
|
4932
|
-
const internals$
|
|
4933
|
-
module.exports = internals$
|
|
4999
|
+
const internals$16 = {};
|
|
5000
|
+
module.exports = internals$16.Values = class {
|
|
4934
5001
|
constructor(values$3, refs) {
|
|
4935
5002
|
this._values = new Set(values$3);
|
|
4936
5003
|
this._refs = new Set(refs);
|
|
4937
|
-
this._lowercase = internals$
|
|
5004
|
+
this._lowercase = internals$16.lowercases(values$3);
|
|
4938
5005
|
this._override = false;
|
|
4939
5006
|
}
|
|
4940
5007
|
get length() {
|
|
@@ -4954,7 +5021,7 @@ var require_values$1 = __commonJSMin((exports, module) => {
|
|
|
4954
5021
|
}
|
|
4955
5022
|
}
|
|
4956
5023
|
static merge(target, source, remove$1) {
|
|
4957
|
-
target = target || new internals$
|
|
5024
|
+
target = target || new internals$16.Values();
|
|
4958
5025
|
if (source) {
|
|
4959
5026
|
if (source._override) return source.clone();
|
|
4960
5027
|
for (const item of [...source._values, ...source._refs]) target.add(item);
|
|
@@ -5015,13 +5082,13 @@ var require_values$1 = __commonJSMin((exports, module) => {
|
|
|
5015
5082
|
return Array.from([...this._values, ...this._refs]);
|
|
5016
5083
|
}
|
|
5017
5084
|
clone() {
|
|
5018
|
-
const set = new internals$
|
|
5085
|
+
const set = new internals$16.Values(this._values, this._refs);
|
|
5019
5086
|
set._override = this._override;
|
|
5020
5087
|
return set;
|
|
5021
5088
|
}
|
|
5022
5089
|
concat(source) {
|
|
5023
5090
|
assert$43(!source._override, "Cannot concat override set of values");
|
|
5024
|
-
const set = new internals$
|
|
5091
|
+
const set = new internals$16.Values([...this._values, ...source._values], [...this._refs, ...source._refs]);
|
|
5025
5092
|
set._override = this._override;
|
|
5026
5093
|
return set;
|
|
5027
5094
|
}
|
|
@@ -5033,9 +5100,9 @@ var require_values$1 = __commonJSMin((exports, module) => {
|
|
|
5033
5100
|
return normalized;
|
|
5034
5101
|
}
|
|
5035
5102
|
};
|
|
5036
|
-
internals$
|
|
5037
|
-
internals$
|
|
5038
|
-
internals$
|
|
5103
|
+
internals$16.Values.prototype[Common$16.symbols.values] = true;
|
|
5104
|
+
internals$16.Values.prototype.slice = internals$16.Values.prototype.clone;
|
|
5105
|
+
internals$16.lowercases = function(from$2) {
|
|
5039
5106
|
const map$8 = new Map();
|
|
5040
5107
|
if (from$2) {
|
|
5041
5108
|
for (const value of from$2) if (typeof value === "string") map$8.set(value.toLowerCase(), value);
|
|
@@ -5047,18 +5114,18 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5047
5114
|
const { assert: assert$42, clone: clone$10, deepEqual: deepEqual$1, merge: merge$2 } = require_lib$4();
|
|
5048
5115
|
const Cache$2 = require_cache();
|
|
5049
5116
|
const Common$15 = require_common$3();
|
|
5050
|
-
const Compile$
|
|
5117
|
+
const Compile$6 = require_compile$1();
|
|
5051
5118
|
const Errors$5 = require_errors$2();
|
|
5052
5119
|
const Extend$2 = require_extend$1();
|
|
5053
5120
|
const Manifest$2 = require_manifest();
|
|
5054
|
-
const Messages$
|
|
5121
|
+
const Messages$4 = require_messages();
|
|
5055
5122
|
const Modify = require_modify();
|
|
5056
5123
|
const Ref$8 = require_ref$2();
|
|
5057
5124
|
const Trace$2 = require_trace();
|
|
5058
5125
|
const Validator = require_validator();
|
|
5059
5126
|
const Values$1 = require_values$1();
|
|
5060
|
-
const internals$
|
|
5061
|
-
internals$
|
|
5127
|
+
const internals$15 = {};
|
|
5128
|
+
internals$15.Base = class {
|
|
5062
5129
|
constructor(type) {
|
|
5063
5130
|
this.type = type;
|
|
5064
5131
|
this.$_root = null;
|
|
@@ -5244,7 +5311,7 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5244
5311
|
when(condition, options) {
|
|
5245
5312
|
const obj = this.clone();
|
|
5246
5313
|
if (!obj.$_terms.whens) obj.$_terms.whens = [];
|
|
5247
|
-
const when = Compile$
|
|
5314
|
+
const when = Compile$6.when(obj, condition, options);
|
|
5248
5315
|
if (!["any", "link"].includes(obj.type)) {
|
|
5249
5316
|
const conditions = when.is ? [when] : when.switch;
|
|
5250
5317
|
for (const item of conditions) {
|
|
@@ -5452,11 +5519,11 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5452
5519
|
return obj;
|
|
5453
5520
|
}
|
|
5454
5521
|
$_compile(schema$2, options) {
|
|
5455
|
-
return Compile$
|
|
5522
|
+
return Compile$6.schema(this.$_root, schema$2, options);
|
|
5456
5523
|
}
|
|
5457
5524
|
$_createError(code$1, value, local, state, prefs, options = {}) {
|
|
5458
5525
|
const flags = options.flags !== false ? this._flags : {};
|
|
5459
|
-
const messages$3 = options.messages ? Messages$
|
|
5526
|
+
const messages$3 = options.messages ? Messages$4.merge(this._definition.messages, options.messages) : this._definition.messages;
|
|
5460
5527
|
return new Errors$5.Report(code$1, value, local, flags, messages$3, state, prefs);
|
|
5461
5528
|
}
|
|
5462
5529
|
$_getFlag(name$3) {
|
|
@@ -5706,225 +5773,25 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5706
5773
|
};
|
|
5707
5774
|
}
|
|
5708
5775
|
};
|
|
5709
|
-
internals$
|
|
5776
|
+
internals$15.Base.prototype[Common$15.symbols.any] = {
|
|
5710
5777
|
version: Common$15.version,
|
|
5711
|
-
compile: Compile$
|
|
5778
|
+
compile: Compile$6.compile,
|
|
5712
5779
|
root: "$_root"
|
|
5713
5780
|
};
|
|
5714
|
-
internals$
|
|
5715
|
-
internals$
|
|
5716
|
-
internals$
|
|
5717
|
-
internals$
|
|
5718
|
-
internals$
|
|
5719
|
-
internals$
|
|
5720
|
-
internals$
|
|
5721
|
-
internals$
|
|
5722
|
-
module.exports = new internals$
|
|
5723
|
-
});
|
|
5724
|
-
var package_exports$1 = {};
|
|
5725
|
-
__export(package_exports$1, {
|
|
5726
|
-
browser: () => browser,
|
|
5727
|
-
default: () => package_default$1,
|
|
5728
|
-
dependencies: () => dependencies$1,
|
|
5729
|
-
description: () => description$1,
|
|
5730
|
-
devDependencies: () => devDependencies$1,
|
|
5731
|
-
engines: () => engines,
|
|
5732
|
-
files: () => files$1,
|
|
5733
|
-
keywords: () => keywords$1,
|
|
5734
|
-
license: () => license$1,
|
|
5735
|
-
main: () => main$1,
|
|
5736
|
-
name: () => name$2,
|
|
5737
|
-
repository: () => repository$1,
|
|
5738
|
-
scripts: () => scripts$1,
|
|
5739
|
-
types: () => types,
|
|
5740
|
-
version: () => version$3
|
|
5741
|
-
});
|
|
5742
|
-
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;
|
|
5743
|
-
var init_package$1 = __esmMin(() => {
|
|
5744
|
-
name$2 = "joi";
|
|
5745
|
-
description$1 = "Object schema validation";
|
|
5746
|
-
version$3 = "18.0.2";
|
|
5747
|
-
repository$1 = {
|
|
5748
|
-
"url": "git://github.com/hapijs/joi",
|
|
5749
|
-
"type": "git"
|
|
5750
|
-
};
|
|
5751
|
-
engines = { "node": ">= 20" };
|
|
5752
|
-
main$1 = "lib/index.js";
|
|
5753
|
-
types = "lib/index.d.ts";
|
|
5754
|
-
browser = "dist/joi-browser.min.js";
|
|
5755
|
-
files$1 = ["lib/**/*", "dist/*"];
|
|
5756
|
-
keywords$1 = ["schema", "validation"];
|
|
5757
|
-
dependencies$1 = {
|
|
5758
|
-
"@hapi/address": "^5.1.1",
|
|
5759
|
-
"@hapi/formula": "^3.0.2",
|
|
5760
|
-
"@hapi/hoek": "^11.0.7",
|
|
5761
|
-
"@hapi/pinpoint": "^2.0.1",
|
|
5762
|
-
"@hapi/tlds": "^1.1.1",
|
|
5763
|
-
"@hapi/topo": "^6.0.2",
|
|
5764
|
-
"@standard-schema/spec": "^1.0.0"
|
|
5765
|
-
};
|
|
5766
|
-
devDependencies$1 = {
|
|
5767
|
-
"@hapi/bourne": "^3.0.0",
|
|
5768
|
-
"@hapi/code": "^9.0.3",
|
|
5769
|
-
"@hapi/eslint-plugin": "^7.0.0",
|
|
5770
|
-
"@hapi/joi-legacy-test": "npm:@hapi/joi@15.x.x",
|
|
5771
|
-
"@hapi/lab": "^26.0.0",
|
|
5772
|
-
"@types/node": "^20.17.47",
|
|
5773
|
-
"typescript": "^5.8.3"
|
|
5774
|
-
};
|
|
5775
|
-
scripts$1 = {
|
|
5776
|
-
"prepublishOnly": "cd browser && npm install && npm run build",
|
|
5777
|
-
"test": "lab -t 100 -a @hapi/code -L -Y",
|
|
5778
|
-
"test-cov-html": "lab -r html -o coverage.html -a @hapi/code"
|
|
5779
|
-
};
|
|
5780
|
-
license$1 = "BSD-3-Clause";
|
|
5781
|
-
package_default$1 = {
|
|
5782
|
-
name: name$2,
|
|
5783
|
-
description: description$1,
|
|
5784
|
-
version: version$3,
|
|
5785
|
-
repository: repository$1,
|
|
5786
|
-
engines,
|
|
5787
|
-
main: main$1,
|
|
5788
|
-
types,
|
|
5789
|
-
browser,
|
|
5790
|
-
files: files$1,
|
|
5791
|
-
keywords: keywords$1,
|
|
5792
|
-
dependencies: dependencies$1,
|
|
5793
|
-
devDependencies: devDependencies$1,
|
|
5794
|
-
scripts: scripts$1,
|
|
5795
|
-
license: license$1
|
|
5796
|
-
};
|
|
5797
|
-
});
|
|
5798
|
-
var require_common$4 = __commonJSMin((exports) => {
|
|
5799
|
-
const { assert: Assert$1, AssertError: AssertError$1 } = require_lib$4();
|
|
5800
|
-
const Pkg = (init_package$1(), __toCommonJS(package_exports$1).default);
|
|
5801
|
-
let Messages$4;
|
|
5802
|
-
let Schemas$3;
|
|
5803
|
-
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)?)?)?)?$/ };
|
|
5804
|
-
exports.version = Pkg.version;
|
|
5805
|
-
exports.defaults = {
|
|
5806
|
-
abortEarly: true,
|
|
5807
|
-
allowUnknown: false,
|
|
5808
|
-
artifacts: false,
|
|
5809
|
-
cache: true,
|
|
5810
|
-
context: null,
|
|
5811
|
-
convert: true,
|
|
5812
|
-
dateFormat: "iso",
|
|
5813
|
-
errors: {
|
|
5814
|
-
escapeHtml: false,
|
|
5815
|
-
label: "path",
|
|
5816
|
-
language: null,
|
|
5817
|
-
render: true,
|
|
5818
|
-
stack: false,
|
|
5819
|
-
wrap: {
|
|
5820
|
-
label: "\"",
|
|
5821
|
-
array: "[]"
|
|
5822
|
-
}
|
|
5823
|
-
},
|
|
5824
|
-
externals: true,
|
|
5825
|
-
messages: {},
|
|
5826
|
-
nonEnumerables: false,
|
|
5827
|
-
noDefaults: false,
|
|
5828
|
-
presence: "optional",
|
|
5829
|
-
skipFunctions: false,
|
|
5830
|
-
stripUnknown: false,
|
|
5831
|
-
warnings: false
|
|
5832
|
-
};
|
|
5833
|
-
exports.symbols = {
|
|
5834
|
-
any: Symbol.for("@hapi/joi/schema"),
|
|
5835
|
-
arraySingle: Symbol("arraySingle"),
|
|
5836
|
-
deepDefault: Symbol("deepDefault"),
|
|
5837
|
-
errors: Symbol("errors"),
|
|
5838
|
-
literal: Symbol("literal"),
|
|
5839
|
-
override: Symbol("override"),
|
|
5840
|
-
parent: Symbol("parent"),
|
|
5841
|
-
prefs: Symbol("prefs"),
|
|
5842
|
-
ref: Symbol("ref"),
|
|
5843
|
-
template: Symbol("template"),
|
|
5844
|
-
values: Symbol("values")
|
|
5845
|
-
};
|
|
5846
|
-
exports.assertOptions = function(options, keys$10, name$3 = "Options") {
|
|
5847
|
-
Assert$1(options && typeof options === "object" && !Array.isArray(options), "Options must be of type object");
|
|
5848
|
-
const unknownKeys = Object.keys(options).filter((k) => !keys$10.includes(k));
|
|
5849
|
-
Assert$1(unknownKeys.length === 0, `${name$3} contain unknown keys: ${unknownKeys}`);
|
|
5850
|
-
};
|
|
5851
|
-
exports.checkPreferences = function(prefs) {
|
|
5852
|
-
Schemas$3 = Schemas$3 || require_schemas();
|
|
5853
|
-
const result = Schemas$3.preferences.validate(prefs);
|
|
5854
|
-
if (result.error) throw new AssertError$1([result.error.details[0].message]);
|
|
5855
|
-
};
|
|
5856
|
-
exports.compare = function(a$2, b, operator$1) {
|
|
5857
|
-
switch (operator$1) {
|
|
5858
|
-
case "=": return a$2 === b;
|
|
5859
|
-
case ">": return a$2 > b;
|
|
5860
|
-
case "<": return a$2 < b;
|
|
5861
|
-
case ">=": return a$2 >= b;
|
|
5862
|
-
case "<=": return a$2 <= b;
|
|
5863
|
-
}
|
|
5864
|
-
};
|
|
5865
|
-
exports.default = function(value, defaultValue) {
|
|
5866
|
-
return value === void 0 ? defaultValue : value;
|
|
5867
|
-
};
|
|
5868
|
-
exports.isIsoDate = function(date) {
|
|
5869
|
-
return internals$15.isoDate.test(date);
|
|
5870
|
-
};
|
|
5871
|
-
exports.isNumber = function(value) {
|
|
5872
|
-
return typeof value === "number" && !isNaN(value);
|
|
5873
|
-
};
|
|
5874
|
-
exports.isResolvable = function(obj) {
|
|
5875
|
-
if (!obj) return false;
|
|
5876
|
-
return obj[exports.symbols.ref] || obj[exports.symbols.template];
|
|
5877
|
-
};
|
|
5878
|
-
exports.isSchema = function(schema$2, options = {}) {
|
|
5879
|
-
const any = schema$2 && schema$2[exports.symbols.any];
|
|
5880
|
-
if (!any) return false;
|
|
5881
|
-
Assert$1(options.legacy || any.version === exports.version, "Cannot mix different versions of joi schemas");
|
|
5882
|
-
return true;
|
|
5883
|
-
};
|
|
5884
|
-
exports.isValues = function(obj) {
|
|
5885
|
-
return obj[exports.symbols.values];
|
|
5886
|
-
};
|
|
5887
|
-
exports.limit = function(value) {
|
|
5888
|
-
return Number.isSafeInteger(value) && value >= 0;
|
|
5889
|
-
};
|
|
5890
|
-
exports.preferences = function(target, source) {
|
|
5891
|
-
Messages$4 = Messages$4 || require_messages();
|
|
5892
|
-
target = target || {};
|
|
5893
|
-
source = source || {};
|
|
5894
|
-
const merged = Object.assign({}, target, source);
|
|
5895
|
-
if (source.errors && target.errors) {
|
|
5896
|
-
merged.errors = Object.assign({}, target.errors, source.errors);
|
|
5897
|
-
merged.errors.wrap = Object.assign({}, target.errors.wrap, source.errors.wrap);
|
|
5898
|
-
}
|
|
5899
|
-
if (source.messages) merged.messages = Messages$4.compile(source.messages, target.messages);
|
|
5900
|
-
delete merged[exports.symbols.prefs];
|
|
5901
|
-
return merged;
|
|
5902
|
-
};
|
|
5903
|
-
exports.tryWithPath = function(fn$1, key, options = {}) {
|
|
5904
|
-
try {
|
|
5905
|
-
return fn$1();
|
|
5906
|
-
} catch (err) {
|
|
5907
|
-
if (err.path !== void 0) err.path = key + "." + err.path;
|
|
5908
|
-
else err.path = key;
|
|
5909
|
-
if (options.append) err.message = `${err.message} (${err.path})`;
|
|
5910
|
-
throw err;
|
|
5911
|
-
}
|
|
5912
|
-
};
|
|
5913
|
-
exports.validateArg = function(value, label, { assert: assert$55, message }) {
|
|
5914
|
-
if (exports.isSchema(assert$55)) {
|
|
5915
|
-
const result = assert$55.validate(value);
|
|
5916
|
-
if (!result.error) return;
|
|
5917
|
-
return result.error.message;
|
|
5918
|
-
} else if (!assert$55(value)) return label ? `${label} ${message}` : message;
|
|
5919
|
-
};
|
|
5920
|
-
exports.verifyFlat = function(args$1, method$1) {
|
|
5921
|
-
for (const arg of args$1) Assert$1(!Array.isArray(arg), "Method no longer accepts array arguments:", method$1);
|
|
5922
|
-
};
|
|
5781
|
+
internals$15.Base.prototype.isImmutable = true;
|
|
5782
|
+
internals$15.Base.prototype.deny = internals$15.Base.prototype.invalid;
|
|
5783
|
+
internals$15.Base.prototype.disallow = internals$15.Base.prototype.invalid;
|
|
5784
|
+
internals$15.Base.prototype.equal = internals$15.Base.prototype.valid;
|
|
5785
|
+
internals$15.Base.prototype.exist = internals$15.Base.prototype.required;
|
|
5786
|
+
internals$15.Base.prototype.not = internals$15.Base.prototype.invalid;
|
|
5787
|
+
internals$15.Base.prototype.options = internals$15.Base.prototype.prefs;
|
|
5788
|
+
internals$15.Base.prototype.preferences = internals$15.Base.prototype.prefs;
|
|
5789
|
+
module.exports = new internals$15.Base();
|
|
5923
5790
|
});
|
|
5924
5791
|
var require_any = __commonJSMin((exports, module) => {
|
|
5925
5792
|
const { assert: assert$41 } = require_lib$4();
|
|
5926
5793
|
const Base$3 = require_base$2();
|
|
5927
|
-
const Common$14 = require_common$
|
|
5794
|
+
const Common$14 = require_common$3();
|
|
5928
5795
|
const Messages$3 = require_messages();
|
|
5929
5796
|
module.exports = Base$3.extend({
|
|
5930
5797
|
type: "any",
|
|
@@ -6232,8 +6099,8 @@ var require_compile = __commonJSMin((exports) => {
|
|
|
6232
6099
|
var require_alternatives = __commonJSMin((exports, module) => {
|
|
6233
6100
|
const { assert: assert$39, merge: merge$1 } = require_lib$4();
|
|
6234
6101
|
const Any$9 = require_any();
|
|
6235
|
-
const Common$12 = require_common$
|
|
6236
|
-
const Compile$
|
|
6102
|
+
const Common$12 = require_common$3();
|
|
6103
|
+
const Compile$5 = require_compile();
|
|
6237
6104
|
const Errors$4 = require_errors$2();
|
|
6238
6105
|
const Ref$6 = require_ref$2();
|
|
6239
6106
|
const internals$13 = {};
|
|
@@ -6321,7 +6188,7 @@ var require_alternatives = __commonJSMin((exports, module) => {
|
|
|
6321
6188
|
assert$39(!this._flags.match, "Cannot combine match mode", this._flags.match, "with conditional rule");
|
|
6322
6189
|
assert$39(options.break === void 0, "Cannot use break option with alternatives conditional");
|
|
6323
6190
|
const obj = this.clone();
|
|
6324
|
-
const match$2 = Compile$
|
|
6191
|
+
const match$2 = Compile$5.when(obj, condition, options);
|
|
6325
6192
|
const conditions = match$2.is ? [match$2] : match$2.switch;
|
|
6326
6193
|
for (const item of conditions) if (item.then && item.otherwise) {
|
|
6327
6194
|
obj.$_setFlag("_endedSwitch", true, { clone: false });
|
|
@@ -6442,8 +6309,8 @@ var require_alternatives = __commonJSMin((exports, module) => {
|
|
|
6442
6309
|
var require_array = __commonJSMin((exports, module) => {
|
|
6443
6310
|
const { assert: assert$38, deepEqual, reach } = require_lib$4();
|
|
6444
6311
|
const Any$8 = require_any();
|
|
6445
|
-
const Common$11 = require_common$
|
|
6446
|
-
const Compile$
|
|
6312
|
+
const Common$11 = require_common$3();
|
|
6313
|
+
const Compile$4 = require_compile();
|
|
6447
6314
|
const internals$12 = {};
|
|
6448
6315
|
module.exports = Any$8.extend({
|
|
6449
6316
|
type: "array",
|
|
@@ -6744,7 +6611,7 @@ var require_array = __commonJSMin((exports, module) => {
|
|
|
6744
6611
|
Common$11.assertOptions(options, ["by", "order"]);
|
|
6745
6612
|
const settings = { order: options.order || "ascending" };
|
|
6746
6613
|
if (options.by) {
|
|
6747
|
-
settings.by = Compile$
|
|
6614
|
+
settings.by = Compile$4.ref(options.by, { ancestor: 0 });
|
|
6748
6615
|
assert$38(!settings.by.ancestor, "Cannot sort by ancestor");
|
|
6749
6616
|
}
|
|
6750
6617
|
return this.$_addRule({
|
|
@@ -6971,7 +6838,7 @@ var require_array = __commonJSMin((exports, module) => {
|
|
|
6971
6838
|
var require_boolean = __commonJSMin((exports, module) => {
|
|
6972
6839
|
const { assert: assert$37 } = require_lib$4();
|
|
6973
6840
|
const Any$7 = require_any();
|
|
6974
|
-
const Common$10 = require_common$
|
|
6841
|
+
const Common$10 = require_common$3();
|
|
6975
6842
|
const Values = require_values$1();
|
|
6976
6843
|
const internals$11 = {};
|
|
6977
6844
|
internals$11.isBool = function(value) {
|
|
@@ -7058,7 +6925,7 @@ var require_boolean = __commonJSMin((exports, module) => {
|
|
|
7058
6925
|
var require_date = __commonJSMin((exports, module) => {
|
|
7059
6926
|
const { assert: assert$36 } = require_lib$4();
|
|
7060
6927
|
const Any$6 = require_any();
|
|
7061
|
-
const Common$9 = require_common$
|
|
6928
|
+
const Common$9 = require_common$3();
|
|
7062
6929
|
const Template$4 = require_template();
|
|
7063
6930
|
const internals$10 = {};
|
|
7064
6931
|
internals$10.isDate = function(value) {
|
|
@@ -7329,8 +7196,8 @@ var require_keys$1 = __commonJSMin((exports, module) => {
|
|
|
7329
7196
|
const { applyToDefaults, assert: assert$34, clone: Clone } = require_lib$4();
|
|
7330
7197
|
const Topo = require_lib$1();
|
|
7331
7198
|
const Any$5 = require_any();
|
|
7332
|
-
const Common$8 = require_common$
|
|
7333
|
-
const Compile$
|
|
7199
|
+
const Common$8 = require_common$3();
|
|
7200
|
+
const Compile$3 = require_compile();
|
|
7334
7201
|
const Errors$3 = require_errors$2();
|
|
7335
7202
|
const Ref$5 = require_ref$2();
|
|
7336
7203
|
const Template$3 = require_template();
|
|
@@ -7426,7 +7293,7 @@ var require_keys$1 = __commonJSMin((exports, module) => {
|
|
|
7426
7293
|
} },
|
|
7427
7294
|
assert: {
|
|
7428
7295
|
method(subject, schema$2, message) {
|
|
7429
|
-
if (!Template$3.isTemplate(subject)) subject = Compile$
|
|
7296
|
+
if (!Template$3.isTemplate(subject)) subject = Compile$3.ref(subject);
|
|
7430
7297
|
assert$34(message === void 0 || typeof message === "string", "Message must be a string");
|
|
7431
7298
|
schema$2 = this.$_compile(schema$2, { appendPath: true });
|
|
7432
7299
|
const obj = this.$_addRule({
|
|
@@ -7721,13 +7588,13 @@ var require_keys$1 = __commonJSMin((exports, module) => {
|
|
|
7721
7588
|
const paths = [];
|
|
7722
7589
|
for (const peer of peers) {
|
|
7723
7590
|
assert$34(typeof peer === "string", rel, "peers must be strings");
|
|
7724
|
-
paths.push(Compile$
|
|
7591
|
+
paths.push(Compile$3.ref(peer, {
|
|
7725
7592
|
separator,
|
|
7726
7593
|
ancestor: 0,
|
|
7727
7594
|
prefix: false
|
|
7728
7595
|
}));
|
|
7729
7596
|
}
|
|
7730
|
-
if (key !== null) key = Compile$
|
|
7597
|
+
if (key !== null) key = Compile$3.ref(key, {
|
|
7731
7598
|
separator,
|
|
7732
7599
|
ancestor: 0,
|
|
7733
7600
|
prefix: false
|
|
@@ -8083,8 +7950,8 @@ var require_function = __commonJSMin((exports, module) => {
|
|
|
8083
7950
|
var require_link = __commonJSMin((exports, module) => {
|
|
8084
7951
|
const { assert: assert$32 } = require_lib$4();
|
|
8085
7952
|
const Any$4 = require_any();
|
|
8086
|
-
const Common$7 = require_common$
|
|
8087
|
-
const Compile$
|
|
7953
|
+
const Common$7 = require_common$3();
|
|
7954
|
+
const Compile$2 = require_compile();
|
|
8088
7955
|
const Errors$2 = require_errors$2();
|
|
8089
7956
|
const internals$7 = {};
|
|
8090
7957
|
module.exports = Any$4.extend({
|
|
@@ -8110,7 +7977,7 @@ var require_link = __commonJSMin((exports, module) => {
|
|
|
8110
7977
|
rules: {
|
|
8111
7978
|
ref: { method(ref) {
|
|
8112
7979
|
assert$32(!this.$_terms.link, "Cannot reinitialize schema");
|
|
8113
|
-
ref = Compile$
|
|
7980
|
+
ref = Compile$2.ref(ref);
|
|
8114
7981
|
assert$32(ref.type === "value" || ref.type === "local", "Invalid reference type:", ref.type);
|
|
8115
7982
|
assert$32(ref.type === "local" || ref.ancestor === "root" || ref.ancestor > 0, "Link cannot reference itself");
|
|
8116
7983
|
const obj = this.clone();
|
|
@@ -8187,7 +8054,7 @@ var require_link = __commonJSMin((exports, module) => {
|
|
|
8187
8054
|
var require_number = __commonJSMin((exports, module) => {
|
|
8188
8055
|
const { assert: assert$31 } = require_lib$4();
|
|
8189
8056
|
const Any$3 = require_any();
|
|
8190
|
-
const Common$6 = require_common$
|
|
8057
|
+
const Common$6 = require_common$3();
|
|
8191
8058
|
const internals$6 = {
|
|
8192
8059
|
numberRx: /^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,
|
|
8193
8060
|
precisionRx: /(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,
|
|
@@ -12474,7 +12341,7 @@ var require_string$1 = __commonJSMin((exports, module) => {
|
|
|
12474
12341
|
const { isDomainValid, isEmailValid, ipRegex, uriRegex } = (init_esm(), __toCommonJS(esm_exports));
|
|
12475
12342
|
const Tlds = require_commonjs();
|
|
12476
12343
|
const Any$2 = require_any();
|
|
12477
|
-
const Common$5 = require_common$
|
|
12344
|
+
const Common$5 = require_common$3();
|
|
12478
12345
|
const internals$5 = {
|
|
12479
12346
|
tlds: Tlds.tlds instanceof Set ? { tlds: {
|
|
12480
12347
|
allow: Tlds.tlds,
|
|
@@ -13191,7 +13058,7 @@ var require_binary = __commonJSMin((exports, module) => {
|
|
|
13191
13058
|
init_dist$1();
|
|
13192
13059
|
const { assert: assert$26 } = require_lib$4();
|
|
13193
13060
|
const Any = require_any();
|
|
13194
|
-
const Common$4 = require_common$
|
|
13061
|
+
const Common$4 = require_common$3();
|
|
13195
13062
|
module.exports = Any.extend({
|
|
13196
13063
|
type: "binary",
|
|
13197
13064
|
coerce: {
|
|
@@ -13272,7 +13139,7 @@ var require_lib = __commonJSMin((exports, module) => {
|
|
|
13272
13139
|
const { assert: assert$25, clone: clone$9 } = require_lib$4();
|
|
13273
13140
|
const Cache$1 = require_cache();
|
|
13274
13141
|
const Common$3 = require_common$3();
|
|
13275
|
-
const Compile = (
|
|
13142
|
+
const Compile$1 = require_compile$1();
|
|
13276
13143
|
const Errors$1 = require_errors$2();
|
|
13277
13144
|
const Extend$1 = require_extend$1();
|
|
13278
13145
|
const Manifest$1 = require_manifest();
|
|
@@ -13359,7 +13226,7 @@ var require_lib = __commonJSMin((exports, module) => {
|
|
|
13359
13226
|
Common$3.checkPreferences(prefs);
|
|
13360
13227
|
},
|
|
13361
13228
|
compile(schema$2, options) {
|
|
13362
|
-
return Compile.compile(this, schema$2, options);
|
|
13229
|
+
return Compile$1.compile(this, schema$2, options);
|
|
13363
13230
|
},
|
|
13364
13231
|
defaults(modifier) {
|
|
13365
13232
|
assert$25(typeof modifier === "function", "modifier must be a function");
|
|
@@ -13661,16 +13528,14 @@ var require_schemas = __commonJSMin((exports) => {
|
|
|
13661
13528
|
link: internals$2.desc.ref
|
|
13662
13529
|
}).pattern(/^[a-z]\w*$/, Joi$1.any());
|
|
13663
13530
|
});
|
|
13664
|
-
var require_common$3 = __commonJSMin((exports
|
|
13665
|
-
|
|
13666
|
-
|
|
13667
|
-
init_lib();
|
|
13531
|
+
var require_common$3 = __commonJSMin((exports) => {
|
|
13532
|
+
const { assert: Assert, AssertError } = require_lib$4();
|
|
13533
|
+
const Pkg = (init_package$1(), __toCommonJS(package_exports$1).default);
|
|
13668
13534
|
let Messages$2;
|
|
13669
13535
|
let Schemas$1;
|
|
13670
13536
|
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)?)?)?)?$/ };
|
|
13671
|
-
|
|
13672
|
-
exports
|
|
13673
|
-
exports$1.defaults = {
|
|
13537
|
+
exports.version = Pkg.version;
|
|
13538
|
+
exports.defaults = {
|
|
13674
13539
|
abortEarly: true,
|
|
13675
13540
|
allowUnknown: false,
|
|
13676
13541
|
artifacts: false,
|
|
@@ -13698,7 +13563,7 @@ var require_common$3 = __commonJSMin((exports, module) => {
|
|
|
13698
13563
|
stripUnknown: false,
|
|
13699
13564
|
warnings: false
|
|
13700
13565
|
};
|
|
13701
|
-
exports
|
|
13566
|
+
exports.symbols = {
|
|
13702
13567
|
any: Symbol.for("@hapi/joi/schema"),
|
|
13703
13568
|
arraySingle: Symbol("arraySingle"),
|
|
13704
13569
|
deepDefault: Symbol("deepDefault"),
|
|
@@ -13709,20 +13574,19 @@ var require_common$3 = __commonJSMin((exports, module) => {
|
|
|
13709
13574
|
prefs: Symbol("prefs"),
|
|
13710
13575
|
ref: Symbol("ref"),
|
|
13711
13576
|
template: Symbol("template"),
|
|
13712
|
-
values: Symbol("values")
|
|
13713
|
-
override: Symbol("override")
|
|
13577
|
+
values: Symbol("values")
|
|
13714
13578
|
};
|
|
13715
|
-
exports
|
|
13716
|
-
(
|
|
13579
|
+
exports.assertOptions = function(options, keys$10, name$3 = "Options") {
|
|
13580
|
+
Assert(options && typeof options === "object" && !Array.isArray(options), "Options must be of type object");
|
|
13717
13581
|
const unknownKeys = Object.keys(options).filter((k) => !keys$10.includes(k));
|
|
13718
|
-
(
|
|
13582
|
+
Assert(unknownKeys.length === 0, `${name$3} contain unknown keys: ${unknownKeys}`);
|
|
13719
13583
|
};
|
|
13720
|
-
exports
|
|
13721
|
-
Schemas$1 = Schemas$1 ||
|
|
13584
|
+
exports.checkPreferences = function(prefs) {
|
|
13585
|
+
Schemas$1 = Schemas$1 || require_schemas();
|
|
13722
13586
|
const result = Schemas$1.preferences.validate(prefs);
|
|
13723
|
-
if (result.error) throw new
|
|
13587
|
+
if (result.error) throw new AssertError([result.error.details[0].message]);
|
|
13724
13588
|
};
|
|
13725
|
-
exports
|
|
13589
|
+
exports.compare = function(a$2, b, operator$1) {
|
|
13726
13590
|
switch (operator$1) {
|
|
13727
13591
|
case "=": return a$2 === b;
|
|
13728
13592
|
case ">": return a$2 > b;
|
|
@@ -13731,32 +13595,32 @@ var require_common$3 = __commonJSMin((exports, module) => {
|
|
|
13731
13595
|
case "<=": return a$2 <= b;
|
|
13732
13596
|
}
|
|
13733
13597
|
};
|
|
13734
|
-
exports
|
|
13598
|
+
exports.default = function(value, defaultValue) {
|
|
13735
13599
|
return value === void 0 ? defaultValue : value;
|
|
13736
13600
|
};
|
|
13737
|
-
exports
|
|
13601
|
+
exports.isIsoDate = function(date) {
|
|
13738
13602
|
return internals$1.isoDate.test(date);
|
|
13739
13603
|
};
|
|
13740
|
-
exports
|
|
13604
|
+
exports.isNumber = function(value) {
|
|
13741
13605
|
return typeof value === "number" && !isNaN(value);
|
|
13742
13606
|
};
|
|
13743
|
-
exports
|
|
13607
|
+
exports.isResolvable = function(obj) {
|
|
13744
13608
|
if (!obj) return false;
|
|
13745
|
-
return obj[exports
|
|
13609
|
+
return obj[exports.symbols.ref] || obj[exports.symbols.template];
|
|
13746
13610
|
};
|
|
13747
|
-
exports
|
|
13748
|
-
const any = schema$2 && schema$2[exports
|
|
13611
|
+
exports.isSchema = function(schema$2, options = {}) {
|
|
13612
|
+
const any = schema$2 && schema$2[exports.symbols.any];
|
|
13749
13613
|
if (!any) return false;
|
|
13750
13614
|
return true;
|
|
13751
13615
|
};
|
|
13752
|
-
exports
|
|
13753
|
-
return obj[exports
|
|
13616
|
+
exports.isValues = function(obj) {
|
|
13617
|
+
return obj[exports.symbols.values];
|
|
13754
13618
|
};
|
|
13755
|
-
exports
|
|
13619
|
+
exports.limit = function(value) {
|
|
13756
13620
|
return Number.isSafeInteger(value) && value >= 0;
|
|
13757
13621
|
};
|
|
13758
|
-
exports
|
|
13759
|
-
Messages$2 = Messages$2 ||
|
|
13622
|
+
exports.preferences = function(target, source) {
|
|
13623
|
+
Messages$2 = Messages$2 || require_messages();
|
|
13760
13624
|
target = target || {};
|
|
13761
13625
|
source = source || {};
|
|
13762
13626
|
const merged = Object.assign({}, target, source);
|
|
@@ -13765,10 +13629,10 @@ var require_common$3 = __commonJSMin((exports, module) => {
|
|
|
13765
13629
|
merged.errors.wrap = Object.assign({}, target.errors.wrap, source.errors.wrap);
|
|
13766
13630
|
}
|
|
13767
13631
|
if (source.messages) merged.messages = Messages$2.compile(source.messages, target.messages);
|
|
13768
|
-
delete merged[exports
|
|
13632
|
+
delete merged[exports.symbols.prefs];
|
|
13769
13633
|
return merged;
|
|
13770
13634
|
};
|
|
13771
|
-
exports
|
|
13635
|
+
exports.tryWithPath = function(fn$1, key, options = {}) {
|
|
13772
13636
|
try {
|
|
13773
13637
|
return fn$1();
|
|
13774
13638
|
} catch (err) {
|
|
@@ -13778,17 +13642,16 @@ var require_common$3 = __commonJSMin((exports, module) => {
|
|
|
13778
13642
|
throw err;
|
|
13779
13643
|
}
|
|
13780
13644
|
};
|
|
13781
|
-
exports
|
|
13782
|
-
if (exports
|
|
13645
|
+
exports.validateArg = function(value, label, { assert: assert$55, message }) {
|
|
13646
|
+
if (exports.isSchema(assert$55)) {
|
|
13783
13647
|
const result = assert$55.validate(value);
|
|
13784
13648
|
if (!result.error) return;
|
|
13785
13649
|
return result.error.message;
|
|
13786
13650
|
} else if (!assert$55(value)) return label ? `${label} ${message}` : message;
|
|
13787
13651
|
};
|
|
13788
|
-
exports
|
|
13789
|
-
for (const arg of args$1) (
|
|
13652
|
+
exports.verifyFlat = function(args$1, method$1) {
|
|
13653
|
+
for (const arg of args$1) Assert(!Array.isArray(arg), "Method no longer accepts array arguments:", method$1);
|
|
13790
13654
|
};
|
|
13791
|
-
module.exports = exports$1;
|
|
13792
13655
|
});
|
|
13793
13656
|
var require_annotate = __commonJSMin((exports) => {
|
|
13794
13657
|
const { clone: clone$8 } = require_lib$4();
|
|
@@ -33085,7 +32948,7 @@ var init_package = __esmMin(() => {
|
|
|
33085
32948
|
};
|
|
33086
32949
|
});
|
|
33087
32950
|
var require_bn$1 = __commonJSMin((exports, module) => {
|
|
33088
|
-
(function(module$1, exports$
|
|
32951
|
+
(function(module$1, exports$1) {
|
|
33089
32952
|
"use strict";
|
|
33090
32953
|
function assert$55(val, msg) {
|
|
33091
32954
|
if (!val) throw new Error(msg || "Assertion failed");
|
|
@@ -33112,7 +32975,7 @@ var require_bn$1 = __commonJSMin((exports, module) => {
|
|
|
33112
32975
|
}
|
|
33113
32976
|
}
|
|
33114
32977
|
if (typeof module$1 === "object") module$1.exports = BN$14;
|
|
33115
|
-
else exports$
|
|
32978
|
+
else exports$1.BN = BN$14;
|
|
33116
32979
|
BN$14.BN = BN$14;
|
|
33117
32980
|
BN$14.wordSize = 26;
|
|
33118
32981
|
var Buffer$27;
|
|
@@ -41225,7 +41088,7 @@ var require_withPublic = __commonJSMin((exports, module) => {
|
|
|
41225
41088
|
module.exports = withPublic$2;
|
|
41226
41089
|
});
|
|
41227
41090
|
var require_bn = __commonJSMin((exports, module) => {
|
|
41228
|
-
(function(module$1, exports$
|
|
41091
|
+
(function(module$1, exports$1) {
|
|
41229
41092
|
"use strict";
|
|
41230
41093
|
function assert$55(val, msg) {
|
|
41231
41094
|
if (!val) throw new Error(msg || "Assertion failed");
|
|
@@ -41252,7 +41115,7 @@ var require_bn = __commonJSMin((exports, module) => {
|
|
|
41252
41115
|
}
|
|
41253
41116
|
}
|
|
41254
41117
|
if (typeof module$1 === "object") module$1.exports = BN$14;
|
|
41255
|
-
else exports$
|
|
41118
|
+
else exports$1.BN = BN$14;
|
|
41256
41119
|
BN$14.BN = BN$14;
|
|
41257
41120
|
BN$14.wordSize = 26;
|
|
41258
41121
|
var Buffer$27;
|
|
@@ -45971,7 +45834,7 @@ var import_trace = __toESM(require_trace());
|
|
|
45971
45834
|
var import_common = __toESM(require_common$3());
|
|
45972
45835
|
var import_errors = __toESM(require_errors$2());
|
|
45973
45836
|
var import_extend = __toESM(require_extend$1());
|
|
45974
|
-
|
|
45837
|
+
var import_compile = __toESM(require_compile$1());
|
|
45975
45838
|
var import_schemas = __toESM(require_schemas());
|
|
45976
45839
|
var import_manifest = __toESM(require_manifest());
|
|
45977
45840
|
var import_template = __toESM(require_template());
|
|
@@ -46011,7 +45874,7 @@ var RootFactory = class RootFactory {
|
|
|
46011
45874
|
static assertValue(value, schema$2, annotate, args$1) {
|
|
46012
45875
|
const message = args$1[0] instanceof Error || typeof args$1[0] === "string" ? args$1[0] : null;
|
|
46013
45876
|
const options = message !== null ? args$1[1] : args$1[0];
|
|
46014
|
-
const result = schema$2.validate(value, import_common.
|
|
45877
|
+
const result = schema$2.validate(value, import_common.preferences({ errors: { stack: true } }, options || {}));
|
|
46015
45878
|
let error = result.error;
|
|
46016
45879
|
if (!error) return result.value;
|
|
46017
45880
|
if (message instanceof Error) throw message;
|
|
@@ -46040,7 +45903,7 @@ var RootFactory = class RootFactory {
|
|
|
46040
45903
|
static getMethods() {
|
|
46041
45904
|
return {
|
|
46042
45905
|
ValidationError: import_errors.ValidationError,
|
|
46043
|
-
version: import_common.
|
|
45906
|
+
version: import_common.version,
|
|
46044
45907
|
cache: import_cache.provider,
|
|
46045
45908
|
assert(value, schema$2, ...args$1) {
|
|
46046
45909
|
RootFactory.assertValue(value, schema$2, true, args$1);
|
|
@@ -46049,21 +45912,21 @@ var RootFactory = class RootFactory {
|
|
|
46049
45912
|
return RootFactory.assertValue(value, schema$2, false, args$1);
|
|
46050
45913
|
},
|
|
46051
45914
|
build(desc$1) {
|
|
46052
|
-
(0, import_assert.default)(typeof import_manifest.
|
|
46053
|
-
return import_manifest.
|
|
45915
|
+
(0, import_assert.default)(typeof import_manifest.build === "function", "Manifest functionality disabled");
|
|
45916
|
+
return import_manifest.build(this, desc$1);
|
|
46054
45917
|
},
|
|
46055
45918
|
checkPreferences(prefs) {
|
|
46056
|
-
import_common.
|
|
45919
|
+
import_common.checkPreferences(prefs);
|
|
46057
45920
|
},
|
|
46058
45921
|
compile(schema$2, options) {
|
|
46059
|
-
return
|
|
45922
|
+
return import_compile.compile(this, schema$2, options);
|
|
46060
45923
|
},
|
|
46061
45924
|
defaults(modifier) {
|
|
46062
45925
|
(0, import_assert.default)(typeof modifier === "function", "modifier must be a function");
|
|
46063
45926
|
const joi$1 = { ...this };
|
|
46064
45927
|
for (const type of joi$1._types) {
|
|
46065
45928
|
const schema$2 = modifier(joi$1[type]());
|
|
46066
|
-
(0, import_assert.default)(import_common.
|
|
45929
|
+
(0, import_assert.default)(import_common.isSchema(schema$2), "modifier must return a valid schema object");
|
|
46067
45930
|
joi$1[type] = function(...args$1) {
|
|
46068
45931
|
return RootFactory.generate(this, schema$2, args$1);
|
|
46069
45932
|
};
|
|
@@ -46074,7 +45937,7 @@ var RootFactory = class RootFactory {
|
|
|
46074
45937
|
return new import_template.default(...args$1);
|
|
46075
45938
|
},
|
|
46076
45939
|
extend(...extensions) {
|
|
46077
|
-
import_common.
|
|
45940
|
+
import_common.verifyFlat(extensions, "extend");
|
|
46078
45941
|
(0, import_assert.default)(extensions.length, "You need to provide at least one extension");
|
|
46079
45942
|
this.assert(extensions, import_schemas.extensions);
|
|
46080
45943
|
const joi$1 = { ...this };
|
|
@@ -46098,11 +45961,11 @@ var RootFactory = class RootFactory {
|
|
|
46098
45961
|
isError: import_errors.ValidationError.isError,
|
|
46099
45962
|
isExpression: import_template.default.isTemplate,
|
|
46100
45963
|
isRef: import_ref.isRef,
|
|
46101
|
-
isSchema: import_common.
|
|
45964
|
+
isSchema: import_common.isSchema,
|
|
46102
45965
|
in(...args$1) {
|
|
46103
45966
|
return import_ref.in(...args$1);
|
|
46104
45967
|
},
|
|
46105
|
-
override: import_common.
|
|
45968
|
+
override: import_common.symbols.override,
|
|
46106
45969
|
ref(...args$1) {
|
|
46107
45970
|
return import_ref.create(...args$1);
|
|
46108
45971
|
},
|
|
@@ -52499,7 +52362,7 @@ var libphonenumber = { exports: {} };
|
|
|
52499
52362
|
libphonenumber.exports;
|
|
52500
52363
|
var hasRequiredLibphonenumber;
|
|
52501
52364
|
function requireLibphonenumber() {
|
|
52502
|
-
return hasRequiredLibphonenumber || (hasRequiredLibphonenumber = 1, function(module$1, exports$1
|
|
52365
|
+
return hasRequiredLibphonenumber || (hasRequiredLibphonenumber = 1, function(module$1, exports$1) {
|
|
52503
52366
|
(function(t$7) {
|
|
52504
52367
|
module$1.exports = t$7();
|
|
52505
52368
|
})(function() {
|
|
@@ -52526,7 +52389,7 @@ function requireLibphonenumber() {
|
|
|
52526
52389
|
return u;
|
|
52527
52390
|
}
|
|
52528
52391
|
return t$7;
|
|
52529
|
-
}()({ 1: [function(require$1, module$2, exports$1$
|
|
52392
|
+
}()({ 1: [function(require$1, module$2, exports$1$1) {
|
|
52530
52393
|
(function(global) {
|
|
52531
52394
|
(function() {
|
|
52532
52395
|
var $jscomp = $jscomp || {};
|
|
@@ -134333,7 +134196,7 @@ function requireLibphonenumber() {
|
|
|
134333
134196
|
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);
|
|
134334
134197
|
}
|
|
134335
134198
|
return this.possibleFormats_.length == 1 && (this.ableToFormat_ = !1), this.currentFormattingPattern_ = "", this.accruedInput_.toString();
|
|
134336
|
-
}, Object.defineProperty(exports$1$
|
|
134199
|
+
}, Object.defineProperty(exports$1$1, "__esModule", { value: !0 }), exports$1$1.default = i18n$1.phonenumbers, module$2.exports = exports$1$1.default;
|
|
134337
134200
|
}).call(this);
|
|
134338
134201
|
}).call(this, typeof commonjsGlobal < "u" ? commonjsGlobal : typeof self < "u" ? self : typeof window < "u" ? window : {});
|
|
134339
134202
|
}, {}] }, {}, [1])(1);
|
|
@@ -145086,7 +144949,7 @@ const encode = (schema$2, options = {}) => {
|
|
|
145086
144949
|
});
|
|
145087
144950
|
const flattened = flattie(sanitized);
|
|
145088
144951
|
return (0, __nhtio_encoder.encode)({
|
|
145089
|
-
version: "2.20251203.
|
|
144952
|
+
version: "2.20251203.1",
|
|
145090
144953
|
schema: flattened
|
|
145091
144954
|
});
|
|
145092
144955
|
};
|
|
@@ -145103,9 +144966,9 @@ const decode = (base64, options = {}) => {
|
|
|
145103
144966
|
}
|
|
145104
144967
|
if (!isPlainObject(decoded) || !("version" in decoded) || !("schema" in decoded) || typeof decoded.version !== "string" || !isPlainObject(decoded.schema)) throw new TypeError("Not a valid encoded schema");
|
|
145105
144968
|
const { version: schemaVersion, schema: schema$2 } = decoded;
|
|
145106
|
-
if (import_semver.valid("2.20251203.
|
|
144969
|
+
if (import_semver.valid("2.20251203.1")) {
|
|
145107
144970
|
if (!import_semver.valid(import_semver.coerce(schemaVersion))) throw new TypeError(`Invalid schema version: ${schemaVersion}`);
|
|
145108
|
-
if (import_semver.gt(import_semver.coerce(schemaVersion), "2.20251203.
|
|
144971
|
+
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`);
|
|
145109
144972
|
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`);
|
|
145110
144973
|
}
|
|
145111
144974
|
const description$2 = nestie(schema$2);
|
|
@@ -146572,7 +146435,7 @@ const ValidationError = import_lib$2.default.ValidationError;
|
|
|
146572
146435
|
init_esm();
|
|
146573
146436
|
var import_lib = __toESM(require_lib$3());
|
|
146574
146437
|
var import_lib$1 = __toESM(require_lib$2());
|
|
146575
|
-
const version = "2.20251203.
|
|
146438
|
+
const version = "2.20251203.1";
|
|
146576
146439
|
exports.ValidationError = ValidationError;
|
|
146577
146440
|
Object.defineProperty(exports, "address", {
|
|
146578
146441
|
enumerable: true,
|