attaform 0.16.3 → 0.16.4
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/dist/chunks/devtools.cjs +1 -1
- package/dist/chunks/devtools.mjs +1 -1
- package/dist/index.cjs +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -4
- package/dist/index.d.mts +33 -4
- package/dist/index.d.ts +33 -4
- package/dist/index.mjs +3 -3
- package/dist/nuxt.d.cts +1 -1
- package/dist/nuxt.d.mts +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/shared/{attaform.lFNwBcA3.d.ts → attaform.CCQkY4Ta.d.ts} +1 -1
- package/dist/shared/{attaform.c_NzdRyc.cjs → attaform.CIwZtbGV.cjs} +6 -2
- package/dist/shared/attaform.CIwZtbGV.cjs.map +1 -0
- package/dist/shared/{attaform.Bls_kFR6.d.mts → attaform.CMRmwGDt.d.cts} +1 -1
- package/dist/shared/{attaform._EqYNPYF.d.ts → attaform.CU3JperC.d.cts} +172 -14
- package/dist/shared/{attaform._EqYNPYF.d.cts → attaform.CU3JperC.d.mts} +172 -14
- package/dist/shared/{attaform._EqYNPYF.d.mts → attaform.CU3JperC.d.ts} +172 -14
- package/dist/shared/{attaform.DLnKT7wk.d.cts → attaform.CXMOheyZ.d.mts} +1 -1
- package/dist/shared/{attaform.jrxE_xZw.mjs → attaform.DZRj9s0s.mjs} +5 -3
- package/dist/shared/attaform.DZRj9s0s.mjs.map +1 -0
- package/dist/shared/{attaform.KrNw10aW.cjs → attaform.Dd_pWnmn.cjs} +12 -13
- package/dist/shared/attaform.Dd_pWnmn.cjs.map +1 -0
- package/dist/shared/{attaform.DILbdvfo.mjs → attaform.DyV1O4tI.mjs} +111 -22
- package/dist/shared/attaform.DyV1O4tI.mjs.map +1 -0
- package/dist/shared/{attaform.CFA6y0KF.mjs → attaform.UA19EF3J.mjs} +12 -13
- package/dist/shared/attaform.UA19EF3J.mjs.map +1 -0
- package/dist/shared/{attaform.C9Ph2SMx.cjs → attaform.fegmBJaq.cjs} +111 -21
- package/dist/shared/attaform.fegmBJaq.cjs.map +1 -0
- package/dist/shared/{attaform.XYOMTvuO.mjs → attaform.g7rfuXdz.mjs} +7 -3
- package/dist/shared/attaform.g7rfuXdz.mjs.map +1 -0
- package/dist/shared/{attaform.DGuGGNg9.cjs → attaform.keLBaHB6.cjs} +7 -3
- package/dist/shared/attaform.keLBaHB6.cjs.map +1 -0
- package/dist/zod-v3.cjs +2 -2
- package/dist/zod-v3.d.cts +3 -3
- package/dist/zod-v3.d.mts +3 -3
- package/dist/zod-v3.d.ts +3 -3
- package/dist/zod-v3.mjs +2 -2
- package/dist/zod-v4.cjs +2 -2
- package/dist/zod-v4.d.cts +3 -3
- package/dist/zod-v4.d.mts +3 -3
- package/dist/zod-v4.d.ts +3 -3
- package/dist/zod-v4.mjs +2 -2
- package/dist/zod.cjs +3 -3
- package/dist/zod.d.cts +3 -3
- package/dist/zod.d.mts +3 -3
- package/dist/zod.d.ts +3 -3
- package/dist/zod.mjs +3 -3
- package/package.json +1 -1
- package/dist/shared/attaform.C9Ph2SMx.cjs.map +0 -1
- package/dist/shared/attaform.CFA6y0KF.mjs.map +0 -1
- package/dist/shared/attaform.DGuGGNg9.cjs.map +0 -1
- package/dist/shared/attaform.DILbdvfo.mjs.map +0 -1
- package/dist/shared/attaform.KrNw10aW.cjs.map +0 -1
- package/dist/shared/attaform.XYOMTvuO.mjs.map +0 -1
- package/dist/shared/attaform.c_NzdRyc.cjs.map +0 -1
- package/dist/shared/attaform.jrxE_xZw.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as getAtPath, s as slimKindOf,
|
|
1
|
+
import { g as getAtPath, s as slimKindOf, f as setAtPath, j as isPlainRecord, A as AttaformErrorCode, h as humanize, e as useAbstractForm } from './attaform.DyV1O4tI.mjs';
|
|
2
2
|
import { a as AttaformError, _ as __DEV__, b as InvalidUseFormConfigError } from './attaform.BfMxsfmE.mjs';
|
|
3
3
|
import { f as fieldMetaStore, g as getFieldMetaForSchema, a as getFieldMetaListForSchema } from './attaform.D13GMFgK.mjs';
|
|
4
|
-
import { c as canonicalizePath } from './attaform.
|
|
4
|
+
import { c as canonicalizePath } from './attaform.DZRj9s0s.mjs';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
|
|
7
7
|
const fieldMeta = fieldMetaStore;
|
|
@@ -35,6 +35,10 @@ function zodIssuesToValidationErrors(issues, formKey) {
|
|
|
35
35
|
}
|
|
36
36
|
return {
|
|
37
37
|
message: issue.message,
|
|
38
|
+
// Adapter-side paths stay schema-relative — the validation
|
|
39
|
+
// pipeline in `create-form-store.ts` prepends the parent path
|
|
40
|
+
// to absolutise, then routes form-level (absolute path length 0)
|
|
41
|
+
// entries to the empty-string bucket at storage time.
|
|
38
42
|
path: issue.path.map((seg) => typeof seg === "number" ? seg : String(seg)),
|
|
39
43
|
formKey,
|
|
40
44
|
code
|
|
@@ -1898,4 +1902,4 @@ function useForm(configuration) {
|
|
|
1898
1902
|
}
|
|
1899
1903
|
|
|
1900
1904
|
export { UnsupportedSchemaError as U, assertZodVersion as a, fieldMeta as f, kindOf as k, useForm as u, withMeta as w, zodV4Adapter as z };
|
|
1901
|
-
//# sourceMappingURL=attaform.
|
|
1905
|
+
//# sourceMappingURL=attaform.g7rfuXdz.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attaform.g7rfuXdz.mjs","sources":["../../src/runtime/adapters/zod-v4/field-meta.ts","../../src/runtime/adapters/zod-v4/errors.ts","../../src/runtime/adapters/zod-v4/introspect.ts","../../src/runtime/adapters/zod-v4/assert-supported.ts","../../src/runtime/adapters/zod-v4/discriminator.ts","../../src/runtime/adapters/zod-v4/fingerprint.ts","../../src/runtime/adapters/zod-v4/slim-primitives.ts","../../src/runtime/adapters/zod-v4/path-walker.ts","../../src/runtime/adapters/zod-v4/strip.ts","../../src/runtime/adapters/zod-v4/default-values.ts","../../src/runtime/adapters/zod-v4/adapter.ts","../../src/runtime/adapters/zod-v4/index.ts"],"sourcesContent":["/**\n * Field-metadata write/read API for the Zod v4 adapter.\n *\n * Storage lives in the shared `field-meta-store` core — every entry\n * (`attaform/zod`, `attaform/zod-v3`, `attaform/zod-v4`) writes to and\n * reads from the same `WeakMap`s, so a payload registered via any\n * entry surfaces at lookup regardless of which adapter actually runs.\n *\n * The native chain `schema.register(fieldMeta, payload)` still works\n * — Zod 4's `.register` calls `registry.add(this, payload)` and\n * returns the schema; the shared store satisfies that structurally.\n *\n * **Registration patterns:** both styles work — register on whatever\n * schema reference you assign into the parent's shape, OR on the\n * inner schema before wrapping. The adapter's resolver tries the\n * walker-returned schema first, then falls back to the peeled\n * inner so either ordering hits:\n *\n * // both equivalent — registry hits at lookup time\n * withMeta(z.string(), { label: 'Email' }).optional()\n * withMeta(z.string().optional(), { label: 'Email' })\n * z.string().optional().register(fieldMeta, { label: 'Email' })\n * z.string().register(fieldMeta, { label: 'Email' }).optional()\n *\n * The path walker returns the wrapper at terminal positions\n * (`['email']` against `{ email: z.string().optional() }` resolves\n * to `ZodOptional<ZodString>`) and peels at intermediate descent\n * (`['address', 'street']` peels through `address`'s wrapper to\n * reach the inner object). The two-stage lookup covers both leaf\n * and container registrations symmetrically.\n */\nimport type { z } from 'zod'\nimport type { FieldMetaPayload } from '../../core/field-meta'\nimport {\n fieldMetaStore,\n getFieldMetaForSchema,\n getFieldMetaListForSchema,\n} from '../../core/field-meta-store'\n\n// `$ZodRegistry` isn't surfaced under zod's classic external `z`\n// namespace, but `z.registry()` returns one — `ReturnType<typeof\n// z.registry<T>>` resolves to the registry type without a direct\n// import. The `import type` keeps the reference type-only so no\n// `z.registry` lands in the bundle.\ntype ZodFieldMetaRegistry = ReturnType<typeof z.registry<FieldMetaPayload>>\n\n/**\n * The shared registry every Attaform-aware Zod 4 schema can register\n * field metadata against. Backed by the cross-adapter\n * `fieldMetaStore` — one module-scoped instance, shared with the v3\n * adapter and the unified `attaform/zod` entry, so a `.register()`\n * chain in one place is read by adapters in another.\n *\n * Consumers extending `FieldMetaPayload` via declaration merging\n * automatically get the richer payload type at every `register` /\n * `add` / `get` call site.\n *\n * **Shared-instance disambiguation.** A single schema instance reused\n * at multiple form paths (e.g. one address schema bound to both\n * `pickup` and `delivery`) can carry distinct metadata per path —\n * even via the canonical `schema.register(fieldMeta, payload)` chain.\n * The shared store keeps a parallel list of every registration; the\n * path-resolver walks the form's schema tree counting per-schema\n * occurrences to pick the right payload for each path. Object\n * literals evaluate left-to-right, so registration order matches\n * tree-walk order, and shared schemas pair their two registrations\n * to the two paths correctly:\n *\n * z.object({\n * pickup: addressSchema.register(fieldMeta, { label: 'Pickup address' }),\n * delivery: addressSchema.register(fieldMeta, { label: 'Delivery address' }),\n * })\n * // form.fields('pickup').label → 'Pickup address'\n * // form.fields('delivery').label → 'Delivery address'\n *\n * Schemas reused via `withMeta()` get a fresh clone per call (see\n * `withMeta` below), so they never share a registry slot in the\n * first place.\n *\n * Cast to `z.$ZodRegistry<FieldMetaPayload>` so that\n * `schema.register(fieldMeta, payload)` chains type-check at the call\n * site — Zod 4's `.register()` only calls `.add(this, payload)`\n * structurally, so the cast is sound at runtime.\n */\nexport const fieldMeta = fieldMetaStore as unknown as ZodFieldMetaRegistry\n\n/**\n * Read the list of payloads registered against `schema`, in\n * registration order. Empty list when nothing has been registered.\n *\n * Used by the v4 adapter's path-resolver to disambiguate per\n * occurrence when a schema is shared across multiple form paths.\n * Most consumers won't need this — use `fieldMeta.get(schema)` for\n * the single-payload case.\n */\nexport function getFieldMetaList(schema: z.ZodType): readonly FieldMetaPayload[] {\n return getFieldMetaListForSchema(schema as object)\n}\n\n/**\n * Attach `payload` to `schema` in the shared `fieldMeta` registry\n * and return `schema` (chainable). Cross-version with `attaform/zod-v3`'s\n * `withMeta()`; user code that uses this helper reads the same on\n * either adapter.\n *\n * Equivalent to `schema.register(fieldMeta, payload)` on Zod 4.\n * Prefer the native chain for v4-only code; reach for `withMeta`\n * when authoring schema modules that may need to compile under both\n * adapters.\n *\n * Registers on the schema reference passed in. See the\n * \"Registration rule\" note in this file's header — register on the\n * inner schema before wrapping with `.optional()` / `.nullable()` /\n * `.default()` / etc.\n */\nexport function withMeta<S extends z.ZodType>(schema: S, payload: FieldMetaPayload): S {\n // Clone first so each `withMeta` returns a fresh schema identity.\n // The fieldMeta registry keys on schema reference; without\n // cloning, two registrations on the same instance — common when a\n // sub-schema is reused at multiple form paths (e.g. address shared\n // between pickup and delivery) — would overwrite (last-write-wins)\n // and every path would resolve to the most recently registered\n // payload. Cloning gives every callsite its own slot.\n //\n // Merge any existing payload through so chaining accumulates\n // fields rather than replacing — `withMeta(withMeta(s, {label}), {description})`\n // keeps both keys.\n const existing = getFieldMetaForSchema(schema as object) ?? {}\n const cloned = schema.clone() as S\n fieldMetaStore.add(cloned as object, { ...existing, ...payload })\n return cloned\n}\n\n/**\n * Read the registered payload for a schema. Returns `undefined`\n * when nothing has been registered — callers apply their own\n * fallbacks (humanize for label, `.describe()` for description).\n *\n * Internal helper used by the v4 adapter's `getFieldMetaAtPath`.\n * Not part of the public `attaform/zod` surface.\n */\nexport function getFieldMeta(schema: z.ZodType): FieldMetaPayload | undefined {\n return getFieldMetaForSchema(schema as object)\n}\n","import type { z } from 'zod'\nimport { __DEV__ } from '../../core/dev'\nimport { AttaformError } from '../../core/errors'\nimport type { FormKey, ValidationError } from '../../types/types-api'\n\nlet warnedZodCodeMissing = false\n\n/**\n * Normalise a batch of Zod v4 issues into the framework's `ValidationError`\n * shape. v4 types `issue.path` as `PropertyKey[]` (includes symbols);\n * we coerce symbols to strings at the boundary so downstream consumers\n * only see string-or-number segments.\n *\n * The `code` field is stamped as `zod:${issue.code}` (e.g.\n * `zod:too_small`, `zod:invalid_format`). If a custom Zod plugin\n * emits an issue without a string `code`, we fall back to\n * `'zod:unknown'` and dev-warn once per process.\n */\nexport function zodIssuesToValidationErrors(\n issues: readonly z.core.$ZodIssue[],\n formKey: FormKey\n): ValidationError[] {\n return issues.map((issue) => {\n let code: string\n if (typeof issue.code === 'string' && issue.code.length > 0) {\n code = `zod:${issue.code}`\n } else {\n code = 'zod:unknown'\n if (__DEV__ && !warnedZodCodeMissing) {\n warnedZodCodeMissing = true\n console.warn(\n '[attaform] zod-v4 adapter received an issue with no string `code`; ' +\n \"stamping `'zod:unknown'`. This usually means a custom Zod plugin emitted \" +\n 'an issue without the standard code field.'\n )\n }\n }\n return {\n message: issue.message,\n // Adapter-side paths stay schema-relative — the validation\n // pipeline in `create-form-store.ts` prepends the parent path\n // to absolutise, then routes form-level (absolute path length 0)\n // entries to the empty-string bucket at storage time.\n path: issue.path.map((seg) => (typeof seg === 'number' ? seg : String(seg))),\n formKey,\n code,\n }\n })\n}\n\n/**\n * Thrown when a Zod schema includes a kind the form library cannot\n * represent: `z.promise`, `z.custom`, `z.templateLiteral`, or a\n * recursive `z.lazy(...)` that loops back into itself.\n *\n * The error message includes the dotted path of the offending node\n * so you can locate it without traversing the whole schema.\n */\nexport class UnsupportedSchemaError extends AttaformError {}\n","/**\n * The single file that reads Zod v4's internal `def` shape. Every other\n * file in the zod-v4 adapter uses these public-shaped accessors — future\n * Zod minor bumps that reshape internals touch only this file.\n *\n * Design principle: treat `schema.def.*` as an unstable surface, even when\n * Zod's docs say otherwise. Each helper returns a narrow, well-typed slice;\n * no adapter code outside this file does shape-based pattern matching on\n * `def`.\n */\nimport type { z } from 'zod'\n\n/**\n * Stable kind discriminant for a Zod v4 schema. Returned by\n * `kindOf(schema)`. Use when building a custom integration that\n * needs to branch on schema shape — most consumers don't need this.\n */\nexport type ZodKind =\n | 'object'\n | 'array'\n | 'set'\n | 'record'\n | 'tuple'\n | 'union'\n | 'discriminated-union'\n | 'string'\n | 'number'\n | 'boolean'\n | 'bigint'\n | 'date'\n | 'enum'\n | 'literal'\n | 'null'\n | 'undefined'\n | 'any'\n | 'unknown'\n | 'optional'\n | 'nullable'\n | 'default'\n | 'pipe'\n | 'readonly'\n | 'nan'\n | 'void'\n | 'never'\n | 'lazy'\n | 'intersection'\n | 'catch'\n | 'promise'\n | 'custom'\n | 'template-literal'\n\n// Narrow accessor for the unstable `def` surface. All reads from this\n// object go through helpers below — never inline.\ninterface ZodInternalShape {\n def?: {\n type?: string\n element?: unknown\n innerType?: unknown\n options?: readonly unknown[]\n shape?: Record<string, unknown>\n keyType?: unknown\n valueType?: unknown\n items?: readonly unknown[]\n values?: readonly unknown[]\n entries?: Record<string, unknown>\n discriminator?: string\n defaultValue?: unknown\n in?: unknown\n out?: unknown\n checks?: readonly unknown[]\n // Added for the extended kind coverage. `getter` on z.lazy(),\n // `left`/`right` on z.intersection(), `catchValue` on z.catch(),\n // `parts` on z.templateLiteral().\n getter?: () => unknown\n left?: unknown\n right?: unknown\n catchValue?: (ctx: { error: unknown; input: unknown }) => unknown\n parts?: readonly unknown[]\n }\n}\n\nfunction readDef(schema: unknown): ZodInternalShape['def'] | undefined {\n if (schema === null || typeof schema !== 'object') return undefined\n return (schema as ZodInternalShape).def\n}\n\n/**\n * Inspect a Zod v4 schema and return its `ZodKind`. Returns\n * `'unknown'` for non-Zod inputs and unrecognised shapes.\n *\n * Useful when writing introspection helpers that branch on schema\n * structure (e.g. custom error formatters or doc generators).\n */\nexport function kindOf(schema: unknown): ZodKind {\n const def = readDef(schema)\n const rawType = def?.type\n if (rawType === undefined) return 'unknown'\n switch (rawType) {\n case 'object':\n return 'object'\n case 'array':\n return 'array'\n case 'set':\n return 'set'\n case 'record':\n return 'record'\n case 'tuple':\n return 'tuple'\n case 'union':\n // v4 stores `z.discriminatedUnion(...)` as `type: 'union'` with an\n // extra `discriminator: string` field — differentiate here.\n return def?.discriminator !== undefined ? 'discriminated-union' : 'union'\n case 'discriminated_union':\n case 'discriminatedUnion':\n return 'discriminated-union'\n case 'string':\n return 'string'\n case 'number':\n return 'number'\n case 'boolean':\n return 'boolean'\n case 'bigint':\n return 'bigint'\n case 'date':\n return 'date'\n case 'enum':\n return 'enum'\n case 'literal':\n return 'literal'\n case 'null':\n return 'null'\n case 'undefined':\n return 'undefined'\n case 'optional':\n return 'optional'\n case 'nullable':\n return 'nullable'\n case 'default':\n case 'prefault':\n return 'default'\n case 'pipe':\n return 'pipe'\n case 'readonly':\n return 'readonly'\n case 'any':\n return 'any'\n case 'nan':\n return 'nan'\n case 'void':\n return 'void'\n case 'never':\n return 'never'\n case 'lazy':\n return 'lazy'\n case 'intersection':\n return 'intersection'\n case 'catch':\n return 'catch'\n case 'promise':\n return 'promise'\n case 'custom':\n return 'custom'\n case 'template_literal':\n case 'templateLiteral':\n return 'template-literal'\n default:\n return 'unknown'\n }\n}\n\n/** Returns schema.shape as Record<string, ZodTypeAny>. */\nexport function getObjectShape(schema: z.ZodObject): Record<string, z.ZodType> {\n const s = schema as unknown as { shape: Record<string, z.ZodType> }\n return s.shape\n}\n\nexport function getArrayElement(schema: z.ZodArray): z.ZodType {\n const def = readDef(schema)\n return def?.element as z.ZodType\n}\n\n/**\n * Returns the element schema of a `z.set(...)`. Symmetric to\n * `getArrayElement`; v4 stores the set's element type on `def.valueType`.\n */\nexport function getSetValueType(schema: z.ZodType): z.ZodType {\n const def = readDef(schema)\n return def?.valueType as z.ZodType\n}\n\nexport function getRecordKeyType(schema: z.ZodType): z.ZodType {\n const def = readDef(schema)\n return def?.keyType as z.ZodType\n}\n\nexport function getRecordValueType(schema: z.ZodType): z.ZodType {\n const def = readDef(schema)\n return def?.valueType as z.ZodType\n}\n\nexport function getTupleItems(schema: z.ZodType): readonly z.ZodType[] {\n const def = readDef(schema)\n return (def?.items as readonly z.ZodType[] | undefined) ?? []\n}\n\nexport function getUnionOptions(schema: z.ZodType): readonly z.ZodType[] {\n const def = readDef(schema)\n return (def?.options as readonly z.ZodType[] | undefined) ?? []\n}\n\nexport function getLiteralValues(schema: z.ZodType): readonly unknown[] {\n const def = readDef(schema)\n return def?.values ?? []\n}\n\nexport function getEnumValues(schema: z.ZodType): readonly (string | number)[] {\n const def = readDef(schema)\n const entries = def?.entries\n if (entries === undefined) return []\n return Object.values(entries) as (string | number)[]\n}\n\nexport function unwrapInner(schema: z.ZodType): z.ZodType | undefined {\n const def = readDef(schema)\n return def?.innerType as z.ZodType | undefined\n}\n\nexport function unwrapPipe(schema: z.ZodType): z.ZodType | undefined {\n const def = readDef(schema)\n return (def?.in as z.ZodType | undefined) ?? (def?.out as z.ZodType | undefined)\n}\n\n/**\n * Resolve a `z.lazy(() => inner)` to its inner schema by invoking the\n * factory. Each invocation runs the arrow function fresh, so the returned\n * schema is a distinct object on each call — cycle detection must track\n * the getter function identity, not the resulting schema.\n */\nexport function unwrapLazy(schema: z.ZodType): z.ZodType | undefined {\n const def = readDef(schema)\n const getter = def?.getter\n if (typeof getter !== 'function') return undefined\n return getter() as z.ZodType\n}\n\n/** Getter function reference on a `z.lazy()` — used for recursion detection. */\nexport function getLazyGetter(schema: z.ZodType): (() => unknown) | undefined {\n const def = readDef(schema)\n return typeof def?.getter === 'function' ? def.getter : undefined\n}\n\nexport function getIntersectionLeft(schema: z.ZodType): z.ZodType | undefined {\n const def = readDef(schema)\n return def?.left as z.ZodType | undefined\n}\n\nexport function getIntersectionRight(schema: z.ZodType): z.ZodType | undefined {\n const def = readDef(schema)\n return def?.right as z.ZodType | undefined\n}\n\n/**\n * Materialise the fallback value of a `z.catch(inner, value)` wrapper.\n * v4 stores the catch as a function `(ctx) => value` on `def.catchValue`;\n * we invoke it with a placeholder context. Consumer catch functions that\n * inspect `ctx.input` / `ctx.error` during default-values derivation are\n * rare — if the function throws, we surface `undefined` and let the\n * validate-then-fix loop find a fallback.\n */\nexport function getCatchDefault(schema: z.ZodType): unknown {\n const def = readDef(schema)\n const cv = def?.catchValue\n if (typeof cv !== 'function') return undefined\n try {\n return cv({ error: new Error('atta:default-values'), input: undefined })\n } catch {\n return undefined\n }\n}\n\nexport function getDefaultValue(schema: z.ZodType): unknown {\n const def = readDef(schema)\n // In v4, defaultValue is stored as a getter that returns the value directly\n // (v3 stored a function that had to be called). We read the property via\n // normal access so the getter fires.\n return def?.defaultValue\n}\n\n/** True if the schema's `def` carries refinement checks (e.g. `.min(3)`). */\nexport function hasChecks(schema: z.ZodType): boolean {\n const def = readDef(schema)\n const checks = def?.checks\n return Array.isArray(checks) && checks.length > 0\n}\n\n/** Raw checks array. Empty when the schema has no refinements. */\nexport function getChecks(schema: z.ZodType): readonly unknown[] {\n const def = readDef(schema)\n const checks = def?.checks\n return Array.isArray(checks) ? (checks as readonly unknown[]) : []\n}\n\n/** ZodDiscriminatedUnion: the discriminator key (e.g. 'status'). */\nexport function getDiscriminator(schema: z.ZodType): string | undefined {\n const def = readDef(schema)\n return def?.discriminator\n}\n\n/** ZodDiscriminatedUnion: the option objects (typed narrowly as ZodObject). */\nexport function getDiscriminatedOptions(schema: z.ZodType): readonly z.ZodObject[] {\n const def = readDef(schema)\n const options = def?.options\n return Array.isArray(options) ? (options as readonly z.ZodObject[]) : []\n}\n\n/**\n * Verify a schema is Zod v4. Throws a clear error if it's a v3\n * schema mistakenly imported through `attaform/zod`.\n *\n * Most consumers never call this directly — the v4 adapter calls it\n * internally on every schema. Reach for it only when wiring a custom\n * adapter that needs the same guard.\n */\nexport function assertZodVersion(schema: unknown): void {\n const def = readDef(schema)\n if (def?.type === undefined) {\n throw new Error(\n '[attaform/zod-v4] Schema is not a Zod v4 schema. The `attaform/zod-v4` adapter requires ' +\n 'zod@^4. Either: (a) install zod@^4 in your project; (b) import from `attaform/zod`, ' +\n 'which auto-detects the Zod version (and tree-shakes to a single adapter when the ' +\n '`attaform/vite` plugin is active); or (c) import from `attaform/zod-v3` if you are ' +\n 'staying on Zod v3.'\n )\n }\n}\n\n/**\n * True iff any refinement check on the schema (or any descendant\n * subschema) is async. Detection: walks the tree once, peeling\n * wrappers (optional/nullable/default/readonly/catch/pipe), descending\n * into containers (object props, array element, tuple items, union\n * options, intersection sides, lazy getter, record key/value), and\n * inspecting each `def.checks[].def.fn` for\n * `constructor.name === 'AsyncFunction'`. Direct `async (v) => …`\n * refinements are caught; sync functions that happen to return a\n * Promise (rare; we'd recommend marking them `async`) are NOT.\n *\n * Used by the adapter's `needsAsyncValidation()` to drive the\n * runtime's construction-time async-validation seed (see\n * create-form-store's strict-mode block). False negatives just delay\n * async refines until first mutation — matches the pre-detection\n * behavior. False positives are unlikely (the AsyncFunction check is\n * precise) and cost only one extra microtask of validation work.\n */\nexport function containsAsyncRefine(schema: z.ZodType, seen?: WeakSet<object>): boolean {\n const visited = seen ?? new WeakSet<object>()\n // Defensive guard: sub-adapters cast through `as` and a malformed leaf\n // could land here as a non-object. The TS signature claims object, but\n // runtime safety beats the conditional-narrowing lint complaint.\n const candidate = schema as unknown\n if (typeof candidate !== 'object' || candidate === null) return false\n if (visited.has(candidate)) return false\n visited.add(candidate)\n\n const checks = getChecks(schema)\n for (const check of checks) {\n if (isAsyncCheck(check)) return true\n }\n\n const def = readDef(schema)\n if (def === undefined) return false\n\n if (def.innerType !== undefined && containsAsyncRefine(def.innerType as z.ZodType, visited)) {\n return true\n }\n if (def.element !== undefined && containsAsyncRefine(def.element as z.ZodType, visited)) {\n return true\n }\n if (def.in !== undefined && containsAsyncRefine(def.in as z.ZodType, visited)) {\n return true\n }\n if (def.out !== undefined && containsAsyncRefine(def.out as z.ZodType, visited)) {\n return true\n }\n if (def.left !== undefined && containsAsyncRefine(def.left as z.ZodType, visited)) {\n return true\n }\n if (def.right !== undefined && containsAsyncRefine(def.right as z.ZodType, visited)) {\n return true\n }\n if (def.keyType !== undefined && containsAsyncRefine(def.keyType as z.ZodType, visited)) {\n return true\n }\n if (def.valueType !== undefined && containsAsyncRefine(def.valueType as z.ZodType, visited)) {\n return true\n }\n if (def.shape !== undefined) {\n for (const sub of Object.values(def.shape)) {\n if (containsAsyncRefine(sub as z.ZodType, visited)) return true\n }\n }\n if (def.entries !== undefined) {\n for (const sub of Object.values(def.entries)) {\n if (containsAsyncRefine(sub as z.ZodType, visited)) return true\n }\n }\n if (def.options !== undefined) {\n for (const sub of def.options) {\n if (containsAsyncRefine(sub as z.ZodType, visited)) return true\n }\n }\n if (def.items !== undefined) {\n for (const sub of def.items) {\n if (containsAsyncRefine(sub as z.ZodType, visited)) return true\n }\n }\n if (typeof def.getter === 'function') {\n try {\n const inner = def.getter() as z.ZodType\n if (containsAsyncRefine(inner, visited)) return true\n } catch {\n // Lazy schemas may throw on resolution before their referenced\n // schema is constructed; treat as no async refine and move on.\n }\n }\n\n return false\n}\n\ninterface ZodCheckInternals {\n _def?: { fn?: unknown }\n def?: { fn?: unknown }\n _zod?: { def?: { fn?: unknown } }\n}\n\nexport function isAsyncCheck(check: unknown): boolean {\n if (typeof check !== 'object' || check === null) return false\n const c = check as ZodCheckInternals\n const fn = c._def?.fn ?? c.def?.fn ?? c._zod?.def?.fn\n if (typeof fn !== 'function') return false\n return fn.constructor.name === 'AsyncFunction'\n}\n","import type { z } from 'zod'\nimport { UnsupportedSchemaError } from './errors'\nimport {\n getArrayElement,\n getDiscriminatedOptions,\n getIntersectionLeft,\n getIntersectionRight,\n getLazyGetter,\n getObjectShape,\n getRecordValueType,\n getSetValueType,\n getTupleItems,\n getUnionOptions,\n kindOf,\n unwrapInner,\n unwrapLazy,\n unwrapPipe,\n type ZodKind,\n} from './introspect'\n\n/**\n * Kinds the adapter does not implement. `z.promise(...)`, `z.custom(...)`,\n * and `z.templateLiteral(...)` can't be represented as form values\n * (Promise-valued fields have no meaningful initial state; custom\n * predicates have no derivable default; template-literal schemas parse\n * strings against a pattern that has no obvious \"empty\" form). The\n * adapter rejects them at construction so the failure surfaces at\n * `useForm(...)` rather than as a mystery `undefined` at render time.\n */\nconst UNSUPPORTED: readonly ZodKind[] = ['promise', 'custom', 'template-literal']\n\nfunction labelPath(path: readonly string[]): string {\n return path.length === 0 ? '<root>' : path.join('.')\n}\n\n/**\n * Walk the schema tree and fail fast on unsupported kinds. Detects\n * recursive `z.lazy(...)` by tracking the *getter function identity*\n * of each lazy on the descent stack — a repeated getter means the\n * factory resolves back into itself (directly or through a detour).\n *\n * This runs once, at adapter construction time, so the cost is paid\n * at app startup rather than per keystroke.\n */\nexport function assertSupportedKinds(\n schema: z.ZodType,\n path: readonly string[] = [],\n lazyGetters: readonly (() => unknown)[] = []\n): void {\n const kind = kindOf(schema)\n\n if (UNSUPPORTED.includes(kind)) {\n throw new UnsupportedSchemaError(\n `[attaform/zod] unsupported kind '${kind}' at '${labelPath(path)}'`\n )\n }\n\n switch (kind) {\n case 'object': {\n const shape = getObjectShape(schema as z.ZodObject)\n for (const [key, sub] of Object.entries(shape)) {\n assertSupportedKinds(sub, [...path, key], lazyGetters)\n }\n return\n }\n case 'array':\n assertSupportedKinds(getArrayElement(schema as z.ZodArray), [...path, '*'], lazyGetters)\n return\n case 'set':\n assertSupportedKinds(getSetValueType(schema), [...path, '*'], lazyGetters)\n return\n case 'record':\n assertSupportedKinds(getRecordValueType(schema), [...path, '*'], lazyGetters)\n return\n case 'tuple': {\n const items = getTupleItems(schema)\n items.forEach((item, i) => assertSupportedKinds(item, [...path, String(i)], lazyGetters))\n return\n }\n case 'union': {\n const options = getUnionOptions(schema)\n options.forEach((opt, i) => assertSupportedKinds(opt, [...path, `|${i}`], lazyGetters))\n return\n }\n case 'discriminated-union': {\n const options = getDiscriminatedOptions(schema)\n options.forEach((opt, i) => assertSupportedKinds(opt, [...path, `|${i}`], lazyGetters))\n return\n }\n case 'optional':\n case 'nullable':\n case 'default':\n case 'readonly':\n case 'catch': {\n const inner = unwrapInner(schema)\n if (inner !== undefined) assertSupportedKinds(inner, path, lazyGetters)\n return\n }\n case 'pipe': {\n const inner = unwrapPipe(schema)\n if (inner !== undefined) assertSupportedKinds(inner, path, lazyGetters)\n return\n }\n case 'lazy': {\n const getter = getLazyGetter(schema)\n if (getter !== undefined && lazyGetters.includes(getter)) {\n throw new UnsupportedSchemaError(\n `[attaform/zod] Recursive z.lazy() at '${labelPath(path)}'`\n )\n }\n const inner = unwrapLazy(schema)\n if (inner !== undefined) {\n assertSupportedKinds(\n inner,\n path,\n getter === undefined ? lazyGetters : [...lazyGetters, getter]\n )\n }\n return\n }\n case 'intersection': {\n const left = getIntersectionLeft(schema)\n const right = getIntersectionRight(schema)\n if (left !== undefined) assertSupportedKinds(left, [...path, 'left'], lazyGetters)\n if (right !== undefined) assertSupportedKinds(right, [...path, 'right'], lazyGetters)\n return\n }\n // Leaves: nothing to descend into.\n case 'string':\n case 'number':\n case 'boolean':\n case 'bigint':\n case 'date':\n case 'enum':\n case 'literal':\n case 'null':\n case 'undefined':\n case 'nan':\n case 'any':\n case 'unknown':\n case 'void':\n case 'never':\n case 'promise':\n case 'custom':\n case 'template-literal':\n return\n default: {\n const _exhaustive: never = kind\n throw new Error(`assertSupportedKinds: unhandled ZodKind '${_exhaustive as string}'`)\n }\n }\n}\n","import type { z } from 'zod'\nimport { getDiscriminatedOptions, kindOf, unwrapInner, unwrapPipe } from './introspect'\n\n/**\n * Peel optional/nullable/default/pipe wrappers off a schema, returning the\n * innermost discriminated union — or `undefined` if none is found. Used by\n * the default-values walker so that e.g.\n *\n * z.discriminatedUnion('status', [...]).optional().default({...})\n *\n * still reaches the DU for first-option-fallback construction.\n */\nexport function unwrapToDiscriminatedUnion(schema: z.ZodType): z.ZodType | undefined {\n let current: z.ZodType = schema\n // Bounded descent — any well-formed Zod schema tree terminates quickly.\n for (let i = 0; i < 64; i++) {\n const kind = kindOf(current)\n if (kind === 'discriminated-union') return current\n let next: z.ZodType | undefined\n if (kind === 'optional' || kind === 'nullable' || kind === 'default' || kind === 'readonly') {\n next = unwrapInner(current)\n } else if (kind === 'pipe') {\n next = unwrapPipe(current)\n }\n if (next === undefined) return undefined\n current = next\n }\n return undefined\n}\n\n/**\n * First option of a discriminated union — used as the default when no\n * discriminator value is known at default-values construction time.\n */\nexport function getDiscriminatedUnionFirstOption(schema: z.ZodType): z.ZodObject | undefined {\n const options = getDiscriminatedOptions(schema)\n return options[0]\n}\n","import type { z } from 'zod'\nimport {\n getArrayElement,\n getCatchDefault,\n getChecks,\n getDefaultValue,\n getDiscriminatedOptions,\n getDiscriminator,\n getEnumValues,\n getIntersectionLeft,\n getIntersectionRight,\n getLiteralValues,\n getObjectShape,\n getRecordKeyType,\n getRecordValueType,\n getSetValueType,\n getTupleItems,\n getUnionOptions,\n kindOf,\n unwrapInner,\n unwrapLazy,\n unwrapPipe,\n} from './introspect'\n\n/**\n * Compute a structural fingerprint for a Zod v4 schema.\n *\n * The returned string is:\n * - **Deterministic** for any pair of schemas with the same shape,\n * regardless of whether they were constructed by the same\n * `z.object({...})` call or two identical ones in different files.\n * - **Key-order-insensitive** for `z.object` — shape entries are\n * sorted before serialisation, so `{a, b}` and `{b, a}` produce\n * the same fingerprint.\n * - **Order-insensitive for `z.union`** — option fingerprints are\n * sorted before they're folded in, because union membership has\n * no semantic order.\n * - **Idempotent** — two fingerprint calls on the same schema\n * reference return identical strings, even when the schema\n * contains non-deterministic metadata (e.g. `.default(() => new\n * Date())`). Factories of any kind collapse to an opaque\n * `fn:*` sentinel for this reason (see `defaultValueRepr`).\n *\n * **Known false negatives** — situations where two semantically\n * different schemas hash the same:\n * - `.refine(fn1)` and `.refine(fn2)`: function bodies aren't\n * hashable in a way that survives minification / different closure\n * captures, so every refinement collapses via the generic `fn:*`\n * sentinel. The warning this powers is a best-effort footgun\n * catcher, not a soundness guarantee — two forms whose only\n * difference is refinement logic will look identical here.\n * - `.transform(fn)`: same reason.\n * - `.default(() => x)` where the factory is non-deterministic:\n * collapses to `fn:*` (idempotence requirement — we can't hash a\n * fresh Date on every call).\n * - `z.custom()` — no structural information to introspect; renders\n * as `custom:*`.\n *\n * **Caching is per-call, not module-global.** A WeakMap cache\n * scoped to the starting schema would break correctness under\n * cycles: the `<cyclic>` sentinel's meaning is relative to the\n * call's starting node, so a cached mid-traversal result from one\n * call is wrong for a different call. Cheapest correct design is\n * \"fresh cache per top-level call.\" A 50-field nested schema\n * fingerprints in microseconds, and the library calls `fingerprint`\n * at most twice per shared-key collision (existing + incoming) —\n * not a hot path.\n */\n\nconst cyclicSentinel = '<cyclic>'\n\nexport function fingerprintZodSchema(schema: z.ZodType): string {\n const cache = new WeakMap<z.ZodType, string>()\n const inProgress = new WeakSet<z.ZodType>()\n return visit(schema, cache, inProgress)\n}\n\nfunction visit(\n schema: z.ZodType,\n cache: WeakMap<z.ZodType, string>,\n inProgress: WeakSet<z.ZodType>\n): string {\n const cached = cache.get(schema)\n if (cached !== undefined) return cached\n if (inProgress.has(schema)) return cyclicSentinel\n inProgress.add(schema)\n try {\n const computed = computeFingerprint(schema, cache, inProgress)\n cache.set(schema, computed)\n return computed\n } finally {\n inProgress.delete(schema)\n }\n}\n\nfunction computeFingerprint(\n schema: z.ZodType,\n cache: WeakMap<z.ZodType, string>,\n inProgress: WeakSet<z.ZodType>\n): string {\n const kind = kindOf(schema)\n const recurse = (child: z.ZodType): string => visit(child, cache, inProgress)\n switch (kind) {\n // Kind-only leaves: no further structure to descend into.\n case 'boolean':\n case 'null':\n case 'undefined':\n case 'any':\n case 'unknown':\n case 'nan':\n case 'void':\n case 'never':\n return kind\n\n // Leaves with checks (min/max/email/regex/...). Checks are\n // canonicalised and sorted so `.min(3).max(10)` and `.max(10).min(3)`\n // produce identical fingerprints.\n case 'string':\n case 'number':\n case 'bigint':\n case 'date':\n return `${kind}${formatChecks(schema)}`\n\n case 'literal': {\n // `z.literal(['a', 'b'])` accepts either — the value set has\n // no semantic order, so canonical-sort before hashing so\n // `['a','b']` and `['b','a']` match. `z.literal` accepts\n // string / number / boolean / null / undefined / bigint /\n // symbol — sort by canonicalised string form to get a total\n // order across those types.\n const values = [...getLiteralValues(schema)].sort((a, b) => {\n const as = canonicalStringify(a)\n const bs = canonicalStringify(b)\n return as < bs ? -1 : as > bs ? 1 : 0\n })\n return `literal:${canonicalStringify(values)}`\n }\n\n case 'enum':\n // Enum values have no semantic order — sort before folding.\n return `enum:${canonicalStringify([...getEnumValues(schema)].sort((a, b) => compare(a, b)))}`\n\n case 'object': {\n const shape = getObjectShape(schema as z.ZodObject)\n const sortedEntries = Object.entries(shape)\n .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n .map(([k, v]) => `${JSON.stringify(k)}:${recurse(v)}`)\n return `object{${sortedEntries.join(',')}}${formatChecks(schema)}`\n }\n\n case 'array':\n return `array[${recurse(getArrayElement(schema as z.ZodArray))}]${formatChecks(schema)}`\n\n case 'set':\n return `set<${recurse(getSetValueType(schema))}>${formatChecks(schema)}`\n\n case 'tuple':\n return `tuple[${getTupleItems(schema).map(recurse).join(',')}]`\n\n case 'record':\n return `record<${recurse(getRecordKeyType(schema))},${recurse(getRecordValueType(schema))}>`\n\n case 'union': {\n // Union membership has no order; sort option fingerprints.\n const options = getUnionOptions(schema).map(recurse).sort()\n return `union(${options.join('|')})`\n }\n\n case 'discriminated-union': {\n const disc = getDiscriminator(schema) ?? '?'\n const options = getDiscriminatedOptions(schema).map(recurse).sort()\n return `dunion[${JSON.stringify(disc)}](${options.join('|')})`\n }\n\n case 'optional': {\n const inner = unwrapInner(schema)\n return inner === undefined ? 'optional(?)' : `optional(${recurse(inner)})`\n }\n\n case 'nullable': {\n const inner = unwrapInner(schema)\n return inner === undefined ? 'nullable(?)' : `nullable(${recurse(inner)})`\n }\n\n case 'default': {\n const inner = unwrapInner(schema)\n return `default[${stableValueRepr(getDefaultValue, schema)}](${inner === undefined ? '?' : recurse(inner)})`\n }\n\n case 'readonly': {\n const inner = unwrapInner(schema)\n return inner === undefined ? 'readonly(?)' : `readonly(${recurse(inner)})`\n }\n\n case 'pipe': {\n const inner = unwrapPipe(schema)\n return inner === undefined ? 'pipe(?)' : `pipe(${recurse(inner)})`\n }\n\n case 'catch': {\n const inner = unwrapInner(schema)\n return `catch[${stableValueRepr(getCatchDefault, schema)}](${inner === undefined ? '?' : recurse(inner)})`\n }\n\n case 'lazy': {\n // `z.lazy(() => other)` — fingerprint the dereferenced inner.\n // The `inProgress` WeakSet catches real cycles (a schema that\n // references itself through lazy) and returns `cyclicSentinel`\n // for any recursive encounter.\n const inner = unwrapLazy(schema)\n return inner === undefined ? 'lazy(?)' : `lazy(${recurse(inner)})`\n }\n\n case 'intersection': {\n const left = getIntersectionLeft(schema)\n const right = getIntersectionRight(schema)\n const leftFp = left === undefined ? '?' : recurse(left as z.ZodType)\n const rightFp = right === undefined ? '?' : recurse(right as z.ZodType)\n // Intersection members have no semantic order; sort both legs.\n const parts = [leftFp, rightFp].sort()\n return `intersection(${parts.join('&')})`\n }\n\n // Structural shape isn't observable for these. Bucket them into\n // kind-only fingerprints — a schema-mismatch warning can't do\n // better than \"both are `custom`\" here, but that still catches\n // `object` vs `custom` mismatches.\n case 'promise':\n case 'custom':\n case 'template-literal':\n return `${kind}:*`\n\n default: {\n // Exhaustiveness guard — if ZodKind grows a new variant we'll\n // fall through here and get a typecheck-visible warning via\n // the unreachable assignment.\n const _: never = kind\n return `unknown:${String(_)}`\n }\n }\n}\n\n/**\n * Render a default/catch value for the fingerprint. Detects\n * non-deterministic factories (`.default(() => new Date())`) by\n * reading the value twice and comparing — zod v4's getter invokes\n * the factory fresh on each access, so two consecutive reads of a\n * factory-backed default produce distinct objects for any\n * heap-allocated return type. Object.is matches for primitive\n * returns (even from factories) and for literal defaults; in both\n * cases we emit the canonical representation. Without this the\n * fingerprint is non-idempotent for schemas like\n * `.default(() => new Date())`.\n */\nfunction stableValueRepr(get: (s: z.ZodType) => unknown, schema: z.ZodType): string {\n const first = get(schema)\n const second = get(schema)\n if (!Object.is(first, second) || typeof first === 'function') return 'fn:*'\n return canonicalStringify(first)\n}\n\n/**\n * Serialise a check array to a stable string. Checks are sorted by\n * their canonical form so order-of-chain doesn't matter — the zod\n * runtime already collapses `.min(3).max(10)` and `.max(10).min(3)`\n * to the same behaviour, and the fingerprint should match.\n */\nfunction formatChecks(schema: z.ZodType): string {\n const checks = getChecks(schema)\n if (checks.length === 0) return ''\n const parts = checks.map((c) => serializeCheck(c)).sort()\n return `[${parts.join(';')}]`\n}\n\n/**\n * Zod v4 checks are instances of `$ZodCheck` — their state lives on\n * `_zod.def` (kind discriminator + kind-specific args), not on the\n * object's own enumerable properties. A plain `Object.entries`\n * serialise would see an empty object and collapse every check to\n * the same fingerprint — `.min(3)` and `.min(8)` would look\n * identical. Reach into `_zod.def` when it's present; fall back to\n * generic canonicalisation for anything that isn't shaped like a\n * v4 check (custom adapters may pass their own shapes here).\n */\nfunction serializeCheck(check: unknown): string {\n if (check !== null && typeof check === 'object') {\n const def = (check as { _zod?: { def?: unknown } })._zod?.def\n if (def !== undefined) return canonicalStringify(def)\n }\n return canonicalStringify(check)\n}\n\n/**\n * Canonical stringify for arbitrary values. Sorts object keys, walks\n * arrays in index order, represents functions / symbols / cycles as\n * opaque sentinels. NOT JSON — the output is not meant to round-trip\n * via JSON.parse; it's a canonical surface for equality-testing.\n *\n * Cycle detection uses an \"ancestor stack\" add/delete pattern: a\n * reference is only considered cyclic if it's currently on the\n * path from the root being stringified. Without `delete` on pop,\n * two sibling properties pointing at the same object would have\n * the second labelled `<cyclic>` (false positive) even though the\n * reference isn't actually an ancestor.\n */\nfunction canonicalStringify(value: unknown, seen: WeakSet<object> = new WeakSet()): string {\n if (value === null) return 'null'\n if (value === undefined) return 'undefined'\n const t = typeof value\n if (t === 'string') return JSON.stringify(value)\n if (t === 'number' || t === 'boolean') return String(value)\n if (t === 'bigint') return `${String(value)}n`\n if (t === 'function') return 'fn:*'\n if (t === 'symbol') return 'symbol:*'\n if (Array.isArray(value)) {\n if (seen.has(value)) return '<cyclic>'\n seen.add(value)\n try {\n const parts = value.map((v) => canonicalStringify(v, seen))\n return `[${parts.join(',')}]`\n } finally {\n seen.delete(value)\n }\n }\n if (t === 'object') {\n // `null` already returned above; the remaining `object` branch is\n // non-null, so narrowing against it is redundant (eslint's\n // no-unnecessary-condition rule flags the prior guard).\n const obj = value as Record<string, unknown>\n if (seen.has(obj)) return '<cyclic>'\n seen.add(obj)\n try {\n if (value instanceof Date) return `date:${value.getTime()}`\n if (value instanceof RegExp) return `regex:${String(value)}`\n const entries = Object.entries(obj)\n .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n .map(([k, v]) => `${JSON.stringify(k)}:${canonicalStringify(v, seen)}`)\n return `{${entries.join(',')}}`\n } finally {\n seen.delete(obj)\n }\n }\n return 'unknown'\n}\n\n/** Strict-mode sort comparator that handles mixed string/number enums. */\nfunction compare(a: string | number, b: string | number): number {\n const as = String(a)\n const bs = String(b)\n return as < bs ? -1 : as > bs ? 1 : 0\n}\n","/**\n * Slim-primitive walker for the zod-v4 adapter. Returns the set of\n * `SlimPrimitiveKind`s a schema accepts at write time — wrappers are\n * peeled, refinement-level constraints (`.email()`, `.min(N)`, enum\n * membership, literal equality, regex) are ignored.\n *\n * The runtime gate (`src/runtime/core/slim-primitive-gate.ts`) calls\n * the adapter method `getSlimPrimitiveTypesAtPath(path)`, which\n * resolves leaf candidates via `getNestedZodSchemasAtPath` and unions\n * `slimPrimitivesOf` across them.\n */\nimport type { z } from 'zod'\nimport type { SlimPrimitiveKind } from '../../types/types-api'\nimport {\n getEnumValues,\n getIntersectionLeft,\n getIntersectionRight,\n getLiteralValues,\n getUnionOptions,\n kindOf,\n unwrapInner,\n unwrapLazy,\n unwrapPipe,\n} from './introspect'\n\nexport const PERMISSIVE: ReadonlySet<SlimPrimitiveKind> = new Set<SlimPrimitiveKind>([\n 'string',\n 'number',\n 'boolean',\n 'bigint',\n 'date',\n 'null',\n 'undefined',\n 'object',\n 'array',\n 'symbol',\n 'function',\n 'map',\n 'set',\n])\n\nconst MAX_LAZY_DEPTH = 64\n\n/**\n * Walk a schema, emitting the union of slim primitive kinds it\n * accepts. Wrappers descend into their inner schema; unions union\n * their branches; intersections intersect; lazy resolves through;\n * pipe takes the input side.\n *\n * Returns an empty set ONLY for `z.never()` — every other kind we\n * understand emits at least one entry. Unknown kinds (lazy with a\n * recursive cycle, custom z-types we don't recognise) return the\n * permissive set so the runtime gate doesn't reject legitimate\n * writes against shapes we can't introspect.\n */\nexport function slimPrimitivesOf(schema: z.ZodType): Set<SlimPrimitiveKind> {\n return walk(schema, 0)\n}\n\nfunction walk(schema: z.ZodType, depth: number): Set<SlimPrimitiveKind> {\n if (depth > MAX_LAZY_DEPTH) return new Set(PERMISSIVE)\n const kind = kindOf(schema)\n switch (kind) {\n case 'string':\n return new Set(['string'])\n case 'number':\n case 'nan':\n return new Set(['number'])\n case 'boolean':\n return new Set(['boolean'])\n case 'bigint':\n return new Set(['bigint'])\n case 'date':\n return new Set(['date'])\n case 'null':\n return new Set(['null'])\n case 'undefined':\n case 'void':\n return new Set(['undefined'])\n case 'enum': {\n // Enums in v4 may be string- or number-valued; walk entries.\n const values = getEnumValues(schema)\n const out = new Set<SlimPrimitiveKind>()\n for (const v of values) {\n if (typeof v === 'string') out.add('string')\n else if (typeof v === 'number') out.add('number')\n }\n return out.size === 0 ? new Set(['string']) : out\n }\n case 'literal': {\n const values = getLiteralValues(schema)\n const out = new Set<SlimPrimitiveKind>()\n for (const v of values) out.add(slimKindOfRaw(v))\n return out.size === 0 ? new Set(PERMISSIVE) : out\n }\n case 'object':\n case 'record':\n return new Set(['object'])\n case 'array':\n case 'tuple':\n return new Set(['array'])\n case 'set':\n return new Set(['set'])\n case 'optional': {\n const inner = unwrapInner(schema)\n const innerSet = inner === undefined ? new Set<SlimPrimitiveKind>() : walk(inner, depth + 1)\n innerSet.add('undefined')\n return innerSet\n }\n case 'nullable': {\n const inner = unwrapInner(schema)\n const innerSet = inner === undefined ? new Set<SlimPrimitiveKind>() : walk(inner, depth + 1)\n innerSet.add('null')\n return innerSet\n }\n case 'default':\n case 'readonly':\n case 'catch': {\n const inner = unwrapInner(schema)\n return inner === undefined ? new Set(PERMISSIVE) : walk(inner, depth + 1)\n }\n case 'pipe': {\n // Use the INPUT side: writes are pre-transform values.\n const inner = unwrapPipe(schema)\n return inner === undefined ? new Set(PERMISSIVE) : walk(inner, depth + 1)\n }\n case 'lazy': {\n const inner = unwrapLazy(schema)\n return inner === undefined ? new Set(PERMISSIVE) : walk(inner, depth + 1)\n }\n case 'union':\n case 'discriminated-union': {\n const options = getUnionOptions(schema)\n const out = new Set<SlimPrimitiveKind>()\n for (const opt of options) {\n for (const k of walk(opt as z.ZodType, depth + 1)) out.add(k)\n }\n return out.size === 0 ? new Set(PERMISSIVE) : out\n }\n case 'intersection': {\n const left = getIntersectionLeft(schema)\n const right = getIntersectionRight(schema)\n const leftSet = left === undefined ? new Set(PERMISSIVE) : walk(left, depth + 1)\n const rightSet = right === undefined ? new Set(PERMISSIVE) : walk(right, depth + 1)\n const out = new Set<SlimPrimitiveKind>()\n for (const k of leftSet) if (rightSet.has(k)) out.add(k)\n return out\n }\n case 'never':\n return new Set()\n case 'any':\n case 'unknown':\n return new Set(PERMISSIVE)\n // Kinds we don't understand at the slim level: be permissive to\n // avoid false-rejecting legitimate writes against schema shapes\n // we haven't characterised.\n case 'promise':\n case 'custom':\n case 'template-literal':\n default:\n return new Set(PERMISSIVE)\n }\n}\n\nfunction slimKindOfRaw(value: unknown): SlimPrimitiveKind {\n if (value === null) return 'null'\n if (value === undefined) return 'undefined'\n if (Array.isArray(value)) return 'array'\n if (value instanceof Date) return 'date'\n const t = typeof value\n switch (t) {\n case 'string':\n return 'string'\n case 'number':\n return 'number'\n case 'boolean':\n return 'boolean'\n case 'bigint':\n return 'bigint'\n case 'symbol':\n return 'symbol'\n case 'undefined':\n return 'undefined'\n case 'object':\n return 'object'\n case 'function':\n return 'function'\n default:\n return 'object'\n }\n}\n","import type { z } from 'zod'\nimport {\n getArrayElement,\n getDiscriminatedOptions,\n getIntersectionLeft,\n getIntersectionRight,\n getObjectShape,\n getRecordValueType,\n getSetValueType,\n getTupleItems,\n getUnionOptions,\n kindOf,\n unwrapInner,\n unwrapLazy,\n unwrapPipe,\n} from './introspect'\n\nconst PATH_SEPARATOR = '.'\n\n/**\n * Walk a dotted path through a Zod schema tree and return the subschema(s)\n * that live at that path.\n *\n * - Unions return multiple candidates (caller tries each).\n * - Discriminated unions filter options to those whose shape contains the\n * next segment, so a path into `{ status: 'error', message: string }`\n * resolves only to the 'error' branch.\n * - Wrappers (optional/nullable/default/readonly/pipe) are transparent —\n * the walker descends into the inner schema without consuming a path\n * segment.\n * - Leaf types (string/number/literal/...) return `[]` when there's still\n * path left, so a caller that asked for `firstName.middle` against a\n * string schema gets an empty resolution rather than a wrong schema.\n */\nexport function getNestedZodSchemasAtPath(\n schema: z.ZodType,\n path: string | readonly (string | number)[]\n): z.ZodType[] {\n if (Array.isArray(path)) return walkSegments(schema, path.map(String))\n const pathString = path as string\n if (pathString.length === 0) return [schema]\n return walkSegments(schema, pathString.split(PATH_SEPARATOR))\n}\n\nfunction walkSegments(schema: z.ZodType, segments: readonly string[]): z.ZodType[] {\n if (segments.length === 0) return [schema]\n const [head, ...rest] = segments\n if (head === undefined) return [schema]\n const kind = kindOf(schema)\n switch (kind) {\n case 'object': {\n const shape = getObjectShape(schema as z.ZodObject)\n // Own-property check: `shape` is a plain object whose prototype\n // is `Object.prototype`, so a bare `shape[head]` for `head ===\n // 'toString'` / `'valueOf'` / `'hasOwnProperty'` etc. returns the\n // inherited Function and the walker treats it as a schema. Filter\n // to OWN keys so unknown segments resolve to \"doesn't exist.\"\n if (!Object.hasOwn(shape, head)) return []\n const next = shape[head]\n return next === undefined ? [] : walkSegments(next, rest)\n }\n case 'array':\n return walkSegments(getArrayElement(schema as z.ZodArray), rest)\n case 'set':\n // Sets aren't position-indexed, so the `head` segment is just a\n // synthetic indexer (`[...path, 0]`) used to query the element\n // type. We descend into the value schema and consume the segment.\n return walkSegments(getSetValueType(schema), rest)\n case 'record':\n return walkSegments(getRecordValueType(schema), rest)\n case 'tuple': {\n const index = Number(head)\n if (!Number.isInteger(index)) return []\n const items = getTupleItems(schema)\n const item = items[index]\n return item === undefined ? [] : walkSegments(item, rest)\n }\n case 'union':\n return getUnionOptions(schema).flatMap((opt) => walkSegments(opt, segments))\n case 'discriminated-union': {\n // Filter options whose shape contains this segment. Fallback: if no\n // option matches (e.g. the discriminator key itself), try every option.\n // `Object.hasOwn` (not `in`) so `Object.prototype` keys don't leak.\n const options = getDiscriminatedOptions(schema)\n const matching = options.filter((opt) => {\n const shape = getObjectShape(opt)\n return Object.hasOwn(shape, head)\n })\n const candidates = matching.length > 0 ? matching : options\n return candidates.flatMap((opt) => walkSegments(opt, segments))\n }\n case 'optional':\n case 'nullable':\n case 'default':\n case 'readonly':\n case 'catch': {\n // `catch` peels like a wrapper — descend into the inner schema.\n // The catch fallback only matters at parse time, not path lookup.\n const inner = unwrapInner(schema)\n return inner === undefined ? [] : walkSegments(inner, segments)\n }\n case 'pipe': {\n const inner = unwrapPipe(schema)\n return inner === undefined ? [] : walkSegments(inner, segments)\n }\n case 'lazy': {\n // Lazy transparently descends — `assertSupportedKinds` guarantees\n // the tree is finite before we get here.\n const inner = unwrapLazy(schema)\n return inner === undefined ? [] : walkSegments(inner, segments)\n }\n case 'intersection': {\n // Union of both sides' resolutions — callers try each candidate,\n // matching parse-time semantics where a value must satisfy both.\n const left = getIntersectionLeft(schema)\n const right = getIntersectionRight(schema)\n const leftResults = left === undefined ? [] : walkSegments(left, segments)\n const rightResults = right === undefined ? [] : walkSegments(right, segments)\n return [...leftResults, ...rightResults]\n }\n // Leaf types — can't descend further.\n case 'string':\n case 'number':\n case 'bigint':\n case 'boolean':\n case 'undefined':\n case 'null':\n case 'void':\n case 'never':\n case 'any':\n case 'unknown':\n case 'date':\n case 'enum':\n case 'literal':\n case 'nan':\n case 'promise':\n case 'custom':\n case 'template-literal':\n return []\n default: {\n const _exhaustive: never = kind\n throw new Error(`walkSegments: unhandled ZodKind '${_exhaustive as string}'`)\n }\n }\n}\n","import { z } from 'zod'\nimport {\n getArrayElement,\n getCatchDefault,\n getChecks,\n getDefaultValue,\n getDiscriminatedOptions,\n getDiscriminator,\n getIntersectionLeft,\n getIntersectionRight,\n getObjectShape,\n getRecordKeyType,\n getRecordValueType,\n getSetValueType,\n getTupleItems,\n getUnionOptions,\n hasChecks,\n isAsyncCheck,\n kindOf,\n unwrapInner,\n unwrapLazy,\n unwrapPipe,\n} from './introspect'\n\ntype StripConfigInternal = Pick<StripConfig, 'stripRefinements'> & {\n /**\n * Optional per-check predicate. When provided, only checks for which\n * `shouldKeepCheck` returns `true` are re-applied to the rebuilt\n * schema. `stripAsyncChecks` uses this to filter async refines while\n * preserving every sync check verbatim. Absent → keep all checks\n * (existing behaviour for `getSlimSchema` callers).\n */\n shouldKeepCheck?: (check: unknown) => boolean\n}\n\n/**\n * Re-apply the container-level checks from `original` to `rebuilt`.\n * Container constructors (`z.object`, `z.array`, `z.tuple`, `z.record`,\n * `z.union`) don't accept checks in their factory signature, so\n * rebuilding a container drops `.min(1)` / `.max(3)` / `.strict()` /\n * etc. silently. Without this, a schema like\n * `z.array(z.string()).min(1)` in strict mode (where\n * `stripRefinements !== true`) would accept `[]` — the bug CR\n * reported.\n *\n * `.check(...)` accepts raw check instances, which is exactly what\n * the internal `def.checks` array holds. Skipping when\n * `stripRefinements === true` matches the leaf branches at the bottom\n * of `getSlimSchema`.\n */\nfunction carryChecks<Rebuilt extends z.ZodType>(\n rebuilt: Rebuilt,\n original: z.ZodType,\n stripConfig: StripConfigInternal\n): Rebuilt {\n if (stripConfig.stripRefinements === true) return rebuilt\n if (!hasChecks(original)) return rebuilt\n const all = getChecks(original)\n const checks =\n stripConfig.shouldKeepCheck === undefined ? all : all.filter(stripConfig.shouldKeepCheck)\n if (checks.length === 0) return rebuilt\n // `.check` on a concrete ZodType accepts instances of `$ZodCheck`\n // in Zod v4; the introspection helper returns exactly that shape,\n // so the cast is the boundary between adapter-internal typing and\n // Zod's public API.\n return (rebuilt as z.ZodType<unknown>).check(\n ...(checks as Parameters<z.ZodType<unknown>['check']>)\n ) as Rebuilt\n}\n\n/**\n * stripRefinements: rebuild the schema tree with all refinement checks\n * (`z.string().min(3)`, `z.number().multipleOf(2)`, etc.) removed. The\n * validate-then-fix loop uses this so a default like `''` can satisfy a\n * `z.string().email()` during default-values construction in lax mode.\n *\n * The semantics match v3's `stripRefinements`: descend through container\n * types and rebuild leaves without their checks.\n */\nexport function stripRefinements(schema: z.ZodType): z.ZodType {\n const kind = kindOf(schema)\n switch (kind) {\n case 'string':\n return hasChecks(schema) ? z.string() : schema\n case 'number':\n return hasChecks(schema) ? z.number() : schema\n case 'bigint':\n return hasChecks(schema) ? z.bigint() : schema\n case 'array': {\n const element = getArrayElement(schema as z.ZodArray)\n return z.array(stripRefinements(element))\n }\n case 'set': {\n const valueType = getSetValueType(schema)\n return z.set(stripRefinements(valueType))\n }\n case 'tuple': {\n const items = getTupleItems(schema).map(stripRefinements)\n // z.tuple requires [T, ...T[]] but the runtime accepts an array.\n return z.tuple(items as unknown as [z.ZodType, ...z.ZodType[]]) as unknown as z.ZodType\n }\n case 'object': {\n const shape = getObjectShape(schema as z.ZodObject)\n const next: Record<string, z.ZodType> = {}\n for (const [k, v] of Object.entries(shape)) {\n next[k] = stripRefinements(v)\n }\n return z.object(next)\n }\n case 'record': {\n const keyType = getRecordKeyType(\n schema\n ) as unknown as z.core.$ZodRecord['_zod']['def']['keyType']\n const valueType = stripRefinements(getRecordValueType(schema))\n return z.record(keyType as z.ZodType<string | number | symbol>, valueType)\n }\n case 'union': {\n const options = getUnionOptions(schema).map(stripRefinements)\n return z.union(options as unknown as readonly [z.ZodType, z.ZodType, ...z.ZodType[]])\n }\n case 'discriminated-union': {\n const options = getDiscriminatedOptions(schema).map(\n (opt) => stripRefinements(opt) as z.ZodObject\n )\n const discriminator = getDiscriminator(schema)\n if (discriminator === undefined) return schema\n return z.discriminatedUnion(\n discriminator,\n options as unknown as readonly [z.ZodObject, ...z.ZodObject[]]\n )\n }\n // Wrappers: strip the inner, preserve the wrapper semantics where\n // possible. For stripping refinements we typically want wrappers to\n // survive (optional/nullable/default), so leave them alone.\n case 'optional':\n case 'nullable':\n case 'default':\n case 'readonly':\n case 'pipe':\n // These wrappers are handled by getSlimSchema below per stripConfig.\n return schema\n case 'lazy': {\n const inner = unwrapLazy(schema)\n if (inner === undefined) return schema\n const slimmedInner = stripRefinements(inner)\n return z.lazy(() => slimmedInner)\n }\n case 'intersection': {\n const left = getIntersectionLeft(schema)\n const right = getIntersectionRight(schema)\n if (left === undefined || right === undefined) return schema\n return z.intersection(stripRefinements(left), stripRefinements(right))\n }\n case 'catch': {\n const inner = unwrapInner(schema)\n if (inner === undefined) return schema\n const slimmedInner = stripRefinements(inner)\n return (slimmedInner as z.ZodType).catch(getCatchDefault(schema) as never)\n }\n // Leaf types without refinements, or Zod features we don't rewrite.\n case 'boolean':\n case 'date':\n case 'enum':\n case 'literal':\n case 'null':\n case 'undefined':\n case 'any':\n case 'unknown':\n case 'nan':\n case 'void':\n case 'never':\n case 'promise':\n case 'custom':\n case 'template-literal':\n return schema\n default: {\n // Compile-time exhaustiveness pin. If `ZodKind` grows a new\n // variant, this line breaks first — pointing at the offending\n // value — instead of a diffuse \"function lacks return statement\"\n // elsewhere in the file. Mirrors the pattern in assertSupportedKinds.\n const _exhaustive: never = kind\n throw new Error(`stripRefinements: unhandled ZodKind '${_exhaustive as string}'`)\n }\n }\n}\n\n/**\n * Walk the schema tree and rebuild each node with async refinement\n * checks removed. Sync `.refine` / `.superRefine` / built-in checks\n * (`min`, `max`, `email`, etc.) are preserved; wrappers (`.optional()`,\n * `.nullable()`, `.default(v)`, `.readonly()`, `.catch(v)`) are\n * preserved structurally and recursed into.\n *\n * Used by the construction-time `getDefaultValues` fallback in the\n * adapter: when `rootSchema.safeParse(data)` throws because the\n * schema contains an async refine, retrying against\n * `stripAsyncChecks(rootSchema)` surfaces every sync-refinement\n * violation that the original parse would have collected if the\n * async sibling weren't poisoning the sync entry point.\n *\n * Conceptually distinct from `stripRefinements` (drop-all, leaf\n * operation) and `getSlimSchema` (configurable peeling for default\n * derivation): this is a tree-walk that filters by sync/async at\n * every check site.\n */\nexport function stripAsyncChecks(schema: z.ZodType): z.ZodType {\n const config: StripConfigInternal = {\n stripRefinements: false,\n shouldKeepCheck: (c) => !isAsyncCheck(c),\n }\n // Cycle-detection set scoped to one strip pass. Mirrors the\n // pattern in `containsAsyncRefine` (introspect.ts) — pathological\n // `z.lazy(() => self)` schemas would otherwise infinite-recurse.\n const seen = new WeakSet<object>()\n\n function recurse(s: z.ZodType): z.ZodType {\n // ZodType instances are always objects — the WeakSet add/check\n // is unconditional once we're inside this function.\n if (seen.has(s)) return s\n seen.add(s)\n\n const kind = kindOf(s)\n switch (kind) {\n case 'string':\n return hasChecks(s) ? carryChecks(z.string(), s, config) : s\n case 'number':\n return hasChecks(s) ? carryChecks(z.number(), s, config) : s\n case 'bigint':\n return hasChecks(s) ? carryChecks(z.bigint(), s, config) : s\n\n case 'array': {\n const element = getArrayElement(s as z.ZodArray)\n return carryChecks(z.array(recurse(element)), s, config)\n }\n case 'set': {\n const valueType = getSetValueType(s)\n return carryChecks(z.set(recurse(valueType)), s, config)\n }\n case 'tuple': {\n const items = getTupleItems(s).map(recurse)\n const rebuilt = z.tuple(\n items as unknown as [z.ZodType, ...z.ZodType[]]\n ) as unknown as z.ZodType\n return carryChecks(rebuilt, s, config)\n }\n case 'object': {\n const shape = getObjectShape(s as z.ZodObject)\n const next: Record<string, z.ZodType> = {}\n for (const [k, v] of Object.entries(shape)) {\n next[k] = recurse(v as z.ZodType)\n }\n return carryChecks(z.object(next), s, config)\n }\n case 'record': {\n const keyType = getRecordKeyType(s)\n const valueType = recurse(getRecordValueType(s))\n const rebuilt = z.record(keyType as z.ZodType<string | number | symbol>, valueType)\n return carryChecks(rebuilt, s, config)\n }\n case 'union': {\n const options = getUnionOptions(s).map(recurse)\n const rebuilt = z.union(\n options as unknown as readonly [z.ZodType, z.ZodType, ...z.ZodType[]]\n )\n return carryChecks(rebuilt, s, config)\n }\n case 'discriminated-union': {\n const options = getDiscriminatedOptions(s).map((opt) => recurse(opt) as z.ZodObject)\n const discriminator = getDiscriminator(s)\n if (discriminator === undefined) return s\n return z.discriminatedUnion(\n discriminator,\n options as unknown as readonly [z.ZodObject, ...z.ZodObject[]]\n )\n }\n\n case 'optional': {\n const inner = unwrapInner(s)\n if (inner === undefined) return s\n return (recurse(inner) as z.ZodType).optional()\n }\n case 'nullable': {\n const inner = unwrapInner(s)\n if (inner === undefined) return s\n return (recurse(inner) as z.ZodType).nullable()\n }\n case 'default': {\n const inner = unwrapInner(s)\n if (inner === undefined) return s\n return (recurse(inner) as z.ZodType).default(getDefaultValue(s) as never)\n }\n case 'readonly': {\n const inner = unwrapInner(s)\n if (inner === undefined) return s\n return (recurse(inner) as z.ZodType).readonly()\n }\n\n case 'pipe':\n // Pipes carry transforms whose output shape would change if\n // we rebuilt them blindly; recursing through both halves of a\n // pipe also requires both halves to be addressable, which\n // `unwrapPipe` doesn't expose. If an async refine lives\n // inside a pipe, its throw surfaces from the inner\n // defensive catch in `getDefaultValues` — same observable\n // behaviour as today's pre-fix catch path. Common-case sync\n // siblings on flat object schemas are unaffected.\n return s\n\n case 'lazy': {\n const inner = unwrapLazy(s)\n if (inner === undefined) return s\n const stripped = recurse(inner)\n return z.lazy(() => stripped)\n }\n case 'intersection': {\n const left = getIntersectionLeft(s)\n const right = getIntersectionRight(s)\n if (left === undefined || right === undefined) return s\n return z.intersection(recurse(left), recurse(right))\n }\n case 'catch': {\n const inner = unwrapInner(s)\n if (inner === undefined) return s\n return (recurse(inner) as z.ZodType).catch(getCatchDefault(s) as never)\n }\n\n // Leaves with no checks — pass through unchanged.\n case 'boolean':\n case 'date':\n case 'enum':\n case 'literal':\n case 'null':\n case 'undefined':\n case 'any':\n case 'unknown':\n case 'nan':\n case 'void':\n case 'never':\n case 'promise':\n case 'custom':\n case 'template-literal':\n return s\n default: {\n const _exhaustive: never = kind\n throw new Error(`stripAsyncChecks: unhandled ZodKind '${_exhaustive as string}'`)\n }\n }\n }\n\n return recurse(schema)\n}\n\nexport type StripConfig = {\n /** Strip `.default(v)` wrappers so the walker produces the leaf's empty value. */\n stripDefaultValues?: boolean\n /** Strip `.optional()` so `undefined` values are rejected. */\n stripOptional?: boolean\n /** Strip `.nullable()` so `null` values are rejected. */\n stripNullable?: boolean\n /** Strip refinement checks (email, min, etc.). Same semantic as v3's stripZodRefinements. */\n stripRefinements?: boolean\n /** Strip pipe transforms (refine/transform). Same semantic as v3's stripZodEffects. */\n stripPipe?: boolean\n}\n\n/**\n * getSlimSchema: walk the schema tree and apply `stripConfig` transparently.\n * Wrappers get peeled when their corresponding flag is set; refinements get\n * rebuilt when `stripRefinements` is set. Every branch recurses so deeply\n * nested wrappers inside objects/arrays/unions all get the same treatment.\n */\nexport function getSlimSchema(schema: z.ZodType, stripConfig: StripConfig): z.ZodType {\n const kind = kindOf(schema)\n switch (kind) {\n case 'optional': {\n const inner = unwrapInner(schema) ?? schema\n const slimmedInner = getSlimSchema(inner, stripConfig)\n return stripConfig.stripOptional === true ? slimmedInner : slimmedInner.optional()\n }\n case 'nullable': {\n const inner = unwrapInner(schema) ?? schema\n const slimmedInner = getSlimSchema(inner, stripConfig)\n return stripConfig.stripNullable === true ? slimmedInner : slimmedInner.nullable()\n }\n case 'default': {\n const inner = unwrapInner(schema) ?? schema\n const slimmedInner = getSlimSchema(inner, stripConfig)\n if (stripConfig.stripDefaultValues === true) return slimmedInner\n // Re-apply the default to the slimmed inner. Returning `schema`\n // unchanged would skip nested stripping (refinements / pipe inside\n // a `.default()` wrapper would survive, breaking parity with the\n // optional / nullable cases above). The default value lives on\n // the wrapper at `_zod.def.defaultValue`; introspect.getDefaultValue\n // reads it through the v4 getter and resolves to the materialised\n // value (lazy `.default(() => x)` getters fire here — we rewrap\n // as a fixed value, which is correct for the slim schema's\n // single-shot use during default-values derivation).\n const defaultValue = getDefaultValue(schema)\n return (slimmedInner as z.ZodType).default(defaultValue as never)\n }\n case 'readonly': {\n // `.readonly()` wraps the output in `Object.freeze` — dropping the\n // wrapper after slimming would hand callers a mutable default,\n // which breaks invariants inside refinements that rely on the\n // frozen shape. Re-wrap the slimmed inner so the observable parse\n // behaviour matches the unstripped schema.\n const inner = unwrapInner(schema)\n return inner === undefined\n ? schema\n : (getSlimSchema(inner, stripConfig) as z.ZodType).readonly()\n }\n case 'pipe': {\n // `.pipe(...)` chains schemas sequentially — the output of one\n // feeds the input of the next — and typically carries a\n // `.transform(...)` that mutates the runtime shape. Slimming the\n // inner and dropping the pipe wrapper would lose that\n // transformation, so by default we return the original schema\n // unchanged. Consumers who explicitly opt in via `stripPipe`\n // (e.g. default-values derivation, where a transform doesn't make\n // sense) get the upstream leg of the pipe only.\n if (stripConfig.stripPipe === true) {\n const inner = unwrapPipe(schema) ?? schema\n return getSlimSchema(inner, stripConfig)\n }\n return schema\n }\n case 'object': {\n const shape = getObjectShape(schema as z.ZodObject)\n const next: Record<string, z.ZodType> = {}\n for (const [k, v] of Object.entries(shape)) {\n next[k] = getSlimSchema(v, stripConfig)\n }\n return carryChecks(z.object(next), schema, stripConfig)\n }\n case 'array': {\n const element = getArrayElement(schema as z.ZodArray)\n return carryChecks(z.array(getSlimSchema(element, stripConfig)), schema, stripConfig)\n }\n case 'set': {\n const valueType = getSetValueType(schema)\n return carryChecks(z.set(getSlimSchema(valueType, stripConfig)), schema, stripConfig)\n }\n case 'tuple': {\n const items = getTupleItems(schema).map((it) => getSlimSchema(it, stripConfig))\n const rebuilt = z.tuple(\n items as unknown as [z.ZodType, ...z.ZodType[]]\n ) as unknown as z.ZodType\n return carryChecks(rebuilt, schema, stripConfig)\n }\n case 'record': {\n const keyType = getRecordKeyType(schema)\n const valueType = getSlimSchema(getRecordValueType(schema), stripConfig)\n const rebuilt = z.record(keyType as z.ZodType<string | number | symbol>, valueType)\n return carryChecks(rebuilt, schema, stripConfig)\n }\n case 'union': {\n const options = getUnionOptions(schema).map((opt) => getSlimSchema(opt, stripConfig))\n const rebuilt = z.union(options as unknown as readonly [z.ZodType, z.ZodType, ...z.ZodType[]])\n return carryChecks(rebuilt, schema, stripConfig)\n }\n case 'discriminated-union': {\n const options = getDiscriminatedOptions(schema).map(\n (opt) => getSlimSchema(opt, stripConfig) as z.ZodObject\n )\n const discriminator = getDiscriminator(schema)\n if (discriminator === undefined) return schema\n return z.discriminatedUnion(\n discriminator,\n options as unknown as readonly [z.ZodObject, ...z.ZodObject[]]\n )\n }\n // Leaves: strip refinements if requested, otherwise pass through.\n case 'string':\n case 'number':\n case 'bigint':\n return stripConfig.stripRefinements === true && hasChecks(schema)\n ? stripRefinements(schema)\n : schema\n case 'boolean':\n case 'date':\n case 'enum':\n case 'literal':\n case 'null':\n case 'undefined':\n case 'any':\n case 'unknown':\n case 'nan':\n case 'void':\n case 'never':\n case 'promise':\n case 'custom':\n case 'template-literal':\n return schema\n case 'lazy': {\n const inner = unwrapLazy(schema)\n if (inner === undefined) return schema\n const slimmedInner = getSlimSchema(inner, stripConfig)\n return z.lazy(() => slimmedInner)\n }\n case 'intersection': {\n const left = getIntersectionLeft(schema)\n const right = getIntersectionRight(schema)\n if (left === undefined || right === undefined) return schema\n return z.intersection(getSlimSchema(left, stripConfig), getSlimSchema(right, stripConfig))\n }\n case 'catch': {\n const inner = unwrapInner(schema)\n if (inner === undefined) return schema\n const slimmedInner = getSlimSchema(inner, stripConfig)\n // Preserve the catch wrapper so downstream safeParse still uses\n // the declared fallback — stripping it would discard user intent.\n return (slimmedInner as z.ZodType).catch(getCatchDefault(schema) as never)\n }\n default: {\n const _exhaustive: never = kind\n throw new Error(`getSlimSchema: unhandled ZodKind '${_exhaustive as string}'`)\n }\n }\n}\n","import type { z } from 'zod'\nimport { getAtPath, isPlainRecord, setAtPath } from '../../core/path-walker'\nimport { slimKindOf } from '../../core/slim-primitive-gate'\nimport { getDiscriminatedUnionFirstOption, unwrapToDiscriminatedUnion } from './discriminator'\nimport { slimPrimitivesOf } from './slim-primitives'\nimport {\n getCatchDefault,\n getDefaultValue,\n getDiscriminatedOptions,\n getEnumValues,\n getIntersectionLeft,\n getIntersectionRight,\n getLiteralValues,\n getObjectShape,\n getTupleItems,\n getUnionOptions,\n kindOf,\n unwrapInner,\n unwrapLazy,\n unwrapPipe,\n type ZodKind,\n} from './introspect'\nimport { getNestedZodSchemasAtPath } from './path-walker'\nimport { getSlimSchema } from './strip'\n\n/**\n * Derive a default value for any Zod v4 schema. Mirrors v3's walker but\n * routes through the introspect helpers so `def.*` access stays\n * chokepointed. When `useDefault` is false, `.default(x)` wrappers are\n * skipped so the walker produces the underlying leaf's empty value\n * instead — useful when the caller wants a \"blank\" initial state rather\n * than the schema's declared defaults.\n */\nexport function deriveDefault(schema: z.ZodType, useDefault: boolean): unknown {\n return defaultForKind(kindOf(schema), schema, useDefault)\n}\n\nfunction defaultForKind(kind: ZodKind, schema: z.ZodType, useDefault: boolean): unknown {\n switch (kind) {\n case 'object': {\n const shape = getObjectShape(schema as z.ZodObject)\n const out: Record<string, unknown> = {}\n for (const [key, subSchema] of Object.entries(shape)) {\n out[key] = deriveDefault(subSchema, useDefault)\n }\n return out\n }\n case 'default': {\n if (useDefault) return getDefaultValue(schema)\n const inner = unwrapInner(schema)\n return inner === undefined ? undefined : deriveDefault(inner, useDefault)\n }\n case 'optional':\n return undefined\n case 'nullable':\n return null\n case 'readonly': {\n const inner = unwrapInner(schema)\n return inner === undefined ? undefined : deriveDefault(inner, useDefault)\n }\n case 'pipe': {\n const inner = unwrapPipe(schema)\n return inner === undefined ? undefined : deriveDefault(inner, useDefault)\n }\n case 'array':\n return []\n case 'set':\n return new Set()\n case 'record':\n return {}\n case 'tuple': {\n const items = getTupleItems(schema)\n return items.map((item) => deriveDefault(item, useDefault))\n }\n case 'union': {\n const options = getUnionOptions(schema)\n const first = options[0]\n return first === undefined ? undefined : deriveDefault(first, useDefault)\n }\n case 'discriminated-union': {\n const first = getDiscriminatedUnionFirstOption(schema)\n return first === undefined ? undefined : deriveDefault(first, useDefault)\n }\n case 'string':\n return ''\n case 'number':\n return 0\n case 'bigint':\n // z.bigint() strictly rejects numbers; the default must be a bigint\n // literal. Using `0` here causes default-values derivation to fail\n // the schema's own validation.\n return 0n\n case 'boolean':\n return false\n case 'date':\n return new Date(0)\n case 'null':\n return null\n case 'undefined':\n return undefined\n case 'enum': {\n const values = getEnumValues(schema)\n return values[0]\n }\n case 'literal': {\n const values = getLiteralValues(schema)\n return values[0]\n }\n case 'nan':\n return NaN\n case 'lazy': {\n const inner = unwrapLazy(schema)\n return inner === undefined ? undefined : deriveDefault(inner, useDefault)\n }\n case 'intersection': {\n const left = getIntersectionLeft(schema)\n const right = getIntersectionRight(schema)\n const l = left === undefined ? undefined : deriveDefault(left, useDefault)\n const r = right === undefined ? undefined : deriveDefault(right, useDefault)\n // `mergeDeep` prefers `right` where both sides carry a plain-record\n // value at a key, and returns `right` wholesale when either side is\n // a leaf. That matches parse-time semantics: an intersection of\n // `{ a }` and `{ b }` must satisfy both, so the merged shape carries\n // both keys' defaults.\n return mergeDeep(l, r)\n }\n case 'catch': {\n // Catch wraps a schema with a fallback value used when parsing\n // fails. For `useDefault=true` the catch value *is* the best\n // default — it's the authoritative \"fresh\" value the consumer\n // declared. For `useDefault=false` fall through to the inner\n // walker so the leaf's empty value wins (matches the default/\n // prefault branch's semantics).\n if (useDefault) return getCatchDefault(schema)\n const inner = unwrapInner(schema)\n return inner === undefined ? undefined : deriveDefault(inner, useDefault)\n }\n case 'any':\n case 'unknown':\n case 'void':\n case 'never':\n case 'promise':\n case 'custom':\n case 'template-literal':\n // `promise`/`custom`/`template-literal` are rejected by\n // `assertSupportedKinds` at adapter construction, so this branch\n // is unreachable through the public surface. Kept for exhaustive\n // switch safety when `deriveDefault` is called directly in tests.\n return undefined\n default: {\n const _exhaustive: never = kind\n throw new Error(`deriveDefault: unhandled ZodKind '${_exhaustive as string}'`)\n }\n }\n}\n\n/**\n * Merge `override` into `base` recursively, preferring override leaves.\n *\n * Leaf semantics (anything not a plain `{}` record is a leaf):\n * - `undefined` override → no-op (don't drop the base value)\n * - `null` override → replaces base (a deliberate \"clear this field\" signal)\n * - primitives, arrays, `Date`, `Map`, class instances → replace wholesale\n *\n * Only plain records on BOTH sides recurse. The previous implementation\n * walked any `typeof === 'object'` value, which collapsed `Date`/`Map`\n * overrides into `{}` and silently swallowed `null` overrides intended\n * to clear a nullable default.\n */\nexport function mergeDeep(base: unknown, override: unknown): unknown {\n if (override === undefined) return base\n // Non-plain-record overrides are leaves and replace base wholesale.\n // (null, primitives, arrays, Date, Map, class instances all land here.)\n if (!isPlainRecord(override)) return override\n // Override is a plain record but base isn't — leaf-replacement again.\n if (!isPlainRecord(base)) return override\n\n const result: Record<string, unknown> = { ...base }\n for (const key of Object.keys(override)) {\n const oVal = override[key]\n const bVal = base[key]\n // Recurse only when BOTH sides are plain records; otherwise treat the\n // override as a leaf. Preserves the historic quirk that an explicit\n // `undefined` does NOT evict the base key (consumers who want to\n // clear a field use `null`).\n if (isPlainRecord(oVal) && isPlainRecord(bVal)) {\n result[key] = mergeDeep(bVal, oVal)\n } else if (oVal !== undefined) {\n result[key] = oVal\n }\n }\n return result\n}\n\nexport type GetDefaultValuesOptions = {\n schema: z.ZodObject\n useDefaultSchemaValues: boolean\n constraints: unknown\n}\n\nexport type DefaultValuesResult<Form> = {\n data: Form\n success: boolean\n slimSchema: z.ZodType\n}\n\n/**\n * getDefaultValuesFromZodSchema — produces a form's starting value.\n *\n * The algorithm mirrors v3's: walk the schema to derive blank defaults,\n * merge constraints, then run the schema's `safeParse`. On failure, walk\n * the resulting issues and fill in issue-specific defaults at each\n * complaining path — e.g. `invalid_type` with `issue.expected === 'string'`\n * fills in `''`, `invalid_value` picks the first allowed value, etc. Re-\n * parse and return.\n *\n * Refinements are always stripped from the slim schema — this helper's\n * concern is producing usable starting data, not surfacing refinement\n * errors. Refinement enforcement (in strict mode) lives upstream in\n * `adapter.ts`'s `rootSchema.safeParse(data)` pass, which uses the full\n * schema. Stripping here is also what keeps `safeParse` from throwing\n * synchronously when the schema contains an async refine.\n */\nexport function getDefaultValuesFromZodSchema<Form>(\n opts: GetDefaultValuesOptions\n): DefaultValuesResult<Form> {\n const { schema, useDefaultSchemaValues, constraints } = opts\n const initial = deriveDefault(schema, useDefaultSchemaValues)\n const merged = mergeDeep(initial, constraints) as unknown\n\n // Strip wrappers, including refinements. The slim schema is for\n // *default-value derivation* — its job is to produce usable starting\n // data, not to surface refinement errors. Refinement errors are the\n // domain of the strict-mode pass downstream (`adapter.ts`'s\n // `rootSchema.safeParse(data)`), which uses the full schema.\n //\n // Crucially, this also avoids `safeParse` throwing synchronously when\n // the schema contains an async refine (zod's \"Encountered Promise\n // during synchronous parse\" error) — which would otherwise crash\n // construction for any strict-mode form with `z.string().refine(async …)`.\n const slimSchema = getSlimSchema(schema, {\n stripDefaultValues: true,\n stripPipe: true,\n stripRefinements: true,\n })\n\n const firstParse = slimSchema.safeParse(merged)\n if (firstParse.success) {\n return { data: firstParse.data as Form, success: true, slimSchema }\n }\n\n // Validate-then-fix: walk issues and fill defaults per path. Under\n // the slim-primitive write contract, we only fix issues that violate\n // STRUCTURAL or PRIMITIVE-TYPE shape. Refinement-level issues (enum\n // membership, literal equality, .email/.min(N)/regex, custom\n // refines, unrecognized_keys) pass THROUGH unchanged — the user's\n // defaultValues are preserved verbatim and the strict-mode\n // validation pass downstream surfaces the error at construction.\n //\n // The discriminant: look up the actual offending value at the\n // issue's path and check its slim primitive kind against the\n // candidate schema's slim primitive set. If the value's kind IS in\n // the set, the issue is refinement-level → skip. If it's NOT in\n // the set, the issue is primitive/structural → fix. This unifies\n // every issue code under one check rather than enumerating refinement\n // codes (which differ between Zod versions and grow over time).\n let fixedData = merged as Record<string, unknown>\n for (const issue of firstParse.error.issues) {\n const pathSegments = issue.path.map((seg) => (typeof seg === 'number' ? seg : String(seg))) as (\n | string\n | number\n )[]\n // Pass the structured path directly — joining with '.' would merge\n // a literal-dot key (`['profile.name']`) into two segments and\n // target the wrong sub-schema during fix-up.\n const candidates = getNestedZodSchemasAtPath(slimSchema, pathSegments)\n if (candidates.length === 0) continue\n const candidate = candidates[0]\n if (candidate === undefined) continue\n\n // Refinement-vs-primitive classification.\n const valueAtPath = getAtPath(merged, pathSegments)\n const slimKinds = slimPrimitivesOf(candidate)\n if (slimKinds.size > 0 && slimKinds.has(slimKindOf(valueAtPath))) {\n // Refinement-level: pass through unchanged.\n continue\n }\n\n // Some issues don't carry a type path: fall back to deriving a default\n // for the schema at that location.\n const fixValue = defaultFromIssue(issue, candidate, useDefaultSchemaValues)\n if (fixValue === SKIP) continue\n fixedData = (\n pathSegments.length === 0 ? fixValue : setAtPath(fixedData, pathSegments, fixValue)\n ) as Record<string, unknown>\n }\n\n const secondParse = slimSchema.safeParse(fixedData)\n if (secondParse.success) {\n return { data: secondParse.data as Form, success: true, slimSchema }\n }\n\n // Last-resort: hand back what we constructed even if it still doesn't\n // parse. Better a partially-valid form than an exception at mount time.\n return { data: fixedData as unknown as Form, success: false, slimSchema }\n}\n\nconst SKIP = Symbol('atta:skip-fix')\n\n/**\n * Map a Zod v4 issue to a concrete replacement value for the path the\n * issue points at. Falls back to the candidate subschema's walker default\n * when the issue code doesn't carry enough info.\n */\nfunction defaultFromIssue(\n issue: z.core.$ZodIssue,\n candidate: z.ZodType,\n useDefaultSchemaValues: boolean\n): unknown {\n if (issue.code === 'invalid_type') {\n // If the candidate is (or wraps) a discriminated union, prefer the\n // first-option default over `undefined` — matches v3's behaviour.\n const du = unwrapToDiscriminatedUnion(candidate)\n if (du !== undefined) {\n const first = getDiscriminatedUnionFirstOption(du)\n if (first !== undefined) return deriveDefault(first, useDefaultSchemaValues)\n }\n return deriveDefault(candidate, useDefaultSchemaValues)\n }\n if (issue.code === 'invalid_value') {\n const values = (issue as unknown as { values?: readonly unknown[] }).values\n if (values !== undefined && values.length > 0) return values[0]\n return deriveDefault(candidate, useDefaultSchemaValues)\n }\n // Other issue codes (too_small/too_big/invalid_format) only fire in strict\n // mode since lax mode strips refinements. Fall back to the walker default.\n return deriveDefault(candidate, useDefaultSchemaValues)\n}\n\n/**\n * Exported for callers who want the discriminated-union option set for\n * path resolution (used by the adapter's getSchemasAtPath).\n */\nexport { getDiscriminatedOptions, getUnionOptions }\n","import type { z } from 'zod'\nimport type {\n AbstractSchema,\n FieldMetaPayload,\n FormKey,\n ResolvedFieldMeta,\n SlimPrimitiveKind,\n UnionDiscriminatorContext,\n ValidationError,\n ValidationResponse,\n} from '../../types/types-api'\nimport { AttaformErrorCode } from '../../core/error-codes'\nimport { getFieldMeta, getFieldMetaList } from './field-meta'\nimport { humanize } from '../../core/humanize'\nimport { canonicalizePath, type Path, type PathKey } from '../../core/paths'\nimport type { DeepPartial, GenericForm } from '../../types/types-core'\nimport { assertSupportedKinds } from './assert-supported'\nimport { unwrapToDiscriminatedUnion } from './discriminator'\nimport { zodIssuesToValidationErrors } from './errors'\nimport { fingerprintZodSchema } from './fingerprint'\nimport { deriveDefault, getDefaultValuesFromZodSchema } from './default-values'\nimport {\n assertZodVersion,\n containsAsyncRefine,\n getArrayElement,\n getDiscriminatedOptions,\n getDiscriminator,\n getIntersectionLeft,\n getIntersectionRight,\n getLiteralValues,\n getObjectShape,\n getRecordValueType,\n getSetValueType,\n getTupleItems,\n getUnionOptions,\n kindOf,\n unwrapInner,\n unwrapLazy,\n unwrapPipe,\n} from './introspect'\nimport { getNestedZodSchemasAtPath } from './path-walker'\nimport { slimPrimitivesOf } from './slim-primitives'\nimport { stripAsyncChecks } from './strip'\n\n/**\n * Zod v4 adapter — implements `AbstractSchema` against Zod v4's public\n * surface. Internal (`def.*`) access is quarantined to introspect.ts and\n * the co-located modules (default-values, strip, path-walker, discriminator,\n * errors). This file is the wiring layer between those modules and the\n * framework's AbstractSchema contract.\n *\n * Feature parity with the v3 adapter:\n * - getDefaultValues: validate-then-fix loop (delegated to default-values.ts)\n * with refinement stripping in lax mode; discriminated-union-aware\n * first-option fallback for invalid_type issues.\n * - getSchemasAtPath: discriminated-union-aware path walker.\n * - validateAtPath: per-union-branch parse with aggregated errors.\n */\n\nconst PATH_SEPARATOR = '.'\n\n/**\n * Peel `.optional()` / `.nullable()` wrappers off a leaf schema ONLY\n * when the inner type is structurally fillable (object, array, tuple,\n * record, discriminated/plain union, intersection — or itself a\n * peelable wrapper that resolves to one of those). Peeling exposes\n * the inner shape's default so consumer-supplied partial writes\n * through optional sub-schemas (`{ profile: z.object({...}).optional() }`,\n * `setValue('profile', { name: 'X' })`) get the inner shape's\n * structural defaults filled in.\n *\n * For PRIMITIVE inner (ZodString, ZodNumber, ZodBoolean, ZodLiteral,\n * etc.), the wrapper IS the meaningful schema — `optional` means\n * \"missing is allowed\", `nullable` means \"null is allowed\". Peeling\n * an optional string to its inner string would default the leaf to\n * `''` and cause mergeStructural to write `notes: ''` instead of\n * `notes: undefined` when filling sibling keys at the parent object\n * — the runtime would silently overwrite the optional's \"absent\"\n * intent with a non-empty marker.\n *\n * `.default(x)` is left intact at every level so deriveDefault\n * returns the explicit default value. Bounded iteration cap as a\n * runaway guard for pathological wrappers.\n */\nfunction unwrapStructuralWrappers(schema: z.ZodType): z.ZodType {\n let current: z.ZodType = schema\n for (let i = 0; i < 64; i++) {\n const outerKind = kindOf(current)\n if (outerKind !== 'optional' && outerKind !== 'nullable') break\n const inner = unwrapInner(current)\n if (inner === undefined) return current\n if (!isStructuralKind(kindOf(inner))) break\n current = inner\n }\n return current\n}\n\n/**\n * Peel every transparent wrapper (optional / nullable / default /\n * readonly / catch / pipe / lazy) off `schema`. Stops on the first\n * non-wrapper kind. Used by `arrayShapeAtPath` for shape\n * introspection where we want the inner kind regardless of what the\n * default-value semantic is — different from\n * `unwrapStructuralWrappers`, which preserves `.default()` so the\n * runtime fill returns the explicit default.\n *\n * Bounded iteration cap as a runaway guard for pathological wrappers.\n */\nfunction peelAllWrappers(schema: z.ZodType): z.ZodType {\n let current: z.ZodType = schema\n for (let i = 0; i < 64; i++) {\n const k = kindOf(current)\n let inner: z.ZodType | undefined\n if (\n k === 'optional' ||\n k === 'nullable' ||\n k === 'default' ||\n k === 'readonly' ||\n k === 'catch'\n ) {\n inner = unwrapInner(current)\n } else if (k === 'pipe') {\n inner = unwrapPipe(current)\n } else if (k === 'lazy') {\n inner = unwrapLazy(current)\n } else {\n return current\n }\n if (inner === undefined) return current\n current = inner\n }\n return current\n}\n\n/**\n * Kinds for which mergeStructural can recurse to fill missing keys\n * or pad missing positions. Primitive leaves (string / number / etc.)\n * and opaque non-recursable wrappers fall outside this set, so\n * peeling Optional / Nullable around them would lose information\n * (the wrapper's \"absent / null\" semantic) without enabling any fill.\n *\n * Wrappers themselves count as structural — `unwrapStructuralWrappers`\n * recurses to re-check their inner kind.\n */\nconst STRUCTURAL_KINDS: ReadonlySet<ReturnType<typeof kindOf>> = new Set([\n 'object',\n 'array',\n 'tuple',\n 'record',\n 'discriminated-union',\n 'union',\n 'intersection',\n 'optional',\n 'nullable',\n 'default',\n 'readonly',\n 'catch',\n 'pipe',\n 'lazy',\n])\n\nfunction isStructuralKind(kind: ReturnType<typeof kindOf>): boolean {\n return STRUCTURAL_KINDS.has(kind)\n}\n\nconst MAX_REQUIRED_DEPTH = 64\n\n/**\n * `true` if the leaf is required — `false` if any wrapper layer admits\n * \"empty\" via `.optional()`, `.nullable()`, `.default(N)`, or\n * `.catch(N)`. See `AbstractSchema.isRequiredAtPath` for the full\n * semantic specification (union → permissive, intersection → strict,\n * readonly/pipe/lazy → transparent peel).\n */\nfunction isLeafRequired(schema: z.ZodType, depth = 0): boolean {\n if (depth > MAX_REQUIRED_DEPTH) return true\n const kind = kindOf(schema)\n // Direct \"schema accepts empty\" wrappers and bare empty-marker leaves —\n // short-circuit. `z.undefined()` / `z.null()` / `z.void()` inside a\n // union (`z.union([z.number(), z.undefined()])`) are how schema authors\n // express \"this field can be absent\" without a wrapper, so they count\n // as not-required here.\n if (\n kind === 'optional' ||\n kind === 'nullable' ||\n kind === 'default' ||\n kind === 'catch' ||\n kind === 'undefined' ||\n kind === 'null' ||\n kind === 'void'\n ) {\n return false\n }\n // Transparent wrappers — peel and re-check.\n if (kind === 'readonly') {\n const inner = unwrapInner(schema)\n return inner === undefined ? true : isLeafRequired(inner, depth + 1)\n }\n if (kind === 'pipe') {\n // Use the input side: blank is a write-time concern.\n const inner = unwrapPipe(schema)\n return inner === undefined ? true : isLeafRequired(inner, depth + 1)\n }\n if (kind === 'lazy') {\n const inner = unwrapLazy(schema)\n return inner === undefined ? true : isLeafRequired(inner, depth + 1)\n }\n // Union — required only if EVERY branch is required (any permissive\n // branch makes the union permissive at parse time).\n if (kind === 'union' || kind === 'discriminated-union') {\n const options =\n kind === 'discriminated-union' ? getDiscriminatedOptions(schema) : getUnionOptions(schema)\n if (options.length === 0) return true\n return options.every((opt) => isLeafRequired(opt as z.ZodType, depth + 1))\n }\n // Intersection — required if EITHER side is required (a parse must\n // satisfy both; the strict side governs).\n if (kind === 'intersection') {\n const left = getIntersectionLeft(schema)\n const right = getIntersectionRight(schema)\n const leftReq = left === undefined ? true : isLeafRequired(left, depth + 1)\n const rightReq = right === undefined ? true : isLeafRequired(right, depth + 1)\n return leftReq || rightReq\n }\n // Direct primitive leaf or unsupported kind — required by default.\n return true\n}\n\n/**\n * Wrap a Zod v4 `ZodObject` schema in an `AbstractSchema` factory.\n *\n * Most consumers never call this directly — `useForm` from\n * `attaform/zod` does the wrapping automatically. Reach for\n * it when you need an adapter outside of `useForm` (e.g. validating\n * data with the same library used elsewhere in the form runtime, or\n * exposing the adapter to a custom integration).\n *\n * Throws if the schema isn't Zod v4, or contains kinds the adapter\n * cannot represent (`z.promise`, `z.custom`, `z.templateLiteral`,\n * recursive `z.lazy(...)`).\n */\nexport function zodV4Adapter<FormSchema extends z.ZodObject, Form extends z.infer<FormSchema>>(\n rootSchema: FormSchema\n): (formKey: FormKey) => AbstractSchema<Form, Form> {\n assertZodVersion(rootSchema)\n // Fail fast at adapter construction if the schema uses kinds we can't\n // represent (z.promise / z.custom / z.templateLiteral) or a recursive\n // z.lazy(). Errors carry the dotted path to the offending node.\n assertSupportedKinds(rootSchema)\n\n return (formKey: FormKey): AbstractSchema<Form, Form> => {\n // Per-adapter `isLeafAtPath` cache. Lifetime = one adapter instance\n // (one per `useForm()` call). Memoises the slim-primitive walk so the\n // leaf-aware proxy traps don't re-walk the schema on every read.\n const leafCache = new Map<PathKey, boolean>()\n // Memoised one-shot walk; `needsAsyncValidation` is queried at\n // construction and possibly again from devtools, so a single tree\n // traversal earns its keep across the adapter's lifetime.\n let asyncValidationFlag: boolean | null = null\n\n return {\n fingerprint: () => fingerprintZodSchema(rootSchema),\n\n needsAsyncValidation(): boolean {\n asyncValidationFlag ??= containsAsyncRefine(rootSchema)\n return asyncValidationFlag\n },\n\n getDefaultValues(config): ReturnType<AbstractSchema<Form, Form>['getDefaultValues']> {\n const { data } = getDefaultValuesFromZodSchema<Form>({\n schema: rootSchema,\n useDefaultSchemaValues: config.useDefaultSchemaValues,\n constraints: config.constraints,\n })\n\n if (config.strict !== false) {\n // Strict mode: run the *full* schema (not the slim one) so\n // refinement-level errors surface. If that passes, we're fine.\n //\n // `safeParse` throws synchronously when the schema contains an\n // async refine — `z.string().refine(async (v) => …)` produces a\n // Promise that the sync parser can't handle. Async refines\n // fundamentally can't seed errors at construction (the\n // `getDefaultValues` contract is sync); degrade gracefully and\n // let the runtime's first mutation kick off `validateAtPath`,\n // which uses `safeParseAsync`.\n try {\n const strictResult = rootSchema.safeParse(data) as z.ZodSafeParseResult<Form>\n if (strictResult.success) {\n return { data: strictResult.data, errors: undefined, success: true, formKey }\n }\n return {\n data,\n errors: zodIssuesToValidationErrors(strictResult.error.issues, formKey),\n success: false,\n formKey,\n }\n } catch {\n // Async-refine threw the sync parser. Retry against a\n // sync-only variant of the schema so sync-refinement\n // errors on the supplied defaults still seed at\n // construction. Async-only errors stay deferred to the\n // post-mount one-shot async validation that\n // `create-form-store` schedules when\n // `needsAsyncValidation()` is true (the contract here is\n // sync, so async verdicts cannot land in this code path\n // regardless).\n try {\n const syncOnly = stripAsyncChecks(rootSchema)\n const syncResult = syncOnly.safeParse(data) as z.ZodSafeParseResult<Form>\n if (syncResult.success) {\n // Sync portion is clean; only async refines could\n // fail. Mount cleanly and let the post-mount async\n // pass surface those — same observable behaviour as\n // the pre-fix catch path for schemas with no sync\n // refines on their defaults.\n return { data, errors: undefined, success: true, formKey }\n }\n return {\n data,\n errors: zodIssuesToValidationErrors(syncResult.error.issues, formKey),\n success: false,\n formKey,\n }\n } catch {\n // Defensive floor — same as the pre-fix behaviour. The\n // strip walker covers every ZodKind, but a future zod\n // construct or a user-defined sync refine that itself\n // throws would land here. Mount cleanly; the post-mount\n // async pass is still the source of truth for any\n // verdict the construction-time parse can't surface.\n return { data, errors: undefined, success: true, formKey }\n }\n }\n }\n\n // Lax mode: the validate-then-fix loop has done everything it can;\n // a partially-valid initial state is preferable to a mount-time\n // exception. Matches v3's lax semantics.\n return { data, errors: undefined, success: true, formKey }\n },\n\n getDefaultAtPath(path) {\n // For empty path, the \"default at root\" is the schema's full\n // default — return the deriveDefault of the root, not the slim-\n // schema validate-then-fix loop (that's getDefaultValues' job).\n if (path.length === 0) return deriveDefault(rootSchema, true)\n const [first] = getNestedZodSchemasAtPath(rootSchema, path)\n if (first === undefined) return undefined\n // STRUCTURAL default: peel `.optional()` / `.nullable()` so the\n // result is the inner shape's default (`''` for an optional\n // string, `{ name: '' }` for an optional object). This is what\n // the runtime structural-completeness invariant needs: when a\n // consumer writes a partial object at an optional path, the lib\n // fills missing keys from the inner shape's structural defaults.\n // `.default(x)` is NOT peeled — the explicit default is the\n // canonical \"fresh\" value at that path. ZodReadonly / ZodCatch /\n // ZodPipe are handled inside `deriveDefault` itself.\n // First candidate matches validateAtPath's first-success semantic\n // and getDefaultValuesFromZodSchema's line-256 first-candidate\n // behavior.\n return deriveDefault(unwrapStructuralWrappers(first), true)\n },\n\n arrayShapeAtPath(path) {\n if (path.length === 0) return undefined\n const [first] = getNestedZodSchemasAtPath(rootSchema, path)\n if (first === undefined) return undefined\n const peeled = peelAllWrappers(first)\n const kind = kindOf(peeled)\n if (kind === 'tuple') return getTupleItems(peeled).length\n if (kind === 'array') return null\n return undefined\n },\n\n getSchemasAtPath(path) {\n const resolved = getNestedZodSchemasAtPath(rootSchema, path)\n return resolved.map(\n (schema) =>\n ({\n fingerprint: () => fingerprintZodSchema(schema),\n needsAsyncValidation: () => containsAsyncRefine(schema),\n getDefaultValues: () => ({\n data: deriveDefault(schema, true),\n errors: undefined,\n success: true,\n formKey,\n }),\n getSchemasAtPath: () => [],\n validateAtPath: async (data: unknown) => {\n // safeParseAsync accepts both sync and async refinements —\n // sync check perf is a microtask slower than safeParse but\n // we trade that for the ability to express .refine(async).\n const result = await schema.safeParseAsync(data)\n if (result.success) {\n return { data: result.data, errors: undefined, success: true, formKey }\n }\n return {\n data: undefined,\n errors: zodIssuesToValidationErrors(result.error.issues, formKey),\n success: false,\n formKey,\n }\n },\n }) as unknown as ReturnType<AbstractSchema<Form, Form>['getSchemasAtPath']>[number]\n )\n },\n\n getSlimPrimitiveTypesAtPath(path): Set<SlimPrimitiveKind> {\n // Resolve every leaf candidate at the path (unions return\n // multiple) and union their slim-primitive sets. Empty path\n // is the root form: always an object.\n if (path.length === 0) return new Set(['object'])\n const resolved = getNestedZodSchemasAtPath(rootSchema, path)\n // Path doesn't resolve in the schema → no kinds accepted.\n // The gate's membership check rejects every kind against an\n // empty set, blocking writes to typo / unknown paths.\n if (resolved.length === 0) return new Set()\n const out = new Set<SlimPrimitiveKind>()\n for (const candidate of resolved) {\n for (const k of slimPrimitivesOf(candidate)) out.add(k)\n }\n return out\n },\n\n isLeafAtPath(path): boolean {\n const cacheKey = canonicalizePath(path).key\n const cached = leafCache.get(cacheKey)\n if (cached !== undefined) return cached\n const prim = this.getSlimPrimitiveTypesAtPath(path)\n // Empty set → path doesn't exist in schema → descend\n // permissively (treat as container so schema-named reserved keys\n // at depth 2+ don't shadow). Any container kind in the set →\n // descend. Otherwise every kind is a primitive → leaf.\n const isLeaf =\n prim.size > 0 &&\n !prim.has('object') &&\n !prim.has('array') &&\n !prim.has('map') &&\n !prim.has('set')\n leafCache.set(cacheKey, isLeaf)\n return isLeaf\n },\n\n isRequiredAtPath(path): boolean {\n // Root form is always \"required\" in the structural sense — it's\n // the object we're parsing. Submit/validate's required-empty\n // check never sees the root path in `blankPaths`\n // (the set tracks primitive leaves), so the value is academic.\n if (path.length === 0) return true\n const resolved = getNestedZodSchemasAtPath(rootSchema, path)\n if (resolved.length === 0) return false\n // Every candidate must be required for the path overall to be\n // required — matches the union \"any-branch-permissive\" rule\n // when the path traverses a union.\n return resolved.every((candidate) => isLeafRequired(candidate))\n },\n\n getFieldMetaAtPath(path): ResolvedFieldMeta {\n return resolveFieldMetaAtPath(rootSchema, path)\n },\n\n getUnionDiscriminatorAtPath(path): UnionDiscriminatorContext | undefined {\n // Resolve every candidate at `path`; pick the unique one that\n // is (or wraps) a discriminated union. Wrappers\n // (`.optional()` / `.default(...)` / etc.) are peeled by\n // `unwrapToDiscriminatedUnion`. Ambiguous resolutions (two\n // distinct DUs both reachable) bail — the runtime then falls\n // back to a plain write.\n const candidates =\n path.length === 0\n ? [rootSchema as z.ZodType]\n : getNestedZodSchemasAtPath(rootSchema, path)\n let matchedUnion: z.ZodType | undefined\n for (const candidate of candidates) {\n const du = unwrapToDiscriminatedUnion(candidate)\n if (du === undefined) continue\n if (matchedUnion !== undefined && matchedUnion !== du) return undefined\n matchedUnion = du\n }\n if (matchedUnion === undefined) return undefined\n const discKey = getDiscriminator(matchedUnion)\n if (discKey === undefined) return undefined\n const options = getDiscriminatedOptions(matchedUnion)\n return {\n discriminatorKey: discKey,\n getVariantDefault(value: unknown): unknown {\n for (const opt of options) {\n const shape = getObjectShape(opt)\n const litSchema = shape[discKey]\n if (litSchema === undefined) continue\n if (kindOf(litSchema) !== 'literal') continue\n const literalValues = getLiteralValues(litSchema)\n if (literalValues.includes(value)) return deriveDefault(opt, true)\n }\n return undefined\n },\n }\n },\n\n validateAtPath(\n data,\n path,\n options\n ): ReturnType<AbstractSchema<Form, Form>['validateAtPath']> {\n // Sync attempt: when `options.sync === true`, try `safeParse`\n // (synchronous). It throws on async refines / pipes /\n // transforms; we catch and fall through to `safeParseAsync`.\n // Without the flag the adapter goes straight to async — the\n // historical contract every non-reshape callsite expects.\n const trySync = options?.sync === true\n if (trySync) {\n try {\n return runSync()\n } catch {\n // Async-only schema. Fall through to the async path.\n }\n }\n return runAsync()\n\n function runSync(): ValidationResponse<Form> {\n if (path === undefined) {\n const result = rootSchema.safeParse(data) as z.ZodSafeParseResult<Form>\n return result.success\n ? { data: result.data, errors: undefined, success: true, formKey }\n : {\n data: undefined,\n errors: zodIssuesToValidationErrors(result.error.issues, formKey),\n success: false,\n formKey,\n }\n }\n const resolved = getNestedZodSchemasAtPath(rootSchema, path)\n if (resolved.length === 0) return pathNotFound(path)\n const aggregated: ValidationError[] = []\n for (const candidate of resolved) {\n const result = candidate.safeParse(data)\n if (result.success) {\n return { data: result.data as Form, errors: undefined, success: true, formKey }\n }\n aggregated.push(...zodIssuesToValidationErrors(result.error.issues, formKey))\n }\n return { data: undefined, errors: aggregated, success: false, formKey }\n }\n\n async function runAsync(): Promise<ValidationResponse<Form>> {\n if (path === undefined) {\n const result = (await rootSchema.safeParseAsync(data)) as z.ZodSafeParseResult<Form>\n return result.success\n ? { data: result.data, errors: undefined, success: true, formKey }\n : {\n data: undefined,\n errors: zodIssuesToValidationErrors(result.error.issues, formKey),\n success: false,\n formKey,\n }\n }\n const resolved = getNestedZodSchemasAtPath(rootSchema, path)\n if (resolved.length === 0) return pathNotFound(path)\n // Sequential await — parallel parses would run every\n // branch's async side effects on a value only one branch\n // should see.\n const aggregated: ValidationError[] = []\n for (const candidate of resolved) {\n const result = await candidate.safeParseAsync(data)\n if (result.success) {\n return { data: result.data as Form, errors: undefined, success: true, formKey }\n }\n aggregated.push(...zodIssuesToValidationErrors(result.error.issues, formKey))\n }\n return { data: undefined, errors: aggregated, success: false, formKey }\n }\n\n function pathNotFound(p: Path): ValidationResponse<Form> {\n return {\n data: undefined,\n errors: [\n {\n message: `Path '${p.join(PATH_SEPARATOR)}' did not resolve to any schema`,\n path: [...p],\n formKey,\n code: AttaformErrorCode.PathNotFound,\n },\n ],\n success: false,\n formKey,\n }\n }\n },\n }\n }\n}\n\n// Per-rootSchema cache of path → payload maps. Build is a single\n// tree-walk; lookups are O(1) thereafter. WeakMap keyed on the root\n// schema so entries GC with the form.\nconst pathMetaCache = new WeakMap<z.ZodType, Map<PathKey, FieldMetaPayload>>()\n\nfunction getPathMetaMap(rootSchema: z.ZodType): Map<PathKey, FieldMetaPayload> {\n const cached = pathMetaCache.get(rootSchema)\n if (cached !== undefined) return cached\n const map = new Map<PathKey, FieldMetaPayload>()\n const counters = new Map<z.ZodType, number>()\n // Track the LAST path each schema was visited at — used after the\n // walk to absorb any \"surplus\" registrations (cases where the\n // registration list is longer than the schema is visited, e.g. a\n // chain like `withMeta(s, {label}).register(fieldMeta, {desc})`\n // where one path consumes list[0] and list[1] would otherwise go\n // unread). Surplus entries get merged into the schema's last-\n // visited path so chained registrations accumulate as expected.\n const lastPathPerSchema = new Map<z.ZodType, PathKey>()\n const inProgress = new WeakSet<z.ZodType>()\n walkForMeta(rootSchema, [], map, counters, lastPathPerSchema, inProgress)\n for (const [schema, lastPath] of lastPathPerSchema) {\n const list = getFieldMetaList(schema)\n const consumed = counters.get(schema) ?? 0\n if (list.length <= consumed) continue\n const surplus = list\n .slice(consumed)\n .reduce<FieldMetaPayload>((acc, p) => ({ ...acc, ...p }), {})\n const existing = map.get(lastPath) ?? {}\n map.set(lastPath, { ...existing, ...surplus })\n }\n pathMetaCache.set(rootSchema, map)\n return map\n}\n\n/**\n * Walk the schema tree from `rootSchema`, emitting a payload for\n * each path that has registered metadata. For schemas registered at\n * multiple paths (shared instance), the per-schema counter advances\n * each visit and selects the i-th payload from the schema's\n * registration list — when registrations happen inline in the\n * schema literal (the canonical pattern), declaration order matches\n * walk order, so each path lands on its intended payload.\n *\n * Visits the schema first (terminal-position registration), then\n * the peeled inner if different (inner-then-wrap registration). At\n * each point the FIRST list-payload found wins for that path.\n */\nfunction walkForMeta(\n schema: z.ZodType,\n path: Path,\n map: Map<PathKey, FieldMetaPayload>,\n counters: Map<z.ZodType, number>,\n lastPathPerSchema: Map<z.ZodType, PathKey>,\n inProgress: WeakSet<z.ZodType>\n): void {\n if (inProgress.has(schema)) return\n inProgress.add(schema)\n try {\n const pathKey = canonicalizePath(path).key\n // Pull a payload off the target schema's list (counter-indexed).\n if (!map.has(pathKey)) {\n const payload = consumePayload(schema, counters)\n if (payload !== undefined) {\n map.set(pathKey, payload)\n lastPathPerSchema.set(schema, pathKey)\n }\n }\n // Also try the peeled inner — covers `withMeta(z.string(), {...}).optional()`\n // where the registration sits on the inner before wrapping.\n const peeled = peelAllWrappers(schema)\n if (peeled !== schema && !map.has(pathKey)) {\n const payload = consumePayload(peeled, counters)\n if (payload !== undefined) {\n map.set(pathKey, payload)\n lastPathPerSchema.set(peeled, pathKey)\n }\n }\n // Descend.\n const kind = kindOf(schema)\n switch (kind) {\n case 'object': {\n const shape = getObjectShape(schema as z.ZodObject)\n for (const [key, child] of Object.entries(shape)) {\n walkForMeta(child, [...path, key], map, counters, lastPathPerSchema, inProgress)\n }\n return\n }\n case 'array': {\n // Visit the element schema with a synthetic '0' index so leaf\n // metadata under array elements gets registered per the array's\n // canonical \"first slot\" path. Per-index instantiations of the\n // array element share the same schema instance, so the\n // resolver's fallback (getFieldMeta on the schema) picks up\n // anything not captured here.\n walkForMeta(\n getArrayElement(schema as z.ZodArray),\n [...path, 0],\n map,\n counters,\n lastPathPerSchema,\n inProgress\n )\n return\n }\n case 'tuple': {\n const items = getTupleItems(schema)\n for (let i = 0; i < items.length; i++) {\n const item = items[i]\n if (item !== undefined)\n walkForMeta(item, [...path, i], map, counters, lastPathPerSchema, inProgress)\n }\n return\n }\n case 'set':\n walkForMeta(\n getSetValueType(schema),\n [...path, 0],\n map,\n counters,\n lastPathPerSchema,\n inProgress\n )\n return\n case 'record':\n walkForMeta(\n getRecordValueType(schema),\n [...path, '*'],\n map,\n counters,\n lastPathPerSchema,\n inProgress\n )\n return\n case 'union': {\n for (const opt of getUnionOptions(schema)) {\n walkForMeta(opt, path, map, counters, lastPathPerSchema, inProgress)\n }\n return\n }\n case 'discriminated-union': {\n for (const opt of getDiscriminatedOptions(schema)) {\n walkForMeta(opt, path, map, counters, lastPathPerSchema, inProgress)\n }\n return\n }\n case 'optional':\n case 'nullable':\n case 'default':\n case 'readonly':\n case 'catch': {\n const inner = unwrapInner(schema)\n if (inner !== undefined)\n walkForMeta(inner, path, map, counters, lastPathPerSchema, inProgress)\n return\n }\n case 'pipe': {\n const inner = unwrapPipe(schema)\n if (inner !== undefined)\n walkForMeta(inner, path, map, counters, lastPathPerSchema, inProgress)\n return\n }\n case 'lazy': {\n const inner = unwrapLazy(schema)\n if (inner !== undefined)\n walkForMeta(inner, path, map, counters, lastPathPerSchema, inProgress)\n return\n }\n case 'intersection': {\n // Descend into both sides at the same path — registrations\n // on either side surface for the same path.\n const left = getIntersectionLeft(schema)\n const right = getIntersectionRight(schema)\n if (left !== undefined)\n walkForMeta(left, path, map, counters, lastPathPerSchema, inProgress)\n if (right !== undefined)\n walkForMeta(right, path, map, counters, lastPathPerSchema, inProgress)\n return\n }\n // Leaf kinds — no children to descend into; metadata for the\n // path itself was captured above. Listed explicitly so the\n // exhaustiveness check catches any new kind landing in Zod\n // without a corresponding decision here.\n case 'string':\n case 'number':\n case 'bigint':\n case 'boolean':\n case 'date':\n case 'enum':\n case 'literal':\n case 'null':\n case 'undefined':\n case 'any':\n case 'unknown':\n case 'nan':\n case 'void':\n case 'never':\n case 'promise':\n case 'custom':\n case 'template-literal':\n return\n }\n } finally {\n inProgress.delete(schema)\n }\n}\n\nfunction consumePayload(\n schema: z.ZodType,\n counters: Map<z.ZodType, number>\n): FieldMetaPayload | undefined {\n const list = getFieldMetaList(schema)\n if (list.length === 0) return undefined\n const idx = counters.get(schema) ?? 0\n // Clamp to last entry — schemas reused MORE times than they're\n // registered (e.g. an array element schema registered once,\n // visited per-index) all share the single registration.\n const payload = list[Math.min(idx, list.length - 1)]\n counters.set(schema, idx + 1)\n return payload\n}\n\n/**\n * Resolve the field metadata for the schema node at `path`. Reads\n * the `fieldMeta` registry on the resolved Zod schema and applies\n * the precedence rules in `getFieldMetaAtPath`'s docblock:\n *\n * - label: registry → humanize(lastSegment)\n * - description: registry → schema.description (.describe()) → undefined\n * - placeholder: registry → undefined\n * - meta: registry payload (frozen) — empty object when absent\n *\n * Returns the empty resolution when the path doesn't resolve in the\n * schema. DU branches: first candidate wins (matches the existing\n * first-success precedent in `getDefaultAtPath` / `validateAtPath`).\n *\n * For shared schemas registered at multiple paths (the canonical\n * `addressSchema.register(fieldMeta, A); addressSchema.register(fieldMeta, B)`\n * footgun), the path-resolver builds a per-rootSchema path → payload\n * map by walking the schema tree once, counting per-schema\n * occurrences and pairing them with the registration list in\n * declaration order. Object literals evaluate left-to-right, so\n * registration order matches tree-walk order, and the mapping pairs\n * correctly.\n */\nfunction resolveFieldMetaAtPath(rootSchema: z.ZodType, path: Path): ResolvedFieldMeta {\n const lastSegment = path.length === 0 ? '' : (path[path.length - 1] as string | number)\n const candidates = path.length === 0 ? [rootSchema] : getNestedZodSchemasAtPath(rootSchema, path)\n const target = candidates[0]\n if (target === undefined) {\n return {\n label: humanize(lastSegment),\n description: undefined,\n placeholder: undefined,\n meta: Object.freeze({}),\n }\n }\n // Path-keyed payload map (built once per rootSchema) disambiguates\n // shared schemas. Falls back to the schema-keyed registry for paths\n // not visited by the walker (e.g. dynamic discriminated-union\n // sub-paths the walker can't statically enumerate).\n const pathMap = getPathMetaMap(rootSchema)\n const pathKey = canonicalizePath(path).key\n const peeled = peelAllWrappers(target)\n const payload =\n pathMap.get(pathKey) ??\n getFieldMeta(target) ??\n (peeled !== target ? getFieldMeta(peeled) : undefined)\n // `description` is exposed as a public property on Zod 4 schemas;\n // when set via `.describe('...')` or `.meta({ description })`, it\n // reads back as a string. Read from the target first; fall back to\n // the peeled inner so a `.describe()` on `z.string()` is still\n // visible when wrapped in `.optional()`.\n const targetDescription = readDescription(target)\n const peeledDescription = peeled !== target ? readDescription(peeled) : undefined\n const schemaDescription = targetDescription ?? peeledDescription\n return {\n label: payload?.label ?? humanize(lastSegment),\n description: payload?.description ?? schemaDescription ?? undefined,\n placeholder: payload?.placeholder ?? undefined,\n meta: Object.freeze({ ...(payload ?? {}) }),\n }\n}\n\nfunction readDescription(schema: z.ZodType): string | undefined {\n const candidate = (schema as z.ZodType & { description?: unknown }).description\n return typeof candidate === 'string' ? candidate : undefined\n}\n\n// Type-only re-export so downstream code can reference the Form shape.\nexport type { DeepPartial, GenericForm }\n","/**\n * Zod v4 adapter entry point. Re-exports the adapter + the useForm\n * wrapper that threads zod-v4-specific schema types through\n * useAbstractForm.\n */\nimport type { z } from 'zod'\nimport { useAbstractForm } from '../../composables/use-abstract-form'\nimport { InvalidUseFormConfigError } from '../../core/errors'\nimport type {\n AbstractSchema,\n FormKey,\n ValidateOnConfig,\n UseFormReturnType,\n UseFormConfiguration,\n} from '../../types/types-api'\nimport type { DeepPartial, DefaultValuesShape, GenericForm } from '../../types/types-core'\nimport { zodV4Adapter } from './adapter'\n\nexport { zodV4Adapter as zodAdapter } from './adapter'\nexport { UnsupportedSchemaError } from './errors'\nexport { assertZodVersion, kindOf } from './introspect'\nexport type { ZodKind } from './introspect'\n\n/**\n * Create a form bound to a Zod v4 schema.\n *\n * ```ts\n * import { useForm } from 'attaform/zod'\n * import { z } from 'zod'\n *\n * const form = useForm({\n * schema: z.object({\n * email: z.email(),\n * password: z.string().min(8),\n * }),\n * defaultValues: { email: '' },\n * })\n * ```\n *\n * Returns a form API exposing `register`, `values`, `errors`,\n * `fields`, `setValue`, `handleSubmit`, `meta`, field-array\n * helpers, and more. See `UseFormReturnType` for the full\n * surface.\n *\n * For Zod v3, import from `attaform/zod-v3` instead.\n */\nexport function useForm<Schema extends z.ZodObject>(\n configuration: Omit<\n UseFormConfiguration<\n z.output<Schema> extends GenericForm ? z.output<Schema> : never,\n z.output<Schema> extends GenericForm ? z.output<Schema> : never,\n AbstractSchema<\n z.output<Schema> extends GenericForm ? z.output<Schema> : never,\n z.output<Schema> extends GenericForm ? z.output<Schema> : never\n >,\n DeepPartial<\n DefaultValuesShape<z.output<Schema> extends GenericForm ? z.output<Schema> : never>\n >\n >,\n 'schema' | 'validateOn' | 'debounceMs'\n > & { schema: Schema } & ValidateOnConfig\n): UseFormReturnType<\n z.output<Schema> extends GenericForm ? z.output<Schema> : never,\n z.output<Schema> extends GenericForm ? z.output<Schema> : never\n> {\n // Foot-gun guard: catches `useForm(z.object({...}))` (raw schema as\n // the first arg — its `.schema` field is undefined), `useForm()` (no\n // args), and `useForm({ schema: undefined })` before they reach the\n // adapter and crash deep with an opaque message. JS callers and\n // `as any` callers can defy the static signature; the `unknown`\n // cast forces the runtime checks to stay live under tsc.\n const candidate = configuration as unknown\n if (\n candidate === undefined ||\n candidate === null ||\n (candidate as { schema?: unknown }).schema === undefined\n ) {\n throw new InvalidUseFormConfigError()\n }\n type Form = z.output<Schema> extends GenericForm ? z.output<Schema> : never\n // `zodV4Adapter` returns a factory `(formKey: FormKey) => AbstractSchema`;\n // `UseFormConfiguration.schema` accepts `Schema | ((key) => Schema)`, so\n // the factory is a first-class input — previously the call site cast it\n // through `unknown as AbstractSchema`, which converted a function to an\n // object type and hid the mismatch. The narrower cast below preserves\n // the factory shape at the boundary.\n const adapter: (key: FormKey) => AbstractSchema<Form, Form> = zodV4Adapter(\n configuration.schema\n ) as (key: FormKey) => AbstractSchema<Form, Form>\n // The discriminated `ValidateOnConfig` doesn't narrow cleanly through\n // `Omit` + spread — TS picks the wrong variant after the structural\n // rebuild. The runtime input is genuinely the right shape (the\n // public `useForm` signature already enforced the discriminant on\n // `configuration` before we got here), so cast to the parameter\n // type to side-step the structural disagreement.\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n return useAbstractForm<Form, Form>({\n ...configuration,\n schema: adapter,\n } as Parameters<typeof useAbstractForm<Form, Form>>[0])\n}\n"],"names":["PATH_SEPARATOR"],"mappings":";;;;;;AAoFO,MAAM,SAAA,GAAY;AAWlB,SAAS,iBAAiB,MAAA,EAAgD;AAC/E,EAAA,OAAO,0BAA0B,MAAgB,CAAA;AACnD;A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,iBAAA,GAAoB,gBAAgB,MAAM,CAAA;AAChD,EAAA,MAAM,iBAAA,GAAoB,MAAA,KAAW,MAAA,GAAS,eAAA,CAAgB,MAAM,CAAA,GAAI,MAAA;AACxE,EAAA,MAAM,oBAAoB,iBAAA,IAAqB,iBAAA;AAC/C,EAAA,OAAO;AAAA,IACL,KAAA,EAAO,OAAA,EAAS,KAAA,IAAS,QAAA,CAAS,WAAW,CAAA;AAAA,IAC7C,WAAA,EAAa,OAAA,EAAS,WAAA,IAAe,iBAAA,IAAqB,MAAA;AAAA,IAC1D,WAAA,EAAa,SAAS,WAAA,IAAe,MAAA;AAAA,IACrC,IAAA,EAAM,OAAO,MAAA,CAAO,EAAE,GAAI,OAAA,IAAW,IAAK;AAAA,GAC5C;AACF;AAEA,SAAS,gBAAgB,MAAA,EAAuC;AAC9D,EAAA,MAAM,YAAa,MAAA,CAAiD,WAAA;AACpE,EAAA,OAAO,OAAO,SAAA,KAAc,QAAA,GAAW,SAAA,GAAY,MAAA;AACrD;;ACj0BO,SAAS,QACd,aAAA,EAiBA;AAOA,EAAA,MAAM,SAAA,GAAY,aAAA;AAClB,EAAA,IACE,cAAc,MAAA,IACd,SAAA,KAAc,IAAA,IACb,SAAA,CAAmC,WAAW,MAAA,EAC/C;AACA,IAAA,MAAM,IAAI,yBAAA,EAA0B;AAAA,EACtC;AAQA,EAAA,MAAM,OAAA,GAAwD,YAAA;AAAA,IAC5D,aAAA,CAAc;AAAA,GAChB;AAQA,EAAA,OAAO,eAAA,CAA4B;AAAA,IACjC,GAAG,aAAA;AAAA,IACH,MAAA,EAAQ;AAAA,GAC4C,CAAA;AACxD;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const useFormContext = require('./attaform.
|
|
3
|
+
const useFormContext = require('./attaform.fegmBJaq.cjs');
|
|
4
4
|
const plugin = require('./attaform.rIRYSUI1.cjs');
|
|
5
5
|
const fieldMetaStore = require('./attaform.C8CyvYa_.cjs');
|
|
6
|
-
const paths = require('./attaform.
|
|
6
|
+
const paths = require('./attaform.CIwZtbGV.cjs');
|
|
7
7
|
const zod = require('zod');
|
|
8
8
|
|
|
9
9
|
const fieldMeta = fieldMetaStore.fieldMetaStore;
|
|
@@ -37,6 +37,10 @@ function zodIssuesToValidationErrors(issues, formKey) {
|
|
|
37
37
|
}
|
|
38
38
|
return {
|
|
39
39
|
message: issue.message,
|
|
40
|
+
// Adapter-side paths stay schema-relative — the validation
|
|
41
|
+
// pipeline in `create-form-store.ts` prepends the parent path
|
|
42
|
+
// to absolutise, then routes form-level (absolute path length 0)
|
|
43
|
+
// entries to the empty-string bucket at storage time.
|
|
40
44
|
path: issue.path.map((seg) => typeof seg === "number" ? seg : String(seg)),
|
|
41
45
|
formKey,
|
|
42
46
|
code
|
|
@@ -1906,4 +1910,4 @@ exports.kindOf = kindOf;
|
|
|
1906
1910
|
exports.useForm = useForm;
|
|
1907
1911
|
exports.withMeta = withMeta;
|
|
1908
1912
|
exports.zodV4Adapter = zodV4Adapter;
|
|
1909
|
-
//# sourceMappingURL=attaform.
|
|
1913
|
+
//# sourceMappingURL=attaform.keLBaHB6.cjs.map
|