Merge pull request #33539 from zharkov-eu/master

Add typings for tarantool-driver
This commit is contained in:
Nathan Shively-Sanders
2019-03-04 15:22:12 -08:00
committed by GitHub
4 changed files with 89 additions and 0 deletions
+62
View File
@@ -0,0 +1,62 @@
// 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";
declare namespace TarantoolConnection {
interface TarantoolOptions {
host?: string;
port?: number;
username?: string;
password?: string;
reserveHosts?: string[];
beforeReserve?: number;
timeout?: number;
retryStrategy?: (times: number) => number;
lazyConnect?: boolean;
}
}
declare class TarantoolConnection extends EventEmitter {
constructor(options: TarantoolConnection.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: any[]): 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>;
}
export = TarantoolConnection;
@@ -0,0 +1,3 @@
import TarantoolDriver = require("tarantool-driver");
new TarantoolDriver({}).connect(); // $ExpectedType Promise
+23
View 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
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }