@icgio/icg-utils 1.7.27 → 1.7.28

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.
Files changed (2) hide show
  1. package/lib/influxdb.js +6 -6
  2. package/package.json +1 -1
package/lib/influxdb.js CHANGED
@@ -27,10 +27,8 @@ function check_points(points) {
27
27
  module.exports = class Influx {
28
28
  constructor(config) {
29
29
  const { url, token, org, org_id, bucket, schema } = config
30
- const influx_db = new InfluxDB({ url, token })
31
- this.buckets_api = new BucketsAPI(influx_db)
32
- this.write_api = influx_db.getWriteApi(org, bucket)
33
- this.query_api = influx_db.getQueryApi(org)
30
+ this.influx_db = new InfluxDB({ url, token })
31
+ this.buckets_api = new BucketsAPI(this.influx_db)
34
32
  this.org = org
35
33
  this.org_id = org_id
36
34
  this.bucket = bucket
@@ -38,6 +36,7 @@ module.exports = class Influx {
38
36
  this.schema = schema
39
37
  }
40
38
  // query(query_string, cb) {
39
+ // this.query_api = this.influx_db.getQueryApi(org)
41
40
  // this.db
42
41
  // .query(query_string)
43
42
  // .then((res) => {
@@ -52,6 +51,7 @@ module.exports = class Influx {
52
51
  // })
53
52
  // }
54
53
  async write_points_with_check(points, cb) {
54
+ const write_api = this.influx_db.getWriteApi(this.org, this.bucket)
55
55
  if (!this.bucket_exist) {
56
56
  const { buckets } = await this.buckets_api.getBuckets({ org: this.org })
57
57
  const names = buckets.map((b) => b.name)
@@ -77,8 +77,8 @@ module.exports = class Influx {
77
77
  }
78
78
  return p_temp
79
79
  })
80
- this.write_api.writePoints(points)
81
- this.write_api
80
+ write_api.writePoints(points)
81
+ write_api
82
82
  .close()
83
83
  .then(() => {
84
84
  cb({ success: true, body: points.length })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-utils",
3
- "version": "1.7.27",
3
+ "version": "1.7.28",
4
4
  "description": "Utils package.",
5
5
  "main": "index.js",
6
6
  "directories": {