@opencrvs/toolkit 1.9.8-rc.d187100 → 1.9.8-rc.f0948d3

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.
@@ -40,19 +40,19 @@ export declare function alwaysTrue(): AjvJSONSchema;
40
40
  /**
41
41
  * Universal boolean connector to be used with any type of conditional. (user, event, field)
42
42
  *
43
- * @example and(field('foo').isEqualTo('bar'), field('baz').isUndefined())
43
+ * @example and(event.declaration('foo').isEqualTo('bar'), event.declaration('baz').isUndefined())
44
44
  */
45
45
  export declare function and(...conditions: AjvJSONSchema[]): JSONSchema;
46
46
  /**
47
47
  * Universal boolean connector to be used with any type of conditional. (user, event, field)
48
48
  *
49
- * @example or(field('foo').isEqualTo('bar'), field('baz').isUndefined())
49
+ * @example or(event.declaration('foo').isEqualTo('bar'), event.declaration('baz').isUndefined())
50
50
  */
51
51
  export declare function or(...conditions: AjvJSONSchema[]): JSONSchema;
52
52
  /**
53
53
  * Universal boolean connector to be used with any type of conditional. (user, event, field)
54
54
  *
55
- * @example not(field('foo').isEqualTo('bar'))
55
+ * @example not(event.declaration('foo').isEqualTo('bar'))
56
56
  */
57
57
  export declare function not(condition: AjvJSONSchema): JSONSchema;
58
58
  /**
@@ -89,7 +89,7 @@ export declare function isFieldReference(value: unknown): value is FieldReferenc
89
89
  *
90
90
  * @param fieldId - The field ID condition is applied to.
91
91
  * @example to combine multiple conditions, utilise connectors like `and`, `or`, `not`:
92
- * and(field('foo').isEqualTo('bar'), field('baz').isUndefined())
92
+ * and(event.declaration('foo').isEqualTo('bar'), event.declaration('baz').isUndefined())
93
93
  *
94
94
  */
