@opencrvs/toolkit 2.0.0-rc.440bc51 → 2.0.0-rc.45e2fdc
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 +7 -35
- package/dist/cli.js +7 -35
- package/dist/commons/api/router.d.ts +59 -54
- package/dist/commons/conditionals/conditionals.d.ts +3 -3
- package/dist/commons/events/ActionInput.d.ts +36 -0
- package/dist/commons/events/Draft.d.ts +1 -0
- package/dist/commons/events/FieldConfig.d.ts +0 -5
- package/dist/commons/events/locations.d.ts +1 -17
- package/dist/conditionals/index.js +7 -35
- package/dist/events/index.js +8 -73
- package/dist/migrations/v2.0/index.js +7 -35
- package/dist/notification/index.js +8 -35
- package/dist/scopes/index.d.ts +10 -82
- package/dist/scopes/index.js +8 -41
- package/opencrvs-toolkit-2.0.0-rc.45e2fdc.tgz +0 -0
- package/package.json +1 -1
- package/opencrvs-toolkit-2.0.0-rc.440bc51.tgz +0 -0
|
@@ -2122,10 +2122,6 @@ var scopeByEvent = z3.preprocess(
|
|
|
2122
2122
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
2123
2123
|
z3.array(z3.string()).optional()
|
|
2124
2124
|
).describe("Event type, e.g. birth, death");
|
|
2125
|
-
var userRole = z3.preprocess(
|
|
2126
|
-
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
2127
|
-
z3.array(z3.string()).optional()
|
|
2128
|
-
).describe("User role, e.g. admin, field agent");
|
|
2129
2125
|
var scopeOptionsPlaceEvent = z3.object({
|
|
2130
2126
|
event: scopeByEvent,
|
|
2131
2127
|
placeOfEvent: JurisdictionFilter.optional()
|
|
@@ -2149,9 +2145,6 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
|
2149
2145
|
var AccessLevelOptions = z3.object({
|
|
2150
2146
|
accessLevel: JurisdictionFilter.optional()
|
|
2151
2147
|
});
|
|
2152
|
-
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
2153
|
-
role: userRole.optional()
|
|
2154
|
-
});
|
|
2155
2148
|
var WorkqueueOrDashboardOptions = z3.object({
|
|
2156
2149
|
ids: z3.preprocess(
|
|
2157
2150
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
@@ -2161,7 +2154,6 @@ var WorkqueueOrDashboardOptions = z3.object({
|
|
|
2161
2154
|
var AllScopeOptions = z3.object({
|
|
2162
2155
|
...AllRecordScopeOptions.shape,
|
|
2163
2156
|
...AccessLevelOptions.shape,
|
|
2164
|
-
...AllUserScopeOptions.shape,
|
|
2165
2157
|
...WorkqueueOrDashboardOptions.shape
|
|
2166
2158
|
});
|
|
2167
2159
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
@@ -2234,28 +2226,6 @@ var RecordScopeV2 = z3.discriminatedUnion("type", [
|
|
|
2234
2226
|
]).describe(
|
|
2235
2227
|
"Scopes used to check user's permission to perform actions on a record."
|
|
2236
2228
|
);
|
|
2237
|
-
var SystemScopeType = z3.enum([
|
|
2238
|
-
"organisation.read-locations",
|
|
2239
|
-
"user.read",
|
|
2240
|
-
"user.create",
|
|
2241
|
-
"user.edit"
|
|
2242
|
-
]);
|
|
2243
|
-
var UserScopeType = SystemScopeType.extract([
|
|
2244
|
-
"user.read",
|
|
2245
|
-
"user.create",
|
|
2246
|
-
"user.edit"
|
|
2247
|
-
]);
|
|
2248
|
-
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
2249
|
-
var UserScopeV2 = z3.discriminatedUnion("type", [
|
|
2250
|
-
z3.object({
|
|
2251
|
-
type: ScopesWithRoleOption,
|
|
2252
|
-
options: AllUserScopeOptions.optional()
|
|
2253
|
-
}),
|
|
2254
|
-
z3.object({
|
|
2255
|
-
type: UserScopeType.extract(["user.read"]),
|
|
2256
|
-
options: AccessLevelOptions.optional()
|
|
2257
|
-
})
|
|
2258
|
-
]);
|
|
2259
2229
|
var ResolvedRecordScopeV2 = z3.discriminatedUnion("type", [
|
|
2260
2230
|
z3.object({
|
|
2261
2231
|
type: ScopesWithPlaceEventOptions,
|
|
@@ -2276,14 +2246,16 @@ var ResolvedRecordScopeV2 = z3.discriminatedUnion("type", [
|
|
|
2276
2246
|
}).optional()
|
|
2277
2247
|
})
|
|
2278
2248
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
2249
|
+
var SystemScopeType = z3.enum([
|
|
2250
|
+
"organisation.read-locations",
|
|
2251
|
+
"user.read",
|
|
2252
|
+
"user.create",
|
|
2253
|
+
"user.edit"
|
|
2254
|
+
]);
|
|
2279
2255
|
var Scope2 = z3.discriminatedUnion("type", [
|
|
2280
2256
|
z3.object({ type: PlainScopeType }),
|
|
2281
2257
|
...RecordScopeV2.options,
|
|
2282
|
-
|
|
2283
|
-
z3.object({
|
|
2284
|
-
type: z3.literal("organisation.read-locations"),
|
|
2285
|
-
options: AccessLevelOptions.optional()
|
|
2286
|
-
}),
|
|
2258
|
+
z3.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
|
|
2287
2259
|
z3.object({
|
|
2288
2260
|
type: z3.literal("workqueue"),
|
|
2289
2261
|
options: WorkqueueOrDashboardOptions
|
|
@@ -110,10 +110,6 @@ var scopeByEvent = z2.preprocess(
|
|
|
110
110
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
111
111
|
z2.array(z2.string()).optional()
|
|
112
112
|
).describe("Event type, e.g. birth, death");
|
|
113
|
-
var userRole = z2.preprocess(
|
|
114
|
-
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
115
|
-
z2.array(z2.string()).optional()
|
|
116
|
-
).describe("User role, e.g. admin, field agent");
|
|
117
113
|
var scopeOptionsPlaceEvent = z2.object({
|
|
118
114
|
event: scopeByEvent,
|
|
119
115
|
placeOfEvent: JurisdictionFilter.optional()
|
|
@@ -137,9 +133,6 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
|
137
133
|
var AccessLevelOptions = z2.object({
|
|
138
134
|
accessLevel: JurisdictionFilter.optional()
|
|
139
135
|
});
|
|
140
|
-
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
141
|
-
role: userRole.optional()
|
|
142
|
-
});
|
|
143
136
|
var WorkqueueOrDashboardOptions = z2.object({
|
|
144
137
|
ids: z2.preprocess(
|
|
145
138
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
@@ -149,7 +142,6 @@ var WorkqueueOrDashboardOptions = z2.object({
|
|
|
149
142
|
var AllScopeOptions = z2.object({
|
|
150
143
|
...AllRecordScopeOptions.shape,
|
|
151
144
|
...AccessLevelOptions.shape,
|
|
152
|
-
...AllUserScopeOptions.shape,
|
|
153
145
|
...WorkqueueOrDashboardOptions.shape
|
|
154
146
|
});
|
|
155
147
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
@@ -222,28 +214,6 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
|
|
|
222
214
|
]).describe(
|
|
223
215
|
"Scopes used to check user's permission to perform actions on a record."
|
|
224
216
|
);
|
|
225
|
-
var SystemScopeType = z2.enum([
|
|
226
|
-
"organisation.read-locations",
|
|
227
|
-
"user.read",
|
|
228
|
-
"user.create",
|
|
229
|
-
"user.edit"
|
|
230
|
-
]);
|
|
231
|
-
var UserScopeType = SystemScopeType.extract([
|
|
232
|
-
"user.read",
|
|
233
|
-
"user.create",
|
|
234
|
-
"user.edit"
|
|
235
|
-
]);
|
|
236
|
-
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
237
|
-
var UserScopeV2 = z2.discriminatedUnion("type", [
|
|
238
|
-
z2.object({
|
|
239
|
-
type: ScopesWithRoleOption,
|
|
240
|
-
options: AllUserScopeOptions.optional()
|
|
241
|
-
}),
|
|
242
|
-
z2.object({
|
|
243
|
-
type: UserScopeType.extract(["user.read"]),
|
|
244
|
-
options: AccessLevelOptions.optional()
|
|
245
|
-
})
|
|
246
|
-
]);
|
|
247
217
|
var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
|
|
248
218
|
z2.object({
|
|
249
219
|
type: ScopesWithPlaceEventOptions,
|
|
@@ -264,14 +234,16 @@ var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
|
|
|
264
234
|
}).optional()
|
|
265
235
|
})
|
|
266
236
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
237
|
+
var SystemScopeType = z2.enum([
|
|
238
|
+
"organisation.read-locations",
|
|
239
|
+
"user.read",
|
|
240
|
+
"user.create",
|
|
241
|
+
"user.edit"
|
|
242
|
+
]);
|
|
267
243
|
var Scope = z2.discriminatedUnion("type", [
|
|
268
244
|
z2.object({ type: PlainScopeType }),
|
|
269
245
|
...RecordScopeV2.options,
|
|
270
|
-
|
|
271
|
-
z2.object({
|
|
272
|
-
type: z2.literal("organisation.read-locations"),
|
|
273
|
-
options: AccessLevelOptions.optional()
|
|
274
|
-
}),
|
|
246
|
+
z2.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
|
|
275
247
|
z2.object({
|
|
276
248
|
type: z2.literal("workqueue"),
|
|
277
249
|
options: WorkqueueOrDashboardOptions
|
|
@@ -4178,6 +4150,7 @@ var BaseActionInput = z38.object({
|
|
|
4178
4150
|
originalActionId: UUID.optional(),
|
|
4179
4151
|
// should not be part of base action.
|
|
4180
4152
|
keepAssignment: z38.boolean().optional(),
|
|
4153
|
+
waitFor: z38.boolean().optional(),
|
|
4181
4154
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
4182
4155
|
// @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
|
|
4183
4156
|
createdAtLocation: UUID.nullish().describe(
|
package/dist/scopes/index.d.ts
CHANGED
|
@@ -41,7 +41,6 @@ declare const AllScopeOptions: z.ZodObject<{
|
|
|
41
41
|
location: "location";
|
|
42
42
|
all: "all";
|
|
43
43
|
}>>;
|
|
44
|
-
role: z.ZodOptional<z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>>;
|
|
45
44
|
event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
46
45
|
placeOfEvent: z.ZodOptional<z.ZodEnum<{
|
|
47
46
|
administrativeArea: "administrativeArea";
|
|
@@ -67,7 +66,6 @@ declare const AllScopeOptions: z.ZodObject<{
|
|
|
67
66
|
}, z.core.$strip>;
|
|
68
67
|
type AllScopeOptions = z.infer<typeof AllScopeOptions>;
|
|
69
68
|
export declare const ScopeOptionKey: z.ZodEnum<{
|
|
70
|
-
role: "role";
|
|
71
69
|
event: "event";
|
|
72
70
|
placeOfEvent: "placeOfEvent";
|
|
73
71
|
declaredIn: "declaredIn";
|
|
@@ -222,53 +220,6 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
222
220
|
templates: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
223
221
|
}, z.core.$strip>>;
|
|
224
222
|
}, z.core.$strip>], "type">;
|
|
225
|
-
declare const SystemScopeType: z.ZodEnum<{
|
|
226
|
-
"organisation.read-locations": "organisation.read-locations";
|
|
227
|
-
"user.read": "user.read";
|
|
228
|
-
"user.create": "user.create";
|
|
229
|
-
"user.edit": "user.edit";
|
|
230
|
-
}>;
|
|
231
|
-
export type SystemScopeType = z.infer<typeof SystemScopeType>;
|
|
232
|
-
declare const UserScopeType: z.ZodEnum<{
|
|
233
|
-
"user.read": "user.read";
|
|
234
|
-
"user.create": "user.create";
|
|
235
|
-
"user.edit": "user.edit";
|
|
236
|
-
}>;
|
|
237
|
-
export type UserScopeType = z.infer<typeof UserScopeType>;
|
|
238
|
-
declare const ScopesWithRoleOption: z.ZodEnum<{
|
|
239
|
-
"user.create": "user.create";
|
|
240
|
-
"user.edit": "user.edit";
|
|
241
|
-
}>;
|
|
242
|
-
export type ScopesWithRoleOption = z.infer<typeof ScopesWithRoleOption>;
|
|
243
|
-
export declare const UserScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
244
|
-
type: z.ZodEnum<{
|
|
245
|
-
"user.create": "user.create";
|
|
246
|
-
"user.edit": "user.edit";
|
|
247
|
-
}>;
|
|
248
|
-
options: z.ZodOptional<z.ZodObject<{
|
|
249
|
-
accessLevel: z.ZodOptional<z.ZodEnum<{
|
|
250
|
-
administrativeArea: "administrativeArea";
|
|
251
|
-
location: "location";
|
|
252
|
-
all: "all";
|
|
253
|
-
}>>;
|
|
254
|
-
role: z.ZodOptional<z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>>;
|
|
255
|
-
}, z.core.$strip>>;
|
|
256
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
257
|
-
type: z.ZodEnum<{
|
|
258
|
-
"user.read": "user.read";
|
|
259
|
-
}>;
|
|
260
|
-
options: z.ZodOptional<z.ZodObject<{
|
|
261
|
-
accessLevel: z.ZodOptional<z.ZodEnum<{
|
|
262
|
-
administrativeArea: "administrativeArea";
|
|
263
|
-
location: "location";
|
|
264
|
-
all: "all";
|
|
265
|
-
}>>;
|
|
266
|
-
}, z.core.$strip>>;
|
|
267
|
-
}, z.core.$strip>], "type">;
|
|
268
|
-
export type UserScopeV2 = z.infer<typeof UserScopeV2>;
|
|
269
|
-
export declare function scopeUsesRoleOptions(scope: UserScopeV2): scope is Extract<UserScopeV2, {
|
|
270
|
-
type: ScopesWithRoleOption;
|
|
271
|
-
}>;
|
|
272
223
|
export declare function scopeUsesDeclaredOptions(scope: Scope): scope is Extract<Scope, {
|
|
273
224
|
type: z.infer<typeof ScopesWithDeclaredOptions>;
|
|
274
225
|
}>;
|
|
@@ -335,6 +286,13 @@ export declare const ResolvedRecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
335
286
|
}, z.core.$strip>], "type">;
|
|
336
287
|
export type RecordScopeV2 = z.infer<typeof RecordScopeV2>;
|
|
337
288
|
export type ResolvedRecordScopeV2 = z.infer<typeof ResolvedRecordScopeV2>;
|
|
289
|
+
declare const SystemScopeType: z.ZodEnum<{
|
|
290
|
+
"organisation.read-locations": "organisation.read-locations";
|
|
291
|
+
"user.read": "user.read";
|
|
292
|
+
"user.create": "user.create";
|
|
293
|
+
"user.edit": "user.edit";
|
|
294
|
+
}>;
|
|
295
|
+
export type SystemScopeType = z.infer<typeof SystemScopeType>;
|
|
338
296
|
/** The primary scope schema which gathers all scope types together. All scopes are discriminated by type and options are determined according to the type. */
|
|
339
297
|
export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
340
298
|
type: z.ZodEnum<{
|
|
@@ -479,30 +437,11 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
479
437
|
}, z.core.$strip>>;
|
|
480
438
|
}, z.core.$strip>, z.ZodObject<{
|
|
481
439
|
type: z.ZodEnum<{
|
|
440
|
+
"organisation.read-locations": "organisation.read-locations";
|
|
441
|
+
"user.read": "user.read";
|
|
482
442
|
"user.create": "user.create";
|
|
483
443
|
"user.edit": "user.edit";
|
|
484
444
|
}>;
|
|
485
|
-
options: z.ZodOptional<z.ZodObject<{
|
|
486
|
-
accessLevel: z.ZodOptional<z.ZodEnum<{
|
|
487
|
-
administrativeArea: "administrativeArea";
|
|
488
|
-
location: "location";
|
|
489
|
-
all: "all";
|
|
490
|
-
}>>;
|
|
491
|
-
role: z.ZodOptional<z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>>;
|
|
492
|
-
}, z.core.$strip>>;
|
|
493
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
494
|
-
type: z.ZodEnum<{
|
|
495
|
-
"user.read": "user.read";
|
|
496
|
-
}>;
|
|
497
|
-
options: z.ZodOptional<z.ZodObject<{
|
|
498
|
-
accessLevel: z.ZodOptional<z.ZodEnum<{
|
|
499
|
-
administrativeArea: "administrativeArea";
|
|
500
|
-
location: "location";
|
|
501
|
-
all: "all";
|
|
502
|
-
}>>;
|
|
503
|
-
}, z.core.$strip>>;
|
|
504
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
505
|
-
type: z.ZodLiteral<"organisation.read-locations">;
|
|
506
445
|
options: z.ZodOptional<z.ZodObject<{
|
|
507
446
|
accessLevel: z.ZodOptional<z.ZodEnum<{
|
|
508
447
|
administrativeArea: "administrativeArea";
|
|
@@ -628,21 +567,10 @@ export declare const decodeScope: (query: EncodedScope) => {
|
|
|
628
567
|
registeredBy?: "user" | undefined;
|
|
629
568
|
templates?: string[] | undefined;
|
|
630
569
|
} | undefined;
|
|
631
|
-
} | {
|
|
632
|
-
type: "user.create" | "user.edit";
|
|
633
|
-
options?: {
|
|
634
|
-
accessLevel?: "administrativeArea" | "location" | "all" | undefined;
|
|
635
|
-
role?: string[] | undefined;
|
|
636
|
-
} | undefined;
|
|
637
|
-
} | {
|
|
638
|
-
type: "user.read";
|
|
639
|
-
options?: {
|
|
640
|
-
accessLevel?: "administrativeArea" | "location" | "all" | undefined;
|
|
641
|
-
} | undefined;
|
|
642
570
|
} | {
|
|
643
571
|
type: "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration";
|
|
644
572
|
} | {
|
|
645
|
-
type: "organisation.read-locations";
|
|
573
|
+
type: "organisation.read-locations" | "user.read" | "user.create" | "user.edit";
|
|
646
574
|
options?: {
|
|
647
575
|
accessLevel?: "administrativeArea" | "location" | "all" | undefined;
|
|
648
576
|
} | undefined;
|
package/dist/scopes/index.js
CHANGED
|
@@ -42,7 +42,6 @@ __export(scopes_exports, {
|
|
|
42
42
|
ScopesWithFullOptions: () => ScopesWithFullOptions,
|
|
43
43
|
ScopesWithPlaceEventOptions: () => ScopesWithPlaceEventOptions,
|
|
44
44
|
UserFilter: () => UserFilter,
|
|
45
|
-
UserScopeV2: () => UserScopeV2,
|
|
46
45
|
canUserCreateEvent: () => canUserCreateEvent,
|
|
47
46
|
decodeScope: () => decodeScope,
|
|
48
47
|
defineRoles: () => defineRoles,
|
|
@@ -55,8 +54,7 @@ __export(scopes_exports, {
|
|
|
55
54
|
isCustomActionScope: () => isCustomActionScope,
|
|
56
55
|
scopeUsesDeclaredOptions: () => scopeUsesDeclaredOptions,
|
|
57
56
|
scopeUsesFullOptions: () => scopeUsesFullOptions,
|
|
58
|
-
scopeUsesPrintCertifiedCopiesOptions: () => scopeUsesPrintCertifiedCopiesOptions
|
|
59
|
-
scopeUsesRoleOptions: () => scopeUsesRoleOptions
|
|
57
|
+
scopeUsesPrintCertifiedCopiesOptions: () => scopeUsesPrintCertifiedCopiesOptions
|
|
60
58
|
});
|
|
61
59
|
module.exports = __toCommonJS(scopes_exports);
|
|
62
60
|
var z4 = __toESM(require("zod/v4"));
|
|
@@ -141,10 +139,6 @@ var scopeByEvent = z3.preprocess(
|
|
|
141
139
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
142
140
|
z3.array(z3.string()).optional()
|
|
143
141
|
).describe("Event type, e.g. birth, death");
|
|
144
|
-
var userRole = z3.preprocess(
|
|
145
|
-
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
146
|
-
z3.array(z3.string()).optional()
|
|
147
|
-
).describe("User role, e.g. admin, field agent");
|
|
148
142
|
var scopeOptionsPlaceEvent = z3.object({
|
|
149
143
|
event: scopeByEvent,
|
|
150
144
|
placeOfEvent: JurisdictionFilter.optional()
|
|
@@ -168,9 +162,6 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
|
168
162
|
var AccessLevelOptions = z3.object({
|
|
169
163
|
accessLevel: JurisdictionFilter.optional()
|
|
170
164
|
});
|
|
171
|
-
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
172
|
-
role: userRole.optional()
|
|
173
|
-
});
|
|
174
165
|
var WorkqueueOrDashboardOptions = z3.object({
|
|
175
166
|
ids: z3.preprocess(
|
|
176
167
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
@@ -180,7 +171,6 @@ var WorkqueueOrDashboardOptions = z3.object({
|
|
|
180
171
|
var AllScopeOptions = z3.object({
|
|
181
172
|
...AllRecordScopeOptions.shape,
|
|
182
173
|
...AccessLevelOptions.shape,
|
|
183
|
-
...AllUserScopeOptions.shape,
|
|
184
174
|
...WorkqueueOrDashboardOptions.shape
|
|
185
175
|
});
|
|
186
176
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
@@ -253,31 +243,6 @@ var RecordScopeV2 = z3.discriminatedUnion("type", [
|
|
|
253
243
|
]).describe(
|
|
254
244
|
"Scopes used to check user's permission to perform actions on a record."
|
|
255
245
|
);
|
|
256
|
-
var SystemScopeType = z3.enum([
|
|
257
|
-
"organisation.read-locations",
|
|
258
|
-
"user.read",
|
|
259
|
-
"user.create",
|
|
260
|
-
"user.edit"
|
|
261
|
-
]);
|
|
262
|
-
var UserScopeType = SystemScopeType.extract([
|
|
263
|
-
"user.read",
|
|
264
|
-
"user.create",
|
|
265
|
-
"user.edit"
|
|
266
|
-
]);
|
|
267
|
-
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
268
|
-
var UserScopeV2 = z3.discriminatedUnion("type", [
|
|
269
|
-
z3.object({
|
|
270
|
-
type: ScopesWithRoleOption,
|
|
271
|
-
options: AllUserScopeOptions.optional()
|
|
272
|
-
}),
|
|
273
|
-
z3.object({
|
|
274
|
-
type: UserScopeType.extract(["user.read"]),
|
|
275
|
-
options: AccessLevelOptions.optional()
|
|
276
|
-
})
|
|
277
|
-
]);
|
|
278
|
-
function scopeUsesRoleOptions(scope) {
|
|
279
|
-
return ScopesWithRoleOption?.options.some((opt) => opt === scope.type);
|
|
280
|
-
}
|
|
281
246
|
function scopeUsesDeclaredOptions(scope) {
|
|
282
247
|
return !ScopesWithPlaceEventOptions.options.some((opt) => opt === scope.type);
|
|
283
248
|
}
|
|
@@ -310,14 +275,16 @@ var ResolvedRecordScopeV2 = z3.discriminatedUnion("type", [
|
|
|
310
275
|
}).optional()
|
|
311
276
|
})
|
|
312
277
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
278
|
+
var SystemScopeType = z3.enum([
|
|
279
|
+
"organisation.read-locations",
|
|
280
|
+
"user.read",
|
|
281
|
+
"user.create",
|
|
282
|
+
"user.edit"
|
|
283
|
+
]);
|
|
313
284
|
var Scope2 = z3.discriminatedUnion("type", [
|
|
314
285
|
z3.object({ type: PlainScopeType }),
|
|
315
286
|
...RecordScopeV2.options,
|
|
316
|
-
|
|
317
|
-
z3.object({
|
|
318
|
-
type: z3.literal("organisation.read-locations"),
|
|
319
|
-
options: AccessLevelOptions.optional()
|
|
320
|
-
}),
|
|
287
|
+
z3.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
|
|
321
288
|
z3.object({
|
|
322
289
|
type: z3.literal("workqueue"),
|
|
323
290
|
options: WorkqueueOrDashboardOptions
|
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|