@opencrvs/toolkit 1.8.0-rc.f7a451a → 1.8.0-rc.f7bcb31

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 +4206 -8342
  2. package/dist/commons/conditionals/conditionals.d.ts +7 -11
  3. package/dist/commons/conditionals/validate.d.ts +6 -4
  4. package/dist/commons/events/ActionConfig.d.ts +1727 -97087
  5. package/dist/commons/events/ActionDocument.d.ts +211 -542
  6. package/dist/commons/events/ActionInput.d.ts +240 -248
  7. package/dist/commons/events/AdvancedSearchConfig.d.ts +22 -957
  8. package/dist/commons/events/CompositeFieldValue.d.ts +0 -3
  9. package/dist/commons/events/Draft.d.ts +20 -33
  10. package/dist/commons/events/EventConfig.d.ts +1350 -46327
  11. package/dist/commons/events/EventDocument.d.ts +156 -324
  12. package/dist/commons/events/EventIndex.d.ts +13 -1821
  13. package/dist/commons/events/EventMetadata.d.ts +11 -277
  14. package/dist/commons/events/FieldConfig.d.ts +754 -4280
  15. package/dist/commons/events/FieldType.d.ts +3 -3
  16. package/dist/commons/events/FieldTypeMapping.d.ts +4 -11
  17. package/dist/commons/events/FieldValue.d.ts +4 -7
  18. package/dist/commons/events/FormConfig.d.ts +441 -43593
  19. package/dist/commons/events/PageConfig.d.ts +208 -10864
  20. package/dist/commons/events/SummaryConfig.d.ts +39 -95
  21. package/dist/commons/events/User.d.ts +2 -31
  22. package/dist/commons/events/WorkqueueConfig.d.ts +20 -5341
  23. package/dist/commons/events/defineConfig.d.ts +35 -7218
  24. package/dist/commons/events/index.d.ts +0 -6
  25. package/dist/commons/events/test.utils.d.ts +46 -10
  26. package/dist/commons/events/utils.d.ts +67 -3665
  27. package/dist/conditionals/index.js +35 -55
  28. package/dist/events/index.js +1075 -2461
  29. package/dist/scopes/index.d.ts +4 -91
  30. package/dist/scopes/index.js +21 -39
  31. package/package.json +2 -3
  32. package/dist/commons/events/CountryConfigQueryInput.d.ts +0 -3008
  33. package/dist/commons/events/WorkqueueColumnConfig.d.ts +0 -42
  34. package/dist/commons/events/event.d.ts +0 -54
  35. package/dist/commons/events/field.d.ts +0 -82
  36. package/dist/commons/events/scopes.d.ts +0 -45
  37. package/dist/commons/events/serializer.d.ts +0 -2
  38. 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
  }
@@ -164,7 +141,7 @@ function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
164
141
  function isFieldReference(value) {
165
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: {
@@ -177,6 +154,10 @@ function createFieldConditionals(fieldId) {
177
154
  required: [fieldId]
178
155
  });
179
156
  return {
157
+ /**
158
+ * @private Internal property used for field reference tracking.
159
+ */
160
+ _fieldId: fieldId,
180
161
  isAfter: () => ({
181
162
  days: (days) => ({
182
163
  inPast: () => defineFormConditional(
@@ -343,7 +324,6 @@ function createFieldConditionals(fieldId) {
343
324
  }
344
325
  },
345
326
  required: [fieldId]
346
- }),
347
- getId: () => ({ fieldId })
327
+ })
348
328
  };
349
329
  }