@wise/dynamic-flow-types 2.28.2 → 2.28.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/build/zod/schemas.ts +354 -354
  2. package/package.json +4 -1
@@ -2,9 +2,12 @@
2
2
  import { z } from 'zod';
3
3
  import type {
4
4
  JsonElement,
5
- Step,
6
- Schema,
5
+ ColumnsLayout,
7
6
  Layout,
7
+ ModalLayout,
8
+ ModalLayoutContent,
9
+ BoxLayout,
10
+ Schema,
8
11
  AllOfSchema,
9
12
  ArraySchema,
10
13
  BooleanSchema,
@@ -14,33 +17,50 @@ import type {
14
17
  OneOfSchema,
15
18
  StringSchema,
16
19
  PersistAsync,
17
- ArraySchemaList,
18
20
  ArraySchemaTuple,
19
- ModalLayout,
20
- ModalLayoutContent,
21
- ColumnsLayout,
22
- BoxLayout,
21
+ ArraySchemaList,
22
+ Step,
23
23
  } from '../next';
24
24
 
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
- );
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
+ ]);
36
32
 
37
- export const externalSchema = z.object({
38
- url: z.string(),
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(),
39
60
  });
40
61
 
41
- export const stepErrorSchema = z.object({
42
- error: z.string().optional(),
43
- validation: jsonElementSchema.optional(),
62
+ export const modalLayoutTriggerSchema = z.object({
63
+ title: z.string(),
44
64
  });
45
65
 
46
66
  export const httpMethodSchema = z.union([
@@ -51,23 +71,77 @@ export const httpMethodSchema = z.union([
51
71
  z.literal('DELETE'),
52
72
  ]);
53
73
 
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(),
74
+ export const dividerLayoutSchema = z.object({
75
+ type: z.literal('divider'),
76
+ control: z.string().optional(),
77
+ margin: sizeSchema.optional(),
60
78
  });
61
79
 
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'),
80
+ export const listLayoutStatusSchema = z.union([
81
+ z.literal('warning'),
82
+ z.literal('neutral'),
83
+ z.literal('positive'),
69
84
  ]);
70
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 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
+
71
145
  export const imageSchema = z.object({
72
146
  text: z.string().optional(),
73
147
  url: z.string(),
@@ -87,8 +161,6 @@ export const validateAsyncSchema = z.object({
87
161
  url: z.string(),
88
162
  });
89
163
 
90
- export const uploadSourceSchema = z.union([z.literal('camera'), z.literal('file')]);
91
-
92
164
  export const autocompleteTokenSchema = z.union([
93
165
  z.literal('on'),
94
166
  z.literal('name'),
@@ -155,152 +227,51 @@ export const autocompleteTokenSchema = z.union([
155
227
  z.literal('pager'),
156
228
  ]);
157
229
 
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'),
179
- ]);
180
-
181
- export const alignSchema = z.union([z.literal('left'), z.literal('center'), z.literal('right')]);
182
-
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
- ]);
190
-
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(),
199
- });
200
-
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(),
213
- });
214
-
215
- export const statusListLayoutStatusSchema = z.union([
216
- z.literal('not-done'),
217
- z.literal('pending'),
218
- z.literal('done'),
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'),
219
237
  ]);
220
238
 
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(),
227
- });
228
-
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
- });
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
+ );
258
250
 
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
- });
251
+ export const uploadSourceSchema = z.union([z.literal('camera'), z.literal('file')]);
266
252
 
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(),
253
+ export const externalSchema = z.object({
254
+ url: z.string(),
274
255
  });
275
256
 
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(),
257
+ export const stepErrorSchema = z.object({
258
+ error: z.string().optional(),
259
+ validation: jsonElementSchema.optional(),
282
260
  });
283
261
 
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(),
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(),
289
268
  });
290
269
 
