@opencrvs/toolkit 1.8.0-rc.fd8a78f → 1.8.0-rc.fde35f6

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 (35) hide show
  1. package/dist/commons/api/router.d.ts +3117 -11206
  2. package/dist/commons/conditionals/conditionals.d.ts +0 -12
  3. package/dist/commons/events/ActionConfig.d.ts +12032 -3972
  4. package/dist/commons/events/ActionDocument.d.ts +3029 -1886
  5. package/dist/commons/events/ActionInput.d.ts +2406 -1506
  6. package/dist/commons/events/AdvancedSearchConfig.d.ts +304 -51
  7. package/dist/commons/events/CompositeFieldValue.d.ts +15 -15
  8. package/dist/commons/events/CountryConfigQueryInput.d.ts +1891 -741
  9. package/dist/commons/events/CreatedAtLocation.d.ts +1 -2
  10. package/dist/commons/events/Draft.d.ts +213 -136
  11. package/dist/commons/events/EventConfig.d.ts +4770 -755
  12. package/dist/commons/events/EventDocument.d.ts +1942 -1219
  13. package/dist/commons/events/EventIndex.d.ts +897 -263
  14. package/dist/commons/events/EventMetadata.d.ts +73 -31
  15. package/dist/commons/events/FieldConfig.d.ts +607 -30
  16. package/dist/commons/events/FieldType.d.ts +2 -1
  17. package/dist/commons/events/FieldTypeMapping.d.ts +73 -41
  18. package/dist/commons/events/FieldValue.d.ts +57 -28
  19. package/dist/commons/events/FormConfig.d.ts +4685 -1295
  20. package/dist/commons/events/PageConfig.d.ts +868 -38
  21. package/dist/commons/events/User.d.ts +6 -3
  22. package/dist/commons/events/WorkqueueColumnConfig.d.ts +11 -11
  23. package/dist/commons/events/WorkqueueConfig.d.ts +4490 -1177
  24. package/dist/commons/events/defineConfig.d.ts +759 -34
  25. package/dist/commons/events/event.d.ts +15 -10
  26. package/dist/commons/events/field.d.ts +17 -0
  27. package/dist/commons/events/scopes.d.ts +1 -2
  28. package/dist/commons/events/test.utils.d.ts +83 -36
  29. package/dist/commons/events/transactions.d.ts +1 -1
  30. package/dist/commons/events/utils.d.ts +2926 -88
  31. package/dist/conditionals/index.js +22 -51
  32. package/dist/events/index.js +1550 -1048
  33. package/dist/scopes/index.d.ts +96 -7
  34. package/dist/scopes/index.js +105 -26
  35. package/package.json +3 -3
@@ -1,3 +1,4 @@
1
+ import { ActionType } from './ActionType';
1
2
  import { EventFieldId } from './AdvancedSearchConfig';
2
3
  import { SelectOption } from './FieldConfig';
3
4
  import { WorkqueueColumnKeys, WorkqueueColumnValue } from './WorkqueueColumnConfig';
@@ -10,36 +11,36 @@ import { WorkqueueColumnKeys, WorkqueueColumnValue } from './WorkqueueColumnConf
10
11
  */
11
12
  declare function eventFn(fieldId: EventFieldId, options?: SelectOption[]): {
12
13
  range: () => {
13
- fieldId: "status" | "updatedAt" | "trackingId" | "legalStatus.REGISTERED.createdAt" | "legalStatus.REGISTERED.createdAtLocation";
14
+ fieldId: "status" | "updatedAt" | "trackingId" | "legalStatuses.REGISTERED.acceptedAt" | "legalStatuses.REGISTERED.createdAtLocation";
15
+ fieldType: "event";
14
16
  options: {
15
17
  value: string;
16
18
  label: import("./TranslationConfig").TranslationConfig;
17
- }[] | undefined;
18
- fieldType: "event";
19
+ }[];
19
20
  } & {
20
21
  config: {
21
22
  type: "range";
22
23
  };
23
24
  };
