zod 4.0.0-beta.1 → 4.0.0-beta.20250409T222615

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 (102) hide show
  1. package/LICENSE +1 -1
  2. package/dist/commonjs/checks.d.ts +1 -0
  3. package/dist/commonjs/checks.js +32 -0
  4. package/dist/commonjs/coerce.d.ts +17 -0
  5. package/dist/commonjs/coerce.js +57 -0
  6. package/dist/commonjs/compat.d.ts +47 -0
  7. package/dist/commonjs/compat.js +73 -0
  8. package/dist/commonjs/errors.d.ts +28 -0
  9. package/dist/commonjs/errors.js +60 -0
  10. package/dist/commonjs/external.d.ts +8 -0
  11. package/dist/commonjs/external.js +67 -0
  12. package/dist/commonjs/index.d.ts +4 -0
  13. package/dist/commonjs/index.js +43 -0
  14. package/dist/commonjs/iso.d.ts +22 -0
  15. package/dist/commonjs/iso.js +70 -0
  16. package/dist/commonjs/package.json +3 -0
  17. package/dist/commonjs/parse.d.ts +17 -0
  18. package/dist/commonjs/parse.js +44 -0
  19. package/dist/commonjs/schemas.d.ts +738 -0
  20. package/dist/commonjs/schemas.js +1171 -0
  21. package/dist/esm/checks.d.ts +1 -0
  22. package/dist/esm/checks.js +1 -0
  23. package/dist/esm/coerce.d.ts +17 -0
  24. package/dist/esm/coerce.js +17 -0
  25. package/dist/esm/compat.d.ts +47 -0
  26. package/dist/esm/compat.js +33 -0
  27. package/dist/esm/errors.d.ts +28 -0
  28. package/dist/esm/errors.js +23 -0
  29. package/dist/esm/external.d.ts +8 -0
  30. package/dist/esm/external.js +14 -0
  31. package/dist/esm/index.d.ts +4 -0
  32. package/dist/esm/index.js +4 -0
  33. package/dist/esm/iso.d.ts +22 -0
  34. package/dist/esm/iso.js +30 -0
  35. package/dist/esm/package.json +3 -0
  36. package/dist/esm/parse.d.ts +17 -0
  37. package/dist/esm/parse.js +8 -0
  38. package/dist/esm/schemas.d.ts +738 -0
  39. package/dist/esm/schemas.js +1057 -0
  40. package/package.json +66 -82
  41. package/src/checks.ts +30 -0
  42. package/src/coerce.ts +27 -0
  43. package/src/compat.ts +74 -0
  44. package/src/errors.ts +52 -0
  45. package/src/external.ts +29 -0
  46. package/src/index.ts +5 -0
  47. package/src/iso.ts +90 -0
  48. package/src/parse.ts +32 -0
  49. package/src/schemas.ts +2324 -0
  50. package/CHANGELOG.md +0 -160
  51. package/README.md +0 -1730
  52. package/lib/.DS_Store +0 -0
  53. package/lib/PseudoPromise.d.ts +0 -7
  54. package/lib/PseudoPromise.d.ts.map +0 -1
  55. package/lib/PseudoPromise.js +0 -17
  56. package/lib/PseudoPromise.js.map +0 -1
  57. package/lib/ZodError.d.ts +0 -137
  58. package/lib/ZodError.d.ts.map +0 -1
  59. package/lib/ZodError.js +0 -301
  60. package/lib/ZodError.js.map +0 -1
  61. package/lib/benchmarks/index.d.ts +0 -2
  62. package/lib/benchmarks/index.d.ts.map +0 -1
  63. package/lib/benchmarks/index.js +0 -54
  64. package/lib/benchmarks/index.js.map +0 -1
  65. package/lib/benchmarks/object.d.ts +0 -6
  66. package/lib/benchmarks/object.d.ts.map +0 -1
  67. package/lib/benchmarks/object.js +0 -71
  68. package/lib/benchmarks/object.js.map +0 -1
  69. package/lib/benchmarks/string.d.ts +0 -6
  70. package/lib/benchmarks/string.d.ts.map +0 -1
  71. package/lib/benchmarks/string.js +0 -45
  72. package/lib/benchmarks/string.js.map +0 -1
  73. package/lib/external.d.ts +0 -4
  74. package/lib/external.d.ts.map +0 -1
  75. package/lib/external.js +0 -16
  76. package/lib/external.js.map +0 -1
  77. package/lib/helpers/errorUtil.d.ts +0 -10
  78. package/lib/helpers/errorUtil.d.ts.map +0 -1
  79. package/lib/helpers/errorUtil.js +0 -13
  80. package/lib/helpers/errorUtil.js.map +0 -1
  81. package/lib/helpers/parseUtil.d.ts +0 -74
  82. package/lib/helpers/parseUtil.d.ts.map +0 -1
  83. package/lib/helpers/parseUtil.js +0 -179
  84. package/lib/helpers/parseUtil.js.map +0 -1
  85. package/lib/helpers/partialUtil.d.ts +0 -18
  86. package/lib/helpers/partialUtil.d.ts.map +0 -1
  87. package/lib/helpers/partialUtil.js +0 -3
  88. package/lib/helpers/partialUtil.js.map +0 -1
  89. package/lib/helpers/util.d.ts +0 -18
  90. package/lib/helpers/util.d.ts.map +0 -1
  91. package/lib/helpers/util.js +0 -87
  92. package/lib/helpers/util.js.map +0 -1
  93. package/lib/index.d.ts +0 -4
  94. package/lib/index.d.ts.map +0 -1
  95. package/lib/index.js +0 -29
  96. package/lib/index.js.map +0 -1
  97. package/lib/index.mjs +0 -2808
  98. package/lib/index.mjs.map +0 -1
  99. package/lib/types.d.ts +0 -541
  100. package/lib/types.d.ts.map +0 -1
  101. package/lib/types.js +0 -2282
  102. package/lib/types.js.map +0 -1
