@opencrvs/toolkit 1.9.6-rc.fe27b9b → 1.9.7-rc.0fa356d

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 (59) hide show
  1. package/dist/commons/api/router.d.ts +2466 -29533
  2. package/dist/commons/conditionals/conditionals.d.ts +1 -10
  3. package/dist/commons/conditionals/validate.d.ts +4 -11
  4. package/dist/commons/events/ActionConfig.d.ts +1552 -24973
  5. package/dist/commons/events/ActionDocument.d.ts +1856 -803
  6. package/dist/commons/events/ActionInput.d.ts +1073 -277
  7. package/dist/commons/events/ActionType.d.ts +9 -86
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +1238 -228
  9. package/dist/commons/events/CompositeFieldValue.d.ts +190 -29
  10. package/dist/commons/events/Conditional.d.ts +38 -26
  11. package/dist/commons/events/Constants.d.ts +1 -1
  12. package/dist/commons/events/CountryConfigQueryInput.d.ts +4223 -1195
  13. package/dist/commons/events/CreatedAtLocation.d.ts +1 -1
  14. package/dist/commons/events/DeduplicationConfig.d.ts +174 -15
  15. package/dist/commons/events/Draft.d.ts +105 -70
  16. package/dist/commons/events/DynamicFieldValue.d.ts +91 -7
  17. package/dist/commons/events/EventConfig.d.ts +2120 -19932
  18. package/dist/commons/events/EventConfigInput.d.ts +1 -1
  19. package/dist/commons/events/EventDocument.d.ts +1332 -320
  20. package/dist/commons/events/EventIndex.d.ts +980 -193
  21. package/dist/commons/events/EventInput.d.ts +8 -2
  22. package/dist/commons/events/EventMetadata.d.ts +347 -106
  23. package/dist/commons/events/FieldConfig.d.ts +12296 -4517
  24. package/dist/commons/events/FieldType.d.ts +4 -20
  25. package/dist/commons/events/FieldTypeMapping.d.ts +897 -193
  26. package/dist/commons/events/FieldValue.d.ts +396 -87
  27. package/dist/commons/events/FormConfig.d.ts +721 -13980
  28. package/dist/commons/events/PageConfig.d.ts +319 -9340
  29. package/dist/commons/events/SummaryConfig.d.ts +161 -14
  30. package/dist/commons/events/TemplateConfig.d.ts +3 -2
  31. package/dist/commons/events/TranslationConfig.d.ts +2 -2
  32. package/dist/commons/events/WorkqueueColumnConfig.d.ts +37 -74
  33. package/dist/commons/events/WorkqueueConfig.d.ts +7131 -1819
  34. package/dist/commons/events/deduplication.d.ts +40 -3
  35. package/dist/commons/events/defineConfig.d.ts +162 -26578
  36. package/dist/commons/events/index.d.ts +0 -1
  37. package/dist/commons/events/locations.d.ts +19 -26
  38. package/dist/commons/events/scopes.d.ts +4 -5
  39. package/dist/commons/events/state/availableActions.d.ts +2 -0
  40. package/dist/commons/events/state/flags.d.ts +3 -21
  41. package/dist/commons/events/state/index.d.ts +19 -23
  42. package/dist/commons/events/state/utils.d.ts +112 -130
  43. package/dist/commons/events/test.utils.d.ts +8 -17
  44. package/dist/commons/events/transactions.d.ts +1 -1
  45. package/dist/commons/events/utils.d.ts +381 -53178
  46. package/dist/commons/notification/UserNotifications.d.ts +636 -55
  47. package/dist/conditionals/index.d.ts.map +1 -1
  48. package/dist/conditionals/index.js +11 -45
  49. package/dist/events/deduplication.d.ts +40 -3
  50. package/dist/events/deduplication.js +34 -0
  51. package/dist/events/index.js +1741 -1975
  52. package/dist/notification/index.d.ts.map +1 -1
  53. package/dist/notification/index.js +1527 -1569
  54. package/dist/scopes/index.d.ts +132 -167
  55. package/dist/scopes/index.d.ts.map +1 -1
  56. package/dist/scopes/index.js +94 -133
  57. package/package.json +5 -5
  58. package/dist/commons/events/Flag.d.ts +0 -67
  59. package/dist/commons/events/eventConfigValidation.d.ts +0 -8
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conditionals/index.ts"],"names":[],"mappings":"AAaA,cAAc,gCAAgC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conditionals/index.ts"],"names":[],"mappings":"AAUA,cAAc,gCAAgC,CAAA"}
@@ -35,25 +35,22 @@ __export(conditionals_exports, {
35
35
  createFieldConditionals: () => createFieldConditionals,
36
36
  defineConditional: () => defineConditional,
37
37
  defineFormConditional: () => defineFormConditional,
38
- flag: () => flag,
39
38
  isFieldReference: () => isFieldReference,
40
39
  never: () => never,
41
40
  not: () => not,
42
41
  now: () => now,
43
42
  or: () => or,
44
- status: () => status,
45
43
  user: () => user
46
44
  });
