@opencrvs/toolkit 1.8.1-rc.8c25e85 → 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 (42) hide show
  1. package/dist/commons/api/router.d.ts +5078 -5910
  2. package/dist/commons/conditionals/conditionals.d.ts +13 -9
  3. package/dist/commons/conditionals/validate.d.ts +6 -15
  4. package/dist/commons/events/ActionConfig.d.ts +1718 -119315
  5. package/dist/commons/events/ActionDocument.d.ts +1325 -4879
  6. package/dist/commons/events/ActionInput.d.ts +1025 -3205
  7. package/dist/commons/events/ActionType.d.ts +1 -10
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +22 -1282
  9. package/dist/commons/events/CompositeFieldValue.d.ts +9 -40
  10. package/dist/commons/events/Draft.d.ts +97 -288
  11. package/dist/commons/events/EventConfig.d.ts +1359 -54365
  12. package/dist/commons/events/EventDocument.d.ts +833 -2720
  13. package/dist/commons/events/EventIndex.d.ts +29 -2228
  14. package/dist/commons/events/EventMetadata.d.ts +47 -347
  15. package/dist/commons/events/FieldConfig.d.ts +1250 -6746
  16. package/dist/commons/events/FieldType.d.ts +3 -8
  17. package/dist/commons/events/FieldTypeMapping.d.ts +73 -161
  18. package/dist/commons/events/FieldValue.d.ts +20 -91
  19. package/dist/commons/events/FormConfig.d.ts +533 -55781
  20. package/dist/commons/events/PageConfig.d.ts +208 -13824
  21. package/dist/commons/events/SummaryConfig.d.ts +42 -93
  22. package/dist/commons/events/User.d.ts +2 -34
  23. package/dist/commons/events/WorkqueueConfig.d.ts +20 -8116
  24. package/dist/commons/events/defineConfig.d.ts +99 -8551
  25. package/dist/commons/events/index.d.ts +0 -8
  26. package/dist/commons/events/test.utils.d.ts +90 -206
  27. package/dist/commons/events/transactions.d.ts +1 -1
  28. package/dist/commons/events/utils.d.ts +94 -15442
  29. package/dist/conditionals/index.js +56 -66
  30. package/dist/events/index.js +1835 -4707
  31. package/dist/scopes/index.d.ts +7 -184
  32. package/dist/scopes/index.js +40 -140
  33. package/package.json +3 -4
  34. package/dist/commons/events/Constants.d.ts +0 -3
  35. package/dist/commons/events/CountryConfigQueryInput.d.ts +0 -4132
  36. package/dist/commons/events/CreatedAtLocation.d.ts +0 -2
  37. package/dist/commons/events/WorkqueueColumnConfig.d.ts +0 -53
  38. package/dist/commons/events/event.d.ts +0 -46
  39. package/dist/commons/events/field.d.ts +0 -94
  40. package/dist/commons/events/scopes.d.ts +0 -45
  41. package/dist/commons/events/serializer.d.ts +0 -2
  42. 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,39 +1,53 @@
1
- import { UUID } from '../uuid';
2
- import { ActionDocument, EventState } from './ActionDocument';
3
- import { ApproveCorrectionActionInput, ArchiveActionInput, AssignActionInput, DeclareActionInput, NotifyActionInput, RegisterActionInput, RejectCorrectionActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnassignActionInput, ValidateActionInput } from './ActionInput';
1
+ import { ActionDocument, ActionUpdate } from './ActionDocument';
2
+ import { ArchiveActionInput, AssignActionInput, DeclareActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnassignActionInput, ValidateActionInput } from './ActionInput';
4
3
  import { ActionType } from './ActionType';
5
4
  import { Draft } from './Draft';
6
5
  import { EventConfig } from './EventConfig';
7
6
  import { EventDocument } from './EventDocument';
8
7
  import { EventIndex } from './EventIndex';
9
8
  import { EventInput } from './EventInput';
