@opencrvs/toolkit 1.8.0-rc.fd754eb → 1.8.0-rc.fd936ab

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 (33) hide show
  1. package/dist/commons/api/router.d.ts +4205 -7695
  2. package/dist/commons/conditionals/conditionals.d.ts +6 -9
  3. package/dist/commons/conditionals/validate.d.ts +6 -4
  4. package/dist/commons/events/ActionConfig.d.ts +1680 -90025
  5. package/dist/commons/events/ActionDocument.d.ts +211 -542
  6. package/dist/commons/events/ActionInput.d.ts +240 -248
  7. package/dist/commons/events/AdvancedSearchConfig.d.ts +25 -369
  8. package/dist/commons/events/CompositeFieldValue.d.ts +0 -3
  9. package/dist/commons/events/Draft.d.ts +20 -33
  10. package/dist/commons/events/EventConfig.d.ts +1344 -42812
  11. package/dist/commons/events/EventDocument.d.ts +156 -337
  12. package/dist/commons/events/EventIndex.d.ts +13 -1346
  13. package/dist/commons/events/EventInput.d.ts +0 -13
  14. package/dist/commons/events/EventMetadata.d.ts +11 -273
  15. package/dist/commons/events/FieldConfig.d.ts +724 -3733
  16. package/dist/commons/events/FieldType.d.ts +3 -3
  17. package/dist/commons/events/FieldTypeMapping.d.ts +4 -11
  18. package/dist/commons/events/FieldValue.d.ts +4 -7
  19. package/dist/commons/events/FormConfig.d.ts +441 -40419
  20. package/dist/commons/events/PageConfig.d.ts +194 -10068
  21. package/dist/commons/events/SummaryConfig.d.ts +39 -95
  22. package/dist/commons/events/User.d.ts +0 -5
  23. package/dist/commons/events/WorkqueueConfig.d.ts +19 -1135
  24. package/dist/commons/events/defineConfig.d.ts +35 -6966
  25. package/dist/commons/events/index.d.ts +0 -3
  26. package/dist/commons/events/test.utils.d.ts +44 -7
  27. package/dist/commons/events/utils.d.ts +67 -3550
  28. package/dist/conditionals/index.js +33 -36
  29. package/dist/events/index.js +977 -1672
  30. package/package.json +2 -3
  31. package/dist/commons/events/event.d.ts +0 -27
  32. package/dist/commons/events/field.d.ts +0 -68
  33. package/dist/commons/events/scopes.d.ts +0 -26
@@ -22,10 +22,10 @@ var conditionals_exports = {};
22
22
  __export(conditionals_exports, {
23
23
  alwaysTrue: () => alwaysTrue,
24
24
  and: () => and,
25
- createEventConditionals: () => createEventConditionals,
26
- createFieldConditionals: () => createFieldConditionals,
27
25
  defineConditional: () => defineConditional,
28
26
  defineFormConditional: () => defineFormConditional,
27
+ event: () => event,
28
+ field: () => field,
29
29
  never: () => never,
30
30
  not: () => not,
31
31
  or: () => or,
@@ -95,38 +95,32 @@ var user = {
95
95
  required: ["$user"]
96
96
  })
97
97
  };
98
- function createEventConditionals() {
99
- return {
100
- /**
101
- * Checks if the event contains a specific action type.
102
- * @param action - The action type to check for.
103
- */
104
- hasAction: (action) => defineConditional({
105
- type: "object",
106
- properties: {
107
- $event: {
108
- type: "object",
109
- properties: {
110
- actions: {
111
- type: "array",
112
- contains: {
113
- type: "object",
114
- properties: {
115
- type: {
116
- const: action
117
- }
118
- },
119
- required: ["type"]
120
- }
98
+ var event = {
99
+ hasAction: (action) => defineConditional({
100
+ type: "object",
101
+ properties: {
102
+ $event: {
103
+ type: "object",
104
+ properties: {
105
+ actions: {
106
+ type: "array",
107
+ contains: {
108
+ type: "object",
109
+ properties: {
110
+ type: {
111
+ const: action
112
+ }
113
+ },
114
+ required: ["type"]
121
115
  }
122
- },
123
- required: ["actions"]
124
- }
125
- },
126
- required: ["$event"]
127
- })
128
- };
129
- }
116
+ }
117
+ },
118
+ required: ["actions"]
119
+ }
120
+ },
121
+ required: ["$event"]
122
+ })
123
+ };
130
124
  function getDateFromNow(days) {
131
125
  return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
132
126
  }
@@ -147,7 +141,7 @@ function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
147
141
  function isFieldReference(value) {
148
142
  return typeof value === "object" && value !== null && "_fieldId" in value;
149
143
  }
150
- function createFieldConditionals(fieldId) {
144
+ function field(fieldId) {
151
145
  const getDateRange = (date, clause) => ({
152
146
  type: "object",
153
147
  properties: {
@@ -160,6 +154,10 @@ function createFieldConditionals(fieldId) {
160
154
  required: [fieldId]
161
155
  });
162
156
  return {
157
+ /**
158
+ * @private Internal property used for field reference tracking.
159
+ */
160
+ _fieldId: fieldId,
163
161
  isAfter: () => ({
164
162
  days: (days) => ({
165
163
  inPast: () => defineFormConditional(
@@ -326,7 +324,6 @@ function createFieldConditionals(fieldId) {
326
324
  }
327
325
  },
328
326
  required: [fieldId]
329
- }),
330
- getId: () => ({ fieldId })
327
+ })
331
328
  };
332
329
  }