@opencrvs/toolkit 2.0.0-rc.eac601e → 2.0.0-rc.ed5fbdc

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 (86) hide show
  1. package/create-countryconfig/index.js +73 -0
  2. package/create-countryconfig/package.json +11 -0
  3. package/dist/application-config/index.js +53 -31
  4. package/dist/cli.js +1784 -349
  5. package/dist/commons/api/router.d.ts +62 -54
  6. package/dist/commons/application-config/index.d.ts +16 -4
  7. package/dist/commons/conditionals/conditionals.d.ts +6 -6
  8. package/dist/commons/events/ActionInput.d.ts +36 -0
  9. package/dist/commons/events/Draft.d.ts +1 -0
  10. package/dist/commons/events/FieldConfig.d.ts +10 -0
  11. package/dist/commons/events/locations.d.ts +38 -1
  12. package/dist/commons/events/mocks.test.utils.d.ts +19 -0
  13. package/dist/commons/events/scopes.d.ts +24 -1
  14. package/dist/conditionals/index.js +37 -7
  15. package/dist/events/index.js +143 -27
  16. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
  17. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +63 -39
  18. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts +3 -0
  19. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts.map +1 -0
  20. package/dist/migrations/v2.0/add-resend-invite-notification.js +373 -0
  21. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +19 -0
  22. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  23. package/dist/migrations/v2.0/checkout-upstream-files.js +17 -14
  24. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -1
  25. package/dist/migrations/v2.0/convert-config-files-to-ts.js +4 -5
  26. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +1 -1
  27. package/dist/migrations/v2.0/convert-paragraph-to-heading.js +4 -5
  28. package/dist/migrations/v2.0/create-events-index.d.ts.map +1 -1
  29. package/dist/migrations/v2.0/create-events-index.js +1 -2
  30. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +11 -0
  31. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -0
  32. package/dist/migrations/v2.0/delete-infrastructure-directory.js +123 -0
  33. package/dist/migrations/v2.0/index.d.ts +10 -4
  34. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  35. package/dist/migrations/v2.0/index.js +1752 -346
  36. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
  37. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +95 -7
  38. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +13 -0
  39. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -0
  40. package/dist/migrations/v2.0/merge-infrastructure-directory.js +222 -0
  41. package/dist/migrations/v2.0/migrate-application-config-url.d.ts +3 -0
  42. package/dist/migrations/v2.0/migrate-application-config-url.d.ts.map +1 -0
  43. package/dist/migrations/v2.0/migrate-application-config-url.js +342 -0
  44. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
  45. package/dist/migrations/v2.0/migrate-scopes.js +6 -7
  46. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +1 -1
  47. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +3 -4
  48. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
  49. package/dist/migrations/v2.0/migrate-workqueue-configs.js +143 -63
  50. package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +1 -1
  51. package/dist/migrations/v2.0/remove-delete-actions.js +3 -4
  52. package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +1 -1
  53. package/dist/migrations/v2.0/remove-demo-scope.js +2 -3
  54. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +1 -1
  55. package/dist/migrations/v2.0/remove-deprecated-imports.js +3 -4
  56. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts +3 -0
  57. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts.map +1 -0
  58. package/dist/migrations/v2.0/remove-fhir-url-helpers.js +163 -0
  59. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +1 -1
  60. package/dist/migrations/v2.0/remove-hearth-migrations.js +1 -2
  61. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts +3 -0
  62. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts.map +1 -0
  63. package/dist/migrations/v2.0/remove-old-statistics-service.js +356 -0
  64. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +1 -1
  65. package/dist/migrations/v2.0/remove-pending-certification-flag.js +3 -4
  66. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +1 -1
  67. package/dist/migrations/v2.0/remove-review-from-register-action.js +3 -4
  68. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts +3 -0
  69. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts.map +1 -0
  70. package/dist/migrations/v2.0/remove-unused-environment-variables.js +186 -0
  71. package/dist/migrations/v2.0/rename-api-paths.d.ts.map +1 -1
  72. package/dist/migrations/v2.0/rename-api-paths.js +3 -4
  73. package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +1 -1
  74. package/dist/migrations/v2.0/rename-location-parent-id.js +3 -4
  75. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +1 -1
  76. package/dist/migrations/v2.0/simplify-analytics-precalculations.js +1 -2
  77. package/dist/migrations/v2.0/update-package-json.d.ts +3 -0
  78. package/dist/migrations/v2.0/update-package-json.d.ts.map +1 -0
  79. package/dist/migrations/v2.0/update-package-json.js +105 -0
  80. package/dist/notification/index.js +50 -27
  81. package/dist/scopes/index.d.ts +87 -10
  82. package/dist/scopes/index.js +43 -8
  83. package/opencrvs-toolkit-2.0.0-rc.ed5fbdc.tgz +0 -0
  84. package/package.json +1 -1
  85. package/tsconfig.tsbuildinfo +1 -1
  86. package/opencrvs-toolkit-2.0.0-rc.eac601e.tgz +0 -0