10
- import { TranslationConfig } from './TranslationConfig';
11
- import { FieldConfig } from './FieldConfig';
12
- import { WorkqueueConfig } from './WorkqueueConfig';
13
9
  import { FieldValue } from './FieldValue';
14
- import { z } from 'zod';
15
- /**
16
- * IANA timezone used in testing. Used for queries that expect similar results independent of the users location (e.g. when event was registered.)
17
- * Since we query by range, providing UTC offset will result to different results when DST changes during the range.
18
- */
19
- export declare const TEST_SYSTEM_IANA_TIMEZONE = "Asia/Dhaka";
20
- /**
21
- * In real application, the roles are defined in the countryconfig.
22
- * These are just for testing purposes to generate realistic mock data.
23
- */
24
- export declare const TestUserRole: z.ZodEnum<["FIELD_AGENT", "LOCAL_REGISTRAR", "LOCAL_SYSTEM_ADMIN", "NATIONAL_REGISTRAR", "REGISTRATION_AGENT"]>;
25
- export type TestUserRole = z.infer<typeof TestUserRole>;
26
- export declare function generateRandomName(rng: () => number): {
27
- firstname: string;
28
- surname: string;
29
- };
30
- /**
31
- * Quick-and-dirty mock data generator for event actions.
32
- */
33
- export declare function mapFieldTypeToMockValue(field: FieldConfig, i: number, rng: () => number): FieldValue;
34
- export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType, rng: () => number): EventState;
35
- export declare function generateActionAnnotationInput(configuration: EventConfig, action: ActionType, rng: () => number): {};
36
- 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: {
37
51
  create: (input?: Partial<EventInput>) => {
38
52
  transactionId: string;
39
53
  type: string;
@@ -43,17 +57,17 @@ export declare function eventPayloadGenerator(rng: () => number): {
43
57
  type: string;
44
58
  id: string;
45
59
  };
46
- draft: ({ eventId, actionType, annotation }: {
47
- eventId: UUID;
60
+ draft: ({ eventId, actionType }: {
61
+ eventId: string;
48
62
  actionType: ActionType;
49
- annotation?: Record<string, any>;
50
63
  }, input?: Partial<Draft>) => Draft;
51
64
  actions: {
52
- 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";
53
67
  transactionId: string;
54
68
  declaration: Record<string, string | number | boolean | {
55
69
  type: string;
56
- path: string;
70
+ filename: string;
57
71
  originalFilename: string;
58
72
  } | {
59
73
  country: string;
@@ -66,10 +80,6 @@ export declare function eventPayloadGenerator(rng: () => number): {
66
80
  residentialArea?: string | null | undefined;
67
81
  street?: string | null | undefined;
68
82
  zipCode?: string | null | undefined;
69
- } | {
70
- firstname?: string | null | undefined;
71
- surname?: string | null | undefined;
72
- middlename?: string | null | undefined;
73
83
  } | {
74
84
  country: string;
75
85
  district: string;
@@ -90,26 +100,24 @@ export declare function eventPayloadGenerator(rng: () => number): {
90
100
  } | {
91
101
  type: string;
92
102
  option: string;
93
- path: string;
103
+ filename: string;
94
104
  originalFilename: string;
95
- }[] | {
96
- start: string;
97
- end: string;
98
- } | null | undefined>;
105
+ }[] | undefined>;
99
106
  annotation: {};
100
- keepAssignment?: boolean | undefined;
101
- type: "DECLARE";
102
107
  eventId: string;
103
108
  };
104
109
  /**
105
110
  * Notify allows sending incomplete data. Think it as 'partial declare' for now.
106
111
  */
107
- notify: (eventId: string, input?: Partial<Pick<NotifyActionInput, "transactionId" | "declaration" | "keepAssignment">>) => {
112
+ notify: (eventId: string, input?: {
113
+ transactionId?: string;
114
+ declaration?: Partial<ActionUpdate>;
115
+ }) => {
108
116
  type: "NOTIFY";
109
117
  transactionId: string;
110
- declaration: Record<string, string | number | boolean | {
118
+ declaration: Partial<Record<string, string | number | boolean | {
111
119
  type: string;
112
- path: string;
120
+ filename: string;
113
121
  originalFilename: string;
114
122
  } | {
115
123
  country: string;
@@ -122,10 +130,6 @@ export declare function eventPayloadGenerator(rng: () => number): {
122
130
  residentialArea?: string | null | undefined;
123
131
  street?: string | null | undefined;
124
132
  zipCode?: string | null | undefined;
125
- } | {
126
- firstname?: string | null | undefined;
127
- surname?: string | null | undefined;
128
- middlename?: string | null | undefined;
129
133
  } | {
130
134
  country: string;
131
135
  district: string;
@@ -146,20 +150,17 @@ export declare function eventPayloadGenerator(rng: () => number): {
146
150
  } | {
147
151
  type: string;
148
152
  option: string;
149
- path: string;
153
+ filename: string;
150
154
  originalFilename: string;
151
- }[] | {
152
- start: string;
153
- end: string;
154
- } | null | undefined>;
155
+ }[] | undefined>>;
155
156
  eventId: string;
156
- keepAssignment: boolean | undefined;
157
157
  };
158
- 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";
159
160
  transactionId: string;
160
161
  declaration: Record<string, string | number | boolean | {
161
162
  type: string;
162
- path: string;
163
+ filename: string;
163
164
  originalFilename: string;
164
165
  } | {
165
166
  country: string;
@@ -172,10 +173,6 @@ export declare function eventPayloadGenerator(rng: () => number): {
172
173
  residentialArea?: string | null | undefined;
173
174
  street?: string | null | undefined;
174
175
  zipCode?: string | null | undefined;
175
- } | {
176
- firstname?: string | null | undefined;
177
- surname?: string | null | undefined;
178
- middlename?: string | null | undefined;
179
176
  } | {
180
177
  country: string;
181
178
  district: string;
@@ -196,15 +193,10 @@ export declare function eventPayloadGenerator(rng: () => number): {
196
193
  } | {
197
194
  type: string;
198
195
  option: string;
199
- path: string;
196
+ filename: string;
200
197
  originalFilename: string;
201
- }[] | {
202
- start: string;
203
- end: string;
204
- } | null | undefined>;
198
+ }[] | undefined>;
205
199
  annotation: {};
206
- keepAssignment?: boolean | undefined;
207
- type: "VALIDATE";
208
200
  duplicates: never[];
209
201
  eventId: string;
210
202
  };
@@ -222,80 +214,30 @@ export declare function eventPayloadGenerator(rng: () => number): {
222
214
  assignedTo: null;
223
215
  eventId: string;
224
216
  };
225
- archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration" | "keepAssignment">>, isDuplicate?: boolean) => {
226
- transactionId: string;
227
- declaration: Record<string, string | number | boolean | {
228
- type: string;
229
- path: string;
230
- originalFilename: string;
231
- } | {
232
- country: string;
233
- district: string;
234
- addressType: "DOMESTIC";
235
- province: string;
236
- urbanOrRural: "URBAN";
237
- number?: string | null | undefined;
238
- town?: string | null | undefined;
239
- residentialArea?: string | null | undefined;
240
- street?: string | null | undefined;
241
- zipCode?: string | null | undefined;
242
- } | {
243
- firstname?: string | null | undefined;
244
- surname?: string | null | undefined;
245
- middlename?: string | null | undefined;
246
- } | {
247
- country: string;
248
- district: string;
249
- addressType: "DOMESTIC";
250
- province: string;
251
- urbanOrRural: "RURAL";
252
- village?: string | null | undefined;
253
- } | {
254
- country: string;
255
- state: string;
256
- addressType: "INTERNATIONAL";
257
- district2: string;
258
- cityOrTown?: string | null | undefined;
259
- addressLine1?: string | null | undefined;
260
- addressLine2?: string | null | undefined;
261
- addressLine3?: string | null | undefined;
262
- postcodeOrZip?: string | null | undefined;
263
- } | {
264
- type: string;
265
- option: string;
266
- path: string;
267
- originalFilename: string;
268
- }[] | {
269
- start: string;
270
- end: string;
271
- } | null | undefined>;
272
- keepAssignment?: boolean | undefined;
217
+ archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration">>, isDuplicate?: boolean) => {
273
218
  type: "ARCHIVE";
274
- annotation: {};
275
- duplicates: never[];
276
- eventId: string;
277
- reason: {
278
- message: string;
219
+ transactionId: string;
220
+ declaration: {};
221
+ annotation: {
279
222
  isDuplicate: boolean;
280
223
  };
224
+ duplicates: never[];
225
+ eventId: string;
281
226
  };
282
- reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
283
- transactionId: string;
284
- annotation: {};
285
- keepAssignment?: boolean | undefined;
227
+ reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation">>) => {
286
228
  type: "REJECT";
229
+ transactionId: string;
287
230
  declaration: {};
231
+ annotation: {};
288
232
  duplicates: never[];
289
233
  eventId: string;
290
- reason: {
291
- message: string;
292
- };
293
234
  };
294
- register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment" | "registrationNumber">>) => {
235
+ register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation">>) => {
236
+ type: "REGISTER";
295
237
  transactionId: string;
296
238
  declaration: Record<string, string | number | boolean | {
297
239
  type: string;
298
- path: string;
240
+ filename: string;
299
241
  originalFilename: string;
300
242
  } | {
301
243
  country: string;
@@ -308,10 +250,6 @@ export declare function eventPayloadGenerator(rng: () => number): {
308
250
  residentialArea?: string | null | undefined;
309
251
  street?: string | null | undefined;
310
252
  zipCode?: string | null | undefined;
311
- } | {
312
- firstname?: string | null | undefined;
313
- surname?: string | null | undefined;
314
- middlename?: string | null | undefined;
315
253
  } | {
316
254
  country: string;
317
255
  district: string;
@@ -332,33 +270,26 @@ export declare function eventPayloadGenerator(rng: () => number): {
332
270
  } | {
333
271
  type: string;
334
272
  option: string;
335
- path: string;
273
+ filename: string;
336
274
  originalFilename: string;
337
- }[] | {
338
- start: string;
339
- end: string;
340
- } | null | undefined>;
275
+ }[] | undefined>;
341
276
  annotation: {};
342
- registrationNumber?: string | undefined;
343
- keepAssignment?: boolean | undefined;
344
- type: "REGISTER";
345
277
  eventId: string;
346
278
  };
347
- printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
348
- transactionId: string;
349
- annotation: {};
350
- keepAssignment?: boolean | undefined;
279
+ printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation">>) => {
351
280
  type: "PRINT_CERTIFICATE";
281
+ transactionId: string;
352
282
  declaration: {};
283
+ annotation: {};
353
284
  eventId: string;
354
285
  };
355
286
  correction: {
356
- request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
287
+ request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation">>) => {
357
288
  type: "REQUEST_CORRECTION";
358
289
  transactionId: string;
359
290
  declaration: Record<string, string | number | boolean | {
360
291
  type: string;
361
- path: string;
292
+ filename: string;
362
293
  originalFilename: string;
363
294
  } | {
364
295
  country: string;
@@ -371,10 +302,6 @@ export declare function eventPayloadGenerator(rng: () => number): {
371
302
  residentialArea?: string | null | undefined;
372
303
  street?: string | null | undefined;
373
304
  zipCode?: string | null | undefined;
374
- } | {
375
- firstname?: string | null | undefined;
376
- surname?: string | null | undefined;
377
- middlename?: string | null | undefined;
378
305
  } | {
379
306
  country: string;
380
307
  district: string;
@@ -395,84 +322,41 @@ export declare function eventPayloadGenerator(rng: () => number): {
395
322
  } | {
396
323
  type: string;
397
324
  option: string;
398
- path: string;
325
+ filename: string;
399
326
  originalFilename: string;
400
- }[] | {
401
- start: string;
402
- end: string;
403
- } | null | undefined>;
327
+ }[] | undefined>;
404
328
  annotation: {};
405
329
  eventId: string;
406
- keepAssignment: boolean | undefined;
407
330
  };
408
- approve: (eventId: string, requestId: string, input?: Partial<Pick<ApproveCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
331
+ approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
409
332
  type: "APPROVE_CORRECTION";
410
333
  transactionId: string;
411
334
  declaration: {};
412
335
  annotation: {};
413
336
  eventId: string;
414
337
  requestId: string;
415
- keepAssignment: boolean | undefined;
416
338
  };
417
- reject: (eventId: string, requestId: string, input?: Partial<Pick<RejectCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
339
+ reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
418
340
  type: "REJECT_CORRECTION";
419
341
  transactionId: string;
420
342
  declaration: {};
421
343
  annotation: {};
422
344
  eventId: string;
423
345
  requestId: string;
424
- keepAssignment: boolean | undefined;
425
346
  };
426
347
  };
427
348
  };
428
349
  };
429
- export declare function generateActionDocument({ configuration, action, rng, defaults, user }: {
350
+ export declare function generateActionDocument({ configuration, action, defaults }: {
430
351
  configuration: EventConfig;
431
352
  action: ActionType;
432
- rng?: () => number;
433
353
  defaults?: Partial<ActionDocument>;
434
- user?: Partial<{
435
- signature: string;
436
- primaryOfficeId: UUID;
437
- role: TestUserRole;
438
- id: string;
439
- }>;
440
354
  }): ActionDocument;
441
- export declare function generateEventDocument({ configuration, actions, rng, user }: {
355
+ export declare function generateEventDocument({ configuration, actions }: {
442
356
  configuration: EventConfig;
443
357
  actions: ActionType[];
444
- rng?: () => number;
445
- user?: Partial<{
446
- signature: string;
447
- primaryOfficeId: UUID;
448
- role: TestUserRole;
449
- id: string;
450
- }>;
451
358
  }): EventDocument;
452
- export declare function generateEventDraftDocument({ eventId, actionType, rng, declaration }: {
453
- eventId: UUID;
454
- actionType: ActionType;
455
- rng?: () => number;
456
- declaration?: EventState;
457
- }): Draft;
458
- export declare function getRandomDatetime(rng: () => number, start: Date, end: Date): string;
459
- export declare function getRandomDate(rng: () => number, start: string, end: string): string;
460
- /**
461
- * Useful for testing when we need deterministic outcome.
462
- * @param seed - Seed value for the pseudo-random number generator
463
- *
464
- * @returns A function that generates pseudo-random numbers between 0 and 1 [0, 1)
465
- */
466
- export declare function createPrng(seed: number): () => number;
467
- export declare function generateUuid(rng?: () => number): UUID;
468
- export declare function generateRegistrationNumber(rng: () => number): string;
469
- export declare function generateRandomSignature(rng: () => number): string;
470
- 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;
471
361
  export declare const generateTranslationConfig: (message: string) => TranslationConfig;
472
- export declare const BearerTokenByUserType: {
473
- fieldAgent: string;
474
- registrationAgent: string;
475
- localRegistrar: string;
476
- };
477
- export declare const generateWorkqueues: (slug?: string) => WorkqueueConfig[];
478
362
  //# sourceMappingURL=test.utils.d.ts.map
@@ -1,2 +1,2 @@
1
- export declare function generateTransactionId(): string & import("zod").BRAND<"UUID">;
1
+ export declare function generateTransactionId(): import("../uuid").UUID;
2
2
  //# sourceMappingURL=transactions.d.ts.map