influx 5.9.7 → 5.10.0

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.
@@ -0,0 +1,15 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "npm" # See documentation for possible values
9
+ directory: "/" # Location of package manifests
10
+ schedule:
11
+ interval: "weekly"
12
+ - package-ecosystem: "github-actions"
13
+ directory: "/" # Location of package manifests
14
+ schedule:
15
+ interval: "weekly"
@@ -3,20 +3,20 @@ name: CI
3
3
  on: [push, pull_request]
4
4
 
5
5
  jobs:
6
- lint:
7
- name: Check Code Style
8
- runs-on: ubuntu-latest
6
+ # lint:
7
+ # name: Check Code Style
8
+ # runs-on: ubuntu-latest
9
9
 
10
- steps:
11
- - uses: actions/checkout@v3
10
+ # steps:
11
+ # - uses: actions/checkout@v4
12
12
 
13
- - name: Prettier
14
- uses: creyD/prettier_action@v4.3
15
- with:
16
- prettier_options: --write **/*.{tsx,ts,md}
17
- commit_message: "style: prettier code"
18
- env:
19
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13
+ # - name: Prettier
14
+ # uses: creyD/prettier_action@v4.3
15
+ # with:
16
+ # prettier_options: --write **/*.{tsx,ts,md}
17
+ # commit_message: "style: prettier code"
18
+ # env:
19
+ # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20
20
 
21
21
  test-browser:
22
22
  name: "Testing Browser"
@@ -25,7 +25,7 @@ jobs:
25
25
 
26
26
  steps:
27
27
  - name: Checkout
28
- uses: actions/checkout@v3
28
+ uses: actions/checkout@v4
29
29
 
30
30
  - name: Reconfigure Git to use HTTP authentication
31
31
  run: >
@@ -33,7 +33,7 @@ jobs:
33
33
  ssh://git@github.com/
34
34
 
35
35
  - name: Setup Node.js
36
- uses: actions/setup-node@v3
36
+ uses: actions/setup-node@v4
37
37
  with:
38
38
  node-version: "16"
39
39
 
@@ -55,11 +55,11 @@ jobs:
55
55
  fail-fast: false
56
56
 
57
57
  matrix:
58
- node: ["16", "17", "18", "19"]
58
+ node: ["18", "20", "22"]
59
59
 
60
60
  steps:
61
61
  - name: Checkout
62
- uses: actions/checkout@v3
62
+ uses: actions/checkout@v4
63
63
 
64
64
  - name: Reconfigure Git to use HTTP authentication
65
65
  run: >
@@ -67,7 +67,7 @@ jobs:
67
67
  ssh://git@github.com/
68
68
 
69
69
  - name: Setup node ${{ matrix.node }}
70
- uses: actions/setup-node@v3
70
+ uses: actions/setup-node@v4
71
71
  with:
72
72
  node-version: ${{ matrix.node }}
73
73
 
@@ -81,17 +81,16 @@ jobs:
81
81
  run: npm run test:ci
82
82
 
83
83
  - name: Coveralls GitHub Action
84
- uses: coverallsapp/github-action@1.1.3
84
+ uses: coverallsapp/github-action@v2
85
85
  with:
86
86
  github-token: ${{ secrets.GITHUB_TOKEN }}
87
87
  parallel: true
88
88
 
89
-
90
89
  finish:
91
90
  needs: test-node
92
91
  runs-on: ubuntu-latest
93
92
  steps:
94
93
  - name: Close parallel build
95
- uses: coverallsapp/github-action@v1
94
+ uses: coverallsapp/github-action@v2
96
95
  with:
97
96
  parallel-finished: true
@@ -1,8 +1,5 @@
1
1
  name: Release
2
- on:
3
- push:
4
- branches:
5
- - master # or main
2
+ on: workflow_dispatch
6
3
 
7
4
  permissions:
8
5
  contents: read # for checkout
@@ -157,6 +157,10 @@ export interface IQueryOptions {
157
157
  * to avoid injection attacks.
158
158
  */
159
159
  placeholders?: Record<string, string | number>;
160
+ /**
161
+ * Execute a query as a HTTP GET or POST request
162
+ */
163
+ method?: "GET" | "POST";
160
164
  }
