@jambonz/time-series 0.2.1 → 0.2.2
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/index.js +2 -0
- package/package.json +1 -1
- package/test/unit-tests.js +3 -3
package/index.js
CHANGED
|
@@ -25,6 +25,7 @@ const schemas = {
|
|
|
25
25
|
measurement: 'cdrs',
|
|
26
26
|
fields: {
|
|
27
27
|
call_sid: Influx.FieldType.STRING,
|
|
28
|
+
application_sid: Influx.FieldType.STRING,
|
|
28
29
|
from: Influx.FieldType.STRING,
|
|
29
30
|
to: Influx.FieldType.STRING,
|
|
30
31
|
sip_callid: Influx.FieldType.STRING,
|
|
@@ -450,6 +451,7 @@ const queryCdrs = async(client, opts) => {
|
|
|
450
451
|
|
|
451
452
|
const sql = createCdrQuery(opts);
|
|
452
453
|
const res = await client.queryRaw(sql, { placeholders: params});
|
|
454
|
+
//console.log(JSON.stringify(res.results[0]));
|
|
453
455
|
if (res.results[0].series && res.results[0].series.length) {
|
|
454
456
|
const {columns, values} = res.results[0].series[0];
|
|
455
457
|
const data = values.map((v) => {
|
package/package.json
CHANGED
package/test/unit-tests.js
CHANGED
|
@@ -33,7 +33,6 @@ test('write timeseries data', async(t) => {
|
|
|
33
33
|
trunk: 'device',
|
|
34
34
|
service_provider_sid: 'zzzzz',
|
|
35
35
|
account_sid: 'xxxx',
|
|
36
|
-
call_sid: 'foo'
|
|
37
36
|
},
|
|
38
37
|
{
|
|
39
38
|
from: 'me2',
|
|
@@ -51,12 +50,13 @@ test('write timeseries data', async(t) => {
|
|
|
51
50
|
trunk: 'twilio',
|
|
52
51
|
service_provider_sid: 'zzzzz',
|
|
53
52
|
account_sid: 'yyyy',
|
|
54
|
-
call_sid: 'bar'
|
|
53
|
+
call_sid: 'bar',
|
|
54
|
+
application_sid: 'app-sid'
|
|
55
55
|
}]);
|
|
56
56
|
t.pass('wrote cdr');
|
|
57
57
|
|
|
58
58
|
result = await queryCdrs({account_sid: 'xxxx', page: 1, page_size:25});
|
|
59
|
-
//
|
|
59
|
+
//console.log(JSON.stringify(result));
|
|
60
60
|
t.ok(result.data.length === 1, 'queried cdrs by account sid')
|
|
61
61
|
|
|
62
62
|
result = await queryCdrs({account_sid: 'yyyy', trunk: 'twilio', page: 1, page_size:25});
|