@opencrvs/toolkit 1.8.0-rc.ffe24c3 → 1.8.1-rc.3e74262

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 +1742 -14918
  2. package/dist/commons/conditionals/conditionals.d.ts +0 -12
  3. package/dist/commons/conditionals/validate.d.ts +5 -0
  4. package/dist/commons/events/ActionConfig.d.ts +37041 -35133
  5. package/dist/commons/events/ActionDocument.d.ts +3159 -1626
  6. package/dist/commons/events/ActionInput.d.ts +2280 -1380
  7. package/dist/commons/events/ActionType.d.ts +7 -4
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +100 -51
  9. package/dist/commons/events/CompositeFieldValue.d.ts +15 -15
  10. package/dist/commons/events/CountryConfigQueryInput.d.ts +1162 -760
  11. package/dist/commons/events/Draft.d.ts +190 -118
  12. package/dist/commons/events/EventConfig.d.ts +20824 -22965
  13. package/dist/commons/events/EventDocument.d.ts +1669 -1021
  14. package/dist/commons/events/EventIndex.d.ts +394 -175
  15. package/dist/commons/events/EventMetadata.d.ts +6 -4
  16. package/dist/commons/events/FieldConfig.d.ts +1528 -449
  17. package/dist/commons/events/FieldType.d.ts +3 -1
  18. package/dist/commons/events/FieldTypeMapping.d.ts +80 -41
  19. package/dist/commons/events/FieldValue.d.ts +58 -28
  20. package/dist/commons/events/FormConfig.d.ts +9263 -2657
  21. package/dist/commons/events/PageConfig.d.ts +3642 -2028
  22. package/dist/commons/events/SummaryConfig.d.ts +10 -10
  23. package/dist/commons/events/User.d.ts +6 -3
  24. package/dist/commons/events/WorkqueueConfig.d.ts +2153 -1337
  25. package/dist/commons/events/defineConfig.d.ts +2759 -3250
  26. package/dist/commons/events/event.d.ts +10 -18
  27. package/dist/commons/events/field.d.ts +13 -1
  28. package/dist/commons/events/scopes.d.ts +2 -1
  29. package/dist/commons/events/test.utils.d.ts +58 -34
  30. package/dist/commons/events/utils.d.ts +8848 -6794
  31. package/dist/conditionals/index.js +23 -53
  32. package/dist/events/index.js +1594 -1341
  33. package/dist/scopes/index.d.ts +92 -6
  34. package/dist/scopes/index.js +38 -9
  35. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
+ import { ActionType } from './ActionType';
1
2
  import { EventFieldId } from './AdvancedSearchConfig';
2
- import { SelectOption } from './FieldConfig';
3
3
  import { WorkqueueColumnKeys, WorkqueueColumnValue } from './WorkqueueColumnConfig';
4
4
  /**
5
5
  * Creates a function that acts like a callable + static method container.
@@ -8,13 +8,9 @@ import { WorkqueueColumnKeys, WorkqueueColumnValue } from './WorkqueueColumnConf
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: EventFieldId): {
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: "status" | "updatedAt" | "trackingId" | "legalStatuses.REGISTERED.acceptedAt" | "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: "status" | "updatedAt" | "trackingId" | "legalStatuses.REGISTERED.acceptedAt" | "legalStatuses.REGISTERED.createdAtLocation";
30
22
  fieldType: "event";
31
23
  } & {
32
24
  config: {
@@ -34,11 +26,7 @@ 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: "status" | "updatedAt" | "trackingId" | "legalStatuses.REGISTERED.acceptedAt" | "legalStatuses.REGISTERED.createdAtLocation";
42
30
  fieldType: "event";
43
31
  } & {
44
32
  config: {
@@ -47,8 +35,12 @@ declare function eventFn(fieldId: EventFieldId, options?: SelectOption[]): {
47
35
  };
48
36
  };
49
37
  declare const event: typeof eventFn & {
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;
50
43
  field(field: WorkqueueColumnKeys): WorkqueueColumnValue;
51
- hasAction: (action: import("./ActionType").ActionType) => import("../conditionals/conditionals").JSONSchema;
52
44
  };
53
45
  export { event };
54
46
  //# sourceMappingURL=event.d.ts.map
@@ -1,17 +1,23 @@
1
1
  import { FieldConditional } from './Conditional';
2
2
  import { TranslationConfig } from './TranslationConfig';
3
- import { ValidationConfig } from './FieldConfig';
3
+ import { SelectOption, ValidationConfig } from './FieldConfig';
4
4
  /**
5
5
  * Entry point for defining conditional logic or configuration for a form field.
6
6
  * @param fieldId - The ID of the field to define rules or config for.
7
7
  * @returns An object combining conditional methods and configuration builders.
8
8
  */
