@opencrvs/toolkit 1.8.0-rc.f8aa0c5 → 1.8.0-rc.f8b1f33

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