@opencrvs/toolkit 1.8.0-rc.fd8a78f → 1.8.0-rc.fd936ab

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/dist/commons/api/router.d.ts +447 -14227
  2. package/dist/commons/conditionals/conditionals.d.ts +6 -14
  3. package/dist/commons/conditionals/validate.d.ts +6 -10
  4. package/dist/commons/events/ActionConfig.d.ts +1726 -117415
  5. package/dist/commons/events/ActionDocument.d.ts +383 -2305
  6. package/dist/commons/events/ActionInput.d.ts +303 -1583
  7. package/dist/commons/events/ActionType.d.ts +0 -4
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +22 -1029
  9. package/dist/commons/events/CompositeFieldValue.d.ts +0 -31
  10. package/dist/commons/events/Draft.d.ts +29 -143
  11. package/dist/commons/events/EventConfig.d.ts +1361 -56376
  12. package/dist/commons/events/EventDocument.d.ts +264 -1428
  13. package/dist/commons/events/EventIndex.d.ts +25 -1590
  14. package/dist/commons/events/EventMetadata.d.ts +43 -299
  15. package/dist/commons/events/FieldConfig.d.ts +1060 -5458
  16. package/dist/commons/events/FieldType.d.ts +3 -6
  17. package/dist/commons/events/FieldTypeMapping.d.ts +54 -103
  18. package/dist/commons/events/FieldValue.d.ts +8 -49
  19. package/dist/commons/events/FormConfig.d.ts +524 -49166
  20. package/dist/commons/events/PageConfig.d.ts +208 -12210
  21. package/dist/commons/events/SummaryConfig.d.ts +42 -93
  22. package/dist/commons/events/User.d.ts +2 -31
  23. package/dist/commons/events/WorkqueueConfig.d.ts +20 -4803
  24. package/dist/commons/events/defineConfig.d.ts +75 -9010
  25. package/dist/commons/events/index.d.ts +0 -8
  26. package/dist/commons/events/test.utils.d.ts +78 -147
  27. package/dist/commons/events/utils.d.ts +68 -13352
  28. package/dist/conditionals/index.js +36 -76
  29. package/dist/events/index.js +1504 -3807
  30. package/dist/scopes/index.d.ts +6 -94
  31. package/dist/scopes/index.js +21 -42
  32. package/package.json +2 -3
  33. package/dist/commons/events/Constants.d.ts +0 -3
  34. package/dist/commons/events/CountryConfigQueryInput.d.ts +0 -2982
  35. package/dist/commons/events/CreatedAtLocation.d.ts +0 -3
  36. package/dist/commons/events/WorkqueueColumnConfig.d.ts +0 -53
  37. package/dist/commons/events/event.d.ts +0 -54
  38. package/dist/commons/events/field.d.ts +0 -77
  39. package/dist/commons/events/scopes.d.ts +0 -45
  40. package/dist/commons/events/serializer.d.ts +0 -2
  41. package/dist/commons/events/workqueueDefaultColumns.d.ts +0 -3
@@ -1,4 +1,3 @@
1
- export * from './Constants';
2
1
  export * from './ActionConfig';
3
2
  export * from './offline';
4
3
  export * from './EventConfig';
@@ -7,8 +6,6 @@ export * from './FieldConfig';
7
6
  export * from './PageConfig';
8
7
  export * from './SummaryConfig';
9
8
  export * from './WorkqueueConfig';
10
- export * from './WorkqueueColumnConfig';
11
- export * from './workqueueDefaultColumns';
12
9
  export * from './Draft';
13
10
  export * from './EventMetadata';
14
11
  export * from './EventInput';
@@ -33,11 +30,6 @@ export * from './Conditional';
33
30
  export * from './AdvancedSearchConfig';
34
31
  export * from './test.utils';
35
32
  export * from './TemplateConfig';
36
- export * from './scopes';
37
- export * from './serializer';
38
- export * from './state/availableActions';
39
33
  export * from '../conditionals/conditionals';
40
34
  export * from '../conditionals/validate';
41
- export * from './field';
42
- export * from './event';
43
35
  //# sourceMappingURL=index.d.ts.map
