@opencrvs/toolkit 1.8.0-rc.ffe24c3 → 1.8.1-rc.1e3e9b5

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 +1742 -14918
  2. package/dist/commons/conditionals/conditionals.d.ts +0 -12
  3. package/dist/commons/conditionals/validate.d.ts +5 -0
  4. package/dist/commons/events/ActionConfig.d.ts +37041 -35133
  5. package/dist/commons/events/ActionDocument.d.ts +3159 -1626
  6. package/dist/commons/events/ActionInput.d.ts +2280 -1380
  7. package/dist/commons/events/ActionType.d.ts +7 -4
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +100 -51
  9. package/dist/commons/events/CompositeFieldValue.d.ts +15 -15
  10. package/dist/commons/events/CountryConfigQueryInput.d.ts +1162 -760
  11. package/dist/commons/events/Draft.d.ts +190 -118
  12. package/dist/commons/events/EventConfig.d.ts +20824 -22965
  13. package/dist/commons/events/EventDocument.d.ts +1669 -1021
  14. package/dist/commons/events/EventIndex.d.ts +394 -175
  15. package/dist/commons/events/EventMetadata.d.ts +6 -4
  16. package/dist/commons/events/FieldConfig.d.ts +1528 -449
  17. package/dist/commons/events/FieldType.d.ts +3 -1
  18. package/dist/commons/events/FieldTypeMapping.d.ts +80 -41
  19. package/dist/commons/events/FieldValue.d.ts +58 -28
  20. package/dist/commons/events/FormConfig.d.ts +9263 -2657
  21. package/dist/commons/events/PageConfig.d.ts +3642 -2028
  22. package/dist/commons/events/SummaryConfig.d.ts +10 -10
  23. package/dist/commons/events/User.d.ts +6 -3
  24. package/dist/commons/events/WorkqueueConfig.d.ts +2153 -1337
  25. package/dist/commons/events/defineConfig.d.ts +2759 -3250
  26. package/dist/commons/events/event.d.ts +10 -18
  27. package/dist/commons/events/field.d.ts +13 -1
  28. package/dist/commons/events/scopes.d.ts +2 -1
  29. package/dist/commons/events/test.utils.d.ts +58 -34
  30. package/dist/commons/events/utils.d.ts +8848 -6794
  31. package/dist/conditionals/index.js +23 -53
  32. package/dist/events/index.js +1594 -1341
  33. package/dist/scopes/index.d.ts +92 -6
  34. package/dist/scopes/index.js +38 -9
  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)) {
@@ -319,8 +290,7 @@ function createFieldConditionals(fieldId) {
319
290
  pattern: "^[\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*( [\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*)*$",
320
291
  description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces."
321
292
  }
322
- },
323
- required: [fieldId]
293
+ }
324
294
  }),
325
295
  /**
326
296
  * Checks if the field value matches a given regular expression pattern.