zod 4.6.1 → 4.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +2 -2
  2. package/package.json +1 -1
  3. package/src/v4/classic/checks.ts +1 -0
  4. package/src/v4/classic/schemas.ts +3 -25
  5. package/src/v4/classic/tests/cyclic-data.test.ts +2 -11
  6. package/src/v4/classic/tests/firstparty.test.ts +0 -4
  7. package/src/v4/classic/tests/instanceof.test.ts +1 -1
  8. package/src/v4/classic/tests/prefault.test.ts +70 -0
  9. package/src/v4/classic/tests/properties.test.ts +34 -137
  10. package/src/v4/core/api.ts +4 -7
  11. package/src/v4/core/checks.ts +61 -1
  12. package/src/v4/core/compile.ts +16 -24
  13. package/src/v4/core/json-schema-processors.ts +0 -50
  14. package/src/v4/core/memoizer.ts +2 -5
  15. package/src/v4/core/schemas.ts +10 -107
  16. package/src/v4/core/to-json-schema.ts +1 -1
  17. package/src/v4/core/util.ts +0 -4
  18. package/src/v4/core/versions.ts +1 -1
  19. package/src/v4/core/visit.ts +0 -11
  20. package/src/v4/mini/checks.ts +1 -0
  21. package/src/v4/mini/schemas.ts +1 -20
  22. package/src/v4/mini/tests/index.test.ts +22 -0
  23. package/v4/classic/checks.cjs +2 -1
  24. package/v4/classic/checks.d.cts +1 -1
  25. package/v4/classic/checks.d.ts +1 -1
  26. package/v4/classic/checks.js +1 -1
  27. package/v4/classic/schemas.cjs +2 -11
  28. package/v4/classic/schemas.d.cts +1 -6
  29. package/v4/classic/schemas.d.ts +1 -6
  30. package/v4/classic/schemas.js +1 -9
  31. package/v4/core/api.cjs +2 -3
  32. package/v4/core/api.d.cts +2 -2
  33. package/v4/core/api.d.ts +2 -2
  34. package/v4/core/api.js +2 -3
  35. package/v4/core/checks.cjs +32 -1
  36. package/v4/core/checks.d.cts +16 -0
  37. package/v4/core/checks.d.ts +16 -0
  38. package/v4/core/checks.js +31 -0
  39. package/v4/core/compile.cjs +12 -17
  40. package/v4/core/compile.js +12 -17
  41. package/v4/core/json-schema-processors.cjs +1 -34
  42. package/v4/core/json-schema-processors.d.cts +0 -1
  43. package/v4/core/json-schema-processors.d.ts +0 -1
  44. package/v4/core/json-schema-processors.js +1 -33
  45. package/v4/core/memoizer.cjs +2 -5
  46. package/v4/core/memoizer.js +2 -5
  47. package/v4/core/schemas.cjs +10 -70
  48. package/v4/core/schemas.d.cts +3 -20
  49. package/v4/core/schemas.d.ts +3 -20
  50. package/v4/core/schemas.js +9 -69
  51. package/v4/core/to-json-schema.cjs +0 -1
  52. package/v4/core/to-json-schema.d.cts +0 -3
  53. package/v4/core/to-json-schema.d.ts +0 -3
  54. package/v4/core/to-json-schema.js +1 -1
  55. package/v4/core/util.cjs +0 -4
  56. package/v4/core/util.js +0 -4
  57. package/v4/core/versions.cjs +1 -1
  58. package/v4/core/versions.js +1 -1
  59. package/v4/core/visit.cjs +0 -12
  60. package/v4/core/visit.js +0 -12
  61. package/v4/mini/checks.cjs +2 -1
  62. package/v4/mini/checks.d.cts +1 -1
  63. package/v4/mini/checks.d.ts +1 -1
  64. package/v4/mini/checks.js +1 -1
  65. package/v4/mini/schemas.cjs +1 -9
  66. package/v4/mini/schemas.d.cts +1 -5
  67. package/v4/mini/schemas.d.ts +1 -5
  68. package/v4/mini/schemas.js +0 -7
@@ -41,7 +41,7 @@ export interface ParsePayload<T = unknown> {
41
41
  }
42
42
  export type CheckFn<T> = (input: ParsePayload<T>) => util.MaybeAsync<void>;
