@glasshome/sync-layer 0.10.1 → 0.10.2

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as setPrivilegedConn, A as unloadDemoData, B as getAreaView, C as demoTimeMap, D as resetDemo, E as loadDemoHouse, F as MAX_HISTORY_POINTS, G as getEntityView, H as buildEntityView, I as appendHistoryPoint, J as forceResubscribe, K as getEntityViews, L as bulkAppendHistoryPoints, M as demoEnergyPreferences, N as isEnergyEntity, O as startDemoEnergyTicker, P as synthesizeEnergyHistory, Q as privilegedConn, R as buildAreaView, S as demoReplayModel, T as loadDemoData, U as entityViewEquals, V as getAreaViews, W as getAllEntityViews, X as setManagerConnection, Y as registerEntity, Z as setResubscribeHandler, _ as applyDemoServiceCall, a as fetchForecastData, b as demoCallLog, c as normalizeStatisticTime, d as callService, et as setState, f as sendCommand, g as updateEntity, h as turnOn, i as fetchForecast, j as demoAssetUrl, k as stopDemoEnergyTicker, l as batchEntityUpdates, m as turnOff, o as fetchForecasts, p as toggle, q as extractDomain, s as fetchStatisticsDuringPeriod, t as forceResubscribeCalendars, tt as state, u as batchServiceCalls, v as applyVisitorHolds, w as isDemoMode, x as demoModel, y as createDemoFixtures, z as buildDeviceView } from "./track-DssLNusE.js";
1
+ import { $ as setPrivilegedConn, A as unloadDemoData, B as getAreaView, C as demoTimeMap, D as resetDemo, E as loadDemoHouse, F as MAX_HISTORY_POINTS, G as getEntityView, H as buildEntityView, I as appendHistoryPoint, J as forceResubscribe, K as getEntityViews, L as bulkAppendHistoryPoints, M as demoEnergyPreferences, N as isEnergyEntity, O as startDemoEnergyTicker, P as synthesizeEnergyHistory, Q as privilegedConn, R as buildAreaView, S as demoReplayModel, T as loadDemoData, U as entityViewEquals, V as getAreaViews, W as getAllEntityViews, X as setManagerConnection, Y as registerEntity, Z as setResubscribeHandler, _ as applyDemoServiceCall, a as fetchForecastData, b as demoCallLog, c as normalizeStatisticTime, d as callService, et as setState, f as sendCommand, g as updateEntity, h as turnOn, i as fetchForecast, j as demoAssetUrl, k as stopDemoEnergyTicker, l as batchEntityUpdates, m as turnOff, o as fetchForecasts, p as toggle, q as extractDomain, s as fetchStatisticsDuringPeriod, t as forceResubscribeCalendars, tt as state, u as batchServiceCalls, v as applyVisitorHolds, w as isDemoMode, x as demoModel, y as createDemoFixtures, z as buildDeviceView } from "./track-BmoU1-vZ.js";
2
2
  import { t as runHaBridgeWorker } from "./worker-main-B6eeHPDQ.js";
3
3
  import { produce } from "solid-js/store";
4
4
  //#region src/core/reducers.ts
@@ -1,4 +1,4 @@
1
- import { G as getEntityView, Q as privilegedConn, R as buildAreaView, U as entityViewEquals, V as getAreaViews, Y as registerEntity, d as callService, et as setState, h as turnOn, m as turnOff, n as trackCalendarEvents, p as toggle, q as extractDomain, r as buildDemoForecast, s as fetchStatisticsDuringPeriod, tt as state, w as isDemoMode } from "../track-DssLNusE.js";
1
+ import { G as getEntityView, Q as privilegedConn, R as buildAreaView, U as entityViewEquals, V as getAreaViews, Y as registerEntity, d as callService, et as setState, h as turnOn, m as turnOff, n as trackCalendarEvents, p as toggle, q as extractDomain, r as buildDemoForecast, s as fetchStatisticsDuringPeriod, tt as state, w as isDemoMode } from "../track-BmoU1-vZ.js";
2
2
  import { produce } from "solid-js/store";
3
3
  import { createEffect, createMemo, createResource, onCleanup } from "solid-js";
4
4
  //#region src/weather/track.ts
@@ -504,7 +504,19 @@ const WEEKDAYS = {
504
504
  Fri: 5,
505
505
  Sat: 6
506
506
  };
