@opencrvs/toolkit 1.8.0-rc.fb261c5 → 1.8.0-rc.fb4793a

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 +12851 -14359
  3. package/dist/commons/conditionals/conditionals.d.ts +30 -5
  4. package/dist/commons/conditionals/validate.d.ts +12 -17
  5. package/dist/commons/events/ActionConfig.d.ts +95950 -5791
  6. package/dist/commons/events/ActionDocument.d.ts +7747 -316
  7. package/dist/commons/events/ActionInput.d.ts +2241 -496
  8. package/dist/commons/events/ActionType.d.ts +26 -16
  9. package/dist/commons/events/AdvancedSearchConfig.d.ts +957 -22
  10. package/dist/commons/events/CompositeFieldValue.d.ts +3 -0
  11. package/dist/commons/events/Conditional.d.ts +21 -5
  12. package/dist/commons/events/Draft.d.ts +79 -51
  13. package/dist/commons/events/EventConfig.d.ts +45793 -3039
  14. package/dist/commons/events/EventConfigInput.d.ts +5 -2
  15. package/dist/commons/events/EventDocument.d.ts +1001 -424
  16. package/dist/commons/events/EventIndex.d.ts +1735 -10
  17. package/dist/commons/events/EventInput.d.ts +13 -0
  18. package/dist/commons/events/EventMetadata.d.ts +274 -8
  19. package/dist/commons/events/FieldConfig.d.ts +4514 -788
  20. package/dist/commons/events/FieldType.d.ts +3 -3
  21. package/dist/commons/events/FieldTypeMapping.d.ts +11 -4
  22. package/dist/commons/events/FieldValue.d.ts +7 -4
  23. package/dist/commons/events/FormConfig.d.ts +43735 -336
  24. package/dist/commons/events/PageConfig.d.ts +10991 -0
  25. package/dist/commons/events/SummaryConfig.d.ts +95 -39
  26. package/dist/commons/events/TemplateConfig.d.ts +5 -5
  27. package/dist/commons/events/User.d.ts +5 -0
  28. package/dist/commons/events/WorkqueueConfig.d.ts +1549 -19
  29. package/dist/commons/events/defineConfig.d.ts +7293 -487
  30. package/dist/commons/events/event.d.ts +54 -0
  31. package/dist/commons/events/field.d.ts +82 -0
  32. package/dist/commons/events/index.d.ts +5 -1
  33. package/dist/commons/events/scopes.d.ts +45 -0
  34. package/dist/commons/events/test.utils.d.ts +67 -326
  35. package/dist/commons/events/utils.d.ts +3689 -158
  36. package/dist/commons/events/utils.test.d.ts +2 -0
  37. package/dist/conditionals/index.js +191 -120
  38. package/dist/events/index.js +2683 -1362
  39. package/dist/scopes/index.d.ts +158 -1
  40. package/dist/scopes/index.js +152 -1
  41. package/package.json +3 -2
@@ -1,52 +1,14 @@
1
- import { ActionDocument } from './ActionDocument';
2
- import { ArchiveActionInput, DeclareActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, ValidateActionInput } from './ActionInput';
1
+ import { ActionDocument, ActionUpdate, EventState } 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';
6
6
  import { EventDocument } from './EventDocument';
7
7
  import { EventIndex } from './EventIndex';
8
8
  import { EventInput } from './EventInput';
9
- import { FieldValue } from './FieldValue';
10
9
  import { TranslationConfig } from './TranslationConfig';
