@opencrvs/toolkit 2.1.0-rc.b061691 → 2.1.0-rc.b2f00ee
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 +190 -200
- package/dist/commons/api/router.d.ts +3465 -3242
- package/dist/commons/application-config/index.d.ts +6 -6
- package/dist/commons/conditionals/conditionals.d.ts +259 -2102
- package/dist/commons/conditionals/validate.d.ts +1 -2
- package/dist/commons/events/ActionConfig.d.ts +105 -126
- package/dist/commons/events/ActionDocument.d.ts +117 -111
- package/dist/commons/events/ActionType.d.ts +62 -62
- package/dist/commons/events/AdvancedSearchConfig.d.ts +513 -513
- package/dist/commons/events/AuditLog.d.ts +151 -42
- package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
- package/dist/commons/events/Conditional.d.ts +3 -3
- package/dist/commons/events/CountryConfigQueryInput.d.ts +590 -608
- package/dist/commons/events/Draft.d.ts +37 -37
- package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
- package/dist/commons/events/EventConfig.d.ts +5 -5
- package/dist/commons/events/EventDocument.d.ts +46 -46
- package/dist/commons/events/EventIndex.d.ts +71 -52
- package/dist/commons/events/EventMetadata.d.ts +40 -41
- package/dist/commons/events/FieldConfig.d.ts +341 -341
- package/dist/commons/events/FieldType.d.ts +51 -51
- package/dist/commons/events/FieldTypeMapping.d.ts +100 -100
- package/dist/commons/events/FieldValue.d.ts +12 -12
- package/dist/commons/events/Flag.d.ts +15 -63
- package/dist/commons/events/TemplateConfig.d.ts +1 -1
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
- package/dist/commons/events/WorkqueueConfig.d.ts +826 -841
- package/dist/commons/events/deduplication.d.ts +1 -1
- package/dist/commons/events/event.d.ts +2 -2
- package/dist/commons/events/field.d.ts +78 -895
- 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 +103 -6
- package/dist/commons/events/mocks.test.utils.d.ts +18 -4
- package/dist/commons/events/scopes.d.ts +4 -4
- package/dist/commons/events/state/index.d.ts +17 -17
- package/dist/commons/events/state/utils.d.ts +7 -7
- package/dist/commons/events/test.utils.d.ts +40 -40
- package/dist/commons/events/utils.d.ts +114 -114
- package/dist/commons/notification/UserNotifications.d.ts +10 -10
- package/dist/conditionals/index.js +56 -303
- package/dist/environment/derived-variables.d.ts +119 -119
- package/dist/environment/derived-variables.d.ts.map +1 -1
- package/dist/environment/logger.d.ts.map +1 -1
- package/dist/environment/questions.d.ts +75 -74
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/setup-environment.js +8 -14
- package/dist/environment/utils.d.ts +1 -1
- package/dist/events/deduplication.d.ts +1 -1
- package/dist/events/index.js +2845 -2755
- package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
- package/dist/notification/index.js +1100 -1561
- package/dist/scopes/index.d.ts +148 -396
- package/dist/scopes/index.js +56 -304
- package/opencrvs-toolkit-2.1.0-rc.b2f00ee.tgz +0 -0
- package/package.json +4 -4
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/commons/events/ActionStatus.d.ts +0 -14
- package/opencrvs-toolkit-2.1.0-rc.b061691.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 z13 = __toESM(require("zod/v4"));
|
|
504
504
|
|
|
505
505
|
// ../commons/src/events/ActionType.ts
|
|
506
506
|
var z10 = __toESM(require("zod/v4"));
|
|
@@ -612,89 +612,16 @@ var META_ACTIONS = [
|
|
|
612
612
|
|
|
613
613
|
// ../commons/src/authentication.ts
|
|
614
614
|
var import_jwt_decode = __toESM(require("jwt-decode"));
|
|
615
|
-
var z13 = __toESM(require("zod/v4"));
|
|
616
|
-
|
|
617
|
-
// ../commons/src/scopes.ts
|
|
618
615
|
var z12 = __toESM(require("zod/v4"));
|
|
619
|
-
var qs = __toESM(require("qs"));
|
|
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
|
-
SEALED: "sealed"
|
|
643
|
-
};
|
|
644
|
-
var actionFlagPattern;
|
|
645
|
-
function getActionFlagPattern() {
|
|
646
|
-
actionFlagPattern ??= new RegExp(
|
|
647
|
-
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
648
|
-
ActionStatus
|
|
649
|
-
).join("|").toLowerCase()})$`
|
|
650
|
-
);
|
|
651
|
-
return actionFlagPattern;
|
|
652
|
-
}
|
|
653
|
-
var ActionFlag = z11.string().refine((value) => getActionFlagPattern().test(value), {
|
|
654
|
-
message: "Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
655
|
-
});
|
|
656
|
-
var CustomFlag = z11.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
657
|
-
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
658
|
-
InherentFlags
|
|
659
|
-
).join(", ")}`
|
|
660
|
-
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
661
|
-
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
662
|
-
}).describe("Custom flag identifier defined by the country config.");
|
|
663
|
-
var Flag = ActionFlag.or(z11.enum(InherentFlags)).or(CustomFlag);
|
|
664
|
-
var ContainsFlags = z11.object({
|
|
665
|
-
anyOf: z11.array(Flag).optional(),
|
|
666
|
-
noneOf: z11.array(Flag).optional(),
|
|
667
|
-
allOf: z11.array(Flag).optional()
|
|
668
|
-
}).meta({
|
|
669
|
-
id: "ContainsFlags"
|
|
670
|
-
});
|
|
671
|
-
var FlagConfig = z11.object({
|
|
672
|
-
id: CustomFlag,
|
|
673
|
-
requiresAction: z11.boolean().describe(
|
|
674
|
-
"Indicates if this flag expects an action to be performed to be cleared."
|
|
675
|
-
),
|
|
676
|
-
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
677
|
-
}).meta({
|
|
678
|
-
id: "FlagConfig",
|
|
679
|
-
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
680
|
-
});
|
|
681
|
-
var ActionFlagConfig = z11.object({
|
|
682
|
-
id: Flag,
|
|
683
|
-
operation: z11.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
684
|
-
conditional: Conditional.optional().describe(
|
|
685
|
-
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
686
|
-
)
|
|
687
|
-
}).meta({
|
|
688
|
-
id: "ActionFlagConfig",
|
|
689
|
-
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
690
|
-
});
|
|
691
616
|
|
|
692
617
|
// ../commons/src/scopes.ts
|
|
693
|
-
var
|
|
618
|
+
var z11 = __toESM(require("zod/v4"));
|
|
619
|
+
var qs = __toESM(require("qs"));
|
|
620
|
+
var JurisdictionFilter = z11.enum(["administrativeArea", "location", "all"]).describe(
|
|
694
621
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
695
622
|
);
|
|
696
|
-
var UserFilter =
|
|
697
|
-
var RecordScopeTypeV2 =
|
|
623
|
+
var UserFilter = z11.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
624
|
+
var RecordScopeTypeV2 = z11.enum([
|
|
698
625
|
"record.search",
|
|
699
626
|
"record.create",
|
|
700
627
|
"record.read",
|
|
@@ -712,7 +639,7 @@ var RecordScopeTypeV2 = z12.enum([
|
|
|
712
639
|
"record.unassign-others",
|
|
713
640
|
"record.custom-action"
|
|
714
641
|
]);
|
|
715
|
-
var PlainScopeType =
|
|
642
|
+
var PlainScopeType = z11.enum([
|
|
716
643
|
// Misc. system scopes
|
|
717
644
|
"bypassratelimit",
|
|
718
645
|
"record.reindex",
|
|
@@ -720,6 +647,7 @@ var PlainScopeType = z12.enum([
|
|
|
720
647
|
"integration.create",
|
|
721
648
|
"record.import",
|
|
722
649
|
"config.update-all",
|
|
650
|
+
"location.edit",
|
|
723
651
|
"attachment.upload",
|
|
724
652
|
"profile.electronic-signature",
|
|
725
653
|
"user.read-only-my-audit",
|
|
@@ -731,15 +659,15 @@ var PlainScopeType = z12.enum([
|
|
|
731
659
|
"record.confirm-registration",
|
|
732
660
|
"record.reject-registration"
|
|
733
661
|
]);
|
|
734
|
-
var scopeByEvent =
|
|
662
|
+
var scopeByEvent = z11.preprocess(
|
|
735
663
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
736
|
-
|
|
664
|
+
z11.array(z11.string()).optional()
|
|
737
665
|
).describe("Event type, e.g. birth, death");
|
|
738
|
-
var userRole =
|
|
666
|
+
var userRole = z11.preprocess(
|
|
739
667
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
740
|
-
|
|
668
|
+
z11.array(z11.string()).optional()
|
|
741
669
|
).describe("User role, e.g. admin, field agent");
|
|
742
|
-
var scopeOptionsPlaceEvent =
|
|
670
|
+
var scopeOptionsPlaceEvent = z11.object({
|
|
743
671
|
event: scopeByEvent,
|
|
744
672
|
placeOfEvent: JurisdictionFilter.optional()
|
|
745
673
|
}).describe("Options applicable to all record scopes.");
|
|
@@ -751,37 +679,36 @@ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
|
751
679
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
752
680
|
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
753
681
|
registeredIn: JurisdictionFilter.optional(),
|
|
754
|
-
registeredBy: UserFilter.optional()
|
|
755
|
-
flags: ContainsFlags.optional()
|
|
682
|
+
registeredBy: UserFilter.optional()
|
|
756
683
|
}).describe(
|
|
757
684
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
758
685
|
);
|
|
759
686
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
760
|
-
customActionTypes:
|
|
687
|
+
customActionTypes: z11.preprocess(
|
|
761
688
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
762
|
-
|
|
689
|
+
z11.array(z11.string()).optional()
|
|
763
690
|
).describe("Allowed custom action types")
|
|
764
691
|
});
|
|
765
|
-
var AccessLevelOptions =
|
|
692
|
+
var AccessLevelOptions = z11.object({
|
|
766
693
|
accessLevel: JurisdictionFilter.optional()
|
|
767
694
|
});
|
|
768
695
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
769
696
|
role: userRole.optional()
|
|
770
697
|
});
|
|
771
|
-
var WorkqueueOrDashboardOptions =
|
|
772
|
-
ids:
|
|
698
|
+
var WorkqueueOrDashboardOptions = z11.object({
|
|
699
|
+
ids: z11.preprocess(
|
|
773
700
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
774
|
-
|
|
701
|
+
z11.array(z11.string())
|
|
775
702
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
776
703
|
});
|
|
777
|
-
var AllScopeOptions =
|
|
704
|
+
var AllScopeOptions = z11.object({
|
|
778
705
|
...AllRecordScopeOptions.shape,
|
|
779
706
|
...AccessLevelOptions.shape,
|
|
780
707
|
...AllUserScopeOptions.shape,
|
|
781
708
|
...WorkqueueOrDashboardOptions.shape
|
|
782
709
|
});
|
|
783
710
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
784
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
711
|
+
var ResolvedScopeOptionsPlaceEvent = z11.object({
|
|
785
712
|
event: scopeByEvent,
|
|
786
713
|
placeOfEvent: UUID.nullish()
|
|
787
714
|
}).describe(
|
|
@@ -789,16 +716,15 @@ var ResolvedScopeOptionsPlaceEvent = z12.object({
|
|
|
789
716
|
);
|
|
790
717
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
791
718
|
notifiedIn: UUID.nullish(),
|
|
792
|
-
notifiedBy:
|
|
719
|
+
notifiedBy: z11.string().optional(),
|
|
793
720
|
declaredIn: UUID.nullish(),
|
|
794
|
-
declaredBy:
|
|
721
|
+
declaredBy: z11.string().optional()
|
|
795
722
|
}).describe(
|
|
796
723
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
797
724
|
);
|
|
798
725
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
799
726
|
registeredIn: UUID.nullish(),
|
|
800
|
-
registeredBy:
|
|
801
|
-
flags: ContainsFlags.optional()
|
|
727
|
+
registeredBy: z11.string().optional()
|
|
802
728
|
}).describe(
|
|
803
729
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
804
730
|
);
|
|
@@ -823,38 +749,38 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
823
749
|
"record.unassign-others"
|
|
824
750
|
]);
|
|
825
751
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
826
|
-
templates:
|
|
752
|
+
templates: z11.preprocess(
|
|
827
753
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
828
|
-
|
|
754
|
+
z11.array(z11.string()).optional()
|
|
829
755
|
).describe(
|
|
830
756
|
"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."
|
|
831
757
|
)
|
|
832
758
|
});
|
|
833
|
-
var RecordScopeV2 =
|
|
834
|
-
|
|
759
|
+
var RecordScopeV2 = z11.discriminatedUnion("type", [
|
|
760
|
+
z11.object({
|
|
835
761
|
type: ScopesWithPlaceEventOptions,
|
|
836
762
|
options: scopeOptionsPlaceEvent.optional()
|
|
837
763
|
}),
|
|
838
|
-
|
|
764
|
+
z11.object({
|
|
839
765
|
type: ScopesWithDeclaredOptions,
|
|
840
766
|
options: scopeOptionsDeclaredOrNotified.optional()
|
|
841
767
|
}),
|
|
842
|
-
|
|
768
|
+
z11.object({
|
|
843
769
|
type: ScopesWithFullOptions,
|
|
844
770
|
options: AllRecordScopeOptions.optional()
|
|
845
771
|
}),
|
|
846
|
-
|
|
847
|
-
type:
|
|
772
|
+
z11.object({
|
|
773
|
+
type: z11.literal("record.custom-action"),
|
|
848
774
|
options: CustomActionScopeOptions.optional()
|
|
849
775
|
}),
|
|
850
|
-
|
|
851
|
-
type:
|
|
776
|
+
z11.object({
|
|
777
|
+
type: z11.literal("record.print-certified-copies"),
|
|
852
778
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
853
779
|
})
|
|
854
780
|
]).describe(
|
|
855
781
|
"Scopes used to check user's permission to perform actions on a record."
|
|
856
782
|
);
|
|
857
|
-
var SystemScopeType =
|
|
783
|
+
var SystemScopeType = z11.enum([
|
|
858
784
|
"organisation.read-locations",
|
|
859
785
|
"user.read",
|
|
860
786
|
"user.create",
|
|
@@ -868,61 +794,61 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
868
794
|
"user.search"
|
|
869
795
|
]);
|
|
870
796
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
871
|
-
var UserScopeV2 =
|
|
872
|
-
|
|
797
|
+
var UserScopeV2 = z11.discriminatedUnion("type", [
|
|
798
|
+
z11.object({
|
|
873
799
|
type: ScopesWithRoleOption,
|
|
874
800
|
options: AllUserScopeOptions.optional()
|
|
875
801
|
}),
|
|
876
|
-
|
|
802
|
+
z11.object({
|
|
877
803
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
878
804
|
options: AccessLevelOptions.optional()
|
|
879
805
|
})
|
|
880
806
|
]);
|
|
881
|
-
var ResolvedRecordScopeV2 =
|
|
882
|
-
|
|
807
|
+
var ResolvedRecordScopeV2 = z11.discriminatedUnion("type", [
|
|
808
|
+
z11.object({
|
|
883
809
|
type: ScopesWithPlaceEventOptions,
|
|
884
810
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
885
811
|
}),
|
|
886
|
-
|
|
812
|
+
z11.object({
|
|
887
813
|
type: ScopesWithDeclaredOptions,
|
|
888
814
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
889
815
|
}),
|
|
890
|
-
|
|
816
|
+
z11.object({
|
|
891
817
|
type: ScopesWithFullOptions,
|
|
892
818
|
options: ResolvedScopeOptionsFull.optional()
|
|
893
819
|
}),
|
|
894
|
-
|
|
895
|
-
type:
|
|
820
|
+
z11.object({
|
|
821
|
+
type: z11.literal("record.print-certified-copies"),
|
|
896
822
|
options: ResolvedScopeOptionsFull.extend({
|
|
897
|
-
templates:
|
|
823
|
+
templates: z11.array(z11.string()).optional()
|
|
898
824
|
}).optional()
|
|
899
825
|
})
|
|
900
826
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
901
|
-
var Scope =
|
|
902
|
-
|
|
827
|
+
var Scope = z11.discriminatedUnion("type", [
|
|
828
|
+
z11.object({ type: PlainScopeType }),
|
|
903
829
|
...RecordScopeV2.options,
|
|
904
830
|
...UserScopeV2.options,
|
|
905
|
-
|
|
906
|
-
type:
|
|
831
|
+
z11.object({
|
|
832
|
+
type: z11.literal("organisation.read-locations"),
|
|
907
833
|
options: AccessLevelOptions.optional()
|
|
908
834
|
}),
|
|
909
|
-
|
|
910
|
-
type:
|
|
835
|
+
z11.object({
|
|
836
|
+
type: z11.literal("workqueue"),
|
|
911
837
|
options: WorkqueueOrDashboardOptions
|
|
912
838
|
}),
|
|
913
|
-
|
|
914
|
-
type:
|
|
839
|
+
z11.object({
|
|
840
|
+
type: z11.literal("dashboard.view"),
|
|
915
841
|
options: WorkqueueOrDashboardOptions
|
|
916
842
|
})
|
|
917
843
|
]);
|
|
918
|
-
var ScopeType =
|
|
844
|
+
var ScopeType = z11.enum([
|
|
919
845
|
...SystemScopeType.options,
|
|
920
846
|
...RecordScopeTypeV2.options,
|
|
921
847
|
...PlainScopeType.options,
|
|
922
848
|
"workqueue",
|
|
923
849
|
"dashboard.view"
|
|
924
850
|
]);
|
|
925
|
-
var EncodedScope =
|
|
851
|
+
var EncodedScope = z11.string().brand("EncodedScope");
|
|
926
852
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
927
853
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
928
854
|
accessLevel: JurisdictionFilter.enum.all,
|
|
@@ -932,25 +858,30 @@ var DEFAULT_SCOPE_OPTIONS = {
|
|
|
932
858
|
};
|
|
933
859
|
|
|
934
860
|
// ../commons/src/authentication.ts
|
|
935
|
-
var TokenUserType =
|
|
936
|
-
var TokenWithBearer =
|
|
861
|
+
var TokenUserType = z12.enum(["user", "system"]);
|
|
862
|
+
var TokenWithBearer = z12.string().regex(/^Bearer\s/);
|
|
937
863
|
|
|
938
864
|
// ../commons/src/events/ActionDocument.ts
|
|
939
|
-
var ActionUpdate =
|
|
865
|
+
var ActionUpdate = z13.record(z13.string(), FieldUpdateValue).describe(
|
|
940
866
|
"Record of field-level changes made by an action. Supports partial updates and nullable values."
|
|
941
867
|
);
|
|
942
|
-
var EventState =
|
|
868
|
+
var EventState = z13.record(z13.string(), FieldValue).describe(
|
|
943
869
|
"Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
|
|
944
870
|
);
|
|
945
|
-
var
|
|
871
|
+
var ActionStatus = {
|
|
872
|
+
Requested: "Requested",
|
|
873
|
+
Accepted: "Accepted",
|
|
874
|
+
Rejected: "Rejected"
|
|
875
|
+
};
|
|
876
|
+
var ActionBase = z13.object({
|
|
946
877
|
id: UUID.describe("Unique identifier of the action."),
|
|
947
|
-
transactionId:
|
|
878
|
+
transactionId: z13.string().describe("Unique identifier of the transaction."),
|
|
948
879
|
createdByUserType: TokenUserType.describe(
|
|
949
880
|
"Indicates whether the action was created by a human-user or by a system-user."
|
|
950
881
|
),
|
|
951
|
-
createdAt:
|
|
952
|
-
createdBy:
|
|
953
|
-
createdByRole:
|
|
882
|
+
createdAt: z13.string().datetime().describe("Timestamp indicating when the action was created."),
|
|
883
|
+
createdBy: z13.string().describe("Identifier of the user who created the action."),
|
|
884
|
+
createdByRole: z13.string().optional().describe("Role of the user who created the action."),
|
|
954
885
|
createdBySignature: DocumentPath.nullish().describe(
|
|
955
886
|
"Reference to the signature of the user who created the action."
|
|
956
887
|
),
|
|
@@ -962,7 +893,7 @@ var ActionBase = z14.object({
|
|
|
962
893
|
"Declaration data defined by the ActionConfig. Supports partial updates."
|
|
963
894
|
),
|
|
964
895
|
annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
|
|
965
|
-
status:
|
|
896
|
+
status: z13.enum([
|
|
966
897
|
ActionStatus.Requested,
|
|
967
898
|
ActionStatus.Accepted,
|
|
968
899
|
ActionStatus.Rejected
|
|
@@ -974,139 +905,139 @@ var ActionBase = z14.object({
|
|
|
974
905
|
)
|
|
975
906
|
});
|
|
976
907
|
var AssignedAction = ActionBase.extend(
|
|
977
|
-
|
|
978
|
-
type:
|
|
979
|
-
assignedTo:
|
|
908
|
+
z13.object({
|
|
909
|
+
type: z13.literal(ActionType.ASSIGN),
|
|
910
|
+
assignedTo: z13.string().describe("Identifier of the user to whom the action is assigned.")
|
|
980
911
|
// TODO move into 'content' property
|
|
981
912
|
}).shape
|
|
982
913
|
);
|
|
983
914
|
var UnassignedAction = ActionBase.extend(
|
|
984
|
-
|
|
985
|
-
type:
|
|
915
|
+
z13.object({
|
|
916
|
+
type: z13.literal(ActionType.UNASSIGN)
|
|
986
917
|
}).shape
|
|
987
918
|
);
|
|
988
919
|
var RegisterAction = ActionBase.extend(
|
|
989
|
-
|
|
990
|
-
type:
|
|
991
|
-
registrationNumber:
|
|
920
|
+
z13.object({
|
|
921
|
+
type: z13.literal(ActionType.REGISTER),
|
|
922
|
+
registrationNumber: z13.string().optional().describe(
|
|
992
923
|
"Registration number of the event. Always present for accepted registrations."
|
|
993
924
|
)
|
|
994
925
|
// TODO move into 'content' property
|
|
995
926
|
}).shape
|
|
996
927
|
);
|
|
997
928
|
var DeclareAction = ActionBase.extend(
|
|
998
|
-
|
|
999
|
-
type:
|
|
929
|
+
z13.object({
|
|
930
|
+
type: z13.literal(ActionType.DECLARE)
|
|
1000
931
|
}).shape
|
|
1001
932
|
);
|
|
1002
|
-
var ReasonContent =
|
|
1003
|
-
reason:
|
|
933
|
+
var ReasonContent = z13.object({
|
|
934
|
+
reason: z13.string().min(1, { error: "Message cannot be empty" }).describe(
|
|
1004
935
|
"Message describing the reason for rejecting or archiving the event."
|
|
1005
936
|
)
|
|
1006
937
|
});
|
|
1007
938
|
var RejectAction = ActionBase.extend(
|
|
1008
|
-
|
|
1009
|
-
type:
|
|
939
|
+
z13.object({
|
|
940
|
+
type: z13.literal(ActionType.REJECT),
|
|
1010
941
|
content: ReasonContent
|
|
1011
942
|
}).shape
|
|
1012
943
|
);
|
|
1013
|
-
var PotentialDuplicate =
|
|
944
|
+
var PotentialDuplicate = z13.object({
|
|
1014
945
|
id: UUID,
|
|
1015
|
-
trackingId:
|
|
946
|
+
trackingId: z13.string()
|
|
1016
947
|
});
|
|
1017
948
|
var DuplicateDetectedAction = ActionBase.extend(
|
|
1018
|
-
|
|
1019
|
-
type:
|
|
1020
|
-
content:
|
|
1021
|
-
duplicates:
|
|
949
|
+
z13.object({
|
|
950
|
+
type: z13.literal(ActionType.DUPLICATE_DETECTED),
|
|
951
|
+
content: z13.object({
|
|
952
|
+
duplicates: z13.array(PotentialDuplicate)
|
|
1022
953
|
})
|
|
1023
954
|
}).shape
|
|
1024
955
|
);
|
|
1025
956
|
var MarkNotDuplicateAction = ActionBase.extend(
|
|
1026
|
-
|
|
1027
|
-
type:
|
|
957
|
+
z13.object({
|
|
958
|
+
type: z13.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
1028
959
|
}).shape
|
|
1029
960
|
);
|
|
1030
961
|
var MarkAsDuplicateAction = ActionBase.extend(
|
|
1031
|
-
|
|
1032
|
-
type:
|
|
1033
|
-
content:
|
|
962
|
+
z13.object({
|
|
963
|
+
type: z13.literal(ActionType.MARK_AS_DUPLICATE),
|
|
964
|
+
content: z13.object({
|
|
1034
965
|
duplicateOf: UUID
|
|
1035
966
|
}).optional()
|
|
1036
967
|
}).shape
|
|
1037
968
|
);
|
|
1038
969
|
var ArchiveAction = ActionBase.extend(
|
|
1039
|
-
|
|
1040
|
-
type:
|
|
970
|
+
z13.object({
|
|
971
|
+
type: z13.literal(ActionType.ARCHIVE),
|
|
1041
972
|
content: ReasonContent
|
|
1042
973
|
}).shape
|
|
1043
974
|
);
|
|
1044
975
|
var UnarchiveAction = ActionBase.extend(
|
|
1045
|
-
|
|
1046
|
-
type:
|
|
976
|
+
z13.object({
|
|
977
|
+
type: z13.literal(ActionType.UNARCHIVE)
|
|
1047
978
|
}).shape
|
|
1048
979
|
);
|
|
1049
980
|
var CreatedAction = ActionBase.extend(
|
|
1050
|
-
|
|
1051
|
-
type:
|
|
981
|
+
z13.object({
|
|
982
|
+
type: z13.literal(ActionType.CREATE)
|
|
1052
983
|
}).shape
|
|
1053
984
|
);
|
|
1054
985
|
var NotifiedAction = ActionBase.extend(
|
|
1055
|
-
|
|
1056
|
-
type:
|
|
986
|
+
z13.object({
|
|
987
|
+
type: z13.literal(ActionType.NOTIFY)
|
|
1057
988
|
}).shape
|
|
1058
989
|
);
|
|
1059
990
|
var EditAction = ActionBase.extend(
|
|
1060
|
-
|
|
1061
|
-
type:
|
|
991
|
+
z13.object({
|
|
992
|
+
type: z13.literal(ActionType.EDIT),
|
|
1062
993
|
/** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
|
|
1063
|
-
content:
|
|
1064
|
-
comment:
|
|
994
|
+
content: z13.object({
|
|
995
|
+
comment: z13.string().describe("Comment for the edit action.").optional()
|
|
1065
996
|
}).optional()
|
|
1066
997
|
}).shape
|
|
1067
998
|
);
|
|
1068
|
-
var PrintContent =
|
|
1069
|
-
templateId:
|
|
999
|
+
var PrintContent = z13.object({
|
|
1000
|
+
templateId: z13.string().optional()
|
|
1070
1001
|
});
|
|
1071
1002
|
var PrintCertificateAction = ActionBase.extend(
|
|
1072
|
-
|
|
1073
|
-
type:
|
|
1003
|
+
z13.object({
|
|
1004
|
+
type: z13.literal(ActionType.PRINT_CERTIFICATE),
|
|
1074
1005
|
content: PrintContent.optional().nullable()
|
|
1075
1006
|
}).shape
|
|
1076
1007
|
);
|
|
1077
1008
|
var RequestedCorrectionAction = ActionBase.extend(
|
|
1078
|
-
|
|
1079
|
-
type:
|
|
1009
|
+
z13.object({
|
|
1010
|
+
type: z13.literal(ActionType.REQUEST_CORRECTION)
|
|
1080
1011
|
}).shape
|
|
1081
1012
|
);
|
|
1082
1013
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
1083
|
-
|
|
1084
|
-
type:
|
|
1085
|
-
requestId:
|
|
1014
|
+
z13.object({
|
|
1015
|
+
type: z13.literal(ActionType.APPROVE_CORRECTION),
|
|
1016
|
+
requestId: z13.string(),
|
|
1086
1017
|
// TODO move into 'content' property
|
|
1087
|
-
content:
|
|
1018
|
+
content: z13.object({ immediateCorrection: z13.boolean().optional() }).optional()
|
|
1088
1019
|
}).shape
|
|
1089
1020
|
);
|
|
1090
1021
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
1091
|
-
|
|
1092
|
-
type:
|
|
1093
|
-
requestId:
|
|
1022
|
+
z13.object({
|
|
1023
|
+
type: z13.literal(ActionType.REJECT_CORRECTION),
|
|
1024
|
+
requestId: z13.string(),
|
|
1094
1025
|
// TODO move into 'content' property
|
|
1095
1026
|
content: ReasonContent
|
|
1096
1027
|
}).shape
|
|
1097
1028
|
);
|
|
1098
1029
|
var ReadAction = ActionBase.extend(
|
|
1099
|
-
|
|
1100
|
-
type:
|
|
1030
|
+
z13.object({
|
|
1031
|
+
type: z13.literal(ActionType.READ)
|
|
1101
1032
|
}).shape
|
|
1102
1033
|
);
|
|
1103
1034
|
var CustomAction = ActionBase.merge(
|
|
1104
|
-
|
|
1105
|
-
type:
|
|
1106
|
-
customActionType:
|
|
1035
|
+
z13.object({
|
|
1036
|
+
type: z13.literal(ActionType.CUSTOM),
|
|
1037
|
+
customActionType: z13.string()
|
|
1107
1038
|
})
|
|
1108
1039
|
);
|
|
1109
|
-
var ActionDocument =
|
|
1040
|
+
var ActionDocument = z13.discriminatedUnion("type", [
|
|
1110
1041
|
CreatedAction.meta({ id: "CreatedAction" }),
|
|
1111
1042
|
RejectAction.meta({ id: "RejectAction" }),
|
|
1112
1043
|
DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
|
|
@@ -1133,12 +1064,64 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
|
1133
1064
|
declaration: true,
|
|
1134
1065
|
annotation: true
|
|
1135
1066
|
}).extend(
|
|
1136
|
-
|
|
1137
|
-
type:
|
|
1138
|
-
status:
|
|
1067
|
+
z13.object({
|
|
1068
|
+
type: z13.enum(ConfirmableActions),
|
|
1069
|
+
status: z13.literal(ActionStatus.Rejected)
|
|
1139
1070
|
}).shape
|
|
1140
1071
|
);
|
|
1141
|
-
var Action =
|
|
1072
|
+
var Action = z13.union([ActionDocument, AsyncRejectActionDocument]);
|
|
1073
|
+
|
|
1074
|
+
// ../commons/src/events/Flag.ts
|
|
1075
|
+
var z14 = __toESM(require("zod/v4"));
|
|
1076
|
+
var InherentFlags = {
|
|
1077
|
+
INCOMPLETE: "incomplete",
|
|
1078
|
+
REJECTED: "rejected",
|
|
1079
|
+
CORRECTION_REQUESTED: "correction-requested",
|
|
1080
|
+
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
1081
|
+
/**
|
|
1082
|
+
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
1083
|
+
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
1084
|
+
*
|
|
1085
|
+
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
1086
|
+
*/
|
|
1087
|
+
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
1088
|
+
};
|
|
1089
|
+
var ActionFlag = z14.string().regex(
|
|
1090
|
+
new RegExp(
|
|
1091
|
+
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
1092
|
+
ActionStatus
|
|
1093
|
+
).join("|").toLowerCase()})$`
|
|
1094
|
+
),
|
|
1095
|
+
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
1096
|
+
);
|
|
1097
|
+
var CustomFlag = z14.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
1098
|
+
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
1099
|
+
InherentFlags
|
|
1100
|
+
).join(", ")}`
|
|
1101
|
+
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
1102
|
+
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
1103
|
+
}).describe("Custom flag identifier defined by the country config.");
|
|
1104
|
+
var Flag = ActionFlag.or(z14.enum(InherentFlags)).or(CustomFlag);
|
|
1105
|
+
var FlagConfig = z14.object({
|
|
1106
|
+
id: CustomFlag,
|
|
1107
|
+
requiresAction: z14.boolean().describe(
|
|
1108
|
+
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1109
|
+
),
|
|
1110
|
+
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1111
|
+
}).meta({
|
|
1112
|
+
id: "FlagConfig",
|
|
1113
|
+
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
1114
|
+
});
|
|
1115
|
+
var ActionFlagConfig = z14.object({
|
|
1116
|
+
id: Flag,
|
|
1117
|
+
operation: z14.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
1118
|
+
conditional: Conditional.optional().describe(
|
|
1119
|
+
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1120
|
+
)
|
|
1121
|
+
}).meta({
|
|
1122
|
+
id: "ActionFlagConfig",
|
|
1123
|
+
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
1124
|
+
});
|
|
1142
1125
|
|
|
1143
1126
|
// ../commons/src/events/EventMetadata.ts
|
|
1144
1127
|
var EventStatus = z15.enum([
|
|
@@ -1299,6 +1282,13 @@ var Range = import_v4.z.object({
|
|
|
1299
1282
|
}).meta({
|
|
1300
1283
|
id: "Range"
|
|
1301
1284
|
});
|
|
1285
|
+
var ContainsFlags = import_v4.z.object({
|
|
1286
|
+
anyOf: import_v4.z.array(Flag).optional(),
|
|
1287
|
+
noneOf: import_v4.z.array(Flag).optional(),
|
|
1288
|
+
allOf: import_v4.z.array(Flag).optional()
|
|
1289
|
+
}).meta({
|
|
1290
|
+
id: "ContainsFlags"
|
|
1291
|
+
});
|
|
1302
1292
|
var Within = import_v4.z.object({ type: import_v4.z.literal("within"), location: import_v4.z.string() }).meta({
|
|
1303
1293
|
id: "Within"
|
|
1304
1294
|
});
|