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

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 (46) hide show
  1. package/README.md +1 -1
  2. package/dist/commons/api/router.d.ts +12639 -14167
  3. package/dist/commons/conditionals/conditionals.d.ts +32 -6
  4. package/dist/commons/conditionals/validate.d.ts +12 -17
  5. package/dist/commons/events/ActionConfig.d.ts +92869 -2005
  6. package/dist/commons/events/ActionDocument.d.ts +8019 -401
  7. package/dist/commons/events/ActionInput.d.ts +2365 -548
  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/Constants.d.ts +2 -0
  13. package/dist/commons/events/CountryConfigQueryInput.d.ts +2982 -0
  14. package/dist/commons/events/CreatedAtLocation.d.ts +3 -0
  15. package/dist/commons/events/Draft.d.ts +93 -60
  16. package/dist/commons/events/EventConfig.d.ts +42302 -1760
  17. package/dist/commons/events/EventConfigInput.d.ts +6 -3
  18. package/dist/commons/events/EventDocument.d.ts +1225 -529
  19. package/dist/commons/events/EventIndex.d.ts +1328 -13
  20. package/dist/commons/events/EventMetadata.d.ts +270 -11
  21. package/dist/commons/events/FieldConfig.d.ts +4704 -786
  22. package/dist/commons/events/FieldType.d.ts +4 -3
  23. package/dist/commons/events/FieldTypeMapping.d.ts +33 -5
  24. package/dist/commons/events/FieldValue.d.ts +12 -7
  25. package/dist/commons/events/FormConfig.d.ts +43810 -73
  26. package/dist/commons/events/PageConfig.d.ts +10991 -0
  27. package/dist/commons/events/SummaryConfig.d.ts +95 -39
  28. package/dist/commons/events/TemplateConfig.d.ts +5 -5
  29. package/dist/commons/events/User.d.ts +31 -2
  30. package/dist/commons/events/WorkqueueColumnConfig.d.ts +53 -0
  31. package/dist/commons/events/WorkqueueConfig.d.ts +4525 -20
  32. package/dist/commons/events/defineConfig.d.ts +6560 -223
  33. package/dist/commons/events/event.d.ts +54 -0
  34. package/dist/commons/events/field.d.ts +82 -0
  35. package/dist/commons/events/index.d.ts +9 -1
  36. package/dist/commons/events/scopes.d.ts +45 -0
  37. package/dist/commons/events/serializer.d.ts +2 -0
  38. package/dist/commons/events/test.utils.d.ts +93 -327
  39. package/dist/commons/events/utils.d.ts +3701 -96
  40. package/dist/commons/events/utils.test.d.ts +2 -0
  41. package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
  42. package/dist/conditionals/index.js +210 -122
  43. package/dist/events/index.js +4464 -1981
  44. package/dist/scopes/index.d.ts +158 -1
  45. package/dist/scopes/index.js +152 -1
  46. package/package.json +3 -2
@@ -1,50 +1,15 @@
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
+ import { WorkqueueConfig } from './WorkqueueConfig';
11
+ export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType): EventState;
12
+ export declare function generateActionAnnotationInput(configuration: EventConfig, action: ActionType): {};
48
13
  export declare const eventPayloadGenerator: {
49
14
  create: (input?: Partial<EventInput>) => {
50
15
  transactionId: string;
@@ -55,76 +20,15 @@ export declare const eventPayloadGenerator: {
55
20
  type: string;
56
21
  id: string;
57
22
  };
58
- draft: (eventId: string, input?: Partial<Draft>) => {
59
- id: import("../uuid").UUID;
23
+ draft: ({ eventId, actionType }: {
60
24
  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 | {
25
+ actionType: ActionType;
26
+ }, input?: Partial<Draft>) => Draft;
27
+ actions: {
28
+ declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation">>) => {
29
+ type: "DECLARE";
30
+ transactionId: string;
31
+ declaration: Record<string, string | number | boolean | {
128
32
  type: string;
129
33
  filename: string;
130
34
  originalFilename: string;
@@ -161,14 +65,20 @@ export declare const eventPayloadGenerator: {
161
65
  option: string;
162
66
  filename: string;
163
67
  originalFilename: string;
164
- }[]> | undefined;
68
+ }[] | [string, string] | undefined>;
69
+ annotation: {};
70
+ eventId: string;
165
71
  };
166
- }>;
167
- actions: {
168
- declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "data">>) => {
169
- type: "DECLARE";
72
+ /**
73
+ * Notify allows sending incomplete data. Think it as 'partial declare' for now.
74
+ */
75
+ notify: (eventId: string, input?: {
76
+ transactionId?: string;
77
+ declaration?: Partial<ActionUpdate>;
78
+ }) => {
79
+ type: "NOTIFY";
170
80
  transactionId: string;
171
- data: Record<string, string | number | boolean | {
81
+ declaration: Partial<Record<string, string | number | boolean | {
172
82
  type: string;
173
83
  filename: string;
174
84
  originalFilename: string;
@@ -205,13 +115,13 @@ export declare const eventPayloadGenerator: {
205
115
  option: string;
206
116
  filename: string;
207
117
  originalFilename: string;
208
- }[]>;
118
+ }[] | [string, string] | undefined>>;
209
119
  eventId: string;
210
120
  };
211
- validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "data">>) => {
121
+ validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "declaration" | "annotation">>) => {
212
122
  type: "VALIDATE";
213
123
  transactionId: string;
214
- data: Record<string, string | number | boolean | {
124
+ declaration: Record<string, string | number | boolean | {
215
125
  type: string;
216
126
  filename: string;
217
127
  originalFilename: string;
@@ -248,105 +158,52 @@ export declare const eventPayloadGenerator: {
248
158
  option: string;
249
159
  filename: string;
250
160
  originalFilename: string;
251
- }[]>;
161
+ }[] | [string, string] | undefined>;
162
+ annotation: {};
252
163
  duplicates: never[];
253
164
  eventId: string;
254
165
  };
255
- archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "data">>, isDuplicate?: boolean) => {
166
+ assign: (eventId: string, input?: Partial<Pick<AssignActionInput, "transactionId" | "assignedTo">>) => {
167
+ type: "ASSIGN";
168
+ transactionId: string;
169
+ declaration: {};
170
+ assignedTo: string;
171
+ eventId: string;
172
+ };
173
+ unassign: (eventId: string, input?: Partial<Pick<UnassignActionInput, "transactionId">>) => {
174
+ type: "UNASSIGN";
175
+ transactionId: string;
176
+ declaration: {};
177
+ assignedTo: null;
178
+ eventId: string;
179
+ };
180
+ archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration">>, isDuplicate?: boolean) => {
256
181
  type: "ARCHIVE";
257
182
  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: {
297
- isDuplicate: boolean;
298
- };
183
+ declaration: {};
184
+ annotation: {};
299
185
  duplicates: never[];
300
186
  eventId: string;
187
+ reason: {
188
+ message: string;
189
+ isDuplicate: boolean;
190
+ };
301
191
  };
302
- reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "data">>) => {
192
+ reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation">>) => {
303
193
  type: "REJECT";
304
194
  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
- }[]>;
195
+ declaration: {};
196
+ annotation: {};
343
197
  duplicates: never[];
344
198
  eventId: string;
199
+ reason: {
200
+ message: string;
201
+ };
345
202
  };
346
- register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "data">>) => {
203
+ register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation">>) => {
347
204
  type: "REGISTER";
348
205
  transactionId: string;
349
- data: Record<string, string | number | boolean | {
206
+ declaration: Record<string, string | number | boolean | {
350
207
  type: string;
351
208
  filename: string;
352
209
  originalFilename: string;
@@ -383,57 +240,22 @@ export declare const eventPayloadGenerator: {
383
240
  option: string;
384
241
  filename: string;
385
242
  originalFilename: string;
386
- }[]>;
243
+ }[] | [string, string] | undefined>;
244
+ annotation: {};
387
245
  eventId: string;
388
246
  };
389
- printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "data">>) => {
247
+ printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation">>) => {
390
248
  type: "PRINT_CERTIFICATE";
391
249
  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
- }[]>;
250
+ declaration: {};
251
+ annotation: {};
430
252
  eventId: string;
431
253
  };
432
254
  correction: {
433
- request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => {
255
+ request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation">>) => {
434
256
  type: "REQUEST_CORRECTION";
435
257
  transactionId: string;
436
- data: Record<string, string | number | boolean | {
258
+ declaration: Record<string, string | number | boolean | {
437
259
  type: string;
438
260
  filename: string;
439
261
  originalFilename: string;
@@ -470,95 +292,23 @@ export declare const eventPayloadGenerator: {
470
292
  option: string;
471
293
  filename: string;
472
294
  originalFilename: string;
473
- }[]>;
474
- metadata: {};
295
+ }[] | [string, string] | undefined>;
296
+ annotation: {};
475
297
  eventId: string;
476
298
  };
477
- approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => {
299
+ approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
478
300
  type: "APPROVE_CORRECTION";
479
301
  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
- }[]>;
302
+ declaration: {};
303
+ annotation: {};
518
304
  eventId: string;
519
305
  requestId: string;
520
306
  };
521
- reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => {
307
+ reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
522
308
  type: "REJECT_CORRECTION";
523
309
  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
- }[]>;
310
+ declaration: {};
311
+ annotation: {};
562
312
  eventId: string;
563
313
  requestId: string;
564
314
  };
@@ -574,6 +324,22 @@ export declare function generateEventDocument({ configuration, actions }: {
574
324
  configuration: EventConfig;
575
325
  actions: ActionType[];
576
326
  }): EventDocument;
577
- export declare function generateEventDraftDocument(eventId: string, actionType?: ActionType, data?: Record<string, FieldValue>): Draft;
578
- export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>) => EventIndex;
327
+ export declare function generateEventDraftDocument(eventId: string, actionType?: ActionType, declaration?: EventState): Draft;
328
+ export declare function getRandomDatetime(rng: () => number, start: Date, end: Date): string;
329
+ /**
330
+ * Useful for testing when we need deterministic outcome.
331
+ * @param seed - Seed value for the pseudo-random number generator
332
+ *
333
+ * @returns A function that generates pseudo-random numbers between 0 and 1
334
+ */
335
+ export declare function createPseudoRandomNumberGenerator(seed: number): () => number;
336
+ export declare function generateRandomSignature(rng: () => number): string;
337
+ export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>, seed?: number) => EventIndex;
338
+ export declare const generateTranslationConfig: (message: string) => TranslationConfig;
339
+ export declare const BearerTokenByUserType: {
340
+ fieldAgent: string;
341
+ registrationAgent: string;
342
+ localRegistrar: string;
343
+ };
344
+ export declare const generateWorkqueues: (slug?: string) => WorkqueueConfig[];
579
345
  //# sourceMappingURL=test.utils.d.ts.map