mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-04-06 05:34:28 +00:00
Add typings for tarantool-driver
This commit is contained in:
58
types/tarantool-driver/index.d.ts
vendored
Normal file
58
types/tarantool-driver/index.d.ts
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
// Type definitions for tarantool-driver 3.0
|
||||
// Project: https://github.com/tarantool/node-tarantool-driver
|
||||
// Definitions by: Evgeni Zharkov <https://github.com/zharkov-eu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { EventEmitter } from "events";
|
||||
|
||||
export interface TarantoolOptions {
|
||||
host?: string;
|
||||
port?: number;
|
||||
username?: string;
|
||||
password?: string;
|
||||
reserveHosts?: string[];
|
||||
beforeReserve?: number;
|
||||
timeout?: number;
|
||||
retryStrategy?: (times: number) => number;
|
||||
lazyConnect?: boolean;
|
||||
}
|
||||
|
||||
export default class TarantoolConnection extends EventEmitter {
|
||||
constructor(options: TarantoolOptions);
|
||||
|
||||
/* Connection */
|
||||
|
||||
connect(): Promise<void>;
|
||||
|
||||
flushQueue(cb: (err: Error) => void): void;
|
||||
|
||||
destroy(): void;
|
||||
|
||||
disconnect(reconnect?: boolean): void;
|
||||
|
||||
/* Commands */
|
||||
|
||||
select(spaceId: number | string,
|
||||
indexId: number | string,
|
||||
limit: number, offset: number,
|
||||
iterator: string, key: string | string[]): Promise<any>;
|
||||
|
||||
delete(spaceId: number | string,
|
||||
indexId: number | string,
|
||||
key: any[]): Promise<any>;
|
||||
|
||||
update(spaceId: number | string,
|
||||
indexId: number | string,
|
||||
key: any[], ops: any[]): Promise<any>;
|
||||
|
||||
upsert(spaceId: number | string,
|
||||
ops: any[], tuple: any[]): Promise<any>;
|
||||
|
||||
eval(expression: string, ...args: any[]): Promise<any>;
|
||||
|
||||
call(functionName: string, ...args: any[]): Promise<any>;
|
||||
|
||||
insert(spaceId: number | string, tuple: any[]): Promise<any>;
|
||||
|
||||
replace(spaceId: number | string, tuple: any[]): Promise<any>;
|
||||
}
|
||||
3
types/tarantool-driver/tarantool-driver-tests.ts
Normal file
3
types/tarantool-driver/tarantool-driver-tests.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import TarantoolDriver from "tarantool-driver";
|
||||
|
||||
new TarantoolDriver({}).connect(); // $ExpectedType Promise
|
||||
23
types/tarantool-driver/tsconfig.json
Normal file
23
types/tarantool-driver/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"tarantool-driver-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/tarantool-driver/tslint.json
Normal file
1
types/tarantool-driver/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user