tesla-inventory 3.2.0-1 → 3.2.0-3

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/package.json +1 -1
  2. package/src/index.js +5 -9
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "tesla-inventory",
3
3
  "description": "Retrieve real-time data from Tesla Inventory.",
4
4
  "homepage": "https://github.com/Kikobeats/tesla-inventory",
5
- "version": "3.2.0-1",
5
+ "version": "3.2.0-3",
6
6
  "main": "src/index.js",
7
7
  "author": {
8
8
  "email": "josefrancisco.verdu@gmail.com",
package/src/index.js CHANGED
@@ -5,8 +5,8 @@ const inventories = require('./inventories')
5
5
 
6
6
  const timestamp =
7
7
  (start = process.hrtime.bigint()) =>
8
- () =>
9
- Math.round(Number(process.hrtime.bigint() - start) / 1e6) + 'ms'
8
+ () =>
9
+ Math.round(Number(process.hrtime.bigint() - start) / 1e6) + 'ms'
10
10
 
11
11
  const uniqBy = (arr, prop) =>
12
12
  arr.filter((x, i, self) => i === self.findIndex(y => x[prop] === y[prop]))
@@ -50,18 +50,14 @@ module.exports = getBrowserless => async (inventory, opts, gotoOpts) => {
50
50
  }).toString()}`
51
51
  ).toString()
52
52
 
53
- console.log({
54
- url,
55
- opts,
56
- query
57
- })
53
+ debug({ url, query })
58
54
 
59
55
  const result = await fn(url).then(async text => {
60
56
  try {
61
57
  const body = JSON.parse(text)
62
58
  return { items: body.results }
63
59
  } catch (error) {
64
- console.log('ERROR', text)
60
+ debug.error({ text, error })
65
61
  const delay = ms => new Promise(resolve => setTimeout(resolve, ms))
66
62
  await delay(10000)
67
63
  return paginate(offset)
@@ -79,7 +75,7 @@ module.exports = getBrowserless => async (inventory, opts, gotoOpts) => {
79
75
  page = await paginate(offset)
80
76
  items = uniqBy(items.concat(page.items), 'VIN')
81
77
  offset = items.length
82
- debug({ items: items.length, duration: duration() })
78
+ debug.info({ items: items.length, duration: duration() })
83
79
  } while (page.items.length >= ITEMS_PER_PAGE)
84
80
 
85
81
  const result = items.filter(item => item.Model === opts.model)