@opencrvs/toolkit 1.8.0-rc.fbb7263 → 1.8.0-rc.fbe4a79

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 (41) hide show
  1. package/README.md +1 -1
  2. package/dist/commons/api/router.d.ts +11448 -10623
  3. package/dist/commons/conditionals/conditionals.d.ts +31 -5
  4. package/dist/commons/conditionals/validate-address.test.d.ts +2 -0
  5. package/dist/commons/conditionals/validate.d.ts +39 -17
  6. package/dist/commons/conditionals/validate.test.d.ts +2 -0
  7. package/dist/commons/events/ActionConfig.d.ts +89415 -2021
  8. package/dist/commons/events/ActionDocument.d.ts +9820 -313
  9. package/dist/commons/events/ActionInput.d.ts +5366 -501
  10. package/dist/commons/events/ActionType.d.ts +27 -12
  11. package/dist/commons/events/AdvancedSearchConfig.d.ts +369 -25
  12. package/dist/commons/events/CompositeFieldValue.d.ts +155 -2
  13. package/dist/commons/events/Conditional.d.ts +21 -5
  14. package/dist/commons/events/Draft.d.ts +367 -51
  15. package/dist/commons/events/EventConfig.d.ts +42573 -1784
  16. package/dist/commons/events/EventConfigInput.d.ts +6 -3
  17. package/dist/commons/events/EventDocument.d.ts +3526 -429
  18. package/dist/commons/events/EventIndex.d.ts +1346 -10
  19. package/dist/commons/events/EventInput.d.ts +13 -0
  20. package/dist/commons/events/EventMetadata.d.ts +273 -8
  21. package/dist/commons/events/FieldConfig.d.ts +4262 -800
  22. package/dist/commons/events/FieldType.d.ts +7 -2
  23. package/dist/commons/events/FieldTypeMapping.d.ts +164 -6
  24. package/dist/commons/events/FieldValue.d.ts +82 -5
  25. package/dist/commons/events/FormConfig.d.ts +40636 -73
  26. package/dist/commons/events/PageConfig.d.ts +10209 -0
  27. package/dist/commons/events/SummaryConfig.d.ts +95 -39
  28. package/dist/commons/events/TemplateConfig.d.ts +38 -0
  29. package/dist/commons/events/User.d.ts +5 -0
  30. package/dist/commons/events/WorkqueueConfig.d.ts +1135 -19
  31. package/dist/commons/events/defineConfig.d.ts +7030 -230
  32. package/dist/commons/events/event.d.ts +27 -0
  33. package/dist/commons/events/field.d.ts +68 -0
  34. package/dist/commons/events/index.d.ts +6 -1
  35. package/dist/commons/events/scopes.d.ts +26 -0
  36. package/dist/commons/events/test.utils.d.ts +128 -238
  37. package/dist/commons/events/utils.d.ts +3679 -69
  38. package/dist/commons/events/utils.test.d.ts +2 -0
  39. package/dist/conditionals/index.js +196 -108
  40. package/dist/events/index.js +2652 -1340
  41. package/package.json +3 -2
@@ -1,24 +1,39 @@
1
+ import { z } from 'zod';
1
2
  /**
2
3
  * Actions recognized by the system
3
4
  */
4
5
  export declare const ActionType: {
6
+ readonly DELETE: "DELETE";
5
7
  readonly CREATE: "CREATE";
6
- readonly ASSIGN: "ASSIGN";
7
- readonly UNASSIGN: "UNASSIGN";
8
- readonly REGISTER: "REGISTER";
9
- readonly VALIDATE: "VALIDATE";
10
- readonly REQUEST_CORRECTION: "REQUEST_CORRECTION";
11
- readonly REJECT_CORRECTION: "REJECT_CORRECTION";
12
- readonly APPROVE_CORRECTION: "APPROVE_CORRECTION";
13
- readonly DETECT_DUPLICATE: "DETECT_DUPLICATE";
14
8
  readonly NOTIFY: "NOTIFY";
15
9
  readonly DECLARE: "DECLARE";
16
- readonly DELETE: "DELETE";
17
- readonly PRINT_CERTIFICATE: "PRINT_CERTIFICATE";
18
- readonly CUSTOM: "CUSTOM";
10
+ readonly VALIDATE: "VALIDATE";
11
+ readonly REGISTER: "REGISTER";
12
+ readonly DETECT_DUPLICATE: "DETECT_DUPLICATE";
19
13
  readonly REJECT: "REJECT";
20
14
  readonly MARKED_AS_DUPLICATE: "MARKED_AS_DUPLICATE";
21
- readonly ARCHIVED: "ARCHIVED";
15
+ readonly ARCHIVE: "ARCHIVE";
16
+ readonly PRINT_CERTIFICATE: "PRINT_CERTIFICATE";
17
+ readonly REQUEST_CORRECTION: "REQUEST_CORRECTION";
18
+ readonly REJECT_CORRECTION: "REJECT_CORRECTION";
19
+ readonly APPROVE_CORRECTION: "APPROVE_CORRECTION";
20
+ readonly READ: "READ";
21
+ readonly ASSIGN: "ASSIGN";
22
+ readonly UNASSIGN: "UNASSIGN";
22
23
  };
