@opencrvs/toolkit 1.8.1-rc.38945e7 → 1.8.1-rc.38ac682
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 +24 -0
- package/dist/commons/events/ActionConfig.d.ts +6654 -2652
- package/dist/commons/events/ActionDocument.d.ts +36 -0
- package/dist/commons/events/ActionInput.d.ts +36 -0
- package/dist/commons/events/EventConfig.d.ts +2726 -937
- package/dist/commons/events/EventDocument.d.ts +26 -0
- package/dist/commons/events/FieldConfig.d.ts +302 -2
- package/dist/commons/events/FieldType.d.ts +2 -1
- package/dist/commons/events/FieldTypeMapping.d.ts +9 -2
- package/dist/commons/events/FormConfig.d.ts +3566 -1688
- package/dist/commons/events/PageConfig.d.ts +462 -0
- package/dist/commons/events/defineConfig.d.ts +279 -0
- package/dist/commons/events/test.utils.d.ts +5 -1
- package/dist/commons/events/utils.d.ts +496 -0
- package/dist/events/index.js +33 -7
- package/package.json +1 -1
package/dist/events/index.js
CHANGED
@@ -297,6 +297,7 @@ __export(events_exports, {
|
|
297
297
|
isPageVisible: () => isPageVisible,
|
298
298
|
isParagraphFieldType: () => isParagraphFieldType,
|
299
299
|
isPhoneFieldType: () => isPhoneFieldType,
|
300
|
+
isPrintButtonFieldType: () => isPrintButtonFieldType,
|
300
301
|
isRadioGroupFieldType: () => isRadioGroupFieldType,
|
301
302
|
isSelectDateRangeFieldType: () => isSelectDateRangeFieldType,
|
302
303
|
isSelectFieldType: () => isSelectFieldType,
|
@@ -537,7 +538,8 @@ var FieldType = {
|
|
537
538
|
FACILITY: "FACILITY",
|
538
539
|
OFFICE: "OFFICE",
|
539
540
|
SIGNATURE: "SIGNATURE",
|
540
|
-
DATA: "DATA"
|
541
|
+
DATA: "DATA",
|
542
|
+
PRINT_BUTTON: "PRINT_BUTTON"
|
541
543
|
};
|
542
544
|
var fieldTypes = Object.values(FieldType);
|
543
545
|
var compositeFieldTypes = [
|
@@ -1004,6 +1006,15 @@ var DataField = BaseField.extend({
|
|
1004
1006
|
data: import_zod7.z.array(DataEntry)
|
1005
1007
|
})
|
1006
1008
|
}).describe("Data field for displaying read-only data");
|
1009
|
+
var PrintButton = BaseField.extend({
|
1010
|
+
type: import_zod7.z.literal(FieldType.PRINT_BUTTON),
|
1011
|
+
configuration: import_zod7.z.object({
|
1012
|
+
template: import_zod7.z.string().describe("Template ID from countryconfig templates to use for printing"),
|
1013
|
+
buttonLabel: TranslationConfig.optional().describe(
|
1014
|
+
"Label for the print button"
|
1015
|
+
)
|
1016
|
+
})
|
1017
|
+
}).describe("Print button field for printing certificates");
|
1007
1018
|
var FieldConfig = import_zod7.z.discriminatedUnion("type", [
|
1008
1019
|
Address,
|
1009
1020
|
TextField,
|
@@ -1032,7 +1043,8 @@ var FieldConfig = import_zod7.z.discriminatedUnion("type", [
|
|
1032
1043
|
SignatureField,
|
1033
1044
|
EmailField,
|
1034
1045
|
FileUploadWithOptions,
|
1035
|
-
DataField
|
1046
|
+
DataField,
|
1047
|
+
PrintButton
|
1036
1048
|
]).openapi({
|
1037
1049
|
description: "Form field configuration",
|
1038
1050
|
ref: "FieldConfig"
|
@@ -1980,7 +1992,8 @@ var ApprovedCorrectionAction = ActionBase.merge(
|
|
1980
1992
|
var RejectedCorrectionAction = ActionBase.merge(
|
1981
1993
|
import_zod19.z.object({
|
1982
1994
|
type: import_zod19.z.literal(ActionType.REJECT_CORRECTION),
|
1983
|
-
requestId: import_zod19.z.string()
|
1995
|
+
requestId: import_zod19.z.string(),
|
1996
|
+
reason: RejectionReason
|
1984
1997
|
})
|
1985
1998
|
);
|
1986
1999
|
var ReadAction = ActionBase.merge(
|
@@ -2093,6 +2106,9 @@ function mapFieldTypeToZod(type, required) {
|
|
2093
2106
|
case FieldType.NAME:
|
2094
2107
|
schema = required ? NameFieldValue : NameFieldUpdateValue;
|
2095
2108
|
break;
|
2109
|
+
case FieldType.PRINT_BUTTON:
|
2110
|
+
schema = TextValue;
|
2111
|
+
break;
|
2096
2112
|
}
|
2097
2113
|
return required ? schema : schema.nullish();
|
2098
2114
|
}
|
@@ -2153,6 +2169,8 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
2153
2169
|
};
|
2154
2170
|
case FieldType.FILE_WITH_OPTIONS:
|
2155
2171
|
return [];
|
2172
|
+
case FieldType.PRINT_BUTTON:
|
2173
|
+
return null;
|
2156
2174
|
}
|
2157
2175
|
}
|
2158
2176
|
var isParagraphFieldType = (field2) => {
|
@@ -2239,6 +2257,9 @@ var isOfficeFieldType = (field2) => {
|
|
2239
2257
|
var isDataFieldType = (field2) => {
|
2240
2258
|
return field2.config.type === FieldType.DATA;
|
2241
2259
|
};
|
2260
|
+
var isPrintButtonFieldType = (field2) => {
|
2261
|
+
return field2.config.type === FieldType.PRINT_BUTTON;
|
2262
|
+
};
|
2242
2263
|
var isNonInteractiveFieldType = (field2) => {
|
2243
2264
|
return field2.type === FieldType.DIVIDER || field2.type === FieldType.PAGE_HEADER || field2.type === FieldType.PARAGRAPH || field2.type === FieldType.BULLET_LIST || field2.type === FieldType.DATA;
|
2244
2265
|
};
|
@@ -3916,7 +3937,8 @@ var RequestCorrectionActionInput = BaseActionInput.merge(
|
|
3916
3937
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
3917
3938
|
import_zod29.z.object({
|
3918
3939
|
requestId: import_zod29.z.string(),
|
3919
|
-
type: import_zod29.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
|
3940
|
+
type: import_zod29.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
|
3941
|
+
reason: RejectionReason
|
3920
3942
|
})
|
3921
3943
|
);
|
3922
3944
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
@@ -6481,6 +6503,8 @@ function mapFieldTypeToMockValue(field2, i, rng) {
|
|
6481
6503
|
return "2021-01-01";
|
6482
6504
|
case FieldType.TIME:
|
6483
6505
|
return "09:33";
|
6506
|
+
case FieldType.PRINT_BUTTON:
|
6507
|
+
return void 0;
|
6484
6508
|
case FieldType.DATE_RANGE:
|
6485
6509
|
return {
|
6486
6510
|
start: "2021-01-01",
|
@@ -6755,7 +6779,7 @@ function eventPayloadGenerator(rng) {
|
|
6755
6779
|
requestId,
|
6756
6780
|
keepAssignment: input.keepAssignment
|
6757
6781
|
}),
|
6758
|
-
reject: (eventId, requestId, input
|
6782
|
+
reject: (eventId, requestId, input) => ({
|
6759
6783
|
type: ActionType.REJECT_CORRECTION,
|
6760
6784
|
transactionId: input.transactionId ?? getUUID(),
|
6761
6785
|
declaration: {},
|
@@ -6766,7 +6790,8 @@ function eventPayloadGenerator(rng) {
|
|
6766
6790
|
),
|
6767
6791
|
eventId,
|
6768
6792
|
requestId,
|
6769
|
-
keepAssignment: input.keepAssignment
|
6793
|
+
keepAssignment: input.keepAssignment,
|
6794
|
+
reason: input.reason ?? { message: "" }
|
6770
6795
|
})
|
6771
6796
|
}
|
6772
6797
|
}
|
@@ -6825,7 +6850,8 @@ function generateActionDocument({
|
|
6825
6850
|
return {
|
6826
6851
|
...actionBase,
|
6827
6852
|
requestId: getUUID(),
|
6828
|
-
type: action
|
6853
|
+
type: action,
|
6854
|
+
reason: { message: "Correction rejection" }
|
6829
6855
|
};
|
6830
6856
|
case ActionType.REGISTER:
|
6831
6857
|
return {
|