@icgio/icg-utils 1.9.64 → 1.9.65

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 +4 -4
  2. package/package.json +1 -1
package/lib/influxdb.js CHANGED
@@ -28,10 +28,6 @@ class Influx {
28
28
  }
29
29
  async query(query_string, cb) {
30
30
  const query_api = this.influx_db.getQueryApi(this.org)
31
- let result = await query_api.queryRaw(query_string)
32
- // Split by empty lines into table blocks — each InfluxDB table may have
33
- // different columns (different tag sets), so parse each with its own headers
34
- const tables = result.split(/\r?\n\s*\r?\n/).filter((b) => b.trim())
35
31
  const parse_table = (csv) =>
36
32
  new Promise((resolve, reject) => {
37
33
  parse(csv, { columns: true, comment: '#', skip_empty_lines: true, relax_column_count: true }, (err, res) => {
@@ -40,6 +36,10 @@ class Influx {
40
36
  })
41
37
  })
42
38
  try {
39
+ let result = await query_api.queryRaw(query_string)
40
+ // Split by empty lines into table blocks — each InfluxDB table may have
41
+ // different columns (different tag sets), so parse each with its own headers
42
+ const tables = result.split(/\r?\n\s*\r?\n/).filter((b) => b.trim())
43
43
  const results = await Promise.all(tables.map((t) => parse_table(t)))
44
44
  cb({ success: true, body: results.flat() })
45
45
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-utils",
3
- "version": "1.9.64",
3
+ "version": "1.9.65",
4
4
  "description": "Utils package.",
5
5
  "main": "index.js",
6
6
  "directories": {