@mxpicture/tesla-superchargers-api 0.1.50 → 0.1.52
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/dist/api/RefsApi.d.ts +20 -0
- package/dist/api/RefsApi.d.ts.map +1 -0
- package/dist/api/RefsApi.js +23 -0
- package/dist/api/RefsApi.js.map +1 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +1 -0
- package/dist/api/index.js.map +1 -1
- package/dist/common/pricebooks.common.d.ts +1 -1
- package/dist/common/pricebooks.common.js +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type RefsBuildSummary } from "@mxpicture/tesla-superchargers-mate/store";
|
|
2
|
+
import { IApi } from "./IApi.js";
|
|
3
|
+
/**
|
|
4
|
+
* `pic_refs` — one row per drive, parked interval and charge, each carrying the
|
|
5
|
+
* euros it consumed, which the Grafana drive/idle cost views read through
|
|
6
|
+
* `pic_base_drive_cost_v` / `pic_base_idle_cost_v`.
|
|
7
|
+
*
|
|
8
|
+
* The table is a projection of what TeslaMate has logged, so it only ever holds
|
|
9
|
+
* what the last build saw: it needs rebuilding after TeslaMate logs new drives
|
|
10
|
+
* or charges, after the pricing pass back-fills a charge's
|
|
11
|
+
* cost (the invoice the replay prices a charge from), and after a
|
|
12
|
+
* deploy — the schema migration drops and recreates the table, so `setup`
|
|
13
|
+
* leaves it empty.
|
|
14
|
+
*/
|
|
15
|
+
export declare class RefsApi extends IApi {
|
|
16
|
+
/** Reconcile and reprice every car's refs. Idempotent; see `buildRefs`. */
|
|
17
|
+
build(): Promise<RefsBuildSummary>;
|
|
18
|
+
}
|
|
19
|
+
export declare const refsApi: () => RefsApi;
|
|
20
|
+
//# sourceMappingURL=RefsApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefsApi.d.ts","sourceRoot":"","sources":["../../src/api/RefsApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;;;;;;;;GAWG;AACH,qBAAa,OAAQ,SAAQ,IAAI;IAC/B,2EAA2E;IAC9D,KAAK,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAGhD;AAGD,eAAO,MAAM,OAAO,eAAiC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { buildRefs, } from "@mxpicture/tesla-superchargers-mate/store";
|
|
2
|
+
import { IApi } from "./IApi.js";
|
|
3
|
+
/**
|
|
4
|
+
* `pic_refs` — one row per drive, parked interval and charge, each carrying the
|
|
5
|
+
* euros it consumed, which the Grafana drive/idle cost views read through
|
|
6
|
+
* `pic_base_drive_cost_v` / `pic_base_idle_cost_v`.
|
|
7
|
+
*
|
|
8
|
+
* The table is a projection of what TeslaMate has logged, so it only ever holds
|
|
9
|
+
* what the last build saw: it needs rebuilding after TeslaMate logs new drives
|
|
10
|
+
* or charges, after the pricing pass back-fills a charge's
|
|
11
|
+
* cost (the invoice the replay prices a charge from), and after a
|
|
12
|
+
* deploy — the schema migration drops and recreates the table, so `setup`
|
|
13
|
+
* leaves it empty.
|
|
14
|
+
*/
|
|
15
|
+
export class RefsApi extends IApi {
|
|
16
|
+
/** Reconcile and reprice every car's refs. Idempotent; see `buildRefs`. */
|
|
17
|
+
async build() {
|
|
18
|
+
return await buildRefs();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
let _api = null;
|
|
22
|
+
export const refsApi = () => (_api ??= new RefsApi());
|
|
23
|
+
//# sourceMappingURL=RefsApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefsApi.js","sourceRoot":"","sources":["../../src/api/RefsApi.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,GAEV,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,OAAQ,SAAQ,IAAI;IAC/B,2EAA2E;IACpE,KAAK,CAAC,KAAK;QAChB,OAAO,MAAM,SAAS,EAAE,CAAC;IAC3B,CAAC;CACF;AAED,IAAI,IAAI,GAAmB,IAAI,CAAC;AAChC,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,CAAC,IAAI,KAAK,IAAI,OAAO,EAAE,CAAC,CAAC"}
|
package/dist/api/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from "./ChargingProcessesApi.js";
|
|
|
3
3
|
export * from "./FailuresApi.js";
|
|
4
4
|
export * from "./IApi.js";
|
|
5
5
|
export * from "./InvoicesApi.js";
|
|
6
|
+
export * from "./RefsApi.js";
|
|
6
7
|
export * from "./SlugsApi.js";
|
|
7
8
|
export * from "./ZipCodesApi.js";
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/api/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC"}
|
package/dist/api/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export * from "./ChargingProcessesApi.js";
|
|
|
4
4
|
export * from "./FailuresApi.js";
|
|
5
5
|
export * from "./IApi.js";
|
|
6
6
|
export * from "./InvoicesApi.js";
|
|
7
|
+
export * from "./RefsApi.js";
|
|
7
8
|
export * from "./SlugsApi.js";
|
|
8
9
|
export * from "./ZipCodesApi.js";
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
package/dist/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC"}
|
|
@@ -26,7 +26,7 @@ export declare const localDayTime: (at: Date, timeZone: string) => {
|
|
|
26
26
|
* `20:00–00:00`); `start == end == 00:00` is a whole-day window. `end` is
|
|
27
27
|
* exclusive — each instant falls into exactly one window of a partition.
|
|
28
28
|
*
|
|
29
|
-
* Mirrored in SQL by `pic_price_hourly_v` (packages/teslamate/sql/
|
|
29
|
+
* Mirrored in SQL by `pic_price_hourly_v` (packages/teslamate/sql/views.sql),
|
|
30
30
|
* which resolves the same question per hour. Keep the two in sync.
|
|
31
31
|
*/
|
|
32
32
|
export declare const pricebookCoversInstant: (row: Pick<PricebookContent, "days" | "start_time" | "end_time">, at: Date, timeZone: string) => boolean;
|
|
@@ -50,7 +50,7 @@ export const localDayTime = (at, timeZone) => {
|
|
|
50
50
|
* `20:00–00:00`); `start == end == 00:00` is a whole-day window. `end` is
|
|
51
51
|
* exclusive — each instant falls into exactly one window of a partition.
|
|
52
52
|
*
|
|
53
|
-
* Mirrored in SQL by `pic_price_hourly_v` (packages/teslamate/sql/
|
|
53
|
+
* Mirrored in SQL by `pic_price_hourly_v` (packages/teslamate/sql/views.sql),
|
|
54
54
|
* which resolves the same question per hour. Keep the two in sync.
|
|
55
55
|
*/
|
|
56
56
|
export const pricebookCoversInstant = (row, at, timeZone) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mxpicture/tesla-superchargers-api",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.52",
|
|
4
4
|
"description": "Fetch + store Tesla Supercharger locations and pricing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "MXPicture",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@mxpicture/tesla-superchargers-cloud-store": "^0.1.
|
|
48
|
-
"@mxpicture/tesla-superchargers-generated": "^0.1.
|
|
49
|
-
"@mxpicture/tesla-superchargers-mate": "^0.1.
|
|
47
|
+
"@mxpicture/tesla-superchargers-cloud-store": "^0.1.52",
|
|
48
|
+
"@mxpicture/tesla-superchargers-generated": "^0.1.52",
|
|
49
|
+
"@mxpicture/tesla-superchargers-mate": "^0.1.52",
|
|
50
50
|
"csv-parse": "^7.0.1",
|
|
51
51
|
"fflate": "^0.8.3",
|
|
52
52
|
"json5": "^2.2.3",
|