@opencrvs/toolkit 1.8.0-rc.ffbb9d7 → 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.
- package/dist/commons/api/router.d.ts +14748 -727
- package/dist/commons/conditionals/conditionals.d.ts +14 -6
- package/dist/commons/conditionals/validate.d.ts +11 -11
- package/dist/commons/events/ActionConfig.d.ts +117418 -1729
- package/dist/commons/events/ActionDocument.d.ts +2581 -554
- package/dist/commons/events/ActionInput.d.ts +1795 -425
- package/dist/commons/events/ActionType.d.ts +8 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +1233 -22
- package/dist/commons/events/CompositeFieldValue.d.ts +31 -0
- package/dist/commons/events/Constants.d.ts +3 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +3730 -0
- package/dist/commons/events/CreatedAtLocation.d.ts +2 -0
- package/dist/commons/events/Draft.d.ts +165 -43
- package/dist/commons/events/EventConfig.d.ts +56501 -1354
- package/dist/commons/events/EventDocument.d.ts +1635 -391
- package/dist/commons/events/EventIndex.d.ts +2007 -27
- package/dist/commons/events/EventMetadata.d.ts +343 -45
- package/dist/commons/events/FieldConfig.d.ts +5450 -1033
- package/dist/commons/events/FieldType.d.ts +6 -3
- package/dist/commons/events/FieldTypeMapping.d.ts +103 -54
- package/dist/commons/events/FieldValue.d.ts +49 -8
- package/dist/commons/events/FormConfig.d.ts +49156 -514
- package/dist/commons/events/PageConfig.d.ts +12206 -204
- package/dist/commons/events/SummaryConfig.d.ts +93 -42
- package/dist/commons/events/TemplateConfig.d.ts +4 -4
- package/dist/commons/events/User.d.ts +31 -2
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +53 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +7300 -20
- package/dist/commons/events/defineConfig.d.ts +9001 -58
- package/dist/commons/events/event.d.ts +54 -0
- package/dist/commons/events/field.d.ts +82 -0
- package/dist/commons/events/index.d.ts +8 -0
- package/dist/commons/events/scopes.d.ts +44 -0
- package/dist/commons/events/serializer.d.ts +2 -0
- package/dist/commons/events/test.utils.d.ts +171 -79
- package/dist/commons/events/transactions.d.ts +1 -1
- package/dist/commons/events/utils.d.ts +13375 -73
- package/dist/commons/events/utils.test.d.ts +2 -0
- package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
- package/dist/conditionals/index.js +76 -36
- package/dist/events/index.js +4630 -1941
- package/dist/scopes/index.d.ts +161 -1
- package/dist/scopes/index.js +202 -1
- package/package.json +4 -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,
|
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
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
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
|
+
}
|
115
138
|
}
|
116
|
-
}
|
117
|
-
|
118
|
-
|
119
|
-
}
|
120
|
-
|
121
|
-
|
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 && "
|
165
|
+
return typeof value === "object" && value !== null && "$$field" in value;
|
143
166
|
}
|
144
|
-
function
|
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
|
-
|
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
|
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
|
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
|
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:
|
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
|
}
|