@opencrvs/toolkit 1.8.0-rc.fa49ae3 → 1.8.0-rc.fa564ca

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 (31) hide show
  1. package/dist/commons/api/router.d.ts +381 -6649
  2. package/dist/commons/conditionals/conditionals.d.ts +0 -4
  3. package/dist/commons/conditionals/validate.d.ts +0 -6
  4. package/dist/commons/events/ActionConfig.d.ts +6326 -18678
  5. package/dist/commons/events/ActionDocument.d.ts +204 -1713
  6. package/dist/commons/events/ActionInput.d.ts +180 -1380
  7. package/dist/commons/events/AdvancedSearchConfig.d.ts +3 -75
  8. package/dist/commons/events/CompositeFieldValue.d.ts +0 -28
  9. package/dist/commons/events/Constants.d.ts +0 -1
  10. package/dist/commons/events/CountryConfigQueryInput.d.ts +0 -26
  11. package/dist/commons/events/Draft.d.ts +16 -117
  12. package/dist/commons/events/EventConfig.d.ts +2487 -8364
  13. package/dist/commons/events/EventDocument.d.ts +152 -1096
  14. package/dist/commons/events/EventIndex.d.ts +17 -283
  15. package/dist/commons/events/EventMetadata.d.ts +35 -38
  16. package/dist/commons/events/FieldConfig.d.ts +771 -1597
  17. package/dist/commons/events/FieldType.d.ts +1 -4
  18. package/dist/commons/events/FieldTypeMapping.d.ts +50 -89
  19. package/dist/commons/events/FieldValue.d.ts +5 -41
  20. package/dist/commons/events/FormConfig.d.ts +2444 -7640
  21. package/dist/commons/events/PageConfig.d.ts +1620 -2896
  22. package/dist/commons/events/SummaryConfig.d.ts +5 -0
  23. package/dist/commons/events/WorkqueueColumnConfig.d.ts +11 -11
  24. package/dist/commons/events/WorkqueueConfig.d.ts +24 -346
  25. package/dist/commons/events/defineConfig.d.ts +14 -960
  26. package/dist/commons/events/field.d.ts +0 -4
  27. package/dist/commons/events/test.utils.d.ts +38 -124
  28. package/dist/commons/events/utils.d.ts +8 -9659
  29. package/dist/conditionals/index.js +1 -18
  30. package/dist/events/index.js +413 -691
  31. package/package.json +1 -1
@@ -69,9 +69,5 @@ export declare function field(fieldId: string, options?: {
69
69
  isValidEnglishName: () => import("../conditionals/conditionals").JSONSchema;
70
70
  matches: (pattern: string) => import("../conditionals/conditionals").JSONSchema;
71
71
  isBetween: (min: number, max: number) => import("../conditionals/conditionals").JSONSchema;
72
- getId: () => {
73
- fieldId: string;
74
- };
75
- object: (options: Record<string, any>) => import("../conditionals/conditionals").JSONSchema;
76
72
  };
77
73
  //# sourceMappingURL=field.d.ts.map
@@ -1,5 +1,5 @@
1
- import { ActionDocument, EventState } from './ActionDocument';
2
- import { ArchiveActionInput, AssignActionInput, DeclareActionInput, NotifyActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnassignActionInput, ValidateActionInput } from './ActionInput';
1
+ import { ActionDocument, ActionUpdate, EventState } 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,20 +7,10 @@ import { EventDocument } from './EventDocument';
7
7
  import { EventIndex } from './EventIndex';
8
8
  import { EventInput } from './EventInput';
9
9
  import { TranslationConfig } from './TranslationConfig';
10
- import { FieldConfig } from './FieldConfig';
11
10
  import { WorkqueueConfig } from './WorkqueueConfig';
12
- 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): {
11
+ export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType): EventState;
12
+ export declare function generateActionAnnotationInput(configuration: EventConfig, action: ActionType): {};
13
+ export declare const eventPayloadGenerator: {
24
14
  create: (input?: Partial<EventInput>) => {
25
15
  transactionId: string;
26
16
  type: string;
@@ -35,7 +25,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
35
25
  actionType: ActionType;
36
26
  }, input?: Partial<Draft>) => Draft;
