@uides/stepwise 1.1.0-d0adc9fb → 2.0.0-061795a7

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,47 +1,77 @@
1
1
  import * as v from 'valibot';
2
- import {
3
- DisplayLang,
4
- DisplayMode,
5
- specialWithNestedSchema,
6
- } from '@uides/stepwise/schemas/common';
7
- import Afm from '@uides/stepwise/schemas/field/afm';
8
- import Amka from '@uides/stepwise/schemas/field/amka';
9
- import Attachment from '@uides/stepwise/schemas/field/attachment';
10
- import Captcha from '@uides/stepwise/schemas/field/captcha';
11
- import Choice from '@uides/stepwise/schemas/field/choice';
2
+ import { DisplayLang, DisplayModeSchema } from '@uides/stepwise/schemas/common';
3
+ import Afm, { AfmType } from '@uides/stepwise/schemas/field/afm';
4
+ import Amka, { AmkaType } from '@uides/stepwise/schemas/field/amka';
5
+ import Attachment, {
6
+ AttachmentType,
7
+ } from '@uides/stepwise/schemas/field/attachment';
8
+ import Captcha, { CaptchaType } from '@uides/stepwise/schemas/field/captcha';
9
+ import Choice, { ChoiceType } from '@uides/stepwise/schemas/field/choice';
12
10
  import { DisplayModeAndLangSchema } from '@uides/stepwise/schemas/field/common';
