@nhtio/validation 0.1.0-master-649f9ed8 → 0.1.0-master-99c163e7
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 +12 -8
- package/index.cjs.map +1 -1
- package/index.mjs +15 -11
- package/index.mjs.map +1 -1
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -13726,9 +13726,10 @@ var RootFactory = class RootFactory {
|
|
|
13726
13726
|
}
|
|
13727
13727
|
static generate(root, schema, args$1) {
|
|
13728
13728
|
(0, import_assert.default)(root, "Must be invoked on a Joi instance.");
|
|
13729
|
-
|
|
13730
|
-
|
|
13731
|
-
|
|
13729
|
+
const cloned = schema.clone();
|
|
13730
|
+
cloned.$_root = root;
|
|
13731
|
+
if (!cloned._definition.args || !args$1.length) return cloned;
|
|
13732
|
+
return cloned._definition.args(cloned, ...args$1);
|
|
13732
13733
|
}
|
|
13733
13734
|
static expandExtension(extension, joi) {
|
|
13734
13735
|
if (typeof extension.type === "string") return [extension];
|
|
@@ -13827,7 +13828,10 @@ var RootFactory = class RootFactory {
|
|
|
13827
13828
|
"object"
|
|
13828
13829
|
].includes(type), "The", type, "type does not allow arguments");
|
|
13829
13830
|
let schema = RootFactory.types[type];
|
|
13830
|
-
if (options.schemaTypeModifiers?.length)
|
|
13831
|
+
if (options.schemaTypeModifiers?.length) {
|
|
13832
|
+
for (const modifier of options.schemaTypeModifiers) schema = modifier(schema, this, args$1);
|
|
13833
|
+
if (type === "link" && args$1.length && schema.$_root) return schema;
|
|
13834
|
+
}
|
|
13831
13835
|
return RootFactory.generate(this, schema, args$1);
|
|
13832
13836
|
};
|
|
13833
13837
|
let shortcuts = [
|
|
@@ -111129,7 +111133,7 @@ const encode = (schema, options = {}) => {
|
|
|
111129
111133
|
});
|
|
111130
111134
|
}
|
|
111131
111135
|
const json$1 = JSON.stringify({
|
|
111132
|
-
version: "0.1.0-master-
|
|
111136
|
+
version: "0.1.0-master-99c163e7",
|
|
111133
111137
|
schema: description$1
|
|
111134
111138
|
}, (key, value) => {
|
|
111135
111139
|
if (typeof value === "bigint") return value.toString();
|
|
@@ -111177,9 +111181,9 @@ const decode = (base64, options = {}) => {
|
|
|
111177
111181
|
});
|
|
111178
111182
|
if (!isPlainObject(description$1) || !("version" in description$1) || !("schema" in description$1) || typeof description$1.version !== "string" || !isPlainObject(description$1.schema)) throw new TypeError("Not a valid encoded schema");
|
|
111179
111183
|
const { version: schemaVersion, schema } = description$1;
|
|
111180
|
-
if (import_semver.valid("0.1.0-master-
|
|
111184
|
+
if (import_semver.valid("0.1.0-master-99c163e7")) {
|
|
111181
111185
|
if (!import_semver.valid(import_semver.coerce(schemaVersion))) throw new TypeError(`Invalid schema version: ${schemaVersion}`);
|
|
111182
|
-
if (import_semver.gt(import_semver.coerce(schemaVersion), "0.1.0-master-
|
|
111186
|
+
if (import_semver.gt(import_semver.coerce(schemaVersion), "0.1.0-master-99c163e7")) throw new TypeError(`Schema version ${schemaVersion} is not compatible with current version 0.1.0-master-99c163e7`);
|
|
111183
111187
|
}
|
|
111184
111188
|
return validator.build(schema);
|
|
111185
111189
|
};
|
|
@@ -112633,7 +112637,7 @@ init_esm();
|
|
|
112633
112637
|
var import_lib = __toESM(require_lib$3());
|
|
112634
112638
|
var import_lib$1 = __toESM(require_lib$2());
|
|
112635
112639
|
var import_lib$2 = __toESM(require_lib());
|
|
112636
|
-
const version = "0.1.0-master-
|
|
112640
|
+
const version = "0.1.0-master-99c163e7";
|
|
112637
112641
|
Object.defineProperty(exports, "ValidationError", {
|
|
112638
112642
|
enumerable: true,
|
|
112639
112643
|
get: function() {
|