///
import { Connection } from "./connection";
import { ArrayCursor } from "./cursor";
export declare enum CollectionType {
DOCUMENT_COLLECTION = 2,
EDGE_COLLECTION = 3
}
export declare type DocumentHandle = string | {
_key?: string;
_id?: string;
};
export declare type IndexHandle = string | {
id?: string;
};
export interface ImportOptions {
type?: null | "auto" | "documents" | "array";
fromPrefix?: string;
toPrefix?: string;
overwrite?: boolean;
waitForSync?: boolean;
onDuplicate?: "error" | "update" | "replace" | "ignore";
complete?: boolean;
details?: boolean;
}
export interface ImportResult {
error: false;
created: number;
errors: number;
empty: number;
updated: number;
ignored: number;
details?: string[];
}
export interface DocumentReadOptions {
graceful?: boolean;
allowDirtyRead?: boolean;
}
export declare function isArangoCollection(collection: any): collection is ArangoCollection;
export interface ArangoCollection {
isArangoCollection: true;
name: string;
}
export declare const DOCUMENT_NOT_FOUND = 1202;
export declare const COLLECTION_NOT_FOUND = 1203;
export declare abstract class BaseCollection implements ArangoCollection {
isArangoCollection: true;
name: string;
abstract type: CollectionType;
protected _idPrefix: string;
protected _connection: Connection;
constructor(connection: Connection, name: string);
protected _documentPath(documentHandle: DocumentHandle): string;
protected _documentHandle(documentHandle: DocumentHandle): string;
protected _indexHandle(indexHandle: IndexHandle): string;
protected _get(path: string, qs?: any): Promise;
protected _put(path: string, body: any): Promise;
get(): Promise;
exists(): Promise;
create(properties?: any): Promise;
properties(): Promise;
count(): Promise;
figures(): Promise;
revision(): Promise;
checksum(opts?: any): Promise;
load(count?: boolean): Promise;
unload(): Promise;
setProperties(properties: any): Promise;
rename(name: string): Promise;
rotate(): Promise;
truncate(): Promise;
drop(opts?: any): Promise;
documentExists(documentHandle: DocumentHandle): Promise;
document(documentHandle: DocumentHandle, graceful: boolean): Promise;
document(documentHandle: DocumentHandle, opts?: DocumentReadOptions): Promise;
replace(documentHandle: DocumentHandle, newValue: any, opts?: any): Promise;
update(documentHandle: DocumentHandle, newValue: any, opts?: any): Promise;
bulkUpdate(newValues: any, opts?: any): Promise;
remove(documentHandle: DocumentHandle, opts?: any): Promise;
list(type?: string): Promise;
all(opts?: any): Promise;
any(): Promise;
first(opts?: any): Promise;
last(opts?: any): Promise;
byExample(example: any, opts?: any): Promise;
firstExample(example: any): Promise;
removeByExample(example: any, opts?: any): Promise;
replaceByExample(example: any, newValue: any, opts?: any): Promise;
updateByExample(example: any, newValue: any, opts?: any): Promise;
lookupByKeys(keys: string[]): Promise;
removeByKeys(keys: string[], options: any): Promise;
import(data: Buffer | Blob | string | any[], { type, ...opts }?: ImportOptions): Promise;
indexes(): Promise;
index(indexHandle: IndexHandle): Promise;
createIndex(details: any): Promise;
dropIndex(indexHandle: IndexHandle): Promise;
createCapConstraint(opts?: any): Promise;
createHashIndex(fields: string[] | string, opts?: any): Promise;
createSkipList(fields: string[] | string, opts?: any): Promise;
createPersistentIndex(fields: string[] | string, opts?: any): Promise;
createGeoIndex(fields: string[] | string, opts?: any): Promise;
createFulltextIndex(fields: string[] | string, minLength?: number): Promise;
fulltext(attribute: any, query: any, opts?: any): Promise;
}
export interface DocumentSaveOptions {
waitForSync?: boolean;
returnNew?: boolean;
returnOld?: boolean;
overwrite?: boolean;
silent?: boolean;
}
export declare class DocumentCollection extends BaseCollection {
type: CollectionType;
constructor(connection: Connection, name: string);
save(data: any, opts?: DocumentSaveOptions | boolean): Promise;
}
export declare class EdgeCollection extends BaseCollection {
type: CollectionType;
constructor(connection: Connection, name: string);
protected _documentPath(documentHandle: DocumentHandle): string;
edge(documentHandle: DocumentHandle, graceful: boolean): Promise;
edge(documentHandle: DocumentHandle, opts?: DocumentReadOptions): Promise;
save(data: any, opts?: DocumentSaveOptions | boolean): Promise;
save(data: any, fromId: DocumentHandle, toId: DocumentHandle, opts?: DocumentSaveOptions | boolean): Promise;
protected _edges(documentHandle: DocumentHandle, direction: any): Promise;
edges(vertex: DocumentHandle): Promise;
inEdges(vertex: DocumentHandle): Promise;
outEdges(vertex: DocumentHandle): Promise;
traversal(startVertex: DocumentHandle, opts?: any): Promise;
}
export declare function constructCollection(connection: Connection, data: any): DocumentCollection;
//# sourceMappingURL=collection.d.ts.map