zod 4.1.0-canary.20250821T014930 → 4.1.0-canary.20250823T071040

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 (158) hide show
  1. package/index.cjs +17 -7
  2. package/package.json +1 -1
  3. package/src/v4/classic/external.ts +0 -1
  4. package/src/v4/classic/parse.ts +49 -0
  5. package/src/v4/classic/schemas.ts +145 -7
  6. package/src/v4/classic/tests/catch.test.ts +25 -0
  7. package/src/v4/classic/tests/codec-examples.test.ts +538 -0
  8. package/src/v4/classic/tests/codec.test.ts +532 -0
  9. package/src/v4/classic/tests/continuability.test.ts +1 -1
  10. package/src/v4/classic/tests/default.test.ts +32 -0
  11. package/src/v4/classic/tests/firstparty.test.ts +4 -0
  12. package/src/v4/classic/tests/function.test.ts +31 -31
  13. package/src/v4/classic/tests/hash.test.ts +68 -0
  14. package/src/v4/classic/tests/nonoptional.test.ts +15 -0
  15. package/src/v4/classic/tests/object.test.ts +31 -0
  16. package/src/v4/classic/tests/pipe.test.ts +25 -5
  17. package/src/v4/classic/tests/prefault.test.ts +25 -0
  18. package/src/v4/classic/tests/preprocess.test.ts +1 -6
  19. package/src/v4/classic/tests/refine.test.ts +76 -3
  20. package/src/v4/classic/tests/string-formats.test.ts +16 -0
  21. package/src/v4/classic/tests/string.test.ts +82 -1
  22. package/src/v4/classic/tests/stringbool.test.ts +40 -0
  23. package/src/v4/classic/tests/template-literal.test.ts +1 -1
  24. package/src/v4/classic/tests/to-json-schema.test.ts +21 -2
  25. package/src/v4/classic/tests/transform.test.ts +7 -0
  26. package/src/v4/classic/tests/union.test.ts +1 -1
  27. package/src/v4/core/api.ts +25 -35
  28. package/src/v4/core/core.ts +7 -26
  29. package/src/v4/core/index.ts +0 -1
  30. package/src/v4/core/json-schema.ts +1 -0
  31. package/src/v4/core/parse.ts +101 -0
  32. package/src/v4/core/regexes.ts +40 -1
  33. package/src/v4/core/schemas.ts +521 -129
  34. package/src/v4/core/to-json-schema.ts +43 -8
  35. package/src/v4/core/util.ts +73 -0
  36. package/src/v4/mini/external.ts +0 -1
  37. package/src/v4/mini/parse.ts +14 -1
  38. package/src/v4/mini/schemas.ts +153 -12
  39. package/src/v4/mini/tests/codec.test.ts +499 -0
  40. package/src/v4/mini/tests/object.test.ts +9 -0
  41. package/src/v4/mini/tests/string.test.ts +16 -0
  42. package/v3/index.cjs +17 -7
  43. package/v4/classic/coerce.cjs +17 -7
  44. package/v4/classic/compat.cjs +17 -7
  45. package/v4/classic/errors.cjs +17 -7
  46. package/v4/classic/external.cjs +18 -9
  47. package/v4/classic/external.d.cts +1 -1
  48. package/v4/classic/external.d.ts +1 -1
  49. package/v4/classic/external.js +1 -1
  50. package/v4/classic/index.cjs +17 -7
  51. package/v4/classic/iso.cjs +17 -7
  52. package/v4/classic/parse.cjs +27 -8
  53. package/v4/classic/parse.d.cts +8 -0
  54. package/v4/classic/parse.d.ts +8 -0
  55. package/v4/classic/parse.js +9 -0
  56. package/v4/classic/schemas.cjs +76 -11
  57. package/v4/classic/schemas.d.cts +48 -2
  58. package/v4/classic/schemas.d.ts +48 -2
  59. package/v4/classic/schemas.js +51 -3
  60. package/v4/core/api.cjs +36 -35
  61. package/v4/core/api.d.cts +3 -4
  62. package/v4/core/api.d.ts +3 -4
  63. package/v4/core/api.js +19 -24
  64. package/v4/core/checks.cjs +17 -7
  65. package/v4/core/core.cjs +8 -1
  66. package/v4/core/core.d.cts +3 -0
  67. package/v4/core/core.d.ts +3 -0
  68. package/v4/core/core.js +6 -0
  69. package/v4/core/errors.cjs +17 -7
  70. package/v4/core/index.cjs +17 -8
  71. package/v4/core/index.d.cts +0 -1
  72. package/v4/core/index.d.ts +0 -1
  73. package/v4/core/index.js +0 -1
  74. package/v4/core/json-schema.d.cts +1 -0
  75. package/v4/core/json-schema.d.ts +1 -0
  76. package/v4/core/parse.cjs +62 -8
  77. package/v4/core/parse.d.cts +24 -0
  78. package/v4/core/parse.d.ts +24 -0
  79. package/v4/core/parse.js +36 -0
  80. package/v4/core/regexes.cjs +34 -2
  81. package/v4/core/regexes.d.cts +16 -0
  82. package/v4/core/regexes.d.ts +16 -0
  83. package/v4/core/regexes.js +32 -1
  84. package/v4/core/schemas.cjs +326 -84
  85. package/v4/core/schemas.d.cts +61 -3
  86. package/v4/core/schemas.d.ts +61 -3
  87. package/v4/core/schemas.js +308 -76
  88. package/v4/core/to-json-schema.cjs +42 -5
  89. package/v4/core/to-json-schema.d.cts +4 -3
  90. package/v4/core/to-json-schema.d.ts +4 -3
  91. package/v4/core/to-json-schema.js +42 -5
  92. package/v4/core/util.cjs +69 -0
  93. package/v4/core/util.d.cts +10 -0
  94. package/v4/core/util.d.ts +10 -0
  95. package/v4/core/util.js +62 -0
  96. package/v4/locales/ar.cjs +17 -7
  97. package/v4/locales/az.cjs +17 -7
  98. package/v4/locales/be.cjs +17 -7
  99. package/v4/locales/bg.cjs +17 -7
  100. package/v4/locales/ca.cjs +17 -7
  101. package/v4/locales/cs.cjs +17 -7
  102. package/v4/locales/da.cjs +17 -7
  103. package/v4/locales/de.cjs +17 -7
  104. package/v4/locales/en.cjs +17 -7
  105. package/v4/locales/eo.cjs +17 -7
  106. package/v4/locales/es.cjs +17 -7
  107. package/v4/locales/fa.cjs +17 -7
  108. package/v4/locales/fi.cjs +17 -7
  109. package/v4/locales/fr-CA.cjs +17 -7
  110. package/v4/locales/fr.cjs +17 -7
  111. package/v4/locales/he.cjs +17 -7
  112. package/v4/locales/hu.cjs +17 -7
  113. package/v4/locales/id.cjs +17 -7
  114. package/v4/locales/is.cjs +17 -7
  115. package/v4/locales/it.cjs +17 -7
  116. package/v4/locales/ja.cjs +17 -7
  117. package/v4/locales/kh.cjs +17 -7
  118. package/v4/locales/ko.cjs +17 -7
  119. package/v4/locales/mk.cjs +17 -7
  120. package/v4/locales/ms.cjs +17 -7
  121. package/v4/locales/nl.cjs +17 -7
  122. package/v4/locales/no.cjs +17 -7
  123. package/v4/locales/ota.cjs +17 -7
  124. package/v4/locales/pl.cjs +17 -7
  125. package/v4/locales/ps.cjs +17 -7
  126. package/v4/locales/pt.cjs +17 -7
  127. package/v4/locales/ru.cjs +17 -7
  128. package/v4/locales/sl.cjs +17 -7
  129. package/v4/locales/sv.cjs +17 -7
  130. package/v4/locales/ta.cjs +17 -7
  131. package/v4/locales/th.cjs +17 -7
  132. package/v4/locales/tr.cjs +17 -7
  133. package/v4/locales/ua.cjs +17 -7
  134. package/v4/locales/ur.cjs +17 -7
  135. package/v4/locales/vi.cjs +17 -7
  136. package/v4/locales/yo.cjs +17 -7
  137. package/v4/locales/zh-CN.cjs +17 -7
  138. package/v4/locales/zh-TW.cjs +17 -7
  139. package/v4/mini/coerce.cjs +17 -7
  140. package/v4/mini/external.cjs +18 -9
  141. package/v4/mini/external.d.cts +1 -1
  142. package/v4/mini/external.d.ts +1 -1
  143. package/v4/mini/external.js +1 -1
  144. package/v4/mini/index.cjs +17 -7
  145. package/v4/mini/iso.cjs +17 -7
  146. package/v4/mini/parse.cjs +9 -1
  147. package/v4/mini/parse.d.cts +1 -1
  148. package/v4/mini/parse.d.ts +1 -1
  149. package/v4/mini/parse.js +1 -1
  150. package/v4/mini/schemas.cjs +75 -10
  151. package/v4/mini/schemas.d.cts +49 -1
  152. package/v4/mini/schemas.d.ts +49 -1
  153. package/v4/mini/schemas.js +49 -2
  154. package/src/v4/core/function.ts +0 -176
  155. package/v4/core/function.cjs +0 -102
  156. package/v4/core/function.d.cts +0 -52
  157. package/v4/core/function.d.ts +0 -52
  158. package/v4/core/function.js +0 -75