291
- export const searchLayoutSchema = z.object({
292
- type: z.literal('search'),
293
- title: z.string(),
294
- method: httpMethodSchema,
270
+ export const searchSearchRequestSchema = z.object({
295
271
  url: z.string(),
272
+ method: httpMethodSchema,
296
273
  param: 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(),
274
+ query: z.string(),
304
275
  });
305
276
 
306
277
  export const navigationStackBehaviorSchema = z.union([
@@ -310,6 +281,10 @@ export const navigationStackBehaviorSchema = z.union([
310
281
  z.literal('replace-current'),
311
282
  ]);
312
283
 
284
+ export const linkSchema = z.object({
285
+ url: z.string(),
286
+ });
287
+
313
288
  export const actionTypeSchema = z.union([
314
289
  z.literal('primary'),
315
290
  z.literal('secondary'),
@@ -318,6 +293,14 @@ export const actionTypeSchema = z.union([
318
293
  z.literal('negative'),
319
294
  ]);
320
295
 
296
+ export const iconNamedSchema = z.object({
297
+ name: z.string(),
298
+ });
299
+
300
+ export const iconTextSchema = z.object({
301
+ text: z.string(),
302
+ });
303
+
321
304
  export const actionSchema = z.object({
322
305
  title: z.string().optional(),
323
306
  type: actionTypeSchema.optional(),
@@ -334,41 +317,56 @@ export const actionSchema = z.object({
334
317
  skipValidation: z.boolean().optional(),
335
318
  });
336
319
 
337
- export const linkHandlerSchema = z.object({
338
- regexPattern: z.string(),
339
- action: actionSchema,
340
- });
341
-
342
- export const actionResponseBodySchema = z.object({
343
- action: actionSchema,
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(),
344
326
  });
345
327
 
346
- export const searchSearchRequestSchema = z.object({
347
- url: z.string(),
328
+ export const searchLayoutSchema = z.object({
329
+ type: z.literal('search'),
330
+ title: z.string(),
348
331
  method: httpMethodSchema,
332
+ url: z.string(),
349
333
  param: z.string(),
350
- query: z.string(),
334
+ emptyMessage: z.string().optional(),
335
+ control: z.string().optional(),
336
+ margin: sizeSchema.optional(),
351
337
  });
352
338
 
353
- export const iconSchema = z.union([iconNamedSchema, iconTextSchema]);
339
+ export const reviewLayoutCallToActionSchema = z.object({
340
+ title: z.string(),
341
+ action: actionSchema,
342
+ });
354
343
 
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(),
344
+ export const instructionsLayoutSchema = z.object({
345
+ type: z.literal('instructions'),
346
+ title: z.string().optional(),
347
+ items: z.array(instructionsLayoutItemSchema),
361
348
  control: z.string().optional(),
362
349
  margin: sizeSchema.optional(),
363
350
  });
364
351
 
365
- export const searchResultActionSchema = z.object({
366
- type: z.literal('action'),
352
+ export const iconSchema = z.union([iconNamedSchema, iconTextSchema]);
353
+
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(),
364
+ });
365
+
366
+ export const alertLayoutCallToActionSchema = z.object({
367
367
  title: z.string(),
368
- description: z.string().optional(),
369
- icon: iconSchema.optional(),
370
- image: imageLayoutSchema.optional(),
371
- value: actionSchema,
368
+ accessibilityDescription: z.string().optional(),
369
+ behavior: behaviorSchema,
372
370
  });
373
371
 
374
372
  export const summarySummariserSchema = z.object({
@@ -382,56 +380,31 @@ export const summarySummariserSchema = z.object({
382
380
  providesImage: z.boolean().optional(),
383
381
  });
384
382
 
385
- export const listLayoutItemSchema = z.object({
386
- title: z.string(),
387
- description: z.string().optional(),
388
- icon: iconSchema,
389
- status: listLayoutStatusSchema.optional(),
383
+ export const linkHandlerSchema = z.object({
384
+ regexPattern: z.string(),
385
+ action: actionSchema,
390
386
  });
391
387
 
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(),
388
+ export const actionResponseBodySchema = z.object({
389
+ action: actionSchema,
398
390
  });
399
391
 
400
- export const decisionLayoutOptionSchema = z.object({
401
- action: actionSchema,
392
+ export const searchResultSearchSchema = z.object({
393
+ type: z.literal('search'),
402
394
  title: z.string(),
403
395
  description: z.string().optional(),
404
- disabled: z.boolean().optional(),
405
396
  icon: iconSchema.optional(),
406
397
  image: imageLayoutSchema.optional(),
398
+ value: searchSearchRequestSchema,
407
399
  });
408
400
 
409
- export const reviewLayoutCallToActionSchema = z.object({
410
- title: z.string(),
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({
401
+ export const searchResultActionSchema = z.object({
402
+ type: z.literal('action'),
432
403
  title: z.string(),
433
- accessibilityDescription: z.string().optional(),
434
- behavior: behaviorSchema,
404
+ description: z.string().optional(),
405
+ icon: iconSchema.optional(),
406
+ image: imageLayoutSchema.optional(),
407
+ value: actionSchema,
435
408
  });
436
409
 
437
410
  export const pollingOnErrorSchema = z.object({
@@ -443,30 +416,27 @@ export const navigationBackBehaviorSchema = z.object({
443
416
  action: actionSchema,
444
417
  });
445
418
 
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(),
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(),
461
431
  });
462
432
 
463
- export const searchResultSearchSchema = z.object({
464
- type: z.literal('search'),
433
+ export const decisionLayoutOptionSchema = z.object({
434
+ action: actionSchema,
465
435
  title: z.string(),
466
436
  description: z.string().optional(),
437
+ disabled: z.boolean().optional(),
467
438
  icon: iconSchema.optional(),
468
439
  image: imageLayoutSchema.optional(),
469
- value: searchSearchRequestSchema,
470
440
  });
471
441
 
472
442
  export const alertLayoutSchema = z.object({
@@ -478,20 +448,6 @@ export const alertLayoutSchema = z.object({
478
448
  callToAction: alertLayoutCallToActionSchema.optional(),
479
449
  });
480
450
 
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
-
495
451
  export const reviewLayoutSchema = z.object({
496
452
  type: z.literal('review'),
497
453
  orientation: z.string().optional(),
@@ -503,7 +459,26 @@ export const reviewLayoutSchema = z.object({
503
459
  margin: sizeSchema.optional(),
504
460
  });
505
461
 
506
- export const searchResultSchema = z.union([searchResultActionSchema, searchResultSearchSchema]);
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
+ });
507
482
 
508
483
  export const blobSchemaSchema = z.object({
509
484
  type: z.literal('blob'),
@@ -545,12 +520,37 @@ export const constSchemaSchema = z.object({
545
520
  disabled: z.boolean().optional(),
546
521
  });
547
522
 
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(),
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(),
554
554
  });
555
555
 
556
556
  export const statusListLayoutSchema = z.object({
@@ -565,43 +565,17 @@ export const searchResponseBodySchema = z.object({
565
565
  results: z.array(searchResultSchema),
566
566
  });
567
567
 
568
- export const stepSchema: z.ZodSchema<Step> = z.lazy(() =>
568
+ export const columnsLayoutSchema: z.ZodSchema<ColumnsLayout> = z.lazy(() =>
569
569
  z.object({
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(),
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(),
587
576
  }),
588
577
  );
589
578
 
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
-
605
579
  export const layoutSchema: z.ZodSchema<Layout> = z.lazy(() =>
606
580
  z.union([
607
581
  alertLayoutSchema,
@@ -626,6 +600,49 @@ export const layoutSchema: z.ZodSchema<Layout> = z.lazy(() =>
626
600
  ]),
627
601
  );
628
602
 
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
+
629
646
  export const allOfSchemaSchema: z.ZodSchema<AllOfSchema> = z.lazy(() =>
630
647
  z.object({
631
648
  disabled: z.boolean().optional(),
@@ -853,17 +870,12 @@ export const persistAsyncSchema: z.ZodSchema<PersistAsync> = z.lazy(() =>
853
870
  }),
854
871
  );
855
872
 
856
- export const arraySchemaListSchema: z.ZodSchema<ArraySchemaList> = z.lazy(() =>
873
+ export const arraySchemaTupleSchema: z.ZodSchema<ArraySchemaTuple> = z.lazy(() =>
857
874
  z.object({
858
875
  type: z.literal('array'),
859
876
  promoted: z.boolean().optional(),
860
877
  $id: z.string().optional(),
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(),
878
+ items: z.array(schemaSchema),
867
879
  title: z.string().optional(),
868
880
  description: z.string().optional(),
869
881
  control: z.string().optional(),
@@ -871,22 +883,25 @@ export const arraySchemaListSchema: z.ZodSchema<ArraySchemaList> = z.lazy(() =>
871
883
  icon: iconSchema.optional(),
872
884
  image: imageSchema.optional(),
873
885
  keywords: z.array(z.string()).optional(),
874
- summary: summarySummariserSchema.optional(),
886
+ summary: summaryProviderSchema.optional(),
875
887
  analyticsId: z.string().optional(),
876
888
  persistAsync: persistAsyncSchema.optional(),
877
889
  validationAsync: validateAsyncSchema.optional(),
878
890
  alert: alertLayoutSchema.optional(),
879
- validationMessages: z.record(z.string()).optional(),
880
- disabled: z.boolean().optional(),
881
891
  }),
882
892
  );
883
893
 
884
- export const arraySchemaTupleSchema: z.ZodSchema<ArraySchemaTuple> = z.lazy(() =>
894
+ export const arraySchemaListSchema: z.ZodSchema<ArraySchemaList> = z.lazy(() =>
885
895
  z.object({
886
896
  type: z.literal('array'),
887
897
  promoted: z.boolean().optional(),
888
898
  $id: z.string().optional(),
889
- items: z.array(schemaSchema),
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(),
890
905
  title: z.string().optional(),
891
906
  description: z.string().optional(),
892
907
  control: z.string().optional(),
@@ -894,49 +909,34 @@ export const arraySchemaTupleSchema: z.ZodSchema<ArraySchemaTuple> = z.lazy(() =
894
909
  icon: iconSchema.optional(),
895
910
  image: imageSchema.optional(),
896
911
  keywords: z.array(z.string()).optional(),
897
- summary: summaryProviderSchema.optional(),
912
+ summary: summarySummariserSchema.optional(),
898
913
  analyticsId: z.string().optional(),
899
914
  persistAsync: persistAsyncSchema.optional(),
900
915
  validationAsync: validateAsyncSchema.optional(),
901
916
  alert: alertLayoutSchema.optional(),
917
+ validationMessages: z.record(z.string()).optional(),
918
+ disabled: z.boolean().optional(),
902
919
  }),
903
920
  );
904
921
 
905
- export const modalLayoutSchema: z.ZodSchema<ModalLayout> = z.lazy(() =>
906
- z.object({
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(() =>
922
+ export const stepSchema: z.ZodSchema<Step> = z.lazy(() =>
934
923
  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(),
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(),
941
941
  }),
942
942
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-types",
3
- "version": "2.28.2",
3
+ "version": "2.28.3",
4
4
  "description": "Dynamic Flow TypeScript Types",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,6 +8,9 @@
8
8
  "fullname": "transferwise/dynamic-flow",
9
9
  "url": "git+https://github.com/transferwise/dynamic-flow.git"
10
10
  },
11
+ "publishConfig": {
12
+ "registry": "https://registry.npmjs.org/"
13
+ },
11
14
  "main": "./build/main.min.js",
12
15
  "module": "./build/main.mjs",
13
16
  "types": "./build/index.d.ts",