@@ -6,6 +6,7 @@ export declare const BaseActionInput: z.ZodObject<{
6
6
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
7
7
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
8
8
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
9
+ waitFor: z.ZodOptional<z.ZodBoolean>;
9
10
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
10
11
  }, z.core.$strip>;
11
12
  export declare const RegisterActionInput: z.ZodObject<{
@@ -15,6 +16,7 @@ export declare const RegisterActionInput: z.ZodObject<{
15
16
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
16
17
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
17
18
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
19
+ waitFor: z.ZodOptional<z.ZodBoolean>;
18
20
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
19
21
  type: z.ZodDefault<z.ZodLiteral<"REGISTER">>;
20
22
  registrationNumber: z.ZodOptional<z.ZodString>;
@@ -27,6 +29,7 @@ export declare const NotifyActionInput: z.ZodObject<{
27
29
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
28
30
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
29
31
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
32
+ waitFor: z.ZodOptional<z.ZodBoolean>;
30
33
  type: z.ZodDefault<z.ZodLiteral<"NOTIFY">>;
31
34
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
32
35
  }, z.core.$strip>;
@@ -38,6 +41,7 @@ export declare const DeclareActionInput: z.ZodObject<{
38
41
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
39
42
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
40
43
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
44
+ waitFor: z.ZodOptional<z.ZodBoolean>;
41
45
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
42
46
  type: z.ZodDefault<z.ZodLiteral<"DECLARE">>;
43
47
  }, z.core.$strip>;
@@ -48,6 +52,7 @@ export declare const EditActionInput: z.ZodObject<{
48
52
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
49
53
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
50
54
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
55
+ waitFor: z.ZodOptional<z.ZodBoolean>;
51
56
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
52
57
  type: z.ZodDefault<z.ZodLiteral<"EDIT">>;
53
58
  content: z.ZodObject<{
@@ -62,6 +67,7 @@ export declare const PrintCertificateActionInput: z.ZodObject<{
62
67
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
63
68
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
64
69
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
70
+ waitFor: z.ZodOptional<z.ZodBoolean>;
65
71
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
66
72
  type: z.ZodDefault<z.ZodLiteral<"PRINT_CERTIFICATE">>;
67
73
  content: z.ZodOptional<z.ZodObject<{
@@ -76,6 +82,7 @@ export declare const RejectDeclarationActionInput: z.ZodObject<{
76
82
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
77
83
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
78
84
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
85
+ waitFor: z.ZodOptional<z.ZodBoolean>;
79
86
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
80
87
  type: z.ZodDefault<z.ZodLiteral<"REJECT">>;
81
88
  content: z.ZodObject<{
@@ -90,6 +97,7 @@ export declare const DuplicateDetectedActionInput: z.ZodObject<{
90
97
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
91
98
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
92
99
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
100
+ waitFor: z.ZodOptional<z.ZodBoolean>;
93
101
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
94
102
  type: z.ZodDefault<z.ZodLiteral<"DUPLICATE_DETECTED">>;
95
103
  content: z.ZodObject<{
@@ -106,6 +114,7 @@ export declare const MarkAsDuplicateActionInput: z.ZodObject<{
106
114
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
107
115
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
108
116
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
117
+ waitFor: z.ZodOptional<z.ZodBoolean>;
109
118
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
110
119
  type: z.ZodDefault<z.ZodLiteral<"MARK_AS_DUPLICATE">>;
111
120
  content: z.ZodOptional<z.ZodObject<{
@@ -120,6 +129,7 @@ export declare const MarkNotDuplicateActionInput: z.ZodObject<{
120
129
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
121
130
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
122
131
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
132
+ waitFor: z.ZodOptional<z.ZodBoolean>;
123
133
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
124
134
  type: z.ZodDefault<z.ZodLiteral<"MARK_AS_NOT_DUPLICATE">>;
125
135
  }, z.core.$strip>;
@@ -131,6 +141,7 @@ export declare const ArchiveActionInput: z.ZodObject<{
131
141
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
132
142
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
133
143
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
144
+ waitFor: z.ZodOptional<z.ZodBoolean>;
134
145
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
135
146
  type: z.ZodDefault<z.ZodLiteral<"ARCHIVE">>;
136
147
  content: z.ZodObject<{
@@ -145,6 +156,7 @@ export declare const AssignActionInput: z.ZodObject<{
145
156
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
146
157
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
147
158
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
159
+ waitFor: z.ZodOptional<z.ZodBoolean>;
148
160
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
149
161
  type: z.ZodLiteral<"ASSIGN">;
150
162
  assignedTo: z.ZodString;
@@ -157,6 +169,7 @@ export declare const UnassignActionInput: z.ZodObject<{
157
169
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
158
170
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
159
171
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
172
+ waitFor: z.ZodOptional<z.ZodBoolean>;
160
173
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
161
174
  type: z.ZodDefault<z.ZodLiteral<"UNASSIGN">>;
162
175
  assignedTo: z.ZodDefault<z.ZodLiteral<null>>;
@@ -169,6 +182,7 @@ export declare const RequestCorrectionActionInput: z.ZodObject<{
169
182
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
170
183
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
171
184
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
185
+ waitFor: z.ZodOptional<z.ZodBoolean>;
172
186
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
173
187
  type: z.ZodDefault<z.ZodLiteral<"REQUEST_CORRECTION">>;
174
188
  }, z.core.$strip>;
@@ -180,6 +194,7 @@ export declare const RejectCorrectionActionInput: z.ZodObject<{
180
194
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
181
195
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
182
196
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
197
+ waitFor: z.ZodOptional<z.ZodBoolean>;
183
198
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
184
199
  requestId: z.ZodString;
185
200
  type: z.ZodDefault<z.ZodLiteral<"REJECT_CORRECTION">>;
@@ -195,6 +210,7 @@ export declare const ApproveCorrectionActionInput: z.ZodObject<{
195
210
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
196
211
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
197
212
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
213
+ waitFor: z.ZodOptional<z.ZodBoolean>;
198
214
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
199
215
  requestId: z.ZodString;
200
216
  type: z.ZodDefault<z.ZodLiteral<"APPROVE_CORRECTION">>;
@@ -207,6 +223,7 @@ export declare const ReadActionInput: z.ZodObject<{
207
223
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
208
224
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
209
225
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
226
+ waitFor: z.ZodOptional<z.ZodBoolean>;
210
227
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
211
228
  type: z.ZodDefault<z.ZodLiteral<"READ">>;
212
229
  }, z.core.$strip>;
@@ -222,6 +239,7 @@ export declare const CustomActionInput: z.ZodObject<{
222
239
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
223
240
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
224
241
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
242
+ waitFor: z.ZodOptional<z.ZodBoolean>;
225
243
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
226
244
  type: z.ZodDefault<z.ZodLiteral<"CUSTOM">>;
227
245
  customActionType: z.ZodString;
@@ -242,6 +260,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
242
260
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
243
261
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
244
262
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
263
+ waitFor: z.ZodOptional<z.ZodBoolean>;
245
264
  type: z.ZodDefault<z.ZodLiteral<"CREATE">>;
246
265
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
247
266
  }, z.core.$strip>, z.ZodObject<{
@@ -251,6 +270,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
251
270
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
252
271
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
253
272
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
273
+ waitFor: z.ZodOptional<z.ZodBoolean>;
254
274
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
255
275
  type: z.ZodDefault<z.ZodLiteral<"REGISTER">>;
256
276
  registrationNumber: z.ZodOptional<z.ZodString>;
@@ -261,6 +281,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
261
281
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
262
282
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
263
283
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
284
+ waitFor: z.ZodOptional<z.ZodBoolean>;
264
285
  type: z.ZodDefault<z.ZodLiteral<"NOTIFY">>;
265
286
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
266
287
  }, z.core.$strip>, z.ZodObject<{
@@ -270,6 +291,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
270
291
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
271
292
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
272
293
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
294
+ waitFor: z.ZodOptional<z.ZodBoolean>;
273
295
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
274
296
  type: z.ZodDefault<z.ZodLiteral<"DECLARE">>;
275
297
  }, z.core.$strip>, z.ZodObject<{
@@ -279,6 +301,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
279
301
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
280
302
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
281
303
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
304
+ waitFor: z.ZodOptional<z.ZodBoolean>;
282
305
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
283
306
  type: z.ZodDefault<z.ZodLiteral<"REJECT">>;
284
307
  content: z.ZodObject<{
@@ -291,6 +314,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
291
314
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
292
315
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
293
316
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
317
+ waitFor: z.ZodOptional<z.ZodBoolean>;
294
318
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
295
319
  type: z.ZodDefault<z.ZodLiteral<"DUPLICATE_DETECTED">>;
296
320
  content: z.ZodObject<{
@@ -306,6 +330,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
306
330
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
307
331
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
308
332
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
333
+ waitFor: z.ZodOptional<z.ZodBoolean>;
309
334
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
310
335
  type: z.ZodDefault<z.ZodLiteral<"MARK_AS_DUPLICATE">>;
311
336
  content: z.ZodOptional<z.ZodObject<{
@@ -318,6 +343,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
318
343
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
319
344
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
320
345
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
346
+ waitFor: z.ZodOptional<z.ZodBoolean>;
321
347
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
322
348
  type: z.ZodDefault<z.ZodLiteral<"MARK_AS_NOT_DUPLICATE">>;
323
349
  }, z.core.$strip>, z.ZodObject<{
@@ -327,6 +353,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
327
353
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
328
354
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
329
355
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
356
+ waitFor: z.ZodOptional<z.ZodBoolean>;
330
357
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
331
358
  type: z.ZodDefault<z.ZodLiteral<"ARCHIVE">>;
332
359
  content: z.ZodObject<{
@@ -339,6 +366,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
339
366
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
340
367
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
341
368
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
369
+ waitFor: z.ZodOptional<z.ZodBoolean>;
342
370
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
343
371
  type: z.ZodLiteral<"ASSIGN">;
344
372
  assignedTo: z.ZodString;
@@ -349,6 +377,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
349
377
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
350
378
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
351
379
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
380
+ waitFor: z.ZodOptional<z.ZodBoolean>;
352
381
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
353
382
  type: z.ZodDefault<z.ZodLiteral<"UNASSIGN">>;
354
383
  assignedTo: z.ZodDefault<z.ZodLiteral<null>>;
@@ -359,6 +388,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
359
388
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
360
389
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
361
390
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
391
+ waitFor: z.ZodOptional<z.ZodBoolean>;
362
392
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
363
393
  type: z.ZodDefault<z.ZodLiteral<"PRINT_CERTIFICATE">>;
364
394
  content: z.ZodOptional<z.ZodObject<{
@@ -371,6 +401,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
371
401
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
372
402
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
373
403
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
404
+ waitFor: z.ZodOptional<z.ZodBoolean>;
374
405
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
375
406
  type: z.ZodDefault<z.ZodLiteral<"REQUEST_CORRECTION">>;
376
407
  }, z.core.$strip>, z.ZodObject<{
@@ -380,6 +411,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
380
411
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
381
412
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
382
413
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
414
+ waitFor: z.ZodOptional<z.ZodBoolean>;
383
415
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
384
416
  requestId: z.ZodString;
385
417
  type: z.ZodDefault<z.ZodLiteral<"REJECT_CORRECTION">>;
@@ -393,6 +425,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
393
425
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
394
426
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
395
427
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
428
+ waitFor: z.ZodOptional<z.ZodBoolean>;
396
429
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
397
430
  requestId: z.ZodString;
398
431
  type: z.ZodDefault<z.ZodLiteral<"APPROVE_CORRECTION">>;
@@ -403,6 +436,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
403
436
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
404
437
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
405
438
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
439
+ waitFor: z.ZodOptional<z.ZodBoolean>;
406
440
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
407
441
  type: z.ZodDefault<z.ZodLiteral<"READ">>;
408
442
  }, z.core.$strip>, z.ZodObject<{
@@ -412,6 +446,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
412
446
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
413
447
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
414
448
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
449
+ waitFor: z.ZodOptional<z.ZodBoolean>;
415
450
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
416
451
  type: z.ZodDefault<z.ZodLiteral<"CUSTOM">>;
417
452
  customActionType: z.ZodString;
@@ -422,6 +457,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
422
457
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
423
458
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
424
459
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
460
+ waitFor: z.ZodOptional<z.ZodBoolean>;
425
461
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
426
462
  type: z.ZodDefault<z.ZodLiteral<"EDIT">>;
427
463
  content: z.ZodObject<{
@@ -51,6 +51,7 @@ export declare const DraftInput: z.ZodObject<{
51
51
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
52
52
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
53
53
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
54
+ waitFor: z.ZodOptional<z.ZodBoolean>;
54
55
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
55
56
  type: z.ZodEnum<{
56
57
  CUSTOM: "CUSTOM";
@@ -1723,10 +1723,12 @@ declare const AdministrativeAreaField: z.ZodObject<{
1723
1723
  "user.read": "user.read";
1724
1724
  "user.create": "user.create";
1725
1725
  "user.edit": "user.edit";
1726
+ "user.search": "user.search";
1726
1727
  workqueue: "workqueue";
1727
1728
  "dashboard.view": "dashboard.view";
1728
1729
  }>;
1729
1730
  $option: z.ZodEnum<{
1731
+ role: "role";
1730
1732
  event: "event";
1731
1733
  placeOfEvent: "placeOfEvent";
1732
1734
  declaredIn: "declaredIn";
@@ -1841,10 +1843,12 @@ declare const LocationInput: z.ZodObject<{
1841
1843
  "user.read": "user.read";
1842
1844
  "user.create": "user.create";
1843
1845
  "user.edit": "user.edit";
1846
+ "user.search": "user.search";
1844
1847
  workqueue: "workqueue";
1845
1848
  "dashboard.view": "dashboard.view";
1846
1849
  }>;
1847
1850
  $option: z.ZodEnum<{
1851
+ role: "role";
1848
1852
  event: "event";
1849
1853
  placeOfEvent: "placeOfEvent";
1850
1854
  declaredIn: "declaredIn";
@@ -2024,10 +2028,12 @@ declare const Facility: z.ZodObject<{
2024
2028
  "user.read": "user.read";
2025
2029
  "user.create": "user.create";
2026
2030
  "user.edit": "user.edit";
2031
+ "user.search": "user.search";
2027
2032
  workqueue: "workqueue";
2028
2033
  "dashboard.view": "dashboard.view";
2029
2034
  }>;
2030
2035
  $option: z.ZodEnum<{
2036
+ role: "role";
2031
2037
  event: "event";
2032
2038
  placeOfEvent: "placeOfEvent";
2033
2039
  declaredIn: "declaredIn";
@@ -2128,10 +2134,12 @@ declare const Office: z.ZodObject<{
2128
2134
  "user.read": "user.read";
2129
2135
  "user.create": "user.create";
2130
2136
  "user.edit": "user.edit";
2137
+ "user.search": "user.search";
2131
2138
  workqueue: "workqueue";
2132
2139
  "dashboard.view": "dashboard.view";
2133
2140
  }>;
2134
2141
  $option: z.ZodEnum<{
2142
+ role: "role";
2135
2143
  event: "event";
2136
2144
  placeOfEvent: "placeOfEvent";
2137
2145
  declaredIn: "declaredIn";
@@ -2319,10 +2327,12 @@ declare const Address: z.ZodObject<{
2319
2327
  "user.read": "user.read";
2320
2328
  "user.create": "user.create";
2321
2329
  "user.edit": "user.edit";
2330
+ "user.search": "user.search";
2322
2331
  workqueue: "workqueue";
2323
2332
  "dashboard.view": "dashboard.view";
2324
2333
  }>;
2325
2334
  $option: z.ZodEnum<{
2335
+ role: "role";
2326
2336
  event: "event";
2327
2337
  placeOfEvent: "placeOfEvent";
2328
2338
  declaredIn: "declaredIn";
@@ -1,7 +1,8 @@
1
+ import { UUID } from '../uuid';
1
2
  import * as z from 'zod/v4';
2
3
  import { EventIndex } from './EventIndex';
3
4
  import { ActionCreationMetadata, RegistrationCreationMetadata } from './EventMetadata';
4
- import { RecordScopeV2 } from '../scopes';
5
+ import { RecordScopeV2, UserScopeV2 } from '../scopes';
5
6
  import { SystemContext, UserContext } from '../users/User';
6
7
  /** @deprecated Moving on, location types are arbitrary and defined by the country config. */
7
8
  export declare const LocationTypeV1: z.ZodEnum<{
@@ -51,11 +52,47 @@ export type EventIndexWithAdministrativeHierarchy = Omit<ToArrayFields<EventInde
51
52
  *
52
53
  */
53
54
  export declare function canAccessEventWithScope(event: Partial<EventIndexWithAdministrativeHierarchy>, scope: RecordScopeV2, user: UserContext | SystemContext, customActionType?: string): boolean;
55
+ export type UserWithResolvedHierarchy = {
56
+ role: string;
57
+ administrativeHierarchy: UUID[];
58
+ primaryOfficeId: UUID;
59
+ };
60
+ export declare function canAccessUserWithScope({ userToAccess, scope, user }: {
61
+ userToAccess: UserWithResolvedHierarchy;
62
+ scope: UserScopeV2;
63
+ user: UserContext | SystemContext;
64
+ }): boolean;
65
+ export declare function canAccessOtherUserWithScopes({ scopes, userToAccess, user }: {
66
+ scopes: UserScopeV2[];
67
+ userToAccess: UserWithResolvedHierarchy;
68
+ user: UserContext | SystemContext;
69
+ }): boolean;
54
70
  /**
55
71
  * Given indexed event and list of resolved scopes, determine if any of the scopes allow access to the event.
56
72
  *
57
73
  * One of the scopes must allow access for the event to be accessible.
58
74
  */
59
75
  export declare function userCanAccessEventWithScopes(event: Partial<EventIndexWithAdministrativeHierarchy>, scopes: RecordScopeV2[], user: UserContext | SystemContext, customActionType?: string): boolean;
76
+ export declare function getAdministrativeAreaHierarchy(administrativeAreaId: string | undefined | null, administrativeAreas: Map<UUID, AdministrativeArea>): {
77
+ id: string & z.core.$brand<"UUID">;
78
+ name: string;
79
+ parentId: (string & z.core.$brand<"UUID">) | null;
80
+ validUntil: string | null;
81
+ externalId?: string | null | undefined;
82
+ }[];
83
+ /**
84
+ * Resolves a location or administrative area UUID into a root-first hierarchy of UUIDs.
85
+ *
86
+ * If the ID refers to a `Location` (e.g. CRVS office), the hierarchy includes
87
+ * the administrative area ancestors followed by the location itself.
88
+ * If the ID refers to an `AdministrativeArea`, returns the area's ancestor chain (root-first).
89
+ *
90
+ * Uses `getAdministrativeAreaHierarchy` which returns leaf-first order,
91
+ * so the result is reversed to match the root-first convention used by the server.
92
+ */
93
+ export declare function getLocationHierarchy(selectedId: UUID, context: {
94
+ administrativeAreas: Map<UUID, AdministrativeArea>;
95
+ locations: Map<UUID, Location>;
96
+ }): UUID[];
60
97
  export {};
61
98
  //# sourceMappingURL=locations.d.ts.map
@@ -0,0 +1,19 @@
1
+ import { AdministrativeArea, Location } from './locations';
2
+ export declare const V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS: AdministrativeArea[];
3
+ export declare const V2_DEFAULT_MOCK_LOCATIONS: Location[];
4
+ export declare const V2_DEFAULT_MOCK_LOCATIONS_MAP: Map<string & import("zod").$brand<"UUID">, {
5
+ id: string & import("zod").$brand<"UUID">;
6
+ name: string;
7
+ administrativeAreaId: (string & import("zod").$brand<"UUID">) | null;
8
+ validUntil: string | null;
9
+ locationType: string | null;
10
+ externalId?: string | null | undefined;
11
+ }>;
12
+ export declare const V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP: Map<string & import("zod").$brand<"UUID">, {
13
+ id: string & import("zod").$brand<"UUID">;
14
+ name: string;
15
+ parentId: (string & import("zod").$brand<"UUID">) | null;
16
+ validUntil: string | null;
17
+ externalId?: string | null | undefined;
18
+ }>;
19
+ //# sourceMappingURL=mocks.test.utils.d.ts.map
@@ -1,8 +1,9 @@
1
1
  import { DisplayableAction } from './ActionType';
2
- import { EncodedScope } from '../scopes';
2
+ import { EncodedScope, UserScopeV2 } from '../scopes';
3
3
  import { EventIndexWithAdministrativeHierarchy } from './locations';
4
4
  import { UserContext } from '../users/User';
5
5
  import { EventIndex } from './EventIndex';
6
+ import { UUID } from 'src/uuid';
6
7
  export declare const ACTION_SCOPE_MAP: {
7
8
  READ: "record.read"[];
8
9
  CREATE: "record.create"[];
@@ -53,4 +54,26 @@ export declare function isActionInScope({ scopes, action, event, currentUser }:
53
54
  event: EventIndexWithAdministrativeHierarchy;
54
55
  currentUser: UserContext;
55
56
  }): boolean;
57
+ /**
58
+ *
59
+ *
60
+ * @param allRoles - All possible roles in the system
61
+ * @param userLocation - The location and role information of the user whose role options are being determined
62
+ * @param acceptedScopes - The scopes of the user requesting the role update, used to determine which roles they can assign.
63
+ * @param userRequesting - The user context of the user requesting the role update, used to check location-based access to the target user's location.
64
+ *
65
+ * @returns An array of roles that the requesting user is allowed to assign to the target user based on their scopes and location
66
+ *
67
+ * 1) Used to determine which roles should be available in the dropdown when a user is editing another user's role in the user management interface.
68
+ * 2) Used to check if payload includes valid role.
69
+ */
70
+ export declare function getAvailableRolesForUserUpdatePayload({ allRoles, userLocation, acceptedScopes, userRequesting }: {
71
+ allRoles: string[];
72
+ userRequesting: UserContext;
73
+ acceptedScopes: UserScopeV2[];
74
+ userLocation: {
75
+ administrativeHierarchy: UUID[];
76
+ primaryOfficeId: UUID;
77
+ };
78
+ }): string[];
56
79
  //# sourceMappingURL=scopes.d.ts.map
@@ -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,30 @@ 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
+ "user.search"
303
+ ]);
304
+ var UserScopeType = SystemScopeType.extract([
305
+ "user.read",
306
+ "user.create",
307
+ "user.edit",
308
+ "user.search"
309
+ ]);
310
+ var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
311
+ var UserScopeV2 = z6.discriminatedUnion("type", [
312
+ z6.object({
313
+ type: ScopesWithRoleOption,
314
+ options: AllUserScopeOptions.optional()
315
+ }),
316
+ z6.object({
317
+ type: UserScopeType.extract(["user.read", "user.search"]),
318
+ options: AccessLevelOptions.optional()
319
+ })
320
+ ]);
289
321
  var ResolvedRecordScopeV2 = z6.discriminatedUnion("type", [
290
322
  z6.object({
291
323
  type: ScopesWithPlaceEventOptions,
@@ -306,16 +338,14 @@ var ResolvedRecordScopeV2 = z6.discriminatedUnion("type", [
306
338
  }).optional()
307
339
  })
308
340
  ]).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
341
  var Scope2 = z6.discriminatedUnion("type", [
316
342
  z6.object({ type: PlainScopeType }),
317
343
  ...RecordScopeV2.options,
318
- z6.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
344
+ ...UserScopeV2.options,
345
+ z6.object({
346
+ type: z6.literal("organisation.read-locations"),
347
+ options: AccessLevelOptions.optional()
348
+ }),
319
349
  z6.object({
320
350
  type: z6.literal("workqueue"),
321
351
  options: WorkqueueOrDashboardOptions