@@ -15,18 +15,28 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
37
  };
28
38
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.coerce = exports.ZodMiniISODuration = exports.ZodMiniISOTime = exports.ZodMiniISODate = exports.ZodMiniISODateTime = exports.iso = exports.locales = exports.NEVER = exports.TimePrecision = exports.toJSONSchema = exports.flattenError = exports.formatError = exports.prettifyError = exports.treeifyError = exports.regexes = exports.clone = exports.function = exports.$brand = exports.$input = exports.$output = exports.config = exports.registry = exports.globalRegistry = exports.core = void 0;
39
+ exports.coerce = exports.ZodMiniISODuration = exports.ZodMiniISOTime = exports.ZodMiniISODate = exports.ZodMiniISODateTime = exports.iso = exports.locales = exports.NEVER = exports.TimePrecision = exports.toJSONSchema = exports.flattenError = exports.formatError = exports.prettifyError = exports.treeifyError = exports.regexes = exports.clone = exports.$brand = exports.$input = exports.$output = exports.config = exports.registry = exports.globalRegistry = exports.core = void 0;
30
40
  exports.core = __importStar(require("../core/index.cjs"));
31
41
  __exportStar(require("./parse.cjs"), exports);
32
42
  __exportStar(require("./schemas.cjs"), exports);
