@opencrvs/toolkit 1.8.0-rc.fc43738 → 1.8.0-rc.fcf46fc

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