@opencrvs/toolkit 1.8.0-rc.f8e4107 → 1.8.0-rc.f97f8f2
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 +8418 -4827
- package/dist/commons/conditionals/conditionals.d.ts +9 -70
- package/dist/commons/conditionals/validate.d.ts +4 -6
- package/dist/commons/events/ActionConfig.d.ts +90025 -1680
- package/dist/commons/events/ActionDocument.d.ts +643 -417
- package/dist/commons/events/ActionInput.d.ts +248 -240
- package/dist/commons/events/AdvancedSearchConfig.d.ts +274 -23
- package/dist/commons/events/CompositeFieldValue.d.ts +3 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +1506 -0
- package/dist/commons/events/Draft.d.ts +38 -30
- package/dist/commons/events/EventConfig.d.ts +42787 -1385
- package/dist/commons/events/EventDocument.d.ts +413 -312
- package/dist/commons/events/EventIndex.d.ts +948 -155
- package/dist/commons/events/EventInput.d.ts +13 -0
- package/dist/commons/events/EventMetadata.d.ts +274 -11
- package/dist/commons/events/FieldConfig.d.ts +3778 -769
- package/dist/commons/events/FieldType.d.ts +3 -3
- package/dist/commons/events/FieldTypeMapping.d.ts +11 -4
- package/dist/commons/events/FieldValue.d.ts +7 -4
- package/dist/commons/events/FormConfig.d.ts +40417 -439
- package/dist/commons/events/PageConfig.d.ts +10077 -203
- package/dist/commons/events/SummaryConfig.d.ts +95 -39
- package/dist/commons/events/User.d.ts +31 -2
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +42 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +2834 -19
- package/dist/commons/events/defineConfig.d.ts +7008 -81
- package/dist/commons/events/event.d.ts +27 -0
- package/dist/commons/events/field.d.ts +68 -0
- package/dist/commons/events/index.d.ts +6 -0
- package/dist/commons/events/scopes.d.ts +26 -0
- package/dist/commons/events/serializer.d.ts +2 -0
- package/dist/commons/events/test.utils.d.ts +7 -44
- package/dist/commons/events/utils.d.ts +3551 -65
- package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
- package/dist/conditionals/index.js +54 -83
- package/dist/events/index.js +2044 -1072
- package/dist/scopes/index.d.ts +105 -1
- package/dist/scopes/index.js +140 -0
- package/package.json +3 -2
@@ -22,11 +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
|
-
eventField: () => eventField,
|
29
|
-
field: () => field,
|
30
29
|
never: () => never,
|
31
30
|
not: () => not,
|
32
31
|
or: () => or,
|
@@ -34,6 +33,23 @@ __export(conditionals_exports, {
|
|
34
33
|
});
|
35
34
|
module.exports = __toCommonJS(conditionals_exports);
|
36
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
|
+
|
37
53
|
// ../commons/src/conditionals/conditionals.ts
|
38
54
|
function defineConditional(schema) {
|
39
55
|
return schema;
|
@@ -75,7 +91,7 @@ function not(condition) {
|
|
75
91
|
function never() {
|
76
92
|
return not(alwaysTrue());
|
77
93
|
}
|
78
|
-
var user = {
|
94
|
+
var user = Object.assign(userSerializer, {
|
79
95
|
hasScope: (scope) => defineConditional({
|
80
96
|
type: "object",
|
81
97
|
properties: {
|
@@ -95,33 +111,39 @@ var user = {
|
|
95
111
|
},
|
96
112
|
required: ["$user"]
|
97
113
|
})
|
98
|
-
};
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
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
|
+
}
|
116
138
|
}
|
117
|
-
}
|
118
|
-
|
119
|
-
|
120
|
-
}
|
121
|
-
|
122
|
-
|
123
|
-
}
|
124
|
-
}
|
139
|
+
},
|
140
|
+
required: ["actions"]
|
141
|
+
}
|
142
|
+
},
|
143
|
+
required: ["$event"]
|
144
|
+
})
|
145
|
+
};
|
146
|
+
}
|
125
147
|
function getDateFromNow(days) {
|
126
148
|
return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
|
127
149
|
}
|
@@ -142,7 +164,7 @@ function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
|
|
142
164
|
function isFieldReference(value) {
|
143
165
|
return typeof value === "object" && value !== null && "_fieldId" in value;
|
144
166
|
}
|
145
|
-
function
|
167
|
+
function createFieldConditionals(fieldId) {
|
146
168
|
const getDateRange = (date, clause) => ({
|
147
169
|
type: "object",
|
148
170
|
properties: {
|
@@ -155,10 +177,6 @@ function field(fieldId) {
|
|
155
177
|
required: [fieldId]
|
156
178
|
});
|
157
179
|
return {
|
158
|
-
/**
|
159
|
-
* @private Internal property used for field reference tracking.
|
160
|
-
*/
|
161
|
-
_fieldId: fieldId,
|
162
180
|
isAfter: () => ({
|
163
181
|
days: (days) => ({
|
164
182
|
inPast: () => defineFormConditional(
|
@@ -326,53 +344,6 @@ function field(fieldId) {
|
|
326
344
|
},
|
327
345
|
required: [fieldId]
|
328
346
|
}),
|
329
|
-
|
330
|
-
* Creates a range configuration for the specified field.
|
331
|
-
*
|
332
|
-
* @returns An object containing the field ID and a configuration object with a type of 'RANGE'.
|
333
|
-
*
|
334
|
-
* @example field('age').range()
|
335
|
-
* // {
|
336
|
-
* // fieldId: 'age',
|
337
|
-
* // config: { type: 'RANGE' }
|
338
|
-
* // }
|
339
|
-
*/
|
340
|
-
range: () => ({
|
341
|
-
fieldId,
|
342
|
-
config: { type: "RANGE" }
|
343
|
-
}),
|
344
|
-
/**
|
345
|
-
* Creates a configuration for exact matching of the specified field.
|
346
|
-
* @returns An object containing the field ID and a configuration object with a type of 'EXACT'.
|
347
|
-
* @example field('dob').exact()
|
348
|
-
* // {
|
349
|
-
* // fieldId: 'dob',
|
350
|
-
* // config: { type: 'EXACT' }
|
351
|
-
* // }
|
352
|
-
*/
|
353
|
-
exact: () => ({
|
354
|
-
fieldId,
|
355
|
-
config: { type: "EXACT" }
|
356
|
-
}),
|
357
|
-
/**
|
358
|
-
* Creates a configuration for fuzzy matching of the specified field.
|
359
|
-
* @returns An object containing the field ID and a configuration object with a type of 'EXACT'.
|
360
|
-
* @example field('name').fuzzy()
|
361
|
-
* // {
|
362
|
-
* // fieldId: 'name',
|
363
|
-
* // config: { type: 'FUZZY' }
|
364
|
-
* // }
|
365
|
-
*/
|
366
|
-
fuzzy: () => ({
|
367
|
-
fieldId,
|
368
|
-
config: { type: "FUZZY" }
|
369
|
-
})
|
370
|
-
};
|
371
|
-
}
|
372
|
-
function eventField(fieldId, options) {
|
373
|
-
return {
|
374
|
-
fieldId,
|
375
|
-
options,
|
376
|
-
config: { type: "EXACT" }
|
347
|
+
getId: () => ({ fieldId })
|
377
348
|
};
|
378
349
|
}
|