@opencrvs/toolkit 1.8.0-rc.fb4793a → 1.8.0-rc.fb8e005

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 (43) hide show
  1. package/dist/commons/api/router.d.ts +6737 -8337
  2. package/dist/commons/conditionals/conditionals.d.ts +8 -3
  3. package/dist/commons/conditionals/validate.d.ts +6 -0
  4. package/dist/commons/events/ActionConfig.d.ts +35832 -12647
  5. package/dist/commons/events/ActionDocument.d.ts +2215 -525
  6. package/dist/commons/events/ActionInput.d.ts +1579 -307
  7. package/dist/commons/events/ActionType.d.ts +4 -0
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +279 -3
  9. package/dist/commons/events/CompositeFieldValue.d.ts +28 -0
  10. package/dist/commons/events/Constants.d.ts +3 -0
  11. package/dist/commons/events/CountryConfigQueryInput.d.ts +3730 -0
  12. package/dist/commons/events/CreatedAtLocation.d.ts +2 -0
  13. package/dist/commons/events/Draft.d.ts +142 -36
  14. package/dist/commons/events/EventConfig.d.ts +23847 -12245
  15. package/dist/commons/events/EventDocument.d.ts +1454 -396
  16. package/dist/commons/events/EventIndex.d.ts +807 -549
  17. package/dist/commons/events/EventInput.d.ts +0 -13
  18. package/dist/commons/events/EventMetadata.d.ts +122 -87
  19. package/dist/commons/events/FieldConfig.d.ts +2261 -1191
  20. package/dist/commons/events/FieldType.d.ts +4 -1
  21. package/dist/commons/events/FieldTypeMapping.d.ts +94 -52
  22. package/dist/commons/events/FieldValue.d.ts +43 -5
  23. package/dist/commons/events/FormConfig.d.ts +11459 -4769
  24. package/dist/commons/events/PageConfig.d.ts +3768 -2134
  25. package/dist/commons/events/SummaryConfig.d.ts +0 -5
  26. package/dist/commons/events/User.d.ts +31 -7
  27. package/dist/commons/events/WorkqueueColumnConfig.d.ts +53 -0
  28. package/dist/commons/events/WorkqueueConfig.d.ts +6278 -528
  29. package/dist/commons/events/defineConfig.d.ts +2747 -679
  30. package/dist/commons/events/event.d.ts +2 -2
  31. package/dist/commons/events/field.d.ts +10 -10
  32. package/dist/commons/events/index.d.ts +5 -0
  33. package/dist/commons/events/scopes.d.ts +1 -2
  34. package/dist/commons/events/serializer.d.ts +2 -0
  35. package/dist/commons/events/test.utils.d.ts +171 -41
  36. package/dist/commons/events/transactions.d.ts +1 -1
  37. package/dist/commons/events/utils.d.ts +10474 -330
  38. package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
  39. package/dist/conditionals/index.js +65 -25
  40. package/dist/events/index.js +2876 -1213
  41. package/dist/scopes/index.d.ts +4 -1
  42. package/dist/scopes/index.js +67 -17
  43. package/package.json +3 -3
