@glasshome/sync-layer 0.1.0
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/LICENSE +21 -0
- package/README.md +120 -0
- package/dist/area-views-B-m8vwce.js +321 -0
- package/dist/camera/fetch.d.ts +15 -0
- package/dist/camera/query.d.ts +15 -0
- package/dist/camera/types.d.ts +85 -0
- package/dist/camera/webrtc.d.ts +31 -0
- package/dist/commands/service.d.ts +53 -0
- package/dist/commands/types.d.ts +113 -0
- package/dist/connection/adapter.d.ts +48 -0
- package/dist/connection/auth.d.ts +126 -0
- package/dist/connection/manager.d.ts +42 -0
- package/dist/connection/subscriptions.d.ts +25 -0
- package/dist/connection/types.d.ts +161 -0
- package/dist/core/reducers.d.ts +99 -0
- package/dist/core/store.d.ts +64 -0
- package/dist/core/types.d.ts +336 -0
- package/dist/demo/demo-data.d.ts +24 -0
- package/dist/demo/demo-provider.d.ts +33 -0
- package/dist/demo/demo-provider.js +103 -0
- package/dist/demo-data-D8JXWRpw.js +419 -0
- package/dist/entities/area-views.d.ts +25 -0
- package/dist/entities/index.d.ts +54 -0
- package/dist/entities/views.d.ts +30 -0
- package/dist/history/constants.d.ts +16 -0
- package/dist/history/fetch.d.ts +19 -0
- package/dist/history/query.d.ts +13 -0
- package/dist/history/types.d.ts +146 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +1747 -0
- package/dist/query/area-builder.d.ts +25 -0
- package/dist/query/builder.d.ts +18 -0
- package/dist/query/helpers.d.ts +21 -0
- package/dist/query/memoization.d.ts +18 -0
- package/dist/query/projections.d.ts +74 -0
- package/dist/query/types.d.ts +260 -0
- package/dist/solid/hooks.d.ts +88 -0
- package/dist/solid/index.d.ts +10 -0
- package/dist/solid/index.js +176 -0
- package/dist/solid/indices.d.ts +14 -0
- package/dist/store-B1sbyexX.js +54 -0
- package/dist/testing/fixtures.d.ts +161 -0
- package/dist/testing/helpers.d.ts +160 -0
- package/dist/testing/index.d.ts +13 -0
- package/dist/testing/index.js +2047 -0
- package/dist/testing/mock-behaviors/base.d.ts +73 -0
- package/dist/testing/mock-behaviors/climate.d.ts +22 -0
- package/dist/testing/mock-behaviors/cover.d.ts +22 -0
- package/dist/testing/mock-behaviors/index.d.ts +11 -0
- package/dist/testing/mock-behaviors/light.d.ts +20 -0
- package/dist/testing/mock-behaviors/lock.d.ts +20 -0
- package/dist/testing/mock-behaviors/media_player.d.ts +42 -0
- package/dist/testing/mock-behaviors/registry.d.ts +55 -0
- package/dist/testing/mock-behaviors/switch.d.ts +17 -0
- package/dist/testing/mock.d.ts +191 -0
- package/dist/testing/types.d.ts +87 -0
- package/dist/types-Csog0nqk.js +10 -0
- package/dist/weather/fetch.d.ts +19 -0
- package/dist/weather/query.d.ts +23 -0
- package/dist/weather/types.d.ts +126 -0
- package/package.json +85 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Weather Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for weather forecast data.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
import type { EntityId } from "../core/types";
|
|
9
|
+
/**
|
|
10
|
+
* Forecast type
|
|
11
|
+
* Supported forecast types from Home Assistant Weather API
|
|
12
|
+
*/
|
|
13
|
+
export type ForecastType = "hourly" | "daily" | "twice_daily";
|
|
14
|
+
/**
|
|
15
|
+
* Weather forecast entry
|
|
16
|
+
* Represents a single forecast point from Home Assistant
|
|
17
|
+
*/
|
|
18
|
+
export interface WeatherForecast {
|
|
19
|
+
/** Forecast datetime (ISO 8601) */
|
|
20
|
+
datetime: string;
|
|
21
|
+
/** Temperature (in unit system) */
|
|
22
|
+
temperature?: number;
|
|
23
|
+
/** Temperature low (for daily forecasts) */
|
|
24
|
+
temp_low?: number;
|
|
25
|
+
/** Temperature high (for daily forecasts) */
|
|
26
|
+
temp_high?: number;
|
|
27
|
+
/** Humidity percentage */
|
|
28
|
+
humidity?: number;
|
|
29
|
+
/** Wind bearing (degrees) */
|
|
30
|
+
wind_bearing?: number;
|
|
31
|
+
/** Wind speed (in unit system) */
|
|
32
|
+
wind_speed?: number;
|
|
33
|
+
/** Precipitation probability (0-100) */
|
|
34
|
+
precipitation?: number;
|
|
35
|
+
/** Precipitation amount (in unit system) */
|
|
36
|
+
precipitation_probability?: number;
|
|
37
|
+
/** Condition (e.g., "sunny", "cloudy", "rainy") */
|
|
38
|
+
condition?: string;
|
|
39
|
+
/** Pressure (in unit system) */
|
|
40
|
+
pressure?: number;
|
|
41
|
+
/** Cloud coverage (0-100) */
|
|
42
|
+
cloud_coverage?: number;
|
|
43
|
+
/** UV index */
|
|
44
|
+
uv_index?: number;
|
|
45
|
+
/** Additional forecast data */
|
|
46
|
+
[key: string]: any;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Weather forecast data for a single type
|
|
50
|
+
*/
|
|
51
|
+
export interface WeatherForecastData {
|
|
52
|
+
/** Entity ID */
|
|
53
|
+
entityId: EntityId;
|
|
54
|
+
/** Forecast type */
|
|
55
|
+
type: ForecastType;
|
|
56
|
+
/** Forecast entries */
|
|
57
|
+
forecast: WeatherForecast[];
|
|
58
|
+
/** Loading state */
|
|
59
|
+
loading: boolean;
|
|
60
|
+
/** Error if any */
|
|
61
|
+
error: Error | null;
|
|
62
|
+
/** Last fetched timestamp */
|
|
63
|
+
lastFetched: number | null;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Weather forecast data for multiple types
|
|
67
|
+
*/
|
|
68
|
+
export interface WeatherForecastsData {
|
|
69
|
+
/** Entity ID */
|
|
70
|
+
entityId: EntityId;
|
|
71
|
+
/** Forecast data by type */
|
|
72
|
+
forecasts: Partial<Record<ForecastType, WeatherForecast[]>>;
|
|
73
|
+
/** Loading states by type */
|
|
74
|
+
loading: Partial<Record<ForecastType, boolean>>;
|
|
75
|
+
/** Errors by type */
|
|
76
|
+
errors: Partial<Record<ForecastType, Error | null>>;
|
|
77
|
+
/** Last fetched timestamps by type */
|
|
78
|
+
lastFetched: Partial<Record<ForecastType, number | null>>;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Weather forecast data for multiple entities
|
|
82
|
+
*/
|
|
83
|
+
export interface WeatherForecasts {
|
|
84
|
+
/** Entity ID -> Forecast data */
|
|
85
|
+
[entityId: EntityId]: WeatherForecastsData;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Options for forecast queries
|
|
89
|
+
*/
|
|
90
|
+
export interface ForecastQueryOptions {
|
|
91
|
+
/** Forecast type(s) to fetch */
|
|
92
|
+
type?: ForecastType;
|
|
93
|
+
/** Multiple forecast types to fetch */
|
|
94
|
+
types?: ForecastType[];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Single entity forecast query options
|
|
98
|
+
*/
|
|
99
|
+
export interface EntityForecastQueryOptions {
|
|
100
|
+
/** Forecast type(s) to fetch */
|
|
101
|
+
type?: ForecastType;
|
|
102
|
+
/** Multiple forecast types to fetch */
|
|
103
|
+
types?: ForecastType[];
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Forecast query result for a single type
|
|
107
|
+
*/
|
|
108
|
+
export interface ForecastResult {
|
|
109
|
+
/** Forecast data */
|
|
110
|
+
data: WeatherForecastData | null;
|
|
111
|
+
/** Loading state */
|
|
112
|
+
loading: boolean;
|
|
113
|
+
/** Error if any */
|
|
114
|
+
error: Error | null;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Forecast query result for multiple types
|
|
118
|
+
*/
|
|
119
|
+
export interface ForecastsResult {
|
|
120
|
+
/** Forecast data */
|
|
121
|
+
data: WeatherForecastsData | null;
|
|
122
|
+
/** Loading states by type */
|
|
123
|
+
loading: Partial<Record<ForecastType, boolean>>;
|
|
124
|
+
/** Errors by type */
|
|
125
|
+
errors: Partial<Record<ForecastType, Error | null>>;
|
|
126
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@glasshome/sync-layer",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Type-safe, reactive state synchronization layer for Home Assistant",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/glasshome/sync-layer.git"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"@glasshome/source": "./src/index.ts",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./solid": {
|
|
20
|
+
"@glasshome/source": "./src/solid/index.ts",
|
|
21
|
+
"types": "./dist/solid/index.d.ts",
|
|
22
|
+
"import": "./dist/solid/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./testing": {
|
|
25
|
+
"@glasshome/source": "./src/testing/index.ts",
|
|
26
|
+
"types": "./dist/testing/index.d.ts",
|
|
27
|
+
"import": "./dist/testing/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./demo": {
|
|
30
|
+
"@glasshome/source": "./src/demo/demo-provider.ts",
|
|
31
|
+
"types": "./dist/demo/demo-provider.d.ts",
|
|
32
|
+
"import": "./dist/demo/demo-provider.js"
|
|
33
|
+
},
|
|
34
|
+
"./package.json": "./package.json"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@glasshome/ha-types": "^0.1.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
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"files": [
|
|
49
|
+
"dist"
|
|
50
|
+
],
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "tsdown",
|
|
53
|
+
"dev": "tsdown --watch",
|
|
54
|
+
"test": "bun test",
|
|
55
|
+
"lint": "tsc --noEmit"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"home-assistant-js-websocket": "^9.6.0"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@types/bun": "latest",
|
|
62
|
+
"tsdown": "^0.2.0",
|
|
63
|
+
"typescript": "^5"
|
|
64
|
+
},
|
|
65
|
+
"homepage": "https://github.com/glasshome/sync-layer#readme",
|
|
66
|
+
"bugs": {
|
|
67
|
+
"url": "https://github.com/glasshome/sync-layer/issues"
|
|
68
|
+
},
|
|
69
|
+
"publishConfig": {
|
|
70
|
+
"access": "public"
|
|
71
|
+
},
|
|
72
|
+
"engines": {
|
|
73
|
+
"node": ">=18"
|
|
74
|
+
},
|
|
75
|
+
"keywords": [
|
|
76
|
+
"home-assistant",
|
|
77
|
+
"websocket",
|
|
78
|
+
"typescript",
|
|
79
|
+
"reactive",
|
|
80
|
+
"solidjs",
|
|
81
|
+
"smart-home"
|
|
82
|
+
],
|
|
83
|
+
"author": "GlassHome Labs",
|
|
84
|
+
"license": "MIT"
|
|
85
|
+
}
|