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:
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],
|
||||
};
|
74
node_modules/zod/dist/esm/v3/benchmarks/discriminatedUnion.js
generated
vendored
Normal file
74
node_modules/zod/dist/esm/v3/benchmarks/discriminatedUnion.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
import Benchmark from "benchmark";
|
||||
import { z } from "zod/v3";
|
||||
const doubleSuite = new Benchmark.Suite("z.discriminatedUnion: double");
|
||||
const manySuite = new Benchmark.Suite("z.discriminatedUnion: many");
|
||||
const aSchema = z.object({
|
||||
type: z.literal("a"),
|
||||
});
|
||||
const objA = {
|
||||
type: "a",
|
||||
};
|
||||
const bSchema = z.object({
|
||||
type: z.literal("b"),
|
||||
});
|
||||
const objB = {
|
||||
type: "b",
|
||||
};
|
||||
const cSchema = z.object({
|
||||
type: z.literal("c"),
|
||||
});
|
||||
const objC = {
|
||||
type: "c",
|
||||
};
|
||||
const dSchema = z.object({
|
||||
type: z.literal("d"),
|
||||
});
|
||||
const double = z.discriminatedUnion("type", [aSchema, bSchema]);
|
||||
const many = 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}`);
|
||||
});
|
||||
export default {
|
||||
suites: [doubleSuite, manySuite],
|
||||
};
|
54
node_modules/zod/dist/esm/v3/benchmarks/index.js
generated
vendored
Normal file
54
node_modules/zod/dist/esm/v3/benchmarks/index.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
import datetimeBenchmarks from "./datetime.js";
|
||||
import discriminatedUnionBenchmarks from "./discriminatedUnion.js";
|
||||
import ipv4Benchmarks from "./ipv4.js";
|
||||
import objectBenchmarks from "./object.js";
|
||||
import primitiveBenchmarks from "./primitives.js";
|
||||
import realworld from "./realworld.js";
|
||||
import stringBenchmarks from "./string.js";
|
||||
import unionBenchmarks from "./union.js";
|
||||
const argv = process.argv.slice(2);
|
||||
let suites = [];
|
||||
if (!argv.length) {
|
||||
suites = [
|
||||
...realworld.suites,
|
||||
...primitiveBenchmarks.suites,
|
||||
...stringBenchmarks.suites,
|
||||
...objectBenchmarks.suites,
|
||||
...unionBenchmarks.suites,
|
||||
...discriminatedUnionBenchmarks.suites,
|
||||
];
|
||||
}
|
||||
else {
|
||||
if (argv.includes("--realworld")) {
|
||||
suites.push(...realworld.suites);
|
||||
}
|
||||
if (argv.includes("--primitives")) {
|
||||
suites.push(...primitiveBenchmarks.suites);
|
||||
}
|
||||
if (argv.includes("--string")) {
|
||||
suites.push(...stringBenchmarks.suites);
|
||||
}
|
||||
if (argv.includes("--object")) {
|
||||
suites.push(...objectBenchmarks.suites);
|
||||
}
|
||||
if (argv.includes("--union")) {
|
||||
suites.push(...unionBenchmarks.suites);
|
||||
}
|
||||
if (argv.includes("--discriminatedUnion")) {
|
||||
suites.push(...datetimeBenchmarks.suites);
|
||||
}
|
||||
if (argv.includes("--datetime")) {
|
||||
suites.push(...datetimeBenchmarks.suites);
|
||||
}
|
||||
if (argv.includes("--ipv4")) {
|
||||
suites.push(...ipv4Benchmarks.suites);
|
||||
}
|
||||
}
|
||||
for (const suite of suites) {
|
||||
suite.run({});
|
||||
}
|
||||
// exit on Ctrl-C
|
||||
process.on("SIGINT", function () {
|
||||
console.log("Exiting...");
|
||||
process.exit();
|
||||
});
|
49
node_modules/zod/dist/esm/v3/benchmarks/ipv4.js
generated
vendored
Normal file
49
node_modules/zod/dist/esm/v3/benchmarks/ipv4.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
import Benchmark from "benchmark";
|
||||
const suite = new Benchmark.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}`);
|
||||
});
|
||||
export default {
|
||||
suites: [suite],
|
||||
};
|
||||
if (require.main === module) {
|
||||
suite.run();
|
||||
}
|
65
node_modules/zod/dist/esm/v3/benchmarks/object.js
generated
vendored
Normal file
65
node_modules/zod/dist/esm/v3/benchmarks/object.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
import Benchmark from "benchmark";
|
||||
import { z } from "zod/v3";
|
||||
const emptySuite = new Benchmark.Suite("z.object: empty");
|
||||
const shortSuite = new Benchmark.Suite("z.object: short");
|
||||
const longSuite = new Benchmark.Suite("z.object: long");
|
||||
const empty = z.object({});
|
||||
const short = z.object({
|
||||
string: z.string(),
|
||||
});
|
||||
const long = z.object({
|
||||
string: z.string(),
|
||||
number: z.number(),
|
||||
boolean: 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}`);
|
||||
});
|
||||
export default {
|
||||
suites: [emptySuite, shortSuite, longSuite],
|
||||
};
|
154
node_modules/zod/dist/esm/v3/benchmarks/primitives.js
generated
vendored
Normal file
154
node_modules/zod/dist/esm/v3/benchmarks/primitives.js
generated
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
import Benchmark from "benchmark";
|
||||
import { z } from "zod/v3";
|
||||
import { Mocker } from "../tests/Mocker.js";
|
||||
const val = new Mocker();
|
||||
const enumSuite = new Benchmark.Suite("z.enum");
|
||||
const enumSchema = 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.Suite("long z.enum");
|
||||
const longEnumSchema = 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.Suite("z.undefined");
|
||||
const undefinedSchema = 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.Suite("z.literal");
|
||||
const short = "short";
|
||||
const bad = "bad";
|
||||
const literalSchema = 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.Suite("z.number");
|
||||
const numberSchema = 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.Suite("z.date");
|
||||
const plainDate = z.date();
|
||||
const minMaxDate = 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.Suite("z.symbol");
|
||||
const symbolSchema = 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}`);
|
||||
});
|
||||
export default {
|
||||
suites: [enumSuite, longEnumSuite, undefinedSuite, literalSuite, numberSuite, dateSuite, symbolSuite],
|
||||
};
|
51
node_modules/zod/dist/esm/v3/benchmarks/realworld.js
generated
vendored
Normal file
51
node_modules/zod/dist/esm/v3/benchmarks/realworld.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
import Benchmark from "benchmark";
|
||||
import { z } from "zod/v3";
|
||||
const shortSuite = new Benchmark.Suite("realworld");
|
||||
const People = z.array(z.object({
|
||||
type: z.literal("person"),
|
||||
hair: z.enum(["blue", "brown"]),
|
||||
active: z.boolean(),
|
||||
name: z.string(),
|
||||
age: z.number().int(),
|
||||
hobbies: z.array(z.string()),
|
||||
address: z.object({
|
||||
street: z.string(),
|
||||
zip: z.string(),
|
||||
country: 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}`);
|
||||
});
|
||||
export default {
|
||||
suites: [shortSuite],
|
||||
};
|
50
node_modules/zod/dist/esm/v3/benchmarks/string.js
generated
vendored
Normal file
50
node_modules/zod/dist/esm/v3/benchmarks/string.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
import Benchmark from "benchmark";
|
||||
import { z } from "zod/v3";
|
||||
const SUITE_NAME = "z.string";
|
||||
const suite = new Benchmark.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 = z.string();
|
||||
const optionalStringSchema = z.string().optional();
|
||||
const optionalNullableStringSchema = 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}`);
|
||||
});
|
||||
export default {
|
||||
suites: [suite],
|
||||
};
|
74
node_modules/zod/dist/esm/v3/benchmarks/union.js
generated
vendored
Normal file
74
node_modules/zod/dist/esm/v3/benchmarks/union.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
import Benchmark from "benchmark";
|
||||
import { z } from "zod/v3";
|
||||
const doubleSuite = new Benchmark.Suite("z.union: double");
|
||||
const manySuite = new Benchmark.Suite("z.union: many");
|
||||
const aSchema = z.object({
|
||||
type: z.literal("a"),
|
||||
});
|
||||
const objA = {
|
||||
type: "a",
|
||||
};
|
||||
const bSchema = z.object({
|
||||
type: z.literal("b"),
|
||||
});
|
||||
const objB = {
|
||||
type: "b",
|
||||
};
|
||||
const cSchema = z.object({
|
||||
type: z.literal("c"),
|
||||
});
|
||||
const objC = {
|
||||
type: "c",
|
||||
};
|
||||
const dSchema = z.object({
|
||||
type: z.literal("d"),
|
||||
});
|
||||
const double = z.union([aSchema, bSchema]);
|
||||
const many = 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}`);
|
||||
});
|
||||
export default {
|
||||
suites: [doubleSuite, manySuite],
|
||||
};
|
9
node_modules/zod/dist/esm/v3/errors.js
generated
vendored
Normal file
9
node_modules/zod/dist/esm/v3/errors.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import defaultErrorMap from "./locales/en.js";
|
||||
let overrideErrorMap = defaultErrorMap;
|
||||
export { defaultErrorMap };
|
||||
export function setErrorMap(map) {
|
||||
overrideErrorMap = map;
|
||||
}
|
||||
export function getErrorMap() {
|
||||
return overrideErrorMap;
|
||||
}
|
6
node_modules/zod/dist/esm/v3/external.js
generated
vendored
Normal file
6
node_modules/zod/dist/esm/v3/external.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export * from "./errors.js";
|
||||
export * from "./helpers/parseUtil.js";
|
||||
export * from "./helpers/typeAliases.js";
|
||||
export * from "./helpers/util.js";
|
||||
export * from "./types.js";
|
||||
export * from "./ZodError.js";
|
1
node_modules/zod/dist/esm/v3/helpers/enumUtil.js
generated
vendored
Normal file
1
node_modules/zod/dist/esm/v3/helpers/enumUtil.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
6
node_modules/zod/dist/esm/v3/helpers/errorUtil.js
generated
vendored
Normal file
6
node_modules/zod/dist/esm/v3/helpers/errorUtil.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export 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 || (errorUtil = {}));
|
109
node_modules/zod/dist/esm/v3/helpers/parseUtil.js
generated
vendored
Normal file
109
node_modules/zod/dist/esm/v3/helpers/parseUtil.js
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
import { getErrorMap } from "../errors.js";
|
||||
import defaultErrorMap from "../locales/en.js";
|
||||
export 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,
|
||||
};
|
||||
};
|
||||
export const EMPTY_PATH = [];
|
||||
export function addIssueToContext(ctx, issueData) {
|
||||
const overrideMap = getErrorMap();
|
||||
const issue = 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 === defaultErrorMap ? undefined : defaultErrorMap, // then global default map
|
||||
].filter((x) => !!x),
|
||||
});
|
||||
ctx.common.issues.push(issue);
|
||||
}
|
||||
export 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 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 INVALID;
|
||||
if (value.status === "aborted")
|
||||
return 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 };
|
||||
}
|
||||
}
|
||||
export const INVALID = Object.freeze({
|
||||
status: "aborted",
|
||||
});
|
||||
export const DIRTY = (value) => ({ status: "dirty", value });
|
||||
export const OK = (value) => ({ status: "valid", value });
|
||||
export const isAborted = (x) => x.status === "aborted";
|
||||
export const isDirty = (x) => x.status === "dirty";
|
||||
export const isValid = (x) => x.status === "valid";
|
||||
export const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
1
node_modules/zod/dist/esm/v3/helpers/partialUtil.js
generated
vendored
Normal file
1
node_modules/zod/dist/esm/v3/helpers/partialUtil.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
1
node_modules/zod/dist/esm/v3/helpers/typeAliases.js
generated
vendored
Normal file
1
node_modules/zod/dist/esm/v3/helpers/typeAliases.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
133
node_modules/zod/dist/esm/v3/helpers/util.js
generated
vendored
Normal file
133
node_modules/zod/dist/esm/v3/helpers/util.js
generated
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
export 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 || (util = {}));
|
||||
export var objectUtil;
|
||||
(function (objectUtil) {
|
||||
objectUtil.mergeShapes = (first, second) => {
|
||||
return {
|
||||
...first,
|
||||
...second, // second overwrites first
|
||||
};
|
||||
};
|
||||
})(objectUtil || (objectUtil = {}));
|
||||
export const ZodParsedType = util.arrayToEnum([
|
||||
"string",
|
||||
"nan",
|
||||
"number",
|
||||
"integer",
|
||||
"float",
|
||||
"boolean",
|
||||
"date",
|
||||
"bigint",
|
||||
"symbol",
|
||||
"function",
|
||||
"undefined",
|
||||
"null",
|
||||
"array",
|
||||
"object",
|
||||
"unknown",
|
||||
"promise",
|
||||
"void",
|
||||
"never",
|
||||
"map",
|
||||
"set",
|
||||
]);
|
||||
export const getParsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "undefined":
|
||||
return ZodParsedType.undefined;
|
||||
case "string":
|
||||
return ZodParsedType.string;
|
||||
case "number":
|
||||
return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
||||
case "boolean":
|
||||
return ZodParsedType.boolean;
|
||||
case "function":
|
||||
return ZodParsedType.function;
|
||||
case "bigint":
|
||||
return ZodParsedType.bigint;
|
||||
case "symbol":
|
||||
return ZodParsedType.symbol;
|
||||
case "object":
|
||||
if (Array.isArray(data)) {
|
||||
return ZodParsedType.array;
|
||||
}
|
||||
if (data === null) {
|
||||
return ZodParsedType.null;
|
||||
}
|
||||
if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
|
||||
return ZodParsedType.promise;
|
||||
}
|
||||
if (typeof Map !== "undefined" && data instanceof Map) {
|
||||
return ZodParsedType.map;
|
||||
}
|
||||
if (typeof Set !== "undefined" && data instanceof Set) {
|
||||
return ZodParsedType.set;
|
||||
}
|
||||
if (typeof Date !== "undefined" && data instanceof Date) {
|
||||
return ZodParsedType.date;
|
||||
}
|
||||
return ZodParsedType.object;
|
||||
default:
|
||||
return ZodParsedType.unknown;
|
||||
}
|
||||
};
|
4
node_modules/zod/dist/esm/v3/index.js
generated
vendored
Normal file
4
node_modules/zod/dist/esm/v3/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import * as z from "./external.js";
|
||||
export * from "./external.js";
|
||||
export { z };
|
||||
export default z;
|
107
node_modules/zod/dist/esm/v3/locales/en.js
generated
vendored
Normal file
107
node_modules/zod/dist/esm/v3/locales/en.js
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
import { ZodIssueCode } from "../ZodError.js";
|
||||
import { util, ZodParsedType } from "../helpers/util.js";
|
||||
const errorMap = (issue, _ctx) => {
|
||||
let message;
|
||||
switch (issue.code) {
|
||||
case ZodIssueCode.invalid_type:
|
||||
if (issue.received === ZodParsedType.undefined) {
|
||||
message = "Required";
|
||||
}
|
||||
else {
|
||||
message = `Expected ${issue.expected}, received ${issue.received}`;
|
||||
}
|
||||
break;
|
||||
case ZodIssueCode.invalid_literal:
|
||||
message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
|
||||
break;
|
||||
case ZodIssueCode.unrecognized_keys:
|
||||
message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
|
||||
break;
|
||||
case ZodIssueCode.invalid_union:
|
||||
message = `Invalid input`;
|
||||
break;
|
||||
case ZodIssueCode.invalid_union_discriminator:
|
||||
message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
|
||||
break;
|
||||
case ZodIssueCode.invalid_enum_value:
|
||||
message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
|
||||
break;
|
||||
case ZodIssueCode.invalid_arguments:
|
||||
message = `Invalid function arguments`;
|
||||
break;
|
||||
case ZodIssueCode.invalid_return_type:
|
||||
message = `Invalid function return type`;
|
||||
break;
|
||||
case ZodIssueCode.invalid_date:
|
||||
message = `Invalid date`;
|
||||
break;
|
||||
case 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.assertNever(issue.validation);
|
||||
}
|
||||
}
|
||||
else if (issue.validation !== "regex") {
|
||||
message = `Invalid ${issue.validation}`;
|
||||
}
|
||||
else {
|
||||
message = "Invalid";
|
||||
}
|
||||
break;
|
||||
case 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 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 ZodIssueCode.custom:
|
||||
message = `Invalid input`;
|
||||
break;
|
||||
case ZodIssueCode.invalid_intersection_types:
|
||||
message = `Intersection results could not be merged`;
|
||||
break;
|
||||
case ZodIssueCode.not_multiple_of:
|
||||
message = `Number must be a multiple of ${issue.multipleOf}`;
|
||||
break;
|
||||
case ZodIssueCode.not_finite:
|
||||
message = "Number must be finite";
|
||||
break;
|
||||
default:
|
||||
message = _ctx.defaultError;
|
||||
util.assertNever(issue);
|
||||
}
|
||||
return { message };
|
||||
};
|
||||
export default errorMap;
|
1
node_modules/zod/dist/esm/v3/standard-schema.js
generated
vendored
Normal file
1
node_modules/zod/dist/esm/v3/standard-schema.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
53
node_modules/zod/dist/esm/v3/tests/Mocker.js
generated
vendored
Normal file
53
node_modules/zod/dist/esm/v3/tests/Mocker.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
function getRandomInt(max) {
|
||||
return Math.floor(Math.random() * Math.floor(max));
|
||||
}
|
||||
const testSymbol = Symbol("test");
|
||||
export 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);
|
||||
}
|
||||
}
|
3713
node_modules/zod/dist/esm/v3/types.js
generated
vendored
Normal file
3713
node_modules/zod/dist/esm/v3/types.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/zod/dist/esm/v4/classic/checks.js
generated
vendored
Normal file
1
node_modules/zod/dist/esm/v4/classic/checks.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { _lt as lt, _lte as lte, _gt as gt, _gte as gte, _positive as positive, _negative as negative, _nonpositive as nonpositive, _nonnegative as nonnegative, _multipleOf as multipleOf, _maxSize as maxSize, _minSize as minSize, _size as size, _maxLength as maxLength, _minLength as minLength, _length as length, _regex as regex, _lowercase as lowercase, _uppercase as uppercase, _includes as includes, _startsWith as startsWith, _endsWith as endsWith, _property as property, _mime as mime, _overwrite as overwrite, _normalize as normalize, _trim as trim, _toLowerCase as toLowerCase, _toUpperCase as toUpperCase, } from "zod/v4/core";
|
17
node_modules/zod/dist/esm/v4/classic/coerce.js
generated
vendored
Normal file
17
node_modules/zod/dist/esm/v4/classic/coerce.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import * as core from "zod/v4/core";
|
||||
import * as schemas from "./schemas.js";
|
||||
export function string(params) {
|
||||
return core._coercedString(schemas.ZodString, params);
|
||||
}
|
||||
export function number(params) {
|
||||
return core._coercedNumber(schemas.ZodNumber, params);
|
||||
}
|
||||
export function boolean(params) {
|
||||
return core._coercedBoolean(schemas.ZodBoolean, params);
|
||||
}
|
||||
export function bigint(params) {
|
||||
return core._coercedBigint(schemas.ZodBigInt, params);
|
||||
}
|
||||
export function date(params) {
|
||||
return core._coercedDate(schemas.ZodDate, params);
|
||||
}
|
33
node_modules/zod/dist/esm/v4/classic/compat.js
generated
vendored
Normal file
33
node_modules/zod/dist/esm/v4/classic/compat.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
// Zod 3 compat layer
|
||||
import * as core from "zod/v4/core";
|
||||
/** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
|
||||
export const 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` */
|
||||
export const NEVER = INVALID;
|
||||
export { $brand, config } from "zod/v4/core";
|
||||
/** @deprecated Use `z.config(params)` instead. */
|
||||
export function setErrorMap(map) {
|
||||
core.config({
|
||||
customError: map,
|
||||
});
|
||||
}
|
||||
/** @deprecated Use `z.config()` instead. */
|
||||
export function getErrorMap() {
|
||||
return core.config().customError;
|
||||
}
|
41
node_modules/zod/dist/esm/v4/classic/errors.js
generated
vendored
Normal file
41
node_modules/zod/dist/esm/v4/classic/errors.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
import * as core from "zod/v4/core";
|
||||
import { $ZodError } from "zod/v4/core";
|
||||
const initializer = (inst, issues) => {
|
||||
$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;
|
||||
// },
|
||||
// });
|
||||
};
|
||||
export const ZodError = core.$constructor("ZodError", initializer);
|
||||
export const ZodRealError = core.$constructor("ZodError", initializer, {
|
||||
Parent: Error,
|
||||
});
|
||||
// /** @deprecated Use `z.core.$ZodErrorMapCtx` instead. */
|
||||
// export type ErrorMapCtx = core.$ZodErrorMapCtx;
|
11
node_modules/zod/dist/esm/v4/classic/external.js
generated
vendored
Normal file
11
node_modules/zod/dist/esm/v4/classic/external.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
export * as core from "zod/v4/core";
|
||||
export * from "./schemas.js";
|
||||
export * from "./checks.js";
|
||||
export * from "./errors.js";
|
||||
export * from "./parse.js";
|
||||
export * from "./compat.js";
|
||||
// zod-specified
|
||||
import { config } from "zod/v4/core";
|
||||
import en from "zod/v4/locales/en.js";
|
||||
config(en());
|
||||
export { globalRegistry, registry, config, function, $output, $input, $brand, clone, regexes, treeifyError, prettifyError, formatError, flattenError, toJSONSchema, locales, } from "zod/v4/core";
|
4
node_modules/zod/dist/esm/v4/classic/index.js
generated
vendored
Normal file
4
node_modules/zod/dist/esm/v4/classic/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import * as z from "./external.js";
|
||||
export { z };
|
||||
export * from "./external.js";
|
||||
export default z;
|
30
node_modules/zod/dist/esm/v4/classic/iso.js
generated
vendored
Normal file
30
node_modules/zod/dist/esm/v4/classic/iso.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import * as core from "zod/v4/core";
|
||||
import * as schemas from "./schemas.js";
|
||||
export const ZodISODateTime = /*@__PURE__*/ core.$constructor("ZodISODateTime", (inst, def) => {
|
||||
core.$ZodISODateTime.init(inst, def);
|
||||
schemas.ZodStringFormat.init(inst, def);
|
||||
});
|
||||
export function datetime(params) {
|
||||
return core._isoDateTime(ZodISODateTime, params);
|
||||
}
|
||||
export const ZodISODate = /*@__PURE__*/ core.$constructor("ZodISODate", (inst, def) => {
|
||||
core.$ZodISODate.init(inst, def);
|
||||
schemas.ZodStringFormat.init(inst, def);
|
||||
});
|
||||
export function date(params) {
|
||||
return core._isoDate(ZodISODate, params);
|
||||
}
|
||||
export const ZodISOTime = /*@__PURE__*/ core.$constructor("ZodISOTime", (inst, def) => {
|
||||
core.$ZodISOTime.init(inst, def);
|
||||
schemas.ZodStringFormat.init(inst, def);
|
||||
});
|
||||
export function time(params) {
|
||||
return core._isoTime(ZodISOTime, params);
|
||||
}
|
||||
export const ZodISODuration = /*@__PURE__*/ core.$constructor("ZodISODuration", (inst, def) => {
|
||||
core.$ZodISODuration.init(inst, def);
|
||||
schemas.ZodStringFormat.init(inst, def);
|
||||
});
|
||||
export function duration(params) {
|
||||
return core._isoDuration(ZodISODuration, params);
|
||||
}
|
6
node_modules/zod/dist/esm/v4/classic/parse.js
generated
vendored
Normal file
6
node_modules/zod/dist/esm/v4/classic/parse.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import * as core from "zod/v4/core";
|
||||
import { ZodRealError } from "./errors.js";
|
||||
export const parse = /* @__PURE__ */ core._parse(ZodRealError);
|
||||
export const parseAsync = /* @__PURE__ */ core._parseAsync(ZodRealError);
|
||||
export const safeParse = /* @__PURE__ */ core._safeParse(ZodRealError);
|
||||
export const safeParseAsync = /* @__PURE__ */ core._safeParseAsync(ZodRealError);
|
1012
node_modules/zod/dist/esm/v4/classic/schemas.js
generated
vendored
Normal file
1012
node_modules/zod/dist/esm/v4/classic/schemas.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
867
node_modules/zod/dist/esm/v4/core/api.js
generated
vendored
Normal file
867
node_modules/zod/dist/esm/v4/core/api.js
generated
vendored
Normal file
@@ -0,0 +1,867 @@
|
||||
import * as checks from "./checks.js";
|
||||
import * as schemas from "./schemas.js";
|
||||
import * as util from "./util.js";
|
||||
export function _string(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _coercedString(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
coerce: true,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _email(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "email",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _guid(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "guid",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _uuid(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "uuid",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _uuidv4(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "uuid",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
version: "v4",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _uuidv6(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "uuid",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
version: "v6",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _uuidv7(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "uuid",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
version: "v7",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _url(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "url",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _emoji(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "emoji",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _nanoid(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "nanoid",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _cuid(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "cuid",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _cuid2(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "cuid2",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _ulid(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "ulid",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _xid(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "xid",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _ksuid(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "ksuid",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _ipv4(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "ipv4",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _ipv6(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "ipv6",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _cidrv4(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "cidrv4",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _cidrv6(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "cidrv6",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _base64(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "base64",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _base64url(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "base64url",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _e164(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "e164",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _jwt(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "jwt",
|
||||
check: "string_format",
|
||||
abort: false,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _isoDateTime(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "datetime",
|
||||
check: "string_format",
|
||||
offset: false,
|
||||
local: false,
|
||||
precision: null,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _isoDate(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "date",
|
||||
check: "string_format",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _isoTime(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "time",
|
||||
check: "string_format",
|
||||
precision: null,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _isoDuration(Class, params) {
|
||||
return new Class({
|
||||
type: "string",
|
||||
format: "duration",
|
||||
check: "string_format",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _number(Class, params) {
|
||||
return new Class({
|
||||
type: "number",
|
||||
checks: [],
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _coercedNumber(Class, params) {
|
||||
return new Class({
|
||||
type: "number",
|
||||
coerce: true,
|
||||
checks: [],
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _int(Class, params) {
|
||||
return new Class({
|
||||
type: "number",
|
||||
check: "number_format",
|
||||
abort: false,
|
||||
format: "safeint",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _float32(Class, params) {
|
||||
return new Class({
|
||||
type: "number",
|
||||
check: "number_format",
|
||||
abort: false,
|
||||
format: "float32",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _float64(Class, params) {
|
||||
return new Class({
|
||||
type: "number",
|
||||
check: "number_format",
|
||||
abort: false,
|
||||
format: "float64",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _int32(Class, params) {
|
||||
return new Class({
|
||||
type: "number",
|
||||
check: "number_format",
|
||||
abort: false,
|
||||
format: "int32",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _uint32(Class, params) {
|
||||
return new Class({
|
||||
type: "number",
|
||||
check: "number_format",
|
||||
abort: false,
|
||||
format: "uint32",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _boolean(Class, params) {
|
||||
return new Class({
|
||||
type: "boolean",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _coercedBoolean(Class, params) {
|
||||
return new Class({
|
||||
type: "boolean",
|
||||
coerce: true,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _bigint(Class, params) {
|
||||
return new Class({
|
||||
type: "bigint",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _coercedBigint(Class, params) {
|
||||
return new Class({
|
||||
type: "bigint",
|
||||
coerce: true,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _int64(Class, params) {
|
||||
return new Class({
|
||||
type: "bigint",
|
||||
check: "bigint_format",
|
||||
abort: false,
|
||||
format: "int64",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _uint64(Class, params) {
|
||||
return new Class({
|
||||
type: "bigint",
|
||||
check: "bigint_format",
|
||||
abort: false,
|
||||
format: "uint64",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _symbol(Class, params) {
|
||||
return new Class({
|
||||
type: "symbol",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _undefined(Class, params) {
|
||||
return new Class({
|
||||
type: "undefined",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _null(Class, params) {
|
||||
return new Class({
|
||||
type: "null",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _any(Class) {
|
||||
return new Class({
|
||||
type: "any",
|
||||
});
|
||||
}
|
||||
export function _unknown(Class) {
|
||||
return new Class({
|
||||
type: "unknown",
|
||||
});
|
||||
}
|
||||
export function _never(Class, params) {
|
||||
return new Class({
|
||||
type: "never",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _void(Class, params) {
|
||||
return new Class({
|
||||
type: "void",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _date(Class, params) {
|
||||
return new Class({
|
||||
type: "date",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _coercedDate(Class, params) {
|
||||
return new Class({
|
||||
type: "date",
|
||||
coerce: true,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _nan(Class, params) {
|
||||
return new Class({
|
||||
type: "nan",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _lt(value, params) {
|
||||
return new checks.$ZodCheckLessThan({
|
||||
check: "less_than",
|
||||
...util.normalizeParams(params),
|
||||
value,
|
||||
inclusive: false,
|
||||
});
|
||||
}
|
||||
export function _lte(value, params) {
|
||||
return new checks.$ZodCheckLessThan({
|
||||
check: "less_than",
|
||||
...util.normalizeParams(params),
|
||||
value,
|
||||
inclusive: true,
|
||||
});
|
||||
}
|
||||
export {
|
||||
/** @deprecated Use `z.lte()` instead. */
|
||||
_lte as _max, };
|
||||
export function _gt(value, params) {
|
||||
return new checks.$ZodCheckGreaterThan({
|
||||
check: "greater_than",
|
||||
...util.normalizeParams(params),
|
||||
value,
|
||||
inclusive: false,
|
||||
});
|
||||
}
|
||||
export function _gte(value, params) {
|
||||
return new checks.$ZodCheckGreaterThan({
|
||||
check: "greater_than",
|
||||
...util.normalizeParams(params),
|
||||
value,
|
||||
inclusive: true,
|
||||
});
|
||||
}
|
||||
export {
|
||||
/** @deprecated Use `z.gte()` instead. */
|
||||
_gte as _min, };
|
||||
export function _positive(params) {
|
||||
return _gt(0, params);
|
||||
}
|
||||
// negative
|
||||
export function _negative(params) {
|
||||
return _lt(0, params);
|
||||
}
|
||||
// nonpositive
|
||||
export function _nonpositive(params) {
|
||||
return _lte(0, params);
|
||||
}
|
||||
// nonnegative
|
||||
export function _nonnegative(params) {
|
||||
return _gte(0, params);
|
||||
}
|
||||
export function _multipleOf(value, params) {
|
||||
return new checks.$ZodCheckMultipleOf({
|
||||
check: "multiple_of",
|
||||
...util.normalizeParams(params),
|
||||
value,
|
||||
});
|
||||
}
|
||||
export function _maxSize(maximum, params) {
|
||||
return new checks.$ZodCheckMaxSize({
|
||||
check: "max_size",
|
||||
...util.normalizeParams(params),
|
||||
maximum,
|
||||
});
|
||||
}
|
||||
export function _minSize(minimum, params) {
|
||||
return new checks.$ZodCheckMinSize({
|
||||
check: "min_size",
|
||||
...util.normalizeParams(params),
|
||||
minimum,
|
||||
});
|
||||
}
|
||||
export function _size(size, params) {
|
||||
return new checks.$ZodCheckSizeEquals({
|
||||
check: "size_equals",
|
||||
...util.normalizeParams(params),
|
||||
size,
|
||||
});
|
||||
}
|
||||
export function _maxLength(maximum, params) {
|
||||
const ch = new checks.$ZodCheckMaxLength({
|
||||
check: "max_length",
|
||||
...util.normalizeParams(params),
|
||||
maximum,
|
||||
});
|
||||
return ch;
|
||||
}
|
||||
export function _minLength(minimum, params) {
|
||||
return new checks.$ZodCheckMinLength({
|
||||
check: "min_length",
|
||||
...util.normalizeParams(params),
|
||||
minimum,
|
||||
});
|
||||
}
|
||||
export function _length(length, params) {
|
||||
return new checks.$ZodCheckLengthEquals({
|
||||
check: "length_equals",
|
||||
...util.normalizeParams(params),
|
||||
length,
|
||||
});
|
||||
}
|
||||
export function _regex(pattern, params) {
|
||||
return new checks.$ZodCheckRegex({
|
||||
check: "string_format",
|
||||
format: "regex",
|
||||
...util.normalizeParams(params),
|
||||
pattern,
|
||||
});
|
||||
}
|
||||
export function _lowercase(params) {
|
||||
return new checks.$ZodCheckLowerCase({
|
||||
check: "string_format",
|
||||
format: "lowercase",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _uppercase(params) {
|
||||
return new checks.$ZodCheckUpperCase({
|
||||
check: "string_format",
|
||||
format: "uppercase",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _includes(includes, params) {
|
||||
return new checks.$ZodCheckIncludes({
|
||||
check: "string_format",
|
||||
format: "includes",
|
||||
...util.normalizeParams(params),
|
||||
includes,
|
||||
});
|
||||
}
|
||||
export function _startsWith(prefix, params) {
|
||||
return new checks.$ZodCheckStartsWith({
|
||||
check: "string_format",
|
||||
format: "starts_with",
|
||||
...util.normalizeParams(params),
|
||||
prefix,
|
||||
});
|
||||
}
|
||||
export function _endsWith(suffix, params) {
|
||||
return new checks.$ZodCheckEndsWith({
|
||||
check: "string_format",
|
||||
format: "ends_with",
|
||||
...util.normalizeParams(params),
|
||||
suffix,
|
||||
});
|
||||
}
|
||||
export function _property(property, schema, params) {
|
||||
return new checks.$ZodCheckProperty({
|
||||
check: "property",
|
||||
property,
|
||||
schema,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _mime(types, params) {
|
||||
return new checks.$ZodCheckMimeType({
|
||||
check: "mime_type",
|
||||
mime: types,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _overwrite(tx) {
|
||||
return new checks.$ZodCheckOverwrite({
|
||||
check: "overwrite",
|
||||
tx,
|
||||
});
|
||||
}
|
||||
// normalize
|
||||
export function _normalize(form) {
|
||||
return _overwrite((input) => input.normalize(form));
|
||||
}
|
||||
// trim
|
||||
export function _trim() {
|
||||
return _overwrite((input) => input.trim());
|
||||
}
|
||||
// toLowerCase
|
||||
export function _toLowerCase() {
|
||||
return _overwrite((input) => input.toLowerCase());
|
||||
}
|
||||
// toUpperCase
|
||||
export function _toUpperCase() {
|
||||
return _overwrite((input) => input.toUpperCase());
|
||||
}
|
||||
export function _array(Class, element, params) {
|
||||
return new Class({
|
||||
type: "array",
|
||||
element,
|
||||
// get element() {
|
||||
// return element;
|
||||
// },
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _union(Class, options, params) {
|
||||
return new Class({
|
||||
type: "union",
|
||||
options,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _discriminatedUnion(Class, discriminator, options, params) {
|
||||
return new Class({
|
||||
type: "union",
|
||||
options,
|
||||
discriminator,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export 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>;
|
||||
export 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),
|
||||
});
|
||||
}
|
||||
export function _record(Class, keyType, valueType, params) {
|
||||
return new Class({
|
||||
type: "record",
|
||||
keyType,
|
||||
valueType,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _map(Class, keyType, valueType, params) {
|
||||
return new Class({
|
||||
type: "map",
|
||||
keyType,
|
||||
valueType,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _set(Class, valueType, params) {
|
||||
return new Class({
|
||||
type: "set",
|
||||
valueType,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export 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);
|
||||
* ```
|
||||
*/
|
||||
export function _nativeEnum(Class, entries, params) {
|
||||
return new Class({
|
||||
type: "enum",
|
||||
entries,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _literal(Class, value, params) {
|
||||
return new Class({
|
||||
type: "literal",
|
||||
values: Array.isArray(value) ? value : [value],
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _file(Class, params) {
|
||||
return new Class({
|
||||
type: "file",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _transform(Class, fn) {
|
||||
return new Class({
|
||||
type: "transform",
|
||||
transform: fn,
|
||||
});
|
||||
}
|
||||
export function _optional(Class, innerType) {
|
||||
return new Class({
|
||||
type: "optional",
|
||||
innerType,
|
||||
});
|
||||
}
|
||||
export function _nullable(Class, innerType) {
|
||||
return new Class({
|
||||
type: "nullable",
|
||||
innerType,
|
||||
});
|
||||
}
|
||||
export function _default(Class, innerType, defaultValue) {
|
||||
return new Class({
|
||||
type: "default",
|
||||
innerType,
|
||||
get defaultValue() {
|
||||
return typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
||||
},
|
||||
});
|
||||
}
|
||||
export function _nonoptional(Class, innerType, params) {
|
||||
return new Class({
|
||||
type: "nonoptional",
|
||||
innerType,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _success(Class, innerType) {
|
||||
return new Class({
|
||||
type: "success",
|
||||
innerType,
|
||||
});
|
||||
}
|
||||
export function _catch(Class, innerType, catchValue) {
|
||||
return new Class({
|
||||
type: "catch",
|
||||
innerType,
|
||||
catchValue: (typeof catchValue === "function" ? catchValue : () => catchValue),
|
||||
});
|
||||
}
|
||||
export function _pipe(Class, in_, out) {
|
||||
return new Class({
|
||||
type: "pipe",
|
||||
in: in_,
|
||||
out,
|
||||
});
|
||||
}
|
||||
export function _readonly(Class, innerType) {
|
||||
return new Class({
|
||||
type: "readonly",
|
||||
innerType,
|
||||
});
|
||||
}
|
||||
export function _templateLiteral(Class, parts, params) {
|
||||
return new Class({
|
||||
type: "template_literal",
|
||||
parts,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function _lazy(Class, getter) {
|
||||
return new Class({
|
||||
type: "lazy",
|
||||
getter,
|
||||
});
|
||||
}
|
||||
export function _promise(Class, innerType) {
|
||||
return new Class({
|
||||
type: "promise",
|
||||
innerType,
|
||||
});
|
||||
}
|
||||
export function _custom(Class, fn, _params) {
|
||||
const schema = new Class({
|
||||
type: "custom",
|
||||
check: "custom",
|
||||
fn: fn,
|
||||
...util.normalizeParams(_params),
|
||||
});
|
||||
return schema;
|
||||
}
|
||||
export function _refine(Class, fn, _params = {}) {
|
||||
return _custom(Class, fn, _params);
|
||||
}
|
||||
export 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",
|
||||
}),
|
||||
});
|
||||
}
|
535
node_modules/zod/dist/esm/v4/core/checks.js
generated
vendored
Normal file
535
node_modules/zod/dist/esm/v4/core/checks.js
generated
vendored
Normal file
@@ -0,0 +1,535 @@
|
||||
// import { $ZodType } from "./schemas.js";
|
||||
import * as core from "./core.js";
|
||||
import * as regexes from "./regexes.js";
|
||||
import * as util from "./util.js";
|
||||
export const $ZodCheck = /*@__PURE__*/ 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",
|
||||
};
|
||||
export const $ZodCheckLessThan = /*@__PURE__*/ core.$constructor("$ZodCheckLessThan", (inst, def) => {
|
||||
$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,
|
||||
});
|
||||
};
|
||||
});
|
||||
export const $ZodCheckGreaterThan = /*@__PURE__*/ core.$constructor("$ZodCheckGreaterThan", (inst, def) => {
|
||||
$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,
|
||||
});
|
||||
};
|
||||
});
|
||||
export const $ZodCheckMultipleOf =
|
||||
/*@__PURE__*/ core.$constructor("$ZodCheckMultipleOf", (inst, def) => {
|
||||
$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,
|
||||
});
|
||||
};
|
||||
});
|
||||
export const $ZodCheckNumberFormat = /*@__PURE__*/ core.$constructor("$ZodCheckNumberFormat", (inst, def) => {
|
||||
$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,
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
export const $ZodCheckBigIntFormat = /*@__PURE__*/ core.$constructor("$ZodCheckBigIntFormat", (inst, def) => {
|
||||
$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,
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
export const $ZodCheckMaxSize = /*@__PURE__*/ core.$constructor("$ZodCheckMaxSize", (inst, def) => {
|
||||
$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,
|
||||
});
|
||||
};
|
||||
});
|
||||
export const $ZodCheckMinSize = /*@__PURE__*/ core.$constructor("$ZodCheckMinSize", (inst, def) => {
|
||||
$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,
|
||||
});
|
||||
};
|
||||
});
|
||||
export const $ZodCheckSizeEquals = /*@__PURE__*/ core.$constructor("$ZodCheckSizeEquals", (inst, def) => {
|
||||
$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,
|
||||
});
|
||||
};
|
||||
});
|
||||
export const $ZodCheckMaxLength = /*@__PURE__*/ core.$constructor("$ZodCheckMaxLength", (inst, def) => {
|
||||
$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,
|
||||
});
|
||||
};
|
||||
});
|
||||
export const $ZodCheckMinLength = /*@__PURE__*/ core.$constructor("$ZodCheckMinLength", (inst, def) => {
|
||||
$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,
|
||||
});
|
||||
};
|
||||
});
|
||||
export const $ZodCheckLengthEquals = /*@__PURE__*/ core.$constructor("$ZodCheckLengthEquals", (inst, def) => {
|
||||
$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,
|
||||
});
|
||||
};
|
||||
});
|
||||
export const $ZodCheckStringFormat = /*@__PURE__*/ core.$constructor("$ZodCheckStringFormat", (inst, def) => {
|
||||
var _a;
|
||||
$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,
|
||||
});
|
||||
});
|
||||
});
|
||||
export const $ZodCheckRegex = /*@__PURE__*/ core.$constructor("$ZodCheckRegex", (inst, def) => {
|
||||
$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,
|
||||
});
|
||||
};
|
||||
});
|
||||
export const $ZodCheckLowerCase = /*@__PURE__*/ core.$constructor("$ZodCheckLowerCase", (inst, def) => {
|
||||
def.pattern ?? (def.pattern = regexes.lowercase);
|
||||
$ZodCheckStringFormat.init(inst, def);
|
||||
});
|
||||
export const $ZodCheckUpperCase = /*@__PURE__*/ core.$constructor("$ZodCheckUpperCase", (inst, def) => {
|
||||
def.pattern ?? (def.pattern = regexes.uppercase);
|
||||
$ZodCheckStringFormat.init(inst, def);
|
||||
});
|
||||
export const $ZodCheckIncludes = /*@__PURE__*/ core.$constructor("$ZodCheckIncludes", (inst, def) => {
|
||||
$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,
|
||||
});
|
||||
};
|
||||
});
|
||||
export const $ZodCheckStartsWith = /*@__PURE__*/ core.$constructor("$ZodCheckStartsWith", (inst, def) => {
|
||||
$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,
|
||||
});
|
||||
};
|
||||
});
|
||||
export const $ZodCheckEndsWith = /*@__PURE__*/ core.$constructor("$ZodCheckEndsWith", (inst, def) => {
|
||||
$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));
|
||||
}
|
||||
}
|
||||
export const $ZodCheckProperty = /*@__PURE__*/ core.$constructor("$ZodCheckProperty", (inst, def) => {
|
||||
$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;
|
||||
};
|
||||
});
|
||||
export const $ZodCheckMimeType = /*@__PURE__*/ core.$constructor("$ZodCheckMimeType", (inst, def) => {
|
||||
$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,
|
||||
});
|
||||
};
|
||||
});
|
||||
export const $ZodCheckOverwrite = /*@__PURE__*/ core.$constructor("$ZodCheckOverwrite", (inst, def) => {
|
||||
$ZodCheck.init(inst, def);
|
||||
inst._zod.check = (payload) => {
|
||||
payload.value = def.tx(payload.value);
|
||||
};
|
||||
});
|
6
node_modules/zod/dist/esm/v4/core/config.js
generated
vendored
Normal file
6
node_modules/zod/dist/esm/v4/core/config.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export const globalConfig = {};
|
||||
export function config(config) {
|
||||
if (config)
|
||||
Object.assign(globalConfig, config);
|
||||
return globalConfig;
|
||||
}
|
53
node_modules/zod/dist/esm/v4/core/core.js
generated
vendored
Normal file
53
node_modules/zod/dist/esm/v4/core/core.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
export /*@__NO_SIDE_EFFECTS__*/ 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 ///////////////////////////////////////
|
||||
export const $brand = Symbol("zod_brand");
|
||||
export class $ZodAsyncError extends Error {
|
||||
constructor() {
|
||||
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
||||
}
|
||||
}
|
||||
export const globalConfig = {};
|
||||
export function config(newConfig) {
|
||||
if (newConfig)
|
||||
Object.assign(globalConfig, newConfig);
|
||||
return globalConfig;
|
||||
}
|
36
node_modules/zod/dist/esm/v4/core/doc.js
generated
vendored
Normal file
36
node_modules/zod/dist/esm/v4/core/doc.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
export 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"));
|
||||
}
|
||||
}
|
206
node_modules/zod/dist/esm/v4/core/errors.js
generated
vendored
Normal file
206
node_modules/zod/dist/esm/v4/core/errors.js
generated
vendored
Normal file
@@ -0,0 +1,206 @@
|
||||
import { $constructor } from "./core.js";
|
||||
import * as util from "./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,
|
||||
// });
|
||||
};
|
||||
export const $ZodError = $constructor("$ZodError", initializer);
|
||||
export const $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error });
|
||||
export 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 };
|
||||
}
|
||||
export 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;
|
||||
}
|
||||
export 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
|
||||
* ```
|
||||
*/
|
||||
export 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("");
|
||||
}
|
||||
export 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");
|
||||
}
|
70
node_modules/zod/dist/esm/v4/core/function.js
generated
vendored
Normal file
70
node_modules/zod/dist/esm/v4/core/function.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
import { _tuple } from "./api.js";
|
||||
import { parse, parseAsync } from "./parse.js";
|
||||
import * as schemas from "./schemas.js";
|
||||
import { $ZodTuple } from "./schemas.js";
|
||||
export 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 ? 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 ? 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 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 ? 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 $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,
|
||||
});
|
||||
}
|
||||
}
|
||||
function _function(params) {
|
||||
return new $ZodFunction({
|
||||
type: "function",
|
||||
input: Array.isArray(params?.input) ? _tuple(schemas.$ZodTuple, params?.input) : (params?.input ?? null),
|
||||
output: params?.output ?? null,
|
||||
});
|
||||
}
|
||||
export { _function as function };
|
15
node_modules/zod/dist/esm/v4/core/index.js
generated
vendored
Normal file
15
node_modules/zod/dist/esm/v4/core/index.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
export * from "./core.js";
|
||||
export * from "./parse.js";
|
||||
export * from "./errors.js";
|
||||
export * from "./schemas.js";
|
||||
export * from "./checks.js";
|
||||
export * from "./versions.js";
|
||||
export * as util from "./util.js";
|
||||
export * as regexes from "./regexes.js";
|
||||
export * as locales from "../locales/index.js";
|
||||
export * from "./registries.js";
|
||||
export * from "./doc.js";
|
||||
export * from "./function.js";
|
||||
export * from "./api.js";
|
||||
export * from "./to-json-schema.js";
|
||||
export * as JSONSchema from "./json-schema.js";
|
1
node_modules/zod/dist/esm/v4/core/json-schema.js
generated
vendored
Normal file
1
node_modules/zod/dist/esm/v4/core/json-schema.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
57
node_modules/zod/dist/esm/v4/core/parse.js
generated
vendored
Normal file
57
node_modules/zod/dist/esm/v4/core/parse.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
import * as core from "./core.js";
|
||||
import * as errors from "./errors.js";
|
||||
import * as util from "./util.js";
|
||||
export 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;
|
||||
};
|
||||
export const parse = /* @__PURE__*/ _parse(errors.$ZodRealError);
|
||||
export 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;
|
||||
};
|
||||
export const parseAsync = /* @__PURE__*/ _parseAsync(errors.$ZodRealError);
|
||||
export 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 };
|
||||
};
|
||||
export const safeParse = /* @__PURE__*/ _safeParse(errors.$ZodRealError);
|
||||
export 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 };
|
||||
};
|
||||
export const safeParseAsync = /* @__PURE__*/ _safeParseAsync(errors.$ZodRealError);
|
93
node_modules/zod/dist/esm/v4/core/regexes.js
generated
vendored
Normal file
93
node_modules/zod/dist/esm/v4/core/regexes.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
export const cuid = /^[cC][^\s-]{8,}$/;
|
||||
export const cuid2 = /^[0-9a-z]+$/;
|
||||
export const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
||||
export const xid = /^[0-9a-vA-V]{20}$/;
|
||||
export const ksuid = /^[A-Za-z0-9]{27}$/;
|
||||
export const 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. */
|
||||
export const 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. */
|
||||
export const 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 */
|
||||
export const 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. */
|
||||
export 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})$`);
|
||||
};
|
||||
export const uuid4 = uuid(4);
|
||||
export const uuid6 = uuid(6);
|
||||
export const uuid7 = uuid(7);
|
||||
/** Practical email validation */
|
||||
export const 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 */
|
||||
export const 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 */
|
||||
export const 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. */
|
||||
export const unicodeEmail = /^[^\s@"]{1,64}@[^\s@]{1,255}$/u;
|
||||
export const 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
|
||||
export const _emoji = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
||||
export function emoji() {
|
||||
return new RegExp(_emoji, "u");
|
||||
}
|
||||
export const 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])$/;
|
||||
export const 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})$/;
|
||||
export const 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])$/;
|
||||
export const 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])$/;
|
||||
export const ip = new RegExp(`(${ipv4.source})|(${ipv6.source})`);
|
||||
// https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript
|
||||
export const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
||||
export const 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])$/;
|
||||
export const hostname = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;
|
||||
// https://blog.stevenlevithan.com/archives/validate-phone-number#r4-3 (regex sans spaces)
|
||||
export const 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])))`;
|
||||
export const 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;
|
||||
}
|
||||
export function time(args) {
|
||||
return new RegExp(`^${timeSource(args)}$`);
|
||||
}
|
||||
// Adapted from https://stackoverflow.com/a/3143231
|
||||
export 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}$`);
|
||||
}
|
||||
export const string = (params) => {
|
||||
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
||||
return new RegExp(`^${regex}$`);
|
||||
};
|
||||
export const bigint = /^\d+n?$/;
|
||||
export const integer = /^\d+$/;
|
||||
export const number = /^-?\d+(?:\.\d+)?/i;
|
||||
export const boolean = /true|false/i;
|
||||
const _null = /null/i;
|
||||
export { _null as null };
|
||||
const _undefined = /undefined/i;
|
||||
export { _undefined as undefined };
|
||||
// regex for string with no uppercase letters
|
||||
export const lowercase = /^[^A-Z]*$/;
|
||||
// regex for string with no lowercase letters
|
||||
export const uppercase = /^[^a-z]*$/;
|
42
node_modules/zod/dist/esm/v4/core/registries.js
generated
vendored
Normal file
42
node_modules/zod/dist/esm/v4/core/registries.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
export const $output = Symbol("ZodOutput");
|
||||
export const $input = Symbol("ZodInput");
|
||||
export 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);
|
||||
}
|
||||
}
|
||||
// registries
|
||||
export function registry() {
|
||||
return new $ZodRegistry();
|
||||
}
|
||||
export const globalRegistry = /*@__PURE__*/ registry();
|
1740
node_modules/zod/dist/esm/v4/core/schemas.js
generated
vendored
Normal file
1740
node_modules/zod/dist/esm/v4/core/schemas.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/zod/dist/esm/v4/core/standard-schema.js
generated
vendored
Normal file
1
node_modules/zod/dist/esm/v4/core/standard-schema.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
664
node_modules/zod/dist/esm/v4/core/to-json-schema.js
generated
vendored
Normal file
664
node_modules/zod/dist/esm/v4/core/to-json-schema.js
generated
vendored
Normal file
@@ -0,0 +1,664 @@
|
||||
import { $ZodRegistry, globalRegistry } from "./registries.js";
|
||||
const formatMap = {
|
||||
guid: "uuid",
|
||||
url: "uri",
|
||||
datetime: "date-time",
|
||||
json_string: "json-string",
|
||||
};
|
||||
export class JSONSchemaGenerator {
|
||||
constructor(params) {
|
||||
this.counter = 0;
|
||||
this.metadataRegistry = params?.metadata ?? 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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
export function toJSONSchema(input, _params) {
|
||||
if (input instanceof $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);
|
||||
}
|
469
node_modules/zod/dist/esm/v4/core/util.js
generated
vendored
Normal file
469
node_modules/zod/dist/esm/v4/core/util.js
generated
vendored
Normal file
@@ -0,0 +1,469 @@
|
||||
// functions
|
||||
export function assertEqual(val) {
|
||||
return val;
|
||||
}
|
||||
export function assertNotEqual(val) {
|
||||
return val;
|
||||
}
|
||||
export function assertIs(_arg) { }
|
||||
export function assertNever(_x) {
|
||||
throw new Error();
|
||||
}
|
||||
export function assert(_) { }
|
||||
export 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);
|
||||
}
|
||||
export function joinValues(array, separator = "|") {
|
||||
return array.map((val) => stringifyPrimitive(val)).join(separator);
|
||||
}
|
||||
export function jsonStringifyReplacer(_, value) {
|
||||
if (typeof value === "bigint")
|
||||
return value.toString();
|
||||
return value;
|
||||
}
|
||||
export 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");
|
||||
},
|
||||
};
|
||||
}
|
||||
export function nullish(input) {
|
||||
return input === null || input === undefined;
|
||||
}
|
||||
export function cleanRegex(source) {
|
||||
const start = source.startsWith("^") ? 1 : 0;
|
||||
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
||||
return source.slice(start, end);
|
||||
}
|
||||
export 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;
|
||||
}
|
||||
export 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,
|
||||
});
|
||||
}
|
||||
export function assignProp(target, prop, value) {
|
||||
Object.defineProperty(target, prop, {
|
||||
value,
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
});
|
||||
}
|
||||
export function getElementAtPath(obj, path) {
|
||||
if (!path)
|
||||
return obj;
|
||||
return path.reduce((acc, key) => acc?.[key], obj);
|
||||
}
|
||||
export 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;
|
||||
});
|
||||
}
|
||||
export 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;
|
||||
}
|
||||
export function esc(str) {
|
||||
return JSON.stringify(str);
|
||||
}
|
||||
export function isObject(data) {
|
||||
return typeof data === "object" && data !== null;
|
||||
}
|
||||
export const allowsEval = cached(() => {
|
||||
try {
|
||||
const F = Function;
|
||||
new F("");
|
||||
return true;
|
||||
}
|
||||
catch (_) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
export function isPlainObject(data) {
|
||||
return typeof data === "object" && data !== null && Object.getPrototypeOf(data) === Object.prototype;
|
||||
}
|
||||
export function numKeys(data) {
|
||||
let keyCount = 0;
|
||||
for (const key in data) {
|
||||
if (Object.prototype.hasOwnProperty.call(data, key)) {
|
||||
keyCount++;
|
||||
}
|
||||
}
|
||||
return keyCount;
|
||||
}
|
||||
export 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}`);
|
||||
}
|
||||
};
|
||||
export const propertyKeyTypes = new Set(["string", "number", "symbol"]);
|
||||
export const primitiveTypes = new Set(["string", "number", "bigint", "boolean", "symbol", "undefined"]);
|
||||
export function escapeRegex(str) {
|
||||
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
}
|
||||
// zod-specific utils
|
||||
export 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;
|
||||
}
|
||||
export 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;
|
||||
}
|
||||
export 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);
|
||||
},
|
||||
});
|
||||
}
|
||||
export function stringifyPrimitive(value) {
|
||||
if (typeof value === "bigint")
|
||||
return value.toString() + "n";
|
||||
if (typeof value === "string")
|
||||
return `"${value}"`;
|
||||
return `${value}`;
|
||||
}
|
||||
export function optionalKeys(shape) {
|
||||
return Object.keys(shape).filter((k) => {
|
||||
return shape[k]._zod.optin === "optional";
|
||||
});
|
||||
}
|
||||
export const 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],
|
||||
};
|
||||
export const BIGINT_FORMAT_RANGES = {
|
||||
int64: [/* @__PURE__*/ BigInt("-9223372036854775808"), /* @__PURE__*/ BigInt("9223372036854775807")],
|
||||
uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt("18446744073709551615")],
|
||||
};
|
||||
export 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: [],
|
||||
});
|
||||
}
|
||||
export 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: [],
|
||||
});
|
||||
}
|
||||
export 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);
|
||||
}
|
||||
export 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
|
||||
});
|
||||
}
|
||||
export 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: [],
|
||||
});
|
||||
}
|
||||
export 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: [],
|
||||
});
|
||||
}
|
||||
export function aborted(x, startIndex = 0) {
|
||||
for (let i = startIndex; i < x.issues.length; i++) {
|
||||
if (x.issues[i].continue !== true)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
export function prefixIssues(path, issues) {
|
||||
return issues.map((iss) => {
|
||||
var _a;
|
||||
(_a = iss).path ?? (_a.path = []);
|
||||
iss.path.unshift(path);
|
||||
return iss;
|
||||
});
|
||||
}
|
||||
export function unwrapMessage(message) {
|
||||
return typeof message === "string" ? message : message?.message;
|
||||
}
|
||||
export 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;
|
||||
}
|
||||
export function getSizableOrigin(input) {
|
||||
if (input instanceof Set)
|
||||
return "set";
|
||||
if (input instanceof Map)
|
||||
return "map";
|
||||
if (input instanceof File)
|
||||
return "file";
|
||||
return "unknown";
|
||||
}
|
||||
export function getLengthableOrigin(input) {
|
||||
if (Array.isArray(input))
|
||||
return "array";
|
||||
if (typeof input === "string")
|
||||
return "string";
|
||||
return "unknown";
|
||||
}
|
||||
export function issue(...args) {
|
||||
const [iss, input, inst] = args;
|
||||
if (typeof iss === "string") {
|
||||
return {
|
||||
message: iss,
|
||||
code: "custom",
|
||||
input,
|
||||
inst,
|
||||
};
|
||||
}
|
||||
return { ...iss };
|
||||
}
|
||||
export 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
|
||||
export class Class {
|
||||
constructor(..._args) { }
|
||||
}
|
5
node_modules/zod/dist/esm/v4/core/versions.js
generated
vendored
Normal file
5
node_modules/zod/dist/esm/v4/core/versions.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export const version = {
|
||||
major: 4,
|
||||
minor: 0,
|
||||
patch: 0,
|
||||
};
|
171
node_modules/zod/dist/esm/v4/core/zsf.js
generated
vendored
Normal file
171
node_modules/zod/dist/esm/v4/core/zsf.js
generated
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
///////////////////////////////////////////////////
|
||||
//////////////// TYPES ///////////////////
|
||||
///////////////////////////////////////////////////
|
||||
export {};
|
||||
/////////////////////////////////////////////////
|
||||
//////////////// 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;
|
3
node_modules/zod/dist/esm/v4/index.js
generated
vendored
Normal file
3
node_modules/zod/dist/esm/v4/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import z4 from "./classic/index.js";
|
||||
export * from "./classic/index.js";
|
||||
export default z4;
|
115
node_modules/zod/dist/esm/v4/locales/ar.js
generated
vendored
Normal file
115
node_modules/zod/dist/esm/v4/locales/ar.js
generated
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
import * as util from "../core/util.js";
|
||||
const Sizable = {
|
||||
string: { unit: "حرف", verb: "أن يحوي" },
|
||||
file: { unit: "بايت", verb: "أن يحوي" },
|
||||
array: { unit: "عنصر", verb: "أن يحوي" },
|
||||
set: { unit: "عنصر", verb: "أن يحوي" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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}، ولكن تم إدخال ${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 "مدخل غير مقبول";
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
114
node_modules/zod/dist/esm/v4/locales/az.js
generated
vendored
Normal file
114
node_modules/zod/dist/esm/v4/locales/az.js
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
import * as util from "../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;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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 ${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`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
163
node_modules/zod/dist/esm/v4/locales/be.js
generated
vendored
Normal file
163
node_modules/zod/dist/esm/v4/locales/be.js
generated
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
import * as util from "../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;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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}, атрымана ${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 `Няправільны ўвод`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
117
node_modules/zod/dist/esm/v4/locales/ca.js
generated
vendored
Normal file
117
node_modules/zod/dist/esm/v4/locales/ca.js
generated
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
import * as util from "../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;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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 ${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`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
134
node_modules/zod/dist/esm/v4/locales/cs.js
generated
vendored
Normal file
134
node_modules/zod/dist/esm/v4/locales/cs.js
generated
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
import * as util from "../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;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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 ${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`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
115
node_modules/zod/dist/esm/v4/locales/de.js
generated
vendored
Normal file
115
node_modules/zod/dist/esm/v4/locales/de.js
generated
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
import * as util from "../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;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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 ${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`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
117
node_modules/zod/dist/esm/v4/locales/en.js
generated
vendored
Normal file
117
node_modules/zod/dist/esm/v4/locales/en.js
generated
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
import * as util from "../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;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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 ${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`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
116
node_modules/zod/dist/esm/v4/locales/es.js
generated
vendored
Normal file
116
node_modules/zod/dist/esm/v4/locales/es.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
import * as util from "../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;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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 ${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`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
121
node_modules/zod/dist/esm/v4/locales/fa.js
generated
vendored
Normal file
121
node_modules/zod/dist/esm/v4/locales/fa.js
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
import * as util from "../core/util.js";
|
||||
const Sizable = {
|
||||
string: { unit: "کاراکتر", verb: "داشته باشد" },
|
||||
file: { unit: "بایت", verb: "داشته باشد" },
|
||||
array: { unit: "آیتم", verb: "داشته باشد" },
|
||||
set: { unit: "آیتم", verb: "داشته باشد" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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} میبود، ${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 `ورودی نامعتبر`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
121
node_modules/zod/dist/esm/v4/locales/fi.js
generated
vendored
Normal file
121
node_modules/zod/dist/esm/v4/locales/fi.js
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
import * as util from "../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;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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 ${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`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
115
node_modules/zod/dist/esm/v4/locales/fr.js
generated
vendored
Normal file
115
node_modules/zod/dist/esm/v4/locales/fr.js
generated
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
import * as util from "../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;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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, ${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`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
116
node_modules/zod/dist/esm/v4/locales/frCA.js
generated
vendored
Normal file
116
node_modules/zod/dist/esm/v4/locales/frCA.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
import * as util from "../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;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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 ${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`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
116
node_modules/zod/dist/esm/v4/locales/he.js
generated
vendored
Normal file
116
node_modules/zod/dist/esm/v4/locales/he.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
import * as util from "../core/util.js";
|
||||
const Sizable = {
|
||||
string: { unit: "אותיות", verb: "לכלול" },
|
||||
file: { unit: "בייטים", verb: "לכלול" },
|
||||
array: { unit: "פריטים", verb: "לכלול" },
|
||||
set: { unit: "פריטים", verb: "לכלול" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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}, התקבל ${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 `קלט לא תקין`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
116
node_modules/zod/dist/esm/v4/locales/hu.js
generated
vendored
Normal file
116
node_modules/zod/dist/esm/v4/locales/hu.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
import * as util from "../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;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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 ${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`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
115
node_modules/zod/dist/esm/v4/locales/id.js
generated
vendored
Normal file
115
node_modules/zod/dist/esm/v4/locales/id.js
generated
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
import * as util from "../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;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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 ${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`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
34
node_modules/zod/dist/esm/v4/locales/index.js
generated
vendored
Normal file
34
node_modules/zod/dist/esm/v4/locales/index.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
export { default as ar } from "./ar.js";
|
||||
export { default as az } from "./az.js";
|
||||
export { default as be } from "./be.js";
|
||||
export { default as ca } from "./ca.js";
|
||||
export { default as cs } from "./cs.js";
|
||||
export { default as de } from "./de.js";
|
||||
export { default as en } from "./en.js";
|
||||
export { default as es } from "./es.js";
|
||||
export { default as fa } from "./fa.js";
|
||||
export { default as fi } from "./fi.js";
|
||||
export { default as fr } from "./fr.js";
|
||||
export { default as frCA } from "./frCA.js";
|
||||
export { default as he } from "./he.js";
|
||||
export { default as hu } from "./hu.js";
|
||||
export { default as id } from "./id.js";
|
||||
export { default as it } from "./it.js";
|
||||
export { default as ja } from "./ja.js";
|
||||
export { default as ko } from "./ko.js";
|
||||
export { default as mk } from "./mk.js";
|
||||
export { default as ms } from "./ms.js";
|
||||
export { default as no } from "./no.js";
|
||||
export { default as ota } from "./ota.js";
|
||||
export { default as pl } from "./pl.js";
|
||||
export { default as pt } from "./pt.js";
|
||||
export { default as ru } from "./ru.js";
|
||||
export { default as sl } from "./sl.js";
|
||||
export { default as ta } from "./ta.js";
|
||||
export { default as th } from "./th.js";
|
||||
export { default as tr } from "./tr.js";
|
||||
export { default as ua } from "./ua.js";
|
||||
export { default as ur } from "./ur.js";
|
||||
export { default as vi } from "./vi.js";
|
||||
export { default as zhCN } from "./zh-CN.js";
|
||||
export { default as zhTW } from "./zh-tw.js";
|
116
node_modules/zod/dist/esm/v4/locales/it.js
generated
vendored
Normal file
116
node_modules/zod/dist/esm/v4/locales/it.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
import * as util from "../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;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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 ${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`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
114
node_modules/zod/dist/esm/v4/locales/ja.js
generated
vendored
Normal file
114
node_modules/zod/dist/esm/v4/locales/ja.js
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
import * as util from "../core/util.js";
|
||||
const Sizable = {
|
||||
string: { unit: "文字", verb: "である" },
|
||||
file: { unit: "バイト", verb: "である" },
|
||||
array: { unit: "要素", verb: "である" },
|
||||
set: { unit: "要素", verb: "である" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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}が期待されましたが、${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 `無効な入力`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
120
node_modules/zod/dist/esm/v4/locales/ko.js
generated
vendored
Normal file
120
node_modules/zod/dist/esm/v4/locales/ko.js
generated
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
import * as util from "../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;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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}, 받은 타입은 ${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 `잘못된 입력`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
117
node_modules/zod/dist/esm/v4/locales/mk.js
generated
vendored
Normal file
117
node_modules/zod/dist/esm/v4/locales/mk.js
generated
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
import * as util from "../core/util.js";
|
||||
const Sizable = {
|
||||
string: { unit: "знаци", verb: "да имаат" },
|
||||
file: { unit: "бајти", verb: "да имаат" },
|
||||
array: { unit: "ставки", verb: "да имаат" },
|
||||
set: { unit: "ставки", verb: "да имаат" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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}, примено ${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 `Грешен внес`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
115
node_modules/zod/dist/esm/v4/locales/ms.js
generated
vendored
Normal file
115
node_modules/zod/dist/esm/v4/locales/ms.js
generated
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
import * as util from "../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;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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 ${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`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
115
node_modules/zod/dist/esm/v4/locales/no.js
generated
vendored
Normal file
115
node_modules/zod/dist/esm/v4/locales/no.js
generated
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
import * as util from "../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;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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 ${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`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
116
node_modules/zod/dist/esm/v4/locales/ota.js
generated
vendored
Normal file
116
node_modules/zod/dist/esm/v4/locales/ota.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
import * as util from "../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;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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 ${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ı.`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
116
node_modules/zod/dist/esm/v4/locales/pl.js
generated
vendored
Normal file
116
node_modules/zod/dist/esm/v4/locales/pl.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
import * as util from "../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;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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 ${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`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
115
node_modules/zod/dist/esm/v4/locales/pt.js
generated
vendored
Normal file
115
node_modules/zod/dist/esm/v4/locales/pt.js
generated
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
import * as util from "../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;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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 ${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`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
163
node_modules/zod/dist/esm/v4/locales/ru.js
generated
vendored
Normal file
163
node_modules/zod/dist/esm/v4/locales/ru.js
generated
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
import * as util from "../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;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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}, получено ${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 `Неверные входные данные`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
116
node_modules/zod/dist/esm/v4/locales/sl.js
generated
vendored
Normal file
116
node_modules/zod/dist/esm/v4/locales/sl.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
import * as util from "../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;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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 ${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";
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
116
node_modules/zod/dist/esm/v4/locales/ta.js
generated
vendored
Normal file
116
node_modules/zod/dist/esm/v4/locales/ta.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
import * as util from "../core/util.js";
|
||||
const Sizable = {
|
||||
string: { unit: "எழுத்துக்கள்", verb: "கொண்டிருக்க வேண்டும்" },
|
||||
file: { unit: "பைட்டுகள்", verb: "கொண்டிருக்க வேண்டும்" },
|
||||
array: { unit: "உறுப்புகள்", verb: "கொண்டிருக்க வேண்டும்" },
|
||||
set: { unit: "உறுப்புகள்", verb: "கொண்டிருக்க வேண்டும்" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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}, பெறப்பட்டது ${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 `தவறான உள்ளீடு`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
116
node_modules/zod/dist/esm/v4/locales/th.js
generated
vendored
Normal file
116
node_modules/zod/dist/esm/v4/locales/th.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
import * as util from "../core/util.js";
|
||||
const Sizable = {
|
||||
string: { unit: "ตัวอักษร", verb: "ควรมี" },
|
||||
file: { unit: "ไบต์", verb: "ควรมี" },
|
||||
array: { unit: "รายการ", verb: "ควรมี" },
|
||||
set: { unit: "รายการ", verb: "ควรมี" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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} แต่ได้รับ ${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 `ข้อมูลไม่ถูกต้อง`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
114
node_modules/zod/dist/esm/v4/locales/tr.js
generated
vendored
Normal file
114
node_modules/zod/dist/esm/v4/locales/tr.js
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
import * as util from "../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;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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 ${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`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
116
node_modules/zod/dist/esm/v4/locales/ua.js
generated
vendored
Normal file
116
node_modules/zod/dist/esm/v4/locales/ua.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
import * as util from "../core/util.js";
|
||||
const Sizable = {
|
||||
string: { unit: "символів", verb: "матиме" },
|
||||
file: { unit: "байтів", verb: "матиме" },
|
||||
array: { unit: "елементів", verb: "матиме" },
|
||||
set: { unit: "елементів", verb: "матиме" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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}, отримано ${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 `Неправильні вхідні дані`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
116
node_modules/zod/dist/esm/v4/locales/ur.js
generated
vendored
Normal file
116
node_modules/zod/dist/esm/v4/locales/ur.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
import * as util from "../core/util.js";
|
||||
const Sizable = {
|
||||
string: { unit: "حروف", verb: "ہونا" },
|
||||
file: { unit: "بائٹس", verb: "ہونا" },
|
||||
array: { unit: "آئٹمز", verb: "ہونا" },
|
||||
set: { unit: "آئٹمز", verb: "ہونا" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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} متوقع تھا، ${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 `غلط ان پٹ`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
115
node_modules/zod/dist/esm/v4/locales/vi.js
generated
vendored
Normal file
115
node_modules/zod/dist/esm/v4/locales/vi.js
generated
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
import * as util from "../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;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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 ${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ệ`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
115
node_modules/zod/dist/esm/v4/locales/zh-CN.js
generated
vendored
Normal file
115
node_modules/zod/dist/esm/v4/locales/zh-CN.js
generated
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
import * as util from "../core/util.js";
|
||||
const Sizable = {
|
||||
string: { unit: "字符", verb: "包含" },
|
||||
file: { unit: "字节", verb: "包含" },
|
||||
array: { unit: "项", verb: "包含" },
|
||||
set: { unit: "项", verb: "包含" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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},实际接收 ${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 `无效输入`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
116
node_modules/zod/dist/esm/v4/locales/zh-tw.js
generated
vendored
Normal file
116
node_modules/zod/dist/esm/v4/locales/zh-tw.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
import * as util from "../core/util.js";
|
||||
const Sizable = {
|
||||
string: { unit: "字元", verb: "擁有" },
|
||||
file: { unit: "位元組", verb: "擁有" },
|
||||
array: { unit: "項目", verb: "擁有" },
|
||||
set: { unit: "項目", verb: "擁有" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
export 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;
|
||||
};
|
||||
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},但收到 ${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 `無效的輸入值`;
|
||||
}
|
||||
};
|
||||
export { error };
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error,
|
||||
};
|
||||
}
|
1
node_modules/zod/dist/esm/v4/mini/checks.js
generated
vendored
Normal file
1
node_modules/zod/dist/esm/v4/mini/checks.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { _lt as lt, _lte as lte, _lte as maximum, _gt as gt, _gte as gte, _gte as minimum, _positive as positive, _negative as negative, _nonpositive as nonpositive, _nonnegative as nonnegative, _multipleOf as multipleOf, _maxSize as maxSize, _minSize as minSize, _size as size, _maxLength as maxLength, _minLength as minLength, _length as length, _regex as regex, _lowercase as lowercase, _uppercase as uppercase, _includes as includes, _startsWith as startsWith, _endsWith as endsWith, _property as property, _mime as mime, _overwrite as overwrite, _normalize as normalize, _trim as trim, _toLowerCase as toLowerCase, _toUpperCase as toUpperCase, } from "zod/v4/core";
|
17
node_modules/zod/dist/esm/v4/mini/coerce.js
generated
vendored
Normal file
17
node_modules/zod/dist/esm/v4/mini/coerce.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import * as core from "zod/v4/core";
|
||||
import * as schemas from "./schemas.js";
|
||||
export function string(params) {
|
||||
return core._coercedString(schemas.ZodMiniString, params);
|
||||
}
|
||||
export function number(params) {
|
||||
return core._coercedNumber(schemas.ZodMiniNumber, params);
|
||||
}
|
||||
export function boolean(params) {
|
||||
return core._coercedBoolean(schemas.ZodMiniBoolean, params);
|
||||
}
|
||||
export function bigint(params) {
|
||||
return core._coercedBigint(schemas.ZodMiniBigInt, params);
|
||||
}
|
||||
export function date(params) {
|
||||
return core._coercedDate(schemas.ZodMiniDate, params);
|
||||
}
|
7
node_modules/zod/dist/esm/v4/mini/external.js
generated
vendored
Normal file
7
node_modules/zod/dist/esm/v4/mini/external.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
export * as core from "zod/v4/core";
|
||||
export * from "./parse.js";
|
||||
export * from "./schemas.js";
|
||||
export * from "./checks.js";
|
||||
export { globalRegistry, registry, config, $output, $input, $brand, function, clone, regexes, treeifyError, prettifyError, formatError, flattenError, toJSONSchema, locales, } from "zod/v4/core";
|
||||
/** A special constant with type `never` */
|
||||
// export const NEVER = {} as never;
|
3
node_modules/zod/dist/esm/v4/mini/index.js
generated
vendored
Normal file
3
node_modules/zod/dist/esm/v4/mini/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import * as z from "./external.js";
|
||||
export * from "./external.js";
|
||||
export { z };
|
30
node_modules/zod/dist/esm/v4/mini/iso.js
generated
vendored
Normal file
30
node_modules/zod/dist/esm/v4/mini/iso.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import * as core from "zod/v4/core";
|
||||
import * as schemas from "./schemas.js";
|
||||
export const ZodMiniISODateTime = /*@__PURE__*/ core.$constructor("$ZodISODateTime", (inst, def) => {
|
||||
core.$ZodISODateTime.init(inst, def);
|
||||
schemas.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
export function datetime(params) {
|
||||
return core._isoDateTime(ZodMiniISODateTime, params);
|
||||
}
|
||||
export const ZodMiniISODate = /*@__PURE__*/ core.$constructor("$ZodISODate", (inst, def) => {
|
||||
core.$ZodISODate.init(inst, def);
|
||||
schemas.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
export function date(params) {
|
||||
return core._isoDate(ZodMiniISODate, params);
|
||||
}
|
||||
export const ZodMiniISOTime = /*@__PURE__*/ core.$constructor("$ZodISOTime", (inst, def) => {
|
||||
core.$ZodISOTime.init(inst, def);
|
||||
schemas.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
export function time(params) {
|
||||
return core._isoTime(ZodMiniISOTime, params);
|
||||
}
|
||||
export const ZodMiniISODuration = /*@__PURE__*/ core.$constructor("$ZodISODuration", (inst, def) => {
|
||||
core.$ZodISODuration.init(inst, def);
|
||||
schemas.ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
export function duration(params) {
|
||||
return core._isoDuration(ZodMiniISODuration, params);
|
||||
}
|
1
node_modules/zod/dist/esm/v4/mini/parse.js
generated
vendored
Normal file
1
node_modules/zod/dist/esm/v4/mini/parse.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { parse, safeParse, parseAsync, safeParseAsync } from "zod/v4/core";
|
738
node_modules/zod/dist/esm/v4/mini/schemas.js
generated
vendored
Normal file
738
node_modules/zod/dist/esm/v4/mini/schemas.js
generated
vendored
Normal file
@@ -0,0 +1,738 @@
|
||||
import * as core from "zod/v4/core";
|
||||
import { util } from "zod/v4/core";
|
||||
import * as parse from "./parse.js";
|
||||
export * as coerce from "./coerce.js";
|
||||
export * as iso from "./iso.js";
|
||||
export const ZodMiniType = /*@__PURE__*/ 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;
|
||||
});
|
||||
});
|
||||
export const ZodMiniString = /*@__PURE__*/ core.$constructor("ZodMiniString", (inst, def) => {
|
||||
core.$ZodString.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function string(params) {
|
||||
return core._string(ZodMiniString, params);
|
||||
}
|
||||
export const ZodMiniStringFormat = /*@__PURE__*/ core.$constructor("ZodMiniStringFormat", (inst, def) => {
|
||||
core.$ZodStringFormat.init(inst, def);
|
||||
ZodMiniString.init(inst, def);
|
||||
});
|
||||
export const ZodMiniEmail = /*@__PURE__*/ core.$constructor("ZodMiniEmail", (inst, def) => {
|
||||
core.$ZodEmail.init(inst, def);
|
||||
ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
export function email(params) {
|
||||
return core._email(ZodMiniEmail, params);
|
||||
}
|
||||
export const ZodMiniGUID = /*@__PURE__*/ core.$constructor("ZodMiniGUID", (inst, def) => {
|
||||
core.$ZodGUID.init(inst, def);
|
||||
ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
export function guid(params) {
|
||||
return core._guid(ZodMiniGUID, params);
|
||||
}
|
||||
export const ZodMiniUUID = /*@__PURE__*/ core.$constructor("ZodMiniUUID", (inst, def) => {
|
||||
core.$ZodUUID.init(inst, def);
|
||||
ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
export function uuid(params) {
|
||||
return core._uuid(ZodMiniUUID, params);
|
||||
}
|
||||
export function uuidv4(params) {
|
||||
return core._uuidv4(ZodMiniUUID, params);
|
||||
}
|
||||
// ZodMiniUUIDv6
|
||||
export function uuidv6(params) {
|
||||
return core._uuidv6(ZodMiniUUID, params);
|
||||
}
|
||||
// ZodMiniUUIDv7
|
||||
export function uuidv7(params) {
|
||||
return core._uuidv7(ZodMiniUUID, params);
|
||||
}
|
||||
export const ZodMiniURL = /*@__PURE__*/ core.$constructor("ZodMiniURL", (inst, def) => {
|
||||
core.$ZodURL.init(inst, def);
|
||||
ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
export function url(params) {
|
||||
return core._url(ZodMiniURL, params);
|
||||
}
|
||||
export const ZodMiniEmoji = /*@__PURE__*/ core.$constructor("ZodMiniEmoji", (inst, def) => {
|
||||
core.$ZodEmoji.init(inst, def);
|
||||
ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
export function emoji(params) {
|
||||
return core._emoji(ZodMiniEmoji, params);
|
||||
}
|
||||
export const ZodMiniNanoID = /*@__PURE__*/ core.$constructor("ZodMiniNanoID", (inst, def) => {
|
||||
core.$ZodNanoID.init(inst, def);
|
||||
ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
export function nanoid(params) {
|
||||
return core._nanoid(ZodMiniNanoID, params);
|
||||
}
|
||||
export const ZodMiniCUID = /*@__PURE__*/ core.$constructor("ZodMiniCUID", (inst, def) => {
|
||||
core.$ZodCUID.init(inst, def);
|
||||
ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
export function cuid(params) {
|
||||
return core._cuid(ZodMiniCUID, params);
|
||||
}
|
||||
export const ZodMiniCUID2 = /*@__PURE__*/ core.$constructor("ZodMiniCUID2", (inst, def) => {
|
||||
core.$ZodCUID2.init(inst, def);
|
||||
ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
export function cuid2(params) {
|
||||
return core._cuid2(ZodMiniCUID2, params);
|
||||
}
|
||||
export const ZodMiniULID = /*@__PURE__*/ core.$constructor("ZodMiniULID", (inst, def) => {
|
||||
core.$ZodULID.init(inst, def);
|
||||
ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
export function ulid(params) {
|
||||
return core._ulid(ZodMiniULID, params);
|
||||
}
|
||||
export const ZodMiniXID = /*@__PURE__*/ core.$constructor("ZodMiniXID", (inst, def) => {
|
||||
core.$ZodXID.init(inst, def);
|
||||
ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
export function xid(params) {
|
||||
return core._xid(ZodMiniXID, params);
|
||||
}
|
||||
export const ZodMiniKSUID = /*@__PURE__*/ core.$constructor("ZodMiniKSUID", (inst, def) => {
|
||||
core.$ZodKSUID.init(inst, def);
|
||||
ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
export function ksuid(params) {
|
||||
return core._ksuid(ZodMiniKSUID, params);
|
||||
}
|
||||
export const ZodMiniIPv4 = /*@__PURE__*/ core.$constructor("ZodMiniIPv4", (inst, def) => {
|
||||
core.$ZodIPv4.init(inst, def);
|
||||
ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
export function ipv4(params) {
|
||||
return core._ipv4(ZodMiniIPv4, params);
|
||||
}
|
||||
export const ZodMiniIPv6 = /*@__PURE__*/ core.$constructor("ZodMiniIPv6", (inst, def) => {
|
||||
core.$ZodIPv6.init(inst, def);
|
||||
ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
export function ipv6(params) {
|
||||
return core._ipv6(ZodMiniIPv6, params);
|
||||
}
|
||||
export const ZodMiniCIDRv4 = /*@__PURE__*/ core.$constructor("ZodMiniCIDRv4", (inst, def) => {
|
||||
core.$ZodCIDRv4.init(inst, def);
|
||||
ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
export function cidrv4(params) {
|
||||
return core._cidrv4(ZodMiniCIDRv4, params);
|
||||
}
|
||||
export const ZodMiniCIDRv6 = /*@__PURE__*/ core.$constructor("ZodMiniCIDRv6", (inst, def) => {
|
||||
core.$ZodCIDRv6.init(inst, def);
|
||||
ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
export function cidrv6(params) {
|
||||
return core._cidrv6(ZodMiniCIDRv6, params);
|
||||
}
|
||||
export const ZodMiniBase64 = /*@__PURE__*/ core.$constructor("ZodMiniBase64", (inst, def) => {
|
||||
core.$ZodBase64.init(inst, def);
|
||||
ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
export function base64(params) {
|
||||
return core._base64(ZodMiniBase64, params);
|
||||
}
|
||||
export const ZodMiniBase64URL = /*@__PURE__*/ core.$constructor("ZodMiniBase64URL", (inst, def) => {
|
||||
core.$ZodBase64URL.init(inst, def);
|
||||
ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
export function base64url(params) {
|
||||
return core._base64url(ZodMiniBase64URL, params);
|
||||
}
|
||||
export const ZodMiniE164 = /*@__PURE__*/ core.$constructor("ZodMiniE164", (inst, def) => {
|
||||
core.$ZodE164.init(inst, def);
|
||||
ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
export function e164(params) {
|
||||
return core._e164(ZodMiniE164, params);
|
||||
}
|
||||
export const ZodMiniJWT = /*@__PURE__*/ core.$constructor("ZodMiniJWT", (inst, def) => {
|
||||
core.$ZodJWT.init(inst, def);
|
||||
ZodMiniStringFormat.init(inst, def);
|
||||
});
|
||||
export function jwt(params) {
|
||||
return core._jwt(ZodMiniJWT, params);
|
||||
}
|
||||
export const ZodMiniNumber = /*@__PURE__*/ core.$constructor("ZodMiniNumber", (inst, def) => {
|
||||
core.$ZodNumber.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function number(params) {
|
||||
return core._number(ZodMiniNumber, params);
|
||||
}
|
||||
export const ZodMiniNumberFormat = /*@__PURE__*/ core.$constructor("ZodMiniNumberFormat", (inst, def) => {
|
||||
core.$ZodNumberFormat.init(inst, def);
|
||||
ZodMiniNumber.init(inst, def);
|
||||
});
|
||||
// int
|
||||
export function int(params) {
|
||||
return core._int(ZodMiniNumberFormat, params);
|
||||
}
|
||||
// float32
|
||||
export function float32(params) {
|
||||
return core._float32(ZodMiniNumberFormat, params);
|
||||
}
|
||||
// float64
|
||||
export function float64(params) {
|
||||
return core._float64(ZodMiniNumberFormat, params);
|
||||
}
|
||||
// int32
|
||||
export function int32(params) {
|
||||
return core._int32(ZodMiniNumberFormat, params);
|
||||
}
|
||||
// uint32
|
||||
export function uint32(params) {
|
||||
return core._uint32(ZodMiniNumberFormat, params);
|
||||
}
|
||||
export const ZodMiniBoolean = /*@__PURE__*/ core.$constructor("ZodMiniBoolean", (inst, def) => {
|
||||
core.$ZodBoolean.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function boolean(params) {
|
||||
return core._boolean(ZodMiniBoolean, params);
|
||||
}
|
||||
export const ZodMiniBigInt = /*@__PURE__*/ core.$constructor("ZodMiniBigInt", (inst, def) => {
|
||||
core.$ZodBigInt.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function bigint(params) {
|
||||
return core._bigint(ZodMiniBigInt, params);
|
||||
}
|
||||
export const ZodMiniBigIntFormat = /*@__PURE__*/ core.$constructor("ZodMiniBigIntFormat", (inst, def) => {
|
||||
core.$ZodBigIntFormat.init(inst, def);
|
||||
ZodMiniBigInt.init(inst, def);
|
||||
});
|
||||
// int64
|
||||
export function int64(params) {
|
||||
return core._int64(ZodMiniBigIntFormat, params);
|
||||
}
|
||||
// uint64
|
||||
export function uint64(params) {
|
||||
return core._uint64(ZodMiniBigIntFormat, params);
|
||||
}
|
||||
export const ZodMiniSymbol = /*@__PURE__*/ core.$constructor("ZodMiniSymbol", (inst, def) => {
|
||||
core.$ZodSymbol.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function symbol(params) {
|
||||
return core._symbol(ZodMiniSymbol, params);
|
||||
}
|
||||
export const ZodMiniUndefined = /*@__PURE__*/ core.$constructor("ZodMiniUndefined", (inst, def) => {
|
||||
core.$ZodUndefined.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
function _undefined(params) {
|
||||
return core._undefined(ZodMiniUndefined, params);
|
||||
}
|
||||
export { _undefined as undefined };
|
||||
export const ZodMiniNull = /*@__PURE__*/ core.$constructor("ZodMiniNull", (inst, def) => {
|
||||
core.$ZodNull.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
function _null(params) {
|
||||
return core._null(ZodMiniNull, params);
|
||||
}
|
||||
export { _null as null };
|
||||
export const ZodMiniAny = /*@__PURE__*/ core.$constructor("ZodMiniAny", (inst, def) => {
|
||||
core.$ZodAny.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function any() {
|
||||
return core._any(ZodMiniAny);
|
||||
}
|
||||
export const ZodMiniUnknown = /*@__PURE__*/ core.$constructor("ZodMiniUnknown", (inst, def) => {
|
||||
core.$ZodUnknown.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function unknown() {
|
||||
return core._unknown(ZodMiniUnknown);
|
||||
}
|
||||
export const ZodMiniNever = /*@__PURE__*/ core.$constructor("ZodMiniNever", (inst, def) => {
|
||||
core.$ZodNever.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function never(params) {
|
||||
return core._never(ZodMiniNever, params);
|
||||
}
|
||||
export const ZodMiniVoid = /*@__PURE__*/ core.$constructor("ZodMiniVoid", (inst, def) => {
|
||||
core.$ZodVoid.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
function _void(params) {
|
||||
return core._void(ZodMiniVoid, params);
|
||||
}
|
||||
export { _void as void };
|
||||
export const ZodMiniDate = /*@__PURE__*/ core.$constructor("ZodMiniDate", (inst, def) => {
|
||||
core.$ZodDate.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function date(params) {
|
||||
return core._date(ZodMiniDate, params);
|
||||
}
|
||||
export const ZodMiniArray = /*@__PURE__*/ core.$constructor("ZodMiniArray", (inst, def) => {
|
||||
core.$ZodArray.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function array(element, params) {
|
||||
return new ZodMiniArray({
|
||||
type: "array",
|
||||
element,
|
||||
// get element() {
|
||||
// return element;
|
||||
// },
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
// .keyof
|
||||
export function keyof(schema) {
|
||||
const shape = schema._zod.def.shape;
|
||||
return literal(Object.keys(shape));
|
||||
}
|
||||
export const ZodMiniObject = /*@__PURE__*/ core.$constructor("ZodMiniObject", (inst, def) => {
|
||||
core.$ZodObject.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function object(shape, params) {
|
||||
const def = {
|
||||
type: "object",
|
||||
get shape() {
|
||||
util.assignProp(this, "shape", { ...shape });
|
||||
return this.shape;
|
||||
},
|
||||
...util.normalizeParams(params),
|
||||
};
|
||||
return new ZodMiniObject(def);
|
||||
}
|
||||
// strictObject
|
||||
export function strictObject(shape, params) {
|
||||
return new ZodMiniObject({
|
||||
type: "object",
|
||||
// shape: shape as core.$ZodLooseShape,
|
||||
get shape() {
|
||||
util.assignProp(this, "shape", { ...shape });
|
||||
return this.shape;
|
||||
},
|
||||
// get optional() {
|
||||
// return util.optionalKeys(shape);
|
||||
// },
|
||||
catchall: never(),
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
// looseObject
|
||||
export function looseObject(shape, params) {
|
||||
return new ZodMiniObject({
|
||||
type: "object",
|
||||
// shape: shape as core.$ZodLooseShape,
|
||||
get shape() {
|
||||
util.assignProp(this, "shape", { ...shape });
|
||||
return this.shape;
|
||||
},
|
||||
// get optional() {
|
||||
// return util.optionalKeys(shape);
|
||||
// },
|
||||
catchall: unknown(),
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
// object methods
|
||||
export function extend(schema, shape) {
|
||||
return util.extend(schema, shape);
|
||||
}
|
||||
export function merge(schema, shape) {
|
||||
return util.extend(schema, shape);
|
||||
}
|
||||
export function pick(schema, mask) {
|
||||
return util.pick(schema, mask);
|
||||
}
|
||||
// .omit
|
||||
export function omit(schema, mask) {
|
||||
return util.omit(schema, mask);
|
||||
}
|
||||
export function partial(schema, mask) {
|
||||
return util.partial(ZodMiniOptional, schema, mask);
|
||||
}
|
||||
export function required(schema, mask) {
|
||||
return util.required(ZodMiniNonOptional, schema, mask);
|
||||
}
|
||||
export const ZodMiniUnion = /*@__PURE__*/ core.$constructor("ZodMiniUnion", (inst, def) => {
|
||||
core.$ZodUnion.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function union(options, params) {
|
||||
return new ZodMiniUnion({
|
||||
type: "union",
|
||||
options,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export const ZodMiniDiscriminatedUnion = /*@__PURE__*/ core.$constructor("ZodMiniDiscriminatedUnion", (inst, def) => {
|
||||
core.$ZodDiscriminatedUnion.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function discriminatedUnion(discriminator, options, params) {
|
||||
return new ZodMiniDiscriminatedUnion({
|
||||
type: "union",
|
||||
options,
|
||||
discriminator,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export const ZodMiniIntersection = /*@__PURE__*/ core.$constructor("ZodMiniIntersection", (inst, def) => {
|
||||
core.$ZodIntersection.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function intersection(left, right) {
|
||||
return new ZodMiniIntersection({
|
||||
type: "intersection",
|
||||
left,
|
||||
right,
|
||||
});
|
||||
}
|
||||
export const ZodMiniTuple = /*@__PURE__*/ core.$constructor("ZodMiniTuple", (inst, def) => {
|
||||
core.$ZodTuple.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function tuple(items, _paramsOrRest, _params) {
|
||||
const hasRest = _paramsOrRest instanceof core.$ZodType;
|
||||
const params = hasRest ? _params : _paramsOrRest;
|
||||
const rest = hasRest ? _paramsOrRest : null;
|
||||
return new ZodMiniTuple({
|
||||
type: "tuple",
|
||||
items,
|
||||
rest,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export const ZodMiniRecord = /*@__PURE__*/ core.$constructor("ZodMiniRecord", (inst, def) => {
|
||||
core.$ZodRecord.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function record(keyType, valueType, params) {
|
||||
return new ZodMiniRecord({
|
||||
type: "record",
|
||||
keyType,
|
||||
valueType,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export function partialRecord(keyType, valueType, params) {
|
||||
return new ZodMiniRecord({
|
||||
type: "record",
|
||||
keyType: union([keyType, never()]),
|
||||
valueType,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export const ZodMiniMap = /*@__PURE__*/ core.$constructor("ZodMiniMap", (inst, def) => {
|
||||
core.$ZodMap.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function map(keyType, valueType, params) {
|
||||
return new ZodMiniMap({
|
||||
type: "map",
|
||||
keyType,
|
||||
valueType,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export const ZodMiniSet = /*@__PURE__*/ core.$constructor("ZodMiniSet", (inst, def) => {
|
||||
core.$ZodSet.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function set(valueType, params) {
|
||||
return new ZodMiniSet({
|
||||
type: "set",
|
||||
valueType,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export const ZodMiniEnum = /*@__PURE__*/ core.$constructor("ZodMiniEnum", (inst, def) => {
|
||||
core.$ZodEnum.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
function _enum(values, params) {
|
||||
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
|
||||
return new ZodMiniEnum({
|
||||
type: "enum",
|
||||
entries,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export { _enum as enum };
|
||||
/** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
|
||||
*
|
||||
* ```ts
|
||||
* enum Colors { red, green, blue }
|
||||
* z.enum(Colors);
|
||||
* ```
|
||||
*/
|
||||
export function nativeEnum(entries, params) {
|
||||
return new ZodMiniEnum({
|
||||
type: "enum",
|
||||
entries,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export const ZodMiniLiteral = /*@__PURE__*/ core.$constructor("ZodMiniLiteral", (inst, def) => {
|
||||
core.$ZodLiteral.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function literal(value, params) {
|
||||
return new ZodMiniLiteral({
|
||||
type: "literal",
|
||||
values: Array.isArray(value) ? value : [value],
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export const ZodMiniFile = /*@__PURE__*/ core.$constructor("ZodMiniFile", (inst, def) => {
|
||||
core.$ZodFile.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function file(params) {
|
||||
return core._file(ZodMiniFile, params);
|
||||
}
|
||||
export const ZodMiniTransform = /*@__PURE__*/ core.$constructor("ZodMiniTransform", (inst, def) => {
|
||||
core.$ZodTransform.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function transform(fn) {
|
||||
return new ZodMiniTransform({
|
||||
type: "transform",
|
||||
transform: fn,
|
||||
});
|
||||
}
|
||||
export const ZodMiniOptional = /*@__PURE__*/ core.$constructor("ZodMiniOptional", (inst, def) => {
|
||||
core.$ZodOptional.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function optional(innerType) {
|
||||
return new ZodMiniOptional({
|
||||
type: "optional",
|
||||
innerType,
|
||||
});
|
||||
}
|
||||
export const ZodMiniNullable = /*@__PURE__*/ core.$constructor("ZodMiniNullable", (inst, def) => {
|
||||
core.$ZodNullable.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function nullable(innerType) {
|
||||
return new ZodMiniNullable({
|
||||
type: "nullable",
|
||||
innerType,
|
||||
});
|
||||
}
|
||||
// nullish
|
||||
export function nullish(innerType) {
|
||||
return optional(nullable(innerType));
|
||||
}
|
||||
export const ZodMiniDefault = /*@__PURE__*/ core.$constructor("ZodMiniDefault", (inst, def) => {
|
||||
core.$ZodDefault.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function _default(innerType, defaultValue) {
|
||||
return new ZodMiniDefault({
|
||||
type: "default",
|
||||
innerType,
|
||||
get defaultValue() {
|
||||
return typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
||||
},
|
||||
});
|
||||
}
|
||||
export const ZodMiniPrefault = /*@__PURE__*/ core.$constructor("ZodMiniPrefault", (inst, def) => {
|
||||
core.$ZodPrefault.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function prefault(innerType, defaultValue) {
|
||||
return new ZodMiniPrefault({
|
||||
type: "prefault",
|
||||
innerType,
|
||||
get defaultValue() {
|
||||
return typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
||||
},
|
||||
});
|
||||
}
|
||||
export const ZodMiniNonOptional = /*@__PURE__*/ core.$constructor("ZodMiniNonOptional", (inst, def) => {
|
||||
core.$ZodNonOptional.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function nonoptional(innerType, params) {
|
||||
return new ZodMiniNonOptional({
|
||||
type: "nonoptional",
|
||||
innerType,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export const ZodMiniSuccess = /*@__PURE__*/ core.$constructor("ZodMiniSuccess", (inst, def) => {
|
||||
core.$ZodSuccess.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function success(innerType) {
|
||||
return new ZodMiniSuccess({
|
||||
type: "success",
|
||||
innerType,
|
||||
});
|
||||
}
|
||||
export const ZodMiniCatch = /*@__PURE__*/ core.$constructor("ZodMiniCatch", (inst, def) => {
|
||||
core.$ZodCatch.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
function _catch(innerType, catchValue) {
|
||||
return new ZodMiniCatch({
|
||||
type: "catch",
|
||||
innerType,
|
||||
catchValue: (typeof catchValue === "function" ? catchValue : () => catchValue),
|
||||
});
|
||||
}
|
||||
export { _catch as catch };
|
||||
export const ZodMiniNaN = /*@__PURE__*/ core.$constructor("ZodMiniNaN", (inst, def) => {
|
||||
core.$ZodNaN.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function nan(params) {
|
||||
return core._nan(ZodMiniNaN, params);
|
||||
}
|
||||
export const ZodMiniPipe = /*@__PURE__*/ core.$constructor("ZodMiniPipe", (inst, def) => {
|
||||
core.$ZodPipe.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function pipe(in_, out) {
|
||||
return new ZodMiniPipe({
|
||||
type: "pipe",
|
||||
in: in_,
|
||||
out,
|
||||
});
|
||||
}
|
||||
export const ZodMiniReadonly = /*@__PURE__*/ core.$constructor("ZodMiniReadonly", (inst, def) => {
|
||||
core.$ZodReadonly.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function readonly(innerType) {
|
||||
return new ZodMiniReadonly({
|
||||
type: "readonly",
|
||||
innerType,
|
||||
});
|
||||
}
|
||||
export const ZodMiniTemplateLiteral = /*@__PURE__*/ core.$constructor("ZodMiniTemplateLiteral", (inst, def) => {
|
||||
core.$ZodTemplateLiteral.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function templateLiteral(parts, params) {
|
||||
return new ZodMiniTemplateLiteral({
|
||||
type: "template_literal",
|
||||
parts,
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
}
|
||||
export const ZodMiniLazy = /*@__PURE__*/ core.$constructor("ZodMiniLazy", (inst, def) => {
|
||||
core.$ZodLazy.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
// export function lazy<T extends object>(getter: () => T): T {
|
||||
// return util.createTransparentProxy<T>(getter);
|
||||
// }
|
||||
function _lazy(getter) {
|
||||
return new ZodMiniLazy({
|
||||
type: "lazy",
|
||||
getter,
|
||||
});
|
||||
}
|
||||
export { _lazy as lazy };
|
||||
export const ZodMiniPromise = /*@__PURE__*/ core.$constructor("ZodMiniPromise", (inst, def) => {
|
||||
core.$ZodPromise.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
export function promise(innerType) {
|
||||
return new ZodMiniPromise({
|
||||
type: "promise",
|
||||
innerType,
|
||||
});
|
||||
}
|
||||
export const ZodMiniCustom = /*@__PURE__*/ core.$constructor("ZodMiniCustom", (inst, def) => {
|
||||
core.$ZodCustom.init(inst, def);
|
||||
ZodMiniType.init(inst, def);
|
||||
});
|
||||
// custom checks
|
||||
export function check(fn, params) {
|
||||
const ch = new core.$ZodCheck({
|
||||
check: "custom",
|
||||
...util.normalizeParams(params),
|
||||
});
|
||||
ch._zod.check = fn;
|
||||
return ch;
|
||||
}
|
||||
// ZodCustom
|
||||
function _custom(fn, _params, Class) {
|
||||
const params = util.normalizeParams(_params);
|
||||
const schema = new Class({
|
||||
type: "custom",
|
||||
check: "custom",
|
||||
fn: fn,
|
||||
...params,
|
||||
});
|
||||
return schema;
|
||||
}
|
||||
// refine
|
||||
export function refine(fn, _params = {}) {
|
||||
return _custom(fn, _params, ZodMiniCustom);
|
||||
}
|
||||
// custom schema
|
||||
export function custom(fn, _params) {
|
||||
return _custom(fn ?? (() => true), _params, 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;
|
||||
}
|
||||
export { _instanceof as instanceof };
|
||||
// stringbool
|
||||
export const stringbool = /* @__PURE__ */ core._stringbool.bind(null, {
|
||||
Pipe: ZodMiniPipe,
|
||||
Boolean: ZodMiniBoolean,
|
||||
Unknown: ZodMiniUnknown,
|
||||
});
|
||||
export function json() {
|
||||
const jsonSchema = _lazy(() => {
|
||||
return union([string(), number(), boolean(), _null(), array(jsonSchema), record(string(), jsonSchema)]);
|
||||
});
|
||||
return jsonSchema;
|
||||
}
|
Reference in New Issue
Block a user