@opencrvs/toolkit 1.8.0-rc.ffbb9d7 → 1.8.0-rc.ffe24c3

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 (44) hide show
  1. package/dist/commons/api/router.d.ts +14748 -727
  2. package/dist/commons/conditionals/conditionals.d.ts +14 -6
  3. package/dist/commons/conditionals/validate.d.ts +11 -11
  4. package/dist/commons/events/ActionConfig.d.ts +117418 -1729
  5. package/dist/commons/events/ActionDocument.d.ts +2581 -554
  6. package/dist/commons/events/ActionInput.d.ts +1795 -425
  7. package/dist/commons/events/ActionType.d.ts +8 -0
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +1233 -22
  9. package/dist/commons/events/CompositeFieldValue.d.ts +31 -0
  10. package/dist/commons/events/Constants.d.ts +3 -0
  11. package/dist/commons/events/CountryConfigQueryInput.d.ts +3730 -0
  12. package/dist/commons/events/CreatedAtLocation.d.ts +2 -0
  13. package/dist/commons/events/Draft.d.ts +165 -43
  14. package/dist/commons/events/EventConfig.d.ts +56501 -1354
  15. package/dist/commons/events/EventDocument.d.ts +1635 -391
  16. package/dist/commons/events/EventIndex.d.ts +2007 -27
  17. package/dist/commons/events/EventMetadata.d.ts +343 -45
  18. package/dist/commons/events/FieldConfig.d.ts +5450 -1033
  19. package/dist/commons/events/FieldType.d.ts +6 -3
  20. package/dist/commons/events/FieldTypeMapping.d.ts +103 -54
  21. package/dist/commons/events/FieldValue.d.ts +49 -8
  22. package/dist/commons/events/FormConfig.d.ts +49156 -514
  23. package/dist/commons/events/PageConfig.d.ts +12206 -204
  24. package/dist/commons/events/SummaryConfig.d.ts +93 -42
  25. package/dist/commons/events/TemplateConfig.d.ts +4 -4
  26. package/dist/commons/events/User.d.ts +31 -2
  27. package/dist/commons/events/WorkqueueColumnConfig.d.ts +53 -0
  28. package/dist/commons/events/WorkqueueConfig.d.ts +7300 -20
  29. package/dist/commons/events/defineConfig.d.ts +9001 -58
  30. package/dist/commons/events/event.d.ts +54 -0
  31. package/dist/commons/events/field.d.ts +82 -0
  32. package/dist/commons/events/index.d.ts +8 -0
  33. package/dist/commons/events/scopes.d.ts +44 -0
  34. package/dist/commons/events/serializer.d.ts +2 -0
  35. package/dist/commons/events/test.utils.d.ts +171 -79
  36. package/dist/commons/events/transactions.d.ts +1 -1
  37. package/dist/commons/events/utils.d.ts +13375 -73
  38. package/dist/commons/events/utils.test.d.ts +2 -0
  39. package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
  40. package/dist/conditionals/index.js +76 -36
  41. package/dist/events/index.js +4630 -1941
  42. package/dist/scopes/index.d.ts +161 -1
  43. package/dist/scopes/index.js +202 -1
  44. package/package.json +4 -3
