@opencrvs/toolkit 1.8.0-rc.feaeeb7 → 1.8.0-rc.ff62f9e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commons/api/router.d.ts +6838 -506
- package/dist/commons/conditionals/conditionals.d.ts +1 -0
- package/dist/commons/conditionals/validate-address.test.d.ts +2 -0
- package/dist/commons/conditionals/validate.d.ts +27 -0
- package/dist/commons/conditionals/validate.test.d.ts +2 -0
- package/dist/commons/events/ActionConfig.d.ts +4714 -262
- package/dist/commons/events/ActionDocument.d.ts +2549 -74
- package/dist/commons/events/ActionInput.d.ts +4100 -276
- package/dist/commons/events/ActionType.d.ts +7 -1
- package/dist/commons/events/CompositeFieldValue.d.ts +152 -2
- package/dist/commons/events/Draft.d.ts +300 -15
- package/dist/commons/events/EventConfig.d.ts +1848 -192
- package/dist/commons/events/EventConfigInput.d.ts +2 -2
- package/dist/commons/events/EventDocument.d.ts +3244 -161
- package/dist/commons/events/FieldConfig.d.ts +293 -40
- package/dist/commons/events/FieldType.d.ts +6 -1
- package/dist/commons/events/FieldTypeMapping.d.ts +154 -3
- package/dist/commons/events/FieldValue.d.ts +76 -2
- package/dist/commons/events/FormConfig.d.ts +377 -29
- package/dist/commons/events/TemplateConfig.d.ts +28 -8
- package/dist/commons/events/defineConfig.d.ts +309 -35
- package/dist/commons/events/test.utils.d.ts +164 -16
- package/dist/commons/events/utils.d.ts +232 -10
- package/dist/conditionals/index.js +17 -0
- package/dist/events/index.js +505 -116
- package/package.json +1 -1
@@ -1,17 +1,25 @@
|
|
1
1
|
import { z } from 'zod';
|
2
2
|
import { TranslationConfig } from './TranslationConfig';
|
3
|
+
export declare const FormPageType: {
|
4
|
+
readonly FORM: "FORM";
|
5
|
+
readonly VERIFICATION: "VERIFICATION";
|
6
|
+
};
|
3
7
|
export declare const FormPage: z.ZodObject<{
|
4
8
|
id: z.ZodString;
|
9
|
+
type: z.ZodDefault<z.ZodLiteral<"FORM">>;
|
5
10
|
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
6
11
|
id: string;
|
7
12
|
description: string;
|
8
13
|
defaultMessage: string;
|
9
14
|
}>;
|
10
|
-
fields: z.ZodArray<z.ZodType<import("./FieldConfig").Inferred, any, import("./FieldConfig").
|
15
|
+
fields: z.ZodArray<z.ZodType<import("./FieldConfig").Inferred, any, import("./FieldConfig").InferredInput>, "many">;
|
16
|
+
conditional: z.ZodOptional<z.ZodType<import(".").JSONSchema, z.ZodTypeDef, import(".").JSONSchema>>;
|
11
17
|
}, "strip", z.ZodTypeAny, {
|
18
|
+
type: "FORM";
|
12
19
|
id: string;
|
13
20
|
title: TranslationConfig;
|
14
21
|
fields: import("./FieldConfig").Inferred[];
|
22
|
+
conditional?: import(".").JSONSchema | undefined;
|
15
23
|
}, {
|
16
24
|
id: string;
|
17
25
|
title: {
|
@@ -19,61 +27,341 @@ export declare const FormPage: z.ZodObject<{
|
|
19
27
|
description: string;
|
20
28
|
defaultMessage: string;
|
21
29
|
};
|
22
|
-
fields: import("./FieldConfig").
|
30
|
+
fields: import("./FieldConfig").InferredInput[];
|
31
|
+
type?: "FORM" | undefined;
|
32
|
+
conditional?: import(".").JSONSchema | undefined;
|
23
33
|
}>;
|
24
|
-
export declare const
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
34
|
+
export declare const VerificationPageConfig: z.ZodObject<{
|
35
|
+
verify: z.ZodObject<{
|
36
|
+
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
37
|
+
id: string;
|
38
|
+
description: string;
|
39
|
+
defaultMessage: string;
|
40
|
+
}>;
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
42
|
+
label: TranslationConfig;
|
43
|
+
}, {
|
44
|
+
label: {
|
45
|
+
id: string;
|
46
|
+
description: string;
|
47
|
+
defaultMessage: string;
|
48
|
+
};
|
29
49
|
}>;
|
30
|
-
|
31
|
-
id: z.ZodString;
|
50
|
+
cancel: z.ZodObject<{
|
32
51
|
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
33
52
|
id: string;
|
34
53
|
description: string;
|
35
54
|
defaultMessage: string;
|
36
55
|
}>;
|
56
|
+
confirmation: z.ZodObject<{
|
57
|
+
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
58
|
+
id: string;
|
59
|
+
description: string;
|
60
|
+
defaultMessage: string;
|
61
|
+
}>;
|
62
|
+
body: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
63
|
+
id: string;
|
64
|
+
description: string;
|
65
|
+
defaultMessage: string;
|
66
|
+
}>;
|
67
|
+
}, "strip", z.ZodTypeAny, {
|
68
|
+
title: TranslationConfig;
|
69
|
+
body: TranslationConfig;
|
70
|
+
}, {
|
71
|
+
title: {
|
72
|
+
id: string;
|
73
|
+
description: string;
|
74
|
+
defaultMessage: string;
|
75
|
+
};
|
76
|
+
body: {
|
77
|
+
id: string;
|
78
|
+
description: string;
|
79
|
+
defaultMessage: string;
|
80
|
+
};
|
81
|
+
}>;
|
37
82
|
}, "strip", z.ZodTypeAny, {
|
38
|
-
id: string;
|
39
83
|
label: TranslationConfig;
|
84
|
+
confirmation: {
|
85
|
+
title: TranslationConfig;
|
86
|
+
body: TranslationConfig;
|
87
|
+
};
|
40
88
|
}, {
|
41
|
-
id: string;
|
42
89
|
label: {
|
43
90
|
id: string;
|
44
91
|
description: string;
|
45
92
|
defaultMessage: string;
|
46
93
|
};
|
94
|
+
confirmation: {
|
95
|
+
title: {
|
96
|
+
id: string;
|
97
|
+
description: string;
|
98
|
+
defaultMessage: string;
|
99
|
+
};
|
100
|
+
body: {
|
101
|
+
id: string;
|
102
|
+
description: string;
|
103
|
+
defaultMessage: string;
|
104
|
+
};
|
105
|
+
};
|
47
106
|
}>;
|
48
|
-
|
49
|
-
|
107
|
+
}, "strip", z.ZodTypeAny, {
|
108
|
+
verify: {
|
109
|
+
label: TranslationConfig;
|
110
|
+
};
|
111
|
+
cancel: {
|
112
|
+
label: TranslationConfig;
|
113
|
+
confirmation: {
|
114
|
+
title: TranslationConfig;
|
115
|
+
body: TranslationConfig;
|
116
|
+
};
|
117
|
+
};
|
118
|
+
}, {
|
119
|
+
verify: {
|
120
|
+
label: {
|
121
|
+
id: string;
|
122
|
+
description: string;
|
123
|
+
defaultMessage: string;
|
124
|
+
};
|
125
|
+
};
|
126
|
+
cancel: {
|
127
|
+
label: {
|
128
|
+
id: string;
|
129
|
+
description: string;
|
130
|
+
defaultMessage: string;
|
131
|
+
};
|
132
|
+
confirmation: {
|
133
|
+
title: {
|
134
|
+
id: string;
|
135
|
+
description: string;
|
136
|
+
defaultMessage: string;
|
137
|
+
};
|
138
|
+
body: {
|
139
|
+
id: string;
|
140
|
+
description: string;
|
141
|
+
defaultMessage: string;
|
142
|
+
};
|
143
|
+
};
|
144
|
+
};
|
145
|
+
}>;
|
146
|
+
export declare const VerificationPage: z.ZodObject<z.objectUtil.extendShape<{
|
147
|
+
id: z.ZodString;
|
148
|
+
type: z.ZodDefault<z.ZodLiteral<"FORM">>;
|
149
|
+
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
150
|
+
id: string;
|
151
|
+
description: string;
|
152
|
+
defaultMessage: string;
|
153
|
+
}>;
|
154
|
+
fields: z.ZodArray<z.ZodType<import("./FieldConfig").Inferred, any, import("./FieldConfig").InferredInput>, "many">;
|
155
|
+
conditional: z.ZodOptional<z.ZodType<import(".").JSONSchema, z.ZodTypeDef, import(".").JSONSchema>>;
|
156
|
+
}, {
|
157
|
+
type: z.ZodLiteral<"VERIFICATION">;
|
158
|
+
actions: z.ZodObject<{
|
159
|
+
verify: z.ZodObject<{
|
160
|
+
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
161
|
+
id: string;
|
162
|
+
description: string;
|
163
|
+
defaultMessage: string;
|
164
|
+
}>;
|
165
|
+
}, "strip", z.ZodTypeAny, {
|
166
|
+
label: TranslationConfig;
|
167
|
+
}, {
|
168
|
+
label: {
|
169
|
+
id: string;
|
170
|
+
description: string;
|
171
|
+
defaultMessage: string;
|
172
|
+
};
|
173
|
+
}>;
|
174
|
+
cancel: z.ZodObject<{
|
175
|
+
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
176
|
+
id: string;
|
177
|
+
description: string;
|
178
|
+
defaultMessage: string;
|
179
|
+
}>;
|
180
|
+
confirmation: z.ZodObject<{
|
181
|
+
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
182
|
+
id: string;
|
183
|
+
description: string;
|
184
|
+
defaultMessage: string;
|
185
|
+
}>;
|
186
|
+
body: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
187
|
+
id: string;
|
188
|
+
description: string;
|
189
|
+
defaultMessage: string;
|
190
|
+
}>;
|
191
|
+
}, "strip", z.ZodTypeAny, {
|
192
|
+
title: TranslationConfig;
|
193
|
+
body: TranslationConfig;
|
194
|
+
}, {
|
195
|
+
title: {
|
196
|
+
id: string;
|
197
|
+
description: string;
|
198
|
+
defaultMessage: string;
|
199
|
+
};
|
200
|
+
body: {
|
201
|
+
id: string;
|
202
|
+
description: string;
|
203
|
+
defaultMessage: string;
|
204
|
+
};
|
205
|
+
}>;
|
206
|
+
}, "strip", z.ZodTypeAny, {
|
207
|
+
label: TranslationConfig;
|
208
|
+
confirmation: {
|
209
|
+
title: TranslationConfig;
|
210
|
+
body: TranslationConfig;
|
211
|
+
};
|
212
|
+
}, {
|
213
|
+
label: {
|
214
|
+
id: string;
|
215
|
+
description: string;
|
216
|
+
defaultMessage: string;
|
217
|
+
};
|
218
|
+
confirmation: {
|
219
|
+
title: {
|
220
|
+
id: string;
|
221
|
+
description: string;
|
222
|
+
defaultMessage: string;
|
223
|
+
};
|
224
|
+
body: {
|
225
|
+
id: string;
|
226
|
+
description: string;
|
227
|
+
defaultMessage: string;
|
228
|
+
};
|
229
|
+
};
|
230
|
+
}>;
|
231
|
+
}, "strip", z.ZodTypeAny, {
|
232
|
+
verify: {
|
233
|
+
label: TranslationConfig;
|
234
|
+
};
|
235
|
+
cancel: {
|
236
|
+
label: TranslationConfig;
|
237
|
+
confirmation: {
|
238
|
+
title: TranslationConfig;
|
239
|
+
body: TranslationConfig;
|
240
|
+
};
|
241
|
+
};
|
242
|
+
}, {
|
243
|
+
verify: {
|
244
|
+
label: {
|
245
|
+
id: string;
|
246
|
+
description: string;
|
247
|
+
defaultMessage: string;
|
248
|
+
};
|
249
|
+
};
|
250
|
+
cancel: {
|
251
|
+
label: {
|
252
|
+
id: string;
|
253
|
+
description: string;
|
254
|
+
defaultMessage: string;
|
255
|
+
};
|
256
|
+
confirmation: {
|
257
|
+
title: {
|
258
|
+
id: string;
|
259
|
+
description: string;
|
260
|
+
defaultMessage: string;
|
261
|
+
};
|
262
|
+
body: {
|
263
|
+
id: string;
|
264
|
+
description: string;
|
265
|
+
defaultMessage: string;
|
266
|
+
};
|
267
|
+
};
|
268
|
+
};
|
269
|
+
}>;
|
270
|
+
}>, "strip", z.ZodTypeAny, {
|
271
|
+
type: "VERIFICATION";
|
272
|
+
id: string;
|
273
|
+
title: TranslationConfig;
|
274
|
+
actions: {
|
275
|
+
verify: {
|
276
|
+
label: TranslationConfig;
|
277
|
+
};
|
278
|
+
cancel: {
|
279
|
+
label: TranslationConfig;
|
280
|
+
confirmation: {
|
281
|
+
title: TranslationConfig;
|
282
|
+
body: TranslationConfig;
|
283
|
+
};
|
284
|
+
};
|
285
|
+
};
|
286
|
+
fields: import("./FieldConfig").Inferred[];
|
287
|
+
conditional?: import(".").JSONSchema | undefined;
|
288
|
+
}, {
|
289
|
+
type: "VERIFICATION";
|
290
|
+
id: string;
|
291
|
+
title: {
|
292
|
+
id: string;
|
293
|
+
description: string;
|
294
|
+
defaultMessage: string;
|
295
|
+
};
|
296
|
+
actions: {
|
297
|
+
verify: {
|
298
|
+
label: {
|
299
|
+
id: string;
|
300
|
+
description: string;
|
301
|
+
defaultMessage: string;
|
302
|
+
};
|
303
|
+
};
|
304
|
+
cancel: {
|
305
|
+
label: {
|
306
|
+
id: string;
|
307
|
+
description: string;
|
308
|
+
defaultMessage: string;
|
309
|
+
};
|
310
|
+
confirmation: {
|
311
|
+
title: {
|
312
|
+
id: string;
|
313
|
+
description: string;
|
314
|
+
defaultMessage: string;
|
315
|
+
};
|
316
|
+
body: {
|
317
|
+
id: string;
|
318
|
+
description: string;
|
319
|
+
defaultMessage: string;
|
320
|
+
};
|
321
|
+
};
|
322
|
+
};
|
323
|
+
};
|
324
|
+
fields: import("./FieldConfig").InferredInput[];
|
325
|
+
conditional?: import(".").JSONSchema | undefined;
|
326
|
+
}>;
|
327
|
+
export type VerificationPageConfig = z.infer<typeof VerificationPageConfig>;
|
328
|
+
type AllPageConfigs = typeof FormPage | typeof VerificationPage;
|
329
|
+
export declare const FormPageConfig: z.ZodDiscriminatedUnion<"type", AllPageConfigs[]>;
|
330
|
+
export type FormPageConfigInput = z.input<typeof FormPageConfig>;
|
331
|
+
export type FormPageConfig = z.infer<typeof FormPageConfig>;
|
332
|
+
export declare const FormConfig: z.ZodObject<{
|
333
|
+
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
334
|
+
id: string;
|
335
|
+
description: string;
|
336
|
+
defaultMessage: string;
|
337
|
+
}>;
|
338
|
+
version: z.ZodObject<{
|
50
339
|
id: z.ZodString;
|
51
|
-
|
340
|
+
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
52
341
|
id: string;
|
53
342
|
description: string;
|
54
343
|
defaultMessage: string;
|
55
344
|
}>;
|
56
|
-
fields: z.ZodArray<z.ZodType<import("./FieldConfig").Inferred, any, import("./FieldConfig").Inferred>, "many">;
|
57
345
|
}, "strip", z.ZodTypeAny, {
|
58
346
|
id: string;
|
59
|
-
|
60
|
-
fields: import("./FieldConfig").Inferred[];
|
347
|
+
label: TranslationConfig;
|
61
348
|
}, {
|
62
349
|
id: string;
|
63
|
-
|
350
|
+
label: {
|
64
351
|
id: string;
|
65
352
|
description: string;
|
66
353
|
defaultMessage: string;
|
67
354
|
};
|
68
|
-
|
69
|
-
|
355
|
+
}>;
|
356
|
+
active: z.ZodDefault<z.ZodBoolean>;
|
357
|
+
pages: z.ZodArray<z.ZodDiscriminatedUnion<"type", AllPageConfigs[]>, "many">;
|
70
358
|
review: z.ZodObject<{
|
71
359
|
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
72
360
|
id: string;
|
73
361
|
description: string;
|
74
362
|
defaultMessage: string;
|
75
363
|
}>;
|
76
|
-
fields: z.ZodArray<z.ZodType<import("./FieldConfig").Inferred, any, import("./FieldConfig").
|
364
|
+
fields: z.ZodArray<z.ZodType<import("./FieldConfig").Inferred, any, import("./FieldConfig").InferredInput>, "many">;
|
77
365
|
}, "strip", z.ZodTypeAny, {
|
78
366
|
title: TranslationConfig;
|
79
367
|
fields: import("./FieldConfig").Inferred[];
|
@@ -83,7 +371,7 @@ export declare const FormConfig: z.ZodObject<{
|
|
83
371
|
description: string;
|
84
372
|
defaultMessage: string;
|
85
373
|
};
|
86
|
-
fields: import("./FieldConfig").
|
374
|
+
fields: import("./FieldConfig").InferredInput[];
|
87
375
|
}>;
|
88
376
|
}, "strip", z.ZodTypeAny, {
|
89
377
|
active: boolean;
|
@@ -92,11 +380,31 @@ export declare const FormConfig: z.ZodObject<{
|
|
92
380
|
label: TranslationConfig;
|
93
381
|
};
|
94
382
|
label: TranslationConfig;
|
95
|
-
pages: {
|
383
|
+
pages: ({
|
384
|
+
type: "FORM";
|
96
385
|
id: string;
|
97
386
|
title: TranslationConfig;
|
98
387
|
fields: import("./FieldConfig").Inferred[];
|
99
|
-
|
388
|
+
conditional?: import(".").JSONSchema | undefined;
|
389
|
+
} | {
|
390
|
+
type: "VERIFICATION";
|
391
|
+
id: string;
|
392
|
+
title: TranslationConfig;
|
393
|
+
actions: {
|
394
|
+
verify: {
|
395
|
+
label: TranslationConfig;
|
396
|
+
};
|
397
|
+
cancel: {
|
398
|
+
label: TranslationConfig;
|
399
|
+
confirmation: {
|
400
|
+
title: TranslationConfig;
|
401
|
+
body: TranslationConfig;
|
402
|
+
};
|
403
|
+
};
|
404
|
+
};
|
405
|
+
fields: import("./FieldConfig").Inferred[];
|
406
|
+
conditional?: import(".").JSONSchema | undefined;
|
407
|
+
})[];
|
100
408
|
review: {
|
101
409
|
title: TranslationConfig;
|
102
410
|
fields: import("./FieldConfig").Inferred[];
|
@@ -115,26 +423,66 @@ export declare const FormConfig: z.ZodObject<{
|
|
115
423
|
description: string;
|
116
424
|
defaultMessage: string;
|
117
425
|
};
|
118
|
-
pages: {
|
426
|
+
pages: ({
|
119
427
|
id: string;
|
120
428
|
title: {
|
121
429
|
id: string;
|
122
430
|
description: string;
|
123
431
|
defaultMessage: string;
|
124
432
|
};
|
125
|
-
fields: import("./FieldConfig").
|
126
|
-
|
433
|
+
fields: import("./FieldConfig").InferredInput[];
|
434
|
+
type?: "FORM" | undefined;
|
435
|
+
conditional?: import(".").JSONSchema | undefined;
|
436
|
+
} | {
|
437
|
+
type: "VERIFICATION";
|
438
|
+
id: string;
|
439
|
+
title: {
|
440
|
+
id: string;
|
441
|
+
description: string;
|
442
|
+
defaultMessage: string;
|
443
|
+
};
|
444
|
+
actions: {
|
445
|
+
verify: {
|
446
|
+
label: {
|
447
|
+
id: string;
|
448
|
+
description: string;
|
449
|
+
defaultMessage: string;
|
450
|
+
};
|
451
|
+
};
|
452
|
+
cancel: {
|
453
|
+
label: {
|
454
|
+
id: string;
|
455
|
+
description: string;
|
456
|
+
defaultMessage: string;
|
457
|
+
};
|
458
|
+
confirmation: {
|
459
|
+
title: {
|
460
|
+
id: string;
|
461
|
+
description: string;
|
462
|
+
defaultMessage: string;
|
463
|
+
};
|
464
|
+
body: {
|
465
|
+
id: string;
|
466
|
+
description: string;
|
467
|
+
defaultMessage: string;
|
468
|
+
};
|
469
|
+
};
|
470
|
+
};
|
471
|
+
};
|
472
|
+
fields: import("./FieldConfig").InferredInput[];
|
473
|
+
conditional?: import(".").JSONSchema | undefined;
|
474
|
+
})[];
|
127
475
|
review: {
|
128
476
|
title: {
|
129
477
|
id: string;
|
130
478
|
description: string;
|
131
479
|
defaultMessage: string;
|
132
480
|
};
|
133
|
-
fields: import("./FieldConfig").
|
481
|
+
fields: import("./FieldConfig").InferredInput[];
|
134
482
|
};
|
135
483
|
active?: boolean | undefined;
|
136
484
|
}>;
|
137
|
-
export type FormPage = z.infer<typeof FormPage>;
|
138
485
|
export type FormConfig = z.infer<typeof FormConfig>;
|
139
486
|
export type FormConfigInput = z.input<typeof FormConfig>;
|
487
|
+
export {};
|
140
488
|
//# sourceMappingURL=FormConfig.d.ts.map
|
@@ -1,18 +1,38 @@
|
|
1
|
+
/**
|
2
|
+
* TemplateConfig defines configuration rules for system-based variables (e.g. $user.province).
|
3
|
+
* They are currently used for providing default values in FieldConfig.
|
4
|
+
*/
|
1
5
|
import { FieldValue } from './FieldValue';
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
export declare function isFieldValueWithoutTemplates(value: DefaultValue): value is FieldValue;
|
6
|
-
export declare function isDefaultValue(value: any): value is DefaultValue;
|
6
|
+
/**
|
7
|
+
* Available system variables for configuration.
|
8
|
+
*/
|
7
9
|
export interface MetaFields {
|
8
10
|
$user: {
|
9
11
|
province: string;
|
10
12
|
district: string;
|
11
13
|
};
|
12
14
|
}
|
13
|
-
|
14
|
-
|
15
|
+
/**
|
16
|
+
* Recursively flatten the keys of an object. Used to limit types when configuring default values in country config.
|
17
|
+
* @example
|
18
|
+
* type Test = FlattenedKeyStrings<{ a: { b: string, c: { d: string } } }>
|
19
|
+
* // 'a.b' | 'a.c.d' but not 'a' or 'a.c'
|
20
|
+
*/
|
21
|
+
type FlattenedKeyStrings<T, Prefix extends string = ''> = {
|
22
|
+
[K in keyof T]: T[K] extends Record<string, any> ? FlattenedKeyStrings<T[K], `${Prefix}${K & string}.`> : `${Prefix}${K & string}`;
|
15
23
|
}[keyof T];
|
16
|
-
export type
|
24
|
+
export type FlattenedMetaFields = FlattenedKeyStrings<MetaFields>;
|
25
|
+
/**
|
26
|
+
* Default value for a field when configuring a form.
|
27
|
+
*/
|
28
|
+
export type FieldConfigDefaultValue = FieldValue | FlattenedMetaFields | Record<string, FlattenedMetaFields | FieldValue>;
|
29
|
+
export declare function isTemplateVariable(value: FieldConfigDefaultValue): value is FlattenedMetaFields;
|
30
|
+
export declare function isFieldValue(value: FieldConfigDefaultValue): value is FieldValue;
|
31
|
+
/**
|
32
|
+
* Checks if given value is valid for a field, and known template variables are already resolved.
|
33
|
+
* @todo: Extend functionality to arbitrary depth objects. Currently only checks first level since our compoosite fields are only 1 level deep.
|
34
|
+
*/
|
35
|
+
export declare function isFieldValueWithoutTemplates(value: FieldConfigDefaultValue): value is FieldValue;
|
36
|
+
export declare function isFieldConfigDefaultValue(value: any): value is FieldConfigDefaultValue;
|
17
37
|
export {};
|
18
38
|
//# sourceMappingURL=TemplateConfig.d.ts.map
|