attaform 0.21.2 → 0.23.0
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/README.md +7 -10
- package/dist/chunks/dev-key-collision-warnings.cjs +0 -33
- package/dist/chunks/dev-key-collision-warnings.cjs.map +1 -1
- package/dist/chunks/dev-key-collision-warnings.mjs +1 -33
- package/dist/chunks/dev-key-collision-warnings.mjs.map +1 -1
- package/dist/chunks/devtools.cjs +3 -5
- package/dist/chunks/devtools.cjs.map +1 -1
- package/dist/chunks/devtools.mjs +3 -5
- package/dist/chunks/devtools.mjs.map +1 -1
- package/dist/chunks/fingerprint2.cjs +1 -1
- package/dist/chunks/fingerprint2.mjs +1 -1
- package/dist/index.cjs +3 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -41
- package/dist/index.d.mts +6 -41
- package/dist/index.d.ts +6 -41
- 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/runtime/components/AttaformDevtoolsPanel.vue +3 -11
- package/dist/runtime/plugins/attaform.cjs +2 -2
- package/dist/runtime/plugins/attaform.mjs +2 -2
- package/dist/shared/{attaform.BGf_J22U.d.ts → attaform.BGMRvckW.d.ts} +11 -70
- package/dist/shared/{attaform.ory-3WhV.d.mts → attaform.BJnNK75Y.d.cts} +41 -491
- package/dist/shared/{attaform.ory-3WhV.d.ts → attaform.BJnNK75Y.d.mts} +41 -491
- package/dist/shared/{attaform.ory-3WhV.d.cts → attaform.BJnNK75Y.d.ts} +41 -491
- package/dist/shared/{attaform.DP-u7_tk.mjs → attaform.BhI9Icek.mjs} +17 -291
- package/dist/shared/attaform.BhI9Icek.mjs.map +1 -0
- package/dist/shared/{attaform.BwLp9KM7.cjs → attaform.BibT5AS_.cjs} +2 -2
- package/dist/shared/{attaform.BwLp9KM7.cjs.map → attaform.BibT5AS_.cjs.map} +1 -1
- package/dist/shared/{attaform.DkA5J8NW.d.cts → attaform.CO0e7YVY.d.cts} +1 -46
- package/dist/shared/{attaform.DkA5J8NW.d.ts → attaform.CO0e7YVY.d.mts} +1 -46
- package/dist/shared/{attaform.DkA5J8NW.d.mts → attaform.CO0e7YVY.d.ts} +1 -46
- package/dist/shared/{attaform.BwrowMp2.cjs → attaform.CaYj3ZfY.cjs} +3 -3
- package/dist/shared/{attaform.BwrowMp2.cjs.map → attaform.CaYj3ZfY.cjs.map} +1 -1
- package/dist/shared/{attaform.BBDIKtKY.cjs → attaform.Cmb_LCie.cjs} +4 -4
- package/dist/shared/{attaform.BVeLgfEh.mjs.map → attaform.Cmb_LCie.cjs.map} +1 -1
- package/dist/shared/{attaform.CTheKoTc.mjs → attaform.CtJOd7ox.mjs} +446 -525
- package/dist/shared/attaform.CtJOd7ox.mjs.map +1 -0
- package/dist/shared/{attaform.CrD73S4m.mjs → attaform.CzVta5o2.mjs} +116 -47
- package/dist/shared/attaform.CzVta5o2.mjs.map +1 -0
- package/dist/shared/{attaform.CnEl--PF.d.mts → attaform.D52oJiYC.d.cts} +1 -1
- package/dist/shared/{attaform.BoY6RZUl.d.cts → attaform.DCkSNnPr.d.mts} +1 -1
- package/dist/shared/{attaform.B5LNzqQh.cjs → attaform.Db4E4IW6.cjs} +18 -297
- package/dist/shared/attaform.Db4E4IW6.cjs.map +1 -0
- package/dist/shared/{attaform.CcnF1AKJ.cjs → attaform.DbyTD8N2.cjs} +116 -47
- package/dist/shared/attaform.DbyTD8N2.cjs.map +1 -0
- package/dist/shared/{attaform.D6GYGshL.mjs → attaform.Dd1Kmmaj.mjs} +3 -3
- package/dist/shared/{attaform.D6GYGshL.mjs.map → attaform.Dd1Kmmaj.mjs.map} +1 -1
- package/dist/shared/{attaform.BCcrLApm.d.mts → attaform.DrY8srOp.d.mts} +11 -70
- package/dist/shared/{attaform.D2ZuIOCf.cjs → attaform.DsQkXE3o.cjs} +445 -534
- package/dist/shared/attaform.DsQkXE3o.cjs.map +1 -0
- package/dist/shared/{attaform.BkjJfMvJ.d.cts → attaform.DuPneYR0.d.cts} +11 -70
- package/dist/shared/{attaform.C41gjp-a.mjs → attaform.Dx9-QQE2.mjs} +2 -2
- package/dist/shared/{attaform.C41gjp-a.mjs.map → attaform.Dx9-QQE2.mjs.map} +1 -1
- package/dist/shared/{attaform.BYgioWLF.d.ts → attaform.WEwfXcHq.d.ts} +1 -1
- package/dist/shared/{attaform.BVeLgfEh.mjs → attaform.alpG7rT7.mjs} +4 -4
- package/dist/shared/{attaform.BBDIKtKY.cjs.map → attaform.alpG7rT7.mjs.map} +1 -1
- 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 +5 -5
- package/dist/zod-v4.d.mts +5 -5
- package/dist/zod-v4.d.ts +5 -5
- package/dist/zod-v4.mjs +2 -2
- package/dist/zod.cjs +5 -5
- package/dist/zod.d.cts +5 -5
- package/dist/zod.d.mts +5 -5
- package/dist/zod.d.ts +5 -5
- package/dist/zod.mjs +5 -5
- package/package.json +2 -2
- package/dist/chunks/indexeddb.cjs +0 -119
- package/dist/chunks/indexeddb.cjs.map +0 -1
- package/dist/chunks/indexeddb.mjs +0 -117
- package/dist/chunks/indexeddb.mjs.map +0 -1
- package/dist/chunks/local-storage.cjs +0 -58
- package/dist/chunks/local-storage.cjs.map +0 -1
- package/dist/chunks/local-storage.mjs +0 -56
- package/dist/chunks/local-storage.mjs.map +0 -1
- package/dist/chunks/multi-tab-sync.cjs +0 -367
- package/dist/chunks/multi-tab-sync.cjs.map +0 -1
- package/dist/chunks/multi-tab-sync.mjs +0 -364
- package/dist/chunks/multi-tab-sync.mjs.map +0 -1
- package/dist/chunks/session-storage.cjs +0 -58
- package/dist/chunks/session-storage.cjs.map +0 -1
- package/dist/chunks/session-storage.mjs +0 -56
- package/dist/chunks/session-storage.mjs.map +0 -1
- package/dist/chunks/wire-persistence.cjs +0 -396
- package/dist/chunks/wire-persistence.cjs.map +0 -1
- package/dist/chunks/wire-persistence.mjs +0 -394
- package/dist/chunks/wire-persistence.mjs.map +0 -1
- package/dist/shared/attaform.B5LNzqQh.cjs.map +0 -1
- package/dist/shared/attaform.CTheKoTc.mjs.map +0 -1
- package/dist/shared/attaform.CcnF1AKJ.cjs.map +0 -1
- package/dist/shared/attaform.CrD73S4m.mjs.map +0 -1
- package/dist/shared/attaform.D2ZuIOCf.cjs.map +0 -1
- package/dist/shared/attaform.DP-u7_tk.mjs.map +0 -1
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const paths = require('./attaform.B5LNzqQh.cjs');
|
|
3
|
+
const walkFieldMeta = require('./attaform.CaYj3ZfY.cjs');
|
|
4
|
+
const injectWizard = require('./attaform.DsQkXE3o.cjs');
|
|
5
|
+
const paths = require('./attaform.Db4E4IW6.cjs');
|
|
7
6
|
|
|
8
7
|
const fieldMeta = walkFieldMeta.fieldMetaStore;
|
|
9
8
|
function withMeta(schema, payload) {
|
|
@@ -56,9 +55,6 @@ function clone(value, seen) {
|
|
|
56
55
|
return copy;
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
class UnsupportedSchemaError extends paths.AttaformError {
|
|
60
|
-
}
|
|
61
|
-
|
|
62
58
|
function isZodSchemaType(schema, expectedType) {
|
|
63
59
|
if (typeof schema !== "object" || schema === null) return false;
|
|
64
60
|
const maybeDef = schema._def;
|
|
@@ -193,6 +189,10 @@ function getDiscriminator(schema) {
|
|
|
193
189
|
const def = readDef(schema);
|
|
194
190
|
return def?.discriminator;
|
|
195
191
|
}
|
|
192
|
+
function getDiscriminatedOptionsMap(schema) {
|
|
193
|
+
const map = readDef(schema)?.optionsMap;
|
|
194
|
+
return map instanceof Map ? map : void 0;
|
|
195
|
+
}
|
|
196
196
|
function getIntersectionLeft(schema) {
|
|
197
197
|
const def = readDef(schema);
|
|
198
198
|
return def?.left;
|
|
@@ -473,6 +473,71 @@ function isContainerAfterWrapperPeel(schema) {
|
|
|
473
473
|
return isZodSchemaType(cur, "ZodObject") || isZodSchemaType(cur, "ZodArray") || isZodSchemaType(cur, "ZodTuple") || isZodSchemaType(cur, "ZodIntersection") || isZodSchemaType(cur, "ZodUnion") || isZodSchemaType(cur, "ZodDiscriminatedUnion") || isZodSchemaType(cur, "ZodRecord") || isZodSchemaType(cur, "ZodSet");
|
|
474
474
|
}
|
|
475
475
|
|
|
476
|
+
function rebuildWithDef(original, defPatch) {
|
|
477
|
+
const node = Object.create(Object.getPrototypeOf(original));
|
|
478
|
+
node._def = { ...original._def, ...defPatch };
|
|
479
|
+
return node;
|
|
480
|
+
}
|
|
481
|
+
function rebuildObject(original, shape) {
|
|
482
|
+
const node = rebuildWithDef(original, { shape: () => shape, unknownKeys: "strip" });
|
|
483
|
+
node._cached = null;
|
|
484
|
+
return node;
|
|
485
|
+
}
|
|
486
|
+
function rebuildArray(original, element) {
|
|
487
|
+
return rebuildWithDef(original, {
|
|
488
|
+
type: element,
|
|
489
|
+
minLength: null,
|
|
490
|
+
maxLength: null,
|
|
491
|
+
exactLength: null
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
function rebuildSet(original, valueType) {
|
|
495
|
+
return rebuildWithDef(original, {
|
|
496
|
+
valueType,
|
|
497
|
+
minSize: null,
|
|
498
|
+
maxSize: null
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
function rebuildRecord(original, valueType, keyType) {
|
|
502
|
+
const patch = { valueType };
|
|
503
|
+
if (keyType !== void 0) patch["keyType"] = keyType;
|
|
504
|
+
return rebuildWithDef(original, patch);
|
|
505
|
+
}
|
|
506
|
+
function rebuildTuple(original, items) {
|
|
507
|
+
return rebuildWithDef(original, { items, rest: null });
|
|
508
|
+
}
|
|
509
|
+
function rebuildUnion(original, options) {
|
|
510
|
+
return rebuildWithDef(original, { options });
|
|
511
|
+
}
|
|
512
|
+
function rebuildIntersection(original, left, right) {
|
|
513
|
+
return rebuildWithDef(original, { left, right });
|
|
514
|
+
}
|
|
515
|
+
function rebuildWrapperInner(original, inner) {
|
|
516
|
+
return rebuildWithDef(original, { innerType: inner });
|
|
517
|
+
}
|
|
518
|
+
function rebuildLazy(original, target) {
|
|
519
|
+
return rebuildWithDef(original, { getter: () => target });
|
|
520
|
+
}
|
|
521
|
+
function stripLeafChecks(original) {
|
|
522
|
+
return rebuildWithDef(original, { checks: [] });
|
|
523
|
+
}
|
|
524
|
+
function rebuildDiscriminatedUnion(original, options) {
|
|
525
|
+
const originalOptions = getDiscriminatedOptions(original);
|
|
526
|
+
const originalMap = getDiscriminatedOptionsMap(original);
|
|
527
|
+
const optionsMap = /* @__PURE__ */ new Map();
|
|
528
|
+
if (originalMap !== void 0) {
|
|
529
|
+
for (const [value, originalOption] of originalMap) {
|
|
530
|
+
const index = originalOptions.indexOf(originalOption);
|
|
531
|
+
const replacement = index >= 0 ? options[index] : void 0;
|
|
532
|
+
if (replacement !== void 0) optionsMap.set(value, replacement);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
return rebuildWithDef(original, { options, optionsMap });
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
class UnsupportedSchemaError extends paths.AttaformError {
|
|
539
|
+
}
|
|
540
|
+
|
|
476
541
|
const UNSUPPORTED_TYPE_NAMES = /* @__PURE__ */ new Set(["ZodPromise", "ZodFunction", "ZodMap", "ZodSymbol"]);
|
|
477
542
|
function labelPath(path) {
|
|
478
543
|
return path.length === 0 ? "<root>" : path.join(".");
|
|
@@ -616,11 +681,11 @@ function stripAsyncChecks(schema) {
|
|
|
616
681
|
}
|
|
617
682
|
if (isZodSchemaType(s, "ZodOptional")) {
|
|
618
683
|
const inner = unwrapInner(s);
|
|
619
|
-
return inner === void 0 ? s :
|
|
684
|
+
return inner === void 0 ? s : rebuildWrapperInner(s, recurse(inner));
|
|
620
685
|
}
|
|
621
686
|
if (isZodSchemaType(s, "ZodNullable")) {
|
|
622
687
|
const inner = unwrapInner(s);
|
|
623
|
-
return inner === void 0 ? s :
|
|
688
|
+
return inner === void 0 ? s : rebuildWrapperInner(s, recurse(inner));
|
|
624
689
|
}
|
|
625
690
|
if (isZodSchemaType(s, "ZodDefault")) {
|
|
626
691
|
const inner = unwrapInner(s);
|
|
@@ -646,7 +711,7 @@ function stripAsyncChecks(schema) {
|
|
|
646
711
|
const inner = unwrapLazy(s);
|
|
647
712
|
if (inner === void 0) return s;
|
|
648
713
|
const stripped = recurse(inner);
|
|
649
|
-
return
|
|
714
|
+
return rebuildLazy(s, stripped);
|
|
650
715
|
}
|
|
651
716
|
if (isZodSchemaType(s, "ZodPipeline")) {
|
|
652
717
|
const inSide = unwrapPipeIn(s);
|
|
@@ -658,33 +723,32 @@ function stripAsyncChecks(schema) {
|
|
|
658
723
|
for (const [k, v] of Object.entries(shape)) {
|
|
659
724
|
next[k] = recurse(v);
|
|
660
725
|
}
|
|
661
|
-
return carryObjectChecks(
|
|
726
|
+
return carryObjectChecks(rebuildObject(s, next), s);
|
|
662
727
|
}
|
|
663
728
|
if (isZodSchemaType(s, "ZodArray")) {
|
|
664
729
|
const element = getArrayElement(s);
|
|
665
730
|
if (element === void 0) return s;
|
|
666
|
-
return carryArrayChecks(
|
|
731
|
+
return carryArrayChecks(rebuildArray(s, recurse(element)), s);
|
|
667
732
|
}
|
|
668
733
|
if (isZodSchemaType(s, "ZodSet")) {
|
|
669
734
|
const valueType = getSetValueType(s);
|
|
670
735
|
if (valueType === void 0) return s;
|
|
671
|
-
return carrySetChecks(
|
|
736
|
+
return carrySetChecks(rebuildSet(s, recurse(valueType)), s);
|
|
672
737
|
}
|
|
673
738
|
if (isZodSchemaType(s, "ZodTuple")) {
|
|
674
739
|
const items = getTupleItems(s).map(recurse);
|
|
675
|
-
|
|
676
|
-
return rebuilt;
|
|
740
|
+
return rebuildTuple(s, items);
|
|
677
741
|
}
|
|
678
742
|
if (isZodSchemaType(s, "ZodRecord")) {
|
|
679
743
|
const keyType = getRecordKeyType(s);
|
|
680
744
|
const valueType = getRecordValueType(s);
|
|
681
745
|
if (valueType === void 0) return s;
|
|
682
746
|
const next = recurse(valueType);
|
|
683
|
-
return keyType === void 0 ?
|
|
747
|
+
return keyType === void 0 ? rebuildRecord(s, next) : rebuildRecord(s, next, keyType);
|
|
684
748
|
}
|
|
685
749
|
if (isZodSchemaType(s, "ZodUnion")) {
|
|
686
750
|
const options = getUnionOptions(s).map(recurse);
|
|
687
|
-
return
|
|
751
|
+
return rebuildUnion(s, options);
|
|
688
752
|
}
|
|
689
753
|
if (isZodSchemaType(s, "ZodDiscriminatedUnion")) {
|
|
690
754
|
const discKey = getDiscriminator(s);
|
|
@@ -692,16 +756,13 @@ function stripAsyncChecks(schema) {
|
|
|
692
756
|
(o) => recurse(o)
|
|
693
757
|
);
|
|
694
758
|
if (discKey === void 0 || options.length === 0) return s;
|
|
695
|
-
return
|
|
696
|
-
discKey,
|
|
697
|
-
options
|
|
698
|
-
);
|
|
759
|
+
return rebuildDiscriminatedUnion(s, options);
|
|
699
760
|
}
|
|
700
761
|
if (isZodSchemaType(s, "ZodIntersection")) {
|
|
701
762
|
const left = getIntersectionLeft(s);
|
|
702
763
|
const right = getIntersectionRight(s);
|
|
703
764
|
if (left === void 0 || right === void 0) return s;
|
|
704
|
-
return
|
|
765
|
+
return rebuildIntersection(s, recurse(left), recurse(right));
|
|
705
766
|
}
|
|
706
767
|
return s;
|
|
707
768
|
}
|
|
@@ -1100,15 +1161,15 @@ function stripRefinements(schema) {
|
|
|
1100
1161
|
function _stripRefinements(_schema, depth) {
|
|
1101
1162
|
if (depth >= MAX_UNWRAP_STEPS) return _schema;
|
|
1102
1163
|
if (isZodSchemaType(_schema, "ZodString") && hasChecks(_schema)) {
|
|
1103
|
-
return
|
|
1164
|
+
return stripLeafChecks(_schema);
|
|
1104
1165
|
}
|
|
1105
1166
|
if (isZodSchemaType(_schema, "ZodNumber") && hasChecks(_schema)) {
|
|
1106
|
-
return
|
|
1167
|
+
return stripLeafChecks(_schema);
|
|
1107
1168
|
}
|
|
1108
1169
|
if (isZodSchemaType(_schema, "ZodArray")) {
|
|
1109
1170
|
const inner = getArrayElement(_schema);
|
|
1110
1171
|
if (!inner) return _schema;
|
|
1111
|
-
return
|
|
1172
|
+
return rebuildArray(_schema, _stripRefinements(inner, depth + 1));
|
|
1112
1173
|
}
|
|
1113
1174
|
if (isZodSchemaType(_schema, "ZodObject")) {
|
|
1114
1175
|
const strippedShape = Object.fromEntries(
|
|
@@ -1117,7 +1178,7 @@ function stripRefinements(schema) {
|
|
|
1117
1178
|
_stripRefinements(value, depth + 1)
|
|
1118
1179
|
])
|
|
1119
1180
|
);
|
|
1120
|
-
return
|
|
1181
|
+
return rebuildObject(_schema, strippedShape);
|
|
1121
1182
|
}
|
|
1122
1183
|
if (isZodSchemaType(_schema, "ZodEffects")) {
|
|
1123
1184
|
const inner = unwrapEffectsSource(_schema);
|
|
@@ -1127,12 +1188,12 @@ function stripRefinements(schema) {
|
|
|
1127
1188
|
if (isZodSchemaType(_schema, "ZodOptional")) {
|
|
1128
1189
|
const inner = unwrapInner(_schema);
|
|
1129
1190
|
if (!inner) return _schema;
|
|
1130
|
-
return
|
|
1191
|
+
return rebuildWrapperInner(_schema, _stripRefinements(inner, depth + 1));
|
|
1131
1192
|
}
|
|
1132
1193
|
if (isZodSchemaType(_schema, "ZodNullable")) {
|
|
1133
1194
|
const inner = unwrapInner(_schema);
|
|
1134
1195
|
if (!inner) return _schema;
|
|
1135
|
-
return
|
|
1196
|
+
return rebuildWrapperInner(_schema, _stripRefinements(inner, depth + 1));
|
|
1136
1197
|
}
|
|
1137
1198
|
if (isZodSchemaType(_schema, "ZodReadonly")) {
|
|
1138
1199
|
const inner = unwrapInner(_schema);
|
|
@@ -1152,13 +1213,13 @@ function stripRefinements(schema) {
|
|
|
1152
1213
|
if (isZodSchemaType(_schema, "ZodSet")) {
|
|
1153
1214
|
const valueType = getSetValueType(_schema);
|
|
1154
1215
|
if (!valueType) return _schema;
|
|
1155
|
-
return
|
|
1216
|
+
return rebuildSet(_schema, _stripRefinements(valueType, depth + 1));
|
|
1156
1217
|
}
|
|
1157
1218
|
if (isZodSchemaType(_schema, "ZodTuple")) {
|
|
1158
1219
|
const items = getTupleItems(_schema);
|
|
1159
1220
|
if (items.length === 0) return _schema;
|
|
1160
1221
|
const stripped = items.map((it) => _stripRefinements(it, depth + 1));
|
|
1161
|
-
return
|
|
1222
|
+
return rebuildTuple(_schema, stripped);
|
|
1162
1223
|
}
|
|
1163
1224
|
if (isZodSchemaType(_schema, "ZodRecord")) {
|
|
1164
1225
|
const valueType = getRecordValueType(_schema);
|
|
@@ -1166,15 +1227,15 @@ function stripRefinements(schema) {
|
|
|
1166
1227
|
const value = _stripRefinements(valueType, depth + 1);
|
|
1167
1228
|
const keyType = getRecordKeyType(_schema);
|
|
1168
1229
|
if (keyType) {
|
|
1169
|
-
return
|
|
1230
|
+
return rebuildRecord(_schema, value, keyType);
|
|
1170
1231
|
}
|
|
1171
|
-
return
|
|
1232
|
+
return rebuildRecord(_schema, value);
|
|
1172
1233
|
}
|
|
1173
1234
|
if (isZodSchemaType(_schema, "ZodUnion")) {
|
|
1174
1235
|
const options = getUnionOptions(_schema);
|
|
1175
1236
|
if (options.length === 0) return _schema;
|
|
1176
1237
|
const stripped = options.map((o) => _stripRefinements(o, depth + 1));
|
|
1177
|
-
return
|
|
1238
|
+
return rebuildUnion(_schema, stripped);
|
|
1178
1239
|
}
|
|
1179
1240
|
if (isZodSchemaType(_schema, "ZodDiscriminatedUnion")) {
|
|
1180
1241
|
const discKey = getDiscriminator(_schema);
|
|
@@ -1183,22 +1244,23 @@ function stripRefinements(schema) {
|
|
|
1183
1244
|
const stripped = options.map(
|
|
1184
1245
|
(o) => _stripRefinements(o, depth + 1)
|
|
1185
1246
|
);
|
|
1186
|
-
return
|
|
1187
|
-
discKey,
|
|
1188
|
-
stripped
|
|
1189
|
-
);
|
|
1247
|
+
return rebuildDiscriminatedUnion(_schema, stripped);
|
|
1190
1248
|
}
|
|
1191
1249
|
if (isZodSchemaType(_schema, "ZodIntersection")) {
|
|
1192
1250
|
const left = getIntersectionLeft(_schema);
|
|
1193
1251
|
const right = getIntersectionRight(_schema);
|
|
1194
1252
|
if (!left || !right) return _schema;
|
|
1195
|
-
return
|
|
1253
|
+
return rebuildIntersection(
|
|
1254
|
+
_schema,
|
|
1255
|
+
_stripRefinements(left, depth + 1),
|
|
1256
|
+
_stripRefinements(right, depth + 1)
|
|
1257
|
+
);
|
|
1196
1258
|
}
|
|
1197
1259
|
if (isZodSchemaType(_schema, "ZodLazy")) {
|
|
1198
1260
|
const inner = unwrapLazy(_schema);
|
|
1199
1261
|
if (!inner) return _schema;
|
|
1200
1262
|
const stripped = _stripRefinements(inner, depth + 1);
|
|
1201
|
-
return
|
|
1263
|
+
return rebuildLazy(_schema, stripped);
|
|
1202
1264
|
}
|
|
1203
1265
|
return _schema;
|
|
1204
1266
|
}
|
|
@@ -1238,12 +1300,12 @@ function getSlimSchema(config) {
|
|
|
1238
1300
|
for (const [key, value] of Object.entries(getObjectShape(_schema))) {
|
|
1239
1301
|
newShape[key] = _getSlimSchema(value);
|
|
1240
1302
|
}
|
|
1241
|
-
return
|
|
1303
|
+
return rebuildObject(_schema, newShape);
|
|
1242
1304
|
}
|
|
1243
1305
|
if (isZodSchemaType(_schema, "ZodArray")) {
|
|
1244
1306
|
const inner = getArrayElement(_schema);
|
|
1245
1307
|
if (!inner) return _schema;
|
|
1246
|
-
return
|
|
1308
|
+
return rebuildArray(_schema, _getSlimSchema(inner));
|
|
1247
1309
|
}
|
|
1248
1310
|
if (isZodSchemaType(_schema, "ZodRecord")) {
|
|
1249
1311
|
const keyType = getRecordKeyType(_schema);
|
|
@@ -1251,7 +1313,7 @@ function getSlimSchema(config) {
|
|
|
1251
1313
|
if (!keyType || !valueType) return _schema;
|
|
1252
1314
|
const key = _getSlimSchema(keyType);
|
|
1253
1315
|
const value = _getSlimSchema(valueType);
|
|
1254
|
-
return
|
|
1316
|
+
return rebuildRecord(_schema, value, key);
|
|
1255
1317
|
}
|
|
1256
1318
|
if (isZodSchemaType(_schema, "ZodDiscriminatedUnion")) {
|
|
1257
1319
|
const slimmedSchemas = [];
|
|
@@ -1262,8 +1324,8 @@ function getSlimSchema(config) {
|
|
|
1262
1324
|
const deepCloneSlimmedSchema = cloneSchemaDeep(slimmedSchema);
|
|
1263
1325
|
slimmedSchemas.push(deepCloneSlimmedSchema);
|
|
1264
1326
|
}
|
|
1265
|
-
return
|
|
1266
|
-
|
|
1327
|
+
return rebuildDiscriminatedUnion(
|
|
1328
|
+
_schema,
|
|
1267
1329
|
slimmedSchemas
|
|
1268
1330
|
);
|
|
1269
1331
|
}
|
|
@@ -1528,7 +1590,10 @@ function runStrictGetDefaultsV3(rootSchema, config, formKey, maxRecursionDepth)
|
|
|
1528
1590
|
formKey
|
|
1529
1591
|
};
|
|
1530
1592
|
}
|
|
1531
|
-
|
|
1593
|
+
const slimRootCacheV3 = /* @__PURE__ */ new WeakMap();
|
|
1594
|
+
function getSlimRootV3(rootSchema) {
|
|
1595
|
+
const cached = slimRootCacheV3.get(rootSchema);
|
|
1596
|
+
if (cached !== void 0) return cached;
|
|
1532
1597
|
const [strippedSchema] = stripRootSchema(rootSchema, {
|
|
1533
1598
|
stripDefaultValues: true,
|
|
1534
1599
|
stripNullable: true,
|
|
@@ -1539,7 +1604,11 @@ function getNestedSchemasInSlimModeV3(rootSchema, path, maxRecursionDepth) {
|
|
|
1539
1604
|
schema: strippedSchema,
|
|
1540
1605
|
stripConfig: { stripDefaultValues: true, stripZodEffects: true }
|
|
1541
1606
|
});
|
|
1542
|
-
|
|
1607
|
+
slimRootCacheV3.set(rootSchema, slimSchema);
|
|
1608
|
+
return slimSchema;
|
|
1609
|
+
}
|
|
1610
|
+
function getNestedSchemasInSlimModeV3(rootSchema, path, maxRecursionDepth) {
|
|
1611
|
+
return getNestedZodSchemasAtPath(getSlimRootV3(rootSchema), path, maxRecursionDepth);
|
|
1543
1612
|
}
|
|
1544
1613
|
|
|
1545
1614
|
function useForm(configuration) {
|
|
@@ -1563,4 +1632,4 @@ exports.isZodSchemaType = isZodSchemaType;
|
|
|
1563
1632
|
exports.useForm = useForm;
|
|
1564
1633
|
exports.withMeta = withMeta;
|
|
1565
1634
|
exports.zodAdapter = zodAdapter;
|
|
1566
|
-
//# sourceMappingURL=attaform.
|
|
1635
|
+
//# sourceMappingURL=attaform.DbyTD8N2.cjs.map
|