arangojs
Version:
The official ArangoDB JavaScript driver.
98 lines • 4.9 kB
TypeScript
/// <reference types="node" />
import { AqlLiteral, AqlQuery } from "./aql-query";
import { ArangoCollection, DocumentCollection, EdgeCollection } from "./collection";
import { Config } from "./connection";
import { ArrayCursor } from "./cursor";
import { Graph } from "./graph";
import { Route } from "./route";
import { ArangoSearchView, ArangoView, ViewType } from "./view";
export declare type TransactionCollections = string | ArangoCollection | (string | ArangoCollection)[] | {
write?: string | ArangoCollection | (string | ArangoCollection)[];
read?: string | ArangoCollection | (string | ArangoCollection)[];
};
export declare type TransactionOptions = {
lockTimeout?: number;
maxTransactionSize?: number;
intermediateCommitCount?: number;
intermediateCommitSize?: number;
waitForSync?: boolean;
};
export declare type ServiceOptions = {
[key: string]: any;
configuration?: {
[key: string]: any;
};
dependencies?: {
[key: string]: any;
};
};
export interface ViewDescription {
id: string;
name: string;
type: ViewType;
}
export declare class Database {
private _connection;
constructor(config?: Config);
readonly name: string | null;
route(path?: string, headers?: Object): Route;
acquireHostList(): Promise<void>;
close(): void;
useDatabase(databaseName: string): this;
useBearerAuth(token: string): this;
useBasicAuth(username?: string, password?: string): this;
get(): Promise<any>;
exists(): Promise<boolean>;
createDatabase(databaseName: string, users?: string[]): Promise<any>;
listDatabases(): Promise<any>;
listUserDatabases(): Promise<any>;
dropDatabase(databaseName: string): Promise<any>;
collection(collectionName: string): DocumentCollection;
edgeCollection(collectionName: string): EdgeCollection;
listCollections(excludeSystem?: boolean): Promise<any>;
collections(excludeSystem?: boolean): Promise<ArangoCollection[]>;
truncate(excludeSystem?: boolean): Promise<[{}, {}, {}, {}, {}, {}, {}, {}, {}, {}]>;
arangoSearchView(viewName: string): ArangoSearchView;
listViews(): Promise<ViewDescription[]>;
views(): Promise<ArangoView[]>;
graph(graphName: string): Graph;
listGraphs(): Promise<any>;
graphs(): Promise<Graph[]>;
transaction(collections: TransactionCollections, action: string): Promise<any>;
transaction(collections: TransactionCollections, action: string, params?: Object): Promise<any>;
transaction(collections: TransactionCollections, action: string, params?: Object, options?: TransactionOptions): Promise<any>;
transaction(collections: TransactionCollections, action: string, lockTimeout?: number): Promise<any>;
transaction(collections: TransactionCollections, action: string, params?: Object, lockTimeout?: number): Promise<any>;
query(query: string | AqlQuery | AqlLiteral): Promise<ArrayCursor>;
query(query: AqlQuery, opts?: any): Promise<ArrayCursor>;
query(query: string | AqlLiteral, bindVars?: any, opts?: any): Promise<ArrayCursor>;
listFunctions(): Promise<any>;
createFunction(name: string, code: string): Promise<any>;
dropFunction(name: string, group?: boolean): Promise<any>;
listServices(): Promise<any>;
installService(mount: string, source: any, opts?: ServiceOptions): Promise<any>;
upgradeService(mount: string, source: any, opts?: ServiceOptions): Promise<any>;
replaceService(mount: string, source: any, opts?: ServiceOptions): Promise<any>;
uninstallService(mount: string, opts?: any): Promise<void>;
getService(mount: string): Promise<any>;
getServiceConfiguration(mount: string, minimal?: boolean): Promise<any>;
updateServiceConfiguration(mount: string, cfg: any, minimal?: boolean): Promise<any>;
replaceServiceConfiguration(mount: string, cfg: any, minimal?: boolean): Promise<any>;
getServiceDependencies(mount: string, minimal?: boolean): Promise<any>;
updateServiceDependencies(mount: string, cfg: any, minimal?: boolean): Promise<any>;
replaceServiceDependencies(mount: string, cfg: {
[key: string]: string;
}, minimal?: boolean): Promise<any>;
enableServiceDevelopmentMode(mount: string): Promise<any>;
disableServiceDevelopmentMode(mount: string): Promise<any>;
listServiceScripts(mount: string): Promise<any>;
runServiceScript(mount: string, name: string, args: any): Promise<any>;
runServiceTests(mount: string, opts: any): Promise<any>;
getServiceReadme(mount: string): Promise<string | undefined>;
getServiceDocumentation(mount: string): Promise<any>;
downloadService(mount: string): Promise<Buffer | Blob>;
commitLocalServiceState(replace?: boolean): Promise<void>;
version(): Promise<any>;
login(username?: string, password?: string): Promise<string>;
}
//# sourceMappingURL=database.d.ts.map