fullstacked 0.12.0-1272 → 0.12.0-1290

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 (165) hide show
  1. package/fullstacked_modules/@fullstacked/ai-agent/index.ts +20 -2
  2. package/fullstacked_modules/@fullstacked/ai-agent/lock.json +469 -38
  3. package/fullstacked_modules/@fullstacked/ai-agent/package.json +11 -1
  4. package/fullstacked_modules/@fullstacked/ai-agent/src/conversation.ts +72 -14
  5. package/fullstacked_modules/@fullstacked/ai-agent/src/index.ts +1 -2
  6. package/fullstacked_modules/@fullstacked/ai-agent/src/markdown.ts +8 -4
  7. package/fullstacked_modules/@fullstacked/ai-agent/src/providers/anthropic.ts +46 -0
  8. package/fullstacked_modules/@fullstacked/ai-agent/src/providers/deepseek.ts +46 -0
  9. package/fullstacked_modules/@fullstacked/ai-agent/src/providers/google.ts +40 -0
  10. package/fullstacked_modules/@fullstacked/ai-agent/src/providers/index.ts +41 -0
  11. package/fullstacked_modules/@fullstacked/ai-agent/src/providers/interface.ts +19 -0
  12. package/fullstacked_modules/@fullstacked/ai-agent/src/providers/mistral.ts +47 -0
  13. package/fullstacked_modules/@fullstacked/ai-agent/src/providers/ollama.ts +26 -9
  14. package/fullstacked_modules/@fullstacked/ai-agent/src/providers/openai.ts +21 -9
  15. package/fullstacked_modules/@fullstacked/ai-agent/src/providers/xai.ts +43 -0
  16. package/fullstacked_modules/@fullstacked/ai-agent/summary.txt +7 -0
  17. package/fullstacked_modules/ai/index.js +155662 -87448
  18. package/fullstacked_modules/esbuild/sass.ts +1 -1
  19. package/fullstacked_modules/fetch/index.ts +1 -4
  20. package/fullstacked_modules/sass/index.js +3 -3
  21. package/fullstacked_modules/zod/README.md +3 -3
  22. package/fullstacked_modules/zod/index.d.cts +2 -2
  23. package/fullstacked_modules/zod/index.d.ts +2 -2
  24. package/fullstacked_modules/zod/package.json +10 -26
  25. package/fullstacked_modules/zod/src/index.ts +2 -2
  26. package/fullstacked_modules/zod/src/v3/tests/string.test.ts +2 -2
  27. package/fullstacked_modules/zod/src/v3/types.ts +1 -3
  28. package/fullstacked_modules/zod/src/v4/classic/checks.ts +0 -1
  29. package/fullstacked_modules/zod/src/v4/classic/compat.ts +0 -4
  30. package/fullstacked_modules/zod/src/v4/classic/errors.ts +2 -9
  31. package/fullstacked_modules/zod/src/v4/classic/schemas.ts +47 -24
  32. package/fullstacked_modules/zod/src/v4/classic/tests/catch.test.ts +5 -4
  33. package/fullstacked_modules/zod/src/v4/classic/tests/datetime.test.ts +0 -6
  34. package/fullstacked_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +0 -42
  35. package/fullstacked_modules/zod/src/v4/classic/tests/error-utils.test.ts +2 -70
  36. package/fullstacked_modules/zod/src/v4/classic/tests/file.test.ts +2 -5
  37. package/fullstacked_modules/zod/src/v4/classic/tests/literal.test.ts +0 -25
  38. package/fullstacked_modules/zod/src/v4/classic/tests/number.test.ts +0 -23
  39. package/fullstacked_modules/zod/src/v4/classic/tests/optional.test.ts +0 -13
  40. package/fullstacked_modules/zod/src/v4/classic/tests/partial.test.ts +0 -193
  41. package/fullstacked_modules/zod/src/v4/classic/tests/pickomit.test.ts +5 -5
  42. package/fullstacked_modules/zod/src/v4/classic/tests/preprocess.test.ts +15 -4
  43. package/fullstacked_modules/zod/src/v4/classic/tests/record.test.ts +1 -15
  44. package/fullstacked_modules/zod/src/v4/classic/tests/recursive-types.test.ts +0 -121
  45. package/fullstacked_modules/zod/src/v4/classic/tests/string.test.ts +4 -119
  46. package/fullstacked_modules/zod/src/v4/classic/tests/template-literal.test.ts +0 -3
  47. package/fullstacked_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +0 -27
  48. package/fullstacked_modules/zod/src/v4/classic/tests/transform.test.ts +0 -104
  49. package/fullstacked_modules/zod/src/v4/classic/tests/tuple.test.ts +2 -2
  50. package/fullstacked_modules/zod/src/v4/classic/tests/union.test.ts +3 -90
  51. package/fullstacked_modules/zod/src/v4/core/api.ts +96 -130
  52. package/fullstacked_modules/zod/src/v4/core/checks.ts +2 -4
  53. package/fullstacked_modules/zod/src/v4/core/doc.ts +2 -2
  54. package/fullstacked_modules/zod/src/v4/core/errors.ts +44 -43
  55. package/fullstacked_modules/zod/src/v4/core/json-schema.ts +3 -6
  56. package/fullstacked_modules/zod/src/v4/core/regexes.ts +6 -9
  57. package/fullstacked_modules/zod/src/v4/core/registries.ts +2 -3
  58. package/fullstacked_modules/zod/src/v4/core/schemas.ts +107 -165
  59. package/fullstacked_modules/zod/src/v4/core/to-json-schema.ts +11 -38
  60. package/fullstacked_modules/zod/src/v4/core/util.ts +105 -157
  61. package/fullstacked_modules/zod/src/v4/core/versions.ts +1 -1
  62. package/fullstacked_modules/zod/src/v4/locales/index.ts +0 -3
  63. package/fullstacked_modules/zod/src/v4/mini/schemas.ts +1 -14
  64. package/fullstacked_modules/zod/src/v4/mini/tests/assignability.test.ts +1 -1
  65. package/fullstacked_modules/zod/src/v4/mini/tests/computed.test.ts +1 -1
  66. package/fullstacked_modules/zod/src/v4/mini/tests/error.test.ts +1 -1
  67. package/fullstacked_modules/zod/src/v4/mini/tests/index.test.ts +1 -1
  68. package/fullstacked_modules/zod/src/v4/mini/tests/number.test.ts +1 -1
  69. package/fullstacked_modules/zod/src/v4/mini/tests/object.test.ts +1 -1
  70. package/fullstacked_modules/zod/src/v4/mini/tests/prototypes.test.ts +1 -1
  71. package/fullstacked_modules/zod/src/v4/mini/tests/recursive-types.test.ts +1 -1
  72. package/fullstacked_modules/zod/src/v4/mini/tests/string.test.ts +1 -1
  73. package/fullstacked_modules/zod/v3/ZodError.d.cts +6 -6
  74. package/fullstacked_modules/zod/v3/ZodError.d.ts +6 -6
  75. package/fullstacked_modules/zod/v3/locales/en.d.cts +1 -1
  76. package/fullstacked_modules/zod/v3/types.d.cts +1 -4
  77. package/fullstacked_modules/zod/v3/types.d.ts +1 -4
  78. package/fullstacked_modules/zod/v4/classic/checks.d.cts +1 -1
  79. package/fullstacked_modules/zod/v4/classic/checks.d.ts +1 -1
  80. package/fullstacked_modules/zod/v4/classic/compat.d.cts +0 -4
  81. package/fullstacked_modules/zod/v4/classic/compat.d.ts +0 -4
  82. package/fullstacked_modules/zod/v4/classic/schemas.d.cts +20 -9
  83. package/fullstacked_modules/zod/v4/classic/schemas.d.ts +20 -9
  84. package/fullstacked_modules/zod/v4/core/api.d.cts +72 -84
  85. package/fullstacked_modules/zod/v4/core/api.d.ts +72 -84
  86. package/fullstacked_modules/zod/v4/core/checks.d.cts +2 -2
  87. package/fullstacked_modules/zod/v4/core/checks.d.ts +2 -2
  88. package/fullstacked_modules/zod/v4/core/doc.d.cts +1 -1
  89. package/fullstacked_modules/zod/v4/core/doc.d.ts +1 -1
  90. package/fullstacked_modules/zod/v4/core/errors.d.cts +22 -24
  91. package/fullstacked_modules/zod/v4/core/errors.d.ts +22 -24
  92. package/fullstacked_modules/zod/v4/core/json-schema.d.cts +3 -3
  93. package/fullstacked_modules/zod/v4/core/json-schema.d.ts +3 -3
  94. package/fullstacked_modules/zod/v4/core/regexes.d.cts +2 -2
  95. package/fullstacked_modules/zod/v4/core/regexes.d.ts +2 -2
  96. package/fullstacked_modules/zod/v4/core/registries.d.cts +1 -1
  97. package/fullstacked_modules/zod/v4/core/registries.d.ts +1 -1
  98. package/fullstacked_modules/zod/v4/core/schemas.d.cts +6 -20
  99. package/fullstacked_modules/zod/v4/core/schemas.d.ts +6 -20
  100. package/fullstacked_modules/zod/v4/core/to-json-schema.d.cts +3 -4
  101. package/fullstacked_modules/zod/v4/core/to-json-schema.d.ts +3 -4
  102. package/fullstacked_modules/zod/v4/core/util.d.cts +0 -2
  103. package/fullstacked_modules/zod/v4/core/util.d.ts +0 -2
  104. package/fullstacked_modules/zod/v4/locales/ar.d.cts +1 -2
  105. package/fullstacked_modules/zod/v4/locales/az.d.cts +1 -2
  106. package/fullstacked_modules/zod/v4/locales/be.d.cts +1 -2
  107. package/fullstacked_modules/zod/v4/locales/ca.d.cts +1 -2
  108. package/fullstacked_modules/zod/v4/locales/cs.d.cts +1 -2
  109. package/fullstacked_modules/zod/v4/locales/de.d.cts +1 -2
  110. package/fullstacked_modules/zod/v4/locales/es.d.cts +1 -2
  111. package/fullstacked_modules/zod/v4/locales/fa.d.cts +1 -2
  112. package/fullstacked_modules/zod/v4/locales/fi.d.cts +1 -2
  113. package/fullstacked_modules/zod/v4/locales/fr-CA.d.cts +1 -2
  114. package/fullstacked_modules/zod/v4/locales/fr.d.cts +1 -2
  115. package/fullstacked_modules/zod/v4/locales/he.d.cts +1 -2
  116. package/fullstacked_modules/zod/v4/locales/hu.d.cts +1 -2
  117. package/fullstacked_modules/zod/v4/locales/id.d.cts +1 -2
  118. package/fullstacked_modules/zod/v4/locales/index.d.cts +0 -3
  119. package/fullstacked_modules/zod/v4/locales/index.d.ts +0 -3
  120. package/fullstacked_modules/zod/v4/locales/it.d.cts +1 -2
  121. package/fullstacked_modules/zod/v4/locales/ja.d.cts +1 -2
  122. package/fullstacked_modules/zod/v4/locales/kh.d.cts +1 -2
  123. package/fullstacked_modules/zod/v4/locales/ko.d.cts +1 -2
  124. package/fullstacked_modules/zod/v4/locales/mk.d.cts +1 -2
  125. package/fullstacked_modules/zod/v4/locales/ms.d.cts +1 -2
  126. package/fullstacked_modules/zod/v4/locales/nl.d.cts +1 -2
  127. package/fullstacked_modules/zod/v4/locales/no.d.cts +1 -2
  128. package/fullstacked_modules/zod/v4/locales/ota.d.cts +1 -2
  129. package/fullstacked_modules/zod/v4/locales/pl.d.cts +1 -2
  130. package/fullstacked_modules/zod/v4/locales/ps.d.cts +1 -2
  131. package/fullstacked_modules/zod/v4/locales/pt.d.cts +1 -2
  132. package/fullstacked_modules/zod/v4/locales/ru.d.cts +1 -2
  133. package/fullstacked_modules/zod/v4/locales/sl.d.cts +1 -2
  134. package/fullstacked_modules/zod/v4/locales/sv.d.cts +1 -2
  135. package/fullstacked_modules/zod/v4/locales/ta.d.cts +1 -2
  136. package/fullstacked_modules/zod/v4/locales/th.d.cts +1 -2
  137. package/fullstacked_modules/zod/v4/locales/ua.d.cts +1 -2
  138. package/fullstacked_modules/zod/v4/locales/ur.d.cts +1 -2
  139. package/fullstacked_modules/zod/v4/locales/vi.d.cts +1 -2
  140. package/fullstacked_modules/zod/v4/locales/zh-CN.d.cts +1 -2
  141. package/fullstacked_modules/zod/v4/locales/zh-TW.d.cts +1 -2
  142. package/fullstacked_modules/zod/v4/mini/schemas.d.cts +0 -2
  143. package/fullstacked_modules/zod/v4/mini/schemas.d.ts +0 -2
  144. package/index.js +1 -1
  145. package/package.json +7 -7
  146. package/fullstacked_modules/ai/package.json +0 -5
  147. package/fullstacked_modules/zod/locales/index.d.cts +0 -1
  148. package/fullstacked_modules/zod/locales/index.d.ts +0 -1
  149. package/fullstacked_modules/zod/mini/index.d.cts +0 -1
  150. package/fullstacked_modules/zod/mini/index.d.ts +0 -1
  151. package/fullstacked_modules/zod/src/locales/index.ts +0 -1
  152. package/fullstacked_modules/zod/src/mini/index.ts +0 -1
  153. package/fullstacked_modules/zod/src/v4/core/tests/extend.test.ts +0 -18
  154. package/fullstacked_modules/zod/src/v4/locales/bg.ts +0 -136
  155. package/fullstacked_modules/zod/src/v4/locales/da.ts +0 -141
  156. package/fullstacked_modules/zod/src/v4/locales/is.ts +0 -127
  157. package/fullstacked_modules/zod/src/v4/locales/yo.ts +0 -131
  158. package/fullstacked_modules/zod/v4/locales/bg.d.cts +0 -5
  159. package/fullstacked_modules/zod/v4/locales/bg.d.ts +0 -5
  160. package/fullstacked_modules/zod/v4/locales/da.d.cts +0 -5
  161. package/fullstacked_modules/zod/v4/locales/da.d.ts +0 -4
  162. package/fullstacked_modules/zod/v4/locales/is.d.cts +0 -5
  163. package/fullstacked_modules/zod/v4/locales/is.d.ts +0 -5
  164. package/fullstacked_modules/zod/v4/locales/yo.d.cts +0 -5
  165. package/fullstacked_modules/zod/v4/locales/yo.d.ts +0 -4