11
- export declare function generateActionInput(configuration: EventConfig, action: ActionType): import("lodash").Dictionary<string | number | boolean | {
12
- type: string;
13
- filename: string;
14
- originalFilename: string;
15
- } | {
16
- country: string;
17
- district: string;
18
- addressType: "DOMESTIC";
19
- province: string;
20
- urbanOrRural: "URBAN";
21
- number?: string | undefined;
22
- town?: string | undefined;
23
- residentialArea?: string | undefined;
24
- street?: string | undefined;
25
- zipCode?: string | undefined;
26
- } | {
27
- country: string;
28
- district: string;
29
- addressType: "DOMESTIC";
30
- province: string;
31
- urbanOrRural: "RURAL";
32
- village?: string | undefined;
33
- } | {
34
- country: string;
35
- state: string;
36
- addressType: "INTERNATIONAL";
37
- district2: string;
38
- cityOrTown?: string | undefined;
39
- addressLine1?: string | undefined;
40
- addressLine2?: string | undefined;
41
- addressLine3?: string | undefined;
42
- postcodeOrZip?: string | undefined;
43
- } | {
44
- type: string;
45
- option: string;
46
- filename: string;
47
- originalFilename: string;
48
- }[] | undefined>;
49
- export declare function generateActionMetadataInput(configuration: EventConfig, action: ActionType): {};
10
+ export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType): EventState;
11
+ export declare function generateActionAnnotationInput(configuration: EventConfig, action: ActionType): {};
50
12
  export declare const eventPayloadGenerator: {
51
13
  create: (input?: Partial<EventInput>) => {
52
14
  transactionId: string;
@@ -57,76 +19,15 @@ export declare const eventPayloadGenerator: {
57
19
  type: string;
58
20
  id: string;
59
21
  };
60
- draft: (eventId: string, input?: Partial<Draft>) => {
61
- id: import("../uuid").UUID;
22
+ draft: ({ eventId, actionType }: {
62
23
  eventId: string;
63
- createdAt: string;
64
- transactionId: import("../uuid").UUID;
65
- action: {
66
- type: "REQUEST_CORRECTION";
67
- data: {
68
- 'applicant.firstname': string;
69
- 'applicant.surname': string;
70
- 'applicant.dob': string;
71
- 'recommender.none': boolean;
72
- };
73
- metadata: {
74
- 'correction.requester.relationship': string;
75
- 'correction.request.reason': string;
76
- };
77
- createdAt: string;
78
- createdBy: string;
79
- createdAtLocation: string;
80
- };
81
- } & Partial<{
82
- id: string;
83
- createdAt: string;
84
- eventId: string;
85
- transactionId: string;
86
- action: {
87
- type: ActionType;
88
- data: Record<string, string | number | boolean | {
89
- type: string;
90
- filename: string;
91
- originalFilename: string;
92
- } | {
93
- country: string;
94
- district: string;
95
- addressType: "DOMESTIC";
96
- province: string;
97
- urbanOrRural: "URBAN";
98
- number?: string | null | undefined;
99
- town?: string | null | undefined;
100
- residentialArea?: string | null | undefined;
101
- street?: string | null | undefined;
102
- zipCode?: string | null | undefined;
103
- } | {
104
- country: string;
105
- district: string;
106
- addressType: "DOMESTIC";
107
- province: string;
108
- urbanOrRural: "RURAL";
109
- village?: string | null | undefined;
110
- } | {
111
- country: string;
112
- state: string;
113
- addressType: "INTERNATIONAL";
114
- district2: string;
115
- cityOrTown?: string | null | undefined;
116
- addressLine1?: string | null | undefined;
117
- addressLine2?: string | null | undefined;
118
- addressLine3?: string | null | undefined;
119
- postcodeOrZip?: string | null | undefined;
120
- } | {
121
- type: string;
122
- option: string;
123
- filename: string;
124
- originalFilename: string;
125
- }[] | undefined>;
126
- createdAt: string;
127
- createdBy: string;
128
- createdAtLocation: string;
129
- metadata?: Record<string, string | number | boolean | {
24
+ actionType: ActionType;
25
+ }, input?: Partial<Draft>) => Draft;
26
+ actions: {
27
+ declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation">>) => {
28
+ type: "DECLARE";
29
+ transactionId: string;
30
+ declaration: Record<string, string | number | boolean | {
130
31
  type: string;
131
32
  filename: string;
132
33
  originalFilename: string;
@@ -163,14 +64,20 @@ export declare const eventPayloadGenerator: {
163
64
  option: string;
164
65
  filename: string;
165
66
  originalFilename: string;
166
- }[] | undefined> | undefined;
67
+ }[] | [string, string] | undefined>;
68
+ annotation: {};
69
+ eventId: string;
167
70
  };
168
- }>;
169
- actions: {
170
- declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "data">>) => {
171
- type: "DECLARE";
71
+ /**
72
+ * Notify allows sending incomplete data. Think it as 'partial declare' for now.
73
+ */
74
+ notify: (eventId: string, input?: {
75
+ transactionId?: string;
76
+ declaration?: Partial<ActionUpdate>;
77
+ }) => {
78
+ type: "NOTIFY";
172
79
  transactionId: string;
173
- data: Record<string, string | number | boolean | {
80
+ declaration: Partial<Record<string, string | number | boolean | {
174
81
  type: string;
175
82
  filename: string;
176
83
  originalFilename: string;
@@ -207,13 +114,13 @@ export declare const eventPayloadGenerator: {
207
114
  option: string;
208
115
  filename: string;
209
116
  originalFilename: string;
210
- }[] | undefined>;
117
+ }[] | [string, string] | undefined>>;
211
118
  eventId: string;
212
119
  };
213
- validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "data">>) => {
120
+ validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "declaration" | "annotation">>) => {
214
121
  type: "VALIDATE";
215
122
  transactionId: string;
216
- data: Record<string, string | number | boolean | {
123
+ declaration: Record<string, string | number | boolean | {
217
124
  type: string;
218
125
  filename: string;
219
126
  originalFilename: string;
@@ -250,105 +157,47 @@ export declare const eventPayloadGenerator: {
250
157
  option: string;
251
158
  filename: string;
252
159
  originalFilename: string;
253
- }[] | undefined>;
160
+ }[] | [string, string] | undefined>;
161
+ annotation: {};
254
162
  duplicates: never[];
255
163
  eventId: string;
256
164
  };
257
- archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "data">>, isDuplicate?: boolean) => {
165
+ assign: (eventId: string, input?: Partial<Pick<AssignActionInput, "transactionId" | "assignedTo">>) => {
166
+ type: "ASSIGN";
167
+ transactionId: string;
168
+ declaration: {};
169
+ assignedTo: string;
170
+ eventId: string;
171
+ };
172
+ unassign: (eventId: string, input?: Partial<Pick<UnassignActionInput, "transactionId">>) => {
173
+ type: "UNASSIGN";
174
+ transactionId: string;
175
+ declaration: {};
176
+ assignedTo: null;
177
+ eventId: string;
178
+ };
179
+ archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration">>, isDuplicate?: boolean) => {
258
180
  type: "ARCHIVE";
259
181
  transactionId: string;
260
- data: Record<string, string | number | boolean | {
261
- type: string;
262
- filename: string;
263
- originalFilename: string;
264
- } | {
265
- country: string;
266
- district: string;
267
- addressType: "DOMESTIC";
268
- province: string;
269
- urbanOrRural: "URBAN";
270
- number?: string | null | undefined;
271
- town?: string | null | undefined;
272
- residentialArea?: string | null | undefined;
273
- street?: string | null | undefined;
274
- zipCode?: string | null | undefined;
275
- } | {
276
- country: string;
277
- district: string;
278
- addressType: "DOMESTIC";
279
- province: string;
280
- urbanOrRural: "RURAL";
281
- village?: string | null | undefined;
282
- } | {
283
- country: string;
284
- state: string;
285
- addressType: "INTERNATIONAL";
286
- district2: string;
287
- cityOrTown?: string | null | undefined;
288
- addressLine1?: string | null | undefined;
289
- addressLine2?: string | null | undefined;
290
- addressLine3?: string | null | undefined;
291
- postcodeOrZip?: string | null | undefined;
292
- } | {
293
- type: string;
294
- option: string;
295
- filename: string;
296
- originalFilename: string;
297
- }[] | undefined>;
298
- metadata: {
182
+ declaration: {};
183
+ annotation: {
299
184
  isDuplicate: boolean;
300
185
  };
301
186
  duplicates: never[];
302
187
  eventId: string;
303
188
  };
304
- reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "data">>) => {
189
+ reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation">>) => {
305
190
  type: "REJECT";
306
191
  transactionId: string;
307
- data: Record<string, string | number | boolean | {
308
- type: string;
309
- filename: string;
310
- originalFilename: string;
311
- } | {
312
- country: string;
313
- district: string;
314
- addressType: "DOMESTIC";
315
- province: string;
316
- urbanOrRural: "URBAN";
317
- number?: string | null | undefined;
318
- town?: string | null | undefined;
319
- residentialArea?: string | null | undefined;
320
- street?: string | null | undefined;
321
- zipCode?: string | null | undefined;
322
- } | {
323
- country: string;
324
- district: string;
325
- addressType: "DOMESTIC";
326
- province: string;
327
- urbanOrRural: "RURAL";
328
- village?: string | null | undefined;
329
- } | {
330
- country: string;
331
- state: string;
332
- addressType: "INTERNATIONAL";
333
- district2: string;
334
- cityOrTown?: string | null | undefined;
335
- addressLine1?: string | null | undefined;
336
- addressLine2?: string | null | undefined;
337
- addressLine3?: string | null | undefined;
338
- postcodeOrZip?: string | null | undefined;
339
- } | {
340
- type: string;
341
- option: string;
342
- filename: string;
343
- originalFilename: string;
344
- }[] | undefined>;
192
+ declaration: {};
193
+ annotation: {};
345
194
  duplicates: never[];
346
195
  eventId: string;
347
196
  };
348
- register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "data">>) => {
197
+ register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation">>) => {
349
198
  type: "REGISTER";
350
199
  transactionId: string;
351
- data: Record<string, string | number | boolean | {
200
+ declaration: Record<string, string | number | boolean | {
352
201
  type: string;
353
202
  filename: string;
354
203
  originalFilename: string;
@@ -385,58 +234,22 @@ export declare const eventPayloadGenerator: {
385
234
  option: string;
386
235
  filename: string;
387
236
  originalFilename: string;
388
- }[] | undefined>;
237
+ }[] | [string, string] | undefined>;
238
+ annotation: {};
389
239
  eventId: string;
390
240
  };
391
- printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "data" | "metadata">>) => {
241
+ printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation">>) => {
392
242
  type: "PRINT_CERTIFICATE";
393
243
  transactionId: string;
394
- data: Record<string, string | number | boolean | {
395
- type: string;
396
- filename: string;
397
- originalFilename: string;
398
- } | {
399
- country: string;
400
- district: string;
401
- addressType: "DOMESTIC";
402
- province: string;
403
- urbanOrRural: "URBAN";
404
- number?: string | null | undefined;
405
- town?: string | null | undefined;
406
- residentialArea?: string | null | undefined;
407
- street?: string | null | undefined;
408
- zipCode?: string | null | undefined;
409
- } | {
410
- country: string;
411
- district: string;
412
- addressType: "DOMESTIC";
413
- province: string;
414
- urbanOrRural: "RURAL";
415
- village?: string | null | undefined;
416
- } | {
417
- country: string;
418
- state: string;
419
- addressType: "INTERNATIONAL";
420
- district2: string;
421
- cityOrTown?: string | null | undefined;
422
- addressLine1?: string | null | undefined;
423
- addressLine2?: string | null | undefined;
424
- addressLine3?: string | null | undefined;
425
- postcodeOrZip?: string | null | undefined;
426
- } | {
427
- type: string;
428
- option: string;
429
- filename: string;
430
- originalFilename: string;
431
- }[] | undefined>;
432
- metadata: {};
244
+ declaration: {};
245
+ annotation: {};
433
246
  eventId: string;
434
247
  };
435
248
  correction: {
436
- request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => {
249
+ request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation">>) => {
437
250
  type: "REQUEST_CORRECTION";
438
251
  transactionId: string;
439
- data: Record<string, string | number | boolean | {
252
+ declaration: Record<string, string | number | boolean | {
440
253
  type: string;
441
254
  filename: string;
442
255
  originalFilename: string;
@@ -473,95 +286,23 @@ export declare const eventPayloadGenerator: {
473
286
  option: string;
474
287
  filename: string;
475
288
  originalFilename: string;
476
- }[] | undefined>;
477
- metadata: {};
289
+ }[] | [string, string] | undefined>;
290
+ annotation: {};
478
291
  eventId: string;
479
292
  };
480
- approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => {
293
+ approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
481
294
  type: "APPROVE_CORRECTION";
482
295
  transactionId: string;
483
- data: Record<string, string | number | boolean | {
484
- type: string;
485
- filename: string;
486
- originalFilename: string;
487
- } | {
488
- country: string;
489
- district: string;
490
- addressType: "DOMESTIC";
491
- province: string;
492
- urbanOrRural: "URBAN";
493
- number?: string | null | undefined;
494
- town?: string | null | undefined;
495
- residentialArea?: string | null | undefined;
496
- street?: string | null | undefined;
497
- zipCode?: string | null | undefined;
498
- } | {
499
- country: string;
500
- district: string;
501
- addressType: "DOMESTIC";
502
- province: string;
503
- urbanOrRural: "RURAL";
504
- village?: string | null | undefined;
505
- } | {
506
- country: string;
507
- state: string;
508
- addressType: "INTERNATIONAL";
509
- district2: string;
510
- cityOrTown?: string | null | undefined;
511
- addressLine1?: string | null | undefined;
512
- addressLine2?: string | null | undefined;
513
- addressLine3?: string | null | undefined;
514
- postcodeOrZip?: string | null | undefined;
515
- } | {
516
- type: string;
517
- option: string;
518
- filename: string;
519
- originalFilename: string;
520
- }[] | undefined>;
296
+ declaration: {};
297
+ annotation: {};
521
298
  eventId: string;
522
299
  requestId: string;
523
300
  };
524
- reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => {
301
+ reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
525
302
  type: "REJECT_CORRECTION";
526
303
  transactionId: string;
527
- data: Record<string, string | number | boolean | {
528
- type: string;
529
- filename: string;
530
- originalFilename: string;
531
- } | {
532
- country: string;
533
- district: string;
534
- addressType: "DOMESTIC";
535
- province: string;
536
- urbanOrRural: "URBAN";
537
- number?: string | null | undefined;
538
- town?: string | null | undefined;
539
- residentialArea?: string | null | undefined;
540
- street?: string | null | undefined;
541
- zipCode?: string | null | undefined;
542
- } | {
543
- country: string;
544
- district: string;
545
- addressType: "DOMESTIC";
546
- province: string;
547
- urbanOrRural: "RURAL";
548
- village?: string | null | undefined;
549
- } | {
550
- country: string;
551
- state: string;
552
- addressType: "INTERNATIONAL";
553
- district2: string;
554
- cityOrTown?: string | null | undefined;
555
- addressLine1?: string | null | undefined;
556
- addressLine2?: string | null | undefined;
557
- addressLine3?: string | null | undefined;
558
- postcodeOrZip?: string | null | undefined;
559
- } | {
560
- type: string;
561
- option: string;
562
- filename: string;
563
- originalFilename: string;
564
- }[] | undefined>;
304
+ declaration: {};
305
+ annotation: {};
565
306
  eventId: string;
566
307
  requestId: string;
567
308
  };
@@ -577,7 +318,7 @@ export declare function generateEventDocument({ configuration, actions }: {
577
318
  configuration: EventConfig;
578
319
  actions: ActionType[];
579
320
  }): EventDocument;
580
- export declare function generateEventDraftDocument(eventId: string, actionType?: ActionType, data?: Record<string, FieldValue>): Draft;
321
+ export declare function generateEventDraftDocument(eventId: string, actionType?: ActionType, declaration?: EventState): Draft;
581
322
  export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>) => EventIndex;
582
323
  export declare const generateTranslationConfig: (message: string) => TranslationConfig;
583
324
  //# sourceMappingURL=test.utils.d.ts.map