attaform 0.20.2 → 0.21.1
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/dev-key-collision-warnings.cjs +58 -0
- package/dist/chunks/dev-key-collision-warnings.cjs.map +1 -0
- package/dist/chunks/dev-key-collision-warnings.mjs +55 -0
- package/dist/chunks/dev-key-collision-warnings.mjs.map +1 -0
- package/dist/chunks/devtools.cjs +1 -1
- package/dist/chunks/devtools.mjs +1 -1
- package/dist/chunks/fingerprint.cjs +186 -0
- package/dist/chunks/fingerprint.cjs.map +1 -0
- package/dist/chunks/fingerprint.mjs +184 -0
- package/dist/chunks/fingerprint.mjs.map +1 -0
- package/dist/chunks/fingerprint2.cjs +162 -0
- package/dist/chunks/fingerprint2.cjs.map +1 -0
- package/dist/chunks/fingerprint2.mjs +160 -0
- package/dist/chunks/fingerprint2.mjs.map +1 -0
- package/dist/chunks/indexeddb.cjs +1 -1
- package/dist/chunks/indexeddb.mjs +1 -1
- package/dist/chunks/local-storage.cjs +1 -1
- package/dist/chunks/local-storage.mjs +1 -1
- package/dist/chunks/multi-tab-sync.cjs +367 -0
- package/dist/chunks/multi-tab-sync.cjs.map +1 -0
- package/dist/chunks/multi-tab-sync.mjs +364 -0
- package/dist/chunks/multi-tab-sync.mjs.map +1 -0
- package/dist/chunks/session-storage.cjs +1 -1
- package/dist/chunks/session-storage.mjs +1 -1
- package/dist/chunks/wire-persistence.cjs +396 -0
- package/dist/chunks/wire-persistence.cjs.map +1 -0
- package/dist/chunks/wire-persistence.mjs +394 -0
- package/dist/chunks/wire-persistence.mjs.map +1 -0
- package/dist/esbuild.cjs +28 -0
- package/dist/esbuild.cjs.map +1 -0
- package/dist/esbuild.d.cts +56 -0
- package/dist/esbuild.d.mts +56 -0
- package/dist/esbuild.d.ts +56 -0
- package/dist/esbuild.mjs +26 -0
- package/dist/esbuild.mjs.map +1 -0
- package/dist/index.cjs +5 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +66 -70
- package/dist/index.d.mts +66 -70
- package/dist/index.d.ts +66 -70
- package/dist/index.mjs +5 -5
- package/dist/nuxt.d.cts +1 -1
- package/dist/nuxt.d.mts +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/rollup.cjs +24 -0
- package/dist/rollup.cjs.map +1 -0
- package/dist/rollup.d.cts +35 -0
- package/dist/rollup.d.mts +35 -0
- package/dist/rollup.d.ts +35 -0
- package/dist/rollup.mjs +22 -0
- package/dist/rollup.mjs.map +1 -0
- package/dist/rspack.cjs +10 -0
- package/dist/rspack.cjs.map +1 -0
- package/dist/rspack.d.cts +40 -0
- package/dist/rspack.d.mts +40 -0
- package/dist/rspack.d.ts +40 -0
- package/dist/rspack.mjs +8 -0
- package/dist/rspack.mjs.map +1 -0
- package/dist/runtime/plugins/attaform.cjs +2 -2
- package/dist/runtime/plugins/attaform.mjs +2 -2
- package/dist/shared/attaform.BJGA_UOS.mjs +37 -0
- package/dist/shared/attaform.BJGA_UOS.mjs.map +1 -0
- package/dist/shared/attaform.BRGIpZo4.cjs +26 -0
- package/dist/shared/attaform.BRGIpZo4.cjs.map +1 -0
- package/dist/shared/{attaform.DAKrGhxc.cjs → attaform.BSkvn43g.cjs} +101 -417
- package/dist/shared/attaform.BSkvn43g.cjs.map +1 -0
- package/dist/shared/{attaform.sWm8B15V.d.mts → attaform.BWfliRIK.d.cts} +172 -2
- package/dist/shared/{attaform.BGk8cfw2.mjs → attaform.Be8NZG9M.mjs} +178 -21
- package/dist/shared/attaform.Be8NZG9M.mjs.map +1 -0
- package/dist/shared/{attaform.D2SCCd4O.cjs → attaform.Bq5sX7TF.cjs} +2 -2
- package/dist/shared/{attaform.D2SCCd4O.cjs.map → attaform.Bq5sX7TF.cjs.map} +1 -1
- package/dist/shared/{attaform.ceGEAEMk.d.ts → attaform.Bv7dRDWK.d.ts} +172 -2
- package/dist/shared/attaform.C3Doa9Pt.mjs +24 -0
- package/dist/shared/attaform.C3Doa9Pt.mjs.map +1 -0
- package/dist/shared/{attaform.B_hph5AE.cjs → attaform.CICFZ1iS.cjs} +178 -20
- package/dist/shared/attaform.CICFZ1iS.cjs.map +1 -0
- package/dist/shared/attaform.CQN9R62B.cjs +39 -0
- package/dist/shared/attaform.CQN9R62B.cjs.map +1 -0
- package/dist/shared/{attaform.CwLjUqmQ.cjs → attaform.ClXwitZj.cjs} +735 -960
- package/dist/shared/attaform.ClXwitZj.cjs.map +1 -0
- package/dist/shared/{attaform.99cfHcIt.d.cts → attaform.D0dWZsJt.d.cts} +349 -77
- package/dist/shared/{attaform.99cfHcIt.d.mts → attaform.D0dWZsJt.d.mts} +349 -77
- package/dist/shared/{attaform.99cfHcIt.d.ts → attaform.D0dWZsJt.d.ts} +349 -77
- package/dist/shared/{attaform.z5j3LwJz.cjs → attaform.D32WwKk6.cjs} +216 -35
- package/dist/shared/attaform.D32WwKk6.cjs.map +1 -0
- package/dist/shared/{attaform.C5aYC_T8.mjs → attaform.DMEP_ENr.mjs} +39 -392
- package/dist/shared/attaform.DMEP_ENr.mjs.map +1 -0
- package/dist/shared/{attaform.tiWEVznj.mjs → attaform.DR6RmxWZ.mjs} +725 -962
- package/dist/shared/attaform.DR6RmxWZ.mjs.map +1 -0
- package/dist/shared/{attaform.Dt7dEcHk.mjs → attaform.DozgVlCE.mjs} +89 -405
- package/dist/shared/attaform.DozgVlCE.mjs.map +1 -0
- package/dist/shared/{attaform.DN5CvZrg.d.ts → attaform.Duecg2NO.d.mts} +2 -2
- package/dist/shared/attaform.DuzQYscR.d.cts +41 -0
- package/dist/shared/attaform.DuzQYscR.d.mts +41 -0
- package/dist/shared/attaform.DuzQYscR.d.ts +41 -0
- package/dist/shared/{attaform.BXinSW2T.d.mts → attaform.FudOcHaa.d.cts} +2 -2
- package/dist/shared/attaform.LEWUFqUw.cjs +54 -0
- package/dist/shared/attaform.LEWUFqUw.cjs.map +1 -0
- package/dist/shared/{attaform.CywE4y8x.d.cts → attaform.MtrpT6Ki.d.ts} +2 -2
- package/dist/shared/{attaform.DbRgDFa7.d.cts → attaform.NQ8mybyW.d.mts} +172 -2
- package/dist/shared/{attaform.Cd4AOfwu.cjs → attaform.S-pYLSo4.cjs} +68 -402
- package/dist/shared/attaform.S-pYLSo4.cjs.map +1 -0
- package/dist/shared/{attaform.CnrxbkB6.mjs → attaform.Y1ZGhM4k.mjs} +2 -2
- package/dist/shared/{attaform.CnrxbkB6.mjs.map → attaform.Y1ZGhM4k.mjs.map} +1 -1
- package/dist/shared/{attaform.QG5TG8lB.mjs → attaform.pmtahXKy.mjs} +216 -36
- package/dist/shared/attaform.pmtahXKy.mjs.map +1 -0
- package/dist/shared/attaform.sHkHv_98.mjs +51 -0
- package/dist/shared/attaform.sHkHv_98.mjs.map +1 -0
- package/dist/vite.cjs +9 -45
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.cts +36 -0
- package/dist/vite.d.mts +36 -0
- package/dist/vite.d.ts +36 -0
- package/dist/vite.mjs +8 -44
- package/dist/vite.mjs.map +1 -1
- package/dist/webpack.cjs +10 -0
- package/dist/webpack.cjs.map +1 -0
- package/dist/webpack.d.cts +37 -0
- package/dist/webpack.d.mts +37 -0
- package/dist/webpack.d.ts +37 -0
- package/dist/webpack.mjs +8 -0
- package/dist/webpack.mjs.map +1 -0
- package/dist/zod-v3.cjs +3 -3
- 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 +3 -3
- package/dist/zod-v4.cjs +3 -3
- package/dist/zod-v4.d.cts +4 -4
- package/dist/zod-v4.d.mts +4 -4
- package/dist/zod-v4.d.ts +4 -4
- package/dist/zod-v4.mjs +3 -3
- package/dist/zod.cjs +8 -8
- package/dist/zod.cjs.map +1 -1
- package/dist/zod.d.cts +52 -10
- package/dist/zod.d.mts +52 -10
- package/dist/zod.d.ts +52 -10
- package/dist/zod.mjs +6 -6
- package/dist/zod.mjs.map +1 -1
- package/package.json +19 -5
- package/dist/shared/attaform.BGk8cfw2.mjs.map +0 -1
- package/dist/shared/attaform.B_hph5AE.cjs.map +0 -1
- package/dist/shared/attaform.C5aYC_T8.mjs.map +0 -1
- package/dist/shared/attaform.Cd4AOfwu.cjs.map +0 -1
- package/dist/shared/attaform.CwLjUqmQ.cjs.map +0 -1
- package/dist/shared/attaform.DAKrGhxc.cjs.map +0 -1
- package/dist/shared/attaform.Dt7dEcHk.mjs.map +0 -1
- package/dist/shared/attaform.QG5TG8lB.mjs.map +0 -1
- package/dist/shared/attaform.tiWEVznj.mjs.map +0 -1
- package/dist/shared/attaform.z5j3LwJz.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as AttaformError, _ as __DEV__, j as canonicalizePath, d as InvalidUseFormConfigError } from './attaform.
|
|
3
|
-
import { f as fieldMetaStore, g as getFieldMetaForSchema, a as getFieldMetaListForSchema, s as slimPrimitivesWalk, w as walkPathSegments, d as deriveDefaultWalk, m as mergeDeep, c as createAbstractSchema } from './attaform.
|
|
1
|
+
import { i as getAtPath, x as slimKindOf, w as setAtPath, j as humanize, B as useAbstractForm } from './attaform.DR6RmxWZ.mjs';
|
|
2
|
+
import { a as AttaformError, _ as __DEV__, j as canonicalizePath, d as InvalidUseFormConfigError } from './attaform.pmtahXKy.mjs';
|
|
3
|
+
import { f as fieldMetaStore, g as getFieldMetaForSchema, a as getFieldMetaListForSchema, s as slimPrimitivesWalk, w as walkPathSegments, d as deriveDefaultWalk, m as mergeDeep, c as createAbstractSchema, b as getFieldMetaPathMap } from './attaform.Be8NZG9M.mjs';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
|
6
6
|
const fieldMeta = fieldMetaStore;
|
|
@@ -514,207 +514,18 @@ function getDiscriminatedUnionFirstOption(schema) {
|
|
|
514
514
|
return options[0];
|
|
515
515
|
}
|
|
516
516
|
|
|
517
|
-
const cyclicSentinel = "<cyclic>";
|
|
518
|
-
function fingerprintZodSchema(schema) {
|
|
519
|
-
const cache = /* @__PURE__ */ new WeakMap();
|
|
520
|
-
const inProgress = /* @__PURE__ */ new WeakSet();
|
|
521
|
-
return visit(schema, cache, inProgress);
|
|
522
|
-
}
|
|
523
|
-
function visit(schema, cache, inProgress) {
|
|
524
|
-
const cached = cache.get(schema);
|
|
525
|
-
if (cached !== void 0) return cached;
|
|
526
|
-
if (inProgress.has(schema)) return cyclicSentinel;
|
|
527
|
-
inProgress.add(schema);
|
|
528
|
-
try {
|
|
529
|
-
const computed = computeFingerprint(schema, cache, inProgress);
|
|
530
|
-
cache.set(schema, computed);
|
|
531
|
-
return computed;
|
|
532
|
-
} finally {
|
|
533
|
-
inProgress.delete(schema);
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
function computeFingerprint(schema, cache, inProgress) {
|
|
537
|
-
const kind = kindOf(schema);
|
|
538
|
-
const recurse = (child) => visit(child, cache, inProgress);
|
|
539
|
-
switch (kind) {
|
|
540
|
-
// Kind-only leaves: no further structure to descend into.
|
|
541
|
-
case "boolean":
|
|
542
|
-
case "null":
|
|
543
|
-
case "undefined":
|
|
544
|
-
case "any":
|
|
545
|
-
case "unknown":
|
|
546
|
-
case "nan":
|
|
547
|
-
case "void":
|
|
548
|
-
case "never":
|
|
549
|
-
return kind;
|
|
550
|
-
// Leaves with checks (min/max/email/regex/...). Checks are
|
|
551
|
-
// canonicalised and sorted so `.min(3).max(10)` and `.max(10).min(3)`
|
|
552
|
-
// produce identical fingerprints.
|
|
553
|
-
case "string":
|
|
554
|
-
case "number":
|
|
555
|
-
case "bigint":
|
|
556
|
-
case "date":
|
|
557
|
-
return `${kind}${formatChecks(schema)}`;
|
|
558
|
-
case "literal": {
|
|
559
|
-
const values = [...getLiteralValues(schema)].sort((a, b) => {
|
|
560
|
-
const as = canonicalStringify(a);
|
|
561
|
-
const bs = canonicalStringify(b);
|
|
562
|
-
return as < bs ? -1 : as > bs ? 1 : 0;
|
|
563
|
-
});
|
|
564
|
-
return `literal:${canonicalStringify(values)}`;
|
|
565
|
-
}
|
|
566
|
-
case "enum":
|
|
567
|
-
return `enum:${canonicalStringify([...getEnumValues(schema)].sort((a, b) => compare(a, b)))}`;
|
|
568
|
-
case "object": {
|
|
569
|
-
const shape = getObjectShape(schema);
|
|
570
|
-
const sortedEntries = Object.entries(shape).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([k, v]) => `${JSON.stringify(k)}:${recurse(v)}`);
|
|
571
|
-
return `object{${sortedEntries.join(",")}}${formatChecks(schema)}`;
|
|
572
|
-
}
|
|
573
|
-
case "array":
|
|
574
|
-
return `array[${recurse(getArrayElement(schema))}]${formatChecks(schema)}`;
|
|
575
|
-
case "set":
|
|
576
|
-
return `set<${recurse(getSetValueType(schema))}>${formatChecks(schema)}`;
|
|
577
|
-
case "tuple":
|
|
578
|
-
return `tuple[${getTupleItems(schema).map(recurse).join(",")}]`;
|
|
579
|
-
case "record":
|
|
580
|
-
return `record<${recurse(getRecordKeyType(schema))},${recurse(getRecordValueType(schema))}>`;
|
|
581
|
-
case "union": {
|
|
582
|
-
const options = getUnionOptions(schema).map(recurse).sort();
|
|
583
|
-
return `union(${options.join("|")})`;
|
|
584
|
-
}
|
|
585
|
-
case "discriminated-union": {
|
|
586
|
-
const disc = getDiscriminator(schema) ?? "?";
|
|
587
|
-
const options = getDiscriminatedOptions(schema).map(recurse).sort();
|
|
588
|
-
return `dunion[${JSON.stringify(disc)}](${options.join("|")})`;
|
|
589
|
-
}
|
|
590
|
-
case "optional": {
|
|
591
|
-
const inner = unwrapInner(schema);
|
|
592
|
-
return inner === void 0 ? "optional(?)" : `optional(${recurse(inner)})`;
|
|
593
|
-
}
|
|
594
|
-
case "nullable": {
|
|
595
|
-
const inner = unwrapInner(schema);
|
|
596
|
-
return inner === void 0 ? "nullable(?)" : `nullable(${recurse(inner)})`;
|
|
597
|
-
}
|
|
598
|
-
case "default": {
|
|
599
|
-
const inner = unwrapInner(schema);
|
|
600
|
-
return `default[${stableValueRepr(getDefaultValue, schema)}](${inner === void 0 ? "?" : recurse(inner)})`;
|
|
601
|
-
}
|
|
602
|
-
case "readonly": {
|
|
603
|
-
const inner = unwrapInner(schema);
|
|
604
|
-
return inner === void 0 ? "readonly(?)" : `readonly(${recurse(inner)})`;
|
|
605
|
-
}
|
|
606
|
-
case "pipe": {
|
|
607
|
-
const inner = unwrapPipe(schema);
|
|
608
|
-
return inner === void 0 ? "pipe(?)" : `pipe(${recurse(inner)})`;
|
|
609
|
-
}
|
|
610
|
-
case "catch": {
|
|
611
|
-
const inner = unwrapInner(schema);
|
|
612
|
-
return `catch[${stableValueRepr(getCatchDefault, schema)}](${inner === void 0 ? "?" : recurse(inner)})`;
|
|
613
|
-
}
|
|
614
|
-
case "lazy": {
|
|
615
|
-
const inner = unwrapLazy(schema);
|
|
616
|
-
return inner === void 0 ? "lazy(?)" : `lazy(${recurse(inner)})`;
|
|
617
|
-
}
|
|
618
|
-
case "intersection": {
|
|
619
|
-
const left = getIntersectionLeft(schema);
|
|
620
|
-
const right = getIntersectionRight(schema);
|
|
621
|
-
const leftFp = left === void 0 ? "?" : recurse(left);
|
|
622
|
-
const rightFp = right === void 0 ? "?" : recurse(right);
|
|
623
|
-
const parts = [leftFp, rightFp].sort();
|
|
624
|
-
return `intersection(${parts.join("&")})`;
|
|
625
|
-
}
|
|
626
|
-
// Structural shape isn't observable for these. Bucket them into
|
|
627
|
-
// kind-only fingerprints — a schema-mismatch warning can't do
|
|
628
|
-
// better than "both are `custom`" here, but that still catches
|
|
629
|
-
// `object` vs `custom` mismatches. `map` / `symbol` / `function`
|
|
630
|
-
// are rejected at adapter construction; kept here for exhaustive
|
|
631
|
-
// switch safety when `fingerprintSchema` is called from tooling.
|
|
632
|
-
case "promise":
|
|
633
|
-
case "custom":
|
|
634
|
-
case "template-literal":
|
|
635
|
-
case "transform":
|
|
636
|
-
case "file":
|
|
637
|
-
case "map":
|
|
638
|
-
case "symbol":
|
|
639
|
-
case "function":
|
|
640
|
-
return `${kind}:*`;
|
|
641
|
-
default: {
|
|
642
|
-
const _ = kind;
|
|
643
|
-
return `unknown:${String(_)}`;
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
function stableValueRepr(get, schema) {
|
|
648
|
-
const first = get(schema);
|
|
649
|
-
const second = get(schema);
|
|
650
|
-
if (!Object.is(first, second) || typeof first === "function") return "fn:*";
|
|
651
|
-
return canonicalStringify(first);
|
|
652
|
-
}
|
|
653
|
-
function formatChecks(schema) {
|
|
654
|
-
const checks = getChecks(schema);
|
|
655
|
-
if (checks.length === 0) return "";
|
|
656
|
-
const parts = checks.map((c) => serializeCheck(c)).sort();
|
|
657
|
-
return `[${parts.join(";")}]`;
|
|
658
|
-
}
|
|
659
|
-
function serializeCheck(check) {
|
|
660
|
-
if (check !== null && typeof check === "object") {
|
|
661
|
-
const def = check._zod?.def;
|
|
662
|
-
if (def !== void 0) return canonicalStringify(def);
|
|
663
|
-
}
|
|
664
|
-
return canonicalStringify(check);
|
|
665
|
-
}
|
|
666
|
-
function canonicalStringify(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
667
|
-
if (value === null) return "null";
|
|
668
|
-
if (value === void 0) return "undefined";
|
|
669
|
-
const t = typeof value;
|
|
670
|
-
if (t === "string") return JSON.stringify(value);
|
|
671
|
-
if (t === "number" || t === "boolean") return String(value);
|
|
672
|
-
if (t === "bigint") return `${String(value)}n`;
|
|
673
|
-
if (t === "function") return "fn:*";
|
|
674
|
-
if (t === "symbol") return "symbol:*";
|
|
675
|
-
if (Array.isArray(value)) {
|
|
676
|
-
if (seen.has(value)) return "<cyclic>";
|
|
677
|
-
seen.add(value);
|
|
678
|
-
try {
|
|
679
|
-
const parts = value.map((v) => canonicalStringify(v, seen));
|
|
680
|
-
return `[${parts.join(",")}]`;
|
|
681
|
-
} finally {
|
|
682
|
-
seen.delete(value);
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
if (t === "object") {
|
|
686
|
-
const obj = value;
|
|
687
|
-
if (seen.has(obj)) return "<cyclic>";
|
|
688
|
-
seen.add(obj);
|
|
689
|
-
try {
|
|
690
|
-
if (value instanceof Date) return `date:${value.getTime()}`;
|
|
691
|
-
if (value instanceof RegExp) return `regex:${String(value)}`;
|
|
692
|
-
const entries = Object.entries(obj).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([k, v]) => `${JSON.stringify(k)}:${canonicalStringify(v, seen)}`);
|
|
693
|
-
return `{${entries.join(",")}}`;
|
|
694
|
-
} finally {
|
|
695
|
-
seen.delete(obj);
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
return "unknown";
|
|
699
|
-
}
|
|
700
|
-
function compare(a, b) {
|
|
701
|
-
const as = String(a);
|
|
702
|
-
const bs = String(b);
|
|
703
|
-
return as < bs ? -1 : as > bs ? 1 : 0;
|
|
704
|
-
}
|
|
705
|
-
|
|
706
517
|
const V4_INTROSPECTOR = {
|
|
707
518
|
kindOf: (schema) => kindOf(schema),
|
|
708
519
|
getObjectShape: (schema) => getObjectShape(schema),
|
|
709
|
-
getTupleItems
|
|
520
|
+
getTupleItems,
|
|
710
521
|
getDiscriminatedOptions: (schema) => getDiscriminatedOptions(schema),
|
|
711
|
-
getDiscriminator
|
|
712
|
-
getLiteralValues
|
|
713
|
-
isPreprocessNode
|
|
714
|
-
isCoercePrimitive
|
|
715
|
-
containsAsyncRefine
|
|
716
|
-
containsAsyncTransform
|
|
717
|
-
hasContainerOrRootRefine
|
|
522
|
+
getDiscriminator,
|
|
523
|
+
getLiteralValues,
|
|
524
|
+
isPreprocessNode,
|
|
525
|
+
isCoercePrimitive,
|
|
526
|
+
containsAsyncRefine,
|
|
527
|
+
containsAsyncTransform,
|
|
528
|
+
hasContainerOrRootRefine,
|
|
718
529
|
// Walker accessors (D2 / D3 / D5).
|
|
719
530
|
getArrayElement: (schema) => {
|
|
720
531
|
if (kindOf(schema) !== "array") return void 0;
|
|
@@ -723,21 +534,21 @@ const V4_INTROSPECTOR = {
|
|
|
723
534
|
getSetValueType: (schema) => kindOf(schema) === "set" ? getSetValueType(schema) : void 0,
|
|
724
535
|
getRecordKeyType: (schema) => kindOf(schema) === "record" ? getRecordKeyType(schema) : void 0,
|
|
725
536
|
getRecordValueType: (schema) => kindOf(schema) === "record" ? getRecordValueType(schema) : void 0,
|
|
726
|
-
getUnionOptions
|
|
727
|
-
getIntersectionLeft
|
|
728
|
-
getIntersectionRight
|
|
729
|
-
getEnumValues
|
|
730
|
-
getNativeEnumValues
|
|
731
|
-
unwrapInner
|
|
732
|
-
unwrapBranded
|
|
733
|
-
unwrapEffectsSource
|
|
734
|
-
unwrapPipeIn
|
|
735
|
-
unwrapPipeOut
|
|
736
|
-
unwrapLazy
|
|
737
|
-
getLazyGetter
|
|
738
|
-
getDefaultValue
|
|
739
|
-
getCatchDefault
|
|
740
|
-
hasCatchValue
|
|
537
|
+
getUnionOptions,
|
|
538
|
+
getIntersectionLeft,
|
|
539
|
+
getIntersectionRight,
|
|
540
|
+
getEnumValues,
|
|
541
|
+
getNativeEnumValues,
|
|
542
|
+
unwrapInner,
|
|
543
|
+
unwrapBranded,
|
|
544
|
+
unwrapEffectsSource,
|
|
545
|
+
unwrapPipeIn,
|
|
546
|
+
unwrapPipeOut,
|
|
547
|
+
unwrapLazy,
|
|
548
|
+
getLazyGetter,
|
|
549
|
+
getDefaultValue,
|
|
550
|
+
getCatchDefault,
|
|
551
|
+
hasCatchValue
|
|
741
552
|
};
|
|
742
553
|
|
|
743
554
|
function slimPrimitivesOf(schema, maxRecursionDepth) {
|
|
@@ -1325,9 +1136,13 @@ function zodV4Adapter(rootSchema) {
|
|
|
1325
1136
|
options
|
|
1326
1137
|
);
|
|
1327
1138
|
}
|
|
1139
|
+
async function lazyFingerprint(schema) {
|
|
1140
|
+
const { fingerprintZodSchema } = await import('../chunks/fingerprint2.mjs');
|
|
1141
|
+
return fingerprintZodSchema(schema);
|
|
1142
|
+
}
|
|
1328
1143
|
function buildV4Services() {
|
|
1329
1144
|
return {
|
|
1330
|
-
fingerprint: (schema) =>
|
|
1145
|
+
fingerprint: (schema) => lazyFingerprint(schema),
|
|
1331
1146
|
getNestedSchemasAtPath: (schema, path, maxRecursionDepth) => getNestedZodSchemasAtPath(schema, path, maxRecursionDepth),
|
|
1332
1147
|
// v4 doesn't pre-strip for the slim-mode walk — its path walker
|
|
1333
1148
|
// already peels every transparent wrapper inline, so the slim and
|
|
@@ -1384,7 +1199,7 @@ function runStrictGetDefaultsV4(rootSchema, config, formKey, maxRecursionDepth)
|
|
|
1384
1199
|
}
|
|
1385
1200
|
function buildSubSchemaStubV4(schema, formKey, maxRecursionDepth) {
|
|
1386
1201
|
return {
|
|
1387
|
-
fingerprint: () =>
|
|
1202
|
+
fingerprint: () => lazyFingerprint(schema),
|
|
1388
1203
|
needsAsyncValidation: () => containsAsyncRefine(schema),
|
|
1389
1204
|
getDefaultValues: () => ({
|
|
1390
1205
|
data: deriveDefault(schema, true, maxRecursionDepth),
|
|
@@ -1412,178 +1227,6 @@ function buildSubSchemaStubV4(schema, formKey, maxRecursionDepth) {
|
|
|
1412
1227
|
}
|
|
1413
1228
|
};
|
|
1414
1229
|
}
|
|
1415
|
-
const pathMetaCache = /* @__PURE__ */ new WeakMap();
|
|
1416
|
-
function getPathMetaMap(rootSchema) {
|
|
1417
|
-
const cached = pathMetaCache.get(rootSchema);
|
|
1418
|
-
if (cached !== void 0) return cached;
|
|
1419
|
-
const map = /* @__PURE__ */ new Map();
|
|
1420
|
-
const counters = /* @__PURE__ */ new Map();
|
|
1421
|
-
const lastPathPerSchema = /* @__PURE__ */ new Map();
|
|
1422
|
-
const inProgress = /* @__PURE__ */ new WeakSet();
|
|
1423
|
-
walkForMeta(rootSchema, [], map, counters, lastPathPerSchema, inProgress);
|
|
1424
|
-
for (const [schema, lastPath] of lastPathPerSchema) {
|
|
1425
|
-
const list = getFieldMetaList(schema);
|
|
1426
|
-
const consumed = counters.get(schema) ?? 0;
|
|
1427
|
-
if (list.length <= consumed) continue;
|
|
1428
|
-
const surplus = list.slice(consumed).reduce((acc, p) => ({ ...acc, ...p }), {});
|
|
1429
|
-
const existing = map.get(lastPath) ?? {};
|
|
1430
|
-
map.set(lastPath, { ...existing, ...surplus });
|
|
1431
|
-
}
|
|
1432
|
-
pathMetaCache.set(rootSchema, map);
|
|
1433
|
-
return map;
|
|
1434
|
-
}
|
|
1435
|
-
function walkForMeta(schema, path, map, counters, lastPathPerSchema, inProgress) {
|
|
1436
|
-
if (inProgress.has(schema)) return;
|
|
1437
|
-
inProgress.add(schema);
|
|
1438
|
-
try {
|
|
1439
|
-
const pathKey = canonicalizePath(path).key;
|
|
1440
|
-
if (!map.has(pathKey)) {
|
|
1441
|
-
const payload = consumePayload(schema, counters);
|
|
1442
|
-
if (payload !== void 0) {
|
|
1443
|
-
map.set(pathKey, payload);
|
|
1444
|
-
lastPathPerSchema.set(schema, pathKey);
|
|
1445
|
-
}
|
|
1446
|
-
}
|
|
1447
|
-
const peeled = peelAllWrappers(schema);
|
|
1448
|
-
if (peeled !== schema && !map.has(pathKey)) {
|
|
1449
|
-
const payload = consumePayload(peeled, counters);
|
|
1450
|
-
if (payload !== void 0) {
|
|
1451
|
-
map.set(pathKey, payload);
|
|
1452
|
-
lastPathPerSchema.set(peeled, pathKey);
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
const kind = kindOf(schema);
|
|
1456
|
-
switch (kind) {
|
|
1457
|
-
case "object": {
|
|
1458
|
-
const shape = getObjectShape(schema);
|
|
1459
|
-
for (const [key, child] of Object.entries(shape)) {
|
|
1460
|
-
walkForMeta(child, [...path, key], map, counters, lastPathPerSchema, inProgress);
|
|
1461
|
-
}
|
|
1462
|
-
return;
|
|
1463
|
-
}
|
|
1464
|
-
case "array": {
|
|
1465
|
-
walkForMeta(
|
|
1466
|
-
getArrayElement(schema),
|
|
1467
|
-
[...path, 0],
|
|
1468
|
-
map,
|
|
1469
|
-
counters,
|
|
1470
|
-
lastPathPerSchema,
|
|
1471
|
-
inProgress
|
|
1472
|
-
);
|
|
1473
|
-
return;
|
|
1474
|
-
}
|
|
1475
|
-
case "tuple": {
|
|
1476
|
-
const items = getTupleItems(schema);
|
|
1477
|
-
for (let i = 0; i < items.length; i++) {
|
|
1478
|
-
const item = items[i];
|
|
1479
|
-
if (item !== void 0)
|
|
1480
|
-
walkForMeta(item, [...path, i], map, counters, lastPathPerSchema, inProgress);
|
|
1481
|
-
}
|
|
1482
|
-
return;
|
|
1483
|
-
}
|
|
1484
|
-
case "set":
|
|
1485
|
-
walkForMeta(
|
|
1486
|
-
getSetValueType(schema),
|
|
1487
|
-
[...path, 0],
|
|
1488
|
-
map,
|
|
1489
|
-
counters,
|
|
1490
|
-
lastPathPerSchema,
|
|
1491
|
-
inProgress
|
|
1492
|
-
);
|
|
1493
|
-
return;
|
|
1494
|
-
case "record":
|
|
1495
|
-
walkForMeta(
|
|
1496
|
-
getRecordValueType(schema),
|
|
1497
|
-
[...path, "*"],
|
|
1498
|
-
map,
|
|
1499
|
-
counters,
|
|
1500
|
-
lastPathPerSchema,
|
|
1501
|
-
inProgress
|
|
1502
|
-
);
|
|
1503
|
-
return;
|
|
1504
|
-
case "union": {
|
|
1505
|
-
for (const opt of getUnionOptions(schema)) {
|
|
1506
|
-
walkForMeta(opt, path, map, counters, lastPathPerSchema, inProgress);
|
|
1507
|
-
}
|
|
1508
|
-
return;
|
|
1509
|
-
}
|
|
1510
|
-
case "discriminated-union": {
|
|
1511
|
-
for (const opt of getDiscriminatedOptions(schema)) {
|
|
1512
|
-
walkForMeta(opt, path, map, counters, lastPathPerSchema, inProgress);
|
|
1513
|
-
}
|
|
1514
|
-
return;
|
|
1515
|
-
}
|
|
1516
|
-
case "optional":
|
|
1517
|
-
case "nullable":
|
|
1518
|
-
case "default":
|
|
1519
|
-
case "readonly":
|
|
1520
|
-
case "catch": {
|
|
1521
|
-
const inner = unwrapInner(schema);
|
|
1522
|
-
if (inner !== void 0)
|
|
1523
|
-
walkForMeta(inner, path, map, counters, lastPathPerSchema, inProgress);
|
|
1524
|
-
return;
|
|
1525
|
-
}
|
|
1526
|
-
case "pipe": {
|
|
1527
|
-
const inner = unwrapPipe(schema);
|
|
1528
|
-
if (inner !== void 0)
|
|
1529
|
-
walkForMeta(inner, path, map, counters, lastPathPerSchema, inProgress);
|
|
1530
|
-
return;
|
|
1531
|
-
}
|
|
1532
|
-
case "lazy": {
|
|
1533
|
-
const inner = unwrapLazy(schema);
|
|
1534
|
-
if (inner !== void 0)
|
|
1535
|
-
walkForMeta(inner, path, map, counters, lastPathPerSchema, inProgress);
|
|
1536
|
-
return;
|
|
1537
|
-
}
|
|
1538
|
-
case "intersection": {
|
|
1539
|
-
const left = getIntersectionLeft(schema);
|
|
1540
|
-
const right = getIntersectionRight(schema);
|
|
1541
|
-
if (left !== void 0)
|
|
1542
|
-
walkForMeta(left, path, map, counters, lastPathPerSchema, inProgress);
|
|
1543
|
-
if (right !== void 0)
|
|
1544
|
-
walkForMeta(right, path, map, counters, lastPathPerSchema, inProgress);
|
|
1545
|
-
return;
|
|
1546
|
-
}
|
|
1547
|
-
// Leaf kinds — no children to descend into; metadata for the
|
|
1548
|
-
// path itself was captured above. Listed explicitly so the
|
|
1549
|
-
// exhaustiveness check catches any new kind landing in Zod
|
|
1550
|
-
// without a corresponding decision here.
|
|
1551
|
-
case "string":
|
|
1552
|
-
case "number":
|
|
1553
|
-
case "bigint":
|
|
1554
|
-
case "boolean":
|
|
1555
|
-
case "date":
|
|
1556
|
-
case "enum":
|
|
1557
|
-
case "literal":
|
|
1558
|
-
case "null":
|
|
1559
|
-
case "undefined":
|
|
1560
|
-
case "any":
|
|
1561
|
-
case "unknown":
|
|
1562
|
-
case "nan":
|
|
1563
|
-
case "void":
|
|
1564
|
-
case "never":
|
|
1565
|
-
case "promise":
|
|
1566
|
-
case "custom":
|
|
1567
|
-
case "template-literal":
|
|
1568
|
-
case "transform":
|
|
1569
|
-
case "file":
|
|
1570
|
-
case "map":
|
|
1571
|
-
case "symbol":
|
|
1572
|
-
case "function":
|
|
1573
|
-
return;
|
|
1574
|
-
}
|
|
1575
|
-
} finally {
|
|
1576
|
-
inProgress.delete(schema);
|
|
1577
|
-
}
|
|
1578
|
-
}
|
|
1579
|
-
function consumePayload(schema, counters) {
|
|
1580
|
-
const list = getFieldMetaList(schema);
|
|
1581
|
-
if (list.length === 0) return void 0;
|
|
1582
|
-
const idx = counters.get(schema) ?? 0;
|
|
1583
|
-
const payload = list[Math.min(idx, list.length - 1)];
|
|
1584
|
-
counters.set(schema, idx + 1);
|
|
1585
|
-
return payload;
|
|
1586
|
-
}
|
|
1587
1230
|
function resolveFieldMetaAtPath(rootSchema, path, maxRecursionDepth) {
|
|
1588
1231
|
const lastSegment = path.length === 0 ? "" : path[path.length - 1];
|
|
1589
1232
|
const candidates = path.length === 0 ? [rootSchema] : getNestedZodSchemasAtPath(rootSchema, path, maxRecursionDepth);
|
|
@@ -1596,7 +1239,11 @@ function resolveFieldMetaAtPath(rootSchema, path, maxRecursionDepth) {
|
|
|
1596
1239
|
meta: Object.freeze({})
|
|
1597
1240
|
};
|
|
1598
1241
|
}
|
|
1599
|
-
const pathMap =
|
|
1242
|
+
const pathMap = getFieldMetaPathMap(rootSchema, {
|
|
1243
|
+
intro: V4_INTROSPECTOR,
|
|
1244
|
+
peelAllWrappers,
|
|
1245
|
+
getFieldMetaList
|
|
1246
|
+
});
|
|
1600
1247
|
const pathKey = canonicalizePath(path).key;
|
|
1601
1248
|
const peeled = peelAllWrappers(target);
|
|
1602
1249
|
const payload = pathMap.get(pathKey) ?? getFieldMeta(target) ?? (peeled !== target ? getFieldMeta(peeled) : void 0);
|
|
@@ -1627,5 +1274,5 @@ function useForm(configuration) {
|
|
|
1627
1274
|
});
|
|
1628
1275
|
}
|
|
1629
1276
|
|
|
1630
|
-
export { UnsupportedSchemaError as U, assertZodVersion as a, fieldMeta as f,
|
|
1631
|
-
//# sourceMappingURL=attaform.
|
|
1277
|
+
export { UnsupportedSchemaError as U, assertZodVersion as a, getCatchDefault as b, getChecks as c, getDefaultValue as d, getDiscriminatedOptions as e, fieldMeta as f, getArrayElement as g, getDiscriminator as h, getEnumValues as i, getIntersectionLeft as j, getIntersectionRight as k, getLiteralValues as l, getObjectShape as m, getRecordKeyType as n, getRecordValueType as o, getSetValueType as p, getTupleItems as q, getUnionOptions as r, kindOf as s, unwrapLazy as t, unwrapInner as u, unwrapPipe as v, useForm as w, withMeta as x, zodV4Adapter as z };
|
|
1278
|
+
//# sourceMappingURL=attaform.DMEP_ENr.mjs.map
|