UNPKG

@enonic/mock-xp

Version:

Mock Enonic XP API JavaScript Library

100 lines (99 loc) 3.69 kB
import type { CreateUserParams, LoginParams, UserKey } from '@enonic-types/lib-auth'; import type { ContextAttributes, ContextUserParams, PrincipalKey } from '@enonic-types/lib-context'; import type { ConnectParams, CreateNodeParams, ModifyNodeParams } from '@enonic-types/lib-node'; import type { CreateRepositoryParams, RepositorySettings } from '@enonic-types/lib-repo'; import type { LogLevel } from './Log'; import type { Log as LogType } from '../types'; import type { App } from './App'; import type { Branch } from './Branch'; import type { Repos } from './Repo'; import { Auth } from './Auth'; import { ContentConnection } from './ContentConnection'; import { Context } from './Context'; import { Project } from './Project'; import { Repo } from './Repo'; import { RepoConnection } from './RepoConnection'; export declare class Server { readonly applications: App[]; readonly auth: Auth; readonly indexWarnings: boolean; readonly log: LogType; readonly projects: Record<string, Project>; readonly repos: Repos; readonly systemRepoConnection: RepoConnection; readonly version: string; readonly vol: import("memfs").Volume; userKey?: UserKey | undefined; context: Context; constructor({ indexWarnings, log, loglevel, version, }?: { indexWarnings?: boolean; log?: LogType; loglevel?: LogLevel; version?: string; }); connect({ repoId, branchId }: { repoId: ConnectParams['repoId']; branchId: ConnectParams['branch']; principals?: ConnectParams['principals']; user?: ConnectParams['user']; }): RepoConnection; contentConnect({ branchId, projectId, }: { branchId: string; projectId: string; }): ContentConnection; createBranch({ branchId, repoId }: { branchId: string; repoId: string; }): Branch; createNode<NodeData = unknown>({ _trace, branchId, repoId, node }: { _trace?: boolean; branchId: string; node: CreateNodeParams<NodeData>; repoId: string; }): import("@enonic-types/lib-node").Node<NodeData>; createRepo({ id, settings }: CreateRepositoryParams): Server; createProject({ projectName, settings }: { projectName: string; settings?: RepositorySettings; }): Server; createUser(params: Omit<CreateUserParams, 'idProvider'> & { idProvider?: string; password?: string; profile?: Record<string, unknown>; }): Server; deleteRepo({ repoId }: { repoId: string; }): Server; getBranch({ branchId, repoId, }: { branchId: string; repoId: string; }): Branch; getNode<NodeData = Record<string, unknown>>({ branchId, key, repoId, }: { branchId: string; key: string; repoId: string; }): import("@enonic-types/lib-node").Node<NodeData>; getProject(projectName: string): Project; getRepo(repoId: string): Repo; install(app: App): Server; listRepos(): Repo[]; login(params: LoginParams): Server; logout(): Server; modifyNode<NodeData = Record<string, unknown>>({ branchId, editor, key, repoId, }: { branchId: string; editor: ModifyNodeParams<NodeData>['editor']; key: string; repoId: string; }): this; setContext({ attributes, principals, projectName, branch, repository, idProvider, login, user, }: { attributes?: ContextAttributes; branch?: string; idProvider?: string; login?: string; principals?: PrincipalKey[]; projectName?: string; repository?: string; user?: ContextUserParams; }): Server; su(): Server; }