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,24 +1,59 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const lodashEs = require('lodash-es');
|
|
4
3
|
const zod = require('zod');
|
|
5
|
-
const
|
|
6
|
-
const injectWizard = require('./attaform.
|
|
7
|
-
const paths = require('./attaform.
|
|
4
|
+
const walkFieldMeta = require('./attaform.CICFZ1iS.cjs');
|
|
5
|
+
const injectWizard = require('./attaform.ClXwitZj.cjs');
|
|
6
|
+
const paths = require('./attaform.D32WwKk6.cjs');
|
|
8
7
|
|
|
9
|
-
const fieldMeta =
|
|
8
|
+
const fieldMeta = walkFieldMeta.fieldMetaStore;
|
|
10
9
|
function withMeta(schema, payload) {
|
|
11
|
-
const existing =
|
|
10
|
+
const existing = walkFieldMeta.getFieldMetaForSchema(schema) ?? {};
|
|
12
11
|
const Ctor = schema.constructor;
|
|
13
12
|
const cloned = new Ctor(schema._def);
|
|
14
|
-
|
|
13
|
+
walkFieldMeta.fieldMetaStore.add(cloned, { ...existing, ...payload });
|
|
15
14
|
return cloned;
|
|
16
15
|
}
|
|
17
16
|
function getFieldMeta(schema) {
|
|
18
|
-
return
|
|
17
|
+
return walkFieldMeta.getFieldMetaForSchema(schema);
|
|
19
18
|
}
|
|
20
19
|
function getFieldMetaList(schema) {
|
|
21
|
-
return
|
|
20
|
+
return walkFieldMeta.getFieldMetaListForSchema(schema);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function cloneSchemaDeep(value) {
|
|
24
|
+
return clone(value, /* @__PURE__ */ new WeakMap());
|
|
25
|
+
}
|
|
26
|
+
function clone(value, seen) {
|
|
27
|
+
if (value === null || typeof value !== "object") return value;
|
|
28
|
+
if (seen.has(value)) return seen.get(value);
|
|
29
|
+
if (value instanceof RegExp) {
|
|
30
|
+
const copy2 = new RegExp(value.source, value.flags);
|
|
31
|
+
copy2.lastIndex = value.lastIndex;
|
|
32
|
+
seen.set(value, copy2);
|
|
33
|
+
return copy2;
|
|
34
|
+
}
|
|
35
|
+
if (value instanceof Date) {
|
|
36
|
+
const copy2 = new Date(value.getTime());
|
|
37
|
+
seen.set(value, copy2);
|
|
38
|
+
return copy2;
|
|
39
|
+
}
|
|
40
|
+
if (Array.isArray(value)) {
|
|
41
|
+
const copy2 = [];
|
|
42
|
+
seen.set(value, copy2);
|
|
43
|
+
for (let i = 0; i < value.length; i++) {
|
|
44
|
+
copy2[i] = clone(value[i], seen);
|
|
45
|
+
}
|
|
46
|
+
return copy2;
|
|
47
|
+
}
|
|
48
|
+
const copy = Object.create(Object.getPrototypeOf(value));
|
|
49
|
+
seen.set(value, copy);
|
|
50
|
+
const source = value;
|
|
51
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
52
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
53
|
+
if (descriptor?.enumerable !== true) continue;
|
|
54
|
+
copy[key] = clone(source[key], seen);
|
|
55
|
+
}
|
|
56
|
+
return copy;
|
|
22
57
|
}
|
|
23
58
|
|
|
24
59
|
class UnsupportedSchemaError extends paths.AttaformError {
|
|
@@ -201,10 +236,10 @@ function isAsyncEffect(schema) {
|
|
|
201
236
|
return fn.constructor.name === "AsyncFunction";
|
|
202
237
|
}
|
|
203
238
|
function containsAsyncRefine(schema, seen) {
|
|
204
|
-
return walkForAsync(schema, "refinement", /* @__PURE__ */ new WeakSet());
|
|
239
|
+
return walkForAsync(schema, "refinement", seen ?? /* @__PURE__ */ new WeakSet());
|
|
205
240
|
}
|
|
206
241
|
function containsAsyncTransform(schema, seen) {
|
|
207
|
-
return walkForAsync(schema, "transform-or-preprocess", /* @__PURE__ */ new WeakSet());
|
|
242
|
+
return walkForAsync(schema, "transform-or-preprocess", seen ?? /* @__PURE__ */ new WeakSet());
|
|
208
243
|
}
|
|
209
244
|
function walkForAsync(schema, target, visited) {
|
|
210
245
|
const candidate = schema;
|
|
@@ -527,258 +562,45 @@ function assertSupportedKinds(schema, path = [], lazyGetters = []) {
|
|
|
527
562
|
}
|
|
528
563
|
}
|
|
529
564
|
|
|
530
|
-
const cyclicSentinel = "<cyclic>";
|
|
531
|
-
function fingerprintZodSchema(schema) {
|
|
532
|
-
const cache = /* @__PURE__ */ new WeakMap();
|
|
533
|
-
const inProgress = /* @__PURE__ */ new WeakSet();
|
|
534
|
-
return visit(schema, cache, inProgress);
|
|
535
|
-
}
|
|
536
|
-
function visit(schema, cache, inProgress) {
|
|
537
|
-
const key = schema;
|
|
538
|
-
const cached = cache.get(key);
|
|
539
|
-
if (cached !== void 0) return cached;
|
|
540
|
-
if (inProgress.has(key)) return cyclicSentinel;
|
|
541
|
-
inProgress.add(key);
|
|
542
|
-
try {
|
|
543
|
-
const computed = computeFingerprint(schema, cache, inProgress);
|
|
544
|
-
cache.set(key, computed);
|
|
545
|
-
return computed;
|
|
546
|
-
} finally {
|
|
547
|
-
inProgress.delete(key);
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
function getDef(schema) {
|
|
551
|
-
return schema._def;
|
|
552
|
-
}
|
|
553
|
-
function computeFingerprint(schema, cache, inProgress) {
|
|
554
|
-
const def = getDef(schema);
|
|
555
|
-
const kind = def.typeName ?? "ZodUnknown";
|
|
556
|
-
const recurse = (child) => visit(child, cache, inProgress);
|
|
557
|
-
switch (kind) {
|
|
558
|
-
case "ZodString":
|
|
559
|
-
case "ZodNumber":
|
|
560
|
-
case "ZodBigInt":
|
|
561
|
-
case "ZodDate":
|
|
562
|
-
return `${kind}${formatChecks(def.checks)}`;
|
|
563
|
-
case "ZodBoolean":
|
|
564
|
-
case "ZodNull":
|
|
565
|
-
case "ZodUndefined":
|
|
566
|
-
case "ZodAny":
|
|
567
|
-
case "ZodUnknown":
|
|
568
|
-
case "ZodNaN":
|
|
569
|
-
case "ZodVoid":
|
|
570
|
-
case "ZodNever":
|
|
571
|
-
return kind;
|
|
572
|
-
case "ZodLiteral":
|
|
573
|
-
return `ZodLiteral:${canonicalStringify(def.value)}`;
|
|
574
|
-
case "ZodEnum": {
|
|
575
|
-
const values = Array.isArray(def.values) ? def.values : [];
|
|
576
|
-
const sorted = [...values].sort((a, b) => {
|
|
577
|
-
const as = String(a);
|
|
578
|
-
const bs = String(b);
|
|
579
|
-
return as < bs ? -1 : as > bs ? 1 : 0;
|
|
580
|
-
});
|
|
581
|
-
return `ZodEnum:${canonicalStringify(sorted)}`;
|
|
582
|
-
}
|
|
583
|
-
case "ZodNativeEnum": {
|
|
584
|
-
const values = def.values && typeof def.values === "object" && !Array.isArray(def.values) ? Object.values(def.values) : [];
|
|
585
|
-
const sorted = [...values].sort((a, b) => {
|
|
586
|
-
const as = String(a);
|
|
587
|
-
const bs = String(b);
|
|
588
|
-
return as < bs ? -1 : as > bs ? 1 : 0;
|
|
589
|
-
});
|
|
590
|
-
return `ZodNativeEnum:${canonicalStringify(sorted)}`;
|
|
591
|
-
}
|
|
592
|
-
case "ZodObject": {
|
|
593
|
-
const shape = readShapeSafely(def);
|
|
594
|
-
const sortedEntries = Object.entries(shape).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([k, v]) => `${JSON.stringify(k)}:${recurse(v)}`);
|
|
595
|
-
return `ZodObject{${sortedEntries.join(",")}}${formatChecks(def.checks)}`;
|
|
596
|
-
}
|
|
597
|
-
case "ZodArray":
|
|
598
|
-
return `ZodArray[${def.type === void 0 ? "?" : recurse(def.type)}]${formatChecks(def.checks)}`;
|
|
599
|
-
case "ZodTuple": {
|
|
600
|
-
const items = def.items ?? [];
|
|
601
|
-
return `ZodTuple[${items.map(recurse).join(",")}]`;
|
|
602
|
-
}
|
|
603
|
-
case "ZodRecord": {
|
|
604
|
-
const keyPart = def.keyType === void 0 ? "?" : recurse(def.keyType);
|
|
605
|
-
const valuePart = def.valueType === void 0 ? "?" : recurse(def.valueType);
|
|
606
|
-
return `ZodRecord<${keyPart},${valuePart}>`;
|
|
607
|
-
}
|
|
608
|
-
case "ZodUnion": {
|
|
609
|
-
const options = (def.options ?? []).map(recurse).sort();
|
|
610
|
-
return `ZodUnion(${options.join("|")})`;
|
|
611
|
-
}
|
|
612
|
-
case "ZodDiscriminatedUnion": {
|
|
613
|
-
const disc = def.discriminator ?? "?";
|
|
614
|
-
const options = (def.options ?? []).map(recurse).sort();
|
|
615
|
-
return `ZodDiscriminatedUnion[${JSON.stringify(disc)}](${options.join("|")})`;
|
|
616
|
-
}
|
|
617
|
-
case "ZodOptional": {
|
|
618
|
-
const inner = def.innerType;
|
|
619
|
-
return inner === void 0 ? "ZodOptional(?)" : `ZodOptional(${recurse(inner)})`;
|
|
620
|
-
}
|
|
621
|
-
case "ZodNullable": {
|
|
622
|
-
const inner = def.innerType;
|
|
623
|
-
return inner === void 0 ? "ZodNullable(?)" : `ZodNullable(${recurse(inner)})`;
|
|
624
|
-
}
|
|
625
|
-
case "ZodDefault": {
|
|
626
|
-
const inner = def.innerType;
|
|
627
|
-
return `ZodDefault[${defaultFactoryRepr(def.defaultValue)}](${inner === void 0 ? "?" : recurse(inner)})`;
|
|
628
|
-
}
|
|
629
|
-
case "ZodReadonly": {
|
|
630
|
-
const inner = def.innerType;
|
|
631
|
-
return inner === void 0 ? "ZodReadonly(?)" : `ZodReadonly(${recurse(inner)})`;
|
|
632
|
-
}
|
|
633
|
-
case "ZodEffects": {
|
|
634
|
-
const effectType = def.effect?.type ?? "effect";
|
|
635
|
-
const inner = def.schema;
|
|
636
|
-
return `ZodEffects:${effectType}:fn:*(${inner === void 0 ? "?" : recurse(inner)})`;
|
|
637
|
-
}
|
|
638
|
-
case "ZodPipeline": {
|
|
639
|
-
const inner = def.in ?? def.out;
|
|
640
|
-
return inner === void 0 ? "ZodPipeline(?)" : `ZodPipeline(${recurse(inner)})`;
|
|
641
|
-
}
|
|
642
|
-
case "ZodCatch": {
|
|
643
|
-
const inner = def.innerType ?? def.schema;
|
|
644
|
-
const catchRepr = defaultFactoryRepr(def.catchValue);
|
|
645
|
-
return `ZodCatch[${catchRepr}](${inner === void 0 ? "?" : recurse(inner)})`;
|
|
646
|
-
}
|
|
647
|
-
case "ZodLazy": {
|
|
648
|
-
const resolve = def.getter;
|
|
649
|
-
if (typeof resolve !== "function") return "ZodLazy(?)";
|
|
650
|
-
try {
|
|
651
|
-
const inner = resolve();
|
|
652
|
-
return `ZodLazy(${recurse(inner)})`;
|
|
653
|
-
} catch {
|
|
654
|
-
return "ZodLazy(?)";
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
case "ZodIntersection": {
|
|
658
|
-
const leftPart = def.left === void 0 ? "?" : recurse(def.left);
|
|
659
|
-
const rightPart = def.right === void 0 ? "?" : recurse(def.right);
|
|
660
|
-
const parts = [leftPart, rightPart].sort();
|
|
661
|
-
return `ZodIntersection(${parts.join("&")})`;
|
|
662
|
-
}
|
|
663
|
-
case "ZodSet": {
|
|
664
|
-
const inner = def.valueType;
|
|
665
|
-
return inner === void 0 ? "ZodSet(?)" : `ZodSet<${recurse(inner)}>${formatChecks(def.checks)}`;
|
|
666
|
-
}
|
|
667
|
-
case "ZodBranded": {
|
|
668
|
-
const inner = def.type;
|
|
669
|
-
return inner === void 0 ? "ZodBranded(?)" : `ZodBranded(${recurse(inner)})`;
|
|
670
|
-
}
|
|
671
|
-
// Structural opacity — schemas whose runtime behaviour isn't
|
|
672
|
-
// introspectable via `_def` fall here. Still distinguishable
|
|
673
|
-
// from other kinds by the returned string.
|
|
674
|
-
case "ZodPromise":
|
|
675
|
-
case "ZodFunction":
|
|
676
|
-
case "ZodMap":
|
|
677
|
-
case "ZodSymbol":
|
|
678
|
-
default:
|
|
679
|
-
return `${kind}:*`;
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
function readShapeSafely(def) {
|
|
683
|
-
if (typeof def.shape !== "function") return {};
|
|
684
|
-
try {
|
|
685
|
-
return def.shape();
|
|
686
|
-
} catch {
|
|
687
|
-
return {};
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
function defaultFactoryRepr(factory) {
|
|
691
|
-
if (typeof factory !== "function") return "none";
|
|
692
|
-
let first;
|
|
693
|
-
let second;
|
|
694
|
-
try {
|
|
695
|
-
first = factory();
|
|
696
|
-
second = factory();
|
|
697
|
-
} catch {
|
|
698
|
-
return "fn:*";
|
|
699
|
-
}
|
|
700
|
-
if (!Object.is(first, second)) return "fn:*";
|
|
701
|
-
if (typeof first === "function") return "fn:*";
|
|
702
|
-
return canonicalStringify(first);
|
|
703
|
-
}
|
|
704
|
-
function formatChecks(checks) {
|
|
705
|
-
if (!Array.isArray(checks) || checks.length === 0) return "";
|
|
706
|
-
const parts = checks.map((c) => canonicalStringify(c)).sort();
|
|
707
|
-
return `[${parts.join(";")}]`;
|
|
708
|
-
}
|
|
709
|
-
function canonicalStringify(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
710
|
-
if (value === null) return "null";
|
|
711
|
-
if (value === void 0) return "undefined";
|
|
712
|
-
const t = typeof value;
|
|
713
|
-
if (t === "string") return JSON.stringify(value);
|
|
714
|
-
if (t === "number" || t === "boolean") return String(value);
|
|
715
|
-
if (t === "bigint") return `${String(value)}n`;
|
|
716
|
-
if (t === "function") return "fn:*";
|
|
717
|
-
if (t === "symbol") return "symbol:*";
|
|
718
|
-
if (Array.isArray(value)) {
|
|
719
|
-
if (seen.has(value)) return "<cyclic>";
|
|
720
|
-
seen.add(value);
|
|
721
|
-
try {
|
|
722
|
-
return `[${value.map((v) => canonicalStringify(v, seen)).join(",")}]`;
|
|
723
|
-
} finally {
|
|
724
|
-
seen.delete(value);
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
if (t === "object") {
|
|
728
|
-
const obj = value;
|
|
729
|
-
if (seen.has(obj)) return "<cyclic>";
|
|
730
|
-
seen.add(obj);
|
|
731
|
-
try {
|
|
732
|
-
if (value instanceof Date) return `date:${value.getTime()}`;
|
|
733
|
-
if (value instanceof RegExp) return `regex:${String(value)}`;
|
|
734
|
-
const entries = Object.entries(obj).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([k, v]) => `${JSON.stringify(k)}:${canonicalStringify(v, seen)}`);
|
|
735
|
-
return `{${entries.join(",")}}`;
|
|
736
|
-
} finally {
|
|
737
|
-
seen.delete(obj);
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
return "unknown";
|
|
741
|
-
}
|
|
742
|
-
|
|
743
565
|
const V3_INTROSPECTOR = {
|
|
744
566
|
kindOf: (schema) => kindOf(schema),
|
|
745
|
-
getObjectShape
|
|
746
|
-
getTupleItems
|
|
567
|
+
getObjectShape,
|
|
568
|
+
getTupleItems,
|
|
747
569
|
getDiscriminatedOptions: (schema) => getDiscriminatedOptions(schema),
|
|
748
|
-
getDiscriminator
|
|
749
|
-
getLiteralValues
|
|
750
|
-
isPreprocessNode
|
|
751
|
-
isCoercePrimitive
|
|
752
|
-
containsAsyncRefine
|
|
753
|
-
containsAsyncTransform
|
|
754
|
-
hasContainerOrRootRefine
|
|
570
|
+
getDiscriminator,
|
|
571
|
+
getLiteralValues,
|
|
572
|
+
isPreprocessNode,
|
|
573
|
+
isCoercePrimitive,
|
|
574
|
+
containsAsyncRefine,
|
|
575
|
+
containsAsyncTransform,
|
|
576
|
+
hasContainerOrRootRefine,
|
|
755
577
|
// Walker accessors (D2 / D3 / D5).
|
|
756
|
-
getArrayElement
|
|
757
|
-
getSetValueType
|
|
758
|
-
getRecordKeyType
|
|
759
|
-
getRecordValueType
|
|
760
|
-
getUnionOptions
|
|
761
|
-
getIntersectionLeft
|
|
762
|
-
getIntersectionRight
|
|
578
|
+
getArrayElement,
|
|
579
|
+
getSetValueType,
|
|
580
|
+
getRecordKeyType,
|
|
581
|
+
getRecordValueType,
|
|
582
|
+
getUnionOptions,
|
|
583
|
+
getIntersectionLeft,
|
|
584
|
+
getIntersectionRight,
|
|
763
585
|
getEnumValues: (schema) => {
|
|
764
586
|
if (!isZodSchemaType(schema, "ZodEnum")) return [];
|
|
765
587
|
return schema.options;
|
|
766
588
|
},
|
|
767
|
-
getNativeEnumValues
|
|
768
|
-
unwrapInner
|
|
769
|
-
unwrapBranded
|
|
770
|
-
unwrapEffectsSource
|
|
771
|
-
unwrapPipeIn
|
|
772
|
-
unwrapPipeOut
|
|
773
|
-
unwrapLazy
|
|
774
|
-
getLazyGetter
|
|
775
|
-
getDefaultValue:
|
|
776
|
-
getCatchDefault
|
|
777
|
-
hasCatchValue
|
|
589
|
+
getNativeEnumValues,
|
|
590
|
+
unwrapInner,
|
|
591
|
+
unwrapBranded,
|
|
592
|
+
unwrapEffectsSource,
|
|
593
|
+
unwrapPipeIn,
|
|
594
|
+
unwrapPipeOut,
|
|
595
|
+
unwrapLazy,
|
|
596
|
+
getLazyGetter,
|
|
597
|
+
getDefaultValue: getDefaultValue$1,
|
|
598
|
+
getCatchDefault,
|
|
599
|
+
hasCatchValue
|
|
778
600
|
};
|
|
779
601
|
|
|
780
602
|
function slimPrimitivesV3(schema) {
|
|
781
|
-
return new Set(
|
|
603
|
+
return new Set(walkFieldMeta.slimPrimitivesWalk(schema, V3_INTROSPECTOR, 64));
|
|
782
604
|
}
|
|
783
605
|
|
|
784
606
|
function stripAsyncChecks(schema) {
|
|
@@ -955,22 +777,6 @@ function constraintsAreSlimValid(slimSchema, constraints) {
|
|
|
955
777
|
return false;
|
|
956
778
|
}
|
|
957
779
|
}
|
|
958
|
-
function mergeDeepV3(base, override) {
|
|
959
|
-
if (override === void 0) return base;
|
|
960
|
-
if (!injectWizard.isPlainRecord(override)) return override;
|
|
961
|
-
if (!injectWizard.isPlainRecord(base)) return override;
|
|
962
|
-
const result = { ...base };
|
|
963
|
-
for (const key of Object.keys(override)) {
|
|
964
|
-
const oVal = override[key];
|
|
965
|
-
const bVal = base[key];
|
|
966
|
-
if (injectWizard.isPlainRecord(oVal) && injectWizard.isPlainRecord(bVal)) {
|
|
967
|
-
result[key] = mergeDeepV3(bVal, oVal);
|
|
968
|
-
} else {
|
|
969
|
-
result[key] = oVal;
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
return result;
|
|
973
|
-
}
|
|
974
780
|
let warnedZodCodeMissing = false;
|
|
975
781
|
function zodAdapter(zodSchema) {
|
|
976
782
|
assertSupportedKinds(zodSchema);
|
|
@@ -985,7 +791,7 @@ function zodAdapter(zodSchema) {
|
|
|
985
791
|
const name = getTypeName(_strippedRoot);
|
|
986
792
|
throw new Error(`ZodAdapter: expected ZodObject, got ${name}`);
|
|
987
793
|
}
|
|
988
|
-
return (formKey, options) =>
|
|
794
|
+
return (formKey, options) => walkFieldMeta.createAbstractSchema(
|
|
989
795
|
zodSchema,
|
|
990
796
|
V3_INTROSPECTOR,
|
|
991
797
|
buildV3Services(),
|
|
@@ -993,9 +799,13 @@ function zodAdapter(zodSchema) {
|
|
|
993
799
|
options
|
|
994
800
|
);
|
|
995
801
|
}
|
|
802
|
+
async function lazyFingerprint(schema) {
|
|
803
|
+
const { fingerprintZodSchema } = await import('../chunks/fingerprint.cjs');
|
|
804
|
+
return fingerprintZodSchema(schema);
|
|
805
|
+
}
|
|
996
806
|
function buildV3Services() {
|
|
997
807
|
return {
|
|
998
|
-
fingerprint: (schema) =>
|
|
808
|
+
fingerprint: (schema) => lazyFingerprint(schema),
|
|
999
809
|
getNestedSchemasAtPath: (schema, path, maxRecursionDepth) => getNestedZodSchemasAtPath(schema, path, maxRecursionDepth),
|
|
1000
810
|
// v3 pre-strips refinements / defaults / wrappers off the root for
|
|
1001
811
|
// slim-mode walks — `getSlimPrimitiveTypesAtPath` and
|
|
@@ -1023,7 +833,7 @@ function buildV3Services() {
|
|
|
1023
833
|
// historical shape) — `getSchemasAtPath` consumers may probe any
|
|
1024
834
|
// method on the result. The factory call rebuilds the full surface
|
|
1025
835
|
// against the sub-schema with its own per-form caches.
|
|
1026
|
-
makeSubSchema: (sub, formKey, maxRecursionDepth) =>
|
|
836
|
+
makeSubSchema: (sub, formKey, maxRecursionDepth) => walkFieldMeta.createAbstractSchema(
|
|
1027
837
|
sub,
|
|
1028
838
|
V3_INTROSPECTOR,
|
|
1029
839
|
buildV3Services(),
|
|
@@ -1076,7 +886,7 @@ function coercePathSegments(path) {
|
|
|
1076
886
|
}
|
|
1077
887
|
function getNestedZodSchemasAtPath(schema, segments, maxRecursionDepth) {
|
|
1078
888
|
if (segments.length === 0) return [schema];
|
|
1079
|
-
return
|
|
889
|
+
return walkFieldMeta.walkPathSegments(schema, segments.map(String), V3_INTROSPECTOR, maxRecursionDepth, 0);
|
|
1080
890
|
}
|
|
1081
891
|
function unwrapStructuralLeafV3(schema) {
|
|
1082
892
|
let current = schema;
|
|
@@ -1147,9 +957,14 @@ function isLeafRequiredV3(schema, depth = 0) {
|
|
|
1147
957
|
return inner === void 0 ? true : isLeafRequiredV3(inner, depth + 1);
|
|
1148
958
|
}
|
|
1149
959
|
if (isZodSchemaType(schema, "ZodEffects")) {
|
|
960
|
+
if (getEffectsKind(schema) === "preprocess") return true;
|
|
1150
961
|
const inner = unwrapEffectsSource(schema);
|
|
1151
962
|
return inner === void 0 ? true : isLeafRequiredV3(inner, depth + 1);
|
|
1152
963
|
}
|
|
964
|
+
if (isZodSchemaType(schema, "ZodLazy")) {
|
|
965
|
+
const inner = unwrapLazy(schema);
|
|
966
|
+
return inner === void 0 ? true : isLeafRequiredV3(inner, depth + 1);
|
|
967
|
+
}
|
|
1153
968
|
if (isZodSchemaType(schema, "ZodUnion") || isZodSchemaType(schema, "ZodDiscriminatedUnion")) {
|
|
1154
969
|
const options = getUnionOptions(schema);
|
|
1155
970
|
if (options.length === 0) return true;
|
|
@@ -1196,6 +1011,7 @@ function unwrapToDiscriminatedUnion(schema, depth = 0) {
|
|
|
1196
1011
|
continue;
|
|
1197
1012
|
}
|
|
1198
1013
|
if (isZodSchemaType(currentSchema, "ZodEffects")) {
|
|
1014
|
+
if (getEffectsKind(currentSchema) === "preprocess") return void 0;
|
|
1199
1015
|
const inner = unwrapEffectsSource(currentSchema);
|
|
1200
1016
|
if (!inner) return void 0;
|
|
1201
1017
|
currentSchema = inner;
|
|
@@ -1254,7 +1070,7 @@ function getDefaultValue(expected, context) {
|
|
|
1254
1070
|
return void 0;
|
|
1255
1071
|
}
|
|
1256
1072
|
function getDefaultValuesFromZodSchema(formSchema, useDefaultSchemaValues, formKey) {
|
|
1257
|
-
return
|
|
1073
|
+
return walkFieldMeta.deriveDefaultWalk(formSchema, useDefaultSchemaValues, V3_INTROSPECTOR, 64, {
|
|
1258
1074
|
unsupportedKindFallback: (schema) => {
|
|
1259
1075
|
console.warn(
|
|
1260
1076
|
`[attaform] zod-v3 adapter: unsupported schema kind '${schema.constructor?.name ?? "unknown"}' on form '${formKey}'. Defaulting the field to null. Use a supported zod kind (object/array/record/string/number/etc.) at this path.`
|
|
@@ -1413,7 +1229,7 @@ function stripRootSchema(schema, stripConfig) {
|
|
|
1413
1229
|
}
|
|
1414
1230
|
const getStripInstruction = (stripValueOrCallback, schema) => {
|
|
1415
1231
|
if (stripValueOrCallback === void 0 || stripValueOrCallback === false) return false;
|
|
1416
|
-
return
|
|
1232
|
+
return typeof stripValueOrCallback === "function" ? stripValueOrCallback(schema) : stripValueOrCallback;
|
|
1417
1233
|
};
|
|
1418
1234
|
function getSlimSchema(config) {
|
|
1419
1235
|
function _getSlimSchema(_schema) {
|
|
@@ -1443,7 +1259,7 @@ function getSlimSchema(config) {
|
|
|
1443
1259
|
if (discKey === void 0) return _schema;
|
|
1444
1260
|
for (const option of getDiscriminatedOptions(_schema)) {
|
|
1445
1261
|
const slimmedSchema = _getSlimSchema(option);
|
|
1446
|
-
const deepCloneSlimmedSchema =
|
|
1262
|
+
const deepCloneSlimmedSchema = cloneSchemaDeep(slimmedSchema);
|
|
1447
1263
|
slimmedSchemas.push(deepCloneSlimmedSchema);
|
|
1448
1264
|
}
|
|
1449
1265
|
return zod.z.discriminatedUnion(
|
|
@@ -1505,142 +1321,6 @@ function peelAllV3Wrappers(schema) {
|
|
|
1505
1321
|
}
|
|
1506
1322
|
return current;
|
|
1507
1323
|
}
|
|
1508
|
-
const pathMetaCacheV3 = /* @__PURE__ */ new WeakMap();
|
|
1509
|
-
function getPathMetaMapV3(rootSchema) {
|
|
1510
|
-
const cached = pathMetaCacheV3.get(rootSchema);
|
|
1511
|
-
if (cached !== void 0) return cached;
|
|
1512
|
-
const map = /* @__PURE__ */ new Map();
|
|
1513
|
-
const counters = /* @__PURE__ */ new Map();
|
|
1514
|
-
const lastPathPerSchema = /* @__PURE__ */ new Map();
|
|
1515
|
-
const inProgress = /* @__PURE__ */ new WeakSet();
|
|
1516
|
-
walkForMetaV3(rootSchema, [], map, counters, lastPathPerSchema, inProgress);
|
|
1517
|
-
for (const [schema, lastPath] of lastPathPerSchema) {
|
|
1518
|
-
const list = getFieldMetaList(schema);
|
|
1519
|
-
const consumed = counters.get(schema) ?? 0;
|
|
1520
|
-
if (list.length <= consumed) continue;
|
|
1521
|
-
const surplus = list.slice(consumed).reduce((acc, p) => ({ ...acc, ...p }), {});
|
|
1522
|
-
const existing = map.get(lastPath) ?? {};
|
|
1523
|
-
map.set(lastPath, { ...existing, ...surplus });
|
|
1524
|
-
}
|
|
1525
|
-
pathMetaCacheV3.set(rootSchema, map);
|
|
1526
|
-
return map;
|
|
1527
|
-
}
|
|
1528
|
-
function consumePayloadV3(schema, counters) {
|
|
1529
|
-
const list = getFieldMetaList(schema);
|
|
1530
|
-
if (list.length === 0) return void 0;
|
|
1531
|
-
const idx = counters.get(schema) ?? 0;
|
|
1532
|
-
const payload = list[Math.min(idx, list.length - 1)];
|
|
1533
|
-
counters.set(schema, idx + 1);
|
|
1534
|
-
return payload;
|
|
1535
|
-
}
|
|
1536
|
-
function walkForMetaV3(schema, path, map, counters, lastPathPerSchema, inProgress) {
|
|
1537
|
-
if (inProgress.has(schema)) return;
|
|
1538
|
-
inProgress.add(schema);
|
|
1539
|
-
try {
|
|
1540
|
-
const pathKey = paths.canonicalizePath(path).key;
|
|
1541
|
-
if (!map.has(pathKey)) {
|
|
1542
|
-
const payload = consumePayloadV3(schema, counters);
|
|
1543
|
-
if (payload !== void 0) {
|
|
1544
|
-
map.set(pathKey, payload);
|
|
1545
|
-
lastPathPerSchema.set(schema, pathKey);
|
|
1546
|
-
}
|
|
1547
|
-
}
|
|
1548
|
-
const peeled = peelAllV3Wrappers(schema);
|
|
1549
|
-
if (peeled !== schema && !map.has(pathKey)) {
|
|
1550
|
-
const payload = consumePayloadV3(peeled, counters);
|
|
1551
|
-
if (payload !== void 0) {
|
|
1552
|
-
map.set(pathKey, payload);
|
|
1553
|
-
lastPathPerSchema.set(peeled, pathKey);
|
|
1554
|
-
}
|
|
1555
|
-
}
|
|
1556
|
-
if (isZodSchemaType(schema, "ZodObject")) {
|
|
1557
|
-
const shape = getObjectShape(schema);
|
|
1558
|
-
for (const [key, child] of Object.entries(shape)) {
|
|
1559
|
-
walkForMetaV3(
|
|
1560
|
-
child,
|
|
1561
|
-
[...path, key],
|
|
1562
|
-
map,
|
|
1563
|
-
counters,
|
|
1564
|
-
lastPathPerSchema,
|
|
1565
|
-
inProgress
|
|
1566
|
-
);
|
|
1567
|
-
}
|
|
1568
|
-
return;
|
|
1569
|
-
}
|
|
1570
|
-
if (isZodSchemaType(schema, "ZodArray")) {
|
|
1571
|
-
const inner = getArrayElement(schema);
|
|
1572
|
-
if (inner) walkForMetaV3(inner, [...path, 0], map, counters, lastPathPerSchema, inProgress);
|
|
1573
|
-
return;
|
|
1574
|
-
}
|
|
1575
|
-
if (isZodSchemaType(schema, "ZodTuple")) {
|
|
1576
|
-
const items = getTupleItems(schema);
|
|
1577
|
-
items.forEach((item, i) => {
|
|
1578
|
-
walkForMetaV3(
|
|
1579
|
-
item,
|
|
1580
|
-
[...path, i],
|
|
1581
|
-
map,
|
|
1582
|
-
counters,
|
|
1583
|
-
lastPathPerSchema,
|
|
1584
|
-
inProgress
|
|
1585
|
-
);
|
|
1586
|
-
});
|
|
1587
|
-
return;
|
|
1588
|
-
}
|
|
1589
|
-
if (isZodSchemaType(schema, "ZodSet")) {
|
|
1590
|
-
const inner = getSetValueType(schema);
|
|
1591
|
-
if (inner) walkForMetaV3(inner, [...path, 0], map, counters, lastPathPerSchema, inProgress);
|
|
1592
|
-
return;
|
|
1593
|
-
}
|
|
1594
|
-
if (isZodSchemaType(schema, "ZodRecord")) {
|
|
1595
|
-
const inner = getRecordValueType(schema);
|
|
1596
|
-
if (inner) walkForMetaV3(inner, [...path, "*"], map, counters, lastPathPerSchema, inProgress);
|
|
1597
|
-
return;
|
|
1598
|
-
}
|
|
1599
|
-
if (isZodSchemaType(schema, "ZodUnion") || isZodSchemaType(schema, "ZodDiscriminatedUnion")) {
|
|
1600
|
-
for (const opt of getUnionOptions(schema)) {
|
|
1601
|
-
walkForMetaV3(opt, path, map, counters, lastPathPerSchema, inProgress);
|
|
1602
|
-
}
|
|
1603
|
-
return;
|
|
1604
|
-
}
|
|
1605
|
-
if (isZodSchemaType(schema, "ZodIntersection")) {
|
|
1606
|
-
const left = getIntersectionLeft(schema);
|
|
1607
|
-
const right = getIntersectionRight(schema);
|
|
1608
|
-
if (left) walkForMetaV3(left, path, map, counters, lastPathPerSchema, inProgress);
|
|
1609
|
-
if (right) walkForMetaV3(right, path, map, counters, lastPathPerSchema, inProgress);
|
|
1610
|
-
return;
|
|
1611
|
-
}
|
|
1612
|
-
if (isZodSchemaType(schema, "ZodOptional") || isZodSchemaType(schema, "ZodNullable") || isZodSchemaType(schema, "ZodDefault") || isZodSchemaType(schema, "ZodReadonly") || isZodSchemaType(schema, "ZodCatch")) {
|
|
1613
|
-
const inner = unwrapInner(schema);
|
|
1614
|
-
if (inner) walkForMetaV3(inner, path, map, counters, lastPathPerSchema, inProgress);
|
|
1615
|
-
return;
|
|
1616
|
-
}
|
|
1617
|
-
if (isZodSchemaType(schema, "ZodEffects")) {
|
|
1618
|
-
const inner = unwrapEffectsSource(schema);
|
|
1619
|
-
if (inner) walkForMetaV3(inner, path, map, counters, lastPathPerSchema, inProgress);
|
|
1620
|
-
return;
|
|
1621
|
-
}
|
|
1622
|
-
if (isZodSchemaType(schema, "ZodPipeline")) {
|
|
1623
|
-
const inner = unwrapPipeIn(schema);
|
|
1624
|
-
if (inner) walkForMetaV3(inner, path, map, counters, lastPathPerSchema, inProgress);
|
|
1625
|
-
return;
|
|
1626
|
-
}
|
|
1627
|
-
if (isZodSchemaType(schema, "ZodBranded")) {
|
|
1628
|
-
const inner = unwrapBranded(schema);
|
|
1629
|
-
if (inner) walkForMetaV3(inner, path, map, counters, lastPathPerSchema, inProgress);
|
|
1630
|
-
return;
|
|
1631
|
-
}
|
|
1632
|
-
if (isZodSchemaType(schema, "ZodLazy")) {
|
|
1633
|
-
try {
|
|
1634
|
-
const inner = unwrapLazy(schema);
|
|
1635
|
-
if (inner) walkForMetaV3(inner, path, map, counters, lastPathPerSchema, inProgress);
|
|
1636
|
-
} catch {
|
|
1637
|
-
}
|
|
1638
|
-
return;
|
|
1639
|
-
}
|
|
1640
|
-
} finally {
|
|
1641
|
-
inProgress.delete(schema);
|
|
1642
|
-
}
|
|
1643
|
-
}
|
|
1644
1324
|
function resolveFieldMetaAtPathV3(rootSchema, path, maxRecursionDepth) {
|
|
1645
1325
|
const lastSegment = path.length === 0 ? "" : path[path.length - 1];
|
|
1646
1326
|
const target = path.length === 0 ? rootSchema : getNestedZodSchemasAtPath(rootSchema, path, maxRecursionDepth)[0];
|
|
@@ -1652,7 +1332,11 @@ function resolveFieldMetaAtPathV3(rootSchema, path, maxRecursionDepth) {
|
|
|
1652
1332
|
meta: Object.freeze({})
|
|
1653
1333
|
};
|
|
1654
1334
|
}
|
|
1655
|
-
const pathMap =
|
|
1335
|
+
const pathMap = walkFieldMeta.getFieldMetaPathMap(rootSchema, {
|
|
1336
|
+
intro: V3_INTROSPECTOR,
|
|
1337
|
+
peelAllWrappers: peelAllV3Wrappers,
|
|
1338
|
+
getFieldMetaList
|
|
1339
|
+
});
|
|
1656
1340
|
const pathKey = paths.canonicalizePath(path).key;
|
|
1657
1341
|
const peeled = peelV3Wrappers(target);
|
|
1658
1342
|
const payload = pathMap.get(pathKey) ?? getFieldMeta(target) ?? (peeled !== target ? getFieldMeta(peeled) : void 0);
|
|
@@ -1686,7 +1370,7 @@ function runStrictGetDefaultsV3(rootSchema, config, formKey, maxRecursionDepth)
|
|
|
1686
1370
|
});
|
|
1687
1371
|
let rawDefaultValues = defaultValuesWithoutConstraints;
|
|
1688
1372
|
if (!isPrimitive(rawDefaultValues)) {
|
|
1689
|
-
rawDefaultValues =
|
|
1373
|
+
rawDefaultValues = walkFieldMeta.mergeDeep(defaultValuesWithoutConstraints, config.constraints);
|
|
1690
1374
|
} else if (constraintsAreSlimValid(slimSchema, config.constraints)) {
|
|
1691
1375
|
rawDefaultValues = config.constraints;
|
|
1692
1376
|
}
|
|
@@ -1811,8 +1495,8 @@ function runStrictGetDefaultsV3(rootSchema, config, formKey, maxRecursionDepth)
|
|
|
1811
1495
|
fixedData = injectWizard.setAtPath(fixedData, path, defaultValue);
|
|
1812
1496
|
continue;
|
|
1813
1497
|
}
|
|
1814
|
-
const peeled =
|
|
1815
|
-
if (peeled !==
|
|
1498
|
+
const peeled = walkFieldMeta.peelEmbeddedDefault(schemaAtPath, V3_INTROSPECTOR);
|
|
1499
|
+
if (peeled !== walkFieldMeta.NO_EMBEDDED_DEFAULT) {
|
|
1816
1500
|
fixedData = injectWizard.setAtPath(fixedData, path, peeled);
|
|
1817
1501
|
continue;
|
|
1818
1502
|
}
|
|
@@ -1834,7 +1518,7 @@ function runStrictGetDefaultsV3(rootSchema, config, formKey, maxRecursionDepth)
|
|
|
1834
1518
|
}
|
|
1835
1519
|
}
|
|
1836
1520
|
}
|
|
1837
|
-
fixedData =
|
|
1521
|
+
fixedData = walkFieldMeta.mergeDeep(rawDefaultValues, fixedData);
|
|
1838
1522
|
const secondParse = slimSchema.safeParse(fixedData);
|
|
1839
1523
|
const finalData = secondParse.success ? secondParse.data : fixedData;
|
|
1840
1524
|
return {
|
|
@@ -1879,4 +1563,4 @@ exports.isZodSchemaType = isZodSchemaType;
|
|
|
1879
1563
|
exports.useForm = useForm;
|
|
1880
1564
|
exports.withMeta = withMeta;
|
|
1881
1565
|
exports.zodAdapter = zodAdapter;
|
|
1882
|
-
//# sourceMappingURL=attaform.
|
|
1566
|
+
//# sourceMappingURL=attaform.BSkvn43g.cjs.map
|