@jambonz/time-series 0.1.11 → 0.1.12

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 CHANGED
@@ -350,6 +350,7 @@ const generateBindParameters = (opts) => {
350
350
  const params = {...opts};
351
351
  if (opts.days) params.timestamp = Date.now() * 1000000 - opts.days * 24 * 60 * 60 * 1000000000;
352
352
  if (opts.page) params.offset = opts.page - 1 >= 0 && opts.page_size >= 0 ? (opts.page - 1) * opts.page_size : 0;
353
+ if (opts.page_size) params.page_size = parseInt(opts.page_size);
353
354
  return params;
354
355
  };
355
356
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jambonz/time-series",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "write and query data to time series daetabase",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -126,6 +126,13 @@ test('write timeseries data', async(t) => {
126
126
  t.ok(result.data.length === 12, 'queried alerts');
127
127
  t.ok(result.data[0].target_sid === null)
128
128
 
129
+ // Make sure that page, page_size and days support both string and int
130
+ result = await queryAlerts({account_sid: 'yyyy', page: '1', page_size: '10', days: '7'});
131
+ t.ok(result.data.length === 10, 'queried alerts');
132
+
133
+ result = await queryAlerts({account_sid: 'yyyy', page: '2', page_size: '10', days: '7'});
134
+ t.ok(result.data.length === 2, 'queried alerts');
135
+
129
136
  result = await queryAlerts({account_sid: 'yyyy', target_sid: 'zzzz', page: 1, page_size: 25, days: 7});
130
137
  t.ok(result.data.length === 1, 'queried alerts by target_sid');
131
138
  t.ok(result.data[0].target_sid === 'zzzz')