@@ -90,28 +90,3 @@ test("readonly", () => {
90
90
  const a = ["asdf"] as const;
91
91
  z.literal(a);
92
92
  });
93
-
94
- test("literal pattern", () => {
95
- expect(z.literal(1.1)._zod.pattern).toMatchInlineSnapshot(`/\\^\\(1\\\\\\.1\\)\\$/`);
96
-
97
- expect(z.templateLiteral([z.literal(1.1)]).safeParse("1.1")).toMatchInlineSnapshot(`
98
- {
99
- "data": "1.1",
100
- "success": true,
101
- }
102
- `);
103
- expect(z.templateLiteral([z.literal(1.1)]).safeParse("1n1")).toMatchInlineSnapshot(`
104
- {
105
- "error": [ZodError: [
106
- {
107
- "code": "invalid_format",
108
- "format": "template_literal",
109
- "pattern": "^(1\\\\.1)$",
110
- "path": [],
111
- "message": "Invalid input"
112
- }
113
- ]],
114
- "success": false,
115
- }
116
- `);
117
- });
@@ -114,29 +114,6 @@ test(".nonnegative() validation", () => {
114
114
  expect(() => schema.parse(-1)).toThrow();
115
115
  });
116
116
 
117
- test("multipleOf", () => {
118
- const numbers = {
119
- number3: 5.123,
120
- number6: 5.123456,
121
- number7: 5.1234567,
122
- number8: 5.12345678,
123
- };
124
-
125
- const schemas = {
126
- schema6: z.number().multipleOf(0.000001),
127
- schema7: z.number().multipleOf(0.0000001),
128
- };
129
-
130
- expect(() => schemas.schema6.parse(numbers.number3)).not.toThrow();
131
- expect(() => schemas.schema6.parse(numbers.number6)).not.toThrow();
132
- expect(() => schemas.schema6.parse(numbers.number7)).toThrow();
133
- expect(() => schemas.schema6.parse(numbers.number8)).toThrow();
134
- expect(() => schemas.schema7.parse(numbers.number3)).not.toThrow();
135
- expect(() => schemas.schema7.parse(numbers.number6)).not.toThrow();
136
- expect(() => schemas.schema7.parse(numbers.number7)).not.toThrow();
137
- expect(() => schemas.schema7.parse(numbers.number8)).toThrow();
138
- });
139
-
140
117
  test(".multipleOf() with positive divisor", () => {
141
118
  const schema = z.number().multipleOf(5);
142
119
  expect(schema.parse(15)).toEqual(15);
@@ -121,16 +121,3 @@ test("pipe optionality inside objects", () => {
121
121
  e: string;
122
122
  }>();
123
123
  });
124
-
125
- test("optional prop with pipe", () => {
126
- const schema = z.object({
127
- id: z
128
- .union([z.number(), z.string().nullish()])
129
- .transform((val) => (val === null || val === undefined ? val : Number(val)))
130
- .pipe(z.number())
131
- .optional(),
132
- });
133
-
134
- schema.parse({});
135
- schema.parse({}, { jitless: true });
136
- });
@@ -145,196 +145,3 @@ test("partial with mask -- ignore falsy values", async () => {
145
145
  masked.parse({ country: "US" });
146
146
  await masked.parseAsync({ country: "US" });
147
147
  });
148
-
149
- test("catch/prefault/default", () => {
150
- const mySchema = z.object({
151
- a: z.string().catch("catch value").optional(),
152
- b: z.string().default("default value").optional(),
153
- c: z.string().prefault("prefault value").optional(),
154
- d: z.string().catch("catch value"),
155
- e: z.string().default("default value"),
156
- f: z.string().prefault("prefault value"),
157
- });
158
-
159
- expect(mySchema.parse({})).toMatchInlineSnapshot(`
160
- {
161
- "b": "default value",
162
- "c": "prefault value",
163
- "d": "catch value",
164
- "e": "default value",
165
- "f": "prefault value",
166
- }
167
- `);
168
-
169
- expect(mySchema.parse({}, { jitless: true })).toMatchInlineSnapshot(`
170
- {
171
- "b": "default value",
172
- "c": "prefault value",
173
- "d": "catch value",
174
- "e": "default value",
175
- "f": "prefault value",
176
- }
177
- `);
178
- });
179
-
180
- test("handleOptionalObjectResult branches", () => {
181
- const mySchema = z.object({
182
- // Branch: input[key] === undefined, key not in input, caught error
183
- caughtMissing: z.string().catch("caught").optional(),
184
- // Branch: input[key] === undefined, key in input, caught error
185
- caughtUndefined: z.string().catch("caught").optional(),
186
- // Branch: input[key] === undefined, key not in input, validation issues
187
- issueMissing: z.string().min(5).optional(),
188
- // Branch: input[key] === undefined, key in input, validation issues
189
- issueUndefined: z.string().min(5).optional(),
190
- // Branch: input[key] === undefined, validation returns undefined
191
- validUndefined: z.string().optional(),
192
- // Branch: input[key] === undefined, non-undefined result (default/transform)
193
- defaultValue: z.string().default("default").optional(),
194
- // Branch: input[key] defined, caught error
195
- caughtDefined: z.string().catch("caught").optional(),
196
- // Branch: input[key] defined, validation issues
197
- issueDefined: z.string().min(5).optional(),
198
- // Branch: input[key] defined, validation returns undefined
199
- validDefinedUndefined: z
200
- .string()
201
- .transform(() => undefined)
202
- .optional(),
203
- // Branch: input[key] defined, non-undefined value
204
- validDefined: z.string().optional(),
205
- });
206
-
207
- // Test input[key] === undefined cases
208
- const result1 = mySchema.parse(
209
- {
210
- // caughtMissing: not present (key not in input)
211
- caughtUndefined: undefined, // key in input
212
- // issueMissing: not present (key not in input)
213
- issueUndefined: undefined, // key in input
214
- validUndefined: undefined,
215
- // defaultValue: not present, will get default
216
- },
217
- { jitless: true }
218
- );
219
-
220
- expect(result1).toEqual({
221
- caughtUndefined: undefined,
222
- issueUndefined: undefined,
223
- validUndefined: undefined,
224
- defaultValue: "default",
225
- });
226
-
227
- // Test input[key] defined cases (successful)
228
- const result2 = mySchema.parse(
229
- {
230
- caughtDefined: 123, // invalid type, should catch
231
- validDefinedUndefined: "test", // transforms to undefined
232
- validDefined: "valid", // valid value
233
- },
234
- { jitless: true }
235
- );
236
-
237
- expect(result2).toEqual({
238
- caughtDefined: "caught",
239
- validDefinedUndefined: undefined,
240
- validDefined: "valid",
241
- defaultValue: "default",
242
- });
243
-
244
- // Test validation issues are properly reported (input[key] defined, validation fails)
245
- expect(() =>
246
- mySchema.parse(
247
- {
248
- issueDefined: "abc", // too short
249
- },
250
- { jitless: true }
251
- )
252
- ).toThrow();
253
- });
254
-
255
- test("fastpass vs non-fastpass consistency", () => {
256
- const mySchema = z.object({
257
- caughtMissing: z.string().catch("caught").optional(),
258
- caughtUndefined: z.string().catch("caught").optional(),
259
- issueMissing: z.string().min(5).optional(),
260
- issueUndefined: z.string().min(5).optional(),
261
- validUndefined: z.string().optional(),
262
- defaultValue: z.string().default("default").optional(),
263
- caughtDefined: z.string().catch("caught").optional(),
264
- validDefinedUndefined: z
265
- .string()
266
- .transform(() => undefined)
267
- .optional(),
268
- validDefined: z.string().optional(),
269
- });
270
-
271
- const input = {
272
- caughtUndefined: undefined,
273
- issueUndefined: undefined,
274
- validUndefined: undefined,
275
- caughtDefined: 123,
276
- validDefinedUndefined: "test",
277
- validDefined: "valid",
278
- };
279
-
280
- // Test both paths produce identical results
281
- const jitlessResult = mySchema.parse(input, { jitless: true });
282
- const fastpassResult = mySchema.parse(input);
283
-
284
- expect(jitlessResult).toEqual(fastpassResult);
285
- expect(jitlessResult).toEqual({
286
- caughtUndefined: undefined,
287
- issueUndefined: undefined,
288
- validUndefined: undefined,
289
- defaultValue: "default",
290
- caughtDefined: "caught",
291
- validDefinedUndefined: undefined,
292
- validDefined: "valid",
293
- });
294
- });
295
-
296
- test("optional with check", () => {
297
- const baseSchema = z
298
- .string()
299
- .optional()
300
- .check(({ value, ...ctx }) => {
301
- ctx.issues.push({
302
- code: "custom",
303
- input: value,
304
- message: "message",
305
- });
306
- });
307
-
308
- // this correctly fails
309
- expect(baseSchema.safeParse(undefined)).toMatchInlineSnapshot(`
310
- {
311
- "error": [ZodError: [
312
- {
313
- "code": "custom",
314
- "message": "message",
315
- "path": []
316
- }
317
- ]],
318
- "success": false,
319
- }
320
- `);
321
-
322
- const schemaObject = z.object({
323
- date: baseSchema,
324
- });
325
-
326
- expect(schemaObject.safeParse({ date: undefined })).toMatchInlineSnapshot(`
327
- {
328
- "error": [ZodError: [
329
- {
330
- "code": "custom",
331
- "message": "message",
332
- "path": [
333
- "date"
334
- ]
335
- }
336
- ]],
337
- "success": false,
338
- }
339
- `);
340
- });
@@ -114,14 +114,14 @@ test("pick/omit/required/partial - do not allow unknown keys", () => {
114
114
  age: z.number(),
115
115
  });
116
116
 
117
- expect(() => schema.pick({ name: true, asdf: true }).safeParse({})).toThrow();
117
+ expect(() => schema.pick({ name: true, asdf: true })).toThrow();
118
118
 
119
119
  // @ts-expect-error
120
- expect(() => schema.pick({ $unknown: true }).safeParse({})).toThrow();
120
+ expect(() => schema.pick({ $unknown: true })).toThrow();
121
121
  // @ts-expect-error
122
- expect(() => schema.omit({ $unknown: true }).safeParse({})).toThrow();
122
+ expect(() => schema.omit({ $unknown: true })).toThrow();
123
123
  // @ts-expect-error
124
- expect(() => schema.required({ $unknown: true }).safeParse({})).toThrow();
124
+ expect(() => schema.required({ $unknown: true })).toThrow();
125
125
  // @ts-expect-error
126
- expect(() => schema.partial({ $unknown: true }).safeParse({})).toThrow();
126
+ expect(() => schema.partial({ $unknown: true })).toThrow();
127
127
  });
