@influxdata/influxdb3-client 0.1.0-nightly.760
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/.mocharc.json +4 -0
- package/LICENSE +21 -0
- package/api-extractor.json +8 -0
- package/dist/index.d.mts +478 -0
- package/dist/index.d.ts +478 -0
- package/dist/index.js +7 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +7 -0
- package/dist/index.mjs.gz +0 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +93 -0
package/.mocharc.json
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 InfluxData Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config file for API Extractor. For more info, please visit: https://api-extractor.com
|
|
3
|
+
*/
|
|
4
|
+
{
|
|
5
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
6
|
+
"extends": "../../scripts/api-extractor-base.json",
|
|
7
|
+
"mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts"
|
|
8
|
+
}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
/** IllegalArgumentError is thrown when illegal argument is supplied. */
|
|
2
|
+
declare class IllegalArgumentError extends Error {
|
|
3
|
+
constructor(message: string);
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* A general HTTP error.
|
|
7
|
+
*/
|
|
8
|
+
declare class HttpError extends Error {
|
|
9
|
+
readonly statusCode: number;
|
|
10
|
+
readonly statusMessage: string | undefined;
|
|
11
|
+
readonly body?: string | undefined;
|
|
12
|
+
readonly contentType?: string | null | undefined;
|
|
13
|
+
/** application error code, when available */
|
|
14
|
+
code: string | undefined;
|
|
15
|
+
/** json error response */
|
|
16
|
+
json: any;
|
|
17
|
+
constructor(statusCode: number, statusMessage: string | undefined, body?: string | undefined, contentType?: string | null | undefined, message?: string);
|
|
18
|
+
}
|
|
19
|
+
/** RequestTimedOutError indicates request timeout in the communication with the server */
|
|
20
|
+
declare class RequestTimedOutError extends Error {
|
|
21
|
+
constructor();
|
|
22
|
+
}
|
|
23
|
+
/** AbortError indicates that the communication with the server was aborted */
|
|
24
|
+
declare class AbortError extends Error {
|
|
25
|
+
constructor();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* ChunkCombiner is a simplified platform-neutral manipulation of Uint8arrays
|
|
30
|
+
* that allows to process text data on the fly. The implementation can be optimized
|
|
31
|
+
* for the target platform (node vs browser).
|
|
32
|
+
*/
|
|
33
|
+
interface ChunkCombiner {
|
|
34
|
+
/**
|
|
35
|
+
* Concatenates first and second chunk.
|
|
36
|
+
* @param first - first chunk
|
|
37
|
+
* @param second - second chunk
|
|
38
|
+
* @returns first + second
|
|
39
|
+
*/
|
|
40
|
+
concat(first: Uint8Array, second: Uint8Array): Uint8Array;
|
|
41
|
+
/**
|
|
42
|
+
* Converts chunk into a string.
|
|
43
|
+
* @param chunk - chunk
|
|
44
|
+
* @param start - start index
|
|
45
|
+
* @param end - end index
|
|
46
|
+
* @returns string representation of chunk slice
|
|
47
|
+
*/
|
|
48
|
+
toUtf8String(chunk: Uint8Array, start: number, end: number): string;
|
|
49
|
+
/**
|
|
50
|
+
* Creates a new chunk from the supplied chunk.
|
|
51
|
+
* @param chunk - chunk to copy
|
|
52
|
+
* @param start - start index
|
|
53
|
+
* @param end - end index
|
|
54
|
+
* @returns a copy of a chunk slice
|
|
55
|
+
*/
|
|
56
|
+
copy(chunk: Uint8Array, start: number, end: number): Uint8Array;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Creates a chunk combiner instance that uses UTF-8
|
|
60
|
+
* TextDecoder to decode Uint8Arrays into strings.
|
|
61
|
+
*/
|
|
62
|
+
declare function createTextDecoderCombiner(): ChunkCombiner;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Allows to cancel a running execution.
|
|
66
|
+
*/
|
|
67
|
+
interface Cancellable {
|
|
68
|
+
/**
|
|
69
|
+
* Cancels execution.
|
|
70
|
+
*/
|
|
71
|
+
cancel(): void;
|
|
72
|
+
isCancelled(): boolean;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Type of HTTP headers.
|
|
77
|
+
*/
|
|
78
|
+
type HttpHeaders = {
|
|
79
|
+
[header: string]: string | string[] | undefined;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Informs about a start of response processing.
|
|
84
|
+
* @param headers - response HTTP headers
|
|
85
|
+
* @param statusCode - response status code
|
|
86
|
+
*/
|
|
87
|
+
type ResponseStartedFn = (headers: HttpHeaders, statusCode?: number) => void;
|
|
88
|
+
/**
|
|
89
|
+
* Observes communication with the server.
|
|
90
|
+
*/
|
|
91
|
+
interface CommunicationObserver<T> {
|
|
92
|
+
/**
|
|
93
|
+
* Data chunk received, can be called multiple times.
|
|
94
|
+
* @param data - data
|
|
95
|
+
* @returns when `false` value is returned and {@link CommunicationObserver.useResume} is defined,
|
|
96
|
+
* future calls to `next` are paused until resume is called.
|
|
97
|
+
*/
|
|
98
|
+
next(data: T): void | boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Communication ended with an error.
|
|
101
|
+
*/
|
|
102
|
+
error(error: Error): void;
|
|
103
|
+
/**
|
|
104
|
+
* Communication was successful.
|
|
105
|
+
*/
|
|
106
|
+
complete(): void;
|
|
107
|
+
/**
|
|
108
|
+
* Informs about a start of response processing.
|
|
109
|
+
*/
|
|
110
|
+
responseStarted?: ResponseStartedFn;
|
|
111
|
+
/**
|
|
112
|
+
* Setups cancelllable for this communication.
|
|
113
|
+
*/
|
|
114
|
+
useCancellable?: (cancellable: Cancellable) => void;
|
|
115
|
+
/**
|
|
116
|
+
* Setups a callback that resumes reading of next data, it is called whenever
|
|
117
|
+
* {@link CommunicationObserver.next} returns `false`.
|
|
118
|
+
*
|
|
119
|
+
* @param resume - a function that will resume reading of next data when called
|
|
120
|
+
*/
|
|
121
|
+
useResume?: (resume: () => void) => void;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Options for sending a request message.
|
|
126
|
+
*/
|
|
127
|
+
interface SendOptions {
|
|
128
|
+
/** HTTP method (POST, PUT, GET, PATCH ...) */
|
|
129
|
+
method: string;
|
|
130
|
+
/** Request HTTP headers. */
|
|
131
|
+
headers?: {
|
|
132
|
+
[key: string]: string;
|
|
133
|
+
};
|
|
134
|
+
/** When specified, message body larger than the treshold is gzipped */
|
|
135
|
+
gzipThreshold?: number;
|
|
136
|
+
/** Abort signal */
|
|
137
|
+
signal?: AbortSignal;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Simpified platform-neutral transport layer for communication with InfluxDB.
|
|
141
|
+
*/
|
|
142
|
+
interface Transport {
|
|
143
|
+
/**
|
|
144
|
+
* Send data to the server and receive communication events via callbacks.
|
|
145
|
+
*
|
|
146
|
+
* @param path - HTTP request path
|
|
147
|
+
* @param requestBody - HTTP request body
|
|
148
|
+
* @param options - send options
|
|
149
|
+
* @param callbacks - communication callbacks to received data in Uint8Array
|
|
150
|
+
*/
|
|
151
|
+
send(path: string, requestBody: string, options: SendOptions, callbacks?: Partial<CommunicationObserver<Uint8Array>>): void;
|
|
152
|
+
/**
|
|
153
|
+
* Sends data to the server and receives decoded result. The type of the result depends on
|
|
154
|
+
* response's content-type (deserialized json, text).
|
|
155
|
+
|
|
156
|
+
* @param path - HTTP request path
|
|
157
|
+
* @param requestBody - request body
|
|
158
|
+
* @param options - send options
|
|
159
|
+
* @returns response data
|
|
160
|
+
*/
|
|
161
|
+
request(path: string, requestBody: any, options: SendOptions, responseStarted?: ResponseStartedFn): Promise<any>;
|
|
162
|
+
/**
|
|
163
|
+
* Sends requestBody and returns response chunks in an async iterable
|
|
164
|
+
* that can be easily consumed in an `for-await` loop.
|
|
165
|
+
*
|
|
166
|
+
* @param path - HTTP request path
|
|
167
|
+
* @param requestBody - request body
|
|
168
|
+
* @param options - send options
|
|
169
|
+
* @returns async iterable
|
|
170
|
+
*/
|
|
171
|
+
iterate(path: string, requestBody: any, options: SendOptions): AsyncIterableIterator<Uint8Array>;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Option for the communication with InfluxDB server.
|
|
176
|
+
*/
|
|
177
|
+
interface ConnectionOptions {
|
|
178
|
+
/** base host URL */
|
|
179
|
+
host: string;
|
|
180
|
+
/** authentication token */
|
|
181
|
+
token?: string;
|
|
182
|
+
/**
|
|
183
|
+
* socket timeout, 10000 milliseconds by default in node.js
|
|
184
|
+
* @defaultValue 10000
|
|
185
|
+
*/
|
|
186
|
+
timeout?: number;
|
|
187
|
+
/**
|
|
188
|
+
* default database for write query if not present as argument.
|
|
189
|
+
*/
|
|
190
|
+
database?: string;
|
|
191
|
+
/**
|
|
192
|
+
* TransportOptions supply extra options for the transport layer, they differ between node.js and browser/deno.
|
|
193
|
+
* Node.js transport accepts options specified in {@link https://nodejs.org/api/http.html#http_http_request_options_callback | http.request } or
|
|
194
|
+
* {@link https://nodejs.org/api/https.html#https_https_request_options_callback | https.request }. For example, an `agent` property can be set to
|
|
195
|
+
* {@link https://www.npmjs.com/package/proxy-http-agent | setup HTTP/HTTPS proxy }, {@link https://nodejs.org/api/tls.html#tls_tls_connect_options_callback | rejectUnauthorized }
|
|
196
|
+
* property can disable TLS server certificate verification. Additionally,
|
|
197
|
+
* {@link https://github.com/follow-redirects/follow-redirects | follow-redirects } property can be also specified
|
|
198
|
+
* in order to follow redirects in node.js.
|
|
199
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/fetch | fetch } is used under the hood in browser/deno.
|
|
200
|
+
* For example,
|
|
201
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/fetch | redirect } property can be set to 'error' to abort request if a redirect occurs.
|
|
202
|
+
*/
|
|
203
|
+
transportOptions?: {
|
|
204
|
+
[key: string]: any;
|
|
205
|
+
};
|
|
206
|
+
/**
|
|
207
|
+
* Default HTTP headers to send with every request.
|
|
208
|
+
*/
|
|
209
|
+
headers?: Record<string, string>;
|
|
210
|
+
/**
|
|
211
|
+
* Full HTTP web proxy URL including schema, for example http://your-proxy:8080.
|
|
212
|
+
*/
|
|
213
|
+
proxyUrl?: string;
|
|
214
|
+
}
|
|
215
|
+
/** default connection options */
|
|
216
|
+
declare const DEFAULT_ConnectionOptions: Partial<ConnectionOptions>;
|
|
217
|
+
/**
|
|
218
|
+
* Options used by {@link InfluxDBClient.write} .
|
|
219
|
+
*/
|
|
220
|
+
interface WriteOptions {
|
|
221
|
+
/** Precision to use in writes for timestamp. default ns */
|
|
222
|
+
precision: WritePrecision;
|
|
223
|
+
/** HTTP headers that will be sent with every write request */
|
|
224
|
+
headers?: {
|
|
225
|
+
[key: string]: string;
|
|
226
|
+
};
|
|
227
|
+
/** When specified, write bodies larger than the threshold are gzipped */
|
|
228
|
+
gzipThreshold?: number;
|
|
229
|
+
/** InfluxDB Enterprise write consistency as explained in https://docs.influxdata.com/enterprise_influxdb/v1.9/concepts/clustering/#write-consistency */
|
|
230
|
+
consistency?: 'any' | 'one' | 'quorum' | 'all';
|
|
231
|
+
}
|
|
232
|
+
/** default writeOptions */
|
|
233
|
+
declare const DEFAULT_WriteOptions: WriteOptions;
|
|
234
|
+
type QueryType = 'sql' | 'influxql';
|
|
235
|
+
/**
|
|
236
|
+
* Options used by {@link InfluxDBClient} .
|
|
237
|
+
*/
|
|
238
|
+
interface ClientOptions extends ConnectionOptions {
|
|
239
|
+
/** supplies and overrides default writing options */
|
|
240
|
+
writeOptions?: Partial<WriteOptions>;
|
|
241
|
+
/** specifies custom transport */
|
|
242
|
+
transport?: Transport;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Timestamp precision used in write operations.
|
|
246
|
+
* See {@link https://docs.influxdata.com/influxdb/latest/api/#operation/PostWrite }
|
|
247
|
+
*/
|
|
248
|
+
type WritePrecision = 'ns' | 'us' | 'ms' | 's';
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Logging interface.
|
|
252
|
+
*/
|
|
253
|
+
interface Logger {
|
|
254
|
+
error(message: string, err?: any): void;
|
|
255
|
+
warn(message: string, err?: any): void;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Logger that logs to console.out
|
|
259
|
+
*/
|
|
260
|
+
declare const consoleLogger: Logger;
|
|
261
|
+
declare const Log: Logger;
|
|
262
|
+
/**
|
|
263
|
+
* Sets custom logger.
|
|
264
|
+
* @param logger - logger to use
|
|
265
|
+
* @returns previous logger
|
|
266
|
+
*/
|
|
267
|
+
declare function setLogger(logger: Logger): Logger;
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Provides functions escape specific parts in InfluxDB line protocol.
|
|
271
|
+
*/
|
|
272
|
+
declare const escape: {
|
|
273
|
+
/**
|
|
274
|
+
* Measurement escapes measurement names.
|
|
275
|
+
*/
|
|
276
|
+
measurement: (value: string) => string;
|
|
277
|
+
/**
|
|
278
|
+
* Quoted escapes quoted values, such as database names.
|
|
279
|
+
*/
|
|
280
|
+
quoted: (value: string) => string;
|
|
281
|
+
/**
|
|
282
|
+
* TagEscaper escapes tag keys, tag values, and field keys.
|
|
283
|
+
*/
|
|
284
|
+
tag: (value: string) => string;
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
declare function useProcessHrtime(use: boolean): boolean;
|
|
288
|
+
/**
|
|
289
|
+
* Exposes functions that creates strings that represent a timestamp that
|
|
290
|
+
* can be used in the line protocol. Micro and nano timestamps are emulated
|
|
291
|
+
* depending on the js platform in use.
|
|
292
|
+
*/
|
|
293
|
+
declare const currentTime: {
|
|
294
|
+
s: () => string;
|
|
295
|
+
ms: () => string;
|
|
296
|
+
us: () => string;
|
|
297
|
+
ns: () => string;
|
|
298
|
+
seconds: () => string;
|
|
299
|
+
millis: () => string;
|
|
300
|
+
micros: () => string;
|
|
301
|
+
nanos: () => string;
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* dateToProtocolTimestamp provides converters for JavaScript Date to InfluxDB Write Protocol Timestamp. Keys are supported precisions.
|
|
305
|
+
*/
|
|
306
|
+
declare const dateToProtocolTimestamp: {
|
|
307
|
+
s: (d: Date) => string;
|
|
308
|
+
ms: (d: Date) => string;
|
|
309
|
+
us: (d: Date) => string;
|
|
310
|
+
ns: (d: Date) => string;
|
|
311
|
+
};
|
|
312
|
+
/**
|
|
313
|
+
* convertTimeToNanos converts Point's timestamp to a string.
|
|
314
|
+
* @param value - supported timestamp value
|
|
315
|
+
* @returns line protocol value
|
|
316
|
+
*/
|
|
317
|
+
declare function convertTimeToNanos(value: string | number | Date | undefined): string | undefined;
|
|
318
|
+
declare const convertTime: (value: string | number | Date | undefined, precision?: WritePrecision) => string | undefined;
|
|
319
|
+
|
|
320
|
+
interface TimeConverter {
|
|
321
|
+
(value: string | number | Date | undefined): string | undefined;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
type PointRecord = {
|
|
325
|
+
measurement: string;
|
|
326
|
+
fields: Record<string, number | string>;
|
|
327
|
+
tags?: Record<string, string>;
|
|
328
|
+
timestamp?: string | number | Date;
|
|
329
|
+
};
|
|
330
|
+
/**
|
|
331
|
+
* Point defines values of a single measurement.
|
|
332
|
+
*/
|
|
333
|
+
declare class Point {
|
|
334
|
+
private name;
|
|
335
|
+
private tags;
|
|
336
|
+
/** escaped field values */
|
|
337
|
+
fields: {
|
|
338
|
+
[key: string]: string;
|
|
339
|
+
};
|
|
340
|
+
private time;
|
|
341
|
+
/**
|
|
342
|
+
* Create a new Point with specified a measurement name.
|
|
343
|
+
*
|
|
344
|
+
* @param measurementName - the measurement name
|
|
345
|
+
*/
|
|
346
|
+
constructor(measurementName?: string);
|
|
347
|
+
/**
|
|
348
|
+
* Sets point's measurement.
|
|
349
|
+
*
|
|
350
|
+
* @param name - measurement name
|
|
351
|
+
* @returns this
|
|
352
|
+
*/
|
|
353
|
+
measurement(name: string): Point;
|
|
354
|
+
/**
|
|
355
|
+
* Adds a tag. The caller has to ensure that both name and value are not empty
|
|
356
|
+
* and do not end with backslash.
|
|
357
|
+
*
|
|
358
|
+
* @param name - tag name
|
|
359
|
+
* @param value - tag value
|
|
360
|
+
* @returns this
|
|
361
|
+
*/
|
|
362
|
+
tag(name: string, value: string): Point;
|
|
363
|
+
/**
|
|
364
|
+
* Adds a boolean field.
|
|
365
|
+
*
|
|
366
|
+
* @param field - field name
|
|
367
|
+
* @param value - field value
|
|
368
|
+
* @returns this
|
|
369
|
+
*/
|
|
370
|
+
booleanField(name: string, value: boolean | any): Point;
|
|
371
|
+
/**
|
|
372
|
+
* Adds an integer field.
|
|
373
|
+
*
|
|
374
|
+
* @param name - field name
|
|
375
|
+
* @param value - field value
|
|
376
|
+
* @returns this
|
|
377
|
+
* @throws NaN or out of int64 range value is supplied
|
|
378
|
+
*/
|
|
379
|
+
intField(name: string, value: number | any): Point;
|
|
380
|
+
/**
|
|
381
|
+
* Adds an unsigned integer field.
|
|
382
|
+
*
|
|
383
|
+
* @param name - field name
|
|
384
|
+
* @param value - field value
|
|
385
|
+
* @returns this
|
|
386
|
+
* @throws NaN out of range value is supplied
|
|
387
|
+
*/
|
|
388
|
+
uintField(name: string, value: number | any): Point;
|
|
389
|
+
/**
|
|
390
|
+
* Adds a number field.
|
|
391
|
+
*
|
|
392
|
+
* @param name - field name
|
|
393
|
+
* @param value - field value
|
|
394
|
+
* @returns this
|
|
395
|
+
* @throws NaN/Infinity/-Infinity is supplied
|
|
396
|
+
*/
|
|
397
|
+
floatField(name: string, value: number | any): Point;
|
|
398
|
+
/**
|
|
399
|
+
* Adds a string field.
|
|
400
|
+
*
|
|
401
|
+
* @param name - field name
|
|
402
|
+
* @param value - field value
|
|
403
|
+
* @returns this
|
|
404
|
+
*/
|
|
405
|
+
stringField(name: string, value: string | any): Point;
|
|
406
|
+
/**
|
|
407
|
+
* Sets point timestamp. Timestamp can be specified as a Date (preferred), number, string
|
|
408
|
+
* or an undefined value. An undefined value instructs to assign a local timestamp using
|
|
409
|
+
* the client's clock. An empty string can be used to let the server assign
|
|
410
|
+
* the timestamp. A number value represents time as a count of time units since epoch, the
|
|
411
|
+
* exact time unit then depends on the {@link InfluxDBClient.write | precision} of the API
|
|
412
|
+
* that writes the point.
|
|
413
|
+
*
|
|
414
|
+
* Beware that the current time in nanoseconds can't precisely fit into a JS number,
|
|
415
|
+
* which can hold at most 2^53 integer number. Nanosecond precision numbers are thus supplied as
|
|
416
|
+
* a (base-10) string. An application can also use ES2020 BigInt to represent nanoseconds,
|
|
417
|
+
* BigInt's `toString()` returns the required high-precision string.
|
|
418
|
+
*
|
|
419
|
+
* Note that InfluxDB requires the timestamp to fit into int64 data type.
|
|
420
|
+
*
|
|
421
|
+
* @param value - point time
|
|
422
|
+
* @returns this
|
|
423
|
+
*/
|
|
424
|
+
timestamp(value: Date | number | string | undefined): Point;
|
|
425
|
+
/**
|
|
426
|
+
* Creates an InfluxDB protocol line out of this instance.
|
|
427
|
+
* @param settings - settings control serialization of a point timestamp and can also add default tags,
|
|
428
|
+
* nanosecond timestamp precision is used when no `settings` or no `settings.convertTime` is supplied.
|
|
429
|
+
* @returns an InfluxDB protocol line out of this instance
|
|
430
|
+
*/
|
|
431
|
+
toLineProtocol(convertTimePrecision?: TimeConverter | WritePrecision): string | undefined;
|
|
432
|
+
toString(): string;
|
|
433
|
+
static fromRecord(record: PointRecord): Point;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/** Prevents confusion with the ArrayLike type. Use with PointRecord */
|
|
437
|
+
type NotArrayLike<T> = T & {
|
|
438
|
+
length?: string;
|
|
439
|
+
};
|
|
440
|
+
/** Prevents confusion with the PointRecord type. */
|
|
441
|
+
type NotPointRecord<T> = T & {
|
|
442
|
+
measurement?: void;
|
|
443
|
+
};
|
|
444
|
+
/**
|
|
445
|
+
* The `WritableData` type represents different types of data that can be written.
|
|
446
|
+
* The data can either be a uniform ArrayLike collection or a single value of the following types:
|
|
447
|
+
*
|
|
448
|
+
* - `Point`: Represents a {@link Point} object.
|
|
449
|
+
*
|
|
450
|
+
* - `string`: Represents lines of the [Line Protocol](https://bit.ly/2QL99fu).
|
|
451
|
+
*
|
|
452
|
+
* - `PointRecord`: Represents an anonymous object. Note that a single `PointRecord`
|
|
453
|
+
* should not have a property of name length, as it could be misinterpreted as ArrayLike.
|
|
454
|
+
* If unsure, encapsulate your record in an array, i.e. [record].
|
|
455
|
+
*/
|
|
456
|
+
type WritableData = NotPointRecord<ArrayLike<string> | ArrayLike<Point> | ArrayLike<PointRecord>> | NotArrayLike<PointRecord> | string | Point;
|
|
457
|
+
declare const writableDataToLineProtocol: (data: WritableData) => string[];
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* `InfluxDBClient` for interacting with an InfluxDB server, simplifying common operations such as writing, querying.
|
|
461
|
+
*/
|
|
462
|
+
declare class InfluxDBClient {
|
|
463
|
+
private readonly _options;
|
|
464
|
+
private readonly _writeApi;
|
|
465
|
+
private readonly _queryApi;
|
|
466
|
+
readonly transport: Transport;
|
|
467
|
+
/**
|
|
468
|
+
* Creates a new instance of the `InfluxDBClient` for interacting with an InfluxDB server, simplifying common operations such as writing, querying.
|
|
469
|
+
* @param options - client options
|
|
470
|
+
*/
|
|
471
|
+
constructor(options: ClientOptions);
|
|
472
|
+
private _mergeWriteOptions;
|
|
473
|
+
write(data: WritableData, database?: string, org?: string, writeOptions?: Partial<WriteOptions>): Promise<void>;
|
|
474
|
+
query(query: string, database?: string, queryType?: QueryType): AsyncGenerator<Record<string, any>, void, void>;
|
|
475
|
+
close(): Promise<void>;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
export { AbortError, Cancellable, ChunkCombiner, ClientOptions, CommunicationObserver, ConnectionOptions, DEFAULT_ConnectionOptions, DEFAULT_WriteOptions, HttpHeaders as Headers, HttpError, HttpHeaders, IllegalArgumentError, InfluxDBClient, Log, Logger, NotArrayLike, NotPointRecord, Point, PointRecord, QueryType, RequestTimedOutError, ResponseStartedFn, SendOptions, TimeConverter, Transport, WritableData, WriteOptions, WritePrecision, consoleLogger, convertTime, convertTimeToNanos, createTextDecoderCombiner, currentTime, dateToProtocolTimestamp, escape, setLogger, useProcessHrtime, writableDataToLineProtocol };
|