@@ -0,0 +1,54 @@
1
+ import { EventFieldId } from './AdvancedSearchConfig';
2
+ import { SelectOption } from './FieldConfig';
3
+ import { WorkqueueColumnKeys, WorkqueueColumnValue } from './WorkqueueColumnConfig';
4
+ /**
5
+ * Creates a function that acts like a callable + static method container.
6
+ *
7
+ * @example
8
+ * event('status') // → returns search config
9
+ * event.hasAction('CLICKED') // → returns conditional
10
+ */
11
+ declare function eventFn(fieldId: EventFieldId, options?: SelectOption[]): {
12
+ range: () => {
13
+ fieldId: "status" | "updatedAt" | "trackingId" | "legalStatus.REGISTERED.createdAt" | "legalStatus.REGISTERED.createdAtLocation";
14
+ options: {
15
+ value: string;
16
+ label: import("./TranslationConfig").TranslationConfig;
17
+ }[] | undefined;
18
+ fieldType: "event";
19
+ } & {
20
+ config: {
21
+ type: "range";
22
+ };
23
+ };
24
+ exact: () => {
25
+ fieldId: "status" | "updatedAt" | "trackingId" | "legalStatus.REGISTERED.createdAt" | "legalStatus.REGISTERED.createdAtLocation";
26
+ options: {
27
+ value: string;
28
+ label: import("./TranslationConfig").TranslationConfig;
29
+ }[] | undefined;
30
+ fieldType: "event";
31
+ } & {
32
+ config: {
33
+ type: "exact";
34
+ };
35
+ };
36
+ fuzzy: () => {
37
+ fieldId: "status" | "updatedAt" | "trackingId" | "legalStatus.REGISTERED.createdAt" | "legalStatus.REGISTERED.createdAtLocation";
38
+ options: {
39
+ value: string;
40
+ label: import("./TranslationConfig").TranslationConfig;
41
+ }[] | undefined;
42
+ fieldType: "event";
43
+ } & {
44
+ config: {
45
+ type: "fuzzy";
46
+ };
47
+ };
48
+ };
49
+ declare const event: typeof eventFn & {
50
+ field(field: WorkqueueColumnKeys): WorkqueueColumnValue;
51
+ hasAction: (action: import("./ActionType").ActionType) => import("../conditionals/conditionals").JSONSchema;
52
+ };
53
+ export { event };
54
+ //# sourceMappingURL=event.d.ts.map
@@ -0,0 +1,82 @@
1
+ import { FieldConditional } from './Conditional';
2
+ import { TranslationConfig } from './TranslationConfig';
3
+ import { ValidationConfig } from './FieldConfig';
4
+ /**
5
+ * Entry point for defining conditional logic or configuration for a form field.
6
+ * @param fieldId - The ID of the field to define rules or config for.
7
+ * @returns An object combining conditional methods and configuration builders.
8
+ */
9
+ export declare function field(fieldId: string, options?: {
10
+ conditionals?: FieldConditional[];
11
+ validations?: ValidationConfig[];
12
+ searchCriteriaLabelPrefix?: TranslationConfig;
13
+ }): {
14
+ range: () => {
15
+ conditionals?: FieldConditional[];
16
+ validations?: ValidationConfig[];
17
+ searchCriteriaLabelPrefix?: TranslationConfig;
18
+ fieldId: string;
19
+ fieldType: "field";
20
+ } & {
21
+ config: {
22
+ type: "range";
23
+ };
24
+ };
25
+ exact: () => {
26
+ conditionals?: FieldConditional[];
27
+ validations?: ValidationConfig[];
28
+ searchCriteriaLabelPrefix?: TranslationConfig;
29
+ fieldId: string;
30
+ fieldType: "field";
31
+ } & {
32
+ config: {
33
+ type: "exact";
34
+ };
35
+ };
36
+ fuzzy: () => {
37
+ conditionals?: FieldConditional[];
38
+ validations?: ValidationConfig[];
39
+ searchCriteriaLabelPrefix?: TranslationConfig;
40
+ fieldId: string;
41
+ fieldType: "field";
42
+ } & {
43
+ config: {
44
+ type: "fuzzy";
45
+ };
46
+ };
47
+ $$field: string;
48
+ isAfter: () => {
49
+ days: (days: number) => {
50
+ inPast: () => import("../conditionals/conditionals").JSONSchema;
51
+ inFuture: () => import("../conditionals/conditionals").JSONSchema;
52
+ };
53
+ date: (date: string | {
54
+ $$field: string;
55
+ }) => import("../conditionals/conditionals").JSONSchema;
56
+ now: () => import("../conditionals/conditionals").JSONSchema;
57
+ };
58
+ isBefore: () => {
59
+ days: (days: number) => {
60
+ inPast: () => import("../conditionals/conditionals").JSONSchema;
61
+ inFuture: () => import("../conditionals/conditionals").JSONSchema;
62
+ };
63
+ date: (date: string | {
64
+ $$field: string;
65
+ }) => import("../conditionals/conditionals").JSONSchema;
66
+ now: () => import("../conditionals/conditionals").JSONSchema;
67
+ };
68
+ isEqualTo: (value: string | boolean | {
69
+ $$field: string;
70
+ }) => import("../conditionals/conditionals").JSONSchema;
71
+ isFalsy: () => import("../conditionals/conditionals").JSONSchema;
72
+ isUndefined: () => import("../conditionals/conditionals").JSONSchema;
73
+ inArray: (values: string[]) => import("../conditionals/conditionals").JSONSchema;
74
+ isValidEnglishName: () => import("../conditionals/conditionals").JSONSchema;
75
+ matches: (pattern: string) => import("../conditionals/conditionals").JSONSchema;
76
+ isBetween: (min: number, max: number) => import("../conditionals/conditionals").JSONSchema;
77
+ getId: () => {
78
+ fieldId: string;
79
+ };
80
+ object: (options: Record<string, any>) => import("../conditionals/conditionals").JSONSchema;
81
+ };
82
+ //# sourceMappingURL=field.d.ts.map
@@ -1,3 +1,4 @@
1
+ export * from './Constants';
1
2
  export * from './ActionConfig';
