@opencrvs/toolkit 1.8.0-rc.fd16d13 → 1.8.0-rc.fd31705

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 (30) hide show
  1. package/README.md +1 -1
  2. package/dist/commons/api/router.d.ts +6304 -12729
  3. package/dist/commons/conditionals/conditionals.d.ts +26 -3
  4. package/dist/commons/conditionals/validate.d.ts +12 -11
  5. package/dist/commons/events/ActionConfig.d.ts +1123 -2056
  6. package/dist/commons/events/ActionDocument.d.ts +8065 -452
  7. package/dist/commons/events/ActionInput.d.ts +3021 -594
  8. package/dist/commons/events/ActionType.d.ts +24 -11
  9. package/dist/commons/events/CompositeFieldValue.d.ts +52 -12
  10. package/dist/commons/events/Conditional.d.ts +21 -5
  11. package/dist/commons/events/Draft.d.ts +145 -61
  12. package/dist/commons/events/EventConfig.d.ts +551 -1206
  13. package/dist/commons/events/EventConfigInput.d.ts +6 -3
  14. package/dist/commons/events/EventDocument.d.ts +1565 -544
  15. package/dist/commons/events/EventIndex.d.ts +6 -3
  16. package/dist/commons/events/EventMetadata.d.ts +3 -0
  17. package/dist/commons/events/FieldConfig.d.ts +483 -76
  18. package/dist/commons/events/FieldType.d.ts +2 -1
  19. package/dist/commons/events/FieldTypeMapping.d.ts +57 -8
  20. package/dist/commons/events/FieldValue.d.ts +30 -10
  21. package/dist/commons/events/FormConfig.d.ts +633 -48
  22. package/dist/commons/events/PageConfig.d.ts +335 -0
  23. package/dist/commons/events/TemplateConfig.d.ts +2 -2
  24. package/dist/commons/events/defineConfig.d.ts +91 -216
  25. package/dist/commons/events/index.d.ts +2 -1
  26. package/dist/commons/events/test.utils.d.ts +87 -268
  27. package/dist/commons/events/utils.d.ts +90 -83
  28. package/dist/conditionals/index.js +166 -81
  29. package/dist/events/index.js +1188 -743
  30. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import { ActionDocument } from './ActionDocument';
2
- import { ArchiveActionInput, DeclareActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, ValidateActionInput } from './ActionInput';
1
+ import { ActionDocument, ActionUpdate } from './ActionDocument';
2
+ import { ArchiveActionInput, AssignActionInput, DeclareActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnassignActionInput, ValidateActionInput } from './ActionInput';
3
3
  import { ActionType } from './ActionType';
4
4
  import { Draft } from './Draft';
5
5
  import { EventConfig } from './EventConfig';
@@ -7,6 +7,7 @@ import { EventDocument } from './EventDocument';
7
7
  import { EventIndex } from './EventIndex';
8
8
  import { EventInput } from './EventInput';
9
9
  import { FieldValue } from './FieldValue';
