@opencrvs/toolkit 2.0.0-rc.977e771 → 2.0.0-rc.b4856ad

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()
@@ -764,33 +760,6 @@ var RecordScopeV2 = z11.discriminatedUnion("type", [
764
760
  ]).describe(
765
761
  "Scopes used to check user's permission to perform actions on a record."
766
762
  );
767
- var SystemScopeType = z11.enum([
768
- "organisation.read-locations",
769
- "user.read",
770
- "user.create",
771
- "user.edit"
772
- ]);
773
- var UserScopeType = SystemScopeType.extract([
774
- "user.read",
775
- "user.create",
776
- "user.edit"
777
- ]);
778
- var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
779
- var UserScopeV2 = z11.discriminatedUnion("type", [
780
- z11.object({
781
- type: ScopesWithRoleOption,
782
- options: z11.object({
783
- accessLevel: JurisdictionFilter.optional(),
784
- role: userRole.optional()
785
- }).optional()
786
- }),
787
- z11.object({
788
- type: UserScopeType.extract(["user.read"]),
789
- options: z11.object({
790
- accessLevel: JurisdictionFilter.optional()
791
- }).optional()
792
- })
793
- ]);
794
763
  var ResolvedRecordScopeV2 = z11.discriminatedUnion("type", [
795
764
  z11.object({
796
765
  type: ScopesWithPlaceEventOptions,
@@ -811,14 +780,16 @@ var ResolvedRecordScopeV2 = z11.discriminatedUnion("type", [
811
780
  }).optional()
812
781
  })
813
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
+ ]);
814
789
  var Scope = z11.discriminatedUnion("type", [
815
790
  z11.object({ type: PlainScopeType }),
816
791
  ...RecordScopeV2.options,
817
- ...UserScopeV2.options,
818
- z11.object({
819
- type: z11.literal("organisation.read-locations"),
820
- options: AccessLevelOptions.optional()
821
- }),
792
+ z11.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
822
793
  z11.object({
823
794
  type: z11.literal("workqueue"),
824
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()
@@ -2218,33 +2214,6 @@ var RecordScopeV2 = z3.discriminatedUnion("type", [
2218
2214
  ]).describe(
2219
2215
  "Scopes used to check user's permission to perform actions on a record."
2220
2216
  );
2221
- var SystemScopeType = z3.enum([
2222
- "organisation.read-locations",
2223
- "user.read",
2224
- "user.create",
2225
- "user.edit"
2226
- ]);
2227
- var UserScopeType = SystemScopeType.extract([
2228
- "user.read",
2229
- "user.create",
2230
- "user.edit"
2231
- ]);
2232
- var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
2233
- var UserScopeV2 = z3.discriminatedUnion("type", [
2234
- z3.object({
2235
- type: ScopesWithRoleOption,
2236
- options: z3.object({
2237
- accessLevel: JurisdictionFilter.optional(),
2238
- role: userRole.optional()
2239
- }).optional()
2240
- }),
2241
- z3.object({
2242
- type: UserScopeType.extract(["user.read"]),
2243
- options: z3.object({
2244
- accessLevel: JurisdictionFilter.optional()
2245
- }).optional()
2246
- })
2247
- ]);
2248
2217
  var ResolvedRecordScopeV2 = z3.discriminatedUnion("type", [
2249
2218
  z3.object({
2250
2219
  type: ScopesWithPlaceEventOptions,
@@ -2265,14 +2234,16 @@ var ResolvedRecordScopeV2 = z3.discriminatedUnion("type", [
2265
2234
  }).optional()
2266
2235
  })
2267
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
+ ]);
2268
2243
  var Scope2 = z3.discriminatedUnion("type", [
2269
2244
  z3.object({ type: PlainScopeType }),
2270
2245
  ...RecordScopeV2.options,
2271
- ...UserScopeV2.options,
2272
- z3.object({
2273
- type: z3.literal("organisation.read-locations"),
2274
- options: AccessLevelOptions.optional()
2275
- }),
2246
+ z3.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
2276
2247
  z3.object({
2277
2248
  type: z3.literal("workqueue"),
2278
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;
@@ -4029,10 +4027,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4029
4027
  output: {
4030
4028
  id: string & import("zod").$brand<"UUID">;
4031
4029
  name: {
4032
- use: string;
4033
- given: string[];
4034
- family: string;
4035
- }[];
4030
+ firstname: string;
4031
+ surname: string;
4032
+ };
4036
4033
  role: string;
4037
4034
  primaryOfficeId: string & import("zod").$brand<"UUID">;
4038
4035
  type: "user";
@@ -4053,10 +4050,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4053
4050
  id: string;
4054
4051
  data?: Record<string, unknown> | undefined;
4055
4052
  name?: {
4056
- use: string;
4057
- given: string[];
4058
- family: string;
4059
- }[] | undefined;
4053
+ firstname: string;
4054
+ surname: string;
4055
+ } | undefined;
4060
4056
  role?: string | undefined;
4061
4057
  fullHonorificName?: string | undefined;
4062
4058
  device?: string | undefined;
@@ -4075,10 +4071,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4075
4071
  output: {
4076
4072
  id: string & import("zod").$brand<"UUID">;
4077
4073
  name: {
4078
- use: string;
4079
- given: string[];
4080
- family: string;
4081
- }[];
4074
+ firstname: string;
4075
+ surname: string;
4076
+ };
4082
4077
  role: string;
4083
4078
  primaryOfficeId: string & import("zod").$brand<"UUID">;
4084
4079
  type: "user";
@@ -4099,10 +4094,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4099
4094
  output: ({
4100
4095
  id: string & import("zod").$brand<"UUID">;
4101
4096
  name: {
4102
- use: string;
4103
- given: string[];
4104
- family: string;
4105
- }[];
4097
+ firstname: string;
4098
+ surname: string;
4099
+ };
4106
4100
  role: string;
4107
4101
  primaryOfficeId: string & import("zod").$brand<"UUID">;
4108
4102
  type: "user";
@@ -4144,10 +4138,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4144
4138
  output: ({
4145
4139
  id: string & import("zod").$brand<"UUID">;
4146
4140
  name: {
4147
- use: string;
4148
- given: string[];
4149
- family: string;
4150
- }[];
4141
+ firstname: string;
4142
+ surname: string;
4143
+ };
4151
4144
  role: string;
4152
4145
  primaryOfficeId: string & import("zod").$brand<"UUID">;
4153
4146
  type: "user";
@@ -4773,7 +4766,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4773
4766
  'legalStatuses.DECLARED.createdAtLocation'?: {
4774
4767
  type: "within";
4775
4768
  location: string | {
4776
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4769
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4777
4770
  $location?: string | undefined;
4778
4771
  };
4779
4772
  } | undefined;
@@ -4795,7 +4788,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4795
4788
  'legalStatuses.REGISTERED.createdAtLocation'?: {
4796
4789
  type: "within";
4797
4790
  location: string | {
4798
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4791
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4799
4792
  $location?: string | undefined;
4800
4793
  };
4801
4794
  } | undefined;
@@ -4810,47 +4803,47 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4810
4803
  createdAtLocation?: {
4811
4804
  type: "within";
4812
4805
  location: string | {
4813
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4806
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4814
4807
  $location?: string | undefined;
4815
4808
  };
4816
4809
  } | {
4817
4810
  type: "exact";
4818
4811
  term: string | {
4819
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4812
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4820
4813
  $location?: string | undefined;
4821
4814
  };
4822
4815
  } | undefined;
4823
4816
  updatedAtLocation?: {
4824
4817
  type: "within";
4825
4818
  location: string | {
4826
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4819
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4827
4820
  $location?: string | undefined;
4828
4821
  };
4829
4822
  } | {
4830
4823
  type: "exact";
4831
4824
  term: string | {
4832
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4825
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4833
4826
  $location?: string | undefined;
4834
4827
  };
4835
4828
  } | undefined;
4836
4829
  updatedByUserRole?: {
4837
4830
  type: "exact";
4838
4831
  term: string | {
4839
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4832
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4840
4833
  $location?: string | undefined;
4841
4834
  };
4842
4835
  } | undefined;
4843
4836
  assignedTo?: {
4844
4837
  type: "exact";
4845
4838
  term: string | {
4846
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4839
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4847
4840
  $location?: string | undefined;
4848
4841
  };
4849
4842
  } | undefined;
4850
4843
  createdBy?: {
4851
4844
  type: "exact";
4852
4845
  term: string | {
4853
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4846
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4854
4847
  $location?: string | undefined;
4855
4848
  };
4856
4849
  } | undefined;
@@ -4861,7 +4854,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4861
4854
  updatedBy?: {
4862
4855
  type: "exact";
4863
4856
  term: string | {
4864
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4857
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4865
4858
  $location?: string | undefined;
4866
4859
  };
4867
4860
  } | undefined;
@@ -4911,7 +4904,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4911
4904
  'legalStatuses.DECLARED.createdAtLocation'?: {
4912
4905
  type: "within";
4913
4906
  location: string | {
4914
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4907
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4915
4908
  $location?: string | undefined;
4916
4909
  };
4917
4910
  } | undefined;
@@ -4933,7 +4926,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4933
4926
  'legalStatuses.REGISTERED.createdAtLocation'?: {
4934
4927
  type: "within";
4935
4928
  location: string | {
4936
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4929
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4937
4930
  $location?: string | undefined;
4938
4931
  };
4939
4932
  } | undefined;
@@ -4948,47 +4941,47 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4948
4941
  createdAtLocation?: {
4949
4942
  type: "within";
4950
4943
  location: string | {
4951
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4944
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4952
4945
  $location?: string | undefined;
4953
4946
  };
4954
4947
  } | {
4955
4948
  type: "exact";
4956
4949
  term: string | {
4957
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4950
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4958
4951
  $location?: string | undefined;
4959
4952
  };
4960
4953
  } | undefined;
4961
4954
  updatedAtLocation?: {
4962
4955
  type: "within";
4963
4956
  location: string | {
4964
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4957
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4965
4958
  $location?: string | undefined;
4966
4959
  };
4967
4960
  } | {
4968
4961
  type: "exact";
4969
4962
  term: string | {
4970
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4963
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4971
4964
  $location?: string | undefined;
4972
4965
  };
4973
4966
  } | undefined;
4974
4967
  updatedByUserRole?: {
4975
4968
  type: "exact";
4976
4969
  term: string | {
4977
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4970
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4978
4971
  $location?: string | undefined;
4979
4972
  };
4980
4973
  } | undefined;
4981
4974
  assignedTo?: {
4982
4975
  type: "exact";
4983
4976
  term: string | {
4984
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4977
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4985
4978
  $location?: string | undefined;
4986
4979
  };
4987
4980
  } | undefined;
4988
4981
  createdBy?: {
4989
4982
  type: "exact";
4990
4983
  term: string | {
4991
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4984
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
4992
4985
  $location?: string | undefined;
4993
4986
  };
4994
4987
  } | undefined;
@@ -4999,7 +4992,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4999
4992
  updatedBy?: {
5000
4993
  type: "exact";
5001
4994
  term: string | {
5002
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4995
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "avatar" | "signature" | "primaryOfficeId" | "middlename";
5003
4996
  $location?: string | undefined;
5004
4997
  };
5005
4998
  } | undefined;
@@ -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()
@@ -290,33 +286,6 @@ var RecordScopeV2 = z6.discriminatedUnion("type", [
290
286
  ]).describe(
291
287
  "Scopes used to check user's permission to perform actions on a record."
292
288
  );
293
- var SystemScopeType = z6.enum([
294
- "organisation.read-locations",
295
- "user.read",
296
- "user.create",
297
- "user.edit"
298
- ]);
299
- var UserScopeType = SystemScopeType.extract([
300
- "user.read",
301
- "user.create",
302
- "user.edit"
303
- ]);
304
- var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
305
- var UserScopeV2 = z6.discriminatedUnion("type", [
306
- z6.object({
307
- type: ScopesWithRoleOption,
308
- options: z6.object({
309
- accessLevel: JurisdictionFilter.optional(),
310
- role: userRole.optional()
311
- }).optional()
312
- }),
313
- z6.object({
314
- type: UserScopeType.extract(["user.read"]),
315
- options: z6.object({
316
- accessLevel: JurisdictionFilter.optional()
317
- }).optional()
318
- })
319
- ]);
320
289
  var ResolvedRecordScopeV2 = z6.discriminatedUnion("type", [
321
290
  z6.object({
322
291
  type: ScopesWithPlaceEventOptions,
@@ -337,14 +306,16 @@ var ResolvedRecordScopeV2 = z6.discriminatedUnion("type", [
337
306
  }).optional()
338
307
  })
339
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
+ ]);
340
315
  var Scope2 = z6.discriminatedUnion("type", [
341
316
  z6.object({ type: PlainScopeType }),
342
317
  ...RecordScopeV2.options,
343
- ...UserScopeV2.options,
344
- z6.object({
345
- type: z6.literal("organisation.read-locations"),
346
- options: AccessLevelOptions.optional()
347
- }),
318
+ z6.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
348
319
  z6.object({
349
320
  type: z6.literal("workqueue"),
350
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()
@@ -599,36 +593,6 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
599
593
  ]).describe(
600
594
  "Scopes used to check user's permission to perform actions on a record."
601
595
  );
602
- var SystemScopeType = z2.enum([
603
- "organisation.read-locations",
604
- "user.read",
605
- "user.create",
606
- "user.edit"
607
- ]);
608
- var UserScopeType = SystemScopeType.extract([
609
- "user.read",
610
- "user.create",
611
- "user.edit"
612
- ]);
613
- var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
614
- var UserScopeV2 = z2.discriminatedUnion("type", [
615
- z2.object({
616
- type: ScopesWithRoleOption,
617
- options: z2.object({
618
- accessLevel: JurisdictionFilter.optional(),
619
- role: userRole.optional()
620
- }).optional()
621
- }),
622
- z2.object({
623
- type: UserScopeType.extract(["user.read"]),
624
- options: z2.object({
625
- accessLevel: JurisdictionFilter.optional()
626
- }).optional()
627
- })
628
- ]);
629
- function scopeUsesRoleOptions(scope) {
630
- return ScopesWithRoleOption?.options.some((opt) => opt === scope.type);
631
- }
632
596
  function scopeUsesDeclaredOptions(scope) {
633
597
  return !ScopesWithPlaceEventOptions.options.some((opt) => opt === scope.type);
634
598
  }
@@ -661,14 +625,16 @@ var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
661
625
  }).optional()
662
626
  })
663
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
+ ]);
664
634
  var Scope = z2.discriminatedUnion("type", [
665
635
  z2.object({ type: PlainScopeType }),
666
636
  ...RecordScopeV2.options,
667
- ...UserScopeV2.options,
668
- z2.object({
669
- type: z2.literal("organisation.read-locations"),
670
- options: AccessLevelOptions.optional()
671
- }),
637
+ z2.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
672
638
  z2.object({
673
639
  type: z2.literal("workqueue"),
674
640
  options: WorkqueueOrDashboardOptions
@@ -9964,39 +9930,6 @@ function canAccessEventWithScope(event2, scope, user2, customActionType) {
9964
9930
  }
9965
9931
  return true;
9966
9932
  }
9967
- function canAccessUserWithScope({
9968
- userToAccess,
9969
- scope,
9970
- user: user2
9971
- }) {
9972
- const opts = scope.options;
9973
- const hasSameOffice = user2.primaryOfficeId === userToAccess.primaryOfficeId;
9974
- if (opts?.accessLevel === JurisdictionFilter.enum.location && !hasSameOffice) {
9975
- return false;
9976
- }
9977
- const hasAdministrativeAreaInHierarchy = userToAccess.administrativeHierarchy.some(
9978
- (id) => user2.administrativeAreaId === id
9979
- ) || user2.administrativeAreaId === null;
9980
- if (opts?.accessLevel === JurisdictionFilter.enum.administrativeArea && !hasAdministrativeAreaInHierarchy) {
9981
- return false;
9982
- }
9983
- if (scopeUsesRoleOptions(scope)) {
9984
- const { options } = scope;
9985
- if (options?.role && !options.role.includes(userToAccess.role)) {
9986
- return false;
9987
- }
9988
- }
9989
- return true;
9990
- }
9991
- function canAccessOtherUserWithScopes({
9992
- scopes,
9993
- userToAccess,
9994
- user: user2
9995
- }) {
9996
- return scopes.some(
9997
- (scope) => canAccessUserWithScope({ userToAccess, scope, user: user2 })
9998
- );
9999
- }
10000
9933
  function userCanAccessEventWithScopes(event2, scopes, user2, customActionType) {
10001
9934
  return scopes.some(
10002
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()
@@ -2231,33 +2227,6 @@ var RecordScopeV2 = z3.discriminatedUnion("type", [
2231
2227
  ]).describe(
2232
2228
  "Scopes used to check user's permission to perform actions on a record."
2233
2229
  );
2234
- var SystemScopeType = z3.enum([
2235
- "organisation.read-locations",
2236
- "user.read",
2237
- "user.create",
2238
- "user.edit"
2239
- ]);
2240
- var UserScopeType = SystemScopeType.extract([
2241
- "user.read",
2242
- "user.create",
2243
- "user.edit"
2244
- ]);
2245
- var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
2246
- var UserScopeV2 = z3.discriminatedUnion("type", [
2247
- z3.object({
2248
- type: ScopesWithRoleOption,
2249
- options: z3.object({
2250
- accessLevel: JurisdictionFilter.optional(),
2251
- role: userRole.optional()
2252
- }).optional()
2253
- }),
2254
- z3.object({
2255
- type: UserScopeType.extract(["user.read"]),
2256
- options: z3.object({
2257
- accessLevel: JurisdictionFilter.optional()
2258
- }).optional()
2259
- })
2260
- ]);
2261
2230
  var ResolvedRecordScopeV2 = z3.discriminatedUnion("type", [
2262
2231
  z3.object({
2263
2232
  type: ScopesWithPlaceEventOptions,
@@ -2278,14 +2247,16 @@ var ResolvedRecordScopeV2 = z3.discriminatedUnion("type", [
2278
2247
  }).optional()
2279
2248
  })
2280
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
+ ]);
2281
2256
  var Scope2 = z3.discriminatedUnion("type", [
2282
2257
  z3.object({ type: PlainScopeType }),
2283
2258
  ...RecordScopeV2.options,
2284
- ...UserScopeV2.options,
2285
- z3.object({
2286
- type: z3.literal("organisation.read-locations"),
2287
- options: AccessLevelOptions.optional()
2288
- }),
2259
+ z3.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
2289
2260
  z3.object({
2290
2261
  type: z3.literal("workqueue"),
2291
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()
@@ -218,33 +214,6 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
218
214
  ]).describe(
219
215
  "Scopes used to check user's permission to perform actions on a record."
220
216
  );
221
- var SystemScopeType = z2.enum([
222
- "organisation.read-locations",
223
- "user.read",
224
- "user.create",
225
- "user.edit"
226
- ]);
227
- var UserScopeType = SystemScopeType.extract([
228
- "user.read",
229
- "user.create",
230
- "user.edit"
231
- ]);
232
- var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
233
- var UserScopeV2 = z2.discriminatedUnion("type", [
234
- z2.object({
235
- type: ScopesWithRoleOption,
236
- options: z2.object({
237
- accessLevel: JurisdictionFilter.optional(),
238
- role: userRole.optional()
239
- }).optional()
240
- }),
241
- z2.object({
242
- type: UserScopeType.extract(["user.read"]),
243
- options: z2.object({
244
- accessLevel: JurisdictionFilter.optional()
245
- }).optional()
246
- })
247
- ]);
248
217
  var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
249
218
  z2.object({
250
219
  type: ScopesWithPlaceEventOptions,
@@ -265,14 +234,16 @@ var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
265
234
  }).optional()
266
235
  })
267
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
+ ]);
268
243
  var Scope = z2.discriminatedUnion("type", [
269
244
  z2.object({ type: PlainScopeType }),
270
245
  ...RecordScopeV2.options,
271
- ...UserScopeV2.options,
272
- z2.object({
273
- type: z2.literal("organisation.read-locations"),
274
- options: AccessLevelOptions.optional()
275
- }),
246
+ z2.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
276
247
  z2.object({
277
248
  type: z2.literal("workqueue"),
278
249
  options: WorkqueueOrDashboardOptions
@@ -220,53 +220,6 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
220
220
  templates: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
221
221
  }, z.core.$strip>>;
222
222
  }, z.core.$strip>], "type">;
223
- declare const SystemScopeType: z.ZodEnum<{
224
- "organisation.read-locations": "organisation.read-locations";
225
- "user.read": "user.read";
226
- "user.create": "user.create";
227
- "user.edit": "user.edit";
228
- }>;
229
- export type SystemScopeType = z.infer<typeof SystemScopeType>;
230
- declare const UserScopeType: z.ZodEnum<{
231
- "user.read": "user.read";
232
- "user.create": "user.create";
233
- "user.edit": "user.edit";
234
- }>;
235
- export type UserScopeType = z.infer<typeof UserScopeType>;
236
- declare const ScopesWithRoleOption: z.ZodEnum<{
237
- "user.create": "user.create";
238
- "user.edit": "user.edit";
239
- }>;
240
- export type ScopesWithRoleOption = z.infer<typeof ScopesWithRoleOption>;
241
- export declare const UserScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
242
- type: z.ZodEnum<{
243
- "user.create": "user.create";
244
- "user.edit": "user.edit";
245
- }>;
246
- options: z.ZodOptional<z.ZodObject<{
247
- accessLevel: z.ZodOptional<z.ZodEnum<{
248
- administrativeArea: "administrativeArea";
249
- location: "location";
250
- all: "all";
251
- }>>;
252
- role: z.ZodOptional<z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>>;
253
- }, z.core.$strip>>;
254
- }, z.core.$strip>, z.ZodObject<{
255
- type: z.ZodEnum<{
256
- "user.read": "user.read";
257
- }>;
258
- options: z.ZodOptional<z.ZodObject<{
259
- accessLevel: z.ZodOptional<z.ZodEnum<{
260
- administrativeArea: "administrativeArea";
261
- location: "location";
262
- all: "all";
263
- }>>;
264
- }, z.core.$strip>>;
265
- }, z.core.$strip>], "type">;
266
- export type UserScopeV2 = z.infer<typeof UserScopeV2>;
267
- export declare function scopeUsesRoleOptions(scope: UserScopeV2): scope is Extract<UserScopeV2, {
268
- type: ScopesWithRoleOption;
269
- }>;
270
223
  export declare function scopeUsesDeclaredOptions(scope: Scope): scope is Extract<Scope, {
271
224
  type: z.infer<typeof ScopesWithDeclaredOptions>;
272
225
  }>;
@@ -333,6 +286,13 @@ export declare const ResolvedRecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject
333
286
  }, z.core.$strip>], "type">;
334
287
  export type RecordScopeV2 = z.infer<typeof RecordScopeV2>;
335
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>;
336
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. */
337
297
  export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
338
298
  type: z.ZodEnum<{
@@ -477,30 +437,11 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
477
437
  }, z.core.$strip>>;
478
438
  }, z.core.$strip>, z.ZodObject<{
479
439
  type: z.ZodEnum<{
440
+ "organisation.read-locations": "organisation.read-locations";
441
+ "user.read": "user.read";
480
442
  "user.create": "user.create";
481
443
  "user.edit": "user.edit";
482
444
  }>;
483
- options: z.ZodOptional<z.ZodObject<{
484
- accessLevel: z.ZodOptional<z.ZodEnum<{
485
- administrativeArea: "administrativeArea";
486
- location: "location";
487
- all: "all";
488
- }>>;
489
- role: z.ZodOptional<z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>>;
490
- }, z.core.$strip>>;
491
- }, z.core.$strip>, z.ZodObject<{
492
- type: z.ZodEnum<{
493
- "user.read": "user.read";
494
- }>;
495
- options: z.ZodOptional<z.ZodObject<{
496
- accessLevel: z.ZodOptional<z.ZodEnum<{
497
- administrativeArea: "administrativeArea";
498
- location: "location";
499
- all: "all";
500
- }>>;
501
- }, z.core.$strip>>;
502
- }, z.core.$strip>, z.ZodObject<{
503
- type: z.ZodLiteral<"organisation.read-locations">;
504
445
  options: z.ZodOptional<z.ZodObject<{
505
446
  accessLevel: z.ZodOptional<z.ZodEnum<{
506
447
  administrativeArea: "administrativeArea";
@@ -626,21 +567,10 @@ export declare const decodeScope: (query: EncodedScope) => {
626
567
  registeredBy?: "user" | undefined;
627
568
  templates?: string[] | undefined;
628
569
  } | undefined;
629
- } | {
630
- type: "user.create" | "user.edit";
631
- options?: {
632
- accessLevel?: "administrativeArea" | "location" | "all" | undefined;
633
- role?: string[] | undefined;
634
- } | undefined;
635
- } | {
636
- type: "user.read";
637
- options?: {
638
- accessLevel?: "administrativeArea" | "location" | "all" | undefined;
639
- } | undefined;
640
570
  } | {
641
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";
642
572
  } | {
643
- type: "organisation.read-locations";
573
+ type: "organisation.read-locations" | "user.read" | "user.create" | "user.edit";
644
574
  options?: {
645
575
  accessLevel?: "administrativeArea" | "location" | "all" | undefined;
646
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()
@@ -249,36 +243,6 @@ var RecordScopeV2 = z3.discriminatedUnion("type", [
249
243
  ]).describe(
250
244
  "Scopes used to check user's permission to perform actions on a record."
251
245
  );
252
- var SystemScopeType = z3.enum([
253
- "organisation.read-locations",
254
- "user.read",
255
- "user.create",
256
- "user.edit"
257
- ]);
258
- var UserScopeType = SystemScopeType.extract([
259
- "user.read",
260
- "user.create",
261
- "user.edit"
262
- ]);
263
- var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
264
- var UserScopeV2 = z3.discriminatedUnion("type", [
265
- z3.object({
266
- type: ScopesWithRoleOption,
267
- options: z3.object({
268
- accessLevel: JurisdictionFilter.optional(),
269
- role: userRole.optional()
270
- }).optional()
271
- }),
272
- z3.object({
273
- type: UserScopeType.extract(["user.read"]),
274
- options: z3.object({
275
- accessLevel: JurisdictionFilter.optional()
276
- }).optional()
277
- })
278
- ]);
279
- function scopeUsesRoleOptions(scope) {
280
- return ScopesWithRoleOption?.options.some((opt) => opt === scope.type);
281
- }
282
246
  function scopeUsesDeclaredOptions(scope) {
283
247
  return !ScopesWithPlaceEventOptions.options.some((opt) => opt === scope.type);
284
248
  }
@@ -311,14 +275,16 @@ var ResolvedRecordScopeV2 = z3.discriminatedUnion("type", [
311
275
  }).optional()
312
276
  })
313
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
+ ]);
314
284
  var Scope2 = z3.discriminatedUnion("type", [
315
285
  z3.object({ type: PlainScopeType }),
316
286
  ...RecordScopeV2.options,
317
- ...UserScopeV2.options,
318
- z3.object({
319
- type: z3.literal("organisation.read-locations"),
320
- options: AccessLevelOptions.optional()
321
- }),
287
+ z3.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
322
288
  z3.object({
323
289
  type: z3.literal("workqueue"),
324
290
  options: WorkqueueOrDashboardOptions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "2.0.0-rc.977e771",
3
+ "version": "2.0.0-rc.b4856ad",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "bin": {