Refactor routing in App component to enhance navigation and improve error handling by integrating dynamic routes and updating the NotFound route.
This commit is contained in:
21
node_modules/zod/LICENSE
generated
vendored
Normal file
21
node_modules/zod/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 Colin McDonnell
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
22
node_modules/zod/dist/cjs/index.js
generated
vendored
Normal file
22
node_modules/zod/dist/cjs/index.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const index_js_1 = __importDefault(require("./v3/index.js"));
|
||||
__exportStar(require("./v3/index.js"), exports);
|
||||
exports.default = index_js_1.default;
|
||||
3
node_modules/zod/dist/cjs/package.json
generated
vendored
Normal file
3
node_modules/zod/dist/cjs/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "commonjs"
|
||||
}
|
||||
137
node_modules/zod/dist/cjs/v3/ZodError.js
generated
vendored
Normal file
137
node_modules/zod/dist/cjs/v3/ZodError.js
generated
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ZodError = exports.quotelessJson = exports.ZodIssueCode = void 0;
|
||||
const util_js_1 = require("./helpers/util.js");
|
||||
exports.ZodIssueCode = util_js_1.util.arrayToEnum([
|
||||
"invalid_type",
|
||||
"invalid_literal",
|
||||
"custom",
|
||||
"invalid_union",
|
||||
"invalid_union_discriminator",
|
||||
"invalid_enum_value",
|
||||
"unrecognized_keys",
|
||||
"invalid_arguments",
|
||||
"invalid_return_type",
|
||||
"invalid_date",
|
||||
"invalid_string",
|
||||
"too_small",
|
||||
"too_big",
|
||||
"invalid_intersection_types",
|
||||
"not_multiple_of",
|
||||
"not_finite",
|
||||
]);
|
||||
const quotelessJson = (obj) => {
|
||||
const json = JSON.stringify(obj, null, 2);
|
||||
return json.replace(/"([^"]+)":/g, "$1:");
|
||||
};
|
||||
exports.quotelessJson = quotelessJson;
|
||||
class ZodError extends Error {
|
||||
get errors() {
|
||||
return this.issues;
|
||||
}
|
||||
constructor(issues) {
|
||||
super();
|
||||
this.issues = [];
|
||||
this.addIssue = (sub) => {
|
||||
this.issues = [...this.issues, sub];
|
||||
};
|
||||
this.addIssues = (subs = []) => {
|
||||
this.issues = [...this.issues, ...subs];
|
||||
};
|
||||
const actualProto = new.target.prototype;
|
||||
if (Object.setPrototypeOf) {
|
||||
// eslint-disable-next-line ban/ban
|
||||
Object.setPrototypeOf(this, actualProto);
|
||||
}
|
||||
else {
|
||||
this.__proto__ = actualProto;
|
||||
}
|
||||
this.name = "ZodError";
|
||||
this.issues = issues;
|
||||
}
|
||||
format(_mapper) {
|
||||
const mapper = _mapper ||
|
||||
function (issue) {
|
||||
return issue.message;
|
||||
};
|
||||
const fieldErrors = { _errors: [] };
|
||||
const processError = (error) => {
|
||||
for (const issue of error.issues) {
|
||||
if (issue.code === "invalid_union") {
|
||||
issue.unionErrors.map(processError);
|
||||
}
|
||||
else if (issue.code === "invalid_return_type") {
|
||||
processError(issue.returnTypeError);
|
||||
}
|
||||
else if (issue.code === "invalid_arguments") {
|
||||
processError(issue.argumentsError);
|
||||
}
|
||||
else if (issue.path.length === 0) {
|
||||
fieldErrors._errors.push(mapper(issue));
|
||||
}
|
||||
else {
|
||||
let curr = fieldErrors;
|
||||
let i = 0;
|
||||
while (i < issue.path.length) {
|
||||
const el = issue.path[i];
|
||||
const terminal = i === issue.path.length - 1;
|
||||
if (!terminal) {
|
||||
curr[el] = curr[el] || { _errors: [] };
|
||||
// if (typeof el === "string") {
|
||||
// curr[el] = curr[el] || { _errors: [] };
|
||||
// } else if (typeof el === "number") {
|
||||
// const errorArray: any = [];
|
||||
// errorArray._errors = [];
|
||||
// curr[el] = curr[el] || errorArray;
|
||||
// }
|
||||
}
|
||||
else {
|
||||
curr[el] = curr[el] || { _errors: [] };
|
||||
curr[el]._errors.push(mapper(issue));
|
||||
}
|
||||
curr = curr[el];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
processError(this);
|
||||
return fieldErrors;
|
||||
}
|
||||
static assert(value) {
|
||||
if (!(value instanceof ZodError)) {
|
||||
throw new Error(`Not a ZodError: ${value}`);
|
||||
}
|
||||
}
|
||||
toString() {
|
||||
return this.message;
|
||||
}
|
||||
get message() {
|
||||
return JSON.stringify(this.issues, util_js_1.util.jsonStringifyReplacer, 2);
|
||||
}
|
||||
get isEmpty() {
|
||||
return this.issues.length === 0;
|
||||
}
|
||||
flatten(mapper = (issue) => issue.message) {
|
||||
const fieldErrors = {};
|
||||
const formErrors = [];
|
||||
for (const sub of this.issues) {
|
||||
if (sub.path.length > 0) {
|
||||
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
||||
fieldErrors[sub.path[0]].push(mapper(sub));
|
||||
}
|
||||
else {
|
||||
formErrors.push(mapper(sub));
|
||||
}
|
||||
}
|
||||
return { formErrors, fieldErrors };
|
||||
}
|
||||
get formErrors() {
|
||||
return this.flatten();
|
||||
}
|
||||
}
|
||||
exports.ZodError = ZodError;
|
||||
ZodError.create = (issues) => {
|
||||
const error = new ZodError(issues);
|
||||
return error;
|
||||
};
|
||||
54
node_modules/zod/dist/cjs/v3/benchmarks/datetime.js
generated
vendored
Normal file
54
node_modules/zod/dist/cjs/v3/benchmarks/datetime.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const benchmark_1 = __importDefault(require("benchmark"));
|
||||
const datetimeValidationSuite = new benchmark_1.default.Suite("datetime");
|
||||
const DATA = "2021-01-01";
|
||||
const MONTHS_31 = new Set([1, 3, 5, 7, 8, 10, 12]);
|
||||
const MONTHS_30 = new Set([4, 6, 9, 11]);
|
||||
const simpleDatetimeRegex = /^(\d{4})-(\d{2})-(\d{2})$/;
|
||||
const datetimeRegexNoLeapYearValidation = /^\d{4}-((0[13578]|10|12)-31|(0[13-9]|1[0-2])-30|(0[1-9]|1[0-2])-(0[1-9]|1\d|2\d))$/;
|
||||
const datetimeRegexWithLeapYearValidation = /^((\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\d|3[01])|(0[469]|11)-(0[1-9]|[12]\d|30)|(02)-(0[1-9]|1\d|2[0-8])))$/;
|
||||
datetimeValidationSuite
|
||||
.add("new Date()", () => {
|
||||
return !Number.isNaN(new Date(DATA).getTime());
|
||||
})
|
||||
.add("regex (no validation)", () => {
|
||||
return simpleDatetimeRegex.test(DATA);
|
||||
})
|
||||
.add("regex (no leap year)", () => {
|
||||
return datetimeRegexNoLeapYearValidation.test(DATA);
|
||||
})
|
||||
.add("regex (w/ leap year)", () => {
|
||||
return datetimeRegexWithLeapYearValidation.test(DATA);
|
||||
})
|
||||
.add("capture groups + code", () => {
|
||||
const match = DATA.match(simpleDatetimeRegex);
|
||||
if (!match)
|
||||
return false;
|
||||
// Extract year, month, and day from the capture groups
|
||||
const year = Number.parseInt(match[1], 10);
|
||||
const month = Number.parseInt(match[2], 10); // month is 0-indexed in JavaScript Date, so subtract 1
|
||||
const day = Number.parseInt(match[3], 10);
|
||||
if (month === 2) {
|
||||
if ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0) {
|
||||
return day <= 29;
|
||||
}
|
||||
return day <= 28;
|
||||
}
|
||||
if (MONTHS_30.has(month)) {
|
||||
return day <= 30;
|
||||
}
|
||||
if (MONTHS_31.has(month)) {
|
||||
return day <= 31;
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.on("cycle", (e) => {
|
||||
console.log(`${datetimeValidationSuite.name}: ${e.target}`);
|
||||
});
|
||||
exports.default = {
|
||||
suites: [datetimeValidationSuite],
|
||||
};
|
||||
79
node_modules/zod/dist/cjs/v3/benchmarks/discriminatedUnion.js
generated
vendored
Normal file
79
node_modules/zod/dist/cjs/v3/benchmarks/discriminatedUnion.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const benchmark_1 = __importDefault(require("benchmark"));
|
||||
const v3_1 = require("zod/v3");
|
||||
const doubleSuite = new benchmark_1.default.Suite("z.discriminatedUnion: double");
|
||||
const manySuite = new benchmark_1.default.Suite("z.discriminatedUnion: many");
|
||||
const aSchema = v3_1.z.object({
|
||||
type: v3_1.z.literal("a"),
|
||||
});
|
||||
const objA = {
|
||||
type: "a",
|
||||
};
|
||||
const bSchema = v3_1.z.object({
|
||||
type: v3_1.z.literal("b"),
|
||||
});
|
||||
const objB = {
|
||||
type: "b",
|
||||
};
|
||||
const cSchema = v3_1.z.object({
|
||||
type: v3_1.z.literal("c"),
|
||||
});
|
||||
const objC = {
|
||||
type: "c",
|
||||
};
|
||||
const dSchema = v3_1.z.object({
|
||||
type: v3_1.z.literal("d"),
|
||||
});
|
||||
const double = v3_1.z.discriminatedUnion("type", [aSchema, bSchema]);
|
||||
const many = v3_1.z.discriminatedUnion("type", [aSchema, bSchema, cSchema, dSchema]);
|
||||
doubleSuite
|
||||
.add("valid: a", () => {
|
||||
double.parse(objA);
|
||||
})
|
||||
.add("valid: b", () => {
|
||||
double.parse(objB);
|
||||
})
|
||||
.add("invalid: null", () => {
|
||||
try {
|
||||
double.parse(null);
|
||||
}
|
||||
catch (_err) { }
|
||||
})
|
||||
.add("invalid: wrong shape", () => {
|
||||
try {
|
||||
double.parse(objC);
|
||||
}
|
||||
catch (_err) { }
|
||||
})
|
||||
.on("cycle", (e) => {
|
||||
console.log(`${doubleSuite.name}: ${e.target}`);
|
||||
});
|
||||
manySuite
|
||||
.add("valid: a", () => {
|
||||
many.parse(objA);
|
||||
})
|
||||
.add("valid: c", () => {
|
||||
many.parse(objC);
|
||||
})
|
||||
.add("invalid: null", () => {
|
||||
try {
|
||||
many.parse(null);
|
||||
}
|
||||
catch (_err) { }
|
||||
})
|
||||
.add("invalid: wrong shape", () => {
|
||||
try {
|
||||
many.parse({ type: "unknown" });
|
||||
}
|
||||
catch (_err) { }
|
||||
})
|
||||
.on("cycle", (e) => {
|
||||
console.log(`${manySuite.name}: ${e.target}`);
|
||||
});
|
||||
exports.default = {
|
||||
suites: [doubleSuite, manySuite],
|
||||
};
|
||||
59
node_modules/zod/dist/cjs/v3/benchmarks/index.js
generated
vendored
Normal file
59
node_modules/zod/dist/cjs/v3/benchmarks/index.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const datetime_js_1 = __importDefault(require("./datetime.js"));
|
||||
const discriminatedUnion_js_1 = __importDefault(require("./discriminatedUnion.js"));
|
||||
const ipv4_js_1 = __importDefault(require("./ipv4.js"));
|
||||
const object_js_1 = __importDefault(require("./object.js"));
|
||||
const primitives_js_1 = __importDefault(require("./primitives.js"));
|
||||
const realworld_js_1 = __importDefault(require("./realworld.js"));
|
||||
const string_js_1 = __importDefault(require("./string.js"));
|
||||
const union_js_1 = __importDefault(require("./union.js"));
|
||||
const argv = process.argv.slice(2);
|
||||
let suites = [];
|
||||
if (!argv.length) {
|
||||
suites = [
|
||||
...realworld_js_1.default.suites,
|
||||
...primitives_js_1.default.suites,
|
||||
...string_js_1.default.suites,
|
||||
...object_js_1.default.suites,
|
||||
...union_js_1.default.suites,
|
||||
...discriminatedUnion_js_1.default.suites,
|
||||
];
|
||||
}
|
||||
else {
|
||||
if (argv.includes("--realworld")) {
|
||||
suites.push(...realworld_js_1.default.suites);
|
||||
}
|
||||
if (argv.includes("--primitives")) {
|
||||
suites.push(...primitives_js_1.default.suites);
|
||||
}
|
||||
if (argv.includes("--string")) {
|
||||
suites.push(...string_js_1.default.suites);
|
||||
}
|
||||
if (argv.includes("--object")) {
|
||||
suites.push(...object_js_1.default.suites);
|
||||
}
|
||||
if (argv.includes("--union")) {
|
||||
suites.push(...union_js_1.default.suites);
|
||||
}
|
||||
if (argv.includes("--discriminatedUnion")) {
|
||||
suites.push(...datetime_js_1.default.suites);
|
||||
}
|
||||
if (argv.includes("--datetime")) {
|
||||
suites.push(...datetime_js_1.default.suites);
|
||||
}
|
||||
if (argv.includes("--ipv4")) {
|
||||
suites.push(...ipv4_js_1.default.suites);
|
||||
}
|
||||
}
|
||||
for (const suite of suites) {
|
||||
suite.run({});
|
||||
}
|
||||
// exit on Ctrl-C
|
||||
process.on("SIGINT", function () {
|
||||
console.log("Exiting...");
|
||||
process.exit();
|
||||
});
|
||||
54
node_modules/zod/dist/cjs/v3/benchmarks/ipv4.js
generated
vendored
Normal file
54
node_modules/zod/dist/cjs/v3/benchmarks/ipv4.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const benchmark_1 = __importDefault(require("benchmark"));
|
||||
const suite = new benchmark_1.default.Suite("ipv4");
|
||||
const DATA = "127.0.0.1";
|
||||
const ipv4RegexA = /^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/;
|
||||
const ipv4RegexB = /^(?:(?:(?=(25[0-5]))\1|(?=(2[0-4][0-9]))\2|(?=(1[0-9]{2}))\3|(?=([0-9]{1,2}))\4)\.){3}(?:(?=(25[0-5]))\5|(?=(2[0-4][0-9]))\6|(?=(1[0-9]{2}))\7|(?=([0-9]{1,2}))\8)$/;
|
||||
const ipv4RegexC = /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/;
|
||||
const ipv4RegexD = /^(\b25[0-5]|\b2[0-4][0-9]|\b[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/;
|
||||
const ipv4RegexE = /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.){3}(25[0-5]|(2[0-4]|1\d|[1-9]|)\d)$/;
|
||||
const ipv4RegexF = /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$/;
|
||||
const ipv4RegexG = /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$/;
|
||||
const ipv4RegexH = /^((25[0-5]|(2[0-4]|1[0-9]|[1-9]|)[0-9])(\.(?!$)|$)){4}$/;
|
||||
const ipv4RegexI = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
||||
suite
|
||||
.add("A", () => {
|
||||
return ipv4RegexA.test(DATA);
|
||||
})
|
||||
.add("B", () => {
|
||||
return ipv4RegexB.test(DATA);
|
||||
})
|
||||
.add("C", () => {
|
||||
return ipv4RegexC.test(DATA);
|
||||
})
|
||||
.add("D", () => {
|
||||
return ipv4RegexD.test(DATA);
|
||||
})
|
||||
.add("E", () => {
|
||||
return ipv4RegexE.test(DATA);
|
||||
})
|
||||
.add("F", () => {
|
||||
return ipv4RegexF.test(DATA);
|
||||
})
|
||||
.add("G", () => {
|
||||
return ipv4RegexG.test(DATA);
|
||||
})
|
||||
.add("H", () => {
|
||||
return ipv4RegexH.test(DATA);
|
||||
})
|
||||
.add("I", () => {
|
||||
return ipv4RegexI.test(DATA);
|
||||
})
|
||||
.on("cycle", (e) => {
|
||||
console.log(`${suite.name}: ${e.target}`);
|
||||
});
|
||||
exports.default = {
|
||||
suites: [suite],
|
||||
};
|
||||
if (require.main === module) {
|
||||
suite.run();
|
||||
}
|
||||
70
node_modules/zod/dist/cjs/v3/benchmarks/object.js
generated
vendored
Normal file
70
node_modules/zod/dist/cjs/v3/benchmarks/object.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const benchmark_1 = __importDefault(require("benchmark"));
|
||||
const v3_1 = require("zod/v3");
|
||||
const emptySuite = new benchmark_1.default.Suite("z.object: empty");
|
||||
const shortSuite = new benchmark_1.default.Suite("z.object: short");
|
||||
const longSuite = new benchmark_1.default.Suite("z.object: long");
|
||||
const empty = v3_1.z.object({});
|
||||
const short = v3_1.z.object({
|
||||
string: v3_1.z.string(),
|
||||
});
|
||||
const long = v3_1.z.object({
|
||||
string: v3_1.z.string(),
|
||||
number: v3_1.z.number(),
|
||||
boolean: v3_1.z.boolean(),
|
||||
});
|
||||
emptySuite
|
||||
.add("valid", () => {
|
||||
empty.parse({});
|
||||
})
|
||||
.add("valid: extra keys", () => {
|
||||
empty.parse({ string: "string" });
|
||||
})
|
||||
.add("invalid: null", () => {
|
||||
try {
|
||||
empty.parse(null);
|
||||
}
|
||||
catch (_err) { }
|
||||
})
|
||||
.on("cycle", (e) => {
|
||||
console.log(`${emptySuite.name}: ${e.target}`);
|
||||
});
|
||||
shortSuite
|
||||
.add("valid", () => {
|
||||
short.parse({ string: "string" });
|
||||
})
|
||||
.add("valid: extra keys", () => {
|
||||
short.parse({ string: "string", number: 42 });
|
||||
})
|
||||
.add("invalid: null", () => {
|
||||
try {
|
||||
short.parse(null);
|
||||
}
|
||||
catch (_err) { }
|
||||
})
|
||||
.on("cycle", (e) => {
|
||||
console.log(`${shortSuite.name}: ${e.target}`);
|
||||
});
|
||||
longSuite
|
||||
.add("valid", () => {
|
||||
long.parse({ string: "string", number: 42, boolean: true });
|
||||
})
|
||||
.add("valid: extra keys", () => {
|
||||
long.parse({ string: "string", number: 42, boolean: true, list: [] });
|
||||
})
|
||||
.add("invalid: null", () => {
|
||||
try {
|
||||
long.parse(null);
|
||||
}
|
||||
catch (_err) { }
|
||||
})
|
||||
.on("cycle", (e) => {
|
||||
console.log(`${longSuite.name}: ${e.target}`);
|
||||
});
|
||||
exports.default = {
|
||||
suites: [emptySuite, shortSuite, longSuite],
|
||||
};
|
||||
159
node_modules/zod/dist/cjs/v3/benchmarks/primitives.js
generated
vendored
Normal file
159
node_modules/zod/dist/cjs/v3/benchmarks/primitives.js
generated
vendored
Normal file
@@ -0,0 +1,159 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const benchmark_1 = __importDefault(require("benchmark"));
|
||||
const v3_1 = require("zod/v3");
|
||||
const Mocker_js_1 = require("../tests/Mocker.js");
|
||||
const val = new Mocker_js_1.Mocker();
|
||||
const enumSuite = new benchmark_1.default.Suite("z.enum");
|
||||
const enumSchema = v3_1.z.enum(["a", "b", "c"]);
|
||||
enumSuite
|
||||
.add("valid", () => {
|
||||
enumSchema.parse("a");
|
||||
})
|
||||
.add("invalid", () => {
|
||||
try {
|
||||
enumSchema.parse("x");
|
||||
}
|
||||
catch (_e) { }
|
||||
})
|
||||
.on("cycle", (e) => {
|
||||
console.log(`z.enum: ${e.target}`);
|
||||
});
|
||||
const longEnumSuite = new benchmark_1.default.Suite("long z.enum");
|
||||
const longEnumSchema = v3_1.z.enum([
|
||||
"one",
|
||||
"two",
|
||||
"three",
|
||||
"four",
|
||||
"five",
|
||||
"six",
|
||||
"seven",
|
||||
"eight",
|
||||
"nine",
|
||||
"ten",
|
||||
"eleven",
|
||||
"twelve",
|
||||
"thirteen",
|
||||
"fourteen",
|
||||
"fifteen",
|
||||
"sixteen",
|
||||
"seventeen",
|
||||
]);
|
||||
longEnumSuite
|
||||
.add("valid", () => {
|
||||
longEnumSchema.parse("five");
|
||||
})
|
||||
.add("invalid", () => {
|
||||
try {
|
||||
longEnumSchema.parse("invalid");
|
||||
}
|
||||
catch (_e) { }
|
||||
})
|
||||
.on("cycle", (e) => {
|
||||
console.log(`long z.enum: ${e.target}`);
|
||||
});
|
||||
const undefinedSuite = new benchmark_1.default.Suite("z.undefined");
|
||||
const undefinedSchema = v3_1.z.undefined();
|
||||
undefinedSuite
|
||||
.add("valid", () => {
|
||||
undefinedSchema.parse(undefined);
|
||||
})
|
||||
.add("invalid", () => {
|
||||
try {
|
||||
undefinedSchema.parse(1);
|
||||
}
|
||||
catch (_e) { }
|
||||
})
|
||||
.on("cycle", (e) => {
|
||||
console.log(`z.undefined: ${e.target}`);
|
||||
});
|
||||
const literalSuite = new benchmark_1.default.Suite("z.literal");
|
||||
const short = "short";
|
||||
const bad = "bad";
|
||||
const literalSchema = v3_1.z.literal("short");
|
||||
literalSuite
|
||||
.add("valid", () => {
|
||||
literalSchema.parse(short);
|
||||
})
|
||||
.add("invalid", () => {
|
||||
try {
|
||||
literalSchema.parse(bad);
|
||||
}
|
||||
catch (_e) { }
|
||||
})
|
||||
.on("cycle", (e) => {
|
||||
console.log(`z.literal: ${e.target}`);
|
||||
});
|
||||
const numberSuite = new benchmark_1.default.Suite("z.number");
|
||||
const numberSchema = v3_1.z.number().int();
|
||||
numberSuite
|
||||
.add("valid", () => {
|
||||
numberSchema.parse(1);
|
||||
})
|
||||
.add("invalid type", () => {
|
||||
try {
|
||||
numberSchema.parse("bad");
|
||||
}
|
||||
catch (_e) { }
|
||||
})
|
||||
.add("invalid number", () => {
|
||||
try {
|
||||
numberSchema.parse(0.5);
|
||||
}
|
||||
catch (_e) { }
|
||||
})
|
||||
.on("cycle", (e) => {
|
||||
console.log(`z.number: ${e.target}`);
|
||||
});
|
||||
const dateSuite = new benchmark_1.default.Suite("z.date");
|
||||
const plainDate = v3_1.z.date();
|
||||
const minMaxDate = v3_1.z.date().min(new Date("2021-01-01")).max(new Date("2030-01-01"));
|
||||
dateSuite
|
||||
.add("valid", () => {
|
||||
plainDate.parse(new Date());
|
||||
})
|
||||
.add("invalid", () => {
|
||||
try {
|
||||
plainDate.parse(1);
|
||||
}
|
||||
catch (_e) { }
|
||||
})
|
||||
.add("valid min and max", () => {
|
||||
minMaxDate.parse(new Date("2023-01-01"));
|
||||
})
|
||||
.add("invalid min", () => {
|
||||
try {
|
||||
minMaxDate.parse(new Date("2019-01-01"));
|
||||
}
|
||||
catch (_e) { }
|
||||
})
|
||||
.add("invalid max", () => {
|
||||
try {
|
||||
minMaxDate.parse(new Date("2031-01-01"));
|
||||
}
|
||||
catch (_e) { }
|
||||
})
|
||||
.on("cycle", (e) => {
|
||||
console.log(`z.date: ${e.target}`);
|
||||
});
|
||||
const symbolSuite = new benchmark_1.default.Suite("z.symbol");
|
||||
const symbolSchema = v3_1.z.symbol();
|
||||
symbolSuite
|
||||
.add("valid", () => {
|
||||
symbolSchema.parse(val.symbol);
|
||||
})
|
||||
.add("invalid", () => {
|
||||
try {
|
||||
symbolSchema.parse(1);
|
||||
}
|
||||
catch (_e) { }
|
||||
})
|
||||
.on("cycle", (e) => {
|
||||
console.log(`z.symbol: ${e.target}`);
|
||||
});
|
||||
exports.default = {
|
||||
suites: [enumSuite, longEnumSuite, undefinedSuite, literalSuite, numberSuite, dateSuite, symbolSuite],
|
||||
};
|
||||
56
node_modules/zod/dist/cjs/v3/benchmarks/realworld.js
generated
vendored
Normal file
56
node_modules/zod/dist/cjs/v3/benchmarks/realworld.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const benchmark_1 = __importDefault(require("benchmark"));
|
||||
const v3_1 = require("zod/v3");
|
||||
const shortSuite = new benchmark_1.default.Suite("realworld");
|
||||
const People = v3_1.z.array(v3_1.z.object({
|
||||
type: v3_1.z.literal("person"),
|
||||
hair: v3_1.z.enum(["blue", "brown"]),
|
||||
active: v3_1.z.boolean(),
|
||||
name: v3_1.z.string(),
|
||||
age: v3_1.z.number().int(),
|
||||
hobbies: v3_1.z.array(v3_1.z.string()),
|
||||
address: v3_1.z.object({
|
||||
street: v3_1.z.string(),
|
||||
zip: v3_1.z.string(),
|
||||
country: v3_1.z.string(),
|
||||
}),
|
||||
}));
|
||||
let i = 0;
|
||||
function num() {
|
||||
return ++i;
|
||||
}
|
||||
function str() {
|
||||
return (++i % 100).toString(16);
|
||||
}
|
||||
function array(fn) {
|
||||
return Array.from({ length: ++i % 10 }, () => fn());
|
||||
}
|
||||
const people = Array.from({ length: 100 }, () => {
|
||||
return {
|
||||
type: "person",
|
||||
hair: i % 2 ? "blue" : "brown",
|
||||
active: !!(i % 2),
|
||||
name: str(),
|
||||
age: num(),
|
||||
hobbies: array(str),
|
||||
address: {
|
||||
street: str(),
|
||||
zip: str(),
|
||||
country: str(),
|
||||
},
|
||||
};
|
||||
});
|
||||
shortSuite
|
||||
.add("valid", () => {
|
||||
People.parse(people);
|
||||
})
|
||||
.on("cycle", (e) => {
|
||||
console.log(`${shortSuite.name}: ${e.target}`);
|
||||
});
|
||||
exports.default = {
|
||||
suites: [shortSuite],
|
||||
};
|
||||
55
node_modules/zod/dist/cjs/v3/benchmarks/string.js
generated
vendored
Normal file
55
node_modules/zod/dist/cjs/v3/benchmarks/string.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const benchmark_1 = __importDefault(require("benchmark"));
|
||||
const v3_1 = require("zod/v3");
|
||||
const SUITE_NAME = "z.string";
|
||||
const suite = new benchmark_1.default.Suite(SUITE_NAME);
|
||||
const empty = "";
|
||||
const short = "short";
|
||||
const long = "long".repeat(256);
|
||||
const manual = (str) => {
|
||||
if (typeof str !== "string") {
|
||||
throw new Error("Not a string");
|
||||
}
|
||||
return str;
|
||||
};
|
||||
const stringSchema = v3_1.z.string();
|
||||
const optionalStringSchema = v3_1.z.string().optional();
|
||||
const optionalNullableStringSchema = v3_1.z.string().optional().nullable();
|
||||
suite
|
||||
.add("empty string", () => {
|
||||
stringSchema.parse(empty);
|
||||
})
|
||||
.add("short string", () => {
|
||||
stringSchema.parse(short);
|
||||
})
|
||||
.add("long string", () => {
|
||||
stringSchema.parse(long);
|
||||
})
|
||||
.add("optional string", () => {
|
||||
optionalStringSchema.parse(long);
|
||||
})
|
||||
.add("nullable string", () => {
|
||||
optionalNullableStringSchema.parse(long);
|
||||
})
|
||||
.add("nullable (null) string", () => {
|
||||
optionalNullableStringSchema.parse(null);
|
||||
})
|
||||
.add("invalid: null", () => {
|
||||
try {
|
||||
stringSchema.parse(null);
|
||||
}
|
||||
catch (_err) { }
|
||||
})
|
||||
.add("manual parser: long", () => {
|
||||
manual(long);
|
||||
})
|
||||
.on("cycle", (e) => {
|
||||
console.log(`${SUITE_NAME}: ${e.target}`);
|
||||
});
|
||||
exports.default = {
|
||||
suites: [suite],
|
||||
};
|
||||
79
node_modules/zod/dist/cjs/v3/benchmarks/union.js
generated
vendored
Normal file
79
node_modules/zod/dist/cjs/v3/benchmarks/union.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const benchmark_1 = __importDefault(require("benchmark"));
|
||||
const v3_1 = require("zod/v3");
|
||||
const doubleSuite = new benchmark_1.default.Suite("z.union: double");
|
||||
const manySuite = new benchmark_1.default.Suite("z.union: many");
|
||||
const aSchema = v3_1.z.object({
|
||||
type: v3_1.z.literal("a"),
|
||||
});
|
||||
const objA = {
|
||||
type: "a",
|
||||
};
|
||||
const bSchema = v3_1.z.object({
|
||||
type: v3_1.z.literal("b"),
|
||||
});
|
||||
const objB = {
|
||||
type: "b",
|
||||
};
|
||||
const cSchema = v3_1.z.object({
|
||||
type: v3_1.z.literal("c"),
|
||||
});
|
||||
const objC = {
|
||||
type: "c",
|
||||
};
|
||||
const dSchema = v3_1.z.object({
|
||||
type: v3_1.z.literal("d"),
|
||||
});
|
||||
const double = v3_1.z.union([aSchema, bSchema]);
|
||||
const many = v3_1.z.union([aSchema, bSchema, cSchema, dSchema]);
|
||||
doubleSuite
|
||||
.add("valid: a", () => {
|
||||
double.parse(objA);
|
||||
})
|
||||
.add("valid: b", () => {
|
||||
double.parse(objB);
|
||||
})
|
||||
.add("invalid: null", () => {
|
||||
try {
|
||||
double.parse(null);
|
||||
}
|
||||
catch (_err) { }
|
||||
})
|
||||
.add("invalid: wrong shape", () => {
|
||||
try {
|
||||
double.parse(objC);
|
||||
}
|
||||
catch (_err) { }
|
||||
})
|
||||
.on("cycle", (e) => {
|
||||
console.log(`${doubleSuite.name}: ${e.target}`);
|
||||
});
|
||||
manySuite
|
||||
.add("valid: a", () => {
|
||||
many.parse(objA);
|
||||
})
|
||||
.add("valid: c", () => {
|
||||
many.parse(objC);
|
||||
})
|
||||
.add("invalid: null", () => {
|
||||
try {
|
||||
many.parse(null);
|
||||
}
|
||||
catch (_err) { }
|
||||
})
|
||||
.add("invalid: wrong shape", () => {
|
||||
try {
|
||||
many.parse({ type: "unknown" });
|
||||
}
|
||||
catch (_err) { }
|
||||
})
|
||||
.on("cycle", (e) => {
|
||||
console.log(`${manySuite.name}: ${e.target}`);
|
||||
});
|
||||
exports.default = {
|
||||
suites: [doubleSuite, manySuite],
|
||||
};
|
||||
17
node_modules/zod/dist/cjs/v3/errors.js
generated
vendored
Normal file
17
node_modules/zod/dist/cjs/v3/errors.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.defaultErrorMap = void 0;
|
||||
exports.setErrorMap = setErrorMap;
|
||||
exports.getErrorMap = getErrorMap;
|
||||
const en_js_1 = __importDefault(require("./locales/en.js"));
|
||||
exports.defaultErrorMap = en_js_1.default;
|
||||
let overrideErrorMap = en_js_1.default;
|
||||
function setErrorMap(map) {
|
||||
overrideErrorMap = map;
|
||||
}
|
||||
function getErrorMap() {
|
||||
return overrideErrorMap;
|
||||
}
|
||||
22
node_modules/zod/dist/cjs/v3/external.js
generated
vendored
Normal file
22
node_modules/zod/dist/cjs/v3/external.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./errors.js"), exports);
|
||||
__exportStar(require("./helpers/parseUtil.js"), exports);
|
||||
__exportStar(require("./helpers/typeAliases.js"), exports);
|
||||
__exportStar(require("./helpers/util.js"), exports);
|
||||
__exportStar(require("./types.js"), exports);
|
||||
__exportStar(require("./ZodError.js"), exports);
|
||||
2
node_modules/zod/dist/cjs/v3/helpers/enumUtil.js
generated
vendored
Normal file
2
node_modules/zod/dist/cjs/v3/helpers/enumUtil.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
9
node_modules/zod/dist/cjs/v3/helpers/errorUtil.js
generated
vendored
Normal file
9
node_modules/zod/dist/cjs/v3/helpers/errorUtil.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.errorUtil = void 0;
|
||||
var errorUtil;
|
||||
(function (errorUtil) {
|
||||
errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
||||
// biome-ignore lint:
|
||||
errorUtil.toString = (message) => typeof message === "string" ? message : message?.message;
|
||||
})(errorUtil || (exports.errorUtil = errorUtil = {}));
|
||||
124
node_modules/zod/dist/cjs/v3/helpers/parseUtil.js
generated
vendored
Normal file
124
node_modules/zod/dist/cjs/v3/helpers/parseUtil.js
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isAsync = exports.isValid = exports.isDirty = exports.isAborted = exports.OK = exports.DIRTY = exports.INVALID = exports.ParseStatus = exports.EMPTY_PATH = exports.makeIssue = void 0;
|
||||
exports.addIssueToContext = addIssueToContext;
|
||||
const errors_js_1 = require("../errors.js");
|
||||
const en_js_1 = __importDefault(require("../locales/en.js"));
|
||||
const makeIssue = (params) => {
|
||||
const { data, path, errorMaps, issueData } = params;
|
||||
const fullPath = [...path, ...(issueData.path || [])];
|
||||
const fullIssue = {
|
||||
...issueData,
|
||||
path: fullPath,
|
||||
};
|
||||
if (issueData.message !== undefined) {
|
||||
return {
|
||||
...issueData,
|
||||
path: fullPath,
|
||||
message: issueData.message,
|
||||
};
|
||||
}
|
||||
let errorMessage = "";
|
||||
const maps = errorMaps
|
||||
.filter((m) => !!m)
|
||||
.slice()
|
||||
.reverse();
|
||||
for (const map of maps) {
|
||||
errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
|
||||
}
|
||||
return {
|
||||
...issueData,
|
||||
path: fullPath,
|
||||
message: errorMessage,
|
||||
};
|
||||
};
|
||||
exports.makeIssue = makeIssue;
|
||||
exports.EMPTY_PATH = [];
|
||||
function addIssueToContext(ctx, issueData) {
|
||||
const overrideMap = (0, errors_js_1.getErrorMap)();
|
||||
const issue = (0, exports.makeIssue)({
|
||||
issueData: issueData,
|
||||
data: ctx.data,
|
||||
path: ctx.path,
|
||||
errorMaps: [
|
||||
ctx.common.contextualErrorMap, // contextual error map is first priority
|
||||
ctx.schemaErrorMap, // then schema-bound map if available
|
||||
overrideMap, // then global override map
|
||||
overrideMap === en_js_1.default ? undefined : en_js_1.default, // then global default map
|
||||
].filter((x) => !!x),
|
||||
});
|
||||
ctx.common.issues.push(issue);
|
||||
}
|
||||
class ParseStatus {
|
||||
constructor() {
|
||||
this.value = "valid";
|
||||
}
|
||||
dirty() {
|
||||
if (this.value === "valid")
|
||||
this.value = "dirty";
|
||||
}
|
||||
abort() {
|
||||
if (this.value !== "aborted")
|
||||
this.value = "aborted";
|
||||
}
|
||||
static mergeArray(status, results) {
|
||||
const arrayValue = [];
|
||||
for (const s of results) {
|
||||
if (s.status === "aborted")
|
||||
return exports.INVALID;
|
||||
if (s.status === "dirty")
|
||||
status.dirty();
|
||||
arrayValue.push(s.value);
|
||||
}
|
||||
return { status: status.value, value: arrayValue };
|
||||
}
|
||||
static async mergeObjectAsync(status, pairs) {
|
||||
const syncPairs = [];
|
||||
for (const pair of pairs) {
|
||||
const key = await pair.key;
|
||||
const value = await pair.value;
|
||||
syncPairs.push({
|
||||
key,
|
||||
value,
|
||||
});
|
||||
}
|
||||
return ParseStatus.mergeObjectSync(status, syncPairs);
|
||||
}
|
||||
static mergeObjectSync(status, pairs) {
|
||||
const finalObject = {};
|
||||
for (const pair of pairs) {
|
||||
const { key, value } = pair;
|
||||
if (key.status === "aborted")
|
||||
return exports.INVALID;
|
||||
if (value.status === "aborted")
|
||||
return exports.INVALID;
|
||||
if (key.status === "dirty")
|
||||
status.dirty();
|
||||
if (value.status === "dirty")
|
||||
status.dirty();
|
||||
if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
|
||||
finalObject[key.value] = value.value;
|
||||
}
|
||||
}
|
||||
return { status: status.value, value: finalObject };
|
||||
}
|
||||
}
|
||||
exports.ParseStatus = ParseStatus;
|
||||
exports.INVALID = Object.freeze({
|
||||
status: "aborted",
|
||||
});
|
||||
const DIRTY = (value) => ({ status: "dirty", value });
|
||||
exports.DIRTY = DIRTY;
|
||||
const OK = (value) => ({ status: "valid", value });
|
||||
exports.OK = OK;
|
||||
const isAborted = (x) => x.status === "aborted";
|
||||
exports.isAborted = isAborted;
|
||||
const isDirty = (x) => x.status === "dirty";
|
||||
exports.isDirty = isDirty;
|
||||
const isValid = (x) => x.status === "valid";
|
||||
exports.isValid = isValid;
|
||||
const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
||||
exports.isAsync = isAsync;
|
||||
2
node_modules/zod/dist/cjs/v3/helpers/partialUtil.js
generated
vendored
Normal file
2
node_modules/zod/dist/cjs/v3/helpers/partialUtil.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
2
node_modules/zod/dist/cjs/v3/helpers/typeAliases.js
generated
vendored
Normal file
2
node_modules/zod/dist/cjs/v3/helpers/typeAliases.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
137
node_modules/zod/dist/cjs/v3/helpers/util.js
generated
vendored
Normal file
137
node_modules/zod/dist/cjs/v3/helpers/util.js
generated
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getParsedType = exports.ZodParsedType = exports.objectUtil = exports.util = void 0;
|
||||
var util;
|
||||
(function (util) {
|
||||
util.assertEqual = (_) => { };
|
||||
function assertIs(_arg) { }
|
||||
util.assertIs = assertIs;
|
||||
function assertNever(_x) {
|
||||
throw new Error();
|
||||
}
|
||||
util.assertNever = assertNever;
|
||||
util.arrayToEnum = (items) => {
|
||||
const obj = {};
|
||||
for (const item of items) {
|
||||
obj[item] = item;
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
util.getValidEnumValues = (obj) => {
|
||||
const validKeys = util.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
|
||||
const filtered = {};
|
||||
for (const k of validKeys) {
|
||||
filtered[k] = obj[k];
|
||||
}
|
||||
return util.objectValues(filtered);
|
||||
};
|
||||
util.objectValues = (obj) => {
|
||||
return util.objectKeys(obj).map(function (e) {
|
||||
return obj[e];
|
||||
});
|
||||
};
|
||||
util.objectKeys = typeof Object.keys === "function" // eslint-disable-line ban/ban
|
||||
? (obj) => Object.keys(obj) // eslint-disable-line ban/ban
|
||||
: (object) => {
|
||||
const keys = [];
|
||||
for (const key in object) {
|
||||
if (Object.prototype.hasOwnProperty.call(object, key)) {
|
||||
keys.push(key);
|
||||
}
|
||||
}
|
||||
return keys;
|
||||
};
|
||||
util.find = (arr, checker) => {
|
||||
for (const item of arr) {
|
||||
if (checker(item))
|
||||
return item;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
util.isInteger = typeof Number.isInteger === "function"
|
||||
? (val) => Number.isInteger(val) // eslint-disable-line ban/ban
|
||||
: (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
|
||||
function joinValues(array, separator = " | ") {
|
||||
return array.map((val) => (typeof val === "string" ? `'${val}'` : val)).join(separator);
|
||||
}
|
||||
util.joinValues = joinValues;
|
||||
util.jsonStringifyReplacer = (_, value) => {
|
||||
if (typeof value === "bigint") {
|
||||
return value.toString();
|
||||
}
|
||||
return value;
|
||||
};
|
||||
})(util || (exports.util = util = {}));
|
||||
var objectUtil;
|
||||
(function (objectUtil) {
|
||||
objectUtil.mergeShapes = (first, second) => {
|
||||
return {
|
||||
...first,
|
||||
...second, // second overwrites first
|
||||
};
|
||||
};
|
||||
})(objectUtil || (exports.objectUtil = objectUtil = {}));
|
||||
exports.ZodParsedType = util.arrayToEnum([
|
||||
"string",
|
||||
"nan",
|
||||
"number",
|
||||
"integer",
|
||||
"float",
|
||||
"boolean",
|
||||
"date",
|
||||
"bigint",
|
||||
"symbol",
|
||||
"function",
|
||||
"undefined",
|
||||
"null",
|
||||
"array",
|
||||
"object",
|
||||
"unknown",
|
||||
"promise",
|
||||
"void",
|
||||
"never",
|
||||
"map",
|
||||
"set",
|
||||
]);
|
||||
const getParsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "undefined":
|
||||
return exports.ZodParsedType.undefined;
|
||||
case "string":
|
||||
return exports.ZodParsedType.string;
|
||||
case "number":
|
||||
return Number.isNaN(data) ? exports.ZodParsedType.nan : exports.ZodParsedType.number;
|
||||
case "boolean":
|
||||
return exports.ZodParsedType.boolean;
|
||||
case "function":
|
||||
return exports.ZodParsedType.function;
|
||||
case "bigint":
|
||||
return exports.ZodParsedType.bigint;
|
||||
case "symbol":
|
||||
return exports.ZodParsedType.symbol;
|
||||
case "object":
|
||||
if (Array.isArray(data)) {
|
||||
return exports.ZodParsedType.array;
|
||||
}
|
||||
if (data === null) {
|
||||
return exports.ZodParsedType.null;
|
||||
}
|
||||
if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
|
||||
return exports.ZodParsedType.promise;
|
||||
}
|
||||
if (typeof Map !== "undefined" && data instanceof Map) {
|
||||
return exports.ZodParsedType.map;
|
||||
}
|
||||
if (typeof Set !== "undefined" && data instanceof Set) {
|
||||
return exports.ZodParsedType.set;
|
||||
}
|
||||
if (typeof Date !== "undefined" && data instanceof Date) {
|
||||
return exports.ZodParsedType.date;
|
||||
}
|
||||
return exports.ZodParsedType.object;
|
||||
default:
|
||||
return exports.ZodParsedType.unknown;
|
||||
}
|
||||
};
|
||||
exports.getParsedType = getParsedType;
|
||||
33
node_modules/zod/dist/cjs/v3/index.js
generated
vendored
Normal file
33
node_modules/zod/dist/cjs/v3/index.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.z = void 0;
|
||||
const z = __importStar(require("./external.js"));
|
||||
exports.z = z;
|
||||
__exportStar(require("./external.js"), exports);
|
||||
exports.default = z;
|
||||
109
node_modules/zod/dist/cjs/v3/locales/en.js
generated
vendored
Normal file
109
node_modules/zod/dist/cjs/v3/locales/en.js
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const ZodError_js_1 = require("../ZodError.js");
|
||||
const util_js_1 = require("../helpers/util.js");
|
||||
const errorMap = (issue, _ctx) => {
|
||||
let message;
|
||||
switch (issue.code) {
|
||||
case ZodError_js_1.ZodIssueCode.invalid_type:
|
||||
if (issue.received === util_js_1.ZodParsedType.undefined) {
|
||||
message = "Required";
|
||||
}
|
||||
else {
|
||||
message = `Expected ${issue.expected}, received ${issue.received}`;
|
||||
}
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.invalid_literal:
|
||||
message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util_js_1.util.jsonStringifyReplacer)}`;
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.unrecognized_keys:
|
||||
message = `Unrecognized key(s) in object: ${util_js_1.util.joinValues(issue.keys, ", ")}`;
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.invalid_union:
|
||||
message = `Invalid input`;
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.invalid_union_discriminator:
|
||||
message = `Invalid discriminator value. Expected ${util_js_1.util.joinValues(issue.options)}`;
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.invalid_enum_value:
|
||||
message = `Invalid enum value. Expected ${util_js_1.util.joinValues(issue.options)}, received '${issue.received}'`;
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.invalid_arguments:
|
||||
message = `Invalid function arguments`;
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.invalid_return_type:
|
||||
message = `Invalid function return type`;
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.invalid_date:
|
||||
message = `Invalid date`;
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.invalid_string:
|
||||
if (typeof issue.validation === "object") {
|
||||
if ("includes" in issue.validation) {
|
||||
message = `Invalid input: must include "${issue.validation.includes}"`;
|
||||
if (typeof issue.validation.position === "number") {
|
||||
message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
|
||||
}
|
||||
}
|
||||
else if ("startsWith" in issue.validation) {
|
||||
message = `Invalid input: must start with "${issue.validation.startsWith}"`;
|
||||
}
|
||||
else if ("endsWith" in issue.validation) {
|
||||
message = `Invalid input: must end with "${issue.validation.endsWith}"`;
|
||||
}
|
||||
else {
|
||||
util_js_1.util.assertNever(issue.validation);
|
||||
}
|
||||
}
|
||||
else if (issue.validation !== "regex") {
|
||||
message = `Invalid ${issue.validation}`;
|
||||
}
|
||||
else {
|
||||
message = "Invalid";
|
||||
}
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.too_small:
|
||||
if (issue.type === "array")
|
||||
message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
|
||||
else if (issue.type === "string")
|
||||
message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
|
||||
else if (issue.type === "number")
|
||||
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
||||
else if (issue.type === "date")
|
||||
message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
|
||||
else
|
||||
message = "Invalid input";
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.too_big:
|
||||
if (issue.type === "array")
|
||||
message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
|
||||
else if (issue.type === "string")
|
||||
message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
|
||||
else if (issue.type === "number")
|
||||
message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
||||
else if (issue.type === "bigint")
|
||||
message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
||||
else if (issue.type === "date")
|
||||
message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
|
||||
else
|
||||
message = "Invalid input";
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.custom:
|
||||
message = `Invalid input`;
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.invalid_intersection_types:
|
||||
message = `Intersection results could not be merged`;
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.not_multiple_of:
|
||||
message = `Number must be a multiple of ${issue.multipleOf}`;
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.not_finite:
|
||||
message = "Number must be finite";
|
||||
break;
|
||||
default:
|
||||
message = _ctx.defaultError;
|
||||
util_js_1.util.assertNever(issue);
|
||||
}
|
||||
return { message };
|
||||
};
|
||||
exports.default = errorMap;
|
||||
2
node_modules/zod/dist/cjs/v3/standard-schema.js
generated
vendored
Normal file
2
node_modules/zod/dist/cjs/v3/standard-schema.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
57
node_modules/zod/dist/cjs/v3/tests/Mocker.js
generated
vendored
Normal file
57
node_modules/zod/dist/cjs/v3/tests/Mocker.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Mocker = void 0;
|
||||
function getRandomInt(max) {
|
||||
return Math.floor(Math.random() * Math.floor(max));
|
||||
}
|
||||
const testSymbol = Symbol("test");
|
||||
class Mocker {
|
||||
constructor() {
|
||||
this.pick = (...args) => {
|
||||
return args[getRandomInt(args.length)];
|
||||
};
|
||||
}
|
||||
get string() {
|
||||
return Math.random().toString(36).substring(7);
|
||||
}
|
||||
get number() {
|
||||
return Math.random() * 100;
|
||||
}
|
||||
get bigint() {
|
||||
return BigInt(Math.floor(Math.random() * 10000));
|
||||
}
|
||||
get boolean() {
|
||||
return Math.random() < 0.5;
|
||||
}
|
||||
get date() {
|
||||
return new Date(Math.floor(Date.now() * Math.random()));
|
||||
}
|
||||
get symbol() {
|
||||
return testSymbol;
|
||||
}
|
||||
get null() {
|
||||
return null;
|
||||
}
|
||||
get undefined() {
|
||||
return undefined;
|
||||
}
|
||||
get stringOptional() {
|
||||
return this.pick(this.string, this.undefined);
|
||||
}
|
||||
get stringNullable() {
|
||||
return this.pick(this.string, this.null);
|
||||
}
|
||||
get numberOptional() {
|
||||
return this.pick(this.number, this.undefined);
|
||||
}
|
||||
get numberNullable() {
|
||||
return this.pick(this.number, this.null);
|
||||
}
|
||||
get booleanOptional() {
|
||||
return this.pick(this.boolean, this.undefined);
|
||||
}
|
||||
get booleanNullable() {
|
||||
return this.pick(this.boolean, this.null);
|
||||
}
|
||||
}
|
||||
exports.Mocker = Mocker;
|
||||
3795
node_modules/zod/dist/cjs/v3/types.js
generated
vendored
Normal file
3795
node_modules/zod/dist/cjs/v3/types.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
32
node_modules/zod/dist/cjs/v4/classic/checks.js
generated
vendored
Normal file
32
node_modules/zod/dist/cjs/v4/classic/checks.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.toUpperCase = exports.toLowerCase = exports.trim = exports.normalize = exports.overwrite = exports.mime = exports.property = exports.endsWith = exports.startsWith = exports.includes = exports.uppercase = exports.lowercase = exports.regex = exports.length = exports.minLength = exports.maxLength = exports.size = exports.minSize = exports.maxSize = exports.multipleOf = exports.nonnegative = exports.nonpositive = exports.negative = exports.positive = exports.gte = exports.gt = exports.lte = exports.lt = void 0;
|
||||
var core_1 = require("zod/v4/core");
|
||||
Object.defineProperty(exports, "lt", { enumerable: true, get: function () { return core_1._lt; } });
|
||||
Object.defineProperty(exports, "lte", { enumerable: true, get: function () { return core_1._lte; } });
|
||||
Object.defineProperty(exports, "gt", { enumerable: true, get: function () { return core_1._gt; } });
|
||||
Object.defineProperty(exports, "gte", { enumerable: true, get: function () { return core_1._gte; } });
|
||||
Object.defineProperty(exports, "positive", { enumerable: true, get: function () { return core_1._positive; } });
|
||||
Object.defineProperty(exports, "negative", { enumerable: true, get: function () { return core_1._negative; } });
|
||||
Object.defineProperty(exports, "nonpositive", { enumerable: true, get: function () { return core_1._nonpositive; } });
|
||||
Object.defineProperty(exports, "nonnegative", { enumerable: true, get: function () { return core_1._nonnegative; } });
|
||||
Object.defineProperty(exports, "multipleOf", { enumerable: true, get: function () { return core_1._multipleOf; } });
|
||||
Object.defineProperty(exports, "maxSize", { enumerable: true, get: function () { return core_1._maxSize; } });
|
||||
Object.defineProperty(exports, "minSize", { enumerable: true, get: function () { return core_1._minSize; } });
|
||||
Object.defineProperty(exports, "size", { enumerable: true, get: function () { return core_1._size; } });
|
||||
Object.defineProperty(exports, "maxLength", { enumerable: true, get: function () { return core_1._maxLength; } });
|
||||
Object.defineProperty(exports, "minLength", { enumerable: true, get: function () { return core_1._minLength; } });
|
||||
Object.defineProperty(exports, "length", { enumerable: true, get: function () { return core_1._length; } });
|
||||
Object.defineProperty(exports, "regex", { enumerable: true, get: function () { return core_1._regex; } });
|
||||
Object.defineProperty(exports, "lowercase", { enumerable: true, get: function () { return core_1._lowercase; } });
|
||||
Object.defineProperty(exports, "uppercase", { enumerable: true, get: function () { return core_1._uppercase; } });
|
||||
Object.defineProperty(exports, "includes", { enumerable: true, get: function () { return core_1._includes; } });
|
||||
Object.defineProperty(exports, "startsWith", { enumerable: true, get: function () { return core_1._startsWith; } });
|
||||
Object.defineProperty(exports, "endsWith", { enumerable: true, get: function () { return core_1._endsWith; } });
|
||||
Object.defineProperty(exports, "property", { enumerable: true, get: function () { return core_1._property; } });
|
||||
Object.defineProperty(exports, "mime", { enumerable: true, get: function () { return core_1._mime; } });
|
||||
Object.defineProperty(exports, "overwrite", { enumerable: true, get: function () { return core_1._overwrite; } });
|
||||
Object.defineProperty(exports, "normalize", { enumerable: true, get: function () { return core_1._normalize; } });
|
||||
Object.defineProperty(exports, "trim", { enumerable: true, get: function () { return core_1._trim; } });
|
||||
Object.defineProperty(exports, "toLowerCase", { enumerable: true, get: function () { return core_1._toLowerCase; } });
|
||||
Object.defineProperty(exports, "toUpperCase", { enumerable: true, get: function () { return core_1._toUpperCase; } });
|
||||
47
node_modules/zod/dist/cjs/v4/classic/coerce.js
generated
vendored
Normal file
47
node_modules/zod/dist/cjs/v4/classic/coerce.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.string = string;
|
||||
exports.number = number;
|
||||
exports.boolean = boolean;
|
||||
exports.bigint = bigint;
|
||||
exports.date = date;
|
||||
const core = __importStar(require("zod/v4/core"));
|
||||
const schemas = __importStar(require("./schemas.js"));
|
||||
function string(params) {
|
||||
return core._coercedString(schemas.ZodString, params);
|
||||
}
|
||||
function number(params) {
|
||||
return core._coercedNumber(schemas.ZodNumber, params);
|
||||
}
|
||||
function boolean(params) {
|
||||
return core._coercedBoolean(schemas.ZodBoolean, params);
|
||||
}
|
||||
function bigint(params) {
|
||||
return core._coercedBigint(schemas.ZodBigInt, params);
|
||||
}
|
||||
function date(params) {
|
||||
return core._coercedDate(schemas.ZodDate, params);
|
||||
}
|
||||
63
node_modules/zod/dist/cjs/v4/classic/compat.js
generated
vendored
Normal file
63
node_modules/zod/dist/cjs/v4/classic/compat.js
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
"use strict";
|
||||
// Zod 3 compat layer
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.config = exports.$brand = exports.NEVER = exports.ZodIssueCode = void 0;
|
||||
exports.setErrorMap = setErrorMap;
|
||||
exports.getErrorMap = getErrorMap;
|
||||
const core = __importStar(require("zod/v4/core"));
|
||||
/** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
|
||||
exports.ZodIssueCode = {
|
||||
invalid_type: "invalid_type",
|
||||
too_big: "too_big",
|
||||
too_small: "too_small",
|
||||
invalid_format: "invalid_format",
|
||||
not_multiple_of: "not_multiple_of",
|
||||
unrecognized_keys: "unrecognized_keys",
|
||||
invalid_union: "invalid_union",
|
||||
invalid_key: "invalid_key",
|
||||
invalid_element: "invalid_element",
|
||||
invalid_value: "invalid_value",
|
||||
custom: "custom",
|
||||
};
|
||||
/** @deprecated Not necessary in Zod 4. */
|
||||
const INVALID = Object.freeze({
|
||||
status: "aborted",
|
||||
});
|
||||
/** A special constant with type `never` */
|
||||
exports.NEVER = INVALID;
|
||||
var core_1 = require("zod/v4/core");
|
||||
Object.defineProperty(exports, "$brand", { enumerable: true, get: function () { return core_1.$brand; } });
|
||||
Object.defineProperty(exports, "config", { enumerable: true, get: function () { return core_1.config; } });
|
||||
/** @deprecated Use `z.config(params)` instead. */
|
||||
function setErrorMap(map) {
|
||||
core.config({
|
||||
customError: map,
|
||||
});
|
||||
}
|
||||
/** @deprecated Use `z.config()` instead. */
|
||||
function getErrorMap() {
|
||||
return core.config().customError;
|
||||
}
|
||||
67
node_modules/zod/dist/cjs/v4/classic/errors.js
generated
vendored
Normal file
67
node_modules/zod/dist/cjs/v4/classic/errors.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ZodRealError = exports.ZodError = void 0;
|
||||
const core = __importStar(require("zod/v4/core"));
|
||||
const core_1 = require("zod/v4/core");
|
||||
const initializer = (inst, issues) => {
|
||||
core_1.$ZodError.init(inst, issues);
|
||||
inst.name = "ZodError";
|
||||
Object.defineProperties(inst, {
|
||||
format: {
|
||||
value: (mapper) => core.formatError(inst, mapper),
|
||||
// enumerable: false,
|
||||
},
|
||||
flatten: {
|
||||
value: (mapper) => core.flattenError(inst, mapper),
|
||||
// enumerable: false,
|
||||
},
|
||||
addIssue: {
|
||||
value: (issue) => inst.issues.push(issue),
|
||||
// enumerable: false,
|
||||
},
|
||||
addIssues: {
|
||||
value: (issues) => inst.issues.push(...issues),
|
||||
// enumerable: false,
|
||||
},
|
||||
isEmpty: {
|
||||
get() {
|
||||
return inst.issues.length === 0;
|
||||
},
|
||||
// enumerable: false,
|
||||
},
|
||||
});
|
||||
// Object.defineProperty(inst, "isEmpty", {
|
||||
// get() {
|
||||
// return inst.issues.length === 0;
|
||||
// },
|
||||
// });
|
||||
};
|
||||
exports.ZodError = core.$constructor("ZodError", initializer);
|
||||
exports.ZodRealError = core.$constructor("ZodError", initializer, {
|
||||
Parent: Error,
|
||||
});
|
||||
// /** @deprecated Use `z.core.$ZodErrorMapCtx` instead. */
|
||||
// export type ErrorMapCtx = core.$ZodErrorMapCtx;
|
||||
58
node_modules/zod/dist/cjs/v4/classic/external.js
generated
vendored
Normal file
58
node_modules/zod/dist/cjs/v4/classic/external.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.locales = exports.toJSONSchema = exports.flattenError = exports.formatError = exports.prettifyError = exports.treeifyError = exports.regexes = exports.clone = exports.$brand = exports.$input = exports.$output = exports.function = exports.config = exports.registry = exports.globalRegistry = exports.core = void 0;
|
||||
exports.core = __importStar(require("zod/v4/core"));
|
||||
__exportStar(require("./schemas.js"), exports);
|
||||
__exportStar(require("./checks.js"), exports);
|
||||
__exportStar(require("./errors.js"), exports);
|
||||
__exportStar(require("./parse.js"), exports);
|
||||
__exportStar(require("./compat.js"), exports);
|
||||
// zod-specified
|
||||
const core_1 = require("zod/v4/core");
|
||||
const en_js_1 = __importDefault(require("zod/v4/locales/en.js"));
|
||||
(0, core_1.config)((0, en_js_1.default)());
|
||||
var core_2 = require("zod/v4/core");
|
||||
Object.defineProperty(exports, "globalRegistry", { enumerable: true, get: function () { return core_2.globalRegistry; } });
|
||||
Object.defineProperty(exports, "registry", { enumerable: true, get: function () { return core_2.registry; } });
|
||||
Object.defineProperty(exports, "config", { enumerable: true, get: function () { return core_2.config; } });
|
||||
Object.defineProperty(exports, "function", { enumerable: true, get: function () { return core_2.function; } });
|
||||
Object.defineProperty(exports, "$output", { enumerable: true, get: function () { return core_2.$output; } });
|
||||
Object.defineProperty(exports, "$input", { enumerable: true, get: function () { return core_2.$input; } });
|
||||
Object.defineProperty(exports, "$brand", { enumerable: true, get: function () { return core_2.$brand; } });
|
||||
Object.defineProperty(exports, "clone", { enumerable: true, get: function () { return core_2.clone; } });
|
||||
Object.defineProperty(exports, "regexes", { enumerable: true, get: function () { return core_2.regexes; } });
|
||||
Object.defineProperty(exports, "treeifyError", { enumerable: true, get: function () { return core_2.treeifyError; } });
|
||||
Object.defineProperty(exports, "prettifyError", { enumerable: true, get: function () { return core_2.prettifyError; } });
|
||||
Object.defineProperty(exports, "formatError", { enumerable: true, get: function () { return core_2.formatError; } });
|
||||
Object.defineProperty(exports, "flattenError", { enumerable: true, get: function () { return core_2.flattenError; } });
|
||||
Object.defineProperty(exports, "toJSONSchema", { enumerable: true, get: function () { return core_2.toJSONSchema; } });
|
||||
Object.defineProperty(exports, "locales", { enumerable: true, get: function () { return core_2.locales; } });
|
||||
33
node_modules/zod/dist/cjs/v4/classic/index.js
generated
vendored
Normal file
33
node_modules/zod/dist/cjs/v4/classic/index.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.z = void 0;
|
||||
const z = __importStar(require("./external.js"));
|
||||
exports.z = z;
|
||||
__exportStar(require("./external.js"), exports);
|
||||
exports.default = z;
|
||||
60
node_modules/zod/dist/cjs/v4/classic/iso.js
generated
vendored
Normal file
60
node_modules/zod/dist/cjs/v4/classic/iso.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ZodISODuration = exports.ZodISOTime = exports.ZodISODate = exports.ZodISODateTime = void 0;
|
||||
exports.datetime = datetime;
|
||||
exports.date = date;
|
||||
exports.time = time;
|
||||
exports.duration = duration;
|
||||
const core = __importStar(require("zod/v4/core"));
|
||||
const schemas = __importStar(require("./schemas.js"));
|
||||
exports.ZodISODateTime = core.$constructor("ZodISODateTime", (inst, def) => {
|
||||
core.$ZodISODateTime.init(inst, def);
|
||||
schemas.ZodStringFormat.init(inst, def);
|
||||
});
|
||||
function datetime(params) {
|
||||
return core._isoDateTime(exports.ZodISODateTime, params);
|
||||
}
|
||||
exports.ZodISODate = core.$constructor("ZodISODate", (inst, def) => {
|
||||
core.$ZodISODate.init(inst, def);
|
||||
schemas.ZodStringFormat.init(inst, def);
|
||||
});
|
||||
function date(params) {
|
||||
return core._isoDate(exports.ZodISODate, params);
|
||||
}
|
||||
exports.ZodISOTime = core.$constructor("ZodISOTime", (inst, def) => {
|
||||
core.$ZodISOTime.init(inst, def);
|
||||
schemas.ZodStringFormat.init(inst, def);
|
||||
});
|
||||
function time(params) {
|
||||
return core._isoTime(exports.ZodISOTime, params);
|
||||
}
|
||||
exports.ZodISODuration = core.$constructor("ZodISODuration", (inst, def) => {
|
||||
core.$ZodISODuration.init(inst, def);
|
||||
schemas.ZodStringFormat.init(inst, def);
|
||||
});
|
||||
function duration(params) {
|
||||
return core._isoDuration(exports.ZodISODuration, params);
|
||||
}
|
||||
32
node_modules/zod/dist/cjs/v4/classic/parse.js
generated
vendored
Normal file
32
node_modules/zod/dist/cjs/v4/classic/parse.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.safeParseAsync = exports.safeParse = exports.parseAsync = exports.parse = void 0;
|
||||
const core = __importStar(require("zod/v4/core"));
|
||||
const errors_js_1 = require("./errors.js");
|
||||
exports.parse = core._parse(errors_js_1.ZodRealError);
|
||||
exports.parseAsync = core._parseAsync(errors_js_1.ZodRealError);
|
||||
exports.safeParse = core._safeParse(errors_js_1.ZodRealError);
|
||||
exports.safeParseAsync = core._safeParseAsync(errors_js_1.ZodRealError);
|
||||
1113
node_modules/zod/dist/cjs/v4/classic/schemas.js
generated
vendored
Normal file
1113
node_modules/zod/dist/cjs/v4/classic/schemas.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
998
node_modules/zod/dist/cjs/v4/core/api.js
generated
vendored
Normal file
998
node_modules/zod/dist/cjs/v4/core/api.js
generated
vendored
Normal file
@@ -0,0 +1,998 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports._string = _string;
|
||||
exports._coercedString = _coercedString;
|
||||
exports._email = _email;
|
||||
exports._guid = _guid;
|
||||
exports._uuid = _uuid;
|
||||
exports._uuidv4 = _uuidv4;
|
||||
exports._uuidv6 = _uuidv6;
|
||||
exports._uuidv7 = _uuidv7;
|
||||
exports._url = _url;
|
||||
exports._emoji = _emoji;
|
||||
exports._nanoid = _nanoid;
|
||||
exports._cuid = _cuid;
|
||||
exports._cuid2 = _cuid2;
|
||||
exports._ulid = _ulid;
|
||||
exports._xid = _xid;
|
||||
exports._ksuid = _ksuid;
|
||||
exports._ipv4 = _ipv4;
|
||||
exports._ipv6 = _ipv6;
|
||||
exports._cidrv4 = _cidrv4;
|
||||
exports._cidrv6 = _cidrv6;
|
||||
exports._base64 = _base64;
|
||||
exports._base64url = _base64url;
|
||||
exports._e164 = _e164;
|
||||
exports._jwt = _jwt;
|
||||
exports._isoDateTime = _isoDateTime;
|
||||
exports._isoDate = _isoDate;
|
||||
exports._isoTime = _isoTime;
|
||||
exports._isoDuration = _isoDuration;
|
||||
exports._number = _number;
|
||||
exports._coercedNumber = _coercedNumber;
|
||||
exports._int = _int;
|
||||
exports._float32 = _float32;
|
||||
exports._float64 = _float64;
|
||||
exports._int32 = _int32;
|
||||
exports._uint32 = _uint32;
|
||||
exports._boolean = _boolean;
|
||||
exports._coercedBoolean = _coercedBoolean;
|
||||
exports._bigint = _bigint;
|
||||
exports._coercedBigint = _coercedBigint;
|
||||
exports._int64 = _int64;
|
||||
exports._uint64 = _uint64;
|
||||
exports._symbol = _symbol;
|
||||
exports._undefined = _undefined;
|
||||
exports._null = _null;
|
||||
exports._any = _any;
|
||||
exports._unknown = _unknown;
|
||||
exports._never = _never;
|
||||
exports._void = _void;
|
||||
exports._date = _date;
|
||||
exports._coercedDate = _coercedDate;
|
||||
exports._nan = _nan;
|
||||
exports._lt = _lt;
|
||||
exports._lte = _lte;
|
||||
exports._max = _lte;
|
||||
exports._lte = _lte;
|
||||
exports._max = _lte;
|
||||
exports._gt = _gt;
|
||||
exports._gte = _gte;
|
||||
exports._min = _gte;
|
||||
exports._gte = _gte;
|
||||
exports._min = _gte;
|
||||
exports._positive = _positive;
|
||||
exports._negative = _negative;
|
||||
exports._nonpositive = _nonpositive;
|
||||
exports._nonnegative = _nonnegative;
|
||||
exports._multipleOf = _multipleOf;
|
||||
exports._maxSize = _maxSize;
|
||||
exports._minSize = _minSize;
|
||||
exports._size = _size;
|
||||
exports._maxLength = _maxLength;
|
||||
exports._minLength = _minLength;
|
||||
exports._length = _length;
|
||||
exports._regex = _regex;
|
||||
exports._lowercase = _lowercase;
|
||||
exports._uppercase = _uppercase;
|
||||
exports._includes = _includes;
|
||||
exports._startsWith = _startsWith;
|
||||
exports._endsWith = _endsWith;
|
||||
exports._property = _property;
|
||||
exports._mime = _mime;
|
||||
exports._overwrite = _overwrite;
|
||||
exports._normalize = _normalize;
|
||||
exports._trim = _trim;
|
||||
exports._toLowerCase = _toLowerCase;
|
||||
exports._toUpperCase = _toUpperCase;
|
||||
exports._array = _array;
|
||||
exports._union = _union;
|
||||
exports._discriminatedUnion = _discriminatedUnion;
|
||||
exports._intersection = _intersection;
|
||||
exports._tuple = _tuple;
|
||||
exports._record = _record;
|
||||
exports._map = _map;
|
||||
exports._set = _set;
|
||||
exports._enum = _enum;
|
||||
exports._nativeEnum = _nativeEnum;
|
||||
exports._literal = _literal;
|
||||
exports._file = _file;
|
||||
exports._transform = _transform;
|
||||
exports._optional = _optional;
|
||||
exports._nullable = _nullable;
|
||||
exports._default = _default;
|
||||
exports._nonoptional = _nonoptional;
|
||||
exports._success = _success;
|
||||
exports._catch = _catch;
|
||||
exports._pipe = _pipe;
|
||||
exports._readonly = _readonly;
|
||||
exports._templateLiteral = _templateLiteral;
|
||||
exports._lazy = _lazy;
|
||||
exports._promise = _promise;
|
||||
exports._custom = _custom;
|
||||
exports._refine = _refine;
|
||||
exports._stringbool = _stringbool;
|
||||
const checks = __importStar(require("./checks.js"));
|
||||
const schemas = __importStar(require("./schemas.js"));
|
||||
const util = __importStar(require("./util.js"));
|
||||
function _string(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _coercedString(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
coerce: true,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _email(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "email",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _guid(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "guid",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _uuid(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "uuid",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _uuidv4(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "uuid",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
version: "v4",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _uuidv6(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "uuid",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
version: "v6",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _uuidv7(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "uuid",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
version: "v7",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _url(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "url",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _emoji(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "emoji",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _nanoid(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "nanoid",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _cuid(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "cuid",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _cuid2(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "cuid2",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _ulid(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "ulid",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _xid(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "xid",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _ksuid(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "ksuid",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _ipv4(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "ipv4",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _ipv6(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "ipv6",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _cidrv4(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "cidrv4",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _cidrv6(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "cidrv6",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _base64(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "base64",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _base64url(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "base64url",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _e164(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "e164",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _jwt(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "jwt",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _isoDateTime(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "datetime",
|
||||
check: "string_format",
|
||||
offset: false,
|
||||
local: false,
|
||||
precision: null,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _isoDate(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "date",
|
||||
check: "string_format",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _isoTime(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "time",
|
||||
check: "string_format",
|
||||
precision: null,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _isoDuration(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "duration",
|
||||
check: "string_format",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _number(Class, params) {
|
||||
return new Class({
|
||||
type: "number",
|
||||
checks: [],
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _coercedNumber(Class, params) {
|
||||
return new Class({
|
||||
type: "number",
|
||||
coerce: true,
|
||||
checks: [],
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _int(Class, params) {
|
||||
return new Class({
|
||||
type: "number",
|
||||
check: "number_format",
|
||||
abort: false,
|
||||
format: "safeint",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _float32(Class, params) {
|
||||
return new Class({
|
||||
type: "number",
|
||||
check: "number_format",
|
||||
abort: false,
|
||||
format: "float32",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _float64(Class, params) {
|
||||
return new Class({
|
||||
type: "number",
|
||||
check: "number_format",
|
||||
abort: false,
|
||||
format: "float64",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _int32(Class, params) {
|
||||
return new Class({
|
||||
type: "number",
|
||||
check: "number_format",
|
||||
abort: false,
|
||||
format: "int32",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _uint32(Class, params) {
|
||||
return new Class({
|
||||
type: "number",
|
||||
check: "number_format",
|
||||
abort: false,
|
||||
format: "uint32",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _boolean(Class, params) {
|
||||
return new Class({
|
||||
type: "boolean",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _coercedBoolean(Class, params) {
|
||||
return new Class({
|
||||
type: "boolean",
|
||||
coerce: true,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _bigint(Class, params) {
|
||||
return new Class({
|
||||
type: "bigint",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _coercedBigint(Class, params) {
|
||||
return new Class({
|
||||
type: "bigint",
|
||||
coerce: true,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _int64(Class, params) {
|
||||
return new Class({
|
||||
type: "bigint",
|
||||
check: "bigint_format",
|
||||
abort: false,
|
||||
format: "int64",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _uint64(Class, params) {
|
||||
return new Class({
|
||||
type: "bigint",
|
||||
check: "bigint_format",
|
||||
abort: false,
|
||||
format: "uint64",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _symbol(Class, params) {
|
||||
return new Class({
|
||||
type: "symbol",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _undefined(Class, params) {
|
||||
return new Class({
|
||||
type: "undefined",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _null(Class, params) {
|
||||
return new Class({
|
||||
type: "null",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _any(Class) {
|
||||
return new Class({
|
||||
type: "any",
|
||||
});
|
||||
}
|
||||
function _unknown(Class) {
|
||||
return new Class({
|
||||
type: "unknown",
|
||||
});
|
||||
}
|
||||
function _never(Class, params) {
|
||||
return new Class({
|
||||
type: "never",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _void(Class, params) {
|
||||
return new Class({
|
||||
type: "void",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _date(Class, params) {
|
||||
return new Class({
|
||||
type: "date",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _coercedDate(Class, params) {
|
||||
return new Class({
|
||||
type: "date",
|
||||
coerce: true,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _nan(Class, params) {
|
||||
return new Class({
|
||||
type: "nan",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _lt(value, params) {
|
||||
return new checks.$ZodCheckLessThan({
|
||||
check: "less_than",
|
||||
...util.normalizeParams(params),
|
||||
value,
|
||||
inclusive: false,
|
||||
});
|
||||
}
|
||||
function _lte(value, params) {
|
||||
return new checks.$ZodCheckLessThan({
|
||||
check: "less_than",
|
||||
...util.normalizeParams(params),
|
||||
value,
|
||||
inclusive: true,
|
||||
});
|
||||
}
|
||||
function _gt(value, params) {
|
||||
return new checks.$ZodCheckGreaterThan({
|
||||
check: "greater_than",
|
||||
...util.normalizeParams(params),
|
||||
value,
|
||||
inclusive: false,
|
||||
});
|
||||
}
|
||||
function _gte(value, params) {
|
||||
return new checks.$ZodCheckGreaterThan({
|
||||
check: "greater_than",
|
||||
...util.normalizeParams(params),
|
||||
value,
|
||||
inclusive: true,
|
||||
});
|
||||
}
|
||||
function _positive(params) {
|
||||
return _gt(0, params);
|
||||
}
|
||||
// negative
|
||||
function _negative(params) {
|
||||
return _lt(0, params);
|
||||
}
|
||||
// nonpositive
|
||||
function _nonpositive(params) {
|
||||
return _lte(0, params);
|
||||
}
|
||||
// nonnegative
|
||||
function _nonnegative(params) {
|
||||
return _gte(0, params);
|
||||
}
|
||||
function _multipleOf(value, params) {
|
||||
return new checks.$ZodCheckMultipleOf({
|
||||
check: "multiple_of",
|
||||
...util.normalizeParams(params),
|
||||
value,
|
||||
});
|
||||
}
|
||||
function _maxSize(maximum, params) {
|
||||
return new checks.$ZodCheckMaxSize({
|
||||
check: "max_size",
|
||||
...util.normalizeParams(params),
|
||||
maximum,
|
||||
});
|
||||
}
|
||||
function _minSize(minimum, params) {
|
||||
return new checks.$ZodCheckMinSize({
|
||||
check: "min_size",
|
||||
...util.normalizeParams(params),
|
||||
minimum,
|
||||
});
|
||||
}
|
||||
function _size(size, params) {
|
||||
return new checks.$ZodCheckSizeEquals({
|
||||
check: "size_equals",
|
||||
...util.normalizeParams(params),
|
||||
size,
|
||||
});
|
||||
}
|
||||
function _maxLength(maximum, params) {
|
||||
const ch = new checks.$ZodCheckMaxLength({
|
||||
check: "max_length",
|
||||
...util.normalizeParams(params),
|
||||
maximum,
|
||||
});
|
||||
return ch;
|
||||
}
|
||||
function _minLength(minimum, params) {
|
||||
return new checks.$ZodCheckMinLength({
|
||||
check: "min_length",
|
||||
...util.normalizeParams(params),
|
||||
minimum,
|
||||
});
|
||||
}
|
||||
function _length(length, params) {
|
||||
return new checks.$ZodCheckLengthEquals({
|
||||
check: "length_equals",
|
||||
...util.normalizeParams(params),
|
||||
length,
|
||||
});
|
||||
}
|
||||
function _regex(pattern, params) {
|
||||
return new checks.$ZodCheckRegex({
|
||||
check: "string_format",
|
||||
format: "regex",
|
||||
...util.normalizeParams(params),
|
||||
pattern,
|
||||
});
|
||||
}
|
||||
function _lowercase(params) {
|
||||
return new checks.$ZodCheckLowerCase({
|
||||
check: "string_format",
|
||||
format: "lowercase",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _uppercase(params) {
|
||||
return new checks.$ZodCheckUpperCase({
|
||||
check: "string_format",
|
||||
format: "uppercase",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _includes(includes, params) {
|
||||
return new checks.$ZodCheckIncludes({
|
||||
check: "string_format",
|
||||
format: "includes",
|
||||
...util.normalizeParams(params),
|
||||
includes,
|
||||
});
|
||||
}
|
||||
function _startsWith(prefix, params) {
|
||||
return new checks.$ZodCheckStartsWith({
|
||||
check: "string_format",
|
||||
format: "starts_with",
|
||||
...util.normalizeParams(params),
|
||||
prefix,
|
||||
});
|
||||
}
|
||||
function _endsWith(suffix, params) {
|
||||
return new checks.$ZodCheckEndsWith({
|
||||
check: "string_format",
|
||||
format: "ends_with",
|
||||
...util.normalizeParams(params),
|
||||
suffix,
|
||||
});
|
||||
}
|
||||
function _property(property, schema, params) {
|
||||
return new checks.$ZodCheckProperty({
|
||||
check: "property",
|
||||
property,
|
||||
schema,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _mime(types, params) {
|
||||
return new checks.$ZodCheckMimeType({
|
||||
check: "mime_type",
|
||||
mime: types,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _overwrite(tx) {
|
||||
return new checks.$ZodCheckOverwrite({
|
||||
check: "overwrite",
|
||||
tx,
|
||||
});
|
||||
}
|
||||
// normalize
|
||||
function _normalize(form) {
|
||||
return _overwrite((input) => input.normalize(form));
|
||||
}
|
||||
// trim
|
||||
function _trim() {
|
||||
return _overwrite((input) => input.trim());
|
||||
}
|
||||
// toLowerCase
|
||||
function _toLowerCase() {
|
||||
return _overwrite((input) => input.toLowerCase());
|
||||
}
|
||||
// toUpperCase
|
||||
function _toUpperCase() {
|
||||
return _overwrite((input) => input.toUpperCase());
|
||||
}
|
||||
function _array(Class, element, params) {
|
||||
return new Class({
|
||||
type: "array",
|
||||
element,
|
||||
// get element() {
|
||||
// return element;
|
||||
// },
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _union(Class, options, params) {
|
||||
return new Class({
|
||||
type: "union",
|
||||
options,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _discriminatedUnion(Class, discriminator, options, params) {
|
||||
return new Class({
|
||||
type: "union",
|
||||
options,
|
||||
discriminator,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _intersection(Class, left, right) {
|
||||
return new Class({
|
||||
type: "intersection",
|
||||
left,
|
||||
right,
|
||||
});
|
||||
}
|
||||
// export function _tuple(
|
||||
// Class: util.SchemaClass<schemas.$ZodTuple>,
|
||||
// items: [],
|
||||
// params?: string | $ZodTupleParams
|
||||
// ): schemas.$ZodTuple<[], null>;
|
||||
function _tuple(Class, items, _paramsOrRest, _params) {
|
||||
const hasRest = _paramsOrRest instanceof schemas.$ZodType;
|
||||
const params = hasRest ? _params : _paramsOrRest;
|
||||
const rest = hasRest ? _paramsOrRest : null;
|
||||
return new Class({
|
||||
type: "tuple",
|
||||
items,
|
||||
rest,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _record(Class, keyType, valueType, params) {
|
||||
return new Class({
|
||||
type: "record",
|
||||
keyType,
|
||||
valueType,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _map(Class, keyType, valueType, params) {
|
||||
return new Class({
|
||||
type: "map",
|
||||
keyType,
|
||||
valueType,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _set(Class, valueType, params) {
|
||||
return new Class({
|
||||
type: "set",
|
||||
valueType,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _enum(Class, values, params) {
|
||||
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
|
||||
// if (Array.isArray(values)) {
|
||||
// for (const value of values) {
|
||||
// entries[value] = value;
|
||||
// }
|
||||
// } else {
|
||||
// Object.assign(entries, values);
|
||||
// }
|
||||
// const entries: util.EnumLike = {};
|
||||
// for (const val of values) {
|
||||
// entries[val] = val;
|
||||
// }
|
||||
return new Class({
|
||||
type: "enum",
|
||||
entries,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
/** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
|
||||
*
|
||||
* ```ts
|
||||
* enum Colors { red, green, blue }
|
||||
* z.enum(Colors);
|
||||
* ```
|
||||
*/
|
||||
function _nativeEnum(Class, entries, params) {
|
||||
return new Class({
|
||||
type: "enum",
|
||||
entries,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _literal(Class, value, params) {
|
||||
return new Class({
|
||||
type: "literal",
|
||||
values: Array.isArray(value) ? value : [value],
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _file(Class, params) {
|
||||
return new Class({
|
||||
type: "file",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _transform(Class, fn) {
|
||||
return new Class({
|
||||
type: "transform",
|
||||
transform: fn,
|
||||
});
|
||||
}
|
||||
function _optional(Class, innerType) {
|
||||
return new Class({
|
||||
type: "optional",
|
||||
innerType,
|
||||
});
|
||||
}
|
||||
function _nullable(Class, innerType) {
|
||||
return new Class({
|
||||
type: "nullable",
|
||||
innerType,
|
||||
});
|
||||
}
|
||||
function _default(Class, innerType, defaultValue) {
|
||||
return new Class({
|
||||
type: "default",
|
||||
innerType,
|
||||
get defaultValue() {
|
||||
return typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
||||
},
|
||||
});
|
||||
}
|
||||
function _nonoptional(Class, innerType, params) {
|
||||
return new Class({
|
||||
type: "nonoptional",
|
||||
innerType,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _success(Class, innerType) {
|
||||
return new Class({
|
||||
type: "success",
|
||||
innerType,
|
||||
});
|
||||
}
|
||||
function _catch(Class, innerType, catchValue) {
|
||||
return new Class({
|
||||
type: "catch",
|
||||
innerType,
|
||||
catchValue: (typeof catchValue === "function" ? catchValue : () => catchValue),
|
||||
});
|
||||
}
|
||||
function _pipe(Class, in_, out) {
|
||||
return new Class({
|
||||
type: "pipe",
|
||||
in: in_,
|
||||
out,
|
||||
});
|
||||
}
|
||||
function _readonly(Class, innerType) {
|
||||
return new Class({
|
||||
type: "readonly",
|
||||
innerType,
|
||||
});
|
||||
}
|
||||
function _templateLiteral(Class, parts, params) {
|
||||
return new Class({
|
||||
type: "template_literal",
|
||||
parts,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function _lazy(Class, getter) {
|
||||
return new Class({
|
||||
type: "lazy",
|
||||
getter,
|
||||
});
|
||||
}
|
||||
function _promise(Class, innerType) {
|
||||
return new Class({
|
||||
type: "promise",
|
||||
innerType,
|
||||
});
|
||||
}
|
||||
function _custom(Class, fn, _params) {
|
||||
const schema = new Class({
|
||||
type: "custom",
|
||||
check: "custom",
|
||||
fn: fn,
|
||||
...util.normalizeParams(_params),
|
||||
});
|
||||
return schema;
|
||||
}
|
||||
function _refine(Class, fn, _params = {}) {
|
||||
return _custom(Class, fn, _params);
|
||||
}
|
||||
function _stringbool(Classes, _params) {
|
||||
const params = util.normalizeParams(_params);
|
||||
const trueValues = new Set(params?.truthy ?? ["true", "1", "yes", "on", "y", "enabled"]);
|
||||
const falseValues = new Set(params?.falsy ?? ["false", "0", "no", "off", "n", "disabled"]);
|
||||
const _Pipe = Classes.Pipe ?? schemas.$ZodPipe;
|
||||
const _Boolean = Classes.Boolean ?? schemas.$ZodBoolean;
|
||||
const _Unknown = Classes.Unknown ?? schemas.$ZodUnknown;
|
||||
const inst = new _Unknown({
|
||||
type: "unknown",
|
||||
checks: [
|
||||
{
|
||||
_zod: {
|
||||
check: (ctx) => {
|
||||
if (typeof ctx.value === "string") {
|
||||
let data = ctx.value;
|
||||
if (params?.case !== "sensitive")
|
||||
data = data.toLowerCase();
|
||||
if (trueValues.has(data)) {
|
||||
ctx.value = true;
|
||||
}
|
||||
else if (falseValues.has(data)) {
|
||||
ctx.value = false;
|
||||
}
|
||||
else {
|
||||
ctx.issues.push({
|
||||
code: "invalid_value",
|
||||
expected: "stringbool",
|
||||
values: [...trueValues, ...falseValues],
|
||||
input: ctx.value,
|
||||
inst,
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
ctx.issues.push({
|
||||
code: "invalid_type",
|
||||
expected: "string",
|
||||
input: ctx.value,
|
||||
});
|
||||
}
|
||||
},
|
||||
def: {
|
||||
check: "custom",
|
||||
},
|
||||
onattach: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
return new _Pipe({
|
||||
type: "pipe",
|
||||
in: inst,
|
||||
out: new _Boolean({
|
||||
type: "boolean",
|
||||
}),
|
||||
});
|
||||
}
|
||||
561
node_modules/zod/dist/cjs/v4/core/checks.js
generated
vendored
Normal file
561
node_modules/zod/dist/cjs/v4/core/checks.js
generated
vendored
Normal file
@@ -0,0 +1,561 @@
|
||||
"use strict";
|
||||
// import { $ZodType } from "./schemas.js";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.$ZodCheckOverwrite = exports.$ZodCheckMimeType = exports.$ZodCheckProperty = exports.$ZodCheckEndsWith = exports.$ZodCheckStartsWith = exports.$ZodCheckIncludes = exports.$ZodCheckUpperCase = exports.$ZodCheckLowerCase = exports.$ZodCheckRegex = exports.$ZodCheckStringFormat = exports.$ZodCheckLengthEquals = exports.$ZodCheckMinLength = exports.$ZodCheckMaxLength = exports.$ZodCheckSizeEquals = exports.$ZodCheckMinSize = exports.$ZodCheckMaxSize = exports.$ZodCheckBigIntFormat = exports.$ZodCheckNumberFormat = exports.$ZodCheckMultipleOf = exports.$ZodCheckGreaterThan = exports.$ZodCheckLessThan = exports.$ZodCheck = void 0;
|
||||
const core = __importStar(require("./core.js"));
|
||||
const regexes = __importStar(require("./regexes.js"));
|
||||
const util = __importStar(require("./util.js"));
|
||||
exports.$ZodCheck = core.$constructor("$ZodCheck", (inst, def) => {
|
||||
var _a;
|
||||
inst._zod ?? (inst._zod = {});
|
||||
inst._zod.def = def;
|
||||
(_a = inst._zod).onattach ?? (_a.onattach = []);
|
||||
});
|
||||
const numericOriginMap = {
|
||||
number: "number",
|
||||
bigint: "bigint",
|
||||
object: "date",
|
||||
};
|
||||
exports.$ZodCheckLessThan = core.$constructor("$ZodCheckLessThan", (inst, def) => {
|
||||
exports.$ZodCheck.init(inst, def);
|
||||
const origin = numericOriginMap[typeof def.value];
|
||||
inst._zod.onattach.push((inst) => {
|
||||
const bag = inst._zod.bag;
|
||||
const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
||||
if (def.value < curr) {
|
||||
if (def.inclusive)
|
||||
bag.maximum = def.value;
|
||||
else
|
||||
bag.exclusiveMaximum = def.value;
|
||||
}
|
||||
});
|
||||
inst._zod.check = (payload) => {
|
||||
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {
|
||||
return;
|
||||
}
|
||||
payload.issues.push({
|
||||
origin,
|
||||
code: "too_big",
|
||||
maximum: def.value,
|
||||
input: payload.value,
|
||||
inclusive: def.inclusive,
|
||||
inst,
|
||||
continue: !def.abort,
|
||||
});
|
||||
};
|
||||
});
|
||||
exports.$ZodCheckGreaterThan = core.$constructor("$ZodCheckGreaterThan", (inst, def) => {
|
||||
exports.$ZodCheck.init(inst, def);
|
||||
const origin = numericOriginMap[typeof def.value];
|
||||
inst._zod.onattach.push((inst) => {
|
||||
const bag = inst._zod.bag;
|
||||
const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
||||
if (def.value > curr) {
|
||||
if (def.inclusive)
|
||||
bag.minimum = def.value;
|
||||
else
|
||||
bag.exclusiveMinimum = def.value;
|
||||
}
|
||||
});
|
||||
inst._zod.check = (payload) => {
|
||||
if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {
|
||||
return;
|
||||
}
|
||||
payload.issues.push({
|
||||
origin: origin,
|
||||
code: "too_small",
|
||||
minimum: def.value,
|
||||
input: payload.value,
|
||||
inclusive: def.inclusive,
|
||||
inst,
|
||||
continue: !def.abort,
|
||||
});
|
||||
};
|
||||
});
|
||||
exports.$ZodCheckMultipleOf =
|
||||
/*@__PURE__*/ core.$constructor("$ZodCheckMultipleOf", (inst, def) => {
|
||||
exports.$ZodCheck.init(inst, def);
|
||||
inst._zod.onattach.push((inst) => {
|
||||
var _a;
|
||||
(_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
|
||||
});
|
||||
inst._zod.check = (payload) => {
|
||||
if (typeof payload.value !== typeof def.value)
|
||||
throw new Error("Cannot mix number and bigint in multiple_of check.");
|
||||
const isMultiple = typeof payload.value === "bigint"
|
||||
? payload.value % def.value === BigInt(0)
|
||||
: util.floatSafeRemainder(payload.value, def.value) === 0;
|
||||
if (isMultiple)
|
||||
return;
|
||||
payload.issues.push({
|
||||
origin: typeof payload.value,
|
||||
code: "not_multiple_of",
|
||||
divisor: def.value,
|
||||
input: payload.value,
|
||||
inst,
|
||||
continue: !def.abort,
|
||||
});
|
||||
};
|
||||
});
|
||||
exports.$ZodCheckNumberFormat = core.$constructor("$ZodCheckNumberFormat", (inst, def) => {
|
||||
exports.$ZodCheck.init(inst, def); // no format checks
|
||||
def.format = def.format || "float64";
|
||||
const isInt = def.format?.includes("int");
|
||||
const origin = isInt ? "int" : "number";
|
||||
const [minimum, maximum] = util.NUMBER_FORMAT_RANGES[def.format];
|
||||
inst._zod.onattach.push((inst) => {
|
||||
const bag = inst._zod.bag;
|
||||
bag.format = def.format;
|
||||
bag.minimum = minimum;
|
||||
bag.maximum = maximum;
|
||||
if (isInt)
|
||||
bag.pattern = regexes.integer;
|
||||
});
|
||||
inst._zod.check = (payload) => {
|
||||
const input = payload.value;
|
||||
if (isInt) {
|
||||
if (!Number.isInteger(input)) {
|
||||
// invalid_type issue
|
||||
payload.issues.push({
|
||||
expected: origin,
|
||||
format: def.format,
|
||||
code: "invalid_type",
|
||||
input,
|
||||
inst,
|
||||
});
|
||||
return;
|
||||
// not_multiple_of issue
|
||||
// payload.issues.push({
|
||||
// code: "not_multiple_of",
|
||||
// origin: "number",
|
||||
// input,
|
||||
// inst,
|
||||
// divisor: 1,
|
||||
// });
|
||||
}
|
||||
if (!Number.isSafeInteger(input)) {
|
||||
if (input > 0) {
|
||||
// too_big
|
||||
payload.issues.push({
|
||||
input,
|
||||
code: "too_big",
|
||||
maximum: Number.MAX_SAFE_INTEGER,
|
||||
note: "Integers must be within the the safe integer range.",
|
||||
inst,
|
||||
origin,
|
||||
continue: !def.abort,
|
||||
});
|
||||
}
|
||||
else {
|
||||
// too_small
|
||||
payload.issues.push({
|
||||
input,
|
||||
code: "too_small",
|
||||
minimum: Number.MIN_SAFE_INTEGER,
|
||||
note: "Integers must be within the safe integer range.",
|
||||
inst,
|
||||
origin,
|
||||
continue: !def.abort,
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (input < minimum) {
|
||||
payload.issues.push({
|
||||
origin: "number",
|
||||
input: input,
|
||||
code: "too_small",
|
||||
minimum: minimum,
|
||||
inclusive: true,
|
||||
inst,
|
||||
continue: !def.abort,
|
||||
});
|
||||
}
|
||||
if (input > maximum) {
|
||||
payload.issues.push({
|
||||
origin: "number",
|
||||
input,
|
||||
code: "too_big",
|
||||
maximum,
|
||||
inst,
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
exports.$ZodCheckBigIntFormat = core.$constructor("$ZodCheckBigIntFormat", (inst, def) => {
|
||||
exports.$ZodCheck.init(inst, def); // no format checks
|
||||
const [minimum, maximum] = util.BIGINT_FORMAT_RANGES[def.format];
|
||||
inst._zod.onattach.push((inst) => {
|
||||
const bag = inst._zod.bag;
|
||||
bag.format = def.format;
|
||||
bag.minimum = minimum;
|
||||
bag.maximum = maximum;
|
||||
});
|
||||
inst._zod.check = (payload) => {
|
||||
const input = payload.value;
|
||||
if (input < minimum) {
|
||||
payload.issues.push({
|
||||
origin: "bigint",
|
||||
input,
|
||||
code: "too_small",
|
||||
minimum: minimum,
|
||||
inclusive: true,
|
||||
inst,
|
||||
continue: !def.abort,
|
||||
});
|
||||
}
|
||||
if (input > maximum) {
|
||||
payload.issues.push({
|
||||
origin: "bigint",
|
||||
input,
|
||||
code: "too_big",
|
||||
maximum,
|
||||
inst,
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
exports.$ZodCheckMaxSize = core.$constructor("$ZodCheckMaxSize", (inst, def) => {
|
||||
exports.$ZodCheck.init(inst, def);
|
||||
inst._zod.when = (payload) => {
|
||||
const val = payload.value;
|
||||
return !util.nullish(val) && val.size !== undefined;
|
||||
};
|
||||
inst._zod.onattach.push((inst) => {
|
||||
const curr = (inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY);
|
||||
if (def.maximum < curr)
|
||||
inst._zod.bag.maximum = def.maximum;
|
||||
});
|
||||
inst._zod.check = (payload) => {
|
||||
const input = payload.value;
|
||||
const size = input.size;
|
||||
if (size <= def.maximum)
|
||||
return;
|
||||
payload.issues.push({
|
||||
origin: util.getSizableOrigin(input),
|
||||
code: "too_big",
|
||||
maximum: def.maximum,
|
||||
input,
|
||||
inst,
|
||||
continue: !def.abort,
|
||||
});
|
||||
};
|
||||
});
|
||||
exports.$ZodCheckMinSize = core.$constructor("$ZodCheckMinSize", (inst, def) => {
|
||||
exports.$ZodCheck.init(inst, def);
|
||||
inst._zod.when = (payload) => {
|
||||
const val = payload.value;
|
||||
return !util.nullish(val) && val.size !== undefined;
|
||||
};
|
||||
inst._zod.onattach.push((inst) => {
|
||||
const curr = (inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY);
|
||||
if (def.minimum > curr)
|
||||
inst._zod.bag.minimum = def.minimum;
|
||||
});
|
||||
inst._zod.check = (payload) => {
|
||||
const input = payload.value;
|
||||
const size = input.size;
|
||||
if (size >= def.minimum)
|
||||
return;
|
||||
payload.issues.push({
|
||||
origin: util.getSizableOrigin(input),
|
||||
code: "too_small",
|
||||
minimum: def.minimum,
|
||||
input,
|
||||
inst,
|
||||
continue: !def.abort,
|
||||
});
|
||||
};
|
||||
});
|
||||
exports.$ZodCheckSizeEquals = core.$constructor("$ZodCheckSizeEquals", (inst, def) => {
|
||||
exports.$ZodCheck.init(inst, def);
|
||||
inst._zod.when = (payload) => {
|
||||
const val = payload.value;
|
||||
return !util.nullish(val) && val.size !== undefined;
|
||||
};
|
||||
inst._zod.onattach.push((inst) => {
|
||||
const bag = inst._zod.bag;
|
||||
bag.minimum = def.size;
|
||||
bag.maximum = def.size;
|
||||
bag.size = def.size;
|
||||
});
|
||||
inst._zod.check = (payload) => {
|
||||
const input = payload.value;
|
||||
const size = input.size;
|
||||
if (size === def.size)
|
||||
return;
|
||||
const tooBig = size > def.size;
|
||||
payload.issues.push({
|
||||
origin: util.getSizableOrigin(input),
|
||||
...(tooBig ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size }),
|
||||
input: payload.value,
|
||||
inst,
|
||||
continue: !def.abort,
|
||||
});
|
||||
};
|
||||
});
|
||||
exports.$ZodCheckMaxLength = core.$constructor("$ZodCheckMaxLength", (inst, def) => {
|
||||
exports.$ZodCheck.init(inst, def);
|
||||
inst._zod.when = (payload) => {
|
||||
const val = payload.value;
|
||||
return !util.nullish(val) && val.length !== undefined;
|
||||
};
|
||||
inst._zod.onattach.push((inst) => {
|
||||
const curr = (inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY);
|
||||
if (def.maximum < curr)
|
||||
inst._zod.bag.maximum = def.maximum;
|
||||
});
|
||||
inst._zod.check = (payload) => {
|
||||
const input = payload.value;
|
||||
const length = input.length;
|
||||
if (length <= def.maximum)
|
||||
return;
|
||||
const origin = util.getLengthableOrigin(input);
|
||||
payload.issues.push({
|
||||
origin,
|
||||
code: "too_big",
|
||||
maximum: def.maximum,
|
||||
input,
|
||||
inst,
|
||||
continue: !def.abort,
|
||||
});
|
||||
};
|
||||
});
|
||||
exports.$ZodCheckMinLength = core.$constructor("$ZodCheckMinLength", (inst, def) => {
|
||||
exports.$ZodCheck.init(inst, def);
|
||||
inst._zod.when = (payload) => {
|
||||
const val = payload.value;
|
||||
return !util.nullish(val) && val.length !== undefined;
|
||||
};
|
||||
inst._zod.onattach.push((inst) => {
|
||||
const curr = (inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY);
|
||||
if (def.minimum > curr)
|
||||
inst._zod.bag.minimum = def.minimum;
|
||||
});
|
||||
inst._zod.check = (payload) => {
|
||||
const input = payload.value;
|
||||
const length = input.length;
|
||||
if (length >= def.minimum)
|
||||
return;
|
||||
const origin = util.getLengthableOrigin(input);
|
||||
payload.issues.push({
|
||||
origin,
|
||||
code: "too_small",
|
||||
minimum: def.minimum,
|
||||
input,
|
||||
inst,
|
||||
continue: !def.abort,
|
||||
});
|
||||
};
|
||||
});
|
||||
exports.$ZodCheckLengthEquals = core.$constructor("$ZodCheckLengthEquals", (inst, def) => {
|
||||
exports.$ZodCheck.init(inst, def);
|
||||
inst._zod.when = (payload) => {
|
||||
const val = payload.value;
|
||||
return !util.nullish(val) && val.length !== undefined;
|
||||
};
|
||||
inst._zod.onattach.push((inst) => {
|
||||
const bag = inst._zod.bag;
|
||||
bag.minimum = def.length;
|
||||
bag.maximum = def.length;
|
||||
bag.length = def.length;
|
||||
});
|
||||
inst._zod.check = (payload) => {
|
||||
const input = payload.value;
|
||||
const length = input.length;
|
||||
if (length === def.length)
|
||||
return;
|
||||
const origin = util.getLengthableOrigin(input);
|
||||
const tooBig = length > def.length;
|
||||
payload.issues.push({
|
||||
origin,
|
||||
...(tooBig ? { code: "too_big", maximum: def.length } : { code: "too_small", minimum: def.length }),
|
||||
input: payload.value,
|
||||
inst,
|
||||
continue: !def.abort,
|
||||
});
|
||||
};
|
||||
});
|
||||
exports.$ZodCheckStringFormat = core.$constructor("$ZodCheckStringFormat", (inst, def) => {
|
||||
var _a;
|
||||
exports.$ZodCheck.init(inst, def);
|
||||
inst._zod.onattach.push((inst) => {
|
||||
inst._zod.bag.format = def.format;
|
||||
if (def.pattern)
|
||||
inst._zod.bag.pattern = def.pattern;
|
||||
});
|
||||
(_a = inst._zod).check ?? (_a.check = (payload) => {
|
||||
if (!def.pattern)
|
||||
throw new Error("Not implemented.");
|
||||
def.pattern.lastIndex = 0;
|
||||
if (def.pattern.test(payload.value))
|
||||
return;
|
||||
payload.issues.push({
|
||||
origin: "string",
|
||||
code: "invalid_format",
|
||||
format: def.format,
|
||||
input: payload.value,
|
||||
...(def.pattern ? { pattern: def.pattern.toString() } : {}),
|
||||
inst,
|
||||
continue: !def.abort,
|
||||
});
|
||||
});
|
||||
});
|
||||
exports.$ZodCheckRegex = core.$constructor("$ZodCheckRegex", (inst, def) => {
|
||||
exports.$ZodCheckStringFormat.init(inst, def);
|
||||
inst._zod.check = (payload) => {
|
||||
def.pattern.lastIndex = 0;
|
||||
if (def.pattern.test(payload.value))
|
||||
return;
|
||||
payload.issues.push({
|
||||
origin: "string",
|
||||
code: "invalid_format",
|
||||
format: "regex",
|
||||
input: payload.value,
|
||||
pattern: def.pattern.toString(),
|
||||
inst,
|
||||
continue: !def.abort,
|
||||
});
|
||||
};
|
||||
});
|
||||
exports.$ZodCheckLowerCase = core.$constructor("$ZodCheckLowerCase", (inst, def) => {
|
||||
def.pattern ?? (def.pattern = regexes.lowercase);
|
||||
exports.$ZodCheckStringFormat.init(inst, def);
|
||||
});
|
||||
exports.$ZodCheckUpperCase = core.$constructor("$ZodCheckUpperCase", (inst, def) => {
|
||||
def.pattern ?? (def.pattern = regexes.uppercase);
|
||||
exports.$ZodCheckStringFormat.init(inst, def);
|
||||
});
|
||||
exports.$ZodCheckIncludes = core.$constructor("$ZodCheckIncludes", (inst, def) => {
|
||||
exports.$ZodCheck.init(inst, def);
|
||||
const pattern = new RegExp(util.escapeRegex(def.includes));
|
||||
def.pattern = pattern;
|
||||
inst._zod.onattach.push((inst) => {
|
||||
inst._zod.bag.pattern = pattern;
|
||||
});
|
||||
inst._zod.check = (payload) => {
|
||||
if (payload.value.includes(def.includes, def.position))
|
||||
return;
|
||||
payload.issues.push({
|
||||
origin: "string",
|
||||
code: "invalid_format",
|
||||
format: "includes",
|
||||
includes: def.includes,
|
||||
input: payload.value,
|
||||
inst,
|
||||
continue: !def.abort,
|
||||
});
|
||||
};
|
||||
});
|
||||
exports.$ZodCheckStartsWith = core.$constructor("$ZodCheckStartsWith", (inst, def) => {
|
||||
exports.$ZodCheck.init(inst, def);
|
||||
const pattern = new RegExp(`^${util.escapeRegex(def.prefix)}.*`);
|
||||
def.pattern ?? (def.pattern = pattern);
|
||||
inst._zod.onattach.push((inst) => {
|
||||
inst._zod.bag.pattern = pattern;
|
||||
});
|
||||
inst._zod.check = (payload) => {
|
||||
if (payload.value.startsWith(def.prefix))
|
||||
return;
|
||||
payload.issues.push({
|
||||
origin: "string",
|
||||
code: "invalid_format",
|
||||
format: "starts_with",
|
||||
prefix: def.prefix,
|
||||
input: payload.value,
|
||||
inst,
|
||||
continue: !def.abort,
|
||||
});
|
||||
};
|
||||
});
|
||||
exports.$ZodCheckEndsWith = core.$constructor("$ZodCheckEndsWith", (inst, def) => {
|
||||
exports.$ZodCheck.init(inst, def);
|
||||
const pattern = new RegExp(`.*${util.escapeRegex(def.suffix)}$`);
|
||||
def.pattern ?? (def.pattern = pattern);
|
||||
inst._zod.onattach.push((inst) => {
|
||||
inst._zod.bag.pattern = new RegExp(`.*${util.escapeRegex(def.suffix)}$`);
|
||||
});
|
||||
inst._zod.check = (payload) => {
|
||||
if (payload.value.endsWith(def.suffix))
|
||||
return;
|
||||
payload.issues.push({
|
||||
origin: "string",
|
||||
code: "invalid_format",
|
||||
format: "ends_with",
|
||||
suffix: def.suffix,
|
||||
input: payload.value,
|
||||
inst,
|
||||
continue: !def.abort,
|
||||
});
|
||||
};
|
||||
});
|
||||
///////////////////////////////////
|
||||
///// $ZodCheckProperty /////
|
||||
///////////////////////////////////
|
||||
function handleCheckPropertyResult(result, payload, property) {
|
||||
if (result.issues.length) {
|
||||
payload.issues.push(...util.prefixIssues(property, result.issues));
|
||||
}
|
||||
}
|
||||
exports.$ZodCheckProperty = core.$constructor("$ZodCheckProperty", (inst, def) => {
|
||||
exports.$ZodCheck.init(inst, def);
|
||||
inst._zod.check = (payload) => {
|
||||
const result = def.schema._zod.run({
|
||||
value: payload.value[def.property],
|
||||
issues: [],
|
||||
}, {});
|
||||
if (result instanceof Promise) {
|
||||
return result.then((result) => handleCheckPropertyResult(result, payload, def.property));
|
||||
}
|
||||
handleCheckPropertyResult(result, payload, def.property);
|
||||
return;
|
||||
};
|
||||
});
|
||||
exports.$ZodCheckMimeType = core.$constructor("$ZodCheckMimeType", (inst, def) => {
|
||||
exports.$ZodCheck.init(inst, def);
|
||||
const mimeSet = new Set(def.mime);
|
||||
inst._zod.onattach.push((inst) => {
|
||||
inst._zod.bag.mime = def.mime;
|
||||
});
|
||||
inst._zod.check = (payload) => {
|
||||
if (mimeSet.has(payload.value.type))
|
||||
return;
|
||||
payload.issues.push({
|
||||
code: "invalid_value",
|
||||
values: def.mime,
|
||||
input: payload.value.type,
|
||||
path: ["type"],
|
||||
inst,
|
||||
});
|
||||
};
|
||||
});
|
||||
exports.$ZodCheckOverwrite = core.$constructor("$ZodCheckOverwrite", (inst, def) => {
|
||||
exports.$ZodCheck.init(inst, def);
|
||||
inst._zod.check = (payload) => {
|
||||
payload.value = def.tx(payload.value);
|
||||
};
|
||||
});
|
||||
10
node_modules/zod/dist/cjs/v4/core/config.js
generated
vendored
Normal file
10
node_modules/zod/dist/cjs/v4/core/config.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.globalConfig = void 0;
|
||||
exports.config = config;
|
||||
exports.globalConfig = {};
|
||||
function config(config) {
|
||||
if (config)
|
||||
Object.assign(exports.globalConfig, config);
|
||||
return exports.globalConfig;
|
||||
}
|
||||
59
node_modules/zod/dist/cjs/v4/core/core.js
generated
vendored
Normal file
59
node_modules/zod/dist/cjs/v4/core/core.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.globalConfig = exports.$ZodAsyncError = exports.$brand = void 0;
|
||||
exports.$constructor = $constructor;
|
||||
exports.config = config;
|
||||
function $constructor(name, initializer, params) {
|
||||
const Parent = params?.Parent ?? Object;
|
||||
class _ extends Parent {
|
||||
constructor(def) {
|
||||
var _a;
|
||||
super();
|
||||
const th = this;
|
||||
_.init(th, def);
|
||||
(_a = th._zod).deferred ?? (_a.deferred = []);
|
||||
for (const fn of th._zod.deferred) {
|
||||
fn();
|
||||
}
|
||||
}
|
||||
static init(inst, def) {
|
||||
var _a;
|
||||
Object.defineProperty(inst, "_zod", {
|
||||
value: inst._zod ?? {},
|
||||
enumerable: false,
|
||||
});
|
||||
// inst._zod ??= {} as any;
|
||||
(_a = inst._zod).traits ?? (_a.traits = new Set());
|
||||
// const seen = inst._zod.traits.has(name);
|
||||
inst._zod.traits.add(name);
|
||||
initializer(inst, def);
|
||||
// support prototype modifications
|
||||
for (const k in _.prototype) {
|
||||
Object.defineProperty(inst, k, { value: _.prototype[k].bind(inst) });
|
||||
}
|
||||
inst._zod.constr = _;
|
||||
inst._zod.def = def;
|
||||
}
|
||||
static [Symbol.hasInstance](inst) {
|
||||
if (params?.Parent && inst instanceof params.Parent)
|
||||
return true;
|
||||
return inst?._zod?.traits?.has(name);
|
||||
}
|
||||
}
|
||||
Object.defineProperty(_, "name", { value: name });
|
||||
return _;
|
||||
}
|
||||
////////////////////////////// UTILITIES ///////////////////////////////////////
|
||||
exports.$brand = Symbol("zod_brand");
|
||||
class $ZodAsyncError extends Error {
|
||||
constructor() {
|
||||
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
||||
}
|
||||
}
|
||||
exports.$ZodAsyncError = $ZodAsyncError;
|
||||
exports.globalConfig = {};
|
||||
function config(newConfig) {
|
||||
if (newConfig)
|
||||
Object.assign(exports.globalConfig, newConfig);
|
||||
return exports.globalConfig;
|
||||
}
|
||||
40
node_modules/zod/dist/cjs/v4/core/doc.js
generated
vendored
Normal file
40
node_modules/zod/dist/cjs/v4/core/doc.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Doc = void 0;
|
||||
class Doc {
|
||||
constructor(args = []) {
|
||||
this.content = [];
|
||||
this.indent = 0;
|
||||
if (this)
|
||||
this.args = args;
|
||||
}
|
||||
indented(fn) {
|
||||
this.indent += 1;
|
||||
fn(this);
|
||||
this.indent -= 1;
|
||||
}
|
||||
write(arg) {
|
||||
if (typeof arg === "function") {
|
||||
arg(this, { execution: "sync" });
|
||||
arg(this, { execution: "async" });
|
||||
return;
|
||||
}
|
||||
const content = arg;
|
||||
const lines = content.split("\n").filter((x) => x);
|
||||
const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
|
||||
const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
|
||||
for (const line of dedented) {
|
||||
this.content.push(line);
|
||||
}
|
||||
}
|
||||
compile() {
|
||||
const F = Function;
|
||||
const args = this?.args;
|
||||
const content = this?.content ?? [``];
|
||||
const lines = [...content.map((x) => ` ${x}`)];
|
||||
// console.log(lines.join("\n"));
|
||||
// console.dir("COMPILE", {depth: null});
|
||||
return new F(...args, lines.join("\n"));
|
||||
}
|
||||
}
|
||||
exports.Doc = Doc;
|
||||
237
node_modules/zod/dist/cjs/v4/core/errors.js
generated
vendored
Normal file
237
node_modules/zod/dist/cjs/v4/core/errors.js
generated
vendored
Normal file
@@ -0,0 +1,237 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.$ZodRealError = exports.$ZodError = void 0;
|
||||
exports.flattenError = flattenError;
|
||||
exports.formatError = formatError;
|
||||
exports.treeifyError = treeifyError;
|
||||
exports.toDotPath = toDotPath;
|
||||
exports.prettifyError = prettifyError;
|
||||
const core_js_1 = require("./core.js");
|
||||
const util = __importStar(require("./util.js"));
|
||||
const initializer = (inst, def) => {
|
||||
inst.name = "$ZodError";
|
||||
Object.defineProperty(inst, "_zod", {
|
||||
value: inst._zod,
|
||||
enumerable: false,
|
||||
});
|
||||
Object.defineProperty(inst, "issues", {
|
||||
value: def,
|
||||
enumerable: false,
|
||||
});
|
||||
// inst.message = JSON.stringify(def, util.jsonStringifyReplacer, 2);
|
||||
Object.defineProperty(inst, "message", {
|
||||
get() {
|
||||
return JSON.stringify(def, util.jsonStringifyReplacer, 2);
|
||||
},
|
||||
enumerable: true,
|
||||
// configurable: false,
|
||||
});
|
||||
// inst.toString = () => inst.message;
|
||||
// inst.message = `Invalid input`;
|
||||
// Object.defineProperty(inst, "message", {
|
||||
// get() {
|
||||
// return (
|
||||
// "\n" +
|
||||
// inst.issues
|
||||
// .map((iss) => {
|
||||
// return `✖ ${iss.message}${iss.path.length ? ` [${iss.path.join(".")}]` : ""}`;
|
||||
// })
|
||||
// .join("\n")
|
||||
// );
|
||||
// },
|
||||
// enumerable: false,
|
||||
// });
|
||||
};
|
||||
exports.$ZodError = (0, core_js_1.$constructor)("$ZodError", initializer);
|
||||
exports.$ZodRealError = (0, core_js_1.$constructor)("$ZodError", initializer, { Parent: Error });
|
||||
function flattenError(error, mapper = (issue) => issue.message) {
|
||||
const fieldErrors = {};
|
||||
const formErrors = [];
|
||||
for (const sub of error.issues) {
|
||||
if (sub.path.length > 0) {
|
||||
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
||||
fieldErrors[sub.path[0]].push(mapper(sub));
|
||||
}
|
||||
else {
|
||||
formErrors.push(mapper(sub));
|
||||
}
|
||||
}
|
||||
return { formErrors, fieldErrors };
|
||||
}
|
||||
function formatError(error, _mapper) {
|
||||
const mapper = _mapper ||
|
||||
function (issue) {
|
||||
return issue.message;
|
||||
};
|
||||
const fieldErrors = { _errors: [] };
|
||||
const processError = (error) => {
|
||||
for (const issue of error.issues) {
|
||||
if (issue.code === "invalid_union") {
|
||||
issue.errors.map((issues) => processError({ issues }));
|
||||
}
|
||||
else if (issue.code === "invalid_key") {
|
||||
processError({ issues: issue.issues });
|
||||
}
|
||||
else if (issue.code === "invalid_element") {
|
||||
processError({ issues: issue.issues });
|
||||
}
|
||||
else if (issue.path.length === 0) {
|
||||
fieldErrors._errors.push(mapper(issue));
|
||||
}
|
||||
else {
|
||||
let curr = fieldErrors;
|
||||
let i = 0;
|
||||
while (i < issue.path.length) {
|
||||
const el = issue.path[i];
|
||||
const terminal = i === issue.path.length - 1;
|
||||
if (!terminal) {
|
||||
curr[el] = curr[el] || { _errors: [] };
|
||||
}
|
||||
else {
|
||||
curr[el] = curr[el] || { _errors: [] };
|
||||
curr[el]._errors.push(mapper(issue));
|
||||
}
|
||||
curr = curr[el];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
processError(error);
|
||||
return fieldErrors;
|
||||
}
|
||||
function treeifyError(error, _mapper) {
|
||||
const mapper = _mapper ||
|
||||
function (issue) {
|
||||
return issue.message;
|
||||
};
|
||||
const result = { errors: [] };
|
||||
const processError = (error, path = []) => {
|
||||
var _a, _b;
|
||||
for (const issue of error.issues) {
|
||||
if (issue.code === "invalid_union") {
|
||||
issue.errors.map((issues) => processError({ issues }, issue.path));
|
||||
}
|
||||
else if (issue.code === "invalid_key") {
|
||||
processError({ issues: issue.issues }, issue.path);
|
||||
}
|
||||
else if (issue.code === "invalid_element") {
|
||||
processError({ issues: issue.issues }, issue.path);
|
||||
}
|
||||
else {
|
||||
const fullpath = [...path, ...issue.path];
|
||||
if (fullpath.length === 0) {
|
||||
result.errors.push(mapper(issue));
|
||||
continue;
|
||||
}
|
||||
let curr = result;
|
||||
let i = 0;
|
||||
while (i < fullpath.length) {
|
||||
const el = fullpath[i];
|
||||
const terminal = i === fullpath.length - 1;
|
||||
if (typeof el === "string") {
|
||||
curr.properties ?? (curr.properties = {});
|
||||
(_a = curr.properties)[el] ?? (_a[el] = { errors: [] });
|
||||
curr = curr.properties[el];
|
||||
}
|
||||
else {
|
||||
curr.items ?? (curr.items = []);
|
||||
(_b = curr.items)[el] ?? (_b[el] = { errors: [] });
|
||||
curr = curr.items[el];
|
||||
}
|
||||
if (terminal) {
|
||||
curr.errors.push(mapper(issue));
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
processError(error);
|
||||
return result;
|
||||
}
|
||||
/** Format a ZodError as a human-readable string in the following form.
|
||||
*
|
||||
* From
|
||||
*
|
||||
* ```ts
|
||||
* ZodError {
|
||||
* issues: [
|
||||
* {
|
||||
* expected: 'string',
|
||||
* code: 'invalid_type',
|
||||
* path: [ 'username' ],
|
||||
* message: 'Invalid input: expected string'
|
||||
* },
|
||||
* {
|
||||
* expected: 'number',
|
||||
* code: 'invalid_type',
|
||||
* path: [ 'favoriteNumbers', 1 ],
|
||||
* message: 'Invalid input: expected number'
|
||||
* }
|
||||
* ];
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* to
|
||||
*
|
||||
* ```
|
||||
* username
|
||||
* ✖ Expected number, received string at "username
|
||||
* favoriteNumbers[0]
|
||||
* ✖ Invalid input: expected number
|
||||
* ```
|
||||
*/
|
||||
function toDotPath(path) {
|
||||
const segs = [];
|
||||
for (const seg of path) {
|
||||
if (typeof seg === "number")
|
||||
segs.push(`[${seg}]`);
|
||||
else if (typeof seg === "symbol")
|
||||
segs.push(`[${JSON.stringify(String(seg))}]`);
|
||||
else if (/[^\w$]/.test(seg))
|
||||
segs.push(`[${JSON.stringify(seg)}]`);
|
||||
else {
|
||||
if (segs.length)
|
||||
segs.push(".");
|
||||
segs.push(seg);
|
||||
}
|
||||
}
|
||||
return segs.join("");
|
||||
}
|
||||
function prettifyError(error) {
|
||||
const lines = [];
|
||||
// sort by path length
|
||||
const issues = [...error.issues].sort((a, b) => a.path.length - b.path.length);
|
||||
// Process each issue
|
||||
for (const issue of issues) {
|
||||
lines.push(`✖ ${issue.message}`);
|
||||
if (issue.path?.length)
|
||||
lines.push(` → at ${toDotPath(issue.path)}`);
|
||||
}
|
||||
// Convert Map to formatted string
|
||||
return lines.join("\n");
|
||||
}
|
||||
97
node_modules/zod/dist/cjs/v4/core/function.js
generated
vendored
Normal file
97
node_modules/zod/dist/cjs/v4/core/function.js
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.$ZodFunction = void 0;
|
||||
exports.function = _function;
|
||||
const api_js_1 = require("./api.js");
|
||||
const parse_js_1 = require("./parse.js");
|
||||
const schemas = __importStar(require("./schemas.js"));
|
||||
const schemas_js_1 = require("./schemas.js");
|
||||
class $ZodFunction {
|
||||
constructor(def) {
|
||||
this._def = def;
|
||||
}
|
||||
implement(func) {
|
||||
if (typeof func !== "function") {
|
||||
throw new Error("implement() must be called with a function");
|
||||
}
|
||||
const impl = ((...args) => {
|
||||
const parsedArgs = this._def.input ? (0, parse_js_1.parse)(this._def.input, args, undefined, { callee: impl }) : args;
|
||||
if (!Array.isArray(parsedArgs)) {
|
||||
throw new Error("Invalid arguments schema: not an array or tuple schema.");
|
||||
}
|
||||
const output = func(...parsedArgs);
|
||||
return this._def.output ? (0, parse_js_1.parse)(this._def.output, output, undefined, { callee: impl }) : output;
|
||||
});
|
||||
return impl;
|
||||
}
|
||||
implementAsync(func) {
|
||||
if (typeof func !== "function") {
|
||||
throw new Error("implement() must be called with a function");
|
||||
}
|
||||
const impl = (async (...args) => {
|
||||
const parsedArgs = this._def.input ? await (0, parse_js_1.parseAsync)(this._def.input, args, undefined, { callee: impl }) : args;
|
||||
if (!Array.isArray(parsedArgs)) {
|
||||
throw new Error("Invalid arguments schema: not an array or tuple schema.");
|
||||
}
|
||||
const output = await func(...parsedArgs);
|
||||
return this._def.output ? (0, parse_js_1.parseAsync)(this._def.output, output, undefined, { callee: impl }) : output;
|
||||
});
|
||||
return impl;
|
||||
}
|
||||
input(...args) {
|
||||
if (Array.isArray(args[0])) {
|
||||
return new $ZodFunction({
|
||||
type: "function",
|
||||
input: new schemas_js_1.$ZodTuple({
|
||||
type: "tuple",
|
||||
items: args[0],
|
||||
rest: args[1],
|
||||
}),
|
||||
output: this._def.output,
|
||||
});
|
||||
}
|
||||
return new $ZodFunction({
|
||||
type: "function",
|
||||
input: args[0],
|
||||
output: this._def.output,
|
||||
});
|
||||
}
|
||||
output(output) {
|
||||
return new $ZodFunction({
|
||||
type: "function",
|
||||
input: this._def.input,
|
||||
output,
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.$ZodFunction = $ZodFunction;
|
||||
function _function(params) {
|
||||
return new $ZodFunction({
|
||||
type: "function",
|
||||
input: Array.isArray(params?.input) ? (0, api_js_1._tuple)(schemas.$ZodTuple, params?.input) : (params?.input ?? null),
|
||||
output: params?.output ?? null,
|
||||
});
|
||||
}
|
||||
44
node_modules/zod/dist/cjs/v4/core/index.js
generated
vendored
Normal file
44
node_modules/zod/dist/cjs/v4/core/index.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.JSONSchema = exports.locales = exports.regexes = exports.util = void 0;
|
||||
__exportStar(require("./core.js"), exports);
|
||||
__exportStar(require("./parse.js"), exports);
|
||||
__exportStar(require("./errors.js"), exports);
|
||||
__exportStar(require("./schemas.js"), exports);
|
||||
__exportStar(require("./checks.js"), exports);
|
||||
__exportStar(require("./versions.js"), exports);
|
||||
exports.util = __importStar(require("./util.js"));
|
||||
exports.regexes = __importStar(require("./regexes.js"));
|
||||
exports.locales = __importStar(require("../locales/index.js"));
|
||||
__exportStar(require("./registries.js"), exports);
|
||||
__exportStar(require("./doc.js"), exports);
|
||||
__exportStar(require("./function.js"), exports);
|
||||
__exportStar(require("./api.js"), exports);
|
||||
__exportStar(require("./to-json-schema.js"), exports);
|
||||
exports.JSONSchema = __importStar(require("./json-schema.js"));
|
||||
2
node_modules/zod/dist/cjs/v4/core/json-schema.js
generated
vendored
Normal file
2
node_modules/zod/dist/cjs/v4/core/json-schema.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
87
node_modules/zod/dist/cjs/v4/core/parse.js
generated
vendored
Normal file
87
node_modules/zod/dist/cjs/v4/core/parse.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.safeParseAsync = exports._safeParseAsync = exports.safeParse = exports._safeParse = exports.parseAsync = exports._parseAsync = exports.parse = exports._parse = void 0;
|
||||
const core = __importStar(require("./core.js"));
|
||||
const errors = __importStar(require("./errors.js"));
|
||||
const util = __importStar(require("./util.js"));
|
||||
const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
||||
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
||||
const result = schema._zod.run({ value, issues: [] }, ctx);
|
||||
if (result instanceof Promise) {
|
||||
throw new core.$ZodAsyncError();
|
||||
}
|
||||
if (result.issues.length) {
|
||||
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));
|
||||
Error.captureStackTrace(e, _params?.callee);
|
||||
throw e;
|
||||
}
|
||||
return result.value;
|
||||
};
|
||||
exports._parse = _parse;
|
||||
exports.parse = (0, exports._parse)(errors.$ZodRealError);
|
||||
const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
||||
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
||||
let result = schema._zod.run({ value, issues: [] }, ctx);
|
||||
if (result instanceof Promise)
|
||||
result = await result;
|
||||
if (result.issues.length) {
|
||||
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));
|
||||
Error.captureStackTrace(e, params?.callee);
|
||||
throw e;
|
||||
}
|
||||
return result.value;
|
||||
};
|
||||
exports._parseAsync = _parseAsync;
|
||||
exports.parseAsync = (0, exports._parseAsync)(errors.$ZodRealError);
|
||||
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
||||
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
||||
const result = schema._zod.run({ value, issues: [] }, ctx);
|
||||
if (result instanceof Promise) {
|
||||
throw new core.$ZodAsyncError();
|
||||
}
|
||||
return result.issues.length
|
||||
? {
|
||||
success: false,
|
||||
error: new (_Err ?? errors.$ZodError)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),
|
||||
}
|
||||
: { success: true, data: result.value };
|
||||
};
|
||||
exports._safeParse = _safeParse;
|
||||
exports.safeParse = (0, exports._safeParse)(errors.$ZodRealError);
|
||||
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
||||
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
||||
let result = schema._zod.run({ value, issues: [] }, ctx);
|
||||
if (result instanceof Promise)
|
||||
result = await result;
|
||||
return result.issues.length
|
||||
? {
|
||||
success: false,
|
||||
error: new _Err(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),
|
||||
}
|
||||
: { success: true, data: result.value };
|
||||
};
|
||||
exports._safeParseAsync = _safeParseAsync;
|
||||
exports.safeParseAsync = (0, exports._safeParseAsync)(errors.$ZodRealError);
|
||||
101
node_modules/zod/dist/cjs/v4/core/regexes.js
generated
vendored
Normal file
101
node_modules/zod/dist/cjs/v4/core/regexes.js
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.uppercase = exports.lowercase = exports.undefined = exports.null = exports.boolean = exports.number = exports.integer = exports.bigint = exports.string = exports.date = exports.e164 = exports.hostname = exports.base64url = exports.base64 = exports.ip = exports.cidrv6 = exports.cidrv4 = exports.ipv6 = exports.ipv4 = exports._emoji = exports.browserEmail = exports.unicodeEmail = exports.rfc5322Email = exports.html5Email = exports.email = exports.uuid7 = exports.uuid6 = exports.uuid4 = exports.uuid = exports.guid = exports.extendedDuration = exports.duration = exports.nanoid = exports.ksuid = exports.xid = exports.ulid = exports.cuid2 = exports.cuid = void 0;
|
||||
exports.emoji = emoji;
|
||||
exports.time = time;
|
||||
exports.datetime = datetime;
|
||||
exports.cuid = /^[cC][^\s-]{8,}$/;
|
||||
exports.cuid2 = /^[0-9a-z]+$/;
|
||||
exports.ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
||||
exports.xid = /^[0-9a-vA-V]{20}$/;
|
||||
exports.ksuid = /^[A-Za-z0-9]{27}$/;
|
||||
exports.nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
||||
/** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
|
||||
exports.duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
||||
/** Implements ISO 8601-2 extensions like explicit +- prefixes, mixing weeks with other units, and fractional/negative components. */
|
||||
exports.extendedDuration = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
|
||||
/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
|
||||
exports.guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
|
||||
/** Returns a regex for validating an RFC 4122 UUID.
|
||||
*
|
||||
* @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
|
||||
const uuid = (version) => {
|
||||
if (!version)
|
||||
return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;
|
||||
return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
|
||||
};
|
||||
exports.uuid = uuid;
|
||||
exports.uuid4 = (0, exports.uuid)(4);
|
||||
exports.uuid6 = (0, exports.uuid)(6);
|
||||
exports.uuid7 = (0, exports.uuid)(7);
|
||||
/** Practical email validation */
|
||||
exports.email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
||||
/** Equivalent to the HTML5 input[type=email] validation implemented by browsers. Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email */
|
||||
exports.html5Email = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
|
||||
/** The classic emailregex.com regex for RFC 5322-compliant emails */
|
||||
exports.rfc5322Email = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
||||
/** A loose regex that allows Unicode characters, enforces length limits, and that's about it. */
|
||||
exports.unicodeEmail = /^[^\s@"]{1,64}@[^\s@]{1,255}$/u;
|
||||
exports.browserEmail = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
|
||||
// from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression
|
||||
exports._emoji = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
||||
function emoji() {
|
||||
return new RegExp(exports._emoji, "u");
|
||||
}
|
||||
exports.ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
||||
exports.ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/;
|
||||
exports.cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
|
||||
exports.cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
||||
exports.ip = new RegExp(`(${exports.ipv4.source})|(${exports.ipv6.source})`);
|
||||
// https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript
|
||||
exports.base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
||||
exports.base64url = /^[A-Za-z0-9_-]*$/;
|
||||
// based on https://stackoverflow.com/questions/106179/regular-expression-to-match-dns-hostname-or-ip-address
|
||||
// export const hostname: RegExp =
|
||||
// /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)+([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/;
|
||||
exports.hostname = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;
|
||||
// https://blog.stevenlevithan.com/archives/validate-phone-number#r4-3 (regex sans spaces)
|
||||
exports.e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
|
||||
const dateSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
|
||||
exports.date = new RegExp(`^${dateSource}$`);
|
||||
function timeSource(args) {
|
||||
// let regex = `\\d{2}:\\d{2}:\\d{2}`;
|
||||
let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
|
||||
if (args.precision) {
|
||||
regex = `${regex}\\.\\d{${args.precision}}`;
|
||||
}
|
||||
else if (args.precision == null) {
|
||||
regex = `${regex}(\\.\\d+)?`;
|
||||
}
|
||||
return regex;
|
||||
}
|
||||
function time(args) {
|
||||
return new RegExp(`^${timeSource(args)}$`);
|
||||
}
|
||||
// Adapted from https://stackoverflow.com/a/3143231
|
||||
function datetime(args) {
|
||||
let regex = `${dateSource}T${timeSource(args)}`;
|
||||
const opts = [];
|
||||
opts.push(args.local ? `Z?` : `Z`);
|
||||
if (args.offset)
|
||||
opts.push(`([+-]\\d{2}:?\\d{2})`);
|
||||
regex = `${regex}(${opts.join("|")})`;
|
||||
return new RegExp(`^${regex}$`);
|
||||
}
|
||||
const string = (params) => {
|
||||
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
||||
return new RegExp(`^${regex}$`);
|
||||
};
|
||||
exports.string = string;
|
||||
exports.bigint = /^\d+n?$/;
|
||||
exports.integer = /^\d+$/;
|
||||
exports.number = /^-?\d+(?:\.\d+)?/i;
|
||||
exports.boolean = /true|false/i;
|
||||
const _null = /null/i;
|
||||
exports.null = _null;
|
||||
const _undefined = /undefined/i;
|
||||
exports.undefined = _undefined;
|
||||
// regex for string with no uppercase letters
|
||||
exports.lowercase = /^[^A-Z]*$/;
|
||||
// regex for string with no lowercase letters
|
||||
exports.uppercase = /^[^a-z]*$/;
|
||||
47
node_modules/zod/dist/cjs/v4/core/registries.js
generated
vendored
Normal file
47
node_modules/zod/dist/cjs/v4/core/registries.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.globalRegistry = exports.$ZodRegistry = exports.$input = exports.$output = void 0;
|
||||
exports.registry = registry;
|
||||
exports.$output = Symbol("ZodOutput");
|
||||
exports.$input = Symbol("ZodInput");
|
||||
class $ZodRegistry {
|
||||
constructor() {
|
||||
this._map = new WeakMap();
|
||||
this._idmap = new Map();
|
||||
}
|
||||
add(schema, ..._meta) {
|
||||
const meta = _meta[0];
|
||||
this._map.set(schema, meta);
|
||||
if (meta && typeof meta === "object" && "id" in meta) {
|
||||
if (this._idmap.has(meta.id)) {
|
||||
throw new Error(`ID ${meta.id} already exists in the registry`);
|
||||
}
|
||||
this._idmap.set(meta.id, schema);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
remove(schema) {
|
||||
this._map.delete(schema);
|
||||
return this;
|
||||
}
|
||||
get(schema) {
|
||||
// return this._map.get(schema) as any;
|
||||
// inherit metadata
|
||||
const p = schema._zod.parent;
|
||||
if (p) {
|
||||
const pm = { ...(this.get(p) ?? {}) };
|
||||
delete pm.id; // do not inherit id
|
||||
return { ...pm, ...this._map.get(schema) };
|
||||
}
|
||||
return this._map.get(schema);
|
||||
}
|
||||
has(schema) {
|
||||
return this._map.has(schema);
|
||||
}
|
||||
}
|
||||
exports.$ZodRegistry = $ZodRegistry;
|
||||
// registries
|
||||
function registry() {
|
||||
return new $ZodRegistry();
|
||||
}
|
||||
exports.globalRegistry = registry();
|
||||
1771
node_modules/zod/dist/cjs/v4/core/schemas.js
generated
vendored
Normal file
1771
node_modules/zod/dist/cjs/v4/core/schemas.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
node_modules/zod/dist/cjs/v4/core/standard-schema.js
generated
vendored
Normal file
2
node_modules/zod/dist/cjs/v4/core/standard-schema.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
669
node_modules/zod/dist/cjs/v4/core/to-json-schema.js
generated
vendored
Normal file
669
node_modules/zod/dist/cjs/v4/core/to-json-schema.js
generated
vendored
Normal file
@@ -0,0 +1,669 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.JSONSchemaGenerator = void 0;
|
||||
exports.toJSONSchema = toJSONSchema;
|
||||
const registries_js_1 = require("./registries.js");
|
||||
const formatMap = {
|
||||
guid: "uuid",
|
||||
url: "uri",
|
||||
datetime: "date-time",
|
||||
json_string: "json-string",
|
||||
};
|
||||
class JSONSchemaGenerator {
|
||||
constructor(params) {
|
||||
this.counter = 0;
|
||||
this.metadataRegistry = params?.metadata ?? registries_js_1.globalRegistry;
|
||||
this.target = params?.target ?? "draft-2020-12";
|
||||
this.unrepresentable = params?.unrepresentable ?? "throw";
|
||||
this.override = params?.override ?? (() => { });
|
||||
this.io = params?.io ?? "output";
|
||||
this.seen = new Map();
|
||||
}
|
||||
process(schema, _params = { path: [], schemaPath: [] }) {
|
||||
var _a;
|
||||
const def = schema._zod.def;
|
||||
// check for schema in seens
|
||||
const seen = this.seen.get(schema);
|
||||
if (seen) {
|
||||
seen.count++;
|
||||
// check if cycle
|
||||
const isCycle = _params.schemaPath.includes(schema);
|
||||
if (isCycle) {
|
||||
seen.cycle = _params.path;
|
||||
}
|
||||
seen.count++;
|
||||
// break cycle
|
||||
return seen.schema;
|
||||
}
|
||||
// initialize
|
||||
const result = { schema: {}, count: 1, cycle: undefined };
|
||||
this.seen.set(schema, result);
|
||||
if (schema._zod.toJSONSchema) {
|
||||
// custom method overrides default behavior
|
||||
result.schema = schema._zod.toJSONSchema();
|
||||
}
|
||||
// check if external
|
||||
// const ext = this.external?.registry.get(schema)?.id;
|
||||
// if (ext) {
|
||||
// result.external = ext;
|
||||
// }
|
||||
const params = {
|
||||
..._params,
|
||||
schemaPath: [..._params.schemaPath, schema],
|
||||
path: _params.path,
|
||||
};
|
||||
const parent = schema._zod.parent;
|
||||
// if (parent) {
|
||||
// // schema was cloned from another schema
|
||||
// result.ref = parent;
|
||||
// this.process(parent, params);
|
||||
// this.seen.get(parent)!.isParent = true;
|
||||
// }
|
||||
if (parent) {
|
||||
// schema was cloned from another schema
|
||||
result.ref = parent;
|
||||
this.process(parent, params);
|
||||
this.seen.get(parent).isParent = true;
|
||||
}
|
||||
else {
|
||||
const _json = result.schema;
|
||||
switch (def.type) {
|
||||
case "string": {
|
||||
const json = _json;
|
||||
json.type = "string";
|
||||
const { minimum, maximum, format, pattern, contentEncoding } = schema._zod.bag;
|
||||
if (typeof minimum === "number")
|
||||
json.minLength = minimum;
|
||||
if (typeof maximum === "number")
|
||||
json.maxLength = maximum;
|
||||
// custom pattern overrides format
|
||||
if (format) {
|
||||
json.format = formatMap[format] ?? format;
|
||||
}
|
||||
if (pattern) {
|
||||
json.pattern = pattern.source;
|
||||
}
|
||||
if (contentEncoding)
|
||||
json.contentEncoding = contentEncoding;
|
||||
break;
|
||||
}
|
||||
case "number": {
|
||||
const json = _json;
|
||||
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
||||
if (typeof format === "string" && format.includes("int"))
|
||||
json.type = "integer";
|
||||
else
|
||||
json.type = "number";
|
||||
if (typeof exclusiveMinimum === "number")
|
||||
json.exclusiveMinimum = exclusiveMinimum;
|
||||
if (typeof minimum === "number") {
|
||||
json.minimum = minimum;
|
||||
if (typeof exclusiveMinimum === "number") {
|
||||
if (exclusiveMinimum >= minimum)
|
||||
delete json.minimum;
|
||||
else
|
||||
delete json.exclusiveMinimum;
|
||||
}
|
||||
}
|
||||
if (typeof exclusiveMaximum === "number")
|
||||
json.exclusiveMaximum = exclusiveMaximum;
|
||||
if (typeof maximum === "number") {
|
||||
json.maximum = maximum;
|
||||
if (typeof exclusiveMaximum === "number") {
|
||||
if (exclusiveMaximum <= maximum)
|
||||
delete json.maximum;
|
||||
else
|
||||
delete json.exclusiveMaximum;
|
||||
}
|
||||
}
|
||||
if (typeof multipleOf === "number")
|
||||
json.multipleOf = multipleOf;
|
||||
break;
|
||||
}
|
||||
case "boolean": {
|
||||
const json = _json;
|
||||
json.type = "boolean";
|
||||
break;
|
||||
}
|
||||
case "bigint": {
|
||||
if (this.unrepresentable === "throw") {
|
||||
throw new Error("BigInt cannot be represented in JSON Schema");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "symbol": {
|
||||
if (this.unrepresentable === "throw") {
|
||||
throw new Error("Symbols cannot be represented in JSON Schema");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "undefined": {
|
||||
const json = _json;
|
||||
json.type = "null";
|
||||
break;
|
||||
}
|
||||
case "null": {
|
||||
_json.type = "null";
|
||||
break;
|
||||
}
|
||||
case "any": {
|
||||
break;
|
||||
}
|
||||
case "unknown": {
|
||||
break;
|
||||
}
|
||||
case "never": {
|
||||
_json.not = {};
|
||||
break;
|
||||
}
|
||||
case "void": {
|
||||
if (this.unrepresentable === "throw") {
|
||||
throw new Error("Void cannot be represented in JSON Schema");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "date": {
|
||||
if (this.unrepresentable === "throw") {
|
||||
throw new Error("Date cannot be represented in JSON Schema");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "array": {
|
||||
const json = _json;
|
||||
const { minimum, maximum } = schema._zod.bag;
|
||||
if (typeof minimum === "number")
|
||||
json.minItems = minimum;
|
||||
if (typeof maximum === "number")
|
||||
json.maxItems = maximum;
|
||||
json.type = "array";
|
||||
json.items = this.process(def.element, { ...params, path: [...params.path, "items"] });
|
||||
break;
|
||||
}
|
||||
case "object": {
|
||||
const json = _json;
|
||||
json.type = "object";
|
||||
json.properties = {};
|
||||
const shape = def.shape; // params.shapeCache.get(schema)!;
|
||||
for (const key in shape) {
|
||||
json.properties[key] = this.process(shape[key], {
|
||||
...params,
|
||||
path: [...params.path, "properties", key],
|
||||
});
|
||||
}
|
||||
// required keys
|
||||
const allKeys = new Set(Object.keys(shape));
|
||||
// const optionalKeys = new Set(def.optional);
|
||||
const requiredKeys = new Set([...allKeys].filter((key) => {
|
||||
const v = def.shape[key]._zod;
|
||||
if (this.io === "input") {
|
||||
return v.optin === undefined;
|
||||
}
|
||||
else {
|
||||
return v.optout === undefined;
|
||||
}
|
||||
}));
|
||||
json.required = Array.from(requiredKeys);
|
||||
// catchall
|
||||
if (def.catchall?._zod.def.type === "never") {
|
||||
json.additionalProperties = false;
|
||||
}
|
||||
else if (def.catchall) {
|
||||
json.additionalProperties = this.process(def.catchall, {
|
||||
...params,
|
||||
path: [...params.path, "additionalProperties"],
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "union": {
|
||||
const json = _json;
|
||||
json.anyOf = def.options.map((x, i) => this.process(x, {
|
||||
...params,
|
||||
path: [...params.path, "anyOf", i],
|
||||
}));
|
||||
break;
|
||||
}
|
||||
case "intersection": {
|
||||
const json = _json;
|
||||
json.allOf = [
|
||||
this.process(def.left, {
|
||||
...params,
|
||||
path: [...params.path, "allOf", 0],
|
||||
}),
|
||||
this.process(def.right, {
|
||||
...params,
|
||||
path: [...params.path, "allOf", 1],
|
||||
}),
|
||||
];
|
||||
break;
|
||||
}
|
||||
case "tuple": {
|
||||
const json = _json;
|
||||
json.type = "array";
|
||||
const prefixItems = def.items.map((x, i) => this.process(x, { ...params, path: [...params.path, "prefixItems", i] }));
|
||||
if (this.target === "draft-2020-12") {
|
||||
json.prefixItems = prefixItems;
|
||||
}
|
||||
else {
|
||||
json.items = prefixItems;
|
||||
}
|
||||
if (def.rest) {
|
||||
const rest = this.process(def.rest, {
|
||||
...params,
|
||||
path: [...params.path, "items"],
|
||||
});
|
||||
if (this.target === "draft-2020-12") {
|
||||
json.items = rest;
|
||||
}
|
||||
else {
|
||||
json.additionalItems = rest;
|
||||
}
|
||||
}
|
||||
// additionalItems
|
||||
if (def.rest) {
|
||||
json.items = this.process(def.rest, {
|
||||
...params,
|
||||
path: [...params.path, "items"],
|
||||
});
|
||||
}
|
||||
// length
|
||||
const { minimum, maximum } = schema._zod.bag;
|
||||
if (typeof minimum === "number")
|
||||
json.minItems = minimum;
|
||||
if (typeof maximum === "number")
|
||||
json.maxItems = maximum;
|
||||
break;
|
||||
}
|
||||
case "record": {
|
||||
const json = _json;
|
||||
json.type = "object";
|
||||
json.propertyNames = this.process(def.keyType, { ...params, path: [...params.path, "propertyNames"] });
|
||||
json.additionalProperties = this.process(def.valueType, {
|
||||
...params,
|
||||
path: [...params.path, "additionalProperties"],
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "map": {
|
||||
if (this.unrepresentable === "throw") {
|
||||
throw new Error("Map cannot be represented in JSON Schema");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "set": {
|
||||
if (this.unrepresentable === "throw") {
|
||||
throw new Error("Set cannot be represented in JSON Schema");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "enum": {
|
||||
const json = _json;
|
||||
json.enum = Object.values(def.entries);
|
||||
break;
|
||||
}
|
||||
case "literal": {
|
||||
const json = _json;
|
||||
const vals = [];
|
||||
for (const val of def.values) {
|
||||
if (val === undefined) {
|
||||
if (this.unrepresentable === "throw") {
|
||||
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
||||
}
|
||||
else {
|
||||
// do not add to vals
|
||||
}
|
||||
}
|
||||
else if (typeof val === "bigint") {
|
||||
if (this.unrepresentable === "throw") {
|
||||
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
||||
}
|
||||
else {
|
||||
vals.push(Number(val));
|
||||
}
|
||||
}
|
||||
else {
|
||||
vals.push(val);
|
||||
}
|
||||
}
|
||||
if (vals.length === 0) {
|
||||
// do nothing (an undefined literal was stripped)
|
||||
}
|
||||
else if (vals.length === 1) {
|
||||
const val = vals[0];
|
||||
json.const = val;
|
||||
}
|
||||
else {
|
||||
json.enum = vals;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "file": {
|
||||
if (this.unrepresentable === "throw") {
|
||||
throw new Error("File cannot be represented in JSON Schema");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "transform": {
|
||||
if (this.unrepresentable === "throw") {
|
||||
throw new Error("Transforms cannot be represented in JSON Schema");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "nullable": {
|
||||
const inner = this.process(def.innerType, params);
|
||||
_json.anyOf = [inner, { type: "null" }];
|
||||
break;
|
||||
}
|
||||
case "nonoptional": {
|
||||
this.process(def.innerType, params);
|
||||
result.ref = def.innerType;
|
||||
break;
|
||||
}
|
||||
case "success": {
|
||||
const json = _json;
|
||||
json.type = "boolean";
|
||||
break;
|
||||
}
|
||||
case "default": {
|
||||
this.process(def.innerType, params);
|
||||
result.ref = def.innerType;
|
||||
_json.default = def.defaultValue;
|
||||
break;
|
||||
}
|
||||
case "prefault": {
|
||||
this.process(def.innerType, params);
|
||||
result.ref = def.innerType;
|
||||
if (this.io === "input")
|
||||
_json._prefault = def.defaultValue;
|
||||
break;
|
||||
}
|
||||
case "catch": {
|
||||
// use conditionals
|
||||
this.process(def.innerType, params);
|
||||
result.ref = def.innerType;
|
||||
let catchValue;
|
||||
try {
|
||||
catchValue = def.catchValue(undefined);
|
||||
}
|
||||
catch {
|
||||
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
||||
}
|
||||
_json.default = catchValue;
|
||||
break;
|
||||
}
|
||||
case "nan": {
|
||||
if (this.unrepresentable === "throw") {
|
||||
throw new Error("NaN cannot be represented in JSON Schema");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "template_literal": {
|
||||
const json = _json;
|
||||
const pattern = schema._zod.pattern;
|
||||
if (!pattern)
|
||||
throw new Error("Pattern not found in template literal");
|
||||
json.type = "string";
|
||||
json.pattern = pattern.source;
|
||||
break;
|
||||
}
|
||||
case "pipe": {
|
||||
const innerType = this.io === "input" ? def.in : def.out;
|
||||
this.process(innerType, params);
|
||||
result.ref = innerType;
|
||||
break;
|
||||
}
|
||||
case "readonly": {
|
||||
this.process(def.innerType, params);
|
||||
result.ref = def.innerType;
|
||||
_json.readOnly = true;
|
||||
break;
|
||||
}
|
||||
// passthrough types
|
||||
case "promise": {
|
||||
this.process(def.innerType, params);
|
||||
result.ref = def.innerType;
|
||||
break;
|
||||
}
|
||||
case "optional": {
|
||||
this.process(def.innerType, params);
|
||||
result.ref = def.innerType;
|
||||
break;
|
||||
}
|
||||
case "lazy": {
|
||||
const innerType = schema._zod.innerType;
|
||||
this.process(innerType, params);
|
||||
result.ref = innerType;
|
||||
break;
|
||||
}
|
||||
case "custom": {
|
||||
if (this.unrepresentable === "throw") {
|
||||
throw new Error("Custom types cannot be represented in JSON Schema");
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
def;
|
||||
}
|
||||
}
|
||||
}
|
||||
// metadata
|
||||
const meta = this.metadataRegistry.get(schema);
|
||||
if (meta)
|
||||
Object.assign(result.schema, meta);
|
||||
if (this.io === "input" && def.type === "pipe") {
|
||||
// examples/defaults only apply to output type of pipe
|
||||
delete result.schema.examples;
|
||||
delete result.schema.default;
|
||||
if (result.schema._prefault)
|
||||
result.schema.default = result.schema._prefault;
|
||||
}
|
||||
if (this.io === "input" && result.schema._prefault)
|
||||
(_a = result.schema).default ?? (_a.default = result.schema._prefault);
|
||||
delete result.schema._prefault;
|
||||
// pulling fresh from this.seen in case it was overwritten
|
||||
const _result = this.seen.get(schema);
|
||||
return _result.schema;
|
||||
}
|
||||
emit(schema, _params) {
|
||||
const params = {
|
||||
cycles: _params?.cycles ?? "ref",
|
||||
reused: _params?.reused ?? "inline",
|
||||
// unrepresentable: _params?.unrepresentable ?? "throw",
|
||||
// uri: _params?.uri ?? ((id) => `${id}`),
|
||||
external: _params?.external ?? undefined,
|
||||
};
|
||||
// iterate over seen map;
|
||||
const root = this.seen.get(schema);
|
||||
if (!root)
|
||||
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
||||
// initialize result with root schema fields
|
||||
// Object.assign(result, seen.cached);
|
||||
const makeURI = (entry) => {
|
||||
// comparing the seen objects because sometimes
|
||||
// multiple schemas map to the same seen object.
|
||||
// e.g. lazy
|
||||
// external is configured
|
||||
const defsSegment = this.target === "draft-2020-12" ? "$defs" : "definitions";
|
||||
if (params.external) {
|
||||
const externalId = params.external.registry.get(entry[0])?.id; // ?? "__shared";// `__schema${this.counter++}`;
|
||||
// check if schema is in the external registry
|
||||
if (externalId)
|
||||
return { ref: params.external.uri(externalId) };
|
||||
// otherwise, add to __shared
|
||||
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${this.counter++}`;
|
||||
entry[1].defId = id;
|
||||
return { defId: id, ref: `${params.external.uri("__shared")}#/${defsSegment}/${id}` };
|
||||
}
|
||||
if (entry[1] === root) {
|
||||
return { ref: "#" };
|
||||
}
|
||||
// self-contained schema
|
||||
const uriPrefix = `#`;
|
||||
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
||||
const defId = entry[1].schema.id ?? `__schema${this.counter++}`;
|
||||
return { defId, ref: defUriPrefix + defId };
|
||||
};
|
||||
const extractToDef = (entry) => {
|
||||
if (entry[1].schema.$ref) {
|
||||
return;
|
||||
}
|
||||
const seen = entry[1];
|
||||
const { ref, defId } = makeURI(entry);
|
||||
seen.def = { ...seen.schema };
|
||||
// defId won't be set if the schema is a reference to an external schema
|
||||
if (defId)
|
||||
seen.defId = defId;
|
||||
// wipe away all properties except $ref
|
||||
const schema = seen.schema;
|
||||
for (const key in schema) {
|
||||
delete schema[key];
|
||||
schema.$ref = ref;
|
||||
}
|
||||
};
|
||||
// extract schemas into $defs
|
||||
for (const entry of this.seen.entries()) {
|
||||
const seen = entry[1];
|
||||
// convert root schema to # $ref
|
||||
// also prevents root schema from being extracted
|
||||
if (schema === entry[0]) {
|
||||
// do not copy to defs...this is the root schema
|
||||
extractToDef(entry);
|
||||
continue;
|
||||
}
|
||||
// extract schemas that are in the external registry
|
||||
if (params.external) {
|
||||
const ext = params.external.registry.get(entry[0])?.id;
|
||||
if (schema !== entry[0] && ext) {
|
||||
extractToDef(entry);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// extract schemas with `id` meta
|
||||
const id = this.metadataRegistry.get(entry[0])?.id;
|
||||
if (id) {
|
||||
extractToDef(entry);
|
||||
continue;
|
||||
}
|
||||
// break cycles
|
||||
if (seen.cycle) {
|
||||
if (params.cycles === "throw") {
|
||||
throw new Error("Cycle detected: " +
|
||||
`#/${seen.cycle?.join("/")}/<root>` +
|
||||
'\n\nSet the `cycles` parameter to `"ref"` to resolve cyclical schemas with defs.');
|
||||
}
|
||||
else if (params.cycles === "ref") {
|
||||
extractToDef(entry);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// extract reused schemas
|
||||
if (seen.count > 1) {
|
||||
if (params.reused === "ref") {
|
||||
extractToDef(entry);
|
||||
// biome-ignore lint:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
// flatten _refs
|
||||
const flattenRef = (zodSchema, params) => {
|
||||
const seen = this.seen.get(zodSchema);
|
||||
const schema = seen.def ?? seen.schema;
|
||||
const _schema = { ...schema };
|
||||
if (seen.ref === null) {
|
||||
return;
|
||||
}
|
||||
const ref = seen.ref;
|
||||
seen.ref = null;
|
||||
if (ref) {
|
||||
flattenRef(ref, params);
|
||||
const refSchema = this.seen.get(ref).schema;
|
||||
if (refSchema.$ref && params.target === "draft-7") {
|
||||
schema.allOf = schema.allOf ?? [];
|
||||
schema.allOf.push(refSchema);
|
||||
}
|
||||
else {
|
||||
Object.assign(schema, refSchema);
|
||||
Object.assign(schema, _schema); // this is to prevent overwriting any fields in the original schema
|
||||
}
|
||||
}
|
||||
if (!seen.isParent)
|
||||
this.override({
|
||||
zodSchema,
|
||||
jsonSchema: schema,
|
||||
});
|
||||
};
|
||||
for (const entry of [...this.seen.entries()].reverse()) {
|
||||
flattenRef(entry[0], { target: this.target });
|
||||
}
|
||||
const result = { ...root.def };
|
||||
const defs = params.external?.defs ?? {};
|
||||
for (const entry of this.seen.entries()) {
|
||||
const seen = entry[1];
|
||||
if (seen.def && seen.defId) {
|
||||
defs[seen.defId] = seen.def;
|
||||
}
|
||||
}
|
||||
// set definitions in result
|
||||
if (!params.external && Object.keys(defs).length > 0) {
|
||||
if (this.target === "draft-2020-12") {
|
||||
result.$defs = defs;
|
||||
}
|
||||
else {
|
||||
result.definitions = defs;
|
||||
}
|
||||
}
|
||||
if (this.target === "draft-2020-12") {
|
||||
result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
||||
}
|
||||
else if (this.target === "draft-7") {
|
||||
result.$schema = "http://json-schema.org/draft-07/schema#";
|
||||
}
|
||||
else {
|
||||
console.warn(`Invalid target: ${this.target}`);
|
||||
}
|
||||
try {
|
||||
// this "finalizes" this schema and ensures all cycles are removed
|
||||
// each call to .emit() is functionally independent
|
||||
// though the seen map is shared
|
||||
return JSON.parse(JSON.stringify(result));
|
||||
}
|
||||
catch (_err) {
|
||||
throw new Error("Error converting schema to JSON.");
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.JSONSchemaGenerator = JSONSchemaGenerator;
|
||||
function toJSONSchema(input, _params) {
|
||||
if (input instanceof registries_js_1.$ZodRegistry) {
|
||||
const gen = new JSONSchemaGenerator(_params);
|
||||
const defs = {};
|
||||
for (const entry of input._idmap.entries()) {
|
||||
const [_, schema] = entry;
|
||||
gen.process(schema);
|
||||
}
|
||||
const schemas = {};
|
||||
const external = {
|
||||
registry: input,
|
||||
uri: _params?.uri || ((id) => id),
|
||||
defs,
|
||||
};
|
||||
for (const entry of input._idmap.entries()) {
|
||||
const [key, schema] = entry;
|
||||
schemas[key] = gen.emit(schema, {
|
||||
..._params,
|
||||
external,
|
||||
});
|
||||
}
|
||||
if (Object.keys(defs).length > 0) {
|
||||
const defsSegment = gen.target === "draft-2020-12" ? "$defs" : "definitions";
|
||||
schemas.__shared = {
|
||||
[defsSegment]: defs,
|
||||
};
|
||||
}
|
||||
return { schemas };
|
||||
}
|
||||
const gen = new JSONSchemaGenerator(_params);
|
||||
gen.process(input);
|
||||
return gen.emit(input, _params);
|
||||
}
|
||||
515
node_modules/zod/dist/cjs/v4/core/util.js
generated
vendored
Normal file
515
node_modules/zod/dist/cjs/v4/core/util.js
generated
vendored
Normal file
@@ -0,0 +1,515 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Class = exports.BIGINT_FORMAT_RANGES = exports.NUMBER_FORMAT_RANGES = exports.primitiveTypes = exports.propertyKeyTypes = exports.getParsedType = exports.allowsEval = void 0;
|
||||
exports.assertEqual = assertEqual;
|
||||
exports.assertNotEqual = assertNotEqual;
|
||||
exports.assertIs = assertIs;
|
||||
exports.assertNever = assertNever;
|
||||
exports.assert = assert;
|
||||
exports.getValidEnumValues = getValidEnumValues;
|
||||
exports.joinValues = joinValues;
|
||||
exports.jsonStringifyReplacer = jsonStringifyReplacer;
|
||||
exports.cached = cached;
|
||||
exports.nullish = nullish;
|
||||
exports.cleanRegex = cleanRegex;
|
||||
exports.floatSafeRemainder = floatSafeRemainder;
|
||||
exports.defineLazy = defineLazy;
|
||||
exports.assignProp = assignProp;
|
||||
exports.getElementAtPath = getElementAtPath;
|
||||
exports.promiseAllObject = promiseAllObject;
|
||||
exports.randomString = randomString;
|
||||
exports.esc = esc;
|
||||
exports.isObject = isObject;
|
||||
exports.isPlainObject = isPlainObject;
|
||||
exports.numKeys = numKeys;
|
||||
exports.escapeRegex = escapeRegex;
|
||||
exports.clone = clone;
|
||||
exports.normalizeParams = normalizeParams;
|
||||
exports.createTransparentProxy = createTransparentProxy;
|
||||
exports.stringifyPrimitive = stringifyPrimitive;
|
||||
exports.optionalKeys = optionalKeys;
|
||||
exports.pick = pick;
|
||||
exports.omit = omit;
|
||||
exports.extend = extend;
|
||||
exports.merge = merge;
|
||||
exports.partial = partial;
|
||||
exports.required = required;
|
||||
exports.aborted = aborted;
|
||||
exports.prefixIssues = prefixIssues;
|
||||
exports.unwrapMessage = unwrapMessage;
|
||||
exports.finalizeIssue = finalizeIssue;
|
||||
exports.getSizableOrigin = getSizableOrigin;
|
||||
exports.getLengthableOrigin = getLengthableOrigin;
|
||||
exports.issue = issue;
|
||||
exports.cleanEnum = cleanEnum;
|
||||
// functions
|
||||
function assertEqual(val) {
|
||||
return val;
|
||||
}
|
||||
function assertNotEqual(val) {
|
||||
return val;
|
||||
}
|
||||
function assertIs(_arg) { }
|
||||
function assertNever(_x) {
|
||||
throw new Error();
|
||||
}
|
||||
function assert(_) { }
|
||||
function getValidEnumValues(obj) {
|
||||
const validKeys = Object.keys(obj).filter((k) => typeof obj[obj[k]] !== "number");
|
||||
const filtered = {};
|
||||
for (const k of validKeys) {
|
||||
filtered[k] = obj[k];
|
||||
}
|
||||
return Object.values(filtered);
|
||||
}
|
||||
function joinValues(array, separator = "|") {
|
||||
return array.map((val) => stringifyPrimitive(val)).join(separator);
|
||||
}
|
||||
function jsonStringifyReplacer(_, value) {
|
||||
if (typeof value === "bigint")
|
||||
return value.toString();
|
||||
return value;
|
||||
}
|
||||
function cached(getter) {
|
||||
const set = false;
|
||||
return {
|
||||
get value() {
|
||||
if (!set) {
|
||||
const value = getter();
|
||||
Object.defineProperty(this, "value", { value });
|
||||
return value;
|
||||
}
|
||||
throw new Error("cached value already set");
|
||||
},
|
||||
};
|
||||
}
|
||||
function nullish(input) {
|
||||
return input === null || input === undefined;
|
||||
}
|
||||
function cleanRegex(source) {
|
||||
const start = source.startsWith("^") ? 1 : 0;
|
||||
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
||||
return source.slice(start, end);
|
||||
}
|
||||
function floatSafeRemainder(val, step) {
|
||||
const valDecCount = (val.toString().split(".")[1] || "").length;
|
||||
const stepDecCount = (step.toString().split(".")[1] || "").length;
|
||||
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
||||
const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
|
||||
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
||||
return (valInt % stepInt) / 10 ** decCount;
|
||||
}
|
||||
function defineLazy(object, key, getter) {
|
||||
const set = false;
|
||||
Object.defineProperty(object, key, {
|
||||
get() {
|
||||
if (!set) {
|
||||
const value = getter();
|
||||
object[key] = value;
|
||||
return value;
|
||||
}
|
||||
throw new Error("cached value already set");
|
||||
},
|
||||
set(v) {
|
||||
Object.defineProperty(object, key, {
|
||||
value: v,
|
||||
// configurable: true,
|
||||
});
|
||||
// object[key] = v;
|
||||
},
|
||||
configurable: true,
|
||||
});
|
||||
}
|
||||
function assignProp(target, prop, value) {
|
||||
Object.defineProperty(target, prop, {
|
||||
value,
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
});
|
||||
}
|
||||
function getElementAtPath(obj, path) {
|
||||
if (!path)
|
||||
return obj;
|
||||
return path.reduce((acc, key) => acc?.[key], obj);
|
||||
}
|
||||
function promiseAllObject(promisesObj) {
|
||||
const keys = Object.keys(promisesObj);
|
||||
const promises = keys.map((key) => promisesObj[key]);
|
||||
return Promise.all(promises).then((results) => {
|
||||
const resolvedObj = {};
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
resolvedObj[keys[i]] = results[i];
|
||||
}
|
||||
return resolvedObj;
|
||||
});
|
||||
}
|
||||
function randomString(length = 10) {
|
||||
const chars = "abcdefghijklmnopqrstuvwxyz";
|
||||
let str = "";
|
||||
for (let i = 0; i < length; i++) {
|
||||
str += chars[Math.floor(Math.random() * chars.length)];
|
||||
}
|
||||
return str;
|
||||
}
|
||||
function esc(str) {
|
||||
return JSON.stringify(str);
|
||||
}
|
||||
function isObject(data) {
|
||||
return typeof data === "object" && data !== null;
|
||||
}
|
||||
exports.allowsEval = cached(() => {
|
||||
try {
|
||||
const F = Function;
|
||||
new F("");
|
||||
return true;
|
||||
}
|
||||
catch (_) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
function isPlainObject(data) {
|
||||
return typeof data === "object" && data !== null && Object.getPrototypeOf(data) === Object.prototype;
|
||||
}
|
||||
function numKeys(data) {
|
||||
let keyCount = 0;
|
||||
for (const key in data) {
|
||||
if (Object.prototype.hasOwnProperty.call(data, key)) {
|
||||
keyCount++;
|
||||
}
|
||||
}
|
||||
return keyCount;
|
||||
}
|
||||
const getParsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "undefined":
|
||||
return "undefined";
|
||||
case "string":
|
||||
return "string";
|
||||
case "number":
|
||||
return Number.isNaN(data) ? "nan" : "number";
|
||||
case "boolean":
|
||||
return "boolean";
|
||||
case "function":
|
||||
return "function";
|
||||
case "bigint":
|
||||
return "bigint";
|
||||
case "symbol":
|
||||
return "symbol";
|
||||
case "object":
|
||||
if (Array.isArray(data)) {
|
||||
return "array";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
|
||||
return "promise";
|
||||
}
|
||||
if (typeof Map !== "undefined" && data instanceof Map) {
|
||||
return "map";
|
||||
}
|
||||
if (typeof Set !== "undefined" && data instanceof Set) {
|
||||
return "set";
|
||||
}
|
||||
if (typeof Date !== "undefined" && data instanceof Date) {
|
||||
return "date";
|
||||
}
|
||||
if (typeof File !== "undefined" && data instanceof File) {
|
||||
return "file";
|
||||
}
|
||||
return "object";
|
||||
default:
|
||||
throw new Error(`Unknown data type: ${t}`);
|
||||
}
|
||||
};
|
||||
exports.getParsedType = getParsedType;
|
||||
exports.propertyKeyTypes = new Set(["string", "number", "symbol"]);
|
||||
exports.primitiveTypes = new Set(["string", "number", "bigint", "boolean", "symbol", "undefined"]);
|
||||
function escapeRegex(str) {
|
||||
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
}
|
||||
// zod-specific utils
|
||||
function clone(inst, def, params) {
|
||||
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
||||
if (!def || params?.parent)
|
||||
cl._zod.parent = inst;
|
||||
return cl;
|
||||
}
|
||||
function normalizeParams(_params) {
|
||||
const params = _params;
|
||||
if (!params)
|
||||
return {};
|
||||
if (typeof params === "string")
|
||||
return { error: () => params };
|
||||
if (params?.message !== undefined) {
|
||||
if (params?.error !== undefined)
|
||||
throw new Error("Cannot specify both `message` and `error` params");
|
||||
params.error = params.message;
|
||||
}
|
||||
delete params.message;
|
||||
if (typeof params.error === "string")
|
||||
return { ...params, error: () => params.error };
|
||||
return params;
|
||||
}
|
||||
function createTransparentProxy(getter) {
|
||||
let target;
|
||||
return new Proxy({}, {
|
||||
get(_, prop, receiver) {
|
||||
target ?? (target = getter());
|
||||
return Reflect.get(target, prop, receiver);
|
||||
},
|
||||
set(_, prop, value, receiver) {
|
||||
target ?? (target = getter());
|
||||
return Reflect.set(target, prop, value, receiver);
|
||||
},
|
||||
has(_, prop) {
|
||||
target ?? (target = getter());
|
||||
return Reflect.has(target, prop);
|
||||
},
|
||||
deleteProperty(_, prop) {
|
||||
target ?? (target = getter());
|
||||
return Reflect.deleteProperty(target, prop);
|
||||
},
|
||||
ownKeys(_) {
|
||||
target ?? (target = getter());
|
||||
return Reflect.ownKeys(target);
|
||||
},
|
||||
getOwnPropertyDescriptor(_, prop) {
|
||||
target ?? (target = getter());
|
||||
return Reflect.getOwnPropertyDescriptor(target, prop);
|
||||
},
|
||||
defineProperty(_, prop, descriptor) {
|
||||
target ?? (target = getter());
|
||||
return Reflect.defineProperty(target, prop, descriptor);
|
||||
},
|
||||
});
|
||||
}
|
||||
function stringifyPrimitive(value) {
|
||||
if (typeof value === "bigint")
|
||||
return value.toString() + "n";
|
||||
if (typeof value === "string")
|
||||
return `"${value}"`;
|
||||
return `${value}`;
|
||||
}
|
||||
function optionalKeys(shape) {
|
||||
return Object.keys(shape).filter((k) => {
|
||||
return shape[k]._zod.optin === "optional";
|
||||
});
|
||||
}
|
||||
exports.NUMBER_FORMAT_RANGES = {
|
||||
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
||||
int32: [-2147483648, 2147483647],
|
||||
uint32: [0, 4294967295],
|
||||
float32: [-3.4028234663852886e38, 3.4028234663852886e38],
|
||||
float64: [-Number.MAX_VALUE, Number.MAX_VALUE],
|
||||
};
|
||||
exports.BIGINT_FORMAT_RANGES = {
|
||||
int64: [/* @__PURE__*/ BigInt("-9223372036854775808"), /* @__PURE__*/ BigInt("9223372036854775807")],
|
||||
uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt("18446744073709551615")],
|
||||
};
|
||||
function pick(schema, mask) {
|
||||
const newShape = {};
|
||||
const currDef = schema._zod.def; //.shape;
|
||||
for (const key in mask) {
|
||||
if (!(key in currDef.shape)) {
|
||||
throw new Error(`Unrecognized key: "${key}"`);
|
||||
}
|
||||
if (!mask[key])
|
||||
continue;
|
||||
// pick key
|
||||
newShape[key] = currDef.shape[key];
|
||||
}
|
||||
return clone(schema, {
|
||||
...schema._zod.def,
|
||||
shape: newShape,
|
||||
checks: [],
|
||||
});
|
||||
}
|
||||
function omit(schema, mask) {
|
||||
const newShape = { ...schema._zod.def.shape };
|
||||
const currDef = schema._zod.def; //.shape;
|
||||
for (const key in mask) {
|
||||
if (!(key in currDef.shape)) {
|
||||
throw new Error(`Unrecognized key: "${key}"`);
|
||||
}
|
||||
if (!mask[key])
|
||||
continue;
|
||||
delete newShape[key];
|
||||
}
|
||||
return clone(schema, {
|
||||
...schema._zod.def,
|
||||
shape: newShape,
|
||||
checks: [],
|
||||
});
|
||||
}
|
||||
function extend(schema, shape) {
|
||||
const def = {
|
||||
...schema._zod.def,
|
||||
get shape() {
|
||||
const _shape = { ...schema._zod.def.shape, ...shape };
|
||||
assignProp(this, "shape", _shape); // self-caching
|
||||
return _shape;
|
||||
},
|
||||
checks: [], // delete existing checks
|
||||
};
|
||||
return clone(schema, def);
|
||||
}
|
||||
function merge(a, b) {
|
||||
return clone(a, {
|
||||
...a._zod.def,
|
||||
get shape() {
|
||||
const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
|
||||
assignProp(this, "shape", _shape); // self-caching
|
||||
return _shape;
|
||||
},
|
||||
catchall: b._zod.def.catchall,
|
||||
checks: [], // delete existing checks
|
||||
});
|
||||
}
|
||||
function partial(Class, schema, mask) {
|
||||
const oldShape = schema._zod.def.shape;
|
||||
const shape = { ...oldShape };
|
||||
if (mask) {
|
||||
for (const key in mask) {
|
||||
if (!(key in oldShape)) {
|
||||
throw new Error(`Unrecognized key: "${key}"`);
|
||||
}
|
||||
if (!mask[key])
|
||||
continue;
|
||||
shape[key] = Class
|
||||
? new Class({
|
||||
type: "optional",
|
||||
innerType: oldShape[key],
|
||||
})
|
||||
: oldShape[key];
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (const key in oldShape) {
|
||||
shape[key] = Class
|
||||
? new Class({
|
||||
type: "optional",
|
||||
innerType: oldShape[key],
|
||||
})
|
||||
: oldShape[key];
|
||||
}
|
||||
}
|
||||
return clone(schema, {
|
||||
...schema._zod.def,
|
||||
shape,
|
||||
checks: [],
|
||||
});
|
||||
}
|
||||
function required(Class, schema, mask) {
|
||||
const oldShape = schema._zod.def.shape;
|
||||
const shape = { ...oldShape };
|
||||
if (mask) {
|
||||
for (const key in mask) {
|
||||
if (!(key in shape)) {
|
||||
throw new Error(`Unrecognized key: "${key}"`);
|
||||
}
|
||||
if (!mask[key])
|
||||
continue;
|
||||
// overwrite with non-optional
|
||||
shape[key] = new Class({
|
||||
type: "nonoptional",
|
||||
innerType: oldShape[key],
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (const key in oldShape) {
|
||||
// overwrite with non-optional
|
||||
shape[key] = new Class({
|
||||
type: "nonoptional",
|
||||
innerType: oldShape[key],
|
||||
});
|
||||
}
|
||||
}
|
||||
return clone(schema, {
|
||||
...schema._zod.def,
|
||||
shape,
|
||||
// optional: [],
|
||||
checks: [],
|
||||
});
|
||||
}
|
||||
function aborted(x, startIndex = 0) {
|
||||
for (let i = startIndex; i < x.issues.length; i++) {
|
||||
if (x.issues[i].continue !== true)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function prefixIssues(path, issues) {
|
||||
return issues.map((iss) => {
|
||||
var _a;
|
||||
(_a = iss).path ?? (_a.path = []);
|
||||
iss.path.unshift(path);
|
||||
return iss;
|
||||
});
|
||||
}
|
||||
function unwrapMessage(message) {
|
||||
return typeof message === "string" ? message : message?.message;
|
||||
}
|
||||
function finalizeIssue(iss, ctx, config) {
|
||||
const full = { ...iss, path: iss.path ?? [] };
|
||||
// for backwards compatibility
|
||||
if (!iss.message) {
|
||||
const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ??
|
||||
unwrapMessage(ctx?.error?.(iss)) ??
|
||||
unwrapMessage(config.customError?.(iss)) ??
|
||||
unwrapMessage(config.localeError?.(iss)) ??
|
||||
"Invalid input";
|
||||
full.message = message;
|
||||
}
|
||||
// delete (full as any).def;
|
||||
delete full.inst;
|
||||
delete full.continue;
|
||||
if (!ctx?.reportInput) {
|
||||
delete full.input;
|
||||
}
|
||||
return full;
|
||||
}
|
||||
function getSizableOrigin(input) {
|
||||
if (input instanceof Set)
|
||||
return "set";
|
||||
if (input instanceof Map)
|
||||
return "map";
|
||||
if (input instanceof File)
|
||||
return "file";
|
||||
return "unknown";
|
||||
}
|
||||
function getLengthableOrigin(input) {
|
||||
if (Array.isArray(input))
|
||||
return "array";
|
||||
if (typeof input === "string")
|
||||
return "string";
|
||||
return "unknown";
|
||||
}
|
||||
function issue(...args) {
|
||||
const [iss, input, inst] = args;
|
||||
if (typeof iss === "string") {
|
||||
return {
|
||||
message: iss,
|
||||
code: "custom",
|
||||
input,
|
||||
inst,
|
||||
};
|
||||
}
|
||||
return { ...iss };
|
||||
}
|
||||
function cleanEnum(obj) {
|
||||
return Object.entries(obj)
|
||||
.filter(([k, _]) => {
|
||||
// return true if NaN, meaning it's not a number, thus a string key
|
||||
return Number.isNaN(Number.parseInt(k, 10));
|
||||
})
|
||||
.map((el) => el[1]);
|
||||
}
|
||||
// instanceof
|
||||
class Class {
|
||||
constructor(..._args) { }
|
||||
}
|
||||
exports.Class = Class;
|
||||
8
node_modules/zod/dist/cjs/v4/core/versions.js
generated
vendored
Normal file
8
node_modules/zod/dist/cjs/v4/core/versions.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = void 0;
|
||||
exports.version = {
|
||||
major: 4,
|
||||
minor: 0,
|
||||
patch: 0,
|
||||
};
|
||||
172
node_modules/zod/dist/cjs/v4/core/zsf.js
generated
vendored
Normal file
172
node_modules/zod/dist/cjs/v4/core/zsf.js
generated
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
///////////////////////////////////////////////////
|
||||
//////////////// TYPES ///////////////////
|
||||
///////////////////////////////////////////////////
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/////////////////////////////////////////////////
|
||||
//////////////// CHECKS ////////////////
|
||||
/////////////////////////////////////////////////
|
||||
// export interface $ZSFCheckRegex {
|
||||
// check: "regex";
|
||||
// pattern: string;
|
||||
// }
|
||||
// export interface $ZSFCheckEmail {
|
||||
// check: "email";
|
||||
// }
|
||||
// export interface $ZSFCheckURL {
|
||||
// check: "url";
|
||||
// }
|
||||
// export interface $ZSFCheckEmoji {
|
||||
// check: "emoji";
|
||||
// }
|
||||
// export interface $ZSFCheckUUID {
|
||||
// check: "uuid";
|
||||
// }
|
||||
// export interface $ZSFCheckUUIDv4 {
|
||||
// check: "uuidv4";
|
||||
// }
|
||||
// export interface $ZSFCheckUUIDv6 {
|
||||
// check: "uuidv6";
|
||||
// }
|
||||
// export interface $ZSFCheckNanoid {
|
||||
// check: "nanoid";
|
||||
// }
|
||||
// export interface $ZSFCheckGUID {
|
||||
// check: "guid";
|
||||
// }
|
||||
// export interface $ZSFCheckCUID {
|
||||
// check: "cuid";
|
||||
// }
|
||||
// export interface $ZSFCheckCUID2 {
|
||||
// check: "cuid2";
|
||||
// }
|
||||
// export interface $ZSFCheckULID {
|
||||
// check: "ulid";
|
||||
// }
|
||||
// export interface $ZSFCheckXID {
|
||||
// check: "xid";
|
||||
// }
|
||||
// export interface $ZSFCheckKSUID {
|
||||
// check: "ksuid";
|
||||
// }
|
||||
// export interface $ZSFCheckISODateTime {
|
||||
// check: "datetime";
|
||||
// precision?: number;
|
||||
// local?: boolean;
|
||||
// }
|
||||
// export interface $ZSFCheckISODate {
|
||||
// check: "date";
|
||||
// }
|
||||
// export interface $ZSFCheckISOTime {
|
||||
// check: "time";
|
||||
// precision?: number;
|
||||
// local?: boolean;
|
||||
// }
|
||||
// export interface $ZSFCheckDuration {
|
||||
// check: "duration";
|
||||
// }
|
||||
// export interface $ZSFCheckIP {
|
||||
// check: "ip";
|
||||
// }
|
||||
// export interface $ZSFCheckIPv4 {
|
||||
// check: "ipv4";
|
||||
// }
|
||||
// export interface $ZSFCheckIPv6 {
|
||||
// check: "ipv6";
|
||||
// }
|
||||
// export interface $ZSFCheckBase64 {
|
||||
// check: "base64";
|
||||
// }
|
||||
// export interface $ZSFCheckJWT {
|
||||
// check: "jwt";
|
||||
// }
|
||||
// export interface $ZSFCheckJSONString {
|
||||
// check: "json_string";
|
||||
// }
|
||||
// export interface $ZSFCheckPrefix {
|
||||
// check: "prefix";
|
||||
// prefix: string;
|
||||
// }
|
||||
// export interface $ZSFCheckSuffix {
|
||||
// check: "suffix";
|
||||
// suffix: string;
|
||||
// }
|
||||
// export interface $ZSFCheckIncludes {
|
||||
// check: "includes";
|
||||
// includes: string;
|
||||
// }
|
||||
// export interface $ZSFCheckMinSize {
|
||||
// check: "min_size";
|
||||
// minimum: number;
|
||||
// }
|
||||
// export interface $ZSFCheckMaxSize {
|
||||
// check: "max_size";
|
||||
// maximum: number;
|
||||
// }
|
||||
// export interface $ZSFCheckSizeEquals {
|
||||
// check: "size_equals";
|
||||
// size: number;
|
||||
// }
|
||||
// export interface $ZSFCheckLessThan {
|
||||
// check: "less_than";
|
||||
// maximum: number | bigint | Date;
|
||||
// }
|
||||
// export interface $ZSFCheckLessThanOrEqual {
|
||||
// check: "less_than_or_equal";
|
||||
// maximum: number | bigint | Date;
|
||||
// }
|
||||
// export interface $ZSFCheckGreaterThan {
|
||||
// check: "greater_than";
|
||||
// minimum: number | bigint | Date;
|
||||
// }
|
||||
// export interface $ZSFCheckGreaterThanOrEqual {
|
||||
// check: "greater_than_or_equal";
|
||||
// minimum: number | bigint | Date;
|
||||
// }
|
||||
// export interface $ZSFCheckEquals {
|
||||
// check: "equals";
|
||||
// value: number | bigint | Date;
|
||||
// }
|
||||
// export interface $ZSFCheckMultipleOf {
|
||||
// check: "multiple_of";
|
||||
// multipleOf: number;
|
||||
// }
|
||||
// export type $ZSFStringFormatChecks =
|
||||
// | $ZSFCheckRegex
|
||||
// | $ZSFCheckEmail
|
||||
// | $ZSFCheckURL
|
||||
// | $ZSFCheckEmoji
|
||||
// | $ZSFCheckUUID
|
||||
// | $ZSFCheckUUIDv4
|
||||
// | $ZSFCheckUUIDv6
|
||||
// | $ZSFCheckNanoid
|
||||
// | $ZSFCheckGUID
|
||||
// | $ZSFCheckCUID
|
||||
// | $ZSFCheckCUID2
|
||||
// | $ZSFCheckULID
|
||||
// | $ZSFCheckXID
|
||||
// | $ZSFCheckKSUID
|
||||
// | $ZSFCheckISODateTime
|
||||
// | $ZSFCheckISODate
|
||||
// | $ZSFCheckISOTime
|
||||
// | $ZSFCheckDuration
|
||||
// | $ZSFCheckIP
|
||||
// | $ZSFCheckIPv4
|
||||
// | $ZSFCheckIPv6
|
||||
// | $ZSFCheckBase64
|
||||
// | $ZSFCheckJWT
|
||||
// | $ZSFCheckJSONString
|
||||
// | $ZSFCheckPrefix
|
||||
// | $ZSFCheckSuffix
|
||||
// | $ZSFCheckIncludes;
|
||||
// export type $ZSFCheck =
|
||||
// | $ZSFStringFormatChecks
|
||||
// | $ZSFCheckMinSize
|
||||
// | $ZSFCheckMaxSize
|
||||
// | $ZSFCheckSizeEquals
|
||||
// | $ZSFCheckLessThan
|
||||
// | $ZSFCheckLessThanOrEqual
|
||||
// | $ZSFCheckGreaterThan
|
||||
// | $ZSFCheckGreaterThanOrEqual
|
||||
// | $ZSFCheckEquals
|
||||
// | $ZSFCheckMultipleOf;
|
||||
22
node_modules/zod/dist/cjs/v4/index.js
generated
vendored
Normal file
22
node_modules/zod/dist/cjs/v4/index.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const index_js_1 = __importDefault(require("./classic/index.js"));
|
||||
__exportStar(require("./classic/index.js"), exports);
|
||||
exports.default = index_js_1.default;
|
||||
143
node_modules/zod/dist/cjs/v4/locales/ar.js
generated
vendored
Normal file
143
node_modules/zod/dist/cjs/v4/locales/ar.js
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "حرف", verb: "أن يحوي" },
|
||||
file: { unit: "بايت", verb: "أن يحوي" },
|
||||
array: { unit: "عنصر", verb: "أن يحوي" },
|
||||
set: { unit: "عنصر", verb: "أن يحوي" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "number";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "array";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "مدخل",
|
||||
email: "بريد إلكتروني",
|
||||
url: "رابط",
|
||||
emoji: "إيموجي",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "تاريخ ووقت بمعيار ISO",
|
||||
date: "تاريخ بمعيار ISO",
|
||||
time: "وقت بمعيار ISO",
|
||||
duration: "مدة بمعيار ISO",
|
||||
ipv4: "عنوان IPv4",
|
||||
ipv6: "عنوان IPv6",
|
||||
cidrv4: "مدى عناوين بصيغة IPv4",
|
||||
cidrv6: "مدى عناوين بصيغة IPv6",
|
||||
base64: "نَص بترميز base64-encoded",
|
||||
base64url: "نَص بترميز base64url-encoded",
|
||||
json_string: "نَص على هيئة JSON",
|
||||
e164: "رقم هاتف بمعيار E.164",
|
||||
jwt: "JWT",
|
||||
template_literal: "مدخل",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `مدخلات غير مقبولة: يفترض إدخال ${issue.expected}، ولكن تم إدخال ${(0, exports.parsedType)(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `مدخلات غير مقبولة: يفترض إدخال ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return ` أكبر من اللازم: يفترض أن تكون ${issue.origin ?? "القيمة"} ${adj} ${issue.maximum.toString()} ${sizing.unit ?? "عنصر"}`;
|
||||
return `أكبر من اللازم: يفترض أن تكون ${issue.origin ?? "القيمة"} ${adj} ${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `أصغر من اللازم: يفترض لـ ${issue.origin} أن يكون ${adj} ${issue.minimum.toString()} ${sizing.unit}`;
|
||||
}
|
||||
return `أصغر من اللازم: يفترض لـ ${issue.origin} أن يكون ${adj} ${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `نَص غير مقبول: يجب أن يبدأ بـ "${issue.prefix}"`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `نَص غير مقبول: يجب أن ينتهي بـ "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes")
|
||||
return `نَص غير مقبول: يجب أن يتضمَّن "${_issue.includes}"`;
|
||||
if (_issue.format === "regex")
|
||||
return `نَص غير مقبول: يجب أن يطابق النمط ${_issue.pattern}`;
|
||||
return `${Nouns[_issue.format] ?? issue.format} غير مقبول`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `رقم غير مقبول: يجب أن يكون من مضاعفات ${issue.divisor}`;
|
||||
case "unrecognized_keys":
|
||||
return `معرف${issue.keys.length > 1 ? "ات" : ""} غريب${issue.keys.length > 1 ? "ة" : ""}: ${util.joinValues(issue.keys, "، ")}`;
|
||||
case "invalid_key":
|
||||
return `معرف غير مقبول في ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return "مدخل غير مقبول";
|
||||
case "invalid_element":
|
||||
return `مدخل غير مقبول في ${issue.origin}`;
|
||||
default:
|
||||
return "مدخل غير مقبول";
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
142
node_modules/zod/dist/cjs/v4/locales/az.js
generated
vendored
Normal file
142
node_modules/zod/dist/cjs/v4/locales/az.js
generated
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "simvol", verb: "olmalıdır" },
|
||||
file: { unit: "bayt", verb: "olmalıdır" },
|
||||
array: { unit: "element", verb: "olmalıdır" },
|
||||
set: { unit: "element", verb: "olmalıdır" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "number";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "array";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "input",
|
||||
email: "email address",
|
||||
url: "URL",
|
||||
emoji: "emoji",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "ISO datetime",
|
||||
date: "ISO date",
|
||||
time: "ISO time",
|
||||
duration: "ISO duration",
|
||||
ipv4: "IPv4 address",
|
||||
ipv6: "IPv6 address",
|
||||
cidrv4: "IPv4 range",
|
||||
cidrv6: "IPv6 range",
|
||||
base64: "base64-encoded string",
|
||||
base64url: "base64url-encoded string",
|
||||
json_string: "JSON string",
|
||||
e164: "E.164 number",
|
||||
jwt: "JWT",
|
||||
template_literal: "input",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `Yanlış dəyər: gözlənilən ${issue.expected}, daxil olan ${(0, exports.parsedType)(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Yanlış dəyər: gözlənilən ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Yanlış seçim: aşağıdakılardan biri olmalıdır: ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `Çox böyük: gözlənilən ${issue.origin ?? "dəyər"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "element"}`;
|
||||
return `Çox böyük: gözlənilən ${issue.origin ?? "dəyər"} ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `Çox kiçik: gözlənilən ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
||||
return `Çox kiçik: gözlənilən ${issue.origin} ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `Yanlış mətn: "${_issue.prefix}" ilə başlamalıdır`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `Yanlış mətn: "${_issue.suffix}" ilə bitməlidir`;
|
||||
if (_issue.format === "includes")
|
||||
return `Yanlış mətn: "${_issue.includes}" daxil olmalıdır`;
|
||||
if (_issue.format === "regex")
|
||||
return `Yanlış mətn: ${_issue.pattern} şablonuna uyğun olmalıdır`;
|
||||
return `Yanlış ${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Yanlış ədəd: ${issue.divisor} ilə bölünə bilən olmalıdır`;
|
||||
case "unrecognized_keys":
|
||||
return `Tanınmayan açar${issue.keys.length > 1 ? "lar" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `${issue.origin} daxilində yanlış açar`;
|
||||
case "invalid_union":
|
||||
return "Yanlış dəyər";
|
||||
case "invalid_element":
|
||||
return `${issue.origin} daxilində yanlış dəyər`;
|
||||
default:
|
||||
return `Yanlış dəyər`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
191
node_modules/zod/dist/cjs/v4/locales/be.js
generated
vendored
Normal file
191
node_modules/zod/dist/cjs/v4/locales/be.js
generated
vendored
Normal file
@@ -0,0 +1,191 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
function getBelarusianPlural(count, one, few, many) {
|
||||
const absCount = Math.abs(count);
|
||||
const lastDigit = absCount % 10;
|
||||
const lastTwoDigits = absCount % 100;
|
||||
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
||||
return many;
|
||||
}
|
||||
if (lastDigit === 1) {
|
||||
return one;
|
||||
}
|
||||
if (lastDigit >= 2 && lastDigit <= 4) {
|
||||
return few;
|
||||
}
|
||||
return many;
|
||||
}
|
||||
const Sizable = {
|
||||
string: {
|
||||
unit: {
|
||||
one: "сімвал",
|
||||
few: "сімвалы",
|
||||
many: "сімвалаў",
|
||||
},
|
||||
verb: "мець",
|
||||
},
|
||||
array: {
|
||||
unit: {
|
||||
one: "элемент",
|
||||
few: "элементы",
|
||||
many: "элементаў",
|
||||
},
|
||||
verb: "мець",
|
||||
},
|
||||
set: {
|
||||
unit: {
|
||||
one: "элемент",
|
||||
few: "элементы",
|
||||
many: "элементаў",
|
||||
},
|
||||
verb: "мець",
|
||||
},
|
||||
file: {
|
||||
unit: {
|
||||
one: "байт",
|
||||
few: "байты",
|
||||
many: "байтаў",
|
||||
},
|
||||
verb: "мець",
|
||||
},
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "лік";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "масіў";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "увод",
|
||||
email: "email адрас",
|
||||
url: "URL",
|
||||
emoji: "эмодзі",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "ISO дата і час",
|
||||
date: "ISO дата",
|
||||
time: "ISO час",
|
||||
duration: "ISO працягласць",
|
||||
ipv4: "IPv4 адрас",
|
||||
ipv6: "IPv6 адрас",
|
||||
cidrv4: "IPv4 дыяпазон",
|
||||
cidrv6: "IPv6 дыяпазон",
|
||||
base64: "радок у фармаце base64",
|
||||
base64url: "радок у фармаце base64url",
|
||||
json_string: "JSON радок",
|
||||
e164: "нумар E.164",
|
||||
jwt: "JWT",
|
||||
template_literal: "увод",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `Няправільны ўвод: чакаўся ${issue.expected}, атрымана ${(0, exports.parsedType)(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Няправільны ўвод: чакалася ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Няправільны варыянт: чакаўся адзін з ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
const maxValue = Number(issue.maximum);
|
||||
const unit = getBelarusianPlural(maxValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);
|
||||
return `Занадта вялікі: чакалася, што ${issue.origin ?? "значэнне"} павінна ${sizing.verb} ${adj}${issue.maximum.toString()} ${unit}`;
|
||||
}
|
||||
return `Занадта вялікі: чакалася, што ${issue.origin ?? "значэнне"} павінна быць ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
const minValue = Number(issue.minimum);
|
||||
const unit = getBelarusianPlural(minValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);
|
||||
return `Занадта малы: чакалася, што ${issue.origin} павінна ${sizing.verb} ${adj}${issue.minimum.toString()} ${unit}`;
|
||||
}
|
||||
return `Занадта малы: чакалася, што ${issue.origin} павінна быць ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `Няправільны радок: павінен пачынацца з "${_issue.prefix}"`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `Няправільны радок: павінен заканчвацца на "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes")
|
||||
return `Няправільны радок: павінен змяшчаць "${_issue.includes}"`;
|
||||
if (_issue.format === "regex")
|
||||
return `Няправільны радок: павінен адпавядаць шаблону ${_issue.pattern}`;
|
||||
return `Няправільны ${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Няправільны лік: павінен быць кратным ${issue.divisor}`;
|
||||
case "unrecognized_keys":
|
||||
return `Нераспазнаны ${issue.keys.length > 1 ? "ключы" : "ключ"}: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `Няправільны ключ у ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return "Няправільны ўвод";
|
||||
case "invalid_element":
|
||||
return `Няправільнае значэнне ў ${issue.origin}`;
|
||||
default:
|
||||
return `Няправільны ўвод`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
145
node_modules/zod/dist/cjs/v4/locales/ca.js
generated
vendored
Normal file
145
node_modules/zod/dist/cjs/v4/locales/ca.js
generated
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "caràcters", verb: "contenir" },
|
||||
file: { unit: "bytes", verb: "contenir" },
|
||||
array: { unit: "elements", verb: "contenir" },
|
||||
set: { unit: "elements", verb: "contenir" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "number";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "array";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "entrada",
|
||||
email: "adreça electrònica",
|
||||
url: "URL",
|
||||
emoji: "emoji",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "data i hora ISO",
|
||||
date: "data ISO",
|
||||
time: "hora ISO",
|
||||
duration: "durada ISO",
|
||||
ipv4: "adreça IPv4",
|
||||
ipv6: "adreça IPv6",
|
||||
cidrv4: "rang IPv4",
|
||||
cidrv6: "rang IPv6",
|
||||
base64: "cadena codificada en base64",
|
||||
base64url: "cadena codificada en base64url",
|
||||
json_string: "cadena JSON",
|
||||
e164: "número E.164",
|
||||
jwt: "JWT",
|
||||
template_literal: "entrada",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `Tipus invàlid: s'esperava ${issue.expected}, s'ha rebut ${(0, exports.parsedType)(issue.input)}`;
|
||||
// return `Tipus invàlid: s'esperava ${issue.expected}, s'ha rebut ${util.getParsedType(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Valor invàlid: s'esperava ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Opció invàlida: s'esperava una de ${util.joinValues(issue.values, " o ")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "com a màxim" : "menys de";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `Massa gran: s'esperava que ${issue.origin ?? "el valor"} contingués ${adj} ${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
|
||||
return `Massa gran: s'esperava que ${issue.origin ?? "el valor"} fos ${adj} ${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? "com a mínim" : "més de";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `Massa petit: s'esperava que ${issue.origin} contingués ${adj} ${issue.minimum.toString()} ${sizing.unit}`;
|
||||
}
|
||||
return `Massa petit: s'esperava que ${issue.origin} fos ${adj} ${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with") {
|
||||
return `Format invàlid: ha de començar amb "${_issue.prefix}"`;
|
||||
}
|
||||
if (_issue.format === "ends_with")
|
||||
return `Format invàlid: ha d'acabar amb "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes")
|
||||
return `Format invàlid: ha d'incloure "${_issue.includes}"`;
|
||||
if (_issue.format === "regex")
|
||||
return `Format invàlid: ha de coincidir amb el patró ${_issue.pattern}`;
|
||||
return `Format invàlid per a ${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Número invàlid: ha de ser múltiple de ${issue.divisor}`;
|
||||
case "unrecognized_keys":
|
||||
return `Clau${issue.keys.length > 1 ? "s" : ""} no reconeguda${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `Clau invàlida a ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return "Entrada invàlida"; // Could also be "Tipus d'unió invàlid" but "Entrada invàlida" is more general
|
||||
case "invalid_element":
|
||||
return `Element invàlid a ${issue.origin}`;
|
||||
default:
|
||||
return `Entrada invàlida`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
162
node_modules/zod/dist/cjs/v4/locales/cs.js
generated
vendored
Normal file
162
node_modules/zod/dist/cjs/v4/locales/cs.js
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "znaků", verb: "mít" },
|
||||
file: { unit: "bajtů", verb: "mít" },
|
||||
array: { unit: "prvků", verb: "mít" },
|
||||
set: { unit: "prvků", verb: "mít" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "číslo";
|
||||
}
|
||||
case "string": {
|
||||
return "řetězec";
|
||||
}
|
||||
case "boolean": {
|
||||
return "boolean";
|
||||
}
|
||||
case "bigint": {
|
||||
return "bigint";
|
||||
}
|
||||
case "function": {
|
||||
return "funkce";
|
||||
}
|
||||
case "symbol": {
|
||||
return "symbol";
|
||||
}
|
||||
case "undefined": {
|
||||
return "undefined";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "pole";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "regulární výraz",
|
||||
email: "e-mailová adresa",
|
||||
url: "URL",
|
||||
emoji: "emoji",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "datum a čas ve formátu ISO",
|
||||
date: "datum ve formátu ISO",
|
||||
time: "čas ve formátu ISO",
|
||||
duration: "doba trvání ISO",
|
||||
ipv4: "IPv4 adresa",
|
||||
ipv6: "IPv6 adresa",
|
||||
cidrv4: "rozsah IPv4",
|
||||
cidrv6: "rozsah IPv6",
|
||||
base64: "řetězec zakódovaný ve formátu base64",
|
||||
base64url: "řetězec zakódovaný ve formátu base64url",
|
||||
json_string: "řetězec ve formátu JSON",
|
||||
e164: "číslo E.164",
|
||||
jwt: "JWT",
|
||||
template_literal: "vstup",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `Neplatný vstup: očekáváno ${issue.expected}, obdrženo ${(0, exports.parsedType)(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Neplatný vstup: očekáváno ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Neplatná možnost: očekávána jedna z hodnot ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `Hodnota je příliš velká: ${issue.origin ?? "hodnota"} musí mít ${adj}${issue.maximum.toString()} ${sizing.unit ?? "prvků"}`;
|
||||
}
|
||||
return `Hodnota je příliš velká: ${issue.origin ?? "hodnota"} musí být ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `Hodnota je příliš malá: ${issue.origin ?? "hodnota"} musí mít ${adj}${issue.minimum.toString()} ${sizing.unit ?? "prvků"}`;
|
||||
}
|
||||
return `Hodnota je příliš malá: ${issue.origin ?? "hodnota"} musí být ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `Neplatný řetězec: musí začínat na "${_issue.prefix}"`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `Neplatný řetězec: musí končit na "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes")
|
||||
return `Neplatný řetězec: musí obsahovat "${_issue.includes}"`;
|
||||
if (_issue.format === "regex")
|
||||
return `Neplatný řetězec: musí odpovídat vzoru ${_issue.pattern}`;
|
||||
return `Neplatný formát ${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Neplatné číslo: musí být násobkem ${issue.divisor}`;
|
||||
case "unrecognized_keys":
|
||||
return `Neznámé klíče: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `Neplatný klíč v ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return "Neplatný vstup";
|
||||
case "invalid_element":
|
||||
return `Neplatná hodnota v ${issue.origin}`;
|
||||
default:
|
||||
return `Neplatný vstup`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
143
node_modules/zod/dist/cjs/v4/locales/de.js
generated
vendored
Normal file
143
node_modules/zod/dist/cjs/v4/locales/de.js
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "Zeichen", verb: "zu haben" },
|
||||
file: { unit: "Bytes", verb: "zu haben" },
|
||||
array: { unit: "Elemente", verb: "zu haben" },
|
||||
set: { unit: "Elemente", verb: "zu haben" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "Zahl";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "Array";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "Eingabe",
|
||||
email: "E-Mail-Adresse",
|
||||
url: "URL",
|
||||
emoji: "Emoji",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "ISO-Datum und -Uhrzeit",
|
||||
date: "ISO-Datum",
|
||||
time: "ISO-Uhrzeit",
|
||||
duration: "ISO-Dauer",
|
||||
ipv4: "IPv4-Adresse",
|
||||
ipv6: "IPv6-Adresse",
|
||||
cidrv4: "IPv4-Bereich",
|
||||
cidrv6: "IPv6-Bereich",
|
||||
base64: "Base64-codierter String",
|
||||
base64url: "Base64-URL-codierter String",
|
||||
json_string: "JSON-String",
|
||||
e164: "E.164-Nummer",
|
||||
jwt: "JWT",
|
||||
template_literal: "Eingabe",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `Ungültige Eingabe: erwartet ${issue.expected}, erhalten ${(0, exports.parsedType)(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Ungültige Eingabe: erwartet ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Ungültige Option: erwartet eine von ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `Zu groß: erwartet, dass ${issue.origin ?? "Wert"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "Elemente"} hat`;
|
||||
return `Zu groß: erwartet, dass ${issue.origin ?? "Wert"} ${adj}${issue.maximum.toString()} ist`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `Zu klein: erwartet, dass ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit} hat`;
|
||||
}
|
||||
return `Zu klein: erwartet, dass ${issue.origin} ${adj}${issue.minimum.toString()} ist`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `Ungültiger String: muss mit "${_issue.prefix}" beginnen`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `Ungültiger String: muss mit "${_issue.suffix}" enden`;
|
||||
if (_issue.format === "includes")
|
||||
return `Ungültiger String: muss "${_issue.includes}" enthalten`;
|
||||
if (_issue.format === "regex")
|
||||
return `Ungültiger String: muss dem Muster ${_issue.pattern} entsprechen`;
|
||||
return `Ungültig: ${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Ungültige Zahl: muss ein Vielfaches von ${issue.divisor} sein`;
|
||||
case "unrecognized_keys":
|
||||
return `${issue.keys.length > 1 ? "Unbekannte Schlüssel" : "Unbekannter Schlüssel"}: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `Ungültiger Schlüssel in ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return "Ungültige Eingabe";
|
||||
case "invalid_element":
|
||||
return `Ungültiger Wert in ${issue.origin}`;
|
||||
default:
|
||||
return `Ungültige Eingabe`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
145
node_modules/zod/dist/cjs/v4/locales/en.js
generated
vendored
Normal file
145
node_modules/zod/dist/cjs/v4/locales/en.js
generated
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "characters", verb: "to have" },
|
||||
file: { unit: "bytes", verb: "to have" },
|
||||
array: { unit: "items", verb: "to have" },
|
||||
set: { unit: "items", verb: "to have" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "number";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "array";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "input",
|
||||
email: "email address",
|
||||
url: "URL",
|
||||
emoji: "emoji",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "ISO datetime",
|
||||
date: "ISO date",
|
||||
time: "ISO time",
|
||||
duration: "ISO duration",
|
||||
ipv4: "IPv4 address",
|
||||
ipv6: "IPv6 address",
|
||||
cidrv4: "IPv4 range",
|
||||
cidrv6: "IPv6 range",
|
||||
base64: "base64-encoded string",
|
||||
base64url: "base64url-encoded string",
|
||||
json_string: "JSON string",
|
||||
e164: "E.164 number",
|
||||
jwt: "JWT",
|
||||
template_literal: "input",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `Invalid input: expected ${issue.expected}, received ${(0, exports.parsedType)(issue.input)}`;
|
||||
// return `Invalid input: expected ${issue.expected}, received ${util.getParsedType(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Invalid input: expected ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Invalid option: expected one of ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
|
||||
return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
||||
}
|
||||
return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with") {
|
||||
return `Invalid string: must start with "${_issue.prefix}"`;
|
||||
}
|
||||
if (_issue.format === "ends_with")
|
||||
return `Invalid string: must end with "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes")
|
||||
return `Invalid string: must include "${_issue.includes}"`;
|
||||
if (_issue.format === "regex")
|
||||
return `Invalid string: must match pattern ${_issue.pattern}`;
|
||||
return `Invalid ${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Invalid number: must be a multiple of ${issue.divisor}`;
|
||||
case "unrecognized_keys":
|
||||
return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `Invalid key in ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return "Invalid input";
|
||||
case "invalid_element":
|
||||
return `Invalid value in ${issue.origin}`;
|
||||
default:
|
||||
return `Invalid input`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
144
node_modules/zod/dist/cjs/v4/locales/es.js
generated
vendored
Normal file
144
node_modules/zod/dist/cjs/v4/locales/es.js
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "caracteres", verb: "tener" },
|
||||
file: { unit: "bytes", verb: "tener" },
|
||||
array: { unit: "elementos", verb: "tener" },
|
||||
set: { unit: "elementos", verb: "tener" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "número";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "arreglo";
|
||||
}
|
||||
if (data === null) {
|
||||
return "nulo";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "entrada",
|
||||
email: "dirección de correo electrónico",
|
||||
url: "URL",
|
||||
emoji: "emoji",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "fecha y hora ISO",
|
||||
date: "fecha ISO",
|
||||
time: "hora ISO",
|
||||
duration: "duración ISO",
|
||||
ipv4: "dirección IPv4",
|
||||
ipv6: "dirección IPv6",
|
||||
cidrv4: "rango IPv4",
|
||||
cidrv6: "rango IPv6",
|
||||
base64: "cadena codificada en base64",
|
||||
base64url: "URL codificada en base64",
|
||||
json_string: "cadena JSON",
|
||||
e164: "número E.164",
|
||||
jwt: "JWT",
|
||||
template_literal: "entrada",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `Entrada inválida: se esperaba ${issue.expected}, recibido ${(0, exports.parsedType)(issue.input)}`;
|
||||
// return `Entrada inválida: se esperaba ${issue.expected}, recibido ${util.getParsedType(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Entrada inválida: se esperaba ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Opción inválida: se esperaba una de ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `Demasiado grande: se esperaba que ${issue.origin ?? "valor"} tuviera ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementos"}`;
|
||||
return `Demasiado grande: se esperaba que ${issue.origin ?? "valor"} fuera ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `Demasiado pequeño: se esperaba que ${issue.origin} tuviera ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
||||
}
|
||||
return `Demasiado pequeño: se esperaba que ${issue.origin} fuera ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `Cadena inválida: debe comenzar con "${_issue.prefix}"`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `Cadena inválida: debe terminar en "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes")
|
||||
return `Cadena inválida: debe incluir "${_issue.includes}"`;
|
||||
if (_issue.format === "regex")
|
||||
return `Cadena inválida: debe coincidir con el patrón ${_issue.pattern}`;
|
||||
return `Inválido ${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Número inválido: debe ser múltiplo de ${issue.divisor}`;
|
||||
case "unrecognized_keys":
|
||||
return `Llave${issue.keys.length > 1 ? "s" : ""} desconocida${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `Llave inválida en ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return "Entrada inválida";
|
||||
case "invalid_element":
|
||||
return `Valor inválido en ${issue.origin}`;
|
||||
default:
|
||||
return `Entrada inválida`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
149
node_modules/zod/dist/cjs/v4/locales/fa.js
generated
vendored
Normal file
149
node_modules/zod/dist/cjs/v4/locales/fa.js
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "کاراکتر", verb: "داشته باشد" },
|
||||
file: { unit: "بایت", verb: "داشته باشد" },
|
||||
array: { unit: "آیتم", verb: "داشته باشد" },
|
||||
set: { unit: "آیتم", verb: "داشته باشد" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "عدد";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "آرایه";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "ورودی",
|
||||
email: "آدرس ایمیل",
|
||||
url: "URL",
|
||||
emoji: "ایموجی",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "تاریخ و زمان ایزو",
|
||||
date: "تاریخ ایزو",
|
||||
time: "زمان ایزو",
|
||||
duration: "مدت زمان ایزو",
|
||||
ipv4: "IPv4 آدرس",
|
||||
ipv6: "IPv6 آدرس",
|
||||
cidrv4: "IPv4 دامنه",
|
||||
cidrv6: "IPv6 دامنه",
|
||||
base64: "base64-encoded رشته",
|
||||
base64url: "base64url-encoded رشته",
|
||||
json_string: "JSON رشته",
|
||||
e164: "E.164 عدد",
|
||||
jwt: "JWT",
|
||||
template_literal: "ورودی",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `ورودی نامعتبر: میبایست ${issue.expected} میبود، ${(0, exports.parsedType)(issue.input)} دریافت شد`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1) {
|
||||
return `ورودی نامعتبر: میبایست ${util.stringifyPrimitive(issue.values[0])} میبود`;
|
||||
}
|
||||
return `گزینه نامعتبر: میبایست یکی از ${util.joinValues(issue.values, "|")} میبود`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `خیلی بزرگ: ${issue.origin ?? "مقدار"} باید ${adj}${issue.maximum.toString()} ${sizing.unit ?? "عنصر"} باشد`;
|
||||
}
|
||||
return `خیلی بزرگ: ${issue.origin ?? "مقدار"} باید ${adj}${issue.maximum.toString()} باشد`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `خیلی کوچک: ${issue.origin} باید ${adj}${issue.minimum.toString()} ${sizing.unit} باشد`;
|
||||
}
|
||||
return `خیلی کوچک: ${issue.origin} باید ${adj}${issue.minimum.toString()} باشد`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with") {
|
||||
return `رشته نامعتبر: باید با "${_issue.prefix}" شروع شود`;
|
||||
}
|
||||
if (_issue.format === "ends_with") {
|
||||
return `رشته نامعتبر: باید با "${_issue.suffix}" تمام شود`;
|
||||
}
|
||||
if (_issue.format === "includes") {
|
||||
return `رشته نامعتبر: باید شامل "${_issue.includes}" باشد`;
|
||||
}
|
||||
if (_issue.format === "regex") {
|
||||
return `رشته نامعتبر: باید با الگوی ${_issue.pattern} مطابقت داشته باشد`;
|
||||
}
|
||||
return `${Nouns[_issue.format] ?? issue.format} نامعتبر`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `عدد نامعتبر: باید مضرب ${issue.divisor} باشد`;
|
||||
case "unrecognized_keys":
|
||||
return `کلید${issue.keys.length > 1 ? "های" : ""} ناشناس: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `کلید ناشناس در ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return `ورودی نامعتبر`;
|
||||
case "invalid_element":
|
||||
return `مقدار نامعتبر در ${issue.origin}`;
|
||||
default:
|
||||
return `ورودی نامعتبر`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
149
node_modules/zod/dist/cjs/v4/locales/fi.js
generated
vendored
Normal file
149
node_modules/zod/dist/cjs/v4/locales/fi.js
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "merkkiä", subject: "merkkijonon" },
|
||||
file: { unit: "tavua", subject: "tiedoston" },
|
||||
array: { unit: "alkiota", subject: "listan" },
|
||||
set: { unit: "alkiota", subject: "joukon" },
|
||||
number: { unit: "", subject: "luvun" },
|
||||
bigint: { unit: "", subject: "suuren kokonaisluvun" },
|
||||
int: { unit: "", subject: "kokonaisluvun" },
|
||||
date: { unit: "", subject: "päivämäärän" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "number";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "array";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "säännöllinen lauseke",
|
||||
email: "sähköpostiosoite",
|
||||
url: "URL-osoite",
|
||||
emoji: "emoji",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "ISO-aikaleima",
|
||||
date: "ISO-päivämäärä",
|
||||
time: "ISO-aika",
|
||||
duration: "ISO-kesto",
|
||||
ipv4: "IPv4-osoite",
|
||||
ipv6: "IPv6-osoite",
|
||||
cidrv4: "IPv4-alue",
|
||||
cidrv6: "IPv6-alue",
|
||||
base64: "base64-koodattu merkkijono",
|
||||
base64url: "base64url-koodattu merkkijono",
|
||||
json_string: "JSON-merkkijono",
|
||||
e164: "E.164-luku",
|
||||
jwt: "JWT",
|
||||
template_literal: "templaattimerkkijono",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `Virheellinen tyyppi: odotettiin ${issue.expected}, oli ${(0, exports.parsedType)(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Virheellinen syöte: täytyy olla ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Virheellinen valinta: täytyy olla yksi seuraavista: ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `Liian suuri: ${sizing.subject} täytyy olla ${adj}${issue.maximum.toString()} ${sizing.unit}`.trim();
|
||||
}
|
||||
return `Liian suuri: arvon täytyy olla ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `Liian pieni: ${sizing.subject} täytyy olla ${adj}${issue.minimum.toString()} ${sizing.unit}`.trim();
|
||||
}
|
||||
return `Liian pieni: arvon täytyy olla ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `Virheellinen syöte: täytyy alkaa "${_issue.prefix}"`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `Virheellinen syöte: täytyy loppua "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes")
|
||||
return `Virheellinen syöte: täytyy sisältää "${_issue.includes}"`;
|
||||
if (_issue.format === "regex") {
|
||||
return `Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${_issue.pattern}`;
|
||||
}
|
||||
return `Virheellinen ${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Virheellinen luku: täytyy olla luvun ${issue.divisor} monikerta`;
|
||||
case "unrecognized_keys":
|
||||
return `${issue.keys.length > 1 ? "Tuntemattomat avaimet" : "Tuntematon avain"}: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return "Virheellinen avain tietueessa";
|
||||
case "invalid_union":
|
||||
return "Virheellinen unioni";
|
||||
case "invalid_element":
|
||||
return "Virheellinen arvo joukossa";
|
||||
default:
|
||||
return `Virheellinen syöte`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
143
node_modules/zod/dist/cjs/v4/locales/fr.js
generated
vendored
Normal file
143
node_modules/zod/dist/cjs/v4/locales/fr.js
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "caractères", verb: "avoir" },
|
||||
file: { unit: "octets", verb: "avoir" },
|
||||
array: { unit: "éléments", verb: "avoir" },
|
||||
set: { unit: "éléments", verb: "avoir" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "nombre";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "tableau";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "entrée",
|
||||
email: "adresse e-mail",
|
||||
url: "URL",
|
||||
emoji: "emoji",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "date et heure ISO",
|
||||
date: "date ISO",
|
||||
time: "heure ISO",
|
||||
duration: "durée ISO",
|
||||
ipv4: "adresse IPv4",
|
||||
ipv6: "adresse IPv6",
|
||||
cidrv4: "plage IPv4",
|
||||
cidrv6: "plage IPv6",
|
||||
base64: "chaîne encodée en base64",
|
||||
base64url: "chaîne encodée en base64url",
|
||||
json_string: "chaîne JSON",
|
||||
e164: "numéro E.164",
|
||||
jwt: "JWT",
|
||||
template_literal: "entrée",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `Entrée invalide : ${issue.expected} attendu, ${(0, exports.parsedType)(issue.input)} reçu`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Entrée invalide : ${util.stringifyPrimitive(issue.values[0])} attendu`;
|
||||
return `Option invalide : une valeur parmi ${util.joinValues(issue.values, "|")} attendue`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `Trop grand : ${issue.origin ?? "valeur"} doit ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "élément(s)"}`;
|
||||
return `Trop grand : ${issue.origin ?? "valeur"} doit être ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `Trop petit : ${issue.origin} doit ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
||||
}
|
||||
return `Trop petit : ${issue.origin} doit être ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `Chaîne invalide : doit commencer par "${_issue.prefix}"`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `Chaîne invalide : doit se terminer par "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes")
|
||||
return `Chaîne invalide : doit inclure "${_issue.includes}"`;
|
||||
if (_issue.format === "regex")
|
||||
return `Chaîne invalide : doit correspondre au modèle ${_issue.pattern}`;
|
||||
return `${Nouns[_issue.format] ?? issue.format} invalide`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Nombre invalide : doit être un multiple de ${issue.divisor}`;
|
||||
case "unrecognized_keys":
|
||||
return `Clé${issue.keys.length > 1 ? "s" : ""} non reconnue${issue.keys.length > 1 ? "s" : ""} : ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `Clé invalide dans ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return "Entrée invalide";
|
||||
case "invalid_element":
|
||||
return `Valeur invalide dans ${issue.origin}`;
|
||||
default:
|
||||
return `Entrée invalide`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
144
node_modules/zod/dist/cjs/v4/locales/frCA.js
generated
vendored
Normal file
144
node_modules/zod/dist/cjs/v4/locales/frCA.js
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "caractères", verb: "avoir" },
|
||||
file: { unit: "octets", verb: "avoir" },
|
||||
array: { unit: "éléments", verb: "avoir" },
|
||||
set: { unit: "éléments", verb: "avoir" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "number";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "array";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "entrée",
|
||||
email: "adresse courriel",
|
||||
url: "URL",
|
||||
emoji: "emoji",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "date-heure ISO",
|
||||
date: "date ISO",
|
||||
time: "heure ISO",
|
||||
duration: "durée ISO",
|
||||
ipv4: "adresse IPv4",
|
||||
ipv6: "adresse IPv6",
|
||||
cidrv4: "plage IPv4",
|
||||
cidrv6: "plage IPv6",
|
||||
base64: "chaîne encodée en base64",
|
||||
base64url: "chaîne encodée en base64url",
|
||||
json_string: "chaîne JSON",
|
||||
e164: "numéro E.164",
|
||||
jwt: "JWT",
|
||||
template_literal: "entrée",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `Entrée invalide : attendu ${issue.expected}, reçu ${(0, exports.parsedType)(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Entrée invalide : attendu ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Option invalide : attendu l'une des valeurs suivantes ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "≤" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `Trop grand : attendu que ${issue.origin ?? "la valeur"} ait ${adj}${issue.maximum.toString()} ${sizing.unit}`;
|
||||
return `Trop grand : attendu que ${issue.origin ?? "la valeur"} soit ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? "≥" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `Trop petit : attendu que ${issue.origin} ait ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
||||
}
|
||||
return `Trop petit : attendu que ${issue.origin} soit ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with") {
|
||||
return `Chaîne invalide : doit commencer par "${_issue.prefix}"`;
|
||||
}
|
||||
if (_issue.format === "ends_with")
|
||||
return `Chaîne invalide : doit se terminer par "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes")
|
||||
return `Chaîne invalide : doit inclure "${_issue.includes}"`;
|
||||
if (_issue.format === "regex")
|
||||
return `Chaîne invalide : doit correspondre au motif ${_issue.pattern}`;
|
||||
return `${Nouns[_issue.format] ?? issue.format} invalide`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Nombre invalide : doit être un multiple de ${issue.divisor}`;
|
||||
case "unrecognized_keys":
|
||||
return `Clé${issue.keys.length > 1 ? "s" : ""} non reconnue${issue.keys.length > 1 ? "s" : ""} : ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `Clé invalide dans ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return "Entrée invalide";
|
||||
case "invalid_element":
|
||||
return `Valeur invalide dans ${issue.origin}`;
|
||||
default:
|
||||
return `Entrée invalide`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
144
node_modules/zod/dist/cjs/v4/locales/he.js
generated
vendored
Normal file
144
node_modules/zod/dist/cjs/v4/locales/he.js
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "אותיות", verb: "לכלול" },
|
||||
file: { unit: "בייטים", verb: "לכלול" },
|
||||
array: { unit: "פריטים", verb: "לכלול" },
|
||||
set: { unit: "פריטים", verb: "לכלול" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "number";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "array";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "קלט",
|
||||
email: "כתובת אימייל",
|
||||
url: "כתובת רשת",
|
||||
emoji: "אימוג'י",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "תאריך וזמן ISO",
|
||||
date: "תאריך ISO",
|
||||
time: "זמן ISO",
|
||||
duration: "משך זמן ISO",
|
||||
ipv4: "כתובת IPv4",
|
||||
ipv6: "כתובת IPv6",
|
||||
cidrv4: "טווח IPv4",
|
||||
cidrv6: "טווח IPv6",
|
||||
base64: "מחרוזת בבסיס 64",
|
||||
base64url: "מחרוזת בבסיס 64 לכתובות רשת",
|
||||
json_string: "מחרוזת JSON",
|
||||
e164: "מספר E.164",
|
||||
jwt: "JWT",
|
||||
template_literal: "קלט",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `קלט לא תקין: צריך ${issue.expected}, התקבל ${(0, exports.parsedType)(issue.input)}`;
|
||||
// return `Invalid input: expected ${issue.expected}, received ${util.getParsedType(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `קלט לא תקין: צריך ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `קלט לא תקין: צריך אחת מהאפשרויות ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `גדול מדי: ${issue.origin ?? "value"} צריך להיות ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
|
||||
return `גדול מדי: ${issue.origin ?? "value"} צריך להיות ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `קטן מדי: ${issue.origin} צריך להיות ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
||||
}
|
||||
return `קטן מדי: ${issue.origin} צריך להיות ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `מחרוזת לא תקינה: חייבת להתחיל ב"${_issue.prefix}"`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `מחרוזת לא תקינה: חייבת להסתיים ב "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes")
|
||||
return `מחרוזת לא תקינה: חייבת לכלול "${_issue.includes}"`;
|
||||
if (_issue.format === "regex")
|
||||
return `מחרוזת לא תקינה: חייבת להתאים לתבנית ${_issue.pattern}`;
|
||||
return `${Nouns[_issue.format] ?? issue.format} לא תקין`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `מספר לא תקין: חייב להיות מכפלה של ${issue.divisor}`;
|
||||
case "unrecognized_keys":
|
||||
return `מפתח${issue.keys.length > 1 ? "ות" : ""} לא מזוה${issue.keys.length > 1 ? "ים" : "ה"}: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `מפתח לא תקין ב${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return "קלט לא תקין";
|
||||
case "invalid_element":
|
||||
return `ערך לא תקין ב${issue.origin}`;
|
||||
default:
|
||||
return `קלט לא תקין`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
144
node_modules/zod/dist/cjs/v4/locales/hu.js
generated
vendored
Normal file
144
node_modules/zod/dist/cjs/v4/locales/hu.js
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "karakter", verb: "legyen" },
|
||||
file: { unit: "byte", verb: "legyen" },
|
||||
array: { unit: "elem", verb: "legyen" },
|
||||
set: { unit: "elem", verb: "legyen" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "szám";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "tömb";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "bemenet",
|
||||
email: "email cím",
|
||||
url: "URL",
|
||||
emoji: "emoji",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "ISO időbélyeg",
|
||||
date: "ISO dátum",
|
||||
time: "ISO idő",
|
||||
duration: "ISO időintervallum",
|
||||
ipv4: "IPv4 cím",
|
||||
ipv6: "IPv6 cím",
|
||||
cidrv4: "IPv4 tartomány",
|
||||
cidrv6: "IPv6 tartomány",
|
||||
base64: "base64-kódolt string",
|
||||
base64url: "base64url-kódolt string",
|
||||
json_string: "JSON string",
|
||||
e164: "E.164 szám",
|
||||
jwt: "JWT",
|
||||
template_literal: "bemenet",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `Érvénytelen bemenet: a várt érték ${issue.expected}, a kapott érték ${(0, exports.parsedType)(issue.input)}`;
|
||||
// return `Invalid input: expected ${issue.expected}, received ${util.getParsedType(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Érvénytelen bemenet: a várt érték ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Érvénytelen opció: valamelyik érték várt ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `Túl nagy: ${issue.origin ?? "érték"} mérete túl nagy ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elem"}`;
|
||||
return `Túl nagy: a bemeneti érték ${issue.origin ?? "érték"} túl nagy: ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `Túl kicsi: a bemeneti érték ${issue.origin} mérete túl kicsi ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
||||
}
|
||||
return `Túl kicsi: a bemeneti érték ${issue.origin} túl kicsi ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `Érvénytelen string: "${_issue.prefix}" értékkel kell kezdődnie`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `Érvénytelen string: "${_issue.suffix}" értékkel kell végződnie`;
|
||||
if (_issue.format === "includes")
|
||||
return `Érvénytelen string: "${_issue.includes}" értéket kell tartalmaznia`;
|
||||
if (_issue.format === "regex")
|
||||
return `Érvénytelen string: ${_issue.pattern} mintának kell megfelelnie`;
|
||||
return `Érvénytelen ${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Érvénytelen szám: ${issue.divisor} többszörösének kell lennie`;
|
||||
case "unrecognized_keys":
|
||||
return `Ismeretlen kulcs${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `Érvénytelen kulcs ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return "Érvénytelen bemenet";
|
||||
case "invalid_element":
|
||||
return `Érvénytelen érték: ${issue.origin}`;
|
||||
default:
|
||||
return `Érvénytelen bemenet`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
143
node_modules/zod/dist/cjs/v4/locales/id.js
generated
vendored
Normal file
143
node_modules/zod/dist/cjs/v4/locales/id.js
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "karakter", verb: "memiliki" },
|
||||
file: { unit: "byte", verb: "memiliki" },
|
||||
array: { unit: "item", verb: "memiliki" },
|
||||
set: { unit: "item", verb: "memiliki" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "number";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "array";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "input",
|
||||
email: "alamat email",
|
||||
url: "URL",
|
||||
emoji: "emoji",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "tanggal dan waktu format ISO",
|
||||
date: "tanggal format ISO",
|
||||
time: "jam format ISO",
|
||||
duration: "durasi format ISO",
|
||||
ipv4: "alamat IPv4",
|
||||
ipv6: "alamat IPv6",
|
||||
cidrv4: "rentang alamat IPv4",
|
||||
cidrv6: "rentang alamat IPv6",
|
||||
base64: "string dengan enkode base64",
|
||||
base64url: "string dengan enkode base64url",
|
||||
json_string: "string JSON",
|
||||
e164: "angka E.164",
|
||||
jwt: "JWT",
|
||||
template_literal: "input",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `Input tidak valid: diharapkan ${issue.expected}, diterima ${(0, exports.parsedType)(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Input tidak valid: diharapkan ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Pilihan tidak valid: diharapkan salah satu dari ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `Terlalu besar: diharapkan ${issue.origin ?? "value"} memiliki ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elemen"}`;
|
||||
return `Terlalu besar: diharapkan ${issue.origin ?? "value"} menjadi ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `Terlalu kecil: diharapkan ${issue.origin} memiliki ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
||||
}
|
||||
return `Terlalu kecil: diharapkan ${issue.origin} menjadi ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `String tidak valid: harus dimulai dengan "${_issue.prefix}"`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `String tidak valid: harus berakhir dengan "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes")
|
||||
return `String tidak valid: harus menyertakan "${_issue.includes}"`;
|
||||
if (_issue.format === "regex")
|
||||
return `String tidak valid: harus sesuai pola ${_issue.pattern}`;
|
||||
return `${Nouns[_issue.format] ?? issue.format} tidak valid`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Angka tidak valid: harus kelipatan dari ${issue.divisor}`;
|
||||
case "unrecognized_keys":
|
||||
return `Kunci tidak dikenali ${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `Kunci tidak valid di ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return "Input tidak valid";
|
||||
case "invalid_element":
|
||||
return `Nilai tidak valid di ${issue.origin}`;
|
||||
default:
|
||||
return `Input tidak valid`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
74
node_modules/zod/dist/cjs/v4/locales/index.js
generated
vendored
Normal file
74
node_modules/zod/dist/cjs/v4/locales/index.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.zhTW = exports.zhCN = exports.vi = exports.ur = exports.ua = exports.tr = exports.th = exports.ta = exports.sl = exports.ru = exports.pt = exports.pl = exports.ota = exports.no = exports.ms = exports.mk = exports.ko = exports.ja = exports.it = exports.id = exports.hu = exports.he = exports.frCA = exports.fr = exports.fi = exports.fa = exports.es = exports.en = exports.de = exports.cs = exports.ca = exports.be = exports.az = exports.ar = void 0;
|
||||
var ar_js_1 = require("./ar.js");
|
||||
Object.defineProperty(exports, "ar", { enumerable: true, get: function () { return __importDefault(ar_js_1).default; } });
|
||||
var az_js_1 = require("./az.js");
|
||||
Object.defineProperty(exports, "az", { enumerable: true, get: function () { return __importDefault(az_js_1).default; } });
|
||||
var be_js_1 = require("./be.js");
|
||||
Object.defineProperty(exports, "be", { enumerable: true, get: function () { return __importDefault(be_js_1).default; } });
|
||||
var ca_js_1 = require("./ca.js");
|
||||
Object.defineProperty(exports, "ca", { enumerable: true, get: function () { return __importDefault(ca_js_1).default; } });
|
||||
var cs_js_1 = require("./cs.js");
|
||||
Object.defineProperty(exports, "cs", { enumerable: true, get: function () { return __importDefault(cs_js_1).default; } });
|
||||
var de_js_1 = require("./de.js");
|
||||
Object.defineProperty(exports, "de", { enumerable: true, get: function () { return __importDefault(de_js_1).default; } });
|
||||
var en_js_1 = require("./en.js");
|
||||
Object.defineProperty(exports, "en", { enumerable: true, get: function () { return __importDefault(en_js_1).default; } });
|
||||
var es_js_1 = require("./es.js");
|
||||
Object.defineProperty(exports, "es", { enumerable: true, get: function () { return __importDefault(es_js_1).default; } });
|
||||
var fa_js_1 = require("./fa.js");
|
||||
Object.defineProperty(exports, "fa", { enumerable: true, get: function () { return __importDefault(fa_js_1).default; } });
|
||||
var fi_js_1 = require("./fi.js");
|
||||
Object.defineProperty(exports, "fi", { enumerable: true, get: function () { return __importDefault(fi_js_1).default; } });
|
||||
var fr_js_1 = require("./fr.js");
|
||||
Object.defineProperty(exports, "fr", { enumerable: true, get: function () { return __importDefault(fr_js_1).default; } });
|
||||
var frCA_js_1 = require("./frCA.js");
|
||||
Object.defineProperty(exports, "frCA", { enumerable: true, get: function () { return __importDefault(frCA_js_1).default; } });
|
||||
var he_js_1 = require("./he.js");
|
||||
Object.defineProperty(exports, "he", { enumerable: true, get: function () { return __importDefault(he_js_1).default; } });
|
||||
var hu_js_1 = require("./hu.js");
|
||||
Object.defineProperty(exports, "hu", { enumerable: true, get: function () { return __importDefault(hu_js_1).default; } });
|
||||
var id_js_1 = require("./id.js");
|
||||
Object.defineProperty(exports, "id", { enumerable: true, get: function () { return __importDefault(id_js_1).default; } });
|
||||
var it_js_1 = require("./it.js");
|
||||
Object.defineProperty(exports, "it", { enumerable: true, get: function () { return __importDefault(it_js_1).default; } });
|
||||
var ja_js_1 = require("./ja.js");
|
||||
Object.defineProperty(exports, "ja", { enumerable: true, get: function () { return __importDefault(ja_js_1).default; } });
|
||||
var ko_js_1 = require("./ko.js");
|
||||
Object.defineProperty(exports, "ko", { enumerable: true, get: function () { return __importDefault(ko_js_1).default; } });
|
||||
var mk_js_1 = require("./mk.js");
|
||||
Object.defineProperty(exports, "mk", { enumerable: true, get: function () { return __importDefault(mk_js_1).default; } });
|
||||
var ms_js_1 = require("./ms.js");
|
||||
Object.defineProperty(exports, "ms", { enumerable: true, get: function () { return __importDefault(ms_js_1).default; } });
|
||||
var no_js_1 = require("./no.js");
|
||||
Object.defineProperty(exports, "no", { enumerable: true, get: function () { return __importDefault(no_js_1).default; } });
|
||||
var ota_js_1 = require("./ota.js");
|
||||
Object.defineProperty(exports, "ota", { enumerable: true, get: function () { return __importDefault(ota_js_1).default; } });
|
||||
var pl_js_1 = require("./pl.js");
|
||||
Object.defineProperty(exports, "pl", { enumerable: true, get: function () { return __importDefault(pl_js_1).default; } });
|
||||
var pt_js_1 = require("./pt.js");
|
||||
Object.defineProperty(exports, "pt", { enumerable: true, get: function () { return __importDefault(pt_js_1).default; } });
|
||||
var ru_js_1 = require("./ru.js");
|
||||
Object.defineProperty(exports, "ru", { enumerable: true, get: function () { return __importDefault(ru_js_1).default; } });
|
||||
var sl_js_1 = require("./sl.js");
|
||||
Object.defineProperty(exports, "sl", { enumerable: true, get: function () { return __importDefault(sl_js_1).default; } });
|
||||
var ta_js_1 = require("./ta.js");
|
||||
Object.defineProperty(exports, "ta", { enumerable: true, get: function () { return __importDefault(ta_js_1).default; } });
|
||||
var th_js_1 = require("./th.js");
|
||||
Object.defineProperty(exports, "th", { enumerable: true, get: function () { return __importDefault(th_js_1).default; } });
|
||||
var tr_js_1 = require("./tr.js");
|
||||
Object.defineProperty(exports, "tr", { enumerable: true, get: function () { return __importDefault(tr_js_1).default; } });
|
||||
var ua_js_1 = require("./ua.js");
|
||||
Object.defineProperty(exports, "ua", { enumerable: true, get: function () { return __importDefault(ua_js_1).default; } });
|
||||
var ur_js_1 = require("./ur.js");
|
||||
Object.defineProperty(exports, "ur", { enumerable: true, get: function () { return __importDefault(ur_js_1).default; } });
|
||||
var vi_js_1 = require("./vi.js");
|
||||
Object.defineProperty(exports, "vi", { enumerable: true, get: function () { return __importDefault(vi_js_1).default; } });
|
||||
var zh_CN_js_1 = require("./zh-CN.js");
|
||||
Object.defineProperty(exports, "zhCN", { enumerable: true, get: function () { return __importDefault(zh_CN_js_1).default; } });
|
||||
var zh_tw_js_1 = require("./zh-tw.js");
|
||||
Object.defineProperty(exports, "zhTW", { enumerable: true, get: function () { return __importDefault(zh_tw_js_1).default; } });
|
||||
144
node_modules/zod/dist/cjs/v4/locales/it.js
generated
vendored
Normal file
144
node_modules/zod/dist/cjs/v4/locales/it.js
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "caratteri", verb: "avere" },
|
||||
file: { unit: "byte", verb: "avere" },
|
||||
array: { unit: "elementi", verb: "avere" },
|
||||
set: { unit: "elementi", verb: "avere" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "numero";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "vettore";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "input",
|
||||
email: "indirizzo email",
|
||||
url: "URL",
|
||||
emoji: "emoji",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "data e ora ISO",
|
||||
date: "data ISO",
|
||||
time: "ora ISO",
|
||||
duration: "durata ISO",
|
||||
ipv4: "indirizzo IPv4",
|
||||
ipv6: "indirizzo IPv6",
|
||||
cidrv4: "intervallo IPv4",
|
||||
cidrv6: "intervallo IPv6",
|
||||
base64: "stringa codificata in base64",
|
||||
base64url: "URL codificata in base64",
|
||||
json_string: "stringa JSON",
|
||||
e164: "numero E.164",
|
||||
jwt: "JWT",
|
||||
template_literal: "input",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `Input non valido: atteso ${issue.expected}, ricevuto ${(0, exports.parsedType)(issue.input)}`;
|
||||
// return `Input non valido: atteso ${issue.expected}, ricevuto ${util.getParsedType(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Input non valido: atteso ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Opzione non valida: atteso uno tra ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `Troppo grande: ${issue.origin ?? "valore"} deve avere ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementi"}`;
|
||||
return `Troppo grande: ${issue.origin ?? "valore"} deve essere ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `Troppo piccolo: ${issue.origin} deve avere ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
||||
}
|
||||
return `Troppo piccolo: ${issue.origin} deve essere ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `Stringa non valida: deve iniziare con "${_issue.prefix}"`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `Stringa non valida: deve terminare con "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes")
|
||||
return `Stringa non valida: deve includere "${_issue.includes}"`;
|
||||
if (_issue.format === "regex")
|
||||
return `Stringa non valida: deve corrispondere al pattern ${_issue.pattern}`;
|
||||
return `Invalid ${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Numero non valido: deve essere un multiplo di ${issue.divisor}`;
|
||||
case "unrecognized_keys":
|
||||
return `Chiav${issue.keys.length > 1 ? "i" : "e"} non riconosciut${issue.keys.length > 1 ? "e" : "a"}: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `Chiave non valida in ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return "Input non valido";
|
||||
case "invalid_element":
|
||||
return `Valore non valido in ${issue.origin}`;
|
||||
default:
|
||||
return `Input non valido`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
142
node_modules/zod/dist/cjs/v4/locales/ja.js
generated
vendored
Normal file
142
node_modules/zod/dist/cjs/v4/locales/ja.js
generated
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "文字", verb: "である" },
|
||||
file: { unit: "バイト", verb: "である" },
|
||||
array: { unit: "要素", verb: "である" },
|
||||
set: { unit: "要素", verb: "である" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "数値";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "配列";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "入力値",
|
||||
email: "メールアドレス",
|
||||
url: "URL",
|
||||
emoji: "絵文字",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "ISO日時",
|
||||
date: "ISO日付",
|
||||
time: "ISO時刻",
|
||||
duration: "ISO期間",
|
||||
ipv4: "IPv4アドレス",
|
||||
ipv6: "IPv6アドレス",
|
||||
cidrv4: "IPv4範囲",
|
||||
cidrv6: "IPv6範囲",
|
||||
base64: "base64エンコード文字列",
|
||||
base64url: "base64urlエンコード文字列",
|
||||
json_string: "JSON文字列",
|
||||
e164: "E.164番号",
|
||||
jwt: "JWT",
|
||||
template_literal: "入力値",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `無効な入力: ${issue.expected}が期待されましたが、${(0, exports.parsedType)(issue.input)}が入力されました`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `無効な入力: ${util.stringifyPrimitive(issue.values[0])}が期待されました`;
|
||||
return `無効な選択: ${util.joinValues(issue.values, "、")}のいずれかである必要があります`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `大きすぎる値: ${issue.origin ?? "値"}は${issue.maximum.toString()}${sizing.unit ?? "要素"}${adj}である必要があります`;
|
||||
return `大きすぎる値: ${issue.origin ?? "値"}は${issue.maximum.toString()}${adj}である必要があります`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `小さすぎる値: ${issue.origin}は${issue.minimum.toString()}${sizing.unit}${adj}である必要があります`;
|
||||
return `小さすぎる値: ${issue.origin}は${issue.minimum.toString()}${adj}である必要があります`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `無効な文字列: "${_issue.prefix}"で始まる必要があります`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `無効な文字列: "${_issue.suffix}"で終わる必要があります`;
|
||||
if (_issue.format === "includes")
|
||||
return `無効な文字列: "${_issue.includes}"を含む必要があります`;
|
||||
if (_issue.format === "regex")
|
||||
return `無効な文字列: パターン${_issue.pattern}に一致する必要があります`;
|
||||
return `無効な${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `無効な数値: ${issue.divisor}の倍数である必要があります`;
|
||||
case "unrecognized_keys":
|
||||
return `認識されていないキー${issue.keys.length > 1 ? "群" : ""}: ${util.joinValues(issue.keys, "、")}`;
|
||||
case "invalid_key":
|
||||
return `${issue.origin}内の無効なキー`;
|
||||
case "invalid_union":
|
||||
return "無効な入力";
|
||||
case "invalid_element":
|
||||
return `${issue.origin}内の無効な値`;
|
||||
default:
|
||||
return `無効な入力`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
148
node_modules/zod/dist/cjs/v4/locales/ko.js
generated
vendored
Normal file
148
node_modules/zod/dist/cjs/v4/locales/ko.js
generated
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "문자", verb: "to have" },
|
||||
file: { unit: "바이트", verb: "to have" },
|
||||
array: { unit: "개", verb: "to have" },
|
||||
set: { unit: "개", verb: "to have" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "number";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "array";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "입력",
|
||||
email: "이메일 주소",
|
||||
url: "URL",
|
||||
emoji: "이모지",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "ISO 날짜시간",
|
||||
date: "ISO 날짜",
|
||||
time: "ISO 시간",
|
||||
duration: "ISO 기간",
|
||||
ipv4: "IPv4 주소",
|
||||
ipv6: "IPv6 주소",
|
||||
cidrv4: "IPv4 범위",
|
||||
cidrv6: "IPv6 범위",
|
||||
base64: "base64 인코딩 문자열",
|
||||
base64url: "base64url 인코딩 문자열",
|
||||
json_string: "JSON 문자열",
|
||||
e164: "E.164 번호",
|
||||
jwt: "JWT",
|
||||
template_literal: "입력",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `잘못된 입력: 예상 타입은 ${issue.expected}, 받은 타입은 ${(0, exports.parsedType)(issue.input)}입니다`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `잘못된 입력: 값은 ${util.stringifyPrimitive(issue.values[0])} 이어야 합니다`;
|
||||
return `잘못된 옵션: ${util.joinValues(issue.values, "또는 ")} 중 하나여야 합니다`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "이하" : "미만";
|
||||
const suffix = adj === "미만" ? "이어야 합니다" : "여야 합니다";
|
||||
const sizing = getSizing(issue.origin);
|
||||
const unit = sizing?.unit ?? "요소";
|
||||
if (sizing)
|
||||
return `${issue.origin ?? "값"}이 너무 큽니다: ${issue.maximum.toString()}${unit} ${adj}${suffix}`;
|
||||
return `${issue.origin ?? "값"}이 너무 큽니다: ${issue.maximum.toString()} ${adj}${suffix}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? "이상" : "초과";
|
||||
const suffix = adj === "이상" ? "이어야 합니다" : "여야 합니다";
|
||||
const sizing = getSizing(issue.origin);
|
||||
const unit = sizing?.unit ?? "요소";
|
||||
if (sizing) {
|
||||
return `${issue.origin ?? "값"}이 너무 작습니다: ${issue.minimum.toString()}${unit} ${adj}${suffix}`;
|
||||
}
|
||||
return `${issue.origin ?? "값"}이 너무 작습니다: ${issue.minimum.toString()} ${adj}${suffix}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with") {
|
||||
return `잘못된 문자열: "${_issue.prefix}"(으)로 시작해야 합니다`;
|
||||
}
|
||||
if (_issue.format === "ends_with")
|
||||
return `잘못된 문자열: "${_issue.suffix}"(으)로 끝나야 합니다`;
|
||||
if (_issue.format === "includes")
|
||||
return `잘못된 문자열: "${_issue.includes}"을(를) 포함해야 합니다`;
|
||||
if (_issue.format === "regex")
|
||||
return `잘못된 문자열: 정규식 ${_issue.pattern} 패턴과 일치해야 합니다`;
|
||||
return `잘못된 ${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `잘못된 숫자: ${issue.divisor}의 배수여야 합니다`;
|
||||
case "unrecognized_keys":
|
||||
return `인식할 수 없는 키: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `잘못된 키: ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return `잘못된 입력`;
|
||||
case "invalid_element":
|
||||
return `잘못된 값: ${issue.origin}`;
|
||||
default:
|
||||
return `잘못된 입력`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
145
node_modules/zod/dist/cjs/v4/locales/mk.js
generated
vendored
Normal file
145
node_modules/zod/dist/cjs/v4/locales/mk.js
generated
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "знаци", verb: "да имаат" },
|
||||
file: { unit: "бајти", verb: "да имаат" },
|
||||
array: { unit: "ставки", verb: "да имаат" },
|
||||
set: { unit: "ставки", verb: "да имаат" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "број";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "низа";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "внес",
|
||||
email: "адреса на е-пошта",
|
||||
url: "URL",
|
||||
emoji: "емоџи",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "ISO датум и време",
|
||||
date: "ISO датум",
|
||||
time: "ISO време",
|
||||
duration: "ISO времетраење",
|
||||
ipv4: "IPv4 адреса",
|
||||
ipv6: "IPv6 адреса",
|
||||
cidrv4: "IPv4 опсег",
|
||||
cidrv6: "IPv6 опсег",
|
||||
base64: "base64-енкодирана низа",
|
||||
base64url: "base64url-енкодирана низа",
|
||||
json_string: "JSON низа",
|
||||
e164: "E.164 број",
|
||||
jwt: "JWT",
|
||||
template_literal: "внес",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `Грешен внес: се очекува ${issue.expected}, примено ${(0, exports.parsedType)(issue.input)}`;
|
||||
// return `Invalid input: expected ${issue.expected}, received ${util.getParsedType(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Invalid input: expected ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Грешана опција: се очекува една ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `Премногу голем: се очекува ${issue.origin ?? "вредноста"} да има ${adj}${issue.maximum.toString()} ${sizing.unit ?? "елементи"}`;
|
||||
return `Премногу голем: се очекува ${issue.origin ?? "вредноста"} да биде ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `Премногу мал: се очекува ${issue.origin} да има ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
||||
}
|
||||
return `Премногу мал: се очекува ${issue.origin} да биде ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with") {
|
||||
return `Неважечка низа: мора да започнува со "${_issue.prefix}"`;
|
||||
}
|
||||
if (_issue.format === "ends_with")
|
||||
return `Неважечка низа: мора да завршува со "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes")
|
||||
return `Неважечка низа: мора да вклучува "${_issue.includes}"`;
|
||||
if (_issue.format === "regex")
|
||||
return `Неважечка низа: мора да одгоара на патернот ${_issue.pattern}`;
|
||||
return `Invalid ${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Грешен број: мора да биде делив со ${issue.divisor}`;
|
||||
case "unrecognized_keys":
|
||||
return `${issue.keys.length > 1 ? "Непрепознаени клучеви" : "Непрепознаен клуч"}: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `Грешен клуч во ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return "Грешен внес";
|
||||
case "invalid_element":
|
||||
return `Грешна вредност во ${issue.origin}`;
|
||||
default:
|
||||
return `Грешен внес`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
143
node_modules/zod/dist/cjs/v4/locales/ms.js
generated
vendored
Normal file
143
node_modules/zod/dist/cjs/v4/locales/ms.js
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "aksara", verb: "mempunyai" },
|
||||
file: { unit: "bait", verb: "mempunyai" },
|
||||
array: { unit: "elemen", verb: "mempunyai" },
|
||||
set: { unit: "elemen", verb: "mempunyai" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "nombor";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "array";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "input",
|
||||
email: "alamat e-mel",
|
||||
url: "URL",
|
||||
emoji: "emoji",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "tarikh masa ISO",
|
||||
date: "tarikh ISO",
|
||||
time: "masa ISO",
|
||||
duration: "tempoh ISO",
|
||||
ipv4: "alamat IPv4",
|
||||
ipv6: "alamat IPv6",
|
||||
cidrv4: "julat IPv4",
|
||||
cidrv6: "julat IPv6",
|
||||
base64: "string dikodkan base64",
|
||||
base64url: "string dikodkan base64url",
|
||||
json_string: "string JSON",
|
||||
e164: "nombor E.164",
|
||||
jwt: "JWT",
|
||||
template_literal: "input",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `Input tidak sah: dijangka ${issue.expected}, diterima ${(0, exports.parsedType)(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Input tidak sah: dijangka ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Pilihan tidak sah: dijangka salah satu daripada ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `Terlalu besar: dijangka ${issue.origin ?? "nilai"} ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elemen"}`;
|
||||
return `Terlalu besar: dijangka ${issue.origin ?? "nilai"} adalah ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `Terlalu kecil: dijangka ${issue.origin} ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
||||
}
|
||||
return `Terlalu kecil: dijangka ${issue.origin} adalah ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `String tidak sah: mesti bermula dengan "${_issue.prefix}"`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `String tidak sah: mesti berakhir dengan "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes")
|
||||
return `String tidak sah: mesti mengandungi "${_issue.includes}"`;
|
||||
if (_issue.format === "regex")
|
||||
return `String tidak sah: mesti sepadan dengan corak ${_issue.pattern}`;
|
||||
return `${Nouns[_issue.format] ?? issue.format} tidak sah`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Nombor tidak sah: perlu gandaan ${issue.divisor}`;
|
||||
case "unrecognized_keys":
|
||||
return `Kunci tidak dikenali: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `Kunci tidak sah dalam ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return "Input tidak sah";
|
||||
case "invalid_element":
|
||||
return `Nilai tidak sah dalam ${issue.origin}`;
|
||||
default:
|
||||
return `Input tidak sah`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
143
node_modules/zod/dist/cjs/v4/locales/no.js
generated
vendored
Normal file
143
node_modules/zod/dist/cjs/v4/locales/no.js
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "tegn", verb: "å ha" },
|
||||
file: { unit: "bytes", verb: "å ha" },
|
||||
array: { unit: "elementer", verb: "å inneholde" },
|
||||
set: { unit: "elementer", verb: "å inneholde" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "tall";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "liste";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "input",
|
||||
email: "e-postadresse",
|
||||
url: "URL",
|
||||
emoji: "emoji",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "ISO dato- og klokkeslett",
|
||||
date: "ISO-dato",
|
||||
time: "ISO-klokkeslett",
|
||||
duration: "ISO-varighet",
|
||||
ipv4: "IPv4-område",
|
||||
ipv6: "IPv6-område",
|
||||
cidrv4: "IPv4-spekter",
|
||||
cidrv6: "IPv6-spekter",
|
||||
base64: "base64-enkodet streng",
|
||||
base64url: "base64url-enkodet streng",
|
||||
json_string: "JSON-streng",
|
||||
e164: "E.164-nummer",
|
||||
jwt: "JWT",
|
||||
template_literal: "input",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `Ugyldig input: forventet ${issue.expected}, fikk ${(0, exports.parsedType)(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Ugyldig verdi: forventet ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Ugyldig valg: forventet en av ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `For stor(t): forventet ${issue.origin ?? "value"} til å ha ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementer"}`;
|
||||
return `For stor(t): forventet ${issue.origin ?? "value"} til å ha ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `For lite(n): forventet ${issue.origin} til å ha ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
||||
}
|
||||
return `For lite(n): forventet ${issue.origin} til å ha ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `Ugyldig streng: må starte med "${_issue.prefix}"`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `Ugyldig streng: må ende med "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes")
|
||||
return `Ugyldig streng: må inneholde "${_issue.includes}"`;
|
||||
if (_issue.format === "regex")
|
||||
return `Ugyldig streng: må matche mønsteret ${_issue.pattern}`;
|
||||
return `Ugyldig ${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Ugyldig tall: må være et multiplum av ${issue.divisor}`;
|
||||
case "unrecognized_keys":
|
||||
return `${issue.keys.length > 1 ? "Ukjente nøkler" : "Ukjent nøkkel"}: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `Ugyldig nøkkel i ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return "Ugyldig input";
|
||||
case "invalid_element":
|
||||
return `Ugyldig verdi i ${issue.origin}`;
|
||||
default:
|
||||
return `Ugyldig input`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
144
node_modules/zod/dist/cjs/v4/locales/ota.js
generated
vendored
Normal file
144
node_modules/zod/dist/cjs/v4/locales/ota.js
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "harf", verb: "olmalıdır" },
|
||||
file: { unit: "bayt", verb: "olmalıdır" },
|
||||
array: { unit: "unsur", verb: "olmalıdır" },
|
||||
set: { unit: "unsur", verb: "olmalıdır" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "numara";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "saf";
|
||||
}
|
||||
if (data === null) {
|
||||
return "gayb";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "giren",
|
||||
email: "epostagâh",
|
||||
url: "URL",
|
||||
emoji: "emoji",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "ISO hengâmı",
|
||||
date: "ISO tarihi",
|
||||
time: "ISO zamanı",
|
||||
duration: "ISO müddeti",
|
||||
ipv4: "IPv4 nişânı",
|
||||
ipv6: "IPv6 nişânı",
|
||||
cidrv4: "IPv4 menzili",
|
||||
cidrv6: "IPv6 menzili",
|
||||
base64: "base64-şifreli metin",
|
||||
base64url: "base64url-şifreli metin",
|
||||
json_string: "JSON metin",
|
||||
e164: "E.164 sayısı",
|
||||
jwt: "JWT",
|
||||
template_literal: "giren",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `Fâsit giren: umulan ${issue.expected}, alınan ${(0, exports.parsedType)(issue.input)}`;
|
||||
// return `Fâsit giren: umulan ${issue.expected}, alınan ${util.getParsedType(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Fâsit giren: umulan ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Fâsit tercih: mûteberler ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `Fazla büyük: ${issue.origin ?? "value"}, ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"} sahip olmalıydı.`;
|
||||
return `Fazla büyük: ${issue.origin ?? "value"}, ${adj}${issue.maximum.toString()} olmalıydı.`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `Fazla küçük: ${issue.origin}, ${adj}${issue.minimum.toString()} ${sizing.unit} sahip olmalıydı.`;
|
||||
}
|
||||
return `Fazla küçük: ${issue.origin}, ${adj}${issue.minimum.toString()} olmalıydı.`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `Fâsit metin: "${_issue.prefix}" ile başlamalı.`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `Fâsit metin: "${_issue.suffix}" ile bitmeli.`;
|
||||
if (_issue.format === "includes")
|
||||
return `Fâsit metin: "${_issue.includes}" ihtivâ etmeli.`;
|
||||
if (_issue.format === "regex")
|
||||
return `Fâsit metin: ${_issue.pattern} nakşına uymalı.`;
|
||||
return `Fâsit ${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Fâsit sayı: ${issue.divisor} katı olmalıydı.`;
|
||||
case "unrecognized_keys":
|
||||
return `Tanınmayan anahtar ${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `${issue.origin} için tanınmayan anahtar var.`;
|
||||
case "invalid_union":
|
||||
return "Giren tanınamadı.";
|
||||
case "invalid_element":
|
||||
return `${issue.origin} için tanınmayan kıymet var.`;
|
||||
default:
|
||||
return `Kıymet tanınamadı.`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
144
node_modules/zod/dist/cjs/v4/locales/pl.js
generated
vendored
Normal file
144
node_modules/zod/dist/cjs/v4/locales/pl.js
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "znaków", verb: "mieć" },
|
||||
file: { unit: "bajtów", verb: "mieć" },
|
||||
array: { unit: "elementów", verb: "mieć" },
|
||||
set: { unit: "elementów", verb: "mieć" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "liczba";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "tablica";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "wyrażenie",
|
||||
email: "adres email",
|
||||
url: "URL",
|
||||
emoji: "emoji",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "data i godzina w formacie ISO",
|
||||
date: "data w formacie ISO",
|
||||
time: "godzina w formacie ISO",
|
||||
duration: "czas trwania ISO",
|
||||
ipv4: "adres IPv4",
|
||||
ipv6: "adres IPv6",
|
||||
cidrv4: "zakres IPv4",
|
||||
cidrv6: "zakres IPv6",
|
||||
base64: "ciąg znaków zakodowany w formacie base64",
|
||||
base64url: "ciąg znaków zakodowany w formacie base64url",
|
||||
json_string: "ciąg znaków w formacie JSON",
|
||||
e164: "liczba E.164",
|
||||
jwt: "JWT",
|
||||
template_literal: "wejście",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `Nieprawidłowe dane wejściowe: oczekiwano ${issue.expected}, otrzymano ${(0, exports.parsedType)(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Nieprawidłowe dane wejściowe: oczekiwano ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Nieprawidłowa opcja: oczekiwano jednej z wartości ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `Za duża wartość: oczekiwano, że ${issue.origin ?? "wartość"} będzie mieć ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementów"}`;
|
||||
}
|
||||
return `Zbyt duż(y/a/e): oczekiwano, że ${issue.origin ?? "wartość"} będzie wynosić ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `Za mała wartość: oczekiwano, że ${issue.origin ?? "wartość"} będzie mieć ${adj}${issue.minimum.toString()} ${sizing.unit ?? "elementów"}`;
|
||||
}
|
||||
return `Zbyt mał(y/a/e): oczekiwano, że ${issue.origin ?? "wartość"} będzie wynosić ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `Nieprawidłowy ciąg znaków: musi zaczynać się od "${_issue.prefix}"`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `Nieprawidłowy ciąg znaków: musi kończyć się na "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes")
|
||||
return `Nieprawidłowy ciąg znaków: musi zawierać "${_issue.includes}"`;
|
||||
if (_issue.format === "regex")
|
||||
return `Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${_issue.pattern}`;
|
||||
return `Nieprawidłow(y/a/e) ${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Nieprawidłowa liczba: musi być wielokrotnością ${issue.divisor}`;
|
||||
case "unrecognized_keys":
|
||||
return `Nierozpoznane klucze${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `Nieprawidłowy klucz w ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return "Nieprawidłowe dane wejściowe";
|
||||
case "invalid_element":
|
||||
return `Nieprawidłowa wartość w ${issue.origin}`;
|
||||
default:
|
||||
return `Nieprawidłowe dane wejściowe`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
143
node_modules/zod/dist/cjs/v4/locales/pt.js
generated
vendored
Normal file
143
node_modules/zod/dist/cjs/v4/locales/pt.js
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "caracteres", verb: "ter" },
|
||||
file: { unit: "bytes", verb: "ter" },
|
||||
array: { unit: "itens", verb: "ter" },
|
||||
set: { unit: "itens", verb: "ter" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "número";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "array";
|
||||
}
|
||||
if (data === null) {
|
||||
return "nulo";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "padrão",
|
||||
email: "endereço de e-mail",
|
||||
url: "URL",
|
||||
emoji: "emoji",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "data e hora ISO",
|
||||
date: "data ISO",
|
||||
time: "hora ISO",
|
||||
duration: "duração ISO",
|
||||
ipv4: "endereço IPv4",
|
||||
ipv6: "endereço IPv6",
|
||||
cidrv4: "faixa de IPv4",
|
||||
cidrv6: "faixa de IPv6",
|
||||
base64: "texto codificado em base64",
|
||||
base64url: "URL codificada em base64",
|
||||
json_string: "texto JSON",
|
||||
e164: "número E.164",
|
||||
jwt: "JWT",
|
||||
template_literal: "entrada",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `Tipo inválido: esperado ${issue.expected}, recebido ${(0, exports.parsedType)(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Entrada inválida: esperado ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Opção inválida: esperada uma das ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `Muito grande: esperado que ${issue.origin ?? "valor"} tivesse ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementos"}`;
|
||||
return `Muito grande: esperado que ${issue.origin ?? "valor"} fosse ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `Muito pequeno: esperado que ${issue.origin} tivesse ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
||||
}
|
||||
return `Muito pequeno: esperado que ${issue.origin} fosse ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `Texto inválido: deve começar com "${_issue.prefix}"`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `Texto inválido: deve terminar com "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes")
|
||||
return `Texto inválido: deve incluir "${_issue.includes}"`;
|
||||
if (_issue.format === "regex")
|
||||
return `Texto inválido: deve corresponder ao padrão ${_issue.pattern}`;
|
||||
return `${Nouns[_issue.format] ?? issue.format} inválido`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Número inválido: deve ser múltiplo de ${issue.divisor}`;
|
||||
case "unrecognized_keys":
|
||||
return `Chave${issue.keys.length > 1 ? "s" : ""} desconhecida${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `Chave inválida em ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return "Entrada inválida";
|
||||
case "invalid_element":
|
||||
return `Valor inválido em ${issue.origin}`;
|
||||
default:
|
||||
return `Campo inválido`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
191
node_modules/zod/dist/cjs/v4/locales/ru.js
generated
vendored
Normal file
191
node_modules/zod/dist/cjs/v4/locales/ru.js
generated
vendored
Normal file
@@ -0,0 +1,191 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
function getRussianPlural(count, one, few, many) {
|
||||
const absCount = Math.abs(count);
|
||||
const lastDigit = absCount % 10;
|
||||
const lastTwoDigits = absCount % 100;
|
||||
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
||||
return many;
|
||||
}
|
||||
if (lastDigit === 1) {
|
||||
return one;
|
||||
}
|
||||
if (lastDigit >= 2 && lastDigit <= 4) {
|
||||
return few;
|
||||
}
|
||||
return many;
|
||||
}
|
||||
const Sizable = {
|
||||
string: {
|
||||
unit: {
|
||||
one: "символ",
|
||||
few: "символа",
|
||||
many: "символов",
|
||||
},
|
||||
verb: "иметь",
|
||||
},
|
||||
file: {
|
||||
unit: {
|
||||
one: "байт",
|
||||
few: "байта",
|
||||
many: "байт",
|
||||
},
|
||||
verb: "иметь",
|
||||
},
|
||||
array: {
|
||||
unit: {
|
||||
one: "элемент",
|
||||
few: "элемента",
|
||||
many: "элементов",
|
||||
},
|
||||
verb: "иметь",
|
||||
},
|
||||
set: {
|
||||
unit: {
|
||||
one: "элемент",
|
||||
few: "элемента",
|
||||
many: "элементов",
|
||||
},
|
||||
verb: "иметь",
|
||||
},
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "число";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "массив";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "ввод",
|
||||
email: "email адрес",
|
||||
url: "URL",
|
||||
emoji: "эмодзи",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "ISO дата и время",
|
||||
date: "ISO дата",
|
||||
time: "ISO время",
|
||||
duration: "ISO длительность",
|
||||
ipv4: "IPv4 адрес",
|
||||
ipv6: "IPv6 адрес",
|
||||
cidrv4: "IPv4 диапазон",
|
||||
cidrv6: "IPv6 диапазон",
|
||||
base64: "строка в формате base64",
|
||||
base64url: "строка в формате base64url",
|
||||
json_string: "JSON строка",
|
||||
e164: "номер E.164",
|
||||
jwt: "JWT",
|
||||
template_literal: "ввод",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `Неверный ввод: ожидалось ${issue.expected}, получено ${(0, exports.parsedType)(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Неверный ввод: ожидалось ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Неверный вариант: ожидалось одно из ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
const maxValue = Number(issue.maximum);
|
||||
const unit = getRussianPlural(maxValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);
|
||||
return `Слишком большое значение: ожидалось, что ${issue.origin ?? "значение"} будет иметь ${adj}${issue.maximum.toString()} ${unit}`;
|
||||
}
|
||||
return `Слишком большое значение: ожидалось, что ${issue.origin ?? "значение"} будет ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
const minValue = Number(issue.minimum);
|
||||
const unit = getRussianPlural(minValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);
|
||||
return `Слишком маленькое значение: ожидалось, что ${issue.origin} будет иметь ${adj}${issue.minimum.toString()} ${unit}`;
|
||||
}
|
||||
return `Слишком маленькое значение: ожидалось, что ${issue.origin} будет ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `Неверная строка: должна начинаться с "${_issue.prefix}"`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `Неверная строка: должна заканчиваться на "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes")
|
||||
return `Неверная строка: должна содержать "${_issue.includes}"`;
|
||||
if (_issue.format === "regex")
|
||||
return `Неверная строка: должна соответствовать шаблону ${_issue.pattern}`;
|
||||
return `Неверный ${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Неверное число: должно быть кратным ${issue.divisor}`;
|
||||
case "unrecognized_keys":
|
||||
return `Нераспознанн${issue.keys.length > 1 ? "ые" : "ый"} ключ${issue.keys.length > 1 ? "и" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `Неверный ключ в ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return "Неверные входные данные";
|
||||
case "invalid_element":
|
||||
return `Неверное значение в ${issue.origin}`;
|
||||
default:
|
||||
return `Неверные входные данные`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
144
node_modules/zod/dist/cjs/v4/locales/sl.js
generated
vendored
Normal file
144
node_modules/zod/dist/cjs/v4/locales/sl.js
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "znakov", verb: "imeti" },
|
||||
file: { unit: "bajtov", verb: "imeti" },
|
||||
array: { unit: "elementov", verb: "imeti" },
|
||||
set: { unit: "elementov", verb: "imeti" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "število";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "tabela";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "vnos",
|
||||
email: "e-poštni naslov",
|
||||
url: "URL",
|
||||
emoji: "emoji",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "ISO datum in čas",
|
||||
date: "ISO datum",
|
||||
time: "ISO čas",
|
||||
duration: "ISO trajanje",
|
||||
ipv4: "IPv4 naslov",
|
||||
ipv6: "IPv6 naslov",
|
||||
cidrv4: "obseg IPv4",
|
||||
cidrv6: "obseg IPv6",
|
||||
base64: "base64 kodiran niz",
|
||||
base64url: "base64url kodiran niz",
|
||||
json_string: "JSON niz",
|
||||
e164: "E.164 številka",
|
||||
jwt: "JWT",
|
||||
template_literal: "vnos",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `Neveljaven vnos: pričakovano ${issue.expected}, prejeto ${(0, exports.parsedType)(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Neveljaven vnos: pričakovano ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Neveljavna možnost: pričakovano eno izmed ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `Preveliko: pričakovano, da bo ${issue.origin ?? "vrednost"} imelo ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementov"}`;
|
||||
return `Preveliko: pričakovano, da bo ${issue.origin ?? "vrednost"} ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `Premajhno: pričakovano, da bo ${issue.origin} imelo ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
||||
}
|
||||
return `Premajhno: pričakovano, da bo ${issue.origin} ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with") {
|
||||
return `Neveljaven niz: mora se začeti z "${_issue.prefix}"`;
|
||||
}
|
||||
if (_issue.format === "ends_with")
|
||||
return `Neveljaven niz: mora se končati z "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes")
|
||||
return `Neveljaven niz: mora vsebovati "${_issue.includes}"`;
|
||||
if (_issue.format === "regex")
|
||||
return `Neveljaven niz: mora ustrezati vzorcu ${_issue.pattern}`;
|
||||
return `Neveljaven ${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Neveljavno število: mora biti večkratnik ${issue.divisor}`;
|
||||
case "unrecognized_keys":
|
||||
return `Neprepoznan${issue.keys.length > 1 ? "i ključi" : " ključ"}: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `Neveljaven ključ v ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return "Neveljaven vnos";
|
||||
case "invalid_element":
|
||||
return `Neveljavna vrednost v ${issue.origin}`;
|
||||
default:
|
||||
return "Neveljaven vnos";
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
144
node_modules/zod/dist/cjs/v4/locales/ta.js
generated
vendored
Normal file
144
node_modules/zod/dist/cjs/v4/locales/ta.js
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "எழுத்துக்கள்", verb: "கொண்டிருக்க வேண்டும்" },
|
||||
file: { unit: "பைட்டுகள்", verb: "கொண்டிருக்க வேண்டும்" },
|
||||
array: { unit: "உறுப்புகள்", verb: "கொண்டிருக்க வேண்டும்" },
|
||||
set: { unit: "உறுப்புகள்", verb: "கொண்டிருக்க வேண்டும்" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "எண் அல்லாதது" : "எண்";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "அணி";
|
||||
}
|
||||
if (data === null) {
|
||||
return "வெறுமை";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "உள்ளீடு",
|
||||
email: "மின்னஞ்சல் முகவரி",
|
||||
url: "URL",
|
||||
emoji: "emoji",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "ISO தேதி நேரம்",
|
||||
date: "ISO தேதி",
|
||||
time: "ISO நேரம்",
|
||||
duration: "ISO கால அளவு",
|
||||
ipv4: "IPv4 முகவரி",
|
||||
ipv6: "IPv6 முகவரி",
|
||||
cidrv4: "IPv4 வரம்பு",
|
||||
cidrv6: "IPv6 வரம்பு",
|
||||
base64: "base64-encoded சரம்",
|
||||
base64url: "base64url-encoded சரம்",
|
||||
json_string: "JSON சரம்",
|
||||
e164: "E.164 எண்",
|
||||
jwt: "JWT",
|
||||
template_literal: "input",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${issue.expected}, பெறப்பட்டது ${(0, exports.parsedType)(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${util.joinValues(issue.values, "|")} இல் ஒன்று`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `மிக பெரியது: எதிர்பார்க்கப்பட்டது ${issue.origin ?? "மதிப்பு"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "உறுப்புகள்"} ஆக இருக்க வேண்டும்`;
|
||||
}
|
||||
return `மிக பெரியது: எதிர்பார்க்கப்பட்டது ${issue.origin ?? "மதிப்பு"} ${adj}${issue.maximum.toString()} ஆக இருக்க வேண்டும்`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit} ஆக இருக்க வேண்டும்`; //
|
||||
}
|
||||
return `மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${issue.origin} ${adj}${issue.minimum.toString()} ஆக இருக்க வேண்டும்`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `தவறான சரம்: "${_issue.prefix}" இல் தொடங்க வேண்டும்`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `தவறான சரம்: "${_issue.suffix}" இல் முடிவடைய வேண்டும்`;
|
||||
if (_issue.format === "includes")
|
||||
return `தவறான சரம்: "${_issue.includes}" ஐ உள்ளடக்க வேண்டும்`;
|
||||
if (_issue.format === "regex")
|
||||
return `தவறான சரம்: ${_issue.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;
|
||||
return `தவறான ${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `தவறான எண்: ${issue.divisor} இன் பலமாக இருக்க வேண்டும்`;
|
||||
case "unrecognized_keys":
|
||||
return `அடையாளம் தெரியாத விசை${issue.keys.length > 1 ? "கள்" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `${issue.origin} இல் தவறான விசை`;
|
||||
case "invalid_union":
|
||||
return "தவறான உள்ளீடு";
|
||||
case "invalid_element":
|
||||
return `${issue.origin} இல் தவறான மதிப்பு`;
|
||||
default:
|
||||
return `தவறான உள்ளீடு`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
144
node_modules/zod/dist/cjs/v4/locales/th.js
generated
vendored
Normal file
144
node_modules/zod/dist/cjs/v4/locales/th.js
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "ตัวอักษร", verb: "ควรมี" },
|
||||
file: { unit: "ไบต์", verb: "ควรมี" },
|
||||
array: { unit: "รายการ", verb: "ควรมี" },
|
||||
set: { unit: "รายการ", verb: "ควรมี" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "ไม่ใช่ตัวเลข (NaN)" : "ตัวเลข";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "อาร์เรย์ (Array)";
|
||||
}
|
||||
if (data === null) {
|
||||
return "ไม่มีค่า (null)";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "ข้อมูลที่ป้อน",
|
||||
email: "ที่อยู่อีเมล",
|
||||
url: "URL",
|
||||
emoji: "อิโมจิ",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "วันที่เวลาแบบ ISO",
|
||||
date: "วันที่แบบ ISO",
|
||||
time: "เวลาแบบ ISO",
|
||||
duration: "ช่วงเวลาแบบ ISO",
|
||||
ipv4: "ที่อยู่ IPv4",
|
||||
ipv6: "ที่อยู่ IPv6",
|
||||
cidrv4: "ช่วง IP แบบ IPv4",
|
||||
cidrv6: "ช่วง IP แบบ IPv6",
|
||||
base64: "ข้อความแบบ Base64",
|
||||
base64url: "ข้อความแบบ Base64 สำหรับ URL",
|
||||
json_string: "ข้อความแบบ JSON",
|
||||
e164: "เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",
|
||||
jwt: "โทเคน JWT",
|
||||
template_literal: "ข้อมูลที่ป้อน",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${issue.expected} แต่ได้รับ ${(0, exports.parsedType)(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `ค่าไม่ถูกต้อง: ควรเป็น ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "ไม่เกิน" : "น้อยกว่า";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `เกินกำหนด: ${issue.origin ?? "ค่า"} ควรมี${adj} ${issue.maximum.toString()} ${sizing.unit ?? "รายการ"}`;
|
||||
return `เกินกำหนด: ${issue.origin ?? "ค่า"} ควรมี${adj} ${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? "อย่างน้อย" : "มากกว่า";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `น้อยกว่ากำหนด: ${issue.origin} ควรมี${adj} ${issue.minimum.toString()} ${sizing.unit}`;
|
||||
}
|
||||
return `น้อยกว่ากำหนด: ${issue.origin} ควรมี${adj} ${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with") {
|
||||
return `รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${_issue.prefix}"`;
|
||||
}
|
||||
if (_issue.format === "ends_with")
|
||||
return `รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes")
|
||||
return `รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${_issue.includes}" อยู่ในข้อความ`;
|
||||
if (_issue.format === "regex")
|
||||
return `รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${_issue.pattern}`;
|
||||
return `รูปแบบไม่ถูกต้อง: ${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${issue.divisor} ได้ลงตัว`;
|
||||
case "unrecognized_keys":
|
||||
return `พบคีย์ที่ไม่รู้จัก: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `คีย์ไม่ถูกต้องใน ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return "ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";
|
||||
case "invalid_element":
|
||||
return `ข้อมูลไม่ถูกต้องใน ${issue.origin}`;
|
||||
default:
|
||||
return `ข้อมูลไม่ถูกต้อง`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
142
node_modules/zod/dist/cjs/v4/locales/tr.js
generated
vendored
Normal file
142
node_modules/zod/dist/cjs/v4/locales/tr.js
generated
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "karakter", verb: "olmalı" },
|
||||
file: { unit: "bayt", verb: "olmalı" },
|
||||
array: { unit: "öğe", verb: "olmalı" },
|
||||
set: { unit: "öğe", verb: "olmalı" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "number";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "array";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "girdi",
|
||||
email: "e-posta adresi",
|
||||
url: "URL",
|
||||
emoji: "emoji",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "ISO tarih ve saat",
|
||||
date: "ISO tarih",
|
||||
time: "ISO saat",
|
||||
duration: "ISO süre",
|
||||
ipv4: "IPv4 adresi",
|
||||
ipv6: "IPv6 adresi",
|
||||
cidrv4: "IPv4 aralığı",
|
||||
cidrv6: "IPv6 aralığı",
|
||||
base64: "base64 ile şifrelenmiş metin",
|
||||
base64url: "base64url ile şifrelenmiş metin",
|
||||
json_string: "JSON dizesi",
|
||||
e164: "E.164 sayısı",
|
||||
jwt: "JWT",
|
||||
template_literal: "Şablon dizesi",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `Geçersiz değer: beklenen ${issue.expected}, alınan ${(0, exports.parsedType)(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Geçersiz değer: beklenen ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Geçersiz seçenek: aşağıdakilerden biri olmalı: ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `Çok büyük: beklenen ${issue.origin ?? "değer"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "öğe"}`;
|
||||
return `Çok büyük: beklenen ${issue.origin ?? "değer"} ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `Çok küçük: beklenen ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
||||
return `Çok küçük: beklenen ${issue.origin} ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `Geçersiz metin: "${_issue.prefix}" ile başlamalı`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `Geçersiz metin: "${_issue.suffix}" ile bitmeli`;
|
||||
if (_issue.format === "includes")
|
||||
return `Geçersiz metin: "${_issue.includes}" içermeli`;
|
||||
if (_issue.format === "regex")
|
||||
return `Geçersiz metin: ${_issue.pattern} desenine uymalı`;
|
||||
return `Geçersiz ${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Geçersiz sayı: ${issue.divisor} ile tam bölünebilmeli`;
|
||||
case "unrecognized_keys":
|
||||
return `Tanınmayan anahtar${issue.keys.length > 1 ? "lar" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `${issue.origin} içinde geçersiz anahtar`;
|
||||
case "invalid_union":
|
||||
return "Geçersiz değer";
|
||||
case "invalid_element":
|
||||
return `${issue.origin} içinde geçersiz değer`;
|
||||
default:
|
||||
return `Geçersiz değer`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
144
node_modules/zod/dist/cjs/v4/locales/ua.js
generated
vendored
Normal file
144
node_modules/zod/dist/cjs/v4/locales/ua.js
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "символів", verb: "матиме" },
|
||||
file: { unit: "байтів", verb: "матиме" },
|
||||
array: { unit: "елементів", verb: "матиме" },
|
||||
set: { unit: "елементів", verb: "матиме" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "число";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "масив";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "вхідні дані",
|
||||
email: "адреса електронної пошти",
|
||||
url: "URL",
|
||||
emoji: "емодзі",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "дата та час ISO",
|
||||
date: "дата ISO",
|
||||
time: "час ISO",
|
||||
duration: "тривалість ISO",
|
||||
ipv4: "адреса IPv4",
|
||||
ipv6: "адреса IPv6",
|
||||
cidrv4: "діапазон IPv4",
|
||||
cidrv6: "діапазон IPv6",
|
||||
base64: "рядок у кодуванні base64",
|
||||
base64url: "рядок у кодуванні base64url",
|
||||
json_string: "рядок JSON",
|
||||
e164: "номер E.164",
|
||||
jwt: "JWT",
|
||||
template_literal: "вхідні дані",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `Неправильні вхідні дані: очікується ${issue.expected}, отримано ${(0, exports.parsedType)(issue.input)}`;
|
||||
// return `Неправильні вхідні дані: очікується ${issue.expected}, отримано ${util.getParsedType(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Неправильні вхідні дані: очікується ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Неправильна опція: очікується одне з ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `Занадто велике: очікується, що ${issue.origin ?? "значення"} ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "елементів"}`;
|
||||
return `Занадто велике: очікується, що ${issue.origin ?? "значення"} буде ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `Занадто мале: очікується, що ${issue.origin} ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
||||
}
|
||||
return `Занадто мале: очікується, що ${issue.origin} буде ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `Неправильний рядок: повинен починатися з "${_issue.prefix}"`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `Неправильний рядок: повинен закінчуватися на "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes")
|
||||
return `Неправильний рядок: повинен містити "${_issue.includes}"`;
|
||||
if (_issue.format === "regex")
|
||||
return `Неправильний рядок: повинен відповідати шаблону ${_issue.pattern}`;
|
||||
return `Неправильний ${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Неправильне число: повинно бути кратним ${issue.divisor}`;
|
||||
case "unrecognized_keys":
|
||||
return `Нерозпізнаний ключ${issue.keys.length > 1 ? "і" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `Неправильний ключ у ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return "Неправильні вхідні дані";
|
||||
case "invalid_element":
|
||||
return `Неправильне значення у ${issue.origin}`;
|
||||
default:
|
||||
return `Неправильні вхідні дані`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
144
node_modules/zod/dist/cjs/v4/locales/ur.js
generated
vendored
Normal file
144
node_modules/zod/dist/cjs/v4/locales/ur.js
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "حروف", verb: "ہونا" },
|
||||
file: { unit: "بائٹس", verb: "ہونا" },
|
||||
array: { unit: "آئٹمز", verb: "ہونا" },
|
||||
set: { unit: "آئٹمز", verb: "ہونا" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "نمبر";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "آرے";
|
||||
}
|
||||
if (data === null) {
|
||||
return "نل";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "ان پٹ",
|
||||
email: "ای میل ایڈریس",
|
||||
url: "یو آر ایل",
|
||||
emoji: "ایموجی",
|
||||
uuid: "یو یو آئی ڈی",
|
||||
uuidv4: "یو یو آئی ڈی وی 4",
|
||||
uuidv6: "یو یو آئی ڈی وی 6",
|
||||
nanoid: "نینو آئی ڈی",
|
||||
guid: "جی یو آئی ڈی",
|
||||
cuid: "سی یو آئی ڈی",
|
||||
cuid2: "سی یو آئی ڈی 2",
|
||||
ulid: "یو ایل آئی ڈی",
|
||||
xid: "ایکس آئی ڈی",
|
||||
ksuid: "کے ایس یو آئی ڈی",
|
||||
datetime: "آئی ایس او ڈیٹ ٹائم",
|
||||
date: "آئی ایس او تاریخ",
|
||||
time: "آئی ایس او وقت",
|
||||
duration: "آئی ایس او مدت",
|
||||
ipv4: "آئی پی وی 4 ایڈریس",
|
||||
ipv6: "آئی پی وی 6 ایڈریس",
|
||||
cidrv4: "آئی پی وی 4 رینج",
|
||||
cidrv6: "آئی پی وی 6 رینج",
|
||||
base64: "بیس 64 ان کوڈڈ سٹرنگ",
|
||||
base64url: "بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",
|
||||
json_string: "جے ایس او این سٹرنگ",
|
||||
e164: "ای 164 نمبر",
|
||||
jwt: "جے ڈبلیو ٹی",
|
||||
template_literal: "ان پٹ",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `غلط ان پٹ: ${issue.expected} متوقع تھا، ${(0, exports.parsedType)(issue.input)} موصول ہوا`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `غلط ان پٹ: ${util.stringifyPrimitive(issue.values[0])} متوقع تھا`;
|
||||
return `غلط آپشن: ${util.joinValues(issue.values, "|")} میں سے ایک متوقع تھا`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `بہت بڑا: ${issue.origin ?? "ویلیو"} کے ${adj}${issue.maximum.toString()} ${sizing.unit ?? "عناصر"} ہونے متوقع تھے`;
|
||||
return `بہت بڑا: ${issue.origin ?? "ویلیو"} کا ${adj}${issue.maximum.toString()} ہونا متوقع تھا`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `بہت چھوٹا: ${issue.origin} کے ${adj}${issue.minimum.toString()} ${sizing.unit} ہونے متوقع تھے`;
|
||||
}
|
||||
return `بہت چھوٹا: ${issue.origin} کا ${adj}${issue.minimum.toString()} ہونا متوقع تھا`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with") {
|
||||
return `غلط سٹرنگ: "${_issue.prefix}" سے شروع ہونا چاہیے`;
|
||||
}
|
||||
if (_issue.format === "ends_with")
|
||||
return `غلط سٹرنگ: "${_issue.suffix}" پر ختم ہونا چاہیے`;
|
||||
if (_issue.format === "includes")
|
||||
return `غلط سٹرنگ: "${_issue.includes}" شامل ہونا چاہیے`;
|
||||
if (_issue.format === "regex")
|
||||
return `غلط سٹرنگ: پیٹرن ${_issue.pattern} سے میچ ہونا چاہیے`;
|
||||
return `غلط ${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `غلط نمبر: ${issue.divisor} کا مضاعف ہونا چاہیے`;
|
||||
case "unrecognized_keys":
|
||||
return `غیر تسلیم شدہ کی${issue.keys.length > 1 ? "ز" : ""}: ${util.joinValues(issue.keys, "، ")}`;
|
||||
case "invalid_key":
|
||||
return `${issue.origin} میں غلط کی`;
|
||||
case "invalid_union":
|
||||
return "غلط ان پٹ";
|
||||
case "invalid_element":
|
||||
return `${issue.origin} میں غلط ویلیو`;
|
||||
default:
|
||||
return `غلط ان پٹ`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
143
node_modules/zod/dist/cjs/v4/locales/vi.js
generated
vendored
Normal file
143
node_modules/zod/dist/cjs/v4/locales/vi.js
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "ký tự", verb: "có" },
|
||||
file: { unit: "byte", verb: "có" },
|
||||
array: { unit: "phần tử", verb: "có" },
|
||||
set: { unit: "phần tử", verb: "có" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "số";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "mảng";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "đầu vào",
|
||||
email: "địa chỉ email",
|
||||
url: "URL",
|
||||
emoji: "emoji",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "ngày giờ ISO",
|
||||
date: "ngày ISO",
|
||||
time: "giờ ISO",
|
||||
duration: "khoảng thời gian ISO",
|
||||
ipv4: "địa chỉ IPv4",
|
||||
ipv6: "địa chỉ IPv6",
|
||||
cidrv4: "dải IPv4",
|
||||
cidrv6: "dải IPv6",
|
||||
base64: "chuỗi mã hóa base64",
|
||||
base64url: "chuỗi mã hóa base64url",
|
||||
json_string: "chuỗi JSON",
|
||||
e164: "số E.164",
|
||||
jwt: "JWT",
|
||||
template_literal: "đầu vào",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `Đầu vào không hợp lệ: mong đợi ${issue.expected}, nhận được ${(0, exports.parsedType)(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Đầu vào không hợp lệ: mong đợi ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `Quá lớn: mong đợi ${issue.origin ?? "giá trị"} ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "phần tử"}`;
|
||||
return `Quá lớn: mong đợi ${issue.origin ?? "giá trị"} ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `Quá nhỏ: mong đợi ${issue.origin} ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
||||
}
|
||||
return `Quá nhỏ: mong đợi ${issue.origin} ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `Chuỗi không hợp lệ: phải bắt đầu bằng "${_issue.prefix}"`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `Chuỗi không hợp lệ: phải kết thúc bằng "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes")
|
||||
return `Chuỗi không hợp lệ: phải bao gồm "${_issue.includes}"`;
|
||||
if (_issue.format === "regex")
|
||||
return `Chuỗi không hợp lệ: phải khớp với mẫu ${_issue.pattern}`;
|
||||
return `${Nouns[_issue.format] ?? issue.format} không hợp lệ`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Số không hợp lệ: phải là bội số của ${issue.divisor}`;
|
||||
case "unrecognized_keys":
|
||||
return `Khóa không được nhận dạng: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `Khóa không hợp lệ trong ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return "Đầu vào không hợp lệ";
|
||||
case "invalid_element":
|
||||
return `Giá trị không hợp lệ trong ${issue.origin}`;
|
||||
default:
|
||||
return `Đầu vào không hợp lệ`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
143
node_modules/zod/dist/cjs/v4/locales/zh-CN.js
generated
vendored
Normal file
143
node_modules/zod/dist/cjs/v4/locales/zh-CN.js
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "字符", verb: "包含" },
|
||||
file: { unit: "字节", verb: "包含" },
|
||||
array: { unit: "项", verb: "包含" },
|
||||
set: { unit: "项", verb: "包含" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "非数字(NaN)" : "数字";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "数组";
|
||||
}
|
||||
if (data === null) {
|
||||
return "空值(null)";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "输入",
|
||||
email: "电子邮件",
|
||||
url: "URL",
|
||||
emoji: "表情符号",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "ISO日期时间",
|
||||
date: "ISO日期",
|
||||
time: "ISO时间",
|
||||
duration: "ISO时长",
|
||||
ipv4: "IPv4地址",
|
||||
ipv6: "IPv6地址",
|
||||
cidrv4: "IPv4网段",
|
||||
cidrv6: "IPv6网段",
|
||||
base64: "base64编码字符串",
|
||||
base64url: "base64url编码字符串",
|
||||
json_string: "JSON字符串",
|
||||
e164: "E.164号码",
|
||||
jwt: "JWT",
|
||||
template_literal: "输入",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `无效输入:期望 ${issue.expected},实际接收 ${(0, exports.parsedType)(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `无效输入:期望 ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `无效选项:期望以下之一 ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `数值过大:期望 ${issue.origin ?? "值"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "个元素"}`;
|
||||
return `数值过大:期望 ${issue.origin ?? "值"} ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `数值过小:期望 ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
||||
}
|
||||
return `数值过小:期望 ${issue.origin} ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `无效字符串:必须以 "${_issue.prefix}" 开头`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `无效字符串:必须以 "${_issue.suffix}" 结尾`;
|
||||
if (_issue.format === "includes")
|
||||
return `无效字符串:必须包含 "${_issue.includes}"`;
|
||||
if (_issue.format === "regex")
|
||||
return `无效字符串:必须满足正则表达式 ${_issue.pattern}`;
|
||||
return `无效${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `无效数字:必须是 ${issue.divisor} 的倍数`;
|
||||
case "unrecognized_keys":
|
||||
return `出现未知的键(key): ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `${issue.origin} 中的键(key)无效`;
|
||||
case "invalid_union":
|
||||
return "无效输入";
|
||||
case "invalid_element":
|
||||
return `${issue.origin} 中包含无效值(value)`;
|
||||
default:
|
||||
return `无效输入`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
144
node_modules/zod/dist/cjs/v4/locales/zh-tw.js
generated
vendored
Normal file
144
node_modules/zod/dist/cjs/v4/locales/zh-tw.js
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.error = exports.parsedType = void 0;
|
||||
exports.default = default_1;
|
||||
const util = __importStar(require("../core/util.js"));
|
||||
const Sizable = {
|
||||
string: { unit: "字元", verb: "擁有" },
|
||||
file: { unit: "位元組", verb: "擁有" },
|
||||
array: { unit: "項目", verb: "擁有" },
|
||||
set: { unit: "項目", verb: "擁有" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const parsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "number": {
|
||||
return Number.isNaN(data) ? "NaN" : "number";
|
||||
}
|
||||
case "object": {
|
||||
if (Array.isArray(data)) {
|
||||
return "array";
|
||||
}
|
||||
if (data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
||||
return data.constructor.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.parsedType = parsedType;
|
||||
const Nouns = {
|
||||
regex: "輸入",
|
||||
email: "郵件地址",
|
||||
url: "URL",
|
||||
emoji: "emoji",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "ISO 日期時間",
|
||||
date: "ISO 日期",
|
||||
time: "ISO 時間",
|
||||
duration: "ISO 期間",
|
||||
ipv4: "IPv4 位址",
|
||||
ipv6: "IPv6 位址",
|
||||
cidrv4: "IPv4 範圍",
|
||||
cidrv6: "IPv6 範圍",
|
||||
base64: "base64 編碼字串",
|
||||
base64url: "base64url 編碼字串",
|
||||
json_string: "JSON 字串",
|
||||
e164: "E.164 數值",
|
||||
jwt: "JWT",
|
||||
template_literal: "輸入",
|
||||
};
|
||||
const error = (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type":
|
||||
return `無效的輸入值:預期為 ${issue.expected},但收到 ${(0, exports.parsedType)(issue.input)}`;
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `無效的輸入值:預期為 ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `無效的選項:預期為以下其中之一 ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `數值過大:預期 ${issue.origin ?? "值"} 應為 ${adj}${issue.maximum.toString()} ${sizing.unit ?? "個元素"}`;
|
||||
return `數值過大:預期 ${issue.origin ?? "值"} 應為 ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `數值過小:預期 ${issue.origin} 應為 ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
||||
}
|
||||
return `數值過小:預期 ${issue.origin} 應為 ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with") {
|
||||
return `無效的字串:必須以 "${_issue.prefix}" 開頭`;
|
||||
}
|
||||
if (_issue.format === "ends_with")
|
||||
return `無效的字串:必須以 "${_issue.suffix}" 結尾`;
|
||||
if (_issue.format === "includes")
|
||||
return `無效的字串:必須包含 "${_issue.includes}"`;
|
||||
if (_issue.format === "regex")
|
||||
return `無效的字串:必須符合格式 ${_issue.pattern}`;
|
||||
return `無效的 ${Nouns[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `無效的數字:必須為 ${issue.divisor} 的倍數`;
|
||||
case "unrecognized_keys":
|
||||
return `無法識別的鍵值${issue.keys.length > 1 ? "們" : ""}:${util.joinValues(issue.keys, "、")}`;
|
||||
case "invalid_key":
|
||||
return `${issue.origin} 中有無效的鍵值`;
|
||||
case "invalid_union":
|
||||
return "無效的輸入值";
|
||||
case "invalid_element":
|
||||
return `${issue.origin} 中有無效的值`;
|
||||
default:
|
||||
return `無效的輸入值`;
|
||||
}
|
||||
};
|
||||
exports.error = error;
|
||||
function default_1() {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
||||
34
node_modules/zod/dist/cjs/v4/mini/checks.js
generated
vendored
Normal file
34
node_modules/zod/dist/cjs/v4/mini/checks.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.toUpperCase = exports.toLowerCase = exports.trim = exports.normalize = exports.overwrite = exports.mime = exports.property = exports.endsWith = exports.startsWith = exports.includes = exports.uppercase = exports.lowercase = exports.regex = exports.length = exports.minLength = exports.maxLength = exports.size = exports.minSize = exports.maxSize = exports.multipleOf = exports.nonnegative = exports.nonpositive = exports.negative = exports.positive = exports.minimum = exports.gte = exports.gt = exports.maximum = exports.lte = exports.lt = void 0;
|
||||
var core_1 = require("zod/v4/core");
|
||||
Object.defineProperty(exports, "lt", { enumerable: true, get: function () { return core_1._lt; } });
|
||||
Object.defineProperty(exports, "lte", { enumerable: true, get: function () { return core_1._lte; } });
|
||||
Object.defineProperty(exports, "maximum", { enumerable: true, get: function () { return core_1._lte; } });
|
||||
Object.defineProperty(exports, "gt", { enumerable: true, get: function () { return core_1._gt; } });
|
||||
Object.defineProperty(exports, "gte", { enumerable: true, get: function () { return core_1._gte; } });
|
||||
Object.defineProperty(exports, "minimum", { enumerable: true, get: function () { return core_1._gte; } });
|
||||
Object.defineProperty(exports, "positive", { enumerable: true, get: function () { return core_1._positive; } });
|
||||
Object.defineProperty(exports, "negative", { enumerable: true, get: function () { return core_1._negative; } });
|
||||
Object.defineProperty(exports, "nonpositive", { enumerable: true, get: function () { return core_1._nonpositive; } });
|
||||
Object.defineProperty(exports, "nonnegative", { enumerable: true, get: function () { return core_1._nonnegative; } });
|
||||
Object.defineProperty(exports, "multipleOf", { enumerable: true, get: function () { return core_1._multipleOf; } });
|
||||
Object.defineProperty(exports, "maxSize", { enumerable: true, get: function () { return core_1._maxSize; } });
|
||||
Object.defineProperty(exports, "minSize", { enumerable: true, get: function () { return core_1._minSize; } });
|
||||
Object.defineProperty(exports, "size", { enumerable: true, get: function () { return core_1._size; } });
|
||||
Object.defineProperty(exports, "maxLength", { enumerable: true, get: function () { return core_1._maxLength; } });
|
||||
Object.defineProperty(exports, "minLength", { enumerable: true, get: function () { return core_1._minLength; } });
|
||||
Object.defineProperty(exports, "length", { enumerable: true, get: function () { return core_1._length; } });
|
||||
Object.defineProperty(exports, "regex", { enumerable: true, get: function () { return core_1._regex; } });
|
||||
Object.defineProperty(exports, "lowercase", { enumerable: true, get: function () { return core_1._lowercase; } });
|
||||
Object.defineProperty(exports, "uppercase", { enumerable: true, get: function () { return core_1._uppercase; } });
|
||||
Object.defineProperty(exports, "includes", { enumerable: true, get: function () { return core_1._includes; } });
|
||||
Object.defineProperty(exports, "startsWith", { enumerable: true, get: function () { return core_1._startsWith; } });
|
||||
Object.defineProperty(exports, "endsWith", { enumerable: true, get: function () { return core_1._endsWith; } });
|
||||
Object.defineProperty(exports, "property", { enumerable: true, get: function () { return core_1._property; } });
|
||||
Object.defineProperty(exports, "mime", { enumerable: true, get: function () { return core_1._mime; } });
|
||||
Object.defineProperty(exports, "overwrite", { enumerable: true, get: function () { return core_1._overwrite; } });
|
||||
Object.defineProperty(exports, "normalize", { enumerable: true, get: function () { return core_1._normalize; } });
|
||||
Object.defineProperty(exports, "trim", { enumerable: true, get: function () { return core_1._trim; } });
|
||||
Object.defineProperty(exports, "toLowerCase", { enumerable: true, get: function () { return core_1._toLowerCase; } });
|
||||
Object.defineProperty(exports, "toUpperCase", { enumerable: true, get: function () { return core_1._toUpperCase; } });
|
||||
47
node_modules/zod/dist/cjs/v4/mini/coerce.js
generated
vendored
Normal file
47
node_modules/zod/dist/cjs/v4/mini/coerce.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.string = string;
|
||||
exports.number = number;
|
||||
exports.boolean = boolean;
|
||||
exports.bigint = bigint;
|
||||
exports.date = date;
|
||||
const core = __importStar(require("zod/v4/core"));
|
||||
const schemas = __importStar(require("./schemas.js"));
|
||||
function string(params) {
|
||||
return core._coercedString(schemas.ZodMiniString, params);
|
||||
}
|
||||
function number(params) {
|
||||
return core._coercedNumber(schemas.ZodMiniNumber, params);
|
||||
}
|
||||
function boolean(params) {
|
||||
return core._coercedBoolean(schemas.ZodMiniBoolean, params);
|
||||
}
|
||||
function bigint(params) {
|
||||
return core._coercedBigint(schemas.ZodMiniBigInt, params);
|
||||
}
|
||||
function date(params) {
|
||||
return core._coercedDate(schemas.ZodMiniDate, params);
|
||||
}
|
||||
51
node_modules/zod/dist/cjs/v4/mini/external.js
generated
vendored
Normal file
51
node_modules/zod/dist/cjs/v4/mini/external.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.locales = exports.toJSONSchema = exports.flattenError = exports.formatError = exports.prettifyError = exports.treeifyError = exports.regexes = exports.clone = exports.function = exports.$brand = exports.$input = exports.$output = exports.config = exports.registry = exports.globalRegistry = exports.core = void 0;
|
||||
exports.core = __importStar(require("zod/v4/core"));
|
||||
__exportStar(require("./parse.js"), exports);
|
||||
__exportStar(require("./schemas.js"), exports);
|
||||
__exportStar(require("./checks.js"), exports);
|
||||
var core_1 = require("zod/v4/core");
|
||||
Object.defineProperty(exports, "globalRegistry", { enumerable: true, get: function () { return core_1.globalRegistry; } });
|
||||
Object.defineProperty(exports, "registry", { enumerable: true, get: function () { return core_1.registry; } });
|
||||
Object.defineProperty(exports, "config", { enumerable: true, get: function () { return core_1.config; } });
|
||||
Object.defineProperty(exports, "$output", { enumerable: true, get: function () { return core_1.$output; } });
|
||||
Object.defineProperty(exports, "$input", { enumerable: true, get: function () { return core_1.$input; } });
|
||||
Object.defineProperty(exports, "$brand", { enumerable: true, get: function () { return core_1.$brand; } });
|
||||
Object.defineProperty(exports, "function", { enumerable: true, get: function () { return core_1.function; } });
|
||||
Object.defineProperty(exports, "clone", { enumerable: true, get: function () { return core_1.clone; } });
|
||||
Object.defineProperty(exports, "regexes", { enumerable: true, get: function () { return core_1.regexes; } });
|
||||
Object.defineProperty(exports, "treeifyError", { enumerable: true, get: function () { return core_1.treeifyError; } });
|
||||
Object.defineProperty(exports, "prettifyError", { enumerable: true, get: function () { return core_1.prettifyError; } });
|
||||
Object.defineProperty(exports, "formatError", { enumerable: true, get: function () { return core_1.formatError; } });
|
||||
Object.defineProperty(exports, "flattenError", { enumerable: true, get: function () { return core_1.flattenError; } });
|
||||
Object.defineProperty(exports, "toJSONSchema", { enumerable: true, get: function () { return core_1.toJSONSchema; } });
|
||||
Object.defineProperty(exports, "locales", { enumerable: true, get: function () { return core_1.locales; } });
|
||||
/** A special constant with type `never` */
|
||||
// export const NEVER = {} as never;
|
||||
32
node_modules/zod/dist/cjs/v4/mini/index.js
generated
vendored
Normal file
32
node_modules/zod/dist/cjs/v4/mini/index.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.z = void 0;
|
||||
const z = __importStar(require("./external.js"));
|
||||
exports.z = z;
|
||||
__exportStar(require("./external.js"), exports);
|
||||
60
node_modules/zod/dist/cjs/v4/mini/iso.js
generated
vendored
Normal file
60
node_modules/zod/dist/cjs/v4/mini/iso.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ZodMiniISODuration = exports.ZodMiniISOTime = exports.ZodMiniISODate = exports.ZodMiniISODateTime = void 0;
|
||||
exports.datetime = datetime;
|
||||
exports.date = date;
|
||||
exports.time = time;
|
||||
exports.duration = duration;
|
||||
const core = __importStar(require("zod/v4/core"));
|
||||
const schemas = __importStar(require("./schemas.js"));
|
||||
exports.ZodMiniISODateTime = core.$constructor("$ZodISODateTime", (inst, def) => {
|
||||
core.$ZodISODateTime.init(inst, def);
|
||||
schemas.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
function datetime(params) {
|
||||
return core._isoDateTime(exports.ZodMiniISODateTime, params);
|
||||
}
|
||||
exports.ZodMiniISODate = core.$constructor("$ZodISODate", (inst, def) => {
|
||||
core.$ZodISODate.init(inst, def);
|
||||
schemas.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
function date(params) {
|
||||
return core._isoDate(exports.ZodMiniISODate, params);
|
||||
}
|
||||
exports.ZodMiniISOTime = core.$constructor("$ZodISOTime", (inst, def) => {
|
||||
core.$ZodISOTime.init(inst, def);
|
||||
schemas.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
function time(params) {
|
||||
return core._isoTime(exports.ZodMiniISOTime, params);
|
||||
}
|
||||
exports.ZodMiniISODuration = core.$constructor("$ZodISODuration", (inst, def) => {
|
||||
core.$ZodISODuration.init(inst, def);
|
||||
schemas.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
function duration(params) {
|
||||
return core._isoDuration(exports.ZodMiniISODuration, params);
|
||||
}
|
||||
8
node_modules/zod/dist/cjs/v4/mini/parse.js
generated
vendored
Normal file
8
node_modules/zod/dist/cjs/v4/mini/parse.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.safeParseAsync = exports.parseAsync = exports.safeParse = exports.parse = void 0;
|
||||
var core_1 = require("zod/v4/core");
|
||||
Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return core_1.parse; } });
|
||||
Object.defineProperty(exports, "safeParse", { enumerable: true, get: function () { return core_1.safeParse; } });
|
||||
Object.defineProperty(exports, "parseAsync", { enumerable: true, get: function () { return core_1.parseAsync; } });
|
||||
Object.defineProperty(exports, "safeParseAsync", { enumerable: true, get: function () { return core_1.safeParseAsync; } });
|
||||
842
node_modules/zod/dist/cjs/v4/mini/schemas.js
generated
vendored
Normal file
842
node_modules/zod/dist/cjs/v4/mini/schemas.js
generated
vendored
Normal file
@@ -0,0 +1,842 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ZodMiniTransform = exports.ZodMiniFile = exports.ZodMiniLiteral = exports.ZodMiniEnum = exports.ZodMiniSet = exports.ZodMiniMap = exports.ZodMiniRecord = exports.ZodMiniTuple = exports.ZodMiniIntersection = exports.ZodMiniDiscriminatedUnion = exports.ZodMiniUnion = exports.ZodMiniObject = exports.ZodMiniArray = exports.ZodMiniDate = exports.ZodMiniVoid = exports.ZodMiniNever = exports.ZodMiniUnknown = exports.ZodMiniAny = exports.ZodMiniNull = exports.ZodMiniUndefined = exports.ZodMiniSymbol = exports.ZodMiniBigIntFormat = exports.ZodMiniBigInt = exports.ZodMiniBoolean = exports.ZodMiniNumberFormat = exports.ZodMiniNumber = exports.ZodMiniJWT = exports.ZodMiniE164 = exports.ZodMiniBase64URL = exports.ZodMiniBase64 = exports.ZodMiniCIDRv6 = exports.ZodMiniCIDRv4 = exports.ZodMiniIPv6 = exports.ZodMiniIPv4 = exports.ZodMiniKSUID = exports.ZodMiniXID = exports.ZodMiniULID = exports.ZodMiniCUID2 = exports.ZodMiniCUID = exports.ZodMiniNanoID = exports.ZodMiniEmoji = exports.ZodMiniURL = exports.ZodMiniUUID = exports.ZodMiniGUID = exports.ZodMiniEmail = exports.ZodMiniStringFormat = exports.ZodMiniString = exports.ZodMiniType = exports.iso = exports.coerce = void 0;
|
||||
exports.stringbool = exports.ZodMiniCustom = exports.ZodMiniPromise = exports.ZodMiniLazy = exports.ZodMiniTemplateLiteral = exports.ZodMiniReadonly = exports.ZodMiniPipe = exports.ZodMiniNaN = exports.ZodMiniCatch = exports.ZodMiniSuccess = exports.ZodMiniNonOptional = exports.ZodMiniPrefault = exports.ZodMiniDefault = exports.ZodMiniNullable = exports.ZodMiniOptional = void 0;
|
||||
exports.string = string;
|
||||
exports.email = email;
|
||||
exports.guid = guid;
|
||||
exports.uuid = uuid;
|
||||
exports.uuidv4 = uuidv4;
|
||||
exports.uuidv6 = uuidv6;
|
||||
exports.uuidv7 = uuidv7;
|
||||
exports.url = url;
|
||||
exports.emoji = emoji;
|
||||
exports.nanoid = nanoid;
|
||||
exports.cuid = cuid;
|
||||
exports.cuid2 = cuid2;
|
||||
exports.ulid = ulid;
|
||||
exports.xid = xid;
|
||||
exports.ksuid = ksuid;
|
||||
exports.ipv4 = ipv4;
|
||||
exports.ipv6 = ipv6;
|
||||
exports.cidrv4 = cidrv4;
|
||||
exports.cidrv6 = cidrv6;
|
||||
exports.base64 = base64;
|
||||
exports.base64url = base64url;
|
||||
exports.e164 = e164;
|
||||
exports.jwt = jwt;
|
||||
exports.number = number;
|
||||
exports.int = int;
|
||||
exports.float32 = float32;
|
||||
exports.float64 = float64;
|
||||
exports.int32 = int32;
|
||||
exports.uint32 = uint32;
|
||||
exports.boolean = boolean;
|
||||
exports.bigint = bigint;
|
||||
exports.int64 = int64;
|
||||
exports.uint64 = uint64;
|
||||
exports.symbol = symbol;
|
||||
exports.undefined = _undefined;
|
||||
exports.null = _null;
|
||||
exports.any = any;
|
||||
exports.unknown = unknown;
|
||||
exports.never = never;
|
||||
exports.void = _void;
|
||||
exports.date = date;
|
||||
exports.array = array;
|
||||
exports.keyof = keyof;
|
||||
exports.object = object;
|
||||
exports.strictObject = strictObject;
|
||||
exports.looseObject = looseObject;
|
||||
exports.extend = extend;
|
||||
exports.merge = merge;
|
||||
exports.pick = pick;
|
||||
exports.omit = omit;
|
||||
exports.partial = partial;
|
||||
exports.required = required;
|
||||
exports.union = union;
|
||||
exports.discriminatedUnion = discriminatedUnion;
|
||||
exports.intersection = intersection;
|
||||
exports.tuple = tuple;
|
||||
exports.record = record;
|
||||
exports.partialRecord = partialRecord;
|
||||
exports.map = map;
|
||||
exports.set = set;
|
||||
exports.enum = _enum;
|
||||
exports.nativeEnum = nativeEnum;
|
||||
exports.literal = literal;
|
||||
exports.file = file;
|
||||
exports.transform = transform;
|
||||
exports.optional = optional;
|
||||
exports.nullable = nullable;
|
||||
exports.nullish = nullish;
|
||||
exports._default = _default;
|
||||
exports.prefault = prefault;
|
||||
exports.nonoptional = nonoptional;
|
||||
exports.success = success;
|
||||
exports.catch = _catch;
|
||||
exports.nan = nan;
|
||||
exports.pipe = pipe;
|
||||
exports.readonly = readonly;
|
||||
exports.templateLiteral = templateLiteral;
|
||||
exports.lazy = _lazy;
|
||||
exports.promise = promise;
|
||||
exports.check = check;
|
||||
exports.refine = refine;
|
||||
exports.custom = custom;
|
||||
exports.instanceof = _instanceof;
|
||||
exports.json = json;
|
||||
const core = __importStar(require("zod/v4/core"));
|
||||
const core_1 = require("zod/v4/core");
|
||||
const parse = __importStar(require("./parse.js"));
|
||||
exports.coerce = __importStar(require("./coerce.js"));
|
||||
exports.iso = __importStar(require("./iso.js"));
|
||||
exports.ZodMiniType = core.$constructor("ZodMiniType", (inst, def) => {
|
||||
if (!inst._zod)
|
||||
throw new Error("Uninitialized schema in mixin ZodMiniType.");
|
||||
core.$ZodType.init(inst, def);
|
||||
inst.def = def;
|
||||
inst.parse = (data, params) => parse.parse(inst, data, params, { callee: inst.parse });
|
||||
inst.safeParse = (data, params) => parse.safeParse(inst, data, params);
|
||||
inst.parseAsync = async (data, params) => parse.parseAsync(inst, data, params, { callee: inst.parseAsync });
|
||||
inst.safeParseAsync = async (data, params) => parse.safeParseAsync(inst, data, params);
|
||||
inst.check = (...checks) => {
|
||||
return inst.clone({
|
||||
...def,
|
||||
checks: [
|
||||
...(def.checks ?? []),
|
||||
...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch),
|
||||
],
|
||||
}
|
||||
// { parent: true }
|
||||
);
|
||||
};
|
||||
inst.clone = (_def, params) => core.clone(inst, _def, params);
|
||||
inst.brand = () => inst;
|
||||
inst.register = ((reg, meta) => {
|
||||
reg.add(inst, meta);
|
||||
return inst;
|
||||
});
|
||||
});
|
||||
exports.ZodMiniString = core.$constructor("ZodMiniString", (inst, def) => {
|
||||
core.$ZodString.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function string(params) {
|
||||
return core._string(exports.ZodMiniString, params);
|
||||
}
|
||||
exports.ZodMiniStringFormat = core.$constructor("ZodMiniStringFormat", (inst, def) => {
|
||||
core.$ZodStringFormat.init(inst, def);
|
||||
exports.ZodMiniString.init(inst, def);
|
||||
});
|
||||
exports.ZodMiniEmail = core.$constructor("ZodMiniEmail", (inst, def) => {
|
||||
core.$ZodEmail.init(inst, def);
|
||||
exports.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
function email(params) {
|
||||
return core._email(exports.ZodMiniEmail, params);
|
||||
}
|
||||
exports.ZodMiniGUID = core.$constructor("ZodMiniGUID", (inst, def) => {
|
||||
core.$ZodGUID.init(inst, def);
|
||||
exports.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
function guid(params) {
|
||||
return core._guid(exports.ZodMiniGUID, params);
|
||||
}
|
||||
exports.ZodMiniUUID = core.$constructor("ZodMiniUUID", (inst, def) => {
|
||||
core.$ZodUUID.init(inst, def);
|
||||
exports.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
function uuid(params) {
|
||||
return core._uuid(exports.ZodMiniUUID, params);
|
||||
}
|
||||
function uuidv4(params) {
|
||||
return core._uuidv4(exports.ZodMiniUUID, params);
|
||||
}
|
||||
// ZodMiniUUIDv6
|
||||
function uuidv6(params) {
|
||||
return core._uuidv6(exports.ZodMiniUUID, params);
|
||||
}
|
||||
// ZodMiniUUIDv7
|
||||
function uuidv7(params) {
|
||||
return core._uuidv7(exports.ZodMiniUUID, params);
|
||||
}
|
||||
exports.ZodMiniURL = core.$constructor("ZodMiniURL", (inst, def) => {
|
||||
core.$ZodURL.init(inst, def);
|
||||
exports.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
function url(params) {
|
||||
return core._url(exports.ZodMiniURL, params);
|
||||
}
|
||||
exports.ZodMiniEmoji = core.$constructor("ZodMiniEmoji", (inst, def) => {
|
||||
core.$ZodEmoji.init(inst, def);
|
||||
exports.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
function emoji(params) {
|
||||
return core._emoji(exports.ZodMiniEmoji, params);
|
||||
}
|
||||
exports.ZodMiniNanoID = core.$constructor("ZodMiniNanoID", (inst, def) => {
|
||||
core.$ZodNanoID.init(inst, def);
|
||||
exports.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
function nanoid(params) {
|
||||
return core._nanoid(exports.ZodMiniNanoID, params);
|
||||
}
|
||||
exports.ZodMiniCUID = core.$constructor("ZodMiniCUID", (inst, def) => {
|
||||
core.$ZodCUID.init(inst, def);
|
||||
exports.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
function cuid(params) {
|
||||
return core._cuid(exports.ZodMiniCUID, params);
|
||||
}
|
||||
exports.ZodMiniCUID2 = core.$constructor("ZodMiniCUID2", (inst, def) => {
|
||||
core.$ZodCUID2.init(inst, def);
|
||||
exports.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
function cuid2(params) {
|
||||
return core._cuid2(exports.ZodMiniCUID2, params);
|
||||
}
|
||||
exports.ZodMiniULID = core.$constructor("ZodMiniULID", (inst, def) => {
|
||||
core.$ZodULID.init(inst, def);
|
||||
exports.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
function ulid(params) {
|
||||
return core._ulid(exports.ZodMiniULID, params);
|
||||
}
|
||||
exports.ZodMiniXID = core.$constructor("ZodMiniXID", (inst, def) => {
|
||||
core.$ZodXID.init(inst, def);
|
||||
exports.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
function xid(params) {
|
||||
return core._xid(exports.ZodMiniXID, params);
|
||||
}
|
||||
exports.ZodMiniKSUID = core.$constructor("ZodMiniKSUID", (inst, def) => {
|
||||
core.$ZodKSUID.init(inst, def);
|
||||
exports.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
function ksuid(params) {
|
||||
return core._ksuid(exports.ZodMiniKSUID, params);
|
||||
}
|
||||
exports.ZodMiniIPv4 = core.$constructor("ZodMiniIPv4", (inst, def) => {
|
||||
core.$ZodIPv4.init(inst, def);
|
||||
exports.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
function ipv4(params) {
|
||||
return core._ipv4(exports.ZodMiniIPv4, params);
|
||||
}
|
||||
exports.ZodMiniIPv6 = core.$constructor("ZodMiniIPv6", (inst, def) => {
|
||||
core.$ZodIPv6.init(inst, def);
|
||||
exports.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
function ipv6(params) {
|
||||
return core._ipv6(exports.ZodMiniIPv6, params);
|
||||
}
|
||||
exports.ZodMiniCIDRv4 = core.$constructor("ZodMiniCIDRv4", (inst, def) => {
|
||||
core.$ZodCIDRv4.init(inst, def);
|
||||
exports.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
function cidrv4(params) {
|
||||
return core._cidrv4(exports.ZodMiniCIDRv4, params);
|
||||
}
|
||||
exports.ZodMiniCIDRv6 = core.$constructor("ZodMiniCIDRv6", (inst, def) => {
|
||||
core.$ZodCIDRv6.init(inst, def);
|
||||
exports.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
function cidrv6(params) {
|
||||
return core._cidrv6(exports.ZodMiniCIDRv6, params);
|
||||
}
|
||||
exports.ZodMiniBase64 = core.$constructor("ZodMiniBase64", (inst, def) => {
|
||||
core.$ZodBase64.init(inst, def);
|
||||
exports.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
function base64(params) {
|
||||
return core._base64(exports.ZodMiniBase64, params);
|
||||
}
|
||||
exports.ZodMiniBase64URL = core.$constructor("ZodMiniBase64URL", (inst, def) => {
|
||||
core.$ZodBase64URL.init(inst, def);
|
||||
exports.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
function base64url(params) {
|
||||
return core._base64url(exports.ZodMiniBase64URL, params);
|
||||
}
|
||||
exports.ZodMiniE164 = core.$constructor("ZodMiniE164", (inst, def) => {
|
||||
core.$ZodE164.init(inst, def);
|
||||
exports.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
function e164(params) {
|
||||
return core._e164(exports.ZodMiniE164, params);
|
||||
}
|
||||
exports.ZodMiniJWT = core.$constructor("ZodMiniJWT", (inst, def) => {
|
||||
core.$ZodJWT.init(inst, def);
|
||||
exports.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
function jwt(params) {
|
||||
return core._jwt(exports.ZodMiniJWT, params);
|
||||
}
|
||||
exports.ZodMiniNumber = core.$constructor("ZodMiniNumber", (inst, def) => {
|
||||
core.$ZodNumber.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function number(params) {
|
||||
return core._number(exports.ZodMiniNumber, params);
|
||||
}
|
||||
exports.ZodMiniNumberFormat = core.$constructor("ZodMiniNumberFormat", (inst, def) => {
|
||||
core.$ZodNumberFormat.init(inst, def);
|
||||
exports.ZodMiniNumber.init(inst, def);
|
||||
});
|
||||
// int
|
||||
function int(params) {
|
||||
return core._int(exports.ZodMiniNumberFormat, params);
|
||||
}
|
||||
// float32
|
||||
function float32(params) {
|
||||
return core._float32(exports.ZodMiniNumberFormat, params);
|
||||
}
|
||||
// float64
|
||||
function float64(params) {
|
||||
return core._float64(exports.ZodMiniNumberFormat, params);
|
||||
}
|
||||
// int32
|
||||
function int32(params) {
|
||||
return core._int32(exports.ZodMiniNumberFormat, params);
|
||||
}
|
||||
// uint32
|
||||
function uint32(params) {
|
||||
return core._uint32(exports.ZodMiniNumberFormat, params);
|
||||
}
|
||||
exports.ZodMiniBoolean = core.$constructor("ZodMiniBoolean", (inst, def) => {
|
||||
core.$ZodBoolean.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function boolean(params) {
|
||||
return core._boolean(exports.ZodMiniBoolean, params);
|
||||
}
|
||||
exports.ZodMiniBigInt = core.$constructor("ZodMiniBigInt", (inst, def) => {
|
||||
core.$ZodBigInt.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function bigint(params) {
|
||||
return core._bigint(exports.ZodMiniBigInt, params);
|
||||
}
|
||||
exports.ZodMiniBigIntFormat = core.$constructor("ZodMiniBigIntFormat", (inst, def) => {
|
||||
core.$ZodBigIntFormat.init(inst, def);
|
||||
exports.ZodMiniBigInt.init(inst, def);
|
||||
});
|
||||
// int64
|
||||
function int64(params) {
|
||||
return core._int64(exports.ZodMiniBigIntFormat, params);
|
||||
}
|
||||
// uint64
|
||||
function uint64(params) {
|
||||
return core._uint64(exports.ZodMiniBigIntFormat, params);
|
||||
}
|
||||
exports.ZodMiniSymbol = core.$constructor("ZodMiniSymbol", (inst, def) => {
|
||||
core.$ZodSymbol.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function symbol(params) {
|
||||
return core._symbol(exports.ZodMiniSymbol, params);
|
||||
}
|
||||
exports.ZodMiniUndefined = core.$constructor("ZodMiniUndefined", (inst, def) => {
|
||||
core.$ZodUndefined.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function _undefined(params) {
|
||||
return core._undefined(exports.ZodMiniUndefined, params);
|
||||
}
|
||||
exports.ZodMiniNull = core.$constructor("ZodMiniNull", (inst, def) => {
|
||||
core.$ZodNull.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function _null(params) {
|
||||
return core._null(exports.ZodMiniNull, params);
|
||||
}
|
||||
exports.ZodMiniAny = core.$constructor("ZodMiniAny", (inst, def) => {
|
||||
core.$ZodAny.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function any() {
|
||||
return core._any(exports.ZodMiniAny);
|
||||
}
|
||||
exports.ZodMiniUnknown = core.$constructor("ZodMiniUnknown", (inst, def) => {
|
||||
core.$ZodUnknown.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function unknown() {
|
||||
return core._unknown(exports.ZodMiniUnknown);
|
||||
}
|
||||
exports.ZodMiniNever = core.$constructor("ZodMiniNever", (inst, def) => {
|
||||
core.$ZodNever.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function never(params) {
|
||||
return core._never(exports.ZodMiniNever, params);
|
||||
}
|
||||
exports.ZodMiniVoid = core.$constructor("ZodMiniVoid", (inst, def) => {
|
||||
core.$ZodVoid.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function _void(params) {
|
||||
return core._void(exports.ZodMiniVoid, params);
|
||||
}
|
||||
exports.ZodMiniDate = core.$constructor("ZodMiniDate", (inst, def) => {
|
||||
core.$ZodDate.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function date(params) {
|
||||
return core._date(exports.ZodMiniDate, params);
|
||||
}
|
||||
exports.ZodMiniArray = core.$constructor("ZodMiniArray", (inst, def) => {
|
||||
core.$ZodArray.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function array(element, params) {
|
||||
return new exports.ZodMiniArray({
|
||||
type: "array",
|
||||
element,
|
||||
// get element() {
|
||||
// return element;
|
||||
// },
|
||||
...core_1.util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
// .keyof
|
||||
function keyof(schema) {
|
||||
const shape = schema._zod.def.shape;
|
||||
return literal(Object.keys(shape));
|
||||
}
|
||||
exports.ZodMiniObject = core.$constructor("ZodMiniObject", (inst, def) => {
|
||||
core.$ZodObject.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function object(shape, params) {
|
||||
const def = {
|
||||
type: "object",
|
||||
get shape() {
|
||||
core_1.util.assignProp(this, "shape", { ...shape });
|
||||
return this.shape;
|
||||
},
|
||||
...core_1.util.normalizeParams(params),
|
||||
};
|
||||
return new exports.ZodMiniObject(def);
|
||||
}
|
||||
// strictObject
|
||||
function strictObject(shape, params) {
|
||||
return new exports.ZodMiniObject({
|
||||
type: "object",
|
||||
// shape: shape as core.$ZodLooseShape,
|
||||
get shape() {
|
||||
core_1.util.assignProp(this, "shape", { ...shape });
|
||||
return this.shape;
|
||||
},
|
||||
// get optional() {
|
||||
// return util.optionalKeys(shape);
|
||||
// },
|
||||
catchall: never(),
|
||||
...core_1.util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
// looseObject
|
||||
function looseObject(shape, params) {
|
||||
return new exports.ZodMiniObject({
|
||||
type: "object",
|
||||
// shape: shape as core.$ZodLooseShape,
|
||||
get shape() {
|
||||
core_1.util.assignProp(this, "shape", { ...shape });
|
||||
return this.shape;
|
||||
},
|
||||
// get optional() {
|
||||
// return util.optionalKeys(shape);
|
||||
// },
|
||||
catchall: unknown(),
|
||||
...core_1.util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
// object methods
|
||||
function extend(schema, shape) {
|
||||
return core_1.util.extend(schema, shape);
|
||||
}
|
||||
function merge(schema, shape) {
|
||||
return core_1.util.extend(schema, shape);
|
||||
}
|
||||
function pick(schema, mask) {
|
||||
return core_1.util.pick(schema, mask);
|
||||
}
|
||||
// .omit
|
||||
function omit(schema, mask) {
|
||||
return core_1.util.omit(schema, mask);
|
||||
}
|
||||
function partial(schema, mask) {
|
||||
return core_1.util.partial(exports.ZodMiniOptional, schema, mask);
|
||||
}
|
||||
function required(schema, mask) {
|
||||
return core_1.util.required(exports.ZodMiniNonOptional, schema, mask);
|
||||
}
|
||||
exports.ZodMiniUnion = core.$constructor("ZodMiniUnion", (inst, def) => {
|
||||
core.$ZodUnion.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function union(options, params) {
|
||||
return new exports.ZodMiniUnion({
|
||||
type: "union",
|
||||
options,
|
||||
...core_1.util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
exports.ZodMiniDiscriminatedUnion = core.$constructor("ZodMiniDiscriminatedUnion", (inst, def) => {
|
||||
core.$ZodDiscriminatedUnion.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function discriminatedUnion(discriminator, options, params) {
|
||||
return new exports.ZodMiniDiscriminatedUnion({
|
||||
type: "union",
|
||||
options,
|
||||
discriminator,
|
||||
...core_1.util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
exports.ZodMiniIntersection = core.$constructor("ZodMiniIntersection", (inst, def) => {
|
||||
core.$ZodIntersection.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function intersection(left, right) {
|
||||
return new exports.ZodMiniIntersection({
|
||||
type: "intersection",
|
||||
left,
|
||||
right,
|
||||
});
|
||||
}
|
||||
exports.ZodMiniTuple = core.$constructor("ZodMiniTuple", (inst, def) => {
|
||||
core.$ZodTuple.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function tuple(items, _paramsOrRest, _params) {
|
||||
const hasRest = _paramsOrRest instanceof core.$ZodType;
|
||||
const params = hasRest ? _params : _paramsOrRest;
|
||||
const rest = hasRest ? _paramsOrRest : null;
|
||||
return new exports.ZodMiniTuple({
|
||||
type: "tuple",
|
||||
items,
|
||||
rest,
|
||||
...core_1.util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
exports.ZodMiniRecord = core.$constructor("ZodMiniRecord", (inst, def) => {
|
||||
core.$ZodRecord.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function record(keyType, valueType, params) {
|
||||
return new exports.ZodMiniRecord({
|
||||
type: "record",
|
||||
keyType,
|
||||
valueType,
|
||||
...core_1.util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
function partialRecord(keyType, valueType, params) {
|
||||
return new exports.ZodMiniRecord({
|
||||
type: "record",
|
||||
keyType: union([keyType, never()]),
|
||||
valueType,
|
||||
...core_1.util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
exports.ZodMiniMap = core.$constructor("ZodMiniMap", (inst, def) => {
|
||||
core.$ZodMap.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function map(keyType, valueType, params) {
|
||||
return new exports.ZodMiniMap({
|
||||
type: "map",
|
||||
keyType,
|
||||
valueType,
|
||||
...core_1.util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
exports.ZodMiniSet = core.$constructor("ZodMiniSet", (inst, def) => {
|
||||
core.$ZodSet.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function set(valueType, params) {
|
||||
return new exports.ZodMiniSet({
|
||||
type: "set",
|
||||
valueType,
|
||||
...core_1.util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
exports.ZodMiniEnum = core.$constructor("ZodMiniEnum", (inst, def) => {
|
||||
core.$ZodEnum.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function _enum(values, params) {
|
||||
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
|
||||
return new exports.ZodMiniEnum({
|
||||
type: "enum",
|
||||
entries,
|
||||
...core_1.util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
/** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
|
||||
*
|
||||
* ```ts
|
||||
* enum Colors { red, green, blue }
|
||||
* z.enum(Colors);
|
||||
* ```
|
||||
*/
|
||||
function nativeEnum(entries, params) {
|
||||
return new exports.ZodMiniEnum({
|
||||
type: "enum",
|
||||
entries,
|
||||
...core_1.util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
exports.ZodMiniLiteral = core.$constructor("ZodMiniLiteral", (inst, def) => {
|
||||
core.$ZodLiteral.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function literal(value, params) {
|
||||
return new exports.ZodMiniLiteral({
|
||||
type: "literal",
|
||||
values: Array.isArray(value) ? value : [value],
|
||||
...core_1.util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
exports.ZodMiniFile = core.$constructor("ZodMiniFile", (inst, def) => {
|
||||
core.$ZodFile.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function file(params) {
|
||||
return core._file(exports.ZodMiniFile, params);
|
||||
}
|
||||
exports.ZodMiniTransform = core.$constructor("ZodMiniTransform", (inst, def) => {
|
||||
core.$ZodTransform.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function transform(fn) {
|
||||
return new exports.ZodMiniTransform({
|
||||
type: "transform",
|
||||
transform: fn,
|
||||
});
|
||||
}
|
||||
exports.ZodMiniOptional = core.$constructor("ZodMiniOptional", (inst, def) => {
|
||||
core.$ZodOptional.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function optional(innerType) {
|
||||
return new exports.ZodMiniOptional({
|
||||
type: "optional",
|
||||
innerType,
|
||||
});
|
||||
}
|
||||
exports.ZodMiniNullable = core.$constructor("ZodMiniNullable", (inst, def) => {
|
||||
core.$ZodNullable.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function nullable(innerType) {
|
||||
return new exports.ZodMiniNullable({
|
||||
type: "nullable",
|
||||
innerType,
|
||||
});
|
||||
}
|
||||
// nullish
|
||||
function nullish(innerType) {
|
||||
return optional(nullable(innerType));
|
||||
}
|
||||
exports.ZodMiniDefault = core.$constructor("ZodMiniDefault", (inst, def) => {
|
||||
core.$ZodDefault.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function _default(innerType, defaultValue) {
|
||||
return new exports.ZodMiniDefault({
|
||||
type: "default",
|
||||
innerType,
|
||||
get defaultValue() {
|
||||
return typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
||||
},
|
||||
});
|
||||
}
|
||||
exports.ZodMiniPrefault = core.$constructor("ZodMiniPrefault", (inst, def) => {
|
||||
core.$ZodPrefault.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function prefault(innerType, defaultValue) {
|
||||
return new exports.ZodMiniPrefault({
|
||||
type: "prefault",
|
||||
innerType,
|
||||
get defaultValue() {
|
||||
return typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
||||
},
|
||||
});
|
||||
}
|
||||
exports.ZodMiniNonOptional = core.$constructor("ZodMiniNonOptional", (inst, def) => {
|
||||
core.$ZodNonOptional.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function nonoptional(innerType, params) {
|
||||
return new exports.ZodMiniNonOptional({
|
||||
type: "nonoptional",
|
||||
innerType,
|
||||
...core_1.util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
exports.ZodMiniSuccess = core.$constructor("ZodMiniSuccess", (inst, def) => {
|
||||
core.$ZodSuccess.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function success(innerType) {
|
||||
return new exports.ZodMiniSuccess({
|
||||
type: "success",
|
||||
innerType,
|
||||
});
|
||||
}
|
||||
exports.ZodMiniCatch = core.$constructor("ZodMiniCatch", (inst, def) => {
|
||||
core.$ZodCatch.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function _catch(innerType, catchValue) {
|
||||
return new exports.ZodMiniCatch({
|
||||
type: "catch",
|
||||
innerType,
|
||||
catchValue: (typeof catchValue === "function" ? catchValue : () => catchValue),
|
||||
});
|
||||
}
|
||||
exports.ZodMiniNaN = core.$constructor("ZodMiniNaN", (inst, def) => {
|
||||
core.$ZodNaN.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function nan(params) {
|
||||
return core._nan(exports.ZodMiniNaN, params);
|
||||
}
|
||||
exports.ZodMiniPipe = core.$constructor("ZodMiniPipe", (inst, def) => {
|
||||
core.$ZodPipe.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function pipe(in_, out) {
|
||||
return new exports.ZodMiniPipe({
|
||||
type: "pipe",
|
||||
in: in_,
|
||||
out,
|
||||
});
|
||||
}
|
||||
exports.ZodMiniReadonly = core.$constructor("ZodMiniReadonly", (inst, def) => {
|
||||
core.$ZodReadonly.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function readonly(innerType) {
|
||||
return new exports.ZodMiniReadonly({
|
||||
type: "readonly",
|
||||
innerType,
|
||||
});
|
||||
}
|
||||
exports.ZodMiniTemplateLiteral = core.$constructor("ZodMiniTemplateLiteral", (inst, def) => {
|
||||
core.$ZodTemplateLiteral.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function templateLiteral(parts, params) {
|
||||
return new exports.ZodMiniTemplateLiteral({
|
||||
type: "template_literal",
|
||||
parts,
|
||||
...core_1.util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
exports.ZodMiniLazy = core.$constructor("ZodMiniLazy", (inst, def) => {
|
||||
core.$ZodLazy.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
// export function lazy<T extends object>(getter: () => T): T {
|
||||
// return util.createTransparentProxy<T>(getter);
|
||||
// }
|
||||
function _lazy(getter) {
|
||||
return new exports.ZodMiniLazy({
|
||||
type: "lazy",
|
||||
getter,
|
||||
});
|
||||
}
|
||||
exports.ZodMiniPromise = core.$constructor("ZodMiniPromise", (inst, def) => {
|
||||
core.$ZodPromise.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
function promise(innerType) {
|
||||
return new exports.ZodMiniPromise({
|
||||
type: "promise",
|
||||
innerType,
|
||||
});
|
||||
}
|
||||
exports.ZodMiniCustom = core.$constructor("ZodMiniCustom", (inst, def) => {
|
||||
core.$ZodCustom.init(inst, def);
|
||||
exports.ZodMiniType.init(inst, def);
|
||||
});
|
||||
// custom checks
|
||||
function check(fn, params) {
|
||||
const ch = new core.$ZodCheck({
|
||||
check: "custom",
|
||||
...core_1.util.normalizeParams(params),
|
||||
});
|
||||
ch._zod.check = fn;
|
||||
return ch;
|
||||
}
|
||||
// ZodCustom
|
||||
function _custom(fn, _params, Class) {
|
||||
const params = core_1.util.normalizeParams(_params);
|
||||
const schema = new Class({
|
||||
type: "custom",
|
||||
check: "custom",
|
||||
fn: fn,
|
||||
...params,
|
||||
});
|
||||
return schema;
|
||||
}
|
||||
// refine
|
||||
function refine(fn, _params = {}) {
|
||||
return _custom(fn, _params, exports.ZodMiniCustom);
|
||||
}
|
||||
// custom schema
|
||||
function custom(fn, _params) {
|
||||
return _custom(fn ?? (() => true), _params, exports.ZodMiniCustom);
|
||||
}
|
||||
// instanceof
|
||||
class Class {
|
||||
constructor(..._args) { }
|
||||
}
|
||||
function _instanceof(cls, params = {
|
||||
error: `Input not instance of ${cls.name}`,
|
||||
}) {
|
||||
const inst = custom((data) => data instanceof cls, params);
|
||||
inst._zod.bag.Class = cls;
|
||||
return inst;
|
||||
}
|
||||
// stringbool
|
||||
exports.stringbool = core._stringbool.bind(null, {
|
||||
Pipe: exports.ZodMiniPipe,
|
||||
Boolean: exports.ZodMiniBoolean,
|
||||
Unknown: exports.ZodMiniUnknown,
|
||||
});
|
||||
function json() {
|
||||
const jsonSchema = _lazy(() => {
|
||||
return union([string(), number(), boolean(), _null(), array(jsonSchema), record(string(), jsonSchema)]);
|
||||
});
|
||||
return jsonSchema;
|
||||
}
|
||||
3
node_modules/zod/dist/esm/index.js
generated
vendored
Normal file
3
node_modules/zod/dist/esm/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import z3 from "./v3/index.js";
|
||||
export * from "./v3/index.js";
|
||||
export default z3;
|
||||
3
node_modules/zod/dist/esm/package.json
generated
vendored
Normal file
3
node_modules/zod/dist/esm/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
||||
132
node_modules/zod/dist/esm/v3/ZodError.js
generated
vendored
Normal file
132
node_modules/zod/dist/esm/v3/ZodError.js
generated
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
import { util } from "./helpers/util.js";
|
||||
export const ZodIssueCode = util.arrayToEnum([
|
||||
"invalid_type",
|
||||
"invalid_literal",
|
||||
"custom",
|
||||
"invalid_union",
|
||||
"invalid_union_discriminator",
|
||||
"invalid_enum_value",
|
||||
"unrecognized_keys",
|
||||
"invalid_arguments",
|
||||
"invalid_return_type",
|
||||
"invalid_date",
|
||||
"invalid_string",
|
||||
"too_small",
|
||||
"too_big",
|
||||
"invalid_intersection_types",
|
||||
"not_multiple_of",
|
||||
"not_finite",
|
||||
]);
|
||||
export const quotelessJson = (obj) => {
|
||||
const json = JSON.stringify(obj, null, 2);
|
||||
return json.replace(/"([^"]+)":/g, "$1:");
|
||||
};
|
||||
export class ZodError extends Error {
|
||||
get errors() {
|
||||
return this.issues;
|
||||
}
|
||||
constructor(issues) {
|
||||
super();
|
||||
this.issues = [];
|
||||
this.addIssue = (sub) => {
|
||||
this.issues = [...this.issues, sub];
|
||||
};
|
||||
this.addIssues = (subs = []) => {
|
||||
this.issues = [...this.issues, ...subs];
|
||||
};
|
||||
const actualProto = new.target.prototype;
|
||||
if (Object.setPrototypeOf) {
|
||||
// eslint-disable-next-line ban/ban
|
||||
Object.setPrototypeOf(this, actualProto);
|
||||
}
|
||||
else {
|
||||
this.__proto__ = actualProto;
|
||||
}
|
||||
this.name = "ZodError";
|
||||
this.issues = issues;
|
||||
}
|
||||
format(_mapper) {
|
||||
const mapper = _mapper ||
|
||||
function (issue) {
|
||||
return issue.message;
|
||||
};
|
||||
const fieldErrors = { _errors: [] };
|
||||
const processError = (error) => {
|
||||
for (const issue of error.issues) {
|
||||
if (issue.code === "invalid_union") {
|
||||
issue.unionErrors.map(processError);
|
||||
}
|
||||
else if (issue.code === "invalid_return_type") {
|
||||
processError(issue.returnTypeError);
|
||||
}
|
||||
else if (issue.code === "invalid_arguments") {
|
||||
processError(issue.argumentsError);
|
||||
}
|
||||
else if (issue.path.length === 0) {
|
||||
fieldErrors._errors.push(mapper(issue));
|
||||
}
|
||||
else {
|
||||
let curr = fieldErrors;
|
||||
let i = 0;
|
||||
while (i < issue.path.length) {
|
||||
const el = issue.path[i];
|
||||
const terminal = i === issue.path.length - 1;
|
||||
if (!terminal) {
|
||||
curr[el] = curr[el] || { _errors: [] };
|
||||
// if (typeof el === "string") {
|
||||
// curr[el] = curr[el] || { _errors: [] };
|
||||
// } else if (typeof el === "number") {
|
||||
// const errorArray: any = [];
|
||||
// errorArray._errors = [];
|
||||
// curr[el] = curr[el] || errorArray;
|
||||
// }
|
||||
}
|
||||
else {
|
||||
curr[el] = curr[el] || { _errors: [] };
|
||||
curr[el]._errors.push(mapper(issue));
|
||||
}
|
||||
curr = curr[el];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
processError(this);
|
||||
return fieldErrors;
|
||||
}
|
||||
static assert(value) {
|
||||
if (!(value instanceof ZodError)) {
|
||||
throw new Error(`Not a ZodError: ${value}`);
|
||||
}
|
||||
}
|
||||
toString() {
|
||||
return this.message;
|
||||
}
|
||||
get message() {
|
||||
return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
|
||||
}
|
||||
get isEmpty() {
|
||||
return this.issues.length === 0;
|
||||
}
|
||||
flatten(mapper = (issue) => issue.message) {
|
||||
const fieldErrors = {};
|
||||
const formErrors = [];
|
||||
for (const sub of this.issues) {
|
||||
if (sub.path.length > 0) {
|
||||
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
||||
fieldErrors[sub.path[0]].push(mapper(sub));
|
||||
}
|
||||
else {
|
||||
formErrors.push(mapper(sub));
|
||||
}
|
||||
}
|
||||
return { formErrors, fieldErrors };
|
||||
}
|
||||
get formErrors() {
|
||||
return this.flatten();
|
||||
}
|
||||
}
|
||||
ZodError.create = (issues) => {
|
||||
const error = new ZodError(issues);
|
||||
return error;
|
||||
};
|
||||
49
node_modules/zod/dist/esm/v3/benchmarks/datetime.js
generated
vendored
Normal file
49
node_modules/zod/dist/esm/v3/benchmarks/datetime.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
import Benchmark from "benchmark";
|
||||
const datetimeValidationSuite = new Benchmark.Suite("datetime");
|
||||
const DATA = "2021-01-01";
|
||||
const MONTHS_31 = new Set([1, 3, 5, 7, 8, 10, 12]);
|
||||
const MONTHS_30 = new Set([4, 6, 9, 11]);
|
||||
const simpleDatetimeRegex = /^(\d{4})-(\d{2})-(\d{2})$/;
|
||||
const datetimeRegexNoLeapYearValidation = /^\d{4}-((0[13578]|10|12)-31|(0[13-9]|1[0-2])-30|(0[1-9]|1[0-2])-(0[1-9]|1\d|2\d))$/;
|
||||
const datetimeRegexWithLeapYearValidation = /^((\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\d|3[01])|(0[469]|11)-(0[1-9]|[12]\d|30)|(02)-(0[1-9]|1\d|2[0-8])))$/;
|
||||
datetimeValidationSuite
|
||||
.add("new Date()", () => {
|
||||
return !Number.isNaN(new Date(DATA).getTime());
|
||||
})
|
||||
.add("regex (no validation)", () => {
|
||||
return simpleDatetimeRegex.test(DATA);
|
||||
})
|
||||
.add("regex (no leap year)", () => {
|
||||
return datetimeRegexNoLeapYearValidation.test(DATA);
|
||||
})
|
||||
.add("regex (w/ leap year)", () => {
|
||||
return datetimeRegexWithLeapYearValidation.test(DATA);
|
||||
})
|
||||
.add("capture groups + code", () => {
|
||||
const match = DATA.match(simpleDatetimeRegex);
|
||||
if (!match)
|
||||
return false;
|
||||
// Extract year, month, and day from the capture groups
|
||||
const year = Number.parseInt(match[1], 10);
|
||||
const month = Number.parseInt(match[2], 10); // month is 0-indexed in JavaScript Date, so subtract 1
|
||||
const day = Number.parseInt(match[3], 10);
|
||||
if (month === 2) {
|
||||
if ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0) {
|
||||
return day <= 29;
|
||||
}
|
||||
return day <= 28;
|
||||
}
|
||||
if (MONTHS_30.has(month)) {
|
||||
return day <= 30;
|
||||
}
|
||||
if (MONTHS_31.has(month)) {
|
||||
return day <= 31;
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.on("cycle", (e) => {
|
||||
console.log(`${datetimeValidationSuite.name}: ${e.target}`);
|
||||
});
|
||||
export default {
|
||||
suites: [datetimeValidationSuite],
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user