@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.
@@ -509,7 +509,7 @@ function createFieldConditionals(fieldId) {
509
509
  },
510
510
  /**
511
511
  * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
512
- * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
512
+ * @example event.declaration('recommender.none').isFalsy() vs not(event.declaration('recommender.none').isEqualTo(true))
513
513
  * @returns whether the field is falsy (undefined, false, null, empty string)
514
514
  *
515
515
  * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
@@ -657,11 +657,11 @@ function createFieldConditionals(fieldId) {
657
657
  getId: () => ({ fieldId }),
658
658
  /**
659
659
  * @deprecated
660
- * use field(fieldId).get(nestedProperty) instead
660
+ * use event.declaration(fieldId).get(nestedProperty) instead
661
661
  * with 'and' combinator e.g.
662
662
  * and(
663
- * field('child.name').get('firstname').isEqualTo('John'),
664
- * field('child.name').get('surname').isEqualTo('Doe')
663
+ * event.declaration('child.name').get('firstname').isEqualTo('John'),
664
+ * event.declaration('child.name').get('surname').isEqualTo('Doe')
665
665
  * )
666
666
  */
667
667
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -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";
@@ -59,39 +59,39 @@ function field(fieldId) {
59
59
  options
60
60
  }),
61
61
  /**
62
- * Creates a date range matcher that finds records where date field fall within a specified range.
63
- *
64
- * By default, matches against the field specified in `field()` (e.g., 'mother.dob').
65
- * When `matchAgainst` is provided, it overwrites the default field and searches against that field with OR logic .
66
- *
67
- * @param options - Configuration for the date range matching
68
- * @param options.days - Number of days before and after the target date to search (creates a ±days range)
69
- * @param options.pivot - Optional. Distance in days where relevance scoring drops by 50%. Defaults to ⌊(days * 2) / 3⌋
70
- * @param options.boost - Optional. Scoring boost multiplier for matching results. Defaults to 1
71
- * @param options.matchAgainst - Optional. Additional field to match against. When provided,
72
- * the query matches if the field fall within the date range. The default field is always excluded in the search in that case.
73
- *
74
- * @returns A clause that matches records where at least one of the specified date field is within the range
75
- *
76
- * @example
77
- * // Matches only against mother.dob (±365 days)
78
- * field('mother.dob').dateRangeMatches({ days: 365 })
79
- *
80
- * @example
81
- * // Matches against mother.age OR spouse.dob, not mother.dob
82
- * field('mother.dob').dateRangeMatches({
83
- * days: 365,
84
- * matchAgainst: $field('mother.age')
85
- * })
86
- *
87
- * @example
88
- * // With custom pivot and boost
89
- * field('mother.dob').dateRangeMatches({
90
- * days: 730,
91
- * pivot: 365,
92
- * boost: 2
93
- * })
94
- */
62
+ * Creates a date range matcher that finds records where date field fall within a specified range.
63
+ *
64
+ * By default, matches against the field specified in `event.declaration()` (e.g., 'mother.dob').
65
+ * When `matchAgainst` is provided, it overwrites the default field and searches against that field with OR logic .
66
+ *
67
+ * @param options - Configuration for the date range matching
68
+ * @param options.days - Number of days before and after the target date to search (creates a ±days range)
69
+ * @param options.pivot - Optional. Distance in days where relevance scoring drops by 50%. Defaults to ⌊(days * 2) / 3⌋
70
+ * @param options.boost - Optional. Scoring boost multiplier for matching results. Defaults to 1
71
+ * @param options.matchAgainst - Optional. Additional field to match against. When provided,
72
+ * the query matches if the field fall within the date range. The default field is always excluded in the search in that case.
73
+ *
74
+ * @returns A clause that matches records where at least one of the specified date field is within the range
75
+ *
76
+ * @example
77
+ * // Matches only against mother.dob (±365 days)
78
+ * event.declaration('mother.dob').dateRangeMatches({ days: 365 })
79
+ *
80
+ * @example
81
+ * // Matches against mother.age OR spouse.dob, not mother.dob
82
+ * event.declaration('mother.dob').dateRangeMatches({
83
+ * days: 365,
84
+ * matchAgainst: $event.declaration('mother.age')
85
+ * })
86
+ *
87
+ * @example
88
+ * // With custom pivot and boost
89
+ * event.declaration('mother.dob').dateRangeMatches({
90
+ * days: 730,
91
+ * pivot: 365,
92
+ * boost: 2
93
+ * })
94
+ */
95
95
  dateRangeMatches: (options) => ({
96
96
  fieldId,
97
97
  type: "dateRange",