@opencrvs/toolkit 1.8.0-rc.f9911ed → 1.8.0-rc.faacbde
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/README.md +1 -1
- package/dist/commons/api/router.d.ts +872 -1303
- package/dist/commons/conditionals/conditionals.d.ts +7 -0
- package/dist/commons/events/ActionConfig.d.ts +1255 -6456
- package/dist/commons/events/ActionDocument.d.ts +173 -173
- package/dist/commons/events/ActionInput.d.ts +1016 -228
- package/dist/commons/events/ActionType.d.ts +23 -16
- package/dist/commons/events/Draft.d.ts +32 -33
- package/dist/commons/events/EventConfig.d.ts +614 -2837
- package/dist/commons/events/EventConfigInput.d.ts +5 -2
- package/dist/commons/events/EventDocument.d.ts +275 -275
- package/dist/commons/events/EventIndex.d.ts +3 -3
- package/dist/commons/events/FieldConfig.d.ts +84 -22
- package/dist/commons/events/FormConfig.d.ts +520 -273
- package/dist/commons/events/PageConfig.d.ts +359 -0
- package/dist/commons/events/defineConfig.d.ts +34 -411
- package/dist/commons/events/index.d.ts +2 -1
- package/dist/commons/events/test.utils.d.ts +52 -182
- package/dist/commons/events/utils.d.ts +38 -153
- package/dist/conditionals/index.js +38 -0
- package/dist/events/index.js +717 -605
- package/package.json +1 -1
package/dist/events/index.js
CHANGED
@@ -35,8 +35,10 @@ __export(events_exports, {
|
|
35
35
|
ActionConfig: () => ActionConfig,
|
36
36
|
ActionConfigBase: () => ActionConfigBase,
|
37
37
|
ActionDocument: () => ActionDocument,
|
38
|
+
ActionFormConfig: () => ActionFormConfig,
|
38
39
|
ActionInput: () => ActionInput,
|
39
40
|
ActionType: () => ActionType,
|
41
|
+
ActionTypes: () => ActionTypes,
|
40
42
|
ActionUpdate: () => ActionUpdate,
|
41
43
|
AddressFieldUpdateValue: () => AddressFieldUpdateValue,
|
42
44
|
AddressFieldValue: () => AddressFieldValue,
|
@@ -52,8 +54,14 @@ __export(events_exports, {
|
|
52
54
|
Clause: () => Clause,
|
53
55
|
Conditional: () => Conditional,
|
54
56
|
ConditionalType: () => ConditionalType,
|
57
|
+
DataEntry: () => DataEntry,
|
55
58
|
DataFieldValue: () => DataFieldValue,
|
56
59
|
DateValue: () => DateValue,
|
60
|
+
DeclarationActionConfig: () => DeclarationActionConfig,
|
61
|
+
DeclarationActions: () => DeclarationActions,
|
62
|
+
DeclarationFormConfig: () => DeclarationFormConfig,
|
63
|
+
DeclarationReviewConfig: () => DeclarationReviewConfig,
|
64
|
+
DeclarationUpdateActions: () => DeclarationUpdateActions,
|
57
65
|
DeclareActionInput: () => DeclareActionInput,
|
58
66
|
DeduplicationConfig: () => DeduplicationConfig,
|
59
67
|
Draft: () => Draft,
|
@@ -77,20 +85,21 @@ __export(events_exports, {
|
|
77
85
|
FileFieldValueWithOption: () => FileFieldValueWithOption,
|
78
86
|
FileFieldWithOptionValue: () => FileFieldWithOptionValue,
|
79
87
|
FormConfig: () => FormConfig,
|
80
|
-
FormPage: () => FormPage,
|
81
88
|
FormPageConfig: () => FormPageConfig,
|
82
|
-
FormPageType: () => FormPageType,
|
83
89
|
GenericAddressUpdateValue: () => GenericAddressUpdateValue,
|
84
90
|
GenericAddressValue: () => GenericAddressValue,
|
85
91
|
GeographicalArea: () => GeographicalArea,
|
86
92
|
ImageMimeType: () => ImageMimeType,
|
87
93
|
LanguageConfig: () => LanguageConfig,
|
88
|
-
LatentActions: () => LatentActions,
|
89
94
|
MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
|
90
95
|
MimeType: () => MimeType,
|
91
96
|
NotifyActionInput: () => NotifyActionInput,
|
92
97
|
NumberFieldValue: () => NumberFieldValue,
|
98
|
+
PageConfig: () => PageConfig,
|
99
|
+
PageConfigBase: () => PageConfigBase,
|
100
|
+
PageTypes: () => PageTypes,
|
93
101
|
PrintCertificateActionInput: () => PrintCertificateActionInput,
|
102
|
+
ReadActionInput: () => ReadActionInput,
|
94
103
|
RegisterActionInput: () => RegisterActionInput,
|
95
104
|
RejectCorrectionActionInput: () => RejectCorrectionActionInput,
|
96
105
|
RejectDeclarationActionInput: () => RejectDeclarationActionInput,
|
@@ -106,20 +115,23 @@ __export(events_exports, {
|
|
106
115
|
UrbanAddressUpdateValue: () => UrbanAddressUpdateValue,
|
107
116
|
UrbanAddressValue: () => UrbanAddressValue,
|
108
117
|
ValidateActionInput: () => ValidateActionInput,
|
109
|
-
|
118
|
+
VerificationActionConfig: () => VerificationActionConfig,
|
110
119
|
VerificationPageConfig: () => VerificationPageConfig,
|
111
120
|
WorkqueueConfig: () => WorkqueueConfig,
|
112
121
|
alwaysTrue: () => alwaysTrue,
|
113
122
|
and: () => and,
|
123
|
+
annotationActions: () => annotationActions,
|
114
124
|
applyDraftsToEventIndex: () => applyDraftsToEventIndex,
|
115
125
|
compositeFieldTypes: () => compositeFieldTypes,
|
116
126
|
createEmptyDraft: () => createEmptyDraft,
|
117
127
|
createValidationSchema: () => createValidationSchema,
|
118
128
|
deepDropNulls: () => deepDropNulls,
|
129
|
+
defineActionForm: () => defineActionForm,
|
119
130
|
defineConditional: () => defineConditional,
|
120
131
|
defineConfig: () => defineConfig,
|
121
|
-
|
132
|
+
defineDeclarationForm: () => defineDeclarationForm,
|
122
133
|
defineFormPage: () => defineFormPage,
|
134
|
+
definePage: () => definePage,
|
123
135
|
errorMessages: () => errorMessages,
|
124
136
|
event: () => event,
|
125
137
|
eventMetadataLabelMap: () => eventMetadataLabelMap,
|
@@ -128,14 +140,9 @@ __export(events_exports, {
|
|
128
140
|
eventStatuses: () => eventStatuses,
|
129
141
|
field: () => field,
|
130
142
|
fieldTypes: () => fieldTypes,
|
131
|
-
findActiveActionFields: () => findActiveActionFields,
|
132
|
-
findActiveActionForm: () => findActiveActionForm,
|
133
|
-
findActiveActionFormFields: () => findActiveActionFormFields,
|
134
|
-
findActiveActionFormPages: () => findActiveActionFormPages,
|
135
|
-
findActiveActionVerificationPageIds: () => findActiveActionVerificationPageIds,
|
136
143
|
findActiveDrafts: () => findActiveDrafts,
|
137
|
-
|
138
|
-
|
144
|
+
findAllFields: () => findAllFields,
|
145
|
+
findRecordActionPages: () => findRecordActionPages,
|
139
146
|
generateActionDocument: () => generateActionDocument,
|
140
147
|
generateActionInput: () => generateActionInput,
|
141
148
|
generateActionMetadataInput: () => generateActionMetadataInput,
|
@@ -143,16 +150,18 @@ __export(events_exports, {
|
|
143
150
|
generateEventDraftDocument: () => generateEventDraftDocument,
|
144
151
|
generateTransactionId: () => generateTransactionId,
|
145
152
|
generateTranslationConfig: () => generateTranslationConfig,
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
153
|
+
getActionAnnotation: () => getActionAnnotation,
|
154
|
+
getActionAnnotationFields: () => getActionAnnotationFields,
|
155
|
+
getActionReview: () => getActionReview,
|
156
|
+
getActionReviewFields: () => getActionReviewFields,
|
157
|
+
getAllAnnotationFields: () => getAllAnnotationFields,
|
150
158
|
getCurrentEventState: () => getCurrentEventState,
|
151
159
|
getCurrentEventStateWithDrafts: () => getCurrentEventStateWithDrafts,
|
152
|
-
|
160
|
+
getDeclaration: () => getDeclaration,
|
161
|
+
getDeclarationFields: () => getDeclarationFields,
|
162
|
+
getDeclarationPages: () => getDeclarationPages,
|
153
163
|
getFieldValidationErrors: () => getFieldValidationErrors,
|
154
|
-
|
155
|
-
getMetadataForAction: () => getMetadataForAction,
|
164
|
+
getVisiblePagesFormFields: () => getVisiblePagesFormFields,
|
156
165
|
isAddressFieldType: () => isAddressFieldType,
|
157
166
|
isAdministrativeAreaFieldType: () => isAdministrativeAreaFieldType,
|
158
167
|
isBulletListFieldType: () => isBulletListFieldType,
|
@@ -174,6 +183,7 @@ __export(events_exports, {
|
|
174
183
|
isNumberFieldType: () => isNumberFieldType,
|
175
184
|
isOfficeFieldType: () => isOfficeFieldType,
|
176
185
|
isPageHeaderFieldType: () => isPageHeaderFieldType,
|
186
|
+
isPageVisible: () => isPageVisible,
|
177
187
|
isParagraphFieldType: () => isParagraphFieldType,
|
178
188
|
isRadioGroupFieldType: () => isRadioGroupFieldType,
|
179
189
|
isSelectFieldType: () => isSelectFieldType,
|
@@ -182,12 +192,12 @@ __export(events_exports, {
|
|
182
192
|
isTextAreaFieldType: () => isTextAreaFieldType,
|
183
193
|
isTextFieldType: () => isTextFieldType,
|
184
194
|
isUndeclaredDraft: () => isUndeclaredDraft,
|
195
|
+
isVerificationPage: () => isVerificationPage,
|
185
196
|
mapFieldTypeToEmptyValue: () => mapFieldTypeToEmptyValue,
|
186
197
|
mapFieldTypeToMockValue: () => mapFieldTypeToMockValue,
|
187
198
|
mapFieldTypeToZod: () => mapFieldTypeToZod,
|
188
199
|
not: () => not,
|
189
200
|
or: () => or,
|
190
|
-
resolveLabelsFromKnownFields: () => resolveLabelsFromKnownFields,
|
191
201
|
stripHiddenFields: () => stripHiddenFields,
|
192
202
|
user: () => user,
|
193
203
|
validate: () => validate,
|
@@ -197,7 +207,7 @@ __export(events_exports, {
|
|
197
207
|
module.exports = __toCommonJS(events_exports);
|
198
208
|
|
199
209
|
// ../commons/src/events/ActionConfig.ts
|
200
|
-
var
|
210
|
+
var import_zod9 = require("zod");
|
201
211
|
|
202
212
|
// ../commons/src/events/Conditional.ts
|
203
213
|
var import_zod = require("zod");
|
@@ -225,7 +235,7 @@ var ActionConditional = import_zod.z.discriminatedUnion("type", [
|
|
225
235
|
EnableConditional
|
226
236
|
]);
|
227
237
|
|
228
|
-
// ../commons/src/events/
|
238
|
+
// ../commons/src/events/PageConfig.ts
|
229
239
|
var import_zod6 = require("zod");
|
230
240
|
|
231
241
|
// ../commons/src/events/FieldConfig.ts
|
@@ -577,7 +587,7 @@ var AdministrativeAreas = import_zod5.z.enum([
|
|
577
587
|
]);
|
578
588
|
var AdministrativeAreaConfiguration = import_zod5.z.object({
|
579
589
|
partOf: import_zod5.z.object({
|
580
|
-
$
|
590
|
+
$declaration: import_zod5.z.string()
|
581
591
|
}).optional().describe("Parent location"),
|
582
592
|
type: AdministrativeAreas
|
583
593
|
}).describe("Administrative area options");
|
@@ -612,11 +622,20 @@ var Address = BaseField.extend({
|
|
612
622
|
type: import_zod5.z.literal(FieldType.ADDRESS),
|
613
623
|
defaultValue: AddressFieldValue.optional()
|
614
624
|
}).describe("Address input field \u2013 a combination of location and text fields");
|
625
|
+
var DataEntry = import_zod5.z.union([
|
626
|
+
import_zod5.z.object({
|
627
|
+
label: TranslationConfig,
|
628
|
+
value: import_zod5.z.string()
|
629
|
+
}),
|
630
|
+
import_zod5.z.object({
|
631
|
+
fieldId: import_zod5.z.string()
|
632
|
+
})
|
633
|
+
]);
|
615
634
|
var DataField = BaseField.extend({
|
616
635
|
type: import_zod5.z.literal(FieldType.DATA),
|
617
636
|
configuration: import_zod5.z.object({
|
618
637
|
subtitle: TranslationConfig.optional(),
|
619
|
-
data: import_zod5.z.array(
|
638
|
+
data: import_zod5.z.array(DataEntry)
|
620
639
|
})
|
621
640
|
}).describe("Data field for displaying read-only data");
|
622
641
|
var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
@@ -644,18 +663,20 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
|
644
663
|
DataField
|
645
664
|
]);
|
646
665
|
|
647
|
-
// ../commons/src/events/
|
648
|
-
var
|
649
|
-
|
650
|
-
VERIFICATION: "VERIFICATION"
|
651
|
-
};
|
652
|
-
var FormPage = import_zod6.z.object({
|
666
|
+
// ../commons/src/events/PageConfig.ts
|
667
|
+
var PageTypes = import_zod6.z.enum(["FORM", "VERIFICATION"]);
|
668
|
+
var PageConfigBase = import_zod6.z.object({
|
653
669
|
id: import_zod6.z.string().describe("Unique identifier for the page"),
|
654
670
|
title: TranslationConfig.describe("Header title of the page"),
|
655
671
|
fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the page"),
|
656
|
-
|
672
|
+
conditional: Conditional().optional().describe(
|
673
|
+
"Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
|
674
|
+
)
|
675
|
+
});
|
676
|
+
var FormPageConfig = PageConfigBase.extend({
|
677
|
+
type: import_zod6.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
|
657
678
|
});
|
658
|
-
var
|
679
|
+
var VerificationActionConfig = import_zod6.z.object({
|
659
680
|
verify: import_zod6.z.object({ label: TranslationConfig }),
|
660
681
|
cancel: import_zod6.z.object({
|
661
682
|
label: TranslationConfig,
|
@@ -665,136 +686,167 @@ var VerificationPageConfig = import_zod6.z.object({
|
|
665
686
|
})
|
666
687
|
})
|
667
688
|
}).describe("Actions available on the verification page");
|
668
|
-
var
|
669
|
-
type: import_zod6.z.literal(
|
670
|
-
actions:
|
671
|
-
});
|
672
|
-
var FormPageConfig = import_zod6.z.preprocess(
|
673
|
-
(pageConfig) => ({
|
674
|
-
...pageConfig,
|
675
|
-
type: pageConfig.type ?? FormPageType.FORM
|
676
|
-
// Default type to "FORM" if not provided
|
677
|
-
}),
|
678
|
-
import_zod6.z.discriminatedUnion("type", [FormPage, VerificationPage])
|
679
|
-
);
|
680
|
-
var FormConfig = import_zod6.z.object({
|
681
|
-
label: TranslationConfig.describe("Human readable description of the form"),
|
682
|
-
version: import_zod6.z.object({
|
683
|
-
id: import_zod6.z.string().describe(
|
684
|
-
"Form version. Semantic versioning recommended. Example: 0.0.1"
|
685
|
-
),
|
686
|
-
label: TranslationConfig.describe(
|
687
|
-
"Human readable description of the version"
|
688
|
-
)
|
689
|
-
}),
|
690
|
-
active: import_zod6.z.boolean().default(false).describe("Whether the form is active"),
|
691
|
-
pages: import_zod6.z.array(FormPageConfig),
|
692
|
-
review: import_zod6.z.object({
|
693
|
-
title: TranslationConfig.describe(
|
694
|
-
"Title of the form to show in review page"
|
695
|
-
),
|
696
|
-
fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the review page for metadata")
|
697
|
-
})
|
689
|
+
var VerificationPageConfig = FormPageConfig.extend({
|
690
|
+
type: import_zod6.z.literal(PageTypes.enum.VERIFICATION),
|
691
|
+
actions: VerificationActionConfig
|
698
692
|
});
|
693
|
+
var PageConfig = import_zod6.z.discriminatedUnion("type", [
|
694
|
+
FormPageConfig,
|
695
|
+
VerificationPageConfig
|
696
|
+
]);
|
699
697
|
|
700
698
|
// ../commons/src/events/ActionType.ts
|
699
|
+
var import_zod7 = require("zod");
|
701
700
|
var ActionType = {
|
701
|
+
// Pre-declaration actions
|
702
|
+
DELETE: "DELETE",
|
702
703
|
CREATE: "CREATE",
|
703
|
-
ASSIGN: "ASSIGN",
|
704
|
-
UNASSIGN: "UNASSIGN",
|
705
|
-
REGISTER: "REGISTER",
|
706
|
-
VALIDATE: "VALIDATE",
|
707
|
-
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
708
|
-
REJECT_CORRECTION: "REJECT_CORRECTION",
|
709
|
-
APPROVE_CORRECTION: "APPROVE_CORRECTION",
|
710
|
-
DETECT_DUPLICATE: "DETECT_DUPLICATE",
|
711
704
|
NOTIFY: "NOTIFY",
|
705
|
+
// Declaration actions
|
712
706
|
DECLARE: "DECLARE",
|
713
|
-
|
714
|
-
|
715
|
-
|
707
|
+
VALIDATE: "VALIDATE",
|
708
|
+
REGISTER: "REGISTER",
|
709
|
+
// Declaration system actions. Non-configurable.
|
710
|
+
DETECT_DUPLICATE: "DETECT_DUPLICATE",
|
716
711
|
REJECT: "REJECT",
|
712
|
+
// REJECT_DECLARATION
|
717
713
|
MARKED_AS_DUPLICATE: "MARKED_AS_DUPLICATE",
|
718
|
-
|
714
|
+
// MARK_AS_DUPLICATE
|
715
|
+
ARCHIVE: "ARCHIVE",
|
716
|
+
// Record actions
|
717
|
+
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
718
|
+
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
719
|
+
REJECT_CORRECTION: "REJECT_CORRECTION",
|
720
|
+
APPROVE_CORRECTION: "APPROVE_CORRECTION",
|
721
|
+
// General actions
|
722
|
+
READ: "READ",
|
723
|
+
ASSIGN: "ASSIGN",
|
724
|
+
UNASSIGN: "UNASSIGN"
|
719
725
|
};
|
720
|
-
var
|
726
|
+
var ActionTypes = import_zod7.z.enum([
|
727
|
+
"DELETE",
|
728
|
+
"CREATE",
|
729
|
+
"NOTIFY",
|
730
|
+
"DECLARE",
|
731
|
+
"VALIDATE",
|
732
|
+
"REGISTER",
|
733
|
+
"DETECT_DUPLICATE",
|
734
|
+
"REJECT",
|
735
|
+
"MARKED_AS_DUPLICATE",
|
736
|
+
"ARCHIVE",
|
737
|
+
"PRINT_CERTIFICATE",
|
738
|
+
"REQUEST_CORRECTION",
|
739
|
+
"REJECT_CORRECTION",
|
740
|
+
"APPROVE_CORRECTION",
|
741
|
+
"READ",
|
742
|
+
"ASSIGN",
|
743
|
+
"UNASSIGN"
|
744
|
+
]);
|
745
|
+
var declarationActionValues = [
|
746
|
+
ActionTypes.enum.DECLARE,
|
747
|
+
ActionTypes.enum.VALIDATE,
|
748
|
+
ActionTypes.enum.REGISTER
|
749
|
+
];
|
750
|
+
var DeclarationActions = ActionTypes.extract(declarationActionValues);
|
751
|
+
var declarationUpdateActionValues = [
|
752
|
+
...declarationActionValues,
|
753
|
+
ActionTypes.enum.REQUEST_CORRECTION
|
754
|
+
];
|
755
|
+
var DeclarationUpdateActions = ActionTypes.extract(
|
756
|
+
declarationUpdateActionValues
|
757
|
+
);
|
758
|
+
var annotationActions = ActionTypes.exclude(declarationActionValues);
|
759
|
+
|
760
|
+
// ../commons/src/events/FormConfig.ts
|
761
|
+
var import_zod8 = require("zod");
|
762
|
+
var DeclarationFormConfig = import_zod8.z.object({
|
763
|
+
label: TranslationConfig.describe("Human readable description of the form"),
|
764
|
+
pages: import_zod8.z.array(FormPageConfig)
|
765
|
+
}).describe("Configuration for a declaration form");
|
766
|
+
var ActionFormConfig = import_zod8.z.object({
|
767
|
+
label: TranslationConfig.describe("Human readable description of the form"),
|
768
|
+
pages: import_zod8.z.array(PageConfig)
|
769
|
+
});
|
770
|
+
var FormConfig = import_zod8.z.union([DeclarationFormConfig, ActionFormConfig]);
|
721
771
|
|
722
772
|
// ../commons/src/events/ActionConfig.ts
|
723
|
-
var ActionConditional2 =
|
773
|
+
var ActionConditional2 = import_zod9.z.discriminatedUnion("type", [
|
724
774
|
/** If conditional is defined, the action is shown to the user only if the condition is met */
|
725
775
|
ShowConditional,
|
726
776
|
/** If conditional is defined, the action is enabled only if the condition is met */
|
727
777
|
EnableConditional
|
728
778
|
]);
|
729
|
-
var
|
779
|
+
var DeclarationReviewConfig = import_zod9.z.object({
|
780
|
+
title: TranslationConfig.describe("Title of the review page"),
|
781
|
+
fields: import_zod9.z.array(FieldConfig).describe("Fields to be rendered on the review page for annotations.")
|
782
|
+
}).describe("Configuration for **declaration** review page.");
|
783
|
+
var ActionConfigBase = import_zod9.z.object({
|
730
784
|
label: TranslationConfig,
|
731
|
-
conditionals:
|
732
|
-
draft:
|
733
|
-
forms: import_zod7.z.array(FormConfig)
|
785
|
+
conditionals: import_zod9.z.array(ActionConditional2).optional().default([]),
|
786
|
+
draft: import_zod9.z.boolean().optional()
|
734
787
|
});
|
735
788
|
var DeclareConfig = ActionConfigBase.merge(
|
736
|
-
|
737
|
-
type:
|
789
|
+
import_zod9.z.object({
|
790
|
+
type: import_zod9.z.literal(ActionType.DECLARE),
|
791
|
+
review: DeclarationReviewConfig
|
738
792
|
})
|
739
793
|
);
|
740
794
|
var ValidateConfig = ActionConfigBase.merge(
|
741
|
-
|
742
|
-
type:
|
795
|
+
import_zod9.z.object({
|
796
|
+
type: import_zod9.z.literal(ActionType.VALIDATE),
|
797
|
+
review: DeclarationReviewConfig
|
798
|
+
})
|
799
|
+
);
|
800
|
+
var RegisterConfig = ActionConfigBase.merge(
|
801
|
+
import_zod9.z.object({
|
802
|
+
type: import_zod9.z.literal(ActionType.REGISTER),
|
803
|
+
review: DeclarationReviewConfig
|
743
804
|
})
|
744
805
|
);
|
745
806
|
var RejectDeclarationConfig = ActionConfigBase.merge(
|
746
|
-
|
747
|
-
type:
|
807
|
+
import_zod9.z.object({
|
808
|
+
type: import_zod9.z.literal(ActionType.REJECT)
|
748
809
|
})
|
749
810
|
);
|
750
811
|
var MarkedAsDuplicateConfig = ActionConfigBase.merge(
|
751
|
-
|
752
|
-
type:
|
812
|
+
import_zod9.z.object({
|
813
|
+
type: import_zod9.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
753
814
|
})
|
754
815
|
);
|
755
816
|
var ArchiveConfig = ActionConfigBase.merge(
|
756
|
-
|
757
|
-
type:
|
758
|
-
})
|
759
|
-
);
|
760
|
-
var RegisterConfig = ActionConfigBase.merge(
|
761
|
-
import_zod7.z.object({
|
762
|
-
type: import_zod7.z.literal(ActionType.REGISTER)
|
817
|
+
import_zod9.z.object({
|
818
|
+
type: import_zod9.z.literal(ActionType.ARCHIVE)
|
763
819
|
})
|
764
820
|
);
|
765
821
|
var DeleteConfig = ActionConfigBase.merge(
|
766
|
-
|
767
|
-
type:
|
822
|
+
import_zod9.z.object({
|
823
|
+
type: import_zod9.z.literal(ActionType.DELETE)
|
768
824
|
})
|
769
825
|
);
|
770
826
|
var PrintCertificateActionConfig = ActionConfigBase.merge(
|
771
|
-
|
772
|
-
type:
|
827
|
+
import_zod9.z.object({
|
828
|
+
type: import_zod9.z.literal(ActionType.PRINT_CERTIFICATE),
|
829
|
+
printForm: ActionFormConfig
|
773
830
|
})
|
774
831
|
);
|
775
832
|
var RequestCorrectionConfig = ActionConfigBase.merge(
|
776
|
-
|
777
|
-
type:
|
778
|
-
onboardingForm:
|
779
|
-
additionalDetailsForm:
|
833
|
+
import_zod9.z.object({
|
834
|
+
type: import_zod9.z.literal(ActionType.REQUEST_CORRECTION),
|
835
|
+
onboardingForm: import_zod9.z.array(PageConfig),
|
836
|
+
additionalDetailsForm: import_zod9.z.array(PageConfig)
|
780
837
|
})
|
781
838
|
);
|
782
839
|
var RejectCorrectionConfig = ActionConfigBase.merge(
|
783
|
-
|
784
|
-
type:
|
840
|
+
import_zod9.z.object({
|
841
|
+
type: import_zod9.z.literal(ActionType.REJECT_CORRECTION)
|
785
842
|
})
|
786
843
|
);
|
787
844
|
var ApproveCorrectionConfig = ActionConfigBase.merge(
|
788
|
-
|
789
|
-
type:
|
790
|
-
})
|
791
|
-
);
|
792
|
-
var CustomConfig = ActionConfigBase.merge(
|
793
|
-
import_zod7.z.object({
|
794
|
-
type: import_zod7.z.literal(ActionType.CUSTOM)
|
845
|
+
import_zod9.z.object({
|
846
|
+
type: import_zod9.z.literal(ActionType.APPROVE_CORRECTION)
|
795
847
|
})
|
796
848
|
);
|
797
|
-
var ActionConfig =
|
849
|
+
var ActionConfig = import_zod9.z.discriminatedUnion("type", [
|
798
850
|
DeclareConfig,
|
799
851
|
ValidateConfig,
|
800
852
|
RejectDeclarationConfig,
|
@@ -805,102 +857,106 @@ var ActionConfig = import_zod7.z.discriminatedUnion("type", [
|
|
805
857
|
PrintCertificateActionConfig,
|
806
858
|
RequestCorrectionConfig,
|
807
859
|
RejectCorrectionConfig,
|
808
|
-
ApproveCorrectionConfig
|
809
|
-
|
860
|
+
ApproveCorrectionConfig
|
861
|
+
]);
|
862
|
+
var DeclarationActionConfig = import_zod9.z.discriminatedUnion("type", [
|
863
|
+
DeclareConfig,
|
864
|
+
ValidateConfig,
|
865
|
+
RegisterConfig
|
810
866
|
]);
|
811
867
|
|
812
868
|
// ../commons/src/events/offline/CertificateConfig.ts
|
813
|
-
var
|
814
|
-
var FontFamily =
|
815
|
-
normal:
|
816
|
-
bold:
|
817
|
-
italics:
|
818
|
-
bolditalics:
|
869
|
+
var import_zod10 = require("zod");
|
870
|
+
var FontFamily = import_zod10.z.object({
|
871
|
+
normal: import_zod10.z.string(),
|
872
|
+
bold: import_zod10.z.string(),
|
873
|
+
italics: import_zod10.z.string(),
|
874
|
+
bolditalics: import_zod10.z.string()
|
819
875
|
});
|
820
|
-
var CertificateConfig =
|
821
|
-
id:
|
822
|
-
event:
|
876
|
+
var CertificateConfig = import_zod10.z.object({
|
877
|
+
id: import_zod10.z.string(),
|
878
|
+
event: import_zod10.z.string(),
|
823
879
|
label: TranslationConfig,
|
824
|
-
isDefault:
|
825
|
-
fee:
|
826
|
-
onTime:
|
827
|
-
late:
|
828
|
-
delayed:
|
880
|
+
isDefault: import_zod10.z.boolean(),
|
881
|
+
fee: import_zod10.z.object({
|
882
|
+
onTime: import_zod10.z.number(),
|
883
|
+
late: import_zod10.z.number(),
|
884
|
+
delayed: import_zod10.z.number()
|
829
885
|
}),
|
830
|
-
svgUrl:
|
831
|
-
fonts:
|
886
|
+
svgUrl: import_zod10.z.string(),
|
887
|
+
fonts: import_zod10.z.record(FontFamily).optional()
|
832
888
|
});
|
833
889
|
var CertificateTemplateConfig = CertificateConfig.extend({
|
834
|
-
hash:
|
835
|
-
svg:
|
890
|
+
hash: import_zod10.z.string().optional(),
|
891
|
+
svg: import_zod10.z.string()
|
836
892
|
});
|
837
893
|
|
838
894
|
// ../commons/src/events/offline/LanguageConfig.ts
|
839
|
-
var
|
840
|
-
var LanguageConfig =
|
841
|
-
lang:
|
895
|
+
var import_zod11 = require("zod");
|
896
|
+
var LanguageConfig = import_zod11.z.object({
|
897
|
+
lang: import_zod11.z.string(),
|
842
898
|
/**
|
843
899
|
* client.csv contents
|
844
900
|
*/
|
845
|
-
messages:
|
901
|
+
messages: import_zod11.z.record(import_zod11.z.string())
|
846
902
|
});
|
847
903
|
|
848
904
|
// ../commons/src/events/EventConfig.ts
|
849
|
-
var
|
905
|
+
var import_zod20 = require("zod");
|
850
906
|
|
851
907
|
// ../commons/src/events/DeduplicationConfig.ts
|
852
|
-
var
|
853
|
-
var FieldReference =
|
854
|
-
var Matcher =
|
855
|
-
fieldId:
|
856
|
-
options:
|
857
|
-
boost:
|
908
|
+
var import_zod12 = require("zod");
|
909
|
+
var FieldReference = import_zod12.z.string();
|
910
|
+
var Matcher = import_zod12.z.object({
|
911
|
+
fieldId: import_zod12.z.string(),
|
912
|
+
options: import_zod12.z.object({
|
913
|
+
boost: import_zod12.z.number().optional()
|
858
914
|
}).optional().default({})
|
859
915
|
});
|
860
916
|
var FuzzyMatcher = Matcher.extend({
|
861
|
-
type:
|
862
|
-
options:
|
917
|
+
type: import_zod12.z.literal("fuzzy"),
|
918
|
+
options: import_zod12.z.object({
|
863
919
|
/**
|
864
920
|
* Names of length 3 or less characters = 0 edits allowed
|
865
921
|
* Names of length 4 - 6 characters = 1 edit allowed
|
866
922
|
* Names of length >7 characters = 2 edits allowed
|
867
923
|
*/
|
868
|
-
fuzziness:
|
869
|
-
boost:
|
924
|
+
fuzziness: import_zod12.z.union([import_zod12.z.string(), import_zod12.z.number()]).optional().default("AUTO:4,7"),
|
925
|
+
boost: import_zod12.z.number().optional().default(1)
|
870
926
|
}).optional().default({})
|
871
927
|
});
|
872
928
|
var StrictMatcher = Matcher.extend({
|
873
|
-
type:
|
874
|
-
options:
|
875
|
-
boost:
|
929
|
+
type: import_zod12.z.literal("strict"),
|
930
|
+
options: import_zod12.z.object({
|
931
|
+
boost: import_zod12.z.number().optional().default(1)
|
876
932
|
}).optional().default({})
|
877
933
|
});
|
878
934
|
var DateRangeMatcher = Matcher.extend({
|
879
|
-
type:
|
880
|
-
options:
|
881
|
-
days:
|
935
|
+
type: import_zod12.z.literal("dateRange"),
|
936
|
+
options: import_zod12.z.object({
|
937
|
+
days: import_zod12.z.number(),
|
882
938
|
origin: FieldReference,
|
883
|
-
boost:
|
939
|
+
boost: import_zod12.z.number().optional().default(1)
|
884
940
|
})
|
885
941
|
});
|
886
942
|
var DateDistanceMatcher = Matcher.extend({
|
887
|
-
type:
|
888
|
-
options:
|
889
|
-
days:
|
943
|
+
type: import_zod12.z.literal("dateDistance"),
|
944
|
+
options: import_zod12.z.object({
|
945
|
+
days: import_zod12.z.number(),
|
890
946
|
origin: FieldReference,
|
891
|
-
boost:
|
947
|
+
boost: import_zod12.z.number().optional().default(1)
|
892
948
|
})
|
893
949
|
});
|
894
|
-
var And =
|
895
|
-
type:
|
896
|
-
clauses:
|
950
|
+
var And = import_zod12.z.object({
|
951
|
+
type: import_zod12.z.literal("and"),
|
952
|
+
clauses: import_zod12.z.lazy(() => Clause.array())
|
897
953
|
});
|
898
|
-
var Or =
|
899
|
-
type:
|
900
|
-
clauses:
|
954
|
+
var Or = import_zod12.z.object({
|
955
|
+
type: import_zod12.z.literal("or"),
|
956
|
+
clauses: import_zod12.z.lazy(() => Clause.array())
|
901
957
|
});
|
902
|
-
var Clause =
|
903
|
-
() =>
|
958
|
+
var Clause = import_zod12.z.lazy(
|
959
|
+
() => import_zod12.z.discriminatedUnion("type", [
|
904
960
|
And,
|
905
961
|
Or,
|
906
962
|
FuzzyMatcher,
|
@@ -909,37 +965,37 @@ var Clause = import_zod10.z.lazy(
|
|
909
965
|
DateDistanceMatcher
|
910
966
|
])
|
911
967
|
);
|
912
|
-
var DeduplicationConfig =
|
913
|
-
id:
|
968
|
+
var DeduplicationConfig = import_zod12.z.object({
|
969
|
+
id: import_zod12.z.string(),
|
914
970
|
label: TranslationConfig,
|
915
971
|
query: Clause
|
916
972
|
});
|
917
973
|
|
918
974
|
// ../commons/src/events/SummaryConfig.ts
|
919
|
-
var
|
920
|
-
var Field =
|
921
|
-
id:
|
975
|
+
var import_zod13 = require("zod");
|
976
|
+
var Field = import_zod13.z.object({
|
977
|
+
id: import_zod13.z.string().describe("Id of summary field"),
|
922
978
|
value: TranslationConfig.describe(
|
923
979
|
"Summary field value. Can utilise values defined in configuration and EventMetadata"
|
924
980
|
),
|
925
981
|
label: TranslationConfig,
|
926
982
|
emptyValueMessage: TranslationConfig.optional()
|
927
983
|
});
|
928
|
-
var Title =
|
929
|
-
id:
|
984
|
+
var Title = import_zod13.z.object({
|
985
|
+
id: import_zod13.z.string(),
|
930
986
|
label: TranslationConfig.describe("Title content"),
|
931
987
|
emptyValueMessage: TranslationConfig.optional()
|
932
988
|
});
|
933
|
-
var SummaryConfig =
|
989
|
+
var SummaryConfig = import_zod13.z.object({
|
934
990
|
title: Title.describe("Title of summary view."),
|
935
|
-
fields:
|
991
|
+
fields: import_zod13.z.array(Field).describe("Fields rendered in summary view.")
|
936
992
|
}).describe("Configuration for summary in event.");
|
937
993
|
|
938
994
|
// ../commons/src/events/WorkqueueConfig.ts
|
939
|
-
var
|
995
|
+
var import_zod15 = require("zod");
|
940
996
|
|
941
997
|
// ../commons/src/events/EventMetadata.ts
|
942
|
-
var
|
998
|
+
var import_zod14 = require("zod");
|
943
999
|
var EventStatus = {
|
944
1000
|
CREATED: "CREATED",
|
945
1001
|
NOTIFIED: "NOTIFIED",
|
@@ -951,18 +1007,18 @@ var EventStatus = {
|
|
951
1007
|
ARCHIVED: "ARCHIVED"
|
952
1008
|
};
|
953
1009
|
var eventStatuses = Object.values(EventStatus);
|
954
|
-
var EventStatuses =
|
955
|
-
var EventMetadata =
|
956
|
-
id:
|
957
|
-
type:
|
1010
|
+
var EventStatuses = import_zod14.z.nativeEnum(EventStatus);
|
1011
|
+
var EventMetadata = import_zod14.z.object({
|
1012
|
+
id: import_zod14.z.string(),
|
1013
|
+
type: import_zod14.z.string(),
|
958
1014
|
status: EventStatuses,
|
959
|
-
createdAt:
|
960
|
-
createdBy:
|
961
|
-
createdAtLocation:
|
962
|
-
modifiedAt:
|
963
|
-
assignedTo:
|
964
|
-
updatedBy:
|
965
|
-
trackingId:
|
1015
|
+
createdAt: import_zod14.z.string().datetime(),
|
1016
|
+
createdBy: import_zod14.z.string(),
|
1017
|
+
createdAtLocation: import_zod14.z.string(),
|
1018
|
+
modifiedAt: import_zod14.z.string().datetime(),
|
1019
|
+
assignedTo: import_zod14.z.string().nullish(),
|
1020
|
+
updatedBy: import_zod14.z.string(),
|
1021
|
+
trackingId: import_zod14.z.string()
|
966
1022
|
});
|
967
1023
|
var eventMetadataLabelMap = {
|
968
1024
|
"event.assignedTo": {
|
@@ -1018,24 +1074,24 @@ var eventMetadataLabelMap = {
|
|
1018
1074
|
};
|
1019
1075
|
|
1020
1076
|
// ../commons/src/events/WorkqueueConfig.ts
|
1021
|
-
var WorkqueueConfig =
|
1022
|
-
id:
|
1023
|
-
filters:
|
1024
|
-
|
1025
|
-
status:
|
1077
|
+
var WorkqueueConfig = import_zod15.z.object({
|
1078
|
+
id: import_zod15.z.string().describe("Unique identifier for workqueue."),
|
1079
|
+
filters: import_zod15.z.array(
|
1080
|
+
import_zod15.z.object({
|
1081
|
+
status: import_zod15.z.array(EventStatuses).describe("Defines which statusese are included in the workqueue.")
|
1026
1082
|
})
|
1027
1083
|
).describe("Filters to be applied to workqueue.")
|
1028
1084
|
}).describe("Configuration for workqueue.");
|
1029
1085
|
|
1030
1086
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
1031
|
-
var
|
1032
|
-
var AdvancedSearchConfig =
|
1087
|
+
var import_zod16 = require("zod");
|
1088
|
+
var AdvancedSearchConfig = import_zod16.z.object({
|
1033
1089
|
title: TranslationConfig.describe("Advanced search tab title"),
|
1034
|
-
fields:
|
1035
|
-
|
1036
|
-
fieldId:
|
1037
|
-
config:
|
1038
|
-
type:
|
1090
|
+
fields: import_zod16.z.array(
|
1091
|
+
import_zod16.z.object({
|
1092
|
+
fieldId: import_zod16.z.string(),
|
1093
|
+
config: import_zod16.z.object({
|
1094
|
+
type: import_zod16.z.enum(["FUZZY", "EXACT", "RANGE"]).describe("Determines the type of field")
|
1039
1095
|
}).optional().describe("Configuration options for the field")
|
1040
1096
|
})
|
1041
1097
|
).optional().default([]).describe("Advanced search fields.")
|
@@ -1045,12 +1101,12 @@ var AdvancedSearchConfig = import_zod14.z.object({
|
|
1045
1101
|
var import_lodash = require("lodash");
|
1046
1102
|
|
1047
1103
|
// ../commons/src/workqueues/WorkqueueConfig.ts
|
1048
|
-
var
|
1104
|
+
var import_zod18 = require("zod");
|
1049
1105
|
|
1050
1106
|
// ../commons/src/workqueues/defaultColumns.ts
|
1051
|
-
var
|
1052
|
-
var WorkQueueColumnConfig =
|
1053
|
-
id:
|
1107
|
+
var import_zod17 = require("zod");
|
1108
|
+
var WorkQueueColumnConfig = import_zod17.z.object({
|
1109
|
+
id: import_zod17.z.string(),
|
1054
1110
|
label: TranslationConfig
|
1055
1111
|
});
|
1056
1112
|
var defaultColumns = {
|
@@ -1087,16 +1143,16 @@ var defaultColumns = {
|
|
1087
1143
|
}
|
1088
1144
|
}
|
1089
1145
|
};
|
1090
|
-
var DefaultColumnKeys =
|
1146
|
+
var DefaultColumnKeys = import_zod17.z.enum(
|
1091
1147
|
Object.keys(defaultColumns)
|
1092
1148
|
);
|
1093
1149
|
|
1094
1150
|
// ../commons/src/workqueues/WorkqueueConfig.ts
|
1095
|
-
var rootWorkqueueConfig =
|
1096
|
-
id:
|
1151
|
+
var rootWorkqueueConfig = import_zod18.z.object({
|
1152
|
+
id: import_zod18.z.string(),
|
1097
1153
|
title: TranslationConfig,
|
1098
|
-
columns:
|
1099
|
-
defaultColumns:
|
1154
|
+
columns: import_zod18.z.array(WorkQueueColumnConfig),
|
1155
|
+
defaultColumns: import_zod18.z.array(DefaultColumnKeys)
|
1100
1156
|
});
|
1101
1157
|
var defineWorkqueue = (config) => rootWorkqueueConfig.parse(config);
|
1102
1158
|
|
@@ -1176,7 +1232,7 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
1176
1232
|
var import_date_fns = require("date-fns");
|
1177
1233
|
|
1178
1234
|
// ../commons/src/events/FieldTypeMapping.ts
|
1179
|
-
var
|
1235
|
+
var import_zod19 = require("zod");
|
1180
1236
|
function mapFieldTypeToZod(type, required) {
|
1181
1237
|
let schema;
|
1182
1238
|
switch (type) {
|
@@ -1229,7 +1285,7 @@ function createValidationSchema(config) {
|
|
1229
1285
|
for (const field2 of config) {
|
1230
1286
|
shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
|
1231
1287
|
}
|
1232
|
-
return
|
1288
|
+
return import_zod19.z.object(shape);
|
1233
1289
|
}
|
1234
1290
|
function mapFieldTypeToMockValue(field2, i) {
|
1235
1291
|
switch (field2.type) {
|
@@ -1557,6 +1613,15 @@ function validateFieldInput({
|
|
1557
1613
|
return rawError.error?.issues.map((issue) => issue.message) ?? [];
|
1558
1614
|
}
|
1559
1615
|
|
1616
|
+
// ../commons/src/uuid.ts
|
1617
|
+
var import_uuid = require("uuid");
|
1618
|
+
function getUUID() {
|
1619
|
+
return (0, import_uuid.v4)();
|
1620
|
+
}
|
1621
|
+
|
1622
|
+
// ../commons/src/events/utils.ts
|
1623
|
+
var import_date_fns2 = require("date-fns");
|
1624
|
+
|
1560
1625
|
// ../commons/src/utils.ts
|
1561
1626
|
function getOrThrow(x, message) {
|
1562
1627
|
if (x === void 0 || x === null) {
|
@@ -1565,73 +1630,64 @@ function getOrThrow(x, message) {
|
|
1565
1630
|
return x;
|
1566
1631
|
}
|
1567
1632
|
|
1568
|
-
// ../commons/src/uuid.ts
|
1569
|
-
var import_uuid = require("uuid");
|
1570
|
-
function getUUID() {
|
1571
|
-
return (0, import_uuid.v4)();
|
1572
|
-
}
|
1573
|
-
|
1574
1633
|
// ../commons/src/events/utils.ts
|
1575
|
-
|
1576
|
-
return
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
config.actions.map(
|
1581
|
-
({ forms }) => forms.map(
|
1582
|
-
({ pages }) => pages.map(
|
1583
|
-
({ fields }) => fields.map(({ id, label }) => ({ id, label }))
|
1584
|
-
)
|
1585
|
-
)
|
1586
|
-
)
|
1587
|
-
);
|
1634
|
+
var findAllFields = (config) => {
|
1635
|
+
return (0, import_lodash.flattenDeep)([
|
1636
|
+
...getDeclarationFields(config),
|
1637
|
+
...getAllAnnotationFields(config)
|
1638
|
+
]);
|
1588
1639
|
};
|
1589
|
-
var
|
1590
|
-
return (0, import_lodash.flattenDeep)(
|
1591
|
-
config.actions.map((action) => {
|
1592
|
-
if (action.type === ActionType.REQUEST_CORRECTION) {
|
1593
|
-
return [
|
1594
|
-
...action.forms.map(({ pages }) => pages.map(({ fields }) => fields)),
|
1595
|
-
...action.onboardingForm.flatMap(({ fields }) => fields),
|
1596
|
-
...action.additionalDetailsForm.flatMap(({ fields }) => fields)
|
1597
|
-
];
|
1598
|
-
}
|
1599
|
-
return action.forms.map(({ pages }) => pages.map(({ fields }) => fields));
|
1600
|
-
})
|
1601
|
-
);
|
1640
|
+
var getAllAnnotationFields = (config) => {
|
1641
|
+
return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
1602
1642
|
};
|
1603
|
-
var
|
1604
|
-
|
1605
|
-
|
1606
|
-
}) =>
|
1607
|
-
|
1608
|
-
|
1609
|
-
|
1610
|
-
|
1611
|
-
|
1612
|
-
|
1613
|
-
|
1614
|
-
|
1615
|
-
|
1616
|
-
|
1617
|
-
const pageLabel = pageFields.find((pageField) => pageField.id === field2.id);
|
1618
|
-
if (!pageLabel) {
|
1619
|
-
throw new Error(`Referenced field ${field2.id} does not have a label`);
|
1620
|
-
}
|
1621
|
-
return {
|
1622
|
-
...field2,
|
1623
|
-
label: pageLabel.label
|
1624
|
-
};
|
1625
|
-
});
|
1643
|
+
var getActionAnnotationFields = (actionConfig) => {
|
1644
|
+
if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
|
1645
|
+
return [
|
1646
|
+
...actionConfig.onboardingForm.flatMap(({ fields }) => fields),
|
1647
|
+
...actionConfig.additionalDetailsForm.flatMap(({ fields }) => fields)
|
1648
|
+
];
|
1649
|
+
}
|
1650
|
+
if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
|
1651
|
+
return actionConfig?.printForm.pages.flatMap(({ fields }) => fields) ?? [];
|
1652
|
+
}
|
1653
|
+
if (isDeclarationActionConfig(actionConfig)) {
|
1654
|
+
return actionConfig?.review.fields ?? [];
|
1655
|
+
}
|
1656
|
+
return [];
|
1626
1657
|
};
|
1627
|
-
|
1628
|
-
|
1629
|
-
|
1630
|
-
...
|
1631
|
-
|
1658
|
+
var findRecordActionPages = (config, actionType) => {
|
1659
|
+
const action = config.actions.find((a) => a.type === actionType);
|
1660
|
+
if (action?.type === ActionType.REQUEST_CORRECTION) {
|
1661
|
+
return [...action.onboardingForm, ...action.additionalDetailsForm];
|
1662
|
+
}
|
1663
|
+
if (action?.type === ActionType.PRINT_CERTIFICATE) {
|
1664
|
+
return action.printForm.pages;
|
1665
|
+
}
|
1666
|
+
return [];
|
1667
|
+
};
|
1668
|
+
function isDeclarationActionConfig(action) {
|
1669
|
+
return DeclarationActions.safeParse(action.type).success;
|
1670
|
+
}
|
1671
|
+
function getDeclarationFields(configuration) {
|
1672
|
+
return configuration.declaration.pages.flatMap(({ fields }) => fields);
|
1673
|
+
}
|
1674
|
+
function getDeclarationPages(configuration) {
|
1675
|
+
return configuration.declaration.pages;
|
1676
|
+
}
|
1677
|
+
function getDeclaration(configuration) {
|
1678
|
+
return configuration.declaration;
|
1632
1679
|
}
|
1633
|
-
function
|
1634
|
-
return configuration
|
1680
|
+
function getActionReviewFields(configuration, actionType) {
|
1681
|
+
return getActionReview(configuration, actionType).fields;
|
1682
|
+
}
|
1683
|
+
function getActionReview(configuration, actionType) {
|
1684
|
+
const [actionConfig] = configuration.actions.filter(
|
1685
|
+
(a) => a.type === actionType
|
1686
|
+
);
|
1687
|
+
return getOrThrow(
|
1688
|
+
actionConfig?.review,
|
1689
|
+
`No review config found for ${actionType}`
|
1690
|
+
);
|
1635
1691
|
}
|
1636
1692
|
function validateWorkqueueConfig(workqueueConfigs) {
|
1637
1693
|
workqueueConfigs.map((workqueue) => {
|
@@ -1645,71 +1701,39 @@ function validateWorkqueueConfig(workqueueConfigs) {
|
|
1645
1701
|
}
|
1646
1702
|
});
|
1647
1703
|
}
|
1648
|
-
|
1649
|
-
|
1650
|
-
|
1651
|
-
return form;
|
1652
|
-
};
|
1653
|
-
var findActiveActionFormPages = (configuration, action) => {
|
1654
|
-
return findActiveActionForm(configuration, action)?.pages;
|
1655
|
-
};
|
1656
|
-
var getFormFields = (formConfig) => {
|
1657
|
-
return formConfig.pages.flatMap((p) => p.fields);
|
1658
|
-
};
|
1659
|
-
var findActiveActionFormFields = (configuration, action) => {
|
1660
|
-
const form = findActiveActionForm(configuration, action);
|
1661
|
-
return form ? getFormFields(form) : void 0;
|
1662
|
-
};
|
1663
|
-
var findActiveActionFields = (configuration, action) => {
|
1664
|
-
const form = findActiveActionForm(configuration, action);
|
1665
|
-
const reviewFields = form?.review.fields;
|
1666
|
-
const formFields = form ? getFormFields(form) : void 0;
|
1667
|
-
const allFields = formFields ? formFields.concat(reviewFields ?? []) : reviewFields;
|
1668
|
-
return allFields;
|
1669
|
-
};
|
1670
|
-
var getActiveActionFormPages = (configuration, action) => {
|
1671
|
-
return getOrThrow(
|
1672
|
-
findActiveActionForm(configuration, action)?.pages,
|
1673
|
-
"Form configuration not found for type: " + configuration.id
|
1674
|
-
);
|
1675
|
-
};
|
1676
|
-
function getActiveActionFields(configuration, action) {
|
1677
|
-
if (LatentActions.some((latentAction) => latentAction === action)) {
|
1678
|
-
return getActiveActionFields(configuration, ActionType.DECLARE);
|
1679
|
-
}
|
1680
|
-
const fields = findActiveActionFields(configuration, action);
|
1681
|
-
if (!fields) {
|
1682
|
-
throw new Error(`No active field config found for action type ${action}`);
|
1683
|
-
}
|
1684
|
-
return fields;
|
1685
|
-
}
|
1686
|
-
function getEventConfiguration(eventConfigurations, type) {
|
1687
|
-
const config = eventConfigurations.find((config2) => config2.id === type);
|
1688
|
-
if (!config) {
|
1689
|
-
throw new Error(`Event configuration not found for type: ${type}`);
|
1704
|
+
function isPageVisible(page, formValues) {
|
1705
|
+
if (!page.conditional) {
|
1706
|
+
return true;
|
1690
1707
|
}
|
1691
|
-
return
|
1708
|
+
return validate(page.conditional, {
|
1709
|
+
$form: formValues,
|
1710
|
+
$now: (0, import_date_fns2.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" })
|
1711
|
+
});
|
1692
1712
|
}
|
1713
|
+
var getVisiblePagesFormFields = (formConfig, formData) => {
|
1714
|
+
return formConfig.pages.filter((p) => isPageVisible(p, formData)).flatMap((p) => p.fields);
|
1715
|
+
};
|
1693
1716
|
function isOptionalUncheckedCheckbox(field2, form) {
|
1694
1717
|
if (field2.type !== FieldType.CHECKBOX || field2.required) {
|
1695
1718
|
return false;
|
1696
1719
|
}
|
1697
1720
|
return !form[field2.id];
|
1698
1721
|
}
|
1699
|
-
function stripHiddenFields(fields,
|
1700
|
-
return (0, import_lodash.omitBy)(
|
1722
|
+
function stripHiddenFields(fields, declaration) {
|
1723
|
+
return (0, import_lodash.omitBy)(declaration, (_2, fieldId) => {
|
1701
1724
|
const field2 = fields.find((f) => f.id === fieldId);
|
1702
1725
|
if (!field2) {
|
1703
1726
|
return true;
|
1704
1727
|
}
|
1705
|
-
if (isOptionalUncheckedCheckbox(field2,
|
1728
|
+
if (isOptionalUncheckedCheckbox(field2, declaration)) {
|
1706
1729
|
return true;
|
1707
1730
|
}
|
1708
|
-
return !isFieldVisible(field2,
|
1731
|
+
return !isFieldVisible(field2, declaration);
|
1709
1732
|
});
|
1710
1733
|
}
|
1711
1734
|
function findActiveDrafts(event2, drafts) {
|
1712
|
-
const actions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
1735
|
+
const actions = event2.actions.slice().filter(({ type }) => type !== ActionType.READ).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
1736
|
+
console.log("actions", event2.actions);
|
1713
1737
|
const lastAction = actions[actions.length - 1];
|
1714
1738
|
return drafts.filter(({ createdAt }) => createdAt >= lastAction.createdAt).filter(({ eventId }) => eventId === event2.id);
|
1715
1739
|
}
|
@@ -1721,35 +1745,32 @@ function createEmptyDraft(eventId, draftId, actionType) {
|
|
1721
1745
|
transactionId: getUUID(),
|
1722
1746
|
action: {
|
1723
1747
|
type: actionType,
|
1724
|
-
|
1725
|
-
|
1748
|
+
declaration: {},
|
1749
|
+
annotation: {},
|
1726
1750
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
1727
1751
|
createdBy: "@todo",
|
1728
1752
|
createdAtLocation: "@todo"
|
1729
1753
|
}
|
1730
1754
|
};
|
1731
1755
|
}
|
1732
|
-
function
|
1733
|
-
|
1734
|
-
if (!pages) {
|
1735
|
-
return [];
|
1736
|
-
}
|
1737
|
-
return pages.filter((page) => page.type === FormPageType.VERIFICATION).map((page) => page.id);
|
1756
|
+
function isVerificationPage(page) {
|
1757
|
+
return page.type === PageTypes.enum.VERIFICATION;
|
1738
1758
|
}
|
1739
1759
|
|
1740
1760
|
// ../commons/src/events/EventConfig.ts
|
1741
|
-
var EventConfig =
|
1742
|
-
id:
|
1761
|
+
var EventConfig = import_zod20.z.object({
|
1762
|
+
id: import_zod20.z.string().describe(
|
1743
1763
|
'A machine-readable identifier for the event, e.g. "birth" or "death"'
|
1744
1764
|
),
|
1745
1765
|
summary: SummaryConfig,
|
1746
1766
|
label: TranslationConfig,
|
1747
|
-
actions:
|
1748
|
-
|
1749
|
-
|
1750
|
-
|
1767
|
+
actions: import_zod20.z.array(ActionConfig),
|
1768
|
+
declaration: DeclarationFormConfig,
|
1769
|
+
workqueues: import_zod20.z.array(WorkqueueConfig),
|
1770
|
+
deduplication: import_zod20.z.array(DeduplicationConfig).optional().default([]),
|
1771
|
+
advancedSearch: import_zod20.z.array(AdvancedSearchConfig).optional().default([])
|
1751
1772
|
}).superRefine((event2, ctx) => {
|
1752
|
-
const allFields =
|
1773
|
+
const allFields = findAllFields(event2);
|
1753
1774
|
const fieldIds = allFields.map((field2) => field2.id);
|
1754
1775
|
const advancedSearchFields = event2.advancedSearch.flatMap(
|
1755
1776
|
(section) => section.fields.flatMap((field2) => field2.fieldId)
|
@@ -1776,106 +1797,108 @@ var EventConfig = import_zod18.z.object({
|
|
1776
1797
|
});
|
1777
1798
|
|
1778
1799
|
// ../commons/src/events/EventConfigInput.ts
|
1779
|
-
var
|
1800
|
+
var defineDeclarationForm = (form) => DeclarationFormConfig.parse(form);
|
1801
|
+
var defineActionForm = (actionForm) => ActionFormConfig.parse(actionForm);
|
1802
|
+
var definePage = (page) => PageConfig.parse(page);
|
1780
1803
|
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
1781
1804
|
|
1782
1805
|
// ../commons/src/events/Draft.ts
|
1783
|
-
var
|
1806
|
+
var import_zod23 = require("zod");
|
1784
1807
|
|
1785
1808
|
// ../commons/src/events/ActionDocument.ts
|
1786
|
-
var
|
1787
|
-
var ActionUpdate =
|
1788
|
-
var ActionBase =
|
1789
|
-
id:
|
1790
|
-
createdAt:
|
1791
|
-
createdBy:
|
1792
|
-
|
1793
|
-
|
1794
|
-
createdAtLocation:
|
1809
|
+
var import_zod21 = require("zod");
|
1810
|
+
var ActionUpdate = import_zod21.z.record(import_zod21.z.string(), FieldUpdateValue);
|
1811
|
+
var ActionBase = import_zod21.z.object({
|
1812
|
+
id: import_zod21.z.string(),
|
1813
|
+
createdAt: import_zod21.z.string().datetime(),
|
1814
|
+
createdBy: import_zod21.z.string(),
|
1815
|
+
declaration: ActionUpdate,
|
1816
|
+
annotation: ActionUpdate.optional(),
|
1817
|
+
createdAtLocation: import_zod21.z.string()
|
1795
1818
|
});
|
1796
1819
|
var AssignedAction = ActionBase.merge(
|
1797
|
-
|
1798
|
-
type:
|
1799
|
-
assignedTo:
|
1820
|
+
import_zod21.z.object({
|
1821
|
+
type: import_zod21.z.literal(ActionType.ASSIGN),
|
1822
|
+
assignedTo: import_zod21.z.string()
|
1800
1823
|
})
|
1801
1824
|
);
|
1802
1825
|
var UnassignedAction = ActionBase.merge(
|
1803
|
-
|
1804
|
-
type:
|
1826
|
+
import_zod21.z.object({
|
1827
|
+
type: import_zod21.z.literal(ActionType.UNASSIGN)
|
1805
1828
|
})
|
1806
1829
|
);
|
1807
1830
|
var RegisterAction = ActionBase.merge(
|
1808
|
-
|
1809
|
-
type:
|
1810
|
-
identifiers:
|
1811
|
-
trackingId:
|
1812
|
-
registrationNumber:
|
1831
|
+
import_zod21.z.object({
|
1832
|
+
type: import_zod21.z.literal(ActionType.REGISTER),
|
1833
|
+
identifiers: import_zod21.z.object({
|
1834
|
+
trackingId: import_zod21.z.string(),
|
1835
|
+
registrationNumber: import_zod21.z.string()
|
1813
1836
|
})
|
1814
1837
|
})
|
1815
1838
|
);
|
1816
1839
|
var DeclareAction = ActionBase.merge(
|
1817
|
-
|
1818
|
-
type:
|
1840
|
+
import_zod21.z.object({
|
1841
|
+
type: import_zod21.z.literal(ActionType.DECLARE)
|
1819
1842
|
})
|
1820
1843
|
);
|
1821
1844
|
var ValidateAction = ActionBase.merge(
|
1822
|
-
|
1823
|
-
type:
|
1845
|
+
import_zod21.z.object({
|
1846
|
+
type: import_zod21.z.literal(ActionType.VALIDATE)
|
1824
1847
|
})
|
1825
1848
|
);
|
1826
1849
|
var RejectAction = ActionBase.merge(
|
1827
|
-
|
1828
|
-
type:
|
1850
|
+
import_zod21.z.object({
|
1851
|
+
type: import_zod21.z.literal(ActionType.REJECT)
|
1829
1852
|
})
|
1830
1853
|
);
|
1831
1854
|
var MarkAsDuplicateAction = ActionBase.merge(
|
1832
|
-
|
1833
|
-
type:
|
1855
|
+
import_zod21.z.object({
|
1856
|
+
type: import_zod21.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1834
1857
|
})
|
1835
1858
|
);
|
1836
1859
|
var ArchiveAction = ActionBase.merge(
|
1837
|
-
|
1838
|
-
type:
|
1860
|
+
import_zod21.z.object({
|
1861
|
+
type: import_zod21.z.literal(ActionType.ARCHIVE)
|
1839
1862
|
})
|
1840
1863
|
);
|
1841
1864
|
var CreatedAction = ActionBase.merge(
|
1842
|
-
|
1843
|
-
type:
|
1865
|
+
import_zod21.z.object({
|
1866
|
+
type: import_zod21.z.literal(ActionType.CREATE)
|
1844
1867
|
})
|
1845
1868
|
);
|
1846
1869
|
var NotifiedAction = ActionBase.merge(
|
1847
|
-
|
1848
|
-
type:
|
1870
|
+
import_zod21.z.object({
|
1871
|
+
type: import_zod21.z.literal(ActionType.NOTIFY)
|
1849
1872
|
})
|
1850
1873
|
);
|
1851
1874
|
var PrintCertificateAction = ActionBase.merge(
|
1852
|
-
|
1853
|
-
type:
|
1875
|
+
import_zod21.z.object({
|
1876
|
+
type: import_zod21.z.literal(ActionType.PRINT_CERTIFICATE)
|
1854
1877
|
})
|
1855
1878
|
);
|
1856
1879
|
var RequestedCorrectionAction = ActionBase.merge(
|
1857
|
-
|
1858
|
-
type:
|
1880
|
+
import_zod21.z.object({
|
1881
|
+
type: import_zod21.z.literal(ActionType.REQUEST_CORRECTION)
|
1859
1882
|
})
|
1860
1883
|
);
|
1861
1884
|
var ApprovedCorrectionAction = ActionBase.merge(
|
1862
|
-
|
1863
|
-
type:
|
1864
|
-
requestId:
|
1885
|
+
import_zod21.z.object({
|
1886
|
+
type: import_zod21.z.literal(ActionType.APPROVE_CORRECTION),
|
1887
|
+
requestId: import_zod21.z.string()
|
1865
1888
|
})
|
1866
1889
|
);
|
1867
1890
|
var RejectedCorrectionAction = ActionBase.merge(
|
1868
|
-
|
1869
|
-
type:
|
1870
|
-
requestId:
|
1891
|
+
import_zod21.z.object({
|
1892
|
+
type: import_zod21.z.literal(ActionType.REJECT_CORRECTION),
|
1893
|
+
requestId: import_zod21.z.string()
|
1871
1894
|
})
|
1872
1895
|
);
|
1873
|
-
var
|
1874
|
-
|
1875
|
-
type:
|
1896
|
+
var ReadAction = ActionBase.merge(
|
1897
|
+
import_zod21.z.object({
|
1898
|
+
type: import_zod21.z.literal(ActionType.READ)
|
1876
1899
|
})
|
1877
1900
|
);
|
1878
|
-
var ActionDocument =
|
1901
|
+
var ActionDocument = import_zod21.z.discriminatedUnion("type", [
|
1879
1902
|
CreatedAction,
|
1880
1903
|
ValidateAction,
|
1881
1904
|
RejectAction,
|
@@ -1890,108 +1913,113 @@ var ActionDocument = import_zod19.z.discriminatedUnion("type", [
|
|
1890
1913
|
RejectedCorrectionAction,
|
1891
1914
|
UnassignedAction,
|
1892
1915
|
PrintCertificateAction,
|
1893
|
-
|
1916
|
+
ReadAction
|
1894
1917
|
]);
|
1895
|
-
var ResolvedUser =
|
1896
|
-
id:
|
1897
|
-
role:
|
1898
|
-
name:
|
1899
|
-
|
1900
|
-
use:
|
1901
|
-
given:
|
1902
|
-
family:
|
1918
|
+
var ResolvedUser = import_zod21.z.object({
|
1919
|
+
id: import_zod21.z.string(),
|
1920
|
+
role: import_zod21.z.string(),
|
1921
|
+
name: import_zod21.z.array(
|
1922
|
+
import_zod21.z.object({
|
1923
|
+
use: import_zod21.z.string(),
|
1924
|
+
given: import_zod21.z.array(import_zod21.z.string()),
|
1925
|
+
family: import_zod21.z.string()
|
1903
1926
|
})
|
1904
1927
|
)
|
1905
1928
|
});
|
1906
1929
|
|
1907
1930
|
// ../commons/src/events/ActionInput.ts
|
1908
|
-
var
|
1909
|
-
var BaseActionInput =
|
1910
|
-
eventId:
|
1911
|
-
transactionId:
|
1912
|
-
|
1913
|
-
|
1931
|
+
var import_zod22 = require("zod");
|
1932
|
+
var BaseActionInput = import_zod22.z.object({
|
1933
|
+
eventId: import_zod22.z.string(),
|
1934
|
+
transactionId: import_zod22.z.string(),
|
1935
|
+
declaration: ActionUpdate,
|
1936
|
+
annotation: ActionUpdate.optional()
|
1914
1937
|
});
|
1915
1938
|
var CreateActionInput = BaseActionInput.merge(
|
1916
|
-
|
1917
|
-
type:
|
1918
|
-
createdAtLocation:
|
1939
|
+
import_zod22.z.object({
|
1940
|
+
type: import_zod22.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
1941
|
+
createdAtLocation: import_zod22.z.string()
|
1919
1942
|
})
|
1920
1943
|
);
|
1921
1944
|
var RegisterActionInput = BaseActionInput.merge(
|
1922
|
-
|
1923
|
-
type:
|
1924
|
-
identifiers:
|
1925
|
-
trackingId:
|
1926
|
-
registrationNumber:
|
1945
|
+
import_zod22.z.object({
|
1946
|
+
type: import_zod22.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
1947
|
+
identifiers: import_zod22.z.object({
|
1948
|
+
trackingId: import_zod22.z.string(),
|
1949
|
+
registrationNumber: import_zod22.z.string()
|
1927
1950
|
})
|
1928
1951
|
})
|
1929
1952
|
);
|
1930
1953
|
var ValidateActionInput = BaseActionInput.merge(
|
1931
|
-
|
1932
|
-
type:
|
1933
|
-
duplicates:
|
1954
|
+
import_zod22.z.object({
|
1955
|
+
type: import_zod22.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
|
1956
|
+
duplicates: import_zod22.z.array(import_zod22.z.string())
|
1934
1957
|
})
|
1935
1958
|
);
|
1936
1959
|
var NotifyActionInput = BaseActionInput.merge(
|
1937
|
-
|
1938
|
-
type:
|
1960
|
+
import_zod22.z.object({
|
1961
|
+
type: import_zod22.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
1939
1962
|
})
|
1940
1963
|
);
|
1941
1964
|
var DeclareActionInput = BaseActionInput.merge(
|
1942
|
-
|
1943
|
-
type:
|
1965
|
+
import_zod22.z.object({
|
1966
|
+
type: import_zod22.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
1944
1967
|
})
|
1945
1968
|
);
|
1946
1969
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
1947
|
-
|
1948
|
-
type:
|
1970
|
+
import_zod22.z.object({
|
1971
|
+
type: import_zod22.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
1949
1972
|
})
|
1950
1973
|
);
|
1951
1974
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
1952
|
-
|
1953
|
-
type:
|
1975
|
+
import_zod22.z.object({
|
1976
|
+
type: import_zod22.z.literal(ActionType.REJECT).default(ActionType.REJECT)
|
1954
1977
|
})
|
1955
1978
|
);
|
1956
1979
|
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
1957
|
-
|
1958
|
-
type:
|
1980
|
+
import_zod22.z.object({
|
1981
|
+
type: import_zod22.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
1959
1982
|
})
|
1960
1983
|
);
|
1961
1984
|
var ArchiveActionInput = BaseActionInput.merge(
|
1962
|
-
|
1963
|
-
type:
|
1985
|
+
import_zod22.z.object({
|
1986
|
+
type: import_zod22.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE)
|
1964
1987
|
})
|
1965
1988
|
);
|
1966
1989
|
var AssignActionInput = BaseActionInput.merge(
|
1967
|
-
|
1968
|
-
type:
|
1969
|
-
assignedTo:
|
1990
|
+
import_zod22.z.object({
|
1991
|
+
type: import_zod22.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
1992
|
+
assignedTo: import_zod22.z.string()
|
1970
1993
|
})
|
1971
1994
|
);
|
1972
1995
|
var UnassignActionInput = BaseActionInput.merge(
|
1973
|
-
|
1974
|
-
type:
|
1996
|
+
import_zod22.z.object({
|
1997
|
+
type: import_zod22.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN)
|
1975
1998
|
})
|
1976
1999
|
);
|
1977
2000
|
var RequestCorrectionActionInput = BaseActionInput.merge(
|
1978
|
-
|
1979
|
-
type:
|
2001
|
+
import_zod22.z.object({
|
2002
|
+
type: import_zod22.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
1980
2003
|
})
|
1981
2004
|
);
|
1982
2005
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
1983
|
-
|
1984
|
-
requestId:
|
1985
|
-
type:
|
2006
|
+
import_zod22.z.object({
|
2007
|
+
requestId: import_zod22.z.string(),
|
2008
|
+
type: import_zod22.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
|
1986
2009
|
})
|
1987
2010
|
);
|
1988
2011
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
1989
|
-
|
1990
|
-
requestId:
|
1991
|
-
type:
|
2012
|
+
import_zod22.z.object({
|
2013
|
+
requestId: import_zod22.z.string(),
|
2014
|
+
type: import_zod22.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
1992
2015
|
})
|
1993
2016
|
);
|
1994
|
-
var
|
2017
|
+
var ReadActionInput = BaseActionInput.merge(
|
2018
|
+
import_zod22.z.object({
|
2019
|
+
type: import_zod22.z.literal(ActionType.READ).default(ActionType.READ)
|
2020
|
+
})
|
2021
|
+
);
|
2022
|
+
var ActionInput = import_zod22.z.discriminatedUnion("type", [
|
1995
2023
|
CreateActionInput,
|
1996
2024
|
ValidateActionInput,
|
1997
2025
|
RegisterActionInput,
|
@@ -2005,49 +2033,50 @@ var ActionInput = import_zod20.z.discriminatedUnion("type", [
|
|
2005
2033
|
PrintCertificateActionInput,
|
2006
2034
|
RequestCorrectionActionInput,
|
2007
2035
|
RejectCorrectionActionInput,
|
2008
|
-
ApproveCorrectionActionInput
|
2036
|
+
ApproveCorrectionActionInput,
|
2037
|
+
ReadActionInput
|
2009
2038
|
]);
|
2010
2039
|
|
2011
2040
|
// ../commons/src/events/Draft.ts
|
2012
|
-
var Draft =
|
2013
|
-
id:
|
2014
|
-
eventId:
|
2015
|
-
transactionId:
|
2016
|
-
createdAt:
|
2041
|
+
var Draft = import_zod23.z.object({
|
2042
|
+
id: import_zod23.z.string(),
|
2043
|
+
eventId: import_zod23.z.string(),
|
2044
|
+
transactionId: import_zod23.z.string(),
|
2045
|
+
createdAt: import_zod23.z.string().datetime(),
|
2017
2046
|
action: ActionBase.extend({
|
2018
|
-
type:
|
2047
|
+
type: ActionTypes
|
2019
2048
|
}).omit({ id: true })
|
2020
2049
|
});
|
2021
2050
|
var DraftInput = BaseActionInput.extend({
|
2022
|
-
type:
|
2051
|
+
type: ActionTypes
|
2023
2052
|
});
|
2024
2053
|
|
2025
2054
|
// ../commons/src/events/EventInput.ts
|
2026
|
-
var
|
2027
|
-
var EventInput =
|
2028
|
-
transactionId:
|
2029
|
-
type:
|
2055
|
+
var import_zod24 = require("zod");
|
2056
|
+
var EventInput = import_zod24.z.object({
|
2057
|
+
transactionId: import_zod24.z.string(),
|
2058
|
+
type: import_zod24.z.string()
|
2030
2059
|
});
|
2031
2060
|
|
2032
2061
|
// ../commons/src/events/EventDocument.ts
|
2033
|
-
var
|
2034
|
-
var EventDocument =
|
2035
|
-
id:
|
2036
|
-
type:
|
2037
|
-
createdAt:
|
2038
|
-
updatedAt:
|
2039
|
-
actions:
|
2040
|
-
trackingId:
|
2062
|
+
var import_zod25 = require("zod");
|
2063
|
+
var EventDocument = import_zod25.z.object({
|
2064
|
+
id: import_zod25.z.string(),
|
2065
|
+
type: import_zod25.z.string(),
|
2066
|
+
createdAt: import_zod25.z.string().datetime(),
|
2067
|
+
updatedAt: import_zod25.z.string().datetime(),
|
2068
|
+
actions: import_zod25.z.array(ActionDocument),
|
2069
|
+
trackingId: import_zod25.z.string()
|
2041
2070
|
});
|
2042
2071
|
|
2043
2072
|
// ../commons/src/events/EventIndex.ts
|
2044
|
-
var
|
2073
|
+
var import_zod26 = require("zod");
|
2045
2074
|
var EventIndex = EventMetadata.extend({
|
2046
|
-
|
2075
|
+
declaration: import_zod26.z.record(import_zod26.z.string(), import_zod26.z.any())
|
2047
2076
|
});
|
2048
|
-
var EventSearchIndex =
|
2049
|
-
|
2050
|
-
type:
|
2077
|
+
var EventSearchIndex = import_zod26.z.record(import_zod26.z.string(), import_zod26.z.any()).and(
|
2078
|
+
import_zod26.z.object({
|
2079
|
+
type: import_zod26.z.string()
|
2051
2080
|
// Ensures "type" (event-id) exists and is a string
|
2052
2081
|
})
|
2053
2082
|
);
|
@@ -2091,7 +2120,7 @@ function getAssignedUserFromActions(actions) {
|
|
2091
2120
|
return user2;
|
2092
2121
|
}, null);
|
2093
2122
|
}
|
2094
|
-
function
|
2123
|
+
function aggregateActionDeclarations(actions) {
|
2095
2124
|
const excludedActions = [
|
2096
2125
|
ActionType.REQUEST_CORRECTION,
|
2097
2126
|
ActionType.PRINT_CERTIFICATE
|
@@ -2105,9 +2134,9 @@ function getData(actions) {
|
|
2105
2134
|
if (!requestAction) {
|
2106
2135
|
return status;
|
2107
2136
|
}
|
2108
|
-
return deepMerge(status, requestAction.
|
2137
|
+
return deepMerge(status, requestAction.declaration);
|
2109
2138
|
}
|
2110
|
-
return deepMerge(status, action.
|
2139
|
+
return deepMerge(status, action.declaration);
|
2111
2140
|
}, {});
|
2112
2141
|
}
|
2113
2142
|
function deepDropNulls(obj) {
|
@@ -2164,7 +2193,7 @@ function getCurrentEventState(event2) {
|
|
2164
2193
|
modifiedAt: latestAction.createdAt,
|
2165
2194
|
assignedTo: getAssignedUserFromActions(event2.actions),
|
2166
2195
|
updatedBy: latestAction.createdBy,
|
2167
|
-
|
2196
|
+
declaration: aggregateActionDeclarations(event2.actions),
|
2168
2197
|
trackingId: event2.trackingId
|
2169
2198
|
});
|
2170
2199
|
}
|
@@ -2197,13 +2226,13 @@ function applyDraftsToEventIndex(eventIndex, drafts) {
|
|
2197
2226
|
}
|
2198
2227
|
return {
|
2199
2228
|
...eventIndex,
|
2200
|
-
|
2201
|
-
...eventIndex.
|
2202
|
-
...activeDrafts[activeDrafts.length - 1].
|
2229
|
+
declaration: {
|
2230
|
+
...eventIndex.declaration,
|
2231
|
+
...activeDrafts[activeDrafts.length - 1].declaration
|
2203
2232
|
}
|
2204
2233
|
};
|
2205
2234
|
}
|
2206
|
-
function
|
2235
|
+
function getActionAnnotation({
|
2207
2236
|
event: event2,
|
2208
2237
|
actionType,
|
2209
2238
|
drafts
|
@@ -2214,21 +2243,17 @@ function getMetadataForAction({
|
|
2214
2243
|
...action ? [action] : [],
|
2215
2244
|
...eventDrafts.map((draft) => draft.action)
|
2216
2245
|
].sort();
|
2217
|
-
const
|
2218
|
-
return deepMerge(
|
2246
|
+
const annotation = sorted.reduce((annotation2, action2) => {
|
2247
|
+
return deepMerge(annotation2, action2.annotation ?? {});
|
2219
2248
|
}, {});
|
2220
|
-
return deepDropNulls(
|
2249
|
+
return deepDropNulls(annotation);
|
2221
2250
|
}
|
2222
2251
|
|
2223
2252
|
// ../commons/src/events/defineConfig.ts
|
2224
2253
|
var defineConfig = (config) => {
|
2225
2254
|
validateWorkqueueConfig(config.workqueues);
|
2226
2255
|
const input = EventConfig.parse(config);
|
2227
|
-
|
2228
|
-
return EventConfig.parse({
|
2229
|
-
...input,
|
2230
|
-
pageFields
|
2231
|
-
});
|
2256
|
+
return input;
|
2232
2257
|
};
|
2233
2258
|
|
2234
2259
|
// ../commons/src/events/transactions.ts
|
@@ -2464,29 +2489,59 @@ function field(fieldId) {
|
|
2464
2489
|
}
|
2465
2490
|
},
|
2466
2491
|
required: ["$form"]
|
2492
|
+
}),
|
2493
|
+
/**
|
2494
|
+
* Checks if the field value matches a given regular expression pattern.
|
2495
|
+
* @param pattern - The regular expression pattern to match the field value against.
|
2496
|
+
* @returns A JSONSchema conditional that validates the field value against the pattern.
|
2497
|
+
*/
|
2498
|
+
matches: (pattern) => defineConditional({
|
2499
|
+
type: "object",
|
2500
|
+
properties: {
|
2501
|
+
$form: {
|
2502
|
+
type: "object",
|
2503
|
+
properties: {
|
2504
|
+
[fieldId]: {
|
2505
|
+
type: "string",
|
2506
|
+
pattern
|
2507
|
+
}
|
2508
|
+
},
|
2509
|
+
required: [fieldId]
|
2510
|
+
}
|
2511
|
+
},
|
2512
|
+
required: ["$form"]
|
2513
|
+
}),
|
2514
|
+
isBetween: (min, max) => defineConditional({
|
2515
|
+
type: "object",
|
2516
|
+
properties: {
|
2517
|
+
$form: {
|
2518
|
+
type: "object",
|
2519
|
+
properties: {
|
2520
|
+
[fieldId]: {
|
2521
|
+
type: "number",
|
2522
|
+
minimum: min,
|
2523
|
+
maximum: max
|
2524
|
+
}
|
2525
|
+
},
|
2526
|
+
required: [fieldId]
|
2527
|
+
}
|
2528
|
+
},
|
2529
|
+
required: ["$form"]
|
2467
2530
|
})
|
2468
2531
|
};
|
2469
2532
|
}
|
2470
2533
|
|
2471
2534
|
// ../commons/src/fixtures/tennis-club-membership-event.ts
|
2472
|
-
var PRINT_CERTIFICATE_FORM =
|
2535
|
+
var PRINT_CERTIFICATE_FORM = defineActionForm({
|
2473
2536
|
label: {
|
2474
2537
|
id: "v2.event.tennis-club-membership.action.certificate.form.label",
|
2475
2538
|
defaultMessage: "Tennis club membership certificate collector",
|
2476
2539
|
description: "This is what this form is referred as in the system"
|
2477
2540
|
},
|
2478
|
-
version: {
|
2479
|
-
id: "1.0.0",
|
2480
|
-
label: {
|
2481
|
-
id: "v2.event.tennis-club-membership.action.certificate.form.version.1",
|
2482
|
-
defaultMessage: "Version 1",
|
2483
|
-
description: "This is the first version of the form"
|
2484
|
-
}
|
2485
|
-
},
|
2486
|
-
active: true,
|
2487
2541
|
pages: [
|
2488
2542
|
{
|
2489
2543
|
id: "collector",
|
2544
|
+
type: PageTypes.enum.FORM,
|
2490
2545
|
title: {
|
2491
2546
|
id: "v2.event.tennis-club-membership.action.certificate.form.section.who.title",
|
2492
2547
|
defaultMessage: "Print certified copy",
|
@@ -2501,7 +2556,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2501
2556
|
defaultMessage: "Requester",
|
2502
2557
|
description: "This is the label for the field"
|
2503
2558
|
},
|
2504
|
-
type:
|
2559
|
+
type: FieldType.SELECT,
|
2505
2560
|
options: [
|
2506
2561
|
{
|
2507
2562
|
value: "INFORMANT",
|
@@ -2578,7 +2633,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2578
2633
|
defaultMessage: "Select Type of ID",
|
2579
2634
|
description: "This is the label for selecting the type of ID"
|
2580
2635
|
},
|
2581
|
-
type:
|
2636
|
+
type: FieldType.SELECT,
|
2582
2637
|
options: [
|
2583
2638
|
{
|
2584
2639
|
value: "PASSPORT",
|
@@ -2679,7 +2734,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2679
2734
|
defaultMessage: "Passport Details",
|
2680
2735
|
description: "Field for entering Passport details"
|
2681
2736
|
},
|
2682
|
-
type:
|
2737
|
+
type: FieldType.TEXT
|
2683
2738
|
},
|
2684
2739
|
{
|
2685
2740
|
id: "collector.DRIVING_LICENSE.details",
|
@@ -2730,7 +2785,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2730
2785
|
defaultMessage: "Driving License Details",
|
2731
2786
|
description: "Field for entering Driving License details"
|
2732
2787
|
},
|
2733
|
-
type:
|
2788
|
+
type: FieldType.TEXT
|
2734
2789
|
},
|
2735
2790
|
{
|
2736
2791
|
id: "collector.REFUGEE_NUMBER.details",
|
@@ -2781,7 +2836,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2781
2836
|
defaultMessage: "Refugee Number Details",
|
2782
2837
|
description: "Field for entering Refugee Number details"
|
2783
2838
|
},
|
2784
|
-
type:
|
2839
|
+
type: FieldType.TEXT
|
2785
2840
|
},
|
2786
2841
|
{
|
2787
2842
|
id: "collector.ALIEN_NUMBER.details",
|
@@ -2832,7 +2887,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2832
2887
|
defaultMessage: "Alien Number Details",
|
2833
2888
|
description: "Field for entering Alien Number details"
|
2834
2889
|
},
|
2835
|
-
type:
|
2890
|
+
type: FieldType.TEXT
|
2836
2891
|
},
|
2837
2892
|
{
|
2838
2893
|
id: "collector.OTHER.idTypeOther",
|
@@ -2883,7 +2938,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2883
2938
|
defaultMessage: "Other ID Type (if applicable)",
|
2884
2939
|
description: 'Field for entering ID type if "Other" is selected'
|
2885
2940
|
},
|
2886
|
-
type:
|
2941
|
+
type: FieldType.TEXT
|
2887
2942
|
},
|
2888
2943
|
{
|
2889
2944
|
id: "collector.OTHER.firstName",
|
@@ -2934,7 +2989,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2934
2989
|
defaultMessage: "First Name",
|
2935
2990
|
description: "This is the label for the first name field"
|
2936
2991
|
},
|
2937
|
-
type:
|
2992
|
+
type: FieldType.TEXT
|
2938
2993
|
},
|
2939
2994
|
{
|
2940
2995
|
id: "collector.OTHER.lastName",
|
@@ -2985,7 +3040,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
2985
3040
|
defaultMessage: "Last Name",
|
2986
3041
|
description: "This is the label for the last name field"
|
2987
3042
|
},
|
2988
|
-
type:
|
3043
|
+
type: FieldType.TEXT
|
2989
3044
|
},
|
2990
3045
|
{
|
2991
3046
|
id: "collector.OTHER.relationshipToMember",
|
@@ -3036,7 +3091,7 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
3036
3091
|
defaultMessage: "Relationship to Member",
|
3037
3092
|
description: "This is the label for the relationship to member field"
|
3038
3093
|
},
|
3039
|
-
type:
|
3094
|
+
type: FieldType.TEXT
|
3040
3095
|
},
|
3041
3096
|
{
|
3042
3097
|
id: "collector.OTHER.signedAffidavit",
|
@@ -3087,13 +3142,14 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
3087
3142
|
defaultMessage: "Signed Affidavit (Optional)",
|
3088
3143
|
description: "This is the label for uploading a signed affidavit"
|
3089
3144
|
},
|
3090
|
-
type:
|
3145
|
+
type: FieldType.FILE
|
3091
3146
|
}
|
3092
3147
|
]
|
3093
3148
|
},
|
3094
3149
|
{
|
3095
3150
|
id: "collector.identity.verify",
|
3096
|
-
type:
|
3151
|
+
type: PageTypes.enum.VERIFICATION,
|
3152
|
+
conditional: field("collector.requesterId").isEqualTo("INFORMANT"),
|
3097
3153
|
title: {
|
3098
3154
|
id: "event.tennis-club-membership.action.print.verifyIdentity",
|
3099
3155
|
defaultMessage: "Verify their identity",
|
@@ -3129,62 +3185,45 @@ var PRINT_CERTIFICATE_FORM = defineForm({
|
|
3129
3185
|
}
|
3130
3186
|
}
|
3131
3187
|
}
|
3132
|
-
]
|
3133
|
-
review: {
|
3134
|
-
title: {
|
3135
|
-
id: "v2.event.tennis-club-membership.action.certificate.form.review.title",
|
3136
|
-
defaultMessage: "Member certificate collector for {firstname} {surname}",
|
3137
|
-
description: "Title of the form to show in review page"
|
3138
|
-
},
|
3139
|
-
fields: []
|
3140
|
-
}
|
3188
|
+
]
|
3141
3189
|
});
|
3142
|
-
var
|
3143
|
-
|
3144
|
-
id: "v2.event.tennis-club-membership.action.declare.form.
|
3145
|
-
defaultMessage: "
|
3146
|
-
description: "
|
3147
|
-
},
|
3148
|
-
active: true,
|
3149
|
-
version: {
|
3150
|
-
id: "1.0.0",
|
3151
|
-
label: {
|
3152
|
-
id: "v2.event.tennis-club-membership.action.declare.form.version.1",
|
3153
|
-
defaultMessage: "Version 1",
|
3154
|
-
description: "This is the first version of the form"
|
3155
|
-
}
|
3190
|
+
var TENNIS_CLUB_DECLARATION_REVIEW = {
|
3191
|
+
title: {
|
3192
|
+
id: "v2.event.tennis-club-membership.action.declare.form.review.title",
|
3193
|
+
defaultMessage: "{applicant.firstname, select, __EMPTY__ {Member declaration} other {{applicant.surname, select, __EMPTY__ {Member declaration} other {Member declaration for {applicant.firstname} {applicant.surname}}}}}",
|
3194
|
+
description: "Title of the review page"
|
3156
3195
|
},
|
3157
|
-
|
3158
|
-
|
3159
|
-
id: "
|
3160
|
-
|
3161
|
-
|
3196
|
+
fields: [
|
3197
|
+
{
|
3198
|
+
id: "review.comment",
|
3199
|
+
type: FieldType.TEXTAREA,
|
3200
|
+
label: {
|
3201
|
+
defaultMessage: "Comment",
|
3202
|
+
id: "v2.event.birth.action.declare.form.review.comment.label",
|
3203
|
+
description: "Label for the comment field in the review section"
|
3204
|
+
}
|
3162
3205
|
},
|
3163
|
-
|
3164
|
-
|
3165
|
-
|
3166
|
-
|
3167
|
-
|
3168
|
-
|
3169
|
-
|
3170
|
-
description: "Label for the comment field in the review section"
|
3171
|
-
}
|
3206
|
+
{
|
3207
|
+
type: FieldType.SIGNATURE,
|
3208
|
+
id: "review.signature",
|
3209
|
+
label: {
|
3210
|
+
defaultMessage: "Signature of informant",
|
3211
|
+
id: "v2.event.birth.action.declare.form.review.signature.label",
|
3212
|
+
description: "Label for the signature field in the review section"
|
3172
3213
|
},
|
3173
|
-
{
|
3174
|
-
|
3175
|
-
|
3176
|
-
|
3177
|
-
defaultMessage: "Signature of informant",
|
3178
|
-
id: "v2.event.birth.action.declare.form.review.signature.label",
|
3179
|
-
description: "Label for the signature field in the review section"
|
3180
|
-
},
|
3181
|
-
signaturePromptLabel: {
|
3182
|
-
id: "v2.signature.upload.modal.title",
|
3183
|
-
defaultMessage: "Draw signature",
|
3184
|
-
description: "Title for the modal to draw signature"
|
3185
|
-
}
|
3214
|
+
signaturePromptLabel: {
|
3215
|
+
id: "v2.signature.upload.modal.title",
|
3216
|
+
defaultMessage: "Draw signature",
|
3217
|
+
description: "Title for the modal to draw signature"
|
3186
3218
|
}
|
3187
|
-
|
3219
|
+
}
|
3220
|
+
]
|
3221
|
+
};
|
3222
|
+
var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
3223
|
+
label: {
|
3224
|
+
id: "v2.event.tennis-club-membership.action.declare.form.label",
|
3225
|
+
defaultMessage: "Tennis club membership application",
|
3226
|
+
description: "This is what this form is referred as in the system"
|
3188
3227
|
},
|
3189
3228
|
pages: [
|
3190
3229
|
{
|
@@ -3197,7 +3236,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3197
3236
|
fields: [
|
3198
3237
|
{
|
3199
3238
|
id: "applicant.firstname",
|
3200
|
-
type:
|
3239
|
+
type: FieldType.TEXT,
|
3201
3240
|
required: true,
|
3202
3241
|
conditionals: [],
|
3203
3242
|
label: {
|
@@ -3208,7 +3247,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3208
3247
|
},
|
3209
3248
|
{
|
3210
3249
|
id: "applicant.surname",
|
3211
|
-
type:
|
3250
|
+
type: FieldType.TEXT,
|
3212
3251
|
required: true,
|
3213
3252
|
conditionals: [],
|
3214
3253
|
label: {
|
@@ -3251,7 +3290,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3251
3290
|
},
|
3252
3291
|
{
|
3253
3292
|
id: "applicant.image",
|
3254
|
-
type:
|
3293
|
+
type: FieldType.FILE,
|
3255
3294
|
required: false,
|
3256
3295
|
label: {
|
3257
3296
|
defaultMessage: "Applicant's profile picture",
|
@@ -3272,6 +3311,27 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3272
3311
|
}
|
3273
3312
|
]
|
3274
3313
|
},
|
3314
|
+
{
|
3315
|
+
id: "senior-pass",
|
3316
|
+
conditional: field("applicant.dob").isBefore().date("1950-01-01"),
|
3317
|
+
title: {
|
3318
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.title",
|
3319
|
+
defaultMessage: "Assign senior pass for applicant",
|
3320
|
+
description: "This is the title of the section"
|
3321
|
+
},
|
3322
|
+
fields: [
|
3323
|
+
{
|
3324
|
+
id: "senior-pass.id",
|
3325
|
+
type: FieldType.TEXT,
|
3326
|
+
required: true,
|
3327
|
+
label: {
|
3328
|
+
defaultMessage: "Senior pass ID",
|
3329
|
+
description: "This is the label for the field",
|
3330
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.field.id.label"
|
3331
|
+
}
|
3332
|
+
}
|
3333
|
+
]
|
3334
|
+
},
|
3275
3335
|
{
|
3276
3336
|
id: "recommender",
|
3277
3337
|
title: {
|
@@ -3293,7 +3353,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3293
3353
|
},
|
3294
3354
|
{
|
3295
3355
|
id: "recommender.firstname",
|
3296
|
-
type:
|
3356
|
+
type: FieldType.TEXT,
|
3297
3357
|
required: true,
|
3298
3358
|
conditionals: [
|
3299
3359
|
{
|
@@ -3309,7 +3369,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3309
3369
|
},
|
3310
3370
|
{
|
3311
3371
|
id: "recommender.surname",
|
3312
|
-
type:
|
3372
|
+
type: FieldType.TEXT,
|
3313
3373
|
required: true,
|
3314
3374
|
conditionals: [
|
3315
3375
|
{
|
@@ -3325,7 +3385,7 @@ var TENNIS_CLUB_FORM = defineForm({
|
|
3325
3385
|
},
|
3326
3386
|
{
|
3327
3387
|
id: "recommender.id",
|
3328
|
-
type:
|
3388
|
+
type: FieldType.TEXT,
|
3329
3389
|
required: true,
|
3330
3390
|
conditionals: [
|
3331
3391
|
{
|
@@ -3433,7 +3493,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3433
3493
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
3434
3494
|
id: "event.tennis-club-membership.action.declare.label"
|
3435
3495
|
},
|
3436
|
-
|
3496
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
3437
3497
|
},
|
3438
3498
|
{
|
3439
3499
|
type: ActionType.VALIDATE,
|
@@ -3442,7 +3502,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3442
3502
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
3443
3503
|
id: "event.tennis-club-membership.action.validate.label"
|
3444
3504
|
},
|
3445
|
-
|
3505
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
3446
3506
|
},
|
3447
3507
|
{
|
3448
3508
|
type: ActionType.REGISTER,
|
@@ -3451,7 +3511,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3451
3511
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
3452
3512
|
id: "event.tennis-club-membership.action.register.label"
|
3453
3513
|
},
|
3454
|
-
|
3514
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
3455
3515
|
},
|
3456
3516
|
{
|
3457
3517
|
type: ActionType.REQUEST_CORRECTION,
|
@@ -3460,10 +3520,10 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3460
3520
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
3461
3521
|
id: "event.tennis-club-membership.action.correction.request.label"
|
3462
3522
|
},
|
3463
|
-
forms: [TENNIS_CLUB_FORM],
|
3464
3523
|
onboardingForm: [
|
3465
3524
|
{
|
3466
3525
|
id: "correction-requester",
|
3526
|
+
type: PageTypes.enum.FORM,
|
3467
3527
|
title: {
|
3468
3528
|
id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
|
3469
3529
|
defaultMessage: "Correction requester",
|
@@ -3527,6 +3587,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3527
3587
|
},
|
3528
3588
|
{
|
3529
3589
|
id: "identity-check",
|
3590
|
+
type: PageTypes.enum.FORM,
|
3530
3591
|
title: {
|
3531
3592
|
id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
|
3532
3593
|
defaultMessage: "Verify their identity",
|
@@ -3569,6 +3630,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3569
3630
|
additionalDetailsForm: [
|
3570
3631
|
{
|
3571
3632
|
id: "correction-request.supporting-documents",
|
3633
|
+
type: PageTypes.enum.FORM,
|
3572
3634
|
title: {
|
3573
3635
|
id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
|
3574
3636
|
defaultMessage: "Upload supporting documents",
|
@@ -3586,7 +3648,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3586
3648
|
},
|
3587
3649
|
{
|
3588
3650
|
id: "correction.supportingDocs",
|
3589
|
-
type:
|
3651
|
+
type: FieldType.FILE,
|
3590
3652
|
label: {
|
3591
3653
|
id: "correction.corrector.title",
|
3592
3654
|
defaultMessage: "Upload supporting documents",
|
@@ -3630,6 +3692,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3630
3692
|
},
|
3631
3693
|
{
|
3632
3694
|
id: "correction-request.additional-details",
|
3695
|
+
type: PageTypes.enum.FORM,
|
3633
3696
|
title: {
|
3634
3697
|
id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
|
3635
3698
|
defaultMessage: "Reason for correction",
|
@@ -3638,7 +3701,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3638
3701
|
fields: [
|
3639
3702
|
{
|
3640
3703
|
id: "correction.request.reason",
|
3641
|
-
type:
|
3704
|
+
type: FieldType.TEXT,
|
3642
3705
|
label: {
|
3643
3706
|
id: "correction.reason.title",
|
3644
3707
|
defaultMessage: "Reason for correction?",
|
@@ -3651,7 +3714,6 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3651
3714
|
},
|
3652
3715
|
{
|
3653
3716
|
type: ActionType.APPROVE_CORRECTION,
|
3654
|
-
forms: [TENNIS_CLUB_FORM],
|
3655
3717
|
label: {
|
3656
3718
|
defaultMessage: "Approve correction",
|
3657
3719
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
@@ -3665,7 +3727,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3665
3727
|
defaultMessage: "Print certificate",
|
3666
3728
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
3667
3729
|
},
|
3668
|
-
|
3730
|
+
printForm: PRINT_CERTIFICATE_FORM,
|
3669
3731
|
conditionals: [
|
3670
3732
|
{
|
3671
3733
|
type: "SHOW",
|
@@ -3712,8 +3774,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3712
3774
|
id: "v2.event.tennis-club-membership.action.archive.label",
|
3713
3775
|
defaultMessage: "Archive",
|
3714
3776
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
3715
|
-
}
|
3716
|
-
forms: [TENNIS_CLUB_FORM]
|
3777
|
+
}
|
3717
3778
|
},
|
3718
3779
|
{
|
3719
3780
|
type: ActionType.REJECT,
|
@@ -3721,8 +3782,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3721
3782
|
id: "v2.event.tennis-club-membership.action.reject.label",
|
3722
3783
|
defaultMessage: "Reject",
|
3723
3784
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
3724
|
-
}
|
3725
|
-
forms: [TENNIS_CLUB_FORM]
|
3785
|
+
}
|
3726
3786
|
}
|
3727
3787
|
],
|
3728
3788
|
advancedSearch: [
|
@@ -3738,33 +3798,49 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3738
3798
|
}
|
3739
3799
|
]
|
3740
3800
|
}
|
3741
|
-
]
|
3801
|
+
],
|
3802
|
+
declaration: TENNIS_CLUB_DECLARATION_FORM
|
3742
3803
|
});
|
3743
3804
|
|
3744
3805
|
// ../commons/src/events/test.utils.ts
|
3745
|
-
function
|
3746
|
-
|
3747
|
-
const data = fields.reduce(
|
3806
|
+
function fieldConfigsToActionAnnotation(fields) {
|
3807
|
+
return fields.reduce(
|
3748
3808
|
(acc, field2, i) => ({
|
3749
3809
|
...acc,
|
3750
3810
|
[field2.id]: mapFieldTypeToMockValue(field2, i)
|
3751
3811
|
}),
|
3752
3812
|
{}
|
3753
3813
|
);
|
3754
|
-
|
3814
|
+
}
|
3815
|
+
function generateActionInput(configuration, action) {
|
3816
|
+
const parsed = DeclarationUpdateActions.safeParse(action);
|
3817
|
+
if (parsed.success) {
|
3818
|
+
const fields = getDeclarationFields(configuration);
|
3819
|
+
const annotation = fieldConfigsToActionAnnotation(fields);
|
3820
|
+
return stripHiddenFields(fields, annotation);
|
3821
|
+
}
|
3822
|
+
console.warn(`${action} is not a declaration action. Setting data as {}.`);
|
3823
|
+
return {};
|
3755
3824
|
}
|
3756
3825
|
function generateActionMetadataInput(configuration, action) {
|
3757
|
-
const
|
3758
|
-
|
3759
|
-
action
|
3826
|
+
const actionConfig = configuration.actions.find(
|
3827
|
+
(actionConfig2) => actionConfig2.type === action
|
3760
3828
|
);
|
3761
|
-
|
3829
|
+
const annotationFields = actionConfig ? getActionAnnotationFields(actionConfig) : [];
|
3830
|
+
const annotation = fieldConfigsToActionAnnotation(annotationFields);
|
3831
|
+
const visibleVerificationPageIds = (findRecordActionPages(configuration, action) ?? []).filter((page) => isVerificationPage(page)).filter((page) => isPageVisible(page, annotation)).map((page) => page.id) ?? [];
|
3832
|
+
const visiblePageVerificationMap = visibleVerificationPageIds.reduce(
|
3762
3833
|
(acc, pageId) => ({
|
3763
3834
|
...acc,
|
3764
3835
|
[pageId]: true
|
3765
3836
|
}),
|
3766
3837
|
{}
|
3767
3838
|
);
|
3839
|
+
const fieldBasedPayload = stripHiddenFields(annotationFields, annotation);
|
3840
|
+
return {
|
3841
|
+
...fieldBasedPayload,
|
3842
|
+
...visiblePageVerificationMap
|
3843
|
+
};
|
3768
3844
|
}
|
3769
3845
|
var eventPayloadGenerator = {
|
3770
3846
|
create: (input = {}) => ({
|
@@ -3784,13 +3860,13 @@ var eventPayloadGenerator = {
|
|
3784
3860
|
transactionId: getUUID(),
|
3785
3861
|
action: {
|
3786
3862
|
type: ActionType.REQUEST_CORRECTION,
|
3787
|
-
|
3863
|
+
declaration: {
|
3788
3864
|
"applicant.firstname": "Max",
|
3789
3865
|
"applicant.surname": "McLaren",
|
3790
3866
|
"applicant.dob": "2020-01-02",
|
3791
3867
|
"recommender.none": true
|
3792
3868
|
},
|
3793
|
-
|
3869
|
+
annotation: {
|
3794
3870
|
"correction.requester.relationship": "ANOTHER_AGENT",
|
3795
3871
|
"correction.request.reason": "Child's name was incorrect"
|
3796
3872
|
},
|
@@ -3805,45 +3881,78 @@ var eventPayloadGenerator = {
|
|
3805
3881
|
declare: (eventId, input = {}) => ({
|
3806
3882
|
type: ActionType.DECLARE,
|
3807
3883
|
transactionId: input.transactionId ?? getUUID(),
|
3808
|
-
|
3884
|
+
declaration: input.declaration ?? generateActionInput(tennisClubMembershipEvent, ActionType.DECLARE),
|
3885
|
+
annotation: input.annotation ?? generateActionMetadataInput(
|
3886
|
+
tennisClubMembershipEvent,
|
3887
|
+
ActionType.DECLARE
|
3888
|
+
),
|
3809
3889
|
eventId
|
3810
3890
|
}),
|
3891
|
+
/**
|
3892
|
+
* Notify allows sending incomplete data. Think it as 'partial declare' for now.
|
3893
|
+
*/
|
3894
|
+
notify: (eventId, input = {}) => {
|
3895
|
+
let declaration = input.declaration;
|
3896
|
+
if (!declaration) {
|
3897
|
+
const partialDeclaration = (0, import_lodash2.omitBy)(
|
3898
|
+
generateActionInput(tennisClubMembershipEvent, ActionType.DECLARE),
|
3899
|
+
import_lodash2.isString
|
3900
|
+
);
|
3901
|
+
declaration = partialDeclaration;
|
3902
|
+
}
|
3903
|
+
return {
|
3904
|
+
type: ActionType.NOTIFY,
|
3905
|
+
transactionId: input.transactionId ?? getUUID(),
|
3906
|
+
declaration,
|
3907
|
+
eventId
|
3908
|
+
};
|
3909
|
+
},
|
3811
3910
|
validate: (eventId, input = {}) => ({
|
3812
3911
|
type: ActionType.VALIDATE,
|
3813
3912
|
transactionId: input.transactionId ?? getUUID(),
|
3814
|
-
|
3913
|
+
declaration: input.declaration ?? generateActionInput(tennisClubMembershipEvent, ActionType.VALIDATE),
|
3914
|
+
annotation: input.annotation ?? generateActionMetadataInput(
|
3915
|
+
tennisClubMembershipEvent,
|
3916
|
+
ActionType.VALIDATE
|
3917
|
+
),
|
3815
3918
|
duplicates: [],
|
3816
3919
|
eventId
|
3817
3920
|
}),
|
3818
3921
|
archive: (eventId, input = {}, isDuplicate) => ({
|
3819
3922
|
type: ActionType.ARCHIVE,
|
3820
3923
|
transactionId: input.transactionId ?? getUUID(),
|
3821
|
-
|
3822
|
-
|
3924
|
+
declaration: {},
|
3925
|
+
// @TODO: Check whether generator is needed?
|
3926
|
+
annotation: { isDuplicate: isDuplicate ?? false },
|
3823
3927
|
duplicates: [],
|
3824
3928
|
eventId
|
3825
3929
|
}),
|
3826
3930
|
reject: (eventId, input = {}) => ({
|
3827
3931
|
type: ActionType.REJECT,
|
3828
3932
|
transactionId: input.transactionId ?? getUUID(),
|
3829
|
-
|
3933
|
+
declaration: {},
|
3934
|
+
annotation: input.annotation ?? generateActionMetadataInput(
|
3935
|
+
tennisClubMembershipEvent,
|
3936
|
+
ActionType.REJECT
|
3937
|
+
),
|
3830
3938
|
duplicates: [],
|
3831
3939
|
eventId
|
3832
3940
|
}),
|
3833
3941
|
register: (eventId, input = {}) => ({
|
3834
3942
|
type: ActionType.REGISTER,
|
3835
3943
|
transactionId: input.transactionId ?? getUUID(),
|
3836
|
-
|
3944
|
+
declaration: input.declaration ?? generateActionInput(tennisClubMembershipEvent, ActionType.REGISTER),
|
3945
|
+
annotation: input.annotation ?? generateActionMetadataInput(
|
3946
|
+
tennisClubMembershipEvent,
|
3947
|
+
ActionType.REGISTER
|
3948
|
+
),
|
3837
3949
|
eventId
|
3838
3950
|
}),
|
3839
3951
|
printCertificate: (eventId, input = {}) => ({
|
3840
3952
|
type: ActionType.PRINT_CERTIFICATE,
|
3841
3953
|
transactionId: input.transactionId ?? getUUID(),
|
3842
|
-
|
3843
|
-
|
3844
|
-
ActionType.PRINT_CERTIFICATE
|
3845
|
-
),
|
3846
|
-
metadata: input.metadata ?? generateActionMetadataInput(
|
3954
|
+
declaration: {},
|
3955
|
+
annotation: input.annotation ?? generateActionMetadataInput(
|
3847
3956
|
tennisClubMembershipEvent,
|
3848
3957
|
ActionType.PRINT_CERTIFICATE
|
3849
3958
|
),
|
@@ -3853,17 +3962,21 @@ var eventPayloadGenerator = {
|
|
3853
3962
|
request: (eventId, input = {}) => ({
|
3854
3963
|
type: ActionType.REQUEST_CORRECTION,
|
3855
3964
|
transactionId: input.transactionId ?? getUUID(),
|
3856
|
-
|
3965
|
+
declaration: input.declaration ?? generateActionInput(
|
3966
|
+
tennisClubMembershipEvent,
|
3967
|
+
ActionType.REQUEST_CORRECTION
|
3968
|
+
),
|
3969
|
+
annotation: input.annotation ?? generateActionMetadataInput(
|
3857
3970
|
tennisClubMembershipEvent,
|
3858
3971
|
ActionType.REQUEST_CORRECTION
|
3859
3972
|
),
|
3860
|
-
metadata: {},
|
3861
3973
|
eventId
|
3862
3974
|
}),
|
3863
3975
|
approve: (eventId, requestId, input = {}) => ({
|
3864
3976
|
type: ActionType.APPROVE_CORRECTION,
|
3865
3977
|
transactionId: input.transactionId ?? getUUID(),
|
3866
|
-
|
3978
|
+
declaration: {},
|
3979
|
+
annotation: input.annotation ?? generateActionMetadataInput(
|
3867
3980
|
tennisClubMembershipEvent,
|
3868
3981
|
ActionType.APPROVE_CORRECTION
|
3869
3982
|
),
|
@@ -3873,7 +3986,8 @@ var eventPayloadGenerator = {
|
|
3873
3986
|
reject: (eventId, requestId, input = {}) => ({
|
3874
3987
|
type: ActionType.REJECT_CORRECTION,
|
3875
3988
|
transactionId: input.transactionId ?? getUUID(),
|
3876
|
-
|
3989
|
+
declaration: {},
|
3990
|
+
annotation: input.annotation ?? generateActionMetadataInput(
|
3877
3991
|
tennisClubMembershipEvent,
|
3878
3992
|
ActionType.REJECT_CORRECTION
|
3879
3993
|
),
|
@@ -3895,8 +4009,8 @@ function generateActionDocument({
|
|
3895
4009
|
createdBy: getUUID(),
|
3896
4010
|
id: getUUID(),
|
3897
4011
|
createdAtLocation: "TODO",
|
3898
|
-
|
3899
|
-
|
4012
|
+
declaration: generateActionInput(configuration, action),
|
4013
|
+
annotation: {},
|
3900
4014
|
...defaults
|
3901
4015
|
};
|
3902
4016
|
switch (action) {
|
@@ -3924,8 +4038,6 @@ function generateActionDocument({
|
|
3924
4038
|
return { ...actionBase, requestId: getUUID(), type: action };
|
3925
4039
|
case ActionType.REJECT_CORRECTION:
|
3926
4040
|
return { ...actionBase, requestId: getUUID(), type: action };
|
3927
|
-
case ActionType.CUSTOM:
|
3928
|
-
return { ...actionBase, type: action };
|
3929
4041
|
case ActionType.REGISTER:
|
3930
4042
|
return {
|
3931
4043
|
...actionBase,
|
@@ -3955,7 +4067,7 @@ function generateEventDocument({
|
|
3955
4067
|
updatedAt: new Date(Date.now() - 1e3).toISOString()
|
3956
4068
|
};
|
3957
4069
|
}
|
3958
|
-
function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE,
|
4070
|
+
function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, declaration = {}) {
|
3959
4071
|
const action = generateActionDocument({
|
3960
4072
|
configuration: tennisClubMembershipEvent,
|
3961
4073
|
action: actionType
|
@@ -3965,9 +4077,9 @@ function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, da
|
|
3965
4077
|
transactionId: getUUID(),
|
3966
4078
|
action: {
|
3967
4079
|
...action,
|
3968
|
-
|
3969
|
-
...action.
|
3970
|
-
...
|
4080
|
+
declaration: {
|
4081
|
+
...action.declaration,
|
4082
|
+
...declaration
|
3971
4083
|
}
|
3972
4084
|
},
|
3973
4085
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
@@ -3984,7 +4096,7 @@ var eventQueryDataGenerator = (overrides = {}) => ({
|
|
3984
4096
|
modifiedAt: overrides.modifiedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
3985
4097
|
assignedTo: overrides.assignedTo ?? null,
|
3986
4098
|
updatedBy: overrides.updatedBy ?? getUUID(),
|
3987
|
-
|
4099
|
+
declaration: overrides.declaration ?? {
|
3988
4100
|
"recommender.none": true,
|
3989
4101
|
"applicant.firstname": "Danny",
|
3990
4102
|
"applicant.surname": "Doe",
|