@opencrvs/toolkit 1.8.0-rc.fe4d9d5 → 1.8.0-rc.fe7c504

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 (31) hide show
  1. package/dist/commons/api/router.d.ts +1335 -10468
  2. package/dist/commons/events/ActionConfig.d.ts +2600 -0
  3. package/dist/commons/events/ActionDocument.d.ts +1081 -1087
  4. package/dist/commons/events/ActionInput.d.ts +726 -726
  5. package/dist/commons/events/ActionType.d.ts +0 -2
  6. package/dist/commons/events/AdvancedSearchConfig.d.ts +222 -18
  7. package/dist/commons/events/CompositeFieldValue.d.ts +6 -6
  8. package/dist/commons/events/CountryConfigQueryInput.d.ts +1234 -572
  9. package/dist/commons/events/CreatedAtLocation.d.ts +1 -2
  10. package/dist/commons/events/Draft.d.ts +77 -77
  11. package/dist/commons/events/EventConfig.d.ts +1458 -0
  12. package/dist/commons/events/EventDocument.d.ts +706 -711
  13. package/dist/commons/events/EventIndex.d.ts +135 -151
  14. package/dist/commons/events/EventMetadata.d.ts +38 -29
  15. package/dist/commons/events/FieldConfig.d.ts +178 -0
  16. package/dist/commons/events/FieldTypeMapping.d.ts +16 -16
  17. package/dist/commons/events/FieldValue.d.ts +12 -12
  18. package/dist/commons/events/FormConfig.d.ts +1092 -0
  19. package/dist/commons/events/PageConfig.d.ts +260 -0
  20. package/dist/commons/events/User.d.ts +6 -3
  21. package/dist/commons/events/WorkqueueConfig.d.ts +2043 -1033
  22. package/dist/commons/events/defineConfig.d.ts +294 -0
  23. package/dist/commons/events/field.d.ts +5 -0
  24. package/dist/commons/events/test.utils.d.ts +30 -19
  25. package/dist/commons/events/transactions.d.ts +1 -1
  26. package/dist/commons/events/utils.d.ts +440 -15
  27. package/dist/conditionals/index.js +22 -18
  28. package/dist/events/index.js +303 -185
  29. package/dist/scopes/index.d.ts +92 -6
  30. package/dist/scopes/index.js +38 -9
  31. package/package.json +3 -3
@@ -40,7 +40,8 @@ var SerializedUserField = import_zod.z.object({
40
40
  "id",
41
41
  "name",
42
42
  "role",
43
- "signatureFilename",
43
+ "signature",
44
+ "avatar",
44
45
  "primaryOfficeId"
45
46
  ])
46
47
  });
@@ -144,9 +145,6 @@ function createEventConditionals() {
144
145
  })
145
146
  };
146
147
  }
147
- function getDateFromNow(days) {
148
- return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
149
- }
150
148
  function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
151
149
  return {
152
150
  type: "object",
@@ -165,6 +163,20 @@ function isFieldReference(value) {
165
163
  return typeof value === "object" && value !== null && "$$field" in value;
166
164
  }
167
165
  function createFieldConditionals(fieldId) {
166
+ const getDayRange = (days, clause) => ({
167
+ type: "object",
168
+ properties: {
169
+ [fieldId]: {
170
+ type: "string",
171
+ format: "date",
172
+ daysFromNow: {
173
+ days,
174
+ clause
175
+ }
176
+ }
177
+ },
178
+ required: [fieldId]
179
+ });
168
180
  const getDateRange = (date, clause) => ({
169
181
  type: "object",
170
182
  properties: {
@@ -183,12 +195,8 @@ function createFieldConditionals(fieldId) {
183
195
  $$field: fieldId,
184
196
  isAfter: () => ({
185
197
  days: (days) => ({
186
- inPast: () => defineFormConditional(
187
- getDateRange(getDateFromNow(days), "formatMinimum")
188
- ),
189
- inFuture: () => defineFormConditional(
190
- getDateRange(getDateFromNow(-days), "formatMinimum")
191
- )
198
+ inPast: () => defineFormConditional(getDayRange(-days, "after")),
199
+ inFuture: () => defineFormConditional(getDayRange(days, "after"))
192
200
  }),
193
201
  date: (date) => {
194
202
  if (isFieldReference(date)) {
@@ -203,16 +211,12 @@ function createFieldConditionals(fieldId) {
203
211
  }
204
212
  return defineFormConditional(getDateRange(date, "formatMinimum"));
205
213
  },
206
- now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMinimum"))
214
+ now: () => defineFormConditional(getDateRange({ $data: "/$now" }, "formatMinimum"))
207
215
  }),
208
216
  isBefore: () => ({
209
217
  days: (days) => ({
210
- inPast: () => defineFormConditional(
211
- getDateRange(getDateFromNow(days), "formatMaximum")
212
- ),
213
- inFuture: () => defineFormConditional(
214
- getDateRange(getDateFromNow(-days), "formatMaximum")
215
- )
218
+ inPast: () => defineFormConditional(getDayRange(days, "before")),
219
+ inFuture: () => defineFormConditional(getDayRange(-days, "before"))
216
220
  }),
217
221
  date: (date) => {
218
222
  if (isFieldReference(date)) {
@@ -227,7 +231,7 @@ function createFieldConditionals(fieldId) {
227
231
  }
228
232
  return defineFormConditional(getDateRange(date, "formatMaximum"));
229
233
  },
230
- now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMaximum"))
234
+ now: () => defineFormConditional(getDateRange({ $data: "/$now" }, "formatMaximum"))
231
235
  }),
232
236
  isEqualTo: (value) => {
233
237
  if (isFieldReference(value)) {