47
45
  module.exports = __toCommonJS(conditionals_exports);
48
- var z4 = __toESM(require("zod/v4"));
49
46
 
50
47
  // ../commons/src/conditionals/conditionals.ts
51
48
  var objectHash = __toESM(require("object-hash"));
52
49
 
53
50
  // ../commons/src/events/serializers/user/serializer.ts
54
- var z = __toESM(require("zod/v4"));
55
- var SerializedUserField = z.object({
56
- $userField: z.enum([
51
+ var import_zod = require("zod");
52
+ var SerializedUserField = import_zod.z.object({
53
+ $userField: import_zod.z.enum([
57
54
  "id",
58
55
  "name",
59
56
  "role",
@@ -62,12 +59,11 @@ var SerializedUserField = z.object({
62
59
  "firstname",
63
60
  "middlename",
64
61
  "surname",
65
- "signature",
66
- "avatar",
67
- "primaryOfficeId",
68
- "administrativeAreaId"
62
+ "district",
63
+ "province",
64
+ "primaryOfficeId"
69
65
  ]),
70
- $location: z.string().optional()
66
+ $location: import_zod.z.string().optional()
71
67
  });
72
68
  function userSerializer(userField) {
73
69
  return {
@@ -87,7 +83,7 @@ function userSerializer(userField) {
87
83
  }
88
84
 
89
85
  // ../commons/src/utils.ts
90
- var z2 = __toESM(require("zod/v4"));
86
+ var z2 = __toESM(require("zod"));
91
87
  var FullNameV1 = z2.array(
92
88
  z2.object({
93
89
  use: z2.string(),
@@ -112,9 +108,9 @@ function omitKeyDeep(obj, keyToRemove) {
112
108
  }
113
109
 
114
110
  // ../commons/src/events/serializers/date/serializer.ts
115
- var import_zod = require("zod");
116
- var SerializedNowDateTime = import_zod.z.object({
117
- $$now: import_zod.z.literal(true)
111
+ var import_zod2 = require("zod");
112
+ var SerializedNowDateTime = import_zod2.z.object({
113
+ $$now: import_zod2.z.literal(true)
118
114
  });
119
115
  function todayDateTimeValueSerializer() {
120
116
  return { $$now: true };
@@ -333,33 +329,6 @@ function defineComparison(field, value, keyword) {
333
329
  required: [field.$$field]
334
330
  });
335
331
  }
336
- function flag(flagvalue) {
337
- return defineConditional({
338
- type: "object",
339
- properties: {
340
- $flags: {
341
- type: "array",
342
- contains: {
343
- type: "string",
344
- const: flagvalue
345
- }
346
- }
347
- },
348
- required: ["$flags"]
349
- });
350
- }
351
- function status(statusValue) {
352
- return defineConditional({
353
- type: "object",
354
- properties: {
355
- $status: {
356
- type: "string",
357
- const: statusValue
358
- }
359
- },
360
- required: ["$status"]
361
- });
362
- }
363
332
  function createFieldConditionals(fieldId) {
364
333
  const getDayRange = (field, days, clause, referenceDate) => ({
365
334
  type: "object",
@@ -713,6 +682,3 @@ function createFieldConditionals(fieldId) {
713
682
  })
714
683
  };
715
684
  }
716
-
717
- // src/conditionals/index.ts
718
- z4.globalRegistry.clear();
@@ -7,25 +7,62 @@ export declare function field(fieldId: string): {
7
7
  fieldId: string;
8
8
  type: "fuzzy";
9
9
  options: {
10
- fuzziness?: string | number | undefined;
11
10
  boost?: number | undefined;
11
+ matchAgainst?: string | undefined;
12
+ fuzziness?: string | number | undefined;
12
13
  } | undefined;
13
14
  };
14
15
  strictMatches: (options?: StrictMatcherOptions) => {
15
16
  fieldId: string;
16
17
  type: "strict";
17
18
  options: {
18
- boost?: number | undefined;
19
19
  value?: string | undefined;
20
+ boost?: number | undefined;
21
+ matchAgainst?: string | undefined;
20
22
  } | undefined;
21
23
  };
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
+ */
22
58
  dateRangeMatches: (options: DateRangeMatcherOptions) => {
23
59
  fieldId: string;
24
60
  type: "dateRange";
25
61
  options: {
26
62
  days: number;
27
- pivot?: number | undefined;
28
63
  boost?: number | undefined;
64
+ matchAgainst?: string | undefined;
65
+ pivot?: number | undefined;
29
66
  };
30
67
  };
31
68
  };
@@ -58,6 +58,40 @@ 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
+ */
61
95
  dateRangeMatches: (options) => ({
62
96
  fieldId,
63
97
  type: "dateRange",