@mxpicture/tesla-superchargers-mate 0.1.45 → 0.1.46

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mxpicture/tesla-superchargers-mate",
3
- "version": "0.1.45",
3
+ "version": "0.1.46",
4
4
  "description": "TeslaMate integration",
5
5
  "type": "module",
6
6
  "author": "MXPicture",
@@ -49,7 +49,7 @@
49
49
  "access": "public"
50
50
  },
51
51
  "dependencies": {
52
- "@mxpicture/tesla-superchargers-generated": "^0.1.45",
52
+ "@mxpicture/tesla-superchargers-generated": "^0.1.46",
53
53
  "postgres": "^3.4.9",
54
54
  "short-uuid": "^6.0.3",
55
55
  "zod": "^4.3.6"
package/sql/reset.sql CHANGED
@@ -16,11 +16,11 @@ DROP VIEW IF EXISTS pic_cp_inv_prep_v;
16
16
 
17
17
  DROP VIEW IF EXISTS pic_cp_sc_v;
18
18
 
19
- DROP VIEW IF EXISTS pic_pricebooks_tesla_ui_v;
19
+ DROP VIEW IF EXISTS pic_price_map_ui_v;
20
20
 
21
- DROP VIEW IF EXISTS pic_pricebooks_tesla_condensed_v;
21
+ DROP VIEW IF EXISTS pic_price_map_condensed_v;
22
22
 
23
- DROP VIEW IF EXISTS pic_pricebooks_tesla_v;
23
+ DROP VIEW IF EXISTS pic_price_map_v;
24
24
 
25
25
  DROP VIEW IF EXISTS pic_chargers_v;
26
26
 
package/sql/setup.sql CHANGED
@@ -229,21 +229,20 @@ DROP INDEX IF EXISTS pic_pricebooks_charger_time_idx;
229
229
 
230
230
  CREATE INDEX IF NOT EXISTS pic_pricebooks_charger_time_idx ON pic_pricebooks (pic_chargers_id, valid_since DESC);
231
231
 
232
- -- // todo add currency code for ui/grafana
233
232
  -- Dropped instead of CREATE OR REPLACE: these views SELECT p.* / c.* / v.* and
234
233
  -- then add more columns, so growing or renaming a column of the upstream
235
234
  -- relation (e.g. adding pic_chargers.favourite, or the fetched_at → valid_since
236
235
  -- split above) shifts a later column's position — which OR REPLACE rejects
237
236
  -- (42P16 "cannot change name of view column"). Views hold no data, so dropping
238
- -- is idempotent. Dropped in dependency order: pic_pricebooks_tesla_ui_v reads
239
- -- the condensed view, which reads pic_pricebooks_tesla_v.
240
- DROP VIEW IF EXISTS pic_pricebooks_tesla_ui_v;
237
+ -- is idempotent. Dropped in dependency order: pic_price_map_ui_v reads
238
+ -- the condensed view, which reads pic_price_map_v.
239
+ DROP VIEW IF EXISTS pic_price_map_ui_v;
241
240
 
242
- DROP VIEW IF EXISTS pic_pricebooks_tesla_condensed_v;
241
+ DROP VIEW IF EXISTS pic_price_map_condensed_v;
243
242
 
244
- DROP VIEW IF EXISTS pic_pricebooks_tesla_v;
243
+ DROP VIEW IF EXISTS pic_price_map_v;
245
244
 
246
- CREATE VIEW pic_pricebooks_tesla_v AS
245
+ CREATE VIEW pic_price_map_v AS
247
246
  SELECT
248
247
  *
249
248
  FROM
@@ -256,7 +255,7 @@ ORDER BY
256
255
  p.is_tou,
257
256
  p.start_time;
258
257
 
259
- CREATE VIEW pic_pricebooks_tesla_condensed_v AS
258
+ CREATE VIEW pic_price_map_condensed_v AS
260
259
  SELECT
261
260
  c.*,
262
261
  base.start_time AS base_start_time,
@@ -289,29 +288,29 @@ SELECT
289
288
  s5.uom AS s5_uom
290
289
  FROM
291
290
  pic_chargers_v AS c
292
- LEFT JOIN pic_pricebooks_tesla_v base ON base.pic_chargers_id = c.id
291
+ LEFT JOIN pic_price_map_v base ON base.pic_chargers_id = c.id
293
292
  AND base.last_fetch_uuid = c.last_fetch_uuid
294
293
  AND base.sort_order IS NULL
295
- LEFT JOIN pic_pricebooks_tesla_v s0 ON s0.pic_chargers_id = c.id
294
+ LEFT JOIN pic_price_map_v s0 ON s0.pic_chargers_id = c.id
296
295
  AND s0.last_fetch_uuid = c.last_fetch_uuid
297
296
  AND s0.sort_order = 0
298
- LEFT JOIN pic_pricebooks_tesla_v s1 ON s1.pic_chargers_id = c.id
297
+ LEFT JOIN pic_price_map_v s1 ON s1.pic_chargers_id = c.id
299
298
  AND s1.last_fetch_uuid = c.last_fetch_uuid
300
299
  AND s1.sort_order = 1
301
- LEFT JOIN pic_pricebooks_tesla_v s2 ON s2.pic_chargers_id = c.id
300
+ LEFT JOIN pic_price_map_v s2 ON s2.pic_chargers_id = c.id
302
301
  AND s2.last_fetch_uuid = c.last_fetch_uuid
303
302
  AND s2.sort_order = 2
304
- LEFT JOIN pic_pricebooks_tesla_v s3 ON s3.pic_chargers_id = c.id
303
+ LEFT JOIN pic_price_map_v s3 ON s3.pic_chargers_id = c.id
305
304
  AND s3.last_fetch_uuid = c.last_fetch_uuid
306
305
  AND s3.sort_order = 3
307
- LEFT JOIN pic_pricebooks_tesla_v s4 ON s4.pic_chargers_id = c.id
306
+ LEFT JOIN pic_price_map_v s4 ON s4.pic_chargers_id = c.id
308
307
  AND s4.last_fetch_uuid = c.last_fetch_uuid
309
308
  AND s4.sort_order = 4
310
- LEFT JOIN pic_pricebooks_tesla_v s5 ON s5.pic_chargers_id = c.id
309
+ LEFT JOIN pic_price_map_v s5 ON s5.pic_chargers_id = c.id
311
310
  AND s5.last_fetch_uuid = c.last_fetch_uuid
312
311
  AND s5.sort_order = 5;
313
312
 
314
- CREATE VIEW pic_pricebooks_tesla_ui_v AS
313
+ CREATE VIEW pic_price_map_ui_v AS
315
314
  SELECT
316
315
  v.*,
317
316
  CASE
@@ -384,7 +383,7 @@ SELECT
384
383
  )
385
384
  END AS s5_timeslot
386
385
  FROM
387
- pic_pricebooks_tesla_condensed_v AS v;
386
+ pic_price_map_condensed_v AS v;
388
387
 
389
388
  -- charging process states ------------------------------------------------------------------------------
390
389
  CREATE TABLE IF NOT EXISTS pic_charging_process_states (