@@ -0,0 +1,3 @@
1
+ import { WorkqueueColumn } from './WorkqueueColumnConfig';
2
+ export declare const defaultWorkqueueColumns: WorkqueueColumn[];
3
+ //# sourceMappingURL=workqueueDefaultColumns.d.ts.map
@@ -33,6 +33,23 @@ __export(conditionals_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(conditionals_exports);
35
35
 
36
+ // ../commons/src/events/serializers/user/serializer.ts
37
+ var import_zod = require("zod");
38
+ var SerializedUserField = import_zod.z.object({
39
+ $userField: import_zod.z.enum([
40
+ "id",
41
+ "name",
42
+ "role",
43
+ "signatureFilename",
44
+ "primaryOfficeId"
45
+ ])
46
+ });
47
+ function userSerializer(userField) {
48
+ return {
49
+ $userField: userField
50
+ };
51
+ }
52
+
36
53
  // ../commons/src/conditionals/conditionals.ts
37
54
  function defineConditional(schema) {
38
55
  return schema;
@@ -74,7 +91,7 @@ function not(condition) {
74
91
  function never() {
75
92
  return not(alwaysTrue());
76
93
  }
77
- var user = {
94
+ var user = Object.assign(userSerializer, {
78
95
  hasScope: (scope) => defineConditional({
79
96
  type: "object",
80
97
  properties: {
@@ -94,7 +111,7 @@ var user = {
94
111
  },
95
112
  required: ["$user"]
96
113
  })
97
- };
114
+ });
98
115
  function createEventConditionals() {
99
116
  return {
100
117
  /**
@@ -127,9 +144,6 @@ function createEventConditionals() {
127
144
  })
128
145
  };
129
146
  }
130
- function getDateFromNow(days) {
131
- return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
132
- }
133
147
  function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
134
148
  return {
135
149
  type: "object",
@@ -145,9 +159,23 @@ function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
145
159
  };
146
160
  }
147
161
  function isFieldReference(value) {
148
- return typeof value === "object" && value !== null && "_fieldId" in value;
162
+ return typeof value === "object" && value !== null && "$$field" in value;
149
163
  }
150
164
  function createFieldConditionals(fieldId) {
165
+ const getDayRange = (days, clause) => ({
166
+ type: "object",
167
+ properties: {
168
+ [fieldId]: {
169
+ type: "string",
170
+ format: "date",
171
+ daysFromNow: {
172
+ days,
173
+ clause
174
+ }
175
+ }
176
+ },
177
+ required: [fieldId]
178
+ });
151
179
  const getDateRange = (date, clause) => ({
152
180
  type: "object",
153
181
  properties: {
@@ -160,18 +188,18 @@ function createFieldConditionals(fieldId) {
160
188
  required: [fieldId]
161
189
  });
162
190
  return {
191
+ /**
192
+ * @private Internal property used for field reference tracking.
193
+ */
194
+ $$field: fieldId,
163
195
  isAfter: () => ({
164
196
  days: (days) => ({
165
- inPast: () => defineFormConditional(
166
- getDateRange(getDateFromNow(days), "formatMinimum")
167
- ),
168
- inFuture: () => defineFormConditional(
169
- getDateRange(getDateFromNow(-days), "formatMinimum")
170
- )
197
+ inPast: () => defineFormConditional(getDayRange(-days, "after")),
198
+ inFuture: () => defineFormConditional(getDayRange(days, "after"))
171
199
  }),
172
200
  date: (date) => {
173
201
  if (isFieldReference(date)) {
174
- const comparedFieldId = date._fieldId;
202
+ const comparedFieldId = date.$$field;
175
203
  return defineFormConditional(
176
204
  getDateRangeToFieldReference(
177
205
  fieldId,
@@ -182,20 +210,16 @@ function createFieldConditionals(fieldId) {
182
210
  }
183
211
  return defineFormConditional(getDateRange(date, "formatMinimum"));
184
212
  },
185
- now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMinimum"))
213
+ now: () => defineFormConditional(getDateRange({ $data: "/$now" }, "formatMinimum"))
186
214
  }),
187
215
  isBefore: () => ({
188
216
  days: (days) => ({
189
- inPast: () => defineFormConditional(
190
- getDateRange(getDateFromNow(days), "formatMaximum")
191
- ),
192
- inFuture: () => defineFormConditional(
193
- getDateRange(getDateFromNow(-days), "formatMaximum")
194
- )
217
+ inPast: () => defineFormConditional(getDayRange(days, "before")),
218
+ inFuture: () => defineFormConditional(getDayRange(-days, "before"))
195
219
  }),
196
220
  date: (date) => {
197
221
  if (isFieldReference(date)) {
198
- const comparedFieldId = date._fieldId;
222
+ const comparedFieldId = date.$$field;
199
223
  return defineFormConditional(
200
224
  getDateRangeToFieldReference(
201
225
  fieldId,
@@ -206,17 +230,17 @@ function createFieldConditionals(fieldId) {
206
230
  }
207
231
  return defineFormConditional(getDateRange(date, "formatMaximum"));
208
232
  },
209
- now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMaximum"))
233
+ now: () => defineFormConditional(getDateRange({ $data: "/$now" }, "formatMaximum"))
210
234
  }),
211
235
  isEqualTo: (value) => {
212
236
  if (isFieldReference(value)) {
213
- const comparedFieldId = value._fieldId;
237
+ const comparedFieldId = value.$$field;
214
238
  return defineFormConditional({
215
239
  type: "object",
216
240
  properties: {
217
241
  [fieldId]: {
218
242
  type: ["string", "boolean"],
219
- const: { $data: `1/${comparedFieldId}` }
243
+ const: { $data: `/$form/${comparedFieldId}` }
220
244
  },
221
245
  [comparedFieldId]: { type: ["string", "boolean"] }
222
246
  },
@@ -327,6 +351,22 @@ function createFieldConditionals(fieldId) {
327
351
  },
328
352
  required: [fieldId]
329
353
  }),
330
- getId: () => ({ fieldId })
354
+ getId: () => ({ fieldId }),
355
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
356
+ object: (options) => defineFormConditional({
357
+ type: "object",
358
+ properties: {
359
+ [fieldId]: {
360
+ type: "object",
361
+ properties: Object.fromEntries(
362
+ Object.entries(options).map(([key, value]) => {
363
+ return [key, value.properties.$form.properties[key]];
364
+ })
365
+ ),
366
+ required: Object.keys(options)
367
+ }
368
+ },
369
+ required: [fieldId]
370
+ })
331
371
  };
332
372
  }