@opencrvs/toolkit 2.1.0-rc.d6a3ca1 → 2.1.0-rc.d876831
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 -0
- package/dist/application-config/index.js +228 -196
- package/dist/cli.js +174 -58
- package/dist/commons/api/router.d.ts +295 -18
- package/dist/commons/conditionals/conditionals.d.ts +6 -6
- package/dist/commons/conditionals/validate.d.ts +11 -4
- package/dist/commons/events/ActionDocument.d.ts +1 -7
- package/dist/commons/events/ActionStatus.d.ts +14 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +12 -0
- package/dist/commons/events/AuditLog.d.ts +147 -0
- package/dist/commons/events/EventConfig.d.ts +3 -0
- package/dist/commons/events/EventIndex.d.ts +3 -26
- package/dist/commons/events/FieldConfig.d.ts +70 -53
- package/dist/commons/events/FieldTypeMapping.d.ts +19 -19
- package/dist/commons/events/FieldValue.d.ts +2 -2
- package/dist/commons/events/Flag.d.ts +42 -0
- package/dist/commons/events/PlainDate.d.ts +8 -0
- package/dist/commons/events/SummaryConfig.d.ts +249 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +17 -14
- package/dist/commons/events/event.d.ts +12 -0
- package/dist/commons/events/index.d.ts +1 -0
- package/dist/commons/events/locationPayloads.d.ts +95 -0
- package/dist/commons/events/locations.d.ts +191 -11
- package/dist/commons/events/mocks.test.utils.d.ts +46 -2
- package/dist/commons/events/test.utils.d.ts +5 -5
- package/dist/conditionals/index.js +303 -55
- package/dist/environment/index.d.ts +1 -0
- package/dist/environment/index.d.ts.map +1 -1
- package/dist/environment/index.js +10 -0
- package/dist/environment/logger.d.ts +12 -3
- package/dist/environment/logger.d.ts.map +1 -1
- package/dist/environment/paths.d.ts +7 -0
- package/dist/environment/paths.d.ts.map +1 -0
- package/dist/environment/paths.js +72 -0
- package/dist/environment/setup-environment.js +2 -1
- package/dist/environment/templates.d.ts.map +1 -1
- package/dist/environment/templates.js +2 -1
- package/dist/environment/update-workflows.d.ts.map +1 -1
- package/dist/environment/update-workflows.js +17 -5
- package/dist/environment/upgrade.d.ts +2 -0
- package/dist/environment/upgrade.d.ts.map +1 -0
- package/dist/environment/upgrade.js +82 -0
- package/dist/environment/users.js +11 -13
- package/dist/events/index.js +3627 -3289
- package/dist/notification/index.js +1925 -1102
- package/dist/scopes/index.d.ts +251 -26
- package/dist/scopes/index.js +304 -55
- package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -3
- package/dist/templates/charts-values/opentelemetry/values.yaml +73 -0
- package/opencrvs-toolkit-2.1.0-rc.d876831.tgz +0 -0
- package/package.json +5 -4
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.1.0-rc.d6a3ca1.tgz +0 -0
|
@@ -500,7 +500,7 @@ var import_v4 = require("zod/v4");
|
|
|
500
500
|
var z15 = __toESM(require("zod/v4"));
|
|
501
501
|
|
|
502
502
|
// ../commons/src/events/ActionDocument.ts
|
|
503
|
-
var
|
|
503
|
+
var z14 = __toESM(require("zod/v4"));
|
|
504
504
|
|
|
505
505
|
// ../commons/src/events/ActionType.ts
|
|
506
506
|
var z10 = __toESM(require("zod/v4"));
|
|
@@ -612,16 +612,88 @@ var META_ACTIONS = [
|
|
|
612
612
|
|
|
613
613
|
// ../commons/src/authentication.ts
|
|
614
614
|
var import_jwt_decode = __toESM(require("jwt-decode"));
|
|
615
|
-
var
|
|
615
|
+
var z13 = __toESM(require("zod/v4"));
|
|
616
616
|
|
|
617
617
|
// ../commons/src/scopes.ts
|
|
618
|
-
var
|
|
618
|
+
var z12 = __toESM(require("zod/v4"));
|
|
619
619
|
var qs = __toESM(require("qs"));
|
|
620
|
-
|
|
620
|
+
|
|
621
|
+
// ../commons/src/events/ActionStatus.ts
|
|
622
|
+
var ActionStatus = {
|
|
623
|
+
Requested: "Requested",
|
|
624
|
+
Accepted: "Accepted",
|
|
625
|
+
Rejected: "Rejected"
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
// ../commons/src/events/Flag.ts
|
|
629
|
+
var z11 = __toESM(require("zod/v4"));
|
|
630
|
+
var InherentFlags = {
|
|
631
|
+
INCOMPLETE: "incomplete",
|
|
632
|
+
REJECTED: "rejected",
|
|
633
|
+
CORRECTION_REQUESTED: "correction-requested",
|
|
634
|
+
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
635
|
+
/**
|
|
636
|
+
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
637
|
+
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
638
|
+
*
|
|
639
|
+
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
640
|
+
*/
|
|
641
|
+
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
642
|
+
};
|
|
643
|
+
var actionFlagPattern;
|
|
644
|
+
function getActionFlagPattern() {
|
|
645
|
+
actionFlagPattern ??= new RegExp(
|
|
646
|
+
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
647
|
+
ActionStatus
|
|
648
|
+
).join("|").toLowerCase()})$`
|
|
649
|
+
);
|
|
650
|
+
return actionFlagPattern;
|
|
651
|
+
}
|
|
652
|
+
var ActionFlag = z11.string().refine((value) => getActionFlagPattern().test(value), {
|
|
653
|
+
message: "Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
654
|
+
});
|
|
655
|
+
var CustomFlag = z11.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
656
|
+
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
657
|
+
InherentFlags
|
|
658
|
+
).join(", ")}`
|
|
659
|
+
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
660
|
+
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
661
|
+
}).describe("Custom flag identifier defined by the country config.");
|
|
662
|
+
var Flag = ActionFlag.or(z11.enum(InherentFlags)).or(CustomFlag);
|
|
663
|
+
var ContainsFlags = z11.object({
|
|
664
|
+
anyOf: z11.array(Flag).optional(),
|
|
665
|
+
noneOf: z11.array(Flag).optional(),
|
|
666
|
+
allOf: z11.array(Flag).optional()
|
|
667
|
+
}).meta({
|
|
668
|
+
id: "ContainsFlags"
|
|
669
|
+
});
|
|
670
|
+
var FlagConfig = z11.object({
|
|
671
|
+
id: CustomFlag,
|
|
672
|
+
requiresAction: z11.boolean().describe(
|
|
673
|
+
"Indicates if this flag expects an action to be performed to be cleared."
|
|
674
|
+
),
|
|
675
|
+
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
676
|
+
}).meta({
|
|
677
|
+
id: "FlagConfig",
|
|
678
|
+
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
679
|
+
});
|
|
680
|
+
var ActionFlagConfig = z11.object({
|
|
681
|
+
id: Flag,
|
|
682
|
+
operation: z11.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
683
|
+
conditional: Conditional.optional().describe(
|
|
684
|
+
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
685
|
+
)
|
|
686
|
+
}).meta({
|
|
687
|
+
id: "ActionFlagConfig",
|
|
688
|
+
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
689
|
+
});
|
|
690
|
+
|
|
691
|
+
// ../commons/src/scopes.ts
|
|
692
|
+
var JurisdictionFilter = z12.enum(["administrativeArea", "location", "all"]).describe(
|
|
621
693
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
622
694
|
);
|
|
623
|
-
var UserFilter =
|
|
624
|
-
var RecordScopeTypeV2 =
|
|
695
|
+
var UserFilter = z12.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
696
|
+
var RecordScopeTypeV2 = z12.enum([
|
|
625
697
|
"record.search",
|
|
626
698
|
"record.create",
|
|
627
699
|
"record.read",
|
|
@@ -639,7 +711,7 @@ var RecordScopeTypeV2 = z11.enum([
|
|
|
639
711
|
"record.unassign-others",
|
|
640
712
|
"record.custom-action"
|
|
641
713
|
]);
|
|
642
|
-
var PlainScopeType =
|
|
714
|
+
var PlainScopeType = z12.enum([
|
|
643
715
|
// Misc. system scopes
|
|
644
716
|
"bypassratelimit",
|
|
645
717
|
"record.reindex",
|
|
@@ -647,6 +719,7 @@ var PlainScopeType = z11.enum([
|
|
|
647
719
|
"integration.create",
|
|
648
720
|
"record.import",
|
|
649
721
|
"config.update-all",
|
|
722
|
+
"location.edit",
|
|
650
723
|
"attachment.upload",
|
|
651
724
|
"profile.electronic-signature",
|
|
652
725
|
"user.read-only-my-audit",
|
|
@@ -658,15 +731,15 @@ var PlainScopeType = z11.enum([
|
|
|
658
731
|
"record.confirm-registration",
|
|
659
732
|
"record.reject-registration"
|
|
660
733
|
]);
|
|
661
|
-
var scopeByEvent =
|
|
734
|
+
var scopeByEvent = z12.preprocess(
|
|
662
735
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
663
|
-
|
|
736
|
+
z12.array(z12.string()).optional()
|
|
664
737
|
).describe("Event type, e.g. birth, death");
|
|
665
|
-
var userRole =
|
|
738
|
+
var userRole = z12.preprocess(
|
|
666
739
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
667
|
-
|
|
740
|
+
z12.array(z12.string()).optional()
|
|
668
741
|
).describe("User role, e.g. admin, field agent");
|
|
669
|
-
var scopeOptionsPlaceEvent =
|
|
742
|
+
var scopeOptionsPlaceEvent = z12.object({
|
|
670
743
|
event: scopeByEvent,
|
|
671
744
|
placeOfEvent: JurisdictionFilter.optional()
|
|
672
745
|
}).describe("Options applicable to all record scopes.");
|
|
@@ -678,36 +751,37 @@ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
|
678
751
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
679
752
|
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
680
753
|
registeredIn: JurisdictionFilter.optional(),
|
|
681
|
-
registeredBy: UserFilter.optional()
|
|
754
|
+
registeredBy: UserFilter.optional(),
|
|
755
|
+
flags: ContainsFlags.optional()
|
|
682
756
|
}).describe(
|
|
683
757
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
684
758
|
);
|
|
685
759
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
686
|
-
customActionTypes:
|
|
760
|
+
customActionTypes: z12.preprocess(
|
|
687
761
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
688
|
-
|
|
762
|
+
z12.array(z12.string()).optional()
|
|
689
763
|
).describe("Allowed custom action types")
|
|
690
764
|
});
|
|
691
|
-
var AccessLevelOptions =
|
|
765
|
+
var AccessLevelOptions = z12.object({
|
|
692
766
|
accessLevel: JurisdictionFilter.optional()
|
|
693
767
|
});
|
|
694
768
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
695
769
|
role: userRole.optional()
|
|
696
770
|
});
|
|
697
|
-
var WorkqueueOrDashboardOptions =
|
|
698
|
-
ids:
|
|
771
|
+
var WorkqueueOrDashboardOptions = z12.object({
|
|
772
|
+
ids: z12.preprocess(
|
|
699
773
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
700
|
-
|
|
774
|
+
z12.array(z12.string())
|
|
701
775
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
702
776
|
});
|
|
703
|
-
var AllScopeOptions =
|
|
777
|
+
var AllScopeOptions = z12.object({
|
|
704
778
|
...AllRecordScopeOptions.shape,
|
|
705
779
|
...AccessLevelOptions.shape,
|
|
706
780
|
...AllUserScopeOptions.shape,
|
|
707
781
|
...WorkqueueOrDashboardOptions.shape
|
|
708
782
|
});
|
|
709
783
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
710
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
784
|
+
var ResolvedScopeOptionsPlaceEvent = z12.object({
|
|
711
785
|
event: scopeByEvent,
|
|
712
786
|
placeOfEvent: UUID.nullish()
|
|
713
787
|
}).describe(
|
|
@@ -715,15 +789,16 @@ var ResolvedScopeOptionsPlaceEvent = z11.object({
|
|
|
715
789
|
);
|
|
716
790
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
717
791
|
notifiedIn: UUID.nullish(),
|
|
718
|
-
notifiedBy:
|
|
792
|
+
notifiedBy: z12.string().optional(),
|
|
719
793
|
declaredIn: UUID.nullish(),
|
|
720
|
-
declaredBy:
|
|
794
|
+
declaredBy: z12.string().optional()
|
|
721
795
|
}).describe(
|
|
722
796
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
723
797
|
);
|
|
724
798
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
725
799
|
registeredIn: UUID.nullish(),
|
|
726
|
-
registeredBy:
|
|
800
|
+
registeredBy: z12.string().optional(),
|
|
801
|
+
flags: ContainsFlags.optional()
|
|
727
802
|
}).describe(
|
|
728
803
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
729
804
|
);
|
|
@@ -748,38 +823,38 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
748
823
|
"record.unassign-others"
|
|
749
824
|
]);
|
|
750
825
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
751
|
-
templates:
|
|
826
|
+
templates: z12.preprocess(
|
|
752
827
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
753
|
-
|
|
828
|
+
z12.array(z12.string()).optional()
|
|
754
829
|
).describe(
|
|
755
830
|
"Template IDs for certified copies. Controls which certificate templates are returned to the client via the config service. Certificate printing is a client-side operation \u2014 this option is not validated when the printCertificate action is submitted."
|
|
756
831
|
)
|
|
757
832
|
});
|
|
758
|
-
var RecordScopeV2 =
|
|
759
|
-
|
|
833
|
+
var RecordScopeV2 = z12.discriminatedUnion("type", [
|
|
834
|
+
z12.object({
|
|
760
835
|
type: ScopesWithPlaceEventOptions,
|
|
761
836
|
options: scopeOptionsPlaceEvent.optional()
|
|
762
837
|
}),
|
|
763
|
-
|
|
838
|
+
z12.object({
|
|
764
839
|
type: ScopesWithDeclaredOptions,
|
|
765
840
|
options: scopeOptionsDeclaredOrNotified.optional()
|
|
766
841
|
}),
|
|
767
|
-
|
|
842
|
+
z12.object({
|
|
768
843
|
type: ScopesWithFullOptions,
|
|
769
844
|
options: AllRecordScopeOptions.optional()
|
|
770
845
|
}),
|
|
771
|
-
|
|
772
|
-
type:
|
|
846
|
+
z12.object({
|
|
847
|
+
type: z12.literal("record.custom-action"),
|
|
773
848
|
options: CustomActionScopeOptions.optional()
|
|
774
849
|
}),
|
|
775
|
-
|
|
776
|
-
type:
|
|
850
|
+
z12.object({
|
|
851
|
+
type: z12.literal("record.print-certified-copies"),
|
|
777
852
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
778
853
|
})
|
|
779
854
|
]).describe(
|
|
780
855
|
"Scopes used to check user's permission to perform actions on a record."
|
|
781
856
|
);
|
|
782
|
-
var SystemScopeType =
|
|
857
|
+
var SystemScopeType = z12.enum([
|
|
783
858
|
"organisation.read-locations",
|
|
784
859
|
"user.read",
|
|
785
860
|
"user.create",
|
|
@@ -793,61 +868,61 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
793
868
|
"user.search"
|
|
794
869
|
]);
|
|
795
870
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
796
|
-
var UserScopeV2 =
|
|
797
|
-
|
|
871
|
+
var UserScopeV2 = z12.discriminatedUnion("type", [
|
|
872
|
+
z12.object({
|
|
798
873
|
type: ScopesWithRoleOption,
|
|
799
874
|
options: AllUserScopeOptions.optional()
|
|
800
875
|
}),
|
|
801
|
-
|
|
876
|
+
z12.object({
|
|
802
877
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
803
878
|
options: AccessLevelOptions.optional()
|
|
804
879
|
})
|
|
805
880
|
]);
|
|
806
|
-
var ResolvedRecordScopeV2 =
|
|
807
|
-
|
|
881
|
+
var ResolvedRecordScopeV2 = z12.discriminatedUnion("type", [
|
|
882
|
+
z12.object({
|
|
808
883
|
type: ScopesWithPlaceEventOptions,
|
|
809
884
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
810
885
|
}),
|
|
811
|
-
|
|
886
|
+
z12.object({
|
|
812
887
|
type: ScopesWithDeclaredOptions,
|
|
813
888
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
814
889
|
}),
|
|
815
|
-
|
|
890
|
+
z12.object({
|
|
816
891
|
type: ScopesWithFullOptions,
|
|
817
892
|
options: ResolvedScopeOptionsFull.optional()
|
|
818
893
|
}),
|
|
819
|
-
|
|
820
|
-
type:
|
|
894
|
+
z12.object({
|
|
895
|
+
type: z12.literal("record.print-certified-copies"),
|
|
821
896
|
options: ResolvedScopeOptionsFull.extend({
|
|
822
|
-
templates:
|
|
897
|
+
templates: z12.array(z12.string()).optional()
|
|
823
898
|
}).optional()
|
|
824
899
|
})
|
|
825
900
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
826
|
-
var Scope =
|
|
827
|
-
|
|
901
|
+
var Scope = z12.discriminatedUnion("type", [
|
|
902
|
+
z12.object({ type: PlainScopeType }),
|
|
828
903
|
...RecordScopeV2.options,
|
|
829
904
|
...UserScopeV2.options,
|
|
830
|
-
|
|
831
|
-
type:
|
|
905
|
+
z12.object({
|
|
906
|
+
type: z12.literal("organisation.read-locations"),
|
|
832
907
|
options: AccessLevelOptions.optional()
|
|
833
908
|
}),
|
|
834
|
-
|
|
835
|
-
type:
|
|
909
|
+
z12.object({
|
|
910
|
+
type: z12.literal("workqueue"),
|
|
836
911
|
options: WorkqueueOrDashboardOptions
|
|
837
912
|
}),
|
|
838
|
-
|
|
839
|
-
type:
|
|
913
|
+
z12.object({
|
|
914
|
+
type: z12.literal("dashboard.view"),
|
|
840
915
|
options: WorkqueueOrDashboardOptions
|
|
841
916
|
})
|
|
842
917
|
]);
|
|
843
|
-
var ScopeType =
|
|
918
|
+
var ScopeType = z12.enum([
|
|
844
919
|
...SystemScopeType.options,
|
|
845
920
|
...RecordScopeTypeV2.options,
|
|
846
921
|
...PlainScopeType.options,
|
|
847
922
|
"workqueue",
|
|
848
923
|
"dashboard.view"
|
|
849
924
|
]);
|
|
850
|
-
var EncodedScope =
|
|
925
|
+
var EncodedScope = z12.string().brand("EncodedScope");
|
|
851
926
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
852
927
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
853
928
|
accessLevel: JurisdictionFilter.enum.all,
|
|
@@ -857,30 +932,25 @@ var DEFAULT_SCOPE_OPTIONS = {
|
|
|
857
932
|
};
|
|
858
933
|
|
|
859
934
|
// ../commons/src/authentication.ts
|
|
860
|
-
var TokenUserType =
|
|
861
|
-
var TokenWithBearer =
|
|
935
|
+
var TokenUserType = z13.enum(["user", "system"]);
|
|
936
|
+
var TokenWithBearer = z13.string().regex(/^Bearer\s/);
|
|
862
937
|
|
|
863
938
|
// ../commons/src/events/ActionDocument.ts
|
|
864
|
-
var ActionUpdate =
|
|
939
|
+
var ActionUpdate = z14.record(z14.string(), FieldUpdateValue).describe(
|
|
865
940
|
"Record of field-level changes made by an action. Supports partial updates and nullable values."
|
|
866
941
|
);
|
|
867
|
-
var EventState =
|
|
942
|
+
var EventState = z14.record(z14.string(), FieldValue).describe(
|
|
868
943
|
"Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
|
|
869
944
|
);
|
|
870
|
-
var
|
|
871
|
-
Requested: "Requested",
|
|
872
|
-
Accepted: "Accepted",
|
|
873
|
-
Rejected: "Rejected"
|
|
874
|
-
};
|
|
875
|
-
var ActionBase = z13.object({
|
|
945
|
+
var ActionBase = z14.object({
|
|
876
946
|
id: UUID.describe("Unique identifier of the action."),
|
|
877
|
-
transactionId:
|
|
947
|
+
transactionId: z14.string().describe("Unique identifier of the transaction."),
|
|
878
948
|
createdByUserType: TokenUserType.describe(
|
|
879
949
|
"Indicates whether the action was created by a human-user or by a system-user."
|
|
880
950
|
),
|
|
881
|
-
createdAt:
|
|
882
|
-
createdBy:
|
|
883
|
-
createdByRole:
|
|
951
|
+
createdAt: z14.string().datetime().describe("Timestamp indicating when the action was created."),
|
|
952
|
+
createdBy: z14.string().describe("Identifier of the user who created the action."),
|
|
953
|
+
createdByRole: z14.string().optional().describe("Role of the user who created the action."),
|
|
884
954
|
createdBySignature: DocumentPath.nullish().describe(
|
|
885
955
|
"Reference to the signature of the user who created the action."
|
|
886
956
|
),
|
|
@@ -892,7 +962,7 @@ var ActionBase = z13.object({
|
|
|
892
962
|
"Declaration data defined by the ActionConfig. Supports partial updates."
|
|
893
963
|
),
|
|
894
964
|
annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
|
|
895
|
-
status:
|
|
965
|
+
status: z14.enum([
|
|
896
966
|
ActionStatus.Requested,
|
|
897
967
|
ActionStatus.Accepted,
|
|
898
968
|
ActionStatus.Rejected
|
|
@@ -904,139 +974,139 @@ var ActionBase = z13.object({
|
|
|
904
974
|
)
|
|
905
975
|
});
|
|
906
976
|
var AssignedAction = ActionBase.extend(
|
|
907
|
-
|
|
908
|
-
type:
|
|
909
|
-
assignedTo:
|
|
977
|
+
z14.object({
|
|
978
|
+
type: z14.literal(ActionType.ASSIGN),
|
|
979
|
+
assignedTo: z14.string().describe("Identifier of the user to whom the action is assigned.")
|
|
910
980
|
// TODO move into 'content' property
|
|
911
981
|
}).shape
|
|
912
982
|
);
|
|
913
983
|
var UnassignedAction = ActionBase.extend(
|
|
914
|
-
|
|
915
|
-
type:
|
|
984
|
+
z14.object({
|
|
985
|
+
type: z14.literal(ActionType.UNASSIGN)
|
|
916
986
|
}).shape
|
|
917
987
|
);
|
|
918
988
|
var RegisterAction = ActionBase.extend(
|
|
919
|
-
|
|
920
|
-
type:
|
|
921
|
-
registrationNumber:
|
|
989
|
+
z14.object({
|
|
990
|
+
type: z14.literal(ActionType.REGISTER),
|
|
991
|
+
registrationNumber: z14.string().optional().describe(
|
|
922
992
|
"Registration number of the event. Always present for accepted registrations."
|
|
923
993
|
)
|
|
924
994
|
// TODO move into 'content' property
|
|
925
995
|
}).shape
|
|
926
996
|
);
|
|
927
997
|
var DeclareAction = ActionBase.extend(
|
|
928
|
-
|
|
929
|
-
type:
|
|
998
|
+
z14.object({
|
|
999
|
+
type: z14.literal(ActionType.DECLARE)
|
|
930
1000
|
}).shape
|
|
931
1001
|
);
|
|
932
|
-
var ReasonContent =
|
|
933
|
-
reason:
|
|
1002
|
+
var ReasonContent = z14.object({
|
|
1003
|
+
reason: z14.string().min(1, { error: "Message cannot be empty" }).describe(
|
|
934
1004
|
"Message describing the reason for rejecting or archiving the event."
|
|
935
1005
|
)
|
|
936
1006
|
});
|
|
937
1007
|
var RejectAction = ActionBase.extend(
|
|
938
|
-
|
|
939
|
-
type:
|
|
1008
|
+
z14.object({
|
|
1009
|
+
type: z14.literal(ActionType.REJECT),
|
|
940
1010
|
content: ReasonContent
|
|
941
1011
|
}).shape
|
|
942
1012
|
);
|
|
943
|
-
var PotentialDuplicate =
|
|
1013
|
+
var PotentialDuplicate = z14.object({
|
|
944
1014
|
id: UUID,
|
|
945
|
-
trackingId:
|
|
1015
|
+
trackingId: z14.string()
|
|
946
1016
|
});
|
|
947
1017
|
var DuplicateDetectedAction = ActionBase.extend(
|
|
948
|
-
|
|
949
|
-
type:
|
|
950
|
-
content:
|
|
951
|
-
duplicates:
|
|
1018
|
+
z14.object({
|
|
1019
|
+
type: z14.literal(ActionType.DUPLICATE_DETECTED),
|
|
1020
|
+
content: z14.object({
|
|
1021
|
+
duplicates: z14.array(PotentialDuplicate)
|
|
952
1022
|
})
|
|
953
1023
|
}).shape
|
|
954
1024
|
);
|
|
955
1025
|
var MarkNotDuplicateAction = ActionBase.extend(
|
|
956
|
-
|
|
957
|
-
type:
|
|
1026
|
+
z14.object({
|
|
1027
|
+
type: z14.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
958
1028
|
}).shape
|
|
959
1029
|
);
|
|
960
1030
|
var MarkAsDuplicateAction = ActionBase.extend(
|
|
961
|
-
|
|
962
|
-
type:
|
|
963
|
-
content:
|
|
1031
|
+
z14.object({
|
|
1032
|
+
type: z14.literal(ActionType.MARK_AS_DUPLICATE),
|
|
1033
|
+
content: z14.object({
|
|
964
1034
|
duplicateOf: UUID
|
|
965
1035
|
}).optional()
|
|
966
1036
|
}).shape
|
|
967
1037
|
);
|
|
968
1038
|
var ArchiveAction = ActionBase.extend(
|
|
969
|
-
|
|
970
|
-
type:
|
|
1039
|
+
z14.object({
|
|
1040
|
+
type: z14.literal(ActionType.ARCHIVE),
|
|
971
1041
|
content: ReasonContent
|
|
972
1042
|
}).shape
|
|
973
1043
|
);
|
|
974
1044
|
var UnarchiveAction = ActionBase.extend(
|
|
975
|
-
|
|
976
|
-
type:
|
|
1045
|
+
z14.object({
|
|
1046
|
+
type: z14.literal(ActionType.UNARCHIVE)
|
|
977
1047
|
}).shape
|
|
978
1048
|
);
|
|
979
1049
|
var CreatedAction = ActionBase.extend(
|
|
980
|
-
|
|
981
|
-
type:
|
|
1050
|
+
z14.object({
|
|
1051
|
+
type: z14.literal(ActionType.CREATE)
|
|
982
1052
|
}).shape
|
|
983
1053
|
);
|
|
984
1054
|
var NotifiedAction = ActionBase.extend(
|
|
985
|
-
|
|
986
|
-
type:
|
|
1055
|
+
z14.object({
|
|
1056
|
+
type: z14.literal(ActionType.NOTIFY)
|
|
987
1057
|
}).shape
|
|
988
1058
|
);
|
|
989
1059
|
var EditAction = ActionBase.extend(
|
|
990
|
-
|
|
991
|
-
type:
|
|
1060
|
+
z14.object({
|
|
1061
|
+
type: z14.literal(ActionType.EDIT),
|
|
992
1062
|
/** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
|
|
993
|
-
content:
|
|
994
|
-
comment:
|
|
1063
|
+
content: z14.object({
|
|
1064
|
+
comment: z14.string().describe("Comment for the edit action.").optional()
|
|
995
1065
|
}).optional()
|
|
996
1066
|
}).shape
|
|
997
1067
|
);
|
|
998
|
-
var PrintContent =
|
|
999
|
-
templateId:
|
|
1068
|
+
var PrintContent = z14.object({
|
|
1069
|
+
templateId: z14.string().optional()
|
|
1000
1070
|
});
|
|
1001
1071
|
var PrintCertificateAction = ActionBase.extend(
|
|
1002
|
-
|
|
1003
|
-
type:
|
|
1072
|
+
z14.object({
|
|
1073
|
+
type: z14.literal(ActionType.PRINT_CERTIFICATE),
|
|
1004
1074
|
content: PrintContent.optional().nullable()
|
|
1005
1075
|
}).shape
|
|
1006
1076
|
);
|
|
1007
1077
|
var RequestedCorrectionAction = ActionBase.extend(
|
|
1008
|
-
|
|
1009
|
-
type:
|
|
1078
|
+
z14.object({
|
|
1079
|
+
type: z14.literal(ActionType.REQUEST_CORRECTION)
|
|
1010
1080
|
}).shape
|
|
1011
1081
|
);
|
|
1012
1082
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
1013
|
-
|
|
1014
|
-
type:
|
|
1015
|
-
requestId:
|
|
1083
|
+
z14.object({
|
|
1084
|
+
type: z14.literal(ActionType.APPROVE_CORRECTION),
|
|
1085
|
+
requestId: z14.string(),
|
|
1016
1086
|
// TODO move into 'content' property
|
|
1017
|
-
content:
|
|
1087
|
+
content: z14.object({ immediateCorrection: z14.boolean().optional() }).optional()
|
|
1018
1088
|
}).shape
|
|
1019
1089
|
);
|
|
1020
1090
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
1021
|
-
|
|
1022
|
-
type:
|
|
1023
|
-
requestId:
|
|
1091
|
+
z14.object({
|
|
1092
|
+
type: z14.literal(ActionType.REJECT_CORRECTION),
|
|
1093
|
+
requestId: z14.string(),
|
|
1024
1094
|
// TODO move into 'content' property
|
|
1025
1095
|
content: ReasonContent
|
|
1026
1096
|
}).shape
|
|
1027
1097
|
);
|
|
1028
1098
|
var ReadAction = ActionBase.extend(
|
|
1029
|
-
|
|
1030
|
-
type:
|
|
1099
|
+
z14.object({
|
|
1100
|
+
type: z14.literal(ActionType.READ)
|
|
1031
1101
|
}).shape
|
|
1032
1102
|
);
|
|
1033
1103
|
var CustomAction = ActionBase.merge(
|
|
1034
|
-
|
|
1035
|
-
type:
|
|
1036
|
-
customActionType:
|
|
1104
|
+
z14.object({
|
|
1105
|
+
type: z14.literal(ActionType.CUSTOM),
|
|
1106
|
+
customActionType: z14.string()
|
|
1037
1107
|
})
|
|
1038
1108
|
);
|
|
1039
|
-
var ActionDocument =
|
|
1109
|
+
var ActionDocument = z14.discriminatedUnion("type", [
|
|
1040
1110
|
CreatedAction.meta({ id: "CreatedAction" }),
|
|
1041
1111
|
RejectAction.meta({ id: "RejectAction" }),
|
|
1042
1112
|
DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
|
|
@@ -1063,64 +1133,12 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
|
1063
1133
|
declaration: true,
|
|
1064
1134
|
annotation: true
|
|
1065
1135
|
}).extend(
|
|
1066
|
-
|
|
1067
|
-
type:
|
|
1068
|
-
status:
|
|
1136
|
+
z14.object({
|
|
1137
|
+
type: z14.enum(ConfirmableActions),
|
|
1138
|
+
status: z14.literal(ActionStatus.Rejected)
|
|
1069
1139
|
}).shape
|
|
1070
1140
|
);
|
|
1071
|
-
var Action =
|
|
1072
|
-
|
|
1073
|
-
// ../commons/src/events/Flag.ts
|
|
1074
|
-
var z14 = __toESM(require("zod/v4"));
|
|
1075
|
-
var InherentFlags = {
|
|
1076
|
-
INCOMPLETE: "incomplete",
|
|
1077
|
-
REJECTED: "rejected",
|
|
1078
|
-
CORRECTION_REQUESTED: "correction-requested",
|
|
1079
|
-
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
1080
|
-
/**
|
|
1081
|
-
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
1082
|
-
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
1083
|
-
*
|
|
1084
|
-
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
1085
|
-
*/
|
|
1086
|
-
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
1087
|
-
};
|
|
1088
|
-
var ActionFlag = z14.string().regex(
|
|
1089
|
-
new RegExp(
|
|
1090
|
-
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
1091
|
-
ActionStatus
|
|
1092
|
-
).join("|").toLowerCase()})$`
|
|
1093
|
-
),
|
|
1094
|
-
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
1095
|
-
);
|
|
1096
|
-
var CustomFlag = z14.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
1097
|
-
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
1098
|
-
InherentFlags
|
|
1099
|
-
).join(", ")}`
|
|
1100
|
-
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
1101
|
-
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
1102
|
-
}).describe("Custom flag identifier defined by the country config.");
|
|
1103
|
-
var Flag = ActionFlag.or(z14.enum(InherentFlags)).or(CustomFlag);
|
|
1104
|
-
var FlagConfig = z14.object({
|
|
1105
|
-
id: CustomFlag,
|
|
1106
|
-
requiresAction: z14.boolean().describe(
|
|
1107
|
-
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1108
|
-
),
|
|
1109
|
-
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1110
|
-
}).meta({
|
|
1111
|
-
id: "FlagConfig",
|
|
1112
|
-
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
1113
|
-
});
|
|
1114
|
-
var ActionFlagConfig = z14.object({
|
|
1115
|
-
id: Flag,
|
|
1116
|
-
operation: z14.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
1117
|
-
conditional: Conditional.optional().describe(
|
|
1118
|
-
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1119
|
-
)
|
|
1120
|
-
}).meta({
|
|
1121
|
-
id: "ActionFlagConfig",
|
|
1122
|
-
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
1123
|
-
});
|
|
1141
|
+
var Action = z14.union([ActionDocument, AsyncRejectActionDocument]);
|
|
1124
1142
|
|
|
1125
1143
|
// ../commons/src/events/EventMetadata.ts
|
|
1126
1144
|
var EventStatus = z15.enum([
|
|
@@ -1281,13 +1299,6 @@ var Range = import_v4.z.object({
|
|
|
1281
1299
|
}).meta({
|
|
1282
1300
|
id: "Range"
|
|
1283
1301
|
});
|
|
1284
|
-
var ContainsFlags = import_v4.z.object({
|
|
1285
|
-
anyOf: import_v4.z.array(Flag).optional(),
|
|
1286
|
-
noneOf: import_v4.z.array(Flag).optional(),
|
|
1287
|
-
allOf: import_v4.z.array(Flag).optional()
|
|
1288
|
-
}).meta({
|
|
1289
|
-
id: "ContainsFlags"
|
|
1290
|
-
});
|
|
1291
1302
|
var Within = import_v4.z.object({ type: import_v4.z.literal("within"), location: import_v4.z.string() }).meta({
|
|
1292
1303
|
id: "Within"
|
|
1293
1304
|
});
|
|
@@ -1482,8 +1493,8 @@ var BaseField = import_v43.default.object({
|
|
|
1482
1493
|
conditionals: import_v43.default.array(FieldConditional).default([]).optional().describe(
|
|
1483
1494
|
"Conditions determining when the field is shown or enabled. By default, the field is always shown and enabled."
|
|
1484
1495
|
),
|
|
1485
|
-
secured: import_v43.default.boolean().default(false).optional().describe(
|
|
1486
|
-
"Indicates whether the field is secured. Secured fields are not indexed for search and are only visible when explicitly assigned."
|
|
1496
|
+
secured: import_v43.default.union([import_v43.default.boolean(), Conditional]).default(false).optional().describe(
|
|
1497
|
+
"Indicates whether the field is secured, either always (boolean) or conditionally, evaluated against the event (a JSONSchema conditional, e.g. flag('sealed')). Secured fields are not indexed for search and are only visible when explicitly assigned."
|
|
1487
1498
|
),
|
|
1488
1499
|
placeholder: TranslationConfig.optional(),
|
|
1489
1500
|
validation: import_v43.default.array(ValidationConfig).default([]).optional().describe("Additional validation rules applied to the field."),
|
|
@@ -1881,7 +1892,13 @@ var AdministrativeAreaField = BaseField.extend({
|
|
|
1881
1892
|
configuration: import_v43.default.object({
|
|
1882
1893
|
partOf: FieldReference.optional().describe("Parent location"),
|
|
1883
1894
|
type: AdministrativeAreas,
|
|
1884
|
-
allowedLocations: AllowedLocations
|
|
1895
|
+
allowedLocations: AllowedLocations,
|
|
1896
|
+
listHistoricalNames: import_v43.default.boolean().optional().describe(
|
|
1897
|
+
"Advanced search: list every historical name a location has had as a separate, selectable option."
|
|
1898
|
+
),
|
|
1899
|
+
activeOnly: import_v43.default.boolean().optional().describe(
|
|
1900
|
+
"Advanced search: offer only currently-active locations; inactivated ones are excluded."
|
|
1901
|
+
)
|
|
1885
1902
|
}).describe("Administrative area options")
|
|
1886
1903
|
}).meta({
|
|
1887
1904
|
description: "Administrative area input field",
|
|
@@ -1892,7 +1909,10 @@ var LocationInput = BaseField.extend({
|
|
|
1892
1909
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
1893
1910
|
configuration: import_v43.default.object({
|
|
1894
1911
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
1895
|
-
allowedLocations: AllowedLocations
|
|
1912
|
+
allowedLocations: AllowedLocations,
|
|
1913
|
+
listHistoricalNames: import_v43.default.boolean().optional().describe(
|
|
1914
|
+
"Advanced search: list every historical name a location has had as a separate, selectable option."
|
|
1915
|
+
)
|
|
1896
1916
|
}).optional()
|
|
1897
1917
|
}).meta({
|
|
1898
1918
|
description: "A field for selecting a location",
|
|
@@ -1918,12 +1938,18 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
1918
1938
|
var Facility = BaseField.extend({
|
|
1919
1939
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
1920
1940
|
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1921
|
-
configuration: import_v43.default.object({
|
|
1941
|
+
configuration: import_v43.default.object({
|
|
1942
|
+
allowedLocations: AllowedLocations,
|
|
1943
|
+
listHistoricalNames: import_v43.default.boolean().optional()
|
|
1944
|
+
}).optional()
|
|
1922
1945
|
}).describe("Input field for a facility");
|
|
1923
1946
|
var Office = BaseField.extend({
|
|
1924
1947
|
type: import_v43.default.literal(FieldType.OFFICE),
|
|
1925
1948
|
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1926
|
-
configuration: import_v43.default.object({
|
|
1949
|
+
configuration: import_v43.default.object({
|
|
1950
|
+
allowedLocations: AllowedLocations,
|
|
1951
|
+
listHistoricalNames: import_v43.default.boolean().optional()
|
|
1952
|
+
}).optional()
|
|
1927
1953
|
}).describe("Input field for an office");
|
|
1928
1954
|
var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
|
|
1929
1955
|
administrativeArea: import_v43.default.union([UUID, SerializedUserField]).optional()
|
|
@@ -1956,7 +1982,13 @@ var Address = BaseField.extend({
|
|
|
1956
1982
|
parent: FieldReference.optional()
|
|
1957
1983
|
})
|
|
1958
1984
|
).optional(),
|
|
1959
|
-
allowedLocations: AllowedLocations
|
|
1985
|
+
allowedLocations: AllowedLocations,
|
|
1986
|
+
listHistoricalNames: import_v43.default.boolean().optional().describe(
|
|
1987
|
+
"Advanced search: list every historical name a location has had as a separate, selectable option. Propagated to the embedded admin-area selectors."
|
|
1988
|
+
),
|
|
1989
|
+
activeOnly: import_v43.default.boolean().optional().describe(
|
|
1990
|
+
"Advanced search: offer only currently-active admin areas; inactivated ones are excluded. Propagated to the embedded admin-area selectors."
|
|
1991
|
+
)
|
|
1960
1992
|
}).optional(),
|
|
1961
1993
|
defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
|
|
1962
1994
|
}).meta({
|