@opencrvs/toolkit 1.9.6-rc.e1e4717 → 1.9.6-rc.e618ee0

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 +29384 -2317
  2. package/dist/commons/conditionals/conditionals.d.ts +10 -1
  3. package/dist/commons/conditionals/validate.d.ts +11 -4
  4. package/dist/commons/events/ActionConfig.d.ts +24973 -1552
  5. package/dist/commons/events/ActionDocument.d.ts +803 -1856
  6. package/dist/commons/events/ActionInput.d.ts +277 -1073
  7. package/dist/commons/events/ActionType.d.ts +86 -9
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +228 -1238
  9. package/dist/commons/events/CompositeFieldValue.d.ts +29 -190
  10. package/dist/commons/events/Conditional.d.ts +26 -38
  11. package/dist/commons/events/Constants.d.ts +1 -1
  12. package/dist/commons/events/CountryConfigQueryInput.d.ts +1195 -4223
  13. package/dist/commons/events/CreatedAtLocation.d.ts +1 -1
  14. package/dist/commons/events/DeduplicationConfig.d.ts +15 -174
  15. package/dist/commons/events/Draft.d.ts +70 -105
  16. package/dist/commons/events/DynamicFieldValue.d.ts +7 -91
  17. package/dist/commons/events/EventConfig.d.ts +19932 -2120
  18. package/dist/commons/events/EventConfigInput.d.ts +1 -1
  19. package/dist/commons/events/EventDocument.d.ts +320 -1332
  20. package/dist/commons/events/EventIndex.d.ts +193 -980
  21. package/dist/commons/events/EventInput.d.ts +2 -8
  22. package/dist/commons/events/EventMetadata.d.ts +106 -347
  23. package/dist/commons/events/FieldConfig.d.ts +4522 -12301
  24. package/dist/commons/events/FieldType.d.ts +20 -4
  25. package/dist/commons/events/FieldTypeMapping.d.ts +193 -897
  26. package/dist/commons/events/FieldValue.d.ts +87 -396
  27. package/dist/commons/events/Flag.d.ts +67 -0
  28. package/dist/commons/events/FormConfig.d.ts +13980 -721
  29. package/dist/commons/events/PageConfig.d.ts +9340 -319
  30. package/dist/commons/events/SummaryConfig.d.ts +14 -161
  31. package/dist/commons/events/TemplateConfig.d.ts +2 -3
  32. package/dist/commons/events/TranslationConfig.d.ts +2 -2
  33. package/dist/commons/events/WorkqueueColumnConfig.d.ts +74 -37
  34. package/dist/commons/events/WorkqueueConfig.d.ts +1867 -7176
  35. package/dist/commons/events/deduplication.d.ts +3 -47
  36. package/dist/commons/events/defineConfig.d.ts +26563 -147
  37. package/dist/commons/events/eventConfigValidation.d.ts +8 -0
  38. package/dist/commons/events/index.d.ts +1 -0
  39. package/dist/commons/events/locations.d.ts +26 -19
  40. package/dist/commons/events/scopes.d.ts +5 -4
  41. package/dist/commons/events/state/availableActions.d.ts +0 -2
  42. package/dist/commons/events/state/flags.d.ts +21 -3
  43. package/dist/commons/events/state/index.d.ts +23 -19
  44. package/dist/commons/events/state/utils.d.ts +130 -112
  45. package/dist/commons/events/test.utils.d.ts +17 -8
  46. package/dist/commons/events/transactions.d.ts +1 -1
  47. package/dist/commons/events/utils.d.ts +53164 -367
  48. package/dist/commons/notification/UserNotifications.d.ts +55 -636
  49. package/dist/conditionals/index.d.ts.map +1 -1
  50. package/dist/conditionals/index.js +45 -11
  51. package/dist/events/deduplication.d.ts +3 -47
  52. package/dist/events/deduplication.js +0 -41
  53. package/dist/events/index.js +1972 -1731
  54. package/dist/notification/index.d.ts.map +1 -1
  55. package/dist/notification/index.js +1621 -1575
  56. package/dist/scopes/index.d.ts +167 -132
  57. package/dist/scopes/index.d.ts.map +1 -1
  58. package/dist/scopes/index.js +133 -94
  59. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conditionals/index.ts"],"names":[],"mappings":"AAUA,cAAc,gCAAgC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conditionals/index.ts"],"names":[],"mappings":"AAaA,cAAc,gCAAgC,CAAA"}
