/// import { EventEmitter } from 'events'; import { IDecoratingObject } from './instrument/decorator'; import { IAuthorizonConfig } from './config'; import { IAuthorizonCache } from './cache/client'; import { IResourceRegistry } from './resources/registry'; import { IResourceReporter } from './resources/reporter'; import { IEnforcer } from './enforcement/enforcer'; import { IMutationsClient } from './mutations/client'; import { RecursivePartial } from './utils/types'; export { ISyncedUser, ISyncedRole, IAuthorizonCache } from './cache/client'; export { IUser, IAction, IResource } from './enforcement/interfaces'; export { ITenant, IAuthorizonCloudReads, IAuthorizonCloudMutations } from './mutations/client'; export { ResourceConfig, ActionConfig } from './resources/interfaces'; export { IUrlContext } from './resources/registry'; export { Context, ContextTransform } from './utils/context'; interface IEventSubscriber { on(event: string | symbol, listener: (...args: any[]) => void): EventEmitter; once(event: string | symbol, listener: (...args: any[]) => void): EventEmitter; } export interface IAuthorizonClient extends IEventSubscriber, IResourceReporter, IEnforcer, IMutationsClient, IResourceRegistry, IDecoratingObject { cache: IAuthorizonCache; config: IAuthorizonConfig; } /** * The AuthorizonSDK class is a simple factory that returns * an initialized IAuthorizonClient object that the user can work with. * * The authorizon client can signal when its available. * all actions with the client should be after the 'ready' event has fired, * as shown below. * * usage example: * const authorizon: IAuthorizonClient = AuthorizonSDK.init({ // config }); * authorizon.once('ready', () => { * const allowed = await authorizon.isAllowed(user, action, resource); * ... * }) */ export declare class AuthorizonSDK { static init(config: RecursivePartial): IAuthorizonClient; }