@@ -38,7 +48,6 @@ Object.defineProperty(exports, "config", { enumerable: true, get: function () {
38
48
  Object.defineProperty(exports, "$output", { enumerable: true, get: function () { return index_js_1.$output; } });
39
49
  Object.defineProperty(exports, "$input", { enumerable: true, get: function () { return index_js_1.$input; } });
40
50
  Object.defineProperty(exports, "$brand", { enumerable: true, get: function () { return index_js_1.$brand; } });
41
- Object.defineProperty(exports, "function", { enumerable: true, get: function () { return index_js_1.function; } });
42
51
  Object.defineProperty(exports, "clone", { enumerable: true, get: function () { return index_js_1.clone; } });
43
52
  Object.defineProperty(exports, "regexes", { enumerable: true, get: function () { return index_js_1.regexes; } });
44
53
  Object.defineProperty(exports, "treeifyError", { enumerable: true, get: function () { return index_js_1.treeifyError; } });
@@ -3,7 +3,7 @@ export * from "./parse.cjs";
3
3
  export * from "./schemas.cjs";
4
4
  export * from "./checks.cjs";
5
5
  export type { infer, output, input } from "../core/index.cjs";
6
- export { globalRegistry, registry, config, $output, $input, $brand, function, clone, regexes, treeifyError, prettifyError, formatError, flattenError, toJSONSchema, TimePrecision, NEVER, } from "../core/index.cjs";
6
+ export { globalRegistry, registry, config, $output, $input, $brand, clone, regexes, treeifyError, prettifyError, formatError, flattenError, toJSONSchema, TimePrecision, NEVER, } from "../core/index.cjs";
7
7
  export * as locales from "../locales/index.cjs";
8
8
  /** A special constant with type `never` */
9
9
  export * as iso from "./iso.cjs";
@@ -3,7 +3,7 @@ export * from "./parse.js";
3
3
  export * from "./schemas.js";
4
4
  export * from "./checks.js";
5
5
  export type { infer, output, input } from "../core/index.js";
6
- export { globalRegistry, registry, config, $output, $input, $brand, function, clone, regexes, treeifyError, prettifyError, formatError, flattenError, toJSONSchema, TimePrecision, NEVER, } from "../core/index.js";
6
+ export { globalRegistry, registry, config, $output, $input, $brand, clone, regexes, treeifyError, prettifyError, formatError, flattenError, toJSONSchema, TimePrecision, NEVER, } from "../core/index.js";
7
7
  export * as locales from "../locales/index.js";
8
8
  /** A special constant with type `never` */
9
9
  export * as iso from "./iso.js";
@@ -2,7 +2,7 @@ export * as core from "../core/index.js";
2
2
  export * from "./parse.js";
3
3
  export * from "./schemas.js";
4
4
  export * from "./checks.js";
5
- export { globalRegistry, registry, config, $output, $input, $brand, function, clone, regexes, treeifyError, prettifyError, formatError, flattenError, toJSONSchema, TimePrecision, NEVER, } from "../core/index.js";
5
+ export { globalRegistry, registry, config, $output, $input, $brand, clone, regexes, treeifyError, prettifyError, formatError, flattenError, toJSONSchema, TimePrecision, NEVER, } from "../core/index.js";
6
6
  export * as locales from "../locales/index.js";
7
7
  /** A special constant with type `never` */
8
8
  // export const NEVER = {} as never;
package/v4/mini/index.cjs CHANGED
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
37
  };
package/v4/mini/iso.cjs CHANGED
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.ZodMiniISODuration = exports.ZodMiniISOTime = exports.ZodMiniISODate = exports.ZodMiniISODateTime = void 0;
27
37
  exports.datetime = datetime;
package/v4/mini/parse.cjs CHANGED
@@ -1,8 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.safeParseAsync = exports.parseAsync = exports.safeParse = exports.parse = void 0;
3
+ exports.safeDecodeAsync = exports.safeEncodeAsync = exports.safeDecode = exports.safeEncode = exports.decodeAsync = exports.encodeAsync = exports.decode = exports.encode = exports.safeParseAsync = exports.parseAsync = exports.safeParse = exports.parse = void 0;
4
4
  var index_js_1 = require("../core/index.cjs");
5
5
  Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return index_js_1.parse; } });
6
6
  Object.defineProperty(exports, "safeParse", { enumerable: true, get: function () { return index_js_1.safeParse; } });
7
7
  Object.defineProperty(exports, "parseAsync", { enumerable: true, get: function () { return index_js_1.parseAsync; } });
8
8
  Object.defineProperty(exports, "safeParseAsync", { enumerable: true, get: function () { return index_js_1.safeParseAsync; } });
9
+ Object.defineProperty(exports, "encode", { enumerable: true, get: function () { return index_js_1.encode; } });
10
+ Object.defineProperty(exports, "decode", { enumerable: true, get: function () { return index_js_1.decode; } });
11
+ Object.defineProperty(exports, "encodeAsync", { enumerable: true, get: function () { return index_js_1.encodeAsync; } });
12
+ Object.defineProperty(exports, "decodeAsync", { enumerable: true, get: function () { return index_js_1.decodeAsync; } });
13
+ Object.defineProperty(exports, "safeEncode", { enumerable: true, get: function () { return index_js_1.safeEncode; } });
14
+ Object.defineProperty(exports, "safeDecode", { enumerable: true, get: function () { return index_js_1.safeDecode; } });
15
+ Object.defineProperty(exports, "safeEncodeAsync", { enumerable: true, get: function () { return index_js_1.safeEncodeAsync; } });
16
+ Object.defineProperty(exports, "safeDecodeAsync", { enumerable: true, get: function () { return index_js_1.safeDecodeAsync; } });
@@ -1 +1 @@
1
- export { parse, safeParse, parseAsync, safeParseAsync } from "../core/index.cjs";
1
+ export { parse, safeParse, parseAsync, safeParseAsync, encode, decode, encodeAsync, decodeAsync, safeEncode, safeDecode, safeEncodeAsync, safeDecodeAsync, } from "../core/index.cjs";
@@ -1 +1 @@
1
- export { parse, safeParse, parseAsync, safeParseAsync } from "../core/index.js";
1
+ export { parse, safeParse, parseAsync, safeParseAsync, encode, decode, encodeAsync, decodeAsync, safeEncode, safeDecode, safeEncodeAsync, safeDecodeAsync, } from "../core/index.js";
package/v4/mini/parse.js CHANGED
@@ -1 +1 @@
1
- export { parse, safeParse, parseAsync, safeParseAsync } from "../core/index.js";
1
+ export { parse, safeParse, parseAsync, safeParseAsync, encode, decode, encodeAsync, decodeAsync, safeEncode, safeDecode, safeEncodeAsync, safeDecodeAsync, } from "../core/index.js";
@@ -15,16 +15,26 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  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;
27
- 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;
37
+ exports.ZodMiniFunction = exports.stringbool = 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 = void 0;
28
38
  exports.string = string;
29
39
  exports.email = email;
30
40
  exports.guid = guid;
@@ -33,6 +43,7 @@ exports.uuidv4 = uuidv4;
33
43
  exports.uuidv6 = uuidv6;
34
44
  exports.uuidv7 = uuidv7;
35
45
  exports.url = url;
46
+ exports.httpUrl = httpUrl;
36
47
  exports.emoji = emoji;
37
48
  exports.nanoid = nanoid;
38
49
  exports.cuid = cuid;
@@ -50,6 +61,8 @@ exports.e164 = e164;
50
61
  exports.jwt = jwt;
51
62
  exports.stringFormat = stringFormat;
52
63
  exports.hostname = hostname;
64
+ exports.hex = hex;
65
+ exports.hash = hash;
53
66
  exports.number = number;
54
67
  exports.int = int;
55
68
  exports.float32 = float32;
