@opencrvs/toolkit 1.8.0-rc.f7aaf07 → 1.8.0-rc.f7e1622

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 (37) hide show
  1. package/dist/commons/api/router.d.ts +2228 -15340
  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 +33832 -35902
  5. package/dist/commons/events/ActionDocument.d.ts +3439 -1912
  6. package/dist/commons/events/ActionInput.d.ts +2406 -1506
  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 +1798 -734
  11. package/dist/commons/events/CreatedAtLocation.d.ts +1 -2
  12. package/dist/commons/events/Draft.d.ts +208 -136
  13. package/dist/commons/events/EventConfig.d.ts +19880 -23808
  14. package/dist/commons/events/EventDocument.d.ts +1863 -1220
  15. package/dist/commons/events/EventIndex.d.ts +514 -316
  16. package/dist/commons/events/EventMetadata.d.ts +44 -33
  17. package/dist/commons/events/FieldConfig.d.ts +1171 -385
  18. package/dist/commons/events/FieldType.d.ts +2 -1
  19. package/dist/commons/events/FieldTypeMapping.d.ts +73 -41
  20. package/dist/commons/events/FieldValue.d.ts +57 -28
  21. package/dist/commons/events/FormConfig.d.ts +7380 -2640
  22. package/dist/commons/events/PageConfig.d.ts +1499 -343
  23. package/dist/commons/events/SummaryConfig.d.ts +10 -10
  24. package/dist/commons/events/User.d.ts +6 -3
  25. package/dist/commons/events/WorkqueueConfig.d.ts +3153 -1327
  26. package/dist/commons/events/defineConfig.d.ts +2475 -3245
  27. package/dist/commons/events/event.d.ts +10 -18
  28. package/dist/commons/events/field.d.ts +13 -1
  29. package/dist/commons/events/scopes.d.ts +2 -1
  30. package/dist/commons/events/test.utils.d.ts +74 -40
  31. package/dist/commons/events/transactions.d.ts +1 -1
  32. package/dist/commons/events/utils.d.ts +8553 -6994
  33. package/dist/conditionals/index.js +23 -53
  34. package/dist/events/index.js +1685 -1402
  35. package/dist/scopes/index.d.ts +92 -6
  36. package/dist/scopes/index.js +38 -9
  37. 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,5 +1,6 @@
1
+ import { UUID } from '../uuid';
1
2
  import { ActionDocument, EventState } from './ActionDocument';
2
- 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';
3
4
  import { ActionType } from './ActionType';
4
5
  import { Draft } from './Draft';
5
6
  import { EventConfig } from './EventConfig';
@@ -11,6 +12,11 @@ import { FieldConfig } from './FieldConfig';
11
12
  import { WorkqueueConfig } from './WorkqueueConfig';
12
13
  import { FieldValue } from './FieldValue';
