@opencrvs/toolkit 2.0.0-rc.4ac5bfa → 2.0.0-rc.5a0ce95

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.
@@ -656,10 +656,6 @@ var scopeByEvent = z11.preprocess(
656
656
  (val) => val === void 0 ? void 0 : [val].flat(),
657
657
  z11.array(z11.string()).optional()
658
658
  ).describe("Event type, e.g. birth, death");
659
- var userRole = z11.preprocess(
660
- (val) => val === void 0 ? void 0 : [val].flat(),
661
- z11.array(z11.string()).optional()
662
- ).describe("User role, e.g. admin, field agent");
663
659
  var scopeOptionsPlaceEvent = z11.object({
664
660
  event: scopeByEvent,
665
661
  placeOfEvent: JurisdictionFilter.optional()
@@ -683,9 +679,6 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
683
679
  var AccessLevelOptions = z11.object({
684
680
  accessLevel: JurisdictionFilter.optional()
685
681
  });
686
- var AllUserScopeOptions = AccessLevelOptions.extend({
687
- role: userRole.optional()
688
- });
689
682
  var WorkqueueOrDashboardOptions = z11.object({
690
683
  ids: z11.preprocess(
691
684
  (val) => val === void 0 ? void 0 : [val].flat(),
@@ -695,7 +688,6 @@ var WorkqueueOrDashboardOptions = z11.object({
695
688
  var AllScopeOptions = z11.object({
696
689
  ...AllRecordScopeOptions.shape,
697
690
  ...AccessLevelOptions.shape,
698
- ...AllUserScopeOptions.shape,
699
691
  ...WorkqueueOrDashboardOptions.shape
700
692
  });
701
693
  var ScopeOptionKey = AllScopeOptions.keyof();
@@ -768,28 +760,6 @@ var RecordScopeV2 = z11.discriminatedUnion("type", [
768
760
  ]).describe(
769
761
  "Scopes used to check user's permission to perform actions on a record."
770
762
  );
771
- var SystemScopeType = z11.enum([
772
- "organisation.read-locations",
773
- "user.read",
774
- "user.create",
775
- "user.edit"
776
- ]);
777
- var UserScopeType = SystemScopeType.extract([
778
- "user.read",
779
- "user.create",
780
- "user.edit"
781
- ]);
782
- var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
783
- var UserScopeV2 = z11.discriminatedUnion("type", [
784
- z11.object({
785
- type: ScopesWithRoleOption,
786
- options: AllUserScopeOptions.optional()
787
- }),
788
- z11.object({
789
- type: UserScopeType.extract(["user.read"]),
790
- options: AccessLevelOptions.optional()
791
- })
792
- ]);
793
763
  var ResolvedRecordScopeV2 = z11.discriminatedUnion("type", [
794
764
  z11.object({
795
765
  type: ScopesWithPlaceEventOptions,
@@ -810,14 +780,16 @@ var ResolvedRecordScopeV2 = z11.discriminatedUnion("type", [
810
780
  }).optional()
811
781
  })
812
782
  ]).describe("Resolved scope with location/user IDs instead of filters.");
783
+ var SystemScopeType = z11.enum([
784
+ "organisation.read-locations",
785
+ "user.read",
786
+ "user.create",
787
+ "user.edit"
788
+ ]);
813
789
  var Scope = z11.discriminatedUnion("type", [
814
790
  z11.object({ type: PlainScopeType }),
815
791
  ...RecordScopeV2.options,
816
- ...UserScopeV2.options,
817
- z11.object({
818
- type: z11.literal("organisation.read-locations"),
819
- options: AccessLevelOptions.optional()
820
- }),
792
+ z11.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
821
793
  z11.object({
822
794
  type: z11.literal("workqueue"),
823
795
  options: WorkqueueOrDashboardOptions
package/dist/cli.js CHANGED
@@ -2110,10 +2110,6 @@ var scopeByEvent = z3.preprocess(
2110
2110
  (val) => val === void 0 ? void 0 : [val].flat(),
2111
2111
  z3.array(z3.string()).optional()
2112
2112
  ).describe("Event type, e.g. birth, death");
2113
- var userRole = z3.preprocess(
2114
- (val) => val === void 0 ? void 0 : [val].flat(),
2115
- z3.array(z3.string()).optional()
2116
- ).describe("User role, e.g. admin, field agent");
2117
2113
  var scopeOptionsPlaceEvent = z3.object({
2118
2114
  event: scopeByEvent,
2119
2115
  placeOfEvent: JurisdictionFilter.optional()
@@ -2137,9 +2133,6 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
2137
2133
  var AccessLevelOptions = z3.object({
2138
2134
  accessLevel: JurisdictionFilter.optional()
2139
2135
  });
2140
- var AllUserScopeOptions = AccessLevelOptions.extend({
2141
- role: userRole.optional()
2142
- });
2143
2136
  var WorkqueueOrDashboardOptions = z3.object({
2144
2137
  ids: z3.preprocess(
2145
2138
  (val) => val === void 0 ? void 0 : [val].flat(),
@@ -2149,7 +2142,6 @@ var WorkqueueOrDashboardOptions = z3.object({
2149
2142
  var AllScopeOptions = z3.object({
2150
2143
  ...AllRecordScopeOptions.shape,
2151
2144
  ...AccessLevelOptions.shape,
2152
- ...AllUserScopeOptions.shape,
2153
2145
  ...WorkqueueOrDashboardOptions.shape
2154
2146
  });
2155
2147
  var ScopeOptionKey = AllScopeOptions.keyof();
@@ -2222,28 +2214,6 @@ var RecordScopeV2 = z3.discriminatedUnion("type", [
2222
2214
  ]).describe(
2223
2215
  "Scopes used to check user's permission to perform actions on a record."
2224
2216
  );
2225
- var SystemScopeType = z3.enum([
2226
- "organisation.read-locations",
2227
- "user.read",
2228
- "user.create",
2229
- "user.edit"
2230
- ]);
2231
- var UserScopeType = SystemScopeType.extract([
2232
- "user.read",
2233
- "user.create",
2234
- "user.edit"
2235
- ]);
2236
- var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
2237
- var UserScopeV2 = z3.discriminatedUnion("type", [
2238
- z3.object({
2239
- type: ScopesWithRoleOption,
2240
- options: AllUserScopeOptions.optional()
2241
- }),
2242
- z3.object({
2243
- type: UserScopeType.extract(["user.read"]),
2244
- options: AccessLevelOptions.optional()
2245
- })
2246
- ]);
2247
2217
  var ResolvedRecordScopeV2 = z3.discriminatedUnion("type", [
2248
2218
  z3.object({
2249
2219
  type: ScopesWithPlaceEventOptions,
@@ -2264,14 +2234,16 @@ var ResolvedRecordScopeV2 = z3.discriminatedUnion("type", [
2264
2234
  }).optional()
2265
2235
  })
2266
2236
  ]).describe("Resolved scope with location/user IDs instead of filters.");
2237
+ var SystemScopeType = z3.enum([
2238
+ "organisation.read-locations",
2239
+ "user.read",
2240
+ "user.create",
2241
+ "user.edit"
2242
+ ]);
2267
2243
  var Scope2 = z3.discriminatedUnion("type", [
2268
2244
  z3.object({ type: PlainScopeType }),
2269
2245
  ...RecordScopeV2.options,
2270
- ...UserScopeV2.options,
2271
- z3.object({
2272
- type: z3.literal("organisation.read-locations"),
2273
- options: AccessLevelOptions.optional()
2274
- }),
2246
+ z3.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
2275
2247
  z3.object({
2276
2248
  type: z3.literal("workqueue"),
2277
2249
  options: WorkqueueOrDashboardOptions
@@ -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";
@@ -4773,7 +4765,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4773
4765
  'legalStatuses.DECLARED.createdAtLocation'?: {
4774
4766
  type: "within";
4775
4767
  location: string | {
4776
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4768
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4777
4769
  $location?: string | undefined;
4778
4770
  };
4779
4771
  } | undefined;
@@ -4795,7 +4787,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4795
4787
  'legalStatuses.REGISTERED.createdAtLocation'?: {
4796
4788
  type: "within";
4797
4789
  location: string | {
4798
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4790
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4799
4791
  $location?: string | undefined;
4800
4792
  };
4801
4793
  } | undefined;
@@ -4810,47 +4802,47 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4810
4802
  createdAtLocation?: {
4811
4803
  type: "within";
4812
4804
  location: string | {
4813
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4805
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4814
4806
  $location?: string | undefined;
4815
4807
  };
4816
4808
  } | {
4817
4809
  type: "exact";
4818
4810
  term: string | {
4819
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4811
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4820
4812
  $location?: string | undefined;
4821
4813
  };
4822
4814
  } | undefined;
4823
4815
  updatedAtLocation?: {
4824
4816
  type: "within";
4825
4817
  location: string | {
4826
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4818
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4827
4819
  $location?: string | undefined;
4828
4820
  };
4829
4821
  } | {
4830
4822
  type: "exact";
4831
4823
  term: string | {
4832
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4824
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4833
4825
  $location?: string | undefined;
4834
4826
  };
4835
4827
  } | undefined;
4836
4828
  updatedByUserRole?: {
4837
4829
  type: "exact";
4838
4830
  term: string | {
4839
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4831
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4840
4832
  $location?: string | undefined;
4841
4833
  };
4842
4834
  } | undefined;
4843
4835
  assignedTo?: {
4844
4836
  type: "exact";
4845
4837
  term: string | {
4846
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4838
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4847
4839
  $location?: string | undefined;
4848
4840
  };
4849
4841
  } | undefined;
4850
4842
  createdBy?: {
4851
4843
  type: "exact";
4852
4844
  term: string | {
4853
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4845
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4854
4846
  $location?: string | undefined;
4855
4847
  };
4856
4848
  } | undefined;
@@ -4861,7 +4853,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4861
4853
  updatedBy?: {
4862
4854
  type: "exact";
4863
4855
  term: string | {
4864
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4856
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4865
4857
  $location?: string | undefined;
4866
4858
  };
4867
4859
  } | undefined;
@@ -4911,7 +4903,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4911
4903
  'legalStatuses.DECLARED.createdAtLocation'?: {
4912
4904
  type: "within";
4913
4905
  location: string | {
4914
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4906
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4915
4907
  $location?: string | undefined;
4916
4908
  };
4917
4909
  } | undefined;
@@ -4933,7 +4925,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4933
4925
  'legalStatuses.REGISTERED.createdAtLocation'?: {
4934
4926
  type: "within";
4935
4927
  location: string | {
4936
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4928
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4937
4929
  $location?: string | undefined;
4938
4930
  };
4939
4931
  } | undefined;
@@ -4948,47 +4940,47 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4948
4940
  createdAtLocation?: {
4949
4941
  type: "within";
4950
4942
  location: string | {
4951
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4943
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4952
4944
  $location?: string | undefined;
4953
4945
  };
4954
4946
  } | {
4955
4947
  type: "exact";
4956
4948
  term: string | {
4957
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4949
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4958
4950
  $location?: string | undefined;
4959
4951
  };
4960
4952
  } | undefined;
4961
4953
  updatedAtLocation?: {
4962
4954
  type: "within";
4963
4955
  location: string | {
4964
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4956
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4965
4957
  $location?: string | undefined;
4966
4958
  };
4967
4959
  } | {
4968
4960
  type: "exact";
4969
4961
  term: string | {
4970
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4962
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4971
4963
  $location?: string | undefined;
4972
4964
  };
4973
4965
  } | undefined;
4974
4966
  updatedByUserRole?: {
4975
4967
  type: "exact";
4976
4968
  term: string | {
4977
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4969
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4978
4970
  $location?: string | undefined;
4979
4971
  };
4980
4972
  } | undefined;
4981
4973
  assignedTo?: {
4982
4974
  type: "exact";
4983
4975
  term: string | {
4984
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4976
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4985
4977
  $location?: string | undefined;
4986
4978
  };
4987
4979
  } | undefined;
4988
4980
  createdBy?: {
4989
4981
  type: "exact";
4990
4982
  term: string | {
4991
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4983
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4992
4984
  $location?: string | undefined;
4993
4985
  };
4994
4986
  } | undefined;
@@ -4999,7 +4991,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4999
4991
  updatedBy?: {
5000
4992
  type: "exact";
5001
4993
  term: string | {
5002
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4994
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
5003
4995
  $location?: string | undefined;
5004
4996
  };
5005
4997
  } | undefined;
@@ -87,16 +87,16 @@ export declare const user: typeof userSerializer & {
87
87
  scope: (scope: import("../scopes").ScopeType) => {
88
88
  attribute: (option: import("../scopes").ScopeOptionKey) => {
89
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: "role" | "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
90
+ $option: "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
91
91
  };
92
92
  };
93
93
  jurisdiction: (jurisdiction: import("../scopes").JurisdictionFilter | {
94
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: "role" | "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
95
+ $option: "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
96
96
  }) => {
97
97
  $jurisdiction: "administrativeArea" | "location" | "all" | {
98
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: "role" | "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
99
+ $option: "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
100
100
  };
101
101
  };
102
102
  };
@@ -1727,7 +1727,6 @@ declare const AdministrativeAreaField: z.ZodObject<{
1727
1727
  "dashboard.view": "dashboard.view";
1728
1728
  }>;
1729
1729
  $option: z.ZodEnum<{
1730
- role: "role";
1731
1730
  event: "event";
1732
1731
  placeOfEvent: "placeOfEvent";
1733
1732
  declaredIn: "declaredIn";
@@ -1846,7 +1845,6 @@ declare const LocationInput: z.ZodObject<{
1846
1845
  "dashboard.view": "dashboard.view";
1847
1846
  }>;
1848
1847
  $option: z.ZodEnum<{
1849
- role: "role";
1850
1848
  event: "event";
1851
1849
  placeOfEvent: "placeOfEvent";
1852
1850
  declaredIn: "declaredIn";
@@ -2030,7 +2028,6 @@ declare const Facility: z.ZodObject<{
2030
2028
  "dashboard.view": "dashboard.view";
2031
2029
  }>;
2032
2030
  $option: z.ZodEnum<{
2033
- role: "role";
2034
2031
  event: "event";
2035
2032
  placeOfEvent: "placeOfEvent";
2036
2033
  declaredIn: "declaredIn";
@@ -2135,7 +2132,6 @@ declare const Office: z.ZodObject<{
2135
2132
  "dashboard.view": "dashboard.view";
2136
2133
  }>;
2137
2134
  $option: z.ZodEnum<{
2138
- role: "role";
2139
2135
  event: "event";
2140
2136
  placeOfEvent: "placeOfEvent";
2141
2137
  declaredIn: "declaredIn";
@@ -2327,7 +2323,6 @@ declare const Address: z.ZodObject<{
2327
2323
  "dashboard.view": "dashboard.view";
2328
2324
  }>;
2329
2325
  $option: z.ZodEnum<{
2330
- role: "role";
2331
2326
  event: "event";
2332
2327
  placeOfEvent: "placeOfEvent";
2333
2328
  declaredIn: "declaredIn";
@@ -1,8 +1,7 @@
1
- import { UUID } from '../uuid';
2
1
  import * as z from 'zod/v4';
3
2
  import { EventIndex } from './EventIndex';
4
3
  import { ActionCreationMetadata, RegistrationCreationMetadata } from './EventMetadata';
5
- import { RecordScopeV2, UserScopeV2 } from '../scopes';
4
+ import { RecordScopeV2 } from '../scopes';
6
5
  import { SystemContext, UserContext } from '../users/User';
7
6
  /** @deprecated Moving on, location types are arbitrary and defined by the country config. */
8
7
  export declare const LocationTypeV1: z.ZodEnum<{
@@ -52,21 +51,6 @@ export type EventIndexWithAdministrativeHierarchy = Omit<ToArrayFields<EventInde
52
51
  *
53
52
  */
54
53
  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;
70
54
  /**
71
55
  * Given indexed event and list of resolved scopes, determine if any of the scopes allow access to the event.
72
56
  *
@@ -182,10 +182,6 @@ 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");
189
185
  var scopeOptionsPlaceEvent = z6.object({
190
186
  event: scopeByEvent,
191
187
  placeOfEvent: JurisdictionFilter.optional()
@@ -209,9 +205,6 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
209
205
  var AccessLevelOptions = z6.object({
210
206
  accessLevel: JurisdictionFilter.optional()
211
207
  });
212
- var AllUserScopeOptions = AccessLevelOptions.extend({
213
- role: userRole.optional()
214
- });
215
208
  var WorkqueueOrDashboardOptions = z6.object({
216
209
  ids: z6.preprocess(
217
210
  (val) => val === void 0 ? void 0 : [val].flat(),
@@ -221,7 +214,6 @@ var WorkqueueOrDashboardOptions = z6.object({
221
214
  var AllScopeOptions = z6.object({
222
215
  ...AllRecordScopeOptions.shape,
223
216
  ...AccessLevelOptions.shape,
224
- ...AllUserScopeOptions.shape,
225
217
  ...WorkqueueOrDashboardOptions.shape
226
218
  });
227
219
  var ScopeOptionKey = AllScopeOptions.keyof();
@@ -294,28 +286,6 @@ var RecordScopeV2 = z6.discriminatedUnion("type", [
294
286
  ]).describe(
295
287
  "Scopes used to check user's permission to perform actions on a record."
296
288
  );
297
- var SystemScopeType = z6.enum([
298
- "organisation.read-locations",
299
- "user.read",
300
- "user.create",
301
- "user.edit"
302
- ]);
303
- var UserScopeType = SystemScopeType.extract([
304
- "user.read",
305
- "user.create",
306
- "user.edit"
307
- ]);
308
- var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
309
- var UserScopeV2 = z6.discriminatedUnion("type", [
310
- z6.object({
311
- type: ScopesWithRoleOption,
312
- options: AllUserScopeOptions.optional()
313
- }),
314
- z6.object({
315
- type: UserScopeType.extract(["user.read"]),
316
- options: AccessLevelOptions.optional()
317
- })
318
- ]);
319
289
  var ResolvedRecordScopeV2 = z6.discriminatedUnion("type", [
320
290
  z6.object({
321
291
  type: ScopesWithPlaceEventOptions,
@@ -336,14 +306,16 @@ var ResolvedRecordScopeV2 = z6.discriminatedUnion("type", [
336
306
  }).optional()
337
307
  })
338
308
  ]).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
+ ]);
339
315
  var Scope2 = z6.discriminatedUnion("type", [
340
316
  z6.object({ type: PlainScopeType }),
341
317
  ...RecordScopeV2.options,
342
- ...UserScopeV2.options,
343
- z6.object({
344
- type: z6.literal("organisation.read-locations"),
345
- options: AccessLevelOptions.optional()
346
- }),
318
+ z6.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
347
319
  z6.object({
348
320
  type: z6.literal("workqueue"),
349
321
  options: WorkqueueOrDashboardOptions
@@ -243,8 +243,6 @@ __export(events_exports, {
243
243
  areConditionsMet: () => areConditionsMet,
244
244
  buildFormState: () => buildFormState,
245
245
  canAccessEventWithScope: () => canAccessEventWithScope,
246
- canAccessOtherUserWithScopes: () => canAccessOtherUserWithScopes,
247
- canAccessUserWithScope: () => canAccessUserWithScope,
248
246
  compositeFieldTypes: () => compositeFieldTypes,
249
247
  createEmptyDraft: () => createEmptyDraft,
250
248
  createFieldConditionals: () => createFieldConditionals,
@@ -491,10 +489,6 @@ var scopeByEvent = z2.preprocess(
491
489
  (val) => val === void 0 ? void 0 : [val].flat(),
492
490
  z2.array(z2.string()).optional()
493
491
  ).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");
498
492
  var scopeOptionsPlaceEvent = z2.object({
499
493
  event: scopeByEvent,
500
494
  placeOfEvent: JurisdictionFilter.optional()
@@ -518,9 +512,6 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
518
512
  var AccessLevelOptions = z2.object({
519
513
  accessLevel: JurisdictionFilter.optional()
520
514
  });
521
- var AllUserScopeOptions = AccessLevelOptions.extend({
522
- role: userRole.optional()
523
- });
524
515
  var WorkqueueOrDashboardOptions = z2.object({
525
516
  ids: z2.preprocess(
526
517
  (val) => val === void 0 ? void 0 : [val].flat(),
@@ -530,7 +521,6 @@ var WorkqueueOrDashboardOptions = z2.object({
530
521
  var AllScopeOptions = z2.object({
531
522
  ...AllRecordScopeOptions.shape,
532
523
  ...AccessLevelOptions.shape,
533
- ...AllUserScopeOptions.shape,
534
524
  ...WorkqueueOrDashboardOptions.shape
535
525
  });
536
526
  var ScopeOptionKey = AllScopeOptions.keyof();
@@ -603,31 +593,6 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
603
593
  ]).describe(
604
594
  "Scopes used to check user's permission to perform actions on a record."
605
595
  );
606
- var SystemScopeType = z2.enum([
607
- "organisation.read-locations",
608
- "user.read",
609
- "user.create",
610
- "user.edit"
611
- ]);
612
- var UserScopeType = SystemScopeType.extract([
613
- "user.read",
614
- "user.create",
615
- "user.edit"
616
- ]);
617
- var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
618
- var UserScopeV2 = z2.discriminatedUnion("type", [
619
- z2.object({
620
- type: ScopesWithRoleOption,
621
- options: AllUserScopeOptions.optional()
622
- }),
623
- z2.object({
624
- type: UserScopeType.extract(["user.read"]),
625
- options: AccessLevelOptions.optional()
626
- })
627
- ]);
628
- function scopeUsesRoleOptions(scope) {
629
- return ScopesWithRoleOption?.options.some((opt) => opt === scope.type);
630
- }
631
596
  function scopeUsesDeclaredOptions(scope) {
632
597
  return !ScopesWithPlaceEventOptions.options.some((opt) => opt === scope.type);
633
598
  }
@@ -660,14 +625,16 @@ var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
660
625
  }).optional()
661
626
  })
662
627
  ]).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
+ ]);
663
634
  var Scope = z2.discriminatedUnion("type", [
664
635
  z2.object({ type: PlainScopeType }),
665
636
  ...RecordScopeV2.options,
666
- ...UserScopeV2.options,
667
- z2.object({
668
- type: z2.literal("organisation.read-locations"),
669
- options: AccessLevelOptions.optional()
670
- }),
637
+ z2.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
671
638
  z2.object({
672
639
  type: z2.literal("workqueue"),
673
640
  options: WorkqueueOrDashboardOptions
@@ -9963,39 +9930,6 @@ function canAccessEventWithScope(event2, scope, user2, customActionType) {
9963
9930
  }
9964
9931
  return true;
9965
9932
  }
9966
- function canAccessUserWithScope({
9967
- userToAccess,
9968
- scope,
9969
- user: user2
9970
- }) {
9971
- const opts = scope.options;
9972
- const hasSameOffice = user2.primaryOfficeId === userToAccess.primaryOfficeId;
9973
- if (opts?.accessLevel === JurisdictionFilter.enum.location && !hasSameOffice) {
9974
- return false;
9975
- }
9976
- const hasAdministrativeAreaInHierarchy = userToAccess.administrativeHierarchy.some(
9977
- (id) => user2.administrativeAreaId === id
9978
- ) || user2.administrativeAreaId === null;
9979
- if (opts?.accessLevel === JurisdictionFilter.enum.administrativeArea && !hasAdministrativeAreaInHierarchy) {
9980
- return false;
9981
- }
9982
- if (scopeUsesRoleOptions(scope)) {
9983
- const { options } = scope;
9984
- if (options?.role && !options.role.includes(userToAccess.role)) {
9985
- return false;
9986
- }
9987
- }
9988
- return true;
9989
- }
9990
- function canAccessOtherUserWithScopes({
9991
- scopes,
9992
- userToAccess,
9993
- user: user2
9994
- }) {
9995
- return scopes.some(
9996
- (scope) => canAccessUserWithScope({ userToAccess, scope, user: user2 })
9997
- );
9998
- }
9999
9933
  function userCanAccessEventWithScopes(event2, scopes, user2, customActionType) {
10000
9934
  return scopes.some(
10001
9935
  (scope) => canAccessEventWithScope(event2, scope, user2, customActionType)
@@ -2123,10 +2123,6 @@ var scopeByEvent = z3.preprocess(
2123
2123
  (val) => val === void 0 ? void 0 : [val].flat(),
2124
2124
  z3.array(z3.string()).optional()
2125
2125
  ).describe("Event type, e.g. birth, death");
2126
- var userRole = z3.preprocess(
2127
- (val) => val === void 0 ? void 0 : [val].flat(),
2128
- z3.array(z3.string()).optional()
2129
- ).describe("User role, e.g. admin, field agent");
2130
2126
  var scopeOptionsPlaceEvent = z3.object({
2131
2127
  event: scopeByEvent,
2132
2128
  placeOfEvent: JurisdictionFilter.optional()
@@ -2150,9 +2146,6 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
2150
2146
  var AccessLevelOptions = z3.object({
2151
2147
  accessLevel: JurisdictionFilter.optional()
2152
2148
  });
2153
- var AllUserScopeOptions = AccessLevelOptions.extend({
2154
- role: userRole.optional()
2155
- });
2156
2149
  var WorkqueueOrDashboardOptions = z3.object({
2157
2150
  ids: z3.preprocess(
2158
2151
  (val) => val === void 0 ? void 0 : [val].flat(),
@@ -2162,7 +2155,6 @@ var WorkqueueOrDashboardOptions = z3.object({
2162
2155
  var AllScopeOptions = z3.object({
2163
2156
  ...AllRecordScopeOptions.shape,
2164
2157
  ...AccessLevelOptions.shape,
2165
- ...AllUserScopeOptions.shape,
2166
2158
  ...WorkqueueOrDashboardOptions.shape
2167
2159
  });
2168
2160
  var ScopeOptionKey = AllScopeOptions.keyof();
@@ -2235,28 +2227,6 @@ var RecordScopeV2 = z3.discriminatedUnion("type", [
2235
2227
  ]).describe(
2236
2228
  "Scopes used to check user's permission to perform actions on a record."
2237
2229
  );
2238
- var SystemScopeType = z3.enum([
2239
- "organisation.read-locations",
2240
- "user.read",
2241
- "user.create",
2242
- "user.edit"
2243
- ]);
2244
- var UserScopeType = SystemScopeType.extract([
2245
- "user.read",
2246
- "user.create",
2247
- "user.edit"
2248
- ]);
2249
- var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
2250
- var UserScopeV2 = z3.discriminatedUnion("type", [
2251
- z3.object({
2252
- type: ScopesWithRoleOption,
2253
- options: AllUserScopeOptions.optional()
2254
- }),
2255
- z3.object({
2256
- type: UserScopeType.extract(["user.read"]),
2257
- options: AccessLevelOptions.optional()
2258
- })
2259
- ]);
2260
2230
  var ResolvedRecordScopeV2 = z3.discriminatedUnion("type", [
2261
2231
  z3.object({
2262
2232
  type: ScopesWithPlaceEventOptions,
@@ -2277,14 +2247,16 @@ var ResolvedRecordScopeV2 = z3.discriminatedUnion("type", [
2277
2247
  }).optional()
2278
2248
  })
2279
2249
  ]).describe("Resolved scope with location/user IDs instead of filters.");
2250
+ var SystemScopeType = z3.enum([
2251
+ "organisation.read-locations",
2252
+ "user.read",
2253
+ "user.create",
2254
+ "user.edit"
2255
+ ]);
2280
2256
  var Scope2 = z3.discriminatedUnion("type", [
2281
2257
  z3.object({ type: PlainScopeType }),
2282
2258
  ...RecordScopeV2.options,
2283
- ...UserScopeV2.options,
2284
- z3.object({
2285
- type: z3.literal("organisation.read-locations"),
2286
- options: AccessLevelOptions.optional()
2287
- }),
2259
+ z3.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
2288
2260
  z3.object({
2289
2261
  type: z3.literal("workqueue"),
2290
2262
  options: WorkqueueOrDashboardOptions
@@ -110,10 +110,6 @@ var scopeByEvent = z2.preprocess(
110
110
  (val) => val === void 0 ? void 0 : [val].flat(),
111
111
  z2.array(z2.string()).optional()
112
112
  ).describe("Event type, e.g. birth, death");
113
- var userRole = z2.preprocess(
114
- (val) => val === void 0 ? void 0 : [val].flat(),
115
- z2.array(z2.string()).optional()
116
- ).describe("User role, e.g. admin, field agent");
117
113
  var scopeOptionsPlaceEvent = z2.object({
118
114
  event: scopeByEvent,
119
115
  placeOfEvent: JurisdictionFilter.optional()
@@ -137,9 +133,6 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
137
133
  var AccessLevelOptions = z2.object({
138
134
  accessLevel: JurisdictionFilter.optional()
139
135
  });
140
- var AllUserScopeOptions = AccessLevelOptions.extend({
141
- role: userRole.optional()
142
- });
143
136
  var WorkqueueOrDashboardOptions = z2.object({
144
137
  ids: z2.preprocess(
145
138
  (val) => val === void 0 ? void 0 : [val].flat(),
@@ -149,7 +142,6 @@ var WorkqueueOrDashboardOptions = z2.object({
149
142
  var AllScopeOptions = z2.object({
150
143
  ...AllRecordScopeOptions.shape,
151
144
  ...AccessLevelOptions.shape,
152
- ...AllUserScopeOptions.shape,
153
145
  ...WorkqueueOrDashboardOptions.shape
154
146
  });
155
147
  var ScopeOptionKey = AllScopeOptions.keyof();
@@ -222,28 +214,6 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
222
214
  ]).describe(
223
215
  "Scopes used to check user's permission to perform actions on a record."
224
216
  );
225
- var SystemScopeType = z2.enum([
226
- "organisation.read-locations",
227
- "user.read",
228
- "user.create",
229
- "user.edit"
230
- ]);
231
- var UserScopeType = SystemScopeType.extract([
232
- "user.read",
233
- "user.create",
234
- "user.edit"
235
- ]);
236
- var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
237
- var UserScopeV2 = z2.discriminatedUnion("type", [
238
- z2.object({
239
- type: ScopesWithRoleOption,
240
- options: AllUserScopeOptions.optional()
241
- }),
242
- z2.object({
243
- type: UserScopeType.extract(["user.read"]),
244
- options: AccessLevelOptions.optional()
245
- })
246
- ]);
247
217
  var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
248
218
  z2.object({
249
219
  type: ScopesWithPlaceEventOptions,
@@ -264,14 +234,16 @@ var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
264
234
  }).optional()
265
235
  })
266
236
  ]).describe("Resolved scope with location/user IDs instead of filters.");
237
+ var SystemScopeType = z2.enum([
238
+ "organisation.read-locations",
239
+ "user.read",
240
+ "user.create",
241
+ "user.edit"
242
+ ]);
267
243
  var Scope = z2.discriminatedUnion("type", [
268
244
  z2.object({ type: PlainScopeType }),
269
245
  ...RecordScopeV2.options,
270
- ...UserScopeV2.options,
271
- z2.object({
272
- type: z2.literal("organisation.read-locations"),
273
- options: AccessLevelOptions.optional()
274
- }),
246
+ z2.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
275
247
  z2.object({
276
248
  type: z2.literal("workqueue"),
277
249
  options: WorkqueueOrDashboardOptions
@@ -41,7 +41,6 @@ declare const AllScopeOptions: z.ZodObject<{
41
41
  location: "location";
42
42
  all: "all";
43
43
  }>>;
44
- role: z.ZodOptional<z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>>;
45
44
  event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
46
45
  placeOfEvent: z.ZodOptional<z.ZodEnum<{
47
46
  administrativeArea: "administrativeArea";
@@ -67,7 +66,6 @@ declare const AllScopeOptions: z.ZodObject<{
67
66
  }, z.core.$strip>;
68
67
  type AllScopeOptions = z.infer<typeof AllScopeOptions>;
69
68
  export declare const ScopeOptionKey: z.ZodEnum<{
70
- role: "role";
71
69
  event: "event";
72
70
  placeOfEvent: "placeOfEvent";
73
71
  declaredIn: "declaredIn";
@@ -222,53 +220,6 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
222
220
  templates: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
223
221
  }, z.core.$strip>>;
224
222
  }, z.core.$strip>], "type">;
225
- declare const SystemScopeType: z.ZodEnum<{
226
- "organisation.read-locations": "organisation.read-locations";
227
- "user.read": "user.read";
228
- "user.create": "user.create";
229
- "user.edit": "user.edit";
230
- }>;
231
- export type SystemScopeType = z.infer<typeof SystemScopeType>;
232
- declare const UserScopeType: z.ZodEnum<{
233
- "user.read": "user.read";
234
- "user.create": "user.create";
235
- "user.edit": "user.edit";
236
- }>;
237
- export type UserScopeType = z.infer<typeof UserScopeType>;
238
- declare const ScopesWithRoleOption: z.ZodEnum<{
239
- "user.create": "user.create";
240
- "user.edit": "user.edit";
241
- }>;
242
- export type ScopesWithRoleOption = z.infer<typeof ScopesWithRoleOption>;
243
- export declare const UserScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
244
- type: z.ZodEnum<{
245
- "user.create": "user.create";
246
- "user.edit": "user.edit";
247
- }>;
248
- options: z.ZodOptional<z.ZodObject<{
249
- accessLevel: z.ZodOptional<z.ZodEnum<{
250
- administrativeArea: "administrativeArea";
251
- location: "location";
252
- all: "all";
253
- }>>;
254
- role: z.ZodOptional<z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>>;
255
- }, z.core.$strip>>;
256
- }, z.core.$strip>, z.ZodObject<{
257
- type: z.ZodEnum<{
258
- "user.read": "user.read";
259
- }>;
260
- options: z.ZodOptional<z.ZodObject<{
261
- accessLevel: z.ZodOptional<z.ZodEnum<{
262
- administrativeArea: "administrativeArea";
263
- location: "location";
264
- all: "all";
265
- }>>;
266
- }, z.core.$strip>>;
267
- }, z.core.$strip>], "type">;
268
- export type UserScopeV2 = z.infer<typeof UserScopeV2>;
269
- export declare function scopeUsesRoleOptions(scope: UserScopeV2): scope is Extract<UserScopeV2, {
270
- type: ScopesWithRoleOption;
271
- }>;
272
223
  export declare function scopeUsesDeclaredOptions(scope: Scope): scope is Extract<Scope, {
273
224
  type: z.infer<typeof ScopesWithDeclaredOptions>;
274
225
  }>;
@@ -335,6 +286,13 @@ export declare const ResolvedRecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject
335
286
  }, z.core.$strip>], "type">;
336
287
  export type RecordScopeV2 = z.infer<typeof RecordScopeV2>;
337
288
  export type ResolvedRecordScopeV2 = z.infer<typeof ResolvedRecordScopeV2>;
289
+ declare const SystemScopeType: z.ZodEnum<{
290
+ "organisation.read-locations": "organisation.read-locations";
291
+ "user.read": "user.read";
292
+ "user.create": "user.create";
293
+ "user.edit": "user.edit";
294
+ }>;
295
+ export type SystemScopeType = z.infer<typeof SystemScopeType>;
338
296
  /** The primary scope schema which gathers all scope types together. All scopes are discriminated by type and options are determined according to the type. */
339
297
  export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
340
298
  type: z.ZodEnum<{
@@ -479,30 +437,11 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
479
437
  }, z.core.$strip>>;
480
438
  }, z.core.$strip>, z.ZodObject<{
481
439
  type: z.ZodEnum<{
440
+ "organisation.read-locations": "organisation.read-locations";
441
+ "user.read": "user.read";
482
442
  "user.create": "user.create";
483
443
  "user.edit": "user.edit";
484
444
  }>;
485
- options: z.ZodOptional<z.ZodObject<{
486
- accessLevel: z.ZodOptional<z.ZodEnum<{
487
- administrativeArea: "administrativeArea";
488
- location: "location";
489
- all: "all";
490
- }>>;
491
- role: z.ZodOptional<z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>>;
492
- }, z.core.$strip>>;
493
- }, z.core.$strip>, z.ZodObject<{
494
- type: z.ZodEnum<{
495
- "user.read": "user.read";
496
- }>;
497
- options: z.ZodOptional<z.ZodObject<{
498
- accessLevel: z.ZodOptional<z.ZodEnum<{
499
- administrativeArea: "administrativeArea";
500
- location: "location";
501
- all: "all";
502
- }>>;
503
- }, z.core.$strip>>;
504
- }, z.core.$strip>, z.ZodObject<{
505
- type: z.ZodLiteral<"organisation.read-locations">;
506
445
  options: z.ZodOptional<z.ZodObject<{
507
446
  accessLevel: z.ZodOptional<z.ZodEnum<{
508
447
  administrativeArea: "administrativeArea";
@@ -628,21 +567,10 @@ export declare const decodeScope: (query: EncodedScope) => {
628
567
  registeredBy?: "user" | undefined;
629
568
  templates?: string[] | undefined;
630
569
  } | undefined;
631
- } | {
632
- type: "user.create" | "user.edit";
633
- options?: {
634
- accessLevel?: "administrativeArea" | "location" | "all" | undefined;
635
- role?: string[] | undefined;
636
- } | undefined;
637
- } | {
638
- type: "user.read";
639
- options?: {
640
- accessLevel?: "administrativeArea" | "location" | "all" | undefined;
641
- } | undefined;
642
570
  } | {
643
571
  type: "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";
644
572
  } | {
645
- type: "organisation.read-locations";
573
+ type: "organisation.read-locations" | "user.read" | "user.create" | "user.edit";
646
574
  options?: {
647
575
  accessLevel?: "administrativeArea" | "location" | "all" | undefined;
648
576
  } | undefined;
@@ -42,7 +42,6 @@ __export(scopes_exports, {
42
42
  ScopesWithFullOptions: () => ScopesWithFullOptions,
43
43
  ScopesWithPlaceEventOptions: () => ScopesWithPlaceEventOptions,
44
44
  UserFilter: () => UserFilter,
45
- UserScopeV2: () => UserScopeV2,
46
45
  canUserCreateEvent: () => canUserCreateEvent,
47
46
  decodeScope: () => decodeScope,
48
47
  defineRoles: () => defineRoles,
@@ -55,8 +54,7 @@ __export(scopes_exports, {
55
54
  isCustomActionScope: () => isCustomActionScope,
56
55
  scopeUsesDeclaredOptions: () => scopeUsesDeclaredOptions,
57
56
  scopeUsesFullOptions: () => scopeUsesFullOptions,
58
- scopeUsesPrintCertifiedCopiesOptions: () => scopeUsesPrintCertifiedCopiesOptions,
59
- scopeUsesRoleOptions: () => scopeUsesRoleOptions
57
+ scopeUsesPrintCertifiedCopiesOptions: () => scopeUsesPrintCertifiedCopiesOptions
60
58
  });
61
59
  module.exports = __toCommonJS(scopes_exports);
62
60
  var z4 = __toESM(require("zod/v4"));
@@ -141,10 +139,6 @@ var scopeByEvent = z3.preprocess(
141
139
  (val) => val === void 0 ? void 0 : [val].flat(),
142
140
  z3.array(z3.string()).optional()
143
141
  ).describe("Event type, e.g. birth, death");
144
- var userRole = z3.preprocess(
145
- (val) => val === void 0 ? void 0 : [val].flat(),
146
- z3.array(z3.string()).optional()
147
- ).describe("User role, e.g. admin, field agent");
148
142
  var scopeOptionsPlaceEvent = z3.object({
149
143
  event: scopeByEvent,
150
144
  placeOfEvent: JurisdictionFilter.optional()
@@ -168,9 +162,6 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
168
162
  var AccessLevelOptions = z3.object({
169
163
  accessLevel: JurisdictionFilter.optional()
170
164
  });
171
- var AllUserScopeOptions = AccessLevelOptions.extend({
172
- role: userRole.optional()
173
- });
174
165
  var WorkqueueOrDashboardOptions = z3.object({
175
166
  ids: z3.preprocess(
176
167
  (val) => val === void 0 ? void 0 : [val].flat(),
@@ -180,7 +171,6 @@ var WorkqueueOrDashboardOptions = z3.object({
180
171
  var AllScopeOptions = z3.object({
181
172
  ...AllRecordScopeOptions.shape,
182
173
  ...AccessLevelOptions.shape,
183
- ...AllUserScopeOptions.shape,
184
174
  ...WorkqueueOrDashboardOptions.shape
185
175
  });
186
176
  var ScopeOptionKey = AllScopeOptions.keyof();
@@ -253,31 +243,6 @@ var RecordScopeV2 = z3.discriminatedUnion("type", [
253
243
  ]).describe(
254
244
  "Scopes used to check user's permission to perform actions on a record."
255
245
  );
256
- var SystemScopeType = z3.enum([
257
- "organisation.read-locations",
258
- "user.read",
259
- "user.create",
260
- "user.edit"
261
- ]);
262
- var UserScopeType = SystemScopeType.extract([
263
- "user.read",
264
- "user.create",
265
- "user.edit"
266
- ]);
267
- var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
268
- var UserScopeV2 = z3.discriminatedUnion("type", [
269
- z3.object({
270
- type: ScopesWithRoleOption,
271
- options: AllUserScopeOptions.optional()
272
- }),
273
- z3.object({
274
- type: UserScopeType.extract(["user.read"]),
275
- options: AccessLevelOptions.optional()
276
- })
277
- ]);
278
- function scopeUsesRoleOptions(scope) {
279
- return ScopesWithRoleOption?.options.some((opt) => opt === scope.type);
280
- }
281
246
  function scopeUsesDeclaredOptions(scope) {
282
247
  return !ScopesWithPlaceEventOptions.options.some((opt) => opt === scope.type);
283
248
  }
@@ -310,14 +275,16 @@ var ResolvedRecordScopeV2 = z3.discriminatedUnion("type", [
310
275
  }).optional()
311
276
  })
312
277
  ]).describe("Resolved scope with location/user IDs instead of filters.");
278
+ var SystemScopeType = z3.enum([
279
+ "organisation.read-locations",
280
+ "user.read",
281
+ "user.create",
282
+ "user.edit"
283
+ ]);
313
284
  var Scope2 = z3.discriminatedUnion("type", [
314
285
  z3.object({ type: PlainScopeType }),
315
286
  ...RecordScopeV2.options,
316
- ...UserScopeV2.options,
317
- z3.object({
318
- type: z3.literal("organisation.read-locations"),
319
- options: AccessLevelOptions.optional()
320
- }),
287
+ z3.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
321
288
  z3.object({
322
289
  type: z3.literal("workqueue"),
323
290
  options: WorkqueueOrDashboardOptions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "2.0.0-rc.4ac5bfa",
3
+ "version": "2.0.0-rc.5a0ce95",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "bin": {