@opencrvs/toolkit 1.8.0-rc.fe799b0 → 1.8.0-rc.fea3888

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 +10781 -10314
  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 +85782 -2035
  8. package/dist/commons/events/ActionDocument.d.ts +9850 -363
  9. package/dist/commons/events/ActionInput.d.ts +5365 -584
  10. package/dist/commons/events/ActionType.d.ts +27 -12
  11. package/dist/commons/events/AdvancedSearchConfig.d.ts +371 -25
  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 +374 -59
  15. package/dist/commons/events/EventConfig.d.ts +40846 -1801
  16. package/dist/commons/events/EventConfigInput.d.ts +6 -3
  17. package/dist/commons/events/EventDocument.d.ts +3672 -504
  18. package/dist/commons/events/EventIndex.d.ts +921 -7
  19. package/dist/commons/events/EventInput.d.ts +13 -0
  20. package/dist/commons/events/EventMetadata.d.ts +16 -3
  21. package/dist/commons/events/FieldConfig.d.ts +3955 -757
  22. package/dist/commons/events/FieldType.d.ts +6 -1
  23. package/dist/commons/events/FieldTypeMapping.d.ts +154 -3
  24. package/dist/commons/events/FieldValue.d.ts +77 -3
  25. package/dist/commons/events/FormConfig.d.ts +38982 -69
  26. package/dist/commons/events/PageConfig.d.ts +9803 -0
  27. package/dist/commons/events/SummaryConfig.d.ts +81 -42
  28. package/dist/commons/events/TemplateConfig.d.ts +38 -0
  29. package/dist/commons/events/User.d.ts +5 -0
  30. package/dist/commons/events/WorkqueueConfig.d.ts +44 -20
  31. package/dist/commons/events/defineConfig.d.ts +6749 -230
  32. package/dist/commons/events/event.d.ts +25 -0
  33. package/dist/commons/events/field.d.ts +68 -0
  34. package/dist/commons/events/index.d.ts +6 -1
  35. package/dist/commons/events/scopes.d.ts +26 -0
  36. package/dist/commons/events/test.utils.d.ts +128 -238
  37. package/dist/commons/events/utils.d.ts +3528 -90
  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 +2231 -1191
  41. package/package.json +3 -2
