@opencrvs/toolkit 1.8.0-rc.ffe8c17 → 1.8.1-rc.a372970

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 (33) hide show
  1. package/README.md +1 -1
  2. package/dist/commons/api/router.d.ts +6644 -9555
  3. package/dist/commons/conditionals/conditionals.d.ts +26 -3
  4. package/dist/commons/conditionals/validate-address.test.d.ts +2 -0
  5. package/dist/commons/conditionals/validate.d.ts +14 -17
  6. package/dist/commons/events/ActionConfig.d.ts +1008 -3209
  7. package/dist/commons/events/ActionDocument.d.ts +9488 -312
  8. package/dist/commons/events/ActionInput.d.ts +5329 -472
  9. package/dist/commons/events/ActionType.d.ts +26 -11
  10. package/dist/commons/events/CompositeFieldValue.d.ts +152 -2
  11. package/dist/commons/events/Conditional.d.ts +21 -5
  12. package/dist/commons/events/Draft.d.ts +351 -48
  13. package/dist/commons/events/EventConfig.d.ts +639 -2862
  14. package/dist/commons/events/EventConfigInput.d.ts +6 -3
  15. package/dist/commons/events/EventDocument.d.ts +3340 -424
  16. package/dist/commons/events/EventIndex.d.ts +6 -3
  17. package/dist/commons/events/EventMetadata.d.ts +3 -0
  18. package/dist/commons/events/FieldConfig.d.ts +383 -104
  19. package/dist/commons/events/FieldTypeMapping.d.ts +104 -207
  20. package/dist/commons/events/FieldValue.d.ts +71 -76
  21. package/dist/commons/events/FormConfig.d.ts +527 -279
  22. package/dist/commons/events/PageConfig.d.ts +335 -0
  23. package/dist/commons/events/TemplateConfig.d.ts +5 -5
  24. package/dist/commons/events/defineConfig.d.ts +40 -417
  25. package/dist/commons/events/index.d.ts +2 -1
  26. package/dist/commons/events/test.utils.d.ts +140 -213
  27. package/dist/commons/events/utils.d.ts +126 -156
  28. package/dist/commons/events/utils.test.d.ts +2 -0
  29. package/dist/conditionals/index.js +166 -81
  30. package/dist/events/index.js +1287 -795
  31. package/dist/scopes/index.d.ts +70 -1
  32. package/dist/scopes/index.js +130 -0
  33. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import { ActionDocument } from './ActionDocument';
