@opencrvs/toolkit 2.0.0-rc.b63fd2e → 2.0.0-rc.ba07891

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.
Files changed (37) hide show
  1. package/create-countryconfig/index.js +73 -0
  2. package/create-countryconfig/package.json +11 -0
  3. package/dist/application-config/index.js +41 -11
  4. package/dist/cli.js +334 -140
  5. package/dist/commons/api/router.d.ts +55 -54
  6. package/dist/commons/application-config/index.d.ts +16 -4
  7. package/dist/commons/conditionals/conditionals.d.ts +6 -6
  8. package/dist/commons/events/FieldConfig.d.ts +10 -0
  9. package/dist/commons/events/locations.d.ts +38 -1
  10. package/dist/commons/events/mocks.test.utils.d.ts +19 -0
  11. package/dist/commons/events/scopes.d.ts +24 -1
  12. package/dist/conditionals/index.js +37 -7
  13. package/dist/events/index.js +130 -7
  14. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
  15. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +60 -35
  16. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
  17. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  18. package/dist/migrations/v2.0/checkout-upstream-files.js +1 -2
  19. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +9 -1
  20. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -1
  21. package/dist/migrations/v2.0/delete-infrastructure-directory.js +66 -20
  22. package/dist/migrations/v2.0/index.d.ts +5 -3
  23. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  24. package/dist/migrations/v2.0/index.js +334 -140
  25. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
  26. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +90 -1
  27. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +11 -1
  28. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -1
  29. package/dist/migrations/v2.0/merge-infrastructure-directory.js +17 -16
  30. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
  31. package/dist/migrations/v2.0/migrate-workqueue-configs.js +140 -59
  32. package/dist/notification/index.js +37 -7
  33. package/dist/scopes/index.d.ts +87 -10
  34. package/dist/scopes/index.js +43 -8
  35. package/opencrvs-toolkit-2.0.0-rc.ba07891.tgz +0 -0
  36. package/package.json +1 -1
  37. package/opencrvs-toolkit-2.0.0-rc.b63fd2e.tgz +0 -0
@@ -3975,10 +3975,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
3975
3975
  output: {
3976
3976
  id: string & import("zod").$brand<"UUID">;
3977
3977
  name: {
3978
- use: string;
3979
- given: string[];
3980
- family: string;
3981
- }[];
3978
+ firstname: string;
3979
+ surname: string;
3980
+ };
3982
3981
  role: string;
3983
3982
  primaryOfficeId: string & import("zod").$brand<"UUID">;
3984
3983
  type: "user";
@@ -4008,10 +4007,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4008
4007
  create: import("@trpc/server").TRPCMutationProcedure<{
4009
4008
  input: {
4010
4009
  name: {
4011
- use: string;
4012
- given: string[];
4013
- family: string;
4014
- }[];
4010
+ firstname: string;
4011
+ surname: string;
4012
+ };
4015
4013
  role: string;
4016
4014
  primaryOfficeId: string;
4017
4015
  data?: Record<string, unknown> | undefined;
@@ -4020,6 +4018,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4020
4018
  email?: string | undefined;
4021
4019
  mobile?: string | undefined;
4022
4020
  username?: undefined;
4021
+ password?: undefined;
4023
4022
  signature?: {
4024
4023
  path: string;
4025
4024
  originalFilename: string;
@@ -4029,10 +4028,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4029
4028
  output: {
4030
4029
  id: string & import("zod").$brand<"UUID">;
4031
4030
  name: {
4032
- use: string;
4033
- given: string[];
4034
- family: string;
4035
- }[];
4031
+ firstname: string;
4032
+ surname: string;
4033
+ };
4036
4034
  role: string;
4037
4035
  primaryOfficeId: string & import("zod").$brand<"UUID">;
4038
4036
  type: "user";
@@ -4053,10 +4051,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4053
4051
  id: string;
4054
4052
  data?: Record<string, unknown> | undefined;
4055
4053
  name?: {
4056
- use: string;
4057
- given: string[];
4058
- family: string;
4059
- }[] | undefined;
4054
+ firstname: string;
4055
+ surname: string;
4056
+ } | undefined;
4060
4057
  role?: string | undefined;
4061
4058
  fullHonorificName?: string | undefined;
4062
4059
  device?: string | undefined;
@@ -4069,16 +4066,13 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4069
4066
  type: string;
4070
4067
  } | undefined;
