influx 5.8.0 → 5.9.3
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/.github/workflows/CI.yml +15 -5
- package/.github/workflows/release.yml +5 -1
- package/README.md +4 -0
- package/lib/src/index.d.ts +1 -1
- package/lib/src/index.js +7 -3
- package/lib/src/pool.d.ts +1 -1
- package/lib/src/pool.js +7 -2
- package/package.json +17 -18
- package/renovate.json +1 -1
package/.github/workflows/CI.yml
CHANGED
|
@@ -11,7 +11,7 @@ jobs:
|
|
|
11
11
|
- uses: actions/checkout@v2
|
|
12
12
|
|
|
13
13
|
- name: Prettier
|
|
14
|
-
uses: creyD/prettier_action@
|
|
14
|
+
uses: creyD/prettier_action@v4.2
|
|
15
15
|
with:
|
|
16
16
|
prettier_options: --write **/*.{tsx,ts,md}
|
|
17
17
|
commit_message: "style: prettier code"
|
|
@@ -27,16 +27,21 @@ jobs:
|
|
|
27
27
|
- name: Checkout
|
|
28
28
|
uses: actions/checkout@v2
|
|
29
29
|
|
|
30
|
+
- name: Reconfigure Git to use HTTP authentication
|
|
31
|
+
run: >
|
|
32
|
+
git config --global url."https://github.com/".insteadOf
|
|
33
|
+
ssh://git@github.com/
|
|
34
|
+
|
|
30
35
|
- name: Setup Node.js
|
|
31
36
|
uses: actions/setup-node@v2
|
|
32
37
|
with:
|
|
33
|
-
node-version: "
|
|
38
|
+
node-version: "16"
|
|
34
39
|
|
|
35
40
|
- name: Install depencencies
|
|
36
41
|
run: npm ci
|
|
37
42
|
|
|
38
43
|
- name: Run InfluxDB
|
|
39
|
-
run: docker run -d -p 8083:8083 -p 8086:8086 influxdb
|
|
44
|
+
run: docker run -d -p 8083:8083 -p 8086:8086 influxdb:1.8
|
|
40
45
|
|
|
41
46
|
- name: Run tests in browser
|
|
42
47
|
run: npm run test:browser
|
|
@@ -48,12 +53,17 @@ jobs:
|
|
|
48
53
|
|
|
49
54
|
strategy:
|
|
50
55
|
matrix:
|
|
51
|
-
node: ["
|
|
56
|
+
node: ["12", "14", "16", "17"]
|
|
52
57
|
|
|
53
58
|
steps:
|
|
54
59
|
- name: Checkout
|
|
55
60
|
uses: actions/checkout@v2
|
|
56
61
|
|
|
62
|
+
- name: Reconfigure Git to use HTTP authentication
|
|
63
|
+
run: >
|
|
64
|
+
git config --global url."https://github.com/".insteadOf
|
|
65
|
+
ssh://git@github.com/
|
|
66
|
+
|
|
57
67
|
- name: Setup node ${{ matrix.node }}
|
|
58
68
|
uses: actions/setup-node@v2
|
|
59
69
|
with:
|
|
@@ -69,6 +79,6 @@ jobs:
|
|
|
69
79
|
run: npm run test:ci
|
|
70
80
|
|
|
71
81
|
- name: Coveralls GitHub Action
|
|
72
|
-
uses: coverallsapp/github-action@
|
|
82
|
+
uses: coverallsapp/github-action@1.1.3
|
|
73
83
|
with:
|
|
74
84
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -13,10 +13,14 @@ jobs:
|
|
|
13
13
|
uses: actions/checkout@v2
|
|
14
14
|
with:
|
|
15
15
|
fetch-depth: 0
|
|
16
|
+
- name: Reconfigure Git to use HTTP authentication
|
|
17
|
+
run: >
|
|
18
|
+
git config --global url."https://github.com/".insteadOf
|
|
19
|
+
ssh://git@github.com/
|
|
16
20
|
- name: Setup Node.js
|
|
17
21
|
uses: actions/setup-node@v2
|
|
18
22
|
with:
|
|
19
|
-
node-version:
|
|
23
|
+
node-version: 16
|
|
20
24
|
- name: Install dependencies
|
|
21
25
|
run: npm ci
|
|
22
26
|
- name: Release
|
package/README.md
CHANGED
package/lib/src/index.d.ts
CHANGED
|
@@ -156,7 +156,7 @@ export interface IQueryOptions {
|
|
|
156
156
|
* Any placeholders used by the query. Using these is strongly recommended
|
|
157
157
|
* to avoid injection attacks.
|
|
158
158
|
*/
|
|
159
|
-
placeholders?: Record<string, string>;
|
|
159
|
+
placeholders?: Record<string, string | number>;
|
|
160
160
|
}
|
|
161
161
|
export interface IParseOptions {
|
|
162
162
|
/**
|
package/lib/src/index.js
CHANGED
|
@@ -831,7 +831,7 @@ class InfluxDB {
|
|
|
831
831
|
const { database = this._defaultDB(), precision = "n", retentionPolicy, } = options;
|
|
832
832
|
let payload = "";
|
|
833
833
|
points.forEach((point) => {
|
|
834
|
-
const { measurement, tags, fieldsPairs, tagsNames, castedTimestamp
|
|
834
|
+
const { measurement, tags, fieldsPairs, tagsNames, castedTimestamp } = this.parsePoint(point, { database, precision });
|
|
835
835
|
payload += (payload.length > 0 ? "\n" : "") + measurement;
|
|
836
836
|
for (let tagsName of tagsNames) {
|
|
837
837
|
payload +=
|
|
@@ -997,7 +997,7 @@ class InfluxDB {
|
|
|
997
997
|
epoch: options.precision,
|
|
998
998
|
q: query,
|
|
999
999
|
rp: retentionPolicy,
|
|
1000
|
-
params: placeholders,
|
|
1000
|
+
params: JSON.stringify(placeholders),
|
|
1001
1001
|
}));
|
|
1002
1002
|
}
|
|
1003
1003
|
/**
|
|
@@ -1016,7 +1016,11 @@ class InfluxDB {
|
|
|
1016
1016
|
* })
|
|
1017
1017
|
*/
|
|
1018
1018
|
ping(timeout) {
|
|
1019
|
-
|
|
1019
|
+
let auth = undefined;
|
|
1020
|
+
if (typeof this._options.username === "string") {
|
|
1021
|
+
auth = `${this._options.username}:${this._options.password || ""}`;
|
|
1022
|
+
}
|
|
1023
|
+
return this._pool.ping(timeout, "/ping", auth);
|
|
1020
1024
|
}
|
|
1021
1025
|
/**
|
|
1022
1026
|
* Returns the default database that queries operates on. It throws if called
|
package/lib/src/pool.d.ts
CHANGED
|
@@ -124,7 +124,7 @@ export declare class Pool {
|
|
|
124
124
|
* Ping sends out a request to all available Influx servers, reporting on
|
|
125
125
|
* their response time and version number.
|
|
126
126
|
*/
|
|
127
|
-
ping(timeout: number, path?: string): Promise<IPingStats[]>;
|
|
127
|
+
ping(timeout: number, path?: string, auth?: string | undefined): Promise<IPingStats[]>;
|
|
128
128
|
/**
|
|
129
129
|
* Makes a request and calls back with the IncomingMessage stream,
|
|
130
130
|
* if possible. An error is returned on a non-2xx status code.
|
package/lib/src/pool.js
CHANGED
|
@@ -178,7 +178,7 @@ class Pool {
|
|
|
178
178
|
* Ping sends out a request to all available Influx servers, reporting on
|
|
179
179
|
* their response time and version number.
|
|
180
180
|
*/
|
|
181
|
-
ping(timeout, path = "/ping") {
|
|
181
|
+
ping(timeout, path = "/ping", auth = undefined) {
|
|
182
182
|
const todo = [];
|
|
183
183
|
setToArray(this._hostsAvailable)
|
|
184
184
|
.concat(setToArray(this._hostsDisabled))
|
|
@@ -187,7 +187,12 @@ class Pool {
|
|
|
187
187
|
const url = host.url;
|
|
188
188
|
const once = doOnce();
|
|
189
189
|
return todo.push(new Promise((resolve) => {
|
|
190
|
-
const
|
|
190
|
+
const headers = {};
|
|
191
|
+
if (typeof auth !== "undefined") {
|
|
192
|
+
const encodedAuth = Buffer.from(auth).toString("base64");
|
|
193
|
+
headers["Authorization"] = `Basic ${encodedAuth}`;
|
|
194
|
+
}
|
|
195
|
+
const req = request(Object.assign({ hostname: url.hostname, method: "GET", path, port: Number(url.port), protocol: url.protocol, timeout, headers: headers }, host.options), once((res) => {
|
|
191
196
|
resolve({
|
|
192
197
|
url,
|
|
193
198
|
res: res.resume(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "influx",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.9.3",
|
|
4
4
|
"description": "InfluxDB Client",
|
|
5
5
|
"main": "./lib/src/index.js",
|
|
6
6
|
"typings": "./lib/src/index",
|
|
@@ -41,39 +41,38 @@
|
|
|
41
41
|
"license": "MIT",
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/chai": "^4.2.11",
|
|
44
|
-
"@types/freeport": "1.0.
|
|
45
|
-
"@types/mocha": "^
|
|
46
|
-
"@types/node": "^
|
|
47
|
-
"@types/sinon": "^
|
|
44
|
+
"@types/freeport": "1.0.22",
|
|
45
|
+
"@types/mocha": "^9.0.0",
|
|
46
|
+
"@types/node": "^16.0.0",
|
|
47
|
+
"@types/sinon": "^10.0.0",
|
|
48
48
|
"@types/sinon-chai": "^3.2.4",
|
|
49
49
|
"awesome-typescript-loader": "5.2.1",
|
|
50
|
-
"chai": "4.3.
|
|
50
|
+
"chai": "4.3.6",
|
|
51
51
|
"coveralls": "^3.1.0",
|
|
52
52
|
"esdoc": "1.1.0",
|
|
53
53
|
"esdoc-standard-plugin": "1.0.0",
|
|
54
54
|
"freeport": "1.0.5",
|
|
55
55
|
"istanbul": "0.4.5",
|
|
56
56
|
"json-loader": "0.5.7",
|
|
57
|
-
"karma": "^6.
|
|
57
|
+
"karma": "^6.3.2",
|
|
58
58
|
"karma-chrome-launcher": "^3.1.0",
|
|
59
59
|
"karma-mocha": "^2.0.1",
|
|
60
60
|
"karma-mocha-reporter": "2.2.5",
|
|
61
61
|
"karma-sourcemap-loader": "0.3.8",
|
|
62
62
|
"karma-webpack": "^5.0.0-alpha.5",
|
|
63
63
|
"lodash": "4.17.21",
|
|
64
|
-
"mocha": "^
|
|
65
|
-
"node-fetch": "2.6.
|
|
64
|
+
"mocha": "^9.0.0",
|
|
65
|
+
"node-fetch": "2.6.7",
|
|
66
66
|
"npm-run-all": "4.1.5",
|
|
67
|
-
"open-cli": "^
|
|
68
|
-
"prettier": "^2.0
|
|
69
|
-
"puppeteer": "^
|
|
70
|
-
"semantic-release": "^
|
|
71
|
-
"sinon": "^
|
|
67
|
+
"open-cli": "^7.0.0",
|
|
68
|
+
"prettier": "^2.3.0",
|
|
69
|
+
"puppeteer": "^13.0.0",
|
|
70
|
+
"semantic-release": "^18.0.0",
|
|
71
|
+
"sinon": "^13.0.0",
|
|
72
72
|
"sinon-chai": "^3.5.0",
|
|
73
73
|
"stream-http": "github:node-influx/stream-http",
|
|
74
|
-
"ts-node": "^
|
|
75
|
-
"typescript": "^4.0.
|
|
74
|
+
"ts-node": "^10.0.0",
|
|
75
|
+
"typescript": "^4.0.2",
|
|
76
76
|
"webpack": "^4.43.0"
|
|
77
|
-
}
|
|
78
|
-
"dependencies": {}
|
|
77
|
+
}
|
|
79
78
|
}
|
package/renovate.json
CHANGED