attaform 0.29.0 → 0.30.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/abstract.d.mts +15 -21
- package/dist/abstract.mjs +4 -4
- package/dist/dev/abstract.mjs +4 -4
- package/dist/dev/chunks/dev-key-collision-warnings.mjs +47 -8
- package/dist/dev/chunks/devtools.mjs +2 -2
- package/dist/dev/directive.mjs +1 -1
- package/dist/dev/history.mjs +1 -2
- package/dist/dev/index.mjs +5 -5
- package/dist/dev/runtime/plugins/attaform.mjs +3 -3
- package/dist/dev/shared/{attaform-dev.BO-71R54.mjs → attaform-dev.BJK1kqHY.mjs} +44 -198
- package/dist/dev/shared/{attaform-dev.D8aoKb89.mjs → attaform-dev.BMQ3GcgD.mjs} +51 -64
- package/dist/dev/shared/{attaform-dev.BgM6FdtA.mjs → attaform-dev.BUIFcTYf.mjs} +94 -62
- package/dist/dev/shared/{attaform-dev.q6UutkCx.mjs → attaform-dev.CT7MDjPy.mjs} +92 -152
- package/dist/dev/shared/{attaform-dev.ButTkwHd.mjs → attaform-dev.CZz4GYZ6.mjs} +26 -15
- package/dist/dev/shared/{attaform-dev.DD5m2W51.mjs → attaform-dev.Chm4D6SJ.mjs} +2 -4
- package/dist/dev/shared/{attaform-dev.DrzObAZo.mjs → attaform-dev.DuEE4GU1.mjs} +4 -4
- package/dist/dev/shared/{attaform-dev.DHuydLAC.mjs → attaform-dev.DxHdkkPG.mjs} +674 -734
- package/dist/dev/shared/{attaform-dev.A-TpJW0B.mjs → attaform-dev.zlvDr0WB.mjs} +3 -21
- package/dist/dev/zod-v3.mjs +6 -6
- package/dist/dev/zod-v4.mjs +6 -6
- package/dist/dev/zod.mjs +5 -5
- package/dist/directive.d.mts +4 -4
- package/dist/directive.mjs +1 -1
- package/dist/esbuild.d.mts +11 -0
- package/dist/esbuild.mjs +1 -1
- package/dist/history.d.mts +3 -32
- package/dist/history.mjs +1 -2
- package/dist/index.d.mts +67 -70
- package/dist/index.mjs +5 -5
- package/dist/nuxt.d.mts +6 -14
- package/dist/nuxt.mjs +3 -7
- package/dist/rollup.d.mts +11 -0
- package/dist/rollup.mjs +1 -1
- package/dist/rspack.d.mts +19 -11
- package/dist/rspack.mjs +1 -1
- package/dist/runtime/components/AttaformDevtoolsPanel.vue +12 -12
- package/dist/runtime/components/DevtoolsValueTree.vue +2 -2
- package/dist/runtime/plugins/attaform.mjs +3 -3
- package/dist/shared/{attaform.CIWLMY-R.d.mts → attaform.2FslhB9R.d.mts} +83 -95
- package/dist/shared/{attaform.Cvao8bW5.mjs → attaform.8mfKZCwH.mjs} +7 -7
- package/dist/shared/{attaform.DRUT703x.d.mts → attaform.B-Tb62qV.d.mts} +12 -12
- package/dist/shared/{attaform.v0fQtWyA.mjs → attaform.B1rH9ht6.mjs} +1 -1
- package/dist/shared/{attaform.BndjUUYX.mjs → attaform.B2iebkPA.mjs} +4 -4
- package/dist/shared/{attaform.DhnPb6nK.mjs → attaform.BAf3UNn4.mjs} +1 -1
- package/dist/shared/{attaform.CZMAYwSK.mjs → attaform.BIWicztt.mjs} +651 -678
- package/dist/shared/attaform.BcQwgWaq.d.mts +2153 -0
- package/dist/shared/attaform.Br8EBn5B.d.mts +4553 -0
- package/dist/shared/{attaform.C2MVyuxC.mjs → attaform.CO918TdU.mjs} +44 -198
- package/dist/shared/{attaform.CZYt_5N_.mjs → attaform.CdZIEf7_.mjs} +1 -19
- package/dist/shared/{attaform.B0dKL8ST.mjs → attaform.DRsANMok.mjs} +94 -62
- package/dist/shared/{attaform.DffRL5pP.mjs → attaform.D_f1WgYf.mjs} +46 -59
- package/dist/shared/{attaform.D1fnTifF.mjs → attaform.D_pt1gOj.mjs} +92 -150
- package/dist/shared/attaform.L0kUn3vL.d.mts +42 -0
- package/dist/shared/{attaform.D0x-qSXm.mjs → attaform.WiGdIqgx.mjs} +1 -3
- package/dist/shared/{attaform.BK0cgu2K.mjs → attaform.ZYn2ahzJ.mjs} +3 -3
- package/dist/transforms.d.mts +153 -26
- package/dist/transforms.mjs +1 -1
- package/dist/vite.d.mts +29 -52
- package/dist/vite.mjs +8 -3
- package/dist/webpack.d.mts +20 -12
- package/dist/webpack.mjs +1 -1
- package/dist/zod-v3.d.mts +90 -96
- package/dist/zod-v3.mjs +6 -6
- package/dist/zod-v4.d.mts +119 -119
- package/dist/zod-v4.mjs +6 -6
- package/dist/zod.d.mts +5 -5
- package/dist/zod.mjs +5 -5
- package/package.json +9 -7
- package/skills/attaform/SKILL.md +1 -1
- package/skills/attaform/references/custom-components.md +1 -1
- package/dist/chunks/fingerprint.mjs +0 -183
- package/dist/chunks/fingerprint2.mjs +0 -159
- package/dist/dev/chunks/fingerprint.mjs +0 -183
- package/dist/dev/chunks/fingerprint2.mjs +0 -159
- package/dist/dev/shared/attaform-dev.BxfsuwBR.mjs +0 -44
- package/dist/shared/attaform.BxfsuwBR.mjs +0 -44
- package/dist/shared/attaform.CsoeRi3P.d.mts +0 -5155
- package/dist/shared/attaform.DDtqHYv1.d.mts +0 -2465
- package/dist/shared/attaform.axHXVQO7.d.mts +0 -44
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as AttaformError, e as canonicalizePath, a as InvalidUseFormConfigError } from './attaform.
|
|
3
|
-
import { s as slimPrimitivesWalk, d as deriveDefaultWalk, m as mergeDeep, f as fixStructuralDefaults, w as walkPathSegments, c as createAbstractSchema, b as buildFieldMetaPathMap,
|
|
4
|
-
import { c as
|
|
5
|
-
import { z } from 'zod';
|
|
1
|
+
import { j as humanize, c as useAbstractForm } from './attaform.BIWicztt.mjs';
|
|
2
|
+
import { A as AttaformError, e as canonicalizePath, a as InvalidUseFormConfigError } from './attaform.CdZIEf7_.mjs';
|
|
3
|
+
import { s as slimPrimitivesWalk, d as deriveDefaultWalk, m as mergeDeep, f as fixStructuralDefaults, w as walkPathSegments, c as createAbstractSchema, a as createSharedSchemaStore, b as buildFieldMetaPathMap, e as getFieldMetaListForSchema, g as getFieldMetaForSchema } from './attaform.DRsANMok.mjs';
|
|
4
|
+
import { c as callConsumerFn } from './attaform.8mfKZCwH.mjs';
|
|
6
5
|
|
|
7
6
|
function readDef(schema) {
|
|
8
7
|
if (schema === null || typeof schema !== "object") return void 0;
|
|
@@ -49,7 +48,9 @@ const IDENTITY_KINDS = /* @__PURE__ */ new Set([
|
|
|
49
48
|
"file",
|
|
50
49
|
"map",
|
|
51
50
|
"symbol",
|
|
52
|
-
"function"
|
|
51
|
+
"function",
|
|
52
|
+
"nonoptional",
|
|
53
|
+
"success"
|
|
53
54
|
]);
|
|
54
55
|
function kindOf(schema) {
|
|
55
56
|
const def = readDef(schema);
|
|
@@ -130,11 +131,7 @@ function unwrapLazy(schema) {
|
|
|
130
131
|
const def = readDef(schema);
|
|
131
132
|
const getter = def?.getter;
|
|
132
133
|
if (typeof getter !== "function") return void 0;
|
|
133
|
-
return
|
|
134
|
-
}
|
|
135
|
-
function getLazyGetter(schema) {
|
|
136
|
-
const def = readDef(schema);
|
|
137
|
-
return typeof def?.getter === "function" ? def.getter : void 0;
|
|
134
|
+
return callConsumerFn(() => getter(), void 0);
|
|
138
135
|
}
|
|
139
136
|
function getIntersectionLeft(schema) {
|
|
140
137
|
const def = readDef(schema);
|
|
@@ -148,7 +145,7 @@ function getCatchDefault(schema) {
|
|
|
148
145
|
const def = readDef(schema);
|
|
149
146
|
const cv = def?.catchValue;
|
|
150
147
|
if (typeof cv !== "function") return void 0;
|
|
151
|
-
return
|
|
148
|
+
return callConsumerFn(
|
|
152
149
|
() => cv({ error: new Error("atta:default-values"), input: void 0 }),
|
|
153
150
|
void 0);
|
|
154
151
|
}
|
|
@@ -158,7 +155,7 @@ function hasCatchValue(schema) {
|
|
|
158
155
|
}
|
|
159
156
|
function getDefaultValue(schema) {
|
|
160
157
|
const def = readDef(schema);
|
|
161
|
-
return
|
|
158
|
+
return callConsumerFn(() => def?.defaultValue, void 0);
|
|
162
159
|
}
|
|
163
160
|
function getNativeEnumValues(_schema) {
|
|
164
161
|
return void 0;
|
|
@@ -169,11 +166,6 @@ function unwrapEffectsSource(_schema) {
|
|
|
169
166
|
function unwrapBranded(_schema) {
|
|
170
167
|
return void 0;
|
|
171
168
|
}
|
|
172
|
-
function hasChecks(schema) {
|
|
173
|
-
const def = readDef(schema);
|
|
174
|
-
const checks = def?.checks;
|
|
175
|
-
return Array.isArray(checks) && checks.length > 0;
|
|
176
|
-
}
|
|
177
169
|
function getChecks(schema) {
|
|
178
170
|
const def = readDef(schema);
|
|
179
171
|
const checks = def?.checks;
|
|
@@ -343,10 +335,10 @@ function zodIssuesToValidationErrors(issues) {
|
|
|
343
335
|
}
|
|
344
336
|
return {
|
|
345
337
|
message: issue.message,
|
|
346
|
-
// Adapter-side paths stay schema-
|
|
347
|
-
//
|
|
348
|
-
//
|
|
349
|
-
//
|
|
338
|
+
// Adapter-side paths stay schema-RELATIVE: the validation pipeline
|
|
339
|
+
// in `core/create-form-store.ts` prepends the parent path to
|
|
340
|
+
// absolutise, then routes form-level entries, those whose absolute
|
|
341
|
+
// path is empty, to the empty-string bucket at storage time.
|
|
350
342
|
path: issue.path.map((seg) => typeof seg === "number" ? seg : String(seg)),
|
|
351
343
|
code
|
|
352
344
|
};
|
|
@@ -372,7 +364,6 @@ const V4_INTROSPECTOR = {
|
|
|
372
364
|
return getArrayElement(schema);
|
|
373
365
|
},
|
|
374
366
|
getSetValueType: (schema) => kindOf(schema) === "set" ? getSetValueType(schema) : void 0,
|
|
375
|
-
getRecordKeyType: (schema) => kindOf(schema) === "record" ? getRecordKeyType(schema) : void 0,
|
|
376
367
|
getRecordValueType: (schema) => kindOf(schema) === "record" ? getRecordValueType(schema) : void 0,
|
|
377
368
|
getMapKeyType: (schema) => kindOf(schema) === "map" ? getMapKeyType(schema) : void 0,
|
|
378
369
|
getMapValueType: (schema) => kindOf(schema) === "map" ? getMapValueType(schema) : void 0,
|
|
@@ -387,7 +378,6 @@ const V4_INTROSPECTOR = {
|
|
|
387
378
|
unwrapPipeIn,
|
|
388
379
|
unwrapPipeOut,
|
|
389
380
|
unwrapLazy,
|
|
390
|
-
getLazyGetter,
|
|
391
381
|
getDefaultValue,
|
|
392
382
|
getCatchDefault,
|
|
393
383
|
hasCatchValue
|
|
@@ -398,15 +388,12 @@ function slimPrimitivesOf(schema, maxRecursionDepth) {
|
|
|
398
388
|
}
|
|
399
389
|
|
|
400
390
|
function deriveDefault(schema, useDefault, maxRecursionDepth) {
|
|
401
|
-
return deriveDefaultWalk(schema, useDefault, V4_INTROSPECTOR, maxRecursionDepth
|
|
402
|
-
// v4 has an exhaustive switch against `SchemaIntrospector.kindOf`;
|
|
403
|
-
// unknown kinds genuinely shouldn't appear, so return undefined.
|
|
404
|
-
unsupportedKindFallback: () => void 0
|
|
405
|
-
});
|
|
391
|
+
return deriveDefaultWalk(schema, useDefault, V4_INTROSPECTOR, maxRecursionDepth);
|
|
406
392
|
}
|
|
407
393
|
function getDefaultValuesFromZodSchema(opts) {
|
|
408
394
|
const { schema, useDefaultSchemaValues, constraints, maxRecursionDepth } = opts;
|
|
409
395
|
const initial = deriveDefault(schema, useDefaultSchemaValues, maxRecursionDepth);
|
|
396
|
+
if (constraints === void 0) return { data: initial, success: true };
|
|
410
397
|
const merged = mergeDeep(initial, constraints);
|
|
411
398
|
return fixStructuralDefaults(
|
|
412
399
|
schema,
|
|
@@ -438,137 +425,6 @@ function getNestedZodSchemasAtPath(schema, path, maxRecursionDepth) {
|
|
|
438
425
|
);
|
|
439
426
|
}
|
|
440
427
|
|
|
441
|
-
function carrySyncChecks(rebuilt, original) {
|
|
442
|
-
if (!hasChecks(original)) return rebuilt;
|
|
443
|
-
const checks = getChecks(original).filter((c) => !isAsyncCheck(c));
|
|
444
|
-
if (checks.length === 0) return rebuilt;
|
|
445
|
-
return rebuilt.check(
|
|
446
|
-
...checks
|
|
447
|
-
);
|
|
448
|
-
}
|
|
449
|
-
function stripAsyncChecks(schema) {
|
|
450
|
-
const seen = /* @__PURE__ */ new WeakSet();
|
|
451
|
-
function recurse(s) {
|
|
452
|
-
if (seen.has(s)) return s;
|
|
453
|
-
seen.add(s);
|
|
454
|
-
const kind = kindOf(s);
|
|
455
|
-
switch (kind) {
|
|
456
|
-
case "string":
|
|
457
|
-
return hasChecks(s) ? carrySyncChecks(z.string(), s) : s;
|
|
458
|
-
case "number":
|
|
459
|
-
return hasChecks(s) ? carrySyncChecks(z.number(), s) : s;
|
|
460
|
-
case "bigint":
|
|
461
|
-
return hasChecks(s) ? carrySyncChecks(z.bigint(), s) : s;
|
|
462
|
-
case "array": {
|
|
463
|
-
const element = getArrayElement(s);
|
|
464
|
-
return carrySyncChecks(z.array(recurse(element)), s);
|
|
465
|
-
}
|
|
466
|
-
case "set": {
|
|
467
|
-
return carrySyncChecks(z.set(recurse(getSetValueType(s))), s);
|
|
468
|
-
}
|
|
469
|
-
case "tuple": {
|
|
470
|
-
const items = getTupleItems(s).map(recurse);
|
|
471
|
-
const rebuilt = z.tuple(
|
|
472
|
-
items
|
|
473
|
-
);
|
|
474
|
-
return carrySyncChecks(rebuilt, s);
|
|
475
|
-
}
|
|
476
|
-
case "object": {
|
|
477
|
-
const shape = getObjectShape(s);
|
|
478
|
-
const next = {};
|
|
479
|
-
for (const [k, v] of Object.entries(shape)) {
|
|
480
|
-
next[k] = recurse(v);
|
|
481
|
-
}
|
|
482
|
-
return carrySyncChecks(z.object(next), s);
|
|
483
|
-
}
|
|
484
|
-
case "record": {
|
|
485
|
-
const keyType = getRecordKeyType(s);
|
|
486
|
-
const valueType = recurse(getRecordValueType(s));
|
|
487
|
-
return carrySyncChecks(
|
|
488
|
-
z.record(keyType, valueType),
|
|
489
|
-
s
|
|
490
|
-
);
|
|
491
|
-
}
|
|
492
|
-
case "union": {
|
|
493
|
-
const options = getUnionOptions(s).map(recurse);
|
|
494
|
-
return carrySyncChecks(
|
|
495
|
-
z.union(options),
|
|
496
|
-
s
|
|
497
|
-
);
|
|
498
|
-
}
|
|
499
|
-
case "discriminated-union": {
|
|
500
|
-
const options = getDiscriminatedOptions(s).map((opt) => recurse(opt));
|
|
501
|
-
const discriminator = getDiscriminator(s);
|
|
502
|
-
if (discriminator === void 0) return s;
|
|
503
|
-
return z.discriminatedUnion(
|
|
504
|
-
discriminator,
|
|
505
|
-
options
|
|
506
|
-
);
|
|
507
|
-
}
|
|
508
|
-
case "optional": {
|
|
509
|
-
const inner = unwrapInner(s);
|
|
510
|
-
return inner === void 0 ? s : recurse(inner).optional();
|
|
511
|
-
}
|
|
512
|
-
case "nullable": {
|
|
513
|
-
const inner = unwrapInner(s);
|
|
514
|
-
return inner === void 0 ? s : recurse(inner).nullable();
|
|
515
|
-
}
|
|
516
|
-
case "default": {
|
|
517
|
-
const inner = unwrapInner(s);
|
|
518
|
-
if (inner === void 0) return s;
|
|
519
|
-
return recurse(inner).default(getDefaultValue(s));
|
|
520
|
-
}
|
|
521
|
-
case "readonly": {
|
|
522
|
-
const inner = unwrapInner(s);
|
|
523
|
-
return inner === void 0 ? s : recurse(inner).readonly();
|
|
524
|
-
}
|
|
525
|
-
case "lazy": {
|
|
526
|
-
const inner = unwrapLazy(s);
|
|
527
|
-
if (inner === void 0) return s;
|
|
528
|
-
const stripped = recurse(inner);
|
|
529
|
-
return z.lazy(() => stripped);
|
|
530
|
-
}
|
|
531
|
-
case "intersection": {
|
|
532
|
-
const left = getIntersectionLeft(s);
|
|
533
|
-
const right = getIntersectionRight(s);
|
|
534
|
-
if (left === void 0 || right === void 0) return s;
|
|
535
|
-
return z.intersection(recurse(left), recurse(right));
|
|
536
|
-
}
|
|
537
|
-
case "catch": {
|
|
538
|
-
const inner = unwrapInner(s);
|
|
539
|
-
if (inner === void 0) return s;
|
|
540
|
-
return recurse(inner).catch(getCatchDefault(s));
|
|
541
|
-
}
|
|
542
|
-
// Pipes pass through (see the docblock); the rest are leaves
|
|
543
|
-
// whose checks the strip walker deliberately leaves in place —
|
|
544
|
-
// an async check on one of these still poisons the sync parse
|
|
545
|
-
// and the callers' defensive catch owns that case.
|
|
546
|
-
case "pipe":
|
|
547
|
-
case "boolean":
|
|
548
|
-
case "date":
|
|
549
|
-
case "enum":
|
|
550
|
-
case "literal":
|
|
551
|
-
case "null":
|
|
552
|
-
case "undefined":
|
|
553
|
-
case "any":
|
|
554
|
-
case "unknown":
|
|
555
|
-
case "nan":
|
|
556
|
-
case "void":
|
|
557
|
-
case "never":
|
|
558
|
-
case "promise":
|
|
559
|
-
case "custom":
|
|
560
|
-
case "template-literal":
|
|
561
|
-
case "transform":
|
|
562
|
-
case "file":
|
|
563
|
-
case "map":
|
|
564
|
-
case "symbol":
|
|
565
|
-
case "function":
|
|
566
|
-
return s;
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
return recurse(schema);
|
|
570
|
-
}
|
|
571
|
-
|
|
572
428
|
function unwrapStructuralWrappers(schema) {
|
|
573
429
|
let current = schema;
|
|
574
430
|
for (let i = 0; i < 64; i++) {
|
|
@@ -662,29 +518,28 @@ function isLeafRequired(schema, depth = 0) {
|
|
|
662
518
|
function zodV4Adapter(rootSchema) {
|
|
663
519
|
assertZodVersion(rootSchema);
|
|
664
520
|
assertKeyedRoot(rootSchema);
|
|
665
|
-
return (
|
|
521
|
+
return (_formKey, options) => sharedV4Schemas(
|
|
666
522
|
rootSchema,
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
523
|
+
options.maxRecursionDepth,
|
|
524
|
+
() => createAbstractSchema(
|
|
525
|
+
rootSchema,
|
|
526
|
+
V4_INTROSPECTOR,
|
|
527
|
+
buildV4Services(),
|
|
528
|
+
options
|
|
529
|
+
)
|
|
671
530
|
);
|
|
672
531
|
}
|
|
673
|
-
|
|
674
|
-
const { fingerprintZodSchema } = await import('../chunks/fingerprint2.mjs');
|
|
675
|
-
return fingerprintZodSchema(schema);
|
|
676
|
-
}
|
|
532
|
+
const sharedV4Schemas = createSharedSchemaStore();
|
|
677
533
|
function buildV4Services() {
|
|
678
534
|
return {
|
|
679
|
-
fingerprint: (schema) => lazyFingerprint(schema),
|
|
680
535
|
getNestedSchemasAtPath: (schema, path, maxRecursionDepth) => getNestedZodSchemasAtPath(schema, path, maxRecursionDepth),
|
|
681
|
-
//
|
|
682
|
-
//
|
|
683
|
-
//
|
|
536
|
+
// No pre-strip for the slim-mode walk: the path walker peels every
|
|
537
|
+
// transparent wrapper inline, so the slim and unstripped walks
|
|
538
|
+
// coincide.
|
|
684
539
|
getNestedSchemasInSlimMode: (schema, path, maxRecursionDepth) => getNestedZodSchemasAtPath(schema, path, maxRecursionDepth),
|
|
685
540
|
slimPrimitivesOf: (schema, maxRecursionDepth) => slimPrimitivesOf(schema, maxRecursionDepth),
|
|
686
541
|
deriveDefault: (schema, useDefault, maxRecursionDepth) => deriveDefault(schema, useDefault, maxRecursionDepth),
|
|
687
|
-
|
|
542
|
+
runGetDefaults: (schema, config, maxRecursionDepth) => runGetDefaultsV4(schema, config, maxRecursionDepth),
|
|
688
543
|
unwrapStructuralWrappers: (schema) => unwrapStructuralWrappers(schema),
|
|
689
544
|
unwrapToDiscriminatedUnion: (schema) => unwrapToDiscriminatedUnion(schema),
|
|
690
545
|
peelAllWrappers: (schema) => peelAllWrappers(schema),
|
|
@@ -699,47 +554,40 @@ function buildV4Services() {
|
|
|
699
554
|
const result = await schema.safeParseAsync(data);
|
|
700
555
|
return result.success ? { success: true, data: result.data } : { success: false, issues: result.error.issues };
|
|
701
556
|
},
|
|
702
|
-
makeSubSchema: (schema,
|
|
557
|
+
makeSubSchema: (schema, maxRecursionDepth) => buildSubSchemaStubV4(schema, maxRecursionDepth)
|
|
703
558
|
};
|
|
704
559
|
}
|
|
705
|
-
function
|
|
560
|
+
function runGetDefaultsV4(rootSchema, config, maxRecursionDepth) {
|
|
706
561
|
const { data } = getDefaultValuesFromZodSchema({
|
|
707
562
|
schema: rootSchema,
|
|
708
563
|
useDefaultSchemaValues: config.useDefaultSchemaValues,
|
|
709
564
|
constraints: config.constraints,
|
|
710
565
|
maxRecursionDepth
|
|
711
566
|
});
|
|
712
|
-
if (
|
|
713
|
-
return { data, errors: void 0, success: true
|
|
714
|
-
}
|
|
715
|
-
if (containsAsyncTransform(rootSchema)) {
|
|
716
|
-
return { data, errors: void 0, success: true, formKey };
|
|
567
|
+
if (containsAsyncTransform(rootSchema) || containsAsyncRefine(rootSchema)) {
|
|
568
|
+
return { data, errors: void 0, success: true };
|
|
717
569
|
}
|
|
718
|
-
const parseTarget = containsAsyncRefine(rootSchema) ? stripAsyncChecks(rootSchema) : rootSchema;
|
|
719
570
|
try {
|
|
720
|
-
const
|
|
721
|
-
if (
|
|
722
|
-
return { data, errors: void 0, success: true
|
|
571
|
+
const parseResult = rootSchema.safeParse(data);
|
|
572
|
+
if (parseResult.success) {
|
|
573
|
+
return { data, errors: void 0, success: true };
|
|
723
574
|
}
|
|
724
575
|
return {
|
|
725
576
|
data,
|
|
726
|
-
errors: zodIssuesToValidationErrors(
|
|
727
|
-
success: false
|
|
728
|
-
formKey
|
|
577
|
+
errors: zodIssuesToValidationErrors(parseResult.error.issues),
|
|
578
|
+
success: false
|
|
729
579
|
};
|
|
730
580
|
} catch {
|
|
731
|
-
return { data, errors: void 0, success: true
|
|
581
|
+
return { data, errors: void 0, success: true };
|
|
732
582
|
}
|
|
733
583
|
}
|
|
734
|
-
function buildSubSchemaStubV4(schema,
|
|
584
|
+
function buildSubSchemaStubV4(schema, maxRecursionDepth) {
|
|
735
585
|
return {
|
|
736
|
-
fingerprint: () => lazyFingerprint(schema),
|
|
737
586
|
needsAsyncValidation: () => containsAsyncRefine(schema),
|
|
738
587
|
getDefaultValues: () => ({
|
|
739
588
|
data: deriveDefault(schema, true, maxRecursionDepth),
|
|
740
589
|
errors: void 0,
|
|
741
|
-
success: true
|
|
742
|
-
formKey
|
|
590
|
+
success: true
|
|
743
591
|
}),
|
|
744
592
|
getSchemasAtPath: () => [],
|
|
745
593
|
validateAtPath: async (data) => {
|
|
@@ -748,15 +596,13 @@ function buildSubSchemaStubV4(schema, formKey, maxRecursionDepth) {
|
|
|
748
596
|
return {
|
|
749
597
|
data: result.data,
|
|
750
598
|
errors: void 0,
|
|
751
|
-
success: true
|
|
752
|
-
formKey
|
|
599
|
+
success: true
|
|
753
600
|
};
|
|
754
601
|
}
|
|
755
602
|
return {
|
|
756
603
|
data: void 0,
|
|
757
604
|
errors: zodIssuesToValidationErrors(result.error.issues),
|
|
758
|
-
success: false
|
|
759
|
-
formKey
|
|
605
|
+
success: false
|
|
760
606
|
};
|
|
761
607
|
}
|
|
762
608
|
};
|
|
@@ -808,4 +654,4 @@ function useForm(configuration) {
|
|
|
808
654
|
});
|
|
809
655
|
}
|
|
810
656
|
|
|
811
|
-
export { assertZodVersion as a,
|
|
657
|
+
export { assertZodVersion as a, kindOf as k, useForm as u, zodV4Adapter as z };
|
|
@@ -40,12 +40,6 @@ function normalizeErrorInputs(input, scope, defaultCode) {
|
|
|
40
40
|
const items = Array.isArray(input) ? input : [input];
|
|
41
41
|
return items.map((item) => normalizeErrorInput(item, scope, defaultCode));
|
|
42
42
|
}
|
|
43
|
-
function* cellEntriesFor(cells, side) {
|
|
44
|
-
for (const [key, cell] of cells) {
|
|
45
|
-
const list = cell[side];
|
|
46
|
-
if (list.length > 0) yield [key, list];
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
43
|
class RegistryNotInstalledError extends AttaformError {
|
|
50
44
|
constructor() {
|
|
51
45
|
super(
|
|
@@ -175,18 +169,6 @@ function pathKeyToDotted(key) {
|
|
|
175
169
|
if (segments === null) return null;
|
|
176
170
|
return segmentsToDotted(segments);
|
|
177
171
|
}
|
|
178
|
-
function coerceToPathKey(input) {
|
|
179
|
-
if (input.length > 0 && input.charCodeAt(0) === 91) {
|
|
180
|
-
try {
|
|
181
|
-
const parsed = JSON.parse(input);
|
|
182
|
-
if (Array.isArray(parsed) && parsed.every((s) => typeof s === "string" || typeof s === "number")) {
|
|
183
|
-
return input;
|
|
184
|
-
}
|
|
185
|
-
} catch {
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
return canonicalizePath(input).key;
|
|
189
|
-
}
|
|
190
172
|
const ROOT_PATH = Object.freeze([]);
|
|
191
173
|
const ROOT_PATH_KEY = "[]";
|
|
192
174
|
function isPathPrefix(prefix, path) {
|
|
@@ -204,4 +186,4 @@ function pathsEqual(a, b) {
|
|
|
204
186
|
return true;
|
|
205
187
|
}
|
|
206
188
|
|
|
207
|
-
export { AttaformError as A, InvalidPathError as I, OutsideSetupError as O, ROOT_PATH as R, SubmitErrorHandlerError as S, InvalidUseFormConfigError as a, ROOT_PATH_KEY as b, RegistryNotInstalledError as c, ReservedFormKeyError as d, canonicalizePath as e, pathsEqual as f, pathKeyToDotted as g, SET_MEMBER_SEGMENT as h, isPathPrefix as i,
|
|
189
|
+
export { AttaformError as A, InvalidPathError as I, OutsideSetupError as O, ROOT_PATH as R, SubmitErrorHandlerError as S, InvalidUseFormConfigError as a, ROOT_PATH_KEY as b, RegistryNotInstalledError as c, ReservedFormKeyError as d, canonicalizePath as e, pathsEqual as f, pathKeyToDotted as g, SET_MEMBER_SEGMENT as h, isPathPrefix as i, groupErrorsByKey as j, keyForSegments as k, normalizeErrorInputs as l, mapSegmentKeys as m, normalizeErrorInput as n, parseDottedPath as p, segmentsForPathKey as s, toError as t };
|