@dstanesc/o-o-o-o-o-o-o
Version:
O-O-O-O-O-O-O is a collection of content addressed persistent data structures
69 lines • 2.21 kB
TypeScript
import { Graph } from './graph';
import { Operation } from './ops';
import { Part, VertexRef, EdgeRef, PropValue, KeyType, Type } from './types';
declare enum PathElemType {
VERTEX = 0,
EDGE = 1,
EXTRACT = 2,
TEMPLATE = 3
}
interface PropPredicate {
keyType: KeyType;
operation: Operation;
}
interface PathElem {
elemType: PathElemType;
}
interface ReducedValue {
context: Part;
value: PropValue;
}
interface EdgePathElem extends PathElem {
types?: Type[];
propPredicate?: PropPredicate;
}
interface VertexPathElem extends PathElem {
types?: Type[];
propPredicate?: PropPredicate;
}
interface ExtractPathElem extends PathElem {
props: number[];
reduce?: (previous: PropValue, current: PropValue) => ReducedValue;
}
interface TemplatePathElem extends PathElem {
template: any;
}
declare class RequestBuilder {
path: PathElem[];
request: NavigationThreshold;
constructor();
add(elemType: PathElemType): RequestBuilder;
type(...types: Type[]): RequestBuilder;
propPred(keyType: KeyType, operation: Operation): RequestBuilder;
extract(...props: number[]): RequestBuilder;
template(template: any): RequestBuilder;
reduce(reduceFunc: (previous: PropValue, current: PropValue) => ReducedValue): RequestBuilder;
maxResults(value: number): RequestBuilder;
get(): {
path: PathElem[];
request: NavigationThreshold;
};
}
declare class NavigationThreshold {
yieldCounter: number;
maxYield: number;
constructor(maxYield: number);
increment(): void;
isDone(): boolean;
completeWhenDone(): void;
}
declare function navigateVertices(graph: Graph, refs: VertexRef[], { path, request }: {
path: PathElem[];
request: NavigationThreshold;
}): AsyncGenerator<any, void, void>;
declare function navigateEdges(graph: Graph, refs: EdgeRef[], { path, request }: {
path: PathElem[];
request: NavigationThreshold;
}): AsyncGenerator<any, void, void>;
export { PathElem, EdgePathElem, VertexPathElem, ExtractPathElem, TemplatePathElem, PropPredicate, PathElemType, RequestBuilder, NavigationThreshold, navigateVertices, navigateEdges, };
//# sourceMappingURL=navigate.d.ts.map