@opencrvs/toolkit 1.9.6-rc.e9b9bc1 → 1.9.6-rc.f071f7d

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.
@@ -10,13 +10,10 @@ declare const FuzzyMatcher: z.ZodObject<z.objectUtil.extendShape<{
10
10
  fieldId: z.ZodString;
11
11
  options: z.ZodDefault<z.ZodOptional<z.ZodObject<{
12
12
  boost: z.ZodOptional<z.ZodNumber>;
13
- matchAgainst: z.ZodOptional<z.ZodString>;
14
13
  }, "strip", z.ZodTypeAny, {
15
14
  boost?: number | undefined;
16
- matchAgainst?: string | undefined;
17
15
  }, {
18
16
  boost?: number | undefined;
19
- matchAgainst?: string | undefined;
20
17
  }>>>;
21
18
  }, {
22
19
  type: z.ZodLiteral<"fuzzy">;
@@ -28,14 +25,11 @@ declare const FuzzyMatcher: z.ZodObject<z.objectUtil.extendShape<{
28
25
  */
29
26
  fuzziness: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>>;
30
27
  boost: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
31
- matchAgainst: z.ZodOptional<z.ZodString>;
32
28
  }, "strip", z.ZodTypeAny, {
33
29
  boost: number;
34
30
  fuzziness: string | number;
35
- matchAgainst?: string | undefined;
36
31
  }, {
37
32
  boost?: number | undefined;
38
- matchAgainst?: string | undefined;
39
33
  fuzziness?: string | number | undefined;
40
34
  }>>>;
41
35
  }>, "strip", z.ZodTypeAny, {
@@ -43,7 +37,6 @@ declare const FuzzyMatcher: z.ZodObject<z.objectUtil.extendShape<{
43
37
  options: {
44
38
  boost: number;
45
39
  fuzziness: string | number;
46
- matchAgainst?: string | undefined;
47
40
  };
48
41
  fieldId: string;
49
42
  }, {
@@ -51,7 +44,6 @@ declare const FuzzyMatcher: z.ZodObject<z.objectUtil.extendShape<{
51
44
  fieldId: string;
52
45
  options?: {
53
46
  boost?: number | undefined;
54
- matchAgainst?: string | undefined;
55
47
  fuzziness?: string | number | undefined;
56
48
  } | undefined;
57
49
  }>;
@@ -66,13 +58,10 @@ declare const StrictMatcher: z.ZodObject<z.objectUtil.extendShape<{
66
58
  fieldId: z.ZodString;
67
59
  options: z.ZodDefault<z.ZodOptional<z.ZodObject<{
68
60
  boost: z.ZodOptional<z.ZodNumber>;
69
- matchAgainst: z.ZodOptional<z.ZodString>;
70
61
  }, "strip", z.ZodTypeAny, {
71
62
  boost?: number | undefined;
72
- matchAgainst?: string | undefined;
73
63
  }, {
74
64
  boost?: number | undefined;
75
- matchAgainst?: string | undefined;
76
65
  }>>>;
77
66
  }, {
78
67
  type: z.ZodLiteral<"strict">;
@@ -82,22 +71,18 @@ declare const StrictMatcher: z.ZodObject<z.objectUtil.extendShape<{
82
71
  * The constant value to be present in the field for both records
83
72
  */
84
73
  value: z.ZodOptional<z.ZodString>;
85
- matchAgainst: z.ZodOptional<z.ZodString>;
86
74
  }, "strip", z.ZodTypeAny, {
87
75
  boost: number;
88
76
  value?: string | undefined;
89
- matchAgainst?: string | undefined;
90
77
  }, {
91
78
  value?: string | undefined;
92
79
  boost?: number | undefined;
93
- matchAgainst?: string | undefined;
94
80
  }>>>;
95
81
  }>, "strip", z.ZodTypeAny, {
96
82
  type: "strict";
97
83
  options: {
98
84
  boost: number;
99
85
  value?: string | undefined;
100
- matchAgainst?: string | undefined;
101
86
  };
102
87
  fieldId: string;
103
88
  }, {
@@ -106,7 +91,6 @@ declare const StrictMatcher: z.ZodObject<z.objectUtil.extendShape<{
106
91
  options?: {
107
92
  value?: string | undefined;
108
93
  boost?: number | undefined;
109
- matchAgainst?: string | undefined;
110
94
  } | undefined;
111
95
  }>;
112
96
  export type StrictMatcherOptions = z.input<typeof StrictMatcher>['options'];
@@ -120,13 +104,10 @@ declare const DateRangeMatcher: z.ZodObject<z.objectUtil.extendShape<{
120
104
  fieldId: z.ZodString;
121
105
  options: z.ZodDefault<z.ZodOptional<z.ZodObject<{
122
106
  boost: z.ZodOptional<z.ZodNumber>;
123
- matchAgainst: z.ZodOptional<z.ZodString>;
124
107
  }, "strip", z.ZodTypeAny, {
125
108
  boost?: number | undefined;
126
- matchAgainst?: string | undefined;
127
109
  }, {
128
110
  boost?: number | undefined;
129
- matchAgainst?: string | undefined;
130
111
  }>>>;
131
112
  }, {
132
113
  type: z.ZodLiteral<"dateRange">;
@@ -138,16 +119,13 @@ declare const DateRangeMatcher: z.ZodObject<z.objectUtil.extendShape<{
138
119
  pivot: z.ZodOptional<z.ZodNumber>;
139
120
  days: z.ZodNumber;
140
121
  boost: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
141
- matchAgainst: z.ZodOptional<z.ZodString>;
142
122
  }, "strip", z.ZodTypeAny, {
143
123
  boost: number;
144
124
  days: number;
145
- matchAgainst?: string | undefined;
146
125
  pivot?: number | undefined;
147
126
  }, {
148
127
  days: number;
149
128
  boost?: number | undefined;
150
- matchAgainst?: string | undefined;
151
129
  pivot?: number | undefined;
152
130
  }>;
153
131
  }>, "strip", z.ZodTypeAny, {
@@ -155,7 +133,6 @@ declare const DateRangeMatcher: z.ZodObject<z.objectUtil.extendShape<{
155
133
  options: {
156
134
  boost: number;
157
135
  days: number;
158
- matchAgainst?: string | undefined;
159
136
  pivot?: number | undefined;
160
137
  };
161
138
  fieldId: string;
@@ -164,7 +141,6 @@ declare const DateRangeMatcher: z.ZodObject<z.objectUtil.extendShape<{
164
141
  options: {
165
142
  days: number;
166
143
  boost?: number | undefined;
167
- matchAgainst?: string | undefined;
168
144
  pivot?: number | undefined;
169
145
  };
170
146
  fieldId: string;
@@ -5278,6 +5278,7 @@ declare const NameField: z.ZodObject<z.objectUtil.extendShape<{
5278
5278
  description: string;
5279
5279
  defaultMessage: string;
5280
5280
  }>>;
5281
+ hideSubFieldError: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
5281
5282
  }, "strip", z.ZodTypeAny, {
5282
5283
  name?: {
5283
5284
  firstname?: {
@@ -5303,6 +5304,7 @@ declare const NameField: z.ZodObject<z.objectUtil.extendShape<{
5303
5304
  maxLength?: number | undefined;
5304
5305
  prefix?: TranslationConfig | undefined;
5305
5306
  postfix?: TranslationConfig | undefined;
5307
+ hideSubFieldError?: boolean | undefined;
5306
5308
  }, {
5307
5309
  name?: {
5308
5310
  firstname?: {
@@ -5360,6 +5362,7 @@ declare const NameField: z.ZodObject<z.objectUtil.extendShape<{
5360
5362
  description: string;
5361
5363
  defaultMessage: string;
5362
5364
  } | undefined;
5365
+ hideSubFieldError?: boolean | undefined;
5363
5366
  }>>>;
5364
5367
  }>, "strip", z.ZodTypeAny, {
5365
5368
  type: "NAME";
@@ -5441,6 +5444,7 @@ declare const NameField: z.ZodObject<z.objectUtil.extendShape<{
5441
5444
  maxLength?: number | undefined;
5442
5445
  prefix?: TranslationConfig | undefined;
5443
5446
  postfix?: TranslationConfig | undefined;
5447
+ hideSubFieldError?: boolean | undefined;
5444
5448
  } | undefined;
5445
5449
  }, {
5446
5450
  type: "NAME";
@@ -5574,6 +5578,7 @@ declare const NameField: z.ZodObject<z.objectUtil.extendShape<{
5574
5578
  description: string;
5575
5579
  defaultMessage: string;
5576
5580
  } | undefined;
5581
+ hideSubFieldError?: boolean | undefined;
5577
5582
  } | undefined;
5578
5583
  }>;
5579
5584
  declare const PhoneField: z.ZodObject<z.objectUtil.extendShape<{
@@ -8,7 +8,6 @@ export declare function field(fieldId: string): {
8
8
  type: "fuzzy";
9
9
  options: {
10
10
  boost?: number | undefined;
11
- matchAgainst?: string | undefined;
12
11
  fuzziness?: string | number | undefined;
13
12
  } | undefined;
14
13
  };
@@ -18,50 +17,14 @@ export declare function field(fieldId: string): {
18
17
  options: {
19
18
  value?: string | undefined;
20
19
  boost?: number | undefined;
21
- matchAgainst?: string | undefined;
22
20
  } | undefined;
23
21
  };
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
- */
58
22
  dateRangeMatches: (options: DateRangeMatcherOptions) => {
59
23
  fieldId: string;
60
24
  type: "dateRange";
61
25
  options: {
62
26
  days: number;
63
27
  boost?: number | undefined;
64
- matchAgainst?: string | undefined;
65
28
  pivot?: number | undefined;
66
29
  };
67
30
  };
@@ -8,7 +8,6 @@ export declare function field(fieldId: string): {
8
8
  type: "fuzzy";
9
9
  options: {
10
10
  boost?: number | undefined;
11
- matchAgainst?: string | undefined;
12
11
  fuzziness?: string | number | undefined;
13
12
  } | undefined;
14
13
  };
@@ -18,50 +17,14 @@ export declare function field(fieldId: string): {
18
17
  options: {
19
18
  value?: string | undefined;
20
19
  boost?: number | undefined;
21
- matchAgainst?: string | undefined;
22
20
  } | undefined;
23
21
  };
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
- */
58
22
  dateRangeMatches: (options: DateRangeMatcherOptions) => {
59
23
  fieldId: string;
60
24
  type: "dateRange";
61
25
  options: {
62
26
  days: number;
63
27
  boost?: number | undefined;
64
- matchAgainst?: string | undefined;
65
28
  pivot?: number | undefined;
66
29
  };
67
30
  };
@@ -58,40 +58,6 @@ function field(fieldId) {
58
58
  type: "strict",
59
59
  options
60
60
  }),
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
- */
95
61
  dateRangeMatches: (options) => ({
96
62
  fieldId,
97
63
  type: "dateRange",
@@ -2209,7 +2209,12 @@ var NameField = BaseField.extend({
2209
2209
  order: import_zod16.z.array(import_zod16.z.enum(["firstname", "middlename", "surname"])).optional(),
2210
2210
  maxLength: import_zod16.z.number().optional().describe("Maximum length of the text"),
2211
2211
  prefix: TranslationConfig.optional(),
2212
- postfix: TranslationConfig.optional()
2212
+ postfix: TranslationConfig.optional(),
2213
+ hideSubFieldError: import_zod16.z.boolean().default(false).optional().describe(
2214
+ `If true, hides the field's validation error message. Useful for composite components like ADDRESS or NAME where errors are shown at the sub-field level instead of the parent
2215
+ field level. When enabled, errors are hidden at the composite component level on the form page but remain visible on the review page. It doesn't interfere with the sub-field's
2216
+ validation error messages.`
2217
+ )
2213
2218
  }).default({
2214
2219
  name: {
2215
2220
  firstname: { required: true },
@@ -2557,8 +2562,7 @@ var Matcher = import_zod19.z.object({
2557
2562
  */
2558
2563
  fieldId: FieldReference2,
2559
2564
  options: import_zod19.z.object({
2560
- boost: import_zod19.z.number().optional(),
2561
- matchAgainst: FieldReference2.optional()
2565
+ boost: import_zod19.z.number().optional()
2562
2566
  }).optional().default({
2563
2567
  boost: 1
2564
2568
  })
@@ -2572,8 +2576,7 @@ var FuzzyMatcher = Matcher.extend({
2572
2576
  * Names of length >7 characters = 2 edits allowed
2573
2577
  */
2574
2578
  fuzziness: import_zod19.z.union([import_zod19.z.string(), import_zod19.z.number()]).optional().default("AUTO:4,7"),
2575
- boost: import_zod19.z.number().optional().default(1),
2576
- matchAgainst: FieldReference2.optional()
2579
+ boost: import_zod19.z.number().optional().default(1)
2577
2580
  }).optional().default({
2578
2581
  fuzziness: "AUTO:4,7",
2579
2582
  boost: 1
@@ -2586,8 +2589,7 @@ var StrictMatcher = Matcher.extend({
2586
2589
  /**
2587
2590
  * The constant value to be present in the field for both records
2588
2591
  */
2589
- value: import_zod19.z.string().optional(),
2590
- matchAgainst: FieldReference2.optional()
2592
+ value: import_zod19.z.string().optional()
2591
2593
  }).optional().default({
2592
2594
  boost: 1
2593
2595
  })
@@ -2601,8 +2603,7 @@ var DateRangeMatcher = Matcher.extend({
2601
2603
  */
2602
2604
  pivot: import_zod19.z.number().optional(),
2603
2605
  days: import_zod19.z.number(),
2604
- boost: import_zod19.z.number().optional().default(1),
2605
- matchAgainst: FieldReference2.optional()
2606
+ boost: import_zod19.z.number().optional().default(1)
2606
2607
  })
2607
2608
  });
2608
2609
  var Not = import_zod19.z.object({
@@ -7817,35 +7818,8 @@ var mother = defineFormPage({
7817
7818
  secured: true,
7818
7819
  validation: [],
7819
7820
  label: generateTranslationConfig("Date of birth"),
7820
- conditionals: [
7821
- {
7822
- type: "SHOW",
7823
- conditional: not(field("mother.dobUnknown").isEqualTo(true))
7824
- }
7825
- ]
7826
- },
7827
- {
7828
- id: "mother.dobUnknown",
7829
- type: "CHECKBOX",
7830
- label: generateTranslationConfig("Exact date of birth unknown"),
7831
7821
  conditionals: []
7832
7822
  },
7833
- {
7834
- id: "mother.age",
7835
- type: FieldType.AGE,
7836
- required: true,
7837
- analytics: true,
7838
- label: generateTranslationConfig("Age of mother"),
7839
- configuration: {
7840
- asOfDate: field("child.dob")
7841
- },
7842
- conditionals: [
7843
- {
7844
- type: "SHOW",
7845
- conditional: field("mother.dobUnknown").isEqualTo(true)
7846
- }
7847
- ]
7848
- },
7849
7823
  {
7850
7824
  id: "mother.idType",
7851
7825
  type: FieldType.SELECT,
@@ -1731,7 +1731,12 @@ var NameField = BaseField.extend({
1731
1731
  order: import_zod16.z.array(import_zod16.z.enum(["firstname", "middlename", "surname"])).optional(),
1732
1732
  maxLength: import_zod16.z.number().optional().describe("Maximum length of the text"),
1733
1733
  prefix: TranslationConfig.optional(),
1734
- postfix: TranslationConfig.optional()
1734
+ postfix: TranslationConfig.optional(),
1735
+ hideSubFieldError: import_zod16.z.boolean().default(false).optional().describe(
1736
+ `If true, hides the field's validation error message. Useful for composite components like ADDRESS or NAME where errors are shown at the sub-field level instead of the parent
1737
+ field level. When enabled, errors are hidden at the composite component level on the form page but remain visible on the review page. It doesn't interfere with the sub-field's
1738
+ validation error messages.`
1739
+ )
1735
1740
  }).default({
1736
1741
  name: {
1737
1742
  firstname: { required: true },
@@ -2079,8 +2084,7 @@ var Matcher = import_zod19.z.object({
2079
2084
  */
2080
2085
  fieldId: FieldReference2,
2081
2086
  options: import_zod19.z.object({
2082
- boost: import_zod19.z.number().optional(),
2083
- matchAgainst: FieldReference2.optional()
2087
+ boost: import_zod19.z.number().optional()
2084
2088
  }).optional().default({
2085
2089
  boost: 1
2086
2090
  })
@@ -2094,8 +2098,7 @@ var FuzzyMatcher = Matcher.extend({
2094
2098
  * Names of length >7 characters = 2 edits allowed
2095
2099
  */
2096
2100
  fuzziness: import_zod19.z.union([import_zod19.z.string(), import_zod19.z.number()]).optional().default("AUTO:4,7"),
2097
- boost: import_zod19.z.number().optional().default(1),
2098
- matchAgainst: FieldReference2.optional()
2101
+ boost: import_zod19.z.number().optional().default(1)
2099
2102
  }).optional().default({
2100
2103
  fuzziness: "AUTO:4,7",
2101
2104
  boost: 1
@@ -2108,8 +2111,7 @@ var StrictMatcher = Matcher.extend({
2108
2111
  /**
2109
2112
  * The constant value to be present in the field for both records
2110
2113
  */
2111
- value: import_zod19.z.string().optional(),
2112
- matchAgainst: FieldReference2.optional()
2114
+ value: import_zod19.z.string().optional()
2113
2115
  }).optional().default({
2114
2116
  boost: 1
2115
2117
  })
@@ -2123,8 +2125,7 @@ var DateRangeMatcher = Matcher.extend({
2123
2125
  */
2124
2126
  pivot: import_zod19.z.number().optional(),
2125
2127
  days: import_zod19.z.number(),
2126
- boost: import_zod19.z.number().optional().default(1),
2127
- matchAgainst: FieldReference2.optional()
2128
+ boost: import_zod19.z.number().optional().default(1)
2128
2129
  })
2129
2130
  });
2130
2131
  var Not = import_zod19.z.object({
@@ -6070,35 +6071,8 @@ var mother = defineFormPage({
6070
6071
  secured: true,
6071
6072
  validation: [],
6072
6073
  label: generateTranslationConfig("Date of birth"),
6073
- conditionals: [
6074
- {
6075
- type: "SHOW",
6076
- conditional: not(field("mother.dobUnknown").isEqualTo(true))
6077
- }
6078
- ]
6079
- },
6080
- {
6081
- id: "mother.dobUnknown",
6082
- type: "CHECKBOX",
6083
- label: generateTranslationConfig("Exact date of birth unknown"),
6084
6074
  conditionals: []
6085
6075
  },
6086
- {
6087
- id: "mother.age",
6088
- type: FieldType.AGE,
6089
- required: true,
6090
- analytics: true,
6091
- label: generateTranslationConfig("Age of mother"),
6092
- configuration: {
6093
- asOfDate: field("child.dob")
6094
- },
6095
- conditionals: [
6096
- {
6097
- type: "SHOW",
6098
- conditional: field("mother.dobUnknown").isEqualTo(true)
6099
- }
6100
- ]
6101
- },
6102
6076
  {
6103
6077
  id: "mother.idType",
6104
6078
  type: FieldType.SELECT,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "1.9.6-rc.e9b9bc1",
3
+ "version": "1.9.6-rc.f071f7d",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "exports": {