@opencrvs/toolkit 1.8.0-rc.fe799b0 → 1.8.0-rc.fe7c504

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 (49) hide show
  1. package/README.md +1 -1
  2. package/dist/commons/api/router.d.ts +12626 -10500
  3. package/dist/commons/conditionals/conditionals.d.ts +37 -6
  4. package/dist/commons/conditionals/validate-address.test.d.ts +2 -0
  5. package/dist/commons/conditionals/validate.d.ts +45 -17
  6. package/dist/commons/conditionals/validate.test.d.ts +2 -0
  7. package/dist/commons/events/ActionConfig.d.ts +119422 -2084
  8. package/dist/commons/events/ActionDocument.d.ts +11632 -435
  9. package/dist/commons/events/ActionInput.d.ts +6716 -663
  10. package/dist/commons/events/ActionType.d.ts +31 -12
  11. package/dist/commons/events/AdvancedSearchConfig.d.ts +1233 -22
  12. package/dist/commons/events/CompositeFieldValue.d.ts +183 -2
  13. package/dist/commons/events/Conditional.d.ts +21 -5
  14. package/dist/commons/events/Constants.d.ts +3 -0
  15. package/dist/commons/events/CountryConfigQueryInput.d.ts +3730 -0
  16. package/dist/commons/events/CreatedAtLocation.d.ts +2 -0
  17. package/dist/commons/events/Draft.d.ts +488 -69
  18. package/dist/commons/events/EventConfig.d.ts +57615 -1821
  19. package/dist/commons/events/EventConfigInput.d.ts +6 -3
  20. package/dist/commons/events/EventDocument.d.ts +4762 -607
  21. package/dist/commons/events/EventIndex.d.ts +2012 -24
  22. package/dist/commons/events/EventMetadata.d.ts +343 -42
  23. package/dist/commons/events/FieldConfig.d.ts +6001 -972
  24. package/dist/commons/events/FieldType.d.ts +10 -2
  25. package/dist/commons/events/FieldTypeMapping.d.ts +218 -18
  26. package/dist/commons/events/FieldValue.d.ts +123 -8
  27. package/dist/commons/events/FormConfig.d.ts +50409 -90
  28. package/dist/commons/events/PageConfig.d.ts +12597 -0
  29. package/dist/commons/events/SummaryConfig.d.ts +93 -42
  30. package/dist/commons/events/TemplateConfig.d.ts +38 -0
  31. package/dist/commons/events/User.d.ts +34 -2
  32. package/dist/commons/events/WorkqueueColumnConfig.d.ts +53 -0
  33. package/dist/commons/events/WorkqueueConfig.d.ts +7300 -20
  34. package/dist/commons/events/defineConfig.d.ts +9405 -307
  35. package/dist/commons/events/event.d.ts +54 -0
  36. package/dist/commons/events/field.d.ts +82 -0
  37. package/dist/commons/events/index.d.ts +11 -1
  38. package/dist/commons/events/scopes.d.ts +44 -0
  39. package/dist/commons/events/serializer.d.ts +2 -0
  40. package/dist/commons/events/test.utils.d.ts +245 -225
  41. package/dist/commons/events/transactions.d.ts +1 -1
  42. package/dist/commons/events/utils.d.ts +13906 -69
  43. package/dist/commons/events/utils.test.d.ts +2 -0
  44. package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
  45. package/dist/conditionals/index.js +244 -115
  46. package/dist/events/index.js +5263 -1871
  47. package/dist/scopes/index.d.ts +247 -1
  48. package/dist/scopes/index.js +231 -1
  49. package/package.json +4 -3
@@ -1,39 +1,34 @@
1
- import { ActionDocument } from './ActionDocument';
2
- import { ArchivedActionInput, DeclareActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, ValidateActionInput } from './ActionInput';
1
+ import { UUID } from '../uuid';
2
+ import { ActionDocument, EventState } from './ActionDocument';
3
+ import { ArchiveActionInput, AssignActionInput, DeclareActionInput, NotifyActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnassignActionInput, ValidateActionInput } from './ActionInput';
3
4
  import { ActionType } from './ActionType';
