@opencrvs/toolkit 1.8.0-rc.ffe24c3 → 1.8.1-rc.008155b
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 +1791 -14926
- package/dist/commons/conditionals/conditionals.d.ts +0 -12
- package/dist/commons/conditionals/validate.d.ts +5 -0
- package/dist/commons/events/ActionConfig.d.ts +37041 -35133
- package/dist/commons/events/ActionDocument.d.ts +3742 -1637
- package/dist/commons/events/ActionInput.d.ts +2342 -1380
- package/dist/commons/events/ActionType.d.ts +7 -4
- package/dist/commons/events/AdvancedSearchConfig.d.ts +153 -86
- package/dist/commons/events/CompositeFieldValue.d.ts +15 -15
- package/dist/commons/events/CountryConfigQueryInput.d.ts +1174 -772
- package/dist/commons/events/Draft.d.ts +190 -118
- package/dist/commons/events/EventConfig.d.ts +20268 -22409
- package/dist/commons/events/EventDocument.d.ts +1714 -1021
- package/dist/commons/events/EventIndex.d.ts +523 -182
- package/dist/commons/events/EventMetadata.d.ts +9 -7
- package/dist/commons/events/FieldConfig.d.ts +1527 -455
- package/dist/commons/events/FieldType.d.ts +3 -1
- package/dist/commons/events/FieldTypeMapping.d.ts +80 -41
- package/dist/commons/events/FieldValue.d.ts +58 -28
- package/dist/commons/events/FormConfig.d.ts +9263 -2657
- package/dist/commons/events/PageConfig.d.ts +3642 -2028
- package/dist/commons/events/SummaryConfig.d.ts +10 -10
- package/dist/commons/events/User.d.ts +6 -3
- package/dist/commons/events/WorkqueueConfig.d.ts +2290 -1350
- package/dist/commons/events/defineConfig.d.ts +2761 -3252
- package/dist/commons/events/event.d.ts +19 -19
- package/dist/commons/events/field.d.ts +27 -1
- package/dist/commons/events/scopes.d.ts +2 -1
- package/dist/commons/events/test.utils.d.ts +62 -34
- package/dist/commons/events/utils.d.ts +8851 -6797
- package/dist/conditionals/index.js +25 -55
- package/dist/events/index.js +1657 -1377
- package/dist/scopes/index.d.ts +92 -6
- package/dist/scopes/index.js +38 -9
- package/package.json +3 -3
@@ -22,7 +22,6 @@ var conditionals_exports = {};
|
|
22
22
|
__export(conditionals_exports, {
|
23
23
|
alwaysTrue: () => alwaysTrue,
|
24
24
|
and: () => and,
|
25
|
-
createEventConditionals: () => createEventConditionals,
|
26
25
|
createFieldConditionals: () => createFieldConditionals,
|
27
26
|
defineConditional: () => defineConditional,
|
28
27
|
defineFormConditional: () => defineFormConditional,
|
@@ -40,7 +39,8 @@ var SerializedUserField = import_zod.z.object({
|
|
40
39
|
"id",
|
41
40
|
"name",
|
42
41
|
"role",
|
43
|
-
"
|
42
|
+
"signature",
|
43
|
+
"avatar",
|
44
44
|
"primaryOfficeId"
|
45
45
|
])
|
46
46
|
});
|
@@ -112,41 +112,6 @@ var user = Object.assign(userSerializer, {
|
|
112
112
|
required: ["$user"]
|
113
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
|
-
}
|
138
|
-
}
|
139
|
-
},
|
140
|
-
required: ["actions"]
|
141
|
-
}
|
142
|
-
},
|
143
|
-
required: ["$event"]
|
144
|
-
})
|
145
|
-
};
|
146
|
-
}
|
147
|
-
function getDateFromNow(days) {
|
148
|
-
return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
|
149
|
-
}
|
150
115
|
function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
|
151
116
|
return {
|
152
117
|
type: "object",
|
@@ -165,6 +130,20 @@ function isFieldReference(value) {
|
|
165
130
|
return typeof value === "object" && value !== null && "$$field" in value;
|
166
131
|
}
|
167
132
|
function createFieldConditionals(fieldId) {
|
133
|
+
const getDayRange = (days, clause) => ({
|
134
|
+
type: "object",
|
135
|
+
properties: {
|
136
|
+
[fieldId]: {
|
137
|
+
type: "string",
|
138
|
+
format: "date",
|
139
|
+
daysFromNow: {
|
140
|
+
days,
|
141
|
+
clause
|
142
|
+
}
|
143
|
+
}
|
144
|
+
},
|
145
|
+
required: [fieldId]
|
146
|
+
});
|
168
147
|
const getDateRange = (date, clause) => ({
|
169
148
|
type: "object",
|
170
149
|
properties: {
|
@@ -183,12 +162,8 @@ function createFieldConditionals(fieldId) {
|
|
183
162
|
$$field: fieldId,
|
184
163
|
isAfter: () => ({
|
185
164
|
days: (days) => ({
|
186
|
-
inPast: () => defineFormConditional(
|
187
|
-
|
188
|
-
),
|
189
|
-
inFuture: () => defineFormConditional(
|
190
|
-
getDateRange(getDateFromNow(-days), "formatMinimum")
|
191
|
-
)
|
165
|
+
inPast: () => defineFormConditional(getDayRange(-days, "after")),
|
166
|
+
inFuture: () => defineFormConditional(getDayRange(days, "after"))
|
192
167
|
}),
|
193
168
|
date: (date) => {
|
194
169
|
if (isFieldReference(date)) {
|
@@ -203,16 +178,12 @@ function createFieldConditionals(fieldId) {
|
|
203
178
|
}
|
204
179
|
return defineFormConditional(getDateRange(date, "formatMinimum"));
|
205
180
|
},
|
206
|
-
now: () => defineFormConditional(getDateRange(
|
181
|
+
now: () => defineFormConditional(getDateRange({ $data: "/$now" }, "formatMinimum"))
|
207
182
|
}),
|
208
183
|
isBefore: () => ({
|
209
184
|
days: (days) => ({
|
210
|
-
inPast: () => defineFormConditional(
|
211
|
-
|
212
|
-
),
|
213
|
-
inFuture: () => defineFormConditional(
|
214
|
-
getDateRange(getDateFromNow(-days), "formatMaximum")
|
215
|
-
)
|
185
|
+
inPast: () => defineFormConditional(getDayRange(days, "before")),
|
186
|
+
inFuture: () => defineFormConditional(getDayRange(-days, "before"))
|
216
187
|
}),
|
217
188
|
date: (date) => {
|
218
189
|
if (isFieldReference(date)) {
|
@@ -227,7 +198,7 @@ function createFieldConditionals(fieldId) {
|
|
227
198
|
}
|
228
199
|
return defineFormConditional(getDateRange(date, "formatMaximum"));
|
229
200
|
},
|
230
|
-
now: () => defineFormConditional(getDateRange(
|
201
|
+
now: () => defineFormConditional(getDateRange({ $data: "/$now" }, "formatMaximum"))
|
231
202
|
}),
|
232
203
|
isEqualTo: (value) => {
|
233
204
|
if (isFieldReference(value)) {
|
@@ -316,11 +287,10 @@ function createFieldConditionals(fieldId) {
|
|
316
287
|
properties: {
|
317
288
|
[fieldId]: {
|
318
289
|
type: "string",
|
319
|
-
pattern: "^[\\p{Script=Latin}0-9'
|
320
|
-
description: "Name must contain only letters, numbers, and allowed special characters ('
|
290
|
+
pattern: "^[\\p{Script=Latin}0-9'.-]*(\\([\\p{Script=Latin}0-9'.-]+\\))?[\\p{Script=Latin}0-9'.-]*( [\\p{Script=Latin}0-9'.-]*(\\([\\p{Script=Latin}0-9'.-]+\\))?[\\p{Script=Latin}0-9'.-]*)*$",
|
291
|
+
description: "Name must contain only letters, numbers, and allowed special characters ('.-). No double spaces."
|
321
292
|
}
|
322
|
-
}
|
323
|
-
required: [fieldId]
|
293
|
+
}
|
324
294
|
}),
|
325
295
|
/**
|
326
296
|
* Checks if the field value matches a given regular expression pattern.
|