@opencrvs/toolkit 1.8.0-rc.f9d33b7 → 1.8.0-rc.f9db4f0

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 (43) hide show
  1. package/dist/commons/api/router.d.ts +5742 -8054
  2. package/dist/commons/conditionals/conditionals.d.ts +8 -15
  3. package/dist/commons/conditionals/validate.d.ts +11 -0
  4. package/dist/commons/events/ActionConfig.d.ts +77341 -48420
  5. package/dist/commons/events/ActionDocument.d.ts +4618 -1375
  6. package/dist/commons/events/ActionInput.d.ts +3139 -967
  7. package/dist/commons/events/ActionType.d.ts +10 -1
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +962 -48
  9. package/dist/commons/events/CompositeFieldValue.d.ts +37 -9
  10. package/dist/commons/events/Constants.d.ts +3 -0
  11. package/dist/commons/events/CountryConfigQueryInput.d.ts +4132 -0
  12. package/dist/commons/events/CreatedAtLocation.d.ts +2 -0
  13. package/dist/commons/events/Draft.d.ts +274 -98
  14. package/dist/commons/events/EventConfig.d.ts +30722 -19227
  15. package/dist/commons/events/EventDocument.d.ts +2564 -929
  16. package/dist/commons/events/EventIndex.d.ts +1571 -283
  17. package/dist/commons/events/EventInput.d.ts +0 -13
  18. package/dist/commons/events/EventMetadata.d.ts +338 -48
  19. package/dist/commons/events/FieldConfig.d.ts +3741 -1283
  20. package/dist/commons/events/FieldType.d.ts +7 -2
  21. package/dist/commons/events/FieldTypeMapping.d.ts +154 -73
  22. package/dist/commons/events/FieldValue.d.ts +89 -19
  23. package/dist/commons/events/FormConfig.d.ts +30389 -15335
  24. package/dist/commons/events/PageConfig.d.ts +6118 -2428
  25. package/dist/commons/events/SummaryConfig.d.ts +17 -5
  26. package/dist/commons/events/User.d.ts +34 -7
  27. package/dist/commons/events/WorkqueueColumnConfig.d.ts +53 -0
  28. package/dist/commons/events/WorkqueueConfig.d.ts +8088 -16
  29. package/dist/commons/events/defineConfig.d.ts +5258 -3735
  30. package/dist/commons/events/event.d.ts +32 -11
  31. package/dist/commons/events/field.d.ts +46 -20
  32. package/dist/commons/events/index.d.ts +5 -0
  33. package/dist/commons/events/scopes.d.ts +23 -4
  34. package/dist/commons/events/serializer.d.ts +2 -0
  35. package/dist/commons/events/test.utils.d.ts +206 -53
  36. package/dist/commons/events/transactions.d.ts +1 -1
  37. package/dist/commons/events/utils.d.ts +12628 -1087
  38. package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
  39. package/dist/conditionals/index.js +67 -60
  40. package/dist/events/index.js +4849 -2327
  41. package/dist/scopes/index.d.ts +247 -1
  42. package/dist/scopes/index.js +231 -1
  43. package/package.json +3 -3
@@ -1,5 +1,6 @@
1
+ import { ActionType } from './ActionType';
1
2
  import { EventFieldId } from './AdvancedSearchConfig';
2
- import { SelectOption } from './FieldConfig';
3
+ import { WorkqueueColumnKeys, WorkqueueColumnValue } from './WorkqueueColumnConfig';
3
4
  /**
4
5
  * Creates a function that acts like a callable + static method container.
5
6
  *
@@ -7,19 +8,39 @@ import { SelectOption } from './FieldConfig';
7
8
  * event('status') // → returns search config
8
9
  * event.hasAction('CLICKED') // → returns conditional
9
10
  */