37
27
  actions: {
38
- declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
28
+ declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation">>) => {
29
+ type: "DECLARE";
39
30
  transactionId: string;
40
31
  declaration: Record<string, string | number | boolean | {
41
32
  type: string;
@@ -52,10 +43,6 @@ export declare function eventPayloadGenerator(rng: () => number): {
52
43
  residentialArea?: string | null | undefined;
53
44
  street?: string | null | undefined;
54
45
  zipCode?: string | null | undefined;
55
- } | {
56
- firstname: string;
57
- surname: string;
58
- middlename?: string | null | undefined;
59
46
  } | {
60
47
  country: string;
61
48
  district: string;
@@ -78,19 +65,20 @@ export declare function eventPayloadGenerator(rng: () => number): {
78
65
  option: string;
79
66
  filename: string;
80
67
  originalFilename: string;
81
- }[] | [string, string] | null | undefined>;
68
+ }[] | [string, string] | undefined>;
82
69
  annotation: {};
83
- keepAssignment?: boolean | undefined;
84
- type: "DECLARE";
85
70
  eventId: string;
86
71
  };
87
72
  /**
88
73
  * Notify allows sending incomplete data. Think it as 'partial declare' for now.
89
74
  */
90
- notify: (eventId: string, input?: Partial<Pick<NotifyActionInput, "transactionId" | "declaration" | "keepAssignment">>) => {
75
+ notify: (eventId: string, input?: {
76
+ transactionId?: string;
77
+ declaration?: Partial<ActionUpdate>;
78
+ }) => {
91
79
  type: "NOTIFY";
92
80
  transactionId: string;
93
- declaration: Record<string, string | number | boolean | {
81
+ declaration: Partial<Record<string, string | number | boolean | {
94
82
  type: string;
95
83
  filename: string;
96
84
  originalFilename: string;
@@ -105,10 +93,6 @@ export declare function eventPayloadGenerator(rng: () => number): {
105
93
  residentialArea?: string | null | undefined;
106
94
  street?: string | null | undefined;
107
95
  zipCode?: string | null | undefined;
108
- } | {
109
- firstname: string;
110
- surname: string;
111
- middlename?: string | null | undefined;
112
96
  } | {
113
97
  country: string;
114
98
  district: string;
@@ -131,11 +115,11 @@ export declare function eventPayloadGenerator(rng: () => number): {
131
115
  option: string;
132
116
  filename: string;
133
117
  originalFilename: string;
134
- }[] | [string, string] | null | undefined>;
118
+ }[] | [string, string] | undefined>>;
135
119
  eventId: string;
136
- keepAssignment: boolean | undefined;
137
120
  };
138
- validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
121
+ validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "declaration" | "annotation">>) => {
122
+ type: "VALIDATE";
139
123
  transactionId: string;
140
124
  declaration: Record<string, string | number | boolean | {
141
125
  type: string;
@@ -152,10 +136,6 @@ export declare function eventPayloadGenerator(rng: () => number): {
152
136
  residentialArea?: string | null | undefined;
153
137
  street?: string | null | undefined;
154
138
  zipCode?: string | null | undefined;
155
- } | {
156
- firstname: string;
157
- surname: string;
158
- middlename?: string | null | undefined;
159
139
  } | {
160
140
  country: string;
161
141
  district: string;
@@ -178,10 +158,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
178
158
  option: string;
179
159
  filename: string;
180
160
  originalFilename: string;
181
- }[] | [string, string] | null | undefined>;
161
+ }[] | [string, string] | undefined>;
182
162
  annotation: {};
183
- keepAssignment?: boolean | undefined;
184
- type: "VALIDATE";
185
163
  duplicates: never[];
186
164
  eventId: string;
187
165
  };
@@ -199,52 +177,10 @@ export declare function eventPayloadGenerator(rng: () => number): {
199
177
  assignedTo: null;
200
178
  eventId: string;
201
179
  };
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;
180
+ archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration">>, isDuplicate?: boolean) => {
247
181
  type: "ARCHIVE";
182
+ transactionId: string;
183
+ declaration: {};
248
184
  annotation: {};
249
185
  duplicates: never[];
250
186
  eventId: string;
@@ -253,19 +189,19 @@ export declare function eventPayloadGenerator(rng: () => number): {
253
189
  isDuplicate: boolean;
254
190
  };
255
191
  };
256
- reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
257
- transactionId: string;
258
- annotation: {};
259
- keepAssignment?: boolean | undefined;
192
+ reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation">>) => {
260
193
  type: "REJECT";
194
+ transactionId: string;
261
195
  declaration: {};
196
+ annotation: {};
262
197
  duplicates: never[];
263
198
  eventId: string;
264
199
  reason: {
265
200
  message: string;
266
201
  };
267
202
  };
268
- register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
203
+ register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation">>) => {
204
+ type: "REGISTER";
269
205
  transactionId: string;
270
206
  declaration: Record<string, string | number | boolean | {
271
207
  type: string;
@@ -282,10 +218,6 @@ export declare function eventPayloadGenerator(rng: () => number): {
282
218
  residentialArea?: string | null | undefined;
283
219
  street?: string | null | undefined;
284
220
  zipCode?: string | null | undefined;
285
- } | {
286
- firstname: string;
287
- surname: string;
288
- middlename?: string | null | undefined;
289
221
  } | {
290
222
  country: string;
291
223
  district: string;
@@ -308,22 +240,19 @@ export declare function eventPayloadGenerator(rng: () => number): {
308
240
  option: string;
309
241
  filename: string;
310
242
  originalFilename: string;
311
- }[] | [string, string] | null | undefined>;
243
+ }[] | [string, string] | undefined>;
312
244
  annotation: {};
313
- keepAssignment?: boolean | undefined;
314
- type: "REGISTER";
315
245
  eventId: string;
316
246
  };
317
- printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
318
- transactionId: string;
319
- annotation: {};
320
- keepAssignment?: boolean | undefined;
247
+ printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation">>) => {
321
248
  type: "PRINT_CERTIFICATE";
249
+ transactionId: string;
322
250
  declaration: {};
251
+ annotation: {};
323
252
  eventId: string;
324
253
  };
