@enonic/mock-xp
Version:
Mock Enonic XP API JavaScript Library
62 lines (61 loc) • 2.44 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;
});
private _queryDateRange;
_createNodeInternal<NodeData = unknown>({ _trace, _id, _indexConfig, _name, _parentPath, _ts, _versionKey, ...rest }: CreateNodeParams<NodeData> & {
_id?: string;
_trace?: boolean;
}): Node<NodeData>;
createNode<NodeData = unknown>(params: CreateNodeParams<NodeData> & {
_trace?: boolean;
}): Node<NodeData>;
private keyToId;
existsNode(key: string): boolean;
deleteNode(keys: string | string[]): string[];
getBranchId(): string;
getNode<NodeData = Record<string, unknown>>({ _trace, key, }: {
_trace?: boolean;
key: string;
}): RepoNodeWithData<NodeData> | RepoNodeWithData<NodeData>[];
getNodes<NodeData = Record<string, unknown>>({ _trace, keys, }: {
_trace?: boolean;
keys: string[];
}): RepoNodeWithData<NodeData> | RepoNodeWithData<NodeData>[];
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({ _trace, count, filters, query, start }: QueryNodeParams & {
_trace?: boolean;
}): NodeQueryResponse;
refresh({ mode, repo, branch }?: NodeRefreshParams): void;
}
export {};