@adrekic/zod-fieldsjson 0.0.1 → 0.0.2-schema-improvements.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/dist/conditions/base.d.ts +2 -2
- package/dist/conditions/boolean.d.ts +2 -2
- package/dist/conditions/checkbox-list.d.ts +2 -2
- package/dist/conditions/date.d.ts +2 -2
- package/dist/conditions/index.d.ts +34 -34
- package/dist/conditions/multi-select.d.ts +2 -2
- package/dist/conditions/multi-string.d.ts +2 -2
- package/dist/conditions/number.d.ts +2 -2
- package/dist/conditions/otp.d.ts +2 -2
- package/dist/conditions/pass-fail.d.ts +2 -2
- package/dist/conditions/radio.d.ts +2 -2
- package/dist/conditions/rating.d.ts +2 -2
- package/dist/conditions/scan.d.ts +2 -2
- package/dist/conditions/select.d.ts +2 -2
- package/dist/conditions/string.d.ts +2 -2
- package/dist/conditions/text.d.ts +2 -2
- package/dist/conditions/time.d.ts +2 -2
- package/dist/conditions/upload.d.ts +2 -2
- package/dist/conditions/url.d.ts +2 -2
- package/dist/elements/index.d.ts +160 -162
- package/dist/elements/section.d.ts +133 -134
- package/dist/fields/base.d.ts +11 -11
- package/dist/fields/boolean.d.ts +3 -3
- package/dist/fields/checkbox-list.d.ts +3 -3
- package/dist/fields/date.d.ts +3 -3
- package/dist/fields/index.d.ts +61 -62
- package/dist/fields/multi-select.d.ts +3 -3
- package/dist/fields/multi-string.d.ts +5 -5
- package/dist/fields/number.d.ts +3 -3
- package/dist/fields/otp.d.ts +4 -7
- package/dist/fields/pass-fail.d.ts +3 -3
- package/dist/fields/radio.d.ts +3 -3
- package/dist/fields/rating.d.ts +4 -4
- package/dist/fields/scan.d.ts +3 -3
- package/dist/fields/select.d.ts +3 -3
- package/dist/fields/string.d.ts +5 -5
- package/dist/fields/text.d.ts +5 -5
- package/dist/fields/time.d.ts +3 -3
- package/dist/fields/upload.d.ts +5 -5
- package/dist/fields/url.d.ts +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +58 -67
- package/dist/schema.d.ts +99 -100
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -13,11 +13,11 @@ var t = (t, n, r) => e.object({
|
|
|
13
13
|
title: "Field identifier",
|
|
14
14
|
description: "Identifier of the field whose value is evaluated."
|
|
15
15
|
}),
|
|
16
|
-
|
|
16
|
+
value: n.meta({
|
|
17
17
|
title: "Comparison value",
|
|
18
18
|
description: "Value or range to compare against the referenced field value."
|
|
19
19
|
}),
|
|
20
|
-
|
|
20
|
+
modifier: r.meta({
|
|
21
21
|
title: "Comparison operator",
|
|
22
22
|
description: "Operator used to compare the referenced field value with the comparison value."
|
|
23
23
|
})
|
|
@@ -161,15 +161,15 @@ var t = (t, n, r) => e.object({
|
|
|
161
161
|
})
|
|
162
162
|
}), g = (t) => e.object({
|
|
163
163
|
...h(t).shape,
|
|
164
|
-
label: e.string().meta({
|
|
164
|
+
label: e.string().optional().meta({
|
|
165
165
|
title: "Field label",
|
|
166
166
|
description: "Display label for the field."
|
|
167
167
|
}),
|
|
168
|
-
description: e.string().
|
|
168
|
+
description: e.string().optional().meta({
|
|
169
169
|
title: "Field description",
|
|
170
|
-
description: "Optional help text for the field
|
|
170
|
+
description: "Optional help text for the field."
|
|
171
171
|
}),
|
|
172
|
-
required: e.boolean().meta({
|
|
172
|
+
required: e.boolean().optional().meta({
|
|
173
173
|
title: "Required",
|
|
174
174
|
description: "Whether the form requires a value for this field."
|
|
175
175
|
})
|
|
@@ -181,11 +181,11 @@ var t = (t, n, r) => e.object({
|
|
|
181
181
|
})
|
|
182
182
|
}), v = (t) => e.object({
|
|
183
183
|
...g(t).shape,
|
|
184
|
-
minimum_length: e.
|
|
184
|
+
minimum_length: e.int().nonnegative().optional().meta({
|
|
185
185
|
title: "Minimum length",
|
|
186
186
|
description: "Minimum number of characters allowed in the field value."
|
|
187
187
|
}),
|
|
188
|
-
maximum_length: e.
|
|
188
|
+
maximum_length: e.int().nonnegative().optional().meta({
|
|
189
189
|
title: "Maximum length",
|
|
190
190
|
description: "Maximum number of characters allowed in the field value."
|
|
191
191
|
}),
|
|
@@ -356,11 +356,11 @@ var t = (t, n, r) => e.object({
|
|
|
356
356
|
description: "A selection input allowing multiple options to be selected."
|
|
357
357
|
}), Ue = e.array(e.string()), z = e.literal("multi-string"), We = e.object({
|
|
358
358
|
...g(z).shape,
|
|
359
|
-
minimum_length: e.
|
|
359
|
+
minimum_length: e.int().nonnegative().optional().meta({
|
|
360
360
|
title: "Minimum entries",
|
|
361
361
|
description: "Minimum number of strings allowed in the list."
|
|
362
362
|
}),
|
|
363
|
-
maximum_length: e.
|
|
363
|
+
maximum_length: e.int().nonnegative().optional().meta({
|
|
364
364
|
title: "Maximum entries",
|
|
365
365
|
description: "Maximum number of strings allowed in the list."
|
|
366
366
|
}),
|
|
@@ -392,40 +392,31 @@ var t = (t, n, r) => e.object({
|
|
|
392
392
|
}).meta({
|
|
393
393
|
title: "Number field",
|
|
394
394
|
description: "A numeric input with optional bounds and an integer-only setting."
|
|
395
|
-
}), qe = e.number().nullable(),
|
|
396
|
-
"alpha",
|
|
397
|
-
"numeric",
|
|
398
|
-
"alphanumeric",
|
|
399
|
-
"none"
|
|
400
|
-
]).meta({
|
|
401
|
-
title: "Code validation mode",
|
|
402
|
-
description: "Allowed characters: alpha for letters, numeric for digits, alphanumeric for letters and digits, or none for no character restriction."
|
|
403
|
-
}), V = e.literal("otp"), Ye = e.object({
|
|
395
|
+
}), qe = e.number().nullable(), V = e.literal("otp"), Je = e.object({
|
|
404
396
|
...g(V).shape,
|
|
405
|
-
length: e.
|
|
397
|
+
length: e.int().positive().meta({
|
|
406
398
|
title: "Code length",
|
|
407
399
|
description: "Number of characters in the code."
|
|
408
|
-
})
|
|
409
|
-
validationType: Je
|
|
400
|
+
})
|
|
410
401
|
}).meta({
|
|
411
402
|
title: "One-time password field",
|
|
412
403
|
description: "A code input with a configured length and character validation mode."
|
|
413
|
-
}),
|
|
404
|
+
}), Ye = e.string(), H = e.literal("radio"), Xe = _(H).meta({
|
|
414
405
|
title: "Radio field",
|
|
415
406
|
description: "A group of radio options allowing one option to be selected."
|
|
416
|
-
}),
|
|
407
|
+
}), Ze = e.string().nullable(), U = e.literal("rating"), Qe = e.object({
|
|
417
408
|
...g(U).shape,
|
|
418
|
-
maxRating: e.
|
|
409
|
+
maxRating: e.int().positive().meta({
|
|
419
410
|
title: "Maximum rating",
|
|
420
411
|
description: "Highest rating available in the input."
|
|
421
412
|
})
|
|
422
413
|
}).meta({
|
|
423
414
|
title: "Rating field",
|
|
424
415
|
description: "A rating input with a configured maximum rating."
|
|
425
|
-
}),
|
|
416
|
+
}), $e = e.number().nullable(), W = e.literal("qr"), et = g(W).meta({
|
|
426
417
|
title: "QR scan field",
|
|
427
418
|
description: "An input for a value read from a QR code."
|
|
428
|
-
}),
|
|
419
|
+
}), tt = e.string(), G = e.literal("select"), nt = e.object({
|
|
429
420
|
..._(G).shape,
|
|
430
421
|
placeholder: e.string().optional().meta({
|
|
431
422
|
title: "Placeholder",
|
|
@@ -434,33 +425,33 @@ var t = (t, n, r) => e.object({
|
|
|
434
425
|
}).meta({
|
|
435
426
|
title: "Select field",
|
|
436
427
|
description: "A selection input allowing one option to be selected."
|
|
437
|
-
}),
|
|
428
|
+
}), rt = e.string().nullable(), K = e.literal("string"), it = v(K).meta({
|
|
438
429
|
title: "String field",
|
|
439
430
|
description: "A single-line text input with optional character limits and a placeholder."
|
|
440
|
-
}),
|
|
431
|
+
}), at = e.string(), q = e.literal("text"), ot = v(q).meta({
|
|
441
432
|
title: "Text field",
|
|
442
433
|
description: "A multiline text input with optional character limits and a placeholder."
|
|
443
|
-
}),
|
|
434
|
+
}), st = e.string(), J = e.literal("time"), ct = g(J).meta({
|
|
444
435
|
title: "Time field",
|
|
445
436
|
description: "An input for a time value with a UTC offset."
|
|
446
|
-
}),
|
|
437
|
+
}), lt = s.nullable(), Y = e.literal("upload"), ut = e.object({
|
|
447
438
|
...g(Y).shape,
|
|
448
439
|
extensions: e.array(e.string()).optional().meta({
|
|
449
440
|
title: "Allowed extensions",
|
|
450
441
|
description: "File extensions accepted by the upload input."
|
|
451
442
|
}),
|
|
452
|
-
maximum_size: e.
|
|
443
|
+
maximum_size: e.int().nonnegative().optional().meta({
|
|
453
444
|
title: "Maximum file size",
|
|
454
445
|
description: "Configured size limit for uploaded files."
|
|
455
446
|
}),
|
|
456
|
-
maximum_files: e.
|
|
447
|
+
maximum_files: e.int().nonnegative().optional().meta({
|
|
457
448
|
title: "Maximum files",
|
|
458
449
|
description: "Maximum number of files allowed in the upload input."
|
|
459
450
|
})
|
|
460
451
|
}).meta({
|
|
461
452
|
title: "Upload field",
|
|
462
453
|
description: "A file upload input with optional extension, size, and file-count limits."
|
|
463
|
-
}),
|
|
454
|
+
}), dt = e.tuple([]), X = e.literal("url"), ft = e.object({
|
|
464
455
|
...g(X).shape,
|
|
465
456
|
placeholder: e.string().optional().meta({
|
|
466
457
|
title: "Placeholder",
|
|
@@ -469,7 +460,7 @@ var t = (t, n, r) => e.object({
|
|
|
469
460
|
}).meta({
|
|
470
461
|
title: "URL field",
|
|
471
462
|
description: "An input for a URL string with an optional placeholder."
|
|
472
|
-
}),
|
|
463
|
+
}), pt = e.string().nullable(), mt = e.union([
|
|
473
464
|
P,
|
|
474
465
|
I,
|
|
475
466
|
L,
|
|
@@ -494,52 +485,52 @@ var t = (t, n, r) => e.object({
|
|
|
494
485
|
He,
|
|
495
486
|
We,
|
|
496
487
|
Ke,
|
|
497
|
-
|
|
488
|
+
Je,
|
|
498
489
|
ge,
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
490
|
+
Xe,
|
|
491
|
+
Qe,
|
|
492
|
+
et,
|
|
493
|
+
nt,
|
|
494
|
+
it,
|
|
495
|
+
ot,
|
|
496
|
+
ct,
|
|
497
|
+
ut,
|
|
498
|
+
ft
|
|
508
499
|
]).meta({
|
|
509
500
|
title: "Field",
|
|
510
501
|
description: "Configuration for an input field, selected by its type discriminator."
|
|
511
|
-
}),
|
|
502
|
+
}), ht = e.union([
|
|
512
503
|
Le,
|
|
513
504
|
ze,
|
|
514
505
|
Ve,
|
|
515
506
|
Ue,
|
|
516
507
|
Ge,
|
|
517
508
|
qe,
|
|
518
|
-
|
|
509
|
+
Ye,
|
|
519
510
|
_e,
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
]),
|
|
530
|
-
title: "Section conditions",
|
|
531
|
-
description: "Conditions stored on the source section for target sections that depend on it. Each key is the identifier of another section (the target section), and each value is a list of conditions based on fields contained in the source section."
|
|
532
|
-
}), $ = e.object({
|
|
511
|
+
Ze,
|
|
512
|
+
$e,
|
|
513
|
+
tt,
|
|
514
|
+
rt,
|
|
515
|
+
at,
|
|
516
|
+
st,
|
|
517
|
+
lt,
|
|
518
|
+
dt,
|
|
519
|
+
pt
|
|
520
|
+
]), gt = e.record(e.string(), ht), Q = e.literal("section"), _t = e.record(e.string(), e.array(Ie)), $ = e.object({
|
|
533
521
|
...h(Q).shape,
|
|
534
|
-
label: e.string().
|
|
522
|
+
label: e.string().optional().meta({
|
|
535
523
|
title: "Section label",
|
|
536
524
|
description: "Display label for the section, or null for an unlabeled section."
|
|
537
525
|
}),
|
|
538
|
-
description: e.string().
|
|
526
|
+
description: e.string().optional().meta({
|
|
539
527
|
title: "Section description",
|
|
540
528
|
description: "Optional help text for the section; may be null."
|
|
541
529
|
}),
|
|
542
|
-
conditions:
|
|
530
|
+
conditions: _t.optional().meta({
|
|
531
|
+
title: "Section conditions",
|
|
532
|
+
description: "Conditions stored on the source section for target sections that depend on it. Each key is the identifier of another section (the target section), and each value is a list of conditions based on fields contained in the source section."
|
|
533
|
+
}),
|
|
543
534
|
fields: e.array(Z).meta({
|
|
544
535
|
title: "Fields",
|
|
545
536
|
description: "Fields in this section, in display order."
|
|
@@ -547,15 +538,15 @@ var t = (t, n, r) => e.object({
|
|
|
547
538
|
}).meta({
|
|
548
539
|
title: "Section",
|
|
549
540
|
description: "A labeled group of fields with optional help text and associated conditions."
|
|
550
|
-
}),
|
|
541
|
+
}), vt = e.union([mt, Q]).meta({
|
|
551
542
|
title: "Element type",
|
|
552
543
|
description: "Supported field and section types."
|
|
553
|
-
}),
|
|
544
|
+
}), yt = e.discriminatedUnion("type", [$, Z]).meta({
|
|
554
545
|
title: "Element",
|
|
555
546
|
description: "A field or section, selected by its type discriminator."
|
|
556
|
-
}),
|
|
547
|
+
}), bt = e.array($).meta({
|
|
557
548
|
title: "Field schema",
|
|
558
549
|
description: "An ordered collection of sections defining a form, its fields, and its conditions."
|
|
559
550
|
});
|
|
560
551
|
//#endregion
|
|
561
|
-
export { t as BaseJSONConditionSchema, h as BaseJSONFieldElementSchema, g as BaseJSONFieldSchema, _ as BaseJSONOptionsFieldSchema, v as BaseJSONStringFieldSchema, r as JSONBooleanConditionModifierSchema, ee as JSONBooleanConditionSchema, n as JSONBooleanConditionTypeSchema, F as JSONBooleanFieldSchema, P as JSONBooleanFieldTypeSchema, Le as JSONBooleanFieldValueSchema, te as JSONCheckboxListConditionModifierSchema, ne as JSONCheckboxListConditionSchema, i as JSONCheckboxListConditionTypeSchema, Re as JSONCheckboxListFieldSchema, I as JSONCheckboxListFieldTypeSchema, ze as JSONCheckboxListFieldValueSchema, Ie as JSONConditionSchema, Fe as JSONConditionTypeSchema, ce as JSONDateConditionModifierSchema, le as JSONDateConditionSchema, c as JSONDateConditionTypeSchema, Be as JSONDateFieldSchema, L as JSONDateFieldTypeSchema, Ve as JSONDateFieldValueSchema, se as JSONDateRangeSchema,
|
|
552
|
+
export { t as BaseJSONConditionSchema, h as BaseJSONFieldElementSchema, g as BaseJSONFieldSchema, _ as BaseJSONOptionsFieldSchema, v as BaseJSONStringFieldSchema, r as JSONBooleanConditionModifierSchema, ee as JSONBooleanConditionSchema, n as JSONBooleanConditionTypeSchema, F as JSONBooleanFieldSchema, P as JSONBooleanFieldTypeSchema, Le as JSONBooleanFieldValueSchema, te as JSONCheckboxListConditionModifierSchema, ne as JSONCheckboxListConditionSchema, i as JSONCheckboxListConditionTypeSchema, Re as JSONCheckboxListFieldSchema, I as JSONCheckboxListFieldTypeSchema, ze as JSONCheckboxListFieldValueSchema, Ie as JSONConditionSchema, Fe as JSONConditionTypeSchema, ce as JSONDateConditionModifierSchema, le as JSONDateConditionSchema, c as JSONDateConditionTypeSchema, Be as JSONDateFieldSchema, L as JSONDateFieldTypeSchema, Ve as JSONDateFieldValueSchema, se as JSONDateRangeSchema, yt as JSONFieldElementSchema, vt as JSONFieldElementTypeSchema, Z as JSONFieldSchema, bt as JSONFieldSchemaSchema, _t as JSONFieldSectionConditionsSchema, $ as JSONFieldSectionSchema, Q as JSONFieldSectionTypeSchema, mt as JSONFieldTypeSchema, ht as JSONFieldValueSchema, gt as JSONFieldValuesSchema, ue as JSONMultiSelectConditionModifierSchema, de as JSONMultiSelectConditionSchema, l as JSONMultiSelectConditionTypeSchema, He as JSONMultiSelectFieldSchema, R as JSONMultiSelectFieldTypeSchema, Ue as JSONMultiSelectFieldValueSchema, d as JSONMultiStringConditionModifierSchema, f as JSONMultiStringConditionSchema, u as JSONMultiStringConditionTypeSchema, We as JSONMultiStringFieldSchema, z as JSONMultiStringFieldTypeSchema, Ge as JSONMultiStringFieldValueSchema, fe as JSONNumberConditionModifierSchema, pe as JSONNumberConditionSchema, p as JSONNumberConditionTypeSchema, Ke as JSONNumberFieldSchema, B as JSONNumberFieldTypeSchema, qe as JSONNumberFieldValueSchema, me as JSONOTPConditionModifierSchema, he as JSONOTPConditionSchema, m as JSONOTPConditionTypeSchema, Je as JSONOTPFieldSchema, V as JSONOTPFieldTypeSchema, Ye as JSONOTPFieldValueSchema, x as JSONPassFailConditionTypeSchema, ve as JSONPassFailFieldConditionModifierSchema, ye as JSONPassFailFieldConditionSchema, ge as JSONPassFailFieldSchema, b as JSONPassFailFieldTypeSchema, _e as JSONPassFailFieldValueSchema, be as JSONRadioConditionModifierSchema, xe as JSONRadioConditionSchema, S as JSONRadioConditionTypeSchema, Xe as JSONRadioFieldSchema, H as JSONRadioFieldTypeSchema, Ze as JSONRadioFieldValueSchema, Se as JSONRatingConditionModifierSchema, Ce as JSONRatingConditionSchema, C as JSONRatingConditionTypeSchema, Qe as JSONRatingFieldSchema, U as JSONRatingFieldTypeSchema, $e as JSONRatingFieldValueSchema, we as JSONScanConditionModifierSchema, T as JSONScanConditionSchema, w as JSONScanConditionTypeSchema, et as JSONScanFieldSchema, W as JSONScanFieldTypeSchema, tt as JSONScanFieldValueSchema, D as JSONSelectConditionModifierSchema, O as JSONSelectConditionSchema, E as JSONSelectConditionTypeSchema, nt as JSONSelectFieldSchema, G as JSONSelectFieldTypeSchema, rt as JSONSelectFieldValueSchema, Te as JSONStringConditionModifierSchema, Ee as JSONStringConditionSchema, k as JSONStringConditionTypeSchema, it as JSONStringFieldSchema, K as JSONStringFieldTypeSchema, at as JSONStringFieldValueSchema, De as JSONTextConditionModifierSchema, Oe as JSONTextConditionSchema, A as JSONTextConditionTypeSchema, ot as JSONTextFieldSchema, q as JSONTextFieldTypeSchema, st as JSONTextFieldValueSchema, ke as JSONTimeConditionModifierSchema, Ae as JSONTimeConditionSchema, j as JSONTimeConditionTypeSchema, ct as JSONTimeFieldSchema, J as JSONTimeFieldTypeSchema, lt as JSONTimeFieldValueSchema, Ne as JSONURLConditionModifierSchema, Pe as JSONURLConditionSchema, N as JSONURLConditionTypeSchema, ft as JSONURLFieldSchema, X as JSONURLFieldTypeSchema, pt as JSONURLFieldValueSchema, je as JSONUploadConditionModifierSchema, Me as JSONUploadConditionSchema, M as JSONUploadConditionTypeSchema, ut as JSONUploadFieldSchema, Y as JSONUploadFieldTypeSchema, dt as JSONUploadFieldValueSchema, a as NumberRangeSchema, y as PassFailFieldStatusSchema, re as SelectFieldOptionSchema, oe as TimeRangeSchema, s as TimeSchema, ae as UTCOffsetSchema, ie as UTCOffsetSignSchema, o as UTCOffsetTimeSchema };
|