@@ -1,26 +1,53 @@
1
- import { ActionDocument, EventState } from './ActionDocument';
2
- import { ArchiveActionInput, AssignActionInput, DeclareActionInput, NotifyActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnassignActionInput, 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';
6
6
  import { EventDocument } from './EventDocument';
7
7
  import { EventIndex } from './EventIndex';
8
8
  import { EventInput } from './EventInput';
9
- import { TranslationConfig } from './TranslationConfig';
10
- import { FieldConfig } from './FieldConfig';
11
- import { WorkqueueConfig } from './WorkqueueConfig';
12
9
  import { FieldValue } from './FieldValue';
13
- export declare function generateRandomName(rng: () => number): {
14
- firstname: string;
15
- surname: string;
16
- };
17
- /**
18
- * Quick-and-dirty mock data generator for event actions.
19
- */
20
- export declare function mapFieldTypeToMockValue(field: FieldConfig, i: number, rng: () => number): FieldValue;
21
- export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType, rng: () => number): EventState;
22
- export declare function generateActionAnnotationInput(configuration: EventConfig, action: ActionType, rng: () => number): {};
23
- export declare function eventPayloadGenerator(rng: () => number): {
10
+ import { TranslationConfig } from './TranslationConfig';
11
+ export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType): import("lodash").Dictionary<string | number | boolean | {
12
+ type: string;
13
+ filename: string;
14
+ originalFilename: string;
15
+ } | {
16
+ country: string;
17
+ district: string;
18
+ addressType: "DOMESTIC";
19
+ province: string;
20
+ urbanOrRural: "URBAN";
21
+ number?: string | undefined;
22
+ town?: string | undefined;
23
+ residentialArea?: string | undefined;
24
+ street?: string | undefined;
25
+ zipCode?: string | undefined;
26
+ } | {
27
+ country: string;
28
+ district: string;
29
+ addressType: "DOMESTIC";
30
+ province: string;
31
+ urbanOrRural: "RURAL";
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;
43
+ } | {
44
+ type: string;
45
+ option: string;
46
+ filename: string;
47
+ originalFilename: string;
48
+ }[] | undefined>;
49
+ export declare function generateActionAnnotationInput(configuration: EventConfig, action: ActionType): {};
50
+ export declare const eventPayloadGenerator: {
24
51
  create: (input?: Partial<EventInput>) => {
25
52
  transactionId: string;
26
53
  type: string;
@@ -35,7 +62,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
35
62
  actionType: ActionType;
36
63
  }, input?: Partial<Draft>) => Draft;