95
95
  export declare function createFieldConditionals(fieldId: string): {
@@ -143,7 +143,7 @@ export declare function createFieldConditionals(fieldId: string): {
143
143
  isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
144
144
  /**
145
145
  * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
146
- * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
146
+ * @example event.declaration('recommender.none').isFalsy() vs not(event.declaration('recommender.none').isEqualTo(true))
147
147
  * @returns whether the field is falsy (undefined, false, null, empty string)
148
148
  *
149
149
  * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
@@ -166,11 +166,11 @@ export declare function createFieldConditionals(fieldId: string): {
166
166
  };
167
167
  /**
168
168
  * @deprecated
169
- * use field(fieldId).get(nestedProperty) instead
169
+ * use event.declaration(fieldId).get(nestedProperty) instead
170
170
  * with 'and' combinator e.g.
171
171
  * and(
172
- * field('child.name').get('firstname').isEqualTo('John'),
173
- * field('child.name').get('surname').isEqualTo('Doe')
172
+ * event.declaration('child.name').get('firstname').isEqualTo('John'),
173
+ * event.declaration('child.name').get('surname').isEqualTo('Doe')
174
174
  * )
175
175
  */
176
176
  object: (options: Record<string, any>) => JSONSchema;
@@ -202,7 +202,7 @@ export declare function createFieldConditionals(fieldId: string): {
202
202
  isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
203
203
  /**
204
204
  * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
205
- * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
205
+ * @example event.declaration('recommender.none').isFalsy() vs not(event.declaration('recommender.none').isEqualTo(true))
206
206
  * @returns whether the field is falsy (undefined, false, null, empty string)
207
207
  *
208
208
  * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
@@ -225,11 +225,11 @@ export declare function createFieldConditionals(fieldId: string): {
225
225
  };
226
226
  /**
227
227
  * @deprecated
228
- * use field(fieldId).get(nestedProperty) instead
228
+ * use event.declaration(fieldId).get(nestedProperty) instead
229
229
  * with 'and' combinator e.g.
230
230
  * and(
231
- * field('child.name').get('firstname').isEqualTo('John'),
232
- * field('child.name').get('surname').isEqualTo('Doe')
231
+ * event.declaration('child.name').get('firstname').isEqualTo('John'),
232
+ * event.declaration('child.name').get('surname').isEqualTo('Doe')
233
233
  * )
234
234
  */
235
235
  object: (options: Record<string, any>) => JSONSchema;
@@ -275,7 +275,7 @@ export declare function createFieldConditionals(fieldId: string): {
275
275
  isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
276
276
  /**
277
277
  * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
278
- * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
278
+ * @example event.declaration('recommender.none').isFalsy() vs not(event.declaration('recommender.none').isEqualTo(true))
279
279
  * @returns whether the field is falsy (undefined, false, null, empty string)
280
280
  *
281
281
  * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
@@ -298,11 +298,11 @@ export declare function createFieldConditionals(fieldId: string): {
298
298
  };
299
299
  /**
300
300
  * @deprecated
301
- * use field(fieldId).get(nestedProperty) instead
301
+ * use event.declaration(fieldId).get(nestedProperty) instead
302
302
  * with 'and' combinator e.g.
303
303
  * and(
304
- * field('child.name').get('firstname').isEqualTo('John'),
305
- * field('child.name').get('surname').isEqualTo('Doe')
304
+ * event.declaration('child.name').get('firstname').isEqualTo('John'),
305
+ * event.declaration('child.name').get('surname').isEqualTo('Doe')
306
306
  * )
307
307
  */
308
308
  object: (options: Record<string, any>) => JSONSchema;
@@ -343,7 +343,7 @@ export declare function createFieldConditionals(fieldId: string): {
343
343
  isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
344
344
  /**
345
345
  * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
346
- * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
346
+ * @example event.declaration('recommender.none').isFalsy() vs not(event.declaration('recommender.none').isEqualTo(true))
347
347
  * @returns whether the field is falsy (undefined, false, null, empty string)
348
348
  *
349
349
  * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
@@ -366,11 +366,11 @@ export declare function createFieldConditionals(fieldId: string): {
366
366
  };
367
367
  /**
368
368
  * @deprecated
369
- * use field(fieldId).get(nestedProperty) instead
369
+ * use event.declaration(fieldId).get(nestedProperty) instead
370
370
  * with 'and' combinator e.g.
371
371
  * and(
372
- * field('child.name').get('firstname').isEqualTo('John'),
373
- * field('child.name').get('surname').isEqualTo('Doe')
372
+ * event.declaration('child.name').get('firstname').isEqualTo('John'),
373
+ * event.declaration('child.name').get('surname').isEqualTo('Doe')
374
374
  * )
375
375
  */
376
376
  object: (options: Record<string, any>) => JSONSchema;
@@ -410,7 +410,7 @@ export declare function createFieldConditionals(fieldId: string): {
410
410
  isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
411
411
  /**
412
412
  * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
413
- * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
413
+ * @example event.declaration('recommender.none').isFalsy() vs not(event.declaration('recommender.none').isEqualTo(true))
414
414
  * @returns whether the field is falsy (undefined, false, null, empty string)
415
415
  *
416
416
  * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
@@ -433,11 +433,11 @@ export declare function createFieldConditionals(fieldId: string): {
433
433
  };
434
434
  /**
435
435
  * @deprecated
436
- * use field(fieldId).get(nestedProperty) instead
436
+ * use event.declaration(fieldId).get(nestedProperty) instead
437
437
  * with 'and' combinator e.g.
438
438
  * and(
439
- * field('child.name').get('firstname').isEqualTo('John'),
440
- * field('child.name').get('surname').isEqualTo('Doe')
439
+ * event.declaration('child.name').get('firstname').isEqualTo('John'),
440
+ * event.declaration('child.name').get('surname').isEqualTo('Doe')
441
441
  * )
442
442
  */
443
443
  object: (options: Record<string, any>) => JSONSchema;
@@ -467,7 +467,7 @@ export declare function createFieldConditionals(fieldId: string): {
467
467
  isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
468
468
  /**
469
469
  * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
470
- * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
470
+ * @example event.declaration('recommender.none').isFalsy() vs not(event.declaration('recommender.none').isEqualTo(true))
471
471
  * @returns whether the field is falsy (undefined, false, null, empty string)
472
472
  *
473
473
  * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
@@ -490,11 +490,11 @@ export declare function createFieldConditionals(fieldId: string): {
490
490
  };
491
491
  /**
492
492
  * @deprecated
493
- * use field(fieldId).get(nestedProperty) instead
493
+ * use event.declaration(fieldId).get(nestedProperty) instead
494
494
  * with 'and' combinator e.g.
495
495
  * and(
496
- * field('child.name').get('firstname').isEqualTo('John'),
497
- * field('child.name').get('surname').isEqualTo('Doe')
496
+ * event.declaration('child.name').get('firstname').isEqualTo('John'),
497
+ * event.declaration('child.name').get('surname').isEqualTo('Doe')
498
498
  * )
499
499
  */
500
500
  object: (options: Record<string, any>) => JSONSchema;
@@ -541,7 +541,7 @@ export declare function createFieldConditionals(fieldId: string): {
541
541
  isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
542
542
  /**
543
543
  * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
544
- * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
544
+ * @example event.declaration('recommender.none').isFalsy() vs not(event.declaration('recommender.none').isEqualTo(true))
545
545
  * @returns whether the field is falsy (undefined, false, null, empty string)
546
546
  *
547
547
  * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
@@ -564,11 +564,11 @@ export declare function createFieldConditionals(fieldId: string): {
564
564
  };
565
565
  /**
566
566
  * @deprecated
567
- * use field(fieldId).get(nestedProperty) instead
567
+ * use event.declaration(fieldId).get(nestedProperty) instead
568
568
  * with 'and' combinator e.g.
569
569
  * and(
570
- * field('child.name').get('firstname').isEqualTo('John'),
571
- * field('child.name').get('surname').isEqualTo('Doe')
570
+ * event.declaration('child.name').get('firstname').isEqualTo('John'),
571
+ * event.declaration('child.name').get('surname').isEqualTo('Doe')
572
572
  * )
573
573
  */
574
574
  object: (options: Record<string, any>) => JSONSchema;
@@ -600,7 +600,7 @@ export declare function createFieldConditionals(fieldId: string): {
600
600
  isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
601
601
  /**
602
602
  * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
603
- * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
603
+ * @example event.declaration('recommender.none').isFalsy() vs not(event.declaration('recommender.none').isEqualTo(true))
604
604
  * @returns whether the field is falsy (undefined, false, null, empty string)
605
605
  *
606
606
  * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
@@ -623,11 +623,11 @@ export declare function createFieldConditionals(fieldId: string): {
623
623
  };
624
624
  /**
625
625
  * @deprecated
626
- * use field(fieldId).get(nestedProperty) instead
626
+ * use event.declaration(fieldId).get(nestedProperty) instead
627
627
  * with 'and' combinator e.g.
628
628
  * and(
629
- * field('child.name').get('firstname').isEqualTo('John'),
630
- * field('child.name').get('surname').isEqualTo('Doe')
629
+ * event.declaration('child.name').get('firstname').isEqualTo('John'),
630
+ * event.declaration('child.name').get('surname').isEqualTo('Doe')
631
631
  * )
632
632
  */
633
633
  object: (options: Record<string, any>) => JSONSchema;
@@ -674,7 +674,7 @@ export declare function createFieldConditionals(fieldId: string): {
674
674
  isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
675
675
  /**
676
676
  * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
677
- * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
677
+ * @example event.declaration('recommender.none').isFalsy() vs not(event.declaration('recommender.none').isEqualTo(true))
678
678
  * @returns whether the field is falsy (undefined, false, null, empty string)
679
679
  *
680
680
  * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
@@ -697,11 +697,11 @@ export declare function createFieldConditionals(fieldId: string): {
697
697
  };
698
698
  /**
699
699
  * @deprecated
700
- * use field(fieldId).get(nestedProperty) instead
700
+ * use event.declaration(fieldId).get(nestedProperty) instead
701
701
  * with 'and' combinator e.g.
702
702
  * and(
703
- * field('child.name').get('firstname').isEqualTo('John'),
704
- * field('child.name').get('surname').isEqualTo('Doe')
703
+ * event.declaration('child.name').get('firstname').isEqualTo('John'),
704
+ * event.declaration('child.name').get('surname').isEqualTo('Doe')
705
705
  * )
706
706
  */
707
707
  object: (options: Record<string, any>) => JSONSchema;
@@ -733,7 +733,7 @@ export declare function createFieldConditionals(fieldId: string): {
733
733
  isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
734
734
  /**
735
735
  * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
736
- * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
736
+ * @example event.declaration('recommender.none').isFalsy() vs not(event.declaration('recommender.none').isEqualTo(true))
737
737
  * @returns whether the field is falsy (undefined, false, null, empty string)
738
738
  *
739
739
  * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
@@ -756,11 +756,11 @@ export declare function createFieldConditionals(fieldId: string): {
756
756
  };
757
757
  /**
758
758
  * @deprecated
759
- * use field(fieldId).get(nestedProperty) instead
759
+ * use event.declaration(fieldId).get(nestedProperty) instead
760
760
  * with 'and' combinator e.g.
761
761
  * and(
762
- * field('child.name').get('firstname').isEqualTo('John'),
763
- * field('child.name').get('surname').isEqualTo('Doe')
762
+ * event.declaration('child.name').get('firstname').isEqualTo('John'),
763
+ * event.declaration('child.name').get('surname').isEqualTo('Doe')
764
764
  * )
765
765
  */
766
766
  object: (options: Record<string, any>) => JSONSchema;
@@ -790,7 +790,7 @@ export declare function createFieldConditionals(fieldId: string): {
790
790
  isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
791
791
  /**
792
792
  * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
793
- * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
793
+ * @example event.declaration('recommender.none').isFalsy() vs not(event.declaration('recommender.none').isEqualTo(true))
794
794
  * @returns whether the field is falsy (undefined, false, null, empty string)
795
795
  *
796
796
  * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
@@ -813,11 +813,11 @@ export declare function createFieldConditionals(fieldId: string): {
813
813
  };
814
814
  /**
815
815
  * @deprecated
816
- * use field(fieldId).get(nestedProperty) instead
816
+ * use event.declaration(fieldId).get(nestedProperty) instead
817
817
  * with 'and' combinator e.g.
818
818
  * and(
819
- * field('child.name').get('firstname').isEqualTo('John'),
820
- * field('child.name').get('surname').isEqualTo('Doe')
819
+ * event.declaration('child.name').get('firstname').isEqualTo('John'),
820
+ * event.declaration('child.name').get('surname').isEqualTo('Doe')
821
821
  * )
822
822
  */
823
823
  object: (options: Record<string, any>) => JSONSchema;
@@ -22,39 +22,39 @@ export declare function field(fieldId: string): {
22
22
  } | undefined;
23
23
  };
24
24
  /**
25
- * Creates a date range matcher that finds records where date field fall within a specified range.
26
- *
27
- * By default, matches against the field specified in `field()` (e.g., 'mother.dob').
28
- * When `matchAgainst` is provided, it overwrites the default field and searches against that field with OR logic .
29
- *
30
- * @param options - Configuration for the date range matching
31
- * @param options.days - Number of days before and after the target date to search (creates a ±days range)
32
- * @param options.pivot - Optional. Distance in days where relevance scoring drops by 50%. Defaults to ⌊(days * 2) / 3⌋
33
- * @param options.boost - Optional. Scoring boost multiplier for matching results. Defaults to 1
34
- * @param options.matchAgainst - Optional. Additional field to match against. When provided,
35
- * the query matches if the field fall within the date range. The default field is always excluded in the search in that case.
36
- *
37
- * @returns A clause that matches records where at least one of the specified date field is within the range
38
- *
39
- * @example
40
- * // Matches only against mother.dob (±365 days)
41
- * field('mother.dob').dateRangeMatches({ days: 365 })
42
- *
43
- * @example
44
- * // Matches against mother.age OR spouse.dob, not mother.dob
45
- * field('mother.dob').dateRangeMatches({
46
- * days: 365,
47
- * matchAgainst: $field('mother.age')
48
- * })
49
- *
50
- * @example
51
- * // With custom pivot and boost
52
- * field('mother.dob').dateRangeMatches({
53
- * days: 730,
54
- * pivot: 365,
55
- * boost: 2
56
- * })
57
- */
25
+ * Creates a date range matcher that finds records where date field fall within a specified range.
26
+ *
27
+ * By default, matches against the field specified in `event.declaration()` (e.g., 'mother.dob').
28
+ * When `matchAgainst` is provided, it overwrites the default field and searches against that field with OR logic .
29
+ *
30
+ * @param options - Configuration for the date range matching
31
+ * @param options.days - Number of days before and after the target date to search (creates a ±days range)
32
+ * @param options.pivot - Optional. Distance in days where relevance scoring drops by 50%. Defaults to ⌊(days * 2) / 3⌋
33
+ * @param options.boost - Optional. Scoring boost multiplier for matching results. Defaults to 1
34
+ * @param options.matchAgainst - Optional. Additional field to match against. When provided,
35
+ * the query matches if the field fall within the date range. The default field is always excluded in the search in that case.
36
+ *
37
+ * @returns A clause that matches records where at least one of the specified date field is within the range
38
+ *
39
+ * @example
40
+ * // Matches only against mother.dob (±365 days)
41
+ * event.declaration('mother.dob').dateRangeMatches({ days: 365 })
42
+ *
43
+ * @example
44
+ * // Matches against mother.age OR spouse.dob, not mother.dob
45
+ * event.declaration('mother.dob').dateRangeMatches({
46
+ * days: 365,
47
+ * matchAgainst: $event.declaration('mother.age')
48
+ * })
49
+ *
50
+ * @example
51
+ * // With custom pivot and boost
52
+ * event.declaration('mother.dob').dateRangeMatches({
53
+ * days: 730,
54
+ * pivot: 365,
55
+ * boost: 2
56
+ * })
57
+ */
58
58
  dateRangeMatches: (options: DateRangeMatcherOptions) => {
59
59
  fieldId: string;
60
60
  type: "dateRange";