24
25
  exact: () => {
25
- fieldId: "status" | "updatedAt" | "trackingId" | "legalStatus.REGISTERED.createdAt" | "legalStatus.REGISTERED.createdAtLocation";
26
+ fieldId: "status" | "updatedAt" | "trackingId" | "legalStatuses.REGISTERED.acceptedAt" | "legalStatuses.REGISTERED.createdAtLocation";
27
+ fieldType: "event";
26
28
  options: {
27
29
  value: string;
28
30
  label: import("./TranslationConfig").TranslationConfig;
29
- }[] | undefined;
30
- fieldType: "event";
31
+ }[];
31
32
  } & {
32
33
  config: {
33
34
  type: "exact";
34
35
  };
35
36
  };
36
37
  fuzzy: () => {
37
- fieldId: "status" | "updatedAt" | "trackingId" | "legalStatus.REGISTERED.createdAt" | "legalStatus.REGISTERED.createdAtLocation";
38
+ fieldId: "status" | "updatedAt" | "trackingId" | "legalStatuses.REGISTERED.acceptedAt" | "legalStatuses.REGISTERED.createdAtLocation";
39
+ fieldType: "event";
38
40
  options: {
39
41
  value: string;
40
42
  label: import("./TranslationConfig").TranslationConfig;
41
- }[] | undefined;
42
- fieldType: "event";
43
+ }[];
43
44
  } & {
44
45
  config: {
45
46
  type: "fuzzy";
@@ -47,8 +48,12 @@ declare function eventFn(fieldId: EventFieldId, options?: SelectOption[]): {
47
48
  };
48
49
  };
49
50
  declare const event: typeof eventFn & {
51
+ /**
52
+ * Checks if the event contains a specific action type.
53
+ * @param action - The action type to check for.
54
+ */
55
+ hasAction: (action: ActionType) => import("../conditionals/conditionals").JSONSchema;
50
56
  field(field: WorkqueueColumnKeys): WorkqueueColumnValue;
51
- hasAction: (action: import("./ActionType").ActionType) => import("../conditionals/conditionals").JSONSchema;
52
57
  };
53
58
  export { event };
54
59
  //# 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";
@@ -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
@@ -1,3 +1,4 @@
1
+ import { UUID } from '../uuid';
1
2
  import { ActionDocument, EventState } from './ActionDocument';
2
3
  import { ArchiveActionInput, AssignActionInput, DeclareActionInput, NotifyActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnassignActionInput, ValidateActionInput } from './ActionInput';
3
4
  import { ActionType } from './ActionType';
@@ -10,6 +11,18 @@ import { TranslationConfig } from './TranslationConfig';
10
11
  import { FieldConfig } from './FieldConfig';
11
12
  import { WorkqueueConfig } from './WorkqueueConfig';
12
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>;
13
26
  export declare function generateRandomName(rng: () => number): {
14
27
  firstname: string;
15
28
  surname: string;
@@ -30,16 +43,17 @@ export declare function eventPayloadGenerator(rng: () => number): {
30
43
  type: string;
31
44
  id: string;
32
45
  };
33
- draft: ({ eventId, actionType }: {
34
- eventId: string;
46
+ draft: ({ eventId, actionType, annotation }: {
47
+ eventId: UUID;
35
48
  actionType: ActionType;
49
+ annotation?: Record<string, any>;
36
50
  }, input?: Partial<Draft>) => Draft;
37
51
  actions: {
38
52
  declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
39
53
  transactionId: string;
40
54
  declaration: Record<string, string | number | boolean | {
41
55
  type: string;
42
- filename: string;
56
+ path: string;
43
57
  originalFilename: string;
44
58
  } | {
45
59
  country: string;
@@ -53,8 +67,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
53
67
  street?: string | null | undefined;
54
68
  zipCode?: string | null | undefined;
55
69
  } | {
56
- firstname: string;
57
- surname: string;
70
+ firstname?: string | null | undefined;
71
+ surname?: string | null | undefined;
58
72
  middlename?: string | null | undefined;
59
73
  } | {
60
74
  country: string;
@@ -76,9 +90,12 @@ export declare function eventPayloadGenerator(rng: () => number): {
76
90
  } | {
77
91
  type: string;
78
92
  option: string;
79
- filename: string;
93
+ path: string;
80
94
  originalFilename: string;
81
- }[] | [string, string] | null | undefined>;
95
+ }[] | {
96
+ start: string;
97
+ end: string;
98
+ } | null | undefined>;
82
99
  annotation: {};
83
100
  keepAssignment?: boolean | undefined;
84
101
  type: "DECLARE";
@@ -92,7 +109,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
92
109
  transactionId: string;
93
110
  declaration: Record<string, string | number | boolean | {
94
111
  type: string;
95
- filename: string;
112
+ path: string;
96
113
  originalFilename: string;
97
114
  } | {
98
115
  country: string;
@@ -106,8 +123,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
106
123
  street?: string | null | undefined;
107
124
  zipCode?: string | null | undefined;
108
125
  } | {
109
- firstname: string;
110
- surname: string;
126
+ firstname?: string | null | undefined;
127
+ surname?: string | null | undefined;
111
128
  middlename?: string | null | undefined;
112
129
  } | {
113
130
  country: string;
@@ -129,9 +146,12 @@ export declare function eventPayloadGenerator(rng: () => number): {
129
146
  } | {
130
147
  type: string;
131
148
  option: string;
132
- filename: string;
149
+ path: string;
133
150
  originalFilename: string;
134
- }[] | [string, string] | null | undefined>;
151
+ }[] | {
152
+ start: string;
153
+ end: string;
154
+ } | null | undefined>;
135
155
  eventId: string;
136
156
  keepAssignment: boolean | undefined;
137
157
  };
@@ -139,7 +159,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
139
159
  transactionId: string;
140
160
  declaration: Record<string, string | number | boolean | {
141
161
  type: string;
142
- filename: string;
162
+ path: string;
143
163
  originalFilename: string;
144
164
  } | {
145
165
  country: string;
@@ -153,8 +173,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
153
173
  street?: string | null | undefined;
154
174
  zipCode?: string | null | undefined;
155
175
  } | {
156
- firstname: string;
157
- surname: string;
176
+ firstname?: string | null | undefined;
177
+ surname?: string | null | undefined;
158
178
  middlename?: string | null | undefined;
159
179
  } | {
160
180
  country: string;
@@ -176,9 +196,12 @@ export declare function eventPayloadGenerator(rng: () => number): {
176
196
  } | {
177
197
  type: string;
178
198
  option: string;
179
- filename: string;
199
+ path: string;
180
200
  originalFilename: string;
181
- }[] | [string, string] | null | undefined>;
201
+ }[] | {
202
+ start: string;
203
+ end: string;
204
+ } | null | undefined>;
182
205
  annotation: {};
183
206
  keepAssignment?: boolean | undefined;
184
207
  type: "VALIDATE";
@@ -203,7 +226,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
203
226
  transactionId: string;
204
227
  declaration: Record<string, string | number | boolean | {
205
228
  type: string;
206
- filename: string;
229
+ path: string;
207
230
  originalFilename: string;
208
231
  } | {
209
232
  country: string;
@@ -217,8 +240,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
217
240
  street?: string | null | undefined;
218
241
  zipCode?: string | null | undefined;
219
242
  } | {
220
- firstname: string;
221
- surname: string;
243
+ firstname?: string | null | undefined;
244
+ surname?: string | null | undefined;
222
245
  middlename?: string | null | undefined;
223
246
  } | {
224
247
  country: string;
@@ -240,9 +263,12 @@ export declare function eventPayloadGenerator(rng: () => number): {
240
263
  } | {
241
264
  type: string;
242
265
  option: string;
243
- filename: string;
266
+ path: string;
244
267
  originalFilename: string;
245
- }[] | [string, string] | null | undefined>;
268
+ }[] | {
269
+ start: string;
270
+ end: string;
271
+ } | null | undefined>;
246
272
  keepAssignment?: boolean | undefined;
247
273
  type: "ARCHIVE";
248
274
  annotation: {};
@@ -265,11 +291,11 @@ export declare function eventPayloadGenerator(rng: () => number): {
265
291
  message: string;
266
292
  };
267
293
  };
268
- register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
294
+ register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment" | "registrationNumber">>) => {
269
295
  transactionId: string;
270
296
  declaration: Record<string, string | number | boolean | {
271
297
  type: string;
272
- filename: string;
298
+ path: string;
273
299
  originalFilename: string;
274
300
  } | {
275
301
  country: string;
@@ -283,8 +309,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
283
309
  street?: string | null | undefined;
284
310
  zipCode?: string | null | undefined;
285
311
  } | {
286
- firstname: string;
287
- surname: string;
312
+ firstname?: string | null | undefined;
313
+ surname?: string | null | undefined;
288
314
  middlename?: string | null | undefined;
289
315
  } | {
290
316
  country: string;
@@ -306,10 +332,14 @@ export declare function eventPayloadGenerator(rng: () => number): {
306
332
  } | {
307
333
  type: string;
308
334
  option: string;
309
- filename: string;
335
+ path: string;
310
336
  originalFilename: string;
311
- }[] | [string, string] | null | undefined>;
337
+ }[] | {
338
+ start: string;
339
+ end: string;
340
+ } | null | undefined>;
312
341
  annotation: {};
342
+ registrationNumber?: string | undefined;
313
343
  keepAssignment?: boolean | undefined;
314
344
  type: "REGISTER";
315
345
  eventId: string;
@@ -328,7 +358,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
328
358
  transactionId: string;
329
359
  declaration: Record<string, string | number | boolean | {
330
360
  type: string;
331
- filename: string;
361
+ path: string;
332
362
  originalFilename: string;
333
363
  } | {
334
364
  country: string;
@@ -342,8 +372,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
342
372
  street?: string | null | undefined;
343
373
  zipCode?: string | null | undefined;
344
374
  } | {
345
- firstname: string;
346
- surname: string;
375
+ firstname?: string | null | undefined;
376
+ surname?: string | null | undefined;
347
377
  middlename?: string | null | undefined;
348
378
  } | {
349
379
  country: string;
@@ -365,9 +395,12 @@ export declare function eventPayloadGenerator(rng: () => number): {
365
395
  } | {
366
396
  type: string;
367
397
  option: string;
368
- filename: string;
398
+ path: string;
369
399
  originalFilename: string;
370
- }[] | [string, string] | null | undefined>;
400
+ }[] | {
401
+ start: string;
402
+ end: string;
403
+ } | null | undefined>;
371
404
  annotation: {};
372
405
  eventId: string;
373
406
  keepAssignment: boolean | undefined;
@@ -393,19 +426,31 @@ export declare function eventPayloadGenerator(rng: () => number): {
393
426
  };
394
427
  };
395
428
  };
396
- export declare function generateActionDocument({ configuration, action, rng, defaults }: {
429
+ export declare function generateActionDocument({ configuration, action, rng, defaults, user }: {
397
430
  configuration: EventConfig;
398
431
  action: ActionType;
399
432
  rng?: () => number;
400
433
  defaults?: Partial<ActionDocument>;
434
+ user?: Partial<{
435
+ signature: string;
436
+ primaryOfficeId: UUID;
437
+ role: TestUserRole;
438
+ id: string;
439
+ }>;
401
440
  }): ActionDocument;
402
- export declare function generateEventDocument({ configuration, actions, rng }: {
441
+ export declare function generateEventDocument({ configuration, actions, rng, user }: {
403
442
  configuration: EventConfig;
404
443
  actions: ActionType[];
405
444
  rng?: () => number;
445
+ user?: Partial<{
446
+ signature: string;
447
+ primaryOfficeId: UUID;
448
+ role: TestUserRole;
449
+ id: string;
450
+ }>;
406
451
  }): EventDocument;
407
452
  export declare function generateEventDraftDocument({ eventId, actionType, rng, declaration }: {
408
- eventId: string;
453
+ eventId: UUID;
409
454
  actionType: ActionType;
410
455
  rng?: () => number;
411
456
  declaration?: EventState;
@@ -419,6 +464,8 @@ export declare function getRandomDate(rng: () => number, start: string, end: str
419
464
  * @returns A function that generates pseudo-random numbers between 0 and 1 [0, 1)
420
465
  */
421
466
  export declare function createPrng(seed: number): () => number;
467
+ export declare function generateUuid(rng?: () => number): UUID;
468
+ export declare function generateRegistrationNumber(rng: () => number): string;
422
469
  export declare function generateRandomSignature(rng: () => number): string;
423
470
  export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>, seed?: number) => EventIndex;
424
471
  export declare const generateTranslationConfig: (message: string) => TranslationConfig;
@@ -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