13
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";
14
20
  /**
15
21
  * In real application, the roles are defined in the countryconfig.
16
22
  * These are just for testing purposes to generate realistic mock data.
@@ -37,16 +43,17 @@ export declare function eventPayloadGenerator(rng: () => number): {
37
43
  type: string;
38
44
  id: string;
39
45
  };
40
- draft: ({ eventId, actionType }: {
41
- eventId: string;
46
+ draft: ({ eventId, actionType, annotation }: {
47
+ eventId: UUID;
42
48
  actionType: ActionType;
49
+ annotation?: Record<string, any>;
43
50
  }, input?: Partial<Draft>) => Draft;
44
51
  actions: {
45
52
  declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
46
53
  transactionId: string;
47
54
  declaration: Record<string, string | number | boolean | {
48
55
  type: string;
49
- filename: string;
56
+ path: string;
50
57
  originalFilename: string;
51
58
  } | {
52
59
  country: string;
@@ -60,8 +67,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
60
67
  street?: string | null | undefined;
61
68
  zipCode?: string | null | undefined;
62
69
  } | {
63
- firstname: string;
64
- surname: string;
70
+ firstname?: string | null | undefined;
71
+ surname?: string | null | undefined;
65
72
  middlename?: string | null | undefined;
66
73
  } | {
67
74
  country: string;
@@ -83,9 +90,12 @@ export declare function eventPayloadGenerator(rng: () => number): {
83
90
  } | {
84
91
  type: string;
85
92
  option: string;
86
- filename: string;
93
+ path: string;
87
94
  originalFilename: string;
88
- }[] | [string, string] | null | undefined>;
95
+ }[] | {
96
+ start: string;
97
+ end: string;
98
+ } | null | undefined>;
89
99
  annotation: {};
90
100
  keepAssignment?: boolean | undefined;
91
101
  type: "DECLARE";
@@ -99,7 +109,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
99
109
  transactionId: string;
100
110
  declaration: Record<string, string | number | boolean | {
101
111
  type: string;
102
- filename: string;
112
+ path: string;
103
113
  originalFilename: string;
104
114
  } | {
105
115
  country: string;
@@ -113,8 +123,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
113
123
  street?: string | null | undefined;
114
124
  zipCode?: string | null | undefined;
115
125
  } | {
116
- firstname: string;
117
- surname: string;
126
+ firstname?: string | null | undefined;
127
+ surname?: string | null | undefined;
118
128
  middlename?: string | null | undefined;
119
129
  } | {
120
130
  country: string;
@@ -136,9 +146,12 @@ export declare function eventPayloadGenerator(rng: () => number): {
136
146
  } | {
137
147
  type: string;
138
148
  option: string;
139
- filename: string;
149
+ path: string;
140
150
  originalFilename: string;
141
- }[] | [string, string] | null | undefined>;
151
+ }[] | {
152
+ start: string;
153
+ end: string;
154
+ } | null | undefined>;
142
155
  eventId: string;
143
156
  keepAssignment: boolean | undefined;
144
157
  };
@@ -146,7 +159,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
146
159
  transactionId: string;
147
160
  declaration: Record<string, string | number | boolean | {
148
161
  type: string;
149
- filename: string;
162
+ path: string;
150
163
  originalFilename: string;
151
164
  } | {
152
165
  country: string;
@@ -160,8 +173,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
160
173
  street?: string | null | undefined;
161
174
  zipCode?: string | null | undefined;
162
175
  } | {
163
- firstname: string;
164
- surname: string;
176
+ firstname?: string | null | undefined;
177
+ surname?: string | null | undefined;
165
178
  middlename?: string | null | undefined;
166
179
  } | {
167
180
  country: string;
@@ -183,9 +196,12 @@ export declare function eventPayloadGenerator(rng: () => number): {
183
196
  } | {
184
197
  type: string;
185
198
  option: string;
186
- filename: string;
199
+ path: string;
187
200
  originalFilename: string;
188
- }[] | [string, string] | null | undefined>;
201
+ }[] | {
202
+ start: string;
203
+ end: string;
204
+ } | null | undefined>;
189
205
  annotation: {};
190
206
  keepAssignment?: boolean | undefined;
191
207
  type: "VALIDATE";
@@ -210,7 +226,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
210
226
  transactionId: string;
211
227
  declaration: Record<string, string | number | boolean | {
212
228
  type: string;
213
- filename: string;
229
+ path: string;
214
230
  originalFilename: string;
215
231
  } | {
216
232
  country: string;
@@ -224,8 +240,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
224
240
  street?: string | null | undefined;
225
241
  zipCode?: string | null | undefined;
226
242
  } | {
227
- firstname: string;
228
- surname: string;
243
+ firstname?: string | null | undefined;
244
+ surname?: string | null | undefined;
229
245
  middlename?: string | null | undefined;
230
246
  } | {
231
247
  country: string;
@@ -247,9 +263,12 @@ export declare function eventPayloadGenerator(rng: () => number): {
247
263
  } | {
248
264
  type: string;
249
265
  option: string;
250
- filename: string;
266
+ path: string;
251
267
  originalFilename: string;
252
- }[] | [string, string] | null | undefined>;
268
+ }[] | {
269
+ start: string;
270
+ end: string;
271
+ } | null | undefined>;
253
272
  keepAssignment?: boolean | undefined;
254
273
  type: "ARCHIVE";
255
274
  annotation: {};
@@ -272,11 +291,11 @@ export declare function eventPayloadGenerator(rng: () => number): {
272
291
  message: string;
273
292
  };
274
293
  };
275
- register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
294
+ register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment" | "registrationNumber">>) => {
276
295
  transactionId: string;
277
296
  declaration: Record<string, string | number | boolean | {
278
297
  type: string;
279
- filename: string;
298
+ path: string;
280
299
  originalFilename: string;
281
300
  } | {
282
301
  country: string;
@@ -290,8 +309,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
290
309
  street?: string | null | undefined;
291
310
  zipCode?: string | null | undefined;
292
311
  } | {
293
- firstname: string;
294
- surname: string;
312
+ firstname?: string | null | undefined;
313
+ surname?: string | null | undefined;
295
314
  middlename?: string | null | undefined;
296
315
  } | {
297
316
  country: string;
@@ -313,10 +332,14 @@ export declare function eventPayloadGenerator(rng: () => number): {
313
332
  } | {
314
333
  type: string;
315
334
  option: string;
316
- filename: string;
335
+ path: string;
317
336
  originalFilename: string;
318
- }[] | [string, string] | null | undefined>;
337
+ }[] | {
338
+ start: string;
339
+ end: string;
340
+ } | null | undefined>;
319
341
  annotation: {};
342
+ registrationNumber?: string | undefined;
320
343
  keepAssignment?: boolean | undefined;
321
344
  type: "REGISTER";
322
345
  eventId: string;
@@ -335,7 +358,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
335
358
  transactionId: string;
336
359
  declaration: Record<string, string | number | boolean | {
337
360
  type: string;
338
- filename: string;
361
+ path: string;
339
362
  originalFilename: string;
340
363
  } | {
341
364
  country: string;
@@ -349,8 +372,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
349
372
  street?: string | null | undefined;
350
373
  zipCode?: string | null | undefined;
351
374
  } | {
352
- firstname: string;
353
- surname: string;
375
+ firstname?: string | null | undefined;
376
+ surname?: string | null | undefined;
354
377
  middlename?: string | null | undefined;
355
378
  } | {
356
379
  country: string;
@@ -372,14 +395,17 @@ export declare function eventPayloadGenerator(rng: () => number): {
372
395
  } | {
373
396
  type: string;
374
397
  option: string;
375
- filename: string;
398
+ path: string;
376
399
  originalFilename: string;
377
- }[] | [string, string] | null | undefined>;
400
+ }[] | {
401
+ start: string;
402
+ end: string;
403
+ } | null | undefined>;
378
404
  annotation: {};
379
405
  eventId: string;
380
406
  keepAssignment: boolean | undefined;
381
407
  };
382
- 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">>) => {
383
409
  type: "APPROVE_CORRECTION";
384
410
  transactionId: string;
385
411
  declaration: {};
@@ -388,7 +414,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
388
414
  requestId: string;
389
415
  keepAssignment: boolean | undefined;
390
416
  };
391
- 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">>) => {
392
418
  type: "REJECT_CORRECTION";
393
419
  transactionId: string;
394
420
  declaration: {};
@@ -400,25 +426,31 @@ export declare function eventPayloadGenerator(rng: () => number): {
400
426
  };
401
427
  };
402
428
  };
403
- export declare function generateActionDocument({ configuration, action, rng, defaults }: {
429
+ export declare function generateActionDocument({ configuration, action, rng, defaults, user }: {
404
430
  configuration: EventConfig;
405
431
  action: ActionType;
406
432
  rng?: () => number;
407
433
  defaults?: Partial<ActionDocument>;
408
434
  user?: Partial<{
409
435
  signature: string;
410
- primaryOfficeId: string;
436
+ primaryOfficeId: UUID;
411
437
  role: TestUserRole;
412
438
  id: string;
413
439
  }>;
414
440
  }): ActionDocument;
415
- export declare function generateEventDocument({ configuration, actions, rng }: {
441
+ export declare function generateEventDocument({ configuration, actions, rng, user }: {
416
442
  configuration: EventConfig;
417
443
  actions: ActionType[];
418
444
  rng?: () => number;
445
+ user?: Partial<{
446
+ signature: string;
447
+ primaryOfficeId: UUID;
448
+ role: TestUserRole;
449
+ id: string;
450
+ }>;
419
451
  }): EventDocument;
420
452
  export declare function generateEventDraftDocument({ eventId, actionType, rng, declaration }: {
421
- eventId: string;
453
+ eventId: UUID;
422
454
  actionType: ActionType;
423
455
  rng?: () => number;
424
456
  declaration?: EventState;
@@ -432,6 +464,8 @@ export declare function getRandomDate(rng: () => number, start: string, end: str
432
464
  * @returns A function that generates pseudo-random numbers between 0 and 1 [0, 1)
433
465
  */
434
466
  export declare function createPrng(seed: number): () => number;
467
+ export declare function generateUuid(rng?: () => number): UUID;
468
+ export declare function generateRegistrationNumber(rng: () => number): string;
435
469
  export declare function generateRandomSignature(rng: () => number): string;
436
470
  export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>, seed?: number) => EventIndex;
437
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