@opencrvs/toolkit 1.8.1-rc.25f3d5c → 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 -404
- package/dist/commons/events/ActionConfig.d.ts +6654 -2652
- package/dist/commons/events/ActionDocument.d.ts +36 -659
- package/dist/commons/events/ActionInput.d.ts +36 -540
- package/dist/commons/events/Draft.d.ts +0 -44
- package/dist/commons/events/EventConfig.d.ts +2726 -937
- package/dist/commons/events/EventDocument.d.ts +26 -416
- 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 -4
- package/dist/events/index.js +33 -14
- package/package.json +1 -1
package/dist/events/index.js
CHANGED
@@ -39,7 +39,6 @@ __export(events_exports, {
|
|
39
39
|
ActionConfig: () => ActionConfig,
|
40
40
|
ActionConfigBase: () => ActionConfigBase,
|
41
41
|
ActionCreationMetadata: () => ActionCreationMetadata,
|
42
|
-
ActionDetails: () => ActionDetails,
|
43
42
|
ActionDocument: () => ActionDocument,
|
44
43
|
ActionFormConfig: () => ActionFormConfig,
|
45
44
|
ActionInput: () => ActionInput,
|
@@ -298,6 +297,7 @@ __export(events_exports, {
|
|
298
297
|
isPageVisible: () => isPageVisible,
|
299
298
|
isParagraphFieldType: () => isParagraphFieldType,
|
300
299
|
isPhoneFieldType: () => isPhoneFieldType,
|
300
|
+
isPrintButtonFieldType: () => isPrintButtonFieldType,
|
301
301
|
isRadioGroupFieldType: () => isRadioGroupFieldType,
|
302
302
|
isSelectDateRangeFieldType: () => isSelectDateRangeFieldType,
|
303
303
|
isSelectFieldType: () => isSelectFieldType,
|
@@ -538,7 +538,8 @@ var FieldType = {
|
|
538
538
|
FACILITY: "FACILITY",
|
539
539
|
OFFICE: "OFFICE",
|
540
540
|
SIGNATURE: "SIGNATURE",
|
541
|
-
DATA: "DATA"
|
541
|
+
DATA: "DATA",
|
542
|
+
PRINT_BUTTON: "PRINT_BUTTON"
|
542
543
|
};
|
543
544
|
var fieldTypes = Object.values(FieldType);
|
544
545
|
var compositeFieldTypes = [
|
@@ -1005,6 +1006,15 @@ var DataField = BaseField.extend({
|
|
1005
1006
|
data: import_zod7.z.array(DataEntry)
|
1006
1007
|
})
|
1007
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");
|
1008
1018
|
var FieldConfig = import_zod7.z.discriminatedUnion("type", [
|
1009
1019
|
Address,
|
1010
1020
|
TextField,
|
@@ -1033,7 +1043,8 @@ var FieldConfig = import_zod7.z.discriminatedUnion("type", [
|
|
1033
1043
|
SignatureField,
|
1034
1044
|
EmailField,
|
1035
1045
|
FileUploadWithOptions,
|
1036
|
-
DataField
|
1046
|
+
DataField,
|
1047
|
+
PrintButton
|
1037
1048
|
]).openapi({
|
1038
1049
|
description: "Form field configuration",
|
1039
1050
|
ref: "FieldConfig"
|
@@ -1883,10 +1894,6 @@ var ActionStatus = {
|
|
1883
1894
|
Accepted: "Accepted",
|
1884
1895
|
Rejected: "Rejected"
|
1885
1896
|
};
|
1886
|
-
var ActionDetails = import_zod19.z.object({
|
1887
|
-
templateId: import_zod19.z.string().optional(),
|
1888
|
-
isImmediateCorrection: import_zod19.z.boolean().optional()
|
1889
|
-
});
|
1890
1897
|
var ActionBase = import_zod19.z.object({
|
1891
1898
|
id: UUID,
|
1892
1899
|
transactionId: import_zod19.z.string(),
|
@@ -1898,7 +1905,6 @@ var ActionBase = import_zod19.z.object({
|
|
1898
1905
|
createdAtLocation: CreatedAtLocation,
|
1899
1906
|
declaration: ActionUpdate,
|
1900
1907
|
annotation: ActionUpdate.optional().nullable(),
|
1901
|
-
actionDetails: ActionDetails.optional().nullable(),
|
1902
1908
|
status: import_zod19.z.enum([
|
1903
1909
|
ActionStatus.Requested,
|
1904
1910
|
ActionStatus.Accepted,
|
@@ -1986,7 +1992,8 @@ var ApprovedCorrectionAction = ActionBase.merge(
|
|
1986
1992
|
var RejectedCorrectionAction = ActionBase.merge(
|
1987
1993
|
import_zod19.z.object({
|
1988
1994
|
type: import_zod19.z.literal(ActionType.REJECT_CORRECTION),
|
1989
|
-
requestId: import_zod19.z.string()
|
1995
|
+
requestId: import_zod19.z.string(),
|
1996
|
+
reason: RejectionReason
|
1990
1997
|
})
|
1991
1998
|
);
|
1992
1999
|
var ReadAction = ActionBase.merge(
|
@@ -2099,6 +2106,9 @@ function mapFieldTypeToZod(type, required) {
|
|
2099
2106
|
case FieldType.NAME:
|
2100
2107
|
schema = required ? NameFieldValue : NameFieldUpdateValue;
|
2101
2108
|
break;
|
2109
|
+
case FieldType.PRINT_BUTTON:
|
2110
|
+
schema = TextValue;
|
2111
|
+
break;
|
2102
2112
|
}
|
2103
2113
|
return required ? schema : schema.nullish();
|
2104
2114
|
}
|
@@ -2159,6 +2169,8 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
2159
2169
|
};
|
2160
2170
|
case FieldType.FILE_WITH_OPTIONS:
|
2161
2171
|
return [];
|
2172
|
+
case FieldType.PRINT_BUTTON:
|
2173
|
+
return null;
|
2162
2174
|
}
|
2163
2175
|
}
|
2164
2176
|
var isParagraphFieldType = (field2) => {
|
@@ -2245,6 +2257,9 @@ var isOfficeFieldType = (field2) => {
|
|
2245
2257
|
var isDataFieldType = (field2) => {
|
2246
2258
|
return field2.config.type === FieldType.DATA;
|
2247
2259
|
};
|
2260
|
+
var isPrintButtonFieldType = (field2) => {
|
2261
|
+
return field2.config.type === FieldType.PRINT_BUTTON;
|
2262
|
+
};
|
2248
2263
|
var isNonInteractiveFieldType = (field2) => {
|
2249
2264
|
return field2.type === FieldType.DIVIDER || field2.type === FieldType.PAGE_HEADER || field2.type === FieldType.PARAGRAPH || field2.type === FieldType.BULLET_LIST || field2.type === FieldType.DATA;
|
2250
2265
|
};
|
@@ -3840,7 +3855,6 @@ var BaseActionInput = import_zod29.z.object({
|
|
3840
3855
|
transactionId: import_zod29.z.string(),
|
3841
3856
|
declaration: ActionUpdate.default({}),
|
3842
3857
|
annotation: ActionUpdate.optional(),
|
3843
|
-
actionDetails: ActionDetails.optional(),
|
3844
3858
|
originalActionId: UUID.optional(),
|
3845
3859
|
// should not be part of base action.
|
3846
3860
|
keepAssignment: import_zod29.z.boolean().optional()
|
@@ -3923,7 +3937,8 @@ var RequestCorrectionActionInput = BaseActionInput.merge(
|
|
3923
3937
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
3924
3938
|
import_zod29.z.object({
|
3925
3939
|
requestId: import_zod29.z.string(),
|
3926
|
-
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
|
3927
3942
|
})
|
3928
3943
|
);
|
3929
3944
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
@@ -6488,6 +6503,8 @@ function mapFieldTypeToMockValue(field2, i, rng) {
|
|
6488
6503
|
return "2021-01-01";
|
6489
6504
|
case FieldType.TIME:
|
6490
6505
|
return "09:33";
|
6506
|
+
case FieldType.PRINT_BUTTON:
|
6507
|
+
return void 0;
|
6491
6508
|
case FieldType.DATE_RANGE:
|
6492
6509
|
return {
|
6493
6510
|
start: "2021-01-01",
|
@@ -6762,7 +6779,7 @@ function eventPayloadGenerator(rng) {
|
|
6762
6779
|
requestId,
|
6763
6780
|
keepAssignment: input.keepAssignment
|
6764
6781
|
}),
|
6765
|
-
reject: (eventId, requestId, input
|
6782
|
+
reject: (eventId, requestId, input) => ({
|
6766
6783
|
type: ActionType.REJECT_CORRECTION,
|
6767
6784
|
transactionId: input.transactionId ?? getUUID(),
|
6768
6785
|
declaration: {},
|
@@ -6773,7 +6790,8 @@ function eventPayloadGenerator(rng) {
|
|
6773
6790
|
),
|
6774
6791
|
eventId,
|
6775
6792
|
requestId,
|
6776
|
-
keepAssignment: input.keepAssignment
|
6793
|
+
keepAssignment: input.keepAssignment,
|
6794
|
+
reason: input.reason ?? { message: "" }
|
6777
6795
|
})
|
6778
6796
|
}
|
6779
6797
|
}
|
@@ -6832,7 +6850,8 @@ function generateActionDocument({
|
|
6832
6850
|
return {
|
6833
6851
|
...actionBase,
|
6834
6852
|
requestId: getUUID(),
|
6835
|
-
type: action
|
6853
|
+
type: action,
|
6854
|
+
reason: { message: "Correction rejection" }
|
6836
6855
|
};
|
6837
6856
|
case ActionType.REGISTER:
|
6838
6857
|
return {
|