@nhtio/validation 0.1.0-master-cb87a6f9 → 0.1.0-master-fe5983b7
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 +265 -260
- package/index.cjs.map +1 -1
- package/index.d.ts +0 -1
- package/index.mjs +265 -260
- package/index.mjs.map +1 -1
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -3764,16 +3764,65 @@ var require_extend$1 = __commonJSMin((exports) => {
|
|
|
3764
3764
|
};
|
|
3765
3765
|
};
|
|
3766
3766
|
});
|
|
3767
|
+
var import_applyToDefaults, import_assert, import_bench, import_block, import_clone, import_contain, import_deepEqual, import_assertError, import_escapeHeaderAttribute, import_escapeHtml, import_escapeJson, import_escapeRegex, import_flatten, import_ignore, import_intersect, import_isPromise, import_merge, import_once, import_reach, import_reachTemplate, import_stringify, import_wait;
|
|
3768
|
+
var init_lib = __esmMin(() => {
|
|
3769
|
+
import_applyToDefaults = __toESM(require_applyToDefaults(), 1);
|
|
3770
|
+
import_assert = __toESM(require_assert$1(), 1);
|
|
3771
|
+
import_bench = __toESM(require_bench(), 1);
|
|
3772
|
+
import_block = __toESM(require_block(), 1);
|
|
3773
|
+
import_clone = __toESM(require_clone$1(), 1);
|
|
3774
|
+
import_contain = __toESM(require_contain(), 1);
|
|
3775
|
+
import_deepEqual = __toESM(require_deepEqual(), 1);
|
|
3776
|
+
import_assertError = __toESM(require_assertError(), 1);
|
|
3777
|
+
import_escapeHeaderAttribute = __toESM(require_escapeHeaderAttribute(), 1);
|
|
3778
|
+
import_escapeHtml = __toESM(require_escapeHtml(), 1);
|
|
3779
|
+
import_escapeJson = __toESM(require_escapeJson(), 1);
|
|
3780
|
+
import_escapeRegex = __toESM(require_escapeRegex(), 1);
|
|
3781
|
+
import_flatten = __toESM(require_flatten$1(), 1);
|
|
3782
|
+
import_ignore = __toESM(require_ignore(), 1);
|
|
3783
|
+
import_intersect = __toESM(require_intersect(), 1);
|
|
3784
|
+
import_isPromise = __toESM(require_isPromise(), 1);
|
|
3785
|
+
import_merge = __toESM(require_merge(), 1);
|
|
3786
|
+
import_once = __toESM(require_once(), 1);
|
|
3787
|
+
import_reach = __toESM(require_reach(), 1);
|
|
3788
|
+
import_reachTemplate = __toESM(require_reachTemplate(), 1);
|
|
3789
|
+
import_stringify = __toESM(require_stringify(), 1);
|
|
3790
|
+
import_wait = __toESM(require_wait(), 1);
|
|
3791
|
+
});
|
|
3767
3792
|
var require_manifest = __commonJSMin((exports) => {
|
|
3768
3793
|
init_dist$1();
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3794
|
+
var import_schemas$1 = __toESM(require_schemas());
|
|
3795
|
+
var import_template$2 = __toESM(require_template());
|
|
3796
|
+
var import_ref$2 = __toESM(require_ref$2());
|
|
3797
|
+
var import_messages$2 = __toESM(require_messages());
|
|
3798
|
+
var import_common$2 = __toESM(require_common$3());
|
|
3799
|
+
init_lib();
|
|
3800
|
+
const Common$19 = import_common$2.default;
|
|
3801
|
+
const Messages$5 = import_messages$2.default;
|
|
3802
|
+
const Ref$9 = import_ref$2.default;
|
|
3803
|
+
const Template$5 = import_template$2.default;
|
|
3804
|
+
const ManifestDescriptionCache = new WeakMap();
|
|
3805
|
+
var ManifestItemCacheClass = class {
|
|
3806
|
+
#items = new WeakMap();
|
|
3807
|
+
get(item, options = {}) {
|
|
3808
|
+
const cached = this.#items.get(item);
|
|
3809
|
+
if (cached) return cached.get(options);
|
|
3810
|
+
}
|
|
3811
|
+
set(item, options = {}, value) {
|
|
3812
|
+
if (!this.#items.has(item)) this.#items.set(item, new WeakMap());
|
|
3813
|
+
this.#items.get(item).set(options, value);
|
|
3814
|
+
}
|
|
3815
|
+
setAndReturn(item, options = {}, value) {
|
|
3816
|
+
this.set(item, options, value);
|
|
3817
|
+
return value;
|
|
3818
|
+
}
|
|
3819
|
+
};
|
|
3820
|
+
const ManifestItemCache = new ManifestItemCacheClass();
|
|
3774
3821
|
let Schemas$3;
|
|
3775
3822
|
const internals$20 = {};
|
|
3776
3823
|
exports.describe = function(schema$2) {
|
|
3824
|
+
const cached = ManifestDescriptionCache.get(schema$2);
|
|
3825
|
+
if (cached) return cached;
|
|
3777
3826
|
const def = schema$2._definition;
|
|
3778
3827
|
const desc$1 = {
|
|
3779
3828
|
type: schema$2.type,
|
|
@@ -3783,7 +3832,7 @@ var require_manifest = __commonJSMin((exports) => {
|
|
|
3783
3832
|
for (const flag in schema$2._flags) if (flag[0] !== "_") desc$1.flags[flag] = internals$20.describe(schema$2._flags[flag]);
|
|
3784
3833
|
if (!Object.keys(desc$1.flags).length) delete desc$1.flags;
|
|
3785
3834
|
if (schema$2._preferences) {
|
|
3786
|
-
desc$1.preferences =
|
|
3835
|
+
desc$1.preferences = (0, import_clone.default)(schema$2._preferences, { shallow: ["messages"] });
|
|
3787
3836
|
delete desc$1.preferences[Common$19.symbols.prefs];
|
|
3788
3837
|
if (desc$1.preferences.messages) desc$1.preferences.messages = Messages$5.decompile(desc$1.preferences.messages);
|
|
3789
3838
|
}
|
|
@@ -3808,7 +3857,7 @@ var require_manifest = __commonJSMin((exports) => {
|
|
|
3808
3857
|
if (!desc$1.rules.length) delete desc$1.rules;
|
|
3809
3858
|
for (const term in schema$2.$_terms) {
|
|
3810
3859
|
if (term[0] === "_") continue;
|
|
3811
|
-
|
|
3860
|
+
(0, import_assert.default)(!desc$1[term], "Cannot describe schema due to internal name conflict with", term);
|
|
3812
3861
|
const items = schema$2.$_terms[term];
|
|
3813
3862
|
if (!items) continue;
|
|
3814
3863
|
if (items instanceof Map) {
|
|
@@ -3819,7 +3868,7 @@ var require_manifest = __commonJSMin((exports) => {
|
|
|
3819
3868
|
desc$1[term] = items.describe();
|
|
3820
3869
|
continue;
|
|
3821
3870
|
}
|
|
3822
|
-
|
|
3871
|
+
(0, import_assert.default)(def.terms[term], "Term", term, "missing configuration");
|
|
3823
3872
|
const manifest = def.terms[term].manifest;
|
|
3824
3873
|
const mapped = typeof manifest === "object";
|
|
3825
3874
|
if (!items.length && !mapped) continue;
|
|
@@ -3832,31 +3881,34 @@ var require_manifest = __commonJSMin((exports) => {
|
|
|
3832
3881
|
continue;
|
|
3833
3882
|
}
|
|
3834
3883
|
if (manifest === "single") {
|
|
3835
|
-
|
|
3884
|
+
(0, import_assert.default)(normalized.length === 1, "Term", term, "contains more than one item");
|
|
3836
3885
|
desc$1[term] = normalized[0];
|
|
3837
3886
|
continue;
|
|
3838
3887
|
}
|
|
3839
3888
|
desc$1[term] = normalized;
|
|
3840
3889
|
}
|
|
3841
3890
|
internals$20.validate(schema$2.$_root, desc$1);
|
|
3891
|
+
ManifestDescriptionCache.set(schema$2, desc$1);
|
|
3842
3892
|
return desc$1;
|
|
3843
3893
|
};
|
|
3844
3894
|
internals$20.describe = function(item, options = {}) {
|
|
3845
|
-
|
|
3846
|
-
if (
|
|
3847
|
-
if (
|
|
3848
|
-
if (
|
|
3849
|
-
if (
|
|
3850
|
-
if (
|
|
3851
|
-
if (
|
|
3895
|
+
const cached = ManifestItemCache.get(item, options);
|
|
3896
|
+
if (cached) return cached;
|
|
3897
|
+
if (Array.isArray(item)) return ManifestItemCache.setAndReturn(item, options, item.map(internals$20.describe));
|
|
3898
|
+
if (item === Common$19.symbols.deepDefault) return ManifestItemCache.setAndReturn(item, options, { special: "deep" });
|
|
3899
|
+
if (typeof item !== "object" || item === null) return ManifestItemCache.setAndReturn(item, options, item);
|
|
3900
|
+
if (options.assign === "options") return ManifestItemCache.setAndReturn(item, options, (0, import_clone.default)(item));
|
|
3901
|
+
if (Buffer$1 && Buffer$1.isBuffer(item)) return ManifestItemCache.setAndReturn(item, options, { buffer: item.toString("binary") });
|
|
3902
|
+
if (item instanceof Date) return ManifestItemCache.setAndReturn(item, options, item.toISOString());
|
|
3903
|
+
if (item instanceof Error) return ManifestItemCache.setAndReturn(item, options, item);
|
|
3852
3904
|
if (item instanceof RegExp) {
|
|
3853
|
-
if (options.assign === "regex") return item.toString();
|
|
3854
|
-
return { regex: item.toString() };
|
|
3905
|
+
if (options.assign === "regex") return ManifestItemCache.setAndReturn(item, options, item.toString());
|
|
3906
|
+
return ManifestItemCache.setAndReturn(item, options, { regex: item.toString() });
|
|
3855
3907
|
}
|
|
3856
|
-
if (item[Common$19.symbols.literal]) return { function: item.literal };
|
|
3908
|
+
if (item[Common$19.symbols.literal]) return ManifestItemCache.setAndReturn(item, options, { function: item.literal });
|
|
3857
3909
|
if (typeof item.describe === "function") {
|
|
3858
|
-
if (options.assign === "ref") return item.describe().ref;
|
|
3859
|
-
return item.describe();
|
|
3910
|
+
if (options.assign === "ref") return ManifestItemCache.setAndReturn(item, options, item.describe().ref);
|
|
3911
|
+
return ManifestItemCache.setAndReturn(item, options, item.describe());
|
|
3860
3912
|
}
|
|
3861
3913
|
const normalized = {};
|
|
3862
3914
|
for (const key in item) {
|
|
@@ -3864,7 +3916,7 @@ var require_manifest = __commonJSMin((exports) => {
|
|
|
3864
3916
|
if (value === void 0) continue;
|
|
3865
3917
|
normalized[key] = internals$20.describe(value, { assign: key });
|
|
3866
3918
|
}
|
|
3867
|
-
return normalized;
|
|
3919
|
+
return ManifestItemCache.setAndReturn(item, options, normalized);
|
|
3868
3920
|
};
|
|
3869
3921
|
exports.build = function(joi, desc$1) {
|
|
3870
3922
|
const builder = new internals$20.Builder(joi);
|
|
@@ -3880,14 +3932,14 @@ var require_manifest = __commonJSMin((exports) => {
|
|
|
3880
3932
|
const def = schema$2._definition;
|
|
3881
3933
|
if (desc$1.flags) for (const flag in desc$1.flags) {
|
|
3882
3934
|
const setter = def.flags[flag] && def.flags[flag].setter || flag;
|
|
3883
|
-
|
|
3935
|
+
(0, import_assert.default)(typeof schema$2[setter] === "function", "Invalid flag", flag, "for type", desc$1.type);
|
|
3884
3936
|
schema$2 = schema$2[setter](this.build(desc$1.flags[flag]));
|
|
3885
3937
|
}
|
|
3886
3938
|
if (desc$1.preferences) schema$2 = schema$2.preferences(this.build(desc$1.preferences));
|
|
3887
3939
|
if (desc$1.allow) schema$2 = schema$2.allow(...this.build(desc$1.allow));
|
|
3888
3940
|
if (desc$1.invalid) schema$2 = schema$2.invalid(...this.build(desc$1.invalid));
|
|
3889
3941
|
if (desc$1.rules) for (const rule of desc$1.rules) {
|
|
3890
|
-
|
|
3942
|
+
(0, import_assert.default)(typeof schema$2[rule.name] === "function", "Invalid rule", rule.name, "for type", desc$1.type);
|
|
3891
3943
|
const args$1 = [];
|
|
3892
3944
|
if (rule.args) {
|
|
3893
3945
|
const built = {};
|
|
@@ -3895,10 +3947,10 @@ var require_manifest = __commonJSMin((exports) => {
|
|
|
3895
3947
|
const keys$10 = Object.keys(built);
|
|
3896
3948
|
const definition = def.rules[rule.name].args;
|
|
3897
3949
|
if (definition) {
|
|
3898
|
-
|
|
3950
|
+
(0, import_assert.default)(keys$10.length <= definition.length, "Invalid number of arguments for", desc$1.type, rule.name, "(expected up to", definition.length, ", found", keys$10.length, ")");
|
|
3899
3951
|
for (const { name: name$2 } of definition) args$1.push(built[name$2]);
|
|
3900
3952
|
} else {
|
|
3901
|
-
|
|
3953
|
+
(0, import_assert.default)(keys$10.length === 1, "Invalid number of arguments for", desc$1.type, rule.name, "(expected up to 1, found", keys$10.length, ")");
|
|
3902
3954
|
args$1.push(built[keys$10[0]]);
|
|
3903
3955
|
}
|
|
3904
3956
|
}
|
|
@@ -3918,7 +3970,7 @@ var require_manifest = __commonJSMin((exports) => {
|
|
|
3918
3970
|
"rules",
|
|
3919
3971
|
"type"
|
|
3920
3972
|
].includes(key)) continue;
|
|
3921
|
-
|
|
3973
|
+
(0, import_assert.default)(def.terms[key], "Term", key, "missing configuration");
|
|
3922
3974
|
const manifest = def.terms[key].manifest;
|
|
3923
3975
|
if (manifest === "schema") {
|
|
3924
3976
|
terms[key] = desc$1[key].map((item) => this.parse(item));
|
|
@@ -3951,13 +4003,13 @@ var require_manifest = __commonJSMin((exports) => {
|
|
|
3951
4003
|
if (desc$1 === null) return null;
|
|
3952
4004
|
if (Array.isArray(desc$1)) return desc$1.map((item) => this.build(item));
|
|
3953
4005
|
if (desc$1 instanceof Error) return desc$1;
|
|
3954
|
-
if (options.assign === "options") return
|
|
4006
|
+
if (options.assign === "options") return (0, import_clone.default)(desc$1);
|
|
3955
4007
|
if (options.assign === "regex") return internals$20.regex(desc$1);
|
|
3956
4008
|
if (options.assign === "ref") return Ref$9.build(desc$1);
|
|
3957
4009
|
if (typeof desc$1 !== "object") return desc$1;
|
|
3958
4010
|
if (Object.keys(desc$1).length === 1) {
|
|
3959
4011
|
if (desc$1.buffer) {
|
|
3960
|
-
|
|
4012
|
+
(0, import_assert.default)(Buffer$1, "Buffers are not supported");
|
|
3961
4013
|
return Buffer$1 && Buffer$1.from(desc$1.buffer, "binary");
|
|
3962
4014
|
}
|
|
3963
4015
|
if (desc$1.function) return {
|
|
@@ -3968,10 +4020,10 @@ var require_manifest = __commonJSMin((exports) => {
|
|
|
3968
4020
|
if (desc$1.ref) return Ref$9.build(desc$1.ref);
|
|
3969
4021
|
if (desc$1.regex) return internals$20.regex(desc$1.regex);
|
|
3970
4022
|
if (desc$1.special) {
|
|
3971
|
-
|
|
4023
|
+
(0, import_assert.default)(["deep"].includes(desc$1.special), "Unknown special value", desc$1.special);
|
|
3972
4024
|
return Common$19.symbols.deepDefault;
|
|
3973
4025
|
}
|
|
3974
|
-
if (desc$1.value) return
|
|
4026
|
+
if (desc$1.value) return (0, import_clone.default)(desc$1.value);
|
|
3975
4027
|
}
|
|
3976
4028
|
if (desc$1.type) return this.parse(desc$1);
|
|
3977
4029
|
if (desc$1.template) return Template$5.build(desc$1);
|
|
@@ -3987,7 +4039,7 @@ var require_manifest = __commonJSMin((exports) => {
|
|
|
3987
4039
|
return new RegExp(exp, flags);
|
|
3988
4040
|
};
|
|
3989
4041
|
internals$20.validate = function(joi, desc$1) {
|
|
3990
|
-
Schemas$3 = Schemas$3 ||
|
|
4042
|
+
Schemas$3 = Schemas$3 || import_schemas$1.default;
|
|
3991
4043
|
joi.assert(desc$1, Schemas$3.description);
|
|
3992
4044
|
};
|
|
3993
4045
|
});
|
|
@@ -4006,7 +4058,7 @@ var require_lib$2 = __commonJSMin((exports) => {
|
|
|
4006
4058
|
};
|
|
4007
4059
|
});
|
|
4008
4060
|
var require_trace = __commonJSMin((exports) => {
|
|
4009
|
-
const { deepEqual: deepEqual$
|
|
4061
|
+
const { deepEqual: deepEqual$3 } = require_lib$4();
|
|
4010
4062
|
const Pinpoint = require_lib$2();
|
|
4011
4063
|
const Errors$7 = require_errors$2();
|
|
4012
4064
|
const internals$19 = {
|
|
@@ -4162,7 +4214,7 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
4162
4214
|
state.mainstay.debug.push(log$1);
|
|
4163
4215
|
}
|
|
4164
4216
|
value(state, by, from$2, to, name$2) {
|
|
4165
|
-
if (!state.mainstay.debug || deepEqual$
|
|
4217
|
+
if (!state.mainstay.debug || deepEqual$3(from$2, to)) return;
|
|
4166
4218
|
const log$1 = {
|
|
4167
4219
|
type: "value",
|
|
4168
4220
|
by,
|
|
@@ -4221,7 +4273,7 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
4221
4273
|
return name$2;
|
|
4222
4274
|
};
|
|
4223
4275
|
internals$19.sub = function(paths, skipped) {
|
|
4224
|
-
for (const path of paths) for (const skip of skipped) if (deepEqual$
|
|
4276
|
+
for (const path of paths) for (const skip of skipped) if (deepEqual$3(path.slice(0, skip.length), skip)) return true;
|
|
4225
4277
|
return false;
|
|
4226
4278
|
};
|
|
4227
4279
|
internals$19.debug = function(state, event) {
|
|
@@ -4232,7 +4284,7 @@ var require_trace = __commonJSMin((exports) => {
|
|
|
4232
4284
|
};
|
|
4233
4285
|
});
|
|
4234
4286
|
var require_modify = __commonJSMin((exports) => {
|
|
4235
|
-
const { assert: assert$
|
|
4287
|
+
const { assert: assert$44 } = require_lib$4();
|
|
4236
4288
|
const Common$18 = require_common$3();
|
|
4237
4289
|
const Ref$8 = require_ref$2();
|
|
4238
4290
|
const internals$18 = {};
|
|
@@ -4252,11 +4304,11 @@ var require_modify = __commonJSMin((exports) => {
|
|
|
4252
4304
|
concat(source) {
|
|
4253
4305
|
if (source._schemaChain) this._schemaChain = true;
|
|
4254
4306
|
for (const [id, value] of source._byId.entries()) {
|
|
4255
|
-
assert$
|
|
4307
|
+
assert$44(!this._byKey.has(id), "Schema id conflicts with existing key:", id);
|
|
4256
4308
|
this._byId.set(id, value);
|
|
4257
4309
|
}
|
|
4258
4310
|
for (const [key, value] of source._byKey.entries()) {
|
|
4259
|
-
assert$
|
|
4311
|
+
assert$44(!this._byId.has(key), "Schema key conflicts with existing id:", key);
|
|
4260
4312
|
this._byKey.set(key, value);
|
|
4261
4313
|
}
|
|
4262
4314
|
}
|
|
@@ -4268,7 +4320,7 @@ var require_modify = __commonJSMin((exports) => {
|
|
|
4268
4320
|
id: tail$5.id,
|
|
4269
4321
|
schema: adjuster(tail$5.schema)
|
|
4270
4322
|
};
|
|
4271
|
-
assert$
|
|
4323
|
+
assert$44(Common$18.isSchema(adjusted.schema), "adjuster function failed to return a joi schema type");
|
|
4272
4324
|
for (const node of chain) adjusted = {
|
|
4273
4325
|
id: node.id,
|
|
4274
4326
|
schema: internals$18.fork(node.schema, adjusted.id, adjusted.schema)
|
|
@@ -4287,7 +4339,7 @@ var require_modify = __commonJSMin((exports) => {
|
|
|
4287
4339
|
reach(path, behind = []) {
|
|
4288
4340
|
const current = path[0];
|
|
4289
4341
|
const node = this._get(current);
|
|
4290
|
-
assert$
|
|
4342
|
+
assert$44(node, "Schema does not contain path", [...behind, ...path].join("."));
|
|
4291
4343
|
const forward = path.slice(1);
|
|
4292
4344
|
if (!forward.length) return node.schema;
|
|
4293
4345
|
return node.schema._ids.reach(forward, [...behind, current]);
|
|
@@ -4298,16 +4350,16 @@ var require_modify = __commonJSMin((exports) => {
|
|
|
4298
4350
|
const id = schema$2._flags.id;
|
|
4299
4351
|
if (id) {
|
|
4300
4352
|
const existing = this._byId.get(id);
|
|
4301
|
-
assert$
|
|
4302
|
-
assert$
|
|
4353
|
+
assert$44(!existing || existing.schema === schema$2, "Cannot add different schemas with the same id:", id);
|
|
4354
|
+
assert$44(!this._byKey.has(id), "Schema id conflicts with existing key:", id);
|
|
4303
4355
|
this._byId.set(id, {
|
|
4304
4356
|
schema: schema$2,
|
|
4305
4357
|
id
|
|
4306
4358
|
});
|
|
4307
4359
|
}
|
|
4308
4360
|
if (key) {
|
|
4309
|
-
assert$
|
|
4310
|
-
assert$
|
|
4361
|
+
assert$44(!this._byKey.has(key), "Schema already contains key:", key);
|
|
4362
|
+
assert$44(!this._byId.has(key), "Schema key conflicts with existing id:", key);
|
|
4311
4363
|
this._byKey.set(key, {
|
|
4312
4364
|
schema: schema$2,
|
|
4313
4365
|
id: key
|
|
@@ -4322,7 +4374,7 @@ var require_modify = __commonJSMin((exports) => {
|
|
|
4322
4374
|
_collect(path, behind = [], nodes = []) {
|
|
4323
4375
|
const current = path[0];
|
|
4324
4376
|
const node = this._get(current);
|
|
4325
|
-
assert$
|
|
4377
|
+
assert$44(node, "Schema does not contain path", [...behind, ...path].join("."));
|
|
4326
4378
|
nodes = [node, ...nodes];
|
|
4327
4379
|
const forward = path.slice(1);
|
|
4328
4380
|
if (!forward.length) return nodes;
|
|
@@ -4419,7 +4471,7 @@ var require_modify = __commonJSMin((exports) => {
|
|
|
4419
4471
|
};
|
|
4420
4472
|
});
|
|
4421
4473
|
var require_state$1 = __commonJSMin((exports, module) => {
|
|
4422
|
-
const { clone: clone$
|
|
4474
|
+
const { clone: clone$12, reach: reach$2 } = require_lib$4();
|
|
4423
4475
|
const Common$17 = require_common$3();
|
|
4424
4476
|
const internals$17 = { value: Symbol("value") };
|
|
4425
4477
|
module.exports = internals$17.State = class {
|
|
@@ -4446,7 +4498,7 @@ var require_state$1 = __commonJSMin((exports, module) => {
|
|
|
4446
4498
|
this.mainstay.shadow.set(this.path, value, reason);
|
|
4447
4499
|
}
|
|
4448
4500
|
snapshot() {
|
|
4449
|
-
if (this.mainstay.shadow) this._snapshot = clone$
|
|
4501
|
+
if (this.mainstay.shadow) this._snapshot = clone$12(this.mainstay.shadow.node(this.path));
|
|
4450
4502
|
this.mainstay.snapshot();
|
|
4451
4503
|
}
|
|
4452
4504
|
restore() {
|
|
@@ -4494,13 +4546,13 @@ var require_state$1 = __commonJSMin((exports, module) => {
|
|
|
4494
4546
|
}
|
|
4495
4547
|
node(path) {
|
|
4496
4548
|
if (!this._values) return;
|
|
4497
|
-
return reach$
|
|
4549
|
+
return reach$2(this._values, path, { iterables: true });
|
|
4498
4550
|
}
|
|
4499
4551
|
override(path, node) {
|
|
4500
4552
|
if (!this._values) return;
|
|
4501
4553
|
const parents = path.slice(0, -1);
|
|
4502
4554
|
const own = path[path.length - 1];
|
|
4503
|
-
const parent = reach$
|
|
4555
|
+
const parent = reach$2(this._values, parents, { iterables: true });
|
|
4504
4556
|
if (node) {
|
|
4505
4557
|
parent.set(own, node);
|
|
4506
4558
|
return;
|
|
@@ -4510,7 +4562,7 @@ var require_state$1 = __commonJSMin((exports, module) => {
|
|
|
4510
4562
|
};
|
|
4511
4563
|
});
|
|
4512
4564
|
var require_validator = __commonJSMin((exports) => {
|
|
4513
|
-
const { assert: assert$
|
|
4565
|
+
const { assert: assert$43, clone: clone$11, ignore, reach: reach$1 } = require_lib$4();
|
|
4514
4566
|
const Common$16 = require_common$3();
|
|
4515
4567
|
const Errors$6 = require_errors$2();
|
|
4516
4568
|
const State = require_state$1();
|
|
@@ -4518,12 +4570,12 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4518
4570
|
exports.entry = function(value, schema$2, prefs) {
|
|
4519
4571
|
let settings = Common$16.defaults;
|
|
4520
4572
|
if (prefs) {
|
|
4521
|
-
assert$
|
|
4522
|
-
assert$
|
|
4573
|
+
assert$43(prefs.warnings === void 0, "Cannot override warnings preference in synchronous validation");
|
|
4574
|
+
assert$43(prefs.artifacts === void 0, "Cannot override artifacts preference in synchronous validation");
|
|
4523
4575
|
settings = Common$16.preferences(Common$16.defaults, prefs);
|
|
4524
4576
|
}
|
|
4525
4577
|
const result = internals$16.entry(value, schema$2, settings);
|
|
4526
|
-
assert$
|
|
4578
|
+
assert$43(!result.mainstay.externals.length, "Schema with external rules must use validateAsync()");
|
|
4527
4579
|
const outcome = { value: result.value };
|
|
4528
4580
|
if (result.error) outcome.error = result.error;
|
|
4529
4581
|
if (result.mainstay.warnings.length) outcome.warning = Errors$6.details(result.mainstay.warnings);
|
|
@@ -4550,7 +4602,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4550
4602
|
let key;
|
|
4551
4603
|
let parent;
|
|
4552
4604
|
const ancestors = path.length ? [root$11] : [];
|
|
4553
|
-
const original = path.length ? reach$
|
|
4605
|
+
const original = path.length ? reach$1(value, path) : value;
|
|
4554
4606
|
if (path.length) {
|
|
4555
4607
|
key = path[path.length - 1];
|
|
4556
4608
|
let current = root$11;
|
|
@@ -4665,7 +4717,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4665
4717
|
internals$16.tracer = function(schema$2, prefs) {
|
|
4666
4718
|
if (schema$2.$_root._tracer) return { tracer: schema$2.$_root._tracer._register(schema$2) };
|
|
4667
4719
|
if (prefs.debug) {
|
|
4668
|
-
assert$
|
|
4720
|
+
assert$43(schema$2.$_root.trace, "Debug mode not supported");
|
|
4669
4721
|
return {
|
|
4670
4722
|
tracer: schema$2.$_root.trace()._register(schema$2),
|
|
4671
4723
|
cleanup: true
|
|
@@ -4855,7 +4907,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4855
4907
|
if (errors.length && schema$2._flags.error) if (typeof schema$2._flags.error === "function") {
|
|
4856
4908
|
errors = schema$2._flags.error(errors);
|
|
4857
4909
|
if (!Array.isArray(errors)) errors = [errors];
|
|
4858
|
-
for (const error of errors) assert$
|
|
4910
|
+
for (const error of errors) assert$43(error instanceof Error || error instanceof Errors$6.Report, "error() must return an Error object");
|
|
4859
4911
|
} else errors = [schema$2._flags.error];
|
|
4860
4912
|
if (value === void 0) {
|
|
4861
4913
|
const defaulted = internals$16.default("default", value, errors, helpers$8);
|
|
@@ -4907,7 +4959,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4907
4959
|
state.mainstay.tracer.log(schema$2, state, "rule", flag, "full");
|
|
4908
4960
|
if (!source) return source;
|
|
4909
4961
|
if (typeof source === "function") {
|
|
4910
|
-
const args$1 = source.length ? [clone$
|
|
4962
|
+
const args$1 = source.length ? [clone$11(state.ancestors[0]), helpers$8] : [];
|
|
4911
4963
|
try {
|
|
4912
4964
|
return source(...args$1);
|
|
4913
4965
|
} catch (err$1) {
|
|
@@ -4918,7 +4970,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4918
4970
|
if (typeof source !== "object") return source;
|
|
4919
4971
|
if (source[Common$16.symbols.literal]) return source.literal;
|
|
4920
4972
|
if (Common$16.isResolvable(source)) return source.resolve(value, state, prefs);
|
|
4921
|
-
return clone$
|
|
4973
|
+
return clone$11(source);
|
|
4922
4974
|
};
|
|
4923
4975
|
internals$16.trim = function(value, schema$2) {
|
|
4924
4976
|
if (typeof value !== "string") return value;
|
|
@@ -4928,12 +4980,12 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4928
4980
|
};
|
|
4929
4981
|
internals$16.ignore = {
|
|
4930
4982
|
active: false,
|
|
4931
|
-
debug: ignore
|
|
4932
|
-
entry: ignore
|
|
4933
|
-
filter: ignore
|
|
4934
|
-
log: ignore
|
|
4935
|
-
resolve: ignore
|
|
4936
|
-
value: ignore
|
|
4983
|
+
debug: ignore,
|
|
4984
|
+
entry: ignore,
|
|
4985
|
+
filter: ignore,
|
|
4986
|
+
log: ignore,
|
|
4987
|
+
resolve: ignore,
|
|
4988
|
+
value: ignore
|
|
4937
4989
|
};
|
|
4938
4990
|
internals$16.errorsArray = function() {
|
|
4939
4991
|
const errors = [];
|
|
@@ -4942,7 +4994,7 @@ var require_validator = __commonJSMin((exports) => {
|
|
|
4942
4994
|
};
|
|
4943
4995
|
});
|
|
4944
4996
|
var require_values$1 = __commonJSMin((exports, module) => {
|
|
4945
|
-
const { assert: assert$
|
|
4997
|
+
const { assert: assert$42, deepEqual: deepEqual$2 } = require_lib$4();
|
|
4946
4998
|
const Common$15 = require_common$3();
|
|
4947
4999
|
const internals$15 = {};
|
|
4948
5000
|
module.exports = internals$15.Values = class {
|
|
@@ -4997,7 +5049,7 @@ var require_values$1 = __commonJSMin((exports, module) => {
|
|
|
4997
5049
|
}
|
|
4998
5050
|
if (!this._refs.size && typeof value !== "object") return false;
|
|
4999
5051
|
if (typeof value === "object") {
|
|
5000
|
-
for (const item of this._values) if (deepEqual$
|
|
5052
|
+
for (const item of this._values) if (deepEqual$2(item, value)) return { value: item };
|
|
5001
5053
|
}
|
|
5002
5054
|
if (state) for (const ref of this._refs) {
|
|
5003
5055
|
const resolved = ref.resolve(value, state, prefs, null, { in: true });
|
|
@@ -5010,7 +5062,7 @@ var require_values$1 = __commonJSMin((exports, module) => {
|
|
|
5010
5062
|
value: item,
|
|
5011
5063
|
ref
|
|
5012
5064
|
};
|
|
5013
|
-
} else if (deepEqual$
|
|
5065
|
+
} else if (deepEqual$2(item, value)) return {
|
|
5014
5066
|
value: item,
|
|
5015
5067
|
ref
|
|
5016
5068
|
};
|
|
@@ -5035,7 +5087,7 @@ var require_values$1 = __commonJSMin((exports, module) => {
|
|
|
5035
5087
|
return set;
|
|
5036
5088
|
}
|
|
5037
5089
|
concat(source) {
|
|
5038
|
-
assert$
|
|
5090
|
+
assert$42(!source._override, "Cannot concat override set of values");
|
|
5039
5091
|
const set = new internals$15.Values([...this._values, ...source._values], [...this._refs, ...source._refs]);
|
|
5040
5092
|
set._override = this._override;
|
|
5041
5093
|
return set;
|
|
@@ -5059,7 +5111,7 @@ var require_values$1 = __commonJSMin((exports, module) => {
|
|
|
5059
5111
|
};
|
|
5060
5112
|
});
|
|
5061
5113
|
var require_base$2 = __commonJSMin((exports, module) => {
|
|
5062
|
-
const { assert: assert$
|
|
5114
|
+
const { assert: assert$41, clone: clone$10, deepEqual: deepEqual$1, merge: merge$2 } = require_lib$4();
|
|
5063
5115
|
const Cache$2 = require_cache();
|
|
5064
5116
|
const Common$14 = require_common$3();
|
|
5065
5117
|
const Compile$6 = require_compile();
|
|
@@ -5097,7 +5149,7 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5097
5149
|
};
|
|
5098
5150
|
}
|
|
5099
5151
|
describe() {
|
|
5100
|
-
assert$
|
|
5152
|
+
assert$41(typeof Manifest$2.describe === "function", "Manifest functionality disabled");
|
|
5101
5153
|
return Manifest$2.describe(this);
|
|
5102
5154
|
}
|
|
5103
5155
|
allow(...values$3) {
|
|
@@ -5105,13 +5157,13 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5105
5157
|
return this._values(values$3, "_valids");
|
|
5106
5158
|
}
|
|
5107
5159
|
alter(targets) {
|
|
5108
|
-
assert$
|
|
5109
|
-
assert$
|
|
5160
|
+
assert$41(targets && typeof targets === "object" && !Array.isArray(targets), "Invalid targets argument");
|
|
5161
|
+
assert$41(!this._inRuleset(), "Cannot set alterations inside a ruleset");
|
|
5110
5162
|
const obj = this.clone();
|
|
5111
5163
|
obj.$_terms.alterations = obj.$_terms.alterations || [];
|
|
5112
5164
|
for (const target in targets) {
|
|
5113
5165
|
const adjuster = targets[target];
|
|
5114
|
-
assert$
|
|
5166
|
+
assert$41(typeof adjuster === "function", "Alteration adjuster for", target, "must be a function");
|
|
5115
5167
|
obj.$_terms.alterations.push({
|
|
5116
5168
|
target,
|
|
5117
5169
|
adjuster
|
|
@@ -5121,20 +5173,20 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5121
5173
|
return obj;
|
|
5122
5174
|
}
|
|
5123
5175
|
artifact(id) {
|
|
5124
|
-
assert$
|
|
5125
|
-
assert$
|
|
5176
|
+
assert$41(id !== void 0, "Artifact cannot be undefined");
|
|
5177
|
+
assert$41(!this._cache, "Cannot set an artifact with a rule cache");
|
|
5126
5178
|
return this.$_setFlag("artifact", id);
|
|
5127
5179
|
}
|
|
5128
5180
|
cast(to) {
|
|
5129
|
-
assert$
|
|
5130
|
-
assert$
|
|
5181
|
+
assert$41(to === false || typeof to === "string", "Invalid to value");
|
|
5182
|
+
assert$41(to === false || this._definition.cast[to], "Type", this.type, "does not support casting to", to);
|
|
5131
5183
|
return this.$_setFlag("cast", to === false ? void 0 : to);
|
|
5132
5184
|
}
|
|
5133
5185
|
default(value, options) {
|
|
5134
5186
|
return this._default("default", value, options);
|
|
5135
5187
|
}
|
|
5136
5188
|
description(desc$1) {
|
|
5137
|
-
assert$
|
|
5189
|
+
assert$41(desc$1 && typeof desc$1 === "string", "Description must be a non-empty string");
|
|
5138
5190
|
return this.$_setFlag("description", desc$1);
|
|
5139
5191
|
}
|
|
5140
5192
|
empty(schema$2) {
|
|
@@ -5143,12 +5195,12 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5143
5195
|
return obj.$_setFlag("empty", schema$2, { clone: false });
|
|
5144
5196
|
}
|
|
5145
5197
|
error(err$1) {
|
|
5146
|
-
assert$
|
|
5147
|
-
assert$
|
|
5198
|
+
assert$41(err$1, "Missing error");
|
|
5199
|
+
assert$41(err$1 instanceof Error || typeof err$1 === "function", "Must provide a valid Error object or a function");
|
|
5148
5200
|
return this.$_setFlag("error", err$1);
|
|
5149
5201
|
}
|
|
5150
5202
|
example(example, options = {}) {
|
|
5151
|
-
assert$
|
|
5203
|
+
assert$41(example !== void 0, "Missing example");
|
|
5152
5204
|
Common$14.assertOptions(options, ["override"]);
|
|
5153
5205
|
return this._inner("examples", example, {
|
|
5154
5206
|
single: true,
|
|
@@ -5157,12 +5209,12 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5157
5209
|
}
|
|
5158
5210
|
external(method$1, description$2) {
|
|
5159
5211
|
if (typeof method$1 === "object") {
|
|
5160
|
-
assert$
|
|
5212
|
+
assert$41(!description$2, "Cannot combine options with description");
|
|
5161
5213
|
description$2 = method$1.description;
|
|
5162
5214
|
method$1 = method$1.method;
|
|
5163
5215
|
}
|
|
5164
|
-
assert$
|
|
5165
|
-
assert$
|
|
5216
|
+
assert$41(typeof method$1 === "function", "Method must be a function");
|
|
5217
|
+
assert$41(description$2 === void 0 || description$2 && typeof description$2 === "string", "Description must be a non-empty string");
|
|
5166
5218
|
return this._inner("externals", {
|
|
5167
5219
|
method: method$1,
|
|
5168
5220
|
description: description$2
|
|
@@ -5176,46 +5228,46 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5176
5228
|
}
|
|
5177
5229
|
id(id) {
|
|
5178
5230
|
if (!id) return this.$_setFlag("id", void 0);
|
|
5179
|
-
assert$
|
|
5180
|
-
assert$
|
|
5231
|
+
assert$41(typeof id === "string", "id must be a non-empty string");
|
|
5232
|
+
assert$41(/^[^\.]+$/.test(id), "id cannot contain period character");
|
|
5181
5233
|
return this.$_setFlag("id", id);
|
|
5182
5234
|
}
|
|
5183
5235
|
invalid(...values$3) {
|
|
5184
5236
|
return this._values(values$3, "_invalids");
|
|
5185
5237
|
}
|
|
5186
5238
|
label(name$2) {
|
|
5187
|
-
assert$
|
|
5239
|
+
assert$41(name$2 && typeof name$2 === "string", "Label name must be a non-empty string");
|
|
5188
5240
|
return this.$_setFlag("label", name$2);
|
|
5189
5241
|
}
|
|
5190
5242
|
meta(meta) {
|
|
5191
|
-
assert$
|
|
5243
|
+
assert$41(meta !== void 0, "Meta cannot be undefined");
|
|
5192
5244
|
return this._inner("metas", meta, { single: true });
|
|
5193
5245
|
}
|
|
5194
5246
|
note(...notes) {
|
|
5195
|
-
assert$
|
|
5196
|
-
for (const note of notes) assert$
|
|
5247
|
+
assert$41(notes.length, "Missing notes");
|
|
5248
|
+
for (const note of notes) assert$41(note && typeof note === "string", "Notes must be non-empty strings");
|
|
5197
5249
|
return this._inner("notes", notes);
|
|
5198
5250
|
}
|
|
5199
5251
|
only(mode = true) {
|
|
5200
|
-
assert$
|
|
5252
|
+
assert$41(typeof mode === "boolean", "Invalid mode:", mode);
|
|
5201
5253
|
return this.$_setFlag("only", mode);
|
|
5202
5254
|
}
|
|
5203
5255
|
optional() {
|
|
5204
5256
|
return this.presence("optional");
|
|
5205
5257
|
}
|
|
5206
5258
|
prefs(prefs) {
|
|
5207
|
-
assert$
|
|
5208
|
-
assert$
|
|
5209
|
-
assert$
|
|
5210
|
-
assert$
|
|
5211
|
-
assert$
|
|
5259
|
+
assert$41(prefs, "Missing preferences");
|
|
5260
|
+
assert$41(prefs.context === void 0, "Cannot override context");
|
|
5261
|
+
assert$41(prefs.externals === void 0, "Cannot override externals");
|
|
5262
|
+
assert$41(prefs.warnings === void 0, "Cannot override warnings");
|
|
5263
|
+
assert$41(prefs.debug === void 0, "Cannot override debug");
|
|
5212
5264
|
Common$14.checkPreferences(prefs);
|
|
5213
5265
|
const obj = this.clone();
|
|
5214
5266
|
obj._preferences = Common$14.preferences(obj._preferences, prefs);
|
|
5215
5267
|
return obj;
|
|
5216
5268
|
}
|
|
5217
5269
|
presence(mode) {
|
|
5218
|
-
assert$
|
|
5270
|
+
assert$41([
|
|
5219
5271
|
"optional",
|
|
5220
5272
|
"required",
|
|
5221
5273
|
"forbidden"
|
|
@@ -5226,7 +5278,7 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5226
5278
|
return this.$_setFlag("result", enabled ? "raw" : void 0);
|
|
5227
5279
|
}
|
|
5228
5280
|
result(mode) {
|
|
5229
|
-
assert$
|
|
5281
|
+
assert$41(["raw", "strip"].includes(mode), "Unknown result mode", mode);
|
|
5230
5282
|
return this.$_setFlag("result", mode);
|
|
5231
5283
|
}
|
|
5232
5284
|
required() {
|
|
@@ -5242,12 +5294,12 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5242
5294
|
return this.$_setFlag("result", enabled ? "strip" : void 0);
|
|
5243
5295
|
}
|
|
5244
5296
|
tag(...tags$1) {
|
|
5245
|
-
assert$
|
|
5246
|
-
for (const tag of tags$1) assert$
|
|
5297
|
+
assert$41(tags$1.length, "Missing tags");
|
|
5298
|
+
for (const tag of tags$1) assert$41(tag && typeof tag === "string", "Tags must be non-empty strings");
|
|
5247
5299
|
return this._inner("tags", tags$1);
|
|
5248
5300
|
}
|
|
5249
5301
|
unit(name$2) {
|
|
5250
|
-
assert$
|
|
5302
|
+
assert$41(name$2 && typeof name$2 === "string", "Unit name must be a non-empty string");
|
|
5251
5303
|
return this.$_setFlag("unit", name$2);
|
|
5252
5304
|
}
|
|
5253
5305
|
valid(...values$3) {
|
|
@@ -5263,17 +5315,17 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5263
5315
|
if (!["any", "link"].includes(obj.type)) {
|
|
5264
5316
|
const conditions = when.is ? [when] : when.switch;
|
|
5265
5317
|
for (const item of conditions) {
|
|
5266
|
-
assert$
|
|
5267
|
-
assert$
|
|
5318
|
+
assert$41(!item.then || item.then.type === "any" || item.then.type === obj.type, "Cannot combine", obj.type, "with", item.then && item.then.type);
|
|
5319
|
+
assert$41(!item.otherwise || item.otherwise.type === "any" || item.otherwise.type === obj.type, "Cannot combine", obj.type, "with", item.otherwise && item.otherwise.type);
|
|
5268
5320
|
}
|
|
5269
5321
|
}
|
|
5270
5322
|
obj.$_terms.whens.push(when);
|
|
5271
5323
|
return obj.$_mutateRebuild();
|
|
5272
5324
|
}
|
|
5273
5325
|
cache(cache$2) {
|
|
5274
|
-
assert$
|
|
5275
|
-
assert$
|
|
5276
|
-
assert$
|
|
5326
|
+
assert$41(!this._inRuleset(), "Cannot set caching inside a ruleset");
|
|
5327
|
+
assert$41(!this._cache, "Cannot override schema cache");
|
|
5328
|
+
assert$41(this._flags.artifact === void 0, "Cannot cache a rule with an artifact");
|
|
5277
5329
|
const obj = this.clone();
|
|
5278
5330
|
obj._cache = cache$2 || Cache$2.provider.provision();
|
|
5279
5331
|
obj.$_temp.ruleset = false;
|
|
@@ -5284,10 +5336,10 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5284
5336
|
return this._assign(obj);
|
|
5285
5337
|
}
|
|
5286
5338
|
concat(source) {
|
|
5287
|
-
assert$
|
|
5288
|
-
assert$
|
|
5289
|
-
assert$
|
|
5290
|
-
assert$
|
|
5339
|
+
assert$41(Common$14.isSchema(source), "Invalid schema object");
|
|
5340
|
+
assert$41(this.type === "any" || source.type === "any" || source.type === this.type, "Cannot merge type", this.type, "with another type:", source.type);
|
|
5341
|
+
assert$41(!this._inRuleset(), "Cannot concatenate onto a schema with open ruleset");
|
|
5342
|
+
assert$41(!source._inRuleset(), "Cannot concatenate a schema with open ruleset");
|
|
5291
5343
|
let obj = this.clone();
|
|
5292
5344
|
if (this.type === "any" && source.type !== "any") {
|
|
5293
5345
|
const tmpObj = source.clone();
|
|
@@ -5311,13 +5363,13 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5311
5363
|
obj._flags.empty = obj._flags.empty.concat(source._flags.empty);
|
|
5312
5364
|
const flags = Object.assign({}, source._flags);
|
|
5313
5365
|
delete flags.empty;
|
|
5314
|
-
merge$
|
|
5366
|
+
merge$2(obj._flags, flags);
|
|
5315
5367
|
} else if (source._flags.empty) {
|
|
5316
5368
|
obj._flags.empty = source._flags.empty;
|
|
5317
5369
|
const flags = Object.assign({}, source._flags);
|
|
5318
5370
|
delete flags.empty;
|
|
5319
|
-
merge$
|
|
5320
|
-
} else merge$
|
|
5371
|
+
merge$2(obj._flags, flags);
|
|
5372
|
+
} else merge$2(obj._flags, source._flags);
|
|
5321
5373
|
for (const key in source.$_terms) {
|
|
5322
5374
|
const terms = source.$_terms[key];
|
|
5323
5375
|
if (!terms) {
|
|
@@ -5334,7 +5386,7 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5334
5386
|
return obj.$_mutateRebuild();
|
|
5335
5387
|
}
|
|
5336
5388
|
extend(options) {
|
|
5337
|
-
assert$
|
|
5389
|
+
assert$41(!options.base, "Cannot extend type with another base");
|
|
5338
5390
|
return Extend$2.type(this, options);
|
|
5339
5391
|
}
|
|
5340
5392
|
extract(path) {
|
|
@@ -5342,7 +5394,7 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5342
5394
|
return this._ids.reach(path);
|
|
5343
5395
|
}
|
|
5344
5396
|
fork(paths, adjuster) {
|
|
5345
|
-
assert$
|
|
5397
|
+
assert$41(!this._inRuleset(), "Cannot fork inside a ruleset");
|
|
5346
5398
|
let obj = this;
|
|
5347
5399
|
for (let path of [].concat(paths)) {
|
|
5348
5400
|
path = Array.isArray(path) ? path : path.split(".");
|
|
@@ -5366,16 +5418,16 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5366
5418
|
rule(options) {
|
|
5367
5419
|
const def = this._definition;
|
|
5368
5420
|
Common$14.assertOptions(options, Object.keys(def.modifiers));
|
|
5369
|
-
assert$
|
|
5421
|
+
assert$41(this.$_temp.ruleset !== false, "Cannot apply rules to empty ruleset or the last rule added does not support rule properties");
|
|
5370
5422
|
const start = this.$_temp.ruleset === null ? this._rules.length - 1 : this.$_temp.ruleset;
|
|
5371
|
-
assert$
|
|
5423
|
+
assert$41(start >= 0 && start < this._rules.length, "Cannot apply rules to empty ruleset");
|
|
5372
5424
|
const obj = this.clone();
|
|
5373
5425
|
for (let i$4 = start; i$4 < obj._rules.length; ++i$4) {
|
|
5374
5426
|
const original = obj._rules[i$4];
|
|
5375
|
-
const rule = clone$
|
|
5427
|
+
const rule = clone$10(original);
|
|
5376
5428
|
for (const name$2 in options) {
|
|
5377
5429
|
def.modifiers[name$2](rule, options[name$2]);
|
|
5378
|
-
assert$
|
|
5430
|
+
assert$41(rule.name === original.name, "Cannot change rule name");
|
|
5379
5431
|
}
|
|
5380
5432
|
obj._rules[i$4] = rule;
|
|
5381
5433
|
if (obj._singleRules.get(rule.name) === original) obj._singleRules.set(rule.name, rule);
|
|
@@ -5384,7 +5436,7 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5384
5436
|
return obj.$_mutateRebuild();
|
|
5385
5437
|
}
|
|
5386
5438
|
get ruleset() {
|
|
5387
|
-
assert$
|
|
5439
|
+
assert$41(!this._inRuleset(), "Cannot start a new ruleset without closing the previous one");
|
|
5388
5440
|
const obj = this.clone();
|
|
5389
5441
|
obj.$_temp.ruleset = obj._rules.length;
|
|
5390
5442
|
return obj;
|
|
@@ -5394,12 +5446,12 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5394
5446
|
}
|
|
5395
5447
|
tailor(targets) {
|
|
5396
5448
|
targets = [].concat(targets);
|
|
5397
|
-
assert$
|
|
5449
|
+
assert$41(!this._inRuleset(), "Cannot tailor inside a ruleset");
|
|
5398
5450
|
let obj = this;
|
|
5399
5451
|
if (this.$_terms.alterations) {
|
|
5400
5452
|
for (const { target, adjuster } of this.$_terms.alterations) if (targets.includes(target)) {
|
|
5401
5453
|
obj = adjuster(obj);
|
|
5402
|
-
assert$
|
|
5454
|
+
assert$41(Common$14.isSchema(obj), "Alteration adjuster for", target, "failed to return a schema object");
|
|
5403
5455
|
}
|
|
5404
5456
|
}
|
|
5405
5457
|
obj = obj.$_modify({
|
|
@@ -5420,18 +5472,18 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5420
5472
|
}
|
|
5421
5473
|
$_addRule(options) {
|
|
5422
5474
|
if (typeof options === "string") options = { name: options };
|
|
5423
|
-
assert$
|
|
5424
|
-
assert$
|
|
5425
|
-
for (const key in options) assert$
|
|
5475
|
+
assert$41(options && typeof options === "object", "Invalid options");
|
|
5476
|
+
assert$41(options.name && typeof options.name === "string", "Invalid rule name");
|
|
5477
|
+
for (const key in options) assert$41(key[0] !== "_", "Cannot set private rule properties");
|
|
5426
5478
|
const rule = Object.assign({}, options);
|
|
5427
5479
|
rule._resolve = [];
|
|
5428
5480
|
rule.method = rule.method || rule.name;
|
|
5429
5481
|
const definition = this._definition.rules[rule.method];
|
|
5430
5482
|
const args$1 = rule.args;
|
|
5431
|
-
assert$
|
|
5483
|
+
assert$41(definition, "Unknown rule", rule.method);
|
|
5432
5484
|
const obj = this.clone();
|
|
5433
5485
|
if (args$1) {
|
|
5434
|
-
assert$
|
|
5486
|
+
assert$41(Object.keys(args$1).length === 1 || Object.keys(args$1).length === this._definition.rules[rule.name].args.length, "Invalid rule definition for", this.type, rule.name);
|
|
5435
5487
|
for (const key in args$1) {
|
|
5436
5488
|
let arg = args$1[key];
|
|
5437
5489
|
if (definition.argsByName) {
|
|
@@ -5446,7 +5498,7 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5446
5498
|
}
|
|
5447
5499
|
if (resolver.assert) {
|
|
5448
5500
|
const error = Common$14.validateArg(arg, key, resolver);
|
|
5449
|
-
assert$
|
|
5501
|
+
assert$41(!error, error, "or reference");
|
|
5450
5502
|
}
|
|
5451
5503
|
}
|
|
5452
5504
|
}
|
|
@@ -5503,7 +5555,7 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5503
5555
|
return Modify.schema(this, options) || this;
|
|
5504
5556
|
}
|
|
5505
5557
|
$_mutateRebuild() {
|
|
5506
|
-
assert$
|
|
5558
|
+
assert$41(!this._inRuleset(), "Cannot add this rule inside a ruleset");
|
|
5507
5559
|
this._refs.reset();
|
|
5508
5560
|
this._ids.reset();
|
|
5509
5561
|
const each$5 = (item, { source, name: name$2, path, key }) => {
|
|
@@ -5532,10 +5584,10 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5532
5584
|
return this._refs.roots();
|
|
5533
5585
|
}
|
|
5534
5586
|
$_setFlag(name$2, value, options = {}) {
|
|
5535
|
-
assert$
|
|
5587
|
+
assert$41(name$2[0] === "_" || !this._inRuleset(), "Cannot set flag inside a ruleset");
|
|
5536
5588
|
const flag = this._definition.flags[name$2] || {};
|
|
5537
|
-
if (deepEqual$
|
|
5538
|
-
if (deepEqual$
|
|
5589
|
+
if (deepEqual$1(value, flag.default)) value = void 0;
|
|
5590
|
+
if (deepEqual$1(value, this._flags[name$2])) return this;
|
|
5539
5591
|
const obj = options.clone !== false ? this.clone() : this;
|
|
5540
5592
|
if (value !== void 0) {
|
|
5541
5593
|
obj._flags[name$2] = value;
|
|
@@ -5560,7 +5612,7 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5560
5612
|
target._valids = this._valids && this._valids.clone();
|
|
5561
5613
|
target._invalids = this._invalids && this._invalids.clone();
|
|
5562
5614
|
target._rules = this._rules.slice();
|
|
5563
|
-
target._singleRules = clone$
|
|
5615
|
+
target._singleRules = clone$10(this._singleRules, { shallow: true });
|
|
5564
5616
|
target._refs = this._refs.clone();
|
|
5565
5617
|
target._flags = Object.assign({}, this._flags);
|
|
5566
5618
|
target._cache = null;
|
|
@@ -5582,8 +5634,8 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5582
5634
|
}
|
|
5583
5635
|
_default(flag, value, options = {}) {
|
|
5584
5636
|
Common$14.assertOptions(options, "literal");
|
|
5585
|
-
assert$
|
|
5586
|
-
assert$
|
|
5637
|
+
assert$41(value !== void 0, "Missing", flag, "value");
|
|
5638
|
+
assert$41(typeof value === "function" || !options.literal, "Only function value supports literal option");
|
|
5587
5639
|
if (typeof value === "function" && options.literal) value = {
|
|
5588
5640
|
[Common$14.symbols.literal]: true,
|
|
5589
5641
|
literal: value
|
|
@@ -5644,7 +5696,7 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5644
5696
|
};
|
|
5645
5697
|
}
|
|
5646
5698
|
_inner(type, values$3, options = {}) {
|
|
5647
|
-
assert$
|
|
5699
|
+
assert$41(!this._inRuleset(), `Cannot set ${type} inside a ruleset`);
|
|
5648
5700
|
const obj = this.clone();
|
|
5649
5701
|
if (!obj.$_terms[type] || options.override) obj.$_terms[type] = [];
|
|
5650
5702
|
if (options.single) obj.$_terms[type].push(values$3);
|
|
@@ -5684,13 +5736,13 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5684
5736
|
if (!obj[key]) return obj;
|
|
5685
5737
|
if (override) obj[key].override();
|
|
5686
5738
|
for (const value of values$3) {
|
|
5687
|
-
assert$
|
|
5688
|
-
assert$
|
|
5739
|
+
assert$41(value !== void 0, "Cannot call allow/valid/invalid with undefined");
|
|
5740
|
+
assert$41(value !== Common$14.symbols.override, "Override must be the first value");
|
|
5689
5741
|
const other = key === "_invalids" ? "_valids" : "_invalids";
|
|
5690
5742
|
if (obj[other]) {
|
|
5691
5743
|
obj[other].remove(value);
|
|
5692
5744
|
if (!obj[other].length) {
|
|
5693
|
-
assert$
|
|
5745
|
+
assert$41(key === "_valids" || !obj._flags.only, "Setting invalid value", value, "leaves schema rejecting all values due to previous valid rule");
|
|
5694
5746
|
obj[other] = null;
|
|
5695
5747
|
}
|
|
5696
5748
|
}
|
|
@@ -5737,7 +5789,7 @@ var require_base$2 = __commonJSMin((exports, module) => {
|
|
|
5737
5789
|
module.exports = new internals$14.Base();
|
|
5738
5790
|
});
|
|
5739
5791
|
var require_any = __commonJSMin((exports, module) => {
|
|
5740
|
-
const { assert: assert$
|
|
5792
|
+
const { assert: assert$40 } = require_lib$4();
|
|
5741
5793
|
const Base$3 = require_base$2();
|
|
5742
5794
|
const Common$13 = require_common$3();
|
|
5743
5795
|
const Messages$3 = require_messages();
|
|
@@ -5757,8 +5809,8 @@ var require_any = __commonJSMin((exports, module) => {
|
|
|
5757
5809
|
rules: {
|
|
5758
5810
|
custom: {
|
|
5759
5811
|
method(method$1, description$2) {
|
|
5760
|
-
assert$
|
|
5761
|
-
assert$
|
|
5812
|
+
assert$40(typeof method$1 === "function", "Method must be a function");
|
|
5813
|
+
assert$40(description$2 === void 0 || description$2 && typeof description$2 === "string", "Description must be a non-empty string");
|
|
5762
5814
|
return this.$_addRule({
|
|
5763
5815
|
name: "custom",
|
|
5764
5816
|
args: {
|
|
@@ -5781,7 +5833,7 @@ var require_any = __commonJSMin((exports, module) => {
|
|
|
5781
5833
|
return this.prefs({ messages: messages$3 });
|
|
5782
5834
|
} },
|
|
5783
5835
|
shared: { method(schema$2) {
|
|
5784
|
-
assert$
|
|
5836
|
+
assert$40(Common$13.isSchema(schema$2) && schema$2._flags.id, "Schema must be a schema with an id");
|
|
5785
5837
|
const obj = this.clone();
|
|
5786
5838
|
obj.$_terms.shared = obj.$_terms.shared || [];
|
|
5787
5839
|
obj.$_terms.shared.push(schema$2);
|
|
@@ -5790,7 +5842,7 @@ var require_any = __commonJSMin((exports, module) => {
|
|
|
5790
5842
|
} },
|
|
5791
5843
|
warning: {
|
|
5792
5844
|
method(code$2, local) {
|
|
5793
|
-
assert$
|
|
5845
|
+
assert$40(code$2 && typeof code$2 === "string", "Invalid warning code");
|
|
5794
5846
|
return this.$_addRule({
|
|
5795
5847
|
name: "warning",
|
|
5796
5848
|
args: {
|
|
@@ -5874,7 +5926,7 @@ var require_any = __commonJSMin((exports, module) => {
|
|
|
5874
5926
|
});
|
|
5875
5927
|
});
|
|
5876
5928
|
var require_alternatives = __commonJSMin((exports, module) => {
|
|
5877
|
-
const { assert: assert$
|
|
5929
|
+
const { assert: assert$39, merge: merge$1 } = require_lib$4();
|
|
5878
5930
|
const Any$9 = require_any();
|
|
5879
5931
|
const Common$12 = require_common$3();
|
|
5880
5932
|
const Compile$5 = require_compile();
|
|
@@ -5926,7 +5978,7 @@ var require_alternatives = __commonJSMin((exports, module) => {
|
|
|
5926
5978
|
return v$1.schema.type === "object" || v$1.schema.type === "alternatives" && isAnyObj(v$1.schema);
|
|
5927
5979
|
});
|
|
5928
5980
|
};
|
|
5929
|
-
return isAnyObj(schema$2) ? { value: matched.reduce((acc, v$1) => merge$
|
|
5981
|
+
return isAnyObj(schema$2) ? { value: matched.reduce((acc, v$1) => merge$1(acc, v$1, { mergeArrays: false })) } : { value: matched[matched.length - 1] };
|
|
5930
5982
|
}
|
|
5931
5983
|
const errors = [];
|
|
5932
5984
|
for (let i$4 = 0; i$4 < schema$2.$_terms.matches.length; ++i$4) {
|
|
@@ -5961,9 +6013,9 @@ var require_alternatives = __commonJSMin((exports, module) => {
|
|
|
5961
6013
|
},
|
|
5962
6014
|
rules: {
|
|
5963
6015
|
conditional: { method(condition, options) {
|
|
5964
|
-
assert$
|
|
5965
|
-
assert$
|
|
5966
|
-
assert$
|
|
6016
|
+
assert$39(!this._flags._endedSwitch, "Unreachable condition");
|
|
6017
|
+
assert$39(!this._flags.match, "Cannot combine match mode", this._flags.match, "with conditional rule");
|
|
6018
|
+
assert$39(options.break === void 0, "Cannot use break option with alternatives conditional");
|
|
5967
6019
|
const obj = this.clone();
|
|
5968
6020
|
const match$2 = Compile$5.when(obj, condition, options);
|
|
5969
6021
|
const conditions = match$2.is ? [match$2] : match$2.switch;
|
|
@@ -5975,18 +6027,18 @@ var require_alternatives = __commonJSMin((exports, module) => {
|
|
|
5975
6027
|
return obj.$_mutateRebuild();
|
|
5976
6028
|
} },
|
|
5977
6029
|
match: { method(mode) {
|
|
5978
|
-
assert$
|
|
6030
|
+
assert$39([
|
|
5979
6031
|
"any",
|
|
5980
6032
|
"one",
|
|
5981
6033
|
"all"
|
|
5982
6034
|
].includes(mode), "Invalid alternatives match mode", mode);
|
|
5983
|
-
if (mode !== "any") for (const match$2 of this.$_terms.matches) assert$
|
|
6035
|
+
if (mode !== "any") for (const match$2 of this.$_terms.matches) assert$39(match$2.schema, "Cannot combine match mode", mode, "with conditional rules");
|
|
5984
6036
|
return this.$_setFlag("match", mode);
|
|
5985
6037
|
} },
|
|
5986
6038
|
try: { method(...schemas) {
|
|
5987
|
-
assert$
|
|
6039
|
+
assert$39(schemas.length, "Missing alternative schemas");
|
|
5988
6040
|
Common$12.verifyFlat(schemas, "try");
|
|
5989
|
-
assert$
|
|
6041
|
+
assert$39(!this._flags._endedSwitch, "Unreachable condition");
|
|
5990
6042
|
const obj = this.clone();
|
|
5991
6043
|
for (const schema$2 of schemas) obj.$_terms.matches.push({ schema: obj.$_compile(schema$2) });
|
|
5992
6044
|
return obj.$_mutateRebuild();
|
|
@@ -6084,7 +6136,7 @@ var require_alternatives = __commonJSMin((exports, module) => {
|
|
|
6084
6136
|
};
|
|
6085
6137
|
});
|
|
6086
6138
|
var require_array = __commonJSMin((exports, module) => {
|
|
6087
|
-
const { assert: assert$
|
|
6139
|
+
const { assert: assert$38, deepEqual, reach } = require_lib$4();
|
|
6088
6140
|
const Any$8 = require_any();
|
|
6089
6141
|
const Common$11 = require_common$3();
|
|
6090
6142
|
const Compile$4 = require_compile();
|
|
@@ -6380,7 +6432,7 @@ var require_array = __commonJSMin((exports, module) => {
|
|
|
6380
6432
|
} },
|
|
6381
6433
|
single: { method(enabled) {
|
|
6382
6434
|
const value = enabled === void 0 ? true : !!enabled;
|
|
6383
|
-
assert$
|
|
6435
|
+
assert$38(!value || !this._flags._arrayItems, "Cannot specify single rule when array has array items");
|
|
6384
6436
|
return this.$_setFlag("single", value);
|
|
6385
6437
|
} },
|
|
6386
6438
|
sort: {
|
|
@@ -6389,7 +6441,7 @@ var require_array = __commonJSMin((exports, module) => {
|
|
|
6389
6441
|
const settings = { order: options.order || "ascending" };
|
|
6390
6442
|
if (options.by) {
|
|
6391
6443
|
settings.by = Compile$4.ref(options.by, { ancestor: 0 });
|
|
6392
|
-
assert$
|
|
6444
|
+
assert$38(!settings.by.ancestor, "Cannot sort by ancestor");
|
|
6393
6445
|
}
|
|
6394
6446
|
return this.$_addRule({
|
|
6395
6447
|
name: "sort",
|
|
@@ -6415,7 +6467,7 @@ var require_array = __commonJSMin((exports, module) => {
|
|
|
6415
6467
|
} },
|
|
6416
6468
|
unique: {
|
|
6417
6469
|
method(comparator, options = {}) {
|
|
6418
|
-
assert$
|
|
6470
|
+
assert$38(!comparator || typeof comparator === "function" || typeof comparator === "string", "comparator must be a function or a string");
|
|
6419
6471
|
Common$11.assertOptions(options, ["ignoreUndefined", "separator"]);
|
|
6420
6472
|
const rule = {
|
|
6421
6473
|
name: "unique",
|
|
@@ -6441,12 +6493,12 @@ var require_array = __commonJSMin((exports, module) => {
|
|
|
6441
6493
|
function: new Map(),
|
|
6442
6494
|
custom: new Map()
|
|
6443
6495
|
};
|
|
6444
|
-
const compare$16 = comparator || deepEqual
|
|
6496
|
+
const compare$16 = comparator || deepEqual;
|
|
6445
6497
|
const ignoreUndefined = options.ignoreUndefined;
|
|
6446
6498
|
for (let i$4 = 0; i$4 < value.length; ++i$4) {
|
|
6447
|
-
const item = path ? reach
|
|
6499
|
+
const item = path ? reach(value[i$4], path) : value[i$4];
|
|
6448
6500
|
const records = comparator ? found.custom : found[typeof item];
|
|
6449
|
-
assert$
|
|
6501
|
+
assert$38(records, "Failed to find unique map container for type", typeof item);
|
|
6450
6502
|
if (records instanceof Map) {
|
|
6451
6503
|
const entries = records.entries();
|
|
6452
6504
|
let current;
|
|
@@ -6574,7 +6626,7 @@ var require_array = __commonJSMin((exports, module) => {
|
|
|
6574
6626
|
};
|
|
6575
6627
|
internals$12.validateSingle = function(type, obj) {
|
|
6576
6628
|
if (type.type === "array" || type._flags._arrayItems) {
|
|
6577
|
-
assert$
|
|
6629
|
+
assert$38(!obj._flags.single, "Cannot specify array item with single rule enabled");
|
|
6578
6630
|
obj.$_setFlag("_arrayItems", true, { clone: false });
|
|
6579
6631
|
}
|
|
6580
6632
|
};
|
|
@@ -6613,7 +6665,7 @@ var require_array = __commonJSMin((exports, module) => {
|
|
|
6613
6665
|
};
|
|
6614
6666
|
});
|
|
6615
6667
|
var require_boolean = __commonJSMin((exports, module) => {
|
|
6616
|
-
const { assert: assert$
|
|
6668
|
+
const { assert: assert$37 } = require_lib$4();
|
|
6617
6669
|
const Any$7 = require_any();
|
|
6618
6670
|
const Common$10 = require_common$3();
|
|
6619
6671
|
const Values = require_values$1();
|
|
@@ -6656,7 +6708,7 @@ var require_boolean = __commonJSMin((exports, module) => {
|
|
|
6656
6708
|
obj.$_terms.truthy = obj.$_terms.truthy || new Values();
|
|
6657
6709
|
for (let i$4 = 0; i$4 < values$3.length; ++i$4) {
|
|
6658
6710
|
const value = values$3[i$4];
|
|
6659
|
-
assert$
|
|
6711
|
+
assert$37(value !== void 0, "Cannot call truthy with undefined");
|
|
6660
6712
|
obj.$_terms.truthy.add(value);
|
|
6661
6713
|
}
|
|
6662
6714
|
return obj;
|
|
@@ -6667,7 +6719,7 @@ var require_boolean = __commonJSMin((exports, module) => {
|
|
|
6667
6719
|
obj.$_terms.falsy = obj.$_terms.falsy || new Values();
|
|
6668
6720
|
for (let i$4 = 0; i$4 < values$3.length; ++i$4) {
|
|
6669
6721
|
const value = values$3[i$4];
|
|
6670
|
-
assert$
|
|
6722
|
+
assert$37(value !== void 0, "Cannot call falsy with undefined");
|
|
6671
6723
|
obj.$_terms.falsy.add(value);
|
|
6672
6724
|
}
|
|
6673
6725
|
return obj;
|
|
@@ -6699,7 +6751,7 @@ var require_boolean = __commonJSMin((exports, module) => {
|
|
|
6699
6751
|
});
|
|
6700
6752
|
});
|
|
6701
6753
|
var require_date = __commonJSMin((exports, module) => {
|
|
6702
|
-
const { assert: assert$
|
|
6754
|
+
const { assert: assert$36 } = require_lib$4();
|
|
6703
6755
|
const Any$6 = require_any();
|
|
6704
6756
|
const Common$9 = require_common$3();
|
|
6705
6757
|
const Template$4 = require_template();
|
|
@@ -6749,7 +6801,7 @@ var require_date = __commonJSMin((exports, module) => {
|
|
|
6749
6801
|
}]
|
|
6750
6802
|
},
|
|
6751
6803
|
format: { method(format) {
|
|
6752
|
-
assert$
|
|
6804
|
+
assert$36([
|
|
6753
6805
|
"iso",
|
|
6754
6806
|
"javascript",
|
|
6755
6807
|
"unix"
|
|
@@ -6792,7 +6844,7 @@ var require_date = __commonJSMin((exports, module) => {
|
|
|
6792
6844
|
});
|
|
6793
6845
|
} },
|
|
6794
6846
|
timestamp: { method(type = "javascript") {
|
|
6795
|
-
assert$
|
|
6847
|
+
assert$36(["javascript", "unix"].includes(type), "\"type\" must be one of \"javascript, unix\"");
|
|
6796
6848
|
return this.format(type);
|
|
6797
6849
|
} }
|
|
6798
6850
|
},
|
|
@@ -6846,7 +6898,7 @@ var require_date = __commonJSMin((exports, module) => {
|
|
|
6846
6898
|
};
|
|
6847
6899
|
});
|
|
6848
6900
|
var require_lib$1 = __commonJSMin((exports) => {
|
|
6849
|
-
const { assert: assert$
|
|
6901
|
+
const { assert: assert$35 } = require_lib$4();
|
|
6850
6902
|
const internals$9 = {};
|
|
6851
6903
|
exports.Sorter = class {
|
|
6852
6904
|
constructor() {
|
|
@@ -6859,10 +6911,10 @@ var require_lib$1 = __commonJSMin((exports) => {
|
|
|
6859
6911
|
const after = [].concat(options.after ?? []);
|
|
6860
6912
|
const group = options.group ?? "?";
|
|
6861
6913
|
const sort$2 = options.sort ?? 0;
|
|
6862
|
-
assert$
|
|
6863
|
-
assert$
|
|
6864
|
-
assert$
|
|
6865
|
-
assert$
|
|
6914
|
+
assert$35(!before.includes(group), `Item cannot come before itself: ${group}`);
|
|
6915
|
+
assert$35(!before.includes("?"), "Item cannot come before unassociated items");
|
|
6916
|
+
assert$35(!after.includes(group), `Item cannot come after itself: ${group}`);
|
|
6917
|
+
assert$35(!after.includes("?"), "Item cannot come after unassociated items");
|
|
6866
6918
|
if (!Array.isArray(nodes)) nodes = [nodes];
|
|
6867
6919
|
for (const node of nodes) {
|
|
6868
6920
|
const item = {
|
|
@@ -6877,7 +6929,7 @@ var require_lib$1 = __commonJSMin((exports) => {
|
|
|
6877
6929
|
}
|
|
6878
6930
|
if (!options.manual) {
|
|
6879
6931
|
const valid$2 = this._sort();
|
|
6880
|
-
assert$
|
|
6932
|
+
assert$35(valid$2, "item", group !== "?" ? `added into group ${group}` : "", "created a dependencies error");
|
|
6881
6933
|
}
|
|
6882
6934
|
return this.nodes;
|
|
6883
6935
|
}
|
|
@@ -6887,12 +6939,12 @@ var require_lib$1 = __commonJSMin((exports) => {
|
|
|
6887
6939
|
this._items.sort(internals$9.mergeSort);
|
|
6888
6940
|
for (let i$4 = 0; i$4 < this._items.length; ++i$4) this._items[i$4].seq = i$4;
|
|
6889
6941
|
const valid$2 = this._sort();
|
|
6890
|
-
assert$
|
|
6942
|
+
assert$35(valid$2, "merge created a dependencies error");
|
|
6891
6943
|
return this.nodes;
|
|
6892
6944
|
}
|
|
6893
6945
|
sort() {
|
|
6894
6946
|
const valid$2 = this._sort();
|
|
6895
|
-
assert$
|
|
6947
|
+
assert$35(valid$2, "sort created a dependencies error");
|
|
6896
6948
|
return this.nodes;
|
|
6897
6949
|
}
|
|
6898
6950
|
_sort() {
|
|
@@ -6969,7 +7021,7 @@ var require_lib$1 = __commonJSMin((exports) => {
|
|
|
6969
7021
|
};
|
|
6970
7022
|
});
|
|
6971
7023
|
var require_keys$1 = __commonJSMin((exports, module) => {
|
|
6972
|
-
const { applyToDefaults
|
|
7024
|
+
const { applyToDefaults, assert: assert$34, clone: Clone } = require_lib$4();
|
|
6973
7025
|
const Topo = require_lib$1();
|
|
6974
7026
|
const Any$5 = require_any();
|
|
6975
7027
|
const Common$8 = require_common$3();
|
|
@@ -7070,7 +7122,7 @@ var require_keys$1 = __commonJSMin((exports, module) => {
|
|
|
7070
7122
|
assert: {
|
|
7071
7123
|
method(subject, schema$2, message) {
|
|
7072
7124
|
if (!Template$3.isTemplate(subject)) subject = Compile$3.ref(subject);
|
|
7073
|
-
assert$
|
|
7125
|
+
assert$34(message === void 0 || typeof message === "string", "Message must be a string");
|
|
7074
7126
|
schema$2 = this.$_compile(schema$2, { appendPath: true });
|
|
7075
7127
|
const obj = this.$_addRule({
|
|
7076
7128
|
name: "assert",
|
|
@@ -7102,7 +7154,7 @@ var require_keys$1 = __commonJSMin((exports, module) => {
|
|
|
7102
7154
|
},
|
|
7103
7155
|
instance: {
|
|
7104
7156
|
method(constructor, name$2) {
|
|
7105
|
-
assert$
|
|
7157
|
+
assert$34(typeof constructor === "function", "constructor must be a function");
|
|
7106
7158
|
name$2 = name$2 || constructor.name;
|
|
7107
7159
|
return this.$_addRule({
|
|
7108
7160
|
name: "instance",
|
|
@@ -7122,8 +7174,8 @@ var require_keys$1 = __commonJSMin((exports, module) => {
|
|
|
7122
7174
|
args: ["constructor", "name"]
|
|
7123
7175
|
},
|
|
7124
7176
|
keys: { method(schema$2) {
|
|
7125
|
-
assert$
|
|
7126
|
-
assert$
|
|
7177
|
+
assert$34(schema$2 === void 0 || typeof schema$2 === "object", "Object schema must be a valid object");
|
|
7178
|
+
assert$34(!Common$8.isSchema(schema$2), "Object schema cannot be a joi schema");
|
|
7127
7179
|
const obj = this.clone();
|
|
7128
7180
|
if (!schema$2) obj.$_terms.keys = null;
|
|
7129
7181
|
else if (!Object.keys(schema$2).length) obj.$_terms.keys = new internals$8.Keys();
|
|
@@ -7188,9 +7240,9 @@ var require_keys$1 = __commonJSMin((exports, module) => {
|
|
|
7188
7240
|
pattern: { method(pattern, schema$2, options = {}) {
|
|
7189
7241
|
const isRegExp$3 = pattern instanceof RegExp;
|
|
7190
7242
|
if (!isRegExp$3) pattern = this.$_compile(pattern, { appendPath: true });
|
|
7191
|
-
assert$
|
|
7243
|
+
assert$34(schema$2 !== void 0, "Invalid rule");
|
|
7192
7244
|
Common$8.assertOptions(options, ["fallthrough", "matches"]);
|
|
7193
|
-
if (isRegExp$3) assert$
|
|
7245
|
+
if (isRegExp$3) assert$34(!pattern.flags.includes("g") && !pattern.flags.includes("y"), "pattern should not use global or sticky mode");
|
|
7194
7246
|
schema$2 = this.$_compile(schema$2, { appendPath: true });
|
|
7195
7247
|
const obj = this.clone();
|
|
7196
7248
|
obj.$_terms.patterns = obj.$_terms.patterns || [];
|
|
@@ -7228,9 +7280,9 @@ var require_keys$1 = __commonJSMin((exports, module) => {
|
|
|
7228
7280
|
}
|
|
7229
7281
|
},
|
|
7230
7282
|
rename: { method(from$2, to, options = {}) {
|
|
7231
|
-
assert$
|
|
7232
|
-
assert$
|
|
7233
|
-
assert$
|
|
7283
|
+
assert$34(typeof from$2 === "string" || from$2 instanceof RegExp, "Rename missing the from argument");
|
|
7284
|
+
assert$34(typeof to === "string" || to instanceof Template$3, "Invalid rename to argument");
|
|
7285
|
+
assert$34(to !== from$2, "Cannot rename key to same name:", from$2);
|
|
7234
7286
|
Common$8.assertOptions(options, [
|
|
7235
7287
|
"alias",
|
|
7236
7288
|
"ignoreUndefined",
|
|
@@ -7239,12 +7291,12 @@ var require_keys$1 = __commonJSMin((exports, module) => {
|
|
|
7239
7291
|
]);
|
|
7240
7292
|
const obj = this.clone();
|
|
7241
7293
|
obj.$_terms.renames = obj.$_terms.renames || [];
|
|
7242
|
-
for (const rename of obj.$_terms.renames) assert$
|
|
7294
|
+
for (const rename of obj.$_terms.renames) assert$34(rename.from !== from$2, "Cannot rename the same key multiple times");
|
|
7243
7295
|
if (to instanceof Template$3) obj.$_mutateRegister(to);
|
|
7244
7296
|
obj.$_terms.renames.push({
|
|
7245
7297
|
from: from$2,
|
|
7246
7298
|
to,
|
|
7247
|
-
options: applyToDefaults
|
|
7299
|
+
options: applyToDefaults(internals$8.renameDefaults, options)
|
|
7248
7300
|
});
|
|
7249
7301
|
return obj;
|
|
7250
7302
|
} },
|
|
@@ -7356,14 +7408,14 @@ var require_keys$1 = __commonJSMin((exports, module) => {
|
|
|
7356
7408
|
return clone$20;
|
|
7357
7409
|
};
|
|
7358
7410
|
internals$8.dependency = function(schema$2, rel, key, peers, options) {
|
|
7359
|
-
assert$
|
|
7411
|
+
assert$34(key === null || typeof key === "string", rel, "key must be a strings");
|
|
7360
7412
|
if (!options) options = peers.length > 1 && typeof peers[peers.length - 1] === "object" ? peers.pop() : {};
|
|
7361
7413
|
Common$8.assertOptions(options, ["separator", "isPresent"]);
|
|
7362
7414
|
peers = [].concat(peers);
|
|
7363
7415
|
const separator = Common$8.default(options.separator, ".");
|
|
7364
7416
|
const paths = [];
|
|
7365
7417
|
for (const peer of peers) {
|
|
7366
|
-
assert$
|
|
7418
|
+
assert$34(typeof peer === "string", rel, "peers must be strings");
|
|
7367
7419
|
paths.push(Compile$3.ref(peer, {
|
|
7368
7420
|
separator,
|
|
7369
7421
|
ancestor: 0,
|
|
@@ -7660,7 +7712,7 @@ var require_keys$1 = __commonJSMin((exports, module) => {
|
|
|
7660
7712
|
};
|
|
7661
7713
|
});
|
|
7662
7714
|
var require_function = __commonJSMin((exports, module) => {
|
|
7663
|
-
const { assert: assert$
|
|
7715
|
+
const { assert: assert$33 } = require_lib$4();
|
|
7664
7716
|
const Keys$1 = require_keys$1();
|
|
7665
7717
|
module.exports = Keys$1.extend({
|
|
7666
7718
|
type: "function",
|
|
@@ -7668,7 +7720,7 @@ var require_function = __commonJSMin((exports, module) => {
|
|
|
7668
7720
|
rules: {
|
|
7669
7721
|
arity: {
|
|
7670
7722
|
method(n$4) {
|
|
7671
|
-
assert$
|
|
7723
|
+
assert$33(Number.isSafeInteger(n$4) && n$4 >= 0, "n must be a positive integer");
|
|
7672
7724
|
return this.$_addRule({
|
|
7673
7725
|
name: "arity",
|
|
7674
7726
|
args: { n: n$4 }
|
|
@@ -7690,7 +7742,7 @@ var require_function = __commonJSMin((exports, module) => {
|
|
|
7690
7742
|
},
|
|
7691
7743
|
minArity: {
|
|
7692
7744
|
method(n$4) {
|
|
7693
|
-
assert$
|
|
7745
|
+
assert$33(Number.isSafeInteger(n$4) && n$4 > 0, "n must be a strict positive integer");
|
|
7694
7746
|
return this.$_addRule({
|
|
7695
7747
|
name: "minArity",
|
|
7696
7748
|
args: { n: n$4 }
|
|
@@ -7703,7 +7755,7 @@ var require_function = __commonJSMin((exports, module) => {
|
|
|
7703
7755
|
},
|
|
7704
7756
|
maxArity: {
|
|
7705
7757
|
method(n$4) {
|
|
7706
|
-
assert$
|
|
7758
|
+
assert$33(Number.isSafeInteger(n$4) && n$4 >= 0, "n must be a positive integer");
|
|
7707
7759
|
return this.$_addRule({
|
|
7708
7760
|
name: "maxArity",
|
|
7709
7761
|
args: { n: n$4 }
|
|
@@ -7724,7 +7776,7 @@ var require_function = __commonJSMin((exports, module) => {
|
|
|
7724
7776
|
});
|
|
7725
7777
|
});
|
|
7726
7778
|
var require_link = __commonJSMin((exports, module) => {
|
|
7727
|
-
const { assert: assert$
|
|
7779
|
+
const { assert: assert$32 } = require_lib$4();
|
|
7728
7780
|
const Any$4 = require_any();
|
|
7729
7781
|
const Common$7 = require_common$3();
|
|
7730
7782
|
const Compile$2 = require_compile();
|
|
@@ -7742,7 +7794,7 @@ var require_link = __commonJSMin((exports, module) => {
|
|
|
7742
7794
|
return schema$2.ref(ref);
|
|
7743
7795
|
},
|
|
7744
7796
|
validate(value, { schema: schema$2, state, prefs }) {
|
|
7745
|
-
assert$
|
|
7797
|
+
assert$32(schema$2.$_terms.link, "Uninitialized link schema");
|
|
7746
7798
|
const linked = internals$7.generate(schema$2, value, state, prefs);
|
|
7747
7799
|
const ref = schema$2.$_terms.link[0].ref;
|
|
7748
7800
|
return linked.$_validate(value, state.nest(linked, `link:${ref.display}:${linked.type}`), prefs);
|
|
@@ -7752,10 +7804,10 @@ var require_link = __commonJSMin((exports, module) => {
|
|
|
7752
7804
|
},
|
|
7753
7805
|
rules: {
|
|
7754
7806
|
ref: { method(ref) {
|
|
7755
|
-
assert$
|
|
7807
|
+
assert$32(!this.$_terms.link, "Cannot reinitialize schema");
|
|
7756
7808
|
ref = Compile$2.ref(ref);
|
|
7757
|
-
assert$
|
|
7758
|
-
assert$
|
|
7809
|
+
assert$32(ref.type === "value" || ref.type === "local", "Invalid reference type:", ref.type);
|
|
7810
|
+
assert$32(ref.type === "local" || ref.ancestor === "root" || ref.ancestor > 0, "Link cannot reference itself");
|
|
7759
7811
|
const obj = this.clone();
|
|
7760
7812
|
obj.$_terms.link = [{ ref }];
|
|
7761
7813
|
return obj;
|
|
@@ -7765,16 +7817,16 @@ var require_link = __commonJSMin((exports, module) => {
|
|
|
7765
7817
|
} }
|
|
7766
7818
|
},
|
|
7767
7819
|
overrides: { concat(source) {
|
|
7768
|
-
assert$
|
|
7769
|
-
assert$
|
|
7770
|
-
assert$
|
|
7820
|
+
assert$32(this.$_terms.link, "Uninitialized link schema");
|
|
7821
|
+
assert$32(Common$7.isSchema(source), "Invalid schema object");
|
|
7822
|
+
assert$32(source.type !== "link", "Cannot merge type link with another link");
|
|
7771
7823
|
const obj = this.clone();
|
|
7772
7824
|
if (!obj.$_terms.whens) obj.$_terms.whens = [];
|
|
7773
7825
|
obj.$_terms.whens.push({ concat: source });
|
|
7774
7826
|
return obj.$_mutateRebuild();
|
|
7775
7827
|
} },
|
|
7776
7828
|
manifest: { build(obj, desc$1) {
|
|
7777
|
-
assert$
|
|
7829
|
+
assert$32(desc$1.link, "Invalid link description missing link");
|
|
7778
7830
|
return obj.ref(desc$1.link);
|
|
7779
7831
|
} }
|
|
7780
7832
|
});
|
|
@@ -7824,11 +7876,11 @@ var require_link = __commonJSMin((exports, module) => {
|
|
|
7824
7876
|
};
|
|
7825
7877
|
internals$7.assert = function(condition, message, ref, schema$2, state, prefs) {
|
|
7826
7878
|
if (condition) return;
|
|
7827
|
-
assert$
|
|
7879
|
+
assert$32(false, `"${Errors$2.label(schema$2._flags, state, prefs)}" contains link reference "${ref.display}" ${message}`);
|
|
7828
7880
|
};
|
|
7829
7881
|
});
|
|
7830
7882
|
var require_number = __commonJSMin((exports, module) => {
|
|
7831
|
-
const { assert: assert$
|
|
7883
|
+
const { assert: assert$31 } = require_lib$4();
|
|
7832
7884
|
const Any$3 = require_any();
|
|
7833
7885
|
const Common$6 = require_common$3();
|
|
7834
7886
|
const internals$6 = {
|
|
@@ -8004,7 +8056,7 @@ var require_number = __commonJSMin((exports, module) => {
|
|
|
8004
8056
|
} },
|
|
8005
8057
|
precision: {
|
|
8006
8058
|
method(limit) {
|
|
8007
|
-
assert$
|
|
8059
|
+
assert$31(Number.isSafeInteger(limit), "limit must be an integer");
|
|
8008
8060
|
return this.$_addRule({
|
|
8009
8061
|
name: "precision",
|
|
8010
8062
|
args: { limit }
|
|
@@ -8023,7 +8075,7 @@ var require_number = __commonJSMin((exports, module) => {
|
|
|
8023
8075
|
},
|
|
8024
8076
|
sign: {
|
|
8025
8077
|
method(sign$2) {
|
|
8026
|
-
assert$
|
|
8078
|
+
assert$31(["negative", "positive"].includes(sign$2), "Invalid sign", sign$2);
|
|
8027
8079
|
return this.$_addRule({
|
|
8028
8080
|
name: "sign",
|
|
8029
8081
|
args: { sign: sign$2 }
|
|
@@ -8035,7 +8087,7 @@ var require_number = __commonJSMin((exports, module) => {
|
|
|
8035
8087
|
}
|
|
8036
8088
|
},
|
|
8037
8089
|
unsafe: { method(enabled = true) {
|
|
8038
|
-
assert$
|
|
8090
|
+
assert$31(typeof enabled === "boolean", "enabled must be a boolean");
|
|
8039
8091
|
return this.$_setFlag("unsafe", enabled);
|
|
8040
8092
|
} }
|
|
8041
8093
|
},
|
|
@@ -9369,10 +9421,10 @@ var require_types = __commonJSMin((exports) => {
|
|
|
9369
9421
|
exports.isArgumentsObject = isArgumentsObject;
|
|
9370
9422
|
exports.isGeneratorFunction = isGeneratorFunction;
|
|
9371
9423
|
exports.isTypedArray = isTypedArray$7;
|
|
9372
|
-
function isPromise$
|
|
9424
|
+
function isPromise$1(input) {
|
|
9373
9425
|
return typeof Promise !== "undefined" && input instanceof Promise || input !== null && typeof input === "object" && typeof input.then === "function" && typeof input.catch === "function";
|
|
9374
9426
|
}
|
|
9375
|
-
exports.isPromise = isPromise$
|
|
9427
|
+
exports.isPromise = isPromise$1;
|
|
9376
9428
|
function isArrayBufferView$1(value) {
|
|
9377
9429
|
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) return ArrayBuffer.isView(value);
|
|
9378
9430
|
return isTypedArray$7(value) || isDataView(value);
|
|
@@ -10056,31 +10108,6 @@ var init_email = __esmMin(() => {
|
|
|
10056
10108
|
"(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})"
|
|
10057
10109
|
].join("|"));
|
|
10058
10110
|
});
|
|
10059
|
-
var import_applyToDefaults, import_assert, import_bench, import_block, import_clone, import_contain, import_deepEqual, import_assertError, import_escapeHeaderAttribute, import_escapeHtml, import_escapeJson, import_escapeRegex, import_flatten, import_ignore, import_intersect, import_isPromise, import_merge, import_once, import_reach, import_reachTemplate, import_stringify, import_wait;
|
|
10060
|
-
var init_lib = __esmMin(() => {
|
|
10061
|
-
import_applyToDefaults = __toESM(require_applyToDefaults(), 1);
|
|
10062
|
-
import_assert = __toESM(require_assert$1(), 1);
|
|
10063
|
-
import_bench = __toESM(require_bench(), 1);
|
|
10064
|
-
import_block = __toESM(require_block(), 1);
|
|
10065
|
-
import_clone = __toESM(require_clone$1(), 1);
|
|
10066
|
-
import_contain = __toESM(require_contain(), 1);
|
|
10067
|
-
import_deepEqual = __toESM(require_deepEqual(), 1);
|
|
10068
|
-
import_assertError = __toESM(require_assertError(), 1);
|
|
10069
|
-
import_escapeHeaderAttribute = __toESM(require_escapeHeaderAttribute(), 1);
|
|
10070
|
-
import_escapeHtml = __toESM(require_escapeHtml(), 1);
|
|
10071
|
-
import_escapeJson = __toESM(require_escapeJson(), 1);
|
|
10072
|
-
import_escapeRegex = __toESM(require_escapeRegex(), 1);
|
|
10073
|
-
import_flatten = __toESM(require_flatten$1(), 1);
|
|
10074
|
-
import_ignore = __toESM(require_ignore(), 1);
|
|
10075
|
-
import_intersect = __toESM(require_intersect(), 1);
|
|
10076
|
-
import_isPromise = __toESM(require_isPromise(), 1);
|
|
10077
|
-
import_merge = __toESM(require_merge(), 1);
|
|
10078
|
-
import_once = __toESM(require_once(), 1);
|
|
10079
|
-
import_reach = __toESM(require_reach(), 1);
|
|
10080
|
-
import_reachTemplate = __toESM(require_reachTemplate(), 1);
|
|
10081
|
-
import_stringify = __toESM(require_stringify(), 1);
|
|
10082
|
-
import_wait = __toESM(require_wait(), 1);
|
|
10083
|
-
});
|
|
10084
10111
|
function generate$1() {
|
|
10085
10112
|
const rfc3986$1 = {};
|
|
10086
10113
|
const hexDigit = "\\dA-Fa-f";
|
|
@@ -13703,20 +13730,6 @@ Object.defineProperty(import_errors$1.default, "template", { value: function(val
|
|
|
13703
13730
|
if (!messages$3[code$2]) return messages$3["*"];
|
|
13704
13731
|
return messages$3[code$2];
|
|
13705
13732
|
} });
|
|
13706
|
-
var import_manifest$1 = __toESM(require_manifest());
|
|
13707
|
-
const ManifestDescriptionCache = new WeakMap();
|
|
13708
|
-
const originalDescribe = import_manifest$1.default.describe;
|
|
13709
|
-
Object.defineProperty(import_manifest$1.default, "describe", {
|
|
13710
|
-
value: function(schema$2) {
|
|
13711
|
-
const cached = ManifestDescriptionCache.get(schema$2);
|
|
13712
|
-
if (cached) return cached;
|
|
13713
|
-
const result = originalDescribe.call(this, schema$2);
|
|
13714
|
-
ManifestDescriptionCache.set(schema$2, result);
|
|
13715
|
-
return result;
|
|
13716
|
-
},
|
|
13717
|
-
writable: true,
|
|
13718
|
-
configurable: true
|
|
13719
|
-
});
|
|
13720
13733
|
const json = (root$11) => {
|
|
13721
13734
|
return root$11;
|
|
13722
13735
|
};
|
|
@@ -45702,14 +45715,6 @@ var RootFactory = class RootFactory {
|
|
|
45702
45715
|
static generate(root$11, schema$2, args$1) {
|
|
45703
45716
|
(0, import_assert.default)(root$11, "Must be invoked on a Joi instance.");
|
|
45704
45717
|
const cloned = schema$2.clone();
|
|
45705
|
-
const originalDescribe$1 = cloned.describe.bind(cloned);
|
|
45706
|
-
cloned.describe = function() {
|
|
45707
|
-
const cached = RootFactory.$_cachedDescriptions.get(this);
|
|
45708
|
-
if (cached) return cached;
|
|
45709
|
-
const result = originalDescribe$1();
|
|
45710
|
-
RootFactory.$_cachedDescriptions.set(this, result);
|
|
45711
|
-
return result;
|
|
45712
|
-
};
|
|
45713
45718
|
cloned.$_root = root$11;
|
|
45714
45719
|
if (!cloned._definition.args || !args$1.length) return cloned;
|
|
45715
45720
|
return cloned._definition.args(cloned, ...args$1);
|
|
@@ -143176,7 +143181,7 @@ const encode = (schema$2, options = {}) => {
|
|
|
143176
143181
|
});
|
|
143177
143182
|
}
|
|
143178
143183
|
const json$1 = JSON.stringify({
|
|
143179
|
-
version: "0.1.0-master-
|
|
143184
|
+
version: "0.1.0-master-fe5983b7",
|
|
143180
143185
|
schema: description$2
|
|
143181
143186
|
}, (key, value) => {
|
|
143182
143187
|
if (typeof value === "bigint") return value.toString();
|
|
@@ -143224,9 +143229,9 @@ const decode = (base64, options = {}) => {
|
|
|
143224
143229
|
});
|
|
143225
143230
|
if (!isPlainObject(description$2) || !("version" in description$2) || !("schema" in description$2) || typeof description$2.version !== "string" || !isPlainObject(description$2.schema)) throw new TypeError("Not a valid encoded schema");
|
|
143226
143231
|
const { version: schemaVersion, schema: schema$2 } = description$2;
|
|
143227
|
-
if (import_semver.valid("0.1.0-master-
|
|
143232
|
+
if (import_semver.valid("0.1.0-master-fe5983b7")) {
|
|
143228
143233
|
if (!import_semver.valid(import_semver.coerce(schemaVersion))) throw new TypeError(`Invalid schema version: ${schemaVersion}`);
|
|
143229
|
-
if (import_semver.gt(import_semver.coerce(schemaVersion), "0.1.0-master-
|
|
143234
|
+
if (import_semver.gt(import_semver.coerce(schemaVersion), "0.1.0-master-fe5983b7")) throw new TypeError(`Schema version ${schemaVersion} is not compatible with current version 0.1.0-master-fe5983b7`);
|
|
143230
143235
|
}
|
|
143231
143236
|
return validator.build(schema$2);
|
|
143232
143237
|
};
|
|
@@ -144680,7 +144685,7 @@ init_esm();
|
|
|
144680
144685
|
var import_lib = __toESM(require_lib$3());
|
|
144681
144686
|
var import_lib$1 = __toESM(require_lib$2());
|
|
144682
144687
|
var import_lib$2 = __toESM(require_lib());
|
|
144683
|
-
const version = "0.1.0-master-
|
|
144688
|
+
const version = "0.1.0-master-fe5983b7";
|
|
144684
144689
|
Object.defineProperty(exports, "ValidationError", {
|
|
144685
144690
|
enumerable: true,
|
|
144686
144691
|
get: function() {
|