@opencrvs/toolkit 2.0.0-rc.3c7efd6 → 2.0.0-rc.3e178f3
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/create-countryconfig/index.js +73 -0
- package/create-countryconfig/package.json +11 -0
- package/dist/application-config/index.js +4 -4
- package/dist/cli.js +110 -40
- package/dist/commons/api/router.d.ts +51 -27
- package/dist/commons/application-config/index.d.ts +16 -4
- package/dist/commons/events/locations.d.ts +21 -0
- package/dist/commons/events/mocks.test.utils.d.ts +19 -0
- package/dist/commons/events/scopes.d.ts +24 -1
- package/dist/events/index.js +55 -0
- 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 +110 -40
- 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/opencrvs-toolkit-2.0.0-rc.3e178f3.tgz +0 -0
- package/package.json +1 -1
- package/opencrvs-toolkit-2.0.0-rc.3c7efd6.tgz +0 -0
|
@@ -4092,18 +4092,33 @@ 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";
|
|
4096
4095
|
name: {
|
|
4097
4096
|
firstname: string;
|
|
4098
4097
|
surname: string;
|
|
4099
4098
|
};
|
|
4100
4099
|
role: string;
|
|
4101
|
-
|
|
4100
|
+
primaryOfficeId: string & import("zod").$brand<"UUID">;
|
|
4101
|
+
type: "user";
|
|
4102
|
+
status: "active" | "pending" | "deactivated";
|
|
4103
|
+
avatar?: (string & import("zod").$brand<"DocumentPath">) | undefined;
|
|
4102
4104
|
signature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
4105
|
+
administrativeAreaId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
4106
|
+
device?: string | undefined;
|
|
4107
|
+
fullHonorificName?: string | undefined;
|
|
4108
|
+
mobile?: string | undefined;
|
|
4109
|
+
email?: string | undefined;
|
|
4110
|
+
data?: Record<string, import("../commons").FieldValue> | undefined;
|
|
4103
4111
|
} | {
|
|
4104
4112
|
id: string & import("zod").$brand<"UUID">;
|
|
4105
|
-
type: "system";
|
|
4106
4113
|
name: string;
|
|
4114
|
+
type: "system";
|
|
4115
|
+
primaryOfficeId?: (string & import("zod").$brand<"UUID">) | undefined;
|
|
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;
|
|
4107
4122
|
})[];
|
|
4108
4123
|
meta: import("trpc-to-openapi").OpenApiMeta;
|
|
4109
4124
|
}>;
|
|
@@ -4260,10 +4275,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4260
4275
|
changeAvatar: import("@trpc/server").TRPCMutationProcedure<{
|
|
4261
4276
|
input: {
|
|
4262
4277
|
userId: string;
|
|
4263
|
-
avatar:
|
|
4264
|
-
type: string;
|
|
4265
|
-
data: string;
|
|
4266
|
-
};
|
|
4278
|
+
avatar: string;
|
|
4267
4279
|
};
|
|
4268
4280
|
output: void;
|
|
4269
4281
|
meta: import("trpc-to-openapi").OpenApiMeta;
|
|
@@ -4295,6 +4307,18 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4295
4307
|
output: void;
|
|
4296
4308
|
meta: import("trpc-to-openapi").OpenApiMeta;
|
|
4297
4309
|
}>;
|
|
4310
|
+
verifyLoggedInUserPassword: import("@trpc/server").TRPCMutationProcedure<{
|
|
4311
|
+
input: {
|
|
4312
|
+
password: string;
|
|
4313
|
+
};
|
|
4314
|
+
output: {
|
|
4315
|
+
status: string;
|
|
4316
|
+
username: string;
|
|
4317
|
+
id: string;
|
|
4318
|
+
mobile?: string | undefined;
|
|
4319
|
+
};
|
|
4320
|
+
meta: import("trpc-to-openapi").OpenApiMeta;
|
|
4321
|
+
}>;
|
|
4298
4322
|
audit: import("@trpc/server").TRPCBuiltRouter<{
|
|
4299
4323
|
ctx: Partial<{
|
|
4300
4324
|
token: `Bearer ${string}`;
|
|
@@ -4750,7 +4774,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4750
4774
|
'legalStatuses.DECLARED.createdAtLocation'?: {
|
|
4751
4775
|
type: "within";
|
|
4752
4776
|
location: string | {
|
|
4753
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "
|
|
4777
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4754
4778
|
$location?: string | undefined;
|
|
4755
4779
|
};
|
|
4756
4780
|
} | undefined;
|
|
@@ -4772,7 +4796,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4772
4796
|
'legalStatuses.REGISTERED.createdAtLocation'?: {
|
|
4773
4797
|
type: "within";
|
|
4774
4798
|
location: string | {
|
|
4775
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "
|
|
4799
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4776
4800
|
$location?: string | undefined;
|
|
4777
4801
|
};
|
|
4778
4802
|
} | undefined;
|
|
@@ -4787,47 +4811,47 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4787
4811
|
createdAtLocation?: {
|
|
4788
4812
|
type: "within";
|
|
4789
4813
|
location: string | {
|
|
4790
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "
|
|
4814
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4791
4815
|
$location?: string | undefined;
|
|
4792
4816
|
};
|
|
4793
4817
|
} | {
|
|
4794
4818
|
type: "exact";
|
|
4795
4819
|
term: string | {
|
|
4796
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "
|
|
4820
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4797
4821
|
$location?: string | undefined;
|
|
4798
4822
|
};
|
|
4799
4823
|
} | undefined;
|
|
4800
4824
|
updatedAtLocation?: {
|
|
4801
4825
|
type: "within";
|
|
4802
4826
|
location: string | {
|
|
4803
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "
|
|
4827
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4804
4828
|
$location?: string | undefined;
|
|
4805
4829
|
};
|
|
4806
4830
|
} | {
|
|
4807
4831
|
type: "exact";
|
|
4808
4832
|
term: string | {
|
|
4809
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "
|
|
4833
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4810
4834
|
$location?: string | undefined;
|
|
4811
4835
|
};
|
|
4812
4836
|
} | undefined;
|
|
4813
4837
|
updatedByUserRole?: {
|
|
4814
4838
|
type: "exact";
|
|
4815
4839
|
term: string | {
|
|
4816
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "
|
|
4840
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4817
4841
|
$location?: string | undefined;
|
|
4818
4842
|
};
|
|
4819
4843
|
} | undefined;
|
|
4820
4844
|
assignedTo?: {
|
|
4821
4845
|
type: "exact";
|
|
4822
4846
|
term: string | {
|
|
4823
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "
|
|
4847
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4824
4848
|
$location?: string | undefined;
|
|
4825
4849
|
};
|
|
4826
4850
|
} | undefined;
|
|
4827
4851
|
createdBy?: {
|
|
4828
4852
|
type: "exact";
|
|
4829
4853
|
term: string | {
|
|
4830
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "
|
|
4854
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4831
4855
|
$location?: string | undefined;
|
|
4832
4856
|
};
|
|
4833
4857
|
} | undefined;
|
|
@@ -4838,7 +4862,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4838
4862
|
updatedBy?: {
|
|
4839
4863
|
type: "exact";
|
|
4840
4864
|
term: string | {
|
|
4841
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "
|
|
4865
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4842
4866
|
$location?: string | undefined;
|
|
4843
4867
|
};
|
|
4844
4868
|
} | undefined;
|
|
@@ -4888,7 +4912,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4888
4912
|
'legalStatuses.DECLARED.createdAtLocation'?: {
|
|
4889
4913
|
type: "within";
|
|
4890
4914
|
location: string | {
|
|
4891
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "
|
|
4915
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4892
4916
|
$location?: string | undefined;
|
|
4893
4917
|
};
|
|
4894
4918
|
} | undefined;
|
|
@@ -4910,7 +4934,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4910
4934
|
'legalStatuses.REGISTERED.createdAtLocation'?: {
|
|
4911
4935
|
type: "within";
|
|
4912
4936
|
location: string | {
|
|
4913
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "
|
|
4937
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4914
4938
|
$location?: string | undefined;
|
|
4915
4939
|
};
|
|
4916
4940
|
} | undefined;
|
|
@@ -4925,47 +4949,47 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4925
4949
|
createdAtLocation?: {
|
|
4926
4950
|
type: "within";
|
|
4927
4951
|
location: string | {
|
|
4928
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "
|
|
4952
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4929
4953
|
$location?: string | undefined;
|
|
4930
4954
|
};
|
|
4931
4955
|
} | {
|
|
4932
4956
|
type: "exact";
|
|
4933
4957
|
term: string | {
|
|
4934
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "
|
|
4958
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4935
4959
|
$location?: string | undefined;
|
|
4936
4960
|
};
|
|
4937
4961
|
} | undefined;
|
|
4938
4962
|
updatedAtLocation?: {
|
|
4939
4963
|
type: "within";
|
|
4940
4964
|
location: string | {
|
|
4941
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "
|
|
4965
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4942
4966
|
$location?: string | undefined;
|
|
4943
4967
|
};
|
|
4944
4968
|
} | {
|
|
4945
4969
|
type: "exact";
|
|
4946
4970
|
term: string | {
|
|
4947
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "
|
|
4971
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4948
4972
|
$location?: string | undefined;
|
|
4949
4973
|
};
|
|
4950
4974
|
} | undefined;
|
|
4951
4975
|
updatedByUserRole?: {
|
|
4952
4976
|
type: "exact";
|
|
4953
4977
|
term: string | {
|
|
4954
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "
|
|
4978
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4955
4979
|
$location?: string | undefined;
|
|
4956
4980
|
};
|
|
4957
4981
|
} | undefined;
|
|
4958
4982
|
assignedTo?: {
|
|
4959
4983
|
type: "exact";
|
|
4960
4984
|
term: string | {
|
|
4961
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "
|
|
4985
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4962
4986
|
$location?: string | undefined;
|
|
4963
4987
|
};
|
|
4964
4988
|
} | undefined;
|
|
4965
4989
|
createdBy?: {
|
|
4966
4990
|
type: "exact";
|
|
4967
4991
|
term: string | {
|
|
4968
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "
|
|
4992
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4969
4993
|
$location?: string | undefined;
|
|
4970
4994
|
};
|
|
4971
4995
|
} | undefined;
|
|
@@ -4976,7 +5000,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4976
5000
|
updatedBy?: {
|
|
4977
5001
|
type: "exact";
|
|
4978
5002
|
term: string | {
|
|
4979
|
-
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "
|
|
5003
|
+
$userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
|
|
4980
5004
|
$location?: string | undefined;
|
|
4981
5005
|
};
|
|
4982
5006
|
} | 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>;
|
|
@@ -73,5 +73,26 @@ export declare function canAccessOtherUserWithScopes({ scopes, userToAccess, use
|
|
|
73
73
|
* One of the scopes must allow access for the event to be accessible.
|
|
74
74
|
*/
|
|
75
75
|
export declare function userCanAccessEventWithScopes(event: Partial<EventIndexWithAdministrativeHierarchy>, scopes: RecordScopeV2[], user: UserContext | SystemContext, customActionType?: string): boolean;
|
|
76
|
+
export declare function getAdministrativeAreaHierarchy(administrativeAreaId: string | undefined | null, administrativeAreas: Map<UUID, AdministrativeArea>): {
|
|
77
|
+
id: string & z.core.$brand<"UUID">;
|
|
78
|
+
name: string;
|
|
79
|
+
parentId: (string & z.core.$brand<"UUID">) | null;
|
|
80
|
+
validUntil: string | null;
|
|
81
|
+
externalId?: string | null | undefined;
|
|
82
|
+
}[];
|
|
83
|
+
/**
|
|
84
|
+
* Resolves a location or administrative area UUID into a root-first hierarchy of UUIDs.
|
|
85
|
+
*
|
|
86
|
+
* If the ID refers to a `Location` (e.g. CRVS office), the hierarchy includes
|
|
87
|
+
* the administrative area ancestors followed by the location itself.
|
|
88
|
+
* If the ID refers to an `AdministrativeArea`, returns the area's ancestor chain (root-first).
|
|
89
|
+
*
|
|
90
|
+
* Uses `getAdministrativeAreaHierarchy` which returns leaf-first order,
|
|
91
|
+
* so the result is reversed to match the root-first convention used by the server.
|
|
92
|
+
*/
|
|
93
|
+
export declare function getLocationHierarchy(selectedId: UUID, context: {
|
|
94
|
+
administrativeAreas: Map<UUID, AdministrativeArea>;
|
|
95
|
+
locations: Map<UUID, Location>;
|
|
96
|
+
}): UUID[];
|
|
76
97
|
export {};
|
|
77
98
|
//# sourceMappingURL=locations.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AdministrativeArea, Location } from './locations';
|
|
2
|
+
export declare const V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS: AdministrativeArea[];
|
|
3
|
+
export declare const V2_DEFAULT_MOCK_LOCATIONS: Location[];
|
|
4
|
+
export declare const V2_DEFAULT_MOCK_LOCATIONS_MAP: Map<string & import("zod").$brand<"UUID">, {
|
|
5
|
+
id: string & import("zod").$brand<"UUID">;
|
|
6
|
+
name: string;
|
|
7
|
+
administrativeAreaId: (string & import("zod").$brand<"UUID">) | null;
|
|
8
|
+
validUntil: string | null;
|
|
9
|
+
locationType: string | null;
|
|
10
|
+
externalId?: string | null | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP: Map<string & import("zod").$brand<"UUID">, {
|
|
13
|
+
id: string & import("zod").$brand<"UUID">;
|
|
14
|
+
name: string;
|
|
15
|
+
parentId: (string & import("zod").$brand<"UUID">) | null;
|
|
16
|
+
validUntil: string | null;
|
|
17
|
+
externalId?: string | null | undefined;
|
|
18
|
+
}>;
|
|
19
|
+
//# sourceMappingURL=mocks.test.utils.d.ts.map
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { DisplayableAction } from './ActionType';
|
|
2
|
-
import { EncodedScope } from '../scopes';
|
|
2
|
+
import { EncodedScope, UserScopeV2 } from '../scopes';
|
|
3
3
|
import { EventIndexWithAdministrativeHierarchy } from './locations';
|
|
4
4
|
import { UserContext } from '../users/User';
|
|
5
5
|
import { EventIndex } from './EventIndex';
|
|
6
|
+
import { UUID } from 'src/uuid';
|
|
6
7
|
export declare const ACTION_SCOPE_MAP: {
|
|
7
8
|
READ: "record.read"[];
|
|
8
9
|
CREATE: "record.create"[];
|
|
@@ -53,4 +54,26 @@ export declare function isActionInScope({ scopes, action, event, currentUser }:
|
|
|
53
54
|
event: EventIndexWithAdministrativeHierarchy;
|
|
54
55
|
currentUser: UserContext;
|
|
55
56
|
}): boolean;
|
|
57
|
+
/**
|
|
58
|
+
*
|
|
59
|
+
*
|
|
60
|
+
* @param allRoles - All possible roles in the system
|
|
61
|
+
* @param userLocation - The location and role information of the user whose role options are being determined
|
|
62
|
+
* @param acceptedScopes - The scopes of the user requesting the role update, used to determine which roles they can assign.
|
|
63
|
+
* @param userRequesting - The user context of the user requesting the role update, used to check location-based access to the target user's location.
|
|
64
|
+
*
|
|
65
|
+
* @returns An array of roles that the requesting user is allowed to assign to the target user based on their scopes and location
|
|
66
|
+
*
|
|
67
|
+
* 1) Used to determine which roles should be available in the dropdown when a user is editing another user's role in the user management interface.
|
|
68
|
+
* 2) Used to check if payload includes valid role.
|
|
69
|
+
*/
|
|
70
|
+
export declare function getAvailableRolesForUserUpdatePayload({ allRoles, userLocation, acceptedScopes, userRequesting }: {
|
|
71
|
+
allRoles: string[];
|
|
72
|
+
userRequesting: UserContext;
|
|
73
|
+
acceptedScopes: UserScopeV2[];
|
|
74
|
+
userLocation: {
|
|
75
|
+
administrativeHierarchy: UUID[];
|
|
76
|
+
primaryOfficeId: UUID;
|
|
77
|
+
};
|
|
78
|
+
}): string[];
|
|
56
79
|
//# sourceMappingURL=scopes.d.ts.map
|
package/dist/events/index.js
CHANGED
|
@@ -302,12 +302,14 @@ __export(events_exports, {
|
|
|
302
302
|
getActionConfig: () => getActionConfig,
|
|
303
303
|
getActionReview: () => getActionReview,
|
|
304
304
|
getActionReviewFields: () => getActionReviewFields,
|
|
305
|
+
getAdministrativeAreaHierarchy: () => getAdministrativeAreaHierarchy,
|
|
305
306
|
getAllUniqueFields: () => getAllUniqueFields,
|
|
306
307
|
getAnnotationFromDrafts: () => getAnnotationFromDrafts,
|
|
307
308
|
getAssignedUserFromActions: () => getAssignedUserFromActions,
|
|
308
309
|
getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
|
|
309
310
|
getAssignmentStatus: () => getAssignmentStatus,
|
|
310
311
|
getAvailableActionsForEvent: () => getAvailableActionsForEvent,
|
|
312
|
+
getAvailableRolesForUserUpdatePayload: () => getAvailableRolesForUserUpdatePayload,
|
|
311
313
|
getCompleteActionAnnotation: () => getCompleteActionAnnotation,
|
|
312
314
|
getCompleteActionDeclaration: () => getCompleteActionDeclaration,
|
|
313
315
|
getCurrentEventState: () => getCurrentEventState,
|
|
@@ -318,6 +320,7 @@ __export(events_exports, {
|
|
|
318
320
|
getDeclarationPages: () => getDeclarationPages,
|
|
319
321
|
getEventConfigById: () => getEventConfigById,
|
|
320
322
|
getFilePathsFromEvent: () => getFilePathsFromEvent,
|
|
323
|
+
getLocationHierarchy: () => getLocationHierarchy,
|
|
321
324
|
getMixedPath: () => getMixedPath,
|
|
322
325
|
getPendingAction: () => getPendingAction,
|
|
323
326
|
getPrintCertificatePages: () => getPrintCertificatePages,
|
|
@@ -10003,6 +10006,39 @@ function userCanAccessEventWithScopes(event2, scopes, user2, customActionType) {
|
|
|
10003
10006
|
(scope) => canAccessEventWithScope(event2, scope, user2, customActionType)
|
|
10004
10007
|
);
|
|
10005
10008
|
}
|
|
10009
|
+
function getAdministrativeAreaHierarchy(administrativeAreaId, administrativeAreas) {
|
|
10010
|
+
const collectedLocations = [];
|
|
10011
|
+
const parsedAdministrativeAreaId = administrativeAreaId && UUID.safeParse(administrativeAreaId).data;
|
|
10012
|
+
let current = parsedAdministrativeAreaId ? administrativeAreas.get(parsedAdministrativeAreaId) : null;
|
|
10013
|
+
while (current) {
|
|
10014
|
+
collectedLocations.push(current);
|
|
10015
|
+
if (!current.parentId) {
|
|
10016
|
+
break;
|
|
10017
|
+
}
|
|
10018
|
+
const parentId = current.parentId;
|
|
10019
|
+
current = administrativeAreas.get(parentId);
|
|
10020
|
+
}
|
|
10021
|
+
return collectedLocations;
|
|
10022
|
+
}
|
|
10023
|
+
function getLocationHierarchy(selectedId, context) {
|
|
10024
|
+
const { administrativeAreas, locations } = context;
|
|
10025
|
+
const loc = locations.get(selectedId);
|
|
10026
|
+
if (loc) {
|
|
10027
|
+
if (loc.administrativeAreaId) {
|
|
10028
|
+
const hierarchy2 = getAdministrativeAreaHierarchy(
|
|
10029
|
+
loc.administrativeAreaId,
|
|
10030
|
+
administrativeAreas
|
|
10031
|
+
);
|
|
10032
|
+
return [...hierarchy2.reverse().map((area) => area.id), loc.id];
|
|
10033
|
+
}
|
|
10034
|
+
return [loc.id];
|
|
10035
|
+
}
|
|
10036
|
+
const hierarchy = getAdministrativeAreaHierarchy(
|
|
10037
|
+
selectedId,
|
|
10038
|
+
administrativeAreas
|
|
10039
|
+
);
|
|
10040
|
+
return hierarchy.reverse().map((area) => area.id);
|
|
10041
|
+
}
|
|
10006
10042
|
|
|
10007
10043
|
// ../commons/src/events/scopes.ts
|
|
10008
10044
|
var ACTION_SCOPE_MAP = {
|
|
@@ -10077,6 +10113,25 @@ function isActionInScope({
|
|
|
10077
10113
|
);
|
|
10078
10114
|
return canAccess;
|
|
10079
10115
|
}
|
|
10116
|
+
function getAvailableRolesForUserUpdatePayload({
|
|
10117
|
+
allRoles,
|
|
10118
|
+
userLocation,
|
|
10119
|
+
acceptedScopes,
|
|
10120
|
+
userRequesting
|
|
10121
|
+
}) {
|
|
10122
|
+
const availableRoles = allRoles.filter((role) => {
|
|
10123
|
+
const canAccess = canAccessOtherUserWithScopes({
|
|
10124
|
+
userToAccess: {
|
|
10125
|
+
...userLocation,
|
|
10126
|
+
role
|
|
10127
|
+
},
|
|
10128
|
+
user: userRequesting,
|
|
10129
|
+
scopes: acceptedScopes
|
|
10130
|
+
});
|
|
10131
|
+
return canAccess;
|
|
10132
|
+
});
|
|
10133
|
+
return availableRoles;
|
|
10134
|
+
}
|
|
10080
10135
|
|
|
10081
10136
|
// ../commons/src/events/serializers/user/deserializer.ts
|
|
10082
10137
|
function userDeserializer(serializedUserField, user2) {
|
|
@@ -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"}
|