2
- import { ArchiveActionInput, 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,13 +7,15 @@ 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 | {
10
+ import { TranslationConfig } from './TranslationConfig';
11
+ export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType): import("lodash").Dictionary<string | number | boolean | {
11
12
  type: string;
12
13
  filename: string;
13
14
  originalFilename: string;
14
15
  } | {
15
16
  country: string;
16
17
  district: string;
18
+ addressType: "DOMESTIC";
17
19
  province: string;
18
20
  urbanOrRural: "URBAN";
19
21
  number?: string | undefined;
@@ -24,15 +26,27 @@ export declare function generateActionInput(configuration: EventConfig, action:
24
26
  } | {
25
27
  country: string;
26
28
  district: string;
29
+ addressType: "DOMESTIC";
27
30
  province: string;
28
31
  urbanOrRural: "RURAL";
29
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;
30
43
  } | {
31
44
  type: string;
32
45
  option: string;
33
46
  filename: string;
34
47
  originalFilename: string;
35
- }[]>;
48
+ }[] | undefined>;
49
+ export declare function generateActionAnnotationInput(configuration: EventConfig, action: ActionType): {};
36
50
  export declare const eventPayloadGenerator: {
37
51
  create: (input?: Partial<EventInput>) => {
38
52
  transactionId: string;
@@ -43,41 +57,22 @@ export declare const eventPayloadGenerator: {
43
57
  type: string;
44
58
  id: string;
45
59
  };
46
- draft: (eventId: string, input?: Partial<Draft>) => {
47
- id: import("../uuid").UUID;
60
+ draft: ({ eventId, actionType }: {
48
61
  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 | {
62
+ actionType: ActionType;
63
+ }, input?: Partial<Draft>) => Draft;
64
+ actions: {
65
+ declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation">>) => {
66
+ type: "DECLARE";
67
+ transactionId: string;
68
+ declaration: Record<string, string | number | boolean | {
75
69
  type: string;
76
70
  filename: string;
77
71
  originalFilename: string;
78
72
  } | {
79
73
  country: string;
80
74
  district: string;
75
+ addressType: "DOMESTIC";
81
76
  province: string;
82
77
  urbanOrRural: "URBAN";
83
78
  number?: string | null | undefined;
@@ -88,57 +83,46 @@ export declare const eventPayloadGenerator: {
88
83
  } | {
89
84
  country: string;
90
85
  district: string;
86
+ addressType: "DOMESTIC";
91
87
  province: string;
92
88
  urbanOrRural: "RURAL";
93
89
  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
90
  } | {
108
91
  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
- } | {
118
- country: string;
119
- district: string;
120
- province: string;
121
- urbanOrRural: "RURAL";
122
- village?: string | null | undefined;
92
+ state: string;
93
+ addressType: "INTERNATIONAL";
94
+ district2: string;
95
+ cityOrTown?: string | null | undefined;
96
+ addressLine1?: string | null | undefined;
97
+ addressLine2?: string | null | undefined;
98
+ addressLine3?: string | null | undefined;
99
+ postcodeOrZip?: string | null | undefined;
123
100
  } | {
124
101
  type: string;
125
102
  option: string;
126
103
  filename: string;
127
104
  originalFilename: string;
128
- }[]> | undefined;
105
+ }[] | undefined>;
106
+ annotation: {};
107
+ eventId: string;
129
108
  };
130
- }>;
131
- actions: {
132
- declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "data">>) => {
133
- type: "DECLARE";
109
+ /**
110
+ * Notify allows sending incomplete data. Think it as 'partial declare' for now.
111
+ */
112
+ notify: (eventId: string, input?: {
113
+ transactionId?: string;
114
+ declaration?: Partial<ActionUpdate>;
115
+ }) => {
116
+ type: "NOTIFY";
134
117
  transactionId: string;
135
- data: Record<string, string | number | boolean | {
118
+ declaration: Partial<Record<string, string | number | boolean | {
136
119
  type: string;
137
120
  filename: string;
138
121
  originalFilename: string;
139
122
  } | {
140
123
  country: string;
141
124
  district: string;
125
+ addressType: "DOMESTIC";
142
126
  province: string;
143
127
  urbanOrRural: "URBAN";
144
128
  number?: string | null | undefined;
@@ -149,27 +133,39 @@ export declare const eventPayloadGenerator: {
149
133
  } | {
150
134
  country: string;
151
135
  district: string;
136
+ addressType: "DOMESTIC";
152
137
  province: string;
153
138
  urbanOrRural: "RURAL";
154
139
  village?: string | null | undefined;
140
+ } | {
141
+ country: string;
142
+ state: string;
143
+ addressType: "INTERNATIONAL";
144
+ district2: string;
145
+ cityOrTown?: string | null | undefined;
146
+ addressLine1?: string | null | undefined;
147
+ addressLine2?: string | null | undefined;
148
+ addressLine3?: string | null | undefined;
149
+ postcodeOrZip?: string | null | undefined;
155
150
  } | {
156
151
  type: string;
157
152
  option: string;
158
153
  filename: string;
159
154
  originalFilename: string;
160
- }[]>;
155
+ }[] | undefined>>;
161
156
  eventId: string;
162
157
  };
163
- validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "data">>) => {
158
+ validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "declaration" | "annotation">>) => {
164
159
  type: "VALIDATE";
165
160
  transactionId: string;
166
- data: Record<string, string | number | boolean | {
161
+ declaration: Record<string, string | number | boolean | {
167
162
  type: string;
168
163
  filename: string;
169
164
  originalFilename: string;
170
165
  } | {
171
166
  country: string;
172
167
  district: string;
168
+ addressType: "DOMESTIC";
173
169
  province: string;
174
170
  urbanOrRural: "URBAN";
175
171
  number?: string | null | undefined;
@@ -180,95 +176,73 @@ export declare const eventPayloadGenerator: {
180
176
  } | {
181
177
  country: string;
182
178
  district: string;
179
+ addressType: "DOMESTIC";
183
180
  province: string;
184
181
  urbanOrRural: "RURAL";
185
182
  village?: string | null | undefined;
183
+ } | {
184
+ country: string;
185
+ state: string;
186
+ addressType: "INTERNATIONAL";
187
+ district2: string;
188
+ cityOrTown?: string | null | undefined;
189
+ addressLine1?: string | null | undefined;
190
+ addressLine2?: string | null | undefined;
191
+ addressLine3?: string | null | undefined;
192
+ postcodeOrZip?: string | null | undefined;
186
193
  } | {
187
194
  type: string;
188
195
  option: string;
189
196
  filename: string;
190
197
  originalFilename: string;
191
- }[]>;
198
+ }[] | undefined>;
199
+ annotation: {};
192
200
  duplicates: never[];
193
201
  eventId: string;
194
202
  };
195
- archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "data">>, isDuplicate?: boolean) => {
203
+ assign: (eventId: string, input?: Partial<Pick<AssignActionInput, "transactionId" | "assignedTo">>) => {
204
+ type: "ASSIGN";
205
+ transactionId: string;
206
+ declaration: {};
207
+ assignedTo: string;
208
+ eventId: string;
209
+ };
210
+ unassign: (eventId: string, input?: Partial<Pick<UnassignActionInput, "transactionId">>) => {
211
+ type: "UNASSIGN";
212
+ transactionId: string;
213
+ declaration: {};
214
+ assignedTo: null;
215
+ eventId: string;
216
+ };
217
+ archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration">>, isDuplicate?: boolean) => {
196
218
  type: "ARCHIVE";
197
219
  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: {
220
+ declaration: {};
221
+ annotation: {
225
222
  isDuplicate: boolean;
226
223
  };
227
224
  duplicates: never[];
228
225
  eventId: string;
229
226
  };
230
- reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "data">>) => {
227
+ reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation">>) => {
231
228
  type: "REJECT";
232
229
  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
- }[]>;
230
+ declaration: {};
231
+ annotation: {};
259
232
  duplicates: never[];
260
233
  eventId: string;
261
234
  };
262
- register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "data">>) => {
235
+ register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation">>) => {
263
236
  type: "REGISTER";
264
237
  transactionId: string;
265
- data: Record<string, string | number | boolean | {
238
+ declaration: Record<string, string | number | boolean | {
266
239
  type: string;
267
240
  filename: string;
268
241
  originalFilename: string;
269
242
  } | {
270
243
  country: string;
271
244
  district: string;
245
+ addressType: "DOMESTIC";
272
246
  province: string;
273
247
  urbanOrRural: "URBAN";
274
248
  number?: string | null | undefined;
@@ -279,59 +253,48 @@ export declare const eventPayloadGenerator: {
279
253
  } | {
280
254
  country: string;
281
255
  district: string;
256
+ addressType: "DOMESTIC";
282
257
  province: string;
283
258
  urbanOrRural: "RURAL";
284
259
  village?: string | null | undefined;
260
+ } | {
261
+ country: string;
262
+ state: string;
263
+ addressType: "INTERNATIONAL";
264
+ district2: string;
265
+ cityOrTown?: string | null | undefined;
266
+ addressLine1?: string | null | undefined;
267
+ addressLine2?: string | null | undefined;
268
+ addressLine3?: string | null | undefined;
269
+ postcodeOrZip?: string | null | undefined;
285
270
  } | {
286
271
  type: string;
287
272
  option: string;
288
273
  filename: string;
289
274
  originalFilename: string;
290
- }[]>;
275
+ }[] | undefined>;
276
+ annotation: {};
291
277
  eventId: string;
292
278
  };
293
- printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "data">>) => {
279
+ printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation">>) => {
294
280
  type: "PRINT_CERTIFICATE";
295
281
  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
- }[]>;
282
+ declaration: {};
283
+ annotation: {};
322
284
  eventId: string;
323
285
  };
324
286
  correction: {
325
- request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => {
287
+ request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation">>) => {
326
288
  type: "REQUEST_CORRECTION";
327
289
  transactionId: string;
328
- data: Record<string, string | number | boolean | {
290
+ declaration: Record<string, string | number | boolean | {
329
291
  type: string;
330
292
  filename: string;
331
293
  originalFilename: string;
332
294
  } | {
333
295
  country: string;
334
296
  district: string;
297
+ addressType: "DOMESTIC";
335
298
  province: string;
336
299
  urbanOrRural: "URBAN";
337
300
  number?: string | null | undefined;
@@ -342,79 +305,42 @@ export declare const eventPayloadGenerator: {
342
305
  } | {
343
306
  country: string;
344
307
  district: string;
308
+ addressType: "DOMESTIC";
345
309
  province: string;
346
310
  urbanOrRural: "RURAL";
347
311
  village?: string | null | undefined;
312
+ } | {
313
+ country: string;
314
+ state: string;
315
+ addressType: "INTERNATIONAL";
316
+ district2: string;
317
+ cityOrTown?: string | null | undefined;
318
+ addressLine1?: string | null | undefined;
319
+ addressLine2?: string | null | undefined;
320
+ addressLine3?: string | null | undefined;
321
+ postcodeOrZip?: string | null | undefined;
348
322
  } | {
349
323
  type: string;
350
324
  option: string;
351
325
  filename: string;
352
326
  originalFilename: string;
353
- }[]>;
354
- metadata: {};
327
+ }[] | undefined>;
328
+ annotation: {};
355
329
  eventId: string;
356
330
  };
357
- approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => {
331
+ approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
358
332
  type: "APPROVE_CORRECTION";
359
333
  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
- }[]>;
334
+ declaration: {};
335
+ annotation: {};
386
336
  eventId: string;
387
337
  requestId: string;
388
338
  };
389
- reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => {
339
+ reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
390
340
  type: "REJECT_CORRECTION";
391
341
  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
- }[]>;
342
+ declaration: {};
343
+ annotation: {};
418
344
  eventId: string;
419
345
  requestId: string;
420
346
  };
@@ -430,6 +356,7 @@ export declare function generateEventDocument({ configuration, actions }: {
430
356
  configuration: EventConfig;
431
357
  actions: ActionType[];
432
358
  }): EventDocument;
433
- export declare function generateEventDraftDocument(eventId: string, actionType?: ActionType, data?: Record<string, FieldValue>): Draft;
359
+ export declare function generateEventDraftDocument(eventId: string, actionType?: ActionType, declaration?: Record<string, FieldValue>): Draft;
434
360
  export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>) => EventIndex;
361
+ export declare const generateTranslationConfig: (message: string) => TranslationConfig;
435
362
  //# sourceMappingURL=test.utils.d.ts.map