@opencrvs/toolkit 1.9.6-rc.e1907dc → 1.9.6-rc.e8f0bd3
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/events/FieldConfig.d.ts +12 -31
- package/dist/commons/events/FieldTypeMapping.d.ts +18 -0
- package/dist/commons/events/FieldValue.d.ts +1 -0
- package/dist/commons/events/TemplateConfig.d.ts +0 -2
- package/dist/conditionals/index.js +2 -6
- package/dist/events/index.js +11 -17
- package/dist/notification/index.js +4 -12
- package/package.json +1 -1
|
@@ -1768,20 +1768,12 @@ declare const DateField: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
1768
1768
|
analytics: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
1769
1769
|
}, {
|
|
1770
1770
|
type: z.ZodLiteral<"DATE">;
|
|
1771
|
-
defaultValue: z.ZodOptional<z.ZodUnion<[z.
|
|
1772
|
-
$$
|
|
1773
|
-
$$time: z.ZodOptional<z.ZodLiteral<"now">>;
|
|
1771
|
+
defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
1772
|
+
$$now: z.ZodLiteral<true>;
|
|
1774
1773
|
}, "strip", z.ZodTypeAny, {
|
|
1775
|
-
$$
|
|
1776
|
-
$$time?: "now" | undefined;
|
|
1777
|
-
}, {
|
|
1778
|
-
$$date?: "now" | undefined;
|
|
1779
|
-
$$time?: "now" | undefined;
|
|
1780
|
-
}>, {
|
|
1781
|
-
$$date: "now";
|
|
1774
|
+
$$now: true;
|
|
1782
1775
|
}, {
|
|
1783
|
-
$$
|
|
1784
|
-
$$time?: "now" | undefined;
|
|
1776
|
+
$$now: true;
|
|
1785
1777
|
}>, z.ZodString]>>;
|
|
1786
1778
|
configuration: z.ZodOptional<z.ZodObject<{
|
|
1787
1779
|
notice: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
|
@@ -1840,7 +1832,7 @@ declare const DateField: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
1840
1832
|
uncorrectable?: boolean | undefined;
|
|
1841
1833
|
analytics?: boolean | undefined;
|
|
1842
1834
|
defaultValue?: string | {
|
|
1843
|
-
$$
|
|
1835
|
+
$$now: true;
|
|
1844
1836
|
} | undefined;
|
|
1845
1837
|
configuration?: {
|
|
1846
1838
|
notice?: TranslationConfig | undefined;
|
|
@@ -1907,8 +1899,7 @@ declare const DateField: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
1907
1899
|
uncorrectable?: boolean | undefined;
|
|
1908
1900
|
analytics?: boolean | undefined;
|
|
1909
1901
|
defaultValue?: string | {
|
|
1910
|
-
$$
|
|
1911
|
-
$$time?: "now" | undefined;
|
|
1902
|
+
$$now: true;
|
|
1912
1903
|
} | undefined;
|
|
1913
1904
|
configuration?: {
|
|
1914
1905
|
notice?: {
|
|
@@ -2284,20 +2275,12 @@ declare const TimeField: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
2284
2275
|
analytics: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
2285
2276
|
}, {
|
|
2286
2277
|
type: z.ZodLiteral<"TIME">;
|
|
2287
|
-
defaultValue: z.ZodOptional<z.ZodUnion<[z.
|
|
2288
|
-
$$
|
|
2289
|
-
$$time: z.ZodOptional<z.ZodLiteral<"now">>;
|
|
2278
|
+
defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
2279
|
+
$$now: z.ZodLiteral<true>;
|
|
2290
2280
|
}, "strip", z.ZodTypeAny, {
|
|
2291
|
-
$$
|
|
2292
|
-
$$time?: "now" | undefined;
|
|
2293
|
-
}, {
|
|
2294
|
-
$$date?: "now" | undefined;
|
|
2295
|
-
$$time?: "now" | undefined;
|
|
2296
|
-
}>, {
|
|
2297
|
-
$$time: "now";
|
|
2281
|
+
$$now: true;
|
|
2298
2282
|
}, {
|
|
2299
|
-
$$
|
|
2300
|
-
$$time?: "now" | undefined;
|
|
2283
|
+
$$now: true;
|
|
2301
2284
|
}>, z.ZodString]>>;
|
|
2302
2285
|
configuration: z.ZodOptional<z.ZodObject<{
|
|
2303
2286
|
use12HourFormat: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -2359,7 +2342,7 @@ declare const TimeField: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
2359
2342
|
uncorrectable?: boolean | undefined;
|
|
2360
2343
|
analytics?: boolean | undefined;
|
|
2361
2344
|
defaultValue?: string | {
|
|
2362
|
-
$$
|
|
2345
|
+
$$now: true;
|
|
2363
2346
|
} | undefined;
|
|
2364
2347
|
configuration?: {
|
|
2365
2348
|
notice?: TranslationConfig | undefined;
|
|
@@ -2427,8 +2410,7 @@ declare const TimeField: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
2427
2410
|
uncorrectable?: boolean | undefined;
|
|
2428
2411
|
analytics?: boolean | undefined;
|
|
2429
2412
|
defaultValue?: string | {
|
|
2430
|
-
$$
|
|
2431
|
-
$$time?: "now" | undefined;
|
|
2413
|
+
$$now: true;
|
|
2432
2414
|
} | undefined;
|
|
2433
2415
|
configuration?: {
|
|
2434
2416
|
notice?: {
|
|
@@ -2440,7 +2422,6 @@ declare const TimeField: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
2440
2422
|
} | undefined;
|
|
2441
2423
|
}>;
|
|
2442
2424
|
export type TimeField = z.infer<typeof TimeField>;
|
|
2443
|
-
export type TimeField2 = z.input<typeof TimeField>;
|
|
2444
2425
|
declare const DateRangeField: z.ZodObject<z.objectUtil.extendShape<{
|
|
2445
2426
|
id: z.ZodEffects<z.ZodString, string, string>;
|
|
2446
2427
|
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
|
@@ -230,6 +230,15 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
|
|
|
230
230
|
}, {
|
|
231
231
|
data?: any;
|
|
232
232
|
}>>> | z.ZodObject<{
|
|
233
|
+
numericValue: z.ZodNumber;
|
|
234
|
+
unit: z.ZodString;
|
|
235
|
+
}, "strip", z.ZodTypeAny, {
|
|
236
|
+
numericValue: number;
|
|
237
|
+
unit: string;
|
|
238
|
+
}, {
|
|
239
|
+
numericValue: number;
|
|
240
|
+
unit: string;
|
|
241
|
+
}> | z.ZodObject<{
|
|
233
242
|
numericValue: z.ZodOptional<z.ZodNumber>;
|
|
234
243
|
unit: z.ZodOptional<z.ZodString>;
|
|
235
244
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -239,6 +248,15 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
|
|
|
239
248
|
numericValue?: number | undefined;
|
|
240
249
|
unit?: string | undefined;
|
|
241
250
|
}> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
251
|
+
numericValue: z.ZodNumber;
|
|
252
|
+
unit: z.ZodString;
|
|
253
|
+
}, "strip", z.ZodTypeAny, {
|
|
254
|
+
numericValue: number;
|
|
255
|
+
unit: string;
|
|
256
|
+
}, {
|
|
257
|
+
numericValue: number;
|
|
258
|
+
unit: string;
|
|
259
|
+
}>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
242
260
|
numericValue: z.ZodOptional<z.ZodNumber>;
|
|
243
261
|
unit: z.ZodOptional<z.ZodString>;
|
|
244
262
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -38,6 +38,7 @@ export declare const AgeUpdateValue: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
|
38
38
|
asOfDateRef: string;
|
|
39
39
|
}>>>;
|
|
40
40
|
export declare const TimeValue: z.ZodString;
|
|
41
|
+
export type TimeValue = z.infer<typeof TimeValue>;
|
|
41
42
|
export declare const DatetimeValue: z.ZodString;
|
|
42
43
|
export declare const SelectDateRangeValue: z.ZodEnum<["last7Days", "last30Days", "last90Days", "last365Days"]>;
|
|
43
44
|
export declare const DateRangeFieldValue: z.ZodUnion<[z.ZodObject<{
|
|
@@ -110,14 +110,10 @@ function omitKeyDeep(obj, keyToRemove) {
|
|
|
110
110
|
// ../commons/src/events/serializers/date/serializer.ts
|
|
111
111
|
var import_zod2 = require("zod");
|
|
112
112
|
var SerializedNowDateTime = import_zod2.z.object({
|
|
113
|
-
$$
|
|
114
|
-
$$time: import_zod2.z.literal("now").optional()
|
|
113
|
+
$$now: import_zod2.z.literal(true)
|
|
115
114
|
});
|
|
116
115
|
function todayDateTimeValueSerializer() {
|
|
117
|
-
return {
|
|
118
|
-
$$date: "now",
|
|
119
|
-
$$time: "now"
|
|
120
|
-
};
|
|
116
|
+
return { $$now: true };
|
|
121
117
|
}
|
|
122
118
|
|
|
123
119
|
// ../commons/src/conditionals/conditionals.ts
|
package/dist/events/index.js
CHANGED
|
@@ -1909,14 +1909,10 @@ var SearchScopeAccessLevels = {
|
|
|
1909
1909
|
// ../commons/src/events/serializers/date/serializer.ts
|
|
1910
1910
|
var import_zod15 = require("zod");
|
|
1911
1911
|
var SerializedNowDateTime = import_zod15.z.object({
|
|
1912
|
-
$$
|
|
1913
|
-
$$time: import_zod15.z.literal("now").optional()
|
|
1912
|
+
$$now: import_zod15.z.literal(true)
|
|
1914
1913
|
});
|
|
1915
1914
|
function todayDateTimeValueSerializer() {
|
|
1916
|
-
return {
|
|
1917
|
-
$$date: "now",
|
|
1918
|
-
$$time: "now"
|
|
1919
|
-
};
|
|
1915
|
+
return { $$now: true };
|
|
1920
1916
|
}
|
|
1921
1917
|
|
|
1922
1918
|
// ../commons/src/events/FieldConfig.ts
|
|
@@ -2052,9 +2048,7 @@ var EmailField = BaseField.extend({
|
|
|
2052
2048
|
});
|
|
2053
2049
|
var DateField = BaseField.extend({
|
|
2054
2050
|
type: import_zod16.z.literal(FieldType.DATE),
|
|
2055
|
-
defaultValue: SerializedNowDateTime.
|
|
2056
|
-
$$date: "now"
|
|
2057
|
-
})).or(DateValue).optional().openapi({ effectType: "input", type: "object" }).describe("Default date value(yyyy-MM-dd)"),
|
|
2051
|
+
defaultValue: SerializedNowDateTime.or(DateValue).optional().openapi({ effectType: "input", type: "string" }).describe("Default date value(yyyy-MM-dd)"),
|
|
2058
2052
|
configuration: import_zod16.z.object({
|
|
2059
2053
|
notice: TranslationConfig.describe(
|
|
2060
2054
|
"Text to display above the date input"
|
|
@@ -2072,9 +2066,7 @@ var AgeField = BaseField.extend({
|
|
|
2072
2066
|
}).describe("An age input field which uses the current date as the asOfDate");
|
|
2073
2067
|
var TimeField = BaseField.extend({
|
|
2074
2068
|
type: import_zod16.z.literal(FieldType.TIME),
|
|
2075
|
-
defaultValue: SerializedNowDateTime.
|
|
2076
|
-
$$time: "now"
|
|
2077
|
-
})).or(TimeValue).optional().openapi({ effectType: "input", type: "object" }).describe("Default time value (HH-mm)"),
|
|
2069
|
+
defaultValue: SerializedNowDateTime.or(TimeValue).optional().openapi({ effectType: "input", type: "object" }).describe("Default time value (HH-mm)"),
|
|
2078
2070
|
configuration: import_zod16.z.object({
|
|
2079
2071
|
use12HourFormat: import_zod16.z.boolean().optional().describe("Whether to use 12-hour format"),
|
|
2080
2072
|
notice: TranslationConfig.describe(
|
|
@@ -3017,7 +3009,7 @@ function mapFieldTypeToZod(field3, actionType) {
|
|
|
3017
3009
|
schema = NumberFieldValue;
|
|
3018
3010
|
break;
|
|
3019
3011
|
case FieldType.NUMBER_WITH_UNIT:
|
|
3020
|
-
schema = NumberWithUnitFieldUpdateValue;
|
|
3012
|
+
schema = field3.required ? NumberWithUnitFieldValue : NumberWithUnitFieldUpdateValue;
|
|
3021
3013
|
break;
|
|
3022
3014
|
case FieldType.CHECKBOX:
|
|
3023
3015
|
schema = CheckboxFieldValue;
|
|
@@ -3408,7 +3400,7 @@ function isFieldVisible(field3, form, context) {
|
|
|
3408
3400
|
}
|
|
3409
3401
|
function isFieldEmptyAndNotRequired(field3, form) {
|
|
3410
3402
|
const fieldValue = form[field3.id];
|
|
3411
|
-
return !field3.required && (fieldValue === void 0 || fieldValue === "");
|
|
3403
|
+
return !field3.required && (fieldValue === void 0 || fieldValue === "" || fieldValue && typeof fieldValue === "object" && Object.values(fieldValue).every((v) => v === void 0 || v === ""));
|
|
3412
3404
|
}
|
|
3413
3405
|
function isFieldEnabled(field3, form, context) {
|
|
3414
3406
|
return isFieldConditionMet(field3, form, ConditionalType.ENABLE, context);
|
|
@@ -3904,11 +3896,14 @@ function isRequestedAction(a) {
|
|
|
3904
3896
|
function isAcceptedAction(a) {
|
|
3905
3897
|
return a.status === ActionStatus.Accepted;
|
|
3906
3898
|
}
|
|
3899
|
+
function isRejectedAction(a) {
|
|
3900
|
+
return a.status === ActionStatus.Rejected;
|
|
3901
|
+
}
|
|
3907
3902
|
function getPendingAction(actions) {
|
|
3908
3903
|
const requestedActions = actions.filter(isRequestedAction);
|
|
3909
3904
|
const pendingActions = requestedActions.filter(
|
|
3910
3905
|
({ id }) => !actions.some(
|
|
3911
|
-
(action) => isAcceptedAction(action) && action.originalActionId === id
|
|
3906
|
+
(action) => (isAcceptedAction(action) || isRejectedAction(action)) && action.originalActionId === id
|
|
3912
3907
|
)
|
|
3913
3908
|
);
|
|
3914
3909
|
if (pendingActions.length !== 1) {
|
|
@@ -8907,8 +8902,7 @@ function isFieldValueWithoutTemplates(value) {
|
|
|
8907
8902
|
if (isTemplateVariable(value)) {
|
|
8908
8903
|
return false;
|
|
8909
8904
|
}
|
|
8910
|
-
if (typeof value === "object" && value !== null &&
|
|
8911
|
-
(Object.values(value).some((val) => isTemplateVariable(val)) || Object.keys(value).some((val) => isTemplateVariable(val)))) {
|
|
8905
|
+
if (typeof value === "object" && value !== null && Object.values(value).some((val) => isTemplateVariable(val))) {
|
|
8912
8906
|
return false;
|
|
8913
8907
|
}
|
|
8914
8908
|
return true;
|
|
@@ -1431,14 +1431,10 @@ var SearchQuery = import_zod14.z.object({
|
|
|
1431
1431
|
// ../commons/src/events/serializers/date/serializer.ts
|
|
1432
1432
|
var import_zod15 = require("zod");
|
|
1433
1433
|
var SerializedNowDateTime = import_zod15.z.object({
|
|
1434
|
-
$$
|
|
1435
|
-
$$time: import_zod15.z.literal("now").optional()
|
|
1434
|
+
$$now: import_zod15.z.literal(true)
|
|
1436
1435
|
});
|
|
1437
1436
|
function todayDateTimeValueSerializer() {
|
|
1438
|
-
return {
|
|
1439
|
-
$$date: "now",
|
|
1440
|
-
$$time: "now"
|
|
1441
|
-
};
|
|
1437
|
+
return { $$now: true };
|
|
1442
1438
|
}
|
|
1443
1439
|
|
|
1444
1440
|
// ../commons/src/events/FieldConfig.ts
|
|
@@ -1574,9 +1570,7 @@ var EmailField = BaseField.extend({
|
|
|
1574
1570
|
});
|
|
1575
1571
|
var DateField = BaseField.extend({
|
|
1576
1572
|
type: import_zod16.z.literal(FieldType.DATE),
|
|
1577
|
-
defaultValue: SerializedNowDateTime.
|
|
1578
|
-
$$date: "now"
|
|
1579
|
-
})).or(DateValue).optional().openapi({ effectType: "input", type: "object" }).describe("Default date value(yyyy-MM-dd)"),
|
|
1573
|
+
defaultValue: SerializedNowDateTime.or(DateValue).optional().openapi({ effectType: "input", type: "string" }).describe("Default date value(yyyy-MM-dd)"),
|
|
1580
1574
|
configuration: import_zod16.z.object({
|
|
1581
1575
|
notice: TranslationConfig.describe(
|
|
1582
1576
|
"Text to display above the date input"
|
|
@@ -1594,9 +1588,7 @@ var AgeField = BaseField.extend({
|
|
|
1594
1588
|
}).describe("An age input field which uses the current date as the asOfDate");
|
|
1595
1589
|
var TimeField = BaseField.extend({
|
|
1596
1590
|
type: import_zod16.z.literal(FieldType.TIME),
|
|
1597
|
-
defaultValue: SerializedNowDateTime.
|
|
1598
|
-
$$time: "now"
|
|
1599
|
-
})).or(TimeValue).optional().openapi({ effectType: "input", type: "object" }).describe("Default time value (HH-mm)"),
|
|
1591
|
+
defaultValue: SerializedNowDateTime.or(TimeValue).optional().openapi({ effectType: "input", type: "object" }).describe("Default time value (HH-mm)"),
|
|
1600
1592
|
configuration: import_zod16.z.object({
|
|
1601
1593
|
use12HourFormat: import_zod16.z.boolean().optional().describe("Whether to use 12-hour format"),
|
|
1602
1594
|
notice: TranslationConfig.describe(
|