@@ -35,22 +35,25 @@ __export(conditionals_exports, {
35
35
  createFieldConditionals: () => createFieldConditionals,
36
36
  defineConditional: () => defineConditional,
37
37
  defineFormConditional: () => defineFormConditional,
38
+ flag: () => flag,
38
39
  isFieldReference: () => isFieldReference,
39
40
  never: () => never,
40
41
  not: () => not,
41
42
  now: () => now,
42
43
  or: () => or,
44
+ status: () => status,
43
45
  user: () => user
44
46
  });
45
47
  module.exports = __toCommonJS(conditionals_exports);
48
+ var z4 = __toESM(require("zod/v4"));
46
49
 
47
50
  // ../commons/src/conditionals/conditionals.ts
48
51
  var objectHash = __toESM(require("object-hash"));
49
52
 
50
53
  // ../commons/src/events/serializers/user/serializer.ts
51
- var import_zod = require("zod");
52
- var SerializedUserField = import_zod.z.object({
53
- $userField: import_zod.z.enum([
54
+ var z = __toESM(require("zod/v4"));
55
+ var SerializedUserField = z.object({
56
+ $userField: z.enum([
54
57
  "id",
55
58
  "name",
56
59
  "role",
@@ -59,11 +62,12 @@ var SerializedUserField = import_zod.z.object({
59
62
  "firstname",
60
63
  "middlename",
61
64
  "surname",
62
- "district",
63
- "province",
64
- "primaryOfficeId"
65
+ "signature",
66
+ "avatar",
67
+ "primaryOfficeId",
68
+ "administrativeAreaId"
65
69
  ]),
66
- $location: import_zod.z.string().optional()
70
+ $location: z.string().optional()
67
71
  });
68
72
  function userSerializer(userField) {
69
73
  return {
@@ -83,7 +87,7 @@ function userSerializer(userField) {
83
87
  }
84
88
 
85
89
  // ../commons/src/utils.ts
86
- var z2 = __toESM(require("zod"));
90
+ var z2 = __toESM(require("zod/v4"));
87
91
  var FullNameV1 = z2.array(
88
92
  z2.object({
89
93
  use: z2.string(),
@@ -108,9 +112,9 @@ function omitKeyDeep(obj, keyToRemove) {
108
112
  }
109
113
 
110
114
  // ../commons/src/events/serializers/date/serializer.ts
111
- var import_zod2 = require("zod");
112
- var SerializedNowDateTime = import_zod2.z.object({
113
- $$now: import_zod2.z.literal(true)
115
+ var import_zod = require("zod");
116
+ var SerializedNowDateTime = import_zod.z.object({
117
+ $$now: import_zod.z.literal(true)
114
118
  });
115
119
  function todayDateTimeValueSerializer() {
116
120
  return { $$now: true };
@@ -329,6 +333,33 @@ function defineComparison(field, value, keyword) {
329
333
  required: [field.$$field]
330
334
  });
331
335
  }
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
+ }
332
363
  function createFieldConditionals(fieldId) {
333
364
  const getDayRange = (field, days, clause, referenceDate) => ({
334
365
  type: "object",
@@ -682,3 +713,6 @@ function createFieldConditionals(fieldId) {
682
713
  })
683
714
  };
684
715
  }
716
+
717
+ // src/conditionals/index.ts
718
+ z4.globalRegistry.clear();
@@ -7,69 +7,25 @@ export declare function field(fieldId: string): {
7
7
  fieldId: string;
8
8
  type: "fuzzy";
9
9
  options: {
10
- boost?: number | undefined;
11
- matchAgainst?: string | undefined;
12
10
  fuzziness?: string | number | undefined;
11
+ boost?: number | undefined;
13
12
  } | undefined;
14
13
  };
15
14
  strictMatches: (options?: StrictMatcherOptions) => {
16
15
  fieldId: string;
17
16
  type: "strict";
18
17
  options: {
19
- value?: string | undefined;
20
18
  boost?: number | undefined;
21
- matchAgainst?: string | undefined;
19
+ value?: string | undefined;
22
20
  } | undefined;
23
21
  };
24
- /**
25
- * Creates a date range matcher that finds records where date fields 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 across multiple fields 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 fields to match against. When provided,
35
- * the query matches if any of these fields fall within the date range. The default field is always excluded in the search in that case.
36
- * If you want to add the default field, you have to explicitly add that field in `matchAgainst` option
37
- *
38
- * @returns A clause that matches records where at least one of the specified date fields is within the range
39
- *
40
- * @example
41
- * // Matches only against mother.dob (±365 days)
42
- * field('mother.dob').dateRangeMatches({ days: 365 })
43
- *
44
- * @example
45
- * // Matches against mother.age OR spouse.dob, not mother.dob
46
- * field('mother.dob').dateRangeMatches({
47
- * days: 365,
48
- * matchAgainst: [$field('mother.age'), $field('spouse.dob')]
49
- * })
50
- *
51
- * If you want to add mother.dob, then
52
- * field('mother.dob').dateRangeMatches({
53
- * days: 365,
54
- * matchAgainst: [$field('mother.age'), $field('spouse.dob'), $field('mother.dob')]
55
- * })
56
- *
57
- * @example
58
- * // With custom pivot and boost
59
- * field('mother.dob').dateRangeMatches({
60
- * days: 730,
61
- * pivot: 365,
62
- * boost: 2
63
- * })
64
- */
65
22
  dateRangeMatches: (options: DateRangeMatcherOptions) => {
66
23
  fieldId: string;
67
24
  type: "dateRange";
68
25
  options: {
69
26
  days: number;
70
- boost?: number | undefined;
71
- matchAgainst?: string | undefined;
72
27
  pivot?: number | undefined;
28
+ boost?: number | undefined;
73
29
  };
74
30
  };
75
31
  };
@@ -58,47 +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 fields 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 across multiple fields 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 fields to match against. When provided,
72
- * the query matches if any of these fields fall within the date range. The default field is always excluded in the search in that case.
73
- * If you want to add the default field, you have to explicitly add that field in `matchAgainst` option
74
- *
75
- * @returns A clause that matches records where at least one of the specified date fields is within the range
76
- *
77
- * @example
78
- * // Matches only against mother.dob (±365 days)
79
- * field('mother.dob').dateRangeMatches({ days: 365 })
80
- *
81
- * @example
82
- * // Matches against mother.age OR spouse.dob, not mother.dob
83
- * field('mother.dob').dateRangeMatches({
84
- * days: 365,
85
- * matchAgainst: [$field('mother.age'), $field('spouse.dob')]
86
- * })
87
- *
88
- * If you want to add mother.dob, then
89
- * field('mother.dob').dateRangeMatches({
90
- * days: 365,
91
- * matchAgainst: [$field('mother.age'), $field('spouse.dob'), $field('mother.dob')]
92
- * })
93
- *
94
- * @example
95
- * // With custom pivot and boost
96
- * field('mother.dob').dateRangeMatches({
97
- * days: 730,
98
- * pivot: 365,
99
- * boost: 2
100
- * })
101
- */
102
61
  dateRangeMatches: (options) => ({
103
62
  fieldId,
104
63
  type: "dateRange",