@wise/dynamic-flow-types 2.15.0 → 2.15.1-experimental-node20-6554c5d

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.
@@ -2,26 +2,39 @@
2
2
  import { z } from 'zod';
3
3
  import type {
4
4
  JsonElement,
5
- Step,
5
+ ArraySchemaTuple,
6
6
  Schema,
7
- Layout,
8
- ModalLayoutContent,
9
- BoxLayout,
10
- ColumnsLayout,
11
- ModalLayout,
12
7
  PersistAsync,
13
- ArraySchemaTuple,
14
8
  OneOfSchema,
15
- BooleanSchema,
16
- StringSchema,
17
9
  ObjectSchema,
10
+ ArraySchemaList,
18
11
  AllOfSchema,
19
12
  ArraySchema,
13
+ BooleanSchema,
20
14
  IntegerSchema,
21
15
  NumberSchema,
22
- ArraySchemaList,
16
+ StringSchema,
17
+ Step,
18
+ Layout,
19
+ BoxLayout,
20
+ ModalLayout,
21
+ ModalLayoutContent,
22
+ ColumnsLayout,
23
23
  } from '../next';
24
24
 
25
+ export const imageSchema = z.object({
26
+ text: z.string().optional(),
27
+ url: z.string(),
28
+ accessibilityDescription: z.string().optional(),
29
+ });
30
+
31
+ export const summaryProviderSchema = z.object({
32
+ providesTitle: z.boolean().optional(),
33
+ providesDescription: z.boolean().optional(),
34
+ providesIcon: z.boolean().optional(),
35
+ providesImage: z.boolean().optional(),
36
+ });
37
+
25
38
  export const jsonElementSchema: z.ZodSchema<JsonElement> = z.lazy(() =>
26
39
  z
27
40
  .union([
@@ -34,141 +47,10 @@ export const jsonElementSchema: z.ZodSchema<JsonElement> = z.lazy(() =>
34
47
  .nullable(),
35
48
  );
36
49
 
37
- export const externalSchema = z.object({
38
- url: z.string(),
39
- });
40
-
41
- export const stepErrorSchema = z.object({
42
- error: z.string().optional(),
43
- validation: jsonElementSchema.optional(),
44
- });
45
-
46
- export const sizeSchema = z.union([
47
- z.literal('xs'),
48
- z.literal('sm'),
49
- z.literal('md'),
50
- z.literal('lg'),
51
- z.literal('xl'),
52
- ]);
53
-
54
- export const alignSchema = z.union([z.literal('left'), z.literal('center'), z.literal('right')]);
55
-
56
- export const dividerLayoutSchema = z.object({
57
- type: z.literal('divider'),
58
- control: z.string().optional(),
59
- margin: sizeSchema.optional(),
60
- });
61
-
62
- export const headingLayoutSchema = z.object({
63
- type: z.literal('heading'),
64
- text: z.string(),
65
- size: sizeSchema.optional(),
66
- align: alignSchema.optional(),
67
- control: z.string().optional(),
68
- margin: sizeSchema.optional(),
69
- });
70
-
71
- export const contextSchema = z.union([
72
- z.literal('positive'),
73
- z.literal('neutral'),
74
- z.literal('warning'),
75
- z.literal('negative'),
76
- z.literal('success'),
77
- z.literal('failure'),
78
- z.literal('info'),
79
- z.literal('primary'),
80
- ]);
81
-
82
- export const instructionsLayoutItemSchema = z.object({
83
- text: z.string(),
84
- context: contextSchema,
85
- });
86
-
87
- export const listLayoutStatusSchema = z.union([
88
- z.literal('warning'),
89
- z.literal('neutral'),
90
- z.literal('positive'),
91
- ]);
92
-
93
- export const modalLayoutTriggerSchema = z.object({
94
- title: z.string(),
95
- });
96
-
97
- export const markdownLayoutSchema = z.object({
98
- type: z.literal('markdown'),
99
- content: z.string(),
100
- align: alignSchema.optional(),
101
- control: z.string().optional(),
102
- margin: sizeSchema.optional(),
103
- });
104
-
105
- export const infoLayoutSchema = z.object({
106
- type: z.literal('info'),
107
- markdown: z.string(),
108
- align: alignSchema.optional(),
109
- control: z.string().optional(),
110
- margin: sizeSchema.optional(),
111
- });
112
-
113
50
  export const helpSchema = z.object({
114
51
  markdown: z.string(),
115
52
  });
116
53
 
117
- export const imageLayoutSchema = z.object({
118
- type: z.literal('image'),
119
- text: z.string().optional(),
120
- url: z.string(),
121
- size: sizeSchema.optional(),
122
- accessibilityDescription: z.string().optional(),
123
- control: z.string().optional(),
124
- margin: sizeSchema.optional(),
125
- });
126
-
127
- export const loadingIndicatorLayoutSchema = z.object({
128
- type: z.literal('loading-indicator'),
129
- size: sizeSchema.optional(),
130
- control: z.string().optional(),
131
- margin: sizeSchema.optional(),
132
- });
133
-
134
- export const formLayoutSchemaReferenceSchema = z.object({
135
- $ref: z.string(),
136
- });
137
-
138
- export const httpMethodSchema = z.union([
139
- z.literal('GET'),
140
- z.literal('POST'),
141
- z.literal('PUT'),
142
- z.literal('PATCH'),
143
- z.literal('DELETE'),
144
- ]);
145
-
146
- export const statusListLayoutStatusSchema = z.union([
147
- z.literal('not-done'),
148
- z.literal('pending'),
149
- z.literal('done'),
150
- ]);
151
-
152
- export const columnsLayoutBiasSchema = z.union([
153
- z.literal('none'),
154
- z.literal('left'),
155
- z.literal('right'),
156
- ]);
157
-
158
- export const iconNamedSchema = z.object({
159
- name: z.string(),
160
- });
161
-
162
- export const iconTextSchema = z.object({
163
- text: z.string(),
164
- });
165
-
166
- export const imageSchema = z.object({
167
- text: z.string().optional(),
168
- url: z.string(),
169
- accessibilityDescription: z.string().optional(),
170
- });
171
-
172
54
  export const autocompleteTokenSchema = z.union([
173
55
  z.literal('on'),
174
56
  z.literal('name'),
@@ -235,21 +117,42 @@ export const autocompleteTokenSchema = z.union([
235
117
  z.literal('pager'),
236
118
  ]);
237
119
 
238
- export const searchSearchRequestSchema = z.object({
120
+ export const uploadSourceSchema = z.union([z.literal('camera'), z.literal('file')]);
121
+
122
+ export const stringSchemaFormatSchema = z.union([
123
+ z.literal('date'),
124
+ z.literal('email'),
125
+ z.literal('numeric'),
126
+ z.literal('password'),
127
+ z.literal('phone-number'),
128
+ z.literal('base64url'),
129
+ ]);
130
+
131
+ export const externalSchema = z.object({
239
132
  url: z.string(),
240
- method: httpMethodSchema,
241
- param: z.string(),
242
- query: z.string(),
243
133
  });
244
134
 
245
- export const errorResponseBodySchema = z.object({
246
- refreshFormUrl: z.string().optional(),
247
- analytics: z.record(z.string()).optional(),
135
+ export const stepErrorSchema = z.object({
248
136
  error: z.string().optional(),
249
137
  validation: jsonElementSchema.optional(),
250
- refreshUrl: z.string().optional(),
251
138
  });
252
139
 
140
+ export const httpMethodSchema = z.union([
141
+ z.literal('GET'),
142
+ z.literal('POST'),
143
+ z.literal('PUT'),
144
+ z.literal('PATCH'),
145
+ z.literal('DELETE'),
146
+ ]);
147
+
148
+ export const actionTypeSchema = z.union([
149
+ z.literal('primary'),
150
+ z.literal('secondary'),
151
+ z.literal('link'),
152
+ z.literal('positive'),
153
+ z.literal('negative'),
154
+ ]);
155
+
253
156
  export const navigationStackBehaviorSchema = z.union([
254
157
  z.literal('default'),
255
158
  z.literal('remove-previous'),
@@ -257,89 +160,51 @@ export const navigationStackBehaviorSchema = z.union([
257
160
  z.literal('replace-current'),
258
161
  ]);
259
162
 
260
- export const summaryProviderSchema = z.object({
261
- providesTitle: z.boolean().optional(),
262
- providesDescription: z.boolean().optional(),
263
- providesIcon: z.boolean().optional(),
264
- providesImage: z.boolean().optional(),
265
- });
163
+ export const sizeSchema = z.union([
164
+ z.literal('xs'),
165
+ z.literal('sm'),
166
+ z.literal('md'),
167
+ z.literal('lg'),
168
+ z.literal('xl'),
169
+ ]);
266
170
 
267
- export const validateAsyncSchema = z.object({
268
- param: z.string(),
269
- method: httpMethodSchema,
270
- url: z.string(),
271
- });
171
+ export const listLayoutStatusSchema = z.union([
172
+ z.literal('warning'),
173
+ z.literal('neutral'),
174
+ z.literal('positive'),
175
+ ]);
272
176
 
273
- export const actionTypeSchema = z.union([
274
- z.literal('primary'),
275
- z.literal('secondary'),
276
- z.literal('link'),
177
+ export const contextSchema = z.union([
277
178
  z.literal('positive'),
179
+ z.literal('neutral'),
180
+ z.literal('warning'),
278
181
  z.literal('negative'),
182
+ z.literal('success'),
183
+ z.literal('failure'),
184
+ z.literal('info'),
185
+ z.literal('primary'),
279
186
  ]);
280
187
 
281
- export const uploadSourceSchema = z.union([z.literal('camera'), z.literal('file')]);
188
+ export const modalLayoutTriggerSchema = z.object({
189
+ title: z.string(),
190
+ });
282
191
 
283
- export const stringSchemaFormatSchema = z.union([
284
- z.literal('date'),
285
- z.literal('email'),
286
- z.literal('numeric'),
287
- z.literal('password'),
288
- z.literal('phone-number'),
289
- z.literal('base64url'),
290
- ]);
192
+ export const formLayoutSchemaReferenceSchema = z.object({
193
+ $ref: z.string(),
194
+ });
291
195
 
292
- export const actionSchema = z.object({
293
- title: z.string().optional(),
294
- type: actionTypeSchema.optional(),
295
- disabled: z.boolean().optional(),
296
- $id: z.string().optional(),
297
- $ref: z.string().optional(),
298
- id: z.string().optional(),
299
- url: z.string().optional(),
300
- method: httpMethodSchema.optional(),
301
- exit: z.boolean().optional(),
302
- result: jsonElementSchema.optional(),
303
- data: jsonElementSchema.optional(),
304
- timeout: z.number().optional(),
305
- skipValidation: z.boolean().optional(),
306
- });
307
-
308
- export const linkHandlerSchema = z.object({
309
- regexPattern: z.string(),
310
- action: actionSchema,
311
- });
312
-
313
- export const reviewLayoutCallToActionSchema = z.object({
314
- title: z.string(),
315
- action: actionSchema,
316
- });
317
-
318
- export const paragraphLayoutSchema = z.object({
319
- type: z.literal('paragraph'),
320
- text: z.string(),
321
- align: alignSchema.optional(),
322
- control: z.string().optional(),
323
- margin: sizeSchema.optional(),
324
- });
325
-
326
- export const alertLayoutSchema = z.object({
327
- type: z.literal('alert'),
328
- markdown: z.string(),
329
- context: contextSchema.optional(),
196
+ export const dividerLayoutSchema = z.object({
197
+ type: z.literal('divider'),
330
198
  control: z.string().optional(),
331
199
  margin: sizeSchema.optional(),
332
200
  });
333
201
 
334
- export const instructionsLayoutSchema = z.object({
335
- type: z.literal('instructions'),
336
- title: z.string().optional(),
337
- items: z.array(instructionsLayoutItemSchema),
338
- control: z.string().optional(),
339
- margin: sizeSchema.optional(),
202
+ export const instructionsLayoutItemSchema = z.object({
203
+ text: z.string(),
204
+ context: contextSchema,
340
205
  });
341
206
 
342
- export const iconSchema = z.union([iconNamedSchema, iconTextSchema]);
207
+ export const alignSchema = z.union([z.literal('left'), z.literal('center'), z.literal('right')]);
343
208
 
344
209
  export const reviewLayoutFieldSchema = z.object({
345
210
  label: z.string(),
@@ -347,97 +212,98 @@ export const reviewLayoutFieldSchema = z.object({
347
212
  help: helpSchema.optional(),
348
213
  });
349
214
 
350
- export const buttonLayoutSchema = z.object({
351
- type: z.literal('button'),
352
- size: sizeSchema.optional(),
353
- title: z.string().optional(),
354
- action: actionSchema,
355
- context: contextSchema.optional(),
356
- disabled: z.boolean().optional(),
357
- pinOrder: z.number().optional(),
215
+ export const searchLayoutSchema = z.object({
216
+ type: z.literal('search'),
217
+ title: z.string(),
218
+ method: httpMethodSchema,
219
+ url: z.string(),
220
+ param: z.string(),
221
+ emptyMessage: z.string().optional(),
358
222
  control: z.string().optional(),
359
223
  margin: sizeSchema.optional(),
360
224
  });
361
225
 
362
- export const formLayoutSchema = z.object({
363
- type: z.literal('form'),
364
- schema: formLayoutSchemaReferenceSchema.optional(),
365
- schemaId: z.string(),
226
+ export const paragraphLayoutSchema = z.object({
227
+ type: z.literal('paragraph'),
228
+ text: z.string(),
229
+ align: alignSchema.optional(),
366
230
  control: z.string().optional(),
367
231
  margin: sizeSchema.optional(),
368
232
  });
369
233
 
370
- export const reviewLayoutSchema = z.object({
371
- type: z.literal('review'),
372
- orientation: z.string().optional(),
373
- action: actionSchema.optional(),
374
- fields: z.array(reviewLayoutFieldSchema),
375
- title: z.string().optional(),
376
- callToAction: reviewLayoutCallToActionSchema.optional(),
234
+ export const columnsLayoutBiasSchema = z.union([
235
+ z.literal('none'),
236
+ z.literal('left'),
237
+ z.literal('right'),
238
+ ]);
239
+
240
+ export const loadingIndicatorLayoutSchema = z.object({
241
+ type: z.literal('loading-indicator'),
242
+ size: sizeSchema.optional(),
377
243
  control: z.string().optional(),
378
244
  margin: sizeSchema.optional(),
379
245
  });
380
246
 
381
- export const searchLayoutSchema = z.object({
382
- type: z.literal('search'),
383
- title: z.string(),
384
- method: httpMethodSchema,
385
- url: z.string(),
386
- param: z.string(),
387
- emptyMessage: z.string().optional(),
247
+ export const headingLayoutSchema = z.object({
248
+ type: z.literal('heading'),
249
+ text: z.string(),
250
+ size: sizeSchema.optional(),
251
+ align: alignSchema.optional(),
388
252
  control: z.string().optional(),
389
253
  margin: sizeSchema.optional(),
390
254
  });
391
255
 
392
- export const decisionLayoutOptionSchema = z.object({
393
- action: actionSchema,
394
- title: z.string(),
395
- description: z.string().optional(),
396
- disabled: z.boolean().optional(),
397
- icon: iconSchema.optional(),
398
- image: imageLayoutSchema.optional(),
256
+ export const statusListLayoutStatusSchema = z.union([
257
+ z.literal('not-done'),
258
+ z.literal('pending'),
259
+ z.literal('done'),
260
+ ]);
261
+
262
+ export const markdownLayoutSchema = z.object({
263
+ type: z.literal('markdown'),
264
+ content: z.string(),
265
+ align: alignSchema.optional(),
266
+ control: z.string().optional(),
267
+ margin: sizeSchema.optional(),
399
268
  });
400
269
 
401
- export const searchResultActionSchema = z.object({
402
- type: z.literal('action'),
403
- title: z.string(),
404
- description: z.string().optional(),
405
- icon: iconSchema.optional(),
406
- image: imageLayoutSchema.optional(),
407
- value: actionSchema,
270
+ export const iconTextSchema = z.object({
271
+ text: z.string(),
408
272
  });
409
273
 
410
- export const searchResultSearchSchema = z.object({
411
- type: z.literal('search'),
412
- title: z.string(),
413
- description: z.string().optional(),
414
- icon: iconSchema.optional(),
415
- image: imageLayoutSchema.optional(),
416
- value: searchSearchRequestSchema,
274
+ export const iconNamedSchema = z.object({
275
+ name: z.string(),
417
276
  });
418
277
 
419
- export const actionResponseBodySchema = z.object({
420
- action: actionSchema,
278
+ export const searchSearchRequestSchema = z.object({
279
+ url: z.string(),
280
+ method: httpMethodSchema,
281
+ param: z.string(),
282
+ query: z.string(),
421
283
  });
422
284
 
423
- export const pollingOnErrorSchema = z.object({
424
- action: actionSchema,
285
+ export const errorResponseBodySchema = z.object({
286
+ refreshFormUrl: z.string().optional(),
287
+ analytics: z.record(z.string()).optional(),
288
+ error: z.string().optional(),
289
+ validation: jsonElementSchema.optional(),
290
+ refreshUrl: z.string().optional(),
425
291
  });
426
292
 
427
- export const navigationBackBehaviourSchema = z.object({
428
- title: z.string().optional(),
429
- action: actionSchema,
293
+ export const iconSchema = z.union([iconNamedSchema, iconTextSchema]);
294
+
295
+ export const validateAsyncSchema = z.object({
296
+ param: z.string(),
297
+ method: httpMethodSchema,
298
+ url: z.string(),
430
299
  });
431
300
 
432
- export const summarySummariserSchema = z.object({
433
- defaultTitle: z.string().optional(),
434
- defaultDescription: z.string().optional(),
435
- defaultIcon: iconSchema.optional(),
436
- defaultImage: imageLayoutSchema.optional(),
437
- providesTitle: z.boolean().optional(),
438
- providesDescription: z.boolean().optional(),
439
- providesIcon: z.boolean().optional(),
440
- providesImage: z.boolean().optional(),
301
+ export const alertLayoutSchema = z.object({
302
+ type: z.literal('alert'),
303
+ markdown: z.string(),
304
+ context: contextSchema.optional(),
305
+ control: z.string().optional(),
306
+ margin: sizeSchema.optional(),
441
307
  });
442
308
 
443
309
  export const blobSchemaSchema = z.object({
@@ -480,24 +346,53 @@ export const constSchemaSchema = z.object({
480
346
  disabled: z.boolean().optional(),
481
347
  });
482
348
 
483
- export const pollingSchema = z.object({
484
- url: z.string(),
485
- interval: z.number(),
486
- maxAttempts: z.number(),
487
- onError: pollingOnErrorSchema,
349
+ export const actionSchema = z.object({
350
+ title: z.string().optional(),
351
+ type: actionTypeSchema.optional(),
352
+ disabled: z.boolean().optional(),
353
+ $id: z.string().optional(),
354
+ $ref: z.string().optional(),
355
+ id: z.string().optional(),
356
+ url: z.string().optional(),
357
+ method: httpMethodSchema.optional(),
358
+ exit: z.boolean().optional(),
359
+ result: jsonElementSchema.optional(),
360
+ data: jsonElementSchema.optional(),
361
+ timeout: z.number().optional(),
362
+ skipValidation: z.boolean().optional(),
488
363
  });
489
364
 
490
- export const navigationSchema = z.object({
491
- backButton: navigationBackBehaviourSchema.optional(),
492
- back: navigationBackBehaviourSchema.optional(),
493
- stackBehavior: navigationStackBehaviorSchema.optional(),
365
+ export const linkHandlerSchema = z.object({
366
+ regexPattern: z.string(),
367
+ action: actionSchema,
494
368
  });
495
369
 
496
- export const statusListLayoutItemSchema = z.object({
370
+ export const navigationBackBehaviourSchema = z.object({
371
+ title: z.string().optional(),
372
+ action: actionSchema,
373
+ });
374
+
375
+ export const pollingOnErrorSchema = z.object({
376
+ action: actionSchema,
377
+ });
378
+
379
+ export const imageLayoutSchema = z.object({
380
+ type: z.literal('image'),
381
+ text: z.string().optional(),
382
+ url: z.string(),
383
+ size: sizeSchema.optional(),
384
+ accessibilityDescription: z.string().optional(),
385
+ control: z.string().optional(),
386
+ margin: sizeSchema.optional(),
387
+ });
388
+
389
+ export const decisionLayoutOptionSchema = z.object({
390
+ action: actionSchema,
497
391
  title: z.string(),
498
392
  description: z.string().optional(),
499
- icon: iconSchema,
500
- status: statusListLayoutStatusSchema.optional(),
393
+ disabled: z.boolean().optional(),
394
+ icon: iconSchema.optional(),
395
+ image: imageLayoutSchema.optional(),
501
396
  });
502
397
 
503
398
  export const listLayoutItemSchema = z.object({
@@ -507,145 +402,141 @@ export const listLayoutItemSchema = z.object({
507
402
  status: listLayoutStatusSchema.optional(),
508
403
  });
509
404
 
510
- export const listLayoutSchema = z.object({
511
- type: z.literal('list'),
512
- items: z.array(listLayoutItemSchema),
405
+ export const statusListLayoutItemSchema = z.object({
406
+ title: z.string(),
407
+ description: z.string().optional(),
408
+ icon: iconSchema,
409
+ status: statusListLayoutStatusSchema.optional(),
410
+ });
411
+
412
+ export const formLayoutSchema = z.object({
413
+ type: z.literal('form'),
414
+ schema: formLayoutSchemaReferenceSchema.optional(),
415
+ schemaId: z.string(),
416
+ control: z.string().optional(),
417
+ margin: sizeSchema.optional(),
418
+ });
419
+
420
+ export const instructionsLayoutSchema = z.object({
421
+ type: z.literal('instructions'),
513
422
  title: z.string().optional(),
423
+ items: z.array(instructionsLayoutItemSchema),
514
424
  control: z.string().optional(),
515
425
  margin: sizeSchema.optional(),
516
426
  });
517
427
 
518
- export const decisionLayoutSchema = z.object({
519
- type: z.literal('decision'),
520
- options: z.array(decisionLayoutOptionSchema),
428
+ export const infoLayoutSchema = z.object({
429
+ type: z.literal('info'),
430
+ markdown: z.string(),
431
+ align: alignSchema.optional(),
521
432
  control: z.string().optional(),
522
433
  margin: sizeSchema.optional(),
523
434
  });
524
435
 
525
- export const searchResultSchema = z.union([searchResultActionSchema, searchResultSearchSchema]);
436
+ export const buttonLayoutSchema = z.object({
437
+ type: z.literal('button'),
438
+ size: sizeSchema.optional(),
439
+ title: z.string().optional(),
440
+ action: actionSchema,
441
+ context: contextSchema.optional(),
442
+ disabled: z.boolean().optional(),
443
+ pinOrder: z.number().optional(),
444
+ control: z.string().optional(),
445
+ margin: sizeSchema.optional(),
446
+ });
526
447
 
527
- export const summarySchema = z.union([summaryProviderSchema, summarySummariserSchema]);
448
+ export const reviewLayoutCallToActionSchema = z.object({
449
+ title: z.string(),
450
+ action: actionSchema,
451
+ });
528
452
 
529
- export const statusListLayoutSchema = z.object({
530
- type: z.literal('status-list'),
531
- items: z.array(statusListLayoutItemSchema),
453
+ export const reviewLayoutSchema = z.object({
454
+ type: z.literal('review'),
455
+ orientation: z.string().optional(),
456
+ action: actionSchema.optional(),
457
+ fields: z.array(reviewLayoutFieldSchema),
532
458
  title: z.string().optional(),
459
+ callToAction: reviewLayoutCallToActionSchema.optional(),
533
460
  control: z.string().optional(),
534
461
  margin: sizeSchema.optional(),
535
462
  });
536
463
 
537
- export const searchResponseBodySchema = z.object({
538
- results: z.array(searchResultSchema),
464
+ export const searchResultActionSchema = z.object({
465
+ type: z.literal('action'),
466
+ title: z.string(),
467
+ description: z.string().optional(),
468
+ icon: iconSchema.optional(),
469
+ image: imageLayoutSchema.optional(),
470
+ value: actionSchema,
539
471
  });
540
472
 
541
- export const stepSchema: z.ZodSchema<Step> = z.lazy(() =>
542
- z.object({
543
- key: z.string().optional(),
544
- type: z.string().optional(),
545
- actions: z.array(actionSchema).optional(),
546
- refreshFormUrl: z.string().optional(),
547
- id: z.string(),
548
- title: z.string(),
549
- description: z.string().optional(),
550
- schemas: z.array(schemaSchema),
551
- layout: z.array(layoutSchema),
552
- model: jsonElementSchema.optional(),
553
- external: externalSchema.optional(),
554
- polling: pollingSchema.optional(),
555
- linkHandlers: z.array(linkHandlerSchema).optional(),
556
- analytics: z.record(z.string()).optional(),
557
- errors: stepErrorSchema.optional(),
558
- navigation: navigationSchema.optional(),
559
- refreshUrl: z.string().optional(),
560
- }),
561
- );
473
+ export const searchResultSearchSchema = z.object({
474
+ type: z.literal('search'),
475
+ title: z.string(),
476
+ description: z.string().optional(),
477
+ icon: iconSchema.optional(),
478
+ image: imageLayoutSchema.optional(),
479
+ value: searchSearchRequestSchema,
480
+ });
562
481
 
563
- export const schemaSchema: z.ZodSchema<Schema> = z.lazy(() =>
564
- z.union([
565
- allOfSchemaSchema,
566
- arraySchemaSchema,
567
- blobSchemaSchema,
568
- booleanSchemaSchema,
569
- constSchemaSchema,
570
- integerSchemaSchema,
571
- numberSchemaSchema,
572
- objectSchemaSchema,
573
- oneOfSchemaSchema,
574
- stringSchemaSchema,
575
- ]),
576
- );
482
+ export const actionResponseBodySchema = z.object({
483
+ action: actionSchema,
484
+ });
577
485
 
578
- export const layoutSchema: z.ZodSchema<Layout> = z.lazy(() =>
579
- z.union([
580
- alertLayoutSchema,
581
- boxLayoutSchema,
582
- buttonLayoutSchema,
583
- columnsLayoutSchema,
584
- decisionLayoutSchema,
585
- dividerLayoutSchema,
586
- formLayoutSchema,
587
- headingLayoutSchema,
588
- imageLayoutSchema,
589
- infoLayoutSchema,
590
- instructionsLayoutSchema,
591
- listLayoutSchema,
592
- loadingIndicatorLayoutSchema,
593
- markdownLayoutSchema,
594
- modalLayoutSchema,
595
- paragraphLayoutSchema,
596
- reviewLayoutSchema,
597
- searchLayoutSchema,
598
- statusListLayoutSchema,
599
- ]),
600
- );
486
+ export const summarySummariserSchema = z.object({
487
+ defaultTitle: z.string().optional(),
488
+ defaultDescription: z.string().optional(),
489
+ defaultIcon: iconSchema.optional(),
490
+ defaultImage: imageLayoutSchema.optional(),
491
+ providesTitle: z.boolean().optional(),
492
+ providesDescription: z.boolean().optional(),
493
+ providesIcon: z.boolean().optional(),
494
+ providesImage: z.boolean().optional(),
495
+ });
601
496
 
602
- export const modalLayoutContentSchema: z.ZodSchema<ModalLayoutContent> = z.lazy(() =>
603
- z.object({
604
- components: z.array(layoutSchema),
605
- }),
606
- );
497
+ export const pollingSchema = z.object({
498
+ url: z.string(),
499
+ interval: z.number(),
500
+ maxAttempts: z.number(),
501
+ onError: pollingOnErrorSchema,
502
+ });
607
503
 
608
- export const boxLayoutSchema: z.ZodSchema<BoxLayout> = z.lazy(() =>
609
- z.object({
610
- type: z.literal('box'),
611
- components: z.array(layoutSchema),
612
- width: sizeSchema.optional(),
613
- border: z.boolean().optional(),
614
- control: z.string().optional(),
615
- margin: sizeSchema.optional(),
616
- }),
617
- );
504
+ export const navigationSchema = z.object({
505
+ backButton: navigationBackBehaviourSchema.optional(),
506
+ back: navigationBackBehaviourSchema.optional(),
507
+ stackBehavior: navigationStackBehaviorSchema.optional(),
508
+ });
618
509
 
619
- export const columnsLayoutSchema: z.ZodSchema<ColumnsLayout> = z.lazy(() =>
620
- z.object({
621
- type: z.literal('columns'),
622
- left: z.array(layoutSchema),
623
- right: z.array(layoutSchema),
624
- bias: columnsLayoutBiasSchema.optional(),
625
- control: z.string().optional(),
626
- margin: sizeSchema.optional(),
627
- }),
628
- );
510
+ export const summarySchema = z.union([summaryProviderSchema, summarySummariserSchema]);
629
511
 
630
- export const modalLayoutSchema: z.ZodSchema<ModalLayout> = z.lazy(() =>
631
- z.object({
632
- type: z.literal('modal'),
633
- control: z.string().optional(),
634
- margin: sizeSchema.optional(),
635
- trigger: modalLayoutTriggerSchema,
636
- content: modalLayoutContentSchema,
637
- }),
638
- );
512
+ export const decisionLayoutSchema = z.object({
513
+ type: z.literal('decision'),
514
+ options: z.array(decisionLayoutOptionSchema),
515
+ control: z.string().optional(),
516
+ margin: sizeSchema.optional(),
517
+ });
518
+
519
+ export const listLayoutSchema = z.object({
520
+ type: z.literal('list'),
521
+ items: z.array(listLayoutItemSchema),
522
+ title: z.string().optional(),
523
+ control: z.string().optional(),
524
+ margin: sizeSchema.optional(),
525
+ });
526
+
527
+ export const statusListLayoutSchema = z.object({
528
+ type: z.literal('status-list'),
529
+ items: z.array(statusListLayoutItemSchema),
530
+ title: z.string().optional(),
531
+ control: z.string().optional(),
532
+ margin: sizeSchema.optional(),
533
+ });
639
534
 
640
- export const persistAsyncSchema: z.ZodSchema<PersistAsync> = z.lazy(() =>
641
- z.object({
642
- param: z.string(),
643
- idProperty: z.string(),
644
- schema: schemaSchema,
645
- url: z.string(),
646
- method: httpMethodSchema,
647
- }),
648
- );
535
+ export const searchResultSchema = z.union([searchResultActionSchema, searchResultSearchSchema]);
536
+
537
+ export const searchResponseBodySchema = z.object({
538
+ results: z.array(searchResultSchema),
539
+ });
649
540
 
650
541
  export const arraySchemaTupleSchema: z.ZodSchema<ArraySchemaTuple> = z.lazy(() =>
651
542
  z.object({
@@ -668,6 +559,31 @@ export const arraySchemaTupleSchema: z.ZodSchema<ArraySchemaTuple> = z.lazy(() =
668
559
  }),
669
560
  );
670
561
 
562
+ export const schemaSchema: z.ZodSchema<Schema> = z.lazy(() =>
563
+ z.union([
564
+ allOfSchemaSchema,
565
+ arraySchemaSchema,
566
+ blobSchemaSchema,
567
+ booleanSchemaSchema,
568
+ constSchemaSchema,
569
+ integerSchemaSchema,
570
+ numberSchemaSchema,
571
+ objectSchemaSchema,
572
+ oneOfSchemaSchema,
573
+ stringSchemaSchema,
574
+ ]),
575
+ );
576
+
577
+ export const persistAsyncSchema: z.ZodSchema<PersistAsync> = z.lazy(() =>
578
+ z.object({
579
+ param: z.string(),
580
+ idProperty: z.string(),
581
+ schema: schemaSchema,
582
+ url: z.string(),
583
+ method: httpMethodSchema,
584
+ }),
585
+ );
586
+
671
587
  export const oneOfSchemaSchema: z.ZodSchema<OneOfSchema> = z.lazy(() =>
672
588
  z.object({
673
589
  autofillProvider: z.string().optional(),
@@ -699,87 +615,62 @@ export const oneOfSchemaSchema: z.ZodSchema<OneOfSchema> = z.lazy(() =>
699
615
  }),
700
616
  );
701
617
 
702
- export const booleanSchemaSchema: z.ZodSchema<BooleanSchema> = z.lazy(() =>
618
+ export const objectSchemaSchema: z.ZodSchema<ObjectSchema> = z.lazy(() =>
703
619
  z.object({
704
- type: z.literal('boolean'),
705
- autofillProvider: z.string().optional(),
620
+ type: z.literal('object'),
621
+ disabled: z.boolean().optional(),
706
622
  promoted: z.boolean().optional(),
707
- refreshFormOnChange: z.boolean().optional(),
708
- refreshUrl: z.string().optional(),
709
- refreshFormUrl: z.string().optional(),
623
+ help: helpSchema.optional(),
624
+ properties: z.record(schemaSchema),
625
+ displayOrder: z.array(z.string()),
626
+ required: z.array(z.string()).optional(),
710
627
  $id: z.string().optional(),
711
628
  title: z.string().optional(),
712
629
  description: z.string().optional(),
713
630
  control: z.string().optional(),
714
- default: z.boolean().optional(),
715
631
  hidden: z.boolean().optional(),
716
- disabled: z.boolean().optional(),
717
632
  icon: iconSchema.optional(),
718
633
  image: imageSchema.optional(),
719
634
  keywords: z.array(z.string()).optional(),
720
635
  summary: summaryProviderSchema.optional(),
721
636
  analyticsId: z.string().optional(),
722
- persistAsync: persistAsyncSchema.optional(),
723
- refreshStepOnChange: z.boolean().optional(),
724
- validationAsync: validateAsyncSchema.optional(),
725
637
  alert: alertLayoutSchema.optional(),
726
- autofillKey: z.string().optional(),
727
- help: helpSchema.optional(),
728
638
  }),
729
639
  );
730
640
 
731
- export const stringSchemaSchema: z.ZodSchema<StringSchema> = z.lazy(() =>
641
+ export const arraySchemaListSchema: z.ZodSchema<ArraySchemaList> = z.lazy(() =>
732
642
  z.object({
733
- type: z.literal('string'),
734
- autofillProvider: z.string().optional(),
643
+ type: z.literal('array'),
735
644
  promoted: z.boolean().optional(),
736
- refreshFormOnChange: z.boolean().optional(),
737
- refreshUrl: z.string().optional(),
738
- refreshFormUrl: z.string().optional(),
739
- format: stringSchemaFormatSchema.optional(),
740
- displayFormat: z.string().optional(),
741
- placeholder: z.string().optional(),
742
- minLength: z.number().optional(),
743
- maxLength: z.number().optional(),
744
- minimum: z.string().optional(),
745
- maximum: z.string().optional(),
746
- pattern: z.string().optional(),
747
645
  $id: z.string().optional(),
646
+ items: schemaSchema,
647
+ addItemTitle: z.string(),
648
+ editItemTitle: z.string(),
649
+ minItems: z.number().optional(),
650
+ maxItems: z.number().optional(),
651
+ placeholder: z.string().optional(),
748
652
  title: z.string().optional(),
749
653
  description: z.string().optional(),
750
654
  control: z.string().optional(),
751
- default: z.string().optional(),
752
655
  hidden: z.boolean().optional(),
753
- disabled: z.boolean().optional(),
754
656
  icon: iconSchema.optional(),
755
657
  image: imageSchema.optional(),
756
658
  keywords: z.array(z.string()).optional(),
757
- summary: summaryProviderSchema.optional(),
659
+ summary: summarySummariserSchema.optional(),
758
660
  analyticsId: z.string().optional(),
759
661
  persistAsync: persistAsyncSchema.optional(),
760
- refreshStepOnChange: z.boolean().optional(),
761
662
  validationAsync: validateAsyncSchema.optional(),
762
- validationMessages: z.record(z.string()).optional(),
763
663
  alert: alertLayoutSchema.optional(),
764
- cameraConfig: jsonElementSchema.optional(),
765
- accepts: z.array(z.string()).optional(),
766
- maxSize: z.number().optional(),
767
- source: uploadSourceSchema.optional(),
768
- autocompleteHint: z.array(autocompleteTokenSchema).optional(),
769
- autofillKey: z.string().optional(),
770
- help: helpSchema.optional(),
664
+ validationMessages: z.record(z.string()).optional(),
665
+ disabled: z.boolean().optional(),
771
666
  }),
772
667
  );
773
668
 
774
- export const objectSchemaSchema: z.ZodSchema<ObjectSchema> = z.lazy(() =>
669
+ export const allOfSchemaSchema: z.ZodSchema<AllOfSchema> = z.lazy(() =>
775
670
  z.object({
776
- type: z.literal('object'),
777
671
  disabled: z.boolean().optional(),
778
672
  promoted: z.boolean().optional(),
779
- help: helpSchema.optional(),
780
- properties: z.record(schemaSchema),
781
- displayOrder: z.array(z.string()),
782
- required: z.array(z.string()).optional(),
673
+ allOf: z.array(schemaSchema),
783
674
  $id: z.string().optional(),
784
675
  title: z.string().optional(),
785
676
  description: z.string().optional(),
@@ -794,29 +685,39 @@ export const objectSchemaSchema: z.ZodSchema<ObjectSchema> = z.lazy(() =>
794
685
  }),
795
686
  );
796
687
 
797
- export const allOfSchemaSchema: z.ZodSchema<AllOfSchema> = z.lazy(() =>
688
+ export const arraySchemaSchema: z.ZodSchema<ArraySchema> = z.lazy(() =>
689
+ z.union([arraySchemaListSchema, arraySchemaTupleSchema]),
690
+ );
691
+
692
+ export const booleanSchemaSchema: z.ZodSchema<BooleanSchema> = z.lazy(() =>
798
693
  z.object({
799
- disabled: z.boolean().optional(),
694
+ type: z.literal('boolean'),
695
+ autofillProvider: z.string().optional(),
800
696
  promoted: z.boolean().optional(),
801
- allOf: z.array(schemaSchema),
697
+ refreshFormOnChange: z.boolean().optional(),
698
+ refreshUrl: z.string().optional(),
699
+ refreshFormUrl: z.string().optional(),
802
700
  $id: z.string().optional(),
803
701
  title: z.string().optional(),
804
702
  description: z.string().optional(),
805
703
  control: z.string().optional(),
704
+ default: z.boolean().optional(),
806
705
  hidden: z.boolean().optional(),
706
+ disabled: z.boolean().optional(),
807
707
  icon: iconSchema.optional(),
808
708
  image: imageSchema.optional(),
809
709
  keywords: z.array(z.string()).optional(),
810
710
  summary: summaryProviderSchema.optional(),
811
711
  analyticsId: z.string().optional(),
712
+ persistAsync: persistAsyncSchema.optional(),
713
+ refreshStepOnChange: z.boolean().optional(),
714
+ validationAsync: validateAsyncSchema.optional(),
812
715
  alert: alertLayoutSchema.optional(),
716
+ autofillKey: z.string().optional(),
717
+ help: helpSchema.optional(),
813
718
  }),
814
719
  );
815
720
 
816
- export const arraySchemaSchema: z.ZodSchema<ArraySchema> = z.lazy(() =>
817
- z.union([arraySchemaListSchema, arraySchemaTupleSchema]),
818
- );
819
-
820
721
  export const integerSchemaSchema: z.ZodSchema<IntegerSchema> = z.lazy(() =>
821
722
  z.object({
822
723
  type: z.literal('integer'),
@@ -885,30 +786,129 @@ export const numberSchemaSchema: z.ZodSchema<NumberSchema> = z.lazy(() =>
885
786
  }),
886
787
  );
887
788
 
888
- export const arraySchemaListSchema: z.ZodSchema<ArraySchemaList> = z.lazy(() =>
789
+ export const stringSchemaSchema: z.ZodSchema<StringSchema> = z.lazy(() =>
889
790
  z.object({
890
- type: z.literal('array'),
791
+ type: z.literal('string'),
792
+ autofillProvider: z.string().optional(),
891
793
  promoted: z.boolean().optional(),
892
- $id: z.string().optional(),
893
- items: schemaSchema,
894
- addItemTitle: z.string(),
895
- editItemTitle: z.string(),
896
- minItems: z.number().optional(),
897
- maxItems: z.number().optional(),
794
+ refreshFormOnChange: z.boolean().optional(),
795
+ refreshUrl: z.string().optional(),
796
+ refreshFormUrl: z.string().optional(),
797
+ format: stringSchemaFormatSchema.optional(),
798
+ displayFormat: z.string().optional(),
898
799
  placeholder: z.string().optional(),
800
+ minLength: z.number().optional(),
801
+ maxLength: z.number().optional(),
802
+ minimum: z.string().optional(),
803
+ maximum: z.string().optional(),
804
+ pattern: z.string().optional(),
805
+ $id: z.string().optional(),
899
806
  title: z.string().optional(),
900
807
  description: z.string().optional(),
901
808
  control: z.string().optional(),
809
+ default: z.string().optional(),
902
810
  hidden: z.boolean().optional(),
811
+ disabled: z.boolean().optional(),
903
812
  icon: iconSchema.optional(),
904
813
  image: imageSchema.optional(),
905
814
  keywords: z.array(z.string()).optional(),
906
- summary: summarySummariserSchema.optional(),
815
+ summary: summaryProviderSchema.optional(),
907
816
  analyticsId: z.string().optional(),
908
817
  persistAsync: persistAsyncSchema.optional(),
818
+ refreshStepOnChange: z.boolean().optional(),
909
819
  validationAsync: validateAsyncSchema.optional(),
910
- alert: alertLayoutSchema.optional(),
911
820
  validationMessages: z.record(z.string()).optional(),
912
- disabled: z.boolean().optional(),
821
+ alert: alertLayoutSchema.optional(),
822
+ cameraConfig: jsonElementSchema.optional(),
823
+ accepts: z.array(z.string()).optional(),
824
+ maxSize: z.number().optional(),
825
+ source: uploadSourceSchema.optional(),
826
+ autocompleteHint: z.array(autocompleteTokenSchema).optional(),
827
+ autofillKey: z.string().optional(),
828
+ help: helpSchema.optional(),
829
+ }),
830
+ );
831
+
832
+ export const stepSchema: z.ZodSchema<Step> = z.lazy(() =>
833
+ z.object({
834
+ key: z.string().optional(),
835
+ type: z.string().optional(),
836
+ actions: z.array(actionSchema).optional(),
837
+ refreshFormUrl: z.string().optional(),
838
+ id: z.string(),
839
+ title: z.string(),
840
+ description: z.string().optional(),
841
+ schemas: z.array(schemaSchema),
842
+ layout: z.array(layoutSchema),
843
+ model: jsonElementSchema.optional(),
844
+ external: externalSchema.optional(),
845
+ polling: pollingSchema.optional(),
846
+ linkHandlers: z.array(linkHandlerSchema).optional(),
847
+ analytics: z.record(z.string()).optional(),
848
+ errors: stepErrorSchema.optional(),
849
+ navigation: navigationSchema.optional(),
850
+ refreshUrl: z.string().optional(),
851
+ }),
852
+ );
853
+
854
+ export const layoutSchema: z.ZodSchema<Layout> = z.lazy(() =>
855
+ z.union([
856
+ alertLayoutSchema,
857
+ boxLayoutSchema,
858
+ buttonLayoutSchema,
859
+ columnsLayoutSchema,
860
+ decisionLayoutSchema,
861
+ dividerLayoutSchema,
862
+ formLayoutSchema,
863
+ headingLayoutSchema,
864
+ imageLayoutSchema,
865
+ infoLayoutSchema,
866
+ instructionsLayoutSchema,
867
+ listLayoutSchema,
868
+ loadingIndicatorLayoutSchema,
869
+ markdownLayoutSchema,
870
+ modalLayoutSchema,
871
+ paragraphLayoutSchema,
872
+ reviewLayoutSchema,
873
+ searchLayoutSchema,
874
+ statusListLayoutSchema,
875
+ ]),
876
+ );
877
+
878
+ export const boxLayoutSchema: z.ZodSchema<BoxLayout> = z.lazy(() =>
879
+ z.object({
880
+ type: z.literal('box'),
881
+ components: z.array(layoutSchema),
882
+ width: sizeSchema.optional(),
883
+ border: z.boolean().optional(),
884
+ control: z.string().optional(),
885
+ margin: sizeSchema.optional(),
886
+ }),
887
+ );
888
+
889
+ export const modalLayoutSchema: z.ZodSchema<ModalLayout> = z.lazy(() =>
890
+ z.object({
891
+ type: z.literal('modal'),
892
+ control: z.string().optional(),
893
+ margin: sizeSchema.optional(),
894
+ trigger: modalLayoutTriggerSchema,
895
+ content: modalLayoutContentSchema,
896
+ }),
897
+ );
898
+
899
+ export const modalLayoutContentSchema: z.ZodSchema<ModalLayoutContent> = z.lazy(() =>
900
+ z.object({
901
+ components: z.array(layoutSchema),
902
+ }),
903
+ );
904
+
905
+ export const columnsLayoutSchema: z.ZodSchema<ColumnsLayout> = z.lazy(() =>
906
+ z.object({
907
+ type: z.literal('columns'),
908
+ left: z.array(layoutSchema),
909
+ right: z.array(layoutSchema),
910
+ bias: columnsLayoutBiasSchema.optional(),
911
+ control: z.string().optional(),
912
+ margin: sizeSchema.optional(),
913
913
  }),
914
914
  );