325
254
  correction: {
326
- request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
255
+ request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation">>) => {
327
256
  type: "REQUEST_CORRECTION";
328
257
  transactionId: string;
329
258
  declaration: Record<string, string | number | boolean | {
@@ -341,10 +270,6 @@ export declare function eventPayloadGenerator(rng: () => number): {
341
270
  residentialArea?: string | null | undefined;
342
271
  street?: string | null | undefined;
343
272
  zipCode?: string | null | undefined;
344
- } | {
345
- firstname: string;
346
- surname: string;
347
- middlename?: string | null | undefined;
348
273
  } | {
349
274
  country: string;
350
275
  district: string;
@@ -367,58 +292,47 @@ export declare function eventPayloadGenerator(rng: () => number): {
367
292
  option: string;
368
293
  filename: string;
369
294
  originalFilename: string;
370
- }[] | [string, string] | null | undefined>;
295
+ }[] | [string, string] | undefined>;
371
296
  annotation: {};
372
297
  eventId: string;
373
- keepAssignment: boolean | undefined;
374
298
  };
375
- approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
299
+ approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
376
300
  type: "APPROVE_CORRECTION";
377
301
  transactionId: string;
378
302
  declaration: {};
379
303
  annotation: {};
380
304
  eventId: string;
381
305
  requestId: string;
382
- keepAssignment: boolean | undefined;
383
306
  };
384
- reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
307
+ reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
385
308
  type: "REJECT_CORRECTION";
386
309
  transactionId: string;
387
310
  declaration: {};
388
311
  annotation: {};
389
312
  eventId: string;
390
313
  requestId: string;
391
- keepAssignment: boolean | undefined;
392
314
  };
393
315
  };
394
316
  };
395
317
  };
396
- export declare function generateActionDocument({ configuration, action, rng, defaults }: {
318
+ export declare function generateActionDocument({ configuration, action, defaults }: {
397
319
  configuration: EventConfig;
398
320
  action: ActionType;
399
- rng?: () => number;
400
321
  defaults?: Partial<ActionDocument>;
401
322
  }): ActionDocument;
402
- export declare function generateEventDocument({ configuration, actions, rng }: {
323
+ export declare function generateEventDocument({ configuration, actions }: {
403
324
  configuration: EventConfig;
404
325
  actions: ActionType[];
405
- rng?: () => number;
406
326
  }): EventDocument;
407
- export declare function generateEventDraftDocument({ eventId, actionType, rng, declaration }: {
408
- eventId: string;
409
- actionType: ActionType;
410
- rng?: () => number;
411
- declaration?: EventState;
412
- }): Draft;
327
+ export declare function generateEventDraftDocument(eventId: string, actionType?: ActionType, declaration?: EventState): Draft;
413
328
  export declare function getRandomDatetime(rng: () => number, start: Date, end: Date): string;
414
- export declare function getRandomDate(rng: () => number, start: string, end: string): string;
415
329
  /**
416
330
  * Useful for testing when we need deterministic outcome.
417
331
  * @param seed - Seed value for the pseudo-random number generator
418
332
  *
419
- * @returns A function that generates pseudo-random numbers between 0 and 1 [0, 1)
333
+ * @returns A function that generates pseudo-random numbers between 0 and 1
420
334
  */
421
- export declare function createPrng(seed: number): () => number;
335
+ export declare function createPseudoRandomNumberGenerator(seed: number): () => number;
422
336
  export declare function generateRandomSignature(rng: () => number): string;
423
337
  export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>, seed?: number) => EventIndex;
424
338
  export declare const generateTranslationConfig: (message: string) => TranslationConfig;