@mxpicture/tesla-superchargers-mate 0.1.19 → 0.1.20
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.
|
@@ -6,4 +6,11 @@ export declare const pricebookToInitializer: (p: {
|
|
|
6
6
|
meta?: Meta;
|
|
7
7
|
chargersId: PicChargersId;
|
|
8
8
|
}) => PicPricebooksInitializer;
|
|
9
|
+
/**
|
|
10
|
+
* Assigns `sort_order` across one pricebook group (the initializers sharing a
|
|
11
|
+
* `last_fetch_uuid`): TOU rows get a 0-based rank by `start_time`, everything
|
|
12
|
+
* else stays `null`. Mirrors the DB backfill so history and new inserts agree;
|
|
13
|
+
* ties keep feed order (stable sort).
|
|
14
|
+
*/
|
|
15
|
+
export declare const assignSortOrder: (group: PicPricebooksInitializer[]) => PicPricebooksInitializer[];
|
|
9
16
|
//# sourceMappingURL=pricebooks.transform.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pricebooks.transform.d.ts","sourceRoot":"","sources":["../../src/transform/pricebooks.transform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,aAAa,EACd,MAAM,iDAAiD,CAAC;AAOzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAErD,eAAO,MAAM,sBAAsB,GAAI,GAAG;IACxC,SAAS,EAAE,kBAAkB,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,UAAU,EAAE,aAAa,CAAC;CAC3B,KAAG,
|
|
1
|
+
{"version":3,"file":"pricebooks.transform.d.ts","sourceRoot":"","sources":["../../src/transform/pricebooks.transform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,aAAa,EACd,MAAM,iDAAiD,CAAC;AAOzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAErD,eAAO,MAAM,sBAAsB,GAAI,GAAG;IACxC,SAAS,EAAE,kBAAkB,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,UAAU,EAAE,aAAa,CAAC;CAC3B,KAAG,wBAsBH,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,wBAAwB,EAAE,KAChC,wBAAwB,EAQ1B,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createMeta, daysStringToNums, removeUndefined, timeStringToDateFallback, } from "./common.transform.js";
|
|
2
2
|
export const pricebookToInitializer = (p) => {
|
|
3
3
|
const meta = createMeta(p.meta);
|
|
4
|
-
//
|
|
4
|
+
// sort_order is the only optional column and needs the whole group, so it is
|
|
5
|
+
// left unset here and filled in later by assignSortOrder
|
|
5
6
|
const result = {
|
|
6
7
|
fetched_at: meta.fetched_at,
|
|
7
8
|
last_fetch_uuid: meta.last_fetch_uuid,
|
|
@@ -21,4 +22,19 @@ export const pricebookToInitializer = (p) => {
|
|
|
21
22
|
};
|
|
22
23
|
return removeUndefined(result);
|
|
23
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Assigns `sort_order` across one pricebook group (the initializers sharing a
|
|
27
|
+
* `last_fetch_uuid`): TOU rows get a 0-based rank by `start_time`, everything
|
|
28
|
+
* else stays `null`. Mirrors the DB backfill so history and new inserts agree;
|
|
29
|
+
* ties keep feed order (stable sort).
|
|
30
|
+
*/
|
|
31
|
+
export const assignSortOrder = (group) => {
|
|
32
|
+
const ranked = group
|
|
33
|
+
.filter((row) => row.is_tou)
|
|
34
|
+
.sort((a, b) => a.start_time.getTime() - b.start_time.getTime());
|
|
35
|
+
return group.map((row) => ({
|
|
36
|
+
...row,
|
|
37
|
+
sort_order: row.is_tou ? ranked.indexOf(row) : null,
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
24
40
|
//# sourceMappingURL=pricebooks.transform.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pricebooks.transform.js","sourceRoot":"","sources":["../../src/transform/pricebooks.transform.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,wBAAwB,GACzB,MAAM,uBAAuB,CAAC;AAI/B,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAItC,EAA4B,EAAE;IAC7B,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAChC,
|
|
1
|
+
{"version":3,"file":"pricebooks.transform.js","sourceRoot":"","sources":["../../src/transform/pricebooks.transform.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,wBAAwB,GACzB,MAAM,uBAAuB,CAAC;AAI/B,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAItC,EAA4B,EAAE;IAC7B,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAChC,6EAA6E;IAC7E,yDAAyD;IACzD,MAAM,MAAM,GAA6B;QACvC,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,eAAe,EAAE,CAAC,CAAC,UAAU;QAC7B,aAAa,EAAE,CAAC,CAAC,SAAS,CAAC,YAAY;QACvC,GAAG,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG;QACpB,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC;QACxC,UAAU,EAAE,wBAAwB,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC;QACpE,QAAQ,EAAE,wBAAwB,CAAC,CAAC,CAAC,SAAS,C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
|
|
4
4
|
"description": "TeslaMate integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "MXPicture",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@mxpicture/tesla-superchargers-generated": "^0.1.
|
|
51
|
+
"@mxpicture/tesla-superchargers-generated": "^0.1.20",
|
|
52
52
|
"postgres": "^3.4.9",
|
|
53
53
|
"short-uuid": "^6.0.3",
|
|
54
54
|
"zod": "^4.3.6"
|