tesla-inventory 1.8.40 → 1.8.43
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/inventories.js +17 -90
- package/package.json +2 -2
- package/scripts/prices/america.js +6 -2
- package/scripts/prices/europe.js +7 -14
- package/scripts/prices/index.js +4 -4
package/inventories.js
CHANGED
|
@@ -1,99 +1,26 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
at: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
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
|
-
|
|
49
|
-
|
|
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
|
-
|
|
69
|
-
|
|
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: 'MX', 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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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: 'PR', 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.
|
|
5
|
+
"version": "1.8.43",
|
|
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
|
|
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
|
|
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
|
|
13
|
+
inventories
|
|
10
14
|
})
|
package/scripts/prices/europe.js
CHANGED
|
@@ -2,20 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
const path = require('path')
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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 }]) => region === 'Europe' && !NON_EURO_COUNTRIES.includes(code)
|
|
10
|
+
)
|
|
11
|
+
)
|
|
19
12
|
|
|
20
13
|
require('.')({
|
|
21
14
|
filepath: path.resolve(__dirname, '../../prices/europe.json'),
|
package/scripts/prices/index.js
CHANGED
|
@@ -37,12 +37,12 @@ const run = async ({ pricesByCode, inventories }) => {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
for (const
|
|
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
|
-
|
|
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({
|
|
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, {
|
|
60
|
+
debug.error(err.message || err, { inventoryCode, model, condition })
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
}
|