@nira-opencrvs/toolkit 1.9.11-rc.1f36427

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 (77) hide show
  1. package/README.md +70 -0
  2. package/build.sh +56 -0
  3. package/dist/api/index.d.ts +11 -0
  4. package/dist/api/index.d.ts.map +1 -0
  5. package/dist/api/index.js +52 -0
  6. package/dist/commons/api/router.d.ts +4125 -0
  7. package/dist/commons/conditionals/conditionals.d.ts +824 -0
  8. package/dist/commons/conditionals/index.d.ts +2 -0
  9. package/dist/commons/conditionals/validate.d.ts +101 -0
  10. package/dist/commons/events/ActionConfig.d.ts +1609 -0
  11. package/dist/commons/events/ActionDocument.d.ts +2180 -0
  12. package/dist/commons/events/ActionInput.d.ts +1229 -0
  13. package/dist/commons/events/ActionType.d.ts +52 -0
  14. package/dist/commons/events/AdvancedSearchConfig.d.ts +1538 -0
  15. package/dist/commons/events/CompositeFieldValue.d.ts +280 -0
  16. package/dist/commons/events/Conditional.d.ts +55 -0
  17. package/dist/commons/events/Constants.d.ts +3 -0
  18. package/dist/commons/events/CountryConfigQueryInput.d.ts +4784 -0
  19. package/dist/commons/events/CreatedAtLocation.d.ts +2 -0
  20. package/dist/commons/events/DeduplicationConfig.d.ts +233 -0
  21. package/dist/commons/events/Draft.d.ts +118 -0
  22. package/dist/commons/events/DynamicFieldValue.d.ts +139 -0
  23. package/dist/commons/events/EventConfig.d.ts +2255 -0
  24. package/dist/commons/events/EventConfigInput.d.ts +10 -0
  25. package/dist/commons/events/EventDocument.d.ts +1457 -0
  26. package/dist/commons/events/EventIndex.d.ts +1134 -0
  27. package/dist/commons/events/EventInput.d.ts +13 -0
  28. package/dist/commons/events/EventMetadata.d.ts +413 -0
  29. package/dist/commons/events/FieldConfig.d.ts +12935 -0
  30. package/dist/commons/events/FieldType.d.ts +55 -0
  31. package/dist/commons/events/FieldTypeMapping.d.ts +1289 -0
  32. package/dist/commons/events/FieldValue.d.ts +512 -0
  33. package/dist/commons/events/FileUtils.d.ts +4 -0
  34. package/dist/commons/events/FormConfig.d.ts +755 -0
  35. package/dist/commons/events/PageConfig.d.ts +342 -0
  36. package/dist/commons/events/PlainDate.d.ts +19 -0
  37. package/dist/commons/events/SummaryConfig.d.ts +170 -0
  38. package/dist/commons/events/TemplateConfig.d.ts +66 -0
  39. package/dist/commons/events/TranslationConfig.d.ts +15 -0
  40. package/dist/commons/events/WorkqueueColumnConfig.d.ts +53 -0
  41. package/dist/commons/events/WorkqueueConfig.d.ts +7957 -0
  42. package/dist/commons/events/deduplication.d.ts +69 -0
  43. package/dist/commons/events/defineConfig.d.ts +234 -0
  44. package/dist/commons/events/event.d.ts +80 -0
  45. package/dist/commons/events/field.d.ts +514 -0
  46. package/dist/commons/events/index.d.ts +45 -0
  47. package/dist/commons/events/locations.d.ts +24 -0
  48. package/dist/commons/events/scopes.d.ts +55 -0
  49. package/dist/commons/events/serializer.d.ts +2 -0
  50. package/dist/commons/events/state/availableActions.d.ts +6 -0
  51. package/dist/commons/events/state/flags.d.ts +4 -0
  52. package/dist/commons/events/state/index.d.ts +119 -0
  53. package/dist/commons/events/state/utils.d.ts +311 -0
  54. package/dist/commons/events/test.utils.d.ts +248 -0
  55. package/dist/commons/events/transactions.d.ts +2 -0
  56. package/dist/commons/events/utils.d.ts +486 -0
  57. package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
  58. package/dist/commons/notification/UserNotifications.d.ts +762 -0
  59. package/dist/commons/notification/index.d.ts +2 -0
  60. package/dist/conditionals/index.d.ts +2 -0
  61. package/dist/conditionals/index.d.ts.map +1 -0
  62. package/dist/conditionals/index.js +689 -0
  63. package/dist/events/deduplication.d.ts +69 -0
  64. package/dist/events/deduplication.d.ts.map +1 -0
  65. package/dist/events/deduplication.js +101 -0
  66. package/dist/events/index.d.ts +2 -0
  67. package/dist/events/index.d.ts.map +1 -0
  68. package/dist/events/index.js +9327 -0
  69. package/dist/notification/index.d.ts +2 -0
  70. package/dist/notification/index.d.ts.map +1 -0
  71. package/dist/notification/index.js +6674 -0
  72. package/dist/scopes/index.d.ts +385 -0
  73. package/dist/scopes/index.d.ts.map +1 -0
  74. package/dist/scopes/index.js +349 -0
  75. package/package.json +40 -0
  76. package/tsconfig.json +27 -0
  77. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,69 @@