package/CHANGELOG.md DELETED
@@ -1,160 +0,0 @@
1
- # Changelog
2
-
3
- ### vNext
4
-
5
- - Object fields of type `unknown` are no longer inferred as optional.
6
- ### 3.2
7
-
8
- - Certain methods (`.or`, `.transform`) now return a new instance that wrap the current instance, instead of trying to avoid additional nesting. For example:
9
-
10
- ```ts
11
- z.union([z.string(), z.number()]).or(z.boolean());
12
- // previously
13
- // => ZodUnion<[ZodString, ZodNumber, ZodBoolean]>
14
-
15
- // now
16
- // => ZodUnion<[ZodUnion<[ZodString, ZodNumber]>, ZodBoolean]>
17
- ```
18
-
19
- This change was made due to recursion limitations in TypeScript 4.3 that made it impossible to properly type these methods.
20
-
21
- ### 3.0.0-beta.1
22
-
23
- - Moved default value logic into ZodDefault. Implemented `.nullish()` method.
24
-
25
- ### 3.0.0-alpha.33
26
-
27
- - Added `.returnType` and `.parameters` methods to ZodFunction
28
-
29
- ### 3.0.0-alpha.32
30
-
31
- - Added `.required()` method to ZodObject
32
-
33
- ### 3.0.0-alpha.30
34
-
35
- - Added Rollup for bundling ESM module
36
-
37
- ### zod@3.0.0-alpha.24
38
-
39
- - Added back ZodIntersection
40
- - Added .and() method to base class
41
-
42
- ### zod@3.0.0-alpha.9
43
-
44
- - Added `z.strictCreate`
45
-
46
- ### zod@3.0.0-alpha.8
47
-
48
- - Allowing optional default values on ZodOptional
49
-
50
- ### zod@3.0.0-alpha.5
51
-
52
- March 17, 2021
53
-
54
- - Refactored parsing logic into individual subclass methods
55
- - Eliminated ZodTypes to enable custom ZodType subclasses
56
- - Removed ZodIntersection
57
- - Added ZodEffects as a container for refinement and transform logic
58
- - Added `or` method to `ZodType`
59
- - Added `format` method to `ZodError`
60
- - Added `unwrap` method to `ZodOptional` and `ZodNullable`
61
- - Added new `default` method and moved default functionality into ZodOptional
62
- - Implemented `z.setErrorMap`
63
- - Exporting `z` variable from `index.ts` to enable `import { z } from 'zod';`
64
-
65
- ### zod@3.0.0-alpha.4
66
-
67
- Jan 25, 2021
68
-
69
- - New implementation of transformers
70
- - Removed type guards
71
-
72
- ### zod@2
73
-
74
- - Added ZodTransformer
75
- - Async refinements
76
-
77
- ### zod@1.11
78
-
79
- - Introduced `.safeParse` option
80
- - Introduced .regex method on string schemas
81
- - Implemented `.primitives()` and `.nonprimitives()` on object schemas
82
- - Implemented `z.nativeEnum()` for creating schemas from TypeScript `enum`s
83
- - Switched to `new URL()` constructor to check valid URLs
84
-
85
- ### zod@1.10
86
-
87
- - Dropping support for TypeScript 3.2
88
-
89
- ### zod@1.9
90
-
91
- - Added z.instanceof() and z.custom()
92
- - Implemented ZodSchema.array() method
93
-
94
- ### zod@1.8
95
-
96
- - Introduced z.void()
97
- - Major overhaul to error handling system, including the introduction of custom error maps
98
- - Wrote new [error handling guide](./ERROR_HANDLING.md)
99
-
100
- ### zod@1.7
101
-
102
- - Added several built-in validators to string, number, and array schemas
103
- - Calls to `.refine` now return new instance
104
-
105
- ### zod@1.5
106
-
107
- - Introduces ZodAny and ZodUnknown
108
-
109
- ### zod@1.4
110
-
111
- - Refinement types (`.refine`)
112
- - Parsing no longer returns deep clone
113
-
114
- ### zod@1.3
115
-
116
- - Promise schemas
117
-
118
- ### zod@1.2.6
119
-
120
- - `.parse` accepts `unknown`
121
- - `bigint` schemas
122
-
123
- ### zod@1.2.5
124
-
125
- - `.partial` and `.deepPartial` on object schemas
126
-
127
- ### zod@1.2.3
128
-
129
- - Added ZodDate
130
-
131
- ### zod@1.2.0
132
-
133
- - Added `.pick`, `.omit`, and `.extend` on object schemas
134
-
135
- ### zod@1.1.0
136
-
137
- - Added ZodRecord
138
-
139
- ### zod@1.0.11
140
-
141
- - Added `.nonstrict`
142
-
143
- ### zod@1.0.10
144
-
145
- - Added type assertions with `.check`
146
-
147
- ### zod@1.0.4
148
-
149
- - Support for empty tuples
150
-
151
- ### zod@1.0.2
152
-
153
- - Added type assertions
154
- - Added ZodLiteral
155
- - Added ZodEnum
156
- - Improved error reporting
157
-
158
- ### zod@1.0.0
159
-
160
- - Initial release