37
64
  actions: {
38
- declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
65
+ declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation">>) => {
66
+ type: "DECLARE";
39
67
  transactionId: string;
40
68
  declaration: Record<string, string | number | boolean | {
41
69
  type: string;
@@ -52,10 +80,6 @@ export declare function eventPayloadGenerator(rng: () => number): {
52
80
  residentialArea?: string | null | undefined;
53
81
  street?: string | null | undefined;
54
82
  zipCode?: string | null | undefined;
55
- } | {
56
- firstname: string;
57
- surname: string;
58
- middlename?: string | null | undefined;
59
83
  } | {
60
84
  country: string;
61
85
  district: string;
@@ -78,19 +102,20 @@ export declare function eventPayloadGenerator(rng: () => number): {
78
102
  option: string;
79
103
  filename: string;
80
104
  originalFilename: string;
81
- }[] | [string, string] | null | undefined>;
105
+ }[] | undefined>;
82
106
  annotation: {};
83
- keepAssignment?: boolean | undefined;
84
- type: "DECLARE";
85
107
  eventId: string;
86
108
  };
87
109
  /**
88
110
  * Notify allows sending incomplete data. Think it as 'partial declare' for now.
89
111
  */
90
- notify: (eventId: string, input?: Partial<Pick<NotifyActionInput, "transactionId" | "declaration" | "keepAssignment">>) => {
112
+ notify: (eventId: string, input?: {
113
+ transactionId?: string;
114
+ declaration?: Partial<ActionUpdate>;
115
+ }) => {
91
116
  type: "NOTIFY";
92
117
  transactionId: string;
93
- declaration: Record<string, string | number | boolean | {
118
+ declaration: Partial<Record<string, string | number | boolean | {
94
119
  type: string;
95
120
  filename: string;
96
121
  originalFilename: string;
@@ -105,10 +130,6 @@ export declare function eventPayloadGenerator(rng: () => number): {
105
130
  residentialArea?: string | null | undefined;
106
131
  street?: string | null | undefined;
107
132
  zipCode?: string | null | undefined;
108
- } | {
109
- firstname: string;
110
- surname: string;
111
- middlename?: string | null | undefined;
112
133
  } | {
113
134
  country: string;
114
135
  district: string;
@@ -131,11 +152,11 @@ export declare function eventPayloadGenerator(rng: () => number): {
131
152
  option: string;
132
153
  filename: string;
133
154
  originalFilename: string;
134
- }[] | [string, string] | null | undefined>;
155
+ }[] | undefined>>;
135
156
  eventId: string;
136
- keepAssignment: boolean | undefined;
137
157
  };
138
- validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
158
+ validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "declaration" | "annotation">>) => {
159
+ type: "VALIDATE";
139
160
  transactionId: string;
140
161
  declaration: Record<string, string | number | boolean | {
141
162
  type: string;
@@ -152,10 +173,6 @@ export declare function eventPayloadGenerator(rng: () => number): {
152
173
  residentialArea?: string | null | undefined;
153
174
  street?: string | null | undefined;
154
175
  zipCode?: string | null | undefined;
155
- } | {
156
- firstname: string;
157
- surname: string;
158
- middlename?: string | null | undefined;
159
176
  } | {
160
177
  country: string;
161
178
  district: string;
@@ -178,10 +195,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
178
195
  option: string;
179
196
  filename: string;
180
197
  originalFilename: string;
181
- }[] | [string, string] | null | undefined>;
198
+ }[] | undefined>;
182
199
  annotation: {};
183
- keepAssignment?: boolean | undefined;
184
- type: "VALIDATE";
185
200
  duplicates: never[];
186
201
  eventId: string;
187
202
  };
@@ -199,73 +214,26 @@ export declare function eventPayloadGenerator(rng: () => number): {
199
214
  assignedTo: null;
200
215
  eventId: string;
201
216
  };
202
- archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration" | "keepAssignment">>, isDuplicate?: boolean) => {
203
- transactionId: string;
204
- declaration: Record<string, string | number | boolean | {
205
- type: string;
206
- filename: string;
207
- originalFilename: string;
208
- } | {
209
- country: string;
210
- district: string;
211
- addressType: "DOMESTIC";
212
- province: string;
213
- urbanOrRural: "URBAN";
214
- number?: string | null | undefined;
215
- town?: string | null | undefined;
216
- residentialArea?: string | null | undefined;
217
- street?: string | null | undefined;
218
- zipCode?: string | null | undefined;
219
- } | {
220
- firstname: string;
221
- surname: string;
222
- middlename?: string | null | undefined;
223
- } | {
224
- country: string;
225
- district: string;
226
- addressType: "DOMESTIC";
227
- province: string;
228
- urbanOrRural: "RURAL";
229
- village?: string | null | undefined;
230
- } | {
231
- country: string;
232
- state: string;
233
- addressType: "INTERNATIONAL";
234
- district2: string;
235
- cityOrTown?: string | null | undefined;
236
- addressLine1?: string | null | undefined;
237
- addressLine2?: string | null | undefined;
238
- addressLine3?: string | null | undefined;
239
- postcodeOrZip?: string | null | undefined;
240
- } | {
241
- type: string;
242
- option: string;
243
- filename: string;
244
- originalFilename: string;
245
- }[] | [string, string] | null | undefined>;
246
- keepAssignment?: boolean | undefined;
217
+ archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration">>, isDuplicate?: boolean) => {
247
218
  type: "ARCHIVE";
248
- annotation: {};
249
- duplicates: never[];
250
- eventId: string;
251
- reason: {
252
- message: string;
219
+ transactionId: string;
220
+ declaration: {};
221
+ annotation: {
253
222
  isDuplicate: boolean;
254
223
  };
224
+ duplicates: never[];
225
+ eventId: string;
255
226
  };
256
- reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
257
- transactionId: string;
258
- annotation: {};
259
- keepAssignment?: boolean | undefined;
227
+ reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation">>) => {
260
228
  type: "REJECT";
229
+ transactionId: string;
261
230
  declaration: {};
231
+ annotation: {};
262
232
  duplicates: never[];
263
233
  eventId: string;
264
- reason: {
265
- message: string;
266
- };
267
234
  };
268
- register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
235
+ register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation">>) => {
236
+ type: "REGISTER";
269
237
  transactionId: string;
270
238
  declaration: Record<string, string | number | boolean | {
271
239
  type: string;
@@ -282,10 +250,6 @@ export declare function eventPayloadGenerator(rng: () => number): {
282
250
  residentialArea?: string | null | undefined;
283
251
  street?: string | null | undefined;
284
252
  zipCode?: string | null | undefined;
285
- } | {
286
- firstname: string;
287
- surname: string;
288
- middlename?: string | null | undefined;
289
253
  } | {
290
254
  country: string;
291
255
  district: string;
@@ -308,22 +272,19 @@ export declare function eventPayloadGenerator(rng: () => number): {
308
272
  option: string;
309
273
  filename: string;
310
274
  originalFilename: string;
311
- }[] | [string, string] | null | undefined>;
275
+ }[] | undefined>;
312
276
  annotation: {};
313
- keepAssignment?: boolean | undefined;
314
- type: "REGISTER";
315
277
  eventId: string;
316
278
  };
317
- printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
318
- transactionId: string;
319
- annotation: {};
320
- keepAssignment?: boolean | undefined;
279
+ printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation">>) => {
321
280
  type: "PRINT_CERTIFICATE";
281
+ transactionId: string;
322
282
  declaration: {};
283
+ annotation: {};
323
284
  eventId: string;
324
285
  };
325
286
  correction: {
326
- request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
287
+ request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation">>) => {
327
288
  type: "REQUEST_CORRECTION";
328
289
  transactionId: string;
329
290
  declaration: Record<string, string | number | boolean | {
@@ -341,10 +302,6 @@ export declare function eventPayloadGenerator(rng: () => number): {
341
302
  residentialArea?: string | null | undefined;
342
303
  street?: string | null | undefined;
343
304
  zipCode?: string | null | undefined;
344
- } | {
345
- firstname: string;
346
- surname: string;
347
- middlename?: string | null | undefined;
348
305
  } | {
349
306
  country: string;
350
307
  district: string;
@@ -367,65 +324,39 @@ export declare function eventPayloadGenerator(rng: () => number): {
367
324
  option: string;
368
325
  filename: string;
369
326
  originalFilename: string;
370
- }[] | [string, string] | null | undefined>;
327
+ }[] | undefined>;
371
328
  annotation: {};
372
329
  eventId: string;
373
- keepAssignment: boolean | undefined;
374
330
  };
375
- approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
331
+ approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
376
332
  type: "APPROVE_CORRECTION";
377
333
  transactionId: string;
378
334
  declaration: {};
379
335
  annotation: {};
380
336
  eventId: string;
381
337
  requestId: string;
382
- keepAssignment: boolean | undefined;
383
338
  };
384
- reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
339
+ reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
385
340
  type: "REJECT_CORRECTION";
386
341
  transactionId: string;
387
342
  declaration: {};
388
343
  annotation: {};
389
344
  eventId: string;
390
345
  requestId: string;
391
- keepAssignment: boolean | undefined;
392
346
  };