43
43
  export interface $ZodTypeDef {
44
- type: "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "null" | "undefined" | "void" | "never" | "any" | "unknown" | "date" | "object" | "record" | "file" | "array" | "tuple" | "union" | "intersection" | "map" | "set" | "enum" | "literal" | "nullable" | "optional" | "nonoptional" | "success" | "transform" | "default" | "prefault" | "catch" | "nan" | "pipe" | "readonly" | "template_literal" | "promise" | "lazy" | "function" | "custom" | "properties";
44
+ type: "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "null" | "undefined" | "void" | "never" | "any" | "unknown" | "date" | "object" | "record" | "file" | "array" | "tuple" | "union" | "intersection" | "map" | "set" | "enum" | "literal" | "nullable" | "optional" | "nonoptional" | "success" | "transform" | "default" | "prefault" | "catch" | "nan" | "pipe" | "readonly" | "template_literal" | "promise" | "lazy" | "function" | "custom";
45
45
  error?: errors.$ZodErrorMap<never> | undefined;
46
46
  checks?: checks.$ZodCheck<never>[];
47
47
  }
@@ -1010,7 +1010,7 @@ export interface $ZodPrefaultDef<T extends SomeType = $ZodType> extends $ZodType
1010
1010
  /** The default value. May be a getter. */
1011
1011
  defaultValue: core.input<T>;
1012
1012
  }
