@opencrvs/toolkit 1.8.0-rc.fcd89ec → 1.8.0-rc.fcf7cb3

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 (48) hide show
  1. package/dist/commons/api/router.d.ts +8046 -8610
  2. package/dist/commons/conditionals/conditionals.d.ts +8 -15
  3. package/dist/commons/conditionals/validate.d.ts +14 -0
  4. package/dist/commons/events/ActionConfig.d.ts +68541 -36072
  5. package/dist/commons/events/ActionDocument.d.ts +3961 -1227
  6. package/dist/commons/events/ActionInput.d.ts +3138 -966
  7. package/dist/commons/events/ActionType.d.ts +4 -0
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +414 -71
  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 +1 -2
  13. package/dist/commons/events/Draft.d.ts +271 -93
  14. package/dist/commons/events/EventConfig.d.ts +33783 -18386
  15. package/dist/commons/events/EventDocument.d.ts +2522 -816
  16. package/dist/commons/events/EventIndex.d.ts +1411 -313
  17. package/dist/commons/events/EventInput.d.ts +0 -13
  18. package/dist/commons/events/EventMetadata.d.ts +113 -76
  19. package/dist/commons/events/FieldConfig.d.ts +4017 -1558
  20. package/dist/commons/events/FieldType.d.ts +10 -1
  21. package/dist/commons/events/FieldTypeMapping.d.ts +149 -75
  22. package/dist/commons/events/FieldValue.d.ts +87 -20
  23. package/dist/commons/events/FormConfig.d.ts +18663 -8055
  24. package/dist/commons/events/PageConfig.d.ts +4601 -1945
  25. package/dist/commons/events/SummaryConfig.d.ts +0 -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 +7802 -308
  29. package/dist/commons/events/defineConfig.d.ts +3535 -860
  30. package/dist/commons/events/event.d.ts +21 -21
  31. package/dist/commons/events/field.d.ts +36 -10
  32. package/dist/commons/events/index.d.ts +5 -0
  33. package/dist/commons/events/scopes.d.ts +1 -2
  34. package/dist/commons/events/serializer.d.ts +2 -0
  35. package/dist/commons/events/test.utils.d.ts +206 -52
  36. package/dist/commons/events/transactions.d.ts +1 -1
  37. package/dist/commons/events/utils.d.ts +14324 -1570
  38. package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
  39. package/dist/conditionals/index.js +70 -62
  40. package/dist/events/index.js +3527 -1656
  41. package/dist/scopes/index.d.ts +96 -7
  42. package/dist/scopes/index.js +105 -26
  43. package/package.json +3 -3
  44. package/tsconfig.json +1 -1
  45. package/dist/commons/conditionals/conditionals.test.d.ts +0 -2
  46. package/dist/commons/conditionals/validate-address.test.d.ts +0 -2
  47. package/dist/commons/conditionals/validate.test.d.ts +0 -2
  48. package/dist/commons/events/utils.test.d.ts +0 -2
@@ -1,6 +1,6 @@
1
- import { EventFieldId } from './AdvancedSearchConfig';
2
- import { EventMetadataKeys, EventMetadataParameter } from './EventMetadata';
3
- import { SelectOption } from './FieldConfig';
1
+ import { ActionType } from './ActionType';
2
+ import { EventFieldIdInput } from './AdvancedSearchConfig';
3
+ import { WorkqueueColumnKeys, WorkqueueColumnValue } from './WorkqueueColumnConfig';
4
4
  /**
5
5
  * Creates a function that acts like a callable + static method container.
6
6
  *
@@ -8,13 +8,9 @@ import { SelectOption } from './FieldConfig';
8
8
  * event('status') // → returns search config
9
9
  * event.hasAction('CLICKED') // → returns conditional
10
10
  */
11
- declare function eventFn(fieldId: EventFieldId, options?: SelectOption[]): {
11
+ declare function eventFn(fieldId: EventFieldIdInput): {
12
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;
13
+ fieldId: "event.status" | "event.updatedAt" | "event.trackingId" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation";
18
14
  fieldType: "event";
19
15
  } & {
20
16
  config: {
@@ -22,11 +18,7 @@ declare function eventFn(fieldId: EventFieldId, options?: SelectOption[]): {
22
18
  };
23
19
  };
24
20
  exact: () => {
25
- fieldId: "status" | "updatedAt" | "trackingId" | "legalStatus.REGISTERED.createdAt" | "legalStatus.REGISTERED.createdAtLocation";
26
- options: {
27
- value: string;
28
- label: import("./TranslationConfig").TranslationConfig;
29
- }[] | undefined;
21
+ fieldId: "event.status" | "event.updatedAt" | "event.trackingId" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation";
30
22
  fieldType: "event";
31
23
  } & {
32
24
  config: {
@@ -34,21 +26,29 @@ declare function eventFn(fieldId: EventFieldId, options?: SelectOption[]): {
34
26
  };
35
27
  };
36
28
  fuzzy: () => {
37
- fieldId: "status" | "updatedAt" | "trackingId" | "legalStatus.REGISTERED.createdAt" | "legalStatus.REGISTERED.createdAtLocation";
38
- options: {
39
- value: string;
40
- label: import("./TranslationConfig").TranslationConfig;
41
- }[] | undefined;
29
+ fieldId: "event.status" | "event.updatedAt" | "event.trackingId" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation";
42
30
  fieldType: "event";
43
31
  } & {
44
32
  config: {
45
33
  type: "fuzzy";
46
34
  };
47
35
  };
36
+ within: () => {
37
+ fieldId: "event.status" | "event.updatedAt" | "event.trackingId" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation";
38
+ fieldType: "event";
39
+ } & {
40
+ config: {
41
+ type: "within";
42
+ };
43
+ };
48
44
  };
49
45
  declare const event: typeof eventFn & {
50
- field(field: EventMetadataKeys): EventMetadataParameter;
51
- hasAction: (action: import("./ActionType").ActionType) => import("../conditionals/conditionals").JSONSchema;
46
+ /**
47
+ * Checks if the event contains a specific action type.
48
+ * @param action - The action type to check for.
49
+ */
50
+ hasAction: (action: ActionType) => import("../conditionals/conditionals").JSONSchema;
51
+ field(field: WorkqueueColumnKeys): WorkqueueColumnValue;
52
52
  };
53
53
  export { event };
54
54
  //# sourceMappingURL=event.d.ts.map
@@ -1,16 +1,25 @@
1
1
  import { FieldConditional } from './Conditional';
2
2
  import { TranslationConfig } from './TranslationConfig';
3
+ import { SelectOption, ValidationConfig } from './FieldConfig';
3
4
  /**
4
5
  * Entry point for defining conditional logic or configuration for a form field.
5
6
  * @param fieldId - The ID of the field to define rules or config for.
6
7
  * @returns An object combining conditional methods and configuration builders.
7
8
  */
8
9
  export declare function field(fieldId: string, options?: {
10
+ options?: SelectOption[];
11
+ excludeInSearchQuery?: boolean;
12
+ alternateFieldIds?: string[];
9
13
  conditionals?: FieldConditional[];
14
+ validations?: ValidationConfig[];
10
15
  searchCriteriaLabelPrefix?: TranslationConfig;
11
16
  }): {
12
17
  range: () => {
18
+ options?: SelectOption[];
19
+ excludeInSearchQuery?: boolean;
20
+ alternateFieldIds?: string[];
13
21
  conditionals?: FieldConditional[];
22
+ validations?: ValidationConfig[];
14
23
  searchCriteriaLabelPrefix?: TranslationConfig;
15
24
  fieldId: string;
16
25
  fieldType: "field";
@@ -20,7 +29,11 @@ export declare function field(fieldId: string, options?: {
20
29
  };
21
30
  };
22
31
  exact: () => {
32
+ options?: SelectOption[];
33
+ excludeInSearchQuery?: boolean;
34
+ alternateFieldIds?: string[];
23
35
  conditionals?: FieldConditional[];
36
+ validations?: ValidationConfig[];
24
37
  searchCriteriaLabelPrefix?: TranslationConfig;
25
38
  fieldId: string;
26
39
  fieldType: "field";
@@ -30,7 +43,11 @@ export declare function field(fieldId: string, options?: {
30
43
  };
31
44
  };
32
45
  fuzzy: () => {
46
+ options?: SelectOption[];
47
+ excludeInSearchQuery?: boolean;
48
+ alternateFieldIds?: string[];
33
49
  conditionals?: FieldConditional[];
50
+ validations?: ValidationConfig[];
34
51
  searchCriteriaLabelPrefix?: TranslationConfig;
35
52
  fieldId: string;
36
53
  fieldType: "field";
@@ -39,14 +56,28 @@ export declare function field(fieldId: string, options?: {
39
56
  type: "fuzzy";
40
57
  };
41
58
  };
59
+ within: () => {
60
+ options?: SelectOption[];
61
+ excludeInSearchQuery?: boolean;
62
+ alternateFieldIds?: string[];
63
+ conditionals?: FieldConditional[];
64
+ validations?: ValidationConfig[];
65
+ searchCriteriaLabelPrefix?: TranslationConfig;
66
+ fieldId: string;
67
+ fieldType: "field";
68
+ } & {
69
+ config: {
70
+ type: "within";
71
+ };
72
+ };
73
+ $$field: string;
42
74
  isAfter: () => {
43
75
  days: (days: number) => {
44
76
  inPast: () => import("../conditionals/conditionals").JSONSchema;
45
77
  inFuture: () => import("../conditionals/conditionals").JSONSchema;
46
78
  };
47
79
  date: (date: string | {
48
- [key: string]: unknown;
49
- _fieldId: string;
80
+ $$field: string;
50
81
  }) => import("../conditionals/conditionals").JSONSchema;
51
82
  now: () => import("../conditionals/conditionals").JSONSchema;
52
83
  };
@@ -56,14 +87,12 @@ export declare function field(fieldId: string, options?: {
56
87
  inFuture: () => import("../conditionals/conditionals").JSONSchema;
57
88
  };
58
89
  date: (date: string | {
59
- [key: string]: unknown;
60
- _fieldId: string;
90
+ $$field: string;
61
91
  }) => import("../conditionals/conditionals").JSONSchema;
62
92
  now: () => import("../conditionals/conditionals").JSONSchema;
63
93
  };
64
94
  isEqualTo: (value: string | boolean | {
65
- [key: string]: unknown;
66
- _fieldId: string;
95
+ $$field: string;
67
96
  }) => import("../conditionals/conditionals").JSONSchema;
68
97
  isFalsy: () => import("../conditionals/conditionals").JSONSchema;
69
98
  isUndefined: () => import("../conditionals/conditionals").JSONSchema;
@@ -74,9 +103,6 @@ export declare function field(fieldId: string, options?: {
74
103
  getId: () => {
75
104
  fieldId: string;
76
105
  };
77
- /**
78
- * @private Internal property used for field reference tracking.
79
- */
80
- _fieldId: string;
106
+ object: (options: Record<string, any>) => import("../conditionals/conditionals").JSONSchema;
81
107
  };
82
108
  //# 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,5 +1,4 @@
1
1
  import { Scope } from '../scopes';
2
- import { ActionType } from './ActionType';
3
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"];
4
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")[];
5
4
  export declare const ACTION_ALLOWED_SCOPES: {
@@ -40,6 +39,6 @@ export declare const ACTION_ALLOWED_CONFIGURABLE_SCOPES: {
40
39
  UNASSIGN: never[];
41
40
  DETECT_DUPLICATE: never[];
42
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
43
  export declare function hasAnyOfScopes(a: Scope[], b: Scope[]): boolean;
44
- export declare function filterUnallowedActions(actions: ActionType[], userScopes: Scope[]): ActionType[];
45
44
  //# sourceMappingURL=scopes.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { deserializeQuery } from './serializers/user/deserializer';
2
+ //# sourceMappingURL=serializer.d.ts.map
@@ -1,5 +1,6 @@
1
- import { ActionDocument, ActionUpdate, EventState } 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';
@@ -7,9 +8,32 @@ import { EventDocument } from './EventDocument';
7
8
  import { EventIndex } from './EventIndex';
8
9
  import { EventInput } from './EventInput';
9
10
  import { TranslationConfig } from './TranslationConfig';
10
- export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType): EventState;
11
- export declare function generateActionAnnotationInput(configuration: EventConfig, action: ActionType): {};
12
- 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): {
13
37
  create: (input?: Partial<EventInput>) => {
14
38
  transactionId: string;
15
39
  type: string;
@@ -19,17 +43,17 @@ export declare const eventPayloadGenerator: {
19
43
  type: string;
20
44
  id: string;
21
45
  };
22
- draft: ({ eventId, actionType }: {
23
- eventId: string;
24
- actionType: ActionType;
46
+ draft: ({ eventId, actionType, annotation }: {
47
+ eventId: UUID;
48
+ actionType: Draft["action"]["type"];
49
+ annotation?: Record<string, any>;
25
50
  }, input?: Partial<Draft>) => Draft;
26
51
  actions: {
27
- declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation">>) => {
28
- type: "DECLARE";
52
+ declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
29
53
  transactionId: string;
30
54
  declaration: Record<string, string | number | boolean | {
31
55
  type: string;
32
- filename: string;
56
+ path: string;
33
57
  originalFilename: string;
34
58
  } | {
35
59
  country: string;
@@ -42,6 +66,10 @@ export declare const eventPayloadGenerator: {
42
66
  residentialArea?: string | null | undefined;
43
67
  street?: string | null | undefined;
44
68
  zipCode?: string | null | undefined;
69
+ } | {
70
+ firstname: string;
71
+ surname: string;
72
+ middlename?: string | null | undefined;
45
73
  } | {
46
74
  country: string;
47
75
  district: string;
@@ -62,24 +90,26 @@ export declare const eventPayloadGenerator: {
62
90
  } | {
63
91
  type: string;
64
92
  option: string;
65
- filename: string;
93
+ path: string;
66
94
  originalFilename: string;
67
- }[] | [string, string] | undefined>;
95
+ }[] | {
96
+ start: string;
97
+ end: string;
98
+ } | null | undefined>;
68
99
  annotation: {};
100
+ keepAssignment?: boolean | undefined;
101
+ type: "DECLARE";
69
102
  eventId: string;
70
103
  };
71
104
  /**
72
105
  * Notify allows sending incomplete data. Think it as 'partial declare' for now.
73
106
  */
74
- notify: (eventId: string, input?: {
75
- transactionId?: string;
76
- declaration?: Partial<ActionUpdate>;
77
- }) => {
107
+ notify: (eventId: string, input?: Partial<Pick<NotifyActionInput, "transactionId" | "declaration" | "keepAssignment">>) => {
78
108
  type: "NOTIFY";
79
109
  transactionId: string;
80
- declaration: Partial<Record<string, string | number | boolean | {
110
+ declaration: Record<string, string | number | boolean | {
81
111
  type: string;
82
- filename: string;
112
+ path: string;
83
113
  originalFilename: string;
84
114
  } | {
85
115
  country: string;
@@ -92,6 +122,10 @@ export declare const eventPayloadGenerator: {
92
122
  residentialArea?: string | null | undefined;
93
123
  street?: string | null | undefined;
94
124
  zipCode?: string | null | undefined;
125
+ } | {
126
+ firstname: string;
127
+ surname: string;
128
+ middlename?: string | null | undefined;
95
129
  } | {
96
130
  country: string;
97
131
  district: string;
@@ -112,17 +146,20 @@ export declare const eventPayloadGenerator: {
112
146
  } | {
113
147
  type: string;
114
148
  option: string;
115
- filename: string;
149
+ path: string;
116
150
  originalFilename: string;
117
- }[] | [string, string] | undefined>>;
151
+ }[] | {
152
+ start: string;
153
+ end: string;
154
+ } | null | undefined>;
118
155
  eventId: string;
156
+ keepAssignment: boolean | undefined;
119
157
  };
120
- validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "declaration" | "annotation">>) => {
121
- type: "VALIDATE";
158
+ validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
122
159
  transactionId: string;
123
160
  declaration: Record<string, string | number | boolean | {
124
161
  type: string;
125
- filename: string;
162
+ path: string;
126
163
  originalFilename: string;
127
164
  } | {
128
165
  country: string;
@@ -135,6 +172,10 @@ export declare const eventPayloadGenerator: {
135
172
  residentialArea?: string | null | undefined;
136
173
  street?: string | null | undefined;
137
174
  zipCode?: string | null | undefined;
175
+ } | {
176
+ firstname: string;
177
+ surname: string;
178
+ middlename?: string | null | undefined;
138
179
  } | {
139
180
  country: string;
140
181
  district: string;
@@ -155,10 +196,15 @@ export declare const eventPayloadGenerator: {
155
196
  } | {
156
197
  type: string;
157
198
  option: string;
158
- filename: string;
199
+ path: string;
159
200
  originalFilename: string;
160
- }[] | [string, string] | undefined>;
201
+ }[] | {
202
+ start: string;
203
+ end: string;
204
+ } | null | undefined>;
161
205
  annotation: {};
206
+ keepAssignment?: boolean | undefined;
207
+ type: "VALIDATE";
162
208
  duplicates: never[];
163
209
  eventId: string;
164
210
  };
@@ -176,30 +222,80 @@ export declare const eventPayloadGenerator: {
176
222
  assignedTo: null;
177
223
  eventId: string;
178
224
  };
179
- archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration">>, isDuplicate?: boolean) => {
180
- type: "ARCHIVE";
225
+ archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration" | "keepAssignment">>, isDuplicate?: boolean) => {
181
226
  transactionId: string;
182
- declaration: {};
183
- annotation: {
184
- isDuplicate: boolean;
185
- };
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;
244
+ surname: string;
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: {};
186
275
  duplicates: never[];
187
276
  eventId: string;
277
+ reason: {
278
+ message: string;
279
+ isDuplicate: boolean;
280
+ };
188
281
  };
189
- reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation">>) => {
190
- type: "REJECT";
282
+ reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
191
283
  transactionId: string;
192
- declaration: {};
193
284
  annotation: {};
285
+ keepAssignment?: boolean | undefined;
286
+ type: "REJECT";
287
+ declaration: {};
194
288
  duplicates: never[];
195
289
  eventId: string;
290
+ reason: {
291
+ message: string;
292
+ };
196
293
  };
197
- register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation">>) => {
198
- type: "REGISTER";
294
+ register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment" | "registrationNumber">>) => {
199
295
  transactionId: string;
200
296
  declaration: Record<string, string | number | boolean | {
201
297
  type: string;
202
- filename: string;
298
+ path: string;
203
299
  originalFilename: string;
204
300
  } | {
205
301
  country: string;
@@ -212,6 +308,10 @@ export declare const eventPayloadGenerator: {
212
308
  residentialArea?: string | null | undefined;
213
309
  street?: string | null | undefined;
214
310
  zipCode?: string | null | undefined;
311
+ } | {
312
+ firstname: string;
313
+ surname: string;
314
+ middlename?: string | null | undefined;
215
315
  } | {
216
316
  country: string;
217
317
  district: string;
@@ -232,26 +332,33 @@ export declare const eventPayloadGenerator: {
232
332
  } | {
233
333
  type: string;
234
334
  option: string;
235
- filename: string;
335
+ path: string;
236
336
  originalFilename: string;
237
- }[] | [string, string] | undefined>;
337
+ }[] | {
338
+ start: string;
339
+ end: string;
340
+ } | null | undefined>;
238
341
  annotation: {};
342
+ registrationNumber?: string | undefined;
343
+ keepAssignment?: boolean | undefined;
344
+ type: "REGISTER";
239
345
  eventId: string;
240
346
  };
241
- printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation">>) => {
242
- type: "PRINT_CERTIFICATE";
347
+ printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
243
348
  transactionId: string;
244
- declaration: {};
245
349
  annotation: {};
350
+ keepAssignment?: boolean | undefined;
351
+ type: "PRINT_CERTIFICATE";
352
+ declaration: {};
246
353
  eventId: string;
247
354
  };
248
355
  correction: {
249
- request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation">>) => {
356
+ request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
250
357
  type: "REQUEST_CORRECTION";
251
358
  transactionId: string;
252
359
  declaration: Record<string, string | number | boolean | {
253
360
  type: string;
254
- filename: string;
361
+ path: string;
255
362
  originalFilename: string;
256
363
  } | {
257
364
  country: string;
@@ -264,6 +371,10 @@ export declare const eventPayloadGenerator: {
264
371
  residentialArea?: string | null | undefined;
265
372
  street?: string | null | undefined;
266
373
  zipCode?: string | null | undefined;
374
+ } | {
375
+ firstname: string;
376
+ surname: string;
377
+ middlename?: string | null | undefined;
267
378
  } | {
268
379
  country: string;
269
380
  district: string;
@@ -284,42 +395,85 @@ export declare const eventPayloadGenerator: {
284
395
  } | {
285
396
  type: string;
286
397
  option: string;
287
- filename: string;
398
+ path: string;
288
399
  originalFilename: string;
289
- }[] | [string, string] | undefined>;
400
+ }[] | {
401
+ start: string;
402
+ end: string;
403
+ } | null | undefined>;
290
404
  annotation: {};
291
405
  eventId: string;
406
+ keepAssignment: boolean | undefined;
292
407
  };
293
- approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
408
+ approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
294
409
  type: "APPROVE_CORRECTION";
295
410
  transactionId: string;
296
411
  declaration: {};
297
412
  annotation: {};
298
413
  eventId: string;
299
414
  requestId: string;
415
+ keepAssignment: boolean | undefined;
300
416
  };
301
- reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
417
+ reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
302
418
  type: "REJECT_CORRECTION";
303
419
  transactionId: string;
304
420
  declaration: {};
305
421
  annotation: {};
306
422
  eventId: string;
307
423
  requestId: string;
424
+ keepAssignment: boolean | undefined;
308
425
  };
309
426
  };
310
427
  };
311
428
  };
312
- export declare function generateActionDocument({ configuration, action, defaults }: {
429
+ export declare function generateActionDocument({ configuration, action, rng, defaults, user }: {
313
430
  configuration: EventConfig;
314
431
  action: ActionType;
432
+ rng?: () => number;
315
433
  defaults?: Partial<ActionDocument>;
434
+ user?: Partial<{
435
+ signature: string;
436
+ primaryOfficeId: UUID;
437
+ role: TestUserRole;
438
+ id: string;
439
+ }>;
316
440
  }): ActionDocument;
317
- export declare function generateEventDocument({ configuration, actions }: {
441
+ export declare function generateEventDocument({ configuration, actions, rng, user }: {
318
442
  configuration: EventConfig;
319
443
  actions: ActionType[];
444
+ rng?: () => number;
445
+ user?: Partial<{
446
+ signature: string;
447
+ primaryOfficeId: UUID;
448
+ role: TestUserRole;
449
+ id: string;
450
+ }>;
320
451
  }): EventDocument;
321
- export declare function generateEventDraftDocument(eventId: string, actionType?: ActionType, declaration?: EventState): Draft;
452
+ export declare function generateEventDraftDocument({ eventId, actionType, rng, declaration }: {
453
+ eventId: UUID;
454
+ actionType: ActionType;
455
+ rng?: () => number;
456
+ declaration?: EventState;
457
+ annotation?: EventState;
458
+ }): Draft;
322
459
  export declare function getRandomDatetime(rng: () => number, start: Date, end: Date): string;
460
+ export declare function getRandomDate(rng: () => number, start: string, end: string): string;
461
+ /**
462
+ * Useful for testing when we need deterministic outcome.
463
+ * @param seed - Seed value for the pseudo-random number generator
464
+ *
465
+ * @returns A function that generates pseudo-random numbers between 0 and 1 [0, 1)
466
+ */
467
+ export declare function createPrng(seed: number): () => number;
468
+ export declare function generateUuid(rng?: () => number): UUID;
469
+ export declare function generateRegistrationNumber(rng: () => number): string;
470
+ export declare function generateRandomSignature(rng: () => number): string;
323
471
  export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>, seed?: number) => EventIndex;
324
472
  export declare const generateTranslationConfig: (message: string) => TranslationConfig;
473
+ export declare const BearerTokenByUserType: {
474
+ fieldAgent: string;
475
+ registrationAgent: string;
476
+ localRegistrar: string;
477
+ };
478
+ export declare const generateWorkqueues: (slug?: string) => WorkqueueConfig[];
325
479
  //# 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