@opencrvs/toolkit 1.8.0-rc.f7aaf07 → 1.8.0-rc.f7bcb31

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 -14391
  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 -2410
  6. package/dist/commons/events/ActionInput.d.ts +303 -1583
  7. package/dist/commons/events/ActionType.d.ts +0 -6
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +22 -1233
  9. package/dist/commons/events/CompositeFieldValue.d.ts +0 -31
  10. package/dist/commons/events/Draft.d.ts +29 -148
  11. package/dist/commons/events/EventConfig.d.ts +1362 -56509
  12. package/dist/commons/events/EventDocument.d.ts +264 -1508
  13. package/dist/commons/events/EventIndex.d.ts +25 -2026
  14. package/dist/commons/events/EventMetadata.d.ts +43 -332
  15. package/dist/commons/events/FieldConfig.d.ts +1059 -5476
  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 -6290
  24. package/dist/commons/events/defineConfig.d.ts +75 -9018
  25. package/dist/commons/events/index.d.ts +0 -8
  26. package/dist/commons/events/test.utils.d.ts +78 -160
  27. package/dist/commons/events/utils.d.ts +68 -13361
  28. package/dist/conditionals/index.js +36 -76
  29. package/dist/events/index.js +1500 -4070
  30. package/dist/scopes/index.d.ts +6 -97
  31. package/dist/scopes/index.js +38 -109
  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 -3068
  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 -82
  39. package/dist/commons/events/scopes.d.ts +0 -44
  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,33 +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
- import { z } from 'zod';
14
- /**
15
- * In real application, the roles are defined in the countryconfig.
16
- * These are just for testing purposes to generate realistic mock data.
17
- */
18
- export declare const TestUserRole: z.ZodEnum<["FIELD_AGENT", "LOCAL_REGISTRAR", "LOCAL_SYSTEM_ADMIN", "NATIONAL_REGISTRAR", "REGISTRATION_AGENT"]>;
19
- export type TestUserRole = z.infer<typeof TestUserRole>;
20
- export declare function generateRandomName(rng: () => number): {
21
- firstname: string;
22
- surname: string;
23
- };
24
- /**
25
- * Quick-and-dirty mock data generator for event actions.
26
- */
27
- export declare function mapFieldTypeToMockValue(field: FieldConfig, i: number, rng: () => number): FieldValue;
28
- export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType, rng: () => number): EventState;
29
- export declare function generateActionAnnotationInput(configuration: EventConfig, action: ActionType, rng: () => number): {};
30
- 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: {
31
51
  create: (input?: Partial<EventInput>) => {
32
52
  transactionId: string;
33
53
  type: string;
@@ -42,7 +62,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
42
62
  actionType: ActionType;
43
63
  }, input?: Partial<Draft>) => Draft;
