@opencrvs/toolkit 2.1.0-rc.fc582d7 → 2.1.0-rc.fd36a56
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 +189 -200
- package/dist/commons/api/router.d.ts +1 -1
- package/dist/commons/conditionals/conditionals.d.ts +3 -3
- package/dist/commons/conditionals/validate.d.ts +1 -10
- package/dist/commons/events/ActionConfig.d.ts +0 -21
- package/dist/commons/events/ActionDocument.d.ts +7 -1
- package/dist/commons/events/AdvancedSearchConfig.d.ts +0 -6
- package/dist/commons/events/CountryConfigQueryInput.d.ts +0 -18
- package/dist/commons/events/EventConfig.d.ts +0 -3
- package/dist/commons/events/EventIndex.d.ts +24 -5
- package/dist/commons/events/EventMetadata.d.ts +0 -1
- package/dist/commons/events/FieldConfig.d.ts +0 -5
- package/dist/commons/events/FieldTypeMapping.d.ts +27 -27
- package/dist/commons/events/Flag.d.ts +0 -48
- package/dist/commons/events/WorkqueueConfig.d.ts +14 -32
- package/dist/commons/events/event.d.ts +0 -12
- package/dist/conditionals/index.js +55 -303
- package/dist/events/index.js +2798 -2870
- package/dist/notification/index.js +1035 -1639
- package/dist/scopes/index.d.ts +0 -250
- package/dist/scopes/index.js +55 -304
- package/opencrvs-toolkit-2.1.0-rc.fd36a56.tgz +0 -0
- package/package.json +1 -1
- package/dist/commons/events/ActionStatus.d.ts +0 -14
- package/opencrvs-toolkit-2.1.0-rc.fc582d7.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",
|
|
@@ -731,15 +658,15 @@ var PlainScopeType = z12.enum([
|
|
|
731
658
|
"record.confirm-registration",
|
|
732
659
|
"record.reject-registration"
|
|
733
660
|
]);
|
|
734
|
-
var scopeByEvent =
|
|
661
|
+
var scopeByEvent = z11.preprocess(
|
|
735
662
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
736
|
-
|
|
663
|
+
z11.array(z11.string()).optional()
|
|
737
664
|
).describe("Event type, e.g. birth, death");
|
|
738
|
-
var userRole =
|
|
665
|
+
var userRole = z11.preprocess(
|
|
739
666
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
740
|
-
|
|
667
|
+
z11.array(z11.string()).optional()
|
|
741
668
|
).describe("User role, e.g. admin, field agent");
|
|
742
|
-
var scopeOptionsPlaceEvent =
|
|
669
|
+
var scopeOptionsPlaceEvent = z11.object({
|
|
743
670
|
event: scopeByEvent,
|
|
744
671
|
placeOfEvent: JurisdictionFilter.optional()
|
|
745
672
|
}).describe("Options applicable to all record scopes.");
|
|
@@ -751,37 +678,36 @@ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
|
751
678
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
752
679
|
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
753
680
|
registeredIn: JurisdictionFilter.optional(),
|
|
754
|
-
registeredBy: UserFilter.optional()
|
|
755
|
-
flags: ContainsFlags.optional()
|
|
681
|
+
registeredBy: UserFilter.optional()
|
|
756
682
|
}).describe(
|
|
757
683
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
758
684
|
);
|
|
759
685
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
760
|
-
customActionTypes:
|
|
686
|
+
customActionTypes: z11.preprocess(
|
|
761
687
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
762
|
-
|
|
688
|
+
z11.array(z11.string()).optional()
|
|
763
689
|
).describe("Allowed custom action types")
|
|
764
690
|
});
|
|
765
|
-
var AccessLevelOptions =
|
|
691
|
+
var AccessLevelOptions = z11.object({
|
|
766
692
|
accessLevel: JurisdictionFilter.optional()
|
|
767
693
|
});
|
|
768
694
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
769
695
|
role: userRole.optional()
|
|
770
696
|
});
|
|
771
|
-
var WorkqueueOrDashboardOptions =
|
|
772
|
-
ids:
|
|
697
|
+
var WorkqueueOrDashboardOptions = z11.object({
|
|
698
|
+
ids: z11.preprocess(
|
|
773
699
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
774
|
-
|
|
700
|
+
z11.array(z11.string())
|
|
775
701
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
776
702
|
});
|
|
777
|
-
var AllScopeOptions =
|
|
703
|
+
var AllScopeOptions = z11.object({
|
|
778
704
|
...AllRecordScopeOptions.shape,
|
|
779
705
|
...AccessLevelOptions.shape,
|
|
780
706
|
...AllUserScopeOptions.shape,
|
|
781
707
|
...WorkqueueOrDashboardOptions.shape
|
|
782
708
|
});
|
|
783
709
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
784
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
710
|
+
var ResolvedScopeOptionsPlaceEvent = z11.object({
|
|
785
711
|
event: scopeByEvent,
|
|
786
712
|
placeOfEvent: UUID.nullish()
|
|
787
713
|
}).describe(
|
|
@@ -789,16 +715,15 @@ var ResolvedScopeOptionsPlaceEvent = z12.object({
|
|
|
789
715
|
);
|
|
790
716
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
791
717
|
notifiedIn: UUID.nullish(),
|
|
792
|
-
notifiedBy:
|
|
718
|
+
notifiedBy: z11.string().optional(),
|
|
793
719
|
declaredIn: UUID.nullish(),
|
|
794
|
-
declaredBy:
|
|
720
|
+
declaredBy: z11.string().optional()
|
|
795
721
|
}).describe(
|
|
796
722
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
797
723
|
);
|
|
798
724
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
799
725
|
registeredIn: UUID.nullish(),
|
|
800
|
-
registeredBy:
|
|
801
|
-
flags: ContainsFlags.optional()
|
|
726
|
+
registeredBy: z11.string().optional()
|
|
802
727
|
}).describe(
|
|
803
728
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
804
729
|
);
|
|
@@ -823,38 +748,38 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
823
748
|
"record.unassign-others"
|
|
824
749
|
]);
|
|
825
750
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
826
|
-
templates:
|
|
751
|
+
templates: z11.preprocess(
|
|
827
752
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
828
|
-
|
|
753
|
+
z11.array(z11.string()).optional()
|
|
829
754
|
).describe(
|
|
830
755
|
"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
756
|
)
|
|
832
757
|
});
|
|
833
|
-
var RecordScopeV2 =
|
|
834
|
-
|
|
758
|
+
var RecordScopeV2 = z11.discriminatedUnion("type", [
|
|
759
|
+
z11.object({
|
|
835
760
|
type: ScopesWithPlaceEventOptions,
|
|
836
761
|
options: scopeOptionsPlaceEvent.optional()
|
|
837
762
|
}),
|
|
838
|
-
|
|
763
|
+
z11.object({
|
|
839
764
|
type: ScopesWithDeclaredOptions,
|
|
840
765
|
options: scopeOptionsDeclaredOrNotified.optional()
|
|
841
766
|
}),
|
|
842
|
-
|
|
767
|
+
z11.object({
|
|
843
768
|
type: ScopesWithFullOptions,
|
|
844
769
|
options: AllRecordScopeOptions.optional()
|
|
845
770
|
}),
|
|
846
|
-
|
|
847
|
-
type:
|
|
771
|
+
z11.object({
|
|
772
|
+
type: z11.literal("record.custom-action"),
|
|
848
773
|
options: CustomActionScopeOptions.optional()
|
|
849
774
|
}),
|
|
850
|
-
|
|
851
|
-
type:
|
|
775
|
+
z11.object({
|
|
776
|
+
type: z11.literal("record.print-certified-copies"),
|
|
852
777
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
853
778
|
})
|
|
854
779
|
]).describe(
|
|
855
780
|
"Scopes used to check user's permission to perform actions on a record."
|
|
856
781
|
);
|
|
857
|
-
var SystemScopeType =
|
|
782
|
+
var SystemScopeType = z11.enum([
|
|
858
783
|
"organisation.read-locations",
|
|
859
784
|
"user.read",
|
|
860
785
|
"user.create",
|
|
@@ -868,61 +793,61 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
868
793
|
"user.search"
|
|
869
794
|
]);
|
|
870
795
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
871
|
-
var UserScopeV2 =
|
|
872
|
-
|
|
796
|
+
var UserScopeV2 = z11.discriminatedUnion("type", [
|
|
797
|
+
z11.object({
|
|
873
798
|
type: ScopesWithRoleOption,
|
|
874
799
|
options: AllUserScopeOptions.optional()
|
|
875
800
|
}),
|
|
876
|
-
|
|
801
|
+
z11.object({
|
|
877
802
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
878
803
|
options: AccessLevelOptions.optional()
|
|
879
804
|
})
|
|
880
805
|
]);
|
|
881
|
-
var ResolvedRecordScopeV2 =
|
|
882
|
-
|
|
806
|
+
var ResolvedRecordScopeV2 = z11.discriminatedUnion("type", [
|
|
807
|
+
z11.object({
|
|
883
808
|
type: ScopesWithPlaceEventOptions,
|
|
884
809
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
885
810
|
}),
|
|
886
|
-
|
|
811
|
+
z11.object({
|
|
887
812
|
type: ScopesWithDeclaredOptions,
|
|
888
813
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
889
814
|
}),
|
|
890
|
-
|
|
815
|
+
z11.object({
|
|
891
816
|
type: ScopesWithFullOptions,
|
|
892
817
|
options: ResolvedScopeOptionsFull.optional()
|
|
893
818
|
}),
|
|
894
|
-
|
|
895
|
-
type:
|
|
819
|
+
z11.object({
|
|
820
|
+
type: z11.literal("record.print-certified-copies"),
|
|
896
821
|
options: ResolvedScopeOptionsFull.extend({
|
|
897
|
-
templates:
|
|
822
|
+
templates: z11.array(z11.string()).optional()
|
|
898
823
|
}).optional()
|
|
899
824
|
})
|
|
900
825
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
901
|
-
var Scope =
|
|
902
|
-
|
|
826
|
+
var Scope = z11.discriminatedUnion("type", [
|
|
827
|
+
z11.object({ type: PlainScopeType }),
|
|
903
828
|
...RecordScopeV2.options,
|
|
904
829
|
...UserScopeV2.options,
|
|
905
|
-
|
|
906
|
-
type:
|
|
830
|
+
z11.object({
|
|
831
|
+
type: z11.literal("organisation.read-locations"),
|
|
907
832
|
options: AccessLevelOptions.optional()
|
|
908
833
|
}),
|
|
909
|
-
|
|
910
|
-
type:
|
|
834
|
+
z11.object({
|
|
835
|
+
type: z11.literal("workqueue"),
|
|
911
836
|
options: WorkqueueOrDashboardOptions
|
|
912
837
|
}),
|
|
913
|
-
|
|
914
|
-
type:
|
|
838
|
+
z11.object({
|
|
839
|
+
type: z11.literal("dashboard.view"),
|
|
915
840
|
options: WorkqueueOrDashboardOptions
|
|
916
841
|
})
|
|
917
842
|
]);
|
|
918
|
-
var ScopeType =
|
|
843
|
+
var ScopeType = z11.enum([
|
|
919
844
|
...SystemScopeType.options,
|
|
920
845
|
...RecordScopeTypeV2.options,
|
|
921
846
|
...PlainScopeType.options,
|
|
922
847
|
"workqueue",
|
|
923
848
|
"dashboard.view"
|
|
924
849
|
]);
|
|
925
|
-
var EncodedScope =
|
|
850
|
+
var EncodedScope = z11.string().brand("EncodedScope");
|
|
926
851
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
927
852
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
928
853
|
accessLevel: JurisdictionFilter.enum.all,
|
|
@@ -932,25 +857,30 @@ var DEFAULT_SCOPE_OPTIONS = {
|
|
|
932
857
|
};
|
|
933
858
|
|
|
934
859
|
// ../commons/src/authentication.ts
|
|
935
|
-
var TokenUserType =
|
|
936
|
-
var TokenWithBearer =
|
|
860
|
+
var TokenUserType = z12.enum(["user", "system"]);
|
|
861
|
+
var TokenWithBearer = z12.string().regex(/^Bearer\s/);
|
|
937
862
|
|
|
938
863
|
// ../commons/src/events/ActionDocument.ts
|
|
939
|
-
var ActionUpdate =
|
|
864
|
+
var ActionUpdate = z13.record(z13.string(), FieldUpdateValue).describe(
|
|
940
865
|
"Record of field-level changes made by an action. Supports partial updates and nullable values."
|
|
941
866
|
);
|
|
942
|
-
var EventState =
|
|
867
|
+
var EventState = z13.record(z13.string(), FieldValue).describe(
|
|
943
868
|
"Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
|
|
944
869
|
);
|
|
945
|
-
var
|
|
870
|
+
var ActionStatus = {
|
|
871
|
+
Requested: "Requested",
|
|
872
|
+
Accepted: "Accepted",
|
|
873
|
+
Rejected: "Rejected"
|
|
874
|
+
};
|
|
875
|
+
var ActionBase = z13.object({
|
|
946
876
|
id: UUID.describe("Unique identifier of the action."),
|
|
947
|
-
transactionId:
|
|
877
|
+
transactionId: z13.string().describe("Unique identifier of the transaction."),
|
|
948
878
|
createdByUserType: TokenUserType.describe(
|
|
949
879
|
"Indicates whether the action was created by a human-user or by a system-user."
|
|
950
880
|
),
|
|
951
|
-
createdAt:
|
|
952
|
-
createdBy:
|
|
953
|
-
createdByRole:
|
|
881
|
+
createdAt: z13.string().datetime().describe("Timestamp indicating when the action was created."),
|
|
882
|
+
createdBy: z13.string().describe("Identifier of the user who created the action."),
|
|
883
|
+
createdByRole: z13.string().optional().describe("Role of the user who created the action."),
|
|
954
884
|
createdBySignature: DocumentPath.nullish().describe(
|
|
955
885
|
"Reference to the signature of the user who created the action."
|
|
956
886
|
),
|
|
@@ -962,7 +892,7 @@ var ActionBase = z14.object({
|
|
|
962
892
|
"Declaration data defined by the ActionConfig. Supports partial updates."
|
|
963
893
|
),
|
|
964
894
|
annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
|
|
965
|
-
status:
|
|
895
|
+
status: z13.enum([
|
|
966
896
|
ActionStatus.Requested,
|
|
967
897
|
ActionStatus.Accepted,
|
|
968
898
|
ActionStatus.Rejected
|
|
@@ -974,139 +904,139 @@ var ActionBase = z14.object({
|
|
|
974
904
|
)
|
|
975
905
|
});
|
|
976
906
|
var AssignedAction = ActionBase.extend(
|
|
977
|
-
|
|
978
|
-
type:
|
|
979
|
-
assignedTo:
|
|
907
|
+
z13.object({
|
|
908
|
+
type: z13.literal(ActionType.ASSIGN),
|
|
909
|
+
assignedTo: z13.string().describe("Identifier of the user to whom the action is assigned.")
|
|
980
910
|
// TODO move into 'content' property
|
|
981
911
|
}).shape
|
|
982
912
|
);
|
|
983
913
|
var UnassignedAction = ActionBase.extend(
|
|
984
|
-
|
|
985
|
-
type:
|
|
914
|
+
z13.object({
|
|
915
|
+
type: z13.literal(ActionType.UNASSIGN)
|
|
986
916
|
}).shape
|
|
987
917
|
);
|
|
988
918
|
var RegisterAction = ActionBase.extend(
|
|
989
|
-
|
|
990
|
-
type:
|
|
991
|
-
registrationNumber:
|
|
919
|
+
z13.object({
|
|
920
|
+
type: z13.literal(ActionType.REGISTER),
|
|
921
|
+
registrationNumber: z13.string().optional().describe(
|
|
992
922
|
"Registration number of the event. Always present for accepted registrations."
|
|
993
923
|
)
|
|
994
924
|
// TODO move into 'content' property
|
|
995
925
|
}).shape
|
|
996
926
|
);
|
|
997
927
|
var DeclareAction = ActionBase.extend(
|
|
998
|
-
|
|
999
|
-
type:
|
|
928
|
+
z13.object({
|
|
929
|
+
type: z13.literal(ActionType.DECLARE)
|
|
1000
930
|
}).shape
|
|
1001
931
|
);
|
|
1002
|
-
var ReasonContent =
|
|
1003
|
-
reason:
|
|
932
|
+
var ReasonContent = z13.object({
|
|
933
|
+
reason: z13.string().min(1, { error: "Message cannot be empty" }).describe(
|
|
1004
934
|
"Message describing the reason for rejecting or archiving the event."
|
|
1005
935
|
)
|
|
1006
936
|
});
|
|
1007
937
|
var RejectAction = ActionBase.extend(
|
|
1008
|
-
|
|
1009
|
-
type:
|
|
938
|
+
z13.object({
|
|
939
|
+
type: z13.literal(ActionType.REJECT),
|
|
1010
940
|
content: ReasonContent
|
|
1011
941
|
}).shape
|
|
1012
942
|
);
|
|
1013
|
-
var PotentialDuplicate =
|
|
943
|
+
var PotentialDuplicate = z13.object({
|
|
1014
944
|
id: UUID,
|
|
1015
|
-
trackingId:
|
|
945
|
+
trackingId: z13.string()
|
|
1016
946
|
});
|
|
1017
947
|
var DuplicateDetectedAction = ActionBase.extend(
|
|
1018
|
-
|
|
1019
|
-
type:
|
|
1020
|
-
content:
|
|
1021
|
-
duplicates:
|
|
948
|
+
z13.object({
|
|
949
|
+
type: z13.literal(ActionType.DUPLICATE_DETECTED),
|
|
950
|
+
content: z13.object({
|
|
951
|
+
duplicates: z13.array(PotentialDuplicate)
|
|
1022
952
|
})
|
|
1023
953
|
}).shape
|
|
1024
954
|
);
|
|
1025
955
|
var MarkNotDuplicateAction = ActionBase.extend(
|
|
1026
|
-
|
|
1027
|
-
type:
|
|
956
|
+
z13.object({
|
|
957
|
+
type: z13.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
1028
958
|
}).shape
|
|
1029
959
|
);
|
|
1030
960
|
var MarkAsDuplicateAction = ActionBase.extend(
|
|
1031
|
-
|
|
1032
|
-
type:
|
|
1033
|
-
content:
|
|
961
|
+
z13.object({
|
|
962
|
+
type: z13.literal(ActionType.MARK_AS_DUPLICATE),
|
|
963
|
+
content: z13.object({
|
|
1034
964
|
duplicateOf: UUID
|
|
1035
965
|
}).optional()
|
|
1036
966
|
}).shape
|
|
1037
967
|
);
|
|
1038
968
|
var ArchiveAction = ActionBase.extend(
|
|
1039
|
-
|
|
1040
|
-
type:
|
|
969
|
+
z13.object({
|
|
970
|
+
type: z13.literal(ActionType.ARCHIVE),
|
|
1041
971
|
content: ReasonContent
|
|
1042
972
|
}).shape
|
|
1043
973
|
);
|
|
1044
974
|
var UnarchiveAction = ActionBase.extend(
|
|
1045
|
-
|
|
1046
|
-
type:
|
|
975
|
+
z13.object({
|
|
976
|
+
type: z13.literal(ActionType.UNARCHIVE)
|
|
1047
977
|
}).shape
|
|
1048
978
|
);
|
|
1049
979
|
var CreatedAction = ActionBase.extend(
|
|
1050
|
-
|
|
1051
|
-
type:
|
|
980
|
+
z13.object({
|
|
981
|
+
type: z13.literal(ActionType.CREATE)
|
|
1052
982
|
}).shape
|
|
1053
983
|
);
|
|
1054
984
|
var NotifiedAction = ActionBase.extend(
|
|
1055
|
-
|
|
1056
|
-
type:
|
|
985
|
+
z13.object({
|
|
986
|
+
type: z13.literal(ActionType.NOTIFY)
|
|
1057
987
|
}).shape
|
|
1058
988
|
);
|
|
1059
989
|
var EditAction = ActionBase.extend(
|
|
1060
|
-
|
|
1061
|
-
type:
|
|
990
|
+
z13.object({
|
|
991
|
+
type: z13.literal(ActionType.EDIT),
|
|
1062
992
|
/** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
|
|
1063
|
-
content:
|
|
1064
|
-
comment:
|
|
993
|
+
content: z13.object({
|
|
994
|
+
comment: z13.string().describe("Comment for the edit action.").optional()
|
|
1065
995
|
}).optional()
|
|
1066
996
|
}).shape
|
|
1067
997
|
);
|
|
1068
|
-
var PrintContent =
|
|
1069
|
-
templateId:
|
|
998
|
+
var PrintContent = z13.object({
|
|
999
|
+
templateId: z13.string().optional()
|
|
1070
1000
|
});
|
|
1071
1001
|
var PrintCertificateAction = ActionBase.extend(
|
|
1072
|
-
|
|
1073
|
-
type:
|
|
1002
|
+
z13.object({
|
|
1003
|
+
type: z13.literal(ActionType.PRINT_CERTIFICATE),
|
|
1074
1004
|
content: PrintContent.optional().nullable()
|
|
1075
1005
|
}).shape
|
|
1076
1006
|
);
|
|
1077
1007
|
var RequestedCorrectionAction = ActionBase.extend(
|
|
1078
|
-
|
|
1079
|
-
type:
|
|
1008
|
+
z13.object({
|
|
1009
|
+
type: z13.literal(ActionType.REQUEST_CORRECTION)
|
|
1080
1010
|
}).shape
|
|
1081
1011
|
);
|
|
1082
1012
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
1083
|
-
|
|
1084
|
-
type:
|
|
1085
|
-
requestId:
|
|
1013
|
+
z13.object({
|
|
1014
|
+
type: z13.literal(ActionType.APPROVE_CORRECTION),
|
|
1015
|
+
requestId: z13.string(),
|
|
1086
1016
|
// TODO move into 'content' property
|
|
1087
|
-
content:
|
|
1017
|
+
content: z13.object({ immediateCorrection: z13.boolean().optional() }).optional()
|
|
1088
1018
|
}).shape
|
|
1089
1019
|
);
|
|
1090
1020
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
1091
|
-
|
|
1092
|
-
type:
|
|
1093
|
-
requestId:
|
|
1021
|
+
z13.object({
|
|
1022
|
+
type: z13.literal(ActionType.REJECT_CORRECTION),
|
|
1023
|
+
requestId: z13.string(),
|
|
1094
1024
|
// TODO move into 'content' property
|
|
1095
1025
|
content: ReasonContent
|
|
1096
1026
|
}).shape
|
|
1097
1027
|
);
|
|
1098
1028
|
var ReadAction = ActionBase.extend(
|
|
1099
|
-
|
|
1100
|
-
type:
|
|
1029
|
+
z13.object({
|
|
1030
|
+
type: z13.literal(ActionType.READ)
|
|
1101
1031
|
}).shape
|
|
1102
1032
|
);
|
|
1103
1033
|
var CustomAction = ActionBase.merge(
|
|
1104
|
-
|
|
1105
|
-
type:
|
|
1106
|
-
customActionType:
|
|
1034
|
+
z13.object({
|
|
1035
|
+
type: z13.literal(ActionType.CUSTOM),
|
|
1036
|
+
customActionType: z13.string()
|
|
1107
1037
|
})
|
|
1108
1038
|
);
|
|
1109
|
-
var ActionDocument =
|
|
1039
|
+
var ActionDocument = z13.discriminatedUnion("type", [
|
|
1110
1040
|
CreatedAction.meta({ id: "CreatedAction" }),
|
|
1111
1041
|
RejectAction.meta({ id: "RejectAction" }),
|
|
1112
1042
|
DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
|
|
@@ -1133,12 +1063,64 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
|
1133
1063
|
declaration: true,
|
|
1134
1064
|
annotation: true
|
|
1135
1065
|
}).extend(
|
|
1136
|
-
|
|
1137
|
-
type:
|
|
1138
|
-
status:
|
|
1066
|
+
z13.object({
|
|
1067
|
+
type: z13.enum(ConfirmableActions),
|
|
1068
|
+
status: z13.literal(ActionStatus.Rejected)
|
|
1139
1069
|
}).shape
|
|
1140
1070
|
);
|
|
1141
|
-
var Action =
|
|
1071
|
+
var Action = z13.union([ActionDocument, AsyncRejectActionDocument]);
|
|
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
|
+
});
|
|
1142
1124
|
|
|
1143
1125
|
// ../commons/src/events/EventMetadata.ts
|
|
1144
1126
|
var EventStatus = z15.enum([
|
|
@@ -1299,6 +1281,13 @@ var Range = import_v4.z.object({
|
|
|
1299
1281
|
}).meta({
|
|
1300
1282
|
id: "Range"
|
|
1301
1283
|
});
|
|
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
|
+
});
|
|
1302
1291
|
var Within = import_v4.z.object({ type: import_v4.z.literal("within"), location: import_v4.z.string() }).meta({
|
|
1303
1292
|
id: "Within"
|
|
1304
1293
|
});
|
|
@@ -8748,7 +8748,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
8748
8748
|
$event: "assignedTo" | "createdAt" | "createdAtLocation" | "createdBy" | "createdByUserType" | "dateOfEvent" | "flags" | "id" | "legalStatuses" | "outbox" | "placeOfEvent" | "status" | "title" | "trackingId" | "type" | "updatedAt" | "updatedAtLocation" | "updatedBy" | "updatedByUserRole";
|
|
8749
8749
|
};
|
|
8750
8750
|
}[];
|
|
8751
|
-
icon: "Activity" | "Archive" | "ArchiveBox" | "ArchiveTray" | "Archived" | "ArrowCircleDown" | "ArrowCounterClockwise" | "ArrowLeft" | "ArrowRight" | "Assigned" | "Briefcase" | "Buildings" | "CaretDown" | "CaretLeft" | "CaretRight" | "Certified" | "ChartActivity" | "ChartBar" | "ChartLine" | "ChatCircle" | "ChatText" | "Check" | "CheckSquare" | "Circle" | "CircleWavyCheck" | "CircleWavyQuestion" | "Clock" | "Close" | "Collapse" | "Compass" | "Copy" | "Database" | "DeviceTabletCamera" | "DotsThreeVertical" | "Draft" | "DuplicateYellow" | "Envelope" | "Expand" | "Export" | "ExternalValidate" | "Eye" | "EyeSlash" | "File" | "FileArrowUp" | "FileDotted" | "
|
|
8751
|
+
icon: "Activity" | "Archive" | "ArchiveBox" | "ArchiveTray" | "Archived" | "ArrowCircleDown" | "ArrowCounterClockwise" | "ArrowLeft" | "ArrowRight" | "Assigned" | "Briefcase" | "Buildings" | "CaretDown" | "CaretLeft" | "CaretRight" | "Certified" | "ChartActivity" | "ChartBar" | "ChartLine" | "ChatCircle" | "ChatText" | "Check" | "CheckSquare" | "Circle" | "CircleWavyCheck" | "CircleWavyQuestion" | "Clock" | "Close" | "Collapse" | "Compass" | "Copy" | "Database" | "DeviceTabletCamera" | "DotsThreeVertical" | "Draft" | "DuplicateYellow" | "Envelope" | "Expand" | "Export" | "ExternalValidate" | "Eye" | "EyeSlash" | "File" | "FileArrowUp" | "FileDotted" | "FileMinus" | "FilePlus" | "FileSearch" | "FileText" | "FileX" | "Files" | "FilledCheck" | "Fingerprint" | "Gear" | "GitBranch" | "Globe" | "Handshake" | "IdentificationCard" | "InReview" | "List" | "ListBullets" | "Lock" | "MagnifyingGlass" | "MagnifyingGlassMinus" | "MagnifyingGlassPlus" | "MapPin" | "Medal" | "NotePencil" | "Offline" | "PaperPlaneTilt" | "Paperclip" | "Pen" | "PenNib" | "Pencil" | "PencilCircle" | "PencilLine" | "PencilSimpleLine" | "Phone" | "Plus" | "Printer" | "PushPin" | "QrCode" | "Registered" | "RequiresUpdates" | "Sent" | "SignOut" | "Stamp" | "Star" | "Sun" | "Target" | "TextT" | "Timer" | "Trash" | "UploadSimple" | "User" | "UserCircle" | "UserPlus" | "Users" | "Validated" | "WaitingApproval" | "WarningCircle" | "Webcam" | "X";
|
|
8752
8752
|
emptyMessage?: {
|
|
8753
8753
|
id: string;
|
|
8754
8754
|
defaultMessage: string;
|