@opencrvs/toolkit 1.8.0-rc.fd8a78f → 1.8.0-rc.fde35f6

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 (35) hide show
  1. package/dist/commons/api/router.d.ts +3117 -11206
  2. package/dist/commons/conditionals/conditionals.d.ts +0 -12
  3. package/dist/commons/events/ActionConfig.d.ts +12032 -3972
  4. package/dist/commons/events/ActionDocument.d.ts +3029 -1886
  5. package/dist/commons/events/ActionInput.d.ts +2406 -1506
  6. package/dist/commons/events/AdvancedSearchConfig.d.ts +304 -51
  7. package/dist/commons/events/CompositeFieldValue.d.ts +15 -15
  8. package/dist/commons/events/CountryConfigQueryInput.d.ts +1891 -741
  9. package/dist/commons/events/CreatedAtLocation.d.ts +1 -2
  10. package/dist/commons/events/Draft.d.ts +213 -136
  11. package/dist/commons/events/EventConfig.d.ts +4770 -755
  12. package/dist/commons/events/EventDocument.d.ts +1942 -1219
  13. package/dist/commons/events/EventIndex.d.ts +897 -263
  14. package/dist/commons/events/EventMetadata.d.ts +73 -31
  15. package/dist/commons/events/FieldConfig.d.ts +607 -30
  16. package/dist/commons/events/FieldType.d.ts +2 -1
  17. package/dist/commons/events/FieldTypeMapping.d.ts +73 -41
  18. package/dist/commons/events/FieldValue.d.ts +57 -28
  19. package/dist/commons/events/FormConfig.d.ts +4685 -1295
  20. package/dist/commons/events/PageConfig.d.ts +868 -38
  21. package/dist/commons/events/User.d.ts +6 -3
  22. package/dist/commons/events/WorkqueueColumnConfig.d.ts +11 -11
  23. package/dist/commons/events/WorkqueueConfig.d.ts +4490 -1177
  24. package/dist/commons/events/defineConfig.d.ts +759 -34
  25. package/dist/commons/events/event.d.ts +15 -10
  26. package/dist/commons/events/field.d.ts +17 -0
  27. package/dist/commons/events/scopes.d.ts +1 -2
  28. package/dist/commons/events/test.utils.d.ts +83 -36
  29. package/dist/commons/events/transactions.d.ts +1 -1
  30. package/dist/commons/events/utils.d.ts +2926 -88
  31. package/dist/conditionals/index.js +22 -51
  32. package/dist/events/index.js +1550 -1048
  33. package/dist/scopes/index.d.ts +96 -7
  34. package/dist/scopes/index.js +105 -26
  35. package/package.json +3 -3
@@ -22,7 +22,6 @@ var conditionals_exports = {};
22
22
  __export(conditionals_exports, {
23
23
  alwaysTrue: () => alwaysTrue,
24
24
  and: () => and,
25
- createEventConditionals: () => createEventConditionals,
26
25
  createFieldConditionals: () => createFieldConditionals,
27
26
  defineConditional: () => defineConditional,
28
27
  defineFormConditional: () => defineFormConditional,
@@ -40,7 +39,8 @@ var SerializedUserField = import_zod.z.object({
40
39
  "id",
41
40
  "name",
42
41
  "role",
43
- "signatureFilename",
42
+ "signature",
43
+ "avatar",
44
44
  "primaryOfficeId"
45
45
  ])
46
46
  });
@@ -112,41 +112,6 @@ var user = Object.assign(userSerializer, {
112
112
  required: ["$user"]
113
113
  })
114
114
  });
115
- function createEventConditionals() {
116
- return {
117
- /**
118
- * Checks if the event contains a specific action type.
119
- * @param action - The action type to check for.
120
- */
121
- hasAction: (action) => defineConditional({
122
- type: "object",
123
- properties: {
124
- $event: {
125
- type: "object",
126
- properties: {
127
- actions: {
128
- type: "array",
129
- contains: {
130
- type: "object",
131
- properties: {
132
- type: {
133
- const: action
134
- }
135
- },
136
- required: ["type"]
137
- }
138
- }
139
- },
140
- required: ["actions"]
141
- }
142
- },
143
- required: ["$event"]
144
- })
145
- };
146
- }
147
- function getDateFromNow(days) {
148
- return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
149
- }
150
115
  function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
151
116
  return {
152
117
  type: "object",
@@ -165,6 +130,20 @@ function isFieldReference(value) {
165
130
  return typeof value === "object" && value !== null && "$$field" in value;
166
131
  }
167
132
  function createFieldConditionals(fieldId) {
133
+ const getDayRange = (days, clause) => ({
134
+ type: "object",
135
+ properties: {
136
+ [fieldId]: {
137
+ type: "string",
138
+ format: "date",
139
+ daysFromNow: {
140
+ days,
141
+ clause
142
+ }
143
+ }
144
+ },
145
+ required: [fieldId]
146
+ });
168
147
  const getDateRange = (date, clause) => ({
169
148
  type: "object",
170
149
  properties: {
@@ -183,12 +162,8 @@ function createFieldConditionals(fieldId) {
183
162
  $$field: fieldId,
184
163
  isAfter: () => ({
185
164
  days: (days) => ({
186
- inPast: () => defineFormConditional(
187
- getDateRange(getDateFromNow(days), "formatMinimum")
188
- ),
189
- inFuture: () => defineFormConditional(
190
- getDateRange(getDateFromNow(-days), "formatMinimum")
191
- )
165
+ inPast: () => defineFormConditional(getDayRange(-days, "after")),
166
+ inFuture: () => defineFormConditional(getDayRange(days, "after"))
192
167
  }),
193
168
  date: (date) => {
194
169
  if (isFieldReference(date)) {
@@ -203,16 +178,12 @@ function createFieldConditionals(fieldId) {
203
178
  }
204
179
  return defineFormConditional(getDateRange(date, "formatMinimum"));
205
180
  },
206
- now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMinimum"))
181
+ now: () => defineFormConditional(getDateRange({ $data: "/$now" }, "formatMinimum"))
207
182
  }),
208
183
  isBefore: () => ({
209
184
  days: (days) => ({
210
- inPast: () => defineFormConditional(
211
- getDateRange(getDateFromNow(days), "formatMaximum")
212
- ),
213
- inFuture: () => defineFormConditional(
214
- getDateRange(getDateFromNow(-days), "formatMaximum")
215
- )
185
+ inPast: () => defineFormConditional(getDayRange(days, "before")),
186
+ inFuture: () => defineFormConditional(getDayRange(-days, "before"))
216
187
  }),
217
188
  date: (date) => {
218
189
  if (isFieldReference(date)) {
@@ -227,7 +198,7 @@ function createFieldConditionals(fieldId) {
227
198
  }
228
199
  return defineFormConditional(getDateRange(date, "formatMaximum"));
229
200
  },
230
- now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMaximum"))
201
+ now: () => defineFormConditional(getDateRange({ $data: "/$now" }, "formatMaximum"))
231
202
  }),
232
203
  isEqualTo: (value) => {
233
204
  if (isFieldReference(value)) {