9
9
  export declare function field(fieldId: string, options?: {
10
+ options?: SelectOption[];
11
+ excludeInSearchQuery?: boolean;
12
+ alternateFieldIds?: string[];
10
13
  conditionals?: FieldConditional[];
11
14
  validations?: ValidationConfig[];
12
15
  searchCriteriaLabelPrefix?: TranslationConfig;
13
16
  }): {
14
17
  range: () => {
18
+ options?: SelectOption[];
19
+ excludeInSearchQuery?: boolean;
20
+ alternateFieldIds?: string[];
15
21
  conditionals?: FieldConditional[];
16
22
  validations?: ValidationConfig[];
17
23
  searchCriteriaLabelPrefix?: TranslationConfig;
@@ -23,6 +29,9 @@ export declare function field(fieldId: string, options?: {
23
29
  };
24
30
  };
25
31
  exact: () => {
32
+ options?: SelectOption[];
33
+ excludeInSearchQuery?: boolean;
34
+ alternateFieldIds?: string[];
26
35
  conditionals?: FieldConditional[];
27
36
  validations?: ValidationConfig[];
28
37
  searchCriteriaLabelPrefix?: TranslationConfig;
@@ -34,6 +43,9 @@ export declare function field(fieldId: string, options?: {
34
43
  };
35
44
  };
36
45
  fuzzy: () => {
46
+ options?: SelectOption[];
47
+ excludeInSearchQuery?: boolean;
48
+ alternateFieldIds?: string[];
37
49
  conditionals?: FieldConditional[];
38
50
  validations?: ValidationConfig[];
39
51
  searchCriteriaLabelPrefix?: TranslationConfig;
@@ -10,7 +10,8 @@ export declare const ACTION_ALLOWED_SCOPES: {
10
10
  VALIDATE: ["record.declaration-submit-for-approval", "record.register"];
11
11
  REGISTER: ["record.register"];
12
12
  PRINT_CERTIFICATE: ["record.registration-print&issue-certified-copies"];
13
- REQUEST_CORRECTION: ["record.registration-request-correction"];
13
+ REQUEST_CORRECTION: ["record.registration-request-correction", "record.registration-correct"];
14
+ REVIEW_CORRECTION_REQUEST: ["record.registration-correct"];
14
15
  REJECT_CORRECTION: ["record.registration-correct"];
15
16
  APPROVE_CORRECTION: ["record.registration-correct"];
16
17
  MARKED_AS_DUPLICATE: ["record.declaration-archive"];
@@ -1,6 +1,6 @@
1
1
  import { UUID } from '../uuid';
2
2
  import { ActionDocument, EventState } from './ActionDocument';
3
- import { ArchiveActionInput, AssignActionInput, DeclareActionInput, NotifyActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnassignActionInput, ValidateActionInput } from './ActionInput';
3
+ import { ApproveCorrectionActionInput, ArchiveActionInput, AssignActionInput, DeclareActionInput, NotifyActionInput, RegisterActionInput, RejectCorrectionActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnassignActionInput, ValidateActionInput } from './ActionInput';
4
4
  import { ActionType } from './ActionType';
5
5
  import { Draft } from './Draft';
6
6
  import { EventConfig } from './EventConfig';
@@ -12,6 +12,11 @@ import { FieldConfig } from './FieldConfig';
12
12
  import { WorkqueueConfig } from './WorkqueueConfig';
13
13
  import { FieldValue } from './FieldValue';
14
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";
15
20
  /**
16
21
  * In real application, the roles are defined in the countryconfig.
17
22
  * These are just for testing purposes to generate realistic mock data.
@@ -38,16 +43,17 @@ export declare function eventPayloadGenerator(rng: () => number): {
38
43
  type: string;
39
44
  id: string;
40
45
  };
41
- draft: ({ eventId, actionType }: {
46
+ draft: ({ eventId, actionType, annotation }: {
42
47
  eventId: UUID;
43
48
  actionType: ActionType;
49
+ annotation?: Record<string, any>;
44
50
  }, input?: Partial<Draft>) => Draft;
45
51
  actions: {
46
52
  declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
47
53
  transactionId: string;
48
54
  declaration: Record<string, string | number | boolean | {
49
55
  type: string;
50
- filename: string;
56
+ path: string;
51
57
  originalFilename: string;
52
58
  } | {
53
59
  country: string;
@@ -61,8 +67,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
61
67
  street?: string | null | undefined;
62
68
  zipCode?: string | null | undefined;
63
69
  } | {
64
- firstname: string;
65
- surname: string;
70
+ firstname?: string | null | undefined;
71
+ surname?: string | null | undefined;
66
72
  middlename?: string | null | undefined;
67
73
  } | {
68
74
  country: string;
@@ -84,9 +90,12 @@ export declare function eventPayloadGenerator(rng: () => number): {
84
90
  } | {
85
91
  type: string;
86
92
  option: string;
87
- filename: string;
93
+ path: string;
88
94
  originalFilename: string;
89
- }[] | [string, string] | null | undefined>;
95
+ }[] | {
96
+ start: string;
97
+ end: string;
98
+ } | null | undefined>;
90
99
  annotation: {};
91
100
  keepAssignment?: boolean | undefined;
92
101
  type: "DECLARE";
@@ -100,7 +109,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
100
109
  transactionId: string;
101
110
  declaration: Record<string, string | number | boolean | {
102
111
  type: string;
103
- filename: string;
112
+ path: string;
104
113
  originalFilename: string;
105
114
  } | {
106
115
  country: string;
@@ -114,8 +123,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
114
123
  street?: string | null | undefined;
115
124
  zipCode?: string | null | undefined;
116
125
  } | {
117
- firstname: string;
118
- surname: string;
126
+ firstname?: string | null | undefined;
127
+ surname?: string | null | undefined;
119
128
  middlename?: string | null | undefined;
120
129
  } | {
121
130
  country: string;
@@ -137,9 +146,12 @@ export declare function eventPayloadGenerator(rng: () => number): {
137
146
  } | {
138
147
  type: string;
139
148
  option: string;
140
- filename: string;
149
+ path: string;
141
150
  originalFilename: string;
142
- }[] | [string, string] | null | undefined>;
151
+ }[] | {
152
+ start: string;
153
+ end: string;
154
+ } | null | undefined>;
143
155
  eventId: string;
144
156
  keepAssignment: boolean | undefined;
145
157
  };
@@ -147,7 +159,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
147
159
  transactionId: string;
148
160
  declaration: Record<string, string | number | boolean | {
149
161
  type: string;
150
- filename: string;
162
+ path: string;
151
163
  originalFilename: string;
152
164
  } | {
153
165
  country: string;
@@ -161,8 +173,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
161
173
  street?: string | null | undefined;
162
174
  zipCode?: string | null | undefined;
163
175
  } | {
164
- firstname: string;
165
- surname: string;
176
+ firstname?: string | null | undefined;
177
+ surname?: string | null | undefined;
166
178
  middlename?: string | null | undefined;
167
179
  } | {
168
180
  country: string;
@@ -184,9 +196,12 @@ export declare function eventPayloadGenerator(rng: () => number): {
184
196
  } | {
185
197
  type: string;
186
198
  option: string;
187
- filename: string;
199
+ path: string;
188
200
  originalFilename: string;
189
- }[] | [string, string] | null | undefined>;
201
+ }[] | {
202
+ start: string;
203
+ end: string;
204
+ } | null | undefined>;
190
205
  annotation: {};
191
206
  keepAssignment?: boolean | undefined;
192
207
  type: "VALIDATE";
@@ -211,7 +226,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
211
226
  transactionId: string;
212
227
  declaration: Record<string, string | number | boolean | {
213
228
  type: string;
214
- filename: string;
229
+ path: string;
215
230
  originalFilename: string;
216
231
  } | {
217
232
  country: string;
@@ -225,8 +240,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
225
240
  street?: string | null | undefined;
226
241
  zipCode?: string | null | undefined;
227
242
  } | {
228
- firstname: string;
229
- surname: string;
243
+ firstname?: string | null | undefined;
244
+ surname?: string | null | undefined;
230
245
  middlename?: string | null | undefined;
231
246
  } | {
232
247
  country: string;
@@ -248,9 +263,12 @@ export declare function eventPayloadGenerator(rng: () => number): {
248
263
  } | {
249
264
  type: string;
250
265
  option: string;
251
- filename: string;
266
+ path: string;
252
267
  originalFilename: string;
253
- }[] | [string, string] | null | undefined>;
268
+ }[] | {
269
+ start: string;
270
+ end: string;
271
+ } | null | undefined>;
254
272
  keepAssignment?: boolean | undefined;
255
273
  type: "ARCHIVE";
256
274
  annotation: {};
@@ -277,7 +295,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
277
295
  transactionId: string;
278
296
  declaration: Record<string, string | number | boolean | {
279
297
  type: string;
280
- filename: string;
298
+ path: string;
281
299
  originalFilename: string;
282
300
  } | {
283
301
  country: string;
@@ -291,8 +309,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
291
309
  street?: string | null | undefined;
292
310
  zipCode?: string | null | undefined;
293
311
  } | {
294
- firstname: string;
295
- surname: string;
312
+ firstname?: string | null | undefined;
313
+ surname?: string | null | undefined;
296
314
  middlename?: string | null | undefined;
297
315
  } | {
298
316
  country: string;
@@ -314,9 +332,12 @@ export declare function eventPayloadGenerator(rng: () => number): {
314
332
  } | {
315
333
  type: string;
316
334
  option: string;
317
- filename: string;
335
+ path: string;
318
336
  originalFilename: string;
319
- }[] | [string, string] | null | undefined>;
337
+ }[] | {
338
+ start: string;
339
+ end: string;
340
+ } | null | undefined>;
320
341
  annotation: {};
321
342
  registrationNumber?: string | undefined;
322
343
  keepAssignment?: boolean | undefined;
@@ -337,7 +358,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
337
358
  transactionId: string;
338
359
  declaration: Record<string, string | number | boolean | {
339
360
  type: string;
340
- filename: string;
361
+ path: string;
341
362
  originalFilename: string;
342
363
  } | {
343
364
  country: string;
@@ -351,8 +372,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
351
372
  street?: string | null | undefined;
352
373
  zipCode?: string | null | undefined;
353
374
  } | {
354
- firstname: string;
355
- surname: string;
375
+ firstname?: string | null | undefined;
376
+ surname?: string | null | undefined;
356
377
  middlename?: string | null | undefined;
357
378
  } | {
358
379
  country: string;
@@ -374,14 +395,17 @@ export declare function eventPayloadGenerator(rng: () => number): {
374
395
  } | {
375
396
  type: string;
376
397
  option: string;
377
- filename: string;
398
+ path: string;
378
399
  originalFilename: string;
379
- }[] | [string, string] | null | undefined>;
400
+ }[] | {
401
+ start: string;
402
+ end: string;
403
+ } | null | undefined>;
380
404
  annotation: {};
381
405
  eventId: string;
382
406
  keepAssignment: boolean | undefined;
383
407
  };
384
- approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
408
+ approve: (eventId: string, requestId: string, input?: Partial<Pick<ApproveCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
385
409
  type: "APPROVE_CORRECTION";
386
410
  transactionId: string;
387
411
  declaration: {};
@@ -390,7 +414,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
390
414
  requestId: string;
391
415
  keepAssignment: boolean | undefined;
392
416
  };
393
- reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
417
+ reject: (eventId: string, requestId: string, input?: Partial<Pick<RejectCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
394
418
  type: "REJECT_CORRECTION";
395
419
  transactionId: string;
396
420
  declaration: {};