44
64
  actions: {
45
- 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";
46
67
  transactionId: string;
47
68
  declaration: Record<string, string | number | boolean | {
48
69
  type: string;
@@ -59,10 +80,6 @@ export declare function eventPayloadGenerator(rng: () => number): {
59
80
  residentialArea?: string | null | undefined;
60
81
  street?: string | null | undefined;
61
82
  zipCode?: string | null | undefined;
62
- } | {
63
- firstname: string;
64
- surname: string;
65
- middlename?: string | null | undefined;
66
83
  } | {
67
84
  country: string;
68
85
  district: string;
@@ -85,19 +102,20 @@ export declare function eventPayloadGenerator(rng: () => number): {
85
102
  option: string;
86
103
  filename: string;
87
104
  originalFilename: string;
88
- }[] | [string, string] | null | undefined>;
105
+ }[] | undefined>;
89
106
  annotation: {};
90
- keepAssignment?: boolean | undefined;
91
- type: "DECLARE";
92
107
  eventId: string;
93
108
  };
94
109
  /**
95
110
  * Notify allows sending incomplete data. Think it as 'partial declare' for now.
96
111
  */
97
- notify: (eventId: string, input?: Partial<Pick<NotifyActionInput, "transactionId" | "declaration" | "keepAssignment">>) => {
112
+ notify: (eventId: string, input?: {
113
+ transactionId?: string;
114
+ declaration?: Partial<ActionUpdate>;
115
+ }) => {
98
116
  type: "NOTIFY";
99
117
  transactionId: string;
100
- declaration: Record<string, string | number | boolean | {
118
+ declaration: Partial<Record<string, string | number | boolean | {
101
119
  type: string;
102
120
  filename: string;
103
121
  originalFilename: string;
@@ -112,10 +130,6 @@ export declare function eventPayloadGenerator(rng: () => number): {
112
130
  residentialArea?: string | null | undefined;
113
131
  street?: string | null | undefined;
114
132
  zipCode?: string | null | undefined;
115
- } | {
116
- firstname: string;
117
- surname: string;
118
- middlename?: string | null | undefined;
119
133
  } | {
120
134
  country: string;
121
135
  district: string;
@@ -138,11 +152,11 @@ export declare function eventPayloadGenerator(rng: () => number): {
138
152
  option: string;
139
153
  filename: string;
140
154
  originalFilename: string;
141
- }[] | [string, string] | null | undefined>;
155
+ }[] | undefined>>;
142
156
  eventId: string;
143
- keepAssignment: boolean | undefined;
144
157
  };
145
- 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";
146
160
  transactionId: string;
147
161
  declaration: Record<string, string | number | boolean | {
148
162
  type: string;
@@ -159,10 +173,6 @@ export declare function eventPayloadGenerator(rng: () => number): {
159
173
  residentialArea?: string | null | undefined;
160
174
  street?: string | null | undefined;
161
175
  zipCode?: string | null | undefined;
162
- } | {
163
- firstname: string;
164
- surname: string;
165
- middlename?: string | null | undefined;
166
176
  } | {
167
177
  country: string;
168
178
  district: string;
@@ -185,10 +195,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
185
195
  option: string;
186
196
  filename: string;
187
197
  originalFilename: string;
188
- }[] | [string, string] | null | undefined>;
198
+ }[] | undefined>;
189
199
  annotation: {};
190
- keepAssignment?: boolean | undefined;
191
- type: "VALIDATE";
192
200
  duplicates: never[];
193
201
  eventId: string;
194
202
  };
@@ -206,73 +214,26 @@ export declare function eventPayloadGenerator(rng: () => number): {
206
214
  assignedTo: null;
207
215
  eventId: string;
208
216
  };
209
- archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration" | "keepAssignment">>, isDuplicate?: boolean) => {
210
- transactionId: string;
211
- declaration: Record<string, string | number | boolean | {
212
- type: string;
213
- filename: string;
214
- originalFilename: string;
215
- } | {
216
- country: string;
217
- district: string;
218
- addressType: "DOMESTIC";
219
- province: string;
220
- urbanOrRural: "URBAN";
221
- number?: string | null | undefined;
222
- town?: string | null | undefined;
223
- residentialArea?: string | null | undefined;
224
- street?: string | null | undefined;
225
- zipCode?: string | null | undefined;
226
- } | {
227
- firstname: string;
228
- surname: string;
229
- middlename?: string | null | undefined;
230
- } | {
231
- country: string;
232
- district: string;
233
- addressType: "DOMESTIC";
234
- province: string;
235
- urbanOrRural: "RURAL";
236
- village?: string | null | undefined;
237
- } | {
238
- country: string;
239
- state: string;
240
- addressType: "INTERNATIONAL";
241
- district2: string;
242
- cityOrTown?: string | null | undefined;
243
- addressLine1?: string | null | undefined;
244
- addressLine2?: string | null | undefined;
245
- addressLine3?: string | null | undefined;
246
- postcodeOrZip?: string | null | undefined;
247
- } | {
248
- type: string;
249
- option: string;
250
- filename: string;
251
- originalFilename: string;
252
- }[] | [string, string] | null | undefined>;
253
- keepAssignment?: boolean | undefined;
217
+ archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration">>, isDuplicate?: boolean) => {
254
218
  type: "ARCHIVE";
255
- annotation: {};
256
- duplicates: never[];
257
- eventId: string;
258
- reason: {
259
- message: string;
219
+ transactionId: string;
220
+ declaration: {};
221
+ annotation: {
260
222
  isDuplicate: boolean;
261
223
  };
224
+ duplicates: never[];
225
+ eventId: string;
262
226
  };
263
- reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
264
- transactionId: string;
265
- annotation: {};
266
- keepAssignment?: boolean | undefined;
227
+ reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation">>) => {
267
228
  type: "REJECT";
229
+ transactionId: string;
268
230
  declaration: {};
231
+ annotation: {};
269
232
  duplicates: never[];
270
233
  eventId: string;
271
- reason: {
272
- message: string;
273
- };
274
234
  };
275
- 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";
276
237
  transactionId: string;
277
238
  declaration: Record<string, string | number | boolean | {
278
239
  type: string;
@@ -289,10 +250,6 @@ export declare function eventPayloadGenerator(rng: () => number): {
289
250
  residentialArea?: string | null | undefined;
290
251
  street?: string | null | undefined;
291
252
  zipCode?: string | null | undefined;
292
- } | {
293
- firstname: string;
294
- surname: string;
295
- middlename?: string | null | undefined;
296
253
  } | {
297
254
  country: string;
298
255
  district: string;
@@ -315,22 +272,19 @@ export declare function eventPayloadGenerator(rng: () => number): {
315
272
  option: string;
316
273
  filename: string;
317
274
  originalFilename: string;
318
- }[] | [string, string] | null | undefined>;
275
+ }[] | undefined>;
319
276
  annotation: {};
320
- keepAssignment?: boolean | undefined;
321
- type: "REGISTER";
322
277
  eventId: string;
323
278
  };
324
- printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
325
- transactionId: string;
326
- annotation: {};
327
- keepAssignment?: boolean | undefined;
279
+ printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation">>) => {
328
280
  type: "PRINT_CERTIFICATE";
281
+ transactionId: string;
329
282
  declaration: {};
283
+ annotation: {};
330
284
  eventId: string;
331
285
  };
332
286
  correction: {
333
- request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
287
+ request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation">>) => {
334
288
  type: "REQUEST_CORRECTION";
335
289
  transactionId: string;
336
290
  declaration: Record<string, string | number | boolean | {
@@ -348,10 +302,6 @@ export declare function eventPayloadGenerator(rng: () => number): {
348
302
  residentialArea?: string | null | undefined;
349
303
  street?: string | null | undefined;
350
304
  zipCode?: string | null | undefined;
351
- } | {
352
- firstname: string;
353
- surname: string;
354
- middlename?: string | null | undefined;
355
305
  } | {
356
306
  country: string;
357
307
  district: string;
@@ -374,71 +324,39 @@ export declare function eventPayloadGenerator(rng: () => number): {
374
324
  option: string;
375
325
  filename: string;
376
326
  originalFilename: string;
377
- }[] | [string, string] | null | undefined>;
327
+ }[] | undefined>;
378
328
  annotation: {};
379
329
  eventId: string;
380
- keepAssignment: boolean | undefined;
381
330
  };
382
- approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
331
+ approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
383
332
  type: "APPROVE_CORRECTION";
384
333
  transactionId: string;
385
334
  declaration: {};
386
335
  annotation: {};
387
336
  eventId: string;
388
337
  requestId: string;
389
- keepAssignment: boolean | undefined;
390
338
  };
391
- reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
339
+ reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
392
340
  type: "REJECT_CORRECTION";
393
341
  transactionId: string;
394
342
  declaration: {};
395
343
  annotation: {};
396
344
  eventId: string;
397
345
  requestId: string;
398
- keepAssignment: boolean | undefined;
399
346
  };
