@opencrvs/toolkit 2.1.0-rc.f29a266 → 2.1.0-rc.f5ea803
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/build.sh +9 -1
- package/create-countryconfig/index.js +176 -2
- package/dist/application-config/index.js +211 -201
- package/dist/authentication/index.d.ts +67 -0
- package/dist/authentication/index.d.ts.map +1 -0
- package/dist/authentication/index.js +750 -0
- package/dist/cli.js +1587 -69
- package/dist/commons/api/router.d.ts +4 -4
- package/dist/commons/conditionals/conditionals.d.ts +3 -3
- package/dist/commons/events/AdvancedSearchConfig.d.ts +6 -0
- package/dist/commons/events/EventDocument.d.ts +468 -0
- package/dist/commons/events/EventMetadata.d.ts +1 -11
- package/dist/commons/events/EventStatus.d.ts +19 -0
- package/dist/commons/events/FieldConfig.d.ts +5 -0
- package/dist/commons/events/FieldTypeMapping.d.ts +15 -15
- package/dist/commons/events/locations.d.ts +2 -2
- package/dist/commons/notification/UserNotifications.d.ts +0 -13
- package/dist/commons/notification/dispatch.d.ts +10 -0
- package/dist/commons/notification/index.d.ts +1 -0
- package/dist/conditionals/index.js +74 -57
- package/dist/csv.d.ts +25 -0
- package/dist/csv.d.ts.map +1 -0
- package/dist/csv.js +120 -0
- package/dist/events/index.js +760 -743
- package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +3 -0
- package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-recovery-link-notifications.js +511 -0
- package/dist/migrations/v2.1/add-translations.d.ts +9 -0
- package/dist/migrations/v2.1/add-translations.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-translations.js +213 -0
- package/dist/migrations/v2.1/enable-telemetry.d.ts +3 -0
- package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -0
- package/dist/migrations/v2.1/enable-telemetry.js +438 -0
- package/dist/migrations/v2.1/index.d.ts.map +1 -1
- package/dist/migrations/v2.1/index.js +1058 -0
- package/dist/notification/index.js +855 -815
- package/dist/scopes/index.d.ts +74 -6
- package/dist/scopes/index.js +74 -57
- package/dist/telemetry/index.d.ts +45 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +39 -0
- package/dist/translations/check.d.ts +19 -0
- package/dist/translations/check.d.ts.map +1 -0
- package/dist/translations/check.js +127 -0
- package/dist/verify/endpoints.d.ts +2 -0
- package/dist/verify/endpoints.d.ts.map +1 -0
- package/dist/verify/endpoints.js +345 -0
- package/opencrvs-toolkit-2.1.0-rc.f5ea803.tgz +0 -0
- package/package.json +8 -3
- package/tsconfig.build.json +11 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- package/opencrvs-toolkit-2.1.0-rc.f29a266.tgz +0 -0
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -42,7 +42,7 @@ __export(application_config_exports, {
|
|
|
42
42
|
module.exports = __toCommonJS(application_config_exports);
|
|
43
43
|
|
|
44
44
|
// ../commons/src/application-config.ts
|
|
45
|
-
var
|
|
45
|
+
var z21 = __toESM(require("zod/v4"));
|
|
46
46
|
|
|
47
47
|
// ../commons/src/events/FieldConfig.ts
|
|
48
48
|
var import_v43 = __toESM(require("zod/v4"));
|
|
@@ -497,10 +497,10 @@ var SerializedUserField = z9.object({
|
|
|
497
497
|
var import_v4 = require("zod/v4");
|
|
498
498
|
|
|
499
499
|
// ../commons/src/events/EventMetadata.ts
|
|
500
|
-
var
|
|
500
|
+
var z16 = __toESM(require("zod/v4"));
|
|
501
501
|
|
|
502
502
|
// ../commons/src/events/ActionDocument.ts
|
|
503
|
-
var
|
|
503
|
+
var z15 = __toESM(require("zod/v4"));
|
|
504
504
|
|
|
505
505
|
// ../commons/src/events/ActionType.ts
|
|
506
506
|
var z10 = __toESM(require("zod/v4"));
|
|
@@ -612,10 +612,10 @@ var META_ACTIONS = [
|
|
|
612
612
|
|
|
613
613
|
// ../commons/src/authentication.ts
|
|
614
614
|
var import_jwt_decode = __toESM(require("jwt-decode"));
|
|
615
|
-
var
|
|
615
|
+
var z14 = __toESM(require("zod/v4"));
|
|
616
616
|
|
|
617
617
|
// ../commons/src/scopes.ts
|
|
618
|
-
var
|
|
618
|
+
var z13 = __toESM(require("zod/v4"));
|
|
619
619
|
var qs = __toESM(require("qs"));
|
|
620
620
|
|
|
621
621
|
// ../commons/src/events/ActionStatus.ts
|
|
@@ -688,12 +688,22 @@ var ActionFlagConfig = z11.object({
|
|
|
688
688
|
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
689
689
|
});
|
|
690
690
|
|
|
691
|
+
// ../commons/src/events/EventStatus.ts
|
|
692
|
+
var z12 = __toESM(require("zod/v4"));
|
|
693
|
+
var EventStatus = z12.enum([
|
|
694
|
+
"CREATED",
|
|
695
|
+
"NOTIFIED",
|
|
696
|
+
"DECLARED",
|
|
697
|
+
"REGISTERED",
|
|
698
|
+
"ARCHIVED"
|
|
699
|
+
]);
|
|
700
|
+
|
|
691
701
|
// ../commons/src/scopes.ts
|
|
692
|
-
var JurisdictionFilter =
|
|
702
|
+
var JurisdictionFilter = z13.enum(["administrativeArea", "location", "all"]).describe(
|
|
693
703
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
694
704
|
);
|
|
695
|
-
var UserFilter =
|
|
696
|
-
var RecordScopeTypeV2 =
|
|
705
|
+
var UserFilter = z13.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
706
|
+
var RecordScopeTypeV2 = z13.enum([
|
|
697
707
|
"record.search",
|
|
698
708
|
"record.create",
|
|
699
709
|
"record.read",
|
|
@@ -711,7 +721,7 @@ var RecordScopeTypeV2 = z12.enum([
|
|
|
711
721
|
"record.unassign-others",
|
|
712
722
|
"record.custom-action"
|
|
713
723
|
]);
|
|
714
|
-
var PlainScopeType =
|
|
724
|
+
var PlainScopeType = z13.enum([
|
|
715
725
|
// Misc. system scopes
|
|
716
726
|
"bypassratelimit",
|
|
717
727
|
"record.reindex",
|
|
@@ -736,15 +746,21 @@ var PlainScopeType = z12.enum([
|
|
|
736
746
|
"record.confirm-registration",
|
|
737
747
|
"record.reject-registration"
|
|
738
748
|
]);
|
|
739
|
-
var scopeByEvent =
|
|
749
|
+
var scopeByEvent = z13.preprocess(
|
|
740
750
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
741
|
-
|
|
751
|
+
z13.array(z13.string()).optional()
|
|
742
752
|
).describe("Event type, e.g. birth, death");
|
|
743
|
-
var
|
|
753
|
+
var scopeByStatus = z13.preprocess(
|
|
754
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
755
|
+
z13.array(EventStatus).optional()
|
|
756
|
+
).describe(
|
|
757
|
+
"Restricts the scope to records currently in one of these statuses."
|
|
758
|
+
);
|
|
759
|
+
var userRole = z13.preprocess(
|
|
744
760
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
745
|
-
|
|
761
|
+
z13.array(z13.string()).optional()
|
|
746
762
|
).describe("User role, e.g. admin, field agent");
|
|
747
|
-
var scopeOptionsPlaceEvent =
|
|
763
|
+
var scopeOptionsPlaceEvent = z13.object({
|
|
748
764
|
event: scopeByEvent,
|
|
749
765
|
placeOfEvent: JurisdictionFilter.optional()
|
|
750
766
|
}).describe("Options applicable to all record scopes.");
|
|
@@ -752,7 +768,8 @@ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
|
752
768
|
notifiedIn: JurisdictionFilter.optional(),
|
|
753
769
|
notifiedBy: UserFilter.optional(),
|
|
754
770
|
declaredIn: JurisdictionFilter.optional(),
|
|
755
|
-
declaredBy: UserFilter.optional()
|
|
771
|
+
declaredBy: UserFilter.optional(),
|
|
772
|
+
status: scopeByStatus
|
|
756
773
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
757
774
|
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
758
775
|
registeredIn: JurisdictionFilter.optional(),
|
|
@@ -762,31 +779,31 @@ var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
|
762
779
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
763
780
|
);
|
|
764
781
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
765
|
-
customActionTypes:
|
|
782
|
+
customActionTypes: z13.preprocess(
|
|
766
783
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
767
|
-
|
|
784
|
+
z13.array(z13.string()).optional()
|
|
768
785
|
).describe("Allowed custom action types")
|
|
769
786
|
});
|
|
770
|
-
var AccessLevelOptions =
|
|
787
|
+
var AccessLevelOptions = z13.object({
|
|
771
788
|
accessLevel: JurisdictionFilter.optional()
|
|
772
789
|
});
|
|
773
790
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
774
791
|
role: userRole.optional()
|
|
775
792
|
});
|
|
776
|
-
var WorkqueueOrDashboardOptions =
|
|
777
|
-
ids:
|
|
793
|
+
var WorkqueueOrDashboardOptions = z13.object({
|
|
794
|
+
ids: z13.preprocess(
|
|
778
795
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
779
|
-
|
|
796
|
+
z13.array(z13.string())
|
|
780
797
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
781
798
|
});
|
|
782
|
-
var AllScopeOptions =
|
|
799
|
+
var AllScopeOptions = z13.object({
|
|
783
800
|
...AllRecordScopeOptions.shape,
|
|
784
801
|
...AccessLevelOptions.shape,
|
|
785
802
|
...AllUserScopeOptions.shape,
|
|
786
803
|
...WorkqueueOrDashboardOptions.shape
|
|
787
804
|
});
|
|
788
805
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
789
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
806
|
+
var ResolvedScopeOptionsPlaceEvent = z13.object({
|
|
790
807
|
event: scopeByEvent,
|
|
791
808
|
placeOfEvent: UUID.nullish()
|
|
792
809
|
}).describe(
|
|
@@ -794,15 +811,15 @@ var ResolvedScopeOptionsPlaceEvent = z12.object({
|
|
|
794
811
|
);
|
|
795
812
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
796
813
|
notifiedIn: UUID.nullish(),
|
|
797
|
-
notifiedBy:
|
|
814
|
+
notifiedBy: z13.string().optional(),
|
|
798
815
|
declaredIn: UUID.nullish(),
|
|
799
|
-
declaredBy:
|
|
816
|
+
declaredBy: z13.string().optional()
|
|
800
817
|
}).describe(
|
|
801
818
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
802
819
|
);
|
|
803
820
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
804
821
|
registeredIn: UUID.nullish(),
|
|
805
|
-
registeredBy:
|
|
822
|
+
registeredBy: z13.string().optional(),
|
|
806
823
|
flags: ContainsFlags.optional()
|
|
807
824
|
}).describe(
|
|
808
825
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
@@ -817,7 +834,6 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
817
834
|
"record.reject",
|
|
818
835
|
"record.archive",
|
|
819
836
|
"record.unarchive",
|
|
820
|
-
"record.review-duplicates",
|
|
821
837
|
"record.register"
|
|
822
838
|
]);
|
|
823
839
|
var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
@@ -825,41 +841,42 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
825
841
|
"record.read",
|
|
826
842
|
"record.request-correction",
|
|
827
843
|
"record.correct",
|
|
828
|
-
"record.unassign-others"
|
|
844
|
+
"record.unassign-others",
|
|
845
|
+
"record.review-duplicates"
|
|
829
846
|
]);
|
|
830
847
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
831
|
-
templates:
|
|
848
|
+
templates: z13.preprocess(
|
|
832
849
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
833
|
-
|
|
850
|
+
z13.array(z13.string()).optional()
|
|
834
851
|
).describe(
|
|
835
852
|
"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."
|
|
836
853
|
)
|
|
837
854
|
});
|
|
838
|
-
var RecordScopeV2 =
|
|
839
|
-
|
|
855
|
+
var RecordScopeV2 = z13.discriminatedUnion("type", [
|
|
856
|
+
z13.object({
|
|
840
857
|
type: ScopesWithPlaceEventOptions,
|
|
841
858
|
options: scopeOptionsPlaceEvent.optional()
|
|
842
859
|
}),
|
|
843
|
-
|
|
860
|
+
z13.object({
|
|
844
861
|
type: ScopesWithDeclaredOptions,
|
|
845
862
|
options: scopeOptionsDeclaredOrNotified.optional()
|
|
846
863
|
}),
|
|
847
|
-
|
|
864
|
+
z13.object({
|
|
848
865
|
type: ScopesWithFullOptions,
|
|
849
866
|
options: AllRecordScopeOptions.optional()
|
|
850
867
|
}),
|
|
851
|
-
|
|
852
|
-
type:
|
|
868
|
+
z13.object({
|
|
869
|
+
type: z13.literal("record.custom-action"),
|
|
853
870
|
options: CustomActionScopeOptions.optional()
|
|
854
871
|
}),
|
|
855
|
-
|
|
856
|
-
type:
|
|
872
|
+
z13.object({
|
|
873
|
+
type: z13.literal("record.print-certified-copies"),
|
|
857
874
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
858
875
|
})
|
|
859
876
|
]).describe(
|
|
860
877
|
"Scopes used to check user's permission to perform actions on a record."
|
|
861
878
|
);
|
|
862
|
-
var SystemScopeType =
|
|
879
|
+
var SystemScopeType = z13.enum([
|
|
863
880
|
"organisation.read-locations",
|
|
864
881
|
"user.read",
|
|
865
882
|
"user.create",
|
|
@@ -873,61 +890,61 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
873
890
|
"user.search"
|
|
874
891
|
]);
|
|
875
892
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
876
|
-
var UserScopeV2 =
|
|
877
|
-
|
|
893
|
+
var UserScopeV2 = z13.discriminatedUnion("type", [
|
|
894
|
+
z13.object({
|
|
878
895
|
type: ScopesWithRoleOption,
|
|
879
896
|
options: AllUserScopeOptions.optional()
|
|
880
897
|
}),
|
|
881
|
-
|
|
898
|
+
z13.object({
|
|
882
899
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
883
900
|
options: AccessLevelOptions.optional()
|
|
884
901
|
})
|
|
885
902
|
]);
|
|
886
|
-
var ResolvedRecordScopeV2 =
|
|
887
|
-
|
|
903
|
+
var ResolvedRecordScopeV2 = z13.discriminatedUnion("type", [
|
|
904
|
+
z13.object({
|
|
888
905
|
type: ScopesWithPlaceEventOptions,
|
|
889
906
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
890
907
|
}),
|
|
891
|
-
|
|
908
|
+
z13.object({
|
|
892
909
|
type: ScopesWithDeclaredOptions,
|
|
893
910
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
894
911
|
}),
|
|
895
|
-
|
|
912
|
+
z13.object({
|
|
896
913
|
type: ScopesWithFullOptions,
|
|
897
914
|
options: ResolvedScopeOptionsFull.optional()
|
|
898
915
|
}),
|
|
899
|
-
|
|
900
|
-
type:
|
|
916
|
+
z13.object({
|
|
917
|
+
type: z13.literal("record.print-certified-copies"),
|
|
901
918
|
options: ResolvedScopeOptionsFull.extend({
|
|
902
|
-
templates:
|
|
919
|
+
templates: z13.array(z13.string()).optional()
|
|
903
920
|
}).optional()
|
|
904
921
|
})
|
|
905
922
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
906
|
-
var Scope =
|
|
907
|
-
|
|
923
|
+
var Scope = z13.discriminatedUnion("type", [
|
|
924
|
+
z13.object({ type: PlainScopeType }),
|
|
908
925
|
...RecordScopeV2.options,
|
|
909
926
|
...UserScopeV2.options,
|
|
910
|
-
|
|
911
|
-
type:
|
|
927
|
+
z13.object({
|
|
928
|
+
type: z13.literal("organisation.read-locations"),
|
|
912
929
|
options: AccessLevelOptions.optional()
|
|
913
930
|
}),
|
|
914
|
-
|
|
915
|
-
type:
|
|
931
|
+
z13.object({
|
|
932
|
+
type: z13.literal("workqueue"),
|
|
916
933
|
options: WorkqueueOrDashboardOptions
|
|
917
934
|
}),
|
|
918
|
-
|
|
919
|
-
type:
|
|
935
|
+
z13.object({
|
|
936
|
+
type: z13.literal("dashboard.view"),
|
|
920
937
|
options: WorkqueueOrDashboardOptions
|
|
921
938
|
})
|
|
922
939
|
]);
|
|
923
|
-
var ScopeType =
|
|
940
|
+
var ScopeType = z13.enum([
|
|
924
941
|
...SystemScopeType.options,
|
|
925
942
|
...RecordScopeTypeV2.options,
|
|
926
943
|
...PlainScopeType.options,
|
|
927
944
|
"workqueue",
|
|
928
945
|
"dashboard.view"
|
|
929
946
|
]);
|
|
930
|
-
var EncodedScope =
|
|
947
|
+
var EncodedScope = z13.string().brand("EncodedScope");
|
|
931
948
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
932
949
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
933
950
|
accessLevel: JurisdictionFilter.enum.all,
|
|
@@ -937,25 +954,25 @@ var DEFAULT_SCOPE_OPTIONS = {
|
|
|
937
954
|
};
|
|
938
955
|
|
|
939
956
|
// ../commons/src/authentication.ts
|
|
940
|
-
var TokenUserType =
|
|
941
|
-
var TokenWithBearer =
|
|
957
|
+
var TokenUserType = z14.enum(["user", "system"]);
|
|
958
|
+
var TokenWithBearer = z14.string().regex(/^Bearer\s/);
|
|
942
959
|
|
|
943
960
|
// ../commons/src/events/ActionDocument.ts
|
|
944
|
-
var ActionUpdate =
|
|
961
|
+
var ActionUpdate = z15.record(z15.string(), FieldUpdateValue).describe(
|
|
945
962
|
"Record of field-level changes made by an action. Supports partial updates and nullable values."
|
|
946
963
|
);
|
|
947
|
-
var EventState =
|
|
964
|
+
var EventState = z15.record(z15.string(), FieldValue).describe(
|
|
948
965
|
"Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
|
|
949
966
|
);
|
|
950
|
-
var ActionBase =
|
|
967
|
+
var ActionBase = z15.object({
|
|
951
968
|
id: UUID.describe("Unique identifier of the action."),
|
|
952
|
-
transactionId:
|
|
969
|
+
transactionId: z15.string().describe("Unique identifier of the transaction."),
|
|
953
970
|
createdByUserType: TokenUserType.describe(
|
|
954
971
|
"Indicates whether the action was created by a human-user or by a system-user."
|
|
955
972
|
),
|
|
956
|
-
createdAt:
|
|
957
|
-
createdBy:
|
|
958
|
-
createdByRole:
|
|
973
|
+
createdAt: z15.string().datetime().describe("Timestamp indicating when the action was created."),
|
|
974
|
+
createdBy: z15.string().describe("Identifier of the user who created the action."),
|
|
975
|
+
createdByRole: z15.string().optional().describe("Role of the user who created the action."),
|
|
959
976
|
createdBySignature: DocumentPath.nullish().describe(
|
|
960
977
|
"Reference to the signature of the user who created the action."
|
|
961
978
|
),
|
|
@@ -967,7 +984,7 @@ var ActionBase = z14.object({
|
|
|
967
984
|
"Declaration data defined by the ActionConfig. Supports partial updates."
|
|
968
985
|
),
|
|
969
986
|
annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
|
|
970
|
-
status:
|
|
987
|
+
status: z15.enum([
|
|
971
988
|
ActionStatus.Requested,
|
|
972
989
|
ActionStatus.Accepted,
|
|
973
990
|
ActionStatus.Rejected
|
|
@@ -979,70 +996,70 @@ var ActionBase = z14.object({
|
|
|
979
996
|
)
|
|
980
997
|
});
|
|
981
998
|
var AssignedAction = ActionBase.extend(
|
|
982
|
-
|
|
983
|
-
type:
|
|
984
|
-
assignedTo:
|
|
999
|
+
z15.object({
|
|
1000
|
+
type: z15.literal(ActionType.ASSIGN),
|
|
1001
|
+
assignedTo: z15.string().describe("Identifier of the user to whom the action is assigned.")
|
|
985
1002
|
// TODO move into 'content' property
|
|
986
1003
|
}).shape
|
|
987
1004
|
);
|
|
988
1005
|
var UnassignedAction = ActionBase.extend(
|
|
989
|
-
|
|
990
|
-
type:
|
|
1006
|
+
z15.object({
|
|
1007
|
+
type: z15.literal(ActionType.UNASSIGN)
|
|
991
1008
|
}).shape
|
|
992
1009
|
);
|
|
993
1010
|
var RegisterAction = ActionBase.extend(
|
|
994
|
-
|
|
995
|
-
type:
|
|
996
|
-
registrationNumber:
|
|
1011
|
+
z15.object({
|
|
1012
|
+
type: z15.literal(ActionType.REGISTER),
|
|
1013
|
+
registrationNumber: z15.string().optional().describe(
|
|
997
1014
|
"Registration number of the event. Always present for accepted registrations."
|
|
998
1015
|
)
|
|
999
1016
|
// TODO move into 'content' property
|
|
1000
1017
|
}).shape
|
|
1001
1018
|
);
|
|
1002
1019
|
var DeclareAction = ActionBase.extend(
|
|
1003
|
-
|
|
1004
|
-
type:
|
|
1020
|
+
z15.object({
|
|
1021
|
+
type: z15.literal(ActionType.DECLARE)
|
|
1005
1022
|
}).shape
|
|
1006
1023
|
);
|
|
1007
|
-
var ReasonContent =
|
|
1008
|
-
reason:
|
|
1024
|
+
var ReasonContent = z15.object({
|
|
1025
|
+
reason: z15.string().min(1, { error: "Message cannot be empty" }).describe(
|
|
1009
1026
|
"Message describing the reason for rejecting or archiving the event."
|
|
1010
1027
|
)
|
|
1011
1028
|
});
|
|
1012
1029
|
var RejectAction = ActionBase.extend(
|
|
1013
|
-
|
|
1014
|
-
type:
|
|
1030
|
+
z15.object({
|
|
1031
|
+
type: z15.literal(ActionType.REJECT),
|
|
1015
1032
|
content: ReasonContent
|
|
1016
1033
|
}).shape
|
|
1017
1034
|
);
|
|
1018
|
-
var PotentialDuplicate =
|
|
1035
|
+
var PotentialDuplicate = z15.object({
|
|
1019
1036
|
id: UUID,
|
|
1020
|
-
trackingId:
|
|
1037
|
+
trackingId: z15.string()
|
|
1021
1038
|
});
|
|
1022
1039
|
var DuplicateDetectedAction = ActionBase.extend(
|
|
1023
|
-
|
|
1024
|
-
type:
|
|
1025
|
-
content:
|
|
1026
|
-
duplicates:
|
|
1040
|
+
z15.object({
|
|
1041
|
+
type: z15.literal(ActionType.DUPLICATE_DETECTED),
|
|
1042
|
+
content: z15.object({
|
|
1043
|
+
duplicates: z15.array(PotentialDuplicate)
|
|
1027
1044
|
})
|
|
1028
1045
|
}).shape
|
|
1029
1046
|
);
|
|
1030
1047
|
var MarkNotDuplicateAction = ActionBase.extend(
|
|
1031
|
-
|
|
1032
|
-
type:
|
|
1048
|
+
z15.object({
|
|
1049
|
+
type: z15.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
1033
1050
|
}).shape
|
|
1034
1051
|
);
|
|
1035
1052
|
var MarkAsDuplicateAction = ActionBase.extend(
|
|
1036
|
-
|
|
1037
|
-
type:
|
|
1038
|
-
content:
|
|
1053
|
+
z15.object({
|
|
1054
|
+
type: z15.literal(ActionType.MARK_AS_DUPLICATE),
|
|
1055
|
+
content: z15.object({
|
|
1039
1056
|
duplicateOf: UUID
|
|
1040
1057
|
}).optional()
|
|
1041
1058
|
}).shape
|
|
1042
1059
|
);
|
|
1043
1060
|
var ArchiveAction = ActionBase.extend(
|
|
1044
|
-
|
|
1045
|
-
type:
|
|
1061
|
+
z15.object({
|
|
1062
|
+
type: z15.literal(ActionType.ARCHIVE),
|
|
1046
1063
|
/**
|
|
1047
1064
|
* Archiving does not collect a reason on its own. Only the
|
|
1048
1065
|
* "mark as duplicate" flow archives with a reason attached.
|
|
@@ -1051,71 +1068,71 @@ var ArchiveAction = ActionBase.extend(
|
|
|
1051
1068
|
}).shape
|
|
1052
1069
|
);
|
|
1053
1070
|
var UnarchiveAction = ActionBase.extend(
|
|
1054
|
-
|
|
1055
|
-
type:
|
|
1071
|
+
z15.object({
|
|
1072
|
+
type: z15.literal(ActionType.UNARCHIVE)
|
|
1056
1073
|
}).shape
|
|
1057
1074
|
);
|
|
1058
1075
|
var CreatedAction = ActionBase.extend(
|
|
1059
|
-
|
|
1060
|
-
type:
|
|
1076
|
+
z15.object({
|
|
1077
|
+
type: z15.literal(ActionType.CREATE)
|
|
1061
1078
|
}).shape
|
|
1062
1079
|
);
|
|
1063
1080
|
var NotifiedAction = ActionBase.extend(
|
|
1064
|
-
|
|
1065
|
-
type:
|
|
1081
|
+
z15.object({
|
|
1082
|
+
type: z15.literal(ActionType.NOTIFY)
|
|
1066
1083
|
}).shape
|
|
1067
1084
|
);
|
|
1068
1085
|
var EditAction = ActionBase.extend(
|
|
1069
|
-
|
|
1070
|
-
type:
|
|
1086
|
+
z15.object({
|
|
1087
|
+
type: z15.literal(ActionType.EDIT),
|
|
1071
1088
|
/** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
|
|
1072
|
-
content:
|
|
1073
|
-
comment:
|
|
1089
|
+
content: z15.object({
|
|
1090
|
+
comment: z15.string().describe("Comment for the edit action.").optional()
|
|
1074
1091
|
}).optional()
|
|
1075
1092
|
}).shape
|
|
1076
1093
|
);
|
|
1077
|
-
var PrintContent =
|
|
1078
|
-
templateId:
|
|
1094
|
+
var PrintContent = z15.object({
|
|
1095
|
+
templateId: z15.string().optional()
|
|
1079
1096
|
});
|
|
1080
1097
|
var PrintCertificateAction = ActionBase.extend(
|
|
1081
|
-
|
|
1082
|
-
type:
|
|
1098
|
+
z15.object({
|
|
1099
|
+
type: z15.literal(ActionType.PRINT_CERTIFICATE),
|
|
1083
1100
|
content: PrintContent.optional().nullable()
|
|
1084
1101
|
}).shape
|
|
1085
1102
|
);
|
|
1086
1103
|
var RequestedCorrectionAction = ActionBase.extend(
|
|
1087
|
-
|
|
1088
|
-
type:
|
|
1104
|
+
z15.object({
|
|
1105
|
+
type: z15.literal(ActionType.REQUEST_CORRECTION)
|
|
1089
1106
|
}).shape
|
|
1090
1107
|
);
|
|
1091
1108
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
1092
|
-
|
|
1093
|
-
type:
|
|
1094
|
-
requestId:
|
|
1109
|
+
z15.object({
|
|
1110
|
+
type: z15.literal(ActionType.APPROVE_CORRECTION),
|
|
1111
|
+
requestId: z15.string(),
|
|
1095
1112
|
// TODO move into 'content' property
|
|
1096
|
-
content:
|
|
1113
|
+
content: z15.object({ immediateCorrection: z15.boolean().optional() }).optional()
|
|
1097
1114
|
}).shape
|
|
1098
1115
|
);
|
|
1099
1116
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
1100
|
-
|
|
1101
|
-
type:
|
|
1102
|
-
requestId:
|
|
1117
|
+
z15.object({
|
|
1118
|
+
type: z15.literal(ActionType.REJECT_CORRECTION),
|
|
1119
|
+
requestId: z15.string(),
|
|
1103
1120
|
// TODO move into 'content' property
|
|
1104
1121
|
content: ReasonContent
|
|
1105
1122
|
}).shape
|
|
1106
1123
|
);
|
|
1107
1124
|
var ReadAction = ActionBase.extend(
|
|
1108
|
-
|
|
1109
|
-
type:
|
|
1125
|
+
z15.object({
|
|
1126
|
+
type: z15.literal(ActionType.READ)
|
|
1110
1127
|
}).shape
|
|
1111
1128
|
);
|
|
1112
1129
|
var CustomAction = ActionBase.merge(
|
|
1113
|
-
|
|
1114
|
-
type:
|
|
1115
|
-
customActionType:
|
|
1130
|
+
z15.object({
|
|
1131
|
+
type: z15.literal(ActionType.CUSTOM),
|
|
1132
|
+
customActionType: z15.string()
|
|
1116
1133
|
})
|
|
1117
1134
|
);
|
|
1118
|
-
var ActionDocument =
|
|
1135
|
+
var ActionDocument = z15.discriminatedUnion("type", [
|
|
1119
1136
|
CreatedAction.meta({ id: "CreatedAction" }),
|
|
1120
1137
|
RejectAction.meta({ id: "RejectAction" }),
|
|
1121
1138
|
DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
|
|
@@ -1142,57 +1159,50 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
|
1142
1159
|
declaration: true,
|
|
1143
1160
|
annotation: true
|
|
1144
1161
|
}).extend(
|
|
1145
|
-
|
|
1146
|
-
type:
|
|
1147
|
-
status:
|
|
1162
|
+
z15.object({
|
|
1163
|
+
type: z15.enum(ConfirmableActions),
|
|
1164
|
+
status: z15.literal(ActionStatus.Rejected)
|
|
1148
1165
|
}).shape
|
|
1149
1166
|
);
|
|
1150
|
-
var Action =
|
|
1167
|
+
var Action = z15.union([ActionDocument, AsyncRejectActionDocument]);
|
|
1151
1168
|
|
|
1152
1169
|
// ../commons/src/events/EventMetadata.ts
|
|
1153
|
-
var
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
"
|
|
1157
|
-
"
|
|
1158
|
-
"ARCHIVED"
|
|
1159
|
-
]);
|
|
1160
|
-
var ZodDate = z15.iso.date();
|
|
1161
|
-
var ZodDateTime = z15.string().datetime();
|
|
1162
|
-
var ActionCreationMetadata = z15.object({
|
|
1163
|
-
createdAt: z15.iso.datetime().describe("The timestamp when the action request was created."),
|
|
1164
|
-
createdBy: z15.string().describe("ID of the user who created the action request."),
|
|
1170
|
+
var ZodDate = z16.iso.date();
|
|
1171
|
+
var ZodDateTime = z16.string().datetime();
|
|
1172
|
+
var ActionCreationMetadata = z16.object({
|
|
1173
|
+
createdAt: z16.iso.datetime().describe("The timestamp when the action request was created."),
|
|
1174
|
+
createdBy: z16.string().describe("ID of the user who created the action request."),
|
|
1165
1175
|
// @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
|
|
1166
1176
|
createdAtLocation: UUID.nullish().describe(
|
|
1167
1177
|
"Location of the user who created the action request."
|
|
1168
1178
|
),
|
|
1169
|
-
createdByUserType:
|
|
1170
|
-
acceptedAt:
|
|
1171
|
-
createdByRole:
|
|
1179
|
+
createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1180
|
+
acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
|
|
1181
|
+
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1172
1182
|
});
|
|
1173
1183
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1174
|
-
registrationNumber:
|
|
1184
|
+
registrationNumber: z16.string().describe(
|
|
1175
1185
|
"Registration number of the event. Always present for accepted registrations."
|
|
1176
1186
|
)
|
|
1177
1187
|
});
|
|
1178
|
-
var LegalStatuses =
|
|
1188
|
+
var LegalStatuses = z16.object({
|
|
1179
1189
|
[EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
|
|
1180
1190
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
|
1181
1191
|
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
|
1182
1192
|
});
|
|
1183
|
-
var EventMetadata =
|
|
1193
|
+
var EventMetadata = z16.object({
|
|
1184
1194
|
id: UUID,
|
|
1185
|
-
type:
|
|
1195
|
+
type: z16.string().describe("The type of event, such as birth, death, or marriage."),
|
|
1186
1196
|
status: EventStatus,
|
|
1187
1197
|
legalStatuses: LegalStatuses.describe(
|
|
1188
1198
|
"Metadata related to the legal registration of the event, such as who registered it and when."
|
|
1189
1199
|
),
|
|
1190
|
-
createdAt:
|
|
1200
|
+
createdAt: z16.iso.datetime().describe("The timestamp when the event was first created and saved."),
|
|
1191
1201
|
dateOfEvent: ZodDate.nullish(),
|
|
1192
1202
|
placeOfEvent: UUID.nullish(),
|
|
1193
|
-
createdBy:
|
|
1194
|
-
createdByUserType:
|
|
1195
|
-
updatedByUserRole:
|
|
1203
|
+
createdBy: z16.string().describe("ID of the user who created the event."),
|
|
1204
|
+
createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1205
|
+
updatedByUserRole: z16.string().nullish().describe("Role of the user who last changed the status."),
|
|
1196
1206
|
// @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
|
|
1197
1207
|
createdAtLocation: UUID.nullish().describe(
|
|
1198
1208
|
"Location of the user who created the event."
|
|
@@ -1200,18 +1210,18 @@ var EventMetadata = z15.object({
|
|
|
1200
1210
|
updatedAtLocation: UUID.nullish().describe(
|
|
1201
1211
|
"Location of the user who last changed the status."
|
|
1202
1212
|
),
|
|
1203
|
-
updatedAt:
|
|
1213
|
+
updatedAt: z16.iso.datetime().describe(
|
|
1204
1214
|
"Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
|
|
1205
1215
|
),
|
|
1206
|
-
assignedTo:
|
|
1207
|
-
updatedBy:
|
|
1208
|
-
trackingId:
|
|
1216
|
+
assignedTo: z16.string().nullish().describe("ID of the user currently assigned to the event."),
|
|
1217
|
+
updatedBy: z16.string().nullish().describe("ID of the user who last changed the status."),
|
|
1218
|
+
trackingId: z16.string().describe(
|
|
1209
1219
|
"System-generated tracking ID used by informants or registrars to look up the event."
|
|
1210
1220
|
),
|
|
1211
|
-
potentialDuplicates:
|
|
1221
|
+
potentialDuplicates: z16.array(PotentialDuplicate).describe(
|
|
1212
1222
|
"List of event IDs and their tracking IDs that this event could be a duplicate of."
|
|
1213
1223
|
),
|
|
1214
|
-
flags:
|
|
1224
|
+
flags: z16.array(Flag)
|
|
1215
1225
|
});
|
|
1216
1226
|
var EventMetadataKeysArray = [
|
|
1217
1227
|
"id",
|
|
@@ -1232,8 +1242,8 @@ var EventMetadataKeysArray = [
|
|
|
1232
1242
|
"legalStatuses",
|
|
1233
1243
|
"flags"
|
|
1234
1244
|
];
|
|
1235
|
-
var EventMetadataKeys =
|
|
1236
|
-
var EventMetadataDateFieldIdInput =
|
|
1245
|
+
var EventMetadataKeys = z16.enum(EventMetadataKeysArray);
|
|
1246
|
+
var EventMetadataDateFieldIdInput = z16.enum([
|
|
1237
1247
|
"createdAt",
|
|
1238
1248
|
"updatedAt",
|
|
1239
1249
|
"legalStatuses.NOTIFIED.createdAt",
|
|
@@ -1243,7 +1253,7 @@ var EventMetadataDateFieldIdInput = z15.enum([
|
|
|
1243
1253
|
"legalStatuses.REGISTERED.createdAt",
|
|
1244
1254
|
"legalStatuses.REGISTERED.acceptedAt"
|
|
1245
1255
|
]);
|
|
1246
|
-
var EventMetadataDateFieldId =
|
|
1256
|
+
var EventMetadataDateFieldId = z16.enum([
|
|
1247
1257
|
"event.createdAt",
|
|
1248
1258
|
"event.updatedAt",
|
|
1249
1259
|
"event.legalStatuses.NOTIFIED.createdAt",
|
|
@@ -2314,7 +2324,7 @@ var AnyFileField = import_v43.default.discriminatedUnion("type", [
|
|
|
2314
2324
|
]);
|
|
2315
2325
|
|
|
2316
2326
|
// ../commons/src/application-config.ts
|
|
2317
|
-
var SearchCriteria =
|
|
2327
|
+
var SearchCriteria = z21.enum([
|
|
2318
2328
|
"TRACKING_ID",
|
|
2319
2329
|
"REGISTRATION_NUMBER",
|
|
2320
2330
|
"NATIONAL_ID",
|
|
@@ -2322,69 +2332,69 @@ var SearchCriteria = z20.enum([
|
|
|
2322
2332
|
"PHONE_NUMBER",
|
|
2323
2333
|
"EMAIL"
|
|
2324
2334
|
]);
|
|
2325
|
-
var ApplicationConfig =
|
|
2326
|
-
APPLICATION_NAME:
|
|
2327
|
-
COUNTRY_LOGO:
|
|
2328
|
-
fileName:
|
|
2329
|
-
file:
|
|
2335
|
+
var ApplicationConfig = z21.object({
|
|
2336
|
+
APPLICATION_NAME: z21.string(),
|
|
2337
|
+
COUNTRY_LOGO: z21.object({
|
|
2338
|
+
fileName: z21.string(),
|
|
2339
|
+
file: z21.string()
|
|
2330
2340
|
}),
|
|
2331
|
-
SYSTEM_IANA_TIMEZONE:
|
|
2332
|
-
CURRENCY:
|
|
2333
|
-
languagesAndCountry:
|
|
2334
|
-
isoCode:
|
|
2341
|
+
SYSTEM_IANA_TIMEZONE: z21.string(),
|
|
2342
|
+
CURRENCY: z21.object({
|
|
2343
|
+
languagesAndCountry: z21.array(z21.string()),
|
|
2344
|
+
isoCode: z21.string()
|
|
2335
2345
|
}),
|
|
2336
|
-
ADMIN_STRUCTURE:
|
|
2337
|
-
|
|
2338
|
-
id:
|
|
2346
|
+
ADMIN_STRUCTURE: z21.array(
|
|
2347
|
+
z21.object({
|
|
2348
|
+
id: z21.string(),
|
|
2339
2349
|
label: TranslationConfig
|
|
2340
2350
|
})
|
|
2341
2351
|
),
|
|
2342
|
-
PHONE_NUMBER_PATTERN:
|
|
2343
|
-
USER_NOTIFICATION_DELIVERY_METHOD:
|
|
2344
|
-
INFORMANT_NOTIFICATION_DELIVERY_METHOD:
|
|
2352
|
+
PHONE_NUMBER_PATTERN: z21.string().or(z21.instanceof(RegExp)),
|
|
2353
|
+
USER_NOTIFICATION_DELIVERY_METHOD: z21.enum(["email", "sms"]),
|
|
2354
|
+
INFORMANT_NOTIFICATION_DELIVERY_METHOD: z21.enum(["email", "sms"]),
|
|
2345
2355
|
SEARCH_DEFAULT_CRITERIA: SearchCriteria.optional().default("TRACKING_ID"),
|
|
2346
|
-
ADDITIONAL_USER_FIELDS:
|
|
2356
|
+
ADDITIONAL_USER_FIELDS: z21.array(FieldConfig).optional().default([])
|
|
2347
2357
|
});
|
|
2348
2358
|
var defineApplicationConfig = (config) => {
|
|
2349
2359
|
return ApplicationConfig.parse(config);
|
|
2350
2360
|
};
|
|
2351
|
-
var BackgroundConfig =
|
|
2352
|
-
backgroundColor:
|
|
2353
|
-
backgroundImage:
|
|
2354
|
-
imageFit:
|
|
2361
|
+
var BackgroundConfig = z21.object({
|
|
2362
|
+
backgroundColor: z21.string().optional(),
|
|
2363
|
+
backgroundImage: z21.string().optional(),
|
|
2364
|
+
imageFit: z21.string().optional()
|
|
2355
2365
|
}).refine(
|
|
2356
2366
|
(data) => !!(data.backgroundColor || data.backgroundImage),
|
|
2357
2367
|
"backgroundColor and backgroundImage cannot be empty at the same time"
|
|
2358
2368
|
);
|
|
2359
|
-
var LoginConfig =
|
|
2360
|
-
COUNTRY:
|
|
2361
|
-
LANGUAGES:
|
|
2362
|
-
USER_NOTIFICATION_DELIVERY_METHOD:
|
|
2363
|
-
INFORMANT_NOTIFICATION_DELIVERY_METHOD:
|
|
2364
|
-
PHONE_NUMBER_PATTERN:
|
|
2369
|
+
var LoginConfig = z21.object({
|
|
2370
|
+
COUNTRY: z21.string(),
|
|
2371
|
+
LANGUAGES: z21.array(z21.string()),
|
|
2372
|
+
USER_NOTIFICATION_DELIVERY_METHOD: z21.enum(["email", "sms"]),
|
|
2373
|
+
INFORMANT_NOTIFICATION_DELIVERY_METHOD: z21.enum(["email", "sms"]),
|
|
2374
|
+
PHONE_NUMBER_PATTERN: z21.string().or(z21.instanceof(RegExp)),
|
|
2365
2375
|
LOGIN_BACKGROUND: BackgroundConfig,
|
|
2366
|
-
SENTRY:
|
|
2376
|
+
SENTRY: z21.string().optional()
|
|
2367
2377
|
});
|
|
2368
2378
|
var defineLoginConfig = (config) => {
|
|
2369
2379
|
return LoginConfig.parse(config);
|
|
2370
2380
|
};
|
|
2371
|
-
var ClientConfig =
|
|
2372
|
-
COUNTRY:
|
|
2373
|
-
LANGUAGES:
|
|
2374
|
-
SENTRY:
|
|
2375
|
-
LOGIN_URL:
|
|
2381
|
+
var ClientConfig = z21.object({
|
|
2382
|
+
COUNTRY: z21.string(),
|
|
2383
|
+
LANGUAGES: z21.array(z21.string()),
|
|
2384
|
+
SENTRY: z21.string().optional(),
|
|
2385
|
+
LOGIN_URL: z21.string().optional(),
|
|
2376
2386
|
REGISTER_BACKGROUND: BackgroundConfig,
|
|
2377
|
-
DASHBOARDS:
|
|
2378
|
-
|
|
2379
|
-
id:
|
|
2387
|
+
DASHBOARDS: z21.array(
|
|
2388
|
+
z21.object({
|
|
2389
|
+
id: z21.string(),
|
|
2380
2390
|
title: TranslationConfig,
|
|
2381
|
-
url:
|
|
2382
|
-
context:
|
|
2383
|
-
auth:
|
|
2391
|
+
url: z21.string(),
|
|
2392
|
+
context: z21.object({
|
|
2393
|
+
auth: z21.literal("REQUEST_AUTH_TOKEN")
|
|
2384
2394
|
}).optional()
|
|
2385
2395
|
})
|
|
2386
2396
|
),
|
|
2387
|
-
FEATURES:
|
|
2397
|
+
FEATURES: z21.object({ V2_EVENTS: z21.boolean().optional().default(true) }).optional().default({ V2_EVENTS: true })
|
|
2388
2398
|
});
|
|
2389
2399
|
var defineClientConfig = (config) => {
|
|
2390
2400
|
return ClientConfig.parse(config);
|