tesla-inventory 1.8.39 → 1.8.42

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/codes.json CHANGED
@@ -48,6 +48,7 @@
48
48
  "BG30": "No Badge",
49
49
  "BG31": "AWD Badge",
50
50
  "BG32": "Performance AWD Badge",
51
+ "BG33": "China Badge",
51
52
  "BP00": "No Ludicrous",
52
53
  "BP01": "Ludicrous Speed Upgrade",
53
54
  "BP02": "Uncorked Acceleration",
@@ -299,6 +300,7 @@
299
300
  "MI03": "4th Generation Production",
300
301
  "MI04": "5th Generation Production",
301
302
  "MI07": "8th Generation Production",
303
+ "MR30": "Tech Package - Mirror -YES",
302
304
  "MR31": "Tech Package - Mirror -YES",
303
305
  "MS03": "Model S",
304
306
  "MS04": "Model S",
@@ -482,6 +484,7 @@
482
484
  "SC04": "Pay Per Use Supercharging",
483
485
  "SC05": "Unlimited Free Supercharging Currently Enabled",
484
486
  "SC06": "Time Bound Unlimited Free Supercharging",
487
+ "SG01": "Model 3 CN MIC",
485
488
  "SLR0": "No Rear Spoiler",
486
489
  "SLR1": "Carbon Fibre Spoiler",
487
490
  "SP00": "No Security Package",
@@ -515,6 +518,7 @@
515
518
  "T3MA": "Tires M3",
516
519
  "T3MC": "Tires M3",
517
520
  "T3P3": "Tires M3",
521
+ "T3PS": "Tires M3",
518
522
  "TD00": "Tear Down NON-GLIDER",
519
523
  "TIC4": "Tires MX",
520
524
  "TIC6": "Tires MS",
package/inventories.js CHANGED
@@ -1,99 +1,26 @@
1
1
  module.exports = {
2
- at: {
3
- country: 'Österreich',
4
- language: 'de',
5
- market: 'AT',
6
- region: 'Europe'
7
- },
8
- be: {
9
- country: 'Belgium',
10
- language: 'nl',
11
- market: 'BE',
12
- region: 'Europe'
13
- },
14
- ca: {
15
- country: 'Canada',
16
- language: 'en',
17
- market: 'CA',
18
- region: 'North America'
19
- },
20
- ch: {
21
- country: 'Switzerland',
22
- language: 'de',
23
- market: 'CH',
24
- region: 'Europe'
25
- },
2
+ at: { country: 'Österreich', language: 'de', market: 'AT', region: 'Europe' },
3
+ be: { country: 'Belgium', language: 'nl', market: 'BE', region: 'Europe' },
4
+ ca: { country: 'Canada', language: 'en', market: 'CA', region: 'North America' },
5
+ ch: { country: 'Switzerland', language: 'de', market: 'CH', region: 'Europe' },
26
6
  cz: { country: 'Česko', language: 'cs', market: 'CZ', region: 'Europe' },
27
- de: {
28
- country: 'Deutschland',
29
- language: 'de',
30
- market: 'DE',
31
- region: 'Europe'
32
- },
33
- dk: {
34
- country: 'Danmark',
35
- language: 'da',
36
- market: 'DK',
37
- region: 'Europe'
38
- },
7
+ de: { country: 'Deutschland', language: 'de', market: 'DE', region: 'Europe' },
8
+ dk: { country: 'Danmark', language: 'da', market: 'DK', region: 'Europe' },
39
9
  es: { country: 'Spain', language: 'es', market: 'ES', region: 'Europe' },
40
- fi: {
41
- country: 'Finland',
42
- language: 'fi',
43
- market: 'FI',
44
- region: 'Europe'
45
- },
10
+ fi: { country: 'Finland', language: 'fi', market: 'FI', region: 'Europe' },
46
11
  fr: { country: 'France', language: 'fr', market: 'FR', region: 'Europe' },
47
- gb: {
48
- country: 'United Kingdom',
49
- language: 'en',
50
- market: 'GB',
51
- region: 'Europe'
52
- },
53
- hu: {
54
- country: 'Magyarország',
55
- language: 'hu',
56
- market: 'HU',
57
- region: 'Europe'
58
- },
59
- ie: {
60
- country: 'Ireland',
61
- language: 'en',
62
- market: 'IE',
63
- region: 'Europe'
64
- },
12
+ gb: { country: 'United Kingdom', language: 'en', market: 'GB', region: 'Europe' },
13
+ hu: { country: 'Magyarország', language: 'hu', market: 'HU', region: 'Europe' },
14
+ ie: { country: 'Ireland', language: 'en', market: 'IE', region: 'Europe' },
65
15
  is: { country: 'Island', language: 'is', market: 'IS', region: 'Europe' },
66
16
  it: { country: 'Italy', language: 'it', market: 'IT', region: 'Europe' },
67
- lu: {
68
- country: 'Luxembourg',
69
- language: 'fr',
70
- market: 'LU',
71
- region: 'Europe'
72
- },
73
- nl: {
74
- country: 'Netherlands',
75
- language: 'nl',
76
- market: 'NL',
77
- region: 'Europe'
78
- },
17
+ lu: { country: 'Luxembourg', language: 'fr', market: 'LU', region: 'Europe' },
18
+ mx: { country: 'Mexico', language: 'es', market: 'US', region: 'North America' },
19
+ nl: { country: 'Netherlands', language: 'nl', market: 'NL', region: 'Europe' },
79
20
  no: { country: 'Norway', language: 'no', market: 'NO', region: 'Europe' },
80
- pt: {
81
- country: 'Portugal',
82
- language: 'pt',
83
- market: 'PT',
84
- region: 'Europe'
85
- },
86
- ro: {
87
- country: 'România',
88
- language: 'ro',
89
- market: 'RO',
90
- region: 'Europe'
91
- },
21
+ pr: { country: 'Puerto Rico', language: 'es', market: 'US', region: 'North America' },
22
+ pt: { country: 'Portugal', language: 'pt', market: 'PT', region: 'Europe' },
23
+ ro: { country: 'România', language: 'ro', market: 'RO', region: 'Europe' },
92
24
  se: { country: 'Sweden', language: 'sv', market: 'SE', region: 'Europe' },
93
- us: {
94
- country: 'United States',
95
- language: 'en',
96
- market: 'US',
97
- region: 'North America'
98
- }
25
+ us: { country: 'United States', language: 'en', market: 'US', region: 'North America' }
99
26
  }
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://nicedoc.io/Kikobeats/tesla-inventory",
5
- "version": "1.8.39",
5
+ "version": "1.8.42",
6
6
  "main": "index.js",