2
3
  export * from './offline';
3
4
  export * from './EventConfig';
@@ -6,6 +7,8 @@ export * from './FieldConfig';
6
7
  export * from './PageConfig';
7
8
  export * from './SummaryConfig';
8
9
  export * from './WorkqueueConfig';
10
+ export * from './WorkqueueColumnConfig';
11
+ export * from './workqueueDefaultColumns';
9
12
  export * from './Draft';
10
13
  export * from './EventMetadata';
11
14
  export * from './EventInput';
@@ -30,6 +33,11 @@ export * from './Conditional';
30
33
  export * from './AdvancedSearchConfig';
31
34
  export * from './test.utils';
32
35
  export * from './TemplateConfig';
36
+ export * from './scopes';
37
+ export * from './serializer';
38
+ export * from './state/availableActions';
33
39
  export * from '../conditionals/conditionals';
34
40
  export * from '../conditionals/validate';
41
+ export * from './field';
42
+ export * from './event';
35
43
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,44 @@
1
+ import { Scope } from '../scopes';
2
+ export declare const CONFIG_GET_ALLOWED_SCOPES: ["record.declare-birth", "record.read", "record.declaration-submit-incomplete", "record.declaration-submit-for-review", "record.register", "record.export-records", "config", "config.update:all"];
3
+ export declare const CONFIG_SEARCH_ALLOWED_SCOPES: ("search.birth:my-jurisdiction" | "search.birth" | "search.death:my-jurisdiction" | "search.death" | "search.marriage:my-jurisdiction" | "search.marriage")[];
4
+ export declare const ACTION_ALLOWED_SCOPES: {
5
+ READ: ["record.declare-birth", "record.read", "record.declaration-submit-incomplete", "record.declaration-submit-for-review", "record.register", "record.export-records"];
6
+ CREATE: ["record.declare-birth", "record.declaration-submit-incomplete", "record.declaration-submit-for-review"];
7
+ NOTIFY: ["record.declaration-submit-incomplete"];
8
+ DECLARE: ["record.declare-birth", "record.declaration-submit-for-approval", "record.register"];
9
+ DELETE: ["record.declare-birth"];
10
+ VALIDATE: ["record.declaration-submit-for-approval", "record.register"];
11
+ REGISTER: ["record.register"];
12
+ PRINT_CERTIFICATE: ["record.registration-print&issue-certified-copies"];
13
+ REQUEST_CORRECTION: ["record.registration-request-correction"];
14
+ REJECT_CORRECTION: ["record.registration-correct"];
15
+ APPROVE_CORRECTION: ["record.registration-correct"];
16
+ MARKED_AS_DUPLICATE: ["record.declaration-archive"];
17
+ ARCHIVE: ["record.declaration-archive"];
18
+ REJECT: ["record.declaration-submit-for-updates"];
19
+ ASSIGN: null;
20
+ UNASSIGN: null;
21
+ DETECT_DUPLICATE: [];
22
+ };
23
+ export declare const ACTION_ALLOWED_CONFIGURABLE_SCOPES: {
24
+ READ: never[];
25
+ CREATE: "record.notify"[];
26
+ NOTIFY: "record.notify"[];
27
+ DECLARE: never[];
28
+ DELETE: never[];
29
+ VALIDATE: never[];
30
+ REGISTER: never[];
31
+ PRINT_CERTIFICATE: never[];
32
+ REQUEST_CORRECTION: never[];
33
+ REJECT_CORRECTION: never[];
34
+ APPROVE_CORRECTION: never[];
35
+ MARKED_AS_DUPLICATE: never[];
36
+ ARCHIVE: never[];
37
+ REJECT: never[];
38
+ ASSIGN: never[];
39
+ UNASSIGN: never[];
40
+ DETECT_DUPLICATE: never[];
41
+ };
42
+ export declare const WRITE_ACTION_SCOPES: ("record.declare-birth" | "record.declaration-submit-for-approval" | "record.register" | "record.registration-print&issue-certified-copies")[];
43
+ export declare function hasAnyOfScopes(a: Scope[], b: Scope[]): boolean;
44
+ //# sourceMappingURL=scopes.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { deserializeQuery } from './serializers/user/deserializer';
2
+ //# sourceMappingURL=serializer.d.ts.map
@@ -1,53 +1,34 @@
1
- import { ActionDocument, ActionUpdate } from './ActionDocument';
2
- import { ArchiveActionInput, AssignActionInput, DeclareActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnassignActionInput, 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';
9
- import { FieldValue } from './FieldValue';
10
10
  import { TranslationConfig } from './TranslationConfig';
11
- export declare function generateActionInput(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 generateActionMetadataInput(configuration: EventConfig, action: ActionType): {};
50
- export declare const eventPayloadGenerator: {
11
+ import { FieldConfig } from './FieldConfig';
12
+ import { WorkqueueConfig } from './WorkqueueConfig';
13
+ 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): {
51
32
  create: (input?: Partial<EventInput>) => {
52
33
  transactionId: string;
53
34
  type: string;
@@ -58,12 +39,11 @@ export declare const eventPayloadGenerator: {
58
39
  id: string;
59
40
  };
60
41
  draft: ({ eventId, actionType }: {
61
- eventId: string;
42
+ eventId: UUID;
62
43
  actionType: ActionType;
63
44
  }, input?: Partial<Draft>) => Draft;
64
45
  actions: {
65
- declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation">>) => {
66
- type: "DECLARE";
46
+ declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
67
47
  transactionId: string;
68
48
  declaration: Record<string, string | number | boolean | {
69
49
  type: string;
@@ -80,6 +60,10 @@ export declare const eventPayloadGenerator: {
80
60
  residentialArea?: string | null | undefined;
81
61
  street?: string | null | undefined;
82
62
  zipCode?: string | null | undefined;
63
+ } | {
64
+ firstname: string;
65
+ surname: string;
66
+ middlename?: string | null | undefined;
83
67
  } | {
84
68
  country: string;
85
69
  district: string;
@@ -102,20 +86,19 @@ export declare const eventPayloadGenerator: {
102
86
  option: string;
103
87
  filename: string;
104
88
  originalFilename: string;
105
- }[] | undefined>;
89
+ }[] | [string, string] | null | undefined>;
106
90
  annotation: {};
91
+ keepAssignment?: boolean | undefined;
92
+ type: "DECLARE";
107
93
  eventId: string;
108
94
  };
109
95
  /**
110
96
  * Notify allows sending incomplete data. Think it as 'partial declare' for now.
111
97
  */
112
- notify: (eventId: string, input?: {
113
- transactionId?: string;
114
- declaration?: Partial<ActionUpdate>;
115
- }) => {
98
+ notify: (eventId: string, input?: Partial<Pick<NotifyActionInput, "transactionId" | "declaration" | "keepAssignment">>) => {
116
99
  type: "NOTIFY";
117
100
  transactionId: string;
118
- declaration: Partial<Record<string, string | number | boolean | {
101
+ declaration: Record<string, string | number | boolean | {
119
102
  type: string;
120
103
  filename: string;
121
104
  originalFilename: string;
@@ -130,6 +113,10 @@ export declare const eventPayloadGenerator: {
130
113
  residentialArea?: string | null | undefined;
131
114
  street?: string | null | undefined;
132
115
  zipCode?: string | null | undefined;
116
+ } | {
117
+ firstname: string;
118
+ surname: string;
119
+ middlename?: string | null | undefined;
133
120
  } | {
134
121
  country: string;
135
122
  district: string;
@@ -152,11 +139,11 @@ export declare const eventPayloadGenerator: {
152
139
  option: string;
153
140
  filename: string;
154
141
  originalFilename: string;
155
- }[] | undefined>>;
142
+ }[] | [string, string] | null | undefined>;
156
143
  eventId: string;
144
+ keepAssignment: boolean | undefined;
157
145
  };
158
- validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "declaration" | "annotation">>) => {
159
- type: "VALIDATE";
146
+ validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
160
147
  transactionId: string;
161
148
  declaration: Record<string, string | number | boolean | {
162
149
  type: string;
@@ -173,6 +160,10 @@ export declare const eventPayloadGenerator: {
173
160
  residentialArea?: string | null | undefined;
174
161
  street?: string | null | undefined;
175
162
  zipCode?: string | null | undefined;
163
+ } | {
164
+ firstname: string;
165
+ surname: string;
166
+ middlename?: string | null | undefined;
176
167
  } | {
177
168
  country: string;
178
169
  district: string;
@@ -195,8 +186,10 @@ export declare const eventPayloadGenerator: {
195
186
  option: string;
196
187
  filename: string;
197
188
  originalFilename: string;
198
- }[] | undefined>;
189
+ }[] | [string, string] | null | undefined>;
199
190
  annotation: {};
191
+ keepAssignment?: boolean | undefined;
192
+ type: "VALIDATE";
200
193
  duplicates: never[];
201
194
  eventId: string;
202
195
  };
@@ -214,26 +207,73 @@ export declare const eventPayloadGenerator: {
214
207
  assignedTo: null;
215
208
  eventId: string;
216
209
  };
217
- archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration">>, isDuplicate?: boolean) => {
218
- type: "ARCHIVE";
210
+ archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration" | "keepAssignment">>, isDuplicate?: boolean) => {
219
211
  transactionId: string;
220
- declaration: {};
221
- annotation: {
222
- isDuplicate: boolean;
223
- };
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;
229
+ surname: string;
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;
255
+ type: "ARCHIVE";
256
+ annotation: {};
224
257
  duplicates: never[];
225
258
  eventId: string;
259
+ reason: {
260
+ message: string;
261
+ isDuplicate: boolean;
262
+ };
226
263
  };
227
- reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation">>) => {
228
- type: "REJECT";
264
+ reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
229
265
  transactionId: string;
230
- declaration: {};
231
266
  annotation: {};
267
+ keepAssignment?: boolean | undefined;
268
+ type: "REJECT";
269
+ declaration: {};
232
270
  duplicates: never[];
233
271
  eventId: string;
272
+ reason: {
273
+ message: string;
274
+ };
234
275
  };
235
- register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation">>) => {
236
- type: "REGISTER";
276
+ register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment" | "registrationNumber">>) => {
237
277
  transactionId: string;
238
278
  declaration: Record<string, string | number | boolean | {
239
279
  type: string;
@@ -250,6 +290,10 @@ export declare const eventPayloadGenerator: {
250
290
  residentialArea?: string | null | undefined;
251
291
  street?: string | null | undefined;
252
292
  zipCode?: string | null | undefined;
293
+ } | {
294
+ firstname: string;
295
+ surname: string;
296
+ middlename?: string | null | undefined;
253
297
  } | {
254
298
  country: string;
255
299
  district: string;
@@ -272,19 +316,23 @@ export declare const eventPayloadGenerator: {
272
316
  option: string;
273
317
  filename: string;
274
318
  originalFilename: string;
275
- }[] | undefined>;
319
+ }[] | [string, string] | null | undefined>;
276
320
  annotation: {};
321
+ registrationNumber?: string | undefined;
322
+ keepAssignment?: boolean | undefined;
323
+ type: "REGISTER";
277
324
  eventId: string;
278
325
  };
279
- printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation">>) => {
280
- type: "PRINT_CERTIFICATE";
326
+ printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
281
327
  transactionId: string;
282
- declaration: {};
283
328
  annotation: {};
329
+ keepAssignment?: boolean | undefined;
330
+ type: "PRINT_CERTIFICATE";
331
+ declaration: {};
284
332
  eventId: string;
285
333
  };
286
334
  correction: {
287
- request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation">>) => {
335
+ request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
288
336
  type: "REQUEST_CORRECTION";
289
337
  transactionId: string;
290
338
  declaration: Record<string, string | number | boolean | {
@@ -302,6 +350,10 @@ export declare const eventPayloadGenerator: {
302
350
  residentialArea?: string | null | undefined;
303
351
  street?: string | null | undefined;
304
352
  zipCode?: string | null | undefined;
353
+ } | {
354
+ firstname: string;
355
+ surname: string;
356
+ middlename?: string | null | undefined;
305
357
  } | {
306
358
  country: string;
307
359
  district: string;
@@ -324,39 +376,79 @@ export declare const eventPayloadGenerator: {
324
376
  option: string;
325
377
  filename: string;
326
378
  originalFilename: string;
327
- }[] | undefined>;
379
+ }[] | [string, string] | null | undefined>;
328
380
  annotation: {};
329
381
  eventId: string;
382
+ keepAssignment: boolean | undefined;
330
383
  };
331
- approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
384
+ approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
332
385
  type: "APPROVE_CORRECTION";
333
386
  transactionId: string;
334
387
  declaration: {};
335
388
  annotation: {};
336
389
  eventId: string;
337
390
  requestId: string;
391
+ keepAssignment: boolean | undefined;
338
392
  };
339
- reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
393
+ reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
340
394
  type: "REJECT_CORRECTION";
341
395
  transactionId: string;
342
396
  declaration: {};
343
397
  annotation: {};
344
398
  eventId: string;
345
399
  requestId: string;
400
+ keepAssignment: boolean | undefined;
346
401
  };
347
402
  };
348
403
  };
349
404
  };
350
- export declare function generateActionDocument({ configuration, action, defaults }: {
405
+ export declare function generateActionDocument({ configuration, action, rng, defaults, user }: {
351
406
  configuration: EventConfig;
352
407
  action: ActionType;
408
+ rng?: () => number;
353
409
  defaults?: Partial<ActionDocument>;
410
+ user?: Partial<{
411
+ signature: string;
412
+ primaryOfficeId: UUID;
413
+ role: TestUserRole;
414
+ id: string;
415
+ }>;
354
416
  }): ActionDocument;
355
- export declare function generateEventDocument({ configuration, actions }: {
417
+ export declare function generateEventDocument({ configuration, actions, rng, user }: {
356
418
  configuration: EventConfig;
357
419
  actions: ActionType[];
420
+ rng?: () => number;
421
+ user?: Partial<{
422
+ signature: string;
423
+ primaryOfficeId: UUID;
424
+ role: TestUserRole;
425
+ id: string;
426
+ }>;
358
427
  }): EventDocument;
359
- export declare function generateEventDraftDocument(eventId: string, actionType?: ActionType, declaration?: Record<string, FieldValue>): Draft;
360
- export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>) => EventIndex;
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;
361
447
  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[];
362
454
  //# sourceMappingURL=test.utils.d.ts.map
@@ -1,2 +1,2 @@
1
- export declare function generateTransactionId(): import("../uuid").UUID;
1
+ export declare function generateTransactionId(): string & import("zod").BRAND<"UUID">;
2
2
  //# sourceMappingURL=transactions.d.ts.map