10
- declare function eventFn(fieldId: EventFieldId, options?: SelectOption[]): {
11
- fieldId: "status" | "trackingId";
12
- options: {
13
- value: string;
14
- label: import("./TranslationConfig").TranslationConfig;
15
- }[] | undefined;
16
- config: {
17
- type: "EXACT";
11
+ declare function eventFn(fieldId: EventFieldId): {
12
+ range: () => {
13
+ fieldId: "status" | "updatedAt" | "trackingId" | "legalStatuses.REGISTERED.acceptedAt" | "legalStatuses.REGISTERED.createdAtLocation";
14
+ fieldType: "event";
15
+ } & {
16
+ config: {
17
+ type: "range";
18
+ };
19
+ };
20
+ exact: () => {
21
+ fieldId: "status" | "updatedAt" | "trackingId" | "legalStatuses.REGISTERED.acceptedAt" | "legalStatuses.REGISTERED.createdAtLocation";
22
+ fieldType: "event";
23
+ } & {
24
+ config: {
25
+ type: "exact";
26
+ };
27
+ };
28
+ fuzzy: () => {
29
+ fieldId: "status" | "updatedAt" | "trackingId" | "legalStatuses.REGISTERED.acceptedAt" | "legalStatuses.REGISTERED.createdAtLocation";
30
+ fieldType: "event";
31
+ } & {
32
+ config: {
33
+ type: "fuzzy";
34
+ };
18
35
  };
19
- fieldType: "event";
20
36
  };
21
37
  declare const event: typeof eventFn & {
22
- hasAction: (action: import("./ActionType").ActionType) => import("../conditionals/conditionals").JSONSchema;
38
+ /**
39
+ * Checks if the event contains a specific action type.
40
+ * @param action - The action type to check for.
41
+ */
42
+ hasAction: (action: ActionType) => import("../conditionals/conditionals").JSONSchema;
43
+ field(field: WorkqueueColumnKeys): WorkqueueColumnValue;
23
44
  };
24
45
  export { event };
25
46
  //# sourceMappingURL=event.d.ts.map
@@ -1,38 +1,69 @@
1
+ import { FieldConditional } from './Conditional';
2
+ import { TranslationConfig } from './TranslationConfig';
3
+ import { SelectOption, ValidationConfig } from './FieldConfig';
1
4
  /**
2
5
  * Entry point for defining conditional logic or configuration for a form field.
3
6
  * @param fieldId - The ID of the field to define rules or config for.
4
7
  * @returns An object combining conditional methods and configuration builders.
5
8
  */
6
- export declare function field(fieldId: string): {
9
+ export declare function field(fieldId: string, options?: {
10
+ options?: SelectOption[];
11
+ excludeInSearchQuery?: boolean;
12
+ alternateFieldIds?: string[];
13
+ conditionals?: FieldConditional[];
14
+ validations?: ValidationConfig[];
15
+ searchCriteriaLabelPrefix?: TranslationConfig;
16
+ }): {
7
17
  range: () => {
8
- config: {
9
- type: "RANGE";
10
- };
18
+ options?: SelectOption[];
19
+ excludeInSearchQuery?: boolean;
20
+ alternateFieldIds?: string[];
21
+ conditionals?: FieldConditional[];
22
+ validations?: ValidationConfig[];
23
+ searchCriteriaLabelPrefix?: TranslationConfig;
11
24
  fieldId: string;
12
25
  fieldType: "field";
13
- };
14
- exact: () => {
26
+ } & {
15
27
  config: {
16
- type: "EXACT";
28
+ type: "range";
17
29
  };
30
+ };
31
+ exact: () => {
32
+ options?: SelectOption[];
33
+ excludeInSearchQuery?: boolean;
34
+ alternateFieldIds?: string[];
35
+ conditionals?: FieldConditional[];
36
+ validations?: ValidationConfig[];
37
+ searchCriteriaLabelPrefix?: TranslationConfig;
18
38
  fieldId: string;
19
39
  fieldType: "field";
20
- };
21
- fuzzy: () => {
40
+ } & {
22
41
  config: {
23
- type: "FUZZY";
42
+ type: "exact";
24
43
  };
44
+ };
45
+ fuzzy: () => {
46
+ options?: SelectOption[];
47
+ excludeInSearchQuery?: boolean;
48
+ alternateFieldIds?: string[];
49
+ conditionals?: FieldConditional[];
50
+ validations?: ValidationConfig[];
51
+ searchCriteriaLabelPrefix?: TranslationConfig;
25
52
  fieldId: string;
26
53
  fieldType: "field";
54
+ } & {
55
+ config: {
56
+ type: "fuzzy";
57
+ };
27
58
  };
59
+ $$field: string;
28
60
  isAfter: () => {
29
61
  days: (days: number) => {
30
62
  inPast: () => import("../conditionals/conditionals").JSONSchema;
31
63
  inFuture: () => import("../conditionals/conditionals").JSONSchema;
32
64
  };
33
65
  date: (date: string | {
34
- [key: string]: unknown;
35
- _fieldId: string;
66
+ $$field: string;
36
67
  }) => import("../conditionals/conditionals").JSONSchema;
37
68
  now: () => import("../conditionals/conditionals").JSONSchema;
38
69
  };
@@ -42,14 +73,12 @@ export declare function field(fieldId: string): {
42
73
  inFuture: () => import("../conditionals/conditionals").JSONSchema;
43
74
  };
44
75
  date: (date: string | {
45
- [key: string]: unknown;
46
- _fieldId: string;
76
+ $$field: string;
47
77
  }) => import("../conditionals/conditionals").JSONSchema;
48
78
  now: () => import("../conditionals/conditionals").JSONSchema;
49
79
  };
50
80
  isEqualTo: (value: string | boolean | {
51
- [key: string]: unknown;
52
- _fieldId: string;
81
+ $$field: string;
53
82
  }) => import("../conditionals/conditionals").JSONSchema;
54
83
  isFalsy: () => import("../conditionals/conditionals").JSONSchema;
55
84
  isUndefined: () => import("../conditionals/conditionals").JSONSchema;
@@ -60,9 +89,6 @@ export declare function field(fieldId: string): {
60
89
  getId: () => {
61
90
  fieldId: string;
62
91
  };
63
- /**
64
- * @private Internal property used for field reference tracking.
65
- */
66
- _fieldId: string;
92
+ object: (options: Record<string, any>) => import("../conditionals/conditionals").JSONSchema;
67
93
  };
68
94
  //# 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';
@@ -31,6 +34,8 @@ export * from './AdvancedSearchConfig';
31
34
  export * from './test.utils';
32
35
  export * from './TemplateConfig';
33
36
  export * from './scopes';
37
+ export * from './serializer';
38
+ export * from './state/availableActions';
34
39
  export * from '../conditionals/conditionals';
35
40
  export * from '../conditionals/validate';
36
41
  export * from './field';
@@ -1,6 +1,4 @@
1
1
  import { Scope } from '../scopes';
2
- import { ActionType } from './ActionType';
3
- export declare function hasAnyOfScopes(a: Scope[], b: Scope[]): boolean;
4
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"];
5
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")[];
6
4
  export declare const ACTION_ALLOWED_SCOPES: {
@@ -12,7 +10,8 @@ export declare const ACTION_ALLOWED_SCOPES: {
12
10
  VALIDATE: ["record.declaration-submit-for-approval", "record.register"];
13
11
  REGISTER: ["record.register"];
14
12
  PRINT_CERTIFICATE: ["record.registration-print&issue-certified-copies"];
15
- REQUEST_CORRECTION: ["record.registration-request-correction"];
13
+ REQUEST_CORRECTION: ["record.registration-request-correction", "record.registration-correct"];
14
+ REVIEW_CORRECTION_REQUEST: ["record.registration-correct"];
16
15
  REJECT_CORRECTION: ["record.registration-correct"];
17
16
  APPROVE_CORRECTION: ["record.registration-correct"];
18
17
  MARKED_AS_DUPLICATE: ["record.declaration-archive"];
@@ -22,5 +21,25 @@ export declare const ACTION_ALLOWED_SCOPES: {
22
21
  UNASSIGN: null;
23
22
  DETECT_DUPLICATE: [];
24
23
  };
25
- export declare function filterUnallowedActions(actions: ActionType[], userScopes: Scope[]): ActionType[];
24
+ export declare const ACTION_ALLOWED_CONFIGURABLE_SCOPES: {
25
+ READ: never[];
26
+ CREATE: "record.notify"[];
27
+ NOTIFY: "record.notify"[];
28
+ DECLARE: never[];
29
+ DELETE: never[];
30
+ VALIDATE: never[];
31
+ REGISTER: never[];
32
+ PRINT_CERTIFICATE: never[];
33
+ REQUEST_CORRECTION: never[];
34
+ REJECT_CORRECTION: never[];
35
+ APPROVE_CORRECTION: never[];
36
+ MARKED_AS_DUPLICATE: never[];
37
+ ARCHIVE: never[];
38
+ REJECT: never[];
39
+ ASSIGN: never[];
40
+ UNASSIGN: never[];
41
+ DETECT_DUPLICATE: never[];
42
+ };
43
+ export declare const WRITE_ACTION_SCOPES: ("record.declare-birth" | "record.declaration-submit-for-approval" | "record.register" | "record.registration-print&issue-certified-copies")[];
44
+ export declare function hasAnyOfScopes(a: Scope[], b: Scope[]): boolean;
26
45
  //# sourceMappingURL=scopes.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { deserializeQuery } from './serializers/user/deserializer';
2
+ //# sourceMappingURL=serializer.d.ts.map
@@ -1,16 +1,39 @@
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 { ApproveCorrectionActionInput, ArchiveActionInput, AssignActionInput, DeclareActionInput, NotifyActionInput, RegisterActionInput, RejectCorrectionActionInput, 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 generateActionDeclarationInput(configuration: EventConfig, action: ActionType): Partial<import("./ActionDocument").EventState>;
12
- export declare function generateActionAnnotationInput(configuration: EventConfig, action: ActionType): {};
13
- 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
+ * IANA timezone used in testing. Used for queries that expect similar results independent of the users location (e.g. when event was registered.)
17
+ * Since we query by range, providing UTC offset will result to different results when DST changes during the range.
18
+ */
19
+ export declare const TEST_SYSTEM_IANA_TIMEZONE = "Asia/Dhaka";
20
+ /**
21
+ * In real application, the roles are defined in the countryconfig.
22
+ * These are just for testing purposes to generate realistic mock data.
23
+ */
24
+ export declare const TestUserRole: z.ZodEnum<["FIELD_AGENT", "LOCAL_REGISTRAR", "LOCAL_SYSTEM_ADMIN", "NATIONAL_REGISTRAR", "REGISTRATION_AGENT"]>;
25
+ export type TestUserRole = z.infer<typeof TestUserRole>;
26
+ export declare function generateRandomName(rng: () => number): {
27
+ firstname: string;
28
+ surname: string;
29
+ };
30
+ /**
31
+ * Quick-and-dirty mock data generator for event actions.
32
+ */
33
+ export declare function mapFieldTypeToMockValue(field: FieldConfig, i: number, rng: () => number): FieldValue;
34
+ export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType, rng: () => number): EventState;
35
+ export declare function generateActionAnnotationInput(configuration: EventConfig, action: ActionType, rng: () => number): {};
36
+ export declare function eventPayloadGenerator(rng: () => number): {
14
37
  create: (input?: Partial<EventInput>) => {
15
38
  transactionId: string;
16
39
  type: string;
@@ -20,17 +43,17 @@ export declare const eventPayloadGenerator: {
20
43
  type: string;
21
44
  id: string;
22
45
  };
23
- draft: ({ eventId, actionType }: {
24
- eventId: string;
46
+ draft: ({ eventId, actionType, annotation }: {
47
+ eventId: UUID;
25
48
  actionType: ActionType;
49
+ annotation?: Record<string, any>;
26
50
  }, input?: Partial<Draft>) => Draft;
27
51
  actions: {
28
- declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation">>) => {
29
- type: "DECLARE";
52
+ declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
30
53
  transactionId: string;
31
54
  declaration: Record<string, string | number | boolean | {
32
55
  type: string;
33
- filename: string;
56
+ path: string;
34
57
  originalFilename: string;
35
58
  } | {
36
59
  country: string;
@@ -43,6 +66,10 @@ export declare const eventPayloadGenerator: {
43
66
  residentialArea?: string | null | undefined;
44
67
  street?: string | null | undefined;
45
68
  zipCode?: string | null | undefined;
69
+ } | {
70
+ firstname?: string | null | undefined;
71
+ surname?: string | null | undefined;
72
+ middlename?: string | null | undefined;
46
73
  } | {
47
74
  country: string;
48
75
  district: string;
@@ -63,24 +90,26 @@ export declare const eventPayloadGenerator: {
63
90
  } | {
64
91
  type: string;
65
92
  option: string;
66
- filename: string;
93
+ path: string;
67
94
  originalFilename: string;
68
- }[] | undefined>;
95
+ }[] | {
96
+ start: string;
97
+ end: string;
98
+ } | null | undefined>;
69
99
  annotation: {};
100
+ keepAssignment?: boolean | undefined;
101
+ type: "DECLARE";
70
102
  eventId: string;
71
103
  };
72
104
  /**
73
105
  * Notify allows sending incomplete data. Think it as 'partial declare' for now.
74
106
  */
75
- notify: (eventId: string, input?: {
76
- transactionId?: string;
77
- declaration?: Partial<ActionUpdate>;
78
- }) => {
107
+ notify: (eventId: string, input?: Partial<Pick<NotifyActionInput, "transactionId" | "declaration" | "keepAssignment">>) => {
79
108
  type: "NOTIFY";
80
109
  transactionId: string;
81
- declaration: Partial<Record<string, string | number | boolean | {
110
+ declaration: Record<string, string | number | boolean | {
82
111
  type: string;
83
- filename: string;
112
+ path: string;
84
113
  originalFilename: string;
85
114
  } | {
86
115
  country: string;
@@ -93,6 +122,10 @@ export declare const eventPayloadGenerator: {
93
122
  residentialArea?: string | null | undefined;
94
123
  street?: string | null | undefined;
95
124
  zipCode?: string | null | undefined;
125
+ } | {
126
+ firstname?: string | null | undefined;
127
+ surname?: string | null | undefined;
128
+ middlename?: string | null | undefined;
96
129
  } | {
97
130
  country: string;
98
131
  district: string;
@@ -113,17 +146,20 @@ export declare const eventPayloadGenerator: {
113
146
  } | {
114
147
  type: string;
115
148
  option: string;
116
- filename: string;
149
+ path: string;
117
150
  originalFilename: string;
118
- }[] | undefined>>;
151
+ }[] | {
152
+ start: string;
153
+ end: string;
154
+ } | null | undefined>;
119
155
  eventId: string;
156
+ keepAssignment: boolean | undefined;
120
157
  };
121
- validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "declaration" | "annotation">>) => {
122
- type: "VALIDATE";
158
+ validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
123
159
  transactionId: string;
124
160
  declaration: Record<string, string | number | boolean | {
125
161
  type: string;
126
- filename: string;
162
+ path: string;
127
163
  originalFilename: string;
128
164
  } | {
129
165
  country: string;
@@ -136,6 +172,10 @@ export declare const eventPayloadGenerator: {
136
172
  residentialArea?: string | null | undefined;
137
173
  street?: string | null | undefined;
138
174
  zipCode?: string | null | undefined;
175
+ } | {
176
+ firstname?: string | null | undefined;
177
+ surname?: string | null | undefined;
178
+ middlename?: string | null | undefined;
139
179
  } | {
140
180
  country: string;
141
181
  district: string;
@@ -156,10 +196,15 @@ export declare const eventPayloadGenerator: {
156
196
  } | {
157
197
  type: string;
158
198
  option: string;
159
- filename: string;
199
+ path: string;
160
200
  originalFilename: string;
161
- }[] | undefined>;
201
+ }[] | {
202
+ start: string;
203
+ end: string;
204
+ } | null | undefined>;
162
205
  annotation: {};
206
+ keepAssignment?: boolean | undefined;
207
+ type: "VALIDATE";
163
208
  duplicates: never[];
164
209
  eventId: string;
165
210
  };
@@ -177,30 +222,80 @@ export declare const eventPayloadGenerator: {
177
222
  assignedTo: null;
178
223
  eventId: string;
179
224
  };
180
- archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration">>, isDuplicate?: boolean) => {
181
- type: "ARCHIVE";
225
+ archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration" | "keepAssignment">>, isDuplicate?: boolean) => {
182
226
  transactionId: string;
183
- declaration: {};
184
- annotation: {
185
- isDuplicate: boolean;
186
- };
227
+ declaration: Record<string, string | number | boolean | {
228
+ type: string;
229
+ path: string;
230
+ originalFilename: string;
231
+ } | {
232
+ country: string;
233
+ district: string;
234
+ addressType: "DOMESTIC";
235
+ province: string;
236
+ urbanOrRural: "URBAN";
237
+ number?: string | null | undefined;
238
+ town?: string | null | undefined;
239
+ residentialArea?: string | null | undefined;
240
+ street?: string | null | undefined;
241
+ zipCode?: string | null | undefined;
242
+ } | {
243
+ firstname?: string | null | undefined;
244
+ surname?: string | null | undefined;
245
+ middlename?: string | null | undefined;
246
+ } | {
247
+ country: string;
248
+ district: string;
249
+ addressType: "DOMESTIC";
250
+ province: string;
251
+ urbanOrRural: "RURAL";
252
+ village?: string | null | undefined;
253
+ } | {
254
+ country: string;
255
+ state: string;
256
+ addressType: "INTERNATIONAL";
257
+ district2: string;
258
+ cityOrTown?: string | null | undefined;
259
+ addressLine1?: string | null | undefined;
260
+ addressLine2?: string | null | undefined;
261
+ addressLine3?: string | null | undefined;
262
+ postcodeOrZip?: string | null | undefined;
263
+ } | {
264
+ type: string;
265
+ option: string;
266
+ path: string;
267
+ originalFilename: string;
268
+ }[] | {
269
+ start: string;
270
+ end: string;
271
+ } | null | undefined>;
272
+ keepAssignment?: boolean | undefined;
273
+ type: "ARCHIVE";
274
+ annotation: {};
187
275
  duplicates: never[];
188
276
  eventId: string;
277
+ reason: {
278
+ message: string;
279
+ isDuplicate: boolean;
280
+ };
189
281
  };
190
- reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation">>) => {
191
- type: "REJECT";
282
+ reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
192
283
  transactionId: string;
193
- declaration: {};
194
284
  annotation: {};
285
+ keepAssignment?: boolean | undefined;
286
+ type: "REJECT";
287
+ declaration: {};
195
288
  duplicates: never[];
196
289
  eventId: string;
290
+ reason: {
291
+ message: string;
292
+ };
197
293
  };
198
- register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation">>) => {
199
- type: "REGISTER";
294
+ register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment" | "registrationNumber">>) => {
200
295
  transactionId: string;
201
296
  declaration: Record<string, string | number | boolean | {
202
297
  type: string;
203
- filename: string;
298
+ path: string;
204
299
  originalFilename: string;
205
300
  } | {
206
301
  country: string;
@@ -213,6 +308,10 @@ export declare const eventPayloadGenerator: {
213
308
  residentialArea?: string | null | undefined;
214
309
  street?: string | null | undefined;
215
310
  zipCode?: string | null | undefined;
311
+ } | {
312
+ firstname?: string | null | undefined;
313
+ surname?: string | null | undefined;
314
+ middlename?: string | null | undefined;
216
315
  } | {
217
316
  country: string;
218
317
  district: string;
@@ -233,26 +332,33 @@ export declare const eventPayloadGenerator: {
233
332
  } | {
234
333
  type: string;
235
334
  option: string;
236
- filename: string;
335
+ path: string;
237
336
  originalFilename: string;
238
- }[] | undefined>;
337
+ }[] | {
338
+ start: string;
339
+ end: string;
340
+ } | null | undefined>;
239
341
  annotation: {};
342
+ registrationNumber?: string | undefined;
343
+ keepAssignment?: boolean | undefined;
344
+ type: "REGISTER";
240
345
  eventId: string;
241
346
  };
242
- printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation">>) => {
243
- type: "PRINT_CERTIFICATE";
347
+ printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
244
348
  transactionId: string;
245
- declaration: {};
246
349
  annotation: {};
350
+ keepAssignment?: boolean | undefined;
351
+ type: "PRINT_CERTIFICATE";
352
+ declaration: {};
247
353
  eventId: string;
248
354
  };
249
355
  correction: {
250
- request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation">>) => {
356
+ request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
251
357
  type: "REQUEST_CORRECTION";
252
358
  transactionId: string;
253
359
  declaration: Record<string, string | number | boolean | {
254
360
  type: string;
255
- filename: string;
361
+ path: string;
256
362
  originalFilename: string;
257
363
  } | {
258
364
  country: string;
@@ -265,6 +371,10 @@ export declare const eventPayloadGenerator: {
265
371
  residentialArea?: string | null | undefined;
266
372
  street?: string | null | undefined;
267
373
  zipCode?: string | null | undefined;
374
+ } | {
375
+ firstname?: string | null | undefined;
376
+ surname?: string | null | undefined;
377
+ middlename?: string | null | undefined;
268
378
  } | {
269
379
  country: string;
270
380
  district: string;
@@ -285,41 +395,84 @@ export declare const eventPayloadGenerator: {
285
395
  } | {
286
396
  type: string;
287
397
  option: string;
288
- filename: string;
398
+ path: string;
289
399
  originalFilename: string;
290
- }[] | undefined>;
400
+ }[] | {
401
+ start: string;
402
+ end: string;
403
+ } | null | undefined>;
291
404
  annotation: {};
292
405
  eventId: string;
406
+ keepAssignment: boolean | undefined;
293
407
  };
294
- approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
408
+ approve: (eventId: string, requestId: string, input?: Partial<Pick<ApproveCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
295
409
  type: "APPROVE_CORRECTION";
296
410
  transactionId: string;
297
411
  declaration: {};
298
412
  annotation: {};
299
413
  eventId: string;
300
414
  requestId: string;
415
+ keepAssignment: boolean | undefined;
301
416
  };
302
- reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
417
+ reject: (eventId: string, requestId: string, input?: Partial<Pick<RejectCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
303
418
  type: "REJECT_CORRECTION";
304
419
  transactionId: string;
305
420
  declaration: {};
306
421
  annotation: {};
307
422
  eventId: string;
308
423
  requestId: string;
424
+ keepAssignment: boolean | undefined;
309
425
  };
310
426
  };
311
427
  };
312
428
  };
313
- export declare function generateActionDocument({ configuration, action, defaults }: {
429
+ export declare function generateActionDocument({ configuration, action, rng, defaults, user }: {
314
430
  configuration: EventConfig;
315
431
  action: ActionType;
432
+ rng?: () => number;
316
433
  defaults?: Partial<ActionDocument>;
434
+ user?: Partial<{
435
+ signature: string;
436
+ primaryOfficeId: UUID;
437
+ role: TestUserRole;
438
+ id: string;
439
+ }>;
317
440
  }): ActionDocument;
318
- export declare function generateEventDocument({ configuration, actions }: {
441
+ export declare function generateEventDocument({ configuration, actions, rng, user }: {
319
442
  configuration: EventConfig;
320
443
  actions: ActionType[];
444
+ rng?: () => number;
445
+ user?: Partial<{
446
+ signature: string;
447
+ primaryOfficeId: UUID;
448
+ role: TestUserRole;
449
+ id: string;
450
+ }>;
321
451
  }): EventDocument;
322
- export declare function generateEventDraftDocument(eventId: string, actionType?: ActionType, declaration?: Record<string, FieldValue>): Draft;
323
- export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>) => EventIndex;
452
+ export declare function generateEventDraftDocument({ eventId, actionType, rng, declaration }: {
453
+ eventId: UUID;
454
+ actionType: ActionType;
455
+ rng?: () => number;
456
+ declaration?: EventState;
457
+ }): Draft;
458
+ export declare function getRandomDatetime(rng: () => number, start: Date, end: Date): string;
459
+ export declare function getRandomDate(rng: () => number, start: string, end: string): string;
460
+ /**
461
+ * Useful for testing when we need deterministic outcome.
462
+ * @param seed - Seed value for the pseudo-random number generator
463
+ *
464
+ * @returns A function that generates pseudo-random numbers between 0 and 1 [0, 1)
465
+ */
466
+ export declare function createPrng(seed: number): () => number;
467
+ export declare function generateUuid(rng?: () => number): UUID;
468
+ export declare function generateRegistrationNumber(rng: () => number): string;
469
+ export declare function generateRandomSignature(rng: () => number): string;
470
+ export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>, seed?: number) => EventIndex;
324
471
  export declare const generateTranslationConfig: (message: string) => TranslationConfig;
472
+ export declare const BearerTokenByUserType: {
473
+ fieldAgent: string;
474
+ registrationAgent: string;
475
+ localRegistrar: string;
476
+ };
477
+ export declare const generateWorkqueues: (slug?: string) => WorkqueueConfig[];
325
478
  //# 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