1
+ import { ClauseInput, DateRangeMatcherOptions, FuzzyMatcherOptions, StrictMatcherOptions } from '.';
2
+ export declare function not(clause: ClauseInput): ClauseInput;
3
+ export declare function and(...clauses: ClauseInput[]): ClauseInput;
4
+ export declare function or(...clauses: ClauseInput[]): ClauseInput;
5
+ export declare function field(fieldId: string): {
6
+ fuzzyMatches: (options?: FuzzyMatcherOptions) => {
7
+ fieldId: string;
8
+ type: "fuzzy";
9
+ options: {
10
+ boost?: number | undefined;
11
+ matchAgainst?: string | undefined;
12
+ fuzziness?: string | number | undefined;
13
+ } | undefined;
14
+ };
15
+ strictMatches: (options?: StrictMatcherOptions) => {
16
+ fieldId: string;
17
+ type: "strict";
18
+ options: {
19
+ value?: string | undefined;
20
+ boost?: number | undefined;
21
+ matchAgainst?: string | undefined;
22
+ } | undefined;
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
+ */
58
+ dateRangeMatches: (options: DateRangeMatcherOptions) => {
59
+ fieldId: string;
60
+ type: "dateRange";
61
+ options: {
62
+ days: number;
63
+ boost?: number | undefined;
64
+ matchAgainst?: string | undefined;
65
+ pivot?: number | undefined;
66
+ };
67
+ };
68
+ };
69
+ //# sourceMappingURL=deduplication.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deduplication.d.ts","sourceRoot":"","sources":["../../src/events/deduplication.ts"],"names":[],"mappings":"AAUA,cAAc,wCAAwC,CAAA"}
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/events/deduplication.ts
21
+ var deduplication_exports = {};
22
+ __export(deduplication_exports, {
23
+ and: () => and,
24
+ field: () => field,
25
+ not: () => not,
26
+ or: () => or
27
+ });
28
+ module.exports = __toCommonJS(deduplication_exports);
29
+
30
+ // ../commons/src/events/deduplication.ts
31
+ function not(clause) {
32
+ return {
33
+ type: "not",
34
+ clause
35
+ };
36
+ }
37
+ function and(...clauses) {
38
+ return {
39
+ type: "and",
40
+ clauses
41
+ };
42
+ }
43
+ function or(...clauses) {
44
+ return {
45
+ type: "or",
46
+ clauses
47
+ };
48
+ }
49
+ function field(fieldId) {
50
+ return {
51
+ fuzzyMatches: (options) => ({
52
+ fieldId,
53
+ type: "fuzzy",
54
+ options
55
+ }),
56
+ strictMatches: (options) => ({
57
+ fieldId,
58
+ type: "strict",
59
+ options
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
+ dateRangeMatches: (options) => ({
96
+ fieldId,
97
+ type: "dateRange",
98
+ options
99
+ })
100
+ };
101
+ }
@@ -0,0 +1,2 @@
1
+ export * from '../commons/events';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AAUA,cAAc,0BAA0B,CAAA"}