@opencrvs/toolkit 1.8.0-rc.ffb4f66 → 1.8.0-rc.ffe24c3

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 (42) hide show
  1. package/dist/commons/api/router.d.ts +14742 -734
  2. package/dist/commons/conditionals/conditionals.d.ts +14 -6
  3. package/dist/commons/conditionals/validate.d.ts +10 -6
  4. package/dist/commons/events/ActionConfig.d.ts +117418 -1729
  5. package/dist/commons/events/ActionDocument.d.ts +2581 -560
  6. package/dist/commons/events/ActionInput.d.ts +1705 -425
  7. package/dist/commons/events/ActionType.d.ts +6 -0
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +1233 -22
  9. package/dist/commons/events/CompositeFieldValue.d.ts +31 -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 +162 -43
  14. package/dist/commons/events/EventConfig.d.ts +56501 -1354
  15. package/dist/commons/events/EventDocument.d.ts +1635 -396
  16. package/dist/commons/events/EventIndex.d.ts +2007 -27
  17. package/dist/commons/events/EventMetadata.d.ts +343 -45
  18. package/dist/commons/events/FieldConfig.d.ts +5450 -1033
  19. package/dist/commons/events/FieldType.d.ts +6 -3
  20. package/dist/commons/events/FieldTypeMapping.d.ts +103 -54
  21. package/dist/commons/events/FieldValue.d.ts +49 -8
  22. package/dist/commons/events/FormConfig.d.ts +49156 -514
  23. package/dist/commons/events/PageConfig.d.ts +12206 -204
  24. package/dist/commons/events/SummaryConfig.d.ts +93 -42
  25. package/dist/commons/events/User.d.ts +31 -2
  26. package/dist/commons/events/WorkqueueColumnConfig.d.ts +53 -0
  27. package/dist/commons/events/WorkqueueConfig.d.ts +7300 -20
  28. package/dist/commons/events/defineConfig.d.ts +9001 -58
  29. package/dist/commons/events/event.d.ts +54 -0
  30. package/dist/commons/events/field.d.ts +82 -0
  31. package/dist/commons/events/index.d.ts +8 -0
  32. package/dist/commons/events/scopes.d.ts +44 -0
  33. package/dist/commons/events/serializer.d.ts +2 -0
  34. package/dist/commons/events/test.utils.d.ts +171 -79
  35. package/dist/commons/events/transactions.d.ts +1 -1
  36. package/dist/commons/events/utils.d.ts +13365 -71
  37. package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
  38. package/dist/conditionals/index.js +76 -36
  39. package/dist/events/index.js +4114 -1495
  40. package/dist/scopes/index.d.ts +161 -1
  41. package/dist/scopes/index.js +202 -1
  42. package/package.json +4 -3
@@ -0,0 +1,3 @@
1
+ import { WorkqueueColumn } from './WorkqueueColumnConfig';
2
+ export declare const defaultWorkqueueColumns: WorkqueueColumn[];
3
+ //# sourceMappingURL=workqueueDefaultColumns.d.ts.map
@@ -22,10 +22,10 @@ var conditionals_exports = {};
22
22
  __export(conditionals_exports, {
23
23
  alwaysTrue: () => alwaysTrue,
24
24
  and: () => and,
25
+ createEventConditionals: () => createEventConditionals,
26
+ createFieldConditionals: () => createFieldConditionals,
25
27
  defineConditional: () => defineConditional,
26
28
  defineFormConditional: () => defineFormConditional,
27
- event: () => event,
28
- field: () => field,
29
29
  never: () => never,
30
30
  not: () => not,
31
31
  or: () => or,
@@ -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,33 +111,39 @@ var user = {
94
111
  },
95
112
  required: ["$user"]
96
113
  })
97
- };
98
- var event = {
99
- hasAction: (action) => defineConditional({
100
- type: "object",
101
- properties: {
102
- $event: {
103
- type: "object",
104
- properties: {
105
- actions: {
106
- type: "array",
107
- contains: {
108
- type: "object",
109
- properties: {
110
- type: {
111
- const: action
112
- }
113
- },
114
- required: ["type"]
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
+ }
115
138
  }
116
- }
117
- },
118
- required: ["actions"]
119
- }
120
- },
121
- required: ["$event"]
122
- })
123
- };
139
+ },
140
+ required: ["actions"]
141
+ }
142
+ },
143
+ required: ["$event"]
144
+ })
145
+ };
146
+ }
124
147
  function getDateFromNow(days) {
125
148
  return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
126
149
  }
@@ -139,9 +162,9 @@ function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
139
162
  };
140
163
  }
141
164
  function isFieldReference(value) {
142
- return typeof value === "object" && value !== null && "_fieldId" in value;
165
+ return typeof value === "object" && value !== null && "$$field" in value;
143
166
  }
144
- function field(fieldId) {
167
+ function createFieldConditionals(fieldId) {
145
168
  const getDateRange = (date, clause) => ({
146
169
  type: "object",
147
170
  properties: {
@@ -157,7 +180,7 @@ function field(fieldId) {
157
180
  /**
158
181
  * @private Internal property used for field reference tracking.
159
182
  */
160
- _fieldId: fieldId,
183
+ $$field: fieldId,
161
184
  isAfter: () => ({
162
185
  days: (days) => ({
163
186
  inPast: () => defineFormConditional(
@@ -169,7 +192,7 @@ function field(fieldId) {
169
192
  }),
170
193
  date: (date) => {
171
194
  if (isFieldReference(date)) {
172
- const comparedFieldId = date._fieldId;
195
+ const comparedFieldId = date.$$field;
173
196
  return defineFormConditional(
174
197
  getDateRangeToFieldReference(
175
198
  fieldId,
@@ -193,7 +216,7 @@ function field(fieldId) {
193
216
  }),
194
217
  date: (date) => {
195
218
  if (isFieldReference(date)) {
196
- const comparedFieldId = date._fieldId;
219
+ const comparedFieldId = date.$$field;
197
220
  return defineFormConditional(
198
221
  getDateRangeToFieldReference(
199
222
  fieldId,
@@ -208,13 +231,13 @@ function field(fieldId) {
208
231
  }),
209
232
  isEqualTo: (value) => {
210
233
  if (isFieldReference(value)) {
211
- const comparedFieldId = value._fieldId;
234
+ const comparedFieldId = value.$$field;
212
235
  return defineFormConditional({
213
236
  type: "object",
214
237
  properties: {
215
238
  [fieldId]: {
216
239
  type: ["string", "boolean"],
217
- const: { $data: `1/${comparedFieldId}` }
240
+ const: { $data: `/$form/${comparedFieldId}` }
218
241
  },
219
242
  [comparedFieldId]: { type: ["string", "boolean"] }
220
243
  },
@@ -324,6 +347,23 @@ function field(fieldId) {
324
347
  }
325
348
  },
326
349
  required: [fieldId]
350
+ }),
351
+ getId: () => ({ fieldId }),
352
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
353
+ object: (options) => defineFormConditional({
354
+ type: "object",
355
+ properties: {
356
+ [fieldId]: {
357
+ type: "object",
358
+ properties: Object.fromEntries(
359
+ Object.entries(options).map(([key, value]) => {
360
+ return [key, value.properties.$form.properties[key]];
361
+ })
362
+ ),
363
+ required: Object.keys(options)
364
+ }
365
+ },
366
+ required: [fieldId]
327
367
  })
328
368
  };
329
369
  }