@wise/dynamic-flow-types 2.15.2 → 2.15.3-experimental-rendererfor-4f35dc5

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