@uides/stepwise 1.1.0-rc.26 → 2.0.0-b15d5d44
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/.rush/temp/chunked-rush-logs/stepwise.build.chunks.jsonl +4 -8
- package/.rush/temp/package-deps_build.json +67 -67
- package/.rush/temp/shrinkwrap-deps.json +2 -2
- package/package.json +6 -6
- package/rush-logs/stepwise.build.log +4 -8
- package/src/schemas/__tests__/step.spec.ts +2 -4
- package/src/schemas/action.ts +132 -131
- package/src/schemas/application.ts +7 -8
- package/src/schemas/attributes.ts +1 -1
- package/src/schemas/common.ts +15 -82
- package/src/schemas/document.ts +53 -49
- package/src/schemas/edupass-healthstate.ts +47 -44
- package/src/schemas/field/afm/index.ts +11 -12
- package/src/schemas/field/amka/index.ts +10 -9
- package/src/schemas/field/attachment/index.ts +21 -20
- package/src/schemas/field/captcha/index.ts +8 -7
- package/src/schemas/field/choice/index.ts +20 -19
- package/src/schemas/field/common.spec.ts +7 -13
- package/src/schemas/field/common.ts +103 -85
- package/src/schemas/field/date/index.ts +24 -23
- package/src/schemas/field/doc_subtitle/index.ts +10 -9
- package/src/schemas/field/doc_title/index.ts +18 -17
- package/src/schemas/field/dynamically-filled-text/index.ts +26 -24
- package/src/schemas/field/email/index.ts +12 -11
- package/src/schemas/field/fillable-string/index.ts +18 -17
- package/src/schemas/field/five-block-date/index.ts +8 -7
- package/src/schemas/field/green-pass-qrcode/index.ts +14 -15
- package/src/schemas/field/hidden/index.ts +58 -64
- package/src/schemas/field/hierarchical-selector/index.ts +27 -25
- package/src/schemas/field/iban/index.ts +11 -10
- package/src/schemas/field/image/index.ts +19 -18
- package/src/schemas/field/index.spec.ts +17 -19
- package/src/schemas/field/index.ts +176 -85
- package/src/schemas/field/int/index.ts +11 -10
- package/src/schemas/field/lab-results/index.ts +9 -8
- package/src/schemas/field/landline_phone/index.ts +8 -7
- package/src/schemas/field/mobile_phone/index.ts +12 -11
- package/src/schemas/field/multiple-choice/index.ts +15 -14
- package/src/schemas/field/pdf-image/index.ts +14 -13
- package/src/schemas/field/postal_code/index.ts +9 -8
- package/src/schemas/field/qrcode/index.ts +18 -17
- package/src/schemas/field/quote/index.ts +18 -17
- package/src/schemas/field/radio-choice/index.ts +21 -15
- package/src/schemas/field/rate/index.ts +10 -9
- package/src/schemas/field/recipient/index.ts +11 -10
- package/src/schemas/field/redirect/index.ts +12 -11
- package/src/schemas/field/refcode/index.ts +25 -24
- package/src/schemas/field/string/index.ts +42 -41
- package/src/schemas/field/text/index.ts +23 -22
- package/src/schemas/field/three-block-date/index.ts +15 -14
- package/src/schemas/fieldset/component-params.ts +40 -37
- package/src/schemas/fieldset/display-components.ts +42 -49
- package/src/schemas/fieldset/enums.ts +12 -6
- package/src/schemas/fieldset/index.ts +9 -10
- package/src/schemas/layout.ts +43 -32
- package/src/schemas/outputs.ts +7 -6
- package/src/schemas/resource/enums.ts +6 -6
- package/src/schemas/resource/field.ts +10 -8
- package/src/schemas/resource/object-action.ts +21 -16
- package/src/schemas/resource/resource-action.ts +19 -17
- package/src/schemas/resource/resource.ts +19 -20
- package/src/schemas/step.ts +116 -115
- package/src/schemas/template/enums.ts +2 -2
- package/src/schemas/template/template-base.ts +15 -13
- package/src/schemas/template/template-source.ts +12 -13
- package/src/schemas/template/template.ts +12 -13
- package/src/schemas/validation-context/enums.ts +5 -5
- package/src/schemas/validation-context/validation-context.ts +45 -44
- package/src/utils/index.spec.ts +2 -0
- package/src/utils/index.ts +5 -3
- package/.rush/temp/chunked-rush-logs/stepwise.lint.chunks.jsonl +0 -2
- package/rush-logs/stepwise.lint.error.log +0 -1
- package/rush-logs/stepwise.lint.log +0 -2
package/src/schemas/action.ts
CHANGED
|
@@ -1,129 +1,127 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
nullish,
|
|
6
|
-
object,
|
|
3
|
+
DisplayLangSchema,
|
|
4
|
+
DisplayModeSchema,
|
|
7
5
|
} from '@uides/stepwise/schemas/common';
|
|
8
6
|
|
|
9
|
-
const
|
|
7
|
+
const RetrySpecSchema = v.strictObject({
|
|
10
8
|
retry_limit: v.number(),
|
|
11
9
|
retry_delay: v.number(),
|
|
12
10
|
});
|
|
13
11
|
|
|
14
|
-
const
|
|
15
|
-
retry:
|
|
12
|
+
const PollSpecSchema = v.strictObject({
|
|
13
|
+
retry: RetrySpecSchema,
|
|
16
14
|
id_field: v.string(),
|
|
17
15
|
endpoint: v.string(),
|
|
18
16
|
});
|
|
19
17
|
|
|
20
|
-
const
|
|
18
|
+
const ActionDisplayBaseSchema = v.strictObject({
|
|
21
19
|
/** The text to display on the button */
|
|
22
|
-
label: nullish(v.string()),
|
|
23
|
-
icon: nullish(v.string()),
|
|
20
|
+
label: v.nullish(v.string()),
|
|
21
|
+
icon: v.nullish(v.string()),
|
|
24
22
|
/** The explanatory title of the action */
|
|
25
|
-
title: nullish(v.string()),
|
|
23
|
+
title: v.nullish(v.string()),
|
|
26
24
|
/** An explanatory subtitle for the action */
|
|
27
|
-
helptext: nullish(v.string()),
|
|
25
|
+
helptext: v.nullish(v.string()),
|
|
28
26
|
/**
|
|
29
27
|
* Whether it is considered a primary action
|
|
30
28
|
*
|
|
31
29
|
* This also determines the styling of the action button
|
|
32
30
|
*/
|
|
33
|
-
primary: nullish(v.boolean()),
|
|
34
|
-
url: nullish(v.string()),
|
|
31
|
+
primary: v.nullish(v.boolean()),
|
|
32
|
+
url: v.nullish(v.string()),
|
|
35
33
|
/** @default false */
|
|
36
|
-
self: nullish(v.boolean()),
|
|
34
|
+
self: v.nullish(v.boolean()),
|
|
37
35
|
/**
|
|
38
36
|
* Confirmation dialog title
|
|
39
37
|
*
|
|
40
38
|
* Title of dialog to display when the user clicks on the action button
|
|
41
39
|
*/
|
|
42
|
-
confirm_title: nullish(v.string()),
|
|
40
|
+
confirm_title: v.nullish(v.string()),
|
|
43
41
|
/**
|
|
44
42
|
* Confirmation dialog description
|
|
45
43
|
*
|
|
46
44
|
* Description of dialog to display when the user clicks on the action button
|
|
47
45
|
*/
|
|
48
|
-
confirm_message: nullish(v.string()),
|
|
46
|
+
confirm_message: v.nullish(v.string()),
|
|
49
47
|
/**
|
|
50
48
|
* Confirmation dialog 'confirm' button label
|
|
51
49
|
*
|
|
52
50
|
* Label of 'confirm' button included in dialog displayed when the user clicks on the action button
|
|
53
51
|
*/
|
|
54
|
-
confirm_confirm_label: nullish(v.string()),
|
|
52
|
+
confirm_confirm_label: v.nullish(v.string()),
|
|
55
53
|
/**
|
|
56
54
|
* Confirmation dialog 'cancel' button label
|
|
57
55
|
*
|
|
58
56
|
* Label of 'cancel' button included in dialog displayed when the user clicks on the action button
|
|
59
57
|
*/
|
|
60
|
-
confirm_cancel_label: nullish(v.string()),
|
|
61
|
-
warning: nullish(v.boolean()),
|
|
62
|
-
autocall: nullish(v.boolean()),
|
|
63
|
-
retry: nullish(
|
|
64
|
-
poll: nullish(
|
|
58
|
+
confirm_cancel_label: v.nullish(v.string()),
|
|
59
|
+
warning: v.nullish(v.boolean()),
|
|
60
|
+
autocall: v.nullish(v.boolean()),
|
|
61
|
+
retry: v.nullish(RetrySpecSchema),
|
|
62
|
+
poll: v.nullish(PollSpecSchema),
|
|
65
63
|
});
|
|
66
64
|
|
|
67
65
|
function createActionDisplay<T extends v.ObjectEntries>(
|
|
68
|
-
Display: v.
|
|
66
|
+
Display: v.StrictObjectSchema<T, undefined>
|
|
69
67
|
) {
|
|
70
68
|
return v.record(
|
|
71
|
-
|
|
69
|
+
DisplayModeSchema,
|
|
72
70
|
v.record(
|
|
73
|
-
|
|
74
|
-
v.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
)
|
|
71
|
+
DisplayLangSchema,
|
|
72
|
+
v.looseObject({
|
|
73
|
+
...v.partial(Display).entries,
|
|
74
|
+
...ActionDisplayBaseSchema.entries,
|
|
75
|
+
})
|
|
78
76
|
)
|
|
79
77
|
);
|
|
80
78
|
}
|
|
81
79
|
|
|
82
|
-
export const
|
|
80
|
+
export const TemporarySaveSchema = v.strictObject({
|
|
83
81
|
display: createActionDisplay(
|
|
84
|
-
|
|
82
|
+
v.strictObject({
|
|
85
83
|
component: v.literal('document-temporary-save'),
|
|
86
84
|
})
|
|
87
85
|
),
|
|
88
86
|
});
|
|
89
|
-
export type TemporarySave = v.
|
|
87
|
+
export type TemporarySave = v.InferOutput<typeof TemporarySaveSchema>;
|
|
90
88
|
|
|
91
|
-
export const
|
|
89
|
+
export const PdfSchema = v.strictObject({
|
|
92
90
|
display: createActionDisplay(
|
|
93
|
-
|
|
91
|
+
v.strictObject({
|
|
94
92
|
component: v.literal('document-download-pdf'),
|
|
95
93
|
})
|
|
96
94
|
),
|
|
97
|
-
'component-params': nullish(
|
|
98
|
-
|
|
95
|
+
'component-params': v.nullish(
|
|
96
|
+
v.strictObject({
|
|
99
97
|
filename: v.string(),
|
|
100
|
-
sign: nullish(v.boolean()),
|
|
98
|
+
sign: v.nullish(v.boolean()),
|
|
101
99
|
})
|
|
102
100
|
),
|
|
103
101
|
});
|
|
104
|
-
export type Pdf = v.
|
|
102
|
+
export type Pdf = v.InferOutput<typeof PdfSchema>;
|
|
105
103
|
|
|
106
|
-
export const
|
|
104
|
+
export const ResendOtpSchema = v.strictObject({
|
|
107
105
|
display: createActionDisplay(
|
|
108
|
-
|
|
106
|
+
v.strictObject({
|
|
109
107
|
component: v.literal('document-resend-otp'),
|
|
110
108
|
})
|
|
111
109
|
),
|
|
112
110
|
});
|
|
113
|
-
export type ResendOtp = v.
|
|
111
|
+
export type ResendOtp = v.InferOutput<typeof ResendOtpSchema>;
|
|
114
112
|
|
|
115
|
-
export const
|
|
113
|
+
export const CancelSchema = v.strictObject({
|
|
116
114
|
display: createActionDisplay(
|
|
117
|
-
|
|
115
|
+
v.strictObject({
|
|
118
116
|
component: v.literal('document-dismiss'),
|
|
119
117
|
})
|
|
120
118
|
),
|
|
121
119
|
});
|
|
122
|
-
export type Cancel = v.
|
|
120
|
+
export type Cancel = v.InferOutput<typeof CancelSchema>;
|
|
123
121
|
|
|
124
|
-
export const
|
|
122
|
+
export const UpdateSchema = v.strictObject({
|
|
125
123
|
display: createActionDisplay(
|
|
126
|
-
|
|
124
|
+
v.strictObject({
|
|
127
125
|
component: v.picklist([
|
|
128
126
|
'document-update',
|
|
129
127
|
'document-collect',
|
|
@@ -131,171 +129,171 @@ export const Update = object({
|
|
|
131
129
|
]),
|
|
132
130
|
})
|
|
133
131
|
),
|
|
134
|
-
'component-params': nullish(
|
|
135
|
-
|
|
136
|
-
issue: nullish(v.boolean()),
|
|
137
|
-
mark_submitting: nullish(v.boolean()),
|
|
138
|
-
'ensure-no-input': nullish(v.boolean()),
|
|
132
|
+
'component-params': v.nullish(
|
|
133
|
+
v.strictObject({
|
|
134
|
+
issue: v.nullish(v.boolean()),
|
|
135
|
+
mark_submitting: v.nullish(v.boolean()),
|
|
136
|
+
'ensure-no-input': v.nullish(v.boolean()),
|
|
139
137
|
})
|
|
140
138
|
),
|
|
141
139
|
});
|
|
142
|
-
export type Update = v.
|
|
140
|
+
export type Update = v.InferOutput<typeof UpdateSchema>;
|
|
143
141
|
|
|
144
|
-
export const
|
|
142
|
+
export const CreateSchema = v.strictObject({
|
|
145
143
|
display: createActionDisplay(
|
|
146
|
-
|
|
144
|
+
v.strictObject({
|
|
147
145
|
component: v.literal('document-create'),
|
|
148
146
|
})
|
|
149
147
|
),
|
|
150
148
|
});
|
|
151
|
-
export type Create = v.
|
|
149
|
+
export type Create = v.InferOutput<typeof CreateSchema>;
|
|
152
150
|
|
|
153
|
-
export const
|
|
151
|
+
export const AnonCreateSchema = v.strictObject({
|
|
154
152
|
display: createActionDisplay(
|
|
155
|
-
|
|
153
|
+
v.strictObject({
|
|
156
154
|
component: v.literal('document-anon-create'),
|
|
157
155
|
})
|
|
158
156
|
),
|
|
159
157
|
});
|
|
160
|
-
export type AnonCreate = v.
|
|
158
|
+
export type AnonCreate = v.InferOutput<typeof AnonCreateSchema>;
|
|
161
159
|
|
|
162
|
-
export const
|
|
160
|
+
export const RevokeSchema = v.strictObject({
|
|
163
161
|
display: createActionDisplay(
|
|
164
|
-
|
|
162
|
+
v.strictObject({
|
|
165
163
|
component: v.literal('document-revoke'),
|
|
166
164
|
})
|
|
167
165
|
),
|
|
168
|
-
'component-params': nullish(
|
|
169
|
-
|
|
166
|
+
'component-params': v.nullish(
|
|
167
|
+
v.strictObject({
|
|
170
168
|
next_step: v.string(),
|
|
171
169
|
})
|
|
172
170
|
),
|
|
173
171
|
});
|
|
174
|
-
export type Revoke = v.
|
|
172
|
+
export type Revoke = v.InferOutput<typeof RevokeSchema>;
|
|
175
173
|
|
|
176
|
-
export const
|
|
174
|
+
export const ShareSchema = v.strictObject({
|
|
177
175
|
display: createActionDisplay(
|
|
178
|
-
|
|
176
|
+
v.strictObject({
|
|
179
177
|
component: v.literal('document-share'),
|
|
180
178
|
})
|
|
181
179
|
),
|
|
182
180
|
});
|
|
183
|
-
export type Share = v.
|
|
181
|
+
export type Share = v.InferOutput<typeof ShareSchema>;
|
|
184
182
|
|
|
185
|
-
export const
|
|
183
|
+
export const EmailSchema = v.strictObject({
|
|
186
184
|
display: createActionDisplay(
|
|
187
|
-
|
|
185
|
+
v.strictObject({
|
|
188
186
|
component: v.literal('document-email'),
|
|
189
187
|
})
|
|
190
188
|
),
|
|
191
|
-
'component-params': nullish(
|
|
192
|
-
|
|
189
|
+
'component-params': v.nullish(
|
|
190
|
+
v.strictObject({
|
|
193
191
|
template: v.string(),
|
|
194
192
|
email_field: v.string(),
|
|
195
193
|
subject: v.string(),
|
|
196
194
|
})
|
|
197
195
|
),
|
|
198
196
|
});
|
|
199
|
-
export type Email = v.
|
|
197
|
+
export type Email = v.InferOutput<typeof EmailSchema>;
|
|
200
198
|
|
|
201
|
-
export const
|
|
199
|
+
export const SmsSchema = v.strictObject({
|
|
202
200
|
display: createActionDisplay(
|
|
203
|
-
|
|
201
|
+
v.strictObject({
|
|
204
202
|
component: v.literal('document-sms'),
|
|
205
203
|
})
|
|
206
204
|
),
|
|
207
|
-
'component-params': nullish(
|
|
208
|
-
|
|
205
|
+
'component-params': v.nullish(
|
|
206
|
+
v.strictObject({
|
|
209
207
|
sms_field: v.string(),
|
|
210
208
|
template: v.string(),
|
|
211
209
|
})
|
|
212
210
|
),
|
|
213
211
|
});
|
|
214
|
-
export type Sms = v.
|
|
212
|
+
export type Sms = v.InferOutput<typeof SmsSchema>;
|
|
215
213
|
|
|
216
|
-
export const
|
|
214
|
+
export const CommunicationSchema = v.strictObject({
|
|
217
215
|
display: createActionDisplay(
|
|
218
|
-
|
|
216
|
+
v.strictObject({
|
|
219
217
|
component: v.literal('entity-send-message'),
|
|
220
218
|
})
|
|
221
219
|
),
|
|
222
|
-
'component-params': nullish(
|
|
223
|
-
|
|
220
|
+
'component-params': v.nullish(
|
|
221
|
+
v.strictObject({
|
|
224
222
|
'contact-phone-field': v.string(),
|
|
225
223
|
'contact-email-field': v.string(),
|
|
226
|
-
'message-subject': nullish(v.string()),
|
|
224
|
+
'message-subject': v.nullish(v.string()),
|
|
227
225
|
})
|
|
228
226
|
),
|
|
229
227
|
});
|
|
230
|
-
export type Communication = v.
|
|
228
|
+
export type Communication = v.InferOutput<typeof CommunicationSchema>;
|
|
231
229
|
|
|
232
|
-
export const
|
|
230
|
+
export const ForwardSchema = v.strictObject({
|
|
233
231
|
display: createActionDisplay(
|
|
234
|
-
|
|
232
|
+
v.strictObject({
|
|
235
233
|
component: v.literal('entity-forward'),
|
|
236
234
|
})
|
|
237
235
|
),
|
|
238
|
-
'component-params': nullish(
|
|
239
|
-
|
|
240
|
-
notify_user: nullish(v.boolean()),
|
|
241
|
-
'message-subject': nullish(v.string()),
|
|
242
|
-
message: nullish(v.string()),
|
|
236
|
+
'component-params': v.nullish(
|
|
237
|
+
v.strictObject({
|
|
238
|
+
notify_user: v.nullish(v.boolean()),
|
|
239
|
+
'message-subject': v.nullish(v.string()),
|
|
240
|
+
message: v.nullish(v.string()),
|
|
243
241
|
})
|
|
244
242
|
),
|
|
245
243
|
});
|
|
246
|
-
export type Forward = v.
|
|
244
|
+
export type Forward = v.InferOutput<typeof ForwardSchema>;
|
|
247
245
|
|
|
248
|
-
export const
|
|
246
|
+
export const AuthorizedPdfSchema = v.strictObject({
|
|
249
247
|
display: createActionDisplay(
|
|
250
|
-
|
|
248
|
+
v.strictObject({
|
|
251
249
|
component: v.literal('entity-print-pdf'),
|
|
252
250
|
})
|
|
253
251
|
),
|
|
254
252
|
});
|
|
255
|
-
export type AuthorizedPdf = v.
|
|
253
|
+
export type AuthorizedPdf = v.InferOutput<typeof AuthorizedPdfSchema>;
|
|
256
254
|
|
|
257
|
-
export const
|
|
255
|
+
export const ReplySchema = v.strictObject({
|
|
258
256
|
display: createActionDisplay(
|
|
259
|
-
|
|
257
|
+
v.strictObject({
|
|
260
258
|
component: v.picklist(['entity-reply', 'hidden']),
|
|
261
259
|
})
|
|
262
260
|
),
|
|
263
|
-
'component-params': nullish(
|
|
264
|
-
|
|
265
|
-
'reply-templates': v.record(v.any()), // TODO: Replace any with actual type
|
|
261
|
+
'component-params': v.nullish(
|
|
262
|
+
v.strictObject({
|
|
263
|
+
'reply-templates': v.record(v.string(), v.any()), // TODO: Replace any with actual type
|
|
266
264
|
})
|
|
267
265
|
),
|
|
268
266
|
});
|
|
269
|
-
export type Reply = v.
|
|
267
|
+
export type Reply = v.InferOutput<typeof ReplySchema>;
|
|
270
268
|
|
|
271
|
-
export const
|
|
269
|
+
export const WebPrintSchema = v.strictObject({
|
|
272
270
|
display: createActionDisplay(
|
|
273
|
-
|
|
271
|
+
v.strictObject({
|
|
274
272
|
component: v.literal('web-print'),
|
|
275
273
|
})
|
|
276
274
|
),
|
|
277
275
|
});
|
|
278
|
-
export type WebPrint = v.
|
|
276
|
+
export type WebPrint = v.InferOutput<typeof WebPrintSchema>;
|
|
279
277
|
|
|
280
|
-
export const
|
|
278
|
+
export const NewDeclOrTempSavePreviewSchema = v.strictObject({
|
|
281
279
|
display: createActionDisplay(
|
|
282
|
-
|
|
280
|
+
v.strictObject({
|
|
283
281
|
component: v.literal('link'),
|
|
284
282
|
})
|
|
285
283
|
),
|
|
286
284
|
});
|
|
287
|
-
export type NewDeclOrTempSavePreview = v.
|
|
288
|
-
typeof
|
|
285
|
+
export type NewDeclOrTempSavePreview = v.InferOutput<
|
|
286
|
+
typeof NewDeclOrTempSavePreviewSchema
|
|
289
287
|
>;
|
|
290
288
|
|
|
291
|
-
export const
|
|
289
|
+
export const BackstepSchema = v.strictObject({
|
|
292
290
|
display: createActionDisplay(
|
|
293
|
-
|
|
291
|
+
v.strictObject({
|
|
294
292
|
component: v.literal('document-backstep'),
|
|
295
293
|
})
|
|
296
294
|
),
|
|
297
295
|
});
|
|
298
|
-
export type Backstep = v.
|
|
296
|
+
export type Backstep = v.InferOutput<typeof BackstepSchema>;
|
|
299
297
|
|
|
300
298
|
/**
|
|
301
299
|
* Describes the action that can be performed on a step
|
|
@@ -303,28 +301,31 @@ export type Backstep = v.Output<typeof Backstep>;
|
|
|
303
301
|
* An action is usually translated as a button in the UI, which the user can click
|
|
304
302
|
* to perform an action, like downloading a PDF or going to the next step.
|
|
305
303
|
*/
|
|
306
|
-
export const
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
304
|
+
export const ActionSchema = v.variant('display', [
|
|
305
|
+
TemporarySaveSchema,
|
|
306
|
+
PdfSchema,
|
|
307
|
+
ResendOtpSchema,
|
|
308
|
+
CancelSchema,
|
|
309
|
+
UpdateSchema,
|
|
310
|
+
CreateSchema,
|
|
311
|
+
AnonCreateSchema,
|
|
312
|
+
RevokeSchema,
|
|
313
|
+
ShareSchema,
|
|
314
|
+
EmailSchema,
|
|
315
|
+
SmsSchema,
|
|
316
|
+
CommunicationSchema,
|
|
317
|
+
ForwardSchema,
|
|
318
|
+
AuthorizedPdfSchema,
|
|
319
|
+
ReplySchema,
|
|
320
|
+
WebPrintSchema,
|
|
321
|
+
NewDeclOrTempSavePreviewSchema,
|
|
322
|
+
BackstepSchema,
|
|
325
323
|
]);
|
|
326
|
-
export type Action = v.
|
|
324
|
+
export type Action = v.InferOutput<typeof ActionSchema>;
|
|
327
325
|
export default Action;
|
|
328
326
|
|
|
329
327
|
export type Actions = Record<string, Action>;
|
|
330
|
-
export const ActionsSchema = v.record(
|
|
328
|
+
export const ActionsSchema = v.record(
|
|
329
|
+
v.string(),
|
|
330
|
+
ActionSchema
|
|
331
|
+
) as v.GenericSchema<Actions, Actions>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
-
import { nullish, object } from '@uides/stepwise/schemas/common';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* As defined in application_data_schema.py
|
|
6
5
|
*/
|
|
7
|
-
export const
|
|
6
|
+
export const ApplicationDataSpecSchema = v.strictObject({
|
|
8
7
|
application_name: v.string(),
|
|
9
8
|
key_schema: v.any(),
|
|
10
9
|
data_schema: v.any(),
|
|
@@ -13,10 +12,10 @@ export const ApplicationDataSpec = object({
|
|
|
13
12
|
/**
|
|
14
13
|
* As defined in application_schema.py
|
|
15
14
|
*/
|
|
16
|
-
export const
|
|
17
|
-
TEMPLATES: nullish(v.any()),
|
|
18
|
-
DATASETS: nullish(v.any()),
|
|
19
|
-
CLAIMS: nullish(v.any()),
|
|
20
|
-
RESOURCES: nullish(v.any()),
|
|
21
|
-
APPLICATION_DATA: nullish(v.any()),
|
|
15
|
+
export const ApplicationSpecSchema = v.strictObject({
|
|
16
|
+
TEMPLATES: v.nullish(v.any()),
|
|
17
|
+
DATASETS: v.nullish(v.any()),
|
|
18
|
+
CLAIMS: v.nullish(v.any()),
|
|
19
|
+
RESOURCES: v.nullish(v.any()),
|
|
20
|
+
APPLICATION_DATA: v.nullish(v.any()),
|
|
22
21
|
});
|
|
@@ -14,7 +14,7 @@ import * as v from 'valibot';
|
|
|
14
14
|
* @value 'mobile_certified_login' Mobile certified login.
|
|
15
15
|
* @value 'mobile_certified_nnc' Mobile certified NNC.
|
|
16
16
|
*/
|
|
17
|
-
export const
|
|
17
|
+
export const AttributeSchema = v.picklist([
|
|
18
18
|
'firstname',
|
|
19
19
|
'surname',
|
|
20
20
|
'afm',
|
package/src/schemas/common.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
2
|
|
|
3
|
-
export const
|
|
4
|
-
export type DisplayLang = v.
|
|
3
|
+
export const DisplayLangSchema = v.picklist(['default', 'el', 'en', 'fr']);
|
|
4
|
+
export type DisplayLang = v.InferOutput<typeof DisplayLangSchema>;
|
|
5
5
|
|
|
6
|
-
export const
|
|
7
|
-
export type DisplayMode = v.
|
|
8
|
-
export const
|
|
6
|
+
export const DisplayModeSchema = v.picklist(['default', 'web', 'pdf']);
|
|
7
|
+
export type DisplayMode = v.InferOutput<typeof DisplayModeSchema>;
|
|
8
|
+
export const FontSchema = v.picklist([
|
|
9
9
|
'Font-Regular',
|
|
10
10
|
'Font-Bold',
|
|
11
11
|
'Font-Mono',
|
|
@@ -14,89 +14,22 @@ export const Font = v.picklist([
|
|
|
14
14
|
'OpenSans-Light',
|
|
15
15
|
]);
|
|
16
16
|
|
|
17
|
-
export const
|
|
18
|
-
grid: nullish(v.boolean()),
|
|
19
|
-
xs: nullish(v.string()),
|
|
20
|
-
sm: nullish(v.string()),
|
|
21
|
-
md: nullish(v.string()),
|
|
22
|
-
lg: nullish(v.string()),
|
|
23
|
-
xl: nullish(v.string()),
|
|
17
|
+
export const ComponentLayoutSchema = v.strictObject({
|
|
18
|
+
grid: v.nullish(v.boolean()),
|
|
19
|
+
xs: v.nullish(v.string()),
|
|
20
|
+
sm: v.nullish(v.string()),
|
|
21
|
+
md: v.nullish(v.string()),
|
|
22
|
+
lg: v.nullish(v.string()),
|
|
23
|
+
xl: v.nullish(v.string()),
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
export function nullish<TWrapped extends v.BaseSchema>(
|
|
27
|
-
wrapped: TWrapped
|
|
28
|
-
): v.OptionalSchema<v.NullableSchema<TWrapped>> {
|
|
29
|
-
return v.optional(v.nullable(wrapped));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function object<TEntries extends v.ObjectEntries>(
|
|
33
|
-
entries: TEntries,
|
|
34
|
-
pipe?: v.Pipe<v.ObjectOutput<TEntries, undefined>>
|
|
35
|
-
): v.ObjectSchema<TEntries, v.NeverSchema> {
|
|
36
|
-
return v.object(entries, v.never(), pipe);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
type FieldValidation<TInput> = v.BaseValidation<TInput> & {
|
|
40
|
-
/**
|
|
41
|
-
* The validation type.
|
|
42
|
-
*/
|
|
43
|
-
type: 'field-validation';
|
|
44
|
-
/**
|
|
45
|
-
* The validated field.
|
|
46
|
-
*/
|
|
47
|
-
field: keyof TInput;
|
|
48
|
-
/**
|
|
49
|
-
* The validation function.
|
|
50
|
-
*/
|
|
51
|
-
requirement: (input: TInput) => boolean;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
26
|
// TODO: Allow for custom error message
|
|
55
27
|
export function validateField<TInput, TKey extends keyof TInput>(
|
|
56
28
|
key: TKey,
|
|
57
29
|
callback: (v: TInput[TKey], values: TInput) => boolean
|
|
58
|
-
)
|
|
59
|
-
|
|
30
|
+
) {
|
|
31
|
+
return v.check((values: TInput) => {
|
|
60
32
|
const value = values[key];
|
|
61
33
|
return callback(value, values);
|
|
62
|
-
});
|
|
63
|
-
return {
|
|
64
|
-
...customValidationResult,
|
|
65
|
-
message: `Invalid field '${key.toString()}'`,
|
|
66
|
-
type: 'field-validation',
|
|
67
|
-
field: key,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface SpecialSchemaWithNestedSchema<TInput, TOutput = TInput>
|
|
72
|
-
extends v.BaseSchema<TInput, TOutput> {
|
|
73
|
-
/** The schema type. */
|
|
74
|
-
type: 'special';
|
|
75
|
-
/** The type check function. */
|
|
76
|
-
check: (input: TInput) => v.SchemaIssues | undefined;
|
|
77
|
-
/** The error message. */
|
|
78
|
-
message: v.ErrorMessage | undefined;
|
|
79
|
-
/** The validation and transformation pipeline. */
|
|
80
|
-
pipe: v.Pipe<TInput> | undefined;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export function specialWithNestedSchema<TInput>(
|
|
84
|
-
check: (input: TInput) => v.SchemaIssues | undefined,
|
|
85
|
-
arg2?: v.Pipe<TInput> | v.ErrorMessage,
|
|
86
|
-
arg3?: v.Pipe<TInput>
|
|
87
|
-
): SpecialSchemaWithNestedSchema<TInput> {
|
|
88
|
-
const [message, pipe] = v.defaultArgs(arg2, arg3);
|
|
89
|
-
|
|
90
|
-
return {
|
|
91
|
-
type: 'special',
|
|
92
|
-
expects: 'unknown',
|
|
93
|
-
async: false,
|
|
94
|
-
check,
|
|
95
|
-
message,
|
|
96
|
-
pipe,
|
|
97
|
-
_parse(input, config) {
|
|
98
|
-
const issues = this.check(input as TInput);
|
|
99
|
-
return v.pipeResult(this, input as TInput, config, issues);
|
|
100
|
-
},
|
|
101
|
-
};
|
|
34
|
+
}, `Invalid field '${key.toString()}'`);
|
|
102
35
|
}
|