@opencrvs/toolkit 1.8.0-rc.fb5b9fe → 1.8.0-rc.fb5f1af

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 (38) hide show
  1. package/dist/commons/api/router.d.ts +7226 -9201
  2. package/dist/commons/conditionals/conditionals.d.ts +4 -12
  3. package/dist/commons/conditionals/validate.d.ts +6 -0
  4. package/dist/commons/events/ActionConfig.d.ts +42985 -22929
  5. package/dist/commons/events/ActionDocument.d.ts +3599 -1052
  6. package/dist/commons/events/ActionInput.d.ts +2942 -842
  7. package/dist/commons/events/ActionType.d.ts +4 -0
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +339 -36
  9. package/dist/commons/events/CompositeFieldValue.d.ts +37 -9
  10. package/dist/commons/events/Constants.d.ts +1 -0
  11. package/dist/commons/events/CountryConfigQueryInput.d.ts +1891 -741
  12. package/dist/commons/events/Draft.d.ts +248 -75
  13. package/dist/commons/events/EventConfig.d.ts +17983 -8266
  14. package/dist/commons/events/EventDocument.d.ts +2260 -673
  15. package/dist/commons/events/EventIndex.d.ts +1069 -196
  16. package/dist/commons/events/EventMetadata.d.ts +52 -40
  17. package/dist/commons/events/FieldConfig.d.ts +2303 -926
  18. package/dist/commons/events/FieldType.d.ts +5 -1
  19. package/dist/commons/events/FieldTypeMapping.d.ts +144 -73
  20. package/dist/commons/events/FieldValue.d.ts +85 -20
  21. package/dist/commons/events/FormConfig.d.ts +23361 -14925
  22. package/dist/commons/events/PageConfig.d.ts +3730 -1662
  23. package/dist/commons/events/SummaryConfig.d.ts +0 -5
  24. package/dist/commons/events/User.d.ts +6 -3
  25. package/dist/commons/events/WorkqueueColumnConfig.d.ts +11 -11
  26. package/dist/commons/events/WorkqueueConfig.d.ts +5509 -1918
  27. package/dist/commons/events/defineConfig.d.ts +1762 -126
  28. package/dist/commons/events/event.d.ts +10 -18
  29. package/dist/commons/events/field.d.ts +9 -0
  30. package/dist/commons/events/index.d.ts +1 -0
  31. package/dist/commons/events/scopes.d.ts +1 -2
  32. package/dist/commons/events/test.utils.d.ts +181 -49
  33. package/dist/commons/events/utils.d.ts +13653 -1222
  34. package/dist/conditionals/index.js +40 -52
  35. package/dist/events/index.js +2274 -1491
  36. package/dist/scopes/index.d.ts +96 -7
  37. package/dist/scopes/index.js +105 -26
  38. 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)) {
@@ -237,7 +208,7 @@ function createFieldConditionals(fieldId) {
237
208
  properties: {
238
209
  [fieldId]: {
239
210
  type: ["string", "boolean"],
240
- const: { $data: `1/${comparedFieldId}` }
211
+ const: { $data: `/$form/${comparedFieldId}` }
241
212
  },
242
213
  [comparedFieldId]: { type: ["string", "boolean"] }
243
214
  },
@@ -347,6 +318,23 @@ function createFieldConditionals(fieldId) {
347
318
  }
348
319
  },
349
320
  required: [fieldId]
321
+ }),
322
+ getId: () => ({ fieldId }),
323
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
324
+ object: (options) => defineFormConditional({
325
+ type: "object",
326
+ properties: {
327
+ [fieldId]: {
328
+ type: "object",
329
+ properties: Object.fromEntries(
330
+ Object.entries(options).map(([key, value]) => {
331
+ return [key, value.properties.$form.properties[key]];
332
+ })
333
+ ),
334
+ required: Object.keys(options)
335
+ }
336
+ },
337
+ required: [fieldId]
350
338
  })
351
339
  };
352
340
  }