influx 5.0.3 → 5.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/lib/src/backoff/backoff.d.ts +15 -15
- package/lib/src/backoff/backoff.js +2 -1
- package/lib/src/backoff/exponential.d.ts +52 -52
- package/lib/src/backoff/exponential.js +40 -39
- package/lib/src/builder.d.ts +265 -265
- package/lib/src/builder.js +366 -365
- package/lib/src/doc.d.ts +315 -310
- package/lib/src/doc.js +340 -329
- package/lib/src/grammar/ds.d.ts +45 -45
- package/lib/src/grammar/ds.js +56 -55
- package/lib/src/grammar/escape.d.ts +25 -25
- package/lib/src/grammar/escape.js +108 -107
- package/lib/src/grammar/index.d.ts +3 -3
- package/lib/src/grammar/index.js +8 -7
- package/lib/src/grammar/times.d.ts +74 -74
- package/lib/src/grammar/times.js +325 -318
- package/lib/src/host.d.ts +26 -24
- package/lib/src/host.js +34 -32
- package/lib/src/index.d.ts +659 -653
- package/lib/src/index.js +870 -866
- package/lib/src/pool.d.ts +149 -148
- package/lib/src/pool.js +344 -333
- package/lib/src/results.d.ts +118 -119
- package/lib/src/results.js +146 -139
- package/lib/src/schema.d.ts +58 -58
- package/lib/src/schema.js +117 -116
- package/package.json +10 -10
package/lib/src/pool.d.ts
CHANGED
|
@@ -1,148 +1,149 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { IBackoffStrategy } from './backoff/backoff';
|
|
3
|
-
import { Host } from './host';
|
|
4
|
-
import * as http from 'http';
|
|
5
|
-
import * as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* to
|
|
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
|
-
private
|
|
79
|
-
private
|
|
80
|
-
private
|
|
81
|
-
private
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
*
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
*
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
*
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
*
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
*
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
*
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
*
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
*
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
*
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
*
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
*
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
private
|
|
148
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { IBackoffStrategy } from './backoff/backoff';
|
|
3
|
+
import { Host } from './host';
|
|
4
|
+
import * as http from 'http';
|
|
5
|
+
import * as https from 'https';
|
|
6
|
+
import * as urlModule from 'url';
|
|
7
|
+
export interface IPoolOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Number of times we should retry running a query
|
|
10
|
+
* before calling back with an error.
|
|
11
|
+
*/
|
|
12
|
+
maxRetries?: number;
|
|
13
|
+
/**
|
|
14
|
+
* The length of time after which HTTP requests will error
|
|
15
|
+
* if they do not receive a response.
|
|
16
|
+
*/
|
|
17
|
+
requestTimeout?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Options to configure the backoff policy for the pool. Defaults
|
|
20
|
+
* to using exponential backoff.
|
|
21
|
+
*/
|
|
22
|
+
backoff?: IBackoffStrategy;
|
|
23
|
+
}
|
|
24
|
+
export interface IPoolRequestOptions {
|
|
25
|
+
/**
|
|
26
|
+
* Request method.
|
|
27
|
+
*/
|
|
28
|
+
method: 'GET' | 'POST';
|
|
29
|
+
/**
|
|
30
|
+
* Path to hit on the database server, must begin with a leading slash.
|
|
31
|
+
*/
|
|
32
|
+
path: string;
|
|
33
|
+
/**
|
|
34
|
+
* Query string to be appended to the request path.
|
|
35
|
+
*/
|
|
36
|
+
query?: any;
|
|
37
|
+
/**
|
|
38
|
+
* Request body to include.
|
|
39
|
+
*/
|
|
40
|
+
body?: string;
|
|
41
|
+
/**
|
|
42
|
+
* For internal use only, a counter of the number of times we've retried
|
|
43
|
+
* running this request.
|
|
44
|
+
*/
|
|
45
|
+
retries?: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* An ServiceNotAvailableError is returned as an error from requests that
|
|
49
|
+
* result in a > 500 error code.
|
|
50
|
+
*/
|
|
51
|
+
export declare class ServiceNotAvailableError extends Error {
|
|
52
|
+
constructor(message: string);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* An RequestError is returned as an error from requests that
|
|
56
|
+
* result in a 300 <= error code <= 500.
|
|
57
|
+
*/
|
|
58
|
+
export declare class RequestError extends Error {
|
|
59
|
+
req: http.ClientRequest;
|
|
60
|
+
res: http.IncomingMessage;
|
|
61
|
+
static Create(req: http.ClientRequest, res: http.IncomingMessage, callback: (e: RequestError) => void): void;
|
|
62
|
+
constructor(req: http.ClientRequest, res: http.IncomingMessage, body: string);
|
|
63
|
+
}
|
|
64
|
+
export interface IPingStats {
|
|
65
|
+
url: urlModule.Url;
|
|
66
|
+
res: http.ServerResponse;
|
|
67
|
+
online: boolean;
|
|
68
|
+
rtt: number;
|
|
69
|
+
version: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
*
|
|
73
|
+
* The Pool maintains a list available Influx hosts and dispatches requests
|
|
74
|
+
* to them. If there are errors connecting to hosts, it will disable that
|
|
75
|
+
* host for a period of time.
|
|
76
|
+
*/
|
|
77
|
+
export declare class Pool {
|
|
78
|
+
private options;
|
|
79
|
+
private index;
|
|
80
|
+
private timeout;
|
|
81
|
+
private hostsAvailable;
|
|
82
|
+
private hostsDisabled;
|
|
83
|
+
/**
|
|
84
|
+
* Creates a new Pool instance.
|
|
85
|
+
* @param {IPoolOptions} options
|
|
86
|
+
*/
|
|
87
|
+
constructor(options: IPoolOptions);
|
|
88
|
+
/**
|
|
89
|
+
* Returns a list of currently active hosts.
|
|
90
|
+
* @return {Host[]}
|
|
91
|
+
*/
|
|
92
|
+
getHostsAvailable(): Host[];
|
|
93
|
+
/**
|
|
94
|
+
* Returns a list of hosts that are currently disabled due to network
|
|
95
|
+
* errors.
|
|
96
|
+
* @return {Host[]}
|
|
97
|
+
*/
|
|
98
|
+
getHostsDisabled(): Host[];
|
|
99
|
+
/**
|
|
100
|
+
* Inserts a new host to the pool.
|
|
101
|
+
*/
|
|
102
|
+
addHost(url: string, options?: https.RequestOptions): Host;
|
|
103
|
+
/**
|
|
104
|
+
* Returns true if there's any host available to by queried.
|
|
105
|
+
* @return {Boolean}
|
|
106
|
+
*/
|
|
107
|
+
hostIsAvailable(): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Makes a request and calls back with the response, parsed as JSON.
|
|
110
|
+
* An error is returned on a non-2xx status code or on a parsing exception.
|
|
111
|
+
*/
|
|
112
|
+
json(options: IPoolRequestOptions): Promise<any>;
|
|
113
|
+
/**
|
|
114
|
+
* Makes a request and resolves with the plain text response,
|
|
115
|
+
* if possible. An error is raised on a non-2xx status code.
|
|
116
|
+
*/
|
|
117
|
+
text(options: IPoolRequestOptions): Promise<string>;
|
|
118
|
+
/**
|
|
119
|
+
* Makes a request and discards any response body it receives.
|
|
120
|
+
* An error is returned on a non-2xx status code.
|
|
121
|
+
*/
|
|
122
|
+
discard(options: IPoolRequestOptions): Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Ping sends out a request to all available Influx servers, reporting on
|
|
125
|
+
* their response time and version number.
|
|
126
|
+
*/
|
|
127
|
+
ping(timeout: number, path?: string): Promise<IPingStats[]>;
|
|
128
|
+
/**
|
|
129
|
+
* Makes a request and calls back with the IncomingMessage stream,
|
|
130
|
+
* if possible. An error is returned on a non-2xx status code.
|
|
131
|
+
*/
|
|
132
|
+
stream(options: IPoolRequestOptions, callback: (err: Error, res: http.IncomingMessage) => void): void;
|
|
133
|
+
/**
|
|
134
|
+
* Returns the next available host for querying.
|
|
135
|
+
* @return {Host}
|
|
136
|
+
*/
|
|
137
|
+
private getHost();
|
|
138
|
+
/**
|
|
139
|
+
* Re-enables the provided host, returning it to the pool to query.
|
|
140
|
+
* @param {Host} host
|
|
141
|
+
*/
|
|
142
|
+
private enableHost(host);
|
|
143
|
+
/**
|
|
144
|
+
* Disables the provided host, removing it from the query pool. It will be
|
|
145
|
+
* re-enabled after a backoff interval
|
|
146
|
+
*/
|
|
147
|
+
private disableHost(host);
|
|
148
|
+
private handleRequestError(err, host, options, callback);
|
|
149
|
+
}
|