UNPKG

@enonic/mock-xp

Version:

Mock Enonic XP API JavaScript Library

24 lines (23 loc) 999 B
import type { Context as ContextInterface, ContextAttributes, ContextParams, PrincipalKey } from '@enonic-types/lib-context'; import type { Auth } from './Auth'; import type { Server } from './Server'; import type { User } from './auth/User'; export declare class Context implements ContextInterface { readonly attributes: ContextAttributes; readonly auth: Auth; readonly branch: ContextInterface['branch']; readonly repository: ContextInterface['repository']; readonly server: Server; principals: ContextParams['principals']; user: User; constructor({ branch, repository, attributes, principals, server, user, }: { branch?: ContextInterface['branch']; repository?: ContextInterface['repository']; server: Server; attributes?: ContextInterface['attributes']; principals?: ContextParams['principals']; user?: ContextParams['user']; }); addPrincipal(principal: PrincipalKey): this; get(): ContextInterface; }