@opencrvs/toolkit 1.8.0-rc.f7e8fb5 → 1.8.0-rc.f876361

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