@uides/stepwise 1.1.0-d0adc9fb → 2.0.0-07ee8440

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.
Files changed (70) hide show
  1. package/.rush/temp/chunked-rush-logs/stepwise.build.chunks.jsonl +1 -1
  2. package/.rush/temp/package-deps_build.json +67 -67
  3. package/.rush/temp/shrinkwrap-deps.json +2 -2
  4. package/package.json +6 -6
  5. package/rush-logs/stepwise.build.log +1 -1
  6. package/src/schemas/__tests__/step.spec.ts +2 -4
  7. package/src/schemas/action.ts +132 -131
  8. package/src/schemas/application.ts +7 -8
  9. package/src/schemas/attributes.ts +1 -1
  10. package/src/schemas/common.ts +15 -82
  11. package/src/schemas/document.ts +53 -49
  12. package/src/schemas/edupass-healthstate.ts +47 -44
  13. package/src/schemas/field/afm/index.ts +11 -12
  14. package/src/schemas/field/amka/index.ts +10 -9
  15. package/src/schemas/field/attachment/index.ts +21 -20
  16. package/src/schemas/field/captcha/index.ts +8 -7
  17. package/src/schemas/field/choice/index.ts +20 -19
  18. package/src/schemas/field/common.spec.ts +7 -13
  19. package/src/schemas/field/common.ts +103 -85
  20. package/src/schemas/field/date/index.ts +24 -23
  21. package/src/schemas/field/doc_subtitle/index.ts +10 -9
  22. package/src/schemas/field/doc_title/index.ts +18 -17
  23. package/src/schemas/field/dynamically-filled-text/index.ts +26 -24
  24. package/src/schemas/field/email/index.ts +12 -11
  25. package/src/schemas/field/fillable-string/index.ts +18 -17
  26. package/src/schemas/field/five-block-date/index.ts +8 -7
  27. package/src/schemas/field/green-pass-qrcode/index.ts +14 -15
  28. package/src/schemas/field/hidden/index.ts +58 -64
  29. package/src/schemas/field/hierarchical-selector/index.ts +27 -25
  30. package/src/schemas/field/iban/index.ts +11 -10
  31. package/src/schemas/field/image/index.ts +19 -18
  32. package/src/schemas/field/index.spec.ts +17 -19
  33. package/src/schemas/field/index.ts +176 -85
  34. package/src/schemas/field/int/index.ts +11 -10
  35. package/src/schemas/field/lab-results/index.ts +9 -8
  36. package/src/schemas/field/landline_phone/index.ts +8 -7
  37. package/src/schemas/field/mobile_phone/index.ts +12 -11
  38. package/src/schemas/field/multiple-choice/index.ts +15 -14
  39. package/src/schemas/field/pdf-image/index.ts +14 -13
  40. package/src/schemas/field/postal_code/index.ts +9 -8
  41. package/src/schemas/field/qrcode/index.ts +18 -17
  42. package/src/schemas/field/quote/index.ts +18 -17
  43. package/src/schemas/field/radio-choice/index.ts +21 -15
  44. package/src/schemas/field/rate/index.ts +10 -9
  45. package/src/schemas/field/recipient/index.ts +11 -10
  46. package/src/schemas/field/redirect/index.ts +12 -11
  47. package/src/schemas/field/refcode/index.ts +25 -24
  48. package/src/schemas/field/string/index.ts +42 -41
  49. package/src/schemas/field/text/index.ts +23 -22
  50. package/src/schemas/field/three-block-date/index.ts +15 -14
  51. package/src/schemas/fieldset/component-params.ts +40 -37
  52. package/src/schemas/fieldset/display-components.ts +42 -49
  53. package/src/schemas/fieldset/enums.ts +12 -6
  54. package/src/schemas/fieldset/index.ts +9 -10
  55. package/src/schemas/layout.ts +43 -32
  56. package/src/schemas/outputs.ts +7 -6
  57. package/src/schemas/resource/enums.ts +6 -6
  58. package/src/schemas/resource/field.ts +10 -8
  59. package/src/schemas/resource/object-action.ts +21 -16
  60. package/src/schemas/resource/resource-action.ts +19 -17
  61. package/src/schemas/resource/resource.ts +19 -20
  62. package/src/schemas/step.ts +116 -115
  63. package/src/schemas/template/enums.ts +2 -2
  64. package/src/schemas/template/template-base.ts +15 -13
  65. package/src/schemas/template/template-source.ts +12 -13
  66. package/src/schemas/template/template.ts +12 -13
  67. package/src/schemas/validation-context/enums.ts +5 -5
  68. package/src/schemas/validation-context/validation-context.ts +45 -44
  69. package/src/utils/index.spec.ts +2 -0
  70. package/src/utils/index.ts +5 -3
@@ -1,57 +1,54 @@
1
1
  import * as v from 'valibot';
2
2
  import {
3
- DisplayMode,
4
3
  DisplayLang,
5
- nullish,
6
- object,
7
- specialWithNestedSchema,
4
+ DisplayModeSchema,
5
+ DisplayLangSchema as BaseDisplayLangSchema,
8
6
  } from '@uides/stepwise/schemas/common';
9
7
  import { resolveDisplay } from '@uides/stepwise/schemas/resolve';
10
8
 
11
9
  // TODO: Make default lang mandatory?
12
- const DisplayLangSchema = v.record(DisplayLang, v.any(), [
13
- v.custom((val) => {
10
+ const FieldDisplayLangSchema = v.pipe(
11
+ v.record(BaseDisplayLangSchema, v.any()),
12
+ v.check((val) => {
14
13
  if (!val) return false;
15
14
  if (Object.keys(val).length === 0) return false;
16
15
  return true;
17
- }, 'At least one display lang must be defined.'),
18
- ]);
16
+ }, 'At least one display lang must be defined.')
17
+ );
19
18
 
20
19
  // TODO: Make default mode mandatory?
21
- export const DisplayModeAndLangSchema = v.record(
22
- DisplayMode,
23
- DisplayLangSchema,
24
- [
25
- v.custom((val) => {
26
- if (!val) return false;
27
- if (Object.keys(val).length === 0) return false;
28
- return true;
29
- }, 'At least one display mode must be defined.'),
30
- ]
20
+ export const DisplayModeAndLangSchema = v.pipe(
21
+ v.record(DisplayModeSchema, FieldDisplayLangSchema),
22
+ v.check((val) => {
23
+ if (!val) return false;
24
+ if (Object.keys(val).length === 0) return false;
25
+ return true;
26
+ }, 'At least one display mode must be defined.')
31
27
  );
32
28
 
33
- type AnyBaseSchema = v.BaseSchema<unknown, unknown>;
29
+ type AnyGenericSchema = v.GenericSchema<unknown, unknown>;
30
+
34
31
  export interface DisplayType<
35
- DefaultDisplaySchema extends AnyBaseSchema = AnyBaseSchema,
36
- WebDisplaySchema extends AnyBaseSchema = AnyBaseSchema,
37
- PdfDisplaySchema extends AnyBaseSchema = AnyBaseSchema,
32
+ DefaultDisplaySchema extends AnyGenericSchema,
33
+ WebDisplaySchema extends AnyGenericSchema = AnyGenericSchema,
34
+ PdfDisplaySchema extends AnyGenericSchema = AnyGenericSchema,
38
35
  > {
39
36
  default?: Partial<
40
37
  Record<
41
38
  DisplayLang,
42
- v.Output<DefaultDisplaySchema> | (unknown & Record<never, never>)
39
+ v.InferOutput<DefaultDisplaySchema> | (unknown & Record<never, never>)
43
40
  >
44
41
  >;
45
42
  web?: Partial<
46
43
  Record<
47
44
  DisplayLang,
48
- v.Output<WebDisplaySchema> | (unknown & Record<never, never>)
45
+ v.InferOutput<WebDisplaySchema> | (unknown & Record<never, never>)
49
46
  >
50
47
  >;
51
48
  pdf?: Partial<
52
49
  Record<
53
50
  DisplayLang,
54
- v.Output<PdfDisplaySchema> | (unknown & Record<never, never>)
51
+ v.InferOutput<PdfDisplaySchema> | (unknown & Record<never, never>)
55
52
  >
56
53
  >;
57
54
  }
@@ -61,77 +58,98 @@ export function createFieldDisplay<
61
58
  D extends v.ObjectEntries,
62
59
  P extends v.ObjectEntries = never,
63
60
  >(
64
- DefaultDisplay: v.ObjectSchema<D, v.NeverSchema>,
65
- PdfDisplay?: v.ObjectSchema<P, v.NeverSchema>
61
+ DefaultDisplay: v.StrictObjectSchema<D, undefined>,
62
+ PdfDisplay?: v.StrictObjectSchema<P, undefined>
66
63
  ) {
64
+ const defaultDisplayContent = v.strictObject({
65
+ ...FieldDisplayModeBaseSchema.entries,
66
+ ...DefaultDisplay.entries,
67
+ });
67
68
  const defaultDisplaySchema = v.record(
68
69
  v.string(),
69
- v.record(
70
- object({
71
- ...FieldDisplayModeBase.entries,
72
- ...DefaultDisplay.entries,
73
- })
74
- )
70
+ v.record(v.string(), defaultDisplayContent)
75
71
  );
72
+
73
+ const pdfDisplayContent = v.strictObject({
74
+ ...FieldDisplayModeBaseSchema.entries,
75
+ ...v.partial(DefaultDisplay).entries,
76
+ ...PdfDisplay?.entries,
77
+ });
76
78
  const pdfDisplaySchema = v.record(
77
79
  v.string(),
78
- v.record(
79
- object({
80
- ...FieldDisplayModeBase.entries,
81
- ...v.partial(DefaultDisplay).entries,
82
- ...PdfDisplay?.entries,
83
- })
84
- )
80
+ v.record(v.string(), pdfDisplayContent)
85
81
  );
86
- const DisplaySchema = specialWithNestedSchema<
87
- DisplayType<
88
- typeof defaultDisplaySchema,
89
- typeof defaultDisplaySchema,
90
- typeof pdfDisplaySchema
91
- >
92
- >((display) => {
93
- if (!display) return undefined;
94
- let issues: v.SchemaIssues | undefined;
95
- DisplayMode.options.forEach((displayMode) => {
96
- if (!display[displayMode]) return;
97
- Object.keys(display[displayMode] as NonNullable<unknown>).forEach(
98
- (displayLang) => {
99
- const resolvedDisplay = resolveDisplay(
100
- displayMode,
101
- displayLang as DisplayLang,
102
- display
103
- );
104
- const displaySchema =
105
- displayMode === 'pdf' ? pdfDisplaySchema : defaultDisplaySchema;
106
- const result = v.safeParse(displaySchema, {
107
- [displayMode]: {
108
- [displayLang]: resolvedDisplay,
109
- },
110
- });
111
- if (result.issues) {
112
- issues?.push(...result.issues);
113
- }
114
- if (!issues) {
115
- issues = result.issues;
82
+
83
+ const DisplaySchema = v.pipe(
84
+ v.record(v.string(), v.any()), // TODO: Unnecessary?
85
+ v.rawCheck<
86
+ DisplayType<
87
+ typeof defaultDisplayContent,
88
+ typeof defaultDisplayContent,
89
+ typeof pdfDisplayContent
90
+ >
91
+ >(({ addIssue, dataset }) => {
92
+ const display = dataset.value;
93
+ if (!(display && typeof display === 'object')) {
94
+ addIssue({
95
+ message: 'Display must be an object.',
96
+ });
97
+ return;
98
+ }
99
+
100
+ DisplayModeSchema.options.forEach((displayMode) => {
101
+ if (
102
+ !(
103
+ displayMode in display &&
104
+ display[displayMode as keyof typeof display]
105
+ )
106
+ )
107
+ return;
108
+ Object.keys(display[displayMode as keyof typeof display]).forEach(
109
+ (displayLang) => {
110
+ const resolvedDisplay = resolveDisplay(
111
+ displayMode,
112
+ displayLang as DisplayLang,
113
+ display
114
+ );
115
+ const displaySchema =
116
+ displayMode === 'pdf' ? pdfDisplaySchema : defaultDisplaySchema;
117
+ const result = v.safeParse(displaySchema, {
118
+ [displayMode]: {
119
+ [displayLang]: resolvedDisplay,
120
+ },
121
+ });
122
+ if (result.issues) {
123
+ // TODO: Add subissues
124
+ result.issues.forEach((issue) => {
125
+ addIssue({
126
+ message: issue.message,
127
+ path: issue.path,
128
+ input: issue.input,
129
+ expected: issue.expected ?? undefined,
130
+ received: issue.received,
131
+ label: 'Display schema',
132
+ });
133
+ });
134
+ }
116
135
  }
117
- }
118
- );
119
- });
120
- return issues;
121
- });
136
+ );
137
+ });
138
+ })
139
+ );
122
140
  return DisplaySchema;
123
141
  }
124
142
 
125
- const FieldDisplayModeBase = object({
126
- title: nullish(v.string()),
127
- title_md: nullish(v.number()),
128
- value_md: nullish(v.number()),
129
- hint: nullish(v.string()),
130
- hint_md: nullish(v.string()),
131
- template_hint: nullish(v.string()),
132
- example: nullish(v.string()),
133
- layout: nullish(
134
- object({
143
+ const FieldDisplayModeBaseSchema = v.strictObject({
144
+ title: v.nullish(v.string()),
145
+ title_md: v.nullish(v.number()),
146
+ value_md: v.nullish(v.number()),
147
+ hint: v.nullish(v.string()),
148
+ hint_md: v.nullish(v.string()),
149
+ template_hint: v.nullish(v.string()),
150
+ example: v.nullish(v.string()),
151
+ layout: v.nullish(
152
+ v.strictObject({
135
153
  md: v.string(),
136
154
  })
137
155
  ),
@@ -1,19 +1,18 @@
1
1
  import * as v from 'valibot';
2
- import { nullish, object } from '@uides/stepwise/schemas/common';
3
2
  import { createFieldDisplay } from '@uides/stepwise/schemas/field/common';
4
3
 
5
- const DateDisplay = createFieldDisplay(
6
- object({
4
+ const DateDisplaySchema = createFieldDisplay(
5
+ v.strictObject({
7
6
  component: v.literal('date'),
8
- 'component-params': nullish(
9
- object({
10
- 'format-title': nullish(v.boolean()),
11
- cell_valign: nullish(v.picklist(['BOTTOM', 'MIDDLE', 'TOP'])),
12
- bold: nullish(v.boolean()),
13
- position: nullish(v.picklist(['left', 'right', 'center', 'justify'])),
14
- textColor: nullish(v.string()),
15
- labels: nullish(
16
- object({
7
+ 'component-params': v.nullish(
8
+ v.strictObject({
9
+ 'format-title': v.nullish(v.boolean()),
10
+ cell_valign: v.nullish(v.picklist(['BOTTOM', 'MIDDLE', 'TOP'])),
11
+ bold: v.nullish(v.boolean()),
12
+ position: v.nullish(v.picklist(['left', 'right', 'center', 'justify'])),
13
+ textColor: v.nullish(v.string()),
14
+ labels: v.nullish(
15
+ v.strictObject({
17
16
  day: v.string(),
18
17
  month: v.string(),
19
18
  year: v.string(),
@@ -24,7 +23,7 @@ const DateDisplay = createFieldDisplay(
24
23
  })
25
24
  );
26
25
 
27
- const DateAttribute = nullish(
26
+ const DateAttributeSchema = v.nullish(
28
27
  v.picklist([
29
28
  'covid19_negative_test_2:birthDate',
30
29
  'covid19_negative_test_2:dateOfResult',
@@ -45,22 +44,24 @@ const DateAttribute = nullish(
45
44
  ])
46
45
  );
47
46
 
48
- const DateField = object({
47
+ const DateSchema = v.strictObject({
49
48
  'user-input-mode': v.picklist(['noinput', 'required']),
50
- display: DateDisplay,
51
- attribute: DateAttribute,
52
- sources: nullish(v.literal('declaration:timestamp')),
53
- datatype: nullish(v.picklist(['date', 'string'])),
54
- 'value-constructor': nullish(
49
+ display: DateDisplaySchema,
50
+ attribute: DateAttributeSchema,
51
+ sources: v.nullish(v.literal('declaration:timestamp')),
52
+ datatype: v.nullish(v.picklist(['date', 'string'])),
53
+ 'value-constructor': v.nullish(
55
54
  v.picklist([
56
55
  'dilosi.interop_logic.common.get_local_date',
57
56
  'dilosi.interop_logic.common.get_local_date_time',
58
57
  'dilosi.interop_logic.common.get_local_date_time_sec',
59
58
  ])
60
59
  ),
61
- value: nullish(v.string()),
62
- 'is-display-field': nullish(v.boolean()),
60
+ value: v.nullish(v.string()),
61
+ 'is-display-field': v.nullish(v.boolean()),
63
62
  });
64
- export type DateFieldType = v.BaseSchema<v.Output<typeof DateField>>;
65
63
 
66
- export default DateField as DateFieldType;
64
+ export type DateType = v.InferOutput<typeof DateSchema>;
65
+ export type DateSchemaType = v.GenericSchema<DateType>;
66
+
67
+ export default DateSchema as DateSchemaType;
@@ -1,19 +1,20 @@
1
1
  import * as v from 'valibot';
2
- import { nullish, object } from '@uides/stepwise/schemas/common';
3
2
  import { createFieldDisplay } from '@uides/stepwise/schemas/field/common';
4
3
 
5
- const DocSubtitleDisplay = createFieldDisplay(
6
- object({
4
+ const DocSubtitleDisplaySchema = createFieldDisplay(
5
+ v.strictObject({
7
6
  component: v.literal('doc_subtitle'),
8
7
  })
9
8
  );
10
9
 
11
- const DocSubtitle = object({
12
- display: DocSubtitleDisplay,
10
+ const DocSubtitleSchema = v.strictObject({
11
+ display: DocSubtitleDisplaySchema,
13
12
  'user-input-mode': v.literal('noinput'),
14
- value: nullish(v.string()),
15
- datatype: nullish(v.literal('string')),
13
+ value: v.nullish(v.string()),
14
+ datatype: v.nullish(v.literal('string')),
16
15
  });
17
- export type DocSubtitleType = v.BaseSchema<v.Output<typeof DocSubtitle>>;
18
16
 
19
- export default DocSubtitle as DocSubtitleType;
17
+ export type DocSubtitleType = v.InferOutput<typeof DocSubtitleSchema>;
18
+ export type DocSubtitleSchemaType = v.GenericSchema<DocSubtitleType>;
19
+
20
+ export default DocSubtitleSchema as DocSubtitleSchemaType;
@@ -1,22 +1,21 @@
1
1
  import * as v from 'valibot';
2
- import { nullish, object } from '@uides/stepwise/schemas/common';
3
2
  import { createFieldDisplay } from '@uides/stepwise/schemas/field/common';
4
3
 
5
- const DocTitleDisplay = createFieldDisplay(
6
- object({
4
+ const DocTitleDisplaySchema = createFieldDisplay(
5
+ v.strictObject({
7
6
  component: v.literal('doc_title'),
8
7
  }),
9
- object({
8
+ v.strictObject({
10
9
  component: v.literal('doc_title'),
11
- 'component-params': nullish(
12
- object({
13
- leading: nullish(v.number()),
10
+ 'component-params': v.nullish(
11
+ v.strictObject({
12
+ leading: v.nullish(v.number()),
14
13
  })
15
14
  ),
16
15
  })
17
16
  );
18
17
 
19
- const DocTitleAttribute = nullish(
18
+ const DocTitleAttributeSchema = v.nullish(
20
19
  v.picklist([
21
20
  'chosen_degree:pdf_title',
22
21
  'digital_diploma:pdfTitle',
@@ -24,15 +23,17 @@ const DocTitleAttribute = nullish(
24
23
  ])
25
24
  );
26
25
 
27
- const DocTitle = object({
28
- display: DocTitleDisplay,
26
+ const DocTitleSchema = v.strictObject({
27
+ display: DocTitleDisplaySchema,
29
28
  'user-input-mode': v.literal('noinput'),
30
- value: nullish(v.string()),
31
- 'default-value': nullish(v.string()),
32
- 'value-constructor': nullish(v.string()),
33
- sources: nullish(v.string()),
34
- attribute: DocTitleAttribute,
29
+ value: v.nullish(v.string()),
30
+ 'default-value': v.nullish(v.string()),
31
+ 'value-constructor': v.nullish(v.string()),
32
+ sources: v.nullish(v.string()),
33
+ attribute: DocTitleAttributeSchema,
35
34
  });
36
- export type DocTitleType = v.BaseSchema<v.Output<typeof DocTitle>>;
37
35
 
38
- export default DocTitle as DocTitleType;
36
+ export type DocTitleType = v.InferOutput<typeof DocTitleSchema>;
37
+ export type DocTitleSchemaType = v.GenericSchema<DocTitleType>;
38
+
39
+ export default DocTitleSchema as DocTitleSchemaType;
@@ -1,39 +1,41 @@
1
1
  import * as v from 'valibot';
2
- import { nullish, object } from '@uides/stepwise/schemas/common';
3
2
  import { createFieldDisplay } from '@uides/stepwise/schemas/field/common';
4
3
 
5
- const DynamicallyFilledTextDisplay = createFieldDisplay(
6
- object({
4
+ const DynamicallyFilledTextDisplaySchema = createFieldDisplay(
5
+ v.strictObject({
7
6
  component: v.literal('dynamically-filled-text'),
8
- 'component-params': nullish(
9
- object({
10
- fill: nullish(v.boolean()),
11
- position: nullish(v.picklist(['center', 'justify', 'left', 'right'])),
12
- format: nullish(v.literal('plaintext')),
13
- textColor: nullish(v.string()),
14
- emph: nullish(v.boolean()),
15
- bold: nullish(v.boolean()),
16
- cell_valign: nullish(v.string()),
17
- leading: nullish(v.number()),
7
+ 'component-params': v.nullish(
8
+ v.strictObject({
9
+ fill: v.nullish(v.boolean()),
10
+ position: v.nullish(v.picklist(['center', 'justify', 'left', 'right'])),
11
+ format: v.nullish(v.literal('plaintext')),
12
+ textColor: v.nullish(v.string()),
13
+ emph: v.nullish(v.boolean()),
14
+ bold: v.nullish(v.boolean()),
15
+ cell_valign: v.nullish(v.string()),
16
+ leading: v.nullish(v.number()),
18
17
  })
19
18
  ),
20
19
  })
21
20
  );
22
21
 
23
- const DynamicallyFilledText = object({
24
- value: nullish(v.string()),
25
- display: DynamicallyFilledTextDisplay,
22
+ const DynamicallyFilledTextSchema = v.strictObject({
23
+ value: v.nullish(v.string()),
24
+ display: DynamicallyFilledTextDisplaySchema,
26
25
  'user-input-mode': v.picklist(['noinput', 'display']),
27
- 'default-value': nullish(v.string()),
28
- sources: nullish(v.literal('field:page_3_year')),
29
- 'value-constructor': nullish(
26
+ 'default-value': v.nullish(v.string()),
27
+ sources: v.nullish(v.literal('field:page_3_year')),
28
+ 'value-constructor': v.nullish(
30
29
  v.literal('dilosi.interop_logic.metavivasi_akinitou.get_page_3_text')
31
30
  ),
32
- 'is-display-field': nullish(v.boolean()),
33
- attribute: nullish(v.string()),
31
+ 'is-display-field': v.nullish(v.boolean()),
32
+ attribute: v.nullish(v.string()),
34
33
  });
35
- export type DynamicallyFilledTextType = v.BaseSchema<
36
- v.Output<typeof DynamicallyFilledText>
34
+
35
+ export type DynamicallyFilledTextType = v.InferOutput<
36
+ typeof DynamicallyFilledTextSchema
37
37
  >;
38
+ export type DynamicallyFilledTextSchemaType =
39
+ v.GenericSchema<DynamicallyFilledTextType>;
38
40
 
39
- export default DynamicallyFilledText as DynamicallyFilledTextType;
41
+ export default DynamicallyFilledTextSchema as DynamicallyFilledTextSchemaType;
@@ -1,14 +1,13 @@
1
1
  import * as v from 'valibot';
2
- import { nullish, object } from '@uides/stepwise/schemas/common';
3
2
  import { createFieldDisplay } from '@uides/stepwise/schemas/field/common';
4
3
 
5
- const EmailDisplay = createFieldDisplay(
6
- object({
4
+ const EmailDisplaySchema = createFieldDisplay(
5
+ v.strictObject({
7
6
  component: v.literal('email'),
8
7
  })
9
8
  );
10
9
 
11
- const EmailAttribute = nullish(
10
+ const EmailAttributeSchema = v.nullish(
12
11
  v.picklist([
13
12
  'civil_registry:email',
14
13
  'find_onomatodosia:email',
@@ -16,13 +15,15 @@ const EmailAttribute = nullish(
16
15
  ])
17
16
  );
18
17
 
19
- const Email = object({
18
+ const EmailSchema = v.strictObject({
20
19
  'user-input-mode': v.picklist(['noinput', 'optional', 'required']),
21
- display: EmailDisplay,
22
- attribute: EmailAttribute,
23
- 'default-value': nullish(v.string()),
24
- datatype: nullish(v.literal('email')),
20
+ display: EmailDisplaySchema,
21
+ attribute: EmailAttributeSchema,
22
+ 'default-value': v.nullish(v.string()),
23
+ datatype: v.nullish(v.literal('email')),
25
24
  });
26
- export type EmailType = v.BaseSchema<v.Output<typeof Email>>;
27
25
 
28
- export default Email as EmailType;
26
+ export type EmailType = v.InferOutput<typeof EmailSchema>;
27
+ export type EmailSchemaType = v.GenericSchema<EmailType>;
28
+
29
+ export default EmailSchema as EmailSchemaType;
@@ -1,29 +1,30 @@
1
1
  import * as v from 'valibot';
2
- import { nullish, object } from '@uides/stepwise/schemas/common';
3
2
  import { createFieldDisplay } from '@uides/stepwise/schemas/field/common';
4
3
 
5
- const FillableStringDisplay = createFieldDisplay(
6
- object({
4
+ const FillableStringDisplaySchema = createFieldDisplay(
5
+ v.strictObject({
7
6
  component: v.literal('fillable-string'),
8
- 'component-params': nullish(
9
- object({
10
- emph: nullish(v.boolean()),
7
+ 'component-params': v.nullish(
8
+ v.strictObject({
9
+ emph: v.nullish(v.boolean()),
11
10
  })
12
11
  ),
13
12
  })
14
13
  );
15
14
 
16
- const FillableString = object({
15
+ const FillableStringSchema = v.strictObject({
17
16
  'user-input-mode': v.picklist(['noinput', 'display']),
18
- display: FillableStringDisplay,
19
- attribute: nullish(v.string()),
20
- 'default-value': nullish(v.string()),
21
- 'value-constructor': nullish(v.string()),
22
- value: nullish(v.string()),
23
- safe: nullish(v.boolean()),
24
- sources: nullish(v.string()),
25
- datatype: nullish(v.literal('string')),
17
+ display: FillableStringDisplaySchema,
18
+ attribute: v.nullish(v.string()),
19
+ 'default-value': v.nullish(v.string()),
20
+ 'value-constructor': v.nullish(v.string()),
21
+ value: v.nullish(v.string()),
22
+ safe: v.nullish(v.boolean()),
23
+ sources: v.nullish(v.string()),
24
+ datatype: v.nullish(v.literal('string')),
26
25
  });
27
- export type FillableStringType = v.BaseSchema<v.Output<typeof FillableString>>;
28
26
 
29
- export default FillableString as FillableStringType;
27
+ export type FillableStringType = v.InferOutput<typeof FillableStringSchema>;
28
+ export type FillableStringSchemaType = v.GenericSchema<FillableStringType>;
29
+
30
+ export default FillableStringSchema as FillableStringSchemaType;
@@ -1,17 +1,18 @@
1
1
  import * as v from 'valibot';
2
- import { object } from '@uides/stepwise/schemas/common';
3
2
  import { createFieldDisplay } from '@uides/stepwise/schemas/field/common';
4
3
 
5
- const FiveBlockDateDisplay = createFieldDisplay(
6
- object({
4
+ const FiveBlockDateDisplaySchema = createFieldDisplay(
5
+ v.strictObject({
7
6
  component: v.literal('five-block-date'),
8
7
  })
9
8
  );
10
9
 
11
- const FiveBlockDate = object({
10
+ const FiveBlockDateSchema = v.strictObject({
12
11
  'user-input-mode': v.picklist(['noinput', 'optional', 'required']),
13
- display: FiveBlockDateDisplay,
12
+ display: FiveBlockDateDisplaySchema,
14
13
  });
15
- export type FiveBlockDateType = v.BaseSchema<v.Output<typeof FiveBlockDate>>;
16
14
 
17
- export default FiveBlockDate as FiveBlockDateType;
15
+ export type FiveBlockDateType = v.InferOutput<typeof FiveBlockDateSchema>;
16
+ export type FiveBlockDateSchemaType = v.GenericSchema<FiveBlockDateType>;
17
+
18
+ export default FiveBlockDateSchema as FiveBlockDateSchemaType;
@@ -1,28 +1,27 @@
1
1
  import * as v from 'valibot';
2
- import { nullish, object } from '@uides/stepwise/schemas/common';
3
2
  import { createFieldDisplay } from '@uides/stepwise/schemas/field/common';
4
3
 
5
- const GreenPassQrcodeDisplay = createFieldDisplay(
6
- object({
4
+ const GreenPassQrcodeDisplaySchema = createFieldDisplay(
5
+ v.strictObject({
7
6
  component: v.literal('green-pass-qrcode'),
8
- 'component-params': nullish(
9
- object({
10
- coordinates: nullish(v.array(v.nullable(v.number()))),
11
- position: nullish(v.picklist(['left', 'right', 'center', 'justify'])),
12
- size: nullish(v.number()),
7
+ 'component-params': v.nullish(
8
+ v.strictObject({
9
+ coordinates: v.nullish(v.array(v.nullable(v.number()))),
10
+ position: v.nullish(v.picklist(['left', 'right', 'center', 'justify'])),
11
+ size: v.nullish(v.number()),
13
12
  })
14
13
  ),
15
14
  })
16
15
  );
17
16
 
18
- const GreenPassQrcode = object({
17
+ const GreenPassQrcodeSchema = v.strictObject({
19
18
  'user-input-mode': v.picklist(['noinput', 'display']),
20
- display: GreenPassQrcodeDisplay,
19
+ display: GreenPassQrcodeDisplaySchema,
21
20
  datatype: v.literal('string'),
22
- attribute: nullish(v.string()),
21
+ attribute: v.nullish(v.string()),
23
22
  });
24
- export type GreenPassQrcodeType = v.BaseSchema<
25
- v.Output<typeof GreenPassQrcode>
26
- >;
27
23
 
28
- export default GreenPassQrcode as GreenPassQrcodeType;
24
+ export type GreenPassQrcodeType = v.InferOutput<typeof GreenPassQrcodeSchema>;
25
+ export type GreenPassQrcodeSchemaType = v.GenericSchema<GreenPassQrcodeType>;
26
+
27
+ export default GreenPassQrcodeSchema as GreenPassQrcodeSchemaType;