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