UNPKG

@bemedev/permissions

Version:

A library for managing permissions

29 lines 1.49 kB
import type { HasPermissions_F, ReduceCollectedReturns_F } from './machine.types'; import type { Config, Implementation as Impl, UserFrom } from './types'; declare class Machine<const Co extends Config, Implementation extends Impl<Co> = Impl<Co>> { #private; private __config; constructor(__config: Co); get config(): Readonly<Co>; get roles(): Readonly<Co["roles"]>; get implementation(): Readonly<Implementation>; get __user(): UserFrom<Co> & Co["user"]; get ressources(): Co["ressources"]; getPriority(role: keyof Co['roles']): Co["roles"][keyof Co["roles"]]; sortRoles: (order: "asc" | "desc", ...roles: (keyof Co["roles"])[]) => (keyof Co["roles"])[]; /** * @deprecated * * Implements the machine with the provided implementation. * This method is used to set the implementation for the machine, allowing it to handle permissions * based on the provided implementation logic. * @param implementation The implementation logic to be set for the machine. * @returns A new instance of the machine with the provided implementation. */ __implements: (implementation: Implementation) => Machine<Co, Implementation>; hasPermisions: HasPermissions_F<Co>; static reduceCollection: ReduceCollectedReturns_F; } export declare const createMachine: <const Co extends Config>(config: Co, implementation: Impl<Co>) => Machine<Co, Impl<Co>>; export { type Machine }; //# sourceMappingURL=machine.d.ts.map