@@ -74,6 +87,7 @@ exports.object = object;
74
87
  exports.strictObject = strictObject;
75
88
  exports.looseObject = looseObject;
76
89
  exports.extend = extend;
90
+ exports.safeExtend = safeExtend;
77
91
  exports.merge = merge;
78
92
  exports.pick = pick;
79
93
  exports.omit = omit;
@@ -103,6 +117,7 @@ exports.success = success;
103
117
  exports.catch = _catch;
104
118
  exports.nan = nan;
105
119
  exports.pipe = pipe;
120
+ exports.codec = codec;
106
121
  exports.readonly = readonly;
107
122
  exports.templateLiteral = templateLiteral;
108
123
  exports.lazy = _lazy;
@@ -113,6 +128,10 @@ exports.refine = refine;
113
128
  exports.superRefine = superRefine;
114
129
  exports.instanceof = _instanceof;
115
130
  exports.json = json;
131
+ exports._function = _function;
132
+ exports.function = _function;
133
+ exports._function = _function;
134
+ exports.function = _function;
116
135
  const core = __importStar(require("../core/index.cjs"));
117
136
  const index_js_1 = require("../core/index.cjs");
118
137
  const parse = __importStar(require("./parse.cjs"));
@@ -194,6 +213,13 @@ exports.ZodMiniURL = core.$constructor("ZodMiniURL", (inst, def) => {
194
213
  function url(params) {
195
214
  return core._url(exports.ZodMiniURL, params);
196
215
  }
216
+ function httpUrl(params) {
217
+ return core._url(exports.ZodMiniURL, {
218
+ protocol: /^https?$/,
219
+ hostname: core.regexes.domain,
220
+ ...index_js_1.util.normalizeParams(params),
221
+ });
222
+ }
197
223
  exports.ZodMiniEmoji = core.$constructor("ZodMiniEmoji", (inst, def) => {
198
224
  core.$ZodEmoji.init(inst, def);
199
225
  exports.ZodMiniStringFormat.init(inst, def);
@@ -309,6 +335,18 @@ function stringFormat(format, fnOrRegex, _params = {}) {
309
335
  function hostname(_params) {
310
336
  return core._stringFormat(exports.ZodMiniCustomStringFormat, "hostname", core.regexes.hostname, _params);
311
337
  }
338
+ function hex(_params) {
339
+ return core._stringFormat(exports.ZodMiniCustomStringFormat, "hex", core.regexes.hex, _params);
340
+ }
341
+ function hash(alg, params) {
342
+ const enc = params?.enc ?? "hex";
343
+ const format = `${alg}_${enc}`;
344
+ const regex = core.regexes[format];
345
+ // check for unrecognized format
346
+ if (!regex)
347
+ throw new Error(`Unrecognized hash format: ${format}`);
348
+ return core._stringFormat(exports.ZodMiniCustomStringFormat, format, regex, params);
349
+ }
312
350
  exports.ZodMiniNumber = core.$constructor("ZodMiniNumber", (inst, def) => {
313
351
  core.$ZodNumber.init(inst, def);
314
352
  exports.ZodMiniType.init(inst, def);
@@ -487,6 +525,9 @@ function looseObject(shape, params) {
487
525
  function extend(schema, shape) {
488
526
  return index_js_1.util.extend(schema, shape);
489
527
  }
528
+ function safeExtend(schema, shape) {
529
+ return index_js_1.util.safeExtend(schema, shape);
530
+ }
490
531
  function merge(schema, shape) {
491
532
  return index_js_1.util.extend(schema, shape);
492
533
  }
@@ -603,6 +644,7 @@ function set(valueType, params) {
603
644
  exports.ZodMiniEnum = core.$constructor("ZodMiniEnum", (inst, def) => {
604
645
  core.$ZodEnum.init(inst, def);
605
646
  exports.ZodMiniType.init(inst, def);
647
+ inst.options = Object.values(def.entries);
606
648
  });
607
649
  function _enum(values, params) {
608
650
  const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
@@ -754,6 +796,19 @@ function pipe(in_, out) {
754
796
  out: out,
755
797
  });
756
798
  }
799
+ exports.ZodMiniCodec = core.$constructor("ZodMiniCodec", (inst, def) => {
800
+ exports.ZodMiniPipe.init(inst, def);
801
+ core.$ZodCodec.init(inst, def);
802
+ });
803
+ function codec(in_, out, params) {
804
+ return new exports.ZodMiniCodec({
805
+ type: "pipe",
806
+ in: in_,
807
+ out: out,
808
+ transform: params.decode,
809
+ reverseTransform: params.encode,
810
+ });
811
+ }
757
812
  exports.ZodMiniReadonly = core.$constructor("ZodMiniReadonly", (inst, def) => {
758
813
  core.$ZodReadonly.init(inst, def);
759
814
  exports.ZodMiniType.init(inst, def);
@@ -837,10 +892,9 @@ function _instanceof(cls, params = {
837
892
  }
838
893
  // stringbool
839
894
  const stringbool = (...args) => core._stringbool({
840
- Pipe: exports.ZodMiniPipe,
895
+ Codec: exports.ZodMiniCodec,
841
896
  Boolean: exports.ZodMiniBoolean,
842
897
  String: exports.ZodMiniString,
843
- Transform: exports.ZodMiniTransform,
844
898
  }, ...args);
845
899
  exports.stringbool = stringbool;
846
900
  function json() {
@@ -849,3 +903,14 @@ function json() {
849
903
  });
850
904
  return jsonSchema;
851
905
  }
906
+ exports.ZodMiniFunction = core.$constructor("ZodMiniFunction", (inst, def) => {
907
+ core.$ZodFunction.init(inst, def);
908
+ exports.ZodMiniType.init(inst, def);
909
+ });
910
+ function _function(params) {
911
+ return new exports.ZodMiniFunction({
912
+ type: "function",
913
+ input: Array.isArray(params?.input) ? tuple(params?.input) : (params?.input ?? array(unknown())),
914
+ output: params?.output ?? unknown(),
915
+ });
916
+ }
@@ -47,6 +47,7 @@ export interface ZodMiniURL extends _ZodMiniString<core.$ZodURLInternals> {
47
47
  }
48
48
  export declare const ZodMiniURL: core.$constructor<ZodMiniURL>;
49
49
  export declare function url(params?: string | core.$ZodURLParams): ZodMiniURL;
50
+ export declare function httpUrl(params?: string | Omit<core.$ZodURLParams, "protocol" | "hostname">): ZodMiniURL;
50
51
  export interface ZodMiniEmoji extends _ZodMiniString<core.$ZodEmojiInternals> {
51
52
  }
52
53
  export declare const ZodMiniEmoji: core.$constructor<ZodMiniEmoji>;
@@ -113,6 +114,10 @@ export interface ZodMiniCustomStringFormat<Format extends string = string> exten
113
114
  export declare const ZodMiniCustomStringFormat: core.$constructor<ZodMiniCustomStringFormat>;
114
115
  export declare function stringFormat<Format extends string>(format: Format, fnOrRegex: ((arg: string) => util.MaybeAsync<unknown>) | RegExp, _params?: string | core.$ZodStringFormatParams): ZodMiniCustomStringFormat<Format>;
115
116
  export declare function hostname(_params?: string | core.$ZodStringFormatParams): ZodMiniCustomStringFormat<"hostname">;
117
+ export declare function hex(_params?: string | core.$ZodStringFormatParams): ZodMiniCustomStringFormat<"hex">;
118
+ export declare function hash<Alg extends util.HashAlgorithm, Enc extends util.HashEncoding = "hex">(alg: Alg, params?: {
119
+ enc?: Enc;
120
+ } & core.$ZodStringFormatParams): ZodMiniCustomStringFormat<`${Alg}_${Enc}`>;
116
121
  interface _ZodMiniNumber<T extends core.$ZodNumberInternals<unknown> = core.$ZodNumberInternals<unknown>> extends _ZodMiniType<T>, core.$ZodNumber<T["input"]> {
117
122
  _zod: T;
118
123
  }
@@ -191,6 +196,10 @@ export declare function object<T extends core.$ZodLooseShape = Record<never, Som
191
196
  export declare function strictObject<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodObjectParams): ZodMiniObject<T, core.$strict>;
192
197
  export declare function looseObject<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodObjectParams): ZodMiniObject<T, core.$loose>;
193
198
  export declare function extend<T extends ZodMiniObject, U extends core.$ZodLooseShape>(schema: T, shape: U): ZodMiniObject<util.Extend<T["shape"], U>, T["_zod"]["config"]>;
199
+ export type SafeExtendShape<Base extends core.$ZodShape, Ext extends core.$ZodLooseShape> = {
200
+ [K in keyof Ext]: K extends keyof Base ? core.output<Ext[K]> extends core.output<Base[K]> ? core.input<Ext[K]> extends core.input<Base[K]> ? Ext[K] : never : never : Ext[K];
201
+ };
202
+ export declare function safeExtend<T extends ZodMiniObject, U extends core.$ZodLooseShape>(schema: T, shape: SafeExtendShape<T["shape"], U>): ZodMiniObject<util.Extend<T["shape"], U>, T["_zod"]["config"]>;
194
203
  /** @deprecated Identical to `z.extend(A, B)` */
195
204
  export declare function merge<T extends ZodMiniObject, U extends ZodMiniObject>(a: T, b: U): ZodMiniObject<util.Extend<T["shape"], U["shape"]>, T["_zod"]["config"]>;
196
205
  export declare function pick<T extends ZodMiniObject, M extends util.Mask<keyof T["shape"]>>(schema: T, mask: M): ZodMiniObject<util.Flatten<Pick<T["shape"], keyof T["shape"] & keyof M>>, T["_zod"]["config"]>;
@@ -246,6 +255,7 @@ export interface ZodMiniSet<T extends SomeType = core.$ZodType> extends _ZodMini
246
255
  export declare const ZodMiniSet: core.$constructor<ZodMiniSet>;
247
256
  export declare function set<Value extends SomeType>(valueType: Value, params?: string | core.$ZodSetParams): ZodMiniSet<Value>;
248
257
  export interface ZodMiniEnum<T extends util.EnumLike = util.EnumLike> extends _ZodMiniType<core.$ZodEnumInternals<T>> {
258
+ options: Array<T[keyof T]>;
249
259
  }
250
260
  export declare const ZodMiniEnum: core.$constructor<ZodMiniEnum>;
251
261
  declare function _enum<const T extends readonly string[]>(values: T, params?: string | core.$ZodEnumParams): ZodMiniEnum<util.ToEnum<T[number]>>;
@@ -310,6 +320,15 @@ export interface ZodMiniPipe<A extends SomeType = core.$ZodType, B extends SomeT
310
320
  }
311
321
  export declare const ZodMiniPipe: core.$constructor<ZodMiniPipe>;
312
322
  export declare function pipe<const A extends SomeType, B extends core.$ZodType<unknown, core.output<A>> = core.$ZodType<unknown, core.output<A>>>(in_: A, out: B | core.$ZodType<unknown, core.output<A>>): ZodMiniPipe<A, B>;
323
+ export interface ZodMiniCodec<A extends SomeType = core.$ZodType, B extends SomeType = core.$ZodType> extends ZodMiniPipe<A, B>, core.$ZodCodec<A, B> {
324
+ _zod: core.$ZodCodecInternals<A, B>;
325
+ def: core.$ZodCodecDef<A, B>;
326
+ }
327
+ export declare const ZodMiniCodec: core.$constructor<ZodMiniCodec>;
328
+ export declare function codec<const A extends SomeType, B extends core.SomeType = core.$ZodType>(in_: A, out: B, params: {
329
+ decode: (value: core.output<A>, payload: core.ParsePayload<core.output<A>>) => core.input<B>;
330
+ encode: (value: core.input<B>, payload: core.ParsePayload<core.input<B>>) => core.output<A>;
331
+ }): ZodMiniCodec<A, B>;
313
332
  export interface ZodMiniReadonly<T extends SomeType = core.$ZodType> extends _ZodMiniType<core.$ZodReadonlyInternals<T>> {
314
333
  }
315
334
  export declare const ZodMiniReadonly: core.$constructor<ZodMiniReadonly>;
@@ -339,7 +358,7 @@ declare abstract class Class {
339
358
  }
340
359
  declare function _instanceof<T extends typeof Class>(cls: T, params?: core.$ZodCustomParams): ZodMiniCustom<InstanceType<T>, InstanceType<T>>;
341
360
  export { _instanceof as instanceof };
342
- export declare const stringbool: (_params?: string | core.$ZodStringBoolParams) => ZodMiniPipe<ZodMiniPipe<ZodMiniString, ZodMiniTransform<boolean, string>>, ZodMiniBoolean>;
361
+ export declare const stringbool: (_params?: string | core.$ZodStringBoolParams) => ZodMiniCodec<ZodMiniString, ZodMiniBoolean>;
343
362
  type _ZodMiniJSONSchema = ZodMiniUnion<[
344
363
  ZodMiniString,
345
364
  ZodMiniNumber,
@@ -357,3 +376,32 @@ export interface ZodMiniJSONSchema extends _ZodMiniJSONSchema {
357
376
  _zod: ZodMiniJSONSchemaInternals;
358
377
  }
359
378
  export declare function json(): ZodMiniJSONSchema;
379
+ export interface ZodMiniFunction<Args extends core.$ZodFunctionIn = core.$ZodFunctionIn, Returns extends core.$ZodFunctionOut = core.$ZodFunctionOut> extends _ZodMiniType<core.$ZodFunctionInternals<Args, Returns>>, core.$ZodFunction<Args, Returns> {
380
+ _def: core.$ZodFunctionDef<Args, Returns>;
381
+ _input: core.$InferInnerFunctionType<Args, Returns>;
382
+ _output: core.$InferOuterFunctionType<Args, Returns>;
383
+ input<const Items extends util.TupleItems, const Rest extends core.$ZodFunctionOut = core.$ZodFunctionOut>(args: Items, rest?: Rest): ZodMiniFunction<ZodMiniTuple<Items, Rest>, Returns>;
384
+ input<NewArgs extends core.$ZodFunctionIn>(args: NewArgs): ZodMiniFunction<NewArgs, Returns>;
385
+ input(...args: any[]): ZodMiniFunction<any, Returns>;
386
+ output<NewReturns extends core.$ZodFunctionOut>(output: NewReturns): ZodMiniFunction<Args, NewReturns>;
387
+ }
388
+ export declare const ZodMiniFunction: core.$constructor<ZodMiniFunction>;
389
+ export declare function _function(): ZodMiniFunction;
390
+ export declare function _function<const In extends Array<SomeType> = Array<SomeType>>(params: {
391
+ input: In;
392
+ }): ZodMiniFunction<ZodMiniTuple<In, null>, core.$ZodFunctionOut>;
393
+ export declare function _function<const In extends Array<SomeType> = Array<SomeType>, const Out extends core.$ZodFunctionOut = core.$ZodFunctionOut>(params: {
394
+ input: In;
395
+ output: Out;
396
+ }): ZodMiniFunction<ZodMiniTuple<In, null>, Out>;
397
+ export declare function _function<const In extends core.$ZodFunctionIn = core.$ZodFunctionIn>(params: {
398
+ input: In;
399
+ }): ZodMiniFunction<In, core.$ZodFunctionOut>;
400
+ export declare function _function<const Out extends core.$ZodFunctionOut = core.$ZodFunctionOut>(params: {
401
+ output: Out;
402
+ }): ZodMiniFunction<core.$ZodFunctionIn, Out>;
403
+ export declare function _function<In extends core.$ZodFunctionIn = core.$ZodFunctionIn, Out extends core.$ZodFunctionOut = core.$ZodFunctionOut>(params?: {
404
+ input: In;
405
+ output: Out;
406
+ }): ZodMiniFunction<In, Out>;
407
+ export { _function as function };
@@ -47,6 +47,7 @@ export interface ZodMiniURL extends _ZodMiniString<core.$ZodURLInternals> {
47
47
  }
48
48
  export declare const ZodMiniURL: core.$constructor<ZodMiniURL>;
49
49
  export declare function url(params?: string | core.$ZodURLParams): ZodMiniURL;
50
+ export declare function httpUrl(params?: string | Omit<core.$ZodURLParams, "protocol" | "hostname">): ZodMiniURL;
50
51
  export interface ZodMiniEmoji extends _ZodMiniString<core.$ZodEmojiInternals> {
51
52
  }
52
53
  export declare const ZodMiniEmoji: core.$constructor<ZodMiniEmoji>;
@@ -113,6 +114,10 @@ export interface ZodMiniCustomStringFormat<Format extends string = string> exten
113
114
  export declare const ZodMiniCustomStringFormat: core.$constructor<ZodMiniCustomStringFormat>;
114
115
  export declare function stringFormat<Format extends string>(format: Format, fnOrRegex: ((arg: string) => util.MaybeAsync<unknown>) | RegExp, _params?: string | core.$ZodStringFormatParams): ZodMiniCustomStringFormat<Format>;
115
116
  export declare function hostname(_params?: string | core.$ZodStringFormatParams): ZodMiniCustomStringFormat<"hostname">;
117
+ export declare function hex(_params?: string | core.$ZodStringFormatParams): ZodMiniCustomStringFormat<"hex">;
118
+ export declare function hash<Alg extends util.HashAlgorithm, Enc extends util.HashEncoding = "hex">(alg: Alg, params?: {
119
+ enc?: Enc;
120
+ } & core.$ZodStringFormatParams): ZodMiniCustomStringFormat<`${Alg}_${Enc}`>;
116
121
  interface _ZodMiniNumber<T extends core.$ZodNumberInternals<unknown> = core.$ZodNumberInternals<unknown>> extends _ZodMiniType<T>, core.$ZodNumber<T["input"]> {
117
122
  _zod: T;
118
123
  }
@@ -191,6 +196,10 @@ export declare function object<T extends core.$ZodLooseShape = Record<never, Som
191
196
  export declare function strictObject<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodObjectParams): ZodMiniObject<T, core.$strict>;
192
197
  export declare function looseObject<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodObjectParams): ZodMiniObject<T, core.$loose>;
193
198
  export declare function extend<T extends ZodMiniObject, U extends core.$ZodLooseShape>(schema: T, shape: U): ZodMiniObject<util.Extend<T["shape"], U>, T["_zod"]["config"]>;
199
+ export type SafeExtendShape<Base extends core.$ZodShape, Ext extends core.$ZodLooseShape> = {
200
+ [K in keyof Ext]: K extends keyof Base ? core.output<Ext[K]> extends core.output<Base[K]> ? core.input<Ext[K]> extends core.input<Base[K]> ? Ext[K] : never : never : Ext[K];
201
+ };
202
+ export declare function safeExtend<T extends ZodMiniObject, U extends core.$ZodLooseShape>(schema: T, shape: SafeExtendShape<T["shape"], U>): ZodMiniObject<util.Extend<T["shape"], U>, T["_zod"]["config"]>;
194
203
  /** @deprecated Identical to `z.extend(A, B)` */
195
204
  export declare function merge<T extends ZodMiniObject, U extends ZodMiniObject>(a: T, b: U): ZodMiniObject<util.Extend<T["shape"], U["shape"]>, T["_zod"]["config"]>;
196
205
  export declare function pick<T extends ZodMiniObject, M extends util.Mask<keyof T["shape"]>>(schema: T, mask: M): ZodMiniObject<util.Flatten<Pick<T["shape"], keyof T["shape"] & keyof M>>, T["_zod"]["config"]>;
@@ -246,6 +255,7 @@ export interface ZodMiniSet<T extends SomeType = core.$ZodType> extends _ZodMini
246
255
  export declare const ZodMiniSet: core.$constructor<ZodMiniSet>;
247
256
  export declare function set<Value extends SomeType>(valueType: Value, params?: string | core.$ZodSetParams): ZodMiniSet<Value>;
248
257
  export interface ZodMiniEnum<T extends util.EnumLike = util.EnumLike> extends _ZodMiniType<core.$ZodEnumInternals<T>> {
258
+ options: Array<T[keyof T]>;
249
259
  }
250
260
  export declare const ZodMiniEnum: core.$constructor<ZodMiniEnum>;
251
261
  declare function _enum<const T extends readonly string[]>(values: T, params?: string | core.$ZodEnumParams): ZodMiniEnum<util.ToEnum<T[number]>>;
@@ -310,6 +320,15 @@ export interface ZodMiniPipe<A extends SomeType = core.$ZodType, B extends SomeT
310
320
  }
311
321
  export declare const ZodMiniPipe: core.$constructor<ZodMiniPipe>;
312
322
  export declare function pipe<const A extends SomeType, B extends core.$ZodType<unknown, core.output<A>> = core.$ZodType<unknown, core.output<A>>>(in_: A, out: B | core.$ZodType<unknown, core.output<A>>): ZodMiniPipe<A, B>;
323
+ export interface ZodMiniCodec<A extends SomeType = core.$ZodType, B extends SomeType = core.$ZodType> extends ZodMiniPipe<A, B>, core.$ZodCodec<A, B> {
324
+ _zod: core.$ZodCodecInternals<A, B>;
325
+ def: core.$ZodCodecDef<A, B>;
326
+ }
327
+ export declare const ZodMiniCodec: core.$constructor<ZodMiniCodec>;
328
+ export declare function codec<const A extends SomeType, B extends core.SomeType = core.$ZodType>(in_: A, out: B, params: {
329
+ decode: (value: core.output<A>, payload: core.ParsePayload<core.output<A>>) => core.input<B>;
330
+ encode: (value: core.input<B>, payload: core.ParsePayload<core.input<B>>) => core.output<A>;
331
+ }): ZodMiniCodec<A, B>;
313
332
  export interface ZodMiniReadonly<T extends SomeType = core.$ZodType> extends _ZodMiniType<core.$ZodReadonlyInternals<T>> {
314
333
  }
315
334
  export declare const ZodMiniReadonly: core.$constructor<ZodMiniReadonly>;
@@ -339,7 +358,7 @@ declare abstract class Class {
339
358
  }
340
359
  declare function _instanceof<T extends typeof Class>(cls: T, params?: core.$ZodCustomParams): ZodMiniCustom<InstanceType<T>, InstanceType<T>>;
341
360
  export { _instanceof as instanceof };
342
- export declare const stringbool: (_params?: string | core.$ZodStringBoolParams) => ZodMiniPipe<ZodMiniPipe<ZodMiniString, ZodMiniTransform<boolean, string>>, ZodMiniBoolean>;
361
+ export declare const stringbool: (_params?: string | core.$ZodStringBoolParams) => ZodMiniCodec<ZodMiniString, ZodMiniBoolean>;
343
362
  type _ZodMiniJSONSchema = ZodMiniUnion<[
344
363
  ZodMiniString,
345
364
  ZodMiniNumber,
@@ -357,3 +376,32 @@ export interface ZodMiniJSONSchema extends _ZodMiniJSONSchema {
357
376
  _zod: ZodMiniJSONSchemaInternals;
358
377
  }
359
378
  export declare function json(): ZodMiniJSONSchema;
379
+ export interface ZodMiniFunction<Args extends core.$ZodFunctionIn = core.$ZodFunctionIn, Returns extends core.$ZodFunctionOut = core.$ZodFunctionOut> extends _ZodMiniType<core.$ZodFunctionInternals<Args, Returns>>, core.$ZodFunction<Args, Returns> {
380
+ _def: core.$ZodFunctionDef<Args, Returns>;
381
+ _input: core.$InferInnerFunctionType<Args, Returns>;
382
+ _output: core.$InferOuterFunctionType<Args, Returns>;
383
+ input<const Items extends util.TupleItems, const Rest extends core.$ZodFunctionOut = core.$ZodFunctionOut>(args: Items, rest?: Rest): ZodMiniFunction<ZodMiniTuple<Items, Rest>, Returns>;
384
+ input<NewArgs extends core.$ZodFunctionIn>(args: NewArgs): ZodMiniFunction<NewArgs, Returns>;
385
+ input(...args: any[]): ZodMiniFunction<any, Returns>;
386
+ output<NewReturns extends core.$ZodFunctionOut>(output: NewReturns): ZodMiniFunction<Args, NewReturns>;
387
+ }
388
+ export declare const ZodMiniFunction: core.$constructor<ZodMiniFunction>;
389
+ export declare function _function(): ZodMiniFunction;
390
+ export declare function _function<const In extends Array<SomeType> = Array<SomeType>>(params: {
391
+ input: In;
392
+ }): ZodMiniFunction<ZodMiniTuple<In, null>, core.$ZodFunctionOut>;
393
+ export declare function _function<const In extends Array<SomeType> = Array<SomeType>, const Out extends core.$ZodFunctionOut = core.$ZodFunctionOut>(params: {
394
+ input: In;
395
+ output: Out;
396
+ }): ZodMiniFunction<ZodMiniTuple<In, null>, Out>;
397
+ export declare function _function<const In extends core.$ZodFunctionIn = core.$ZodFunctionIn>(params: {
398
+ input: In;
399
+ }): ZodMiniFunction<In, core.$ZodFunctionOut>;
400
+ export declare function _function<const Out extends core.$ZodFunctionOut = core.$ZodFunctionOut>(params: {
401
+ output: Out;
402
+ }): ZodMiniFunction<core.$ZodFunctionIn, Out>;
403
+ export declare function _function<In extends core.$ZodFunctionIn = core.$ZodFunctionIn, Out extends core.$ZodFunctionOut = core.$ZodFunctionOut>(params?: {
404
+ input: In;
405
+ output: Out;
406
+ }): ZodMiniFunction<In, Out>;
407
+ export { _function as function };
@@ -79,6 +79,13 @@ export const ZodMiniURL = /*@__PURE__*/ core.$constructor("ZodMiniURL", (inst, d
79
79
  export function url(params) {
80
80
  return core._url(ZodMiniURL, params);
81
81
  }
82
+ export function httpUrl(params) {
83
+ return core._url(ZodMiniURL, {
84
+ protocol: /^https?$/,
85
+ hostname: core.regexes.domain,
86
+ ...util.normalizeParams(params),
87
+ });
88
+ }
82
89
  export const ZodMiniEmoji = /*@__PURE__*/ core.$constructor("ZodMiniEmoji", (inst, def) => {
83
90
  core.$ZodEmoji.init(inst, def);
84
91
  ZodMiniStringFormat.init(inst, def);
@@ -194,6 +201,18 @@ export function stringFormat(format, fnOrRegex, _params = {}) {
194
201
  export function hostname(_params) {
195
202
  return core._stringFormat(ZodMiniCustomStringFormat, "hostname", core.regexes.hostname, _params);
196
203
  }
204
+ export function hex(_params) {
205
+ return core._stringFormat(ZodMiniCustomStringFormat, "hex", core.regexes.hex, _params);
206
+ }
207
+ export function hash(alg, params) {
208
+ const enc = params?.enc ?? "hex";
209
+ const format = `${alg}_${enc}`;
210
+ const regex = core.regexes[format];
211
+ // check for unrecognized format
212
+ if (!regex)
213
+ throw new Error(`Unrecognized hash format: ${format}`);
214
+ return core._stringFormat(ZodMiniCustomStringFormat, format, regex, params);
215
+ }
197
216
  export const ZodMiniNumber = /*@__PURE__*/ core.$constructor("ZodMiniNumber", (inst, def) => {
198
217
  core.$ZodNumber.init(inst, def);
199
218
  ZodMiniType.init(inst, def);
@@ -375,6 +394,9 @@ export function looseObject(shape, params) {
375
394
  export function extend(schema, shape) {
376
395
  return util.extend(schema, shape);
377
396
  }
397
+ export function safeExtend(schema, shape) {
398
+ return util.safeExtend(schema, shape);
399
+ }
378
400
  export function merge(schema, shape) {
379
401
  return util.extend(schema, shape);
380
402
  }
@@ -491,6 +513,7 @@ export function set(valueType, params) {
491
513
  export const ZodMiniEnum = /*@__PURE__*/ core.$constructor("ZodMiniEnum", (inst, def) => {
492
514
  core.$ZodEnum.init(inst, def);
493
515
  ZodMiniType.init(inst, def);
516
+ inst.options = Object.values(def.entries);
494
517
  });
495
518
  function _enum(values, params) {
496
519
  const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
@@ -644,6 +667,19 @@ export function pipe(in_, out) {
644
667
  out: out,
645
668
  });
646
669
  }
670
+ export const ZodMiniCodec = /*@__PURE__*/ core.$constructor("ZodMiniCodec", (inst, def) => {
671
+ ZodMiniPipe.init(inst, def);
672
+ core.$ZodCodec.init(inst, def);
673
+ });
674
+ export function codec(in_, out, params) {
675
+ return new ZodMiniCodec({
676
+ type: "pipe",
677
+ in: in_,
678
+ out: out,
679
+ transform: params.decode,
680
+ reverseTransform: params.encode,
681
+ });
682
+ }
647
683
  export const ZodMiniReadonly = /*@__PURE__*/ core.$constructor("ZodMiniReadonly", (inst, def) => {
648
684
  core.$ZodReadonly.init(inst, def);
649
685
  ZodMiniType.init(inst, def);
@@ -729,10 +765,9 @@ function _instanceof(cls, params = {
729
765
  export { _instanceof as instanceof };
730
766
  // stringbool
731
767
  export const stringbool = (...args) => core._stringbool({
732
- Pipe: ZodMiniPipe,
768
+ Codec: ZodMiniCodec,
733
769
  Boolean: ZodMiniBoolean,
734
770
  String: ZodMiniString,
735
- Transform: ZodMiniTransform,
736
771
  }, ...args);
737
772
  export function json() {
738
773
  const jsonSchema = _lazy(() => {
@@ -740,3 +775,15 @@ export function json() {
740
775
  });
741
776
  return jsonSchema;
742
777
  }
778
+ export const ZodMiniFunction = /*@__PURE__*/ core.$constructor("ZodMiniFunction", (inst, def) => {
779
+ core.$ZodFunction.init(inst, def);
780
+ ZodMiniType.init(inst, def);
781
+ });
782
+ export function _function(params) {
783
+ return new ZodMiniFunction({
784
+ type: "function",
785
+ input: Array.isArray(params?.input) ? tuple(params?.input) : (params?.input ?? array(unknown())),
786
+ output: params?.output ?? unknown(),
787
+ });
788
+ }
789
+ export { _function as function };