10
+ import { TranslationConfig } from './TranslationConfig';
10
11
  export declare function generateActionInput(configuration: EventConfig, action: ActionType): import("lodash").Dictionary<string | number | boolean | {
11
12
  type: string;
12
13
  filename: string;
@@ -14,6 +15,7 @@ export declare function generateActionInput(configuration: EventConfig, action:
14
15
  } | {
15
16
  country: string;
16
17
  district: string;
18
+ addressType: "DOMESTIC";
17
19
  province: string;
18
20
  urbanOrRural: "URBAN";
19
21
  number?: string | undefined;
@@ -24,12 +26,14 @@ export declare function generateActionInput(configuration: EventConfig, action:
24
26
  } | {
25
27
  country: string;
26
28
  district: string;
29
+ addressType: "DOMESTIC";
27
30
  province: string;
28
31
  urbanOrRural: "RURAL";
29
32
  village?: string | undefined;
30
33
  } | {
31
34
  country: string;
32
35
  state: string;
36
+ addressType: "INTERNATIONAL";
33
37
  district2: string;
34
38
  cityOrTown?: string | undefined;
35
39
  addressLine1?: string | undefined;
@@ -41,7 +45,8 @@ export declare function generateActionInput(configuration: EventConfig, action:
41
45
  option: string;
42
46
  filename: string;
43
47
  originalFilename: string;
44
- }[]>;
48
+ }[] | undefined>;
49
+ export declare function generateActionMetadataInput(configuration: EventConfig, action: ActionType): {};
45
50
  export declare const eventPayloadGenerator: {
46
51
  create: (input?: Partial<EventInput>) => {
47
52
  transactionId: string;
@@ -52,79 +57,22 @@ export declare const eventPayloadGenerator: {
52
57
  type: string;
53
58
  id: string;
54
59
  };
55
- draft: (eventId: string, input?: Partial<Draft>) => {
56
- id: import("../uuid").UUID;
60
+ draft: ({ eventId, actionType }: {
57
61
  eventId: string;
58
- createdAt: string;
59
- transactionId: import("../uuid").UUID;
60
- action: {
61
- type: "REQUEST_CORRECTION";
62
- data: {
63
- 'applicant.firstname': string;
64
- 'applicant.surname': string;
65
- 'applicant.dob': string;
66
- 'recommender.none': boolean;
67
- };
68
- metadata: {
69
- 'correction.requester.relationship': string;
70
- 'correction.request.reason': string;
71
- };
72
- createdAt: string;
73
- createdBy: string;
74
- createdAtLocation: string;
75
- };
76
- } & Partial<{
77
- id: string;
78
- createdAt: string;
79
- eventId: string;
80
- transactionId: string;
81
- action: {
82
- type: ActionType;
83
- data: Record<string, string | number | boolean | {
84
- type: string;
85
- filename: string;
86
- originalFilename: string;
87
- } | {
88
- country: string;
89
- district: string;
90
- province: string;
91
- urbanOrRural: "URBAN";
92
- number?: string | null | undefined;
93
- town?: string | null | undefined;
94
- residentialArea?: string | null | undefined;
95
- street?: string | null | undefined;
96
- zipCode?: string | null | undefined;
97
- } | {
98
- country: string;
99
- district: string;
100
- province: string;
101
- urbanOrRural: "RURAL";
102
- village?: string | null | undefined;
103
- } | {
104
- country: string;
105
- state: string;
106
- district2: string;
107
- cityOrTown?: string | null | undefined;
108
- addressLine1?: string | null | undefined;
109
- addressLine2?: string | null | undefined;
110
- addressLine3?: string | null | undefined;
111
- postcodeOrZip?: string | null | undefined;
112
- } | {
113
- type: string;
114
- option: string;
115
- filename: string;
116
- originalFilename: string;
117
- }[]>;
118
- createdAt: string;
119
- createdBy: string;
120
- createdAtLocation: string;
121
- metadata?: Record<string, string | number | boolean | {
62
+ actionType: ActionType;
63
+ }, input?: Partial<Draft>) => Draft;
64
+ actions: {
65
+ declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation">>) => {
66
+ type: "DECLARE";
67
+ transactionId: string;
68
+ declaration: Record<string, string | number | boolean | {
122
69
  type: string;
123
70
  filename: string;
124
71
  originalFilename: string;
125
72
  } | {
126
73
  country: string;
127
74
  district: string;
75
+ addressType: "DOMESTIC";
128
76
  province: string;
129
77
  urbanOrRural: "URBAN";
130
78
  number?: string | null | undefined;
@@ -135,12 +83,14 @@ export declare const eventPayloadGenerator: {
135
83
  } | {
136
84
  country: string;
137
85
  district: string;
86
+ addressType: "DOMESTIC";
138
87
  province: string;
139
88
  urbanOrRural: "RURAL";
140
89
  village?: string | null | undefined;
141
90
  } | {
142
91
  country: string;
143
92
  state: string;
93
+ addressType: "INTERNATIONAL";
144
94
  district2: string;
145
95
  cityOrTown?: string | null | undefined;
146
96
  addressLine1?: string | null | undefined;
@@ -152,20 +102,27 @@ export declare const eventPayloadGenerator: {
152
102
  option: string;
153
103
  filename: string;
154
104
  originalFilename: string;
155
- }[]> | undefined;
105
+ }[] | undefined>;
106
+ annotation: {};
107
+ eventId: string;
156
108
  };
157
- }>;
158
- actions: {
159
- declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "data">>) => {
160
- type: "DECLARE";
109
+ /**
110
+ * Notify allows sending incomplete data. Think it as 'partial declare' for now.
111
+ */
112
+ notify: (eventId: string, input?: {
113
+ transactionId?: string;
114
+ declaration?: Partial<ActionUpdate>;
115
+ }) => {
116
+ type: "NOTIFY";
161
117
  transactionId: string;
162
- data: Record<string, string | number | boolean | {
118
+ declaration: Partial<Record<string, string | number | boolean | {
163
119
  type: string;
164
120
  filename: string;
165
121
  originalFilename: string;
166
122
  } | {
167
123
  country: string;
168
124
  district: string;
125
+ addressType: "DOMESTIC";
169
126
  province: string;
170
127
  urbanOrRural: "URBAN";
171
128
  number?: string | null | undefined;
@@ -176,12 +133,14 @@ export declare const eventPayloadGenerator: {
176
133
  } | {
177
134
  country: string;
178
135
  district: string;
136
+ addressType: "DOMESTIC";
179
137
  province: string;
180
138
  urbanOrRural: "RURAL";
181
139
  village?: string | null | undefined;
182
140
  } | {
183
141
  country: string;
184
142
  state: string;
143
+ addressType: "INTERNATIONAL";
185
144
  district2: string;
186
145
  cityOrTown?: string | null | undefined;
187
146
  addressLine1?: string | null | undefined;
@@ -193,19 +152,20 @@ export declare const eventPayloadGenerator: {
193
152
  option: string;
194
153
  filename: string;
195
154
  originalFilename: string;
196
- }[]>;
155
+ }[] | undefined>>;
197
156
  eventId: string;
198
157
  };
199
- validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "data">>) => {
158
+ validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "declaration" | "annotation">>) => {
200
159
  type: "VALIDATE";
201
160
  transactionId: string;
202
- data: Record<string, string | number | boolean | {
161
+ declaration: Record<string, string | number | boolean | {
203
162
  type: string;
204
163
  filename: string;
205
164
  originalFilename: string;
206
165
  } | {
207
166
  country: string;
208
167
  district: string;
168
+ addressType: "DOMESTIC";
209
169
  province: string;
210
170
  urbanOrRural: "URBAN";
211
171
  number?: string | null | undefined;
@@ -216,12 +176,14 @@ export declare const eventPayloadGenerator: {
216
176
  } | {
217
177
  country: string;
218
178
  district: string;
179
+ addressType: "DOMESTIC";
219
180
  province: string;
220
181
  urbanOrRural: "RURAL";
221
182
  village?: string | null | undefined;
222
183
  } | {
223
184
  country: string;
224
185
  state: string;
186
+ addressType: "INTERNATIONAL";
225
187
  district2: string;
226
188
  cityOrTown?: string | null | undefined;
227
189
  addressLine1?: string | null | undefined;
@@ -233,105 +195,54 @@ export declare const eventPayloadGenerator: {
233
195
  option: string;
234
196
  filename: string;
235
197
  originalFilename: string;
236
- }[]>;
198
+ }[] | undefined>;
199
+ annotation: {};
237
200
  duplicates: never[];
238
201
  eventId: string;
239
202
  };
240
- archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "data">>, isDuplicate?: boolean) => {
203
+ assign: (eventId: string, input?: Partial<Pick<AssignActionInput, "transactionId" | "assignedTo">>) => {
204
+ type: "ASSIGN";
205
+ transactionId: string;
206
+ declaration: {};
207
+ assignedTo: string;
208
+ eventId: string;
209
+ };
210
+ unassign: (eventId: string, input?: Partial<Pick<UnassignActionInput, "transactionId">>) => {
211
+ type: "UNASSIGN";
212
+ transactionId: string;
213
+ declaration: {};
214
+ assignedTo: null;
215
+ eventId: string;
216
+ };
217
+ archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration">>, isDuplicate?: boolean) => {
241
218
  type: "ARCHIVE";
242
219
  transactionId: string;
243
- data: Record<string, string | number | boolean | {
244
- type: string;
245
- filename: string;
246
- originalFilename: string;
247
- } | {
248
- country: string;
249
- district: string;
250
- province: string;
251
- urbanOrRural: "URBAN";
252
- number?: string | null | undefined;
253
- town?: string | null | undefined;
254
- residentialArea?: string | null | undefined;
255
- street?: string | null | undefined;
256
- zipCode?: string | null | undefined;
257
- } | {
258
- country: string;
259
- district: string;
260
- province: string;
261
- urbanOrRural: "RURAL";
262
- village?: string | null | undefined;
263
- } | {
264
- country: string;
265
- state: string;
266
- district2: string;
267
- cityOrTown?: string | null | undefined;
268
- addressLine1?: string | null | undefined;
269
- addressLine2?: string | null | undefined;
270
- addressLine3?: string | null | undefined;
271
- postcodeOrZip?: string | null | undefined;
272
- } | {
273
- type: string;
274
- option: string;
275
- filename: string;
276
- originalFilename: string;
277
- }[]>;
278
- metadata: {
220
+ declaration: {};
221
+ annotation: {
279
222
  isDuplicate: boolean;
280
223
  };
281
224
  duplicates: never[];
282
225
  eventId: string;
283
226
  };
284
- reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "data">>) => {
227
+ reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation">>) => {
285
228
  type: "REJECT";
286
229
  transactionId: string;
287
- data: Record<string, string | number | boolean | {
288
- type: string;
289
- filename: string;
290
- originalFilename: string;
291
- } | {
292
- country: string;
293
- district: string;
294
- province: string;
295
- urbanOrRural: "URBAN";
296
- number?: string | null | undefined;
297
- town?: string | null | undefined;
298
- residentialArea?: string | null | undefined;
299
- street?: string | null | undefined;
300
- zipCode?: string | null | undefined;
301
- } | {
302
- country: string;
303
- district: string;
304
- province: string;
305
- urbanOrRural: "RURAL";
306
- village?: string | null | undefined;
307
- } | {
308
- country: string;
309
- state: string;
310
- district2: string;
311
- cityOrTown?: string | null | undefined;
312
- addressLine1?: string | null | undefined;
313
- addressLine2?: string | null | undefined;
314
- addressLine3?: string | null | undefined;
315
- postcodeOrZip?: string | null | undefined;
316
- } | {
317
- type: string;
318
- option: string;
319
- filename: string;
320
- originalFilename: string;
321
- }[]>;
230
+ declaration: {};
231
+ annotation: {};
322
232
  duplicates: never[];
323
233
  eventId: string;
324
234
  };
325
- register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "data">>) => {
235
+ register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation">>) => {
326
236
  type: "REGISTER";
327
237
  transactionId: string;
328
- data: Record<string, string | number | boolean | {
238
+ declaration: Record<string, string | number | boolean | {
329
239
  type: string;
330
240
  filename: string;
331
241
  originalFilename: string;
332
242
  } | {
333
243
  country: string;
334
244
  district: string;
245
+ addressType: "DOMESTIC";
335
246
  province: string;
336
247
  urbanOrRural: "URBAN";
337
248
  number?: string | null | undefined;
@@ -342,12 +253,14 @@ export declare const eventPayloadGenerator: {
342
253
  } | {
343
254
  country: string;
344
255
  district: string;
256
+ addressType: "DOMESTIC";
345
257
  province: string;
346
258
  urbanOrRural: "RURAL";
347
259
  village?: string | null | undefined;
348
260
  } | {
349
261
  country: string;
350
262
  state: string;
263
+ addressType: "INTERNATIONAL";
351
264
  district2: string;
352
265
  cityOrTown?: string | null | undefined;
353
266
  addressLine1?: string | null | undefined;
@@ -359,60 +272,29 @@ export declare const eventPayloadGenerator: {
359
272
  option: string;
360
273
  filename: string;
361
274
  originalFilename: string;
362
- }[]>;
275
+ }[] | undefined>;
276
+ annotation: {};
363
277
  eventId: string;
364
278
  };
365
- printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "data">>) => {
279
+ printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation">>) => {
366
280
  type: "PRINT_CERTIFICATE";
367
281
  transactionId: string;
368
- data: Record<string, string | number | boolean | {
369
- type: string;
370
- filename: string;
371
- originalFilename: string;
372
- } | {
373
- country: string;
374
- district: string;
375
- province: string;
376
- urbanOrRural: "URBAN";
377
- number?: string | null | undefined;
378
- town?: string | null | undefined;
379
- residentialArea?: string | null | undefined;
380
- street?: string | null | undefined;
381
- zipCode?: string | null | undefined;
382
- } | {
383
- country: string;
384
- district: string;
385
- province: string;
386
- urbanOrRural: "RURAL";
387
- village?: string | null | undefined;
388
- } | {
389
- country: string;
390
- state: string;
391
- district2: string;
392
- cityOrTown?: string | null | undefined;
393
- addressLine1?: string | null | undefined;
394
- addressLine2?: string | null | undefined;
395
- addressLine3?: string | null | undefined;
396
- postcodeOrZip?: string | null | undefined;
397
- } | {
398
- type: string;
399
- option: string;
400
- filename: string;
401
- originalFilename: string;
402
- }[]>;
282
+ declaration: {};
283
+ annotation: {};
403
284
  eventId: string;
404
285
  };
405
286
  correction: {
406
- request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => {
287
+ request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation">>) => {
407
288
  type: "REQUEST_CORRECTION";
408
289
  transactionId: string;
409
- data: Record<string, string | number | boolean | {
290
+ declaration: Record<string, string | number | boolean | {
410
291
  type: string;
411
292
  filename: string;
412
293
  originalFilename: string;
413
294
  } | {
414
295
  country: string;
415
296
  district: string;
297
+ addressType: "DOMESTIC";
416
298
  province: string;
417
299
  urbanOrRural: "URBAN";
418
300
  number?: string | null | undefined;
@@ -423,12 +305,14 @@ export declare const eventPayloadGenerator: {
423
305
  } | {
424
306
  country: string;
425
307
  district: string;
308
+ addressType: "DOMESTIC";
426
309
  province: string;
427
310
  urbanOrRural: "RURAL";
428
311
  village?: string | null | undefined;
429
312
  } | {
430
313
  country: string;
431
314
  state: string;
315
+ addressType: "INTERNATIONAL";
432
316
  district2: string;
433
317
  cityOrTown?: string | null | undefined;
434
318
  addressLine1?: string | null | undefined;
@@ -440,89 +324,23 @@ export declare const eventPayloadGenerator: {
440
324
  option: string;
441
325
  filename: string;
442
326
  originalFilename: string;
443
- }[]>;
444
- metadata: {};
327
+ }[] | undefined>;
328
+ annotation: {};
445
329
  eventId: string;
446
330
  };
447
- approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => {
331
+ approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
448
332
  type: "APPROVE_CORRECTION";
449
333
  transactionId: string;
450
- data: Record<string, string | number | boolean | {
451
- type: string;
452
- filename: string;
453
- originalFilename: string;
454
- } | {
455
- country: string;
456
- district: string;
457
- province: string;
458
- urbanOrRural: "URBAN";
459
- number?: string | null | undefined;
460
- town?: string | null | undefined;
461
- residentialArea?: string | null | undefined;
462
- street?: string | null | undefined;
463
- zipCode?: string | null | undefined;
464
- } | {
465
- country: string;
466
- district: string;
467
- province: string;
468
- urbanOrRural: "RURAL";
469
- village?: string | null | undefined;
470
- } | {
471
- country: string;
472
- state: string;
473
- district2: string;
474
- cityOrTown?: string | null | undefined;
475
- addressLine1?: string | null | undefined;
476
- addressLine2?: string | null | undefined;
477
- addressLine3?: string | null | undefined;
478
- postcodeOrZip?: string | null | undefined;
479
- } | {
480
- type: string;
481
- option: string;
482
- filename: string;
483
- originalFilename: string;
484
- }[]>;
334
+ declaration: {};
335
+ annotation: {};
485
336
  eventId: string;
486
337
  requestId: string;
487
338
  };
488
- reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => {
339
+ reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
489
340
  type: "REJECT_CORRECTION";
490
341
  transactionId: string;
491
- data: Record<string, string | number | boolean | {
492
- type: string;
493
- filename: string;
494
- originalFilename: string;
495
- } | {
496
- country: string;
497
- district: string;
498
- province: string;
499
- urbanOrRural: "URBAN";
500
- number?: string | null | undefined;
501
- town?: string | null | undefined;
502
- residentialArea?: string | null | undefined;
503
- street?: string | null | undefined;
504
- zipCode?: string | null | undefined;
505
- } | {
506
- country: string;
507
- district: string;
508
- province: string;
509
- urbanOrRural: "RURAL";
510
- village?: string | null | undefined;
511
- } | {
512
- country: string;
513
- state: string;
514
- district2: string;
515
- cityOrTown?: string | null | undefined;
516
- addressLine1?: string | null | undefined;
517
- addressLine2?: string | null | undefined;
518
- addressLine3?: string | null | undefined;
519
- postcodeOrZip?: string | null | undefined;
520
- } | {
521
- type: string;
522
- option: string;
523
- filename: string;
524
- originalFilename: string;
525
- }[]>;
342
+ declaration: {};
343
+ annotation: {};
526
344
  eventId: string;
527
345
  requestId: string;
528
346
  };
@@ -538,6 +356,7 @@ export declare function generateEventDocument({ configuration, actions }: {
538
356
  configuration: EventConfig;
539
357
  actions: ActionType[];
540
358
  }): EventDocument;
541
- export declare function generateEventDraftDocument(eventId: string, actionType?: ActionType, data?: Record<string, FieldValue>): Draft;
359
+ export declare function generateEventDraftDocument(eventId: string, actionType?: ActionType, declaration?: Record<string, FieldValue>): Draft;
542
360
  export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>) => EventIndex;
361
+ export declare const generateTranslationConfig: (message: string) => TranslationConfig;
543
362
  //# sourceMappingURL=test.utils.d.ts.map