@opencrvs/toolkit 2.0.0-rc.5bee728 → 2.0.0-rc.61bee9f
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 +41 -11
- package/dist/cli.js +147 -47
- package/dist/commons/api/router.d.ts +35 -38
- package/dist/commons/application-config/index.d.ts +16 -4
- package/dist/commons/conditionals/conditionals.d.ts +6 -6
- package/dist/commons/events/FieldConfig.d.ts +10 -0
- package/dist/commons/events/locations.d.ts +17 -1
- package/dist/conditionals/index.js +37 -7
- package/dist/events/index.js +75 -7
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +60 -35
- package/dist/migrations/v2.0/index.js +147 -47
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +90 -1
- package/dist/notification/index.js +37 -7
- package/dist/scopes/index.d.ts +87 -10
- package/dist/scopes/index.js +43 -8
- package/opencrvs-toolkit-2.0.0-rc.61bee9f.tgz +0 -0
- package/package.json +1 -1
- package/opencrvs-toolkit-2.0.0-rc.5bee728.tgz +0 -0
|
@@ -4092,33 +4092,18 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4092
4092
|
input: string[];
|
|
4093
4093
|
output: ({
|
|
4094
4094
|
id: string & import("zod").$brand<"UUID">;
|
|
4095
|
+
type: "user";
|
|
4095
4096
|
name: {
|
|
4096
4097
|
firstname: string;
|
|
4097
4098
|
surname: string;
|
|
4098
4099
|
};
|
|
4099
4100
|
role: string;
|
|
4100
|
-
primaryOfficeId: string & import("zod").$brand<"UUID">;
|
|
4101
|
-
type: "user";
|
|
4102
|
-
status: "active" | "pending" | "deactivated";
|
|
4103
|
-
avatar?: (string & import("zod").$brand<"DocumentPath">) | undefined;
|
|
4104
|
-
signature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
4105
|
-
administrativeAreaId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
4106
|
-
device?: string | undefined;
|
|
4107
4101
|
fullHonorificName?: string | undefined;
|
|
4108
|
-
|
|
4109
|
-
email?: string | undefined;
|
|
4110
|
-
data?: Record<string, import("../commons").FieldValue> | undefined;
|
|
4102
|
+
signature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
4111
4103
|
} | {
|
|
4112
4104
|
id: string & import("zod").$brand<"UUID">;
|
|
4113
|
-
name: string;
|
|
4114
4105
|
type: "system";
|
|
4115
|
-
|
|
4116
|
-
administrativeAreaId?: (string & import("zod").$brand<"UUID">) | undefined;
|
|
4117
|
-
signature?: undefined;
|
|
4118
|
-
avatar?: undefined;
|
|
4119
|
-
fullHonorificName?: string | undefined;
|
|
4120
|
-
legacyId?: string | undefined;
|
|
4121
|
-
status?: undefined;
|
|
4106
|
+
name: string;
|
|
4122
4107
|
})[];
|
|
4123
4108
|
meta: import("trpc-to-openapi").OpenApiMeta;
|
|
4124
4109
|
}>;
|
|
@@ -4307,6 +4292,18 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4307
4292
|
output: void;
|
|
4308
4293
|
meta: import("trpc-to-openapi").OpenApiMeta;
|
|
4309
4294
|
}>;
|
|
4295
|
+
verifyLoggedInUserPassword: import("@trpc/server").TRPCMutationProcedure<{
|
|
4296
|
+
input: {
|
|
4297
|
+
password: string;
|
|
4298
|
+
};
|
|
4299
|
+
output: {
|
|
4300
|
+
status: string;
|
|
4301
|
+
username: string;
|
|
4302
|
+
id: string;
|
|
4303
|
+
mobile?: string | undefined;
|
|
4304
|
+
};
|
|
4305
|
+
meta: import("trpc-to-openapi").OpenApiMeta;
|
|
4306
|
+
}>;
|
|
4310
4307
|
audit: import("@trpc/server").TRPCBuiltRouter<{
|
|
4311
4308
|
ctx: Partial<{
|
|
4312
4309
|
token: `Bearer ${string}`;
|
|
@@ -4762,7 +4759,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4762
4759
|
'legalStatuses.DECLARED.createdAtLocation'?: {
|
|
4763
4760
|
type: "within";
|
|
4764
4761
|
location: string | {
|
|
4765
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4762
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4766
4763
|
$location?: string | undefined;
|
|
4767
4764
|
};
|
|
4768
4765
|
} | undefined;
|
|
@@ -4784,7 +4781,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4784
4781
|
'legalStatuses.REGISTERED.createdAtLocation'?: {
|
|
4785
4782
|
type: "within";
|
|
4786
4783
|
location: string | {
|
|
4787
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4784
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4788
4785
|
$location?: string | undefined;
|
|
4789
4786
|
};
|
|
4790
4787
|
} | undefined;
|
|
@@ -4799,47 +4796,47 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4799
4796
|
createdAtLocation?: {
|
|
4800
4797
|
type: "within";
|
|
4801
4798
|
location: string | {
|
|
4802
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4799
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4803
4800
|
$location?: string | undefined;
|
|
4804
4801
|
};
|
|
4805
4802
|
} | {
|
|
4806
4803
|
type: "exact";
|
|
4807
4804
|
term: string | {
|
|
4808
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4805
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4809
4806
|
$location?: string | undefined;
|
|
4810
4807
|
};
|
|
4811
4808
|
} | undefined;
|
|
4812
4809
|
updatedAtLocation?: {
|
|
4813
4810
|
type: "within";
|
|
4814
4811
|
location: string | {
|
|
4815
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4812
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4816
4813
|
$location?: string | undefined;
|
|
4817
4814
|
};
|
|
4818
4815
|
} | {
|
|
4819
4816
|
type: "exact";
|
|
4820
4817
|
term: string | {
|
|
4821
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4818
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4822
4819
|
$location?: string | undefined;
|
|
4823
4820
|
};
|
|
4824
4821
|
} | undefined;
|
|
4825
4822
|
updatedByUserRole?: {
|
|
4826
4823
|
type: "exact";
|
|
4827
4824
|
term: string | {
|
|
4828
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4825
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4829
4826
|
$location?: string | undefined;
|
|
4830
4827
|
};
|
|
4831
4828
|
} | undefined;
|
|
4832
4829
|
assignedTo?: {
|
|
4833
4830
|
type: "exact";
|
|
4834
4831
|
term: string | {
|
|
4835
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4832
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4836
4833
|
$location?: string | undefined;
|
|
4837
4834
|
};
|
|
4838
4835
|
} | undefined;
|
|
4839
4836
|
createdBy?: {
|
|
4840
4837
|
type: "exact";
|
|
4841
4838
|
term: string | {
|
|
4842
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4839
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4843
4840
|
$location?: string | undefined;
|
|
4844
4841
|
};
|
|
4845
4842
|
} | undefined;
|
|
@@ -4850,7 +4847,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4850
4847
|
updatedBy?: {
|
|
4851
4848
|
type: "exact";
|
|
4852
4849
|
term: string | {
|
|
4853
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4850
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4854
4851
|
$location?: string | undefined;
|
|
4855
4852
|
};
|
|
4856
4853
|
} | undefined;
|
|
@@ -4900,7 +4897,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4900
4897
|
'legalStatuses.DECLARED.createdAtLocation'?: {
|
|
4901
4898
|
type: "within";
|
|
4902
4899
|
location: string | {
|
|
4903
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4900
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4904
4901
|
$location?: string | undefined;
|
|
4905
4902
|
};
|
|
4906
4903
|
} | undefined;
|
|
@@ -4922,7 +4919,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4922
4919
|
'legalStatuses.REGISTERED.createdAtLocation'?: {
|
|
4923
4920
|
type: "within";
|
|
4924
4921
|
location: string | {
|
|
4925
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4922
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4926
4923
|
$location?: string | undefined;
|
|
4927
4924
|
};
|
|
4928
4925
|
} | undefined;
|
|
@@ -4937,47 +4934,47 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4937
4934
|
createdAtLocation?: {
|
|
4938
4935
|
type: "within";
|
|
4939
4936
|
location: string | {
|
|
4940
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4937
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4941
4938
|
$location?: string | undefined;
|
|
4942
4939
|
};
|
|
4943
4940
|
} | {
|
|
4944
4941
|
type: "exact";
|
|
4945
4942
|
term: string | {
|
|
4946
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4943
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4947
4944
|
$location?: string | undefined;
|
|
4948
4945
|
};
|
|
4949
4946
|
} | undefined;
|
|
4950
4947
|
updatedAtLocation?: {
|
|
4951
4948
|
type: "within";
|
|
4952
4949
|
location: string | {
|
|
4953
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4950
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4954
4951
|
$location?: string | undefined;
|
|
4955
4952
|
};
|
|
4956
4953
|
} | {
|
|
4957
4954
|
type: "exact";
|
|
4958
4955
|
term: string | {
|
|
4959
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4956
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4960
4957
|
$location?: string | undefined;
|
|
4961
4958
|
};
|
|
4962
4959
|
} | undefined;
|
|
4963
4960
|
updatedByUserRole?: {
|
|
4964
4961
|
type: "exact";
|
|
4965
4962
|
term: string | {
|
|
4966
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4963
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4967
4964
|
$location?: string | undefined;
|
|
4968
4965
|
};
|
|
4969
4966
|
} | undefined;
|
|
4970
4967
|
assignedTo?: {
|
|
4971
4968
|
type: "exact";
|
|
4972
4969
|
term: string | {
|
|
4973
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4970
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4974
4971
|
$location?: string | undefined;
|
|
4975
4972
|
};
|
|
4976
4973
|
} | undefined;
|
|
4977
4974
|
createdBy?: {
|
|
4978
4975
|
type: "exact";
|
|
4979
4976
|
term: string | {
|
|
4980
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4977
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4981
4978
|
$location?: string | undefined;
|
|
4982
4979
|
};
|
|
4983
4980
|
} | undefined;
|
|
@@ -4988,7 +4985,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4988
4985
|
updatedBy?: {
|
|
4989
4986
|
type: "exact";
|
|
4990
4987
|
term: string | {
|
|
4991
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "
|
|
4988
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4992
4989
|
$location?: string | undefined;
|
|
4993
4990
|
};
|
|
4994
4991
|
} | undefined;
|
|
@@ -24,8 +24,14 @@ export declare const ApplicationConfig: z.ZodObject<{
|
|
|
24
24
|
label: z.ZodObject<import("./events/TranslationConfig").MessageDescriptorZod, z.core.$strip>;
|
|
25
25
|
}, z.core.$strip>>;
|
|
26
26
|
PHONE_NUMBER_PATTERN: z.ZodUnion<[z.ZodString, z.ZodCustom<RegExp, RegExp>]>;
|
|
27
|
-
USER_NOTIFICATION_DELIVERY_METHOD: z.
|
|
28
|
-
|
|
27
|
+
USER_NOTIFICATION_DELIVERY_METHOD: z.ZodEnum<{
|
|
28
|
+
email: "email";
|
|
29
|
+
sms: "sms";
|
|
30
|
+
}>;
|
|
31
|
+
INFORMANT_NOTIFICATION_DELIVERY_METHOD: z.ZodEnum<{
|
|
32
|
+
email: "email";
|
|
33
|
+
sms: "sms";
|
|
34
|
+
}>;
|
|
29
35
|
SEARCH_DEFAULT_CRITERIA: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
30
36
|
NAME: "NAME";
|
|
31
37
|
EMAIL: "EMAIL";
|
|
@@ -46,8 +52,14 @@ export declare const BackgroundConfig: z.ZodObject<{
|
|
|
46
52
|
export declare const LoginConfig: z.ZodObject<{
|
|
47
53
|
COUNTRY: z.ZodString;
|
|
48
54
|
LANGUAGES: z.ZodArray<z.ZodString>;
|
|
49
|
-
USER_NOTIFICATION_DELIVERY_METHOD: z.
|
|
50
|
-
|
|
55
|
+
USER_NOTIFICATION_DELIVERY_METHOD: z.ZodEnum<{
|
|
56
|
+
email: "email";
|
|
57
|
+
sms: "sms";
|
|
58
|
+
}>;
|
|
59
|
+
INFORMANT_NOTIFICATION_DELIVERY_METHOD: z.ZodEnum<{
|
|
60
|
+
email: "email";
|
|
61
|
+
sms: "sms";
|
|
62
|
+
}>;
|
|
51
63
|
PHONE_NUMBER_PATTERN: z.ZodUnion<[z.ZodString, z.ZodCustom<RegExp, RegExp>]>;
|
|
52
64
|
LOGIN_BACKGROUND: z.ZodObject<{
|
|
53
65
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
@@ -86,17 +86,17 @@ export declare const user: typeof userSerializer & {
|
|
|
86
86
|
};
|
|
87
87
|
scope: (scope: import("../scopes").ScopeType) => {
|
|
88
88
|
attribute: (option: import("../scopes").ScopeOptionKey) => {
|
|
89
|
-
$scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "workqueue" | "dashboard.view";
|
|
90
|
-
$option: "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
|
|
89
|
+
$scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "user.search" | "workqueue" | "dashboard.view";
|
|
90
|
+
$option: "role" | "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
|
|
91
91
|
};
|
|
92
92
|
};
|
|
93
93
|
jurisdiction: (jurisdiction: import("../scopes").JurisdictionFilter | {
|
|
94
|
-
$scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "workqueue" | "dashboard.view";
|
|
95
|
-
$option: "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
|
|
94
|
+
$scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "user.search" | "workqueue" | "dashboard.view";
|
|
95
|
+
$option: "role" | "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
|
|
96
96
|
}) => {
|
|
97
97
|
$jurisdiction: "administrativeArea" | "location" | "all" | {
|
|
98
|
-
$scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "workqueue" | "dashboard.view";
|
|
99
|
-
$option: "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
|
|
98
|
+
$scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "user.search" | "workqueue" | "dashboard.view";
|
|
99
|
+
$option: "role" | "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
|
|
100
100
|
};
|
|
101
101
|
};
|
|
102
102
|
};
|
|
@@ -1723,10 +1723,12 @@ declare const AdministrativeAreaField: z.ZodObject<{
|
|
|
1723
1723
|
"user.read": "user.read";
|
|
1724
1724
|
"user.create": "user.create";
|
|
1725
1725
|
"user.edit": "user.edit";
|
|
1726
|
+
"user.search": "user.search";
|
|
1726
1727
|
workqueue: "workqueue";
|
|
1727
1728
|
"dashboard.view": "dashboard.view";
|
|
1728
1729
|
}>;
|
|
1729
1730
|
$option: z.ZodEnum<{
|
|
1731
|
+
role: "role";
|
|
1730
1732
|
event: "event";
|
|
1731
1733
|
placeOfEvent: "placeOfEvent";
|
|
1732
1734
|
declaredIn: "declaredIn";
|
|
@@ -1841,10 +1843,12 @@ declare const LocationInput: z.ZodObject<{
|
|
|
1841
1843
|
"user.read": "user.read";
|
|
1842
1844
|
"user.create": "user.create";
|
|
1843
1845
|
"user.edit": "user.edit";
|
|
1846
|
+
"user.search": "user.search";
|
|
1844
1847
|
workqueue: "workqueue";
|
|
1845
1848
|
"dashboard.view": "dashboard.view";
|
|
1846
1849
|
}>;
|
|
1847
1850
|
$option: z.ZodEnum<{
|
|
1851
|
+
role: "role";
|
|
1848
1852
|
event: "event";
|
|
1849
1853
|
placeOfEvent: "placeOfEvent";
|
|
1850
1854
|
declaredIn: "declaredIn";
|
|
@@ -2024,10 +2028,12 @@ declare const Facility: z.ZodObject<{
|
|
|
2024
2028
|
"user.read": "user.read";
|
|
2025
2029
|
"user.create": "user.create";
|
|
2026
2030
|
"user.edit": "user.edit";
|
|
2031
|
+
"user.search": "user.search";
|
|
2027
2032
|
workqueue: "workqueue";
|
|
2028
2033
|
"dashboard.view": "dashboard.view";
|
|
2029
2034
|
}>;
|
|
2030
2035
|
$option: z.ZodEnum<{
|
|
2036
|
+
role: "role";
|
|
2031
2037
|
event: "event";
|
|
2032
2038
|
placeOfEvent: "placeOfEvent";
|
|
2033
2039
|
declaredIn: "declaredIn";
|
|
@@ -2128,10 +2134,12 @@ declare const Office: z.ZodObject<{
|
|
|
2128
2134
|
"user.read": "user.read";
|
|
2129
2135
|
"user.create": "user.create";
|
|
2130
2136
|
"user.edit": "user.edit";
|
|
2137
|
+
"user.search": "user.search";
|
|
2131
2138
|
workqueue: "workqueue";
|
|
2132
2139
|
"dashboard.view": "dashboard.view";
|
|
2133
2140
|
}>;
|
|
2134
2141
|
$option: z.ZodEnum<{
|
|
2142
|
+
role: "role";
|
|
2135
2143
|
event: "event";
|
|
2136
2144
|
placeOfEvent: "placeOfEvent";
|
|
2137
2145
|
declaredIn: "declaredIn";
|
|
@@ -2319,10 +2327,12 @@ declare const Address: z.ZodObject<{
|
|
|
2319
2327
|
"user.read": "user.read";
|
|
2320
2328
|
"user.create": "user.create";
|
|
2321
2329
|
"user.edit": "user.edit";
|
|
2330
|
+
"user.search": "user.search";
|
|
2322
2331
|
workqueue: "workqueue";
|
|
2323
2332
|
"dashboard.view": "dashboard.view";
|
|
2324
2333
|
}>;
|
|
2325
2334
|
$option: z.ZodEnum<{
|
|
2335
|
+
role: "role";
|
|
2326
2336
|
event: "event";
|
|
2327
2337
|
placeOfEvent: "placeOfEvent";
|
|
2328
2338
|
declaredIn: "declaredIn";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { UUID } from '../uuid';
|
|
1
2
|
import * as z from 'zod/v4';
|
|
2
3
|
import { EventIndex } from './EventIndex';
|
|
3
4
|
import { ActionCreationMetadata, RegistrationCreationMetadata } from './EventMetadata';
|
|
4
|
-
import { RecordScopeV2 } from '../scopes';
|
|
5
|
+
import { RecordScopeV2, UserScopeV2 } from '../scopes';
|
|
5
6
|
import { SystemContext, UserContext } from '../users/User';
|
|
6
7
|
/** @deprecated Moving on, location types are arbitrary and defined by the country config. */
|
|
7
8
|
export declare const LocationTypeV1: z.ZodEnum<{
|
|
@@ -51,6 +52,21 @@ export type EventIndexWithAdministrativeHierarchy = Omit<ToArrayFields<EventInde
|
|
|
51
52
|
*
|
|
52
53
|
*/
|
|
53
54
|
export declare function canAccessEventWithScope(event: Partial<EventIndexWithAdministrativeHierarchy>, scope: RecordScopeV2, user: UserContext | SystemContext, customActionType?: string): boolean;
|
|
55
|
+
export type UserWithResolvedHierarchy = {
|
|
56
|
+
role: string;
|
|
57
|
+
administrativeHierarchy: UUID[];
|
|
58
|
+
primaryOfficeId: UUID;
|
|
59
|
+
};
|
|
60
|
+
export declare function canAccessUserWithScope({ userToAccess, scope, user }: {
|
|
61
|
+
userToAccess: UserWithResolvedHierarchy;
|
|
62
|
+
scope: UserScopeV2;
|
|
63
|
+
user: UserContext | SystemContext;
|
|
64
|
+
}): boolean;
|
|
65
|
+
export declare function canAccessOtherUserWithScopes({ scopes, userToAccess, user }: {
|
|
66
|
+
scopes: UserScopeV2[];
|
|
67
|
+
userToAccess: UserWithResolvedHierarchy;
|
|
68
|
+
user: UserContext | SystemContext;
|
|
69
|
+
}): boolean;
|
|
54
70
|
/**
|
|
55
71
|
* Given indexed event and list of resolved scopes, determine if any of the scopes allow access to the event.
|
|
56
72
|
*
|
|
@@ -182,6 +182,10 @@ var scopeByEvent = z6.preprocess(
|
|
|
182
182
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
183
183
|
z6.array(z6.string()).optional()
|
|
184
184
|
).describe("Event type, e.g. birth, death");
|
|
185
|
+
var userRole = z6.preprocess(
|
|
186
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
187
|
+
z6.array(z6.string()).optional()
|
|
188
|
+
).describe("User role, e.g. admin, field agent");
|
|
185
189
|
var scopeOptionsPlaceEvent = z6.object({
|
|
186
190
|
event: scopeByEvent,
|
|
187
191
|
placeOfEvent: JurisdictionFilter.optional()
|
|
@@ -205,6 +209,9 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
|
205
209
|
var AccessLevelOptions = z6.object({
|
|
206
210
|
accessLevel: JurisdictionFilter.optional()
|
|
207
211
|
});
|
|
212
|
+
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
213
|
+
role: userRole.optional()
|
|
214
|
+
});
|
|
208
215
|
var WorkqueueOrDashboardOptions = z6.object({
|
|
209
216
|
ids: z6.preprocess(
|
|
210
217
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
@@ -214,6 +221,7 @@ var WorkqueueOrDashboardOptions = z6.object({
|
|
|
214
221
|
var AllScopeOptions = z6.object({
|
|
215
222
|
...AllRecordScopeOptions.shape,
|
|
216
223
|
...AccessLevelOptions.shape,
|
|
224
|
+
...AllUserScopeOptions.shape,
|
|
217
225
|
...WorkqueueOrDashboardOptions.shape
|
|
218
226
|
});
|
|
219
227
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
@@ -286,6 +294,30 @@ var RecordScopeV2 = z6.discriminatedUnion("type", [
|
|
|
286
294
|
]).describe(
|
|
287
295
|
"Scopes used to check user's permission to perform actions on a record."
|
|
288
296
|
);
|
|
297
|
+
var SystemScopeType = z6.enum([
|
|
298
|
+
"organisation.read-locations",
|
|
299
|
+
"user.read",
|
|
300
|
+
"user.create",
|
|
301
|
+
"user.edit",
|
|
302
|
+
"user.search"
|
|
303
|
+
]);
|
|
304
|
+
var UserScopeType = SystemScopeType.extract([
|
|
305
|
+
"user.read",
|
|
306
|
+
"user.create",
|
|
307
|
+
"user.edit",
|
|
308
|
+
"user.search"
|
|
309
|
+
]);
|
|
310
|
+
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
311
|
+
var UserScopeV2 = z6.discriminatedUnion("type", [
|
|
312
|
+
z6.object({
|
|
313
|
+
type: ScopesWithRoleOption,
|
|
314
|
+
options: AllUserScopeOptions.optional()
|
|
315
|
+
}),
|
|
316
|
+
z6.object({
|
|
317
|
+
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
318
|
+
options: AccessLevelOptions.optional()
|
|
319
|
+
})
|
|
320
|
+
]);
|
|
289
321
|
var ResolvedRecordScopeV2 = z6.discriminatedUnion("type", [
|
|
290
322
|
z6.object({
|
|
291
323
|
type: ScopesWithPlaceEventOptions,
|
|
@@ -306,16 +338,14 @@ var ResolvedRecordScopeV2 = z6.discriminatedUnion("type", [
|
|
|
306
338
|
}).optional()
|
|
307
339
|
})
|
|
308
340
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
309
|
-
var SystemScopeType = z6.enum([
|
|
310
|
-
"organisation.read-locations",
|
|
311
|
-
"user.read",
|
|
312
|
-
"user.create",
|
|
313
|
-
"user.edit"
|
|
314
|
-
]);
|
|
315
341
|
var Scope2 = z6.discriminatedUnion("type", [
|
|
316
342
|
z6.object({ type: PlainScopeType }),
|
|
317
343
|
...RecordScopeV2.options,
|
|
318
|
-
|
|
344
|
+
...UserScopeV2.options,
|
|
345
|
+
z6.object({
|
|
346
|
+
type: z6.literal("organisation.read-locations"),
|
|
347
|
+
options: AccessLevelOptions.optional()
|
|
348
|
+
}),
|
|
319
349
|
z6.object({
|
|
320
350
|
type: z6.literal("workqueue"),
|
|
321
351
|
options: WorkqueueOrDashboardOptions
|
package/dist/events/index.js
CHANGED
|
@@ -243,6 +243,8 @@ __export(events_exports, {
|
|
|
243
243
|
areConditionsMet: () => areConditionsMet,
|
|
244
244
|
buildFormState: () => buildFormState,
|
|
245
245
|
canAccessEventWithScope: () => canAccessEventWithScope,
|
|
246
|
+
canAccessOtherUserWithScopes: () => canAccessOtherUserWithScopes,
|
|
247
|
+
canAccessUserWithScope: () => canAccessUserWithScope,
|
|
246
248
|
compositeFieldTypes: () => compositeFieldTypes,
|
|
247
249
|
createEmptyDraft: () => createEmptyDraft,
|
|
248
250
|
createFieldConditionals: () => createFieldConditionals,
|
|
@@ -489,6 +491,10 @@ var scopeByEvent = z2.preprocess(
|
|
|
489
491
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
490
492
|
z2.array(z2.string()).optional()
|
|
491
493
|
).describe("Event type, e.g. birth, death");
|
|
494
|
+
var userRole = z2.preprocess(
|
|
495
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
496
|
+
z2.array(z2.string()).optional()
|
|
497
|
+
).describe("User role, e.g. admin, field agent");
|
|
492
498
|
var scopeOptionsPlaceEvent = z2.object({
|
|
493
499
|
event: scopeByEvent,
|
|
494
500
|
placeOfEvent: JurisdictionFilter.optional()
|
|
@@ -512,6 +518,9 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
|
512
518
|
var AccessLevelOptions = z2.object({
|
|
513
519
|
accessLevel: JurisdictionFilter.optional()
|
|
514
520
|
});
|
|
521
|
+
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
522
|
+
role: userRole.optional()
|
|
523
|
+
});
|
|
515
524
|
var WorkqueueOrDashboardOptions = z2.object({
|
|
516
525
|
ids: z2.preprocess(
|
|
517
526
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
@@ -521,6 +530,7 @@ var WorkqueueOrDashboardOptions = z2.object({
|
|
|
521
530
|
var AllScopeOptions = z2.object({
|
|
522
531
|
...AllRecordScopeOptions.shape,
|
|
523
532
|
...AccessLevelOptions.shape,
|
|
533
|
+
...AllUserScopeOptions.shape,
|
|
524
534
|
...WorkqueueOrDashboardOptions.shape
|
|
525
535
|
});
|
|
526
536
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
@@ -593,6 +603,33 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
|
|
|
593
603
|
]).describe(
|
|
594
604
|
"Scopes used to check user's permission to perform actions on a record."
|
|
595
605
|
);
|
|
606
|
+
var SystemScopeType = z2.enum([
|
|
607
|
+
"organisation.read-locations",
|
|
608
|
+
"user.read",
|
|
609
|
+
"user.create",
|
|
610
|
+
"user.edit",
|
|
611
|
+
"user.search"
|
|
612
|
+
]);
|
|
613
|
+
var UserScopeType = SystemScopeType.extract([
|
|
614
|
+
"user.read",
|
|
615
|
+
"user.create",
|
|
616
|
+
"user.edit",
|
|
617
|
+
"user.search"
|
|
618
|
+
]);
|
|
619
|
+
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
620
|
+
var UserScopeV2 = z2.discriminatedUnion("type", [
|
|
621
|
+
z2.object({
|
|
622
|
+
type: ScopesWithRoleOption,
|
|
623
|
+
options: AllUserScopeOptions.optional()
|
|
624
|
+
}),
|
|
625
|
+
z2.object({
|
|
626
|
+
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
627
|
+
options: AccessLevelOptions.optional()
|
|
628
|
+
})
|
|
629
|
+
]);
|
|
630
|
+
function scopeUsesRoleOptions(scope) {
|
|
631
|
+
return ScopesWithRoleOption?.options.some((opt) => opt === scope.type);
|
|
632
|
+
}
|
|
596
633
|
function scopeUsesDeclaredOptions(scope) {
|
|
597
634
|
return !ScopesWithPlaceEventOptions.options.some((opt) => opt === scope.type);
|
|
598
635
|
}
|
|
@@ -625,16 +662,14 @@ var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
|
|
|
625
662
|
}).optional()
|
|
626
663
|
})
|
|
627
664
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
628
|
-
var SystemScopeType = z2.enum([
|
|
629
|
-
"organisation.read-locations",
|
|
630
|
-
"user.read",
|
|
631
|
-
"user.create",
|
|
632
|
-
"user.edit"
|
|
633
|
-
]);
|
|
634
665
|
var Scope = z2.discriminatedUnion("type", [
|
|
635
666
|
z2.object({ type: PlainScopeType }),
|
|
636
667
|
...RecordScopeV2.options,
|
|
637
|
-
|
|
668
|
+
...UserScopeV2.options,
|
|
669
|
+
z2.object({
|
|
670
|
+
type: z2.literal("organisation.read-locations"),
|
|
671
|
+
options: AccessLevelOptions.optional()
|
|
672
|
+
}),
|
|
638
673
|
z2.object({
|
|
639
674
|
type: z2.literal("workqueue"),
|
|
640
675
|
options: WorkqueueOrDashboardOptions
|
|
@@ -9930,6 +9965,39 @@ function canAccessEventWithScope(event2, scope, user2, customActionType) {
|
|
|
9930
9965
|
}
|
|
9931
9966
|
return true;
|
|
9932
9967
|
}
|
|
9968
|
+
function canAccessUserWithScope({
|
|
9969
|
+
userToAccess,
|
|
9970
|
+
scope,
|
|
9971
|
+
user: user2
|
|
9972
|
+
}) {
|
|
9973
|
+
const opts = scope.options;
|
|
9974
|
+
const hasSameOffice = user2.primaryOfficeId === userToAccess.primaryOfficeId;
|
|
9975
|
+
if (opts?.accessLevel === JurisdictionFilter.enum.location && !hasSameOffice) {
|
|
9976
|
+
return false;
|
|
9977
|
+
}
|
|
9978
|
+
const hasAdministrativeAreaInHierarchy = userToAccess.administrativeHierarchy.some(
|
|
9979
|
+
(id) => user2.administrativeAreaId === id
|
|
9980
|
+
) || user2.administrativeAreaId === null;
|
|
9981
|
+
if (opts?.accessLevel === JurisdictionFilter.enum.administrativeArea && !hasAdministrativeAreaInHierarchy) {
|
|
9982
|
+
return false;
|
|
9983
|
+
}
|
|
9984
|
+
if (scopeUsesRoleOptions(scope)) {
|
|
9985
|
+
const { options } = scope;
|
|
9986
|
+
if (options?.role && !options.role.includes(userToAccess.role)) {
|
|
9987
|
+
return false;
|
|
9988
|
+
}
|
|
9989
|
+
}
|
|
9990
|
+
return true;
|
|
9991
|
+
}
|
|
9992
|
+
function canAccessOtherUserWithScopes({
|
|
9993
|
+
scopes,
|
|
9994
|
+
userToAccess,
|
|
9995
|
+
user: user2
|
|
9996
|
+
}) {
|
|
9997
|
+
return scopes.some(
|
|
9998
|
+
(scope) => canAccessUserWithScope({ userToAccess, scope, user: user2 })
|
|
9999
|
+
);
|
|
10000
|
+
}
|
|
9933
10001
|
function userCanAccessEventWithScopes(event2, scopes, user2, customActionType) {
|
|
9934
10002
|
return scopes.some(
|
|
9935
10003
|
(scope) => canAccessEventWithScope(event2, scope, user2, customActionType)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-birth-certificate-issuance-flag.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/add-birth-certificate-issuance-flag.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-birth-certificate-issuance-flag.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/add-birth-certificate-issuance-flag.ts"],"names":[],"mappings":"AAycA,iBAAe,IAAI,kBAiDlB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
|