@opencrvs/toolkit 2.1.0-rc.d078d1a → 2.1.0-rc.d24aa5e
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 -202
- package/dist/commons/api/router.d.ts +1589 -1657
- package/dist/commons/application-config/index.d.ts +6 -6
- package/dist/commons/conditionals/conditionals.d.ts +2102 -259
- package/dist/commons/conditionals/validate.d.ts +1 -10
- package/dist/commons/events/ActionConfig.d.ts +105 -105
- package/dist/commons/events/ActionDocument.d.ts +123 -117
- package/dist/commons/events/ActionInput.d.ts +6 -0
- package/dist/commons/events/ActionType.d.ts +62 -62
- package/dist/commons/events/AdvancedSearchConfig.d.ts +507 -519
- package/dist/commons/events/AuditLog.d.ts +42 -79
- 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 -590
- 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 -8
- package/dist/commons/events/EventDocument.d.ts +48 -48
- package/dist/commons/events/EventIndex.d.ts +71 -48
- package/dist/commons/events/EventMetadata.d.ts +40 -40
- package/dist/commons/events/FieldConfig.d.ts +337 -347
- package/dist/commons/events/FieldType.d.ts +51 -51
- package/dist/commons/events/FieldTypeMapping.d.ts +91 -91
- package/dist/commons/events/FieldValue.d.ts +12 -12
- package/dist/commons/events/Flag.d.ts +15 -57
- 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 +813 -816
- package/dist/commons/events/deduplication.d.ts +1 -1
- package/dist/commons/events/event.d.ts +2 -14
- package/dist/commons/events/field.d.ts +895 -78
- package/dist/commons/events/index.d.ts +0 -1
- package/dist/commons/events/locations.d.ts +6 -103
- package/dist/commons/events/mocks.test.utils.d.ts +4 -18
- 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 +43 -40
- package/dist/commons/events/utils.d.ts +114 -114
- package/dist/commons/notification/UserNotifications.d.ts +10 -10
- package/dist/conditionals/index.js +55 -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 +74 -75
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/setup-environment.js +14 -8
- package/dist/environment/utils.d.ts +1 -1
- package/dist/events/deduplication.d.ts +1 -1
- package/dist/events/index.js +3386 -3548
- package/dist/migrations/v2.0/migrate-application-config-url.js +3 -4
- package/dist/notification/index.js +1064 -1731
- package/dist/scopes/index.d.ts +146 -371
- package/dist/scopes/index.js +55 -304
- package/opencrvs-toolkit-2.1.0-rc.d24aa5e.tgz +0 -0
- package/package.json +5 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/commons/events/ActionStatus.d.ts +0 -14
- package/dist/commons/events/locationPayloads.d.ts +0 -95
- package/opencrvs-toolkit-2.1.0-rc.d078d1a.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,88 +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
|
-
};
|
|
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
616
|
|
|
691
617
|
// ../commons/src/scopes.ts
|
|
692
|
-
var
|
|
618
|
+
var z11 = __toESM(require("zod/v4"));
|
|
619
|
+
var qs = __toESM(require("qs"));
|
|
620
|
+
var JurisdictionFilter = z11.enum(["administrativeArea", "location", "all"]).describe(
|
|
693
621
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
694
622
|
);
|
|
695
|
-
var UserFilter =
|
|
696
|
-
var RecordScopeTypeV2 =
|
|
623
|
+
var UserFilter = z11.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
624
|
+
var RecordScopeTypeV2 = z11.enum([
|
|
697
625
|
"record.search",
|
|
698
626
|
"record.create",
|
|
699
627
|
"record.read",
|
|
@@ -711,7 +639,7 @@ var RecordScopeTypeV2 = z12.enum([
|
|
|
711
639
|
"record.unassign-others",
|
|
712
640
|
"record.custom-action"
|
|
713
641
|
]);
|
|
714
|
-
var PlainScopeType =
|
|
642
|
+
var PlainScopeType = z11.enum([
|
|
715
643
|
// Misc. system scopes
|
|
716
644
|
"bypassratelimit",
|
|
717
645
|
"record.reindex",
|
|
@@ -719,7 +647,6 @@ var PlainScopeType = z12.enum([
|
|
|
719
647
|
"integration.create",
|
|
720
648
|
"record.import",
|
|
721
649
|
"config.update-all",
|
|
722
|
-
"location.edit",
|
|
723
650
|
"attachment.upload",
|
|
724
651
|
"profile.electronic-signature",
|
|
725
652
|
"user.read-only-my-audit",
|
|
@@ -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,138 @@ 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:
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
}).optional()
|
|
990
|
+
z13.object({
|
|
991
|
+
type: z13.literal(ActionType.EDIT),
|
|
992
|
+
content: z13.object({
|
|
993
|
+
comment: z13.string().describe("Comment for the edit action.").optional()
|
|
994
|
+
})
|
|
1066
995
|
}).shape
|
|
1067
996
|
);
|
|
1068
|
-
var PrintContent =
|
|
1069
|
-
templateId:
|
|
997
|
+
var PrintContent = z13.object({
|
|
998
|
+
templateId: z13.string().optional()
|
|
1070
999
|
});
|
|
1071
1000
|
var PrintCertificateAction = ActionBase.extend(
|
|
1072
|
-
|
|
1073
|
-
type:
|
|
1001
|
+
z13.object({
|
|
1002
|
+
type: z13.literal(ActionType.PRINT_CERTIFICATE),
|
|
1074
1003
|
content: PrintContent.optional().nullable()
|
|
1075
1004
|
}).shape
|
|
1076
1005
|
);
|
|
1077
1006
|
var RequestedCorrectionAction = ActionBase.extend(
|
|
1078
|
-
|
|
1079
|
-
type:
|
|
1007
|
+
z13.object({
|
|
1008
|
+
type: z13.literal(ActionType.REQUEST_CORRECTION)
|
|
1080
1009
|
}).shape
|
|
1081
1010
|
);
|
|
1082
1011
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
1083
|
-
|
|
1084
|
-
type:
|
|
1085
|
-
requestId:
|
|
1012
|
+
z13.object({
|
|
1013
|
+
type: z13.literal(ActionType.APPROVE_CORRECTION),
|
|
1014
|
+
requestId: z13.string(),
|
|
1086
1015
|
// TODO move into 'content' property
|
|
1087
|
-
content:
|
|
1016
|
+
content: z13.object({ immediateCorrection: z13.boolean().optional() }).optional()
|
|
1088
1017
|
}).shape
|
|
1089
1018
|
);
|
|
1090
1019
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
1091
|
-
|
|
1092
|
-
type:
|
|
1093
|
-
requestId:
|
|
1020
|
+
z13.object({
|
|
1021
|
+
type: z13.literal(ActionType.REJECT_CORRECTION),
|
|
1022
|
+
requestId: z13.string(),
|
|
1094
1023
|
// TODO move into 'content' property
|
|
1095
1024
|
content: ReasonContent
|
|
1096
1025
|
}).shape
|
|
1097
1026
|
);
|
|
1098
1027
|
var ReadAction = ActionBase.extend(
|
|
1099
|
-
|
|
1100
|
-
type:
|
|
1028
|
+
z13.object({
|
|
1029
|
+
type: z13.literal(ActionType.READ)
|
|
1101
1030
|
}).shape
|
|
1102
1031
|
);
|
|
1103
1032
|
var CustomAction = ActionBase.merge(
|
|
1104
|
-
|
|
1105
|
-
type:
|
|
1106
|
-
customActionType:
|
|
1033
|
+
z13.object({
|
|
1034
|
+
type: z13.literal(ActionType.CUSTOM),
|
|
1035
|
+
customActionType: z13.string()
|
|
1107
1036
|
})
|
|
1108
1037
|
);
|
|
1109
|
-
var ActionDocument =
|
|
1038
|
+
var ActionDocument = z13.discriminatedUnion("type", [
|
|
1110
1039
|
CreatedAction.meta({ id: "CreatedAction" }),
|
|
1111
1040
|
RejectAction.meta({ id: "RejectAction" }),
|
|
1112
1041
|
DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
|
|
@@ -1133,12 +1062,64 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
|
1133
1062
|
declaration: true,
|
|
1134
1063
|
annotation: true
|
|
1135
1064
|
}).extend(
|
|
1136
|
-
|
|
1137
|
-
type:
|
|
1138
|
-
status:
|
|
1065
|
+
z13.object({
|
|
1066
|
+
type: z13.enum(ConfirmableActions),
|
|
1067
|
+
status: z13.literal(ActionStatus.Rejected)
|
|
1139
1068
|
}).shape
|
|
1140
1069
|
);
|
|
1141
|
-
var Action =
|
|
1070
|
+
var Action = z13.union([ActionDocument, AsyncRejectActionDocument]);
|
|
1071
|
+
|
|
1072
|
+
// ../commons/src/events/Flag.ts
|
|
1073
|
+
var z14 = __toESM(require("zod/v4"));
|
|
1074
|
+
var InherentFlags = {
|
|
1075
|
+
INCOMPLETE: "incomplete",
|
|
1076
|
+
REJECTED: "rejected",
|
|
1077
|
+
CORRECTION_REQUESTED: "correction-requested",
|
|
1078
|
+
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
1079
|
+
/**
|
|
1080
|
+
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
1081
|
+
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
1082
|
+
*
|
|
1083
|
+
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
1084
|
+
*/
|
|
1085
|
+
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
1086
|
+
};
|
|
1087
|
+
var ActionFlag = z14.string().regex(
|
|
1088
|
+
new RegExp(
|
|
1089
|
+
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
1090
|
+
ActionStatus
|
|
1091
|
+
).join("|").toLowerCase()})$`
|
|
1092
|
+
),
|
|
1093
|
+
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
1094
|
+
);
|
|
1095
|
+
var CustomFlag = z14.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
1096
|
+
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
1097
|
+
InherentFlags
|
|
1098
|
+
).join(", ")}`
|
|
1099
|
+
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
1100
|
+
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
1101
|
+
}).describe("Custom flag identifier defined by the country config.");
|
|
1102
|
+
var Flag = ActionFlag.or(z14.enum(InherentFlags)).or(CustomFlag);
|
|
1103
|
+
var FlagConfig = z14.object({
|
|
1104
|
+
id: CustomFlag,
|
|
1105
|
+
requiresAction: z14.boolean().describe(
|
|
1106
|
+
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1107
|
+
),
|
|
1108
|
+
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1109
|
+
}).meta({
|
|
1110
|
+
id: "FlagConfig",
|
|
1111
|
+
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
1112
|
+
});
|
|
1113
|
+
var ActionFlagConfig = z14.object({
|
|
1114
|
+
id: Flag,
|
|
1115
|
+
operation: z14.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
1116
|
+
conditional: Conditional.optional().describe(
|
|
1117
|
+
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1118
|
+
)
|
|
1119
|
+
}).meta({
|
|
1120
|
+
id: "ActionFlagConfig",
|
|
1121
|
+
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
1122
|
+
});
|
|
1142
1123
|
|
|
1143
1124
|
// ../commons/src/events/EventMetadata.ts
|
|
1144
1125
|
var EventStatus = z15.enum([
|
|
@@ -1299,6 +1280,13 @@ var Range = import_v4.z.object({
|
|
|
1299
1280
|
}).meta({
|
|
1300
1281
|
id: "Range"
|
|
1301
1282
|
});
|
|
1283
|
+
var ContainsFlags = import_v4.z.object({
|
|
1284
|
+
anyOf: import_v4.z.array(Flag).optional(),
|
|
1285
|
+
noneOf: import_v4.z.array(Flag).optional(),
|
|
1286
|
+
allOf: import_v4.z.array(Flag).optional()
|
|
1287
|
+
}).meta({
|
|
1288
|
+
id: "ContainsFlags"
|
|
1289
|
+
});
|
|
1302
1290
|
var Within = import_v4.z.object({ type: import_v4.z.literal("within"), location: import_v4.z.string() }).meta({
|
|
1303
1291
|
id: "Within"
|
|
1304
1292
|
});
|