@opencrvs/toolkit 1.8.1-rc.e32d7b8 → 1.8.1-rc.e59d03c

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 (32) hide show
  1. package/dist/commons/api/router.d.ts +433 -796
  2. package/dist/commons/conditionals/validate.d.ts +11 -2
  3. package/dist/commons/events/ActionConfig.d.ts +2004 -366
  4. package/dist/commons/events/ActionDocument.d.ts +1302 -1389
  5. package/dist/commons/events/ActionInput.d.ts +658 -1136
  6. package/dist/commons/events/AdvancedSearchConfig.d.ts +83 -65
  7. package/dist/commons/events/CompositeFieldValue.d.ts +6 -6
  8. package/dist/commons/events/CountryConfigQueryInput.d.ts +88 -88
  9. package/dist/commons/events/Draft.d.ts +48 -92
  10. package/dist/commons/events/EventConfig.d.ts +695 -168
  11. package/dist/commons/events/EventDocument.d.ts +475 -846
  12. package/dist/commons/events/EventIndex.d.ts +184 -62
  13. package/dist/commons/events/EventMetadata.d.ts +9 -9
  14. package/dist/commons/events/FieldConfig.d.ts +254 -43
  15. package/dist/commons/events/FieldTypeMapping.d.ts +16 -16
  16. package/dist/commons/events/FieldValue.d.ts +12 -12
  17. package/dist/commons/events/FormConfig.d.ts +1032 -246
  18. package/dist/commons/events/PageConfig.d.ts +264 -46
  19. package/dist/commons/events/WorkqueueConfig.d.ts +288 -164
  20. package/dist/commons/events/defineConfig.d.ts +129 -30
  21. package/dist/commons/events/event.d.ts +68 -6
  22. package/dist/commons/events/field.d.ts +14 -0
  23. package/dist/commons/events/test.utils.d.ts +17 -13
  24. package/dist/commons/events/utils.d.ts +236 -64
  25. package/dist/conditionals/index.js +3 -2
  26. package/dist/events/index.js +265 -102
  27. package/package.json +1 -1
  28. package/tsconfig.json +1 -1
  29. package/dist/commons/conditionals/conditionals.test.d.ts +0 -2
  30. package/dist/commons/conditionals/validate-address.test.d.ts +0 -2
  31. package/dist/commons/conditionals/validate.test.d.ts +0 -2
  32. package/dist/commons/events/utils.test.d.ts +0 -2
