@opencrvs/toolkit 2.0.0-rc.fc7f7fc → 2.0.0-rc.fd8d9e7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/application-config/index.js +39 -11
  2. package/dist/cli.js +1657 -318
  3. package/dist/commons/api/router.d.ts +44 -56
  4. package/dist/commons/application-config/index.d.ts +16 -4
  5. package/dist/commons/conditionals/conditionals.d.ts +3 -3
  6. package/dist/commons/events/FieldConfig.d.ts +5 -0
  7. package/dist/commons/events/locations.d.ts +17 -1
  8. package/dist/conditionals/index.js +35 -7
  9. package/dist/events/index.js +73 -7
  10. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
  11. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +63 -39
  12. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts +3 -0
  13. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts.map +1 -0
  14. package/dist/migrations/v2.0/add-resend-invite-notification.js +373 -0
  15. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +19 -0
  16. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  17. package/dist/migrations/v2.0/checkout-upstream-files.js +17 -13
  18. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -1
  19. package/dist/migrations/v2.0/convert-config-files-to-ts.js +4 -5
  20. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +1 -1
  21. package/dist/migrations/v2.0/convert-paragraph-to-heading.js +4 -5
  22. package/dist/migrations/v2.0/create-events-index.d.ts.map +1 -1
  23. package/dist/migrations/v2.0/create-events-index.js +1 -2
  24. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +3 -0
  25. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -0
  26. package/dist/migrations/v2.0/delete-infrastructure-directory.js +77 -0
  27. package/dist/migrations/v2.0/index.d.ts +8 -4
  28. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  29. package/dist/migrations/v2.0/index.js +1625 -315
  30. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
  31. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +95 -7
  32. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +3 -0
  33. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -0
  34. package/dist/migrations/v2.0/merge-infrastructure-directory.js +221 -0
  35. package/dist/migrations/v2.0/migrate-application-config-url.d.ts +3 -0
  36. package/dist/migrations/v2.0/migrate-application-config-url.d.ts.map +1 -0
  37. package/dist/migrations/v2.0/migrate-application-config-url.js +342 -0
  38. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
  39. package/dist/migrations/v2.0/migrate-scopes.js +6 -7
  40. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +1 -1
  41. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +3 -4
  42. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
  43. package/dist/migrations/v2.0/migrate-workqueue-configs.js +3 -4
  44. package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +1 -1
  45. package/dist/migrations/v2.0/remove-delete-actions.js +3 -4
  46. package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +1 -1
  47. package/dist/migrations/v2.0/remove-demo-scope.js +2 -3
  48. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +1 -1
  49. package/dist/migrations/v2.0/remove-deprecated-imports.js +3 -4
  50. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts +3 -0
  51. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts.map +1 -0
  52. package/dist/migrations/v2.0/remove-fhir-url-helpers.js +163 -0
  53. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +1 -1
  54. package/dist/migrations/v2.0/remove-hearth-migrations.js +1 -2
  55. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts +3 -0
  56. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts.map +1 -0
  57. package/dist/migrations/v2.0/remove-old-statistics-service.js +356 -0
  58. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +1 -1
  59. package/dist/migrations/v2.0/remove-pending-certification-flag.js +3 -4
  60. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +1 -1
  61. package/dist/migrations/v2.0/remove-review-from-register-action.js +3 -4
  62. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts +3 -0
  63. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts.map +1 -0
  64. package/dist/migrations/v2.0/remove-unused-environment-variables.js +186 -0
  65. package/dist/migrations/v2.0/rename-api-paths.d.ts.map +1 -1
  66. package/dist/migrations/v2.0/rename-api-paths.js +3 -4
  67. package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +1 -1
  68. package/dist/migrations/v2.0/rename-location-parent-id.js +3 -4
  69. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +1 -1
  70. package/dist/migrations/v2.0/simplify-analytics-precalculations.js +1 -2
  71. package/dist/migrations/v2.0/update-package-json.d.ts +3 -0
  72. package/dist/migrations/v2.0/update-package-json.d.ts.map +1 -0
  73. package/dist/migrations/v2.0/update-package-json.js +105 -0
  74. package/dist/notification/index.js +35 -7
  75. package/dist/scopes/index.d.ts +82 -10
  76. package/dist/scopes/index.js +41 -8
  77. package/opencrvs-toolkit-2.0.0-rc.fd8d9e7.tgz +0 -0
  78. package/package.json +1 -1
  79. package/tsconfig.tsbuildinfo +1 -1
  80. package/opencrvs-toolkit-2.0.0-rc.fc7f7fc.tgz +0 -0
@@ -3975,10 +3975,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
3975
3975
  output: {
3976
3976
  id: string & import("zod").$brand<"UUID">;
3977
3977
  name: {
3978
- use: string;
3979
- given: string[];
3980
- family: string;
3981
- }[];
3978
+ firstname: string;
3979
+ surname: string;
3980
+ };
3982
3981
  role: string;
3983
3982
  primaryOfficeId: string & import("zod").$brand<"UUID">;
3984
3983
  type: "user";
@@ -4008,10 +4007,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4008
4007
  create: import("@trpc/server").TRPCMutationProcedure<{
4009
4008
  input: {
4010
4009
  name: {
4011
- use: string;
4012
- given: string[];
4013
- family: string;
4014
- }[];
4010
+ firstname: string;
4011
+ surname: string;
4012
+ };
4015
4013
  role: string;
4016
4014
  primaryOfficeId: string;
4017
4015
  data?: Record<string, unknown> | undefined;
@@ -4020,6 +4018,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4020
4018
  email?: string | undefined;
4021
4019
  mobile?: string | undefined;
4022
4020
  username?: undefined;
4021
+ password?: undefined;
4023
4022
  signature?: {
4024
4023
  path: string;
4025
4024
  originalFilename: string;
@@ -4029,10 +4028,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4029
4028
  output: {
4030
4029
  id: string & import("zod").$brand<"UUID">;
4031
4030
  name: {
4032
- use: string;
4033
- given: string[];
4034
- family: string;
4035
- }[];
4031
+ firstname: string;
4032
+ surname: string;
4033
+ };
4036
4034
  role: string;
4037
4035
  primaryOfficeId: string & import("zod").$brand<"UUID">;
4038
4036
  type: "user";
@@ -4053,10 +4051,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4053
4051
  id: string;
4054
4052
  data?: Record<string, unknown> | undefined;
4055
4053
  name?: {
4056
- use: string;
4057
- given: string[];
4058
- family: string;
4059
- }[] | undefined;
4054
+ firstname: string;
4055
+ surname: string;
4056
+ } | undefined;
4060
4057
  role?: string | undefined;
4061
4058
  fullHonorificName?: string | undefined;
4062
4059
  device?: string | undefined;
@@ -4069,16 +4066,13 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4069
4066
  type: string;
4070
4067
  } | undefined;
4071
4068
  status?: "active" | "deactivated" | undefined;
4072
- } & {
4073
- id: string;
4074
4069
  };
4075
4070
  output: {
4076
4071
  id: string & import("zod").$brand<"UUID">;
4077
4072
  name: {
4078
- use: string;
4079
- given: string[];
4080
- family: string;
4081
- }[];
4073
+ firstname: string;
4074
+ surname: string;
4075
+ };
4082
4076
  role: string;
4083
4077
  primaryOfficeId: string & import("zod").$brand<"UUID">;
4084
4078
  type: "user";
@@ -4099,10 +4093,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4099
4093
  output: ({
4100
4094
  id: string & import("zod").$brand<"UUID">;
4101
4095
  name: {
4102
- use: string;
4103
- given: string[];
4104
- family: string;
4105
- }[];
4096
+ firstname: string;
4097
+ surname: string;
4098
+ };
4106
4099
  role: string;
4107
4100
  primaryOfficeId: string & import("zod").$brand<"UUID">;
4108
4101
  type: "user";
@@ -4144,10 +4137,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4144
4137
  output: ({
4145
4138
  id: string & import("zod").$brand<"UUID">;
4146
4139
  name: {
4147
- use: string;
4148
- given: string[];
4149
- family: string;
4150
- }[];
4140
+ firstname: string;
4141
+ surname: string;
4142
+ };
4151
4143
  role: string;
4152
4144
  primaryOfficeId: string & import("zod").$brand<"UUID">;
4153
4145
  type: "user";
@@ -4283,10 +4275,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4283
4275
  changeAvatar: import("@trpc/server").TRPCMutationProcedure<{
4284
4276
  input: {
4285
4277
  userId: string;
4286
- avatar: {
4287
- type: string;
4288
- data: string;
4289
- };
4278
+ avatar: string;
4290
4279
  };
4291
4280
  output: void;
4292
4281
  meta: import("trpc-to-openapi").OpenApiMeta;
@@ -4318,9 +4307,8 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4318
4307
  output: void;
4319
4308
  meta: import("trpc-to-openapi").OpenApiMeta;
4320
4309
  }>;
4321
- verifyPasswordById: import("@trpc/server").TRPCMutationProcedure<{
4310
+ verifyLoggedInUserPassword: import("@trpc/server").TRPCMutationProcedure<{
4322
4311
  input: {
4323
- id: string;
4324
4312
  password: string;
4325
4313
  };
4326
4314
  output: {
@@ -4786,7 +4774,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4786
4774
  'legalStatuses.DECLARED.createdAtLocation'?: {
4787
4775
  type: "within";
4788
4776
  location: string | {
4789
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4777
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4790
4778
  $location?: string | undefined;
4791
4779
  };
4792
4780
  } | undefined;
@@ -4808,7 +4796,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4808
4796
  'legalStatuses.REGISTERED.createdAtLocation'?: {
4809
4797
  type: "within";
4810
4798
  location: string | {
4811
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4799
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4812
4800
  $location?: string | undefined;
4813
4801
  };
4814
4802
  } | undefined;
@@ -4823,47 +4811,47 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4823
4811
  createdAtLocation?: {
4824
4812
  type: "within";
4825
4813
  location: string | {
4826
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4814
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4827
4815
  $location?: string | undefined;
4828
4816
  };
4829
4817
  } | {
4830
4818
  type: "exact";
4831
4819
  term: string | {
4832
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4820
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4833
4821
  $location?: string | undefined;
4834
4822
  };
4835
4823
  } | undefined;
4836
4824
  updatedAtLocation?: {
4837
4825
  type: "within";
4838
4826
  location: string | {
4839
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4827
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4840
4828
  $location?: string | undefined;
4841
4829
  };
4842
4830
  } | {
4843
4831
  type: "exact";
4844
4832
  term: string | {
4845
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4833
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4846
4834
  $location?: string | undefined;
4847
4835
  };
4848
4836
  } | undefined;
4849
4837
  updatedByUserRole?: {
4850
4838
  type: "exact";
4851
4839
  term: string | {
4852
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4840
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4853
4841
  $location?: string | undefined;
4854
4842
  };
4855
4843
  } | undefined;
4856
4844
  assignedTo?: {
4857
4845
  type: "exact";
4858
4846
  term: string | {
4859
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4847
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4860
4848
  $location?: string | undefined;
4861
4849
  };
4862
4850
  } | undefined;
4863
4851
  createdBy?: {
4864
4852
  type: "exact";
4865
4853
  term: string | {
4866
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4854
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4867
4855
  $location?: string | undefined;
4868
4856
  };
4869
4857
  } | undefined;
@@ -4874,7 +4862,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4874
4862
  updatedBy?: {
4875
4863
  type: "exact";
4876
4864
  term: string | {
4877
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4865
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4878
4866
  $location?: string | undefined;
4879
4867
  };
4880
4868
  } | undefined;
@@ -4924,7 +4912,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4924
4912
  'legalStatuses.DECLARED.createdAtLocation'?: {
4925
4913
  type: "within";
4926
4914
  location: string | {
4927
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4915
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4928
4916
  $location?: string | undefined;
4929
4917
  };
4930
4918
  } | undefined;
@@ -4946,7 +4934,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4946
4934
  'legalStatuses.REGISTERED.createdAtLocation'?: {
4947
4935
  type: "within";
4948
4936
  location: string | {
4949
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4937
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4950
4938
  $location?: string | undefined;
4951
4939
  };
4952
4940
  } | undefined;
@@ -4961,47 +4949,47 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4961
4949
  createdAtLocation?: {
4962
4950
  type: "within";
4963
4951
  location: string | {
4964
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4952
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4965
4953
  $location?: string | undefined;
4966
4954
  };
4967
4955
  } | {
4968
4956
  type: "exact";
4969
4957
  term: string | {
4970
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4958
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4971
4959
  $location?: string | undefined;
4972
4960
  };
4973
4961
  } | undefined;
4974
4962
  updatedAtLocation?: {
4975
4963
  type: "within";
4976
4964
  location: string | {
4977
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4965
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4978
4966
  $location?: string | undefined;
4979
4967
  };
4980
4968
  } | {
4981
4969
  type: "exact";
4982
4970
  term: string | {
4983
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4971
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4984
4972
  $location?: string | undefined;
4985
4973
  };
4986
4974
  } | undefined;
4987
4975
  updatedByUserRole?: {
4988
4976
  type: "exact";
4989
4977
  term: string | {
4990
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4978
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4991
4979
  $location?: string | undefined;
4992
4980
  };
4993
4981
  } | undefined;
4994
4982
  assignedTo?: {
4995
4983
  type: "exact";
4996
4984
  term: string | {
4997
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4985
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4998
4986
  $location?: string | undefined;
4999
4987
  };
5000
4988
  } | undefined;
5001
4989
  createdBy?: {
5002
4990
  type: "exact";
5003
4991
  term: string | {
5004
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
4992
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
5005
4993
  $location?: string | undefined;
5006
4994
  };
5007
4995
  } | undefined;
@@ -5012,7 +5000,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
5012
5000
  updatedBy?: {
5013
5001
  type: "exact";
5014
5002
  term: string | {
5015
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "avatar" | "signature" | "primaryOfficeId";
5003
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
5016
5004
  $location?: string | undefined;
5017
5005
  };
5018
5006
  } | undefined;
@@ -24,8 +24,14 @@ export declare const ApplicationConfig: z.ZodObject<{
24
24
  label: z.ZodObject<import("./events/TranslationConfig").MessageDescriptorZod, z.core.$strip>;
25
25
  }, z.core.$strip>>;
26
26
  PHONE_NUMBER_PATTERN: z.ZodUnion<[z.ZodString, z.ZodCustom<RegExp, RegExp>]>;
27
- USER_NOTIFICATION_DELIVERY_METHOD: z.ZodString;
28
- INFORMANT_NOTIFICATION_DELIVERY_METHOD: z.ZodString;
27
+ USER_NOTIFICATION_DELIVERY_METHOD: z.ZodEnum<{
28
+ email: "email";
29
+ sms: "sms";
30
+ }>;
31
+ INFORMANT_NOTIFICATION_DELIVERY_METHOD: z.ZodEnum<{
32
+ email: "email";
33
+ sms: "sms";
34
+ }>;
29
35
  SEARCH_DEFAULT_CRITERIA: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
30
36
  NAME: "NAME";
31
37
  EMAIL: "EMAIL";
@@ -46,8 +52,14 @@ export declare const BackgroundConfig: z.ZodObject<{
46
52
  export declare const LoginConfig: z.ZodObject<{
47
53
  COUNTRY: z.ZodString;
48
54
  LANGUAGES: z.ZodArray<z.ZodString>;
49
- USER_NOTIFICATION_DELIVERY_METHOD: z.ZodString;
50
- INFORMANT_NOTIFICATION_DELIVERY_METHOD: z.ZodString;
55
+ USER_NOTIFICATION_DELIVERY_METHOD: z.ZodEnum<{
56
+ email: "email";
57
+ sms: "sms";
58
+ }>;
59
+ INFORMANT_NOTIFICATION_DELIVERY_METHOD: z.ZodEnum<{
60
+ email: "email";
61
+ sms: "sms";
62
+ }>;
51
63
  PHONE_NUMBER_PATTERN: z.ZodUnion<[z.ZodString, z.ZodCustom<RegExp, RegExp>]>;
52
64
  LOGIN_BACKGROUND: z.ZodObject<{
53
65
  backgroundColor: z.ZodOptional<z.ZodString>;
@@ -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: "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
90
+ $option: "role" | "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: "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
95
+ $option: "role" | "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: "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
99
+ $option: "role" | "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
100
100
  };
101
101
  };
102
102
  };
@@ -1727,6 +1727,7 @@ declare const AdministrativeAreaField: z.ZodObject<{
1727
1727
  "dashboard.view": "dashboard.view";
1728
1728
  }>;
1729
1729
  $option: z.ZodEnum<{
1730
+ role: "role";
1730
1731
  event: "event";
1731
1732
  placeOfEvent: "placeOfEvent";
1732
1733
  declaredIn: "declaredIn";
@@ -1845,6 +1846,7 @@ declare const LocationInput: z.ZodObject<{
1845
1846
  "dashboard.view": "dashboard.view";
1846
1847
  }>;
1847
1848
  $option: z.ZodEnum<{
1849
+ role: "role";
1848
1850
  event: "event";
1849
1851
  placeOfEvent: "placeOfEvent";
1850
1852
  declaredIn: "declaredIn";
@@ -2028,6 +2030,7 @@ declare const Facility: z.ZodObject<{
2028
2030
  "dashboard.view": "dashboard.view";
2029
2031
  }>;
2030
2032
  $option: z.ZodEnum<{
2033
+ role: "role";
2031
2034
  event: "event";
2032
2035
  placeOfEvent: "placeOfEvent";
2033
2036
  declaredIn: "declaredIn";
@@ -2132,6 +2135,7 @@ declare const Office: z.ZodObject<{
2132
2135
  "dashboard.view": "dashboard.view";
2133
2136
  }>;
2134
2137
  $option: z.ZodEnum<{
2138
+ role: "role";
2135
2139
  event: "event";
2136
2140
  placeOfEvent: "placeOfEvent";
2137
2141
  declaredIn: "declaredIn";
@@ -2323,6 +2327,7 @@ declare const Address: z.ZodObject<{
2323
2327
  "dashboard.view": "dashboard.view";
2324
2328
  }>;
2325
2329
  $option: z.ZodEnum<{
2330
+ role: "role";
2326
2331
  event: "event";
2327
2332
  placeOfEvent: "placeOfEvent";
2328
2333
  declaredIn: "declaredIn";
@@ -1,7 +1,8 @@
1
+ import { UUID } from '../uuid';
1
2
  import * as z from 'zod/v4';
2
3
  import { EventIndex } from './EventIndex';
3
4
  import { ActionCreationMetadata, RegistrationCreationMetadata } from './EventMetadata';
4
- import { RecordScopeV2 } from '../scopes';
5
+ import { RecordScopeV2, UserScopeV2 } from '../scopes';
5
6
  import { SystemContext, UserContext } from '../users/User';
6
7
  /** @deprecated Moving on, location types are arbitrary and defined by the country config. */
7
8
  export declare const LocationTypeV1: z.ZodEnum<{
@@ -51,6 +52,21 @@ export type EventIndexWithAdministrativeHierarchy = Omit<ToArrayFields<EventInde
51
52
  *
52
53
  */
53
54
  export declare function canAccessEventWithScope(event: Partial<EventIndexWithAdministrativeHierarchy>, scope: RecordScopeV2, user: UserContext | SystemContext, customActionType?: string): boolean;
55
+ export type UserWithResolvedHierarchy = {
56
+ role: string;
57
+ administrativeHierarchy: UUID[];
58
+ primaryOfficeId: UUID;
59
+ };
60
+ export declare function canAccessUserWithScope({ userToAccess, scope, user }: {
61
+ userToAccess: UserWithResolvedHierarchy;
62
+ scope: UserScopeV2;
63
+ user: UserContext | SystemContext;
64
+ }): boolean;
65
+ export declare function canAccessOtherUserWithScopes({ scopes, userToAccess, user }: {
66
+ scopes: UserScopeV2[];
67
+ userToAccess: UserWithResolvedHierarchy;
68
+ user: UserContext | SystemContext;
69
+ }): boolean;
54
70
  /**
55
71
  * Given indexed event and list of resolved scopes, determine if any of the scopes allow access to the event.
56
72
  *
@@ -182,6 +182,10 @@ var scopeByEvent = z6.preprocess(
182
182
  (val) => val === void 0 ? void 0 : [val].flat(),
183
183
  z6.array(z6.string()).optional()
184
184
  ).describe("Event type, e.g. birth, death");
185
+ var userRole = z6.preprocess(
186
+ (val) => val === void 0 ? void 0 : [val].flat(),
187
+ z6.array(z6.string()).optional()
188
+ ).describe("User role, e.g. admin, field agent");
185
189
  var scopeOptionsPlaceEvent = z6.object({
186
190
  event: scopeByEvent,
187
191
  placeOfEvent: JurisdictionFilter.optional()
@@ -205,6 +209,9 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
205
209
  var AccessLevelOptions = z6.object({
206
210
  accessLevel: JurisdictionFilter.optional()
207
211
  });
212
+ var AllUserScopeOptions = AccessLevelOptions.extend({
213
+ role: userRole.optional()
214
+ });
208
215
  var WorkqueueOrDashboardOptions = z6.object({
209
216
  ids: z6.preprocess(
210
217
  (val) => val === void 0 ? void 0 : [val].flat(),
@@ -214,6 +221,7 @@ var WorkqueueOrDashboardOptions = z6.object({
214
221
  var AllScopeOptions = z6.object({
215
222
  ...AllRecordScopeOptions.shape,
216
223
  ...AccessLevelOptions.shape,
224
+ ...AllUserScopeOptions.shape,
217
225
  ...WorkqueueOrDashboardOptions.shape
218
226
  });
219
227
  var ScopeOptionKey = AllScopeOptions.keyof();
@@ -286,6 +294,28 @@ var RecordScopeV2 = z6.discriminatedUnion("type", [
286
294
  ]).describe(
287
295
  "Scopes used to check user's permission to perform actions on a record."
288
296
  );
297
+ var SystemScopeType = z6.enum([
298
+ "organisation.read-locations",
299
+ "user.read",
300
+ "user.create",
301
+ "user.edit"
302
+ ]);
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
+ ]);
289
319
  var ResolvedRecordScopeV2 = z6.discriminatedUnion("type", [
290
320
  z6.object({
291
321
  type: ScopesWithPlaceEventOptions,
@@ -306,16 +336,14 @@ var ResolvedRecordScopeV2 = z6.discriminatedUnion("type", [
306
336
  }).optional()
307
337
  })
308
338
  ]).describe("Resolved scope with location/user IDs instead of filters.");
309
- var SystemScopeType = z6.enum([
310
- "organisation.read-locations",
311
- "user.read",
312
- "user.create",
313
- "user.edit"
314
- ]);
315
339
  var Scope2 = z6.discriminatedUnion("type", [
316
340
  z6.object({ type: PlainScopeType }),
317
341
  ...RecordScopeV2.options,
318
- z6.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
342
+ ...UserScopeV2.options,
343
+ z6.object({
344
+ type: z6.literal("organisation.read-locations"),
345
+ options: AccessLevelOptions.optional()
346
+ }),
319
347
  z6.object({
320
348
  type: z6.literal("workqueue"),
321
349
  options: WorkqueueOrDashboardOptions
@@ -243,6 +243,8 @@ __export(events_exports, {
243
243
  areConditionsMet: () => areConditionsMet,
244
244
  buildFormState: () => buildFormState,
245
245
  canAccessEventWithScope: () => canAccessEventWithScope,
246
+ canAccessOtherUserWithScopes: () => canAccessOtherUserWithScopes,
247
+ canAccessUserWithScope: () => canAccessUserWithScope,
246
248
  compositeFieldTypes: () => compositeFieldTypes,
247
249
  createEmptyDraft: () => createEmptyDraft,
248
250
  createFieldConditionals: () => createFieldConditionals,
@@ -489,6 +491,10 @@ var scopeByEvent = z2.preprocess(
489
491
  (val) => val === void 0 ? void 0 : [val].flat(),
490
492
  z2.array(z2.string()).optional()
491
493
  ).describe("Event type, e.g. birth, death");
494
+ var userRole = z2.preprocess(
495
+ (val) => val === void 0 ? void 0 : [val].flat(),
496
+ z2.array(z2.string()).optional()
497
+ ).describe("User role, e.g. admin, field agent");
492
498
  var scopeOptionsPlaceEvent = z2.object({
493
499
  event: scopeByEvent,
494
500
  placeOfEvent: JurisdictionFilter.optional()
@@ -512,6 +518,9 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
512
518
  var AccessLevelOptions = z2.object({
513
519
  accessLevel: JurisdictionFilter.optional()
514
520
  });
521
+ var AllUserScopeOptions = AccessLevelOptions.extend({
522
+ role: userRole.optional()
523
+ });
515
524
  var WorkqueueOrDashboardOptions = z2.object({
516
525
  ids: z2.preprocess(
517
526
  (val) => val === void 0 ? void 0 : [val].flat(),
@@ -521,6 +530,7 @@ var WorkqueueOrDashboardOptions = z2.object({
521
530
  var AllScopeOptions = z2.object({
522
531
  ...AllRecordScopeOptions.shape,
523
532
  ...AccessLevelOptions.shape,
533
+ ...AllUserScopeOptions.shape,
524
534
  ...WorkqueueOrDashboardOptions.shape
525
535
  });
526
536
  var ScopeOptionKey = AllScopeOptions.keyof();
@@ -593,6 +603,31 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
593
603
  ]).describe(
594
604
  "Scopes used to check user's permission to perform actions on a record."
595
605
  );
606
+ var SystemScopeType = z2.enum([
607
+ "organisation.read-locations",
608
+ "user.read",
609
+ "user.create",
610
+ "user.edit"
611
+ ]);
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
+ }
596
631
  function scopeUsesDeclaredOptions(scope) {
597
632
  return !ScopesWithPlaceEventOptions.options.some((opt) => opt === scope.type);
598
633
  }
@@ -625,16 +660,14 @@ var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
625
660
  }).optional()
626
661
  })
627
662
  ]).describe("Resolved scope with location/user IDs instead of filters.");
628
- var SystemScopeType = z2.enum([
629
- "organisation.read-locations",
630
- "user.read",
631
- "user.create",
632
- "user.edit"
633
- ]);
634
663
  var Scope = z2.discriminatedUnion("type", [
635
664
  z2.object({ type: PlainScopeType }),
636
665
  ...RecordScopeV2.options,
637
- z2.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
666
+ ...UserScopeV2.options,
667
+ z2.object({
668
+ type: z2.literal("organisation.read-locations"),
669
+ options: AccessLevelOptions.optional()
670
+ }),
638
671
  z2.object({
639
672
  type: z2.literal("workqueue"),
640
673
  options: WorkqueueOrDashboardOptions
@@ -9930,6 +9963,39 @@ function canAccessEventWithScope(event2, scope, user2, customActionType) {
9930
9963
  }
9931
9964
  return true;
9932
9965
  }
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
+ }
9933
9999
  function userCanAccessEventWithScopes(event2, scopes, user2, customActionType) {
9934
10000
  return scopes.some(
9935
10001
  (scope) => canAccessEventWithScope(event2, scope, user2, customActionType)