@opencrvs/toolkit 1.8.0-rc.fd8a78f → 1.8.0-rc.fd936ab

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 (41) hide show
  1. package/dist/commons/api/router.d.ts +447 -14227
  2. package/dist/commons/conditionals/conditionals.d.ts +6 -14
  3. package/dist/commons/conditionals/validate.d.ts +6 -10
  4. package/dist/commons/events/ActionConfig.d.ts +1726 -117415
  5. package/dist/commons/events/ActionDocument.d.ts +383 -2305
  6. package/dist/commons/events/ActionInput.d.ts +303 -1583
  7. package/dist/commons/events/ActionType.d.ts +0 -4
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +22 -1029
  9. package/dist/commons/events/CompositeFieldValue.d.ts +0 -31
  10. package/dist/commons/events/Draft.d.ts +29 -143
  11. package/dist/commons/events/EventConfig.d.ts +1361 -56376
  12. package/dist/commons/events/EventDocument.d.ts +264 -1428
  13. package/dist/commons/events/EventIndex.d.ts +25 -1590
  14. package/dist/commons/events/EventMetadata.d.ts +43 -299
  15. package/dist/commons/events/FieldConfig.d.ts +1060 -5458
  16. package/dist/commons/events/FieldType.d.ts +3 -6
  17. package/dist/commons/events/FieldTypeMapping.d.ts +54 -103
  18. package/dist/commons/events/FieldValue.d.ts +8 -49
  19. package/dist/commons/events/FormConfig.d.ts +524 -49166
  20. package/dist/commons/events/PageConfig.d.ts +208 -12210
  21. package/dist/commons/events/SummaryConfig.d.ts +42 -93
  22. package/dist/commons/events/User.d.ts +2 -31
  23. package/dist/commons/events/WorkqueueConfig.d.ts +20 -4803
  24. package/dist/commons/events/defineConfig.d.ts +75 -9010
  25. package/dist/commons/events/index.d.ts +0 -8
  26. package/dist/commons/events/test.utils.d.ts +78 -147
  27. package/dist/commons/events/utils.d.ts +68 -13352
  28. package/dist/conditionals/index.js +36 -76
  29. package/dist/events/index.js +1504 -3807
  30. package/dist/scopes/index.d.ts +6 -94
  31. package/dist/scopes/index.js +21 -42
  32. package/package.json +2 -3
  33. package/dist/commons/events/Constants.d.ts +0 -3
  34. package/dist/commons/events/CountryConfigQueryInput.d.ts +0 -2982
  35. package/dist/commons/events/CreatedAtLocation.d.ts +0 -3
  36. package/dist/commons/events/WorkqueueColumnConfig.d.ts +0 -53
  37. package/dist/commons/events/event.d.ts +0 -54
  38. package/dist/commons/events/field.d.ts +0 -77
  39. package/dist/commons/events/scopes.d.ts +0 -45
  40. package/dist/commons/events/serializer.d.ts +0 -2
  41. package/dist/commons/events/workqueueDefaultColumns.d.ts +0 -3
@@ -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,
27
25
  defineConditional: () => defineConditional,
28
26
  defineFormConditional: () => defineFormConditional,
27
+ event: () => event,
28
+ field: () => field,
29
29
  never: () => never,
30
30
  not: () => not,
31
31
  or: () => or,
@@ -33,23 +33,6 @@ __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
-
53
36
  // ../commons/src/conditionals/conditionals.ts
54
37
  function defineConditional(schema) {
55
38
  return schema;
@@ -91,7 +74,7 @@ function not(condition) {
91
74
  function never() {
92
75
  return not(alwaysTrue());
93
76
  }
94
- var user = Object.assign(userSerializer, {
77
+ var user = {
95
78
  hasScope: (scope) => defineConditional({
96
79
  type: "object",
97
80
  properties: {
@@ -111,39 +94,33 @@ var user = Object.assign(userSerializer, {
111
94
  },
112
95
  required: ["$user"]
113
96
  })
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
- }
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"]
138
115
  }
139
- },
140
- required: ["actions"]
141
- }
142
- },
143
- required: ["$event"]
144
- })
145
- };
146
- }
116
+ }
117
+ },
118
+ required: ["actions"]
119
+ }
120
+ },
121
+ required: ["$event"]
122
+ })
123
+ };
147
124
  function getDateFromNow(days) {
148
125
  return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
149
126
  }
@@ -162,9 +139,9 @@ function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
162
139
  };
163
140
  }
164
141
  function isFieldReference(value) {
165
- return typeof value === "object" && value !== null && "$$field" in value;
142
+ return typeof value === "object" && value !== null && "_fieldId" in value;
166
143
  }
167
- function createFieldConditionals(fieldId) {
144
+ function field(fieldId) {
168
145
  const getDateRange = (date, clause) => ({
169
146
  type: "object",
170
147
  properties: {
@@ -180,7 +157,7 @@ function createFieldConditionals(fieldId) {
180
157
  /**
181
158
  * @private Internal property used for field reference tracking.
182
159
  */
183
- $$field: fieldId,
160
+ _fieldId: fieldId,
184
161
  isAfter: () => ({
185
162
  days: (days) => ({
186
163
  inPast: () => defineFormConditional(
@@ -192,7 +169,7 @@ function createFieldConditionals(fieldId) {
192
169
  }),
193
170
  date: (date) => {
194
171
  if (isFieldReference(date)) {
195
- const comparedFieldId = date.$$field;
172
+ const comparedFieldId = date._fieldId;
196
173
  return defineFormConditional(
197
174
  getDateRangeToFieldReference(
198
175
  fieldId,
@@ -216,7 +193,7 @@ function createFieldConditionals(fieldId) {
216
193
  }),
217
194
  date: (date) => {
218
195
  if (isFieldReference(date)) {
219
- const comparedFieldId = date.$$field;
196
+ const comparedFieldId = date._fieldId;
220
197
  return defineFormConditional(
221
198
  getDateRangeToFieldReference(
222
199
  fieldId,
@@ -231,13 +208,13 @@ function createFieldConditionals(fieldId) {
231
208
  }),
232
209
  isEqualTo: (value) => {
233
210
  if (isFieldReference(value)) {
234
- const comparedFieldId = value.$$field;
211
+ const comparedFieldId = value._fieldId;
235
212
  return defineFormConditional({
236
213
  type: "object",
237
214
  properties: {
238
215
  [fieldId]: {
239
216
  type: ["string", "boolean"],
240
- const: { $data: `/$form/${comparedFieldId}` }
217
+ const: { $data: `1/${comparedFieldId}` }
241
218
  },
242
219
  [comparedFieldId]: { type: ["string", "boolean"] }
243
220
  },
@@ -347,23 +324,6 @@ function createFieldConditionals(fieldId) {
347
324
  }
348
325
  },
349
326
  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]
367
327
  })
368
328
  };
369
329
  }