4
5
  import { Draft } from './Draft';
5
6
  import { EventConfig } from './EventConfig';
6
7
  import { EventDocument } from './EventDocument';
7
8
  import { EventIndex } from './EventIndex';
8
9
  import { EventInput } from './EventInput';
10
+ import { TranslationConfig } from './TranslationConfig';
11
+ import { FieldConfig } from './FieldConfig';
12
+ import { WorkqueueConfig } from './WorkqueueConfig';
9
13
  import { FieldValue } from './FieldValue';
10
- export declare function generateActionInput(configuration: EventConfig, action: ActionType): import("lodash").Dictionary<string | number | boolean | {
11
- type: string;
12
- filename: string;
13
- originalFilename: string;
14
- } | {
15
- country: string;
16
- district: string;
17
- province: string;
18
- urbanOrRural: "URBAN";
19
- number?: string | undefined;
20
- town?: string | undefined;
21
- residentialArea?: string | undefined;
22
- street?: string | undefined;
23
- zipCode?: string | undefined;
24
- } | {
25
- country: string;
26
- district: string;
27
- province: string;
28
- urbanOrRural: "RURAL";
29
- village?: string | undefined;
30
- } | {
31
- type: string;
32
- option: string;
33
- filename: string;
34
- originalFilename: string;
35
- }[]>;
36
- export declare const eventPayloadGenerator: {
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): {
37
32
  create: (input?: Partial<EventInput>) => {
38
33
  transactionId: string;
39
34
  type: string;
@@ -43,41 +38,22 @@ export declare const eventPayloadGenerator: {
43
38
  type: string;
44
39
  id: string;
45
40
  };
46
- draft: (eventId: string, input?: Partial<Draft>) => {
47
- id: import("../uuid").UUID;
48
- eventId: string;
49
- createdAt: string;
50
- transactionId: import("../uuid").UUID;
51
- action: {
52
- type: "REQUEST_CORRECTION";
53
- data: {
54
- 'applicant.firstname': string;
55
- 'applicant.surname': string;
56
- 'applicant.dob': string;
57
- 'recommender.none': boolean;
58
- };
59
- metadata: {
60
- 'correction.requester.relationship': string;
61
- 'correction.request.reason': string;
62
- };
63
- createdAt: string;
64
- createdBy: string;
65
- createdAtLocation: string;
66
- };
67
- } & Partial<{
68
- id: string;
69
- createdAt: string;
70
- eventId: string;
71
- transactionId: string;
72
- action: {
73
- type: ActionType;
74
- data: Record<string, string | number | boolean | {
41
+ draft: ({ eventId, actionType, annotation }: {
42
+ eventId: UUID;
43
+ actionType: ActionType;
44
+ annotation?: Record<string, any>;
45
+ }, input?: Partial<Draft>) => Draft;
46
+ actions: {
47
+ declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
48
+ transactionId: string;
49
+ declaration: Record<string, string | number | boolean | {
75
50
  type: string;
76
51
  filename: string;
77
52
  originalFilename: string;
78
53
  } | {
79
54
  country: string;
80
55
  district: string;
56
+ addressType: "DOMESTIC";
81
57
  province: string;
82
58
  urbanOrRural: "URBAN";
83
59
  number?: string | null | undefined;
@@ -85,60 +61,52 @@ export declare const eventPayloadGenerator: {
85
61
  residentialArea?: string | null | undefined;
86
62
  street?: string | null | undefined;
87
63
  zipCode?: string | null | undefined;
64
+ } | {
65
+ firstname?: string | null | undefined;
66
+ surname?: string | null | undefined;
67
+ middlename?: string | null | undefined;
88
68
  } | {
89
69
  country: string;
90
70
  district: string;
71
+ addressType: "DOMESTIC";
91
72
  province: string;
92
73
  urbanOrRural: "RURAL";
93
74
  village?: string | null | undefined;
94
- } | {
95
- type: string;
96
- option: string;
97
- filename: string;
98
- originalFilename: string;
99
- }[]>;
100
- createdAt: string;
101
- createdBy: string;
102
- createdAtLocation: string;
103
- metadata?: Record<string, string | number | boolean | {
104
- type: string;
105
- filename: string;
106
- originalFilename: string;
107
75
  } | {
108
76
  country: string;
109
- district: string;
110
- province: string;
111
- urbanOrRural: "URBAN";
112
- number?: string | null | undefined;
113
- town?: string | null | undefined;
114
- residentialArea?: string | null | undefined;
115
- street?: string | null | undefined;
116
- zipCode?: string | null | undefined;
117
- } | {
118
- country: string;
119
- district: string;
120
- province: string;
121
- urbanOrRural: "RURAL";
122
- village?: string | null | undefined;
77
+ state: string;
78
+ addressType: "INTERNATIONAL";
79
+ district2: string;
80
+ cityOrTown?: string | null | undefined;
81
+ addressLine1?: string | null | undefined;
82
+ addressLine2?: string | null | undefined;
83
+ addressLine3?: string | null | undefined;
84
+ postcodeOrZip?: string | null | undefined;
123
85
  } | {
124
86
  type: string;
125
87
  option: string;
126
88
  filename: string;
127
89
  originalFilename: string;
128
- }[]> | undefined;
129
- };
130
- }>;
131
- actions: {
132
- declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "data">>) => {
90
+ }[] | [string, string] | null | undefined>;
91
+ annotation: {};
92
+ keepAssignment?: boolean | undefined;
133
93
  type: "DECLARE";
94
+ eventId: string;
95
+ };
96
+ /**
97
+ * Notify allows sending incomplete data. Think it as 'partial declare' for now.
98
+ */
99
+ notify: (eventId: string, input?: Partial<Pick<NotifyActionInput, "transactionId" | "declaration" | "keepAssignment">>) => {
100
+ type: "NOTIFY";
134
101
  transactionId: string;
135
- data: Record<string, string | number | boolean | {
102
+ declaration: Record<string, string | number | boolean | {
136
103
  type: string;
137
104
  filename: string;
138
105
  originalFilename: string;
139
106
  } | {
140
107
  country: string;
141
108
  district: string;
109
+ addressType: "DOMESTIC";
142
110
  province: string;
143
111
  urbanOrRural: "URBAN";
144
112
  number?: string | null | undefined;
@@ -146,30 +114,46 @@ export declare const eventPayloadGenerator: {
146
114
  residentialArea?: string | null | undefined;
147
115
  street?: string | null | undefined;
148
116
  zipCode?: string | null | undefined;
117
+ } | {
118
+ firstname?: string | null | undefined;
119
+ surname?: string | null | undefined;
120
+ middlename?: string | null | undefined;
149
121
  } | {
150
122
  country: string;
151
123
  district: string;
124
+ addressType: "DOMESTIC";
152
125
  province: string;
153
126
  urbanOrRural: "RURAL";
154
127
  village?: string | null | undefined;
128
+ } | {
129
+ country: string;
130
+ state: string;
131
+ addressType: "INTERNATIONAL";
132
+ district2: string;
133
+ cityOrTown?: string | null | undefined;
134
+ addressLine1?: string | null | undefined;
135
+ addressLine2?: string | null | undefined;
136
+ addressLine3?: string | null | undefined;
137
+ postcodeOrZip?: string | null | undefined;
155
138
  } | {
156
139
  type: string;
157
140
  option: string;
158
141
  filename: string;
159
142
  originalFilename: string;
160
- }[]>;
143
+ }[] | [string, string] | null | undefined>;
161
144
  eventId: string;
145
+ keepAssignment: boolean | undefined;
162
146
  };
163
- validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "data">>) => {
164
- type: "VALIDATE";
147
+ validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
165
148
  transactionId: string;
166
- data: Record<string, string | number | boolean | {
149
+ declaration: Record<string, string | number | boolean | {
167
150
  type: string;
168
151
  filename: string;
169
152
  originalFilename: string;
170
153
  } | {
171
154
  country: string;
172
155
  district: string;
156
+ addressType: "DOMESTIC";
173
157
  province: string;
174
158
  urbanOrRural: "URBAN";
175
159
  number?: string | null | undefined;
@@ -177,31 +161,63 @@ export declare const eventPayloadGenerator: {
177
161
  residentialArea?: string | null | undefined;
178
162
  street?: string | null | undefined;
179
163
  zipCode?: string | null | undefined;
164
+ } | {
165
+ firstname?: string | null | undefined;
166
+ surname?: string | null | undefined;
167
+ middlename?: string | null | undefined;
180
168
  } | {
181
169
  country: string;
182
170
  district: string;
171
+ addressType: "DOMESTIC";
183
172
  province: string;
184
173
  urbanOrRural: "RURAL";
185
174
  village?: string | null | undefined;
175
+ } | {
176
+ country: string;
177
+ state: string;
178
+ addressType: "INTERNATIONAL";
179
+ district2: string;
180
+ cityOrTown?: string | null | undefined;
181
+ addressLine1?: string | null | undefined;
182
+ addressLine2?: string | null | undefined;
183
+ addressLine3?: string | null | undefined;
184
+ postcodeOrZip?: string | null | undefined;
186
185
  } | {
187
186
  type: string;
188
187
  option: string;
189
188
  filename: string;
190
189
  originalFilename: string;
191
- }[]>;
190
+ }[] | [string, string] | null | undefined>;
191
+ annotation: {};
192
+ keepAssignment?: boolean | undefined;
193
+ type: "VALIDATE";
192
194
  duplicates: never[];
193
195
  eventId: string;
194
196
  };
195
- archive: (eventId: string, input?: Partial<Pick<ArchivedActionInput, "transactionId" | "data">>, isDuplicate?: boolean) => {
196
- type: "ARCHIVED";
197
+ assign: (eventId: string, input?: Partial<Pick<AssignActionInput, "transactionId" | "assignedTo">>) => {
198
+ type: "ASSIGN";
199
+ transactionId: string;
200
+ declaration: {};
201
+ assignedTo: string;
202
+ eventId: string;
203
+ };
204
+ unassign: (eventId: string, input?: Partial<Pick<UnassignActionInput, "transactionId">>) => {
205
+ type: "UNASSIGN";
197
206
  transactionId: string;
198
- data: Record<string, string | number | boolean | {
207
+ declaration: {};
208
+ assignedTo: null;
209
+ eventId: string;
210
+ };
211
+ archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration" | "keepAssignment">>, isDuplicate?: boolean) => {
212
+ transactionId: string;
213
+ declaration: Record<string, string | number | boolean | {
199
214
  type: string;
200
215
  filename: string;
201
216
  originalFilename: string;
202
217
  } | {
203
218
  country: string;
204
219
  district: string;
220
+ addressType: "DOMESTIC";
205
221
  province: string;
206
222
  urbanOrRural: "URBAN";
207
223
  number?: string | null | undefined;
@@ -209,66 +225,65 @@ export declare const eventPayloadGenerator: {
209
225
  residentialArea?: string | null | undefined;
210
226
  street?: string | null | undefined;
211
227
  zipCode?: string | null | undefined;
228
+ } | {
229
+ firstname?: string | null | undefined;
230
+ surname?: string | null | undefined;
231
+ middlename?: string | null | undefined;
212
232
  } | {
213
233
  country: string;
214
234
  district: string;
235
+ addressType: "DOMESTIC";
215
236
  province: string;
216
237
  urbanOrRural: "RURAL";
217
238
  village?: string | null | undefined;
239
+ } | {
240
+ country: string;
241
+ state: string;
242
+ addressType: "INTERNATIONAL";
243
+ district2: string;
244
+ cityOrTown?: string | null | undefined;
245
+ addressLine1?: string | null | undefined;
246
+ addressLine2?: string | null | undefined;
247
+ addressLine3?: string | null | undefined;
248
+ postcodeOrZip?: string | null | undefined;
218
249
  } | {
219
250
  type: string;
220
251
  option: string;
221
252
  filename: string;
222
253
  originalFilename: string;
223
- }[]>;
224
- metadata: {
225
- isDuplicate: boolean;
226
- };
254
+ }[] | [string, string] | null | undefined>;
255
+ keepAssignment?: boolean | undefined;
256
+ type: "ARCHIVE";
257
+ annotation: {};
227
258
  duplicates: never[];
228
259
  eventId: string;
260
+ reason: {
261
+ message: string;
262
+ isDuplicate: boolean;
263
+ };
229
264
  };
230
- reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "data">>) => {
231
- type: "REJECT";
265
+ reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
232
266
  transactionId: string;
233
- data: Record<string, string | number | boolean | {
234
- type: string;
235
- filename: string;
236
- originalFilename: string;
237
- } | {
238
- country: string;
239
- district: string;
240
- province: string;
241
- urbanOrRural: "URBAN";
242
- number?: string | null | undefined;
243
- town?: string | null | undefined;
244
- residentialArea?: string | null | undefined;
245
- street?: string | null | undefined;
246
- zipCode?: string | null | undefined;
247
- } | {
248
- country: string;
249
- district: string;
250
- province: string;
251
- urbanOrRural: "RURAL";
252
- village?: string | null | undefined;
253
- } | {
254
- type: string;
255
- option: string;
256
- filename: string;
257
- originalFilename: string;
258
- }[]>;
267
+ annotation: {};
268
+ keepAssignment?: boolean | undefined;
269
+ type: "REJECT";
270
+ declaration: {};
259
271
  duplicates: never[];
260
272
  eventId: string;
273
+ reason: {
274
+ message: string;
275
+ };
261
276
  };
262
- register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "data">>) => {
263
- type: "REGISTER";
277
+ register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment" | "registrationNumber">>) => {
264
278
  transactionId: string;
265
- data: Record<string, string | number | boolean | {
279
+ declaration: Record<string, string | number | boolean | {
266
280
  type: string;
267
281
  filename: string;
268
282
  originalFilename: string;
269
283
  } | {
270
284
  country: string;
271
285
  district: string;
286
+ addressType: "DOMESTIC";
272
287
  province: string;
273
288
  urbanOrRural: "URBAN";
274
289
  number?: string | null | undefined;
@@ -276,62 +291,59 @@ export declare const eventPayloadGenerator: {
276
291
  residentialArea?: string | null | undefined;
277
292
  street?: string | null | undefined;
278
293
  zipCode?: string | null | undefined;
294
+ } | {
295
+ firstname?: string | null | undefined;
296
+ surname?: string | null | undefined;
297
+ middlename?: string | null | undefined;
279
298
  } | {
280
299
  country: string;
281
300
  district: string;
301
+ addressType: "DOMESTIC";
282
302
  province: string;
283
303
  urbanOrRural: "RURAL";
284
304
  village?: string | null | undefined;
305
+ } | {
306
+ country: string;
307
+ state: string;
308
+ addressType: "INTERNATIONAL";
309
+ district2: string;
310
+ cityOrTown?: string | null | undefined;
311
+ addressLine1?: string | null | undefined;
312
+ addressLine2?: string | null | undefined;
313
+ addressLine3?: string | null | undefined;
314
+ postcodeOrZip?: string | null | undefined;
285
315
  } | {
286
316
  type: string;
287
317
  option: string;
288
318
  filename: string;
289
319
  originalFilename: string;
290
- }[]>;
320
+ }[] | [string, string] | null | undefined>;
321
+ annotation: {};
322
+ registrationNumber?: string | undefined;
323
+ keepAssignment?: boolean | undefined;
324
+ type: "REGISTER";
291
325
  eventId: string;
292
326
  };
293
- printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "data">>) => {
294
- type: "PRINT_CERTIFICATE";
327
+ printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
295
328
  transactionId: string;
296
- data: Record<string, string | number | boolean | {
297
- type: string;
298
- filename: string;
299
- originalFilename: string;
300
- } | {
301
- country: string;
302
- district: string;
303
- province: string;
304
- urbanOrRural: "URBAN";
305
- number?: string | null | undefined;
306
- town?: string | null | undefined;
307
- residentialArea?: string | null | undefined;
308
- street?: string | null | undefined;
309
- zipCode?: string | null | undefined;
310
- } | {
311
- country: string;
312
- district: string;
313
- province: string;
314
- urbanOrRural: "RURAL";
315
- village?: string | null | undefined;
316
- } | {
317
- type: string;
318
- option: string;
319
- filename: string;
320
- originalFilename: string;
321
- }[]>;
329
+ annotation: {};
330
+ keepAssignment?: boolean | undefined;
331
+ type: "PRINT_CERTIFICATE";
332
+ declaration: {};
322
333
  eventId: string;
323
334
  };
324
335
  correction: {
325
- request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => {
336
+ request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
326
337
  type: "REQUEST_CORRECTION";
327
338
  transactionId: string;
328
- data: Record<string, string | number | boolean | {
339
+ declaration: Record<string, string | number | boolean | {
329
340
  type: string;
330
341
  filename: string;
331
342
  originalFilename: string;
332
343
  } | {
333
344
  country: string;
334
345
  district: string;
346
+ addressType: "DOMESTIC";
335
347
  province: string;
336
348
  urbanOrRural: "URBAN";
337
349
  number?: string | null | undefined;
@@ -339,97 +351,105 @@ export declare const eventPayloadGenerator: {
339
351
  residentialArea?: string | null | undefined;
340
352
  street?: string | null | undefined;
341
353
  zipCode?: string | null | undefined;
354
+ } | {
355
+ firstname?: string | null | undefined;
356
+ surname?: string | null | undefined;
357
+ middlename?: string | null | undefined;
342
358
  } | {
343
359
  country: string;
344
360
  district: string;
361
+ addressType: "DOMESTIC";
345
362
  province: string;
346
363
  urbanOrRural: "RURAL";
347
364
  village?: string | null | undefined;
365
+ } | {
366
+ country: string;
367
+ state: string;
368
+ addressType: "INTERNATIONAL";
369
+ district2: string;
370
+ cityOrTown?: string | null | undefined;
371
+ addressLine1?: string | null | undefined;
372
+ addressLine2?: string | null | undefined;
373
+ addressLine3?: string | null | undefined;
374
+ postcodeOrZip?: string | null | undefined;
348
375
  } | {
349
376
  type: string;
350
377
  option: string;
351
378
  filename: string;
352
379
  originalFilename: string;
353
- }[]>;
354
- metadata: {};
380
+ }[] | [string, string] | null | undefined>;
381
+ annotation: {};
355
382
  eventId: string;
383
+ keepAssignment: boolean | undefined;
356
384
  };
357
- approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => {
385
+ approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
358
386
  type: "APPROVE_CORRECTION";
359
387
  transactionId: string;
360
- data: Record<string, string | number | boolean | {
361
- type: string;
362
- filename: string;
363
- originalFilename: string;
364
- } | {
365
- country: string;
366
- district: string;
367
- province: string;
368
- urbanOrRural: "URBAN";
369
- number?: string | null | undefined;
370
- town?: string | null | undefined;
371
- residentialArea?: string | null | undefined;
372
- street?: string | null | undefined;
373
- zipCode?: string | null | undefined;
374
- } | {
375
- country: string;
376
- district: string;
377
- province: string;
378
- urbanOrRural: "RURAL";
379
- village?: string | null | undefined;
380
- } | {
381
- type: string;
382
- option: string;
383
- filename: string;
384
- originalFilename: string;
385
- }[]>;
388
+ declaration: {};
389
+ annotation: {};
386
390
  eventId: string;
387
391
  requestId: string;
392
+ keepAssignment: boolean | undefined;
388
393
  };
389
- reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => {
394
+ reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
390
395
  type: "REJECT_CORRECTION";
391
396
  transactionId: string;
392
- data: Record<string, string | number | boolean | {
393
- type: string;
394
- filename: string;
395
- originalFilename: string;
396
- } | {
397
- country: string;
398
- district: string;
399
- province: string;
400
- urbanOrRural: "URBAN";
401
- number?: string | null | undefined;
402
- town?: string | null | undefined;
403
- residentialArea?: string | null | undefined;
404
- street?: string | null | undefined;
405
- zipCode?: string | null | undefined;
406
- } | {
407
- country: string;
408
- district: string;
409
- province: string;
410
- urbanOrRural: "RURAL";
411
- village?: string | null | undefined;
412
- } | {
413
- type: string;
414
- option: string;
415
- filename: string;
416
- originalFilename: string;
417
- }[]>;
397
+ declaration: {};
398
+ annotation: {};
418
399
  eventId: string;
419
400
  requestId: string;
401
+ keepAssignment: boolean | undefined;
420
402
  };
421
403
  };
422
404
  };
423
405
  };
424
- export declare function generateActionDocument({ configuration, action, defaults }: {
406
+ export declare function generateActionDocument({ configuration, action, rng, defaults, user }: {
425
407
  configuration: EventConfig;
426
408
  action: ActionType;
409
+ rng?: () => number;
427
410
  defaults?: Partial<ActionDocument>;
411
+ user?: Partial<{
412
+ signature: string;
413
+ primaryOfficeId: UUID;
414
+ role: TestUserRole;
415
+ id: string;
416
+ }>;
428
417
  }): ActionDocument;
429
- export declare function generateEventDocument({ configuration, actions }: {
418
+ export declare function generateEventDocument({ configuration, actions, rng, user }: {
430
419
  configuration: EventConfig;
431
420
  actions: ActionType[];
421
+ rng?: () => number;
422
+ user?: Partial<{
423
+ signature: string;
424
+ primaryOfficeId: UUID;
425
+ role: TestUserRole;
426
+ id: string;
427
+ }>;
432
428
  }): EventDocument;
433
- export declare function generateEventDraftDocument(eventId: string, actionType?: ActionType, data?: Record<string, FieldValue>): Draft;
434
- export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>) => EventIndex;
429
+ export declare function generateEventDraftDocument({ eventId, actionType, rng, declaration }: {
430
+ eventId: UUID;
431
+ actionType: ActionType;
432
+ rng?: () => number;
433
+ declaration?: EventState;
434
+ }): Draft;
435
+ export declare function getRandomDatetime(rng: () => number, start: Date, end: Date): string;
436
+ export declare function getRandomDate(rng: () => number, start: string, end: string): string;
437
+ /**
438
+ * Useful for testing when we need deterministic outcome.
439
+ * @param seed - Seed value for the pseudo-random number generator
440
+ *
441
+ * @returns A function that generates pseudo-random numbers between 0 and 1 [0, 1)
442
+ */
443
+ export declare function createPrng(seed: number): () => number;
444
+ export declare function generateUuid(rng?: () => number): UUID;
445
+ export declare function generateRegistrationNumber(rng: () => number): string;
446
+ export declare function generateRandomSignature(rng: () => number): string;
447
+ export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>, seed?: number) => EventIndex;
448
+ export declare const generateTranslationConfig: (message: string) => TranslationConfig;
449
+ export declare const BearerTokenByUserType: {
450
+ fieldAgent: string;
451
+ registrationAgent: string;
452
+ localRegistrar: string;
453
+ };
454
+ export declare const generateWorkqueues: (slug?: string) => WorkqueueConfig[];
435
455
  //# sourceMappingURL=test.utils.d.ts.map