4071
4068
  status?: "active" | "deactivated" | undefined;
4072
- } & {
4073
- id: string;
4074
4069
  };
4075
4070
  output: {
4076
4071
  id: string & import("zod").$brand<"UUID">;
4077
4072
  name: {
4078
- use: string;
4079
- given: string[];
4080
- family: string;
4081
- }[];
4073
+ firstname: string;
4074
+ surname: string;
4075
+ };
4082
4076
  role: string;
4083
4077
  primaryOfficeId: string & import("zod").$brand<"UUID">;
4084
4078
  type: "user";
@@ -4099,10 +4093,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4099
4093
  output: ({
4100
4094
  id: string & import("zod").$brand<"UUID">;
4101
4095
  name: {
4102
- use: string;
4103
- given: string[];
4104
- family: string;
4105
- }[];
4096
+ firstname: string;
4097
+ surname: string;
4098
+ };
4106
4099
  role: string;
4107
4100
  primaryOfficeId: string & import("zod").$brand<"UUID">;
4108
4101
  type: "user";
@@ -4144,10 +4137,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4144
4137
  output: ({
4145
4138
  id: string & import("zod").$brand<"UUID">;
4146
4139
  name: {
4147
- use: string;
4148
- given: string[];
4149
- family: string;
4150
- }[];
4140
+ firstname: string;
4141
+ surname: string;
4142
+ };
4151
4143
  role: string;
4152
4144
  primaryOfficeId: string & import("zod").$brand<"UUID">;
4153
4145
  type: "user";
@@ -4283,10 +4275,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4283
4275
  changeAvatar: import("@trpc/server").TRPCMutationProcedure<{
4284
4276
  input: {
4285
4277
  userId: string;
4286
- avatar: {
4287
- type: string;
4288
- data: string;
4289
- };
4278
+ avatar: string;
4290
4279
  };
4291
4280
  output: void;
4292
4281
  meta: import("trpc-to-openapi").OpenApiMeta;
@@ -4318,6 +4307,18 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4318
4307
  output: void;
4319
4308
  meta: import("trpc-to-openapi").OpenApiMeta;
4320
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
+ }>;
4321
4322
  audit: import("@trpc/server").TRPCBuiltRouter<{
4322
4323
  ctx: Partial<{
4323
4324
  token: `Bearer ${string}`;
@@ -4773,7 +4774,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4773
4774
  'legalStatuses.DECLARED.createdAtLocation'?: {
4774
4775
  type: "within";
4775
4776
  location: string | {
4776
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4777
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4777
4778
  $location?: string | undefined;
4778
4779
  };
4779
4780
  } | undefined;
@@ -4795,7 +4796,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4795
4796
  'legalStatuses.REGISTERED.createdAtLocation'?: {
4796
4797
  type: "within";
4797
4798
  location: string | {
4798
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4799
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4799
4800
  $location?: string | undefined;
4800
4801
  };
4801
4802
  } | undefined;
@@ -4810,47 +4811,47 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4810
4811
  createdAtLocation?: {
4811
4812
  type: "within";
4812
4813
  location: string | {
4813
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4814
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4814
4815
  $location?: string | undefined;
4815
4816
  };
4816
4817
  } | {
4817
4818
  type: "exact";
4818
4819
  term: string | {
4819
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4820
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4820
4821
  $location?: string | undefined;
4821
4822
  };
4822
4823
  } | undefined;
4823
4824
  updatedAtLocation?: {
4824
4825
  type: "within";
4825
4826
  location: string | {
4826
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4827
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4827
4828
  $location?: string | undefined;
4828
4829
  };
4829
4830
  } | {
4830
4831
  type: "exact";
4831
4832
  term: string | {
4832
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4833
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4833
4834
  $location?: string | undefined;
4834
4835
  };
4835
4836
  } | undefined;
4836
4837
  updatedByUserRole?: {
4837
4838
  type: "exact";
4838
4839
  term: string | {
4839
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4840
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4840
4841
  $location?: string | undefined;
4841
4842
  };
4842
4843
  } | undefined;
4843
4844
  assignedTo?: {
4844
4845
  type: "exact";
4845
4846
  term: string | {
4846
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4847
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4847
4848
  $location?: string | undefined;
4848
4849
  };
4849
4850
  } | undefined;
4850
4851
  createdBy?: {
4851
4852
  type: "exact";
4852
4853
  term: string | {
4853
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4854
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4854
4855
  $location?: string | undefined;
4855
4856
  };
4856
4857
  } | undefined;
@@ -4861,7 +4862,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4861
4862
  updatedBy?: {
4862
4863
  type: "exact";
4863
4864
  term: string | {
4864
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4865
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4865
4866
  $location?: string | undefined;
4866
4867
  };
4867
4868
  } | undefined;
@@ -4911,7 +4912,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4911
4912
  'legalStatuses.DECLARED.createdAtLocation'?: {
4912
4913
  type: "within";
4913
4914
  location: string | {
4914
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4915
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4915
4916
  $location?: string | undefined;
4916
4917
  };
4917
4918
  } | undefined;
@@ -4933,7 +4934,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4933
4934
  'legalStatuses.REGISTERED.createdAtLocation'?: {
4934
4935
  type: "within";
4935
4936
  location: string | {
4936
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4937
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4937
4938
  $location?: string | undefined;
4938
4939
  };
4939
4940
  } | undefined;
@@ -4948,47 +4949,47 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4948
4949
  createdAtLocation?: {
4949
4950
  type: "within";
4950
4951
  location: string | {
4951
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4952
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4952
4953
  $location?: string | undefined;
4953
4954
  };
4954
4955
  } | {
4955
4956
  type: "exact";
4956
4957
  term: string | {
4957
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4958
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4958
4959
  $location?: string | undefined;
4959
4960
  };
4960
4961
  } | undefined;
4961
4962
  updatedAtLocation?: {
4962
4963
  type: "within";
4963
4964
  location: string | {
4964
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4965
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4965
4966
  $location?: string | undefined;
4966
4967
  };
4967
4968
  } | {
4968
4969
  type: "exact";
4969
4970
  term: string | {
4970
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4971
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4971
4972
  $location?: string | undefined;
4972
4973
  };
4973
4974
  } | undefined;
4974
4975
  updatedByUserRole?: {
4975
4976
  type: "exact";
4976
4977
  term: string | {
4977
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4978
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4978
4979
  $location?: string | undefined;
4979
4980
  };
4980
4981
  } | undefined;
4981
4982
  assignedTo?: {
4982
4983
  type: "exact";
4983
4984
  term: string | {
4984
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4985
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4985
4986
  $location?: string | undefined;
4986
4987
  };
4987
4988
  } | undefined;
4988
4989
  createdBy?: {
4989
4990
  type: "exact";
4990
4991
  term: string | {
4991
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4992
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4992
4993
  $location?: string | undefined;
4993
4994
  };
4994
4995
  } | undefined;
@@ -4999,7 +5000,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4999
5000
  updatedBy?: {
5000
5001
  type: "exact";
5001
5002
  term: string | {
5002
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
5003
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
5003
5004
  $location?: string | undefined;
5004
5005
  };
5005
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.ZodString;
28
- INFORMANT_NOTIFICATION_DELIVERY_METHOD: z.ZodString;
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.ZodString;
50
- INFORMANT_NOTIFICATION_DELIVERY_METHOD: z.ZodString;
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,11 +52,47 @@ 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
  *
57
73
  * One of the scopes must allow access for the event to be accessible.
58
74
  */
59
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[];
60
97
  export {};
61
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