23
24
  export type ActionType = (typeof ActionType)[keyof typeof ActionType];
25
+ export declare const ConfirmableActions: readonly ["NOTIFY", "DECLARE", "VALIDATE", "REGISTER", "REJECT", "ARCHIVE", "PRINT_CERTIFICATE"];
26
+ /** Testing building types from enums as an alternative */
27
+ export declare const ActionTypes: z.ZodEnum<["DELETE", "CREATE", "NOTIFY", "DECLARE", "VALIDATE", "REGISTER", "DETECT_DUPLICATE", "REJECT", "MARKED_AS_DUPLICATE", "ARCHIVE", "PRINT_CERTIFICATE", "REQUEST_CORRECTION", "REJECT_CORRECTION", "APPROVE_CORRECTION", "READ", "ASSIGN", "UNASSIGN"]>;
28
+ /** Actions which change event data (declaration) before registration / during declaration. */
29
+ export declare const DeclarationActions: z.ZodEnum<["DECLARE", "VALIDATE", "REGISTER"]>;
30
+ export type DeclarationActionType = z.infer<typeof DeclarationActions>;
31
+ /** Actions that can modify declaration data. Request can be corrected after declaring it. */
32
+ export declare const DeclarationUpdateActions: z.ZodEnum<["DECLARE", "VALIDATE", "REGISTER", "REQUEST_CORRECTION"]>;
33
+ export type DeclarationUpdateActionType = z.infer<typeof DeclarationUpdateActions>;
34
+ /** Actions which update annotation or status of an event. */
35
+ export declare const annotationActions: z.ZodEnum<["DELETE", "CREATE", "NOTIFY", "DETECT_DUPLICATE", "REJECT", "MARKED_AS_DUPLICATE", "ARCHIVE", "PRINT_CERTIFICATE", "REQUEST_CORRECTION", "REJECT_CORRECTION", "APPROVE_CORRECTION", "READ", "ASSIGN", "UNASSIGN"]>;
36
+ export type AnnotationActionType = z.infer<typeof annotationActions>;
37
+ /** Actions which requires the user to be assigned */
38
+ export declare const writeActions: z.ZodEnum<["DELETE", "NOTIFY", "DECLARE", "VALIDATE", "REGISTER", "DETECT_DUPLICATE", "REJECT", "MARKED_AS_DUPLICATE", "ARCHIVE", "PRINT_CERTIFICATE", "REQUEST_CORRECTION", "REJECT_CORRECTION", "APPROVE_CORRECTION"]>;
24
39
  //# sourceMappingURL=ActionType.d.ts.map
@@ -1,51 +1,395 @@
1
1
  import { z } from 'zod';
2
2
  import { TranslationConfig } from './TranslationConfig';
