@wise/dynamic-flow-types 2.28.0 → 2.28.2

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,12 +2,9 @@
2
2
  import { z } from 'zod';
3
3
  import type {
4
4
  JsonElement,
5
- ColumnsLayout,
6
- Layout,
7
- ModalLayout,
8
- ModalLayoutContent,
9
- BoxLayout,
5
+ Step,
10
6
  Schema,
7
+ Layout,
11
8
  AllOfSchema,
12
9
  ArraySchema,
13
10
  BooleanSchema,
@@ -17,50 +14,33 @@ import type {
17
14
  OneOfSchema,
18
15
  StringSchema,
19
16
  PersistAsync,
20
- ArraySchemaTuple,
21
17
  ArraySchemaList,
22
- Step,
18
+ ArraySchemaTuple,
19
+ ModalLayout,
20
+ ModalLayoutContent,
21
+ ColumnsLayout,
22
+ BoxLayout,
23
23
  } from '../next';
24
24
 
25
- export const sizeSchema = z.union([
26
- z.literal('xs'),
27
- z.literal('sm'),
28
- z.literal('md'),
29
- z.literal('lg'),
30
- z.literal('xl'),
31
- ]);
32
-
33
- export const contextSchema = z.union([
34
- z.literal('positive'),
35
- z.literal('neutral'),
36
- z.literal('warning'),
37
- z.literal('negative'),
38
- z.literal('success'),
39
- z.literal('failure'),
40
- z.literal('info'),
41
- z.literal('primary'),
42
- ]);
43
-
44
- export const columnsLayoutBiasSchema = z.union([
45
- z.literal('none'),
46
- z.literal('left'),
47
- z.literal('right'),
48
- ]);
49
-
50
- export const statusListLayoutStatusSchema = z.union([
51
- z.literal('not-done'),
52
- z.literal('pending'),
53
- z.literal('done'),
54
- ]);
55
-
56
- export const alignSchema = z.union([z.literal('left'), z.literal('center'), z.literal('right')]);
25
+ export const jsonElementSchema: z.ZodSchema<JsonElement> = z.lazy(() =>
26
+ z
27
+ .union([
28
+ z.string(),
29
+ z.number(),
30
+ z.boolean(),
31
+ z.record(jsonElementSchema),
32
+ z.array(jsonElementSchema),
33
+ ])
34
+ .nullable(),
35
+ );
57
36
 
58
- export const formLayoutSchemaReferenceSchema = z.object({
59
- $ref: z.string(),
37
+ export const externalSchema = z.object({
38
+ url: z.string(),
60
39
  });
61
40
 
62
- export const modalLayoutTriggerSchema = z.object({
63
- title: z.string(),
41
+ export const stepErrorSchema = z.object({
42
+ error: z.string().optional(),
43
+ validation: jsonElementSchema.optional(),
64
44
  });
65
45
 
66
46
  export const httpMethodSchema = z.union([
@@ -71,77 +51,23 @@ export const httpMethodSchema = z.union([
71
51
  z.literal('DELETE'),
72
52
  ]);
73
53
 
74
- export const dividerLayoutSchema = z.object({
75
- type: z.literal('divider'),
76
- control: z.string().optional(),
77
- margin: sizeSchema.optional(),
54
+ export const errorResponseBodySchema = z.object({
55
+ refreshFormUrl: z.string().optional(),
56
+ analytics: z.record(z.string()).optional(),
57
+ error: z.string().optional(),
58
+ validation: jsonElementSchema.optional(),
59
+ refreshUrl: z.string().optional(),
78
60
  });
79
61
 
80
- export const listLayoutStatusSchema = z.union([
81
- z.literal('warning'),
82
- z.literal('neutral'),
83
- z.literal('positive'),
62
+ export const stringSchemaFormatSchema = z.union([
63
+ z.literal('date'),
64
+ z.literal('email'),
65
+ z.literal('numeric'),
66
+ z.literal('password'),
67
+ z.literal('phone-number'),
68
+ z.literal('base64url'),
84
69
  ]);
85
70
 
86
- export const headingLayoutSchema = z.object({
87
- type: z.literal('heading'),
88
- text: z.string(),
89
- size: sizeSchema.optional(),
90
- align: alignSchema.optional(),
91
- control: z.string().optional(),
92
- margin: sizeSchema.optional(),
93
- });
94
-
95
- export const formLayoutSchema = z.object({
96
- type: z.literal('form'),
97
- schema: formLayoutSchemaReferenceSchema.optional(),
98
- schemaId: z.string(),
99
- control: z.string().optional(),
100
- margin: sizeSchema.optional(),
101
- });
102
-
103
- export const imageLayoutSchema = z.object({
104
- type: z.literal('image'),
105
- text: z.string().optional(),
106
- url: z.string(),
107
- size: sizeSchema.optional(),
108
- accessibilityDescription: z.string().optional(),
109
- control: z.string().optional(),
110
- margin: sizeSchema.optional(),
111
- });
112
-
113
- export const infoLayoutSchema = z.object({
114
- type: z.literal('info'),
115
- markdown: z.string(),
116
- align: alignSchema.optional(),
117
- control: z.string().optional(),
118
- margin: sizeSchema.optional(),
119
- });
120
-
121
- export const loadingIndicatorLayoutSchema = z.object({
122
- type: z.literal('loading-indicator'),
123
- size: sizeSchema.optional(),
124
- control: z.string().optional(),
125
- margin: sizeSchema.optional(),
126
- });
127
-
128
- export const paragraphLayoutSchema = z.object({
129
- type: z.literal('paragraph'),
130
- text: z.string(),
131
- align: alignSchema.optional(),
132
- control: z.string().optional(),
133
- margin: sizeSchema.optional(),
134
- });
135
-
136
- export const instructionsLayoutItemSchema = z.object({
137
- text: z.string(),
138
- context: contextSchema,
139
- });
140
-
141
- export const helpSchema = z.object({
142
- markdown: z.string(),
143
- });
144
-
145
71
  export const imageSchema = z.object({
146
72
  text: z.string().optional(),
147
73
  url: z.string(),
@@ -161,6 +87,8 @@ export const validateAsyncSchema = z.object({
161
87
  url: z.string(),
162
88
  });
163
89
 
90
+ export const uploadSourceSchema = z.union([z.literal('camera'), z.literal('file')]);
91
+
164
92
  export const autocompleteTokenSchema = z.union([
165
93
  z.literal('on'),
166
94
  z.literal('name'),
@@ -227,51 +155,152 @@ export const autocompleteTokenSchema = z.union([
227
155
  z.literal('pager'),
228
156
  ]);
229
157
 
230
- export const stringSchemaFormatSchema = z.union([
231
- z.literal('date'),
232
- z.literal('email'),
233
- z.literal('numeric'),
234
- z.literal('password'),
235
- z.literal('phone-number'),
236
- z.literal('base64url'),
158
+ export const helpSchema = z.object({
159
+ markdown: z.string(),
160
+ });
161
+
162
+ export const iconNamedSchema = z.object({
163
+ name: z.string(),
164
+ });
165
+
166
+ export const iconTextSchema = z.object({
167
+ text: z.string(),
168
+ });
169
+
170
+ export const contextSchema = z.union([
171
+ z.literal('positive'),
172
+ z.literal('neutral'),
173
+ z.literal('warning'),
174
+ z.literal('negative'),
175
+ z.literal('success'),
176
+ z.literal('failure'),
177
+ z.literal('info'),
178
+ z.literal('primary'),
237
179
  ]);
238
180
 
239
- export const jsonElementSchema: z.ZodSchema<JsonElement> = z.lazy(() =>
240
- z
241
- .union([
242
- z.string(),
243
- z.number(),
244
- z.boolean(),
245
- z.record(jsonElementSchema),
246
- z.array(jsonElementSchema),
247
- ])
248
- .nullable(),
249
- );
181
+ export const alignSchema = z.union([z.literal('left'), z.literal('center'), z.literal('right')]);
250
182
 
251
- export const uploadSourceSchema = z.union([z.literal('camera'), z.literal('file')]);
183
+ export const sizeSchema = z.union([
184
+ z.literal('xs'),
185
+ z.literal('sm'),
186
+ z.literal('md'),
187
+ z.literal('lg'),
188
+ z.literal('xl'),
189
+ ]);
252
190
 
253
- export const externalSchema = z.object({
254
- url: z.string(),
191
+ export const listLayoutStatusSchema = z.union([
192
+ z.literal('warning'),
193
+ z.literal('neutral'),
194
+ z.literal('positive'),
195
+ ]);
196
+
197
+ export const modalLayoutTriggerSchema = z.object({
198
+ title: z.string(),
255
199
  });
256
200
 
257
- export const stepErrorSchema = z.object({
258
- error: z.string().optional(),
259
- validation: jsonElementSchema.optional(),
201
+ export const columnsLayoutBiasSchema = z.union([
202
+ z.literal('none'),
203
+ z.literal('left'),
204
+ z.literal('right'),
205
+ ]);
206
+
207
+ export const markdownLayoutSchema = z.object({
208
+ type: z.literal('markdown'),
209
+ content: z.string(),
210
+ align: alignSchema.optional(),
211
+ control: z.string().optional(),
212
+ margin: sizeSchema.optional(),
260
213
  });
261
214
 
262
- export const errorResponseBodySchema = z.object({
263
- refreshFormUrl: z.string().optional(),
264
- analytics: z.record(z.string()).optional(),
265
- error: z.string().optional(),
266
- validation: jsonElementSchema.optional(),
267
- refreshUrl: z.string().optional(),
215
+ export const statusListLayoutStatusSchema = z.union([
216
+ z.literal('not-done'),
217
+ z.literal('pending'),
218
+ z.literal('done'),
219
+ ]);
220
+
221
+ export const paragraphLayoutSchema = z.object({
222
+ type: z.literal('paragraph'),
223
+ text: z.string(),
224
+ align: alignSchema.optional(),
225
+ control: z.string().optional(),
226
+ margin: sizeSchema.optional(),
268
227
  });
269
228
 
270
- export const searchSearchRequestSchema = z.object({
271
- url: z.string(),
229
+ export const infoLayoutSchema = z.object({
230
+ type: z.literal('info'),
231
+ markdown: z.string(),
232
+ align: alignSchema.optional(),
233
+ control: z.string().optional(),
234
+ margin: sizeSchema.optional(),
235
+ });
236
+
237
+ export const formLayoutSchemaReferenceSchema = z.object({
238
+ $ref: z.string(),
239
+ });
240
+
241
+ export const reviewLayoutFieldSchema = z.object({
242
+ label: z.string(),
243
+ value: z.string(),
244
+ rawValue: z.string().optional(),
245
+ help: helpSchema.optional(),
246
+ });
247
+
248
+ export const instructionsLayoutItemSchema = z.object({
249
+ text: z.string(),
250
+ context: contextSchema,
251
+ });
252
+
253
+ export const dividerLayoutSchema = z.object({
254
+ type: z.literal('divider'),
255
+ control: z.string().optional(),
256
+ margin: sizeSchema.optional(),
257
+ });
258
+
259
+ export const formLayoutSchema = z.object({
260
+ type: z.literal('form'),
261
+ schema: formLayoutSchemaReferenceSchema.optional(),
262
+ schemaId: z.string(),
263
+ control: z.string().optional(),
264
+ margin: sizeSchema.optional(),
265
+ });
266
+
267
+ export const headingLayoutSchema = z.object({
268
+ type: z.literal('heading'),
269
+ text: z.string(),
270
+ size: sizeSchema.optional(),
271
+ align: alignSchema.optional(),
272
+ control: z.string().optional(),
273
+ margin: sizeSchema.optional(),
274
+ });
275
+
276
+ export const instructionsLayoutSchema = z.object({
277
+ type: z.literal('instructions'),
278
+ title: z.string().optional(),
279
+ items: z.array(instructionsLayoutItemSchema),
280
+ control: z.string().optional(),
281
+ margin: sizeSchema.optional(),
282
+ });
283
+
284
+ export const loadingIndicatorLayoutSchema = z.object({
285
+ type: z.literal('loading-indicator'),
286
+ size: sizeSchema.optional(),
287
+ control: z.string().optional(),
288
+ margin: sizeSchema.optional(),
289
+ });
290
+
291
+ export const searchLayoutSchema = z.object({
292
+ type: z.literal('search'),
293
+ title: z.string(),
272
294
  method: httpMethodSchema,
295
+ url: z.string(),
273
296
  param: z.string(),
274
- query: z.string(),
297
+ emptyMessage: z.string().optional(),
298
+ control: z.string().optional(),
299
+ margin: sizeSchema.optional(),
300
+ });
301
+
302
+ export const linkSchema = z.object({
303
+ url: z.string(),
275
304
  });
276
305
 
277
306
  export const navigationStackBehaviorSchema = z.union([
@@ -281,10 +310,6 @@ export const navigationStackBehaviorSchema = z.union([
281
310
  z.literal('replace-current'),
282
311
  ]);
283
312
 
284
- export const linkSchema = z.object({
285
- url: z.string(),
286
- });
287
-
288
313
  export const actionTypeSchema = z.union([
289
314
  z.literal('primary'),
290
315
  z.literal('secondary'),
@@ -293,14 +318,6 @@ export const actionTypeSchema = z.union([
293
318
  z.literal('negative'),
294
319
  ]);
295
320
 
296
- export const iconNamedSchema = z.object({
297
- name: z.string(),
298
- });
299
-
300
- export const iconTextSchema = z.object({
301
- text: z.string(),
302
- });
303
-
304
321
  export const actionSchema = z.object({
305
322
  title: z.string().optional(),
306
323
  type: actionTypeSchema.optional(),
@@ -317,56 +334,41 @@ export const actionSchema = z.object({
317
334
  skipValidation: z.boolean().optional(),
318
335
  });
319
336
 
320
- export const markdownLayoutSchema = z.object({
321
- type: z.literal('markdown'),
322
- content: z.string(),
323
- align: alignSchema.optional(),
324
- control: z.string().optional(),
325
- margin: sizeSchema.optional(),
326
- });
327
-
328
- export const searchLayoutSchema = z.object({
329
- type: z.literal('search'),
330
- title: z.string(),
331
- method: httpMethodSchema,
332
- url: z.string(),
333
- param: z.string(),
334
- emptyMessage: z.string().optional(),
335
- control: z.string().optional(),
336
- margin: sizeSchema.optional(),
337
+ export const linkHandlerSchema = z.object({
338
+ regexPattern: z.string(),
339
+ action: actionSchema,
337
340
  });
338
341
 
339
- export const reviewLayoutCallToActionSchema = z.object({
340
- title: z.string(),
342
+ export const actionResponseBodySchema = z.object({
341
343
  action: actionSchema,
342
344
  });
343
345
 
344
- export const instructionsLayoutSchema = z.object({
345
- type: z.literal('instructions'),
346
- title: z.string().optional(),
347
- items: z.array(instructionsLayoutItemSchema),
348
- control: z.string().optional(),
349
- margin: sizeSchema.optional(),
346
+ export const searchSearchRequestSchema = z.object({
347
+ url: z.string(),
348
+ method: httpMethodSchema,
349
+ param: z.string(),
350
+ query: z.string(),
350
351
  });
351
352
 
352
353
  export const iconSchema = z.union([iconNamedSchema, iconTextSchema]);
353
354
 
354
- export const behaviorSchema = z.object({
355
- action: actionSchema.optional(),
356
- link: linkSchema.optional(),
357
- });
358
-
359
- export const reviewLayoutFieldSchema = z.object({
360
- label: z.string(),
361
- value: z.string(),
362
- rawValue: z.string().optional(),
363
- help: helpSchema.optional(),
355
+ export const imageLayoutSchema = z.object({
356
+ type: z.literal('image'),
357
+ text: z.string().optional(),
358
+ url: z.string(),
359
+ size: sizeSchema.optional(),
360
+ accessibilityDescription: z.string().optional(),
361
+ control: z.string().optional(),
362
+ margin: sizeSchema.optional(),
364
363
  });
365
364
 
366
- export const alertLayoutCallToActionSchema = z.object({
365
+ export const searchResultActionSchema = z.object({
366
+ type: z.literal('action'),
367
367
  title: z.string(),
368
- accessibilityDescription: z.string().optional(),
369
- behavior: behaviorSchema,
368
+ description: z.string().optional(),
369
+ icon: iconSchema.optional(),
370
+ image: imageLayoutSchema.optional(),
371
+ value: actionSchema,
370
372
  });
371
373
 
372
374
  export const summarySummariserSchema = z.object({
@@ -380,31 +382,56 @@ export const summarySummariserSchema = z.object({
380
382
  providesImage: z.boolean().optional(),
381
383
  });
382
384
 
383
- export const linkHandlerSchema = z.object({
384
- regexPattern: z.string(),
385
- action: actionSchema,
385
+ export const listLayoutItemSchema = z.object({
386
+ title: z.string(),
387
+ description: z.string().optional(),
388
+ icon: iconSchema,
389
+ status: listLayoutStatusSchema.optional(),
386
390
  });
387
391
 
388
- export const actionResponseBodySchema = z.object({
389
- action: actionSchema,
392
+ export const listLayoutSchema = z.object({
393
+ type: z.literal('list'),
394
+ items: z.array(listLayoutItemSchema),
395
+ title: z.string().optional(),
396
+ control: z.string().optional(),
397
+ margin: sizeSchema.optional(),
390
398
  });
391
399
 
392
- export const searchResultSearchSchema = z.object({
393
- type: z.literal('search'),
400
+ export const decisionLayoutOptionSchema = z.object({
401
+ action: actionSchema,
394
402
  title: z.string(),
395
403
  description: z.string().optional(),
404
+ disabled: z.boolean().optional(),
396
405
  icon: iconSchema.optional(),
397
406
  image: imageLayoutSchema.optional(),
398
- value: searchSearchRequestSchema,
399
407
  });
400
408
 
401
- export const searchResultActionSchema = z.object({
402
- type: z.literal('action'),
409
+ export const reviewLayoutCallToActionSchema = z.object({
403
410
  title: z.string(),
404
- description: z.string().optional(),
405
- icon: iconSchema.optional(),
406
- image: imageLayoutSchema.optional(),
407
- value: actionSchema,
411
+ action: actionSchema,
412
+ });
413
+
414
+ export const buttonLayoutSchema = z.object({
415
+ type: z.literal('button'),
416
+ size: sizeSchema.optional(),
417
+ title: z.string().optional(),
418
+ action: actionSchema,
419
+ context: contextSchema.optional(),
420
+ disabled: z.boolean().optional(),
421
+ pinOrder: z.number().optional(),
422
+ control: z.string().optional(),
423
+ margin: sizeSchema.optional(),
424
+ });
425
+
426
+ export const behaviorSchema = z.object({
427
+ action: actionSchema.optional(),
428
+ link: linkSchema.optional(),
429
+ });
430
+
431
+ export const alertLayoutCallToActionSchema = z.object({
432
+ title: z.string(),
433
+ accessibilityDescription: z.string().optional(),
434
+ behavior: behaviorSchema,
408
435
  });
409
436
 
410
437
  export const pollingOnErrorSchema = z.object({
@@ -416,27 +443,30 @@ export const navigationBackBehaviorSchema = z.object({
416
443
  action: actionSchema,
417
444
  });
418
445
 
419
- export const summarySchema = z.union([summaryProviderSchema, summarySummariserSchema]);
420
-
421
- export const buttonLayoutSchema = z.object({
422
- type: z.literal('button'),
423
- size: sizeSchema.optional(),
424
- title: z.string().optional(),
425
- action: actionSchema,
426
- context: contextSchema.optional(),
427
- disabled: z.boolean().optional(),
428
- pinOrder: z.number().optional(),
429
- control: z.string().optional(),
430
- margin: sizeSchema.optional(),
446
+ export const summarySchema = z.union([summaryProviderSchema, summarySummariserSchema]);
447
+
448
+ export const pollingSchema = z.object({
449
+ url: z.string(),
450
+ interval: z.number().optional(),
451
+ delay: z.number().optional(),
452
+ timeout: z.number().optional(),
453
+ maxAttempts: z.number(),
454
+ onError: pollingOnErrorSchema,
455
+ });
456
+
457
+ export const navigationSchema = z.object({
458
+ backButton: navigationBackBehaviorSchema.optional(),
459
+ back: navigationBackBehaviorSchema.optional(),
460
+ stackBehavior: navigationStackBehaviorSchema.optional(),
431
461
  });
432
462
 
433
- export const decisionLayoutOptionSchema = z.object({
434
- action: actionSchema,
463
+ export const searchResultSearchSchema = z.object({
464
+ type: z.literal('search'),
435
465
  title: z.string(),
436
466
  description: z.string().optional(),
437
- disabled: z.boolean().optional(),
438
467
  icon: iconSchema.optional(),
439
468
  image: imageLayoutSchema.optional(),
469
+ value: searchSearchRequestSchema,
440
470
  });
441
471
 
442
472
  export const alertLayoutSchema = z.object({
@@ -448,6 +478,20 @@ export const alertLayoutSchema = z.object({
448
478
  callToAction: alertLayoutCallToActionSchema.optional(),
449
479
  });
450
480
 
481
+ export const itemCallToActionSchema = z.object({
482
+ title: z.string(),
483
+ accessibilityDescription: z.string().optional(),
484
+ behavior: behaviorSchema,
485
+ });
486
+
487
+ export const decisionLayoutSchema = z.object({
488
+ type: z.literal('decision'),
489
+ title: z.string().optional(),
490
+ options: z.array(decisionLayoutOptionSchema),
491
+ control: z.string().optional(),
492
+ margin: sizeSchema.optional(),
493
+ });
494
+
451
495
  export const reviewLayoutSchema = z.object({
452
496
  type: z.literal('review'),
453
497
  orientation: z.string().optional(),
@@ -459,26 +503,7 @@ export const reviewLayoutSchema = z.object({
459
503
  margin: sizeSchema.optional(),
460
504
  });
461
505
 
462
- export const listLayoutItemSchema = z.object({
463
- title: z.string(),
464
- description: z.string().optional(),
465
- icon: iconSchema,
466
- status: listLayoutStatusSchema.optional(),
467
- });
468
-
469
- export const itemCallToActionSchema = z.object({
470
- title: z.string(),
471
- accessibilityDescription: z.string().optional(),
472
- behavior: behaviorSchema,
473
- });
474
-
475
- export const statusListLayoutItemSchema = z.object({
476
- title: z.string(),
477
- description: z.string().optional(),
478
- icon: iconSchema,
479
- status: statusListLayoutStatusSchema.optional(),
480
- callToAction: itemCallToActionSchema.optional(),
481
- });
506
+ export const searchResultSchema = z.union([searchResultActionSchema, searchResultSearchSchema]);
482
507
 
483
508
  export const blobSchemaSchema = z.object({
484
509
  type: z.literal('blob'),
@@ -520,37 +545,12 @@ export const constSchemaSchema = z.object({
520
545
  disabled: z.boolean().optional(),
521
546
  });
522
547
 
523
- export const pollingSchema = z.object({
524
- url: z.string(),
525
- interval: z.number().optional(),
526
- delay: z.number().optional(),
527
- timeout: z.number().optional(),
528
- maxAttempts: z.number(),
529
- onError: pollingOnErrorSchema,
530
- });
531
-
532
- export const navigationSchema = z.object({
533
- backButton: navigationBackBehaviorSchema.optional(),
534
- back: navigationBackBehaviorSchema.optional(),
535
- stackBehavior: navigationStackBehaviorSchema.optional(),
536
- });
537
-
538
- export const searchResultSchema = z.union([searchResultActionSchema, searchResultSearchSchema]);
539
-
540
- export const decisionLayoutSchema = z.object({
541
- type: z.literal('decision'),
542
- title: z.string().optional(),
543
- options: z.array(decisionLayoutOptionSchema),
544
- control: z.string().optional(),
545
- margin: sizeSchema.optional(),
546
- });
547
-
548
- export const listLayoutSchema = z.object({
549
- type: z.literal('list'),
550
- items: z.array(listLayoutItemSchema),
551
- title: z.string().optional(),
552
- control: z.string().optional(),
553
- margin: sizeSchema.optional(),
548
+ export const statusListLayoutItemSchema = z.object({
549
+ title: z.string(),
550
+ description: z.string().optional(),
551
+ icon: iconSchema,
552
+ status: statusListLayoutStatusSchema.optional(),
553
+ callToAction: itemCallToActionSchema.optional(),
554
554
  });
555
555
 
556
556
  export const statusListLayoutSchema = z.object({
@@ -565,17 +565,43 @@ export const searchResponseBodySchema = z.object({
565
565
  results: z.array(searchResultSchema),
566
566
  });
567
567
 
568
- export const columnsLayoutSchema: z.ZodSchema<ColumnsLayout> = z.lazy(() =>
568
+ export const stepSchema: z.ZodSchema<Step> = z.lazy(() =>
569
569
  z.object({
570
- type: z.literal('columns'),
571
- left: z.array(layoutSchema),
572
- right: z.array(layoutSchema),
573
- bias: columnsLayoutBiasSchema.optional(),
574
- control: z.string().optional(),
575
- margin: sizeSchema.optional(),
570
+ key: z.string().optional(),
571
+ type: z.string().optional(),
572
+ actions: z.array(actionSchema).optional(),
573
+ refreshFormUrl: z.string().optional(),
574
+ id: z.string(),
575
+ title: z.string(),
576
+ schemas: z.array(schemaSchema),
577
+ layout: z.array(layoutSchema),
578
+ description: z.string().optional(),
579
+ model: jsonElementSchema.optional(),
580
+ external: externalSchema.optional(),
581
+ polling: pollingSchema.optional(),
582
+ linkHandlers: z.array(linkHandlerSchema).optional(),
583
+ analytics: z.record(z.string()).optional(),
584
+ errors: stepErrorSchema.optional(),
585
+ navigation: navigationSchema.optional(),
586
+ refreshUrl: z.string().optional(),
576
587
  }),
577
588
  );
578
589
 
590
+ export const schemaSchema: z.ZodSchema<Schema> = z.lazy(() =>
591
+ z.union([
592
+ allOfSchemaSchema,
593
+ arraySchemaSchema,
594
+ blobSchemaSchema,
595
+ booleanSchemaSchema,
596
+ constSchemaSchema,
597
+ integerSchemaSchema,
598
+ numberSchemaSchema,
599
+ objectSchemaSchema,
600
+ oneOfSchemaSchema,
601
+ stringSchemaSchema,
602
+ ]),
603
+ );
604
+
579
605
  export const layoutSchema: z.ZodSchema<Layout> = z.lazy(() =>
580
606
  z.union([
581
607
  alertLayoutSchema,
@@ -600,49 +626,6 @@ export const layoutSchema: z.ZodSchema<Layout> = z.lazy(() =>
600
626
  ]),
601
627
  );
602
628
 
603
- export const modalLayoutSchema: z.ZodSchema<ModalLayout> = z.lazy(() =>
604
- z.object({
605
- type: z.literal('modal'),
606
- control: z.string().optional(),
607
- margin: sizeSchema.optional(),
608
- trigger: modalLayoutTriggerSchema,
609
- content: modalLayoutContentSchema,
610
- }),
611
- );
612
-
613
- export const modalLayoutContentSchema: z.ZodSchema<ModalLayoutContent> = z.lazy(() =>
614
- z.object({
615
- title: z.string().optional(),
616
- components: z.array(layoutSchema),
617
- }),
618
- );
619
-
620
- export const boxLayoutSchema: z.ZodSchema<BoxLayout> = z.lazy(() =>
621
- z.object({
622
- type: z.literal('box'),
623
- components: z.array(layoutSchema),
624
- width: sizeSchema.optional(),
625
- border: z.boolean().optional(),
626
- control: z.string().optional(),
627
- margin: sizeSchema.optional(),
628
- }),
629
- );
630
-
631
- export const schemaSchema: z.ZodSchema<Schema> = z.lazy(() =>
632
- z.union([
633
- allOfSchemaSchema,
634
- arraySchemaSchema,
635
- blobSchemaSchema,
636
- booleanSchemaSchema,
637
- constSchemaSchema,
638
- integerSchemaSchema,
639
- numberSchemaSchema,
640
- objectSchemaSchema,
641
- oneOfSchemaSchema,
642
- stringSchemaSchema,
643
- ]),
644
- );
645
-
646
629
  export const allOfSchemaSchema: z.ZodSchema<AllOfSchema> = z.lazy(() =>
647
630
  z.object({
648
631
  disabled: z.boolean().optional(),
@@ -870,12 +853,17 @@ export const persistAsyncSchema: z.ZodSchema<PersistAsync> = z.lazy(() =>
870
853
  }),
871
854
  );
872
855
 
873
- export const arraySchemaTupleSchema: z.ZodSchema<ArraySchemaTuple> = z.lazy(() =>
856
+ export const arraySchemaListSchema: z.ZodSchema<ArraySchemaList> = z.lazy(() =>
874
857
  z.object({
875
858
  type: z.literal('array'),
876
859
  promoted: z.boolean().optional(),
877
860
  $id: z.string().optional(),
878
- items: z.array(schemaSchema),
861
+ items: schemaSchema,
862
+ addItemTitle: z.string(),
863
+ editItemTitle: z.string(),
864
+ minItems: z.number().optional(),
865
+ maxItems: z.number().optional(),
866
+ placeholder: z.string().optional(),
879
867
  title: z.string().optional(),
880
868
  description: z.string().optional(),
881
869
  control: z.string().optional(),
@@ -883,25 +871,22 @@ export const arraySchemaTupleSchema: z.ZodSchema<ArraySchemaTuple> = z.lazy(() =
883
871
  icon: iconSchema.optional(),
884
872
  image: imageSchema.optional(),
885
873
  keywords: z.array(z.string()).optional(),
886
- summary: summaryProviderSchema.optional(),
874
+ summary: summarySummariserSchema.optional(),
887
875
  analyticsId: z.string().optional(),
888
876
  persistAsync: persistAsyncSchema.optional(),
889
877
  validationAsync: validateAsyncSchema.optional(),
890
878
  alert: alertLayoutSchema.optional(),
879
+ validationMessages: z.record(z.string()).optional(),
880
+ disabled: z.boolean().optional(),
891
881
  }),
892
882
  );
893
883
 
894
- export const arraySchemaListSchema: z.ZodSchema<ArraySchemaList> = z.lazy(() =>
884
+ export const arraySchemaTupleSchema: z.ZodSchema<ArraySchemaTuple> = z.lazy(() =>
895
885
  z.object({
896
886
  type: z.literal('array'),
897
887
  promoted: z.boolean().optional(),
898
888
  $id: z.string().optional(),
899
- items: schemaSchema,
900
- addItemTitle: z.string(),
901
- editItemTitle: z.string(),
902
- minItems: z.number().optional(),
903
- maxItems: z.number().optional(),
904
- placeholder: z.string().optional(),
889
+ items: z.array(schemaSchema),
905
890
  title: z.string().optional(),
906
891
  description: z.string().optional(),
907
892
  control: z.string().optional(),
@@ -909,34 +894,49 @@ export const arraySchemaListSchema: z.ZodSchema<ArraySchemaList> = z.lazy(() =>
909
894
  icon: iconSchema.optional(),
910
895
  image: imageSchema.optional(),
911
896
  keywords: z.array(z.string()).optional(),
912
- summary: summarySummariserSchema.optional(),
897
+ summary: summaryProviderSchema.optional(),
913
898
  analyticsId: z.string().optional(),
914
899
  persistAsync: persistAsyncSchema.optional(),
915
900
  validationAsync: validateAsyncSchema.optional(),
916
901
  alert: alertLayoutSchema.optional(),
917
- validationMessages: z.record(z.string()).optional(),
918
- disabled: z.boolean().optional(),
919
902
  }),
920
903
  );
921
904
 
922
- export const stepSchema: z.ZodSchema<Step> = z.lazy(() =>
905
+ export const modalLayoutSchema: z.ZodSchema<ModalLayout> = z.lazy(() =>
923
906
  z.object({
924
- key: z.string().optional(),
925
- type: z.string().optional(),
926
- actions: z.array(actionSchema).optional(),
927
- refreshFormUrl: z.string().optional(),
928
- id: z.string(),
929
- title: z.string(),
930
- schemas: z.array(schemaSchema),
931
- layout: z.array(layoutSchema),
932
- description: z.string().optional(),
933
- model: jsonElementSchema.optional(),
934
- external: externalSchema.optional(),
935
- polling: pollingSchema.optional(),
936
- linkHandlers: z.array(linkHandlerSchema).optional(),
937
- analytics: z.record(z.string()).optional(),
938
- errors: stepErrorSchema.optional(),
939
- navigation: navigationSchema.optional(),
940
- refreshUrl: z.string().optional(),
907
+ type: z.literal('modal'),
908
+ control: z.string().optional(),
909
+ margin: sizeSchema.optional(),
910
+ trigger: modalLayoutTriggerSchema,
911
+ content: modalLayoutContentSchema,
912
+ }),
913
+ );
914
+
915
+ export const modalLayoutContentSchema: z.ZodSchema<ModalLayoutContent> = z.lazy(() =>
916
+ z.object({
917
+ title: z.string().optional(),
918
+ components: z.array(layoutSchema),
919
+ }),
920
+ );
921
+
922
+ export const columnsLayoutSchema: z.ZodSchema<ColumnsLayout> = z.lazy(() =>
923
+ z.object({
924
+ type: z.literal('columns'),
925
+ left: z.array(layoutSchema),
926
+ right: z.array(layoutSchema),
927
+ bias: columnsLayoutBiasSchema.optional(),
928
+ control: z.string().optional(),
929
+ margin: sizeSchema.optional(),
930
+ }),
931
+ );
932
+
933
+ export const boxLayoutSchema: z.ZodSchema<BoxLayout> = z.lazy(() =>
934
+ z.object({
935
+ type: z.literal('box'),
936
+ components: z.array(layoutSchema),
937
+ width: sizeSchema.optional(),
938
+ border: z.boolean().optional(),
939
+ control: z.string().optional(),
940
+ margin: sizeSchema.optional(),
941
941
  }),
942
942
  );