13
- import DateField from '@uides/stepwise/schemas/field/date';
14
- import DocSubtitle from '@uides/stepwise/schemas/field/doc_subtitle';
15
- import DocTitle from '@uides/stepwise/schemas/field/doc_title';
16
- import DynamicallyFilledText from '@uides/stepwise/schemas/field/dynamically-filled-text';
17
- import Email from '@uides/stepwise/schemas/field/email';
18
- import FillableString from '@uides/stepwise/schemas/field/fillable-string';
19
- import FiveBlockDate from '@uides/stepwise/schemas/field/five-block-date';
20
- import GreenPassQrcode from '@uides/stepwise/schemas/field/green-pass-qrcode';
21
- import Hidden from '@uides/stepwise/schemas/field/hidden';
22
- import HierarchicalSelector from '@uides/stepwise/schemas/field/hierarchical-selector';
23
- import Iban from '@uides/stepwise/schemas/field/iban';
24
- import Image from '@uides/stepwise/schemas/field/image';
25
- import Int from '@uides/stepwise/schemas/field/int';
26
- import LabResults from '@uides/stepwise/schemas/field/lab-results';
27
- import LandlinePhone from '@uides/stepwise/schemas/field/landline_phone';
28
- import MobilePhone from '@uides/stepwise/schemas/field/mobile_phone';
29
- import MultipleChoice from '@uides/stepwise/schemas/field/multiple-choice';
30
- import PdfImage from '@uides/stepwise/schemas/field/pdf-image';
31
- import PostalCode from '@uides/stepwise/schemas/field/postal_code';
32
- import Qrcode from '@uides/stepwise/schemas/field/qrcode';
33
- import Quote from '@uides/stepwise/schemas/field/quote';
34
- import RadioChoice from '@uides/stepwise/schemas/field/radio-choice';
35
- import Rate from '@uides/stepwise/schemas/field/rate';
36
- import Recipient from '@uides/stepwise/schemas/field/recipient';
37
- import Redirect from '@uides/stepwise/schemas/field/redirect';
38
- import Refcode from '@uides/stepwise/schemas/field/refcode';
39
- import StringField from '@uides/stepwise/schemas/field/string';
40
- import Text from '@uides/stepwise/schemas/field/text';
41
- import ThreeBlockDate from '@uides/stepwise/schemas/field/three-block-date';
11
+ import DateField, { DateType } from '@uides/stepwise/schemas/field/date';
12
+ import DocSubtitle, {
13
+ DocSubtitleType,
14
+ } from '@uides/stepwise/schemas/field/doc_subtitle';
15
+ import DocTitle, {
16
+ DocTitleType,
17
+ } from '@uides/stepwise/schemas/field/doc_title';
18
+ import DynamicallyFilledText, {
19
+ DynamicallyFilledTextType,
20
+ } from '@uides/stepwise/schemas/field/dynamically-filled-text';
21
+ import Email, { EmailType } from '@uides/stepwise/schemas/field/email';
22
+ import FillableString, {
23
+ FillableStringType,
24
+ } from '@uides/stepwise/schemas/field/fillable-string';
25
+ import FiveBlockDate, {
26
+ FiveBlockDateType,
27
+ } from '@uides/stepwise/schemas/field/five-block-date';
28
+ import GreenPassQrcode, {
29
+ GreenPassQrcodeType,
30
+ } from '@uides/stepwise/schemas/field/green-pass-qrcode';
31
+ import Hidden, { HiddenType } from '@uides/stepwise/schemas/field/hidden';
32
+ import HierarchicalSelector, {
33
+ HierarchicalSelectorType,
34
+ } from '@uides/stepwise/schemas/field/hierarchical-selector';
35
+ import Iban, { IbanType } from '@uides/stepwise/schemas/field/iban';
36
+ import Image, { ImageType } from '@uides/stepwise/schemas/field/image';
37
+ import Int, { IntType } from '@uides/stepwise/schemas/field/int';
38
+ import LabResults, {
39
+ LabResultsType,
40
+ } from '@uides/stepwise/schemas/field/lab-results';
41
+ import LandlinePhone, {
42
+ LandlinePhoneType,
43
+ } from '@uides/stepwise/schemas/field/landline_phone';
44
+ import MobilePhone, {
45
+ MobilePhoneType,
46
+ } from '@uides/stepwise/schemas/field/mobile_phone';
47
+ import MultipleChoice, {
48
+ MultipleChoiceType,
49
+ } from '@uides/stepwise/schemas/field/multiple-choice';
50
+ import PdfImage, {
51
+ PdfImageType,
52
+ } from '@uides/stepwise/schemas/field/pdf-image';
53
+ import PostalCode, {
54
+ PostalCodeType,
55
+ } from '@uides/stepwise/schemas/field/postal_code';
56
+ import Qrcode, { QrcodeType } from '@uides/stepwise/schemas/field/qrcode';
57
+ import Quote, { QuoteType } from '@uides/stepwise/schemas/field/quote';
58
+ import RadioChoice, {
59
+ RadioChoiceType,
60
+ } from '@uides/stepwise/schemas/field/radio-choice';
61
+ import Rate, { RateType } from '@uides/stepwise/schemas/field/rate';
62
+ import Recipient, {
63
+ RecipientType,
64
+ } from '@uides/stepwise/schemas/field/recipient';
65
+ import Redirect, { RedirectType } from '@uides/stepwise/schemas/field/redirect';
66
+ import Refcode, { RefcodeType } from '@uides/stepwise/schemas/field/refcode';
67
+ import StringField, { StringType } from '@uides/stepwise/schemas/field/string';
68
+ import Text, { TextType } from '@uides/stepwise/schemas/field/text';
69
+ import ThreeBlockDate, {
70
+ ThreeBlockDateType,
71
+ } from '@uides/stepwise/schemas/field/three-block-date';
42
72
  import { resolveDisplay } from '@uides/stepwise/schemas/resolve';
43
73
 