3
+ export declare const FieldConfigSchema: z.ZodObject<z.objectUtil.extendShape<{
4
+ config: z.ZodObject<{
5
+ type: z.ZodEnum<["fuzzy", "exact", "range"]>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ type: "exact" | "fuzzy" | "range";
8
+ }, {
9
+ type: "exact" | "fuzzy" | "range";
10
+ }>;
11
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
12
+ value: z.ZodString;
13
+ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
14
+ id: string;
15
+ description: string;
16
+ defaultMessage: string;
17
+ }>;
18
+ }, "strip", z.ZodTypeAny, {
19
+ value: string;
20
+ label: TranslationConfig;
21
+ }, {
22
+ value: string;
23
+ label: {
24
+ id: string;
25
+ description: string;
26
+ defaultMessage: string;
27
+ };
28
+ }>, "many">>;
29
+ }, {
30
+ fieldId: z.ZodString;
31
+ fieldType: z.ZodLiteral<"field">;
32
+ }>, "strip", z.ZodTypeAny, {
33
+ config: {
34
+ type: "exact" | "fuzzy" | "range";
35
+ };
36
+ fieldId: string;
37
+ fieldType: "field";
38
+ options?: {
39
+ value: string;
40
+ label: TranslationConfig;
41
+ }[] | undefined;
42
+ }, {
43
+ config: {
44
+ type: "exact" | "fuzzy" | "range";
45
+ };
46
+ fieldId: string;
47
+ fieldType: "field";
48
+ options?: {
49
+ value: string;
50
+ label: {
51
+ id: string;
52
+ description: string;
53
+ defaultMessage: string;
54
+ };
55
+ }[] | undefined;
56
+ }>;
57
+ export declare const EventFieldId: z.ZodEnum<["trackingId", "status"]>;
58
+ export type EventFieldId = z.infer<typeof EventFieldId>;
59
+ export declare const EventFieldConfigSchema: z.ZodObject<z.objectUtil.extendShape<{
60
+ config: z.ZodObject<{
61
+ type: z.ZodEnum<["fuzzy", "exact", "range"]>;
62
+ }, "strip", z.ZodTypeAny, {
63
+ type: "exact" | "fuzzy" | "range";
64
+ }, {
65
+ type: "exact" | "fuzzy" | "range";
66
+ }>;
67
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
68
+ value: z.ZodString;
69
+ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
70
+ id: string;
71
+ description: string;
72
+ defaultMessage: string;
73
+ }>;
74
+ }, "strip", z.ZodTypeAny, {
75
+ value: string;
76
+ label: TranslationConfig;
77
+ }, {
78
+ value: string;
79
+ label: {
80
+ id: string;
81
+ description: string;
82
+ defaultMessage: string;
83
+ };
84
+ }>, "many">>;
85
+ }, {
86
+ fieldId: z.ZodEnum<["trackingId", "status"]>;
87
+ fieldType: z.ZodLiteral<"event">;
88
+ }>, "strip", z.ZodTypeAny, {
89
+ config: {
90
+ type: "exact" | "fuzzy" | "range";
91
+ };
92
+ fieldId: "status" | "trackingId";
93
+ fieldType: "event";
94
+ options?: {
95
+ value: string;
96
+ label: TranslationConfig;
97
+ }[] | undefined;
98
+ }, {
99
+ config: {
100
+ type: "exact" | "fuzzy" | "range";
101
+ };
102
+ fieldId: "status" | "trackingId";
103
+ fieldType: "event";
104
+ options?: {
105
+ value: string;
106
+ label: {
107
+ id: string;
108
+ description: string;
109
+ defaultMessage: string;
110
+ };
111
+ }[] | undefined;
112
+ }>;
113
+ export declare const SearchField: z.ZodDiscriminatedUnion<"fieldType", [z.ZodObject<z.objectUtil.extendShape<{
114
+ config: z.ZodObject<{
115
+ type: z.ZodEnum<["fuzzy", "exact", "range"]>;
116
+ }, "strip", z.ZodTypeAny, {
117
+ type: "exact" | "fuzzy" | "range";
118
+ }, {
119
+ type: "exact" | "fuzzy" | "range";
120
+ }>;
121
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
122
+ value: z.ZodString;
123
+ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
124
+ id: string;
125
+ description: string;
126
+ defaultMessage: string;
127
+ }>;
128
+ }, "strip", z.ZodTypeAny, {
129
+ value: string;
130
+ label: TranslationConfig;
131
+ }, {
132
+ value: string;
133
+ label: {
134
+ id: string;
135
+ description: string;
136
+ defaultMessage: string;
137
+ };
138
+ }>, "many">>;
139
+ }, {
140
+ fieldId: z.ZodString;
141
+ fieldType: z.ZodLiteral<"field">;
142
+ }>, "strip", z.ZodTypeAny, {
143
+ config: {
144
+ type: "exact" | "fuzzy" | "range";
145
+ };
146
+ fieldId: string;
147
+ fieldType: "field";
148
+ options?: {
149
+ value: string;
150
+ label: TranslationConfig;
151
+ }[] | undefined;
152
+ }, {
153
+ config: {
154
+ type: "exact" | "fuzzy" | "range";
155
+ };
156
+ fieldId: string;
157
+ fieldType: "field";
158
+ options?: {
159
+ value: string;
160
+ label: {
161
+ id: string;
162
+ description: string;
163
+ defaultMessage: string;
164
+ };
165
+ }[] | undefined;
166
+ }>, z.ZodObject<z.objectUtil.extendShape<{
167
+ config: z.ZodObject<{
168
+ type: z.ZodEnum<["fuzzy", "exact", "range"]>;
169
+ }, "strip", z.ZodTypeAny, {
170
+ type: "exact" | "fuzzy" | "range";
171
+ }, {
172
+ type: "exact" | "fuzzy" | "range";
173
+ }>;
174
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
175
+ value: z.ZodString;
176
+ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
177
+ id: string;
178
+ description: string;
179
+ defaultMessage: string;
180
+ }>;
181
+ }, "strip", z.ZodTypeAny, {
182
+ value: string;
183
+ label: TranslationConfig;
184
+ }, {
185
+ value: string;
186
+ label: {
187
+ id: string;
188
+ description: string;
189
+ defaultMessage: string;
190
+ };
191
+ }>, "many">>;
192
+ }, {
193
+ fieldId: z.ZodEnum<["trackingId", "status"]>;
194
+ fieldType: z.ZodLiteral<"event">;
195
+ }>, "strip", z.ZodTypeAny, {
196
+ config: {
197
+ type: "exact" | "fuzzy" | "range";
198
+ };
199
+ fieldId: "status" | "trackingId";
200
+ fieldType: "event";
201
+ options?: {
202
+ value: string;
203
+ label: TranslationConfig;
204
+ }[] | undefined;
205
+ }, {
206
+ config: {
207
+ type: "exact" | "fuzzy" | "range";
208
+ };
209
+ fieldId: "status" | "trackingId";
210
+ fieldType: "event";
211
+ options?: {
212
+ value: string;
213
+ label: {
214
+ id: string;
215
+ description: string;
216
+ defaultMessage: string;
217
+ };
218
+ }[] | undefined;
219
+ }>]>;
220
+ export type SearchField = z.infer<typeof SearchField>;
3
221
  export declare const AdvancedSearchConfig: z.ZodObject<{
4
222
  title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
5
223
  id: string;
6
224
  description: string;
7
225
  defaultMessage: string;
8
226
  }>;
