@opencrvs/toolkit 1.8.0-rc.fca3e39 → 1.8.0-rc.fcd89ec

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