zod 4.0.16 → 4.0.17
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.
- package/package.json +1 -1
- package/src/v4/core/schemas.ts +3 -2
- package/src/v4/core/versions.ts +1 -1
- package/v4/core/schemas.cjs +3 -2
- package/v4/core/schemas.js +3 -2
- package/v4/core/versions.cjs +1 -1
- package/v4/core/versions.js +1 -1
package/package.json
CHANGED
package/src/v4/core/schemas.ts
CHANGED
|
@@ -1721,7 +1721,7 @@ export const $ZodObject: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$con
|
|
|
1721
1721
|
const _normalized = util.cached(() => {
|
|
1722
1722
|
const keys = Object.keys(def.shape);
|
|
1723
1723
|
for (const k of keys) {
|
|
1724
|
-
if (!
|
|
1724
|
+
if (!def.shape[k]._zod.traits.has("$ZodType")) {
|
|
1725
1725
|
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
1726
1726
|
}
|
|
1727
1727
|
}
|
|
@@ -3642,7 +3642,8 @@ export const $ZodTemplateLiteral: core.$constructor<$ZodTemplateLiteral> = /*@__
|
|
|
3642
3642
|
$ZodType.init(inst, def);
|
|
3643
3643
|
const regexParts: string[] = [];
|
|
3644
3644
|
for (const part of def.parts) {
|
|
3645
|
-
if (part
|
|
3645
|
+
if (typeof part === "object" && part !== null) {
|
|
3646
|
+
// is Zod schema
|
|
3646
3647
|
if (!part._zod.pattern) {
|
|
3647
3648
|
// if (!source)
|
|
3648
3649
|
throw new Error(`Invalid template literal part, no pattern found: ${[...(part as any)._zod.traits].shift()}`);
|
package/src/v4/core/versions.ts
CHANGED
package/v4/core/schemas.cjs
CHANGED
|
@@ -710,7 +710,7 @@ exports.$ZodObject = core.$constructor("$ZodObject", (inst, def) => {
|
|
|
710
710
|
const _normalized = util.cached(() => {
|
|
711
711
|
const keys = Object.keys(def.shape);
|
|
712
712
|
for (const k of keys) {
|
|
713
|
-
if (!
|
|
713
|
+
if (!def.shape[k]._zod.traits.has("$ZodType")) {
|
|
714
714
|
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
715
715
|
}
|
|
716
716
|
}
|
|
@@ -1632,7 +1632,8 @@ exports.$ZodTemplateLiteral = core.$constructor("$ZodTemplateLiteral", (inst, de
|
|
|
1632
1632
|
exports.$ZodType.init(inst, def);
|
|
1633
1633
|
const regexParts = [];
|
|
1634
1634
|
for (const part of def.parts) {
|
|
1635
|
-
if (part
|
|
1635
|
+
if (typeof part === "object" && part !== null) {
|
|
1636
|
+
// is Zod schema
|
|
1636
1637
|
if (!part._zod.pattern) {
|
|
1637
1638
|
// if (!source)
|
|
1638
1639
|
throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
|
package/v4/core/schemas.js
CHANGED
|
@@ -679,7 +679,7 @@ export const $ZodObject = /*@__PURE__*/ core.$constructor("$ZodObject", (inst, d
|
|
|
679
679
|
const _normalized = util.cached(() => {
|
|
680
680
|
const keys = Object.keys(def.shape);
|
|
681
681
|
for (const k of keys) {
|
|
682
|
-
if (!
|
|
682
|
+
if (!def.shape[k]._zod.traits.has("$ZodType")) {
|
|
683
683
|
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
684
684
|
}
|
|
685
685
|
}
|
|
@@ -1601,7 +1601,8 @@ export const $ZodTemplateLiteral = /*@__PURE__*/ core.$constructor("$ZodTemplate
|
|
|
1601
1601
|
$ZodType.init(inst, def);
|
|
1602
1602
|
const regexParts = [];
|
|
1603
1603
|
for (const part of def.parts) {
|
|
1604
|
-
if (part
|
|
1604
|
+
if (typeof part === "object" && part !== null) {
|
|
1605
|
+
// is Zod schema
|
|
1605
1606
|
if (!part._zod.pattern) {
|
|
1606
1607
|
// if (!source)
|
|
1607
1608
|
throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
|
package/v4/core/versions.cjs
CHANGED
package/v4/core/versions.js
CHANGED