9
- fields: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
10
- fieldId: z.ZodString;
11
- config: z.ZodOptional<z.ZodObject<{
12
- type: z.ZodEnum<["FUZZY", "EXACT", "RANGE"]>;
227
+ fields: z.ZodArray<z.ZodDiscriminatedUnion<"fieldType", [z.ZodObject<z.objectUtil.extendShape<{
228
+ config: z.ZodObject<{
229
+ type: z.ZodEnum<["fuzzy", "exact", "range"]>;
13
230
  }, "strip", z.ZodTypeAny, {
14
- type: "FUZZY" | "EXACT" | "RANGE";
231
+ type: "exact" | "fuzzy" | "range";
15
232
  }, {
16
- type: "FUZZY" | "EXACT" | "RANGE";
17
- }>>;
18
- }, "strip", z.ZodTypeAny, {
233
+ type: "exact" | "fuzzy" | "range";
234
+ }>;
235
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
236
+ value: z.ZodString;
237
+ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
238
+ id: string;
239
+ description: string;
240
+ defaultMessage: string;
241
+ }>;
242
+ }, "strip", z.ZodTypeAny, {
243
+ value: string;
244
+ label: TranslationConfig;
245
+ }, {
246
+ value: string;
247
+ label: {
248
+ id: string;
249
+ description: string;
250
+ defaultMessage: string;
251
+ };
252
+ }>, "many">>;
253
+ }, {
254
+ fieldId: z.ZodString;
255
+ fieldType: z.ZodLiteral<"field">;
256
+ }>, "strip", z.ZodTypeAny, {
257
+ config: {
258
+ type: "exact" | "fuzzy" | "range";
259
+ };
19
260
  fieldId: string;
20
- config?: {
21
- type: "FUZZY" | "EXACT" | "RANGE";
22
- } | undefined;
261
+ fieldType: "field";
262
+ options?: {
263
+ value: string;
264
+ label: TranslationConfig;
265
+ }[] | undefined;
23
266
  }, {
267
+ config: {
268
+ type: "exact" | "fuzzy" | "range";
269
+ };
24
270
  fieldId: string;
25
- config?: {
26
- type: "FUZZY" | "EXACT" | "RANGE";
27
- } | undefined;
28
- }>, "many">>>;
271
+ fieldType: "field";
272
+ options?: {
273
+ value: string;
274
+ label: {
275
+ id: string;
276
+ description: string;
277
+ defaultMessage: string;
278
+ };
279
+ }[] | undefined;
280
+ }>, z.ZodObject<z.objectUtil.extendShape<{
281
+ config: z.ZodObject<{
282
+ type: z.ZodEnum<["fuzzy", "exact", "range"]>;
283
+ }, "strip", z.ZodTypeAny, {
284
+ type: "exact" | "fuzzy" | "range";
285
+ }, {
286
+ type: "exact" | "fuzzy" | "range";
287
+ }>;
288
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
289
+ value: z.ZodString;
290
+ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
291
+ id: string;
292
+ description: string;
293
+ defaultMessage: string;
294
+ }>;
295
+ }, "strip", z.ZodTypeAny, {
296
+ value: string;
297
+ label: TranslationConfig;
298
+ }, {
299
+ value: string;
300
+ label: {
301
+ id: string;
302
+ description: string;
303
+ defaultMessage: string;
304
+ };
305
+ }>, "many">>;
306
+ }, {
307
+ fieldId: z.ZodEnum<["trackingId", "status"]>;
308
+ fieldType: z.ZodLiteral<"event">;
309
+ }>, "strip", z.ZodTypeAny, {
310
+ config: {
311
+ type: "exact" | "fuzzy" | "range";
312
+ };
313
+ fieldId: "status" | "trackingId";
314
+ fieldType: "event";
315
+ options?: {
316
+ value: string;
317
+ label: TranslationConfig;
318
+ }[] | undefined;
319
+ }, {
320
+ config: {
321
+ type: "exact" | "fuzzy" | "range";
322
+ };
323
+ fieldId: "status" | "trackingId";
324
+ fieldType: "event";
325
+ options?: {
326
+ value: string;
327
+ label: {
328
+ id: string;
329
+ description: string;
330
+ defaultMessage: string;
331
+ };
332
+ }[] | undefined;
333
+ }>]>, "many">;
29
334
  }, "strip", z.ZodTypeAny, {
30
335
  title: TranslationConfig;
31
- fields: {
336
+ fields: ({
337
+ config: {
338
+ type: "exact" | "fuzzy" | "range";
339
+ };
32
340
  fieldId: string;
33
- config?: {
34
- type: "FUZZY" | "EXACT" | "RANGE";
35
- } | undefined;
36
- }[];
341
+ fieldType: "field";
342
+ options?: {
343
+ value: string;
344
+ label: TranslationConfig;
345
+ }[] | undefined;
346
+ } | {
347
+ config: {
348
+ type: "exact" | "fuzzy" | "range";
349
+ };
350
+ fieldId: "status" | "trackingId";
351
+ fieldType: "event";
352
+ options?: {
353
+ value: string;
354
+ label: TranslationConfig;
355
+ }[] | undefined;
356
+ })[];
37
357
  }, {
38
358
  title: {
39
359
  id: string;
40
360
  description: string;
41
361
  defaultMessage: string;
42
362
  };
43
- fields?: {
363
+ fields: ({
364
+ config: {
365
+ type: "exact" | "fuzzy" | "range";
366
+ };
44
367
  fieldId: string;
45
- config?: {
46
- type: "FUZZY" | "EXACT" | "RANGE";
47
- } | undefined;
48
- }[] | undefined;
368
+ fieldType: "field";
369
+ options?: {
370
+ value: string;
371
+ label: {
372
+ id: string;
373
+ description: string;
374
+ defaultMessage: string;
375
+ };
376
+ }[] | undefined;
377
+ } | {
378
+ config: {
379
+ type: "exact" | "fuzzy" | "range";
380
+ };
381
+ fieldId: "status" | "trackingId";
382
+ fieldType: "event";
383
+ options?: {
384
+ value: string;
385
+ label: {
386
+ id: string;
387
+ description: string;
388
+ defaultMessage: string;
389
+ };
390
+ }[] | undefined;
391
+ })[];
49
392
  }>;
393
+ export type AdvancedSearchConfigInput = z.infer<typeof AdvancedSearchConfig>;
50
394
  export type AdvancedSearchConfig = z.infer<typeof AdvancedSearchConfig>;
51
395
  //# sourceMappingURL=AdvancedSearchConfig.d.ts.map