import type { NRoleDef } from '@neon.id/types'; import type { TAbilityInstance } from '../ability'; import type { TPermitResult } from '../types'; import type { TGateAction, TGateActions, TGateCheckOptions, TGateDefinition, TGateGuardFunction, TGateGuardFunctionOrInstance, TGateInstance } from './gate.types'; export declare class Gate implements TGateInstance { roles?: NRoleDef[]; guard?: TGateGuardFunction; actions: TGateActions; ability?: TAbilityInstance; isHydrated: boolean; private constructor(); /** * Define a new gate. */ static define(def: TGateDefinition): Gate; /** * Clone to a new gate instance. */ clone(): TGateInstance; /** * Hydrate the gate with ability. */ hydrate(ability: TAbilityInstance): void; /** * Check if guard allows public. */ get isPublic(): boolean; /** * Check if guard allows any user. */ get isUser(): boolean; /** * Check action and data against gate guards. */ check(action: TGateAction, data?: Record, opts?: TGateCheckOptions): TPermitResult; private checkRole; private checkGuard; private checkActions; /** * Get array of guard. */ static getArray(guard: TGateGuardFunctionOrInstance | TGateGuardFunctionOrInstance[]): TGateGuardFunctionOrInstance[]; private log; }