@opencrvs/toolkit 1.8.0-rc.fe4d9d5 → 1.8.0-rc.fe7c504
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 +1335 -10468
- package/dist/commons/events/ActionConfig.d.ts +2600 -0
- package/dist/commons/events/ActionDocument.d.ts +1081 -1087
- package/dist/commons/events/ActionInput.d.ts +726 -726
- package/dist/commons/events/ActionType.d.ts +0 -2
- package/dist/commons/events/AdvancedSearchConfig.d.ts +222 -18
- package/dist/commons/events/CompositeFieldValue.d.ts +6 -6
- package/dist/commons/events/CountryConfigQueryInput.d.ts +1234 -572
- package/dist/commons/events/CreatedAtLocation.d.ts +1 -2
- package/dist/commons/events/Draft.d.ts +77 -77
- package/dist/commons/events/EventConfig.d.ts +1458 -0
- package/dist/commons/events/EventDocument.d.ts +706 -711
- package/dist/commons/events/EventIndex.d.ts +135 -151
- package/dist/commons/events/EventMetadata.d.ts +38 -29
- package/dist/commons/events/FieldConfig.d.ts +178 -0
- package/dist/commons/events/FieldTypeMapping.d.ts +16 -16
- package/dist/commons/events/FieldValue.d.ts +12 -12
- package/dist/commons/events/FormConfig.d.ts +1092 -0
- package/dist/commons/events/PageConfig.d.ts +260 -0
- package/dist/commons/events/User.d.ts +6 -3
- package/dist/commons/events/WorkqueueConfig.d.ts +2043 -1033
- package/dist/commons/events/defineConfig.d.ts +294 -0
- package/dist/commons/events/field.d.ts +5 -0
- package/dist/commons/events/test.utils.d.ts +30 -19
- package/dist/commons/events/transactions.d.ts +1 -1
- package/dist/commons/events/utils.d.ts +440 -15
- package/dist/conditionals/index.js +22 -18
- package/dist/events/index.js +303 -185
- package/dist/scopes/index.d.ts +92 -6
- package/dist/scopes/index.js +38 -9
- package/package.json +3 -3
@@ -40,7 +40,8 @@ var SerializedUserField = import_zod.z.object({
|
|
40
40
|
"id",
|
41
41
|
"name",
|
42
42
|
"role",
|
43
|
-
"
|
43
|
+
"signature",
|
44
|
+
"avatar",
|
44
45
|
"primaryOfficeId"
|
45
46
|
])
|
46
47
|
});
|
@@ -144,9 +145,6 @@ function createEventConditionals() {
|
|
144
145
|
})
|
145
146
|
};
|
146
147
|
}
|
147
|
-
function getDateFromNow(days) {
|
148
|
-
return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
|
149
|
-
}
|
150
148
|
function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
|
151
149
|
return {
|
152
150
|
type: "object",
|
@@ -165,6 +163,20 @@ function isFieldReference(value) {
|
|
165
163
|
return typeof value === "object" && value !== null && "$$field" in value;
|
166
164
|
}
|
167
165
|
function createFieldConditionals(fieldId) {
|
166
|
+
const getDayRange = (days, clause) => ({
|
167
|
+
type: "object",
|
168
|
+
properties: {
|
169
|
+
[fieldId]: {
|
170
|
+
type: "string",
|
171
|
+
format: "date",
|
172
|
+
daysFromNow: {
|
173
|
+
days,
|
174
|
+
clause
|
175
|
+
}
|
176
|
+
}
|
177
|
+
},
|
178
|
+
required: [fieldId]
|
179
|
+
});
|
168
180
|
const getDateRange = (date, clause) => ({
|
169
181
|
type: "object",
|
170
182
|
properties: {
|
@@ -183,12 +195,8 @@ function createFieldConditionals(fieldId) {
|
|
183
195
|
$$field: fieldId,
|
184
196
|
isAfter: () => ({
|
185
197
|
days: (days) => ({
|
186
|
-
inPast: () => defineFormConditional(
|
187
|
-
|
188
|
-
),
|
189
|
-
inFuture: () => defineFormConditional(
|
190
|
-
getDateRange(getDateFromNow(-days), "formatMinimum")
|
191
|
-
)
|
198
|
+
inPast: () => defineFormConditional(getDayRange(-days, "after")),
|
199
|
+
inFuture: () => defineFormConditional(getDayRange(days, "after"))
|
192
200
|
}),
|
193
201
|
date: (date) => {
|
194
202
|
if (isFieldReference(date)) {
|
@@ -203,16 +211,12 @@ function createFieldConditionals(fieldId) {
|
|
203
211
|
}
|
204
212
|
return defineFormConditional(getDateRange(date, "formatMinimum"));
|
205
213
|
},
|
206
|
-
now: () => defineFormConditional(getDateRange(
|
214
|
+
now: () => defineFormConditional(getDateRange({ $data: "/$now" }, "formatMinimum"))
|
207
215
|
}),
|
208
216
|
isBefore: () => ({
|
209
217
|
days: (days) => ({
|
210
|
-
inPast: () => defineFormConditional(
|
211
|
-
|
212
|
-
),
|
213
|
-
inFuture: () => defineFormConditional(
|
214
|
-
getDateRange(getDateFromNow(-days), "formatMaximum")
|
215
|
-
)
|
218
|
+
inPast: () => defineFormConditional(getDayRange(days, "before")),
|
219
|
+
inFuture: () => defineFormConditional(getDayRange(-days, "before"))
|
216
220
|
}),
|
217
221
|
date: (date) => {
|
218
222
|
if (isFieldReference(date)) {
|
@@ -227,7 +231,7 @@ function createFieldConditionals(fieldId) {
|
|
227
231
|
}
|
228
232
|
return defineFormConditional(getDateRange(date, "formatMaximum"));
|
229
233
|
},
|
230
|
-
now: () => defineFormConditional(getDateRange(
|
234
|
+
now: () => defineFormConditional(getDateRange({ $data: "/$now" }, "formatMaximum"))
|
231
235
|
}),
|
232
236
|
isEqualTo: (value) => {
|
233
237
|
if (isFieldReference(value)) {
|