@opencrvs/toolkit 2.0.0-rc.45e2fdc → 2.0.0-rc.487f96e
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.
- package/dist/application-config/index.js +39 -11
- package/dist/cli.js +35 -7
- package/dist/commons/api/router.d.ts +54 -59
- package/dist/commons/application-config/index.d.ts +16 -4
- package/dist/commons/conditionals/conditionals.d.ts +3 -3
- package/dist/commons/events/ActionInput.d.ts +0 -36
- package/dist/commons/events/Draft.d.ts +0 -1
- package/dist/commons/events/FieldConfig.d.ts +5 -0
- package/dist/commons/events/locations.d.ts +38 -1
- package/dist/commons/events/mocks.test.utils.d.ts +19 -0
- package/dist/commons/events/scopes.d.ts +25 -1
- package/dist/conditionals/index.js +35 -7
- package/dist/events/index.js +128 -8
- package/dist/migrations/v2.0/index.js +35 -7
- package/dist/notification/index.js +35 -8
- package/dist/scopes/index.d.ts +82 -10
- package/dist/scopes/index.js +41 -8
- package/opencrvs-toolkit-2.0.0-rc.487f96e.tgz +0 -0
- package/package.json +1 -1
- package/opencrvs-toolkit-2.0.0-rc.45e2fdc.tgz +0 -0
|
@@ -6,7 +6,6 @@ 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>;
|
|
10
9
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
11
10
|
}, z.core.$strip>;
|
|
12
11
|
export declare const RegisterActionInput: z.ZodObject<{
|
|
@@ -16,7 +15,6 @@ export declare const RegisterActionInput: z.ZodObject<{
|
|
|
16
15
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
17
16
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
18
17
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
20
18
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
21
19
|
type: z.ZodDefault<z.ZodLiteral<"REGISTER">>;
|
|
22
20
|
registrationNumber: z.ZodOptional<z.ZodString>;
|
|
@@ -29,7 +27,6 @@ export declare const NotifyActionInput: z.ZodObject<{
|
|
|
29
27
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
30
28
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
31
29
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
32
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
33
30
|
type: z.ZodDefault<z.ZodLiteral<"NOTIFY">>;
|
|
34
31
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
35
32
|
}, z.core.$strip>;
|
|
@@ -41,7 +38,6 @@ export declare const DeclareActionInput: z.ZodObject<{
|
|
|
41
38
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
42
39
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
43
40
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
44
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
45
41
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
46
42
|
type: z.ZodDefault<z.ZodLiteral<"DECLARE">>;
|
|
47
43
|
}, z.core.$strip>;
|
|
@@ -52,7 +48,6 @@ export declare const EditActionInput: z.ZodObject<{
|
|
|
52
48
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
53
49
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
54
50
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
56
51
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
57
52
|
type: z.ZodDefault<z.ZodLiteral<"EDIT">>;
|
|
58
53
|
content: z.ZodObject<{
|
|
@@ -67,7 +62,6 @@ export declare const PrintCertificateActionInput: z.ZodObject<{
|
|
|
67
62
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
68
63
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
69
64
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
70
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
71
65
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
72
66
|
type: z.ZodDefault<z.ZodLiteral<"PRINT_CERTIFICATE">>;
|
|
73
67
|
content: z.ZodOptional<z.ZodObject<{
|
|
@@ -82,7 +76,6 @@ export declare const RejectDeclarationActionInput: z.ZodObject<{
|
|
|
82
76
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
83
77
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
84
78
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
85
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
86
79
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
87
80
|
type: z.ZodDefault<z.ZodLiteral<"REJECT">>;
|
|
88
81
|
content: z.ZodObject<{
|
|
@@ -97,7 +90,6 @@ export declare const DuplicateDetectedActionInput: z.ZodObject<{
|
|
|
97
90
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
98
91
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
99
92
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
100
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
101
93
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
102
94
|
type: z.ZodDefault<z.ZodLiteral<"DUPLICATE_DETECTED">>;
|
|
103
95
|
content: z.ZodObject<{
|
|
@@ -114,7 +106,6 @@ export declare const MarkAsDuplicateActionInput: z.ZodObject<{
|
|
|
114
106
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
115
107
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
116
108
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
117
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
118
109
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
119
110
|
type: z.ZodDefault<z.ZodLiteral<"MARK_AS_DUPLICATE">>;
|
|
120
111
|
content: z.ZodOptional<z.ZodObject<{
|
|
@@ -129,7 +120,6 @@ export declare const MarkNotDuplicateActionInput: z.ZodObject<{
|
|
|
129
120
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
130
121
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
131
122
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
132
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
133
123
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
134
124
|
type: z.ZodDefault<z.ZodLiteral<"MARK_AS_NOT_DUPLICATE">>;
|
|
135
125
|
}, z.core.$strip>;
|
|
@@ -141,7 +131,6 @@ export declare const ArchiveActionInput: z.ZodObject<{
|
|
|
141
131
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
142
132
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
143
133
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
144
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
145
134
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
146
135
|
type: z.ZodDefault<z.ZodLiteral<"ARCHIVE">>;
|
|
147
136
|
content: z.ZodObject<{
|
|
@@ -156,7 +145,6 @@ export declare const AssignActionInput: z.ZodObject<{
|
|
|
156
145
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
157
146
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
158
147
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
159
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
160
148
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
161
149
|
type: z.ZodLiteral<"ASSIGN">;
|
|
162
150
|
assignedTo: z.ZodString;
|
|
@@ -169,7 +157,6 @@ export declare const UnassignActionInput: z.ZodObject<{
|
|
|
169
157
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
170
158
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
171
159
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
172
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
173
160
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
174
161
|
type: z.ZodDefault<z.ZodLiteral<"UNASSIGN">>;
|
|
175
162
|
assignedTo: z.ZodDefault<z.ZodLiteral<null>>;
|
|
@@ -182,7 +169,6 @@ export declare const RequestCorrectionActionInput: z.ZodObject<{
|
|
|
182
169
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
183
170
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
184
171
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
185
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
186
172
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
187
173
|
type: z.ZodDefault<z.ZodLiteral<"REQUEST_CORRECTION">>;
|
|
188
174
|
}, z.core.$strip>;
|
|
@@ -194,7 +180,6 @@ export declare const RejectCorrectionActionInput: z.ZodObject<{
|
|
|
194
180
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
195
181
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
196
182
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
197
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
198
183
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
199
184
|
requestId: z.ZodString;
|
|
200
185
|
type: z.ZodDefault<z.ZodLiteral<"REJECT_CORRECTION">>;
|
|
@@ -210,7 +195,6 @@ export declare const ApproveCorrectionActionInput: z.ZodObject<{
|
|
|
210
195
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
211
196
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
212
197
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
213
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
214
198
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
215
199
|
requestId: z.ZodString;
|
|
216
200
|
type: z.ZodDefault<z.ZodLiteral<"APPROVE_CORRECTION">>;
|
|
@@ -223,7 +207,6 @@ export declare const ReadActionInput: z.ZodObject<{
|
|
|
223
207
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
224
208
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
225
209
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
226
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
227
210
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
228
211
|
type: z.ZodDefault<z.ZodLiteral<"READ">>;
|
|
229
212
|
}, z.core.$strip>;
|
|
@@ -239,7 +222,6 @@ export declare const CustomActionInput: z.ZodObject<{
|
|
|
239
222
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
240
223
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
241
224
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
242
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
243
225
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
244
226
|
type: z.ZodDefault<z.ZodLiteral<"CUSTOM">>;
|
|
245
227
|
customActionType: z.ZodString;
|
|
@@ -260,7 +242,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
260
242
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
261
243
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
262
244
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
263
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
264
245
|
type: z.ZodDefault<z.ZodLiteral<"CREATE">>;
|
|
265
246
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
266
247
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -270,7 +251,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
270
251
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
271
252
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
272
253
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
273
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
274
254
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
275
255
|
type: z.ZodDefault<z.ZodLiteral<"REGISTER">>;
|
|
276
256
|
registrationNumber: z.ZodOptional<z.ZodString>;
|
|
@@ -281,7 +261,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
281
261
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
282
262
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
283
263
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
284
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
285
264
|
type: z.ZodDefault<z.ZodLiteral<"NOTIFY">>;
|
|
286
265
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
287
266
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -291,7 +270,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
291
270
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
292
271
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
293
272
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
294
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
295
273
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
296
274
|
type: z.ZodDefault<z.ZodLiteral<"DECLARE">>;
|
|
297
275
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -301,7 +279,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
301
279
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
302
280
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
303
281
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
304
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
305
282
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
306
283
|
type: z.ZodDefault<z.ZodLiteral<"REJECT">>;
|
|
307
284
|
content: z.ZodObject<{
|
|
@@ -314,7 +291,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
314
291
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
315
292
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
316
293
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
317
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
318
294
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
319
295
|
type: z.ZodDefault<z.ZodLiteral<"DUPLICATE_DETECTED">>;
|
|
320
296
|
content: z.ZodObject<{
|
|
@@ -330,7 +306,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
330
306
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
331
307
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
332
308
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
333
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
334
309
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
335
310
|
type: z.ZodDefault<z.ZodLiteral<"MARK_AS_DUPLICATE">>;
|
|
336
311
|
content: z.ZodOptional<z.ZodObject<{
|
|
@@ -343,7 +318,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
343
318
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
344
319
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
345
320
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
346
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
347
321
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
348
322
|
type: z.ZodDefault<z.ZodLiteral<"MARK_AS_NOT_DUPLICATE">>;
|
|
349
323
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -353,7 +327,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
353
327
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
354
328
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
355
329
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
356
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
357
330
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
358
331
|
type: z.ZodDefault<z.ZodLiteral<"ARCHIVE">>;
|
|
359
332
|
content: z.ZodObject<{
|
|
@@ -366,7 +339,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
366
339
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
367
340
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
368
341
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
369
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
370
342
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
371
343
|
type: z.ZodLiteral<"ASSIGN">;
|
|
372
344
|
assignedTo: z.ZodString;
|
|
@@ -377,7 +349,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
377
349
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
378
350
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
379
351
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
380
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
381
352
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
382
353
|
type: z.ZodDefault<z.ZodLiteral<"UNASSIGN">>;
|
|
383
354
|
assignedTo: z.ZodDefault<z.ZodLiteral<null>>;
|
|
@@ -388,7 +359,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
388
359
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
389
360
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
390
361
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
391
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
392
362
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
393
363
|
type: z.ZodDefault<z.ZodLiteral<"PRINT_CERTIFICATE">>;
|
|
394
364
|
content: z.ZodOptional<z.ZodObject<{
|
|
@@ -401,7 +371,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
401
371
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
402
372
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
403
373
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
404
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
405
374
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
406
375
|
type: z.ZodDefault<z.ZodLiteral<"REQUEST_CORRECTION">>;
|
|
407
376
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -411,7 +380,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
411
380
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
412
381
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
413
382
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
414
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
415
383
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
416
384
|
requestId: z.ZodString;
|
|
417
385
|
type: z.ZodDefault<z.ZodLiteral<"REJECT_CORRECTION">>;
|
|
@@ -425,7 +393,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
425
393
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
426
394
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
427
395
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
428
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
429
396
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
430
397
|
requestId: z.ZodString;
|
|
431
398
|
type: z.ZodDefault<z.ZodLiteral<"APPROVE_CORRECTION">>;
|
|
@@ -436,7 +403,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
436
403
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
437
404
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
438
405
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
439
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
440
406
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
441
407
|
type: z.ZodDefault<z.ZodLiteral<"READ">>;
|
|
442
408
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -446,7 +412,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
446
412
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
447
413
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
448
414
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
449
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
450
415
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
451
416
|
type: z.ZodDefault<z.ZodLiteral<"CUSTOM">>;
|
|
452
417
|
customActionType: z.ZodString;
|
|
@@ -457,7 +422,6 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
457
422
|
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
|
|
458
423
|
originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
459
424
|
keepAssignment: z.ZodOptional<z.ZodBoolean>;
|
|
460
|
-
waitFor: z.ZodOptional<z.ZodBoolean>;
|
|
461
425
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
462
426
|
type: z.ZodDefault<z.ZodLiteral<"EDIT">>;
|
|
463
427
|
content: z.ZodObject<{
|
|
@@ -51,7 +51,6 @@ 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>;
|
|
55
54
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
56
55
|
type: z.ZodEnum<{
|
|
57
56
|
CUSTOM: "CUSTOM";
|
|
@@ -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,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,27 @@ 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
|
+
role?: string;
|
|
76
|
+
administrativeHierarchy: UUID[];
|
|
77
|
+
primaryOfficeId: UUID;
|
|
78
|
+
};
|
|
79
|
+
}): string[];
|
|
56
80
|
//# 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,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
|
-
|
|
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
|