507
+ const RECENT_LIMIT = 256;
508
+ const recent = /* @__PURE__ */ new Map();
507
509
  function parts(ms, timeZone) {
510
+ const key = `${timeZone}|${ms}`;
511
+ let p = recent.get(key);
512
+ if (!p) {
513
+ if (recent.size >= RECENT_LIMIT) recent.clear();
514
+ p = readParts(ms, timeZone);
515
+ recent.set(key, p);
516
+ }
517
+ return p;
518
+ }
519
+ function readParts(ms, timeZone) {
508
520
  const out = {};
509
521
  for (const p of formatter(timeZone).formatToParts(ms)) out[p.type] = p.value;
510
522
  return {
package/package.json CHANGED
@@ -1,15 +1,32 @@
1
1
  {
2
2
  "name": "@glasshome/sync-layer",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "description": "Type-safe, reactive state synchronization layer for Home Assistant",
5
+ "keywords": [
6
+ "home-assistant",
7
+ "reactive",
8
+ "smart-home",
9
+ "solidjs",
10
+ "typescript",
11
+ "websocket"
12
+ ],
13
+ "homepage": "https://github.com/glasshome/sync-layer#readme",
14
+ "bugs": {
15
+ "url": "https://github.com/glasshome/sync-layer/issues"
16
+ },
17
+ "license": "MIT",
18
+ "author": "GlassHome Labs",
5
19
  "repository": {
6
20
  "type": "git",
7
21
  "url": "https://github.com/glasshome/sync-layer.git"
8
22
  },
23
+ "files": [
24
+ "dist"
25
+ ],
9
26
  "type": "module",
27
+ "sideEffects": true,
10
28
  "main": "./dist/index.js",
11
29
  "types": "./dist/index.d.ts",
12
- "sideEffects": true,
13
30
  "exports": {
14
31
  ".": {
15
32
  "@glasshome/source": "./src/index.ts",
@@ -33,59 +50,45 @@
33
50
  },
34
51
  "./package.json": "./package.json"
35
52
  },
36
- "peerDependencies": {
37
- "@glasshome/ha-types": "0.2.0",
38
- "solid-js": "^1.9.0"
39
- },
40
- "peerDependenciesMeta": {
41
- "@glasshome/ha-types": {
42
- "optional": false
43
- },
44
- "solid-js": {
45
- "optional": true
46
- }
53
+ "publishConfig": {
54
+ "access": "public"
47
55
  },
48
- "files": [
49
- "dist"
50
- ],
51
56
  "scripts": {
52
57
  "build": "tsdown && tsc --noEmit && bun scripts/check-widget-reachable-surface.ts",
53
58
  "dev": "tsdown --watch",
54
59
  "test": "bun test",
55
- "lint": "tsc --noEmit",
60
+ "lint": "oxlint --type-aware . && oxfmt --check . && tsc --noEmit",
56
61
  "gen:demo-ids": "bun scripts/gen-demo-ids.ts",
57
62
  "check:dead": "fallow dead-code --fail-on-issues"
58
63
  },
59
64
  "dependencies": {
60
- "home-assistant-js-websocket": "^9.6.0",
61
- "@glasshome/widget-contract": "0.3.0"
65
+ "@glasshome/widget-contract": "0.3.0",
66
+ "home-assistant-js-websocket": "^9.6.0"
62
67
  },
63
68
  "devDependencies": {
64
69
  "@glasshome/ha-types": "0.2.0",
65
70
  "@types/bun": "^1.4.0",
66
71
  "fallow": "3.17.0",
72
+ "oxfmt": "0.65.0",
73
+ "oxlint": "1.81.0",
74
+ "oxlint-tsgolint": "7.0.2001",
67
75
  "solid-js": "^1.9.0",
68
76
  "tsdown": "^0.22.14",
69
77
  "typescript": "^7.0.2"
70
78
  },
71
- "homepage": "https://github.com/glasshome/sync-layer#readme",
72
- "bugs": {
73
- "url": "https://github.com/glasshome/sync-layer/issues"
79
+ "peerDependencies": {
80
+ "@glasshome/ha-types": "0.2.0",
81
+ "solid-js": "^1.9.0"
74
82
  },
75
- "publishConfig": {
76
- "access": "public"
83
+ "peerDependenciesMeta": {
84
+ "@glasshome/ha-types": {
85
+ "optional": false
86
+ },
87
+ "solid-js": {
88
+ "optional": true
89
+ }
77
90
  },
78
91
  "engines": {
79
92
  "node": ">=18"
80
- },
81
- "keywords": [
82
- "home-assistant",
83
- "websocket",
84
- "typescript",
85
- "reactive",
86
- "solidjs",
87
- "smart-home"
88
- ],
89
- "author": "GlassHome Labs",
90
- "license": "MIT"
93
+ }
91
94
  }