@@ -1,5 +1,5 @@
1
- import { ActionDocument } from './ActionDocument';
2
- import { ArchivedActionInput, 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,32 +7,9 @@ import { EventDocument } from './EventDocument';
7
7
  import { EventIndex } from './EventIndex';
8
8
  import { EventInput } from './EventInput';
9
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
- }[]>;
10
+ import { TranslationConfig } from './TranslationConfig';
11
+ export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType): Partial<import("./ActionDocument").EventState>;
12
+ export declare function generateActionAnnotationInput(configuration: EventConfig, action: ActionType): {};
36
13
  export declare const eventPayloadGenerator: {
37
14
  create: (input?: Partial<EventInput>) => {
38
15
  transactionId: string;
@@ -43,41 +20,22 @@ export declare const eventPayloadGenerator: {
43
20
  type: string;
44
21
  id: string;
45
22
  };
46
- draft: (eventId: string, input?: Partial<Draft>) => {
47
- id: import("../uuid").UUID;
23
+ draft: ({ eventId, actionType }: {
48
24
  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 | {
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 | {
75
32
  type: string;
76
33
  filename: string;
77
34
  originalFilename: string;
78
35
  } | {
79
36
  country: string;
80
37
  district: string;
38
+ addressType: "DOMESTIC";
81
39
  province: string;
82
40
  urbanOrRural: "URBAN";
83
41
  number?: string | null | undefined;
@@ -88,57 +46,46 @@ export declare const eventPayloadGenerator: {
88
46
  } | {
89
47
  country: string;
90
48
  district: string;
49
+ addressType: "DOMESTIC";
91
50
  province: string;
92
51
  urbanOrRural: "RURAL";
93
52
  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
53
  } | {
118
54
  country: string;
119
- district: string;
120
- province: string;
121
- urbanOrRural: "RURAL";
122
- village?: string | null | undefined;
55
+ state: string;
56
+ addressType: "INTERNATIONAL";
57
+ district2: string;
58
+ cityOrTown?: string | null | undefined;
59
+ addressLine1?: string | null | undefined;
60
+ addressLine2?: string | null | undefined;
61
+ addressLine3?: string | null | undefined;
62
+ postcodeOrZip?: string | null | undefined;
123
63
  } | {
124
64
  type: string;
125
65
  option: string;
126
66
  filename: string;
127
67
  originalFilename: string;
128
- }[]> | undefined;
68
+ }[] | undefined>;
69
+ annotation: {};
70
+ eventId: string;
129
71
  };
130
- }>;
131
- actions: {
132
- declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "data">>) => {
133
- 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";
134
80
  transactionId: string;
135
- data: Record<string, string | number | boolean | {
81
+ declaration: Partial<Record<string, string | number | boolean | {
136
82
  type: string;
137
83
  filename: string;
138
84
  originalFilename: string;
139
85
  } | {
140
86
  country: string;
141
87
  district: string;
88
+ addressType: "DOMESTIC";
142
89
  province: string;
143
90
  urbanOrRural: "URBAN";
144
91
  number?: string | null | undefined;
@@ -149,27 +96,39 @@ export declare const eventPayloadGenerator: {
149
96
  } | {
150
97
  country: string;
151
98
  district: string;
99
+ addressType: "DOMESTIC";
152
100
  province: string;
153
101
  urbanOrRural: "RURAL";
154
102
  village?: string | null | undefined;
103
+ } | {
104
+ country: string;
105
+ state: string;
106
+ addressType: "INTERNATIONAL";
107
+ district2: string;
108
+ cityOrTown?: string | null | undefined;
109
+ addressLine1?: string | null | undefined;
110
+ addressLine2?: string | null | undefined;
111
+ addressLine3?: string | null | undefined;
112
+ postcodeOrZip?: string | null | undefined;
155
113
  } | {
156
114
  type: string;
157
115
  option: string;
158
116
  filename: string;
159
117
  originalFilename: string;
160
- }[]>;
118
+ }[] | undefined>>;
161
119
  eventId: string;
162
120
  };
163
- validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "data">>) => {
121
+ validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "declaration" | "annotation">>) => {
164
122
  type: "VALIDATE";
165
123
  transactionId: string;
166
- data: Record<string, string | number | boolean | {
124
+ declaration: Record<string, string | number | boolean | {
167
125
  type: string;
168
126
  filename: string;
169
127
  originalFilename: string;
170
128
  } | {
171
129
  country: string;
172
130
  district: string;
131
+ addressType: "DOMESTIC";
173
132
  province: string;
174
133
  urbanOrRural: "URBAN";
175
134
  number?: string | null | undefined;
@@ -180,95 +139,73 @@ export declare const eventPayloadGenerator: {
180
139
  } | {
181
140
  country: string;
182
141
  district: string;
142
+ addressType: "DOMESTIC";
183
143
  province: string;
184
144
  urbanOrRural: "RURAL";
185
145
  village?: string | null | undefined;
146
+ } | {
147
+ country: string;
148
+ state: string;
149
+ addressType: "INTERNATIONAL";
150
+ district2: string;
151
+ cityOrTown?: string | null | undefined;
152
+ addressLine1?: string | null | undefined;
153
+ addressLine2?: string | null | undefined;
154
+ addressLine3?: string | null | undefined;
155
+ postcodeOrZip?: string | null | undefined;
186
156
  } | {
187
157
  type: string;
188
158
  option: string;
189
159
  filename: string;
190
160
  originalFilename: string;
191
- }[]>;
161
+ }[] | undefined>;
162
+ annotation: {};
192
163
  duplicates: never[];
193
164
  eventId: string;
194
165
  };
195
- archive: (eventId: string, input?: Partial<Pick<ArchivedActionInput, "transactionId" | "data">>, isDuplicate?: boolean) => {
196
- type: "ARCHIVED";
166
+ assign: (eventId: string, input?: Partial<Pick<AssignActionInput, "transactionId" | "assignedTo">>) => {
167
+ type: "ASSIGN";
197
168
  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: {
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) => {
181
+ type: "ARCHIVE";
182
+ transactionId: string;
183
+ declaration: {};
184
+ annotation: {
225
185
  isDuplicate: boolean;
226
186
  };
227
187
  duplicates: never[];
228
188
  eventId: string;
229
189
  };
230
- reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "data">>) => {
190
+ reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation">>) => {
231
191
  type: "REJECT";
232
192
  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
- }[]>;
193
+ declaration: {};
194
+ annotation: {};
259
195
  duplicates: never[];
260
196
  eventId: string;
261
197
  };
262
- register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "data">>) => {
198
+ register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation">>) => {
263
199
  type: "REGISTER";
264
200
  transactionId: string;
265
- data: Record<string, string | number | boolean | {
201
+ declaration: Record<string, string | number | boolean | {
266
202
  type: string;
267
203
  filename: string;
268
204
  originalFilename: string;
269
205
  } | {
270
206
  country: string;
271
207
  district: string;
208
+ addressType: "DOMESTIC";
272
209
  province: string;
273
210
  urbanOrRural: "URBAN";
274
211
  number?: string | null | undefined;
@@ -279,59 +216,48 @@ export declare const eventPayloadGenerator: {
279
216
  } | {
280
217
  country: string;
281
218
  district: string;
219
+ addressType: "DOMESTIC";
282
220
  province: string;
283
221
  urbanOrRural: "RURAL";
284
222
  village?: string | null | undefined;
223
+ } | {
224
+ country: string;
225
+ state: string;
226
+ addressType: "INTERNATIONAL";
227
+ district2: string;
228
+ cityOrTown?: string | null | undefined;
229
+ addressLine1?: string | null | undefined;
230
+ addressLine2?: string | null | undefined;
231
+ addressLine3?: string | null | undefined;
232
+ postcodeOrZip?: string | null | undefined;
285
233
  } | {
286
234
  type: string;
287
235
  option: string;
288
236
  filename: string;
289
237
  originalFilename: string;
290
- }[]>;
238
+ }[] | undefined>;
239
+ annotation: {};
291
240
  eventId: string;
292
241
  };
293
- printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "data">>) => {
242
+ printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation">>) => {
294
243
  type: "PRINT_CERTIFICATE";
295
244
  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
- }[]>;
245
+ declaration: {};
246
+ annotation: {};
322
247
  eventId: string;
323
248
  };
324
249
  correction: {
325
- request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => {
250
+ request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation">>) => {
326
251
  type: "REQUEST_CORRECTION";
327
252
  transactionId: string;
328
- data: Record<string, string | number | boolean | {
253
+ declaration: Record<string, string | number | boolean | {
329
254
  type: string;
330
255
  filename: string;
331
256
  originalFilename: string;
332
257
  } | {
333
258
  country: string;
334
259
  district: string;
260
+ addressType: "DOMESTIC";
335
261
  province: string;
336
262
  urbanOrRural: "URBAN";
337
263
  number?: string | null | undefined;
@@ -342,79 +268,42 @@ export declare const eventPayloadGenerator: {
342
268
  } | {
343
269
  country: string;
344
270
  district: string;
271
+ addressType: "DOMESTIC";
345
272
  province: string;
346
273
  urbanOrRural: "RURAL";
347
274
  village?: string | null | undefined;
275
+ } | {
276
+ country: string;
277
+ state: string;
278
+ addressType: "INTERNATIONAL";
279
+ district2: string;
280
+ cityOrTown?: string | null | undefined;
281
+ addressLine1?: string | null | undefined;
282
+ addressLine2?: string | null | undefined;
283
+ addressLine3?: string | null | undefined;
284
+ postcodeOrZip?: string | null | undefined;
348
285
  } | {
349
286
  type: string;
350
287
  option: string;
351
288
  filename: string;
352
289
  originalFilename: string;
353
- }[]>;
354
- metadata: {};
290
+ }[] | undefined>;
291
+ annotation: {};
355
292
  eventId: string;
356
293
  };
357
- approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => {
294
+ approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
358
295
  type: "APPROVE_CORRECTION";
359
296
  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
- }[]>;
297
+ declaration: {};
298
+ annotation: {};
386
299
  eventId: string;
387
300
  requestId: string;
388
301
  };
389
- reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => {
302
+ reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
390
303
  type: "REJECT_CORRECTION";
391
304
  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
- }[]>;
305
+ declaration: {};
306
+ annotation: {};
418
307
  eventId: string;
419
308
  requestId: string;
420
309
  };
@@ -430,6 +319,7 @@ export declare function generateEventDocument({ configuration, actions }: {
430
319
  configuration: EventConfig;
431
320
  actions: ActionType[];
432
321
  }): EventDocument;
433
- export declare function generateEventDraftDocument(eventId: string, actionType?: ActionType, data?: Record<string, FieldValue>): Draft;
322
+ export declare function generateEventDraftDocument(eventId: string, actionType?: ActionType, declaration?: Record<string, FieldValue>): Draft;
434
323
  export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>) => EventIndex;
324
+ export declare const generateTranslationConfig: (message: string) => TranslationConfig;
435
325
  //# sourceMappingURL=test.utils.d.ts.map