393
347
  };
394
348
  };
395
349
  };
396
- export declare function generateActionDocument({ configuration, action, rng, defaults }: {
350
+ export declare function generateActionDocument({ configuration, action, defaults }: {
397
351
  configuration: EventConfig;
398
352
  action: ActionType;
399
- rng?: () => number;
400
353
  defaults?: Partial<ActionDocument>;
401
354
  }): ActionDocument;
402
- export declare function generateEventDocument({ configuration, actions, rng }: {
355
+ export declare function generateEventDocument({ configuration, actions }: {
403
356
  configuration: EventConfig;
404
357
  actions: ActionType[];
405
- rng?: () => number;
406
358
  }): EventDocument;
407
- export declare function generateEventDraftDocument({ eventId, actionType, rng, declaration }: {
408
- eventId: string;
409
- actionType: ActionType;
410
- rng?: () => number;
411
- declaration?: EventState;
412
- }): Draft;
413
- export declare function getRandomDatetime(rng: () => number, start: Date, end: Date): string;
414
- export declare function getRandomDate(rng: () => number, start: string, end: string): string;
415
- /**
416
- * Useful for testing when we need deterministic outcome.
417
- * @param seed - Seed value for the pseudo-random number generator
418
- *
419
- * @returns A function that generates pseudo-random numbers between 0 and 1 [0, 1)
420
- */
421
- export declare function createPrng(seed: number): () => number;
422
- export declare function generateRandomSignature(rng: () => number): string;
423
- export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>, seed?: number) => EventIndex;
359
+ export declare function generateEventDraftDocument(eventId: string, actionType?: ActionType, declaration?: Record<string, FieldValue>): Draft;
360
+ export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>) => EventIndex;
424
361
  export declare const generateTranslationConfig: (message: string) => TranslationConfig;
425
- export declare const BearerTokenByUserType: {
426
- fieldAgent: string;
427
- registrationAgent: string;
428
- localRegistrar: string;
429
- };
430
- export declare const generateWorkqueues: (slug?: string) => WorkqueueConfig[];
431
362
  //# sourceMappingURL=test.utils.d.ts.map