gitea push

This commit is contained in:
2026-05-09 12:19:29 -06:00
parent 06113c95b8
commit 429461e985
1481 changed files with 74306 additions and 52475 deletions
+40 -4
View File
@@ -16,7 +16,11 @@ export const ZodMiniType = /*@__PURE__*/ core.$constructor("ZodMiniType", (inst,
...def,
checks: [
...(def.checks ?? []),
...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch),
...checks.map((ch) => typeof ch === "function"
? {
_zod: { check: ch, def: { check: "custom" }, onattach: [] },
}
: ch),
],
}, { parent: true });
};
@@ -90,7 +94,7 @@ export function url(params) {
// @__NO_SIDE_EFFECTS__
export function httpUrl(params) {
return core._url(ZodMiniURL, {
protocol: /^https?$/,
protocol: core.regexes.httpProtocol,
hostname: core.regexes.domain,
...util.normalizeParams(params),
});
@@ -111,10 +115,22 @@ export const ZodMiniNanoID = /*@__PURE__*/ core.$constructor("ZodMiniNanoID", (i
export function nanoid(params) {
return core._nanoid(ZodMiniNanoID, params);
}
/**
* @deprecated CUID v1 is deprecated by its authors due to information leakage
* (timestamps embedded in the id). Use {@link ZodMiniCUID2} instead.
* See https://github.com/paralleldrive/cuid.
*/
export const ZodMiniCUID = /*@__PURE__*/ core.$constructor("ZodMiniCUID", (inst, def) => {
core.$ZodCUID.init(inst, def);
ZodMiniStringFormat.init(inst, def);
});
/**
* Validates a CUID v1 string.
*
* @deprecated CUID v1 is deprecated by its authors due to information leakage
* (timestamps embedded in the id). Use {@link cuid2 | `z.cuid2()`} instead.
* See https://github.com/paralleldrive/cuid.
*/
// @__NO_SIDE_EFFECTS__
export function cuid(params) {
return core._cuid(ZodMiniCUID, params);
@@ -543,6 +559,15 @@ export const ZodMiniRecord = /*@__PURE__*/ core.$constructor("ZodMiniRecord", (i
});
// @__NO_SIDE_EFFECTS__
export function record(keyType, valueType, params) {
// v3-compat: z.record(valueType, params?) — defaults keyType to z.string()
if (!valueType || !valueType._zod) {
return new ZodMiniRecord({
type: "record",
keyType: string(),
valueType: keyType,
...util.normalizeParams(valueType),
});
}
return new ZodMiniRecord({
type: "record",
keyType,
@@ -792,6 +817,17 @@ export function codec(in_, out, params) {
reverseTransform: params.encode,
});
}
// @__NO_SIDE_EFFECTS__
export function invertCodec(codec) {
const def = codec._zod.def;
return new ZodMiniCodec({
type: "pipe",
in: def.out,
out: def.in,
transform: def.reverseTransform,
reverseTransform: def.transform,
});
}
export const ZodMiniReadonly = /*@__PURE__*/ core.$constructor("ZodMiniReadonly", (inst, def) => {
core.$ZodReadonly.init(inst, def);
ZodMiniType.init(inst, def);
@@ -868,8 +904,8 @@ export function refine(fn, _params = {}) {
}
// superRefine
// @__NO_SIDE_EFFECTS__
export function superRefine(fn) {
return core._superRefine(fn);
export function superRefine(fn, params) {
return core._superRefine(fn, params);
}
// Re-export describe and meta from core
export const describe = core.describe;