400
347
  };
401
348
  };
402
349
  };
403
- export declare function generateActionDocument({ configuration, action, rng, defaults }: {
350
+ export declare function generateActionDocument({ configuration, action, defaults }: {
404
351
  configuration: EventConfig;
405
352
  action: ActionType;
406
- rng?: () => number;
407
353
  defaults?: Partial<ActionDocument>;
408
- user?: Partial<{
409
- signature: string;
410
- primaryOfficeId: string;
411
- role: TestUserRole;
412
- id: string;
413
- }>;
414
354
  }): ActionDocument;
415
- export declare function generateEventDocument({ configuration, actions, rng }: {
355
+ export declare function generateEventDocument({ configuration, actions }: {
416
356
  configuration: EventConfig;
417
357
  actions: ActionType[];
418
- rng?: () => number;
419
358
  }): EventDocument;
420
- export declare function generateEventDraftDocument({ eventId, actionType, rng, declaration }: {
421
- eventId: string;
422
- actionType: ActionType;
423
- rng?: () => number;
424
- declaration?: EventState;
425
- }): Draft;
426
- export declare function getRandomDatetime(rng: () => number, start: Date, end: Date): string;
427
- export declare function getRandomDate(rng: () => number, start: string, end: string): string;
428
- /**
429
- * Useful for testing when we need deterministic outcome.
430
- * @param seed - Seed value for the pseudo-random number generator
431
- *
432
- * @returns A function that generates pseudo-random numbers between 0 and 1 [0, 1)
433
- */
434
- export declare function createPrng(seed: number): () => number;
435
- export declare function generateRandomSignature(rng: () => number): string;
436
- 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;
437
361
  export declare const generateTranslationConfig: (message: string) => TranslationConfig;
438
- export declare const BearerTokenByUserType: {
439
- fieldAgent: string;
440
- registrationAgent: string;
441
- localRegistrar: string;
442
- };
443
- export declare const generateWorkqueues: (slug?: string) => WorkqueueConfig[];
444
362
  //# sourceMappingURL=test.utils.d.ts.map