@luxdb/sdk 1.2.0 → 1.2.1
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/dist/index.js +10 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -107,6 +107,12 @@ class TimeSeriesNamespace {
|
|
|
107
107
|
}
|
|
108
108
|
class Lux extends ioredis_1.default {
|
|
109
109
|
constructor(options) {
|
|
110
|
+
if (typeof options === 'string') {
|
|
111
|
+
if (options.startsWith('rediss://') || options.startsWith('luxs://')) {
|
|
112
|
+
throw new Error('TLS is not yet supported');
|
|
113
|
+
}
|
|
114
|
+
options = options.replace(/^lux:\/\//, 'redis://');
|
|
115
|
+
}
|
|
110
116
|
super(options);
|
|
111
117
|
this.vectors = new VectorNamespace(this);
|
|
112
118
|
this.timeseries = new TimeSeriesNamespace(this);
|
|
@@ -120,17 +126,12 @@ class Lux extends ioredis_1.default {
|
|
|
120
126
|
return [];
|
|
121
127
|
const rows = [];
|
|
122
128
|
for (const item of result) {
|
|
123
|
-
if (Array.isArray(item) && item.length >=
|
|
124
|
-
const row = { id: 0 };
|
|
125
|
-
for (let i =
|
|
129
|
+
if (Array.isArray(item) && item.length >= 1) {
|
|
130
|
+
const row = { id: parseInt(item[0], 10) };
|
|
131
|
+
for (let i = 1; i < item.length - 1; i += 2) {
|
|
126
132
|
const key = String(item[i]);
|
|
127
133
|
const val = item[i + 1];
|
|
128
|
-
|
|
129
|
-
row.id = parseInt(val, 10);
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
row[key] = val;
|
|
133
|
-
}
|
|
134
|
+
row[key] = val;
|
|
134
135
|
}
|
|
135
136
|
rows.push(row);
|
|
136
137
|
}
|