@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,5 +1,4 @@
1
1
  import * as v from 'valibot';
2
- import { nullish, object } from '@uides/stepwise/schemas/common';
3
2
 
4
3
  /**
5
4
  * Describes the state of a document.
@@ -10,7 +9,7 @@ import { nullish, object } from '@uides/stepwise/schemas/common';
10
9
  * @value 'extracted' Document has been extracted.
11
10
  * @value 'submitting' Document is being submitted.
12
11
  */
13
- export const DocumentState = v.picklist([
12
+ export const DocumentStateSchema = v.picklist([
14
13
  'editing',
15
14
  'issued',
16
15
  'revoked',
@@ -21,84 +20,84 @@ export const DocumentState = v.picklist([
21
20
  /**
22
21
  * The template of a document.
23
22
  */
24
- export const DocumentTemplate = object({
23
+ export const DocumentTemplateSchema = v.strictObject({
25
24
  /** Unique identifier of the template */
26
25
  refname: v.string(),
27
- 'digest-sha256': nullish(v.string()),
26
+ 'digest-sha256': v.nullish(v.string()),
28
27
  });
29
28
 
30
29
  /**
31
30
  * Describes a document attachment.
32
31
  */
33
- export const DocumentAttachment = object({
32
+ export const DocumentAttachmentSchema = v.strictObject({
34
33
  /** The name of the uploaded file. */
35
34
  filename: v.string(),
36
35
  /** The cryptographic hash created using the SHA-256 algorithm. */
37
- digest_sha256: nullish(v.string()),
36
+ digest_sha256: v.nullish(v.string()),
38
37
  /** The encoding with which the file's content is encoded. */
39
- 'content-encoding': nullish(v.string()),
38
+ 'content-encoding': v.nullish(v.string()),
40
39
  /**
41
40
  * The file's encoded content
42
41
  *
43
42
  * The content is encoded using the encoding specified in the `content-encoding` field.
44
43
  * Either this field or the `content-uri` field must be specified, but not both.
45
44
  */
46
- content: nullish(v.string()),
45
+ content: v.nullish(v.string()),
47
46
  /**
48
47
  * The URI for fetching the file's contents
49
48
  *
50
49
  * This URI will be used to fetch the file's content, in case it is not stored in the `content` field.
51
50
  * Either this field or the `content` field must be specified, but not both.
52
51
  */
53
- 'content-uri': nullish(v.string()),
52
+ 'content-uri': v.nullish(v.string()),
54
53
  });
55
54
 
56
55
  /**
57
56
  * Describes a document attachment used for input.
58
57
  */
59
- export const DocumentInputAttachment = object({
58
+ export const DocumentInputAttachmentSchema = v.strictObject({
60
59
  /** The name of the uploaded file. */
61
60
  filename: v.string(),
62
61
  /** The cryptographic hash created using the SHA-256 algorithm. */
63
- digest_sha256: nullish(v.string()),
62
+ digest_sha256: v.nullish(v.string()),
64
63
  /** The encoding with which the file's content is encoded. */
65
- 'content-encoding': nullish(v.string()),
64
+ 'content-encoding': v.nullish(v.string()),
66
65
  /**
67
66
  * The file's content
68
67
  */
69
68
  content: v.string(),
70
69
  });
71
70
 
72
- const BaseDocumentData = object({
71
+ const BaseDocumentDataSchema = v.strictObject({
73
72
  /**
74
73
  * The statements of the document.
75
74
  *
76
75
  * Contains the fields of the document, represented as key-value pairs.
77
76
  * The keys are the field identifiers.
78
77
  */
79
- statements: v.record(v.string()),
78
+ statements: v.record(v.string(), v.string()),
80
79
  /**
81
80
  * The attachments of the document.
82
81
  *
83
82
  * Contains the attachments of the document, represented as key-value pairs.
84
83
  * The keys are the attachment identifiers, specified in the template.
85
84
  */
86
- attachments: v.record(DocumentAttachment),
85
+ attachments: v.record(v.string(), DocumentAttachmentSchema),
87
86
  /** The template of the document. */
88
- template: DocumentTemplate,
87
+ template: DocumentTemplateSchema,
89
88
  /** The identifier of the case to which the document belongs. */
90
- case_id: nullish(v.string()),
91
- 'declaration-id': nullish(v.string()),
89
+ case_id: v.nullish(v.string()),
90
+ 'declaration-id': v.nullish(v.string()),
92
91
  });
93
92
 
94
93
  /**
95
94
  * Describes the data of a document to be created.
96
95
  */
97
- export const DocumentApiInput = object({
98
- ...BaseDocumentData.entries,
99
- attachments: v.record(DocumentInputAttachment),
100
- step: nullish(v.string()),
101
- state: nullish(v.picklist(['issued', 'revoked'])),
96
+ export const DocumentApiInputSchema = v.strictObject({
97
+ ...BaseDocumentDataSchema.entries,
98
+ attachments: v.record(v.string(), DocumentInputAttachmentSchema),
99
+ step: v.nullish(v.string()),
100
+ state: v.nullish(v.picklist(['issued', 'revoked'])),
102
101
  });
103
102
 
104
103
  /**
@@ -106,28 +105,28 @@ export const DocumentApiInput = object({
106
105
  *
107
106
  * @see {@link Document}
108
107
  */
109
- export const DocumentSubmission = object({
110
- ...BaseDocumentData.entries,
111
- attachments: v.record(DocumentInputAttachment),
112
- template: nullish(DocumentTemplate),
108
+ export const DocumentSubmissionSchema = v.strictObject({
109
+ ...BaseDocumentDataSchema.entries,
110
+ attachments: v.record(v.string(), DocumentInputAttachmentSchema),
111
+ template: v.nullish(DocumentTemplateSchema),
113
112
  });
114
113
 
115
114
  /**
116
115
  * Describes the data of a document.
117
116
  */
118
- export const DocumentData = object({
119
- ...BaseDocumentData.entries,
117
+ export const DocumentDataSchema = v.strictObject({
118
+ ...BaseDocumentDataSchema.entries,
120
119
  /**
121
120
  * Object containing extra information regarding the document's display.
122
121
  */
123
- displaying: nullish(v.record(v.any())),
122
+ displaying: v.nullish(v.record(v.string(), v.any())),
124
123
  /**
125
124
  * Object containing extra information regarding the document's display.
126
125
  * @deprecated
127
126
  */
128
- display: nullish(v.record(v.any())),
127
+ display: v.nullish(v.record(v.string(), v.any())),
129
128
  /** Timestamp of the document's issuance in ISO format */
130
- timestamp: nullish(v.string()),
129
+ timestamp: v.nullish(v.string()),
131
130
  /**
132
131
  * The document's issuer.
133
132
  * @default 'services.gov.gr'
@@ -136,39 +135,41 @@ export const DocumentData = object({
136
135
  /** Whether the document is issued and therefore official, or a draft. */
137
136
  is_official: v.boolean(),
138
137
  /** The fill-in step of the document, in case the document is being filled in gradually. */
139
- step: nullish(v.string()),
138
+ step: v.nullish(v.string()),
140
139
  /** The identifier of the issued document. */
141
- 'document-id': nullish(v.string()),
140
+ 'document-id': v.nullish(v.string()),
142
141
  /** The document's title. */
143
- 'document-title': nullish(v.string()),
144
- 'digest-sha256': nullish(v.string()),
145
- state: nullish(DocumentState),
142
+ 'document-title': v.nullish(v.string()),
143
+ 'digest-sha256': v.nullish(v.string()),
144
+ state: v.nullish(DocumentStateSchema),
146
145
  });
147
146
 
148
147
  /**
149
148
  * Describes a full document
150
149
  */
151
- export const DocumentFull = object({
152
- declaration: DocumentData,
153
- 'document-refs': nullish(v.record(v.record(v.any()))),
154
- 'digest-sha256': nullish(v.string()),
155
- state: DocumentState,
156
- info: nullish(v.record(v.any())),
150
+ export const DocumentFullSchema = v.strictObject({
151
+ declaration: DocumentDataSchema,
152
+ 'document-refs': v.nullish(
153
+ v.record(v.string(), v.record(v.string(), v.any()))
154
+ ),
155
+ 'digest-sha256': v.nullish(v.string()),
156
+ state: DocumentStateSchema,
157
+ info: v.nullish(v.record(v.string(), v.any())),
157
158
  });
158
159
 
159
- export const DocumentRevokedData = object({
160
+ export const DocumentRevokedDataSchema = v.strictObject({
160
161
  'document-id': v.string(),
161
162
  /** @default 'revoked' */
162
- state: DocumentState,
163
+ state: DocumentStateSchema,
163
164
  });
164
165
 
165
166
  /**
166
167
  * Describes a revoked document.
167
168
  */
168
- export const DocumentRevoked = object({
169
- declaration: nullish(DocumentRevokedData),
169
+ export const DocumentRevokedSchema = v.strictObject({
170
+ declaration: v.nullish(DocumentRevokedDataSchema),
170
171
  /** @default 'revoked' */
171
- state: DocumentState,
172
+ state: DocumentStateSchema,
172
173
  });
173
174
 
174
175
  /**
@@ -179,4 +180,7 @@ export const DocumentRevoked = object({
179
180
  *
180
181
  * @see {@link BaseDocumentData}
181
182
  */
182
- export const Document = v.union([DocumentFull, DocumentRevoked]);
183
+ export const DocumentSchema = v.union([
184
+ DocumentFullSchema,
185
+ DocumentRevokedSchema,
186
+ ]);
@@ -1,25 +1,24 @@
1
1
  import * as v from 'valibot';
2
- import { nullish, object } from '@uides/stepwise/schemas/common';
3
2
 
4
- export const Result = object({
3
+ export const ResultSchema = v.strictObject({
5
4
  code: v.number(),
6
5
  description: v.picklist(['ΘΕΤΙΚΟ', 'ΑΡΝΗΤΙΚΟ']),
7
6
  });
8
7
 
9
- export const IdikaState = object({
8
+ export const IdikaStateSchema = v.strictObject({
10
9
  amka: v.string(),
11
- birthDate: nullish(v.string()),
12
- dateOfFirstDose: nullish(v.string()),
13
- dateOfFirstPositiveResult: nullish(v.string()),
14
- dateOfResult: nullish(v.string()),
15
- dateOfSample: nullish(v.string()),
16
- dateOfSecondDose: nullish(v.string()),
17
- diagnosisMethodEnum: nullish(v.picklist(['PCR', 'RAPID'])),
18
- requiredDoses: nullish(v.number()),
19
- result: nullish(Result),
10
+ birthDate: v.nullish(v.string()),
11
+ dateOfFirstDose: v.nullish(v.string()),
12
+ dateOfFirstPositiveResult: v.nullish(v.string()),
13
+ dateOfResult: v.nullish(v.string()),
14
+ dateOfSample: v.nullish(v.string()),
15
+ dateOfSecondDose: v.nullish(v.string()),
16
+ diagnosisMethodEnum: v.nullish(v.picklist(['PCR', 'RAPID'])),
17
+ requiredDoses: v.nullish(v.number()),
18
+ result: v.nullish(ResultSchema),
20
19
  });
21
20
 
22
- const UserStatus = v.picklist([
21
+ const UserStatusSchema = v.picklist([
23
22
  'ΜέλοςΔ.Ε.Π.',
24
23
  'ΜέλοςΕ.Ε.Π.',
25
24
  'ΜέλοςΕ.ΔΙ.Π.',
@@ -29,41 +28,45 @@ const UserStatus = v.picklist([
29
28
  'Άλλο–Επιστημονικός-ήσυνεργάτης',
30
29
  ]);
31
30
 
32
- const StudyCycle = v.picklist(['Προπτυχιακό', 'Μεταπτυχιακό', 'Διδακτορικό']);
31
+ const StudyCycleSchema = v.picklist([
32
+ 'Προπτυχιακό',
33
+ 'Μεταπτυχιακό',
34
+ 'Διδακτορικό',
35
+ ]);
33
36
 
34
- export const Metadata = object({
35
- aft: nullish(v.string()),
36
- am: nullish(v.string()),
37
+ export const MetadataSchema = v.strictObject({
38
+ aft: v.nullish(v.string()),
39
+ am: v.nullish(v.string()),
37
40
  firstname: v.string(),
38
41
  lastname: v.string(),
39
- birthdate: nullish(v.string()),
40
- user_status: nullish(UserStatus),
41
- study_cycle: nullish(StudyCycle),
42
+ birthdate: v.nullish(v.string()),
43
+ user_status: v.nullish(UserStatusSchema),
44
+ study_cycle: v.nullish(StudyCycleSchema),
42
45
  });
43
46
 
44
- export const Healthstate = object({
47
+ export const HealthstateSchema = v.strictObject({
45
48
  valid_until: v.string(),
46
- declaration_last_updated_at: nullish(v.string()),
47
- declaration_last_updated_origin: nullish(v.number()),
48
- monitored_last_updated_at: nullish(v.string()),
49
- monitored_since: nullish(v.string()),
50
- monitored_status: nullish(v.picklist(['ΚΟΝΤΙΝΗ ΘΕΣΗ', 'ΣΤΕΝΗ ΕΠΑΦΗ'])),
51
- self_test_amka: nullish(v.string()),
52
- self_test_amka_origin: nullish(v.number()),
53
- self_test_date: nullish(v.string()),
54
- self_test_origin: nullish(v.number()),
55
- self_test_result: nullish(v.string()),
56
- quarantine_start_date: nullish(v.string()),
57
- idika_state: nullish(IdikaState),
58
- idika_state_call_id: nullish(v.string()),
59
- idika_state_last_updated_at: nullish(v.string()),
60
- amka: nullish(v.string()),
61
- amka_origin: nullish(v.number()),
62
- can_use_amka: nullish(v.boolean()),
63
- can_use_amka_origin: nullish(v.number()),
64
- metadata: nullish(Metadata),
65
- metadata_origin: nullish(v.number()),
66
- amka_crosschecked_with_idika: nullish(v.string()),
67
- unverified_amka: nullish(v.string()),
68
- unverified_amka_origin: nullish(v.string()),
49
+ declaration_last_updated_at: v.nullish(v.string()),
50
+ declaration_last_updated_origin: v.nullish(v.number()),
51
+ monitored_last_updated_at: v.nullish(v.string()),
52
+ monitored_since: v.nullish(v.string()),
53
+ monitored_status: v.nullish(v.picklist(['ΚΟΝΤΙΝΗ ΘΕΣΗ', 'ΣΤΕΝΗ ΕΠΑΦΗ'])),
54
+ self_test_amka: v.nullish(v.string()),
55
+ self_test_amka_origin: v.nullish(v.number()),
56
+ self_test_date: v.nullish(v.string()),
57
+ self_test_origin: v.nullish(v.number()),
58
+ self_test_result: v.nullish(v.string()),
59
+ quarantine_start_date: v.nullish(v.string()),
60
+ idika_state: v.nullish(IdikaStateSchema),
61
+ idika_state_call_id: v.nullish(v.string()),
62
+ idika_state_last_updated_at: v.nullish(v.string()),
63
+ amka: v.nullish(v.string()),
64
+ amka_origin: v.nullish(v.number()),
65
+ can_use_amka: v.nullish(v.boolean()),
66
+ can_use_amka_origin: v.nullish(v.number()),
67
+ metadata: v.nullish(MetadataSchema),
68
+ metadata_origin: v.nullish(v.number()),
69
+ amka_crosschecked_with_idika: v.nullish(v.string()),
70
+ unverified_amka: v.nullish(v.string()),
71
+ unverified_amka_origin: v.nullish(v.string()),
69
72
  });
@@ -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 AfmDisplay = createFieldDisplay(
6
- object({
4
+ const AfmDisplaySchema = createFieldDisplay(
5
+ v.strictObject({
7
6
  component: v.literal('afm'),
8
7
  })
9
8
  );
10
9
 
11
- const AfmAttribute = nullish(
10
+ const AfmAttributeSchema = v.nullish(
12
11
  v.picklist([
13
12
  'afm',
14
13
  'confirm_signatories:afm',
@@ -25,14 +24,14 @@ const AfmAttribute = nullish(
25
24
  ])
26
25
  );
27
26
 
28
- const Afm = object({
27
+ const AfmSchema = v.strictObject({
29
28
  'user-input-mode': v.picklist(['noinput', 'optional', 'required', 'display']),
30
- attribute: AfmAttribute,
31
- datatype: nullish(v.literal('afm')),
32
- display: AfmDisplay,
33
- 'default-value': nullish(v.string()),
29
+ attribute: AfmAttributeSchema,
30
+ datatype: v.nullish(v.literal('afm')),
31
+ display: AfmDisplaySchema,
32
+ 'default-value': v.nullish(v.string()),
34
33
  });
35
- export type AfmType = v.Output<typeof Afm>;
36
- export type AfmSchemaType = v.BaseSchema<AfmType, AfmType>;
34
+ export type AfmType = v.InferOutput<typeof AfmSchema>;
35
+ export type AfmSchemaType = v.GenericSchema<AfmType>;
37
36
 
38
- export default Afm as AfmSchemaType;
37
+ export default AfmSchema as AfmSchemaType;
@@ -1,20 +1,21 @@
1
1
  import * as v from 'valibot';
2
- import { object, nullish } from '@uides/stepwise/schemas/common';
3
2
  import { createFieldDisplay } from '@uides/stepwise/schemas/field/common';
4
3
 
5
- const AmkaDisplay = createFieldDisplay(
6
- object({
4
+ const AmkaDisplaySchema = createFieldDisplay(
5
+ v.strictObject({
7
6
  component: v.literal('amka'),
8
7
  })
9
8
  );
10
9
 
11
- const Amka = object({
10
+ const AmkaSchema = v.strictObject({
12
11
  'user-input-mode': v.picklist(['noinput', 'optional', 'required']),
13
- 'default-value': nullish(v.string()),
12
+ 'default-value': v.nullish(v.string()),
14
13
  attribute: v.optional(v.null_()),
15
- display: AmkaDisplay,
16
- datatype: nullish(v.literal('amka')),
14
+ display: AmkaDisplaySchema,
15
+ datatype: v.nullish(v.literal('amka')),
17
16
  });
18
- export type AmkaType = v.BaseSchema<v.Output<typeof Amka>>;
19
17
 
20
- export default Amka as AmkaType;
18
+ export type AmkaType = v.InferOutput<typeof AmkaSchema>;
19
+ export type AmkaSchemaType = v.GenericSchema<AmkaType>;
20
+
21
+ export default AmkaSchema as AmkaSchemaType;
@@ -1,31 +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 AttachmentDisplay = createFieldDisplay(
6
- object({
4
+ const AttachmentDisplaySchema = createFieldDisplay(
5
+ v.strictObject({
7
6
  component: v.literal('attachment'),
8
- 'component-params': nullish(
9
- object({
10
- filetype: nullish(v.picklist(['pdf', 'pdf-for-mark'])),
11
- 'file-max-size': nullish(v.number()),
7
+ 'component-params': v.nullish(
8
+ v.strictObject({
9
+ filetype: v.nullish(v.picklist(['pdf', 'pdf-for-mark'])),
10
+ 'file-max-size': v.nullish(v.number()),
12
11
  })
13
12
  ),
14
13
  }),
15
- object({
14
+ v.strictObject({
16
15
  component: v.literal('attachment'),
17
- 'component-params': nullish(
16
+ 'component-params': v.nullish(
18
17
  // TODO: Make pdf component-params also inherit default component-params
19
- object({
20
- filetype: nullish(v.picklist(['pdf', 'pdf-for-mark'])),
21
- 'file-max-size': nullish(v.number()),
22
- coordinates: nullish(v.array(v.nullable(v.number()))),
18
+ v.strictObject({
19
+ filetype: v.nullish(v.picklist(['pdf', 'pdf-for-mark'])),
20
+ 'file-max-size': v.nullish(v.number()),
21
+ coordinates: v.nullish(v.array(v.nullable(v.number()))),
23
22
  })
24
23
  ),
25
24
  })
26
25
  );
27
26
 
28
- const AttachmentAttribute = nullish(
27
+ const AttachmentAttributeSchema = v.nullish(
29
28
  v.picklist([
30
29
  'cert_registry:pdf',
31
30
  'cert_registry_v2:certificate',
@@ -44,12 +43,14 @@ const AttachmentAttribute = nullish(
44
43
  ])
45
44
  );
46
45
 
47
- const Attachment = object({
46
+ const AttachmentSchema = v.strictObject({
48
47
  'user-input-mode': v.picklist(['noinput', 'optional', 'required', 'display']),
49
- datatype: nullish(v.literal('attachment')),
50
- attribute: AttachmentAttribute,
51
- display: AttachmentDisplay,
48
+ datatype: v.nullish(v.literal('attachment')),
49
+ attribute: AttachmentAttributeSchema,
50
+ display: AttachmentDisplaySchema,
52
51
  });
53
- export type AttachmentType = v.BaseSchema<v.Output<typeof Attachment>>;
54
52
 
55
- export default Attachment as AttachmentType;
53
+ export type AttachmentType = v.InferOutput<typeof AttachmentSchema>;
54
+ export type AttachmentSchemaType = v.GenericSchema<AttachmentType>;
55
+
56
+ export default AttachmentSchema as AttachmentSchemaType;
@@ -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 CaptchaDisplay = createFieldDisplay(
6
- object({
4
+ const CaptchaDisplaySchema = createFieldDisplay(
5
+ v.strictObject({
7
6
  component: v.literal('captcha'),
8
7
  })
9
8
  );
10
9
 
11
- const Captcha = object({
10
+ const CaptchaSchema = v.strictObject({
12
11
  'user-input-mode': v.picklist(['noinput', 'optional', 'required']),
13
- display: CaptchaDisplay,
12
+ display: CaptchaDisplaySchema,
14
13
  });
15
- export type CaptchaType = v.BaseSchema<v.Output<typeof Captcha>>;
16
14
 
17
- export default Captcha as CaptchaType;
15
+ export type CaptchaType = v.InferOutput<typeof CaptchaSchema>;
16
+ export type CaptchaSchemaType = v.GenericSchema<CaptchaType>;
17
+
18
+ export default CaptchaSchema as CaptchaSchemaType;
@@ -1,23 +1,22 @@
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 ChoiceDisplay = createFieldDisplay(
6
- object({
4
+ const ChoiceDisplaySchema = createFieldDisplay(
5
+ v.strictObject({
7
6
  component: v.literal('choice'),
8
- choices: nullish(v.union([v.string(), v.record(v.string())])),
9
- 'choices-order': nullish(v.string()),
10
- 'component-params': nullish(
11
- object({
12
- autocomplete: nullish(v.boolean()),
13
- 'legacy-mode': nullish(v.boolean()),
14
- 'format-title': nullish(v.boolean()),
7
+ choices: v.nullish(v.union([v.string(), v.record(v.string(), v.string())])),
8
+ 'choices-order': v.nullish(v.string()),
9
+ 'component-params': v.nullish(
10
+ v.strictObject({
11
+ autocomplete: v.nullish(v.boolean()),
12
+ 'legacy-mode': v.nullish(v.boolean()),
13
+ 'format-title': v.nullish(v.boolean()),
15
14
  })
16
15
  ),
17
16
  })
18
17
  );
19
18
 
20
- const ChoicesSourceFn = nullish(
19
+ const ChoicesSourceFnSchema = v.nullish(
21
20
  v.picklist([
22
21
  'dilosi.applications.deddie.claims.common.get_groups',
23
22
  'dilosi.applications.diplomas.claims.common.get_didactic_years',
@@ -28,14 +27,16 @@ const ChoicesSourceFn = nullish(
28
27
  ])
29
28
  );
30
29
 
31
- const Choice = object({
30
+ const ChoiceSchema = v.strictObject({
32
31
  'user-input-mode': v.picklist(['noinput', 'optional', 'required']),
33
- display: ChoiceDisplay,
34
- 'default-value': nullish(v.string()),
35
- 'choices-source-fn': ChoicesSourceFn,
36
- attribute: nullish(v.literal('find_onomatodosia:contact_confirm')),
37
- datatype: nullish(v.picklist(['choice', 'string'])),
32
+ display: ChoiceDisplaySchema,
33
+ 'default-value': v.nullish(v.string()),
34
+ 'choices-source-fn': ChoicesSourceFnSchema,
35
+ attribute: v.nullish(v.literal('find_onomatodosia:contact_confirm')),
36
+ datatype: v.nullish(v.picklist(['choice', 'string'])),
38
37
  });
39
- export type ChoiceType = v.BaseSchema<v.Output<typeof Choice>>;
40
38
 
41
- export default Choice as ChoiceType;
39
+ export type ChoiceType = v.InferOutput<typeof ChoiceSchema>;
40
+ export type ChoiceSchemaType = v.GenericSchema<ChoiceType>;
41
+
42
+ export default ChoiceSchema as ChoiceSchemaType;
@@ -36,19 +36,13 @@ const fiedlWithAllDisplays = {
36
36
  };
37
37
 
38
38
  const DisplaySchema = createFieldDisplay(
39
- v.object(
40
- {
41
- label: v.string(),
42
- value: v.number(),
43
- },
44
- v.never()
45
- ),
46
- v.object(
47
- {
48
- flag: v.boolean(),
49
- },
50
- v.never()
51
- )
39
+ v.strictObject({
40
+ label: v.string(),
41
+ value: v.number(),
42
+ }),
43
+ v.strictObject({
44
+ flag: v.boolean(),
45
+ })
52
46
  );
53
47
 
54
48
  describe('field display schema', () => {