@@ -567,14 +567,25 @@ export declare const defineConfig: (config: EventConfigInput) => {
567
567
  hideLabel?: boolean | undefined;
568
568
  uncorrectable?: boolean | undefined;
569
569
  defaultValue?: {
570
- firstname: string;
571
- surname: string;
570
+ firstname?: string | undefined;
571
+ surname?: string | undefined;
572
+ middlename?: string | undefined;
572
573
  } | undefined;
573
574
  configuration?: {
575
+ name?: {
576
+ firstname?: {
577
+ required: boolean;
578
+ } | undefined;
579
+ surname?: {
580
+ required: boolean;
581
+ } | undefined;
582
+ middlename?: {
583
+ required: boolean;
584
+ } | undefined;
585
+ } | undefined;
574
586
  maxLength?: number | undefined;
575
587
  prefix?: import("./TranslationConfig").TranslationConfig | undefined;
576
588
  postfix?: import("./TranslationConfig").TranslationConfig | undefined;
577
- includeMiddlename?: boolean | undefined;
578
589
  searchMode?: boolean | undefined;
579
590
  } | undefined;
580
591
  } | {
@@ -1517,14 +1528,25 @@ export declare const defineConfig: (config: EventConfigInput) => {
1517
1528
  hideLabel?: boolean | undefined;
1518
1529
  uncorrectable?: boolean | undefined;
1519
1530
  defaultValue?: {
1520
- firstname: string;
1521
- surname: string;
1531
+ firstname?: string | undefined;
1532
+ surname?: string | undefined;
1533
+ middlename?: string | undefined;
1522
1534
  } | undefined;
1523
1535
  configuration?: {
1536
+ name?: {
1537
+ firstname?: {
1538
+ required: boolean;
1539
+ } | undefined;
1540
+ surname?: {
1541
+ required: boolean;
1542
+ } | undefined;
1543
+ middlename?: {
1544
+ required: boolean;
1545
+ } | undefined;
1546
+ } | undefined;
1524
1547
  maxLength?: number | undefined;
1525
1548
  prefix?: import("./TranslationConfig").TranslationConfig | undefined;
1526
1549
  postfix?: import("./TranslationConfig").TranslationConfig | undefined;
1527
- includeMiddlename?: boolean | undefined;
1528
1550
  searchMode?: boolean | undefined;
1529
1551
  } | undefined;
1530
1552
  } | {
@@ -2466,14 +2488,25 @@ export declare const defineConfig: (config: EventConfigInput) => {
2466
2488
  hideLabel?: boolean | undefined;
2467
2489
  uncorrectable?: boolean | undefined;
2468
2490
  defaultValue?: {
2469
- firstname: string;
2470
- surname: string;
2491
+ firstname?: string | undefined;
2492
+ surname?: string | undefined;
2493
+ middlename?: string | undefined;
2471
2494
  } | undefined;
2472
2495
  configuration?: {
2496
+ name?: {
2497
+ firstname?: {
2498
+ required: boolean;
2499
+ } | undefined;
2500
+ surname?: {
2501
+ required: boolean;
2502
+ } | undefined;
2503
+ middlename?: {
2504
+ required: boolean;
2505
+ } | undefined;
2506
+ } | undefined;
2473
2507
  maxLength?: number | undefined;
2474
2508
  prefix?: import("./TranslationConfig").TranslationConfig | undefined;
2475
2509
  postfix?: import("./TranslationConfig").TranslationConfig | undefined;
2476
- includeMiddlename?: boolean | undefined;
2477
2510
  searchMode?: boolean | undefined;
2478
2511
  } | undefined;
2479
2512
  } | {
@@ -3415,14 +3448,25 @@ export declare const defineConfig: (config: EventConfigInput) => {
3415
3448
  hideLabel?: boolean | undefined;
3416
3449
  uncorrectable?: boolean | undefined;
3417
3450
  defaultValue?: {
3418
- firstname: string;
3419
- surname: string;
3451
+ firstname?: string | undefined;
3452
+ surname?: string | undefined;
3453
+ middlename?: string | undefined;
3420
3454
  } | undefined;
3421
3455
  configuration?: {
3456
+ name?: {
3457
+ firstname?: {
3458
+ required: boolean;
3459
+ } | undefined;
3460
+ surname?: {
3461
+ required: boolean;
3462
+ } | undefined;
3463
+ middlename?: {
3464
+ required: boolean;
3465
+ } | undefined;
3466
+ } | undefined;
3422
3467
  maxLength?: number | undefined;
3423
3468
  prefix?: import("./TranslationConfig").TranslationConfig | undefined;
3424
3469
  postfix?: import("./TranslationConfig").TranslationConfig | undefined;
3425
- includeMiddlename?: boolean | undefined;
3426
3470
  searchMode?: boolean | undefined;
3427
3471
  } | undefined;
3428
3472
  } | {
@@ -4364,14 +4408,25 @@ export declare const defineConfig: (config: EventConfigInput) => {
4364
4408
  hideLabel?: boolean | undefined;
4365
4409
  uncorrectable?: boolean | undefined;
4366
4410
  defaultValue?: {
4367
- firstname: string;
4368
- surname: string;
4411
+ firstname?: string | undefined;
4412
+ surname?: string | undefined;
4413
+ middlename?: string | undefined;
4369
4414
  } | undefined;
4370
4415
  configuration?: {
4416
+ name?: {
4417
+ firstname?: {
4418
+ required: boolean;
4419
+ } | undefined;
4420
+ surname?: {
4421
+ required: boolean;
4422
+ } | undefined;
4423
+ middlename?: {
4424
+ required: boolean;
4425
+ } | undefined;
4426
+ } | undefined;
4371
4427
  maxLength?: number | undefined;
4372
4428
  prefix?: import("./TranslationConfig").TranslationConfig | undefined;
4373
4429
  postfix?: import("./TranslationConfig").TranslationConfig | undefined;
4374
- includeMiddlename?: boolean | undefined;
4375
4430
  searchMode?: boolean | undefined;
4376
4431
  } | undefined;
4377
4432
  } | {
@@ -5361,14 +5416,25 @@ export declare const defineConfig: (config: EventConfigInput) => {
5361
5416
  hideLabel?: boolean | undefined;
5362
5417
  uncorrectable?: boolean | undefined;
5363
5418
  defaultValue?: {
5364
- firstname: string;
5365
- surname: string;
5419
+ firstname?: string | undefined;
5420
+ surname?: string | undefined;
5421
+ middlename?: string | undefined;
5366
5422
  } | undefined;
5367
5423
  configuration?: {
5424
+ name?: {
5425
+ firstname?: {
5426
+ required: boolean;
5427
+ } | undefined;
5428
+ surname?: {
5429
+ required: boolean;
5430
+ } | undefined;
5431
+ middlename?: {
5432
+ required: boolean;
5433
+ } | undefined;
5434
+ } | undefined;
5368
5435
  maxLength?: number | undefined;
5369
5436
  prefix?: import("./TranslationConfig").TranslationConfig | undefined;
5370
5437
  postfix?: import("./TranslationConfig").TranslationConfig | undefined;
5371
- includeMiddlename?: boolean | undefined;
5372
5438
  searchMode?: boolean | undefined;
5373
5439
  } | undefined;
5374
5440
  } | {
@@ -6313,14 +6379,25 @@ export declare const defineConfig: (config: EventConfigInput) => {
6313
6379
  hideLabel?: boolean | undefined;
6314
6380
  uncorrectable?: boolean | undefined;
6315
6381
  defaultValue?: {
6316
- firstname: string;
6317
- surname: string;
6382
+ firstname?: string | undefined;
6383
+ surname?: string | undefined;
6384
+ middlename?: string | undefined;
6318
6385
  } | undefined;
6319
6386
  configuration?: {
6387
+ name?: {
6388
+ firstname?: {
6389
+ required: boolean;
6390
+ } | undefined;
6391
+ surname?: {
6392
+ required: boolean;
6393
+ } | undefined;
6394
+ middlename?: {
6395
+ required: boolean;
6396
+ } | undefined;
6397
+ } | undefined;
6320
6398
  maxLength?: number | undefined;
6321
6399
  prefix?: import("./TranslationConfig").TranslationConfig | undefined;
6322
6400
  postfix?: import("./TranslationConfig").TranslationConfig | undefined;
6323
- includeMiddlename?: boolean | undefined;
6324
6401
  searchMode?: boolean | undefined;
6325
6402
  } | undefined;
6326
6403
  } | {
@@ -7268,14 +7345,25 @@ export declare const defineConfig: (config: EventConfigInput) => {
7268
7345
  hideLabel?: boolean | undefined;
7269
7346
  uncorrectable?: boolean | undefined;
7270
7347
  defaultValue?: {
7271
- firstname: string;
7272
- surname: string;
7348
+ firstname?: string | undefined;
7349
+ surname?: string | undefined;
7350
+ middlename?: string | undefined;
7273
7351
  } | undefined;
7274
7352
  configuration?: {
7353
+ name?: {
7354
+ firstname?: {
7355
+ required: boolean;
7356
+ } | undefined;
7357
+ surname?: {
7358
+ required: boolean;
7359
+ } | undefined;
7360
+ middlename?: {
7361
+ required: boolean;
7362
+ } | undefined;
7363
+ } | undefined;
7275
7364
  maxLength?: number | undefined;
7276
7365
  prefix?: import("./TranslationConfig").TranslationConfig | undefined;
7277
7366
  postfix?: import("./TranslationConfig").TranslationConfig | undefined;
7278
- includeMiddlename?: boolean | undefined;
7279
7367
  searchMode?: boolean | undefined;
7280
7368
  } | undefined;
7281
7369
  } | {
@@ -8220,14 +8308,25 @@ export declare const defineConfig: (config: EventConfigInput) => {
8220
8308
  hideLabel?: boolean | undefined;
8221
8309
  uncorrectable?: boolean | undefined;
8222
8310
  defaultValue?: {
8223
- firstname: string;
8224
- surname: string;
8311
+ firstname?: string | undefined;
8312
+ surname?: string | undefined;
8313
+ middlename?: string | undefined;
8225
8314
  } | undefined;
8226
8315
  configuration?: {
8316
+ name?: {
8317
+ firstname?: {
8318
+ required: boolean;
8319
+ } | undefined;
8320
+ surname?: {
8321
+ required: boolean;
8322
+ } | undefined;
8323
+ middlename?: {
8324
+ required: boolean;
8325
+ } | undefined;
8326
+ } | undefined;
8227
8327
  maxLength?: number | undefined;
8228
8328
  prefix?: import("./TranslationConfig").TranslationConfig | undefined;
8229
8329
  postfix?: import("./TranslationConfig").TranslationConfig | undefined;
8230
- includeMiddlename?: boolean | undefined;
8231
8330
  searchMode?: boolean | undefined;
8232
8331
  } | undefined;
8233
8332
  } | {
@@ -8657,7 +8756,7 @@ export declare const defineConfig: (config: EventConfigInput) => {
8657
8756
  title: import("./TranslationConfig").TranslationConfig;
8658
8757
  fields: ({
8659
8758
  config: {
8660
- type: "exact" | "fuzzy" | "range";
8759
+ type: "exact" | "fuzzy" | "range" | "within";
8661
8760
  };
8662
8761
  fieldId: string;
8663
8762
  fieldType: "field";
@@ -8684,9 +8783,9 @@ export declare const defineConfig: (config: EventConfigInput) => {
8684
8783
  excludeInSearchQuery?: boolean | undefined;
8685
8784
  } | {
8686
8785
  config: {
8687
- type: "exact" | "fuzzy" | "range";
8786
+ type: "exact" | "fuzzy" | "range" | "within";
8688
8787
  };
8689
- fieldId: "status" | "updatedAt" | "trackingId" | "legalStatuses.REGISTERED.acceptedAt" | "legalStatuses.REGISTERED.createdAtLocation";
8788
+ fieldId: "event.status" | "event.updatedAt" | "event.trackingId" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation";
8690
8789
  fieldType: "event";
8691
8790
  options?: {
8692
8791
  value: string;
@@ -1,5 +1,5 @@
1
1
  import { ActionType } from './ActionType';
2
- import { EventFieldId } from './AdvancedSearchConfig';
2
+ import { EventFieldIdInput } from './AdvancedSearchConfig';
3
3
  import { WorkqueueColumnKeys, WorkqueueColumnValue } from './WorkqueueColumnConfig';
4
4
  /**
5
5
  * Creates a function that acts like a callable + static method container.
@@ -8,9 +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): {
11
+ declare function eventFn(fieldId: EventFieldIdInput): {
12
12
  range: () => {
13
- fieldId: "status" | "updatedAt" | "trackingId" | "legalStatuses.REGISTERED.acceptedAt" | "legalStatuses.REGISTERED.createdAtLocation";
13
+ fieldId: "event.status" | "event.updatedAt" | "event.trackingId" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation";
14
14
  fieldType: "event";
15
15
  } & {
16
16
  config: {
@@ -18,7 +18,7 @@ declare function eventFn(fieldId: EventFieldId): {
18
18
  };
19
19
  };
20
20
  exact: () => {
21
- fieldId: "status" | "updatedAt" | "trackingId" | "legalStatuses.REGISTERED.acceptedAt" | "legalStatuses.REGISTERED.createdAtLocation";
21
+ fieldId: "event.status" | "event.updatedAt" | "event.trackingId" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation";
22
22
  fieldType: "event";
23
23
  } & {
24
24
  config: {
@@ -26,20 +26,82 @@ declare function eventFn(fieldId: EventFieldId): {
26
26
  };
27
27
  };
28
28
  fuzzy: () => {
29
- fieldId: "status" | "updatedAt" | "trackingId" | "legalStatuses.REGISTERED.acceptedAt" | "legalStatuses.REGISTERED.createdAtLocation";
29
+ fieldId: "event.status" | "event.updatedAt" | "event.trackingId" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation";
30
30
  fieldType: "event";
31
31
  } & {
32
32
  config: {
33
33
  type: "fuzzy";
34
34
  };
35
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
+ };
36
44
  };
37
45
  declare const event: typeof eventFn & {
38
46
  /**
39
47
  * Checks if the event contains a specific action type.
48
+ * Can be used directly as a conditional or chained with additional methods.
40
49
  * @param action - The action type to check for.
41
50
  */
42
- hasAction: (action: ActionType) => import("../conditionals/conditionals").JSONSchema;
51
+ hasAction: (action: ActionType) => {
52
+ /**
53
+ * Creates a conditional that checks if the event contains a specific action type
54
+ * with a minimum count of occurrences.
55
+ *
56
+ * @param minCount - The minimum number of actions required.
57
+ */
58
+ minCount: (minCount: number) => import("../conditionals/conditionals").JSONSchema;
59
+ /**
60
+ * Builds a conditional that sets a maximum count for the number of actions.
61
+ * This is useful for limiting the number of actions of a specific type in a single event.
62
+ */
63
+ maxCount: (maxCount: number) => import("../conditionals/conditionals").JSONSchema;
64
+ /**
65
+ * Adds additional field constraints to the action matching.
66
+ *
67
+ * @param fields - Object containing additional fields to match on the action.
68
+ */
69
+ withFields: (fields: Record<string, unknown>) => {
70
+ /**
71
+ * Creates a conditional that checks if the event contains a specific action type
72
+ * with a minimum count of occurrences.
73
+ *
74
+ * @param minCount - The minimum number of actions required.
75
+ */
76
+ minCount: (minCount: number) => import("../conditionals/conditionals").JSONSchema;
77
+ /**
78
+ * Builds a conditional that sets a maximum count for the number of actions.
79
+ * This is useful for limiting the number of actions of a specific type in a single event.
80
+ */
81
+ maxCount: (maxCount: number) => import("../conditionals/conditionals").JSONSchema;
82
+ };
83
+ /**
84
+ * Adds template ID constraint to the action matching.
85
+ * This is a convenience method that adds content.templateId to the fields.
86
+ *
87
+ * @param id - The template ID to match against.
88
+ */
89
+ withTemplate: (id: string) => {
90
+ /**
91
+ * Creates a conditional that checks if the event contains a specific action type
92
+ * with a minimum count of occurrences.
93
+ *
94
+ * @param minCount - The minimum number of actions required.
95
+ */
96
+ minCount: (minCount: number) => import("../conditionals/conditionals").JSONSchema;
97
+ /**
98
+ * Builds a conditional that sets a maximum count for the number of actions.
99
+ * This is useful for limiting the number of actions of a specific type in a single event.
100
+ */
101
+ maxCount: (maxCount: number) => import("../conditionals/conditionals").JSONSchema;
102
+ };
103
+ __nominal__type: "JSONSchema";
104
+ };
43
105
  field(field: WorkqueueColumnKeys): WorkqueueColumnValue;
44
106
  };
45
107
  export { event };
@@ -56,6 +56,20 @@ export declare function field(fieldId: string, options?: {
56
56
  type: "fuzzy";
57
57
  };
58
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
+ };
59
73
  $$field: string;
60
74
  isAfter: () => {
61
75
  days: (days: number) => {
@@ -67,8 +67,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
67
67
  street?: string | null | undefined;
68
68
  zipCode?: string | null | undefined;
69
69
  } | {
70
- firstname?: string | null | undefined;
71
- surname?: string | null | undefined;
70
+ firstname: string;
71
+ surname: string;
72
72
  middlename?: string | null | undefined;
73
73
  } | {
74
74
  country: string;
@@ -123,8 +123,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
123
123
  street?: string | null | undefined;
124
124
  zipCode?: string | null | undefined;
125
125
  } | {
126
- firstname?: string | null | undefined;
127
- surname?: string | null | undefined;
126
+ firstname: string;
127
+ surname: string;
128
128
  middlename?: string | null | undefined;
129
129
  } | {
130
130
  country: string;
@@ -173,8 +173,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
173
173
  street?: string | null | undefined;
174
174
  zipCode?: string | null | undefined;
175
175
  } | {
176
- firstname?: string | null | undefined;
177
- surname?: string | null | undefined;
176
+ firstname: string;
177
+ surname: string;
178
178
  middlename?: string | null | undefined;
179
179
  } | {
180
180
  country: string;
@@ -240,8 +240,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
240
240
  street?: string | null | undefined;
241
241
  zipCode?: string | null | undefined;
242
242
  } | {
243
- firstname?: string | null | undefined;
244
- surname?: string | null | undefined;
243
+ firstname: string;
244
+ surname: string;
245
245
  middlename?: string | null | undefined;
246
246
  } | {
247
247
  country: string;
@@ -309,8 +309,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
309
309
  street?: string | null | undefined;
310
310
  zipCode?: string | null | undefined;
311
311
  } | {
312
- firstname?: string | null | undefined;
313
- surname?: string | null | undefined;
312
+ firstname: string;
313
+ surname: string;
314
314
  middlename?: string | null | undefined;
315
315
  } | {
316
316
  country: string;
@@ -372,8 +372,8 @@ export declare function eventPayloadGenerator(rng: () => number): {
372
372
  street?: string | null | undefined;
373
373
  zipCode?: string | null | undefined;
374
374
  } | {
375
- firstname?: string | null | undefined;
376
- surname?: string | null | undefined;
375
+ firstname: string;
376
+ surname: string;
377
377
  middlename?: string | null | undefined;
378
378
  } | {
379
379
  country: string;
@@ -414,7 +414,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
414
414
  requestId: string;
415
415
  keepAssignment: boolean | undefined;
416
416
  };
417
- reject: (eventId: string, requestId: string, input?: Partial<Pick<RejectCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
417
+ reject: (eventId: string, requestId: string, input: Partial<Pick<RejectCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment" | "reason">>) => {
418
418
  type: "REJECT_CORRECTION";
419
419
  transactionId: string;
420
420
  declaration: {};
@@ -422,6 +422,10 @@ export declare function eventPayloadGenerator(rng: () => number): {
422
422
  eventId: string;
423
423
  requestId: string;
424
424
  keepAssignment: boolean | undefined;
425
+ reason: {
426
+ message: string;
427
+ isDuplicate?: boolean | undefined;
428
+ };
425
429
  };
426
430
  };
427
431
  };