usePermissions API
API reference for the usePermissions composable.
(_options?: PermissionOptions) => ECreates a new permissions instance.
(_options?: PermissionContextOptions) => ContextTrinity<E>Creates a new permissions context.
(_options?: PermissionPluginOptions) => anyCreates a new permissions plugin.
(namespace?: string) => EReturns the current permissions instance.
booleanEnable event emission for registry operations
Default: false
booleanEnable reactive behavior for registry operations
Default: false
booleanWhether to flatten nested token structures.
Default: false
stringAn optional prefix to prepend to each token ID during registration.
ReadonlyMap<ID, Z>The collection of tickets in the registry
numberThe number of tickets in the registry
() => voidClear the entire registry
(id: ID) => booleanCheck if a ticket exists by ID
() => readonly ID[]Get all registered IDs
(value: Z["value"]) => ID[] | undefinedBrowse for an ID(s) by value
(index: number) => ID | undefinedlookup a ticket by index number
(id: ID) => Z | undefinedGet a ticket by ID
(id: ID, ticket?: Partial<Z>) => ZUpdate or insert a ticket by ID
() => readonly Z[]Get all values of registered tickets
() => readonly [ID, Z][]Get all entries of registered tickets
(ticket?: Partial<Z>) => ZRegister a new ticket
(id: ID) => voidUnregister a ticket by ID
() => voidReset the index directory and update all tickets
(direction?: "first" | "last", from?: number, predicate?: (ticket) => boolean) => Z | undefinedSeek for a ticket based on direction and optional predicate
<K extends Extensible<RegistryEventName>>(event: K, cb: EventHandler<Z, K>) => voidListen for registry events
<K extends Extensible<RegistryEventName>>(event: K, cb: EventHandler<Z, K>) => voidStop listening for registry events
<K extends Extensible<RegistryEventName>>(event: K, data: EventPayload<Z, K>) => voidEmit an event with data
() => voidClears the registry and removes all listeners
(registrations: Partial<Z>[]) => Z[]Onboard multiple tickets at once
(ids: ID[]) => voidOffboard multiple tickets at once
<R>(fn: () => R) => RExecute operations in a batch, deferring cache invalidation and event emission until complete
(token: unknown) => token is stringChecks if a token is an alias
(token: string | TokenAlias) => unknown | undefinedResolves a token or alias to its value.
(id: ID, action: string, subject: string, context?: Record<string, any>) => boolean