-
Notifications
You must be signed in to change notification settings - Fork 16
/
index.d.ts
94 lines (74 loc) · 2.16 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import stream = require("stream");
declare interface TlsOptions {
rejectUnauthorized?: boolean;
ca?: string;
key?: string;
cert?: string;
}
declare interface Config {
user?: string;
database?: string;
password?: string | (() => string | Promise<string>);
port?: number;
host?: string;
connectionString?: string;
allowCredentialsDiffing?: boolean;
keepAlive?: boolean;
stream?: stream.Duplex;
statement_timeout?: false | number;
parseInputDatesAsUTC?: boolean;
ssl?: boolean | TlsOptions;
query_timeout?: number;
keepAliveInitialDelayMillis?: number;
idle_in_transaction_session_timeout?: number;
application_name?: string;
connectionTimeoutMillis?: number;
manualMaxConnections?: boolean;
maxConnsFreqMs?: number;
maxConnections?: number;
processCountFreqMs?: number;
processCountCacheEnabled?: boolean;
strategy?: string;
debug?: boolean;
maxIdleConnectionsToKill?: number;
minConnectionIdleTimeSec?: number;
connUtilization?: number;
capMs?: number;
baseMs?: number;
delayMs?: number;
maxRetries?: number;
library?: typeof import("pg");
plugin?: Plugin;
}
declare interface Plugin {
getIdleProcessesListByMinimumTimeout(self: ServerlessClient): Promise<NodePgClientResponse<ProcessList>>;
getIdleProcessesListOrderByDate(self: ServerlessClient): Promise<NodePgClientResponse<ProcessList>>;
processCount(self: ServerlessClient): Promise<NodePgClientResponse<Count>>;
killProcesses(self: ServerlessClient, pids: string[]): Promise<NodePgClientResponse<any>>;
showMaxConnections(self: ServerlessClient): Promise<NodePgClientResponse<MaxConnections>>;
}
declare interface ProcessList {
pid: string;
}
declare interface Count {
count: number;
}
declare interface MaxConnections {
max_connections: number;
}
declare interface NodePgClientResponse<T> {
rows: T[];
}
declare namespace ServerlessClient {
export { TlsOptions, Config };
}
declare class ServerlessClient {
constructor(config: Config)
clean(): Promise<number | undefined>
setConfig(config: Config): void
connect(): Promise<void>
query(...args): Promise<any>
end(): Promise<any>
on(...args): void
}
export = ServerlessClient