@opencrvs/toolkit 1.8.0-rc.ffe8c17 → 1.8.1-rc.a372970
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/README.md +1 -1
- package/dist/commons/api/router.d.ts +6644 -9555
- package/dist/commons/conditionals/conditionals.d.ts +26 -3
- package/dist/commons/conditionals/validate-address.test.d.ts +2 -0
- package/dist/commons/conditionals/validate.d.ts +14 -17
- package/dist/commons/events/ActionConfig.d.ts +1008 -3209
- package/dist/commons/events/ActionDocument.d.ts +9488 -312
- package/dist/commons/events/ActionInput.d.ts +5329 -472
- package/dist/commons/events/ActionType.d.ts +26 -11
- package/dist/commons/events/CompositeFieldValue.d.ts +152 -2
- package/dist/commons/events/Conditional.d.ts +21 -5
- package/dist/commons/events/Draft.d.ts +351 -48
- package/dist/commons/events/EventConfig.d.ts +639 -2862
- package/dist/commons/events/EventConfigInput.d.ts +6 -3
- package/dist/commons/events/EventDocument.d.ts +3340 -424
- package/dist/commons/events/EventIndex.d.ts +6 -3
- package/dist/commons/events/EventMetadata.d.ts +3 -0
- package/dist/commons/events/FieldConfig.d.ts +383 -104
- package/dist/commons/events/FieldTypeMapping.d.ts +104 -207
- package/dist/commons/events/FieldValue.d.ts +71 -76
- package/dist/commons/events/FormConfig.d.ts +527 -279
- package/dist/commons/events/PageConfig.d.ts +335 -0
- package/dist/commons/events/TemplateConfig.d.ts +5 -5
- package/dist/commons/events/defineConfig.d.ts +40 -417
- package/dist/commons/events/index.d.ts +2 -1
- package/dist/commons/events/test.utils.d.ts +140 -213
- package/dist/commons/events/utils.d.ts +126 -156
- package/dist/commons/events/utils.test.d.ts +2 -0
- package/dist/conditionals/index.js +166 -81
- package/dist/events/index.js +1287 -795
- package/dist/scopes/index.d.ts +70 -1
- package/dist/scopes/index.js +130 -0
- package/package.json +1 -1
@@ -0,0 +1,335 @@
|
|
1
|
+
import { z } from 'zod';
|
2
|
+
import { TranslationConfig } from './TranslationConfig';
|
3
|
+
export declare const PageTypes: z.ZodEnum<["FORM", "VERIFICATION"]>;
|
4
|
+
export type PageType = z.infer<typeof PageTypes>;
|
5
|
+
export declare const FormPageConfig: z.ZodObject<z.objectUtil.extendShape<{
|
6
|
+
id: z.ZodString;
|
7
|
+
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
8
|
+
id: string;
|
9
|
+
description: string;
|
10
|
+
defaultMessage: string;
|
11
|
+
}>;
|
12
|
+
fields: z.ZodArray<z.ZodType<import("./FieldConfig").Inferred, any, import("./FieldConfig").InferredInput>, "many">;
|
13
|
+
conditional: z.ZodOptional<z.ZodType<import(".").JSONSchema, z.ZodTypeDef, import(".").JSONSchema>>;
|
14
|
+
}, {
|
15
|
+
type: z.ZodDefault<z.ZodLiteral<"FORM">>;
|
16
|
+
}>, "strip", z.ZodTypeAny, {
|
17
|
+
type: "FORM";
|
18
|
+
id: string;
|
19
|
+
title: TranslationConfig;
|
20
|
+
fields: import("./FieldConfig").Inferred[];
|
21
|
+
conditional?: import(".").JSONSchema | undefined;
|
22
|
+
}, {
|
23
|
+
id: string;
|
24
|
+
title: {
|
25
|
+
id: string;
|
26
|
+
description: string;
|
27
|
+
defaultMessage: string;
|
28
|
+
};
|
29
|
+
fields: import("./FieldConfig").InferredInput[];
|
30
|
+
type?: "FORM" | undefined;
|
31
|
+
conditional?: import(".").JSONSchema | undefined;
|
32
|
+
}>;
|
33
|
+
export type FormPageConfig = z.infer<typeof FormPageConfig>;
|
34
|
+
export type FormPageConfigInput = z.input<typeof FormPageConfig>;
|
35
|
+
export declare const VerificationActionConfig: z.ZodObject<{
|
36
|
+
verify: z.ZodObject<{
|
37
|
+
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
38
|
+
id: string;
|
39
|
+
description: string;
|
40
|
+
defaultMessage: string;
|
41
|
+
}>;
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
43
|
+
label: TranslationConfig;
|
44
|
+
}, {
|
45
|
+
label: {
|
46
|
+
id: string;
|
47
|
+
description: string;
|
48
|
+
defaultMessage: string;
|
49
|
+
};
|
50
|
+
}>;
|
51
|
+
cancel: z.ZodObject<{
|
52
|
+
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
53
|
+
id: string;
|
54
|
+
description: string;
|
55
|
+
defaultMessage: string;
|
56
|
+
}>;
|
57
|
+
confirmation: z.ZodObject<{
|
58
|
+
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
59
|
+
id: string;
|
60
|
+
description: string;
|
61
|
+
defaultMessage: string;
|
62
|
+
}>;
|
63
|
+
body: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
64
|
+
id: string;
|
65
|
+
description: string;
|
66
|
+
defaultMessage: string;
|
67
|
+
}>;
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
69
|
+
title: TranslationConfig;
|
70
|
+
body: TranslationConfig;
|
71
|
+
}, {
|
72
|
+
title: {
|
73
|
+
id: string;
|
74
|
+
description: string;
|
75
|
+
defaultMessage: string;
|
76
|
+
};
|
77
|
+
body: {
|
78
|
+
id: string;
|
79
|
+
description: string;
|
80
|
+
defaultMessage: string;
|
81
|
+
};
|
82
|
+
}>;
|
83
|
+
}, "strip", z.ZodTypeAny, {
|
84
|
+
label: TranslationConfig;
|
85
|
+
confirmation: {
|
86
|
+
title: TranslationConfig;
|
87
|
+
body: TranslationConfig;
|
88
|
+
};
|
89
|
+
}, {
|
90
|
+
label: {
|
91
|
+
id: string;
|
92
|
+
description: string;
|
93
|
+
defaultMessage: string;
|
94
|
+
};
|
95
|
+
confirmation: {
|
96
|
+
title: {
|
97
|
+
id: string;
|
98
|
+
description: string;
|
99
|
+
defaultMessage: string;
|
100
|
+
};
|
101
|
+
body: {
|
102
|
+
id: string;
|
103
|
+
description: string;
|
104
|
+
defaultMessage: string;
|
105
|
+
};
|
106
|
+
};
|
107
|
+
}>;
|
108
|
+
}, "strip", z.ZodTypeAny, {
|
109
|
+
verify: {
|
110
|
+
label: TranslationConfig;
|
111
|
+
};
|
112
|
+
cancel: {
|
113
|
+
label: TranslationConfig;
|
114
|
+
confirmation: {
|
115
|
+
title: TranslationConfig;
|
116
|
+
body: TranslationConfig;
|
117
|
+
};
|
118
|
+
};
|
119
|
+
}, {
|
120
|
+
verify: {
|
121
|
+
label: {
|
122
|
+
id: string;
|
123
|
+
description: string;
|
124
|
+
defaultMessage: string;
|
125
|
+
};
|
126
|
+
};
|
127
|
+
cancel: {
|
128
|
+
label: {
|
129
|
+
id: string;
|
130
|
+
description: string;
|
131
|
+
defaultMessage: string;
|
132
|
+
};
|
133
|
+
confirmation: {
|
134
|
+
title: {
|
135
|
+
id: string;
|
136
|
+
description: string;
|
137
|
+
defaultMessage: string;
|
138
|
+
};
|
139
|
+
body: {
|
140
|
+
id: string;
|
141
|
+
description: string;
|
142
|
+
defaultMessage: string;
|
143
|
+
};
|
144
|
+
};
|
145
|
+
};
|
146
|
+
}>;
|
147
|
+
export declare const VerificationPageConfig: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
|
148
|
+
id: z.ZodString;
|
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.ZodDefault<z.ZodLiteral<"FORM">>;
|
158
|
+
}>, {
|
159
|
+
type: z.ZodLiteral<"VERIFICATION">;
|
160
|
+
actions: z.ZodObject<{
|
161
|
+
verify: z.ZodObject<{
|
162
|
+
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
163
|
+
id: string;
|
164
|
+
description: string;
|
165
|
+
defaultMessage: string;
|
166
|
+
}>;
|
167
|
+
}, "strip", z.ZodTypeAny, {
|
168
|
+
label: TranslationConfig;
|
169
|
+
}, {
|
170
|
+
label: {
|
171
|
+
id: string;
|
172
|
+
description: string;
|
173
|
+
defaultMessage: string;
|
174
|
+
};
|
175
|
+
}>;
|
176
|
+
cancel: z.ZodObject<{
|
177
|
+
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
178
|
+
id: string;
|
179
|
+
description: string;
|
180
|
+
defaultMessage: string;
|
181
|
+
}>;
|
182
|
+
confirmation: z.ZodObject<{
|
183
|
+
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
184
|
+
id: string;
|
185
|
+
description: string;
|
186
|
+
defaultMessage: string;
|
187
|
+
}>;
|
188
|
+
body: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
189
|
+
id: string;
|
190
|
+
description: string;
|
191
|
+
defaultMessage: string;
|
192
|
+
}>;
|
193
|
+
}, "strip", z.ZodTypeAny, {
|
194
|
+
title: TranslationConfig;
|
195
|
+
body: TranslationConfig;
|
196
|
+
}, {
|
197
|
+
title: {
|
198
|
+
id: string;
|
199
|
+
description: string;
|
200
|
+
defaultMessage: string;
|
201
|
+
};
|
202
|
+
body: {
|
203
|
+
id: string;
|
204
|
+
description: string;
|
205
|
+
defaultMessage: string;
|
206
|
+
};
|
207
|
+
}>;
|
208
|
+
}, "strip", z.ZodTypeAny, {
|
209
|
+
label: TranslationConfig;
|
210
|
+
confirmation: {
|
211
|
+
title: TranslationConfig;
|
212
|
+
body: TranslationConfig;
|
213
|
+
};
|
214
|
+
}, {
|
215
|
+
label: {
|
216
|
+
id: string;
|
217
|
+
description: string;
|
218
|
+
defaultMessage: string;
|
219
|
+
};
|
220
|
+
confirmation: {
|
221
|
+
title: {
|
222
|
+
id: string;
|
223
|
+
description: string;
|
224
|
+
defaultMessage: string;
|
225
|
+
};
|
226
|
+
body: {
|
227
|
+
id: string;
|
228
|
+
description: string;
|
229
|
+
defaultMessage: string;
|
230
|
+
};
|
231
|
+
};
|
232
|
+
}>;
|
233
|
+
}, "strip", z.ZodTypeAny, {
|
234
|
+
verify: {
|
235
|
+
label: TranslationConfig;
|
236
|
+
};
|
237
|
+
cancel: {
|
238
|
+
label: TranslationConfig;
|
239
|
+
confirmation: {
|
240
|
+
title: TranslationConfig;
|
241
|
+
body: TranslationConfig;
|
242
|
+
};
|
243
|
+
};
|
244
|
+
}, {
|
245
|
+
verify: {
|
246
|
+
label: {
|
247
|
+
id: string;
|
248
|
+
description: string;
|
249
|
+
defaultMessage: string;
|
250
|
+
};
|
251
|
+
};
|
252
|
+
cancel: {
|
253
|
+
label: {
|
254
|
+
id: string;
|
255
|
+
description: string;
|
256
|
+
defaultMessage: string;
|
257
|
+
};
|
258
|
+
confirmation: {
|
259
|
+
title: {
|
260
|
+
id: string;
|
261
|
+
description: string;
|
262
|
+
defaultMessage: string;
|
263
|
+
};
|
264
|
+
body: {
|
265
|
+
id: string;
|
266
|
+
description: string;
|
267
|
+
defaultMessage: string;
|
268
|
+
};
|
269
|
+
};
|
270
|
+
};
|
271
|
+
}>;
|
272
|
+
}>, "strip", z.ZodTypeAny, {
|
273
|
+
type: "VERIFICATION";
|
274
|
+
id: string;
|
275
|
+
title: TranslationConfig;
|
276
|
+
actions: {
|
277
|
+
verify: {
|
278
|
+
label: TranslationConfig;
|
279
|
+
};
|
280
|
+
cancel: {
|
281
|
+
label: TranslationConfig;
|
282
|
+
confirmation: {
|
283
|
+
title: TranslationConfig;
|
284
|
+
body: TranslationConfig;
|
285
|
+
};
|
286
|
+
};
|
287
|
+
};
|
288
|
+
fields: import("./FieldConfig").Inferred[];
|
289
|
+
conditional?: import(".").JSONSchema | undefined;
|
290
|
+
}, {
|
291
|
+
type: "VERIFICATION";
|
292
|
+
id: string;
|
293
|
+
title: {
|
294
|
+
id: string;
|
295
|
+
description: string;
|
296
|
+
defaultMessage: string;
|
297
|
+
};
|
298
|
+
actions: {
|
299
|
+
verify: {
|
300
|
+
label: {
|
301
|
+
id: string;
|
302
|
+
description: string;
|
303
|
+
defaultMessage: string;
|
304
|
+
};
|
305
|
+
};
|
306
|
+
cancel: {
|
307
|
+
label: {
|
308
|
+
id: string;
|
309
|
+
description: string;
|
310
|
+
defaultMessage: string;
|
311
|
+
};
|
312
|
+
confirmation: {
|
313
|
+
title: {
|
314
|
+
id: string;
|
315
|
+
description: string;
|
316
|
+
defaultMessage: string;
|
317
|
+
};
|
318
|
+
body: {
|
319
|
+
id: string;
|
320
|
+
description: string;
|
321
|
+
defaultMessage: string;
|
322
|
+
};
|
323
|
+
};
|
324
|
+
};
|
325
|
+
};
|
326
|
+
fields: import("./FieldConfig").InferredInput[];
|
327
|
+
conditional?: import(".").JSONSchema | undefined;
|
328
|
+
}>;
|
329
|
+
export type VerificationPageConfig = z.infer<typeof VerificationPageConfig>;
|
330
|
+
type AllPageConfig = typeof VerificationPageConfig | typeof FormPageConfig;
|
331
|
+
export declare const PageConfig: z.ZodDiscriminatedUnion<"type", AllPageConfig[]>;
|
332
|
+
export type PageConfig = z.infer<typeof PageConfig>;
|
333
|
+
export type PageConfigInput = z.input<typeof PageConfig>;
|
334
|
+
export {};
|
335
|
+
//# sourceMappingURL=PageConfig.d.ts.map
|
@@ -6,12 +6,12 @@ import { FieldValue } from './FieldValue';
|
|
6
6
|
/**
|
7
7
|
* Available system variables for configuration.
|
8
8
|
*/
|
9
|
-
export
|
9
|
+
export type SystemVariables = {
|
10
10
|
$user: {
|
11
11
|
province: string;
|
12
12
|
district: string;
|
13
13
|
};
|
14
|
-
}
|
14
|
+
};
|
15
15
|
/**
|
16
16
|
* Recursively flatten the keys of an object. Used to limit types when configuring default values in country config.
|
17
17
|
* @example
|
@@ -21,12 +21,12 @@ export interface MetaFields {
|
|
21
21
|
type FlattenedKeyStrings<T, Prefix extends string = ''> = {
|
22
22
|
[K in keyof T]: T[K] extends Record<string, any> ? FlattenedKeyStrings<T[K], `${Prefix}${K & string}.`> : `${Prefix}${K & string}`;
|
23
23
|
}[keyof T];
|
24
|
-
export type
|
24
|
+
export type FlattenenedSystemVariables = FlattenedKeyStrings<SystemVariables>;
|
25
25
|
/**
|
26
26
|
* Default value for a field when configuring a form.
|
27
27
|
*/
|
28
|
-
export type FieldConfigDefaultValue = FieldValue |
|
29
|
-
export declare function isTemplateVariable(value: FieldConfigDefaultValue): value is
|
28
|
+
export type FieldConfigDefaultValue = FieldValue | FlattenenedSystemVariables | Record<string, FlattenenedSystemVariables | FieldValue>;
|
29
|
+
export declare function isTemplateVariable(value: FieldConfigDefaultValue): value is FlattenenedSystemVariables;
|
30
30
|
export declare function isFieldValue(value: FieldConfigDefaultValue): value is FieldValue;
|
31
31
|
/**
|
32
32
|
* Checks if given value is valid for a field, and known template variables are already resolved.
|