7
7
  "author": {
8
8
  "email": "josefrancisco.verdu@gmail.com",
@@ -80,7 +80,7 @@
80
80
  "postrelease": "npm run release:tags && npm run release:github && (ci-publish || npm publish --access=public)",
81
81
  "prerelease": "npm run update:check && npm run contributors",
82
82
  "pretest": "npm run lint",
83
- "prices": "npm run prices:europe && npm run prices:america && npm run prices:america",
83
+ "prices": "npm run prices:europe && npm run prices:america",
84
84
  "prices:america": "(DEBUG=tesla-inventory* node scripts/prices/america.js && git add prices/america.json && git commit -m 'build(update): prices for North America' --no-verify && git push) || true",
85
85
  "prices:europe": "(DEBUG=tesla-inventory* node scripts/prices/europe.js && git add prices/europe.json && git commit -m 'build(update): prices for Europe' --no-verify && git push) || true",
86
86
  "release": "standard-version -a",
@@ -2,9 +2,13 @@
2
2
 
3
3
  const path = require('path')
4
4
 
5
- const { ca, us } = require('../../inventories')
5
+ const inventories = Object.fromEntries(
6
+ Object.entries(require('../../inventories')).filter(
7
+ ([, { region }]) => region === 'North America'
8
+ )
9
+ )
6
10
 
7
11
  require('.')({
8
12
  filepath: path.resolve(__dirname, '../../prices/america.json'),
9
- inventories: { ca, us }
13
+ inventories
10
14
  })
@@ -2,20 +2,14 @@
2
2
 
3
3
  const path = require('path')
4
4
 
5
- // only countries with EURO currency
6
- const {
7
- cz, // Croatia coin is not Euro
8
- se, // Sweden coin is not Euro
9
- dk, // Denmark coin is not Euro
10
- hu, // Hungary coin is not not EU
11
- is, // Island is not EU
12
- ch, // Switzerland is not EU
13
- gb, // United Kingdom is not EU
14
- no, // Norgway is not EU
15
- us, // United States is not EU
16
- ca, // Canada is not EU
17
- ...inventories
18
- } = require('../../inventories')
5
+ const NON_EURO_COUNTRIES = ['cz', 'se', 'dk', 'hu', 'is', 'ch', 'gb', 'no']
6
+
7
+ const inventories = Object.fromEntries(
8
+ Object.entries(require('../../inventories')).filter(
9
+ ([code, { region }]) =>
10
+ region === 'Europe' && !NON_EURO_COUNTRIES.includes(code)
11
+ )
12
+ )
19
13
 
20
14
  require('.')({
21
15
  filepath: path.resolve(__dirname, '../../prices/europe.json'),
@@ -37,12 +37,12 @@ const run = async ({ pricesByCode, inventories }) => {
37
37
  }
38
38
  }
39
39
 
40
- for (const inventoryName in inventories) {
40
+ for (const inventoryCode in inventories) {
41
41
  for (const model of MODEL_LETTER) {
42
42
  for (const condition of MODEL_CONDITION) {
43
43
  try {
44
44
  const results = await teslaInventory(
45
- inventoryName,
45
+ inventoryCode,
46
46
  {
47
47
  model,
48
48
  condition
@@ -50,14 +50,14 @@ const run = async ({ pricesByCode, inventories }) => {
50
50
  GOT_OPTS
51
51
  )
52
52
 
53
- debug({ inventoryName, model, condition })
53
+ debug({ inventoryCode, model, condition })
54
54
 
55
55
  results.forEach(result => {
56
56
  result.FlexibleOptionsData.forEach(addItem)
57
57
  result.OptionCodeData.forEach(addItem)
58
58
  })
59
59
  } catch (err) {
60
- debug.error(err.message || err, { inventoryName, model, condition })
60
+ debug.error(err.message || err, { inventoryCode, model, condition })
61
61
  }
62
62
  }
63
63
  }