1013
- export interface $ZodPrefaultInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<util.NoUndefined<core.output<T>>, core.input<T> | undefined> {
1013
+ export interface $ZodPrefaultInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<core.output<T>, core.input<T> | undefined> {
1014
1014
  def: $ZodPrefaultDef<T>;
1015
1015
  optin: "defaulted";
1016
1016
  optout?: "optional" | undefined;
@@ -1267,22 +1267,5 @@ export interface $ZodCustom<O = unknown, I = unknown> extends $ZodType {
1267
1267
  _zod: $ZodCustomInternals<O, I>;
1268
1268
  }
1269
1269
  export declare const $ZodCustom: core.$constructor<$ZodCustom>;
1270
- export interface $ZodPropertiesDef<Shape extends $ZodShape = $ZodShape> extends $ZodTypeDef, checks.$ZodCheckDef {
1271
- type: "properties";
1272
- check: "properties";
1273
- shape: Shape;
1274
- }
1275
- export interface $ZodPropertiesInternals<Shape extends $ZodShape = $ZodShape> extends $ZodTypeInternals<$InferObjectInput<Shape, {}>, $InferObjectInput<Shape, {}>>, checks.$ZodCheckInternals<{
1276
- -readonly [k in keyof Shape]: util.Widen<core.input<Shape[k]>>;
1277
- }> {
1278
- def: $ZodPropertiesDef<Shape>;
1279
- isst: errors.$ZodIssueInvalidType;
1280
- issc: errors.$ZodIssue;
1281
- }
1282
- export interface $ZodProperties<Shape extends $ZodShape = $ZodShape> extends $ZodType {
1283
- _zod: $ZodPropertiesInternals<Shape>;
1284
- [Symbol.iterator](): Iterator<this>;
1285
- }
1286
- export declare const $ZodProperties: core.$constructor<$ZodProperties>;
1287
- export type $ZodTypes = $ZodString | $ZodNumber | $ZodBigInt | $ZodBoolean | $ZodDate | $ZodSymbol | $ZodUndefined | $ZodNullable | $ZodNull | $ZodAny | $ZodUnknown | $ZodNever | $ZodVoid | $ZodArray | $ZodObject | $ZodUnion | $ZodIntersection | $ZodTuple | $ZodRecord | $ZodMap | $ZodSet | $ZodLiteral | $ZodEnum | $ZodFunction | $ZodPromise | $ZodLazy | $ZodOptional | $ZodDefault | $ZodPrefault | $ZodTemplateLiteral | $ZodCustom | $ZodProperties | $ZodTransform | $ZodNonOptional | $ZodReadonly | $ZodNaN | $ZodPipe | $ZodSuccess | $ZodCatch | $ZodFile;
1270
+ export type $ZodTypes = $ZodString | $ZodNumber | $ZodBigInt | $ZodBoolean | $ZodDate | $ZodSymbol | $ZodUndefined | $ZodNullable | $ZodNull | $ZodAny | $ZodUnknown | $ZodNever | $ZodVoid | $ZodArray | $ZodObject | $ZodUnion | $ZodIntersection | $ZodTuple | $ZodRecord | $ZodMap | $ZodSet | $ZodLiteral | $ZodEnum | $ZodFunction | $ZodPromise | $ZodLazy | $ZodOptional | $ZodDefault | $ZodPrefault | $ZodTemplateLiteral | $ZodCustom | $ZodTransform | $ZodNonOptional | $ZodReadonly | $ZodNaN | $ZodPipe | $ZodSuccess | $ZodCatch | $ZodFile;
1288
1271
  export type $ZodStringFormatTypes = $ZodGUID | $ZodUUID | $ZodEmail | $ZodURL | $ZodEmoji | $ZodNanoID | $ZodCUID | $ZodCUID2 | $ZodULID | $ZodXID | $ZodKSUID | $ZodISODateTime | $ZodISODate | $ZodISOTime | $ZodISODuration | $ZodIPv4 | $ZodIPv6 | $ZodMAC | $ZodCIDRv4 | $ZodCIDRv6 | $ZodBase64 | $ZodBase64URL | $ZodE164 | $ZodCreditCard | $ZodIBAN | $ZodJWT | $ZodCustomStringFormat<"hex"> | $ZodCustomStringFormat<util.HashFormat> | $ZodCustomStringFormat<"hostname">;
@@ -41,7 +41,7 @@ export interface ParsePayload<T = unknown> {
41
41
  }
42
42
  export type CheckFn<T> = (input: ParsePayload<T>) => util.MaybeAsync<void>;
43
43
  export interface $ZodTypeDef {
44
- type: "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "null" | "undefined" | "void" | "never" | "any" | "unknown" | "date" | "object" | "record" | "file" | "array" | "tuple" | "union" | "intersection" | "map" | "set" | "enum" | "literal" | "nullable" | "optional" | "nonoptional" | "success" | "transform" | "default" | "prefault" | "catch" | "nan" | "pipe" | "readonly" | "template_literal" | "promise" | "lazy" | "function" | "custom" | "properties";
44
+ type: "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "null" | "undefined" | "void" | "never" | "any" | "unknown" | "date" | "object" | "record" | "file" | "array" | "tuple" | "union" | "intersection" | "map" | "set" | "enum" | "literal" | "nullable" | "optional" | "nonoptional" | "success" | "transform" | "default" | "prefault" | "catch" | "nan" | "pipe" | "readonly" | "template_literal" | "promise" | "lazy" | "function" | "custom";
45
45
  error?: errors.$ZodErrorMap<never> | undefined;
46
46
  checks?: checks.$ZodCheck<never>[];
47
47
  }
@@ -1010,7 +1010,7 @@ export interface $ZodPrefaultDef<T extends SomeType = $ZodType> extends $ZodType
1010
1010
  /** The default value. May be a getter. */
1011
1011
  defaultValue: core.input<T>;
1012
1012
  }
1013
- export interface $ZodPrefaultInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<util.NoUndefined<core.output<T>>, core.input<T> | undefined> {
1013
+ export interface $ZodPrefaultInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<core.output<T>, core.input<T> | undefined> {
1014
1014
  def: $ZodPrefaultDef<T>;
1015
1015
  optin: "defaulted";
1016
1016
  optout?: "optional" | undefined;
@@ -1267,22 +1267,5 @@ export interface $ZodCustom<O = unknown, I = unknown> extends $ZodType {
1267
1267
  _zod: $ZodCustomInternals<O, I>;
1268
1268
  }
1269
1269
  export declare const $ZodCustom: core.$constructor<$ZodCustom>;
1270
- export interface $ZodPropertiesDef<Shape extends $ZodShape = $ZodShape> extends $ZodTypeDef, checks.$ZodCheckDef {
1271
- type: "properties";
1272
- check: "properties";
1273
- shape: Shape;
1274
- }
1275
- export interface $ZodPropertiesInternals<Shape extends $ZodShape = $ZodShape> extends $ZodTypeInternals<$InferObjectInput<Shape, {}>, $InferObjectInput<Shape, {}>>, checks.$ZodCheckInternals<{
1276
- -readonly [k in keyof Shape]: util.Widen<core.input<Shape[k]>>;
1277
- }> {
1278
- def: $ZodPropertiesDef<Shape>;
1279
- isst: errors.$ZodIssueInvalidType;
1280
- issc: errors.$ZodIssue;
1281
- }
1282
- export interface $ZodProperties<Shape extends $ZodShape = $ZodShape> extends $ZodType {
1283
- _zod: $ZodPropertiesInternals<Shape>;
1284
- [Symbol.iterator](): Iterator<this>;
1285
- }
1286
- export declare const $ZodProperties: core.$constructor<$ZodProperties>;
1287
- export type $ZodTypes = $ZodString | $ZodNumber | $ZodBigInt | $ZodBoolean | $ZodDate | $ZodSymbol | $ZodUndefined | $ZodNullable | $ZodNull | $ZodAny | $ZodUnknown | $ZodNever | $ZodVoid | $ZodArray | $ZodObject | $ZodUnion | $ZodIntersection | $ZodTuple | $ZodRecord | $ZodMap | $ZodSet | $ZodLiteral | $ZodEnum | $ZodFunction | $ZodPromise | $ZodLazy | $ZodOptional | $ZodDefault | $ZodPrefault | $ZodTemplateLiteral | $ZodCustom | $ZodProperties | $ZodTransform | $ZodNonOptional | $ZodReadonly | $ZodNaN | $ZodPipe | $ZodSuccess | $ZodCatch | $ZodFile;
1270
+ export type $ZodTypes = $ZodString | $ZodNumber | $ZodBigInt | $ZodBoolean | $ZodDate | $ZodSymbol | $ZodUndefined | $ZodNullable | $ZodNull | $ZodAny | $ZodUnknown | $ZodNever | $ZodVoid | $ZodArray | $ZodObject | $ZodUnion | $ZodIntersection | $ZodTuple | $ZodRecord | $ZodMap | $ZodSet | $ZodLiteral | $ZodEnum | $ZodFunction | $ZodPromise | $ZodLazy | $ZodOptional | $ZodDefault | $ZodPrefault | $ZodTemplateLiteral | $ZodCustom | $ZodTransform | $ZodNonOptional | $ZodReadonly | $ZodNaN | $ZodPipe | $ZodSuccess | $ZodCatch | $ZodFile;
1288
1271
  export type $ZodStringFormatTypes = $ZodGUID | $ZodUUID | $ZodEmail | $ZodURL | $ZodEmoji | $ZodNanoID | $ZodCUID | $ZodCUID2 | $ZodULID | $ZodXID | $ZodKSUID | $ZodISODateTime | $ZodISODate | $ZodISOTime | $ZodISODuration | $ZodIPv4 | $ZodIPv6 | $ZodMAC | $ZodCIDRv4 | $ZodCIDRv6 | $ZodBase64 | $ZodBase64URL | $ZodE164 | $ZodCreditCard | $ZodIBAN | $ZodJWT | $ZodCustomStringFormat<"hex"> | $ZodCustomStringFormat<util.HashFormat> | $ZodCustomStringFormat<"hostname">;
@@ -869,7 +869,7 @@ function handlePropertyResult(result, final, key, input, optin, optout) {
869
869
  return;
870
870
  }
871
871
  if (result.value === undefined) {
872
- if (isPresent) {
872
+ if (isPresent || (optin === "defaulted" && !isOptionalOut)) {
873
873
  final.value[key] = undefined;
874
874
  }
875
875
  }
@@ -1124,16 +1124,17 @@ export const $ZodObjectJIT = /*@__PURE__*/ core.$constructor("$ZodObjectJIT", (i
1124
1124
  doc.write(`
1125
1125
  if (${id}.issues.length) {${prefixStr(id, k)}
1126
1126
  }
1127
-
1128
- if (${id}.value === undefined) {
1129
- if (${isPresent}) {
1130
- newResult[${k}] = undefined;
1131
- }
1132
- } else {
1127
+ `);
1128
+ if (optin === "defaulted") {
1129
+ doc.write(`newResult[${k}] = ${id}.value;`);
1130
+ }
1131
+ else {
1132
+ doc.write(`
1133
+ if (${id}.value !== undefined || ${isPresent}) {
1133
1134
  newResult[${k}] = ${id}.value;
1134
1135
  }
1135
-
1136
1136
  `);
1137
+ }
1137
1138
  }
1138
1139
  }
1139
1140
  doc.write(`payload.value = newResult;`);
@@ -2584,64 +2585,3 @@ function handleRefineResult(result, payload, input, inst) {
2584
2585
  payload.issues.push(util.issue(_iss));
2585
2586
  }
2586
2587
  }
2587
- // asserts in place: the child result's value is discarded, matching z.property(), because a nested object or array schema rebuilds its output even when nothing transformed
2588
- function handlePropertiesResult(result, payload, key) {
2589
- if (result.issues.length) {
2590
- payload.issues.push(...util.prefixIssues(key, result.issues));
2591
- }
2592
- }
2593
- export const $ZodProperties = /*@__PURE__*/ core.$constructor("$ZodProperties", (inst, def) => {
2594
- // $ZodType.init prepends an instance that already carries the $ZodCheck trait to its own `checks`, which would run the shape a second time and cost the parse context. Initializing the check trait after it keeps the schema role in `parse`, where the context arrives.
2595
- $ZodType.init(inst, def);
2596
- checks.$ZodCheck.init(inst, def);
2597
- const memo = core.globalConfig.memoizer;
2598
- memo?.attach(inst);
2599
- // key and schema snapshotted together: reading one live and the other cached lets a later mutation of the caller's shape object pair a stale key with a missing schema
2600
- let entries;
2601
- const runShape = (payload, ctx) => {
2602
- entries ?? (entries = Reflect.ownKeys(def.shape).map((key) => [key, def.shape[key]]));
2603
- const input = payload.value;
2604
- let proms;
2605
- for (const [key, schema] of entries) {
2606
- const result = schema._zod.run({ value: input[key], issues: [] }, ctx);
2607
- if (result instanceof Promise) {
2608
- proms ?? (proms = []);
2609
- proms.push(result.then((result) => handlePropertiesResult(result, payload, key)));
2610
- }
2611
- else {
2612
- handlePropertiesResult(result, payload, key);
2613
- }
2614
- }
2615
- if (proms)
2616
- return Promise.all(proms).then(() => undefined);
2617
- return undefined;
2618
- };
2619
- inst._zod.parse = (payload, ctx) => {
2620
- const input = payload.value;
2621
- // as a schema this is the type gate, and it infers an object shape, so a primitive is a type error. A function passes: its properties read like any other object's, and z.instanceof allows one.
2622
- if (input === null || (typeof input !== "object" && typeof input !== "function")) {
2623
- payload.issues.push({ expected: "object", code: "invalid_type", input, inst });
2624
- return payload;
2625
- }
2626
- // both sides declare the shape's input type, so the assertion runs forward in either direction; encoding the children backward would reject the very type this schema claims to take
2627
- if (ctx.direction === "backward")
2628
- ctx = { ...ctx, direction: "forward" };
2629
- // the input is its own output here, so it registers as its own memo entry: a cycle re-entering this node hits the bucket instead of recursing forever
2630
- if (memo)
2631
- memo.alloc(inst, payload, input, ctx);
2632
- const result = runShape(payload, ctx);
2633
- return result instanceof Promise ? result.then(() => payload) : payload;
2634
- };
2635
- // as a check the base schema already typed the value, so this only asserts the properties — which read on a primitive too, matching z.property() on a string's length. It gets no context of its own, so a cycle through a spread schema is not tracked.
2636
- inst._zod.check = (payload) => {
2637
- if (payload.value == null) {
2638
- payload.issues.push({ expected: "object", code: "invalid_type", input: payload.value, inst });
2639
- return undefined;
2640
- }
2641
- return runShape(payload, {});
2642
- };
2643
- }, {
2644
- *[Symbol.iterator]() {
2645
- yield this;
2646
- },
2647
- });
@@ -9,7 +9,6 @@ exports.processSchema = processSchema;
9
9
  exports.process = processSchema;
10
10
  exports.extractDefs = extractDefs;
11
11
  exports.finalize = finalize;
12
- exports.isTransforming = isTransforming;
13
12
  const registries_js_1 = require("./registries.cjs");
14
13
  const util_js_1 = require("./util.cjs");
15
14
  function assignProps(target, ...sources) {
@@ -137,9 +137,6 @@ export declare function processSchema<T extends schemas.$ZodType>(schema: T, ctx
137
137
  export { processSchema as process };
138
138
  export declare function extractDefs<T extends schemas.$ZodType>(ctx: ToJSONSchemaContext, schema: T): void;
139
139
  export declare function finalize<T extends schemas.$ZodType>(ctx: ToJSONSchemaContext, schema: T): ZodStandardJSONSchemaPayload<T>;
140
- export declare function isTransforming(_schema: schemas.$ZodType, _ctx?: {
141
- seen: Set<schemas.$ZodType>;
142
- }): boolean;
143
140
  export type ZodStandardSchemaWithJSON<T> = StandardSchemaWithJSONProps<core.input<T>, core.output<T>>;
144
141
  export interface ZodStandardJSONSchemaPayload<T> extends JSONSchema.BaseSchema {
145
142
  "~standard": ZodStandardSchemaWithJSON<T>;
@@ -137,9 +137,6 @@ export declare function processSchema<T extends schemas.$ZodType>(schema: T, ctx
137
137
  export { processSchema as process };
138
138
  export declare function extractDefs<T extends schemas.$ZodType>(ctx: ToJSONSchemaContext, schema: T): void;
139
139
  export declare function finalize<T extends schemas.$ZodType>(ctx: ToJSONSchemaContext, schema: T): ZodStandardJSONSchemaPayload<T>;
140
- export declare function isTransforming(_schema: schemas.$ZodType, _ctx?: {
141
- seen: Set<schemas.$ZodType>;
142
- }): boolean;
143
140
  export type ZodStandardSchemaWithJSON<T> = StandardSchemaWithJSONProps<core.input<T>, core.output<T>>;
144
141
  export interface ZodStandardJSONSchemaPayload<T> extends JSONSchema.BaseSchema {
145
142
  "~standard": ZodStandardSchemaWithJSON<T>;
@@ -572,7 +572,7 @@ export function finalize(ctx, schema) {
572
572
  throw new Error("Error converting schema to JSON.");
573
573
  }
574
574
  }
575
- export function isTransforming(_schema, _ctx) {
575
+ function isTransforming(_schema, _ctx) {
576
576
  const ctx = _ctx ?? { seen: new Set() };
577
577
  if (ctx.seen.has(_schema))
578
578
  return false;
package/v4/core/util.cjs CHANGED
@@ -796,10 +796,6 @@ function members(proto, table) {
796
796
  else
797
797
  defineBound(proto, key, desc.value);
798
798
  }
799
- // for..in sees no symbol keys, so well-known members like Symbol.iterator install here
800
- for (const sym of Object.getOwnPropertySymbols(table)) {
801
- defineBound(proto, sym, table[sym]);
802
- }
803
799
  }
804
800
  /** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */
805
801
  function own(inst, key, value, enumerable = true) {
package/v4/core/util.js CHANGED
@@ -725,10 +725,6 @@ export function members(proto, table) {
725
725
  else
726
726
  defineBound(proto, key, desc.value);
727
727
  }
728
- // for..in sees no symbol keys, so well-known members like Symbol.iterator install here
729
- for (const sym of Object.getOwnPropertySymbols(table)) {
730
- defineBound(proto, sym, table[sym]);
731
- }
732
728
  }
733
729
  /** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */
734
730
  export function own(inst, key, value, enumerable = true) {
@@ -4,7 +4,7 @@ exports.version = void 0;
4
4
  exports.version = {
5
5
  major: 4,
6
6
  minor: 6,
7
- patch: 1,
7
+ patch: 3,
8
8
  };
9
9
 
10
10
  // seal-cjs-exports
@@ -1,5 +1,5 @@
1
1
  export const version = {
2
2
  major: 4,
3
3
  minor: 6,
4
- patch: 1,
4
+ patch: 3,
5
5
  };
package/v4/core/visit.cjs CHANGED
@@ -161,18 +161,6 @@ function visit(schema, fnOrHandlers) {
161
161
  const { _cachedInner, ...rest } = def;
162
162
  return (0, util_js_1.clone)(s, { ...rest, getter: () => run(original()) });
163
163
  }
164
- case "properties": {
165
- const oldShape = def.shape;
166
- let changed = false;
167
- const newShape = {};
168
- for (const k of Reflect.ownKeys(oldShape)) {
169
- const mapped = run(oldShape[k]);
170
- if (mapped !== oldShape[k])
171
- changed = true;
172
- newShape[k] = mapped;
173
- }
174
- return changed ? (0, util_js_1.clone)(s, { ...def, shape: newShape }) : s;
175
- }
176
164
  // A leaf by choice: `parts` are regex fragments, not data positions.
177
165
  case "template_literal":
178
166
  // Leaves.
package/v4/core/visit.js CHANGED
@@ -135,18 +135,6 @@ export function visit(schema, fnOrHandlers) {
135
135
  const { _cachedInner, ...rest } = def;
136
136
  return clone(s, { ...rest, getter: () => run(original()) });
137
137
  }
138
- case "properties": {
139
- const oldShape = def.shape;
140
- let changed = false;
141
- const newShape = {};
142
- for (const k of Reflect.ownKeys(oldShape)) {
143
- const mapped = run(oldShape[k]);
144
- if (mapped !== oldShape[k])
145
- changed = true;
146
- newShape[k] = mapped;
147
- }
148
- return changed ? clone(s, { ...def, shape: newShape }) : s;
149
- }
150
138
  // A leaf by choice: `parts` are regex fragments, not data positions.
151
139
  case "template_literal":
152
140
  // Leaves.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toUpperCase = exports.toLowerCase = exports.trim = exports.normalize = exports.overwrite = exports.mime = exports.property = exports.endsWith = exports.startsWith = exports.includes = exports.uppercase = exports.lowercase = exports.regex = exports.length = exports.minLength = exports.maxLength = exports.size = exports.minSize = exports.maxSize = exports.multipleOf = exports.nonnegative = exports.nonpositive = exports.negative = exports.positive = exports.minimum = exports.gte = exports.gt = exports.maximum = exports.lte = exports.lt = void 0;
3
+ exports.toUpperCase = exports.toLowerCase = exports.trim = exports.normalize = exports.overwrite = exports.mime = exports.properties = exports.property = exports.endsWith = exports.startsWith = exports.includes = exports.uppercase = exports.lowercase = exports.regex = exports.length = exports.minLength = exports.maxLength = exports.size = exports.minSize = exports.maxSize = exports.multipleOf = exports.nonnegative = exports.nonpositive = exports.negative = exports.positive = exports.minimum = exports.gte = exports.gt = exports.maximum = exports.lte = exports.lt = void 0;
4
4
  var index_js_1 = require("../core/index.cjs");
5
5
  Object.defineProperty(exports, "lt", { enumerable: true, get: function () { return index_js_1._lt; } });
6
6
  Object.defineProperty(exports, "lte", { enumerable: true, get: function () { return index_js_1._lte; } });
@@ -26,6 +26,7 @@ Object.defineProperty(exports, "includes", { enumerable: true, get: function ()
26
26
  Object.defineProperty(exports, "startsWith", { enumerable: true, get: function () { return index_js_1._startsWith; } });
27
27
  Object.defineProperty(exports, "endsWith", { enumerable: true, get: function () { return index_js_1._endsWith; } });
28
28
  Object.defineProperty(exports, "property", { enumerable: true, get: function () { return index_js_1._property; } });
29
+ Object.defineProperty(exports, "properties", { enumerable: true, get: function () { return index_js_1._properties; } });
29
30
  Object.defineProperty(exports, "mime", { enumerable: true, get: function () { return index_js_1._mime; } });
30
31
  Object.defineProperty(exports, "overwrite", { enumerable: true, get: function () { return index_js_1._overwrite; } });
31
32
  Object.defineProperty(exports, "normalize", { enumerable: true, get: function () { return index_js_1._normalize; } });
@@ -1 +1 @@
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 "../core/index.cjs";
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, _properties as properties, _mime as mime, _overwrite as overwrite, _normalize as normalize, _trim as trim, _toLowerCase as toLowerCase, _toUpperCase as toUpperCase, } from "../core/index.cjs";
@@ -1 +1 @@
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 "../core/index.js";
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, _properties as properties, _mime as mime, _overwrite as overwrite, _normalize as normalize, _trim as trim, _toLowerCase as toLowerCase, _toUpperCase as toUpperCase, } from "../core/index.js";
package/v4/mini/checks.js CHANGED
@@ -1 +1 @@
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 "../core/index.js";
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, _properties as properties, _mime as mime, _overwrite as overwrite, _normalize as normalize, _trim as trim, _toLowerCase as toLowerCase, _toUpperCase as toUpperCase, } from "../core/index.js";
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.ZodMiniEnum = exports.ZodMiniSet = exports.ZodMiniMap = exports.ZodMiniRecord = exports.ZodMiniTuple = exports.ZodMiniIntersection = exports.ZodMiniDiscriminatedUnion = exports.ZodMiniXor = 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.ZodMiniIBAN = exports.ZodMiniCreditCard = 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;
27
- exports.ZodMiniFunction = exports.stringbool = exports.meta = exports.describe = exports.ZodMiniProperties = 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.ZodMiniExactOptional = exports.ZodMiniOptional = exports.ZodMiniTransform = exports.ZodMiniFile = exports.ZodMiniLiteral = void 0;
27
+ 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.ZodMiniExactOptional = exports.ZodMiniOptional = exports.ZodMiniTransform = exports.ZodMiniFile = exports.ZodMiniLiteral = void 0;
28
28
  exports.string = string;
29
29
  exports.email = email;
30
30
  exports.guid = guid;
@@ -120,7 +120,6 @@ exports.readonly = readonly;
120
120
  exports.templateLiteral = templateLiteral;
121
121
  exports.lazy = _lazy;
122
122
  exports.promise = promise;
123
- exports.properties = properties;
124
123
  exports.check = check;
125
124
  exports.custom = custom;
126
125
  exports.refine = refine;
@@ -1045,13 +1044,6 @@ exports.ZodMiniCustom = core.$constructor("ZodMiniCustom", (inst, def) => {
1045
1044
  core.$ZodCustom.init(inst, def);
1046
1045
  exports.ZodMiniType.init(inst, def);
1047
1046
  });
1048
- exports.ZodMiniProperties = core.$constructor("ZodMiniProperties", (inst, def) => {
1049
- core.$ZodProperties.init(inst, def);
1050
- exports.ZodMiniType.init(inst, def);
1051
- });
1052
- function properties(shape, params) {
1053
- return core._properties(exports.ZodMiniProperties, shape, params);
1054
- }
1055
1047
  // custom checks
1056
1048
  // @__NO_SIDE_EFFECTS__
1057
1049
  function check(fn, params) {
@@ -367,7 +367,7 @@ export declare function _default<T extends SomeType>(innerType: T, defaultValue:
367
367
  export interface ZodMiniPrefault<T extends SomeType = core.$ZodType> extends _ZodMiniType<core.$ZodPrefaultInternals<T>> {
368
368
  }
369
369
  export declare const ZodMiniPrefault: core.$constructor<ZodMiniPrefault>;
370
- export declare function prefault<T extends SomeType>(innerType: T, defaultValue: util.NoUndefined<core.input<T>> | (() => util.NoUndefined<core.input<T>>)): ZodMiniPrefault<T>;
370
+ export declare function prefault<T extends SomeType>(innerType: T, defaultValue: core.input<T> | (() => core.input<T>)): ZodMiniPrefault<T>;
371
371
  export interface ZodMiniNonOptional<T extends SomeType = core.$ZodType> extends _ZodMiniType<core.$ZodNonOptionalInternals<T>> {
372
372
  }
373
373
  export declare const ZodMiniNonOptional: core.$constructor<ZodMiniNonOptional>;
@@ -419,10 +419,6 @@ export declare function promise<T extends SomeType>(innerType: T): ZodMiniPromis
419
419
  export interface ZodMiniCustom<O = unknown, I = unknown> extends _ZodMiniType<core.$ZodCustomInternals<O, I>> {
420
420
  }
421
421
  export declare const ZodMiniCustom: core.$constructor<ZodMiniCustom>;
422
- export interface ZodMiniProperties<Shape extends core.$ZodShape = core.$ZodShape> extends _ZodMiniType<core.$ZodPropertiesInternals<Shape>>, core.$ZodProperties<Shape> {
423
- }
424
- export declare const ZodMiniProperties: core.$constructor<ZodMiniProperties>;
425
- export declare function properties<Shape extends core.$ZodShape>(shape: Shape, params?: string | core.$ZodPropertiesParams): ZodMiniProperties<Shape>;
426
422
  export declare function check<O = unknown>(fn: core.CheckFn<O>, params?: string | core.$ZodCustomParams): core.$ZodCheck<O>;
427
423
  export declare function custom<O = unknown, I = O>(fn?: (data: O) => unknown, _params?: string | core.$ZodCustomParams | undefined): ZodMiniCustom<O, I>;
428
424
  export declare function refine<T>(fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>, _params?: string | core.$ZodCustomParams): core.$ZodCheck<T>;
@@ -367,7 +367,7 @@ export declare function _default<T extends SomeType>(innerType: T, defaultValue:
367
367
  export interface ZodMiniPrefault<T extends SomeType = core.$ZodType> extends _ZodMiniType<core.$ZodPrefaultInternals<T>> {
368
368
  }
369
369
  export declare const ZodMiniPrefault: core.$constructor<ZodMiniPrefault>;
370
- export declare function prefault<T extends SomeType>(innerType: T, defaultValue: util.NoUndefined<core.input<T>> | (() => util.NoUndefined<core.input<T>>)): ZodMiniPrefault<T>;
370
+ export declare function prefault<T extends SomeType>(innerType: T, defaultValue: core.input<T> | (() => core.input<T>)): ZodMiniPrefault<T>;
371
371
  export interface ZodMiniNonOptional<T extends SomeType = core.$ZodType> extends _ZodMiniType<core.$ZodNonOptionalInternals<T>> {
372
372
  }
373
373
  export declare const ZodMiniNonOptional: core.$constructor<ZodMiniNonOptional>;
@@ -419,10 +419,6 @@ export declare function promise<T extends SomeType>(innerType: T): ZodMiniPromis
419
419
  export interface ZodMiniCustom<O = unknown, I = unknown> extends _ZodMiniType<core.$ZodCustomInternals<O, I>> {
420
420
  }
421
421
  export declare const ZodMiniCustom: core.$constructor<ZodMiniCustom>;
422
- export interface ZodMiniProperties<Shape extends core.$ZodShape = core.$ZodShape> extends _ZodMiniType<core.$ZodPropertiesInternals<Shape>>, core.$ZodProperties<Shape> {
423
- }
424
- export declare const ZodMiniProperties: core.$constructor<ZodMiniProperties>;
425
- export declare function properties<Shape extends core.$ZodShape>(shape: Shape, params?: string | core.$ZodPropertiesParams): ZodMiniProperties<Shape>;
426
422
  export declare function check<O = unknown>(fn: core.CheckFn<O>, params?: string | core.$ZodCustomParams): core.$ZodCheck<O>;
427
423
  export declare function custom<O = unknown, I = O>(fn?: (data: O) => unknown, _params?: string | core.$ZodCustomParams | undefined): ZodMiniCustom<O, I>;
428
424
  export declare function refine<T>(fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>, _params?: string | core.$ZodCustomParams): core.$ZodCheck<T>;
@@ -918,13 +918,6 @@ export const ZodMiniCustom = /*@__PURE__*/ core.$constructor("ZodMiniCustom", (i
918
918
  core.$ZodCustom.init(inst, def);
919
919
  ZodMiniType.init(inst, def);
920
920
  });
921
- export const ZodMiniProperties = /*@__PURE__*/ core.$constructor("ZodMiniProperties", (inst, def) => {
922
- core.$ZodProperties.init(inst, def);
923
- ZodMiniType.init(inst, def);
924
- });
925
- export function properties(shape, params) {
926
- return core._properties(ZodMiniProperties, shape, params);
927
- }
928
921
  // custom checks
929
922
  // @__NO_SIDE_EFFECTS__
930
923
  export function check(fn, params) {