@@ -73,18 +73,17 @@ test("preprocess ctx.addIssue with parse", () => {
73
73
  `);
74
74
  });
75
75
 
76
- test("preprocess ctx.addIssue fatal by default", () => {
76
+ test("preprocess ctx.addIssue non-fatal by default", () => {
77
77
  const schema = z.preprocess((data, ctx) => {
78
78
  ctx.addIssue({
79
79
  code: "custom",
80
80
  message: `custom error`,
81
81
  });
82
-
83
82
  return data;
84
83
  }, z.string());
85
84
  const result = schema.safeParse(1234);
86
85
 
87
- expect(result.error!.issues).toHaveLength(1);
86
+ expect(result.error!.issues).toHaveLength(2);
88
87
  expect(result).toMatchInlineSnapshot(`
89
88
  {
90
89
  "error": [ZodError: [
@@ -92,6 +91,12 @@ test("preprocess ctx.addIssue fatal by default", () => {
92
91
  "code": "custom",
93
92
  "message": "custom error",
94
93
  "path": []
94
+ },
95
+ {
96
+ "expected": "string",
97
+ "code": "invalid_type",
98
+ "path": [],
99
+ "message": "Invalid input: expected string, received number"
95
100
  }
96
101
  ]],
97
102
  "success": false,
@@ -170,7 +175,7 @@ test("z.NEVER in preprocess", () => {
170
175
  expectTypeOf<foo>().toEqualTypeOf<number>();
171
176
  const result = foo.safeParse(undefined);
172
177
 
173
- expect(result.error!.issues).toHaveLength(1);
178
+ expect(result.error!.issues).toHaveLength(2);
174
179
  expect(result).toMatchInlineSnapshot(`
175
180
  {
176
181
  "error": [ZodError: [
@@ -178,6 +183,12 @@ test("z.NEVER in preprocess", () => {
178
183
  "code": "custom",
179
184
  "message": "bad",
180
185
  "path": []
186
+ },
187
+ {
188
+ "expected": "number",
189
+ "code": "invalid_type",
190
+ "path": [],
191
+ "message": "Invalid input: expected number, received object"
181
192
  }
182
193
  ]],
183
194
  "success": false,
@@ -336,21 +336,7 @@ test("partial record", () => {
336
336
  type schema = z.infer<typeof schema>;
337
337
  expectTypeOf<schema>().toEqualTypeOf<Partial<Record<string, string>>>();
338
338
 
339
- const Keys = z.enum(["id", "name", "email"]); //.or(z.never());
339
+ const Keys = z.enum(["id", "name", "email"]).or(z.never());
340
340
  const Person = z.partialRecord(Keys, z.string());
341
341
  expectTypeOf<z.infer<typeof Person>>().toEqualTypeOf<Partial<Record<"id" | "name" | "email", string>>>();
342
-
343
- Person.parse({
344
- id: "123",
345
- // name: "John",
346
- // email: "john@example.com",
347
- });
348
-
349
- Person.parse({
350
- // id: "123",
351
- // name: "John",
352
- email: "john@example.com",
353
- });
354
-
355
- expect(Person.def.keyType._zod.def.type).toEqual("enum");
356
342
  });
@@ -260,127 +260,6 @@ test("mutual recursion with meta", () => {
260
260
  expectTypeOf<B>().toEqualTypeOf<_B>();
261
261
  });
262
262
 
263
- test("intersection with recursive types", () => {
264
- const A = z.discriminatedUnion("type", [
265
- z.object({
266
- type: z.literal("CONTAINER"),
267
- }),
268
- z.object({
269
- type: z.literal("SCREEN"),
270
- config: z.object({ x: z.number(), y: z.number() }),
271
- }),
272
- ]);
273
- // type A = z.infer<typeof A>;
274
-
275
- const B = z.object({
276
- get children() {
277
- return z.array(C).optional();
278
- },
279
- });
280
- // type B = z.infer<typeof B>;
281
-
282
- const C = z.intersection(A, B);
283
- type C = z.infer<typeof C>;
284
-
285
- type _C = (
286
- | {
287
- type: "CONTAINER";
288
- }
289
- | {
290
- type: "SCREEN";
291
- config: {
292
- x: number;
293
- y: number;
294
- };
295
- }
296
- ) & {
297
- children?: _C[] | undefined;
298
- };
299
- expectTypeOf<C>().toEqualTypeOf<_C>();
300
- });
301
-
302
- test("object utilities with recursive types", () => {
303
- const NodeBase = z.object({
304
- id: z.string(),
305
- name: z.string(),
306
- get children() {
307
- return z.array(Node).optional();
308
- },
309
- });
310
-
311
- // Test extend
312
- const NodeOne = NodeBase.extend({
313
- name: z.literal("nodeOne"),
314
- get children() {
315
- return z.array(Node);
316
- },
317
- });
318
-
319
- const NodeTwo = NodeBase.extend({
320
- name: z.literal("nodeTwo"),
321
- get children() {
322
- return z.array(Node);
323
- },
324
- });
325
-
326
- // Test pick
327
- const PickedNode = NodeBase.pick({ id: true, name: true });
328
-
329
- // Test omit
330
- const OmittedNode = NodeBase.omit({ children: true });
331
-
332
- // Test merge
333
- const ExtraProps = {
334
- metadata: z.string(),
335
- get parent() {
336
- return Node.optional();
337
- },
338
- };
339
- const MergedNode = NodeBase.extend(ExtraProps);
340
-
341
- // Test partial
342
- const PartialNode = NodeBase.partial();
343
- const PartialMaskedNode = NodeBase.partial({ name: true });
344
-
345
- // Test required (assuming NodeBase has optional fields)
346
- const OptionalNodeBase = z.object({
347
- id: z.string().optional(),
348
- name: z.string().optional(),
349
- get children() {
350
- return z.array(Node).optional();
351
- },
352
- });
353
- const RequiredNode = OptionalNodeBase.required();
354
- const RequiredMaskedNode = OptionalNodeBase.required({ id: true });
355
-
356
- const Node = z.union([
357
- NodeOne,
358
- NodeTwo,
359
- PickedNode,
360
- OmittedNode,
361
- MergedNode,
362
- PartialNode,
363
- PartialMaskedNode,
364
- RequiredNode,
365
- RequiredMaskedNode,
366
- ]);
367
- });
368
-
369
- test("tuple with recursive types", () => {
370
- const TaskListNodeSchema = z.strictObject({
371
- type: z.literal("taskList"),
372
- get content() {
373
- return z.array(z.tuple([TaskListNodeSchema, z.union([TaskListNodeSchema])])).min(1);
374
- },
375
- });
376
- type TaskListNodeSchema = z.infer<typeof TaskListNodeSchema>;
377
- type _TaskListNodeSchema = {
378
- type: "taskList";
379
- content: [_TaskListNodeSchema, _TaskListNodeSchema][];
380
- };
381
- expectTypeOf<TaskListNodeSchema>().toEqualTypeOf<_TaskListNodeSchema>();
382
- });
383
-
384
263
  test("recursion compatibility", () => {
385
264
  // array
386
265
  const A = z.object({
@@ -318,83 +318,6 @@ test("url validations", () => {
318
318
  expect(() => url.parse("https://")).toThrow();
319
319
  });
320
320
 
321
- test("url preserves original input", () => {
322
- const url = z.string().url();
323
-
324
- // Test the specific case from the user report
325
- const input = "https://example.com?key=NUXOmHqWNVTapJkJJHw8BfD155AuqhH_qju_5fNmQ4ZHV7u8";
326
- const output = url.parse(input);
327
- expect(output).toBe(input); // Should preserve the original input exactly
328
-
329
- // Test other cases where URL constructor would normalize
330
- expect(url.parse("https://example.com?foo=bar")).toBe("https://example.com?foo=bar");
331
- expect(url.parse("http://example.com?test=123")).toBe("http://example.com?test=123");
332
- expect(url.parse("https://sub.example.com?param=value&other=data")).toBe(
333
- "https://sub.example.com?param=value&other=data"
334
- );
335
-
336
- // Test cases with trailing slashes are preserved
337
- expect(url.parse("https://example.com/")).toBe("https://example.com/");
338
- expect(url.parse("https://example.com/path/")).toBe("https://example.com/path/");
339
-
340
- // Test cases with paths and query parameters
341
- expect(url.parse("https://example.com/path?query=param")).toBe("https://example.com/path?query=param");
342
- });
343
-
344
- test("url trims whitespace", () => {
345
- const url = z.string().url();
346
-
347
- // Test trimming whitespace from URLs
348
- expect(url.parse(" https://example.com ")).toBe("https://example.com");
349
- expect(url.parse(" https://example.com/path?query=param ")).toBe("https://example.com/path?query=param");
350
- expect(url.parse("\t\nhttps://example.com\t\n")).toBe("https://example.com");
351
- expect(url.parse(" https://example.com?key=value ")).toBe("https://example.com?key=value");
352
-
353
- // Test that URLs without extra whitespace are unchanged
354
- expect(url.parse("https://example.com")).toBe("https://example.com");
355
- expect(url.parse("https://example.com/path")).toBe("https://example.com/path");
356
- });
357
-
358
- test("url normalize flag", () => {
359
- const normalizeUrl = z.url({ normalize: true });
360
- const preserveUrl = z.url(); // normalize: false/undefined by default
361
-
362
- // Test that normalize flag causes URL normalization
363
- expect(normalizeUrl.parse("https://example.com?key=value")).toBe("https://example.com/?key=value");
364
- expect(normalizeUrl.parse("http://example.com?test=123")).toBe("http://example.com/?test=123");
365
-
366
- // Test with already normalized URLs
367
- expect(normalizeUrl.parse("https://example.com/")).toBe("https://example.com/");
368
- expect(normalizeUrl.parse("https://example.com/path?query=param")).toBe("https://example.com/path?query=param");
369
-
370
- // Test complex URLs with normalization
371
- expect(normalizeUrl.parse("https://example.com/../?key=value")).toBe("https://example.com/?key=value");
372
- expect(normalizeUrl.parse("https://example.com/./path?key=value")).toBe("https://example.com/path?key=value");
373
-
374
- // Compare with non-normalize behavior
375
- expect(preserveUrl.parse("https://example.com?key=value")).toBe("https://example.com?key=value");
376
- expect(preserveUrl.parse("http://example.com?test=123")).toBe("http://example.com?test=123");
377
-
378
- // Test trimming with normalize
379
- expect(normalizeUrl.parse(" https://example.com?key=value ")).toBe("https://example.com/?key=value");
380
- expect(preserveUrl.parse(" https://example.com?key=value ")).toBe("https://example.com?key=value");
381
- });
382
-
383
- test("url normalize with hostname and protocol constraints", () => {
384
- const constrainedNormalizeUrl = z.url({
385
- normalize: true,
386
- protocol: /^https$/,
387
- hostname: /^example\.com$/,
388
- });
389
-
390
- // Test that normalization works with constraints
391
- expect(constrainedNormalizeUrl.parse("https://example.com?key=value")).toBe("https://example.com/?key=value");
392
-
393
- // Test that constraints are still enforced
394
- expect(() => constrainedNormalizeUrl.parse("http://example.com?key=value")).toThrow();
395
- expect(() => constrainedNormalizeUrl.parse("https://other.com?key=value")).toThrow();
396
- });
397
-
398
321
  test("httpurl", () => {
399
322
  const httpUrl = z.url({
400
323
  protocol: /^https?$/,
@@ -541,8 +464,8 @@ test(`bad uuid`, () => {
541
464
  "9491d710-3185-0e06-bea0-6a2f275345e0",
542
465
  "9491d710-3185-5e06-0ea0-6a2f275345e0",
543
466
  "d89e7b01-7598-ed11-9d7a-0022489382fd", // new sequential id
544
- "b3ce60f8-e8b9-40f5-1150-172ede56ff74", // Variant 0 - RFC 9562/4122: Reserved, NCS backward compatibility
545
- "92e76bf9-28b3-4730-cd7f-cb6bc51f8c09", // Variant 2 - RFC 9562/4122: Reserved, Microsoft Corporation backward compatibility
467
+ "b3ce60f8-e8b9-40f5-1150-172ede56ff74", // Variant 0 - RFC 4122: Reserved, NCS backward compatibility
468
+ "92e76bf9-28b3-4730-cd7f-cb6bc51f8c09", // Variant 2 - RFC 4122: Reserved, Microsoft Corporation backward compatibility
546
469
  "invalid uuid",
547
470
  "9491d710-3185-4e06-bea0-6a2f275345e0X",
548
471
  "ffffffff-ffff-ffff-ffff-ffffffffffff",
@@ -558,8 +481,8 @@ test("good guid", () => {
558
481
  for (const goodGuid of [
559
482
  "9491d710-3185-4e06-bea0-6a2f275345e0",
560
483
  "d89e7b01-7598-ed11-9d7a-0022489382fd", // new sequential id
561
- "b3ce60f8-e8b9-40f5-1150-172ede56ff74", // Variant 0 - RFC 9562/4122: Reserved, NCS backward compatibility
562
- "92e76bf9-28b3-4730-cd7f-cb6bc51f8c09", // Variant 2 - RFC 9562/4122: Reserved, Microsoft Corporation backward compatibility
484
+ "b3ce60f8-e8b9-40f5-1150-172ede56ff74", // Variant 0 - RFC 4122: Reserved, NCS backward compatibility
485
+ "92e76bf9-28b3-4730-cd7f-cb6bc51f8c09", // Variant 2 - RFC 4122: Reserved, Microsoft Corporation backward compatibility
563
486
  "00000000-0000-0000-0000-000000000000",
564
487
  "ffffffff-ffff-ffff-ffff-ffffffffffff",
565
488
  ]) {
@@ -956,41 +879,3 @@ test("E.164 validation", () => {
956
879
  expect(validE164Numbers.every((number) => e164Number.safeParse(number).success)).toBe(true);
957
880
  expect(invalidE164Numbers.every((number) => e164Number.safeParse(number).success === false)).toBe(true);
958
881
  });
959
-
960
- test("hostname", () => {
961
- const hostname = z.hostname();
962
-
963
- // Valid hostnames
964
- hostname.parse("localhost");
965
- hostname.parse("example.com");
966
- hostname.parse("sub.example.com");
967
- hostname.parse("a-b-c.example.com");
968
- hostname.parse("123.example.com");
969
- hostname.parse("example-123.com");
970
- hostname.parse("example-123.1234");
971
- hostname.parse("developer.mozilla.org");
972
- hostname.parse("hello.world.example.com");
973
- hostname.parse("www.google.com");
974
- hostname.parse("192.168.1.1");
975
- hostname.parse("xn--d1acj3b.com");
976
- hostname.parse("xn--d1acj3b.org");
977
- hostname.parse("xn--d1acj3b");
978
-
979
- // Invalid hostnames
980
- expect(() => hostname.parse("")).toThrow();
981
- expect(() => hostname.parse("example..com")).toThrow();
982
- expect(() => hostname.parse("example-.com")).toThrow();
983
- expect(() => hostname.parse("-example.com")).toThrow();
984
- expect(() => hostname.parse("example.com-")).toThrow();
985
- expect(() => hostname.parse("example_com")).toThrow();
986
- expect(() => hostname.parse("example.com:8080")).toThrow();
987
- expect(() => hostname.parse("http://example.com")).toThrow();
988
- expect(() => hostname.parse("ht!tp://invalid.com")).toThrow();
989
-
990
- expect(() => hostname.parse("xn--d1acj3b..com")).toThrow();
991
- expect(() => hostname.parse("ex@mple.com")).toThrow();
992
- expect(() => hostname.parse("[2001:db8::zzzz]")).toThrow();
993
- expect(() => hostname.parse("exa mple.com")).toThrow();
994
- expect(() => hostname.parse("-example.com")).toThrow();
995
- expect(() => hostname.parse("example..com")).toThrow();
996
- });
@@ -6,7 +6,6 @@ const hello = z.templateLiteral(["hello"]);
6
6
  const world = z.templateLiteral(["", z.literal("world")]);
7
7
  const one = z.templateLiteral([1]);
8
8
  const two = z.templateLiteral(["", z.literal(2)]);
9
- const onePointOne = z.templateLiteral([z.literal(1.1)]);
10
9
  const truee = z.templateLiteral([true]);
11
10
  const anotherTrue = z.templateLiteral(["", z.literal(true)]);
12
11
  const falsee = z.templateLiteral([false]);
@@ -290,7 +289,6 @@ test("template literal parsing - success - basic cases", () => {
290
289
  world.parse("world");
291
290
  one.parse("1");
292
291
  two.parse("2");
293
- onePointOne.parse("1.1");
294
292
  truee.parse("true");
295
293
  anotherTrue.parse("true");
296
294
  falsee.parse("false");
@@ -383,7 +381,6 @@ test("template literal parsing - failure - basic cases", () => {
383
381
  expect(() => one.parse("2")).toThrow();
384
382
  expect(() => one.parse("12")).toThrow();
385
383
  expect(() => one.parse("21")).toThrow();
386
- expect(() => onePointOne.parse("1s1")).toThrow();
387
384
  expect(() => two.parse("1")).toThrow();
388
385
  expect(() => two.parse("21")).toThrow();
389
386
  expect(() => two.parse("12")).toThrow();