@opencrvs/toolkit 2.0.0-rc.e1d7e00 → 2.0.0-rc.e20c746
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/application-config/index.js +9 -2
- package/dist/cli.js +1 -1
- package/dist/commons/api/router.d.ts +13 -2
- package/dist/commons/events/ActionConfig.d.ts +204 -2
- package/dist/commons/events/CountryConfigQueryInput.d.ts +42 -0
- package/dist/commons/events/EventIndex.d.ts +14 -0
- package/dist/commons/events/FieldConfig.d.ts +1 -0
- package/dist/commons/events/FieldType.d.ts +1 -0
- package/dist/commons/events/FieldTypeMapping.d.ts +1 -1
- package/dist/commons/events/WorkqueueConfig.d.ts +39 -0
- package/dist/events/index.js +247 -70
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.js +1 -1
- package/dist/migrations/v2.0/index.js +1 -1
- package/dist/notification/index.js +189 -7
- package/opencrvs-toolkit-2.0.0-rc.e20c746.tgz +0 -0
- package/package.json +1 -1
- package/opencrvs-toolkit-2.0.0-rc.e1d7e00.tgz +0 -0
|
@@ -770,6 +770,11 @@ var FieldTypesToHideInReview = [
|
|
|
770
770
|
FieldType.ALPHA_PRINT_BUTTON,
|
|
771
771
|
FieldType.ALPHA_HIDDEN
|
|
772
772
|
];
|
|
773
|
+
var HiddenFieldTypes = [
|
|
774
|
+
FieldType.HTTP,
|
|
775
|
+
FieldType.QUERY_PARAM_READER,
|
|
776
|
+
FieldType.ALPHA_HIDDEN
|
|
777
|
+
];
|
|
773
778
|
|
|
774
779
|
// ../commons/src/events/FieldValue.ts
|
|
775
780
|
var z12 = __toESM(require("zod/v4"));
|
|
@@ -888,7 +893,7 @@ var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date i
|
|
|
888
893
|
// ../commons/src/events/FieldValue.ts
|
|
889
894
|
var TextValue = z12.string();
|
|
890
895
|
var HiddenFieldValue = z12.string();
|
|
891
|
-
var NonEmptyTextValue =
|
|
896
|
+
var NonEmptyTextValue = z12.string().trim().min(1);
|
|
892
897
|
var DateValue = z12.iso.date().describe("Date in the format YYYY-MM-DD");
|
|
893
898
|
var AgeValue = z12.object({
|
|
894
899
|
age: z12.number(),
|
|
@@ -1478,7 +1483,8 @@ var Range = import_v4.z.object({
|
|
|
1478
1483
|
});
|
|
1479
1484
|
var ContainsFlags = import_v4.z.object({
|
|
1480
1485
|
anyOf: import_v4.z.array(Flag).optional(),
|
|
1481
|
-
noneOf: import_v4.z.array(Flag).optional()
|
|
1486
|
+
noneOf: import_v4.z.array(Flag).optional(),
|
|
1487
|
+
allOf: import_v4.z.array(Flag).optional()
|
|
1482
1488
|
}).meta({
|
|
1483
1489
|
id: "ContainsFlags"
|
|
1484
1490
|
});
|
|
@@ -1750,6 +1756,7 @@ var NumberField = BaseField.extend({
|
|
|
1750
1756
|
configuration: import_v43.default.object({
|
|
1751
1757
|
min: import_v43.default.number().optional().describe("Minimum value"),
|
|
1752
1758
|
max: import_v43.default.number().optional().describe("Maximum value"),
|
|
1759
|
+
integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
|
|
1753
1760
|
prefix: TranslationConfig.optional(),
|
|
1754
1761
|
postfix: TranslationConfig.optional()
|
|
1755
1762
|
}).optional()
|
|
@@ -2673,6 +2680,57 @@ var ReadActionConfig = ActionConfigBase.extend(
|
|
|
2673
2680
|
conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
|
|
2674
2681
|
}).shape
|
|
2675
2682
|
);
|
|
2683
|
+
var NotifyConfig = ActionConfigBase.extend(
|
|
2684
|
+
z24.object({
|
|
2685
|
+
type: z24.literal(ActionType.NOTIFY)
|
|
2686
|
+
}).shape
|
|
2687
|
+
);
|
|
2688
|
+
var DuplicateDetectedConfig = ActionConfigBase.extend(
|
|
2689
|
+
z24.object({
|
|
2690
|
+
type: z24.literal(ActionType.DUPLICATE_DETECTED),
|
|
2691
|
+
label: z24.never().optional().describe(
|
|
2692
|
+
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
|
|
2693
|
+
),
|
|
2694
|
+
supportingCopy: z24.never().optional(),
|
|
2695
|
+
icon: z24.never().optional().describe(
|
|
2696
|
+
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
|
|
2697
|
+
),
|
|
2698
|
+
conditionals: z24.never().optional().describe(
|
|
2699
|
+
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
|
|
2700
|
+
)
|
|
2701
|
+
}).shape
|
|
2702
|
+
);
|
|
2703
|
+
var MarkAsDuplicateConfig = ActionConfigBase.extend(
|
|
2704
|
+
z24.object({
|
|
2705
|
+
type: z24.literal(ActionType.MARK_AS_DUPLICATE)
|
|
2706
|
+
}).shape
|
|
2707
|
+
);
|
|
2708
|
+
var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
|
|
2709
|
+
z24.object({
|
|
2710
|
+
type: z24.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
2711
|
+
}).shape
|
|
2712
|
+
);
|
|
2713
|
+
var AssignConfig = ActionConfigBase.extend(
|
|
2714
|
+
z24.object({
|
|
2715
|
+
type: z24.literal(ActionType.ASSIGN),
|
|
2716
|
+
flags: z24.never().optional().describe(
|
|
2717
|
+
"ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
2718
|
+
)
|
|
2719
|
+
}).shape
|
|
2720
|
+
);
|
|
2721
|
+
var UnassignConfig = ActionConfigBase.extend(
|
|
2722
|
+
z24.object({
|
|
2723
|
+
type: z24.literal(ActionType.UNASSIGN),
|
|
2724
|
+
flags: z24.never().optional().describe(
|
|
2725
|
+
"UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
2726
|
+
)
|
|
2727
|
+
}).shape
|
|
2728
|
+
);
|
|
2729
|
+
var DeleteConfig = ActionConfigBase.extend(
|
|
2730
|
+
z24.object({
|
|
2731
|
+
type: z24.literal(ActionType.DELETE)
|
|
2732
|
+
}).shape
|
|
2733
|
+
);
|
|
2676
2734
|
var DeclareConfig = DeclarationActionBase.extend(
|
|
2677
2735
|
z24.object({
|
|
2678
2736
|
type: z24.literal(ActionType.DECLARE),
|
|
@@ -2735,7 +2793,17 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
|
|
|
2735
2793
|
correctionForm: ActionFormConfig
|
|
2736
2794
|
}).shape
|
|
2737
2795
|
);
|
|
2738
|
-
var
|
|
2796
|
+
var ApproveCorrectionConfig = ActionConfigBase.extend(
|
|
2797
|
+
z24.object({
|
|
2798
|
+
type: z24.literal(ActionType.APPROVE_CORRECTION)
|
|
2799
|
+
}).shape
|
|
2800
|
+
);
|
|
2801
|
+
var RejectCorrectionConfig = ActionConfigBase.extend(
|
|
2802
|
+
z24.object({
|
|
2803
|
+
type: z24.literal(ActionType.REJECT_CORRECTION)
|
|
2804
|
+
}).shape
|
|
2805
|
+
);
|
|
2806
|
+
var CustomActionConfig = ActionConfigBase.extend(
|
|
2739
2807
|
z24.object({
|
|
2740
2808
|
type: z24.literal(ActionType.CUSTOM),
|
|
2741
2809
|
customActionType: z24.string().describe("Type identifier of the custom action."),
|
|
@@ -2746,7 +2814,7 @@ var CustomActionConfig = ActionConfigBase.merge(
|
|
|
2746
2814
|
auditHistoryLabel: TranslationConfig.describe(
|
|
2747
2815
|
'The label to show in audit history for this action. For example "Approved".'
|
|
2748
2816
|
)
|
|
2749
|
-
})
|
|
2817
|
+
}).shape
|
|
2750
2818
|
);
|
|
2751
2819
|
var ActionConfig = z24.discriminatedUnion("type", [
|
|
2752
2820
|
/*
|
|
@@ -2757,9 +2825,37 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
2757
2825
|
id: "ReadActionConfig",
|
|
2758
2826
|
description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
|
|
2759
2827
|
}),
|
|
2828
|
+
AssignConfig.meta({
|
|
2829
|
+
id: "AssignActionConfig",
|
|
2830
|
+
description: "Configuration for assigning a record to the current user."
|
|
2831
|
+
}),
|
|
2832
|
+
UnassignConfig.meta({
|
|
2833
|
+
id: "UnassignActionConfig",
|
|
2834
|
+
description: "Configuration for unassigning a record from its current assignee."
|
|
2835
|
+
}),
|
|
2836
|
+
DeleteConfig.meta({
|
|
2837
|
+
id: "DeleteActionConfig",
|
|
2838
|
+
description: "Configuration for deleting a draft record."
|
|
2839
|
+
}),
|
|
2840
|
+
NotifyConfig.meta({
|
|
2841
|
+
id: "NotifyActionConfig",
|
|
2842
|
+
description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
|
|
2843
|
+
}),
|
|
2760
2844
|
DeclareConfig.meta({
|
|
2761
2845
|
id: "DeclareActionConfig",
|
|
2762
|
-
description: "Configuration for the declare action. Includes review-page fields.
|
|
2846
|
+
description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
|
|
2847
|
+
}),
|
|
2848
|
+
DuplicateDetectedConfig.meta({
|
|
2849
|
+
id: "DuplicateDetectedActionConfig",
|
|
2850
|
+
description: "Configuration for the system-generated duplicate-detection action. Never shown as a button, so it only supports flags \u2014 not label, icon, or conditionals."
|
|
2851
|
+
}),
|
|
2852
|
+
MarkAsDuplicateConfig.meta({
|
|
2853
|
+
id: "MarkAsDuplicateActionConfig",
|
|
2854
|
+
description: "Configuration for marking a record as a duplicate."
|
|
2855
|
+
}),
|
|
2856
|
+
MarkAsNotDuplicateConfig.meta({
|
|
2857
|
+
id: "MarkAsNotDuplicateActionConfig",
|
|
2858
|
+
description: "Configuration for marking a record as not a duplicate, after it was previously flagged as one."
|
|
2763
2859
|
}),
|
|
2764
2860
|
RejectConfig.meta({
|
|
2765
2861
|
id: "RejectActionConfig",
|
|
@@ -2777,6 +2873,14 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
2777
2873
|
id: "RequestCorrectionActionConfig",
|
|
2778
2874
|
description: "Configuration for requesting a correction on a registered record."
|
|
2779
2875
|
}),
|
|
2876
|
+
ApproveCorrectionConfig.meta({
|
|
2877
|
+
id: "ApproveCorrectionActionConfig",
|
|
2878
|
+
description: "Configuration for approving a requested correction."
|
|
2879
|
+
}),
|
|
2880
|
+
RejectCorrectionConfig.meta({
|
|
2881
|
+
id: "RejectCorrectionActionConfig",
|
|
2882
|
+
description: "Configuration for rejecting a requested correction."
|
|
2883
|
+
}),
|
|
2780
2884
|
EditActionConfig.meta({
|
|
2781
2885
|
id: "EditActionConfig",
|
|
2782
2886
|
description: "Configuration for editing a record before registration."
|
|
@@ -3193,7 +3297,7 @@ var getActionAnnotationFields = (actionConfig) => {
|
|
|
3193
3297
|
if (actionConfig.type === ActionType.CUSTOM) {
|
|
3194
3298
|
return actionConfig.form;
|
|
3195
3299
|
}
|
|
3196
|
-
if ("review" in actionConfig) {
|
|
3300
|
+
if ("review" in actionConfig && actionConfig.review != null) {
|
|
3197
3301
|
return actionConfig.review.fields;
|
|
3198
3302
|
}
|
|
3199
3303
|
return [];
|
|
@@ -3904,7 +4008,7 @@ function validateActionFlags(event2, ctx) {
|
|
|
3904
4008
|
const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
|
|
3905
4009
|
const configuredFlagIds = event2.flags.map((flag) => flag.id);
|
|
3906
4010
|
const actionFlagIds = event2.actions.flatMap(
|
|
3907
|
-
(action) => action.flags.map((flag) => flag.id)
|
|
4011
|
+
(action) => (action.flags ?? []).map((flag) => flag.id)
|
|
3908
4012
|
);
|
|
3909
4013
|
for (const actionFlagId of actionFlagIds) {
|
|
3910
4014
|
const isConfigured = configuredFlagIds.includes(actionFlagId);
|
|
@@ -4697,12 +4801,53 @@ var updateActions = ActionTypes.extract([
|
|
|
4697
4801
|
ActionType.ARCHIVE,
|
|
4698
4802
|
ActionType.PRINT_CERTIFICATE,
|
|
4699
4803
|
ActionType.REQUEST_CORRECTION,
|
|
4804
|
+
ActionType.APPROVE_CORRECTION,
|
|
4805
|
+
ActionType.REJECT_CORRECTION,
|
|
4700
4806
|
ActionType.CUSTOM
|
|
4701
4807
|
]);
|
|
4702
4808
|
|
|
4703
4809
|
// ../commons/src/events/state/flags.ts
|
|
4704
4810
|
var import_lodash3 = require("lodash");
|
|
4705
4811
|
var import_date_fns3 = require("date-fns");
|
|
4812
|
+
var INHERENT_FLAG_RULES = [
|
|
4813
|
+
{
|
|
4814
|
+
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
4815
|
+
setOn: [ActionType.REQUEST_CORRECTION],
|
|
4816
|
+
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
4817
|
+
},
|
|
4818
|
+
{
|
|
4819
|
+
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
4820
|
+
// other status-changing action (see getStatusFromActions).
|
|
4821
|
+
flag: InherentFlags.INCOMPLETE,
|
|
4822
|
+
setOn: [ActionType.NOTIFY],
|
|
4823
|
+
resetOn: [
|
|
4824
|
+
ActionType.CREATE,
|
|
4825
|
+
ActionType.DECLARE,
|
|
4826
|
+
ActionType.REGISTER,
|
|
4827
|
+
ActionType.ARCHIVE
|
|
4828
|
+
]
|
|
4829
|
+
},
|
|
4830
|
+
{
|
|
4831
|
+
flag: InherentFlags.REJECTED,
|
|
4832
|
+
setOn: [ActionType.REJECT],
|
|
4833
|
+
resetOn: [
|
|
4834
|
+
ActionType.NOTIFY,
|
|
4835
|
+
ActionType.DECLARE,
|
|
4836
|
+
ActionType.EDIT,
|
|
4837
|
+
ActionType.REGISTER
|
|
4838
|
+
]
|
|
4839
|
+
},
|
|
4840
|
+
{
|
|
4841
|
+
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
4842
|
+
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
4843
|
+
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
4844
|
+
},
|
|
4845
|
+
{
|
|
4846
|
+
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
4847
|
+
setOn: [ActionType.EDIT],
|
|
4848
|
+
resetOnAnyOtherAction: true
|
|
4849
|
+
}
|
|
4850
|
+
];
|
|
4706
4851
|
|
|
4707
4852
|
// ../commons/src/events/defineConfig.ts
|
|
4708
4853
|
var IGNORED_EVENT_TYPES = [
|
|
@@ -5448,6 +5593,11 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
|
|
|
5448
5593
|
id: "signature.upload.modal.title",
|
|
5449
5594
|
defaultMessage: "Draw signature",
|
|
5450
5595
|
description: "Title for the modal to draw signature"
|
|
5596
|
+
},
|
|
5597
|
+
// Zod applies the schema default at parse time, but this fixture bypasses
|
|
5598
|
+
// parsing — GeneratedInputField accesses configuration.maxFileSize directly.
|
|
5599
|
+
configuration: {
|
|
5600
|
+
maxFileSize: 5 * 1024 * 1024
|
|
5451
5601
|
}
|
|
5452
5602
|
}
|
|
5453
5603
|
]
|
|
@@ -6004,6 +6154,20 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
6004
6154
|
},
|
|
6005
6155
|
review: TENNIS_CLUB_DECLARATION_REVIEW
|
|
6006
6156
|
},
|
|
6157
|
+
{
|
|
6158
|
+
type: ActionType.NOTIFY,
|
|
6159
|
+
label: {
|
|
6160
|
+
defaultMessage: "Notify health worker",
|
|
6161
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
6162
|
+
id: "event.tennis-club-membership.action.notify.label"
|
|
6163
|
+
},
|
|
6164
|
+
flags: [
|
|
6165
|
+
{
|
|
6166
|
+
id: "health-worker-notified",
|
|
6167
|
+
operation: "add"
|
|
6168
|
+
}
|
|
6169
|
+
]
|
|
6170
|
+
},
|
|
6007
6171
|
{
|
|
6008
6172
|
type: ActionType.REJECT,
|
|
6009
6173
|
label: {
|
|
@@ -6246,6 +6410,17 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
6246
6410
|
}
|
|
6247
6411
|
}
|
|
6248
6412
|
],
|
|
6413
|
+
flags: [
|
|
6414
|
+
{
|
|
6415
|
+
id: "health-worker-notified",
|
|
6416
|
+
requiresAction: false,
|
|
6417
|
+
label: {
|
|
6418
|
+
id: "event.tennis-club-membership.flag.health-worker-notified.label",
|
|
6419
|
+
defaultMessage: "Health worker notified",
|
|
6420
|
+
description: "Label for the health-worker-notified flag"
|
|
6421
|
+
}
|
|
6422
|
+
}
|
|
6423
|
+
],
|
|
6249
6424
|
advancedSearch: [
|
|
6250
6425
|
{
|
|
6251
6426
|
title: {
|
|
@@ -7241,6 +7416,13 @@ var ACTION_FILTERS = {
|
|
|
7241
7416
|
[ActionType.UNASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
|
|
7242
7417
|
[ActionType.CUSTOM]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
|
|
7243
7418
|
};
|
|
7419
|
+
var REJECTED_ACTIONS = [
|
|
7420
|
+
ActionType.READ,
|
|
7421
|
+
ActionType.NOTIFY,
|
|
7422
|
+
ActionType.CUSTOM,
|
|
7423
|
+
ActionType.EDIT,
|
|
7424
|
+
ActionType.ARCHIVE
|
|
7425
|
+
];
|
|
7244
7426
|
|
|
7245
7427
|
// ../commons/src/events/FileUtils.ts
|
|
7246
7428
|
var import_lodash7 = require("lodash");
|
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|