44
- const fieldOptions = {
74
+ const allFieldSchemas = {
45
75
  afm: Afm,
46
76
  amka: Amka,
47
77
  attachment: Attachment,
@@ -77,25 +107,45 @@ const fieldOptions = {
77
107
  text: Text,
78
108
  'three-block-date': ThreeBlockDate,
79
109
  };
80
- type FieldOptions = (typeof fieldOptions)[keyof typeof fieldOptions];
81
110
 
82
- const Field = specialWithNestedSchema<v.Output<FieldOptions>>(
83
- (field) => {
84
- const { display, ...fieldAttrs } = field;
111
+ const FieldSchema = v.pipe(
112
+ v.record(v.string(), v.any()), // TODO: Unnecessary?
113
+ v.rawCheck<Field>(({ dataset, addIssue }) => {
114
+ const { display, ...fieldAttrs } = dataset.value as Record<string, any>;
85
115
  if (!display) {
86
- const result = fieldOptions['string']._parse(fieldAttrs);
87
- return result.issues;
116
+ const result = v.safeParse(allFieldSchemas['string'], fieldAttrs);
117
+ // TODO: DRY
118
+ if (result.issues) {
119
+ // TODO: Add subissues
120
+ result.issues.forEach((issue) => {
121
+ addIssue({
122
+ message: issue.message,
123
+ path: issue.path,
124
+ input: issue.input,
125
+ expected: issue.expected ?? undefined,
126
+ received: issue.received,
127
+ label: 'Display schema',
128
+ });
129
+ });
130
+ }
131
+ return;
88
132
  }
89
- let issues: v.SchemaIssues | undefined;
90
133
  const result = v.safeParse(DisplayModeAndLangSchema, display);
91
134
  if (result.issues) {
92
- issues?.push(...result.issues);
93
- }
94
- if (!issues) {
95
- issues = result.issues;
135
+ // TODO: Add subissues
136
+ result.issues.forEach((issue) => {
137
+ addIssue({
138
+ message: issue.message,
139
+ path: issue.path,
140
+ input: issue.input,
141
+ expected: issue.expected ?? undefined,
142
+ received: issue.received,
143
+ label: 'Display schema',
144
+ });
145
+ });
96
146
  }
97
- DisplayMode.options.forEach((displayMode) => {
98
- if (!display[displayMode]) return;
147
+ DisplayModeSchema.options.forEach((displayMode) => {
148
+ if (!(display && display[displayMode])) return;
99
149
  Object.keys(display[displayMode] as NonNullable<unknown>).forEach(
100
150
  (displayLang) => {
101
151
  const resolvedDisplay = resolveDisplay(
@@ -118,41 +168,82 @@ const Field = specialWithNestedSchema<v.Output<FieldOptions>>(
118
168
  };
119
169
 
120
170
  const component = resolvedDisplay?.['component'] ?? 'string';
121
- const result =
122
- fieldOptions[component as keyof typeof fieldOptions]._parse(
123
- fieldToValidate
124
- );
171
+ const result = v.safeParse(
172
+ allFieldSchemas[component as keyof typeof allFieldSchemas],
173
+ fieldToValidate
174
+ );
125
175
  if (result.issues) {
126
- issues?.push(...result.issues);
127
- }
128
- if (!issues) {
129
- issues = result.issues;
176
+ // TODO: Add subissues
177
+ result.issues.forEach((issue) => {
178
+ addIssue({
179
+ message: issue.message,
180
+ path: issue.path,
181
+ input: issue.input,
182
+ expected: issue.expected ?? undefined,
183
+ received: issue.received,
184
+ label: 'Display schema',
185
+ });
186
+ });
130
187
  }
131
188
  }
132
189
  );
133
190
  });
134
- return issues;
135
- },
136
- [
137
- v.custom((values) => {
138
- if (!('value' in values)) return true;
139
- const value = values.value;
140
- const userInputMode = values['user-input-mode'];
141
- if (
142
- value &&
143
- !(userInputMode === 'noinput' || userInputMode === 'display')
144
- ) {
145
- return false;
146
- }
147
- return true;
148
- }, 'Field with value cannot be editable'),
149
- ]
150
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
151
- ) as any;
152
- export default Field as FieldOptions;
191
+ }),
192
+ v.check((values) => {
193
+ if (!('value' in values)) return true;
194
+ const value = values['value'];
195
+ const userInputMode = values['user-input-mode'];
196
+ if (
197
+ value &&
198
+ !(userInputMode === 'noinput' || userInputMode === 'display')
199
+ ) {
200
+ return false;
201
+ }
202
+ return true;
203
+ }, 'Field with value cannot be editable')
204
+ );
205
+
206
+ export default FieldSchema;
207
+
208
+ export type Field =
209
+ | AfmType
210
+ | AmkaType
211
+ | AttachmentType
212
+ | CaptchaType
213
+ | ChoiceType
214
+ | DateType
215
+ | DocSubtitleType
216
+ | DocTitleType
217
+ | DynamicallyFilledTextType
218
+ | EmailType
219
+ | FillableStringType
220
+ | FiveBlockDateType
221
+ | GreenPassQrcodeType
222
+ | HiddenType
223
+ | HierarchicalSelectorType
224
+ | IbanType
225
+ | ImageType
226
+ | IntType
227
+ | LabResultsType
228
+ | LandlinePhoneType
229
+ | MobilePhoneType
230
+ | MultipleChoiceType
231
+ | PdfImageType
232
+ | PostalCodeType
233
+ | QrcodeType
234
+ | QuoteType
235
+ | RadioChoiceType
236
+ | RateType
237
+ | RecipientType
238
+ | RedirectType
239
+ | RefcodeType
240
+ | StringType
241
+ | TextType
242
+ | ThreeBlockDateType;
243
+
244
+ export type Fields = Record<string, Field>;
153
245
 
154
- export type Fields = Record<
155
- string,
156
- NonNullable<FieldOptions['_types']>['input']
157
- >;
158
- export const FieldsSchema = v.record(Field) as v.BaseSchema<Fields, Fields>;
246
+ export const FieldsSchema = v.record(
247
+ v.string(),
248
+ FieldSchema
249
+ ) as v.GenericSchema<Fields>;
@@ -1,23 +1,24 @@
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 IntDisplay = createFieldDisplay(
6
- object({
4
+ const IntDisplaySchema = createFieldDisplay(
5
+ v.strictObject({
7
6
  component: v.literal('int'),
8
- 'component-params': nullish(
9
- object({
7
+ 'component-params': v.nullish(
8
+ v.strictObject({
10
9
  enforceUppercase: v.boolean(),
11
10
  })
12
11
  ),
13
12
  })
14
13
  );
15
14
 
16
- const Int = object({
15
+ const IntSchema = v.strictObject({
17
16
  'user-input-mode': v.picklist(['noinput', 'optional', 'required']),
18
- display: IntDisplay,
19
- 'default-value': nullish(v.string()),
17
+ display: IntDisplaySchema,
18
+ 'default-value': v.nullish(v.string()),
20
19
  });
21
- export type IntType = v.BaseSchema<v.Output<typeof Int>>;
22
20
 
23
- export default Int as IntType;
21
+ export type IntType = v.InferOutput<typeof IntSchema>;
22
+ export type IntSchemaType = v.GenericSchema<IntType>;
23
+
24
+ export default IntSchema as IntSchemaType;
@@ -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 LabResultsDisplay = createFieldDisplay(
6
- object({
4
+ const LabResultsDisplaySchema = createFieldDisplay(
5
+ v.strictObject({
7
6
  component: v.literal('lab-results'),
8
7
  })
9
8
  );
10
9
 
11
- const LabResults = object({
10
+ const LabResultsSchema = v.strictObject({
12
11
  'user-input-mode': v.literal('noinput'),
13
- display: LabResultsDisplay,
14
- 'default-value': nullish(v.string()),
12
+ display: LabResultsDisplaySchema,
13
+ 'default-value': v.nullish(v.string()),
15
14
  attribute: v.string(),
16
15
  });
17
- export type LabResultsType = v.BaseSchema<v.Output<typeof LabResults>>;
18
16
 
19
- export default LabResults as LabResultsType;
17
+ export type LabResultsType = v.InferOutput<typeof LabResultsSchema>;
18
+ export type LabResultsSchemaType = v.GenericSchema<LabResultsType>;
19
+
20
+ export default LabResultsSchema as LabResultsSchemaType;
@@ -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 LandlinePhoneDisplay = createFieldDisplay(
6
- object({
4
+ const LandlinePhoneDisplaySchema = createFieldDisplay(
5
+ v.strictObject({
7
6
  component: v.literal('landline_phone'),
8
7
  })
9
8
  );
10
9
 
11
- const LandlinePhone = object({
10
+ const LandlinePhoneSchema = v.strictObject({
12
11
  'user-input-mode': v.picklist(['noinput', 'optional']),
13
- display: LandlinePhoneDisplay,
12
+ display: LandlinePhoneDisplaySchema,
14
13
  });
15
- export type LandlinePhoneType = v.BaseSchema<v.Output<typeof LandlinePhone>>;
16
14
 
17
- export default LandlinePhone as LandlinePhoneType;
15
+ export type LandlinePhoneType = v.InferOutput<typeof LandlinePhoneSchema>;
16
+ export type LandlinePhoneSchemaType = v.GenericSchema<LandlinePhoneType>;
17
+
18
+ export default LandlinePhoneSchema as LandlinePhoneSchemaType;
@@ -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 MobilePhoneDisplay = createFieldDisplay(
6
- object({
4
+ const MobilePhoneDisplaySchema = createFieldDisplay(
5
+ v.strictObject({
7
6
  component: v.literal('mobile_phone'),
8
7
  })
9
8
  );
10
9
 
11
- const MobilePhoneAttribute = nullish(
10
+ const MobilePhoneAttributeSchema = v.nullish(
12
11
  v.picklist([
13
12
  'civil_registry:mobile',
14
13
  'find_onomatodosia:mobile_phone',
@@ -19,13 +18,15 @@ const MobilePhoneAttribute = nullish(
19
18
  ])
20
19
  );
21
20
 
22
- const MobilePhone = object({
21
+ const MobilePhoneSchema = v.strictObject({
23
22
  'user-input-mode': v.picklist(['noinput', 'optional', 'required']),
24
- attribute: MobilePhoneAttribute,
25
- display: MobilePhoneDisplay,
26
- 'default-value': nullish(v.string()),
27
- datatype: nullish(v.literal('mobile_phone')),
23
+ attribute: MobilePhoneAttributeSchema,
24
+ display: MobilePhoneDisplaySchema,
25
+ 'default-value': v.nullish(v.string()),
26
+ datatype: v.nullish(v.literal('mobile_phone')),
28
27
  });
29
- export type MobilePhoneType = v.BaseSchema<v.Output<typeof MobilePhone>>;
30
28
 
31
- export default MobilePhone as MobilePhoneType;
29
+ export type MobilePhoneType = v.InferOutput<typeof MobilePhoneSchema>;
30
+ export type MobilePhoneSchemaType = v.GenericSchema<MobilePhoneType>;
31
+
32
+ export default MobilePhoneSchema as MobilePhoneSchemaType;
@@ -1,28 +1,29 @@
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 MultipleChoiceDisplay = createFieldDisplay(
6
- object({
4
+ const MultipleChoiceDisplaySchema = createFieldDisplay(
5
+ v.strictObject({
7
6
  component: v.literal('multiple-choice'),
8
- choices: v.record(v.string()),
7
+ choices: v.record(v.string(), v.string()),
9
8
  'choices-order': v.string(),
10
- 'component-params': nullish(
11
- object({
12
- 'legacy-mode': nullish(v.boolean()),
13
- showcase: nullish(v.picklist(['comma_separated', 'one_per_line'])),
9
+ 'component-params': v.nullish(
10
+ v.strictObject({
11
+ 'legacy-mode': v.nullish(v.boolean()),
12
+ showcase: v.nullish(v.picklist(['comma_separated', 'one_per_line'])),
14
13
  })
15
14
  ),
16
15
  })
17
16
  );
18
17
 
19
- const MultipleChoice = object({
18
+ const MultipleChoiceSchema = v.strictObject({
20
19
  'user-input-mode': v.picklist(['noinput', 'optional', 'required']),
21
- display: MultipleChoiceDisplay,
22
- 'default-value': nullish(v.string()),
20
+ display: MultipleChoiceDisplaySchema,
21
+ 'default-value': v.nullish(v.string()),
23
22
  attribute: v.optional(v.null_()),
24
- datatype: nullish(v.picklist(['multiple-choice', 'string'])),
23
+ datatype: v.nullish(v.picklist(['multiple-choice', 'string'])),
25
24
  });
26
- export type MultipleChoiceType = v.BaseSchema<v.Output<typeof MultipleChoice>>;
27
25
 
28
- export default MultipleChoice as MultipleChoiceType;
26
+ export type MultipleChoiceType = v.InferOutput<typeof MultipleChoiceSchema>;
27
+ export type MultipleChoiceSchemaType = v.GenericSchema<MultipleChoiceType>;
28
+
29
+ export default MultipleChoiceSchema as MultipleChoiceSchemaType;
@@ -1,20 +1,19 @@
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 PdfImageDisplay = createFieldDisplay(
6
- object({
4
+ const PdfImageDisplaySchema = createFieldDisplay(
5
+ v.strictObject({
7
6
  component: v.literal('pdf-image'),
8
- 'component-params': nullish(
9
- object({
7
+ 'component-params': v.nullish(
8
+ v.strictObject({
10
9
  coordinates: v.array(v.nullable(v.number())),
11
- position: nullish(v.picklist(['left', 'right', 'center', 'justify'])),
10
+ position: v.nullish(v.picklist(['left', 'right', 'center', 'justify'])),
12
11
  })
13
12
  ),
14
13
  })
15
14
  );
16
15
 
17
- const PdfImageValue = v.picklist([
16
+ const PdfImageValueSchema = v.picklist([
18
17
  'amea_footer_1_pdf',
19
18
  'amea_opeka_logo_pdf',
20
19
  'daktylios_backgroud_pdf',
@@ -28,12 +27,14 @@ const PdfImageValue = v.picklist([
28
27
  'AADE_logo_small_pdf',
29
28
  ]);
30
29
 
31
- const PdfImage = object({
32
- display: PdfImageDisplay,
33
- value: PdfImageValue,
30
+ const PdfImageSchema = v.strictObject({
31
+ display: PdfImageDisplaySchema,
32
+ value: PdfImageValueSchema,
34
33
  'user-input-mode': v.picklist(['noinput', 'display']),
35
- datatype: nullish(v.literal('string')),
34
+ datatype: v.nullish(v.literal('string')),
36
35
  });
37
- export type PdfImageType = v.BaseSchema<v.Output<typeof PdfImage>>;
38
36
 
39
- export default PdfImage as PdfImageType;
37
+ export type PdfImageType = v.InferOutput<typeof PdfImageSchema>;
38
+ export type PdfImageSchemaType = v.GenericSchema<PdfImageType>;
39
+
40
+ export default PdfImageSchema as PdfImageSchemaType;
@@ -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 PostalCodeDisplay = createFieldDisplay(
6
- object({
4
+ const PostalCodeDisplaySchema = createFieldDisplay(
5
+ v.strictObject({
7
6
  component: v.literal('postal_code'),
8
7
  })
9
8
  );
10
9
 
11
- const PostalCode = object({
10
+ const PostalCodeSchema = v.strictObject({
12
11
  'user-input-mode': v.picklist(['noinput', 'optional', 'required']),
13
- display: PostalCodeDisplay,
14
- datatype: nullish(v.literal('postal_code')),
12
+ display: PostalCodeDisplaySchema,
13
+ datatype: v.nullish(v.literal('postal_code')),
15
14
  attribute: v.optional(v.null_()),
16
15
  });
17
- export type PostalCodeType = v.BaseSchema<v.Output<typeof PostalCode>>;
18
16
 
19
- export default PostalCode as PostalCodeType;
17
+ export type PostalCodeType = v.InferOutput<typeof PostalCodeSchema>;
18
+ export type PostalCodeSchemaType = v.GenericSchema<PostalCodeType>;
19
+
20
+ export default PostalCodeSchema as PostalCodeSchemaType;
@@ -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 QrcodeDisplay = createFieldDisplay(
6
- object({
4
+ const QrcodeDisplaySchema = createFieldDisplay(
5
+ v.strictObject({
7
6
  component: v.literal('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 Qrcode = object({
17
+ const QrcodeSchema = v.strictObject({
19
18
  'user-input-mode': v.picklist(['noinput', 'display']),
20
- display: QrcodeDisplay,
21
- attribute: nullish(v.string()),
22
- sources: nullish(v.string()),
23
- value: nullish(v.string()),
24
- 'value-constructor': nullish(v.string()),
25
- 'is-display-field': nullish(v.boolean()),
19
+ display: QrcodeDisplaySchema,
20
+ attribute: v.nullish(v.string()),
21
+ sources: v.nullish(v.string()),
22
+ value: v.nullish(v.string()),
23
+ 'value-constructor': v.nullish(v.string()),
24
+ 'is-display-field': v.nullish(v.boolean()),
26
25
  });
27
- export type QrcodeType = v.BaseSchema<v.Output<typeof Qrcode>>;
28
26
 
29
- export default Qrcode as QrcodeType;
27
+ export type QrcodeType = v.InferOutput<typeof QrcodeSchema>;
28
+ export type QrcodeSchemaType = v.GenericSchema<QrcodeType>;
29
+
30
+ export default QrcodeSchema as QrcodeSchemaType;