influx 5.0.6 → 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/lib/src/doc.js CHANGED
@@ -1,340 +1,340 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
- return function (d, b) {
7
- extendStatics(d, b);
8
- function __() { this.constructor = d; }
9
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
10
- };
11
- })();
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- /**
14
- * Pool options can be passed into the database to configure the behaviour
15
- * of the connection pool.
16
- * @typedef {Object} IPoolOptions
17
- * @property {Number} [maxRetries=2] Number of times we should retry running
18
- * a query before calling back with an error.
19
- * @property {Number} [requestTimeout=30000] The length of time after which
20
- * HTTP requests will error if they do not receive a response.
21
- * @property {IBackoffStrategy} [backoff] The backoff strategy to use for
22
- * unhealthy connections. Defaults to an exponential backoff with an
23
- * initial delay of 300ms and a maximum delay of 10 seconds.
24
- */
25
- /**
26
- * A ISingleHostConfig can be provided into `new InfluxDB(config)` when you
27
- * have a single Influx address to connect to.
28
- *
29
- * @public
30
- * @typedef {Object} ISingleHostConfig
31
- * @property {String} [username='root'] Username for connecting to the database.
32
- * @property {String} [password='root'] Password for connecting to the database.
33
- * @property {String} [database] Default database to operate on. Providing this
34
- * will let you omit database names in most operations, and is convenient
35
- * if your app is primarily dealing with a single database.
36
- * @property {String} [host='127.0.0.1'] Influx host to connect to.
37
- * @property {Number} [port=8086] Influx port to connect to.
38
- * @property {String} [protocol='http'] Protocol to connect over, either
39
- * 'http' or 'https'.
40
- * @property {https.RequestOptions} [options={}] Option overrides to use in
41
- * passing to http.request or https.request.
42
- * @property {IPoolOptions} [pool] Options for the connection pool.
43
- * @property {ISchemaOptions[]} [schema] An optional list of data schema to use.
44
- *
45
- * @example
46
- * import { InfluxDB } from 'influx'; // or const InfluxDB = require('influx').InfluxDB
47
- *
48
- * // Connect to a single host with a full set of config details and
49
- * // a custom schema
50
- * const client = new InfluxDB({
51
- * database: 'my_db',
52
- * host: 'localhost',
53
- * port: 8086,
54
- * username: 'connor',
55
- * password: 'pa$$w0rd',
56
- * schema: [{
57
- * measurement: 'perf',
58
- * tags: ['hostname'],
59
- * fields: {
60
- * memory_usage: FieldType.INTEGER,
61
- * cpu_usage: FieldType.FLOAT,
62
- * is_online: FieldType.BOOLEAN,
63
- * }
64
- * }]
65
- * })
66
- */
67
- /**
68
- * A IClusterConfig can be provided into `new InfluxDB(config)` when you
69
- * have a multiple Influx nodes to connect to.
70
- *
71
- * @typedef {Object} IClusterConfig
72
- * @property {String} [username='root'] Username for connecting to the database.
73
- * @property {String} [password='root'] Password for connecting to the database.
74
- * @property {String} [database] Default database to operate on. Providing this
75
- * will let you omit database names in most operations, and is convenient
76
- * if your app is primarily dealing with a single database.
77
- * @property {Array} hosts A list of Influx hosts to connect to.
78
- * @property {String} [hosts.host='127.0.0.1'] Influx host to connect to.
79
- * @property {Number} [hosts.port=8086] Influx port to connect to.
80
- * @property {String} [hosts.protocol='http'] Protocol to connect over, either
81
- * 'http' or 'https'.
82
- * @property {https.RequestOptions} [hosts.options={}] Option overrides to
83
- * use in passing to http.request or https.request.
84
- * @property {IPoolOptions} [pool] Options for the connection pool.
85
- * @property {ISchemaOptions[]} [schema] An optional list of data schema to use.
86
- *
87
- * @example
88
- * import { InfluxDB } from 'influx'; // or const InfluxDB = require('influx').InfluxDB
89
- *
90
- * // Connect to a single host with a full set of config details and
91
- * // a custom schema
92
- * const client = new InfluxDB({
93
- * database: 'my_db',
94
- * username: 'connor',
95
- * password: 'pa$$w0rd',
96
- * hosts: [
97
- * { host: 'db1.example.com' },
98
- * { host: 'db2.example.com' },
99
- * ]
100
- * schema: [{
101
- * measurement: 'perf',
102
- * tags: ['hostname'],
103
- * fields: {
104
- * memory_usage: FieldType.INTEGER,
105
- * cpu_usage: FieldType.FLOAT,
106
- * is_online: FieldType.BOOLEAN,
107
- * }
108
- * }]
109
- * })
110
- */
111
- /**
112
- * Schema options can be passed into the `new InfluxDB()` constructor to
113
- * help define the shape of your data. Each schema config corresponds to
114
- * a measurement in Influx
115
- *
116
- * It's recommended, but not required, that you make use of schema; internally
117
- * we use them to be smarter about coercing your data, and providing immediate
118
- * error feedback if you try to write data which doesn't fit in your schema:
119
- * either if you include tags of fields which are not present in your schema,
120
- * or you enter the wrong datatype for one of your schema fields.
121
- *
122
- * @typedef {Object} ISchemaOptions
123
- * @property {String} [database] The database where the measurement lives. This
124
- * is required if you don't provide a default database in Influx.
125
- * @property {String} measurement The measurement name in Influx this refers to
126
- * @property {Object.<String, FieldType>} fields A mapping of fields names to
127
- * their data types. It's assumed that this is a comprehensive mapping of
128
- * every field you might write.
129
- * @property {String[]} tags A list of tag names in this measurement. It's
130
- * assumed that this is a comprehensive list of every tag you might write.
131
- *
132
- * @example
133
- * {
134
- * measurement: 'perf',
135
- * tags: ['hostname'],
136
- * fields: {
137
- * memory_usage: FieldType.INTEGER,
138
- * cpu_usage: FieldType.FLOAT,
139
- * is_online: FieldType.BOOLEAN,
140
- * }
141
- * }
142
- */
143
- /**
144
- * IResults are returned from the {@link InfluxDB#query} method. It marshals the raw Influx
145
- * results into a more palatable, JavaScript-y structure. All query results
146
- * are marshalled into a single, flat array, and methods are provided to
147
- * examine grouped results as necessary. The `time` column, if included, is
148
- * converted into a {@link INanoDate}. If `.query()` was called on an array of strings,
149
- * it will return an array of IResults, one result per query string.
150
- *
151
- * @interface
152
- * @example
153
- * influx.query('select host, cpu, mem from perf').then(results => {
154
- * expect(results).to.deep.equal([
155
- * { host: 'ares.peet.io', cpu: 0.12, mem: 2435 },
156
- * { host: 'ares.peet.io', cpu: 0.10, mem: 2451 },
157
- * // ...
158
- * ])
159
- * })
160
- */
161
- var IResults = (function (_super) {
162
- __extends(IResults, _super);
163
- function IResults() {
164
- return _super !== null && _super.apply(this, arguments) || this;
165
- }
166
- /**
167
- * Looks for and returns the first group in the results
168
- * that matches the provided tags.
169
- *
170
- * If you've used lodash or underscore, we do something quite similar to
171
- * their object matching: for every row in the results, if it contains tag
172
- * values matching the requested object, we return it.
173
- *
174
- * @param {Object.<String, String>} matcher
175
- * @return {T[]}
176
- * @example
177
- * // Matching tags sets in queries:
178
- * influx.query('select * from perf group by host').then(results => {
179
- * expect(results.group({ host: 'ares.peet.io'})).to.deep.equal([
180
- * { host: 'ares.peet.io', cpu: 0.12, mem: 2435 },
181
- * { host: 'ares.peet.io', cpu: 0.10, mem: 2451 },
182
- * // ...
183
- * ])
184
- *
185
- * expect(results.group({ host: 'box1.example.com'})).to.deep.equal([
186
- * { host: 'box1.example.com', cpu: 0.54, mem: 8420 },
187
- * // ...
188
- * ])
189
- * })
190
- */
191
- IResults.prototype.group = function (matcher) { return null; };
192
- /**
193
- * Returns the data grouped into nested arrays, similarly to how it was
194
- * returned from Influx originally.
195
- *
196
- * @returns {Array<{ name: String, tags: Object.<String, String>, rows: T[] }>}
197
- * @example
198
- * influx.query('select * from perf group by host').then(results => {
199
- * expect(results.groups()).to.deep.equal([
200
- * {
201
- * name: 'perf',
202
- * tags: { host: 'ares.peet.io' },
203
- * rows: [
204
- * { host: 'ares.peet.io', cpu: 0.12, mem: 2435 },
205
- * { host: 'ares.peet.io', cpu: 0.10, mem: 2451 },
206
- * // ...
207
- * ]
208
- * }
209
- * {
210
- * name: 'perf',
211
- * tags: { host: 'box1.example.com' },
212
- * rows: [
213
- * { host: 'box1.example.com', cpu: 0.54, mem: 8420 },
214
- * // ...
215
- * ]
216
- * }
217
- * ])
218
- * })
219
- */
220
- IResults.prototype.groups = function () { return null; };
221
- return IResults;
222
- }(Array));
223
- exports.IResults = IResults;
224
- /**
225
- * IPoint is passed to the client's write methods to store a point in InfluxDB.
226
- *
227
- * @typedef {Object} IPoint
228
- * @property {String} measurement Measurement is the Influx measurement name.
229
- * @property {Object.<String, String>} [tags] Tags is the list of tag
230
- * values to insert.
231
- * @property {Object.<String, *>} [fields] Fields is the list of
232
- * field values to insert.
233
- * @property {Date|string|number} [timestamp] Specifies a timestamp for this
234
- * point. This can be a Date object, in which case we'll adjust it to the
235
- * desired precision, or a numeric string or number, in which case
236
- * it gets passed directly to Influx.
237
- */
238
- /**
239
- * IWriteOptions configure how points are written in the database.
240
- *
241
- * @typedef {Object} IWriteOptions
242
- * @property {TimePrecision} [precision] Precision at which the points are
243
- * written, defaults to milliseconds 'ms'. Influx recommends that you use
244
- * the coarsest precision possible in order to maximize efficiency.
245
- * @property {String} [retentionPolicy] The retention policy to insert
246
- * the points under, uses the DEFAULT policy if not provided.
247
- * @property {String} [database] The database to insert the points in, uses the
248
- * adapter's default database if not provided.
249
- */
250
- /**
251
- * The IQueryOptions allow you to configure how queries are run against Influx.
252
- *
253
- * @typedef {Object} IQueryOptions
254
- * @property {TimePrecision} [precision] Defines the precision at which
255
- * to query points. Defaults to querying in nanosecond precision.
256
- * @property {String} [retentionPolicy] Retention policy to query from,
257
- * defaults to the DEFAULT retention policy.
258
- * @property {String} [database] Database under which to query the points.
259
- * This is required if a database is not provided in Influx client.
260
- */
261
- /**
262
- * IPingStats is returned from {@link InfluxDB#ping}.
263
- *
264
- * @typedef {Object} IPingStats
265
- * @property {Url} url URL is the host's URL
266
- * @property {Boolean} online Whether the request was completed successfully.
267
- * @property {http.ServerResponse} res The raw response from the server, may be
268
- * null on a timeout or HTTP error.
269
- * @property {Number} rtt Total time the server took to respond, in milliseconds
270
- * @property {String} version Version number the server reports to run
271
- */
272
- /**
273
- * The IBackoffStrategy dictates behaviour to use when hosts in the connection
274
- * pool start failing. We remove them from the pool for a duration of time
275
- * specified by the backoff strategy.
276
- *
277
- * The strategy itself is immutable, and each method call should return a new
278
- * strategy without modifying the original one.
279
- *
280
- * @interface
281
- * @example
282
- * let backoff = new MyBackoffStrategy();
283
- * console.log(backoff.getDelay()); // => 10
284
- * backoff = backoff.next();
285
- * console.log(backoff.getDelay()); // => 20
286
- * backoff = backoff.reset();
287
- * console.log(backoff.getDelay()); // => 10
288
- */
289
- var IBackoffStrategy = (function () {
290
- function IBackoffStrategy() {
291
- }
292
- /**
293
- * getDelay returns the amount of delay of the current backoff.
294
- * @return {Number}
295
- */
296
- IBackoffStrategy.prototype.getDelay = function () { return 0; };
297
- /**
298
- * Next is called when a failure occurs on a host to
299
- * return the next backoff amount.
300
- * @return {IBackoffStrategy}
301
- */
302
- IBackoffStrategy.prototype.next = function () { return this; };
303
- /**
304
- * Returns a strategy with a reset backoff counter.
305
- * @return {IBackoffStrategy}
306
- */
307
- IBackoffStrategy.prototype.reset = function () { return this; };
308
- return IBackoffStrategy;
309
- }());
310
- exports.IBackoffStrategy = IBackoffStrategy;
311
- /**
312
- * An INanoDate is a type of Date that holds a nanosecond-precision unix
313
- * timestamp. It's the default date type parsed in {@link IResults} and
314
- * can be created manually using {@link toNanoDate}.
315
- * @interface
316
- */
317
- var INanoDate = (function (_super) {
318
- __extends(INanoDate, _super);
319
- function INanoDate() {
320
- return _super !== null && _super.apply(this, arguments) || this;
321
- }
322
- /**
323
- * Returns the unix nanoseconds timestamp as a string.
324
- * @example
325
- * const date = toNanoDate('1475985480231035677')
326
- * expect(date.getNanoTime()).to.equal('1475985480231035677')
327
- */
328
- INanoDate.prototype.getNanoTime = function () { return ''; };
329
- ;
330
- /**
331
- * Formats the date as an ISO RFC3339 timestamp with nanosecond precision.
332
- * @example
333
- * const date = toNanoDate('1475985480231035677')
334
- * expect(date.toNanoISOString()).to.equal('2016-10-09T03:58:00.231035677Z')
335
- */
336
- INanoDate.prototype.toNanoISOString = function () { return ''; };
337
- ;
338
- return INanoDate;
339
- }(Date));
340
- exports.INanoDate = INanoDate;
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ return function (d, b) {
7
+ extendStatics(d, b);
8
+ function __() { this.constructor = d; }
9
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
10
+ };
11
+ })();
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ /**
14
+ * Pool options can be passed into the database to configure the behaviour
15
+ * of the connection pool.
16
+ * @typedef {Object} IPoolOptions
17
+ * @property {Number} [maxRetries=2] Number of times we should retry running
18
+ * a query before calling back with an error.
19
+ * @property {Number} [requestTimeout=30000] The length of time after which
20
+ * HTTP requests will error if they do not receive a response.
21
+ * @property {IBackoffStrategy} [backoff] The backoff strategy to use for
22
+ * unhealthy connections. Defaults to an exponential backoff with an
23
+ * initial delay of 300ms and a maximum delay of 10 seconds.
24
+ */
25
+ /**
26
+ * A ISingleHostConfig can be provided into `new InfluxDB(config)` when you
27
+ * have a single Influx address to connect to.
28
+ *
29
+ * @public
30
+ * @typedef {Object} ISingleHostConfig
31
+ * @property {String} [username='root'] Username for connecting to the database.
32
+ * @property {String} [password='root'] Password for connecting to the database.
33
+ * @property {String} [database] Default database to operate on. Providing this
34
+ * will let you omit database names in most operations, and is convenient
35
+ * if your app is primarily dealing with a single database.
36
+ * @property {String} [host='127.0.0.1'] Influx host to connect to.
37
+ * @property {Number} [port=8086] Influx port to connect to.
38
+ * @property {String} [protocol='http'] Protocol to connect over, either
39
+ * 'http' or 'https'.
40
+ * @property {https.RequestOptions} [options={}] Option overrides to use in
41
+ * passing to http.request or https.request.
42
+ * @property {IPoolOptions} [pool] Options for the connection pool.
43
+ * @property {ISchemaOptions[]} [schema] An optional list of data schema to use.
44
+ *
45
+ * @example
46
+ * import { InfluxDB } from 'influx'; // or const InfluxDB = require('influx').InfluxDB
47
+ *
48
+ * // Connect to a single host with a full set of config details and
49
+ * // a custom schema
50
+ * const client = new InfluxDB({
51
+ * database: 'my_db',
52
+ * host: 'localhost',
53
+ * port: 8086,
54
+ * username: 'connor',
55
+ * password: 'pa$$w0rd',
56
+ * schema: [{
57
+ * measurement: 'perf',
58
+ * tags: ['hostname'],
59
+ * fields: {
60
+ * memory_usage: FieldType.INTEGER,
61
+ * cpu_usage: FieldType.FLOAT,
62
+ * is_online: FieldType.BOOLEAN,
63
+ * }
64
+ * }]
65
+ * })
66
+ */
67
+ /**
68
+ * A IClusterConfig can be provided into `new InfluxDB(config)` when you
69
+ * have a multiple Influx nodes to connect to.
70
+ *
71
+ * @typedef {Object} IClusterConfig
72
+ * @property {String} [username='root'] Username for connecting to the database.
73
+ * @property {String} [password='root'] Password for connecting to the database.
74
+ * @property {String} [database] Default database to operate on. Providing this
75
+ * will let you omit database names in most operations, and is convenient
76
+ * if your app is primarily dealing with a single database.
77
+ * @property {Array} hosts A list of Influx hosts to connect to.
78
+ * @property {String} [hosts.host='127.0.0.1'] Influx host to connect to.
79
+ * @property {Number} [hosts.port=8086] Influx port to connect to.
80
+ * @property {String} [hosts.protocol='http'] Protocol to connect over, either
81
+ * 'http' or 'https'.
82
+ * @property {https.RequestOptions} [hosts.options={}] Option overrides to
83
+ * use in passing to http.request or https.request.
84
+ * @property {IPoolOptions} [pool] Options for the connection pool.
85
+ * @property {ISchemaOptions[]} [schema] An optional list of data schema to use.
86
+ *
87
+ * @example
88
+ * import { InfluxDB } from 'influx'; // or const InfluxDB = require('influx').InfluxDB
89
+ *
90
+ * // Connect to a single host with a full set of config details and
91
+ * // a custom schema
92
+ * const client = new InfluxDB({
93
+ * database: 'my_db',
94
+ * username: 'connor',
95
+ * password: 'pa$$w0rd',
96
+ * hosts: [
97
+ * { host: 'db1.example.com' },
98
+ * { host: 'db2.example.com' },
99
+ * ]
100
+ * schema: [{
101
+ * measurement: 'perf',
102
+ * tags: ['hostname'],
103
+ * fields: {
104
+ * memory_usage: FieldType.INTEGER,
105
+ * cpu_usage: FieldType.FLOAT,
106
+ * is_online: FieldType.BOOLEAN,
107
+ * }
108
+ * }]
109
+ * })
110
+ */
111
+ /**
112
+ * Schema options can be passed into the `new InfluxDB()` constructor to
113
+ * help define the shape of your data. Each schema config corresponds to
114
+ * a measurement in Influx
115
+ *
116
+ * It's recommended, but not required, that you make use of schema; internally
117
+ * we use them to be smarter about coercing your data, and providing immediate
118
+ * error feedback if you try to write data which doesn't fit in your schema:
119
+ * either if you include tags of fields which are not present in your schema,
120
+ * or you enter the wrong datatype for one of your schema fields.
121
+ *
122
+ * @typedef {Object} ISchemaOptions
123
+ * @property {String} [database] The database where the measurement lives. This
124
+ * is required if you don't provide a default database in Influx.
125
+ * @property {String} measurement The measurement name in Influx this refers to
126
+ * @property {Object.<String, FieldType>} fields A mapping of fields names to
127
+ * their data types. It's assumed that this is a comprehensive mapping of
128
+ * every field you might write.
129
+ * @property {String[]} tags A list of tag names in this measurement. It's
130
+ * assumed that this is a comprehensive list of every tag you might write.
131
+ *
132
+ * @example
133
+ * {
134
+ * measurement: 'perf',
135
+ * tags: ['hostname'],
136
+ * fields: {
137
+ * memory_usage: FieldType.INTEGER,
138
+ * cpu_usage: FieldType.FLOAT,
139
+ * is_online: FieldType.BOOLEAN,
140
+ * }
141
+ * }
142
+ */
143
+ /**
144
+ * IResults are returned from the {@link InfluxDB#query} method. It marshals the raw Influx
145
+ * results into a more palatable, JavaScript-y structure. All query results
146
+ * are marshalled into a single, flat array, and methods are provided to
147
+ * examine grouped results as necessary. The `time` column, if included, is
148
+ * converted into a {@link INanoDate}. If `.query()` was called on an array of strings,
149
+ * it will return an array of IResults, one result per query string.
150
+ *
151
+ * @interface
152
+ * @example
153
+ * influx.query('select host, cpu, mem from perf').then(results => {
154
+ * expect(results).to.deep.equal([
155
+ * { host: 'ares.peet.io', cpu: 0.12, mem: 2435 },
156
+ * { host: 'ares.peet.io', cpu: 0.10, mem: 2451 },
157
+ * // ...
158
+ * ])
159
+ * })
160
+ */
161
+ var IResults = (function (_super) {
162
+ __extends(IResults, _super);
163
+ function IResults() {
164
+ return _super !== null && _super.apply(this, arguments) || this;
165
+ }
166
+ /**
167
+ * Looks for and returns the first group in the results
168
+ * that matches the provided tags.
169
+ *
170
+ * If you've used lodash or underscore, we do something quite similar to
171
+ * their object matching: for every row in the results, if it contains tag
172
+ * values matching the requested object, we return it.
173
+ *
174
+ * @param {Object.<String, String>} matcher
175
+ * @return {T[]}
176
+ * @example
177
+ * // Matching tags sets in queries:
178
+ * influx.query('select * from perf group by host').then(results => {
179
+ * expect(results.group({ host: 'ares.peet.io'})).to.deep.equal([
180
+ * { host: 'ares.peet.io', cpu: 0.12, mem: 2435 },
181
+ * { host: 'ares.peet.io', cpu: 0.10, mem: 2451 },
182
+ * // ...
183
+ * ])
184
+ *
185
+ * expect(results.group({ host: 'box1.example.com'})).to.deep.equal([
186
+ * { host: 'box1.example.com', cpu: 0.54, mem: 8420 },
187
+ * // ...
188
+ * ])
189
+ * })
190
+ */
191
+ IResults.prototype.group = function (matcher) { return null; };
192
+ /**
193
+ * Returns the data grouped into nested arrays, similarly to how it was
194
+ * returned from Influx originally.
195
+ *
196
+ * @returns {Array<{ name: String, tags: Object.<String, String>, rows: T[] }>}
197
+ * @example
198
+ * influx.query('select * from perf group by host').then(results => {
199
+ * expect(results.groups()).to.deep.equal([
200
+ * {
201
+ * name: 'perf',
202
+ * tags: { host: 'ares.peet.io' },
203
+ * rows: [
204
+ * { host: 'ares.peet.io', cpu: 0.12, mem: 2435 },
205
+ * { host: 'ares.peet.io', cpu: 0.10, mem: 2451 },
206
+ * // ...
207
+ * ]
208
+ * }
209
+ * {
210
+ * name: 'perf',
211
+ * tags: { host: 'box1.example.com' },
212
+ * rows: [
213
+ * { host: 'box1.example.com', cpu: 0.54, mem: 8420 },
214
+ * // ...
215
+ * ]
216
+ * }
217
+ * ])
218
+ * })
219
+ */
220
+ IResults.prototype.groups = function () { return null; };
221
+ return IResults;
222
+ }(Array));
223
+ exports.IResults = IResults;
224
+ /**
225
+ * IPoint is passed to the client's write methods to store a point in InfluxDB.
226
+ *
227
+ * @typedef {Object} IPoint
228
+ * @property {String} measurement Measurement is the Influx measurement name.
229
+ * @property {Object.<String, String>} [tags] Tags is the list of tag
230
+ * values to insert.
231
+ * @property {Object.<String, *>} [fields] Fields is the list of
232
+ * field values to insert.
233
+ * @property {Date|string|number} [timestamp] Specifies a timestamp for this
234
+ * point. This can be a Date object, in which case we'll adjust it to the
235
+ * desired precision, or a numeric string or number, in which case
236
+ * it gets passed directly to Influx.
237
+ */
238
+ /**
239
+ * IWriteOptions configure how points are written in the database.
240
+ *
241
+ * @typedef {Object} IWriteOptions
242
+ * @property {TimePrecision} [precision] Precision at which the points are
243
+ * written, defaults to milliseconds 'ms'. Influx recommends that you use
244
+ * the coarsest precision possible in order to maximize efficiency.
245
+ * @property {String} [retentionPolicy] The retention policy to insert
246
+ * the points under, uses the DEFAULT policy if not provided.
247
+ * @property {String} [database] The database to insert the points in, uses the
248
+ * adapter's default database if not provided.
249
+ */
250
+ /**
251
+ * The IQueryOptions allow you to configure how queries are run against Influx.
252
+ *
253
+ * @typedef {Object} IQueryOptions
254
+ * @property {TimePrecision} [precision] Defines the precision at which
255
+ * to query points. Defaults to querying in nanosecond precision.
256
+ * @property {String} [retentionPolicy] Retention policy to query from,
257
+ * defaults to the DEFAULT retention policy.
258
+ * @property {String} [database] Database under which to query the points.
259
+ * This is required if a database is not provided in Influx client.
260
+ */
261
+ /**
262
+ * IPingStats is returned from {@link InfluxDB#ping}.
263
+ *
264
+ * @typedef {Object} IPingStats
265
+ * @property {Url} url URL is the host's URL
266
+ * @property {Boolean} online Whether the request was completed successfully.
267
+ * @property {http.ServerResponse} res The raw response from the server, may be
268
+ * null on a timeout or HTTP error.
269
+ * @property {Number} rtt Total time the server took to respond, in milliseconds
270
+ * @property {String} version Version number the server reports to run
271
+ */
272
+ /**
273
+ * The IBackoffStrategy dictates behaviour to use when hosts in the connection
274
+ * pool start failing. We remove them from the pool for a duration of time
275
+ * specified by the backoff strategy.
276
+ *
277
+ * The strategy itself is immutable, and each method call should return a new
278
+ * strategy without modifying the original one.
279
+ *
280
+ * @interface
281
+ * @example
282
+ * let backoff = new MyBackoffStrategy();
283
+ * console.log(backoff.getDelay()); // => 10
284
+ * backoff = backoff.next();
285
+ * console.log(backoff.getDelay()); // => 20
286
+ * backoff = backoff.reset();
287
+ * console.log(backoff.getDelay()); // => 10
288
+ */
289
+ var IBackoffStrategy = (function () {
290
+ function IBackoffStrategy() {
291
+ }
292
+ /**
293
+ * getDelay returns the amount of delay of the current backoff.
294
+ * @return {Number}
295
+ */
296
+ IBackoffStrategy.prototype.getDelay = function () { return 0; };
297
+ /**
298
+ * Next is called when a failure occurs on a host to
299
+ * return the next backoff amount.
300
+ * @return {IBackoffStrategy}
301
+ */
302
+ IBackoffStrategy.prototype.next = function () { return this; };
303
+ /**
304
+ * Returns a strategy with a reset backoff counter.
305
+ * @return {IBackoffStrategy}
306
+ */
307
+ IBackoffStrategy.prototype.reset = function () { return this; };
308
+ return IBackoffStrategy;
309
+ }());
310
+ exports.IBackoffStrategy = IBackoffStrategy;
311
+ /**
312
+ * An INanoDate is a type of Date that holds a nanosecond-precision unix
313
+ * timestamp. It's the default date type parsed in {@link IResults} and
314
+ * can be created manually using {@link toNanoDate}.
315
+ * @interface
316
+ */
317
+ var INanoDate = (function (_super) {
318
+ __extends(INanoDate, _super);
319
+ function INanoDate() {
320
+ return _super !== null && _super.apply(this, arguments) || this;
321
+ }
322
+ /**
323
+ * Returns the unix nanoseconds timestamp as a string.
324
+ * @example
325
+ * const date = toNanoDate('1475985480231035677')
326
+ * expect(date.getNanoTime()).to.equal('1475985480231035677')
327
+ */
328
+ INanoDate.prototype.getNanoTime = function () { return ''; };
329
+ ;
330
+ /**
331
+ * Formats the date as an ISO RFC3339 timestamp with nanosecond precision.
332
+ * @example
333
+ * const date = toNanoDate('1475985480231035677')
334
+ * expect(date.toNanoISOString()).to.equal('2016-10-09T03:58:00.231035677Z')
335
+ */
336
+ INanoDate.prototype.toNanoISOString = function () { return ''; };
337
+ ;
338
+ return INanoDate;
339
+ }(Date));
340
+ exports.INanoDate = INanoDate;