@opencrvs/toolkit 1.8.0-rc.ff2e7b6 → 1.8.0-rc.ff5b3f3

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 (43) hide show
  1. package/README.md +1 -1
  2. package/dist/commons/api/router.d.ts +14000 -10258
  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 +96433 -2024
  8. package/dist/commons/events/ActionDocument.d.ts +9819 -312
  9. package/dist/commons/events/ActionInput.d.ts +5362 -497
  10. package/dist/commons/events/ActionType.d.ts +26 -11
  11. package/dist/commons/events/AdvancedSearchConfig.d.ts +957 -22
  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 +46117 -1819
  16. package/dist/commons/events/EventConfigInput.d.ts +6 -3
  17. package/dist/commons/events/EventDocument.d.ts +3521 -424
  18. package/dist/commons/events/EventIndex.d.ts +1735 -10
  19. package/dist/commons/events/EventInput.d.ts +13 -0
  20. package/dist/commons/events/EventMetadata.d.ts +274 -8
  21. package/dist/commons/events/FieldConfig.d.ts +4765 -787
  22. package/dist/commons/events/FieldType.d.ts +4 -3
  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 +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 +5 -0
  30. package/dist/commons/events/WorkqueueConfig.d.ts +1549 -19
  31. package/dist/commons/events/defineConfig.d.ts +7282 -230
  32. package/dist/commons/events/event.d.ts +54 -0
  33. package/dist/commons/events/field.d.ts +82 -0
  34. package/dist/commons/events/index.d.ts +5 -1
  35. package/dist/commons/events/scopes.d.ts +45 -0
  36. package/dist/commons/events/test.utils.d.ts +129 -239
  37. package/dist/commons/events/utils.d.ts +3793 -73
  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 +3033 -1382
  41. package/dist/scopes/index.d.ts +158 -1
  42. package/dist/scopes/index.js +152 -1
  43. package/package.json +3 -2
@@ -1,38 +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
- province: string;
18
- urbanOrRural: "URBAN";
19
- number?: string | undefined;
20
- town?: string | undefined;
21
- residentialArea?: string | undefined;
22
- street?: string | undefined;
23
- zipCode?: string | undefined;
24
- } | {
25
- country: string;
26
- district: string;
27
- province: string;
28
- urbanOrRural: "RURAL";
29
- village?: string | undefined;
30
- } | {
31
- type: string;
32
- option: string;
33
- filename: string;
34
- originalFilename: string;
35
- }[]>;
9
+ import { TranslationConfig } from './TranslationConfig';
10
+ export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType): EventState;
11
+ export declare function generateActionAnnotationInput(configuration: EventConfig, action: ActionType): {};
36
12
  export declare const eventPayloadGenerator: {
37
13
  create: (input?: Partial<EventInput>) => {
38
14
  transactionId: string;
@@ -43,41 +19,22 @@ export declare const eventPayloadGenerator: {
43
19
  type: string;
44
20
  id: string;
45
21
  };
46
- draft: (eventId: string, input?: Partial<Draft>) => {
47
- id: import("../uuid").UUID;
22
+ draft: ({ eventId, actionType }: {
48
23
  eventId: string;
49
- createdAt: string;
50
- transactionId: import("../uuid").UUID;
51
- action: {
52
- type: "REQUEST_CORRECTION";
53
- data: {
54
- 'applicant.firstname': string;
55
- 'applicant.surname': string;
56
- 'applicant.dob': string;
57
- 'recommender.none': boolean;
58
- };
59
- metadata: {
60
- 'correction.requester.relationship': string;
61
- 'correction.request.reason': string;
62
- };
63
- createdAt: string;
64
- createdBy: string;
65
- createdAtLocation: string;
66
- };
67
- } & Partial<{
68
- id: string;
69
- createdAt: string;
70
- eventId: string;
71
- transactionId: string;
72
- action: {
73
- type: ActionType;
74
- data: 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 | {
75
31
  type: string;
76
32
  filename: string;
77
33
  originalFilename: string;
78
34
  } | {
79
35
  country: string;
80
36
  district: string;
37
+ addressType: "DOMESTIC";
81
38
  province: string;
82
39
  urbanOrRural: "URBAN";
83
40
  number?: string | null | undefined;
@@ -88,57 +45,46 @@ export declare const eventPayloadGenerator: {
88
45
  } | {
89
46
  country: string;
90
47
  district: string;
48
+ addressType: "DOMESTIC";
91
49
  province: string;
92
50
  urbanOrRural: "RURAL";
93
51
  village?: string | null | undefined;
94
- } | {
95
- type: string;
96
- option: string;
97
- filename: string;
98
- originalFilename: string;
99
- }[]>;
100
- createdAt: string;
101
- createdBy: string;
102
- createdAtLocation: string;
103
- metadata?: Record<string, string | number | boolean | {
104
- type: string;
105
- filename: string;
106
- originalFilename: string;
107
- } | {
108
- country: string;
109
- district: string;
110
- province: string;
111
- urbanOrRural: "URBAN";
112
- number?: string | null | undefined;
113
- town?: string | null | undefined;
114
- residentialArea?: string | null | undefined;
115
- street?: string | null | undefined;
116
- zipCode?: string | null | undefined;
117
52
  } | {
118
53
  country: string;
119
- district: string;
120
- province: string;
121
- urbanOrRural: "RURAL";
122
- village?: string | null | undefined;
54
+ state: string;
55
+ addressType: "INTERNATIONAL";
56
+ district2: string;
57
+ cityOrTown?: string | null | undefined;
58
+ addressLine1?: string | null | undefined;
59
+ addressLine2?: string | null | undefined;
60
+ addressLine3?: string | null | undefined;
61
+ postcodeOrZip?: string | null | undefined;
123
62
  } | {
124
63
  type: string;
125
64
  option: string;
126
65
  filename: string;
127
66
  originalFilename: string;
128
- }[]> | undefined;
67
+ }[] | [string, string] | undefined>;
68
+ annotation: {};
69
+ eventId: string;
129
70
  };
130
- }>;
131
- actions: {
132
- declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "data">>) => {
133
- 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";
134
79
  transactionId: string;
135
- data: Record<string, string | number | boolean | {
80
+ declaration: Partial<Record<string, string | number | boolean | {
136
81
  type: string;
137
82
  filename: string;
138
83
  originalFilename: string;
139
84
  } | {
140
85
  country: string;
141
86
  district: string;
87
+ addressType: "DOMESTIC";
142
88
  province: string;
143
89
  urbanOrRural: "URBAN";
144
90
  number?: string | null | undefined;
@@ -149,27 +95,39 @@ export declare const eventPayloadGenerator: {
149
95
  } | {
150
96
  country: string;
151
97
  district: string;
98
+ addressType: "DOMESTIC";
152
99
  province: string;
153
100
  urbanOrRural: "RURAL";
154
101
  village?: string | null | undefined;
102
+ } | {
103
+ country: string;
104
+ state: string;
105
+ addressType: "INTERNATIONAL";
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;
155
112
  } | {
156
113
  type: string;
157
114
  option: string;
158
115
  filename: string;
159
116
  originalFilename: string;
160
- }[]>;
117
+ }[] | [string, string] | undefined>>;
161
118
  eventId: string;
162
119
  };
163
- validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "data">>) => {
120
+ validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "declaration" | "annotation">>) => {
164
121
  type: "VALIDATE";
165
122
  transactionId: string;
166
- data: Record<string, string | number | boolean | {
123
+ declaration: Record<string, string | number | boolean | {
167
124
  type: string;
168
125
  filename: string;
169
126
  originalFilename: string;
170
127
  } | {
171
128
  country: string;
172
129
  district: string;
130
+ addressType: "DOMESTIC";
173
131
  province: string;
174
132
  urbanOrRural: "URBAN";
175
133
  number?: string | null | undefined;
@@ -180,95 +138,73 @@ export declare const eventPayloadGenerator: {
180
138
  } | {
181
139
  country: string;
182
140
  district: string;
141
+ addressType: "DOMESTIC";
183
142
  province: string;
184
143
  urbanOrRural: "RURAL";
185
144
  village?: string | null | undefined;
145
+ } | {
146
+ country: string;
147
+ state: string;
148
+ addressType: "INTERNATIONAL";
149
+ district2: string;
150
+ cityOrTown?: string | null | undefined;
151
+ addressLine1?: string | null | undefined;
152
+ addressLine2?: string | null | undefined;
153
+ addressLine3?: string | null | undefined;
154
+ postcodeOrZip?: string | null | undefined;
186
155
  } | {
187
156
  type: string;
188
157
  option: string;
189
158
  filename: string;
190
159
  originalFilename: string;
191
- }[]>;
160
+ }[] | [string, string] | undefined>;
161
+ annotation: {};
192
162
  duplicates: never[];
193
163
  eventId: string;
194
164
  };
195
- 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) => {
196
180
  type: "ARCHIVE";
197
181
  transactionId: string;
198
- data: Record<string, string | number | boolean | {
199
- type: string;
200
- filename: string;
201
- originalFilename: string;
202
- } | {
203
- country: string;
204
- district: string;
205
- province: string;
206
- urbanOrRural: "URBAN";
207
- number?: string | null | undefined;
208
- town?: string | null | undefined;
209
- residentialArea?: string | null | undefined;
210
- street?: string | null | undefined;
211
- zipCode?: string | null | undefined;
212
- } | {
213
- country: string;
214
- district: string;
215
- province: string;
216
- urbanOrRural: "RURAL";
217
- village?: string | null | undefined;
218
- } | {
219
- type: string;
220
- option: string;
221
- filename: string;
222
- originalFilename: string;
223
- }[]>;
224
- metadata: {
182
+ declaration: {};
183
+ annotation: {
225
184
  isDuplicate: boolean;
226
185
  };
227
186
  duplicates: never[];
228
187
  eventId: string;
229
188
  };
230
- reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "data">>) => {
189
+ reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation">>) => {
231
190
  type: "REJECT";
232
191
  transactionId: string;
233
- data: Record<string, string | number | boolean | {
234
- type: string;
235
- filename: string;
236
- originalFilename: string;
237
- } | {
238
- country: string;
239
- district: string;
240
- province: string;
241
- urbanOrRural: "URBAN";
242
- number?: string | null | undefined;
243
- town?: string | null | undefined;
244
- residentialArea?: string | null | undefined;
245
- street?: string | null | undefined;
246
- zipCode?: string | null | undefined;
247
- } | {
248
- country: string;
249
- district: string;
250
- province: string;
251
- urbanOrRural: "RURAL";
252
- village?: string | null | undefined;
253
- } | {
254
- type: string;
255
- option: string;
256
- filename: string;
257
- originalFilename: string;
258
- }[]>;
192
+ declaration: {};
193
+ annotation: {};
259
194
  duplicates: never[];
260
195
  eventId: string;
261
196
  };
262
- register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "data">>) => {
197
+ register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation">>) => {
263
198
  type: "REGISTER";
264
199
  transactionId: string;
265
- data: Record<string, string | number | boolean | {
200
+ declaration: Record<string, string | number | boolean | {
266
201
  type: string;
267
202
  filename: string;
268
203
  originalFilename: string;
269
204
  } | {
270
205
  country: string;
271
206
  district: string;
207
+ addressType: "DOMESTIC";
272
208
  province: string;
273
209
  urbanOrRural: "URBAN";
274
210
  number?: string | null | undefined;
@@ -279,59 +215,48 @@ export declare const eventPayloadGenerator: {
279
215
  } | {
280
216
  country: string;
281
217
  district: string;
218
+ addressType: "DOMESTIC";
282
219
  province: string;
283
220
  urbanOrRural: "RURAL";
284
221
  village?: string | null | undefined;
222
+ } | {
223
+ country: string;
224
+ state: string;
225
+ addressType: "INTERNATIONAL";
226
+ district2: string;
227
+ cityOrTown?: string | null | undefined;
228
+ addressLine1?: string | null | undefined;
229
+ addressLine2?: string | null | undefined;
230
+ addressLine3?: string | null | undefined;
231
+ postcodeOrZip?: string | null | undefined;
285
232
  } | {
286
233
  type: string;
287
234
  option: string;
288
235
  filename: string;
289
236
  originalFilename: string;
290
- }[]>;
237
+ }[] | [string, string] | undefined>;
238
+ annotation: {};
291
239
  eventId: string;
292
240
  };
293
- printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "data">>) => {
241
+ printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation">>) => {
294
242
  type: "PRINT_CERTIFICATE";
295
243
  transactionId: string;
296
- data: Record<string, string | number | boolean | {
297
- type: string;
298
- filename: string;
299
- originalFilename: string;
300
- } | {
301
- country: string;
302
- district: string;
303
- province: string;
304
- urbanOrRural: "URBAN";
305
- number?: string | null | undefined;
306
- town?: string | null | undefined;
307
- residentialArea?: string | null | undefined;
308
- street?: string | null | undefined;
309
- zipCode?: string | null | undefined;
310
- } | {
311
- country: string;
312
- district: string;
313
- province: string;
314
- urbanOrRural: "RURAL";
315
- village?: string | null | undefined;
316
- } | {
317
- type: string;
318
- option: string;
319
- filename: string;
320
- originalFilename: string;
321
- }[]>;
244
+ declaration: {};
245
+ annotation: {};
322
246
  eventId: string;
323
247
  };
324
248
  correction: {
325
- request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => {
249
+ request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation">>) => {
326
250
  type: "REQUEST_CORRECTION";
327
251
  transactionId: string;
328
- data: Record<string, string | number | boolean | {
252
+ declaration: Record<string, string | number | boolean | {
329
253
  type: string;
330
254
  filename: string;
331
255
  originalFilename: string;
332
256
  } | {
333
257
  country: string;
334
258
  district: string;
259
+ addressType: "DOMESTIC";
335
260
  province: string;
336
261
  urbanOrRural: "URBAN";
337
262
  number?: string | null | undefined;
@@ -342,79 +267,42 @@ export declare const eventPayloadGenerator: {
342
267
  } | {
343
268
  country: string;
344
269
  district: string;
270
+ addressType: "DOMESTIC";
345
271
  province: string;
346
272
  urbanOrRural: "RURAL";
347
273
  village?: string | null | undefined;
274
+ } | {
275
+ country: string;
276
+ state: string;
277
+ addressType: "INTERNATIONAL";
278
+ district2: string;
279
+ cityOrTown?: string | null | undefined;
280
+ addressLine1?: string | null | undefined;
281
+ addressLine2?: string | null | undefined;
282
+ addressLine3?: string | null | undefined;
283
+ postcodeOrZip?: string | null | undefined;
348
284
  } | {
349
285
  type: string;
350
286
  option: string;
351
287
  filename: string;
352
288
  originalFilename: string;
353
- }[]>;
354
- metadata: {};
289
+ }[] | [string, string] | undefined>;
290
+ annotation: {};
355
291
  eventId: string;
356
292
  };
357
- approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => {
293
+ approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
358
294
  type: "APPROVE_CORRECTION";
359
295
  transactionId: string;
360
- data: Record<string, string | number | boolean | {
361
- type: string;
362
- filename: string;
363
- originalFilename: string;
364
- } | {
365
- country: string;
366
- district: string;
367
- province: string;
368
- urbanOrRural: "URBAN";
369
- number?: string | null | undefined;
370
- town?: string | null | undefined;
371
- residentialArea?: string | null | undefined;
372
- street?: string | null | undefined;
373
- zipCode?: string | null | undefined;
374
- } | {
375
- country: string;
376
- district: string;
377
- province: string;
378
- urbanOrRural: "RURAL";
379
- village?: string | null | undefined;
380
- } | {
381
- type: string;
382
- option: string;
383
- filename: string;
384
- originalFilename: string;
385
- }[]>;
296
+ declaration: {};
297
+ annotation: {};
386
298
  eventId: string;
387
299
  requestId: string;
388
300
  };
389
- reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => {
301
+ reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
390
302
  type: "REJECT_CORRECTION";
391
303
  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
- province: string;
400
- urbanOrRural: "URBAN";
401
- number?: string | null | undefined;
402
- town?: string | null | undefined;
403
- residentialArea?: string | null | undefined;
404
- street?: string | null | undefined;
405
- zipCode?: string | null | undefined;
406
- } | {
407
- country: string;
408
- district: string;
409
- province: string;
410
- urbanOrRural: "RURAL";
411
- village?: string | null | undefined;
412
- } | {
413
- type: string;
414
- option: string;
415
- filename: string;
416
- originalFilename: string;
417
- }[]>;
304
+ declaration: {};
305
+ annotation: {};
418
306
  eventId: string;
419
307
  requestId: string;
420
308
  };
@@ -430,6 +318,8 @@ export declare function generateEventDocument({ configuration, actions }: {
430
318
  configuration: EventConfig;
431
319
  actions: ActionType[];
432
320
  }): EventDocument;
433
- export declare function generateEventDraftDocument(eventId: string, actionType?: ActionType, data?: Record<string, FieldValue>): Draft;
434
- 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;
435
325
  //# sourceMappingURL=test.utils.d.ts.map