Skip to content

Type Alias: ScopedGuard<T, G, K, O> ​

ts
type ScopedGuard<T, G, K, O> = <A>(event, ...args) => Promise<SubjectRbac<T, ScopedGuardName<T, RequirementGuard<A, G>>>>;

Defined in: packages/sveltekit/src/server/guards.ts:128

A guard of createGuards<T, G>() when T has per-guard names (RbacTypeConfig['guards']): like Guard, but the names are those of the guard the call checks in, its { guard } option or else G (the guard of rbacHandle()), and the subject it returns is typed for that guard.

Type Parameters ​

Type Parameter
T extends RbacTypeConfig
G extends string
K extends GuardKind
O

Type Parameters ​

Type Parameter
A extends readonly (GuardNames | O)[]

Parameters ​

ParameterType
eventRequestEvent
...argsA & GuardRequirementArgs<A, T, K, G, O>

Returns ​

Promise<SubjectRbac<T, ScopedGuardName<T, RequirementGuard<A, G>>>>

Released under the MIT License. Inspired by spatie/laravel-permission.