avancement planning

This commit is contained in:
2026-05-26 11:58:39 +02:00
parent 619a2b240a
commit 150b97cd2e
4892 changed files with 99214 additions and 429382 deletions
+89 -25
View File
@@ -23,8 +23,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodMiniOptional = exports.ZodMiniTransform = exports.ZodMiniFile = exports.ZodMiniLiteral = exports.ZodMiniEnum = exports.ZodMiniSet = exports.ZodMiniMap = exports.ZodMiniRecord = exports.ZodMiniTuple = exports.ZodMiniIntersection = exports.ZodMiniDiscriminatedUnion = exports.ZodMiniUnion = exports.ZodMiniObject = exports.ZodMiniArray = exports.ZodMiniDate = exports.ZodMiniVoid = exports.ZodMiniNever = exports.ZodMiniUnknown = exports.ZodMiniAny = exports.ZodMiniNull = exports.ZodMiniUndefined = exports.ZodMiniSymbol = exports.ZodMiniBigIntFormat = exports.ZodMiniBigInt = exports.ZodMiniBoolean = exports.ZodMiniNumberFormat = exports.ZodMiniNumber = exports.ZodMiniCustomStringFormat = exports.ZodMiniJWT = exports.ZodMiniE164 = exports.ZodMiniBase64URL = exports.ZodMiniBase64 = exports.ZodMiniCIDRv6 = exports.ZodMiniCIDRv4 = exports.ZodMiniIPv6 = exports.ZodMiniIPv4 = exports.ZodMiniKSUID = exports.ZodMiniXID = exports.ZodMiniULID = exports.ZodMiniCUID2 = exports.ZodMiniCUID = exports.ZodMiniNanoID = exports.ZodMiniEmoji = exports.ZodMiniURL = exports.ZodMiniUUID = exports.ZodMiniGUID = exports.ZodMiniEmail = exports.ZodMiniStringFormat = exports.ZodMiniString = exports.ZodMiniType = void 0;
exports.stringbool = exports.ZodMiniCustom = exports.ZodMiniPromise = exports.ZodMiniLazy = exports.ZodMiniTemplateLiteral = exports.ZodMiniReadonly = exports.ZodMiniPipe = exports.ZodMiniNaN = exports.ZodMiniCatch = exports.ZodMiniSuccess = exports.ZodMiniNonOptional = exports.ZodMiniPrefault = exports.ZodMiniDefault = exports.ZodMiniNullable = void 0;
exports.ZodMiniTransform = exports.ZodMiniFile = exports.ZodMiniLiteral = exports.ZodMiniEnum = exports.ZodMiniSet = exports.ZodMiniMap = exports.ZodMiniRecord = exports.ZodMiniTuple = exports.ZodMiniIntersection = exports.ZodMiniDiscriminatedUnion = exports.ZodMiniUnion = exports.ZodMiniObject = exports.ZodMiniArray = exports.ZodMiniDate = exports.ZodMiniVoid = exports.ZodMiniNever = exports.ZodMiniUnknown = exports.ZodMiniAny = exports.ZodMiniNull = exports.ZodMiniUndefined = exports.ZodMiniSymbol = exports.ZodMiniBigIntFormat = exports.ZodMiniBigInt = exports.ZodMiniBoolean = exports.ZodMiniNumberFormat = exports.ZodMiniNumber = exports.ZodMiniCustomStringFormat = exports.ZodMiniJWT = exports.ZodMiniE164 = exports.ZodMiniBase64URL = exports.ZodMiniBase64 = exports.ZodMiniMAC = exports.ZodMiniCIDRv6 = exports.ZodMiniCIDRv4 = exports.ZodMiniIPv6 = exports.ZodMiniIPv4 = exports.ZodMiniKSUID = exports.ZodMiniXID = exports.ZodMiniULID = exports.ZodMiniCUID2 = exports.ZodMiniCUID = exports.ZodMiniNanoID = exports.ZodMiniEmoji = exports.ZodMiniURL = exports.ZodMiniUUID = exports.ZodMiniGUID = exports.ZodMiniEmail = exports.ZodMiniStringFormat = exports.ZodMiniString = exports.ZodMiniType = void 0;
exports.ZodMiniFunction = exports.stringbool = exports.meta = exports.describe = exports.ZodMiniCustom = exports.ZodMiniPromise = exports.ZodMiniLazy = exports.ZodMiniTemplateLiteral = exports.ZodMiniReadonly = exports.ZodMiniCodec = exports.ZodMiniPipe = exports.ZodMiniNaN = exports.ZodMiniCatch = exports.ZodMiniSuccess = exports.ZodMiniNonOptional = exports.ZodMiniPrefault = exports.ZodMiniDefault = exports.ZodMiniNullable = exports.ZodMiniOptional = void 0;
exports.string = string;
exports.email = email;
exports.guid = guid;
@@ -33,6 +33,7 @@ exports.uuidv4 = uuidv4;
exports.uuidv6 = uuidv6;
exports.uuidv7 = uuidv7;
exports.url = url;
exports.httpUrl = httpUrl;
exports.emoji = emoji;
exports.nanoid = nanoid;
exports.cuid = cuid;
@@ -44,11 +45,15 @@ exports.ipv4 = ipv4;
exports.ipv6 = ipv6;
exports.cidrv4 = cidrv4;
exports.cidrv6 = cidrv6;
exports.mac = mac;
exports.base64 = base64;
exports.base64url = base64url;
exports.e164 = e164;
exports.jwt = jwt;
exports.stringFormat = stringFormat;
exports.hostname = hostname;
exports.hex = hex;
exports.hash = hash;
exports.number = number;
exports.int = int;
exports.float32 = float32;
@@ -73,6 +78,7 @@ exports.object = object;
exports.strictObject = strictObject;
exports.looseObject = looseObject;
exports.extend = extend;
exports.safeExtend = safeExtend;
exports.merge = merge;
exports.pick = pick;
exports.omit = omit;
@@ -102,6 +108,7 @@ exports.success = success;
exports.catch = _catch;
exports.nan = nan;
exports.pipe = pipe;
exports.codec = codec;
exports.readonly = readonly;
exports.templateLiteral = templateLiteral;
exports.lazy = _lazy;
@@ -109,8 +116,13 @@ exports.promise = promise;
exports.check = check;
exports.custom = custom;
exports.refine = refine;
exports.superRefine = superRefine;
exports.instanceof = _instanceof;
exports.json = json;
exports._function = _function;
exports.function = _function;
exports._function = _function;
exports.function = _function;
const core = __importStar(require("../core/index.cjs"));
const index_js_1 = require("../core/index.cjs");
const parse = __importStar(require("./parse.cjs"));
@@ -119,6 +131,7 @@ exports.ZodMiniType = core.$constructor("ZodMiniType", (inst, def) => {
throw new Error("Uninitialized schema in ZodMiniType.");
core.$ZodType.init(inst, def);
inst.def = def;
inst.type = def.type;
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 });
@@ -191,6 +204,13 @@ exports.ZodMiniURL = core.$constructor("ZodMiniURL", (inst, def) => {
function url(params) {
return core._url(exports.ZodMiniURL, params);
}
function httpUrl(params) {
return core._url(exports.ZodMiniURL, {
protocol: /^https?$/,
hostname: core.regexes.domain,
...index_js_1.util.normalizeParams(params),
});
}
exports.ZodMiniEmoji = core.$constructor("ZodMiniEmoji", (inst, def) => {
core.$ZodEmoji.init(inst, def);
exports.ZodMiniStringFormat.init(inst, def);
@@ -268,6 +288,13 @@ exports.ZodMiniCIDRv6 = core.$constructor("ZodMiniCIDRv6", (inst, def) => {
function cidrv6(params) {
return core._cidrv6(exports.ZodMiniCIDRv6, params);
}
exports.ZodMiniMAC = core.$constructor("ZodMiniMAC", (inst, def) => {
core.$ZodMAC.init(inst, def);
exports.ZodMiniStringFormat.init(inst, def);
});
function mac(params) {
return core._mac(exports.ZodMiniMAC, params);
}
exports.ZodMiniBase64 = core.$constructor("ZodMiniBase64", (inst, def) => {
core.$ZodBase64.init(inst, def);
exports.ZodMiniStringFormat.init(inst, def);
@@ -303,6 +330,21 @@ exports.ZodMiniCustomStringFormat = core.$constructor("ZodMiniCustomStringFormat
function stringFormat(format, fnOrRegex, _params = {}) {
return core._stringFormat(exports.ZodMiniCustomStringFormat, format, fnOrRegex, _params);
}
function hostname(_params) {
return core._stringFormat(exports.ZodMiniCustomStringFormat, "hostname", core.regexes.hostname, _params);
}
function hex(_params) {
return core._stringFormat(exports.ZodMiniCustomStringFormat, "hex", core.regexes.hex, _params);
}
function hash(alg, params) {
const enc = params?.enc ?? "hex";
const format = `${alg}_${enc}`;
const regex = core.regexes[format];
// check for unrecognized format
if (!regex)
throw new Error(`Unrecognized hash format: ${format}`);
return core._stringFormat(exports.ZodMiniCustomStringFormat, format, regex, params);
}
exports.ZodMiniNumber = core.$constructor("ZodMiniNumber", (inst, def) => {
core.$ZodNumber.init(inst, def);
exports.ZodMiniType.init(inst, def);
@@ -430,7 +472,7 @@ function array(element, params) {
// .keyof
function keyof(schema) {
const shape = schema._zod.def.shape;
return literal(Object.keys(shape));
return _enum(Object.keys(shape));
}
exports.ZodMiniObject = core.$constructor("ZodMiniObject", (inst, def) => {
core.$ZodObject.init(inst, def);
@@ -440,10 +482,7 @@ exports.ZodMiniObject = core.$constructor("ZodMiniObject", (inst, def) => {
function object(shape, params) {
const def = {
type: "object",
get shape() {
index_js_1.util.assignProp(this, "shape", { ...shape });
return this.shape;
},
shape: shape ?? {},
...index_js_1.util.normalizeParams(params),
};
return new exports.ZodMiniObject(def);
@@ -452,11 +491,7 @@ function object(shape, params) {
function strictObject(shape, params) {
return new exports.ZodMiniObject({
type: "object",
// shape: shape as core.$ZodLooseShape,
get shape() {
index_js_1.util.assignProp(this, "shape", { ...shape });
return this.shape;
},
shape,
catchall: never(),
...index_js_1.util.normalizeParams(params),
});
@@ -465,14 +500,7 @@ function strictObject(shape, params) {
function looseObject(shape, params) {
return new exports.ZodMiniObject({
type: "object",
// shape: shape as core.$ZodLooseShape,
get shape() {
index_js_1.util.assignProp(this, "shape", { ...shape });
return this.shape;
},
// get optional() {
// return util.optionalKeys(shape);
// },
shape,
catchall: unknown(),
...index_js_1.util.normalizeParams(params),
});
@@ -481,6 +509,9 @@ function looseObject(shape, params) {
function extend(schema, shape) {
return index_js_1.util.extend(schema, shape);
}
function safeExtend(schema, shape) {
return index_js_1.util.safeExtend(schema, shape);
}
function merge(schema, shape) {
return index_js_1.util.extend(schema, shape);
}
@@ -562,9 +593,11 @@ function record(keyType, valueType, params) {
});
}
function partialRecord(keyType, valueType, params) {
const k = core.clone(keyType);
k._zod.values = undefined;
return new exports.ZodMiniRecord({
type: "record",
keyType: union([keyType, never()]),
keyType: k,
valueType: valueType,
...index_js_1.util.normalizeParams(params),
});
@@ -595,6 +628,7 @@ function set(valueType, params) {
exports.ZodMiniEnum = core.$constructor("ZodMiniEnum", (inst, def) => {
core.$ZodEnum.init(inst, def);
exports.ZodMiniType.init(inst, def);
inst.options = Object.values(def.entries);
});
function _enum(values, params) {
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
@@ -679,7 +713,7 @@ function _default(innerType, defaultValue) {
type: "default",
innerType: innerType,
get defaultValue() {
return typeof defaultValue === "function" ? defaultValue() : defaultValue;
return typeof defaultValue === "function" ? defaultValue() : index_js_1.util.shallowClone(defaultValue);
},
});
}
@@ -692,7 +726,7 @@ function prefault(innerType, defaultValue) {
type: "prefault",
innerType: innerType,
get defaultValue() {
return typeof defaultValue === "function" ? defaultValue() : defaultValue;
return typeof defaultValue === "function" ? defaultValue() : index_js_1.util.shallowClone(defaultValue);
},
});
}
@@ -746,6 +780,19 @@ function pipe(in_, out) {
out: out,
});
}
exports.ZodMiniCodec = core.$constructor("ZodMiniCodec", (inst, def) => {
exports.ZodMiniPipe.init(inst, def);
core.$ZodCodec.init(inst, def);
});
function codec(in_, out, params) {
return new exports.ZodMiniCodec({
type: "pipe",
in: in_,
out: out,
transform: params.decode,
reverseTransform: params.encode,
});
}
exports.ZodMiniReadonly = core.$constructor("ZodMiniReadonly", (inst, def) => {
core.$ZodReadonly.init(inst, def);
exports.ZodMiniType.init(inst, def);
@@ -812,6 +859,13 @@ function custom(fn, _params) {
function refine(fn, _params = {}) {
return core._refine(exports.ZodMiniCustom, fn, _params);
}
// superRefine
function superRefine(fn) {
return core._superRefine(fn);
}
// Re-export describe and meta from core
exports.describe = core.describe;
exports.meta = core.meta;
// instanceof
class Class {
constructor(..._args) { }
@@ -825,10 +879,9 @@ function _instanceof(cls, params = {
}
// stringbool
const stringbool = (...args) => core._stringbool({
Pipe: exports.ZodMiniPipe,
Codec: exports.ZodMiniCodec,
Boolean: exports.ZodMiniBoolean,
String: exports.ZodMiniString,
Transform: exports.ZodMiniTransform,
}, ...args);
exports.stringbool = stringbool;
function json() {
@@ -837,3 +890,14 @@ function json() {
});
return jsonSchema;
}
exports.ZodMiniFunction = core.$constructor("ZodMiniFunction", (inst, def) => {
core.$ZodFunction.init(inst, def);
exports.ZodMiniType.init(inst, def);
});
function _function(params) {
return new exports.ZodMiniFunction({
type: "function",
input: Array.isArray(params?.input) ? tuple(params?.input) : (params?.input ?? array(unknown())),
output: params?.output ?? unknown(),
});
}