161
165
  export interface IParseOptions {
162
166
  /**
package/lib/src/index.js CHANGED
@@ -16,6 +16,7 @@ exports.InfluxDB = exports.ResultError = exports.toNanoDate = exports.escape = e
16
16
  const url = require("url");
17
17
  const b = require("./builder");
18
18
  const grammar = require("./grammar");
19
+ const querystring = require("querystring");
19
20
  const pool_1 = require("./pool");
20
21
  const results_1 = require("./results");
21
22
  const schema_1 = require("./schema");
@@ -998,7 +999,7 @@ class InfluxDB {
998
999
  q: query,
999
1000
  rp: retentionPolicy,
1000
1001
  params: JSON.stringify(placeholders),
1001
- }));
1002
+ }, options.method, true));
1002
1003
  }
1003
1004
  /**
1004
1005
  * Pings all available hosts, collecting online status and version info.
@@ -1038,12 +1039,26 @@ class InfluxDB {
1038
1039
  * Creates options to be passed into the pool to query databases.
1039
1040
  * @private
1040
1041
  */
1041
- _getQueryOpts(params, method = "GET") {
1042
- return {
1043
- method,
1044
- path: "/query",
1045
- query: Object.assign({ p: this._options.password, u: this._options.username }, params),
1042
+ _getQueryOpts(params, method = "GET", partOfBody = false) {
1043
+ const authCredentials = {
1044
+ u: this._options.username,
1045
+ p: this._options.password,
1046
1046
  };
1047
+ if (method === "POST" && partOfBody) {
1048
+ return {
1049
+ method,
1050
+ path: "/query",
1051
+ query: authCredentials,
1052
+ body: querystring.stringify(params),
1053
+ };
1054
+ }
1055
+ else {
1056
+ return {
1057
+ method,
1058
+ path: "/query",
1059
+ query: Object.assign(Object.assign({}, authCredentials), params)
1060
+ };
1061
+ }
1047
1062
  }
1048
1063
  /**
1049
1064
  * Creates specified measurement schema
package/lib/src/pool.js CHANGED
@@ -241,9 +241,9 @@ class Pool {
241
241
  if (options.query) {
242
242
  path += "?" + querystring.stringify(options.query);
243
243
  }
244
- const req = request(Object.assign({ headers: {
245
- "content-length": options.body ? Buffer.from(options.body).length : 0,
246
- }, hostname: host.url.hostname, method: options.method, path, port: Number(host.url.port), protocol: host.url.protocol, timeout: this._timeout }, host.options), once((res) => {
244
+ const req = request(Object.assign({ headers: Object.assign({ "content-length": options.body ? Buffer.from(options.body).length : 0 }, (options.body && options.path === "/query"
245
+ ? { "Content-Type": "application/x-www-form-urlencoded" }
246
+ : {})), hostname: host.url.hostname, method: options.method, path, port: Number(host.url.port), protocol: host.url.protocol, timeout: this._timeout }, host.options), once((res) => {
247
247
  res.setEncoding("utf8");
248
248
  if (res.statusCode >= 500) {
249
249
  res.on("data", () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "influx",
3
- "version": "5.9.7",
3
+ "version": "5.10.0",
4
4
  "description": "InfluxDB Client",
5
5
  "main": "./lib/src/index.js",
6
6
  "typings": "./lib/src/index",
@@ -16,7 +16,7 @@
16
16
  "test:integrate": "mocha --require ts-node/register --timeout 20000 test/integrate/*.test.ts",
17
17
  "test:lint": "prettier -c .",
18
18
  "test:ci": "npm-run-all clean test:unit test:integrate build:dist && istanbul cover _mocha --report lcovonly -- lib/test/unit/*.test.js",
19
- "test:unit": "mocha --require ts-node/register test/unit/*.test.ts",
19
+ "test:unit": "mocha --require ts-node/register --timeout 20000 test/unit/*.test.ts",
20
20
  "test:watch": "mocha -R min --watch --require ts-node/register test/unit/*.test.ts",
21
21
  "semantic-release": "semantic-release"
22
22
  },
@@ -41,7 +41,7 @@
41
41
  "license": "MIT",
42
42
  "devDependencies": {
43
43
  "@types/chai": "^4.2.11",
44
- "@types/freeport": "1.0.22",
44
+ "@types/freeport": "1.0.24",
45
45
  "@types/mocha": "^10.0.0",
46
46
  "@types/node": "^18.0.0",
47
47
  "@types/sinon": "^10.0.0",
@@ -58,16 +58,16 @@
58
58
  "karma-chrome-launcher": "^3.1.0",
59
59
  "karma-mocha": "^2.0.1",
60
60
  "karma-mocha-reporter": "2.2.5",
61
- "karma-sourcemap-loader": "0.3.8",
61
+ "karma-sourcemap-loader": "0.4.0",
62
62
  "karma-webpack": "^5.0.0-alpha.5",
63
63
  "lodash": "4.17.21",
64
- "mocha": "^10.0.0",
65
- "node-fetch": "3.3.0",
64
+ "mocha": "^11.1.0",
65
+ "node-fetch": "3.3.2",
66
66
  "npm-run-all": "4.1.5",
67
- "open-cli": "^7.0.0",
68
- "prettier": "^2.3.0",
69
- "puppeteer": "^19.0.0",
70
- "semantic-release": "^20.0.0",
67
+ "open-cli": "^8.0.0",
68
+ "prettier": "^3.4.2",
69
+ "puppeteer": "^24.1.1",
70
+ "semantic-release": "^24.2.1",
71
71
  "sinon": "^15.0.0",
72
72
  "sinon-chai": "^3.5.0",
73
73
  "stream-http": "github:node-influx/stream-http",
package/renovate.json CHANGED
@@ -1,3 +1,7 @@
1
1
  {
2
- "extends": ["config:base", ":preserveSemverRanges", ":disableDependencyDashboard"]
2
+ "extends": [
3
+ "config:base",
4
+ ":preserveSemverRanges",
5
+ ":disableDependencyDashboard"
6
+ ]
3
7
  }