@enonic/mock-xp
Version:
Mock Enonic XP API JavaScript Library
49 lines (48 loc) • 2 kB
TypeScript
import type { CreateNodeParams, HasValueFilter, MoveNodeParams, Node, QueryNodeParams } from '@enonic-types/lib-node';
import type { GetActiveVersionParamObject, GetActiveVersionResponse, Log, NodeModifyParams, NodeQueryResponse, NodeRefreshParams, RepoNodeWithData } from '../types';
import type { Repo } from './Repo';
interface Nodes {
[key: string]: RepoNodeWithData;
}
interface PathIndex {
[key: string]: string;
}
interface SearchIndex {
[_indexConfig: string]: {
[valueString: string]: string[];
};
}
export declare class Branch {
static generateInstantString(): string;
readonly binaryReferences: Record<string, Record<string, string>>;
readonly id: string;
readonly nodes: Nodes;
readonly pathIndex: PathIndex;
readonly searchIndex: SearchIndex;
readonly repo: Repo;
readonly log: Log;
constructor({ branchId, repo }: {
branchId: string;
repo: Repo;
});
_createNodeInternal<NodeData = unknown>({ _id, _indexConfig, _name, _parentPath, _ts, _versionKey, ...rest }: CreateNodeParams<NodeData> & {
_id?: string;
}): Node<NodeData>;
createNode<NodeData = unknown>(params: CreateNodeParams<NodeData>): Node<NodeData>;
private keyToId;
existsNode(key: string): boolean;
deleteNode(keys: string | string[]): string[];
getBranchId(): string;
getNode(...keys: string[]): RepoNodeWithData | RepoNodeWithData[];
getNodeActiveVersion({ key }: GetActiveVersionParamObject): GetActiveVersionResponse;
getRepo(): Repo;
modifyNode({ key, editor }: NodeModifyParams): RepoNodeWithData;
moveNode({ source, target }: MoveNodeParams): RepoNodeWithData | null;
_overwriteNode({ node }: {
node: RepoNodeWithData;
}): RepoNodeWithData;
_handleHasValueFilter(hasValueFilter: HasValueFilter): string[];
query({ count, filters, query, start }: QueryNodeParams): NodeQueryResponse;
refresh({ mode, repo, branch }?: NodeRefreshParams): void;
}
export {};