@hashsome/core 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.
Files changed (75) hide show
  1. package/LICENSE +674 -0
  2. package/dist/.tsbuildinfo +1 -0
  3. package/dist/base-integration.d.ts +30 -0
  4. package/dist/base-integration.js +106 -0
  5. package/dist/base-integration.js.map +1 -0
  6. package/dist/client.d.ts +63 -0
  7. package/dist/client.js +199 -0
  8. package/dist/client.js.map +1 -0
  9. package/dist/codegen.d.ts +6 -0
  10. package/dist/codegen.js +19 -0
  11. package/dist/codegen.js.map +1 -0
  12. package/dist/conformance.d.ts +23 -0
  13. package/dist/conformance.js +196 -0
  14. package/dist/conformance.js.map +1 -0
  15. package/dist/emitter.d.ts +8 -0
  16. package/dist/emitter.js +18 -0
  17. package/dist/emitter.js.map +1 -0
  18. package/dist/entity.d.ts +24 -0
  19. package/dist/entity.js +21 -0
  20. package/dist/entity.js.map +1 -0
  21. package/dist/index.d.ts +9 -0
  22. package/dist/index.js +9 -0
  23. package/dist/index.js.map +1 -0
  24. package/dist/integration.d.ts +61 -0
  25. package/dist/integration.js +1 -0
  26. package/dist/integration.js.map +1 -0
  27. package/dist/local-client.d.ts +22 -0
  28. package/dist/local-client.js +121 -0
  29. package/dist/local-client.js.map +1 -0
  30. package/dist/mock.d.ts +61 -0
  31. package/dist/mock.js +448 -0
  32. package/dist/mock.js.map +1 -0
  33. package/dist/model/action.d.ts +9 -0
  34. package/dist/model/action.js +1 -0
  35. package/dist/model/action.js.map +1 -0
  36. package/dist/model/base.d.ts +21 -0
  37. package/dist/model/base.js +1 -0
  38. package/dist/model/base.js.map +1 -0
  39. package/dist/model/browse.d.ts +28 -0
  40. package/dist/model/browse.js +1 -0
  41. package/dist/model/browse.js.map +1 -0
  42. package/dist/model/climate.d.ts +37 -0
  43. package/dist/model/climate.js +1 -0
  44. package/dist/model/climate.js.map +1 -0
  45. package/dist/model/generic.d.ts +7 -0
  46. package/dist/model/generic.js +1 -0
  47. package/dist/model/generic.js.map +1 -0
  48. package/dist/model/history.d.ts +23 -0
  49. package/dist/model/history.js +1 -0
  50. package/dist/model/history.js.map +1 -0
  51. package/dist/model/index.d.ts +51 -0
  52. package/dist/model/index.js +38 -0
  53. package/dist/model/index.js.map +1 -0
  54. package/dist/model/light.d.ts +46 -0
  55. package/dist/model/light.js +1 -0
  56. package/dist/model/light.js.map +1 -0
  57. package/dist/model/media-player.d.ts +68 -0
  58. package/dist/model/media-player.js +1 -0
  59. package/dist/model/media-player.js.map +1 -0
  60. package/dist/model/person.d.ts +10 -0
  61. package/dist/model/person.js +1 -0
  62. package/dist/model/person.js.map +1 -0
  63. package/dist/model/sensor.d.ts +12 -0
  64. package/dist/model/sensor.js +1 -0
  65. package/dist/model/sensor.js.map +1 -0
  66. package/dist/model/switch.d.ts +10 -0
  67. package/dist/model/switch.js +1 -0
  68. package/dist/model/switch.js.map +1 -0
  69. package/dist/model/weather.d.ts +16 -0
  70. package/dist/model/weather.js +19 -0
  71. package/dist/model/weather.js.map +1 -0
  72. package/dist/protocol.d.ts +61 -0
  73. package/dist/protocol.js +102 -0
  74. package/dist/protocol.js.map +1 -0
  75. package/package.json +36 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock.js","sourceRoot":"","sources":["../src/mock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EACL,WAAW,GAeZ,MAAM,kBAAkB,CAAC;AAU1B,MAAM,UAAU,eAAe,CAC7B,IAAI,GAEA,EAAE;IAEN,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;IACvC,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,OAAO;QACrB,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,KAAK;QACZ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QACnE,CAAC;QAED,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;YACpC,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,KAAK,MAAM,CAAC,IAAI,YAAY,IAAI,WAAW,CAAC,CAAC,CAAC;QAChF,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,KAAK,aAAa,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;YAC1D,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC/C,CAAC;QAED,IAAI,CAAC;YACH,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QAC1D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACnF,CAAC;QAED,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;CACF"}
@@ -0,0 +1,9 @@
1
+ import type { EntityBase } from './base.ts';
2
+ /** A one-shot thing to trigger: a scene, a script, a button, a vacuum's start. */
3
+ export interface ActionEntity extends EntityBase<'action'> {
4
+ /** ISO 8601, when it last ran. */
5
+ lastTriggered?: string;
6
+ }
7
+ export interface ActionCommands {
8
+ trigger: void;
9
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.js","sourceRoot":"","sources":["../../src/model/action.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ import type { EntityRef } from '../entity.ts';
2
+ /** `ready`: the state is meaningful. `unavailable`: the device is unreachable. `unknown`:
3
+ * reachable but it has not reported yet. */
4
+ export type Availability = 'ready' | 'unavailable' | 'unknown';
5
+ /** What every entity has, whatever its kind. See ARCHITECTURE.md ("The generic entity model"). */
6
+ export interface EntityBase<K extends string = string> {
7
+ /** `<integration>:<id>`; stamped by `BaseIntegration`, never built by an integration. */
8
+ ref: EntityRef;
9
+ /** What this entity is; selects the model and its commands. */
10
+ kind: K;
11
+ /** Human-readable name, already resolved by the integration. */
12
+ name: string;
13
+ availability: Availability;
14
+ /** ISO 8601: when the state last changed. */
15
+ lastChanged?: string;
16
+ /** ISO 8601: when the backend last reported it. */
17
+ lastUpdated?: string;
18
+ /** The backend's own payload, untouched — an escape hatch for project code, never read by
19
+ * `@hashsome/ui`. It reaches the browser, so it must hold no credentials. */
20
+ raw?: Record<string, unknown>;
21
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/model/base.ts"],"names":[],"mappings":""}
@@ -0,0 +1,28 @@
1
+ /** What a browsable item is, so the UI can pick an icon and a layout. Open set: anything an
2
+ * integration cannot place is `other`. */
3
+ export type BrowseKind = 'folder' | 'artist' | 'album' | 'playlist' | 'track' | 'radio' | 'other';
4
+ /** One entry in a media library, as the UI shows it. The `id` is opaque: only the integration that
5
+ * produced it can read it, and it is what goes back to `browse` (to open it) or `playMedia` (to
6
+ * play it). */
7
+ export interface BrowseItem {
8
+ id: string;
9
+ title: string;
10
+ subtitle?: string;
11
+ artworkUrl?: string;
12
+ kind: BrowseKind;
13
+ /** `playMedia` accepts this item. */
14
+ playable: boolean;
15
+ /** `browse` can open this item to list what is inside it. */
16
+ expandable: boolean;
17
+ }
18
+ export interface BrowseQuery {
19
+ /** The `id` of an expandable item to open. Omit for the top level. */
20
+ path?: string;
21
+ /** Finds items by name. Only for integrations whose player has `capabilities.search`. */
22
+ search?: string;
23
+ }
24
+ export interface BrowseResult {
25
+ /** A heading for what is listed, when the backend names it (a playlist's name). */
26
+ title?: string;
27
+ items: BrowseItem[];
28
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browse.js","sourceRoot":"","sources":["../../src/model/browse.ts"],"names":[],"mappings":""}
@@ -0,0 +1,37 @@
1
+ import type { EntityBase } from './base.ts';
2
+ export type ClimateMode = 'off' | 'heat' | 'cool' | 'auto' | 'heatCool' | 'dry' | 'fanOnly';
3
+ export type ClimateAction = 'off' | 'idle' | 'heating' | 'cooling' | 'drying' | 'fan';
4
+ export interface ClimateEntity extends EntityBase<'climate'> {
5
+ mode: ClimateMode;
6
+ /** What it is doing right now, when it reports that. */
7
+ action?: ClimateAction;
8
+ targetTemperature?: number;
9
+ currentTemperature?: number;
10
+ /** Relative humidity, 0–100. */
11
+ humidity?: number;
12
+ unit: '°C' | '°F';
13
+ preset?: string;
14
+ capabilities: {
15
+ /** The modes this device supports, in display order. */
16
+ modes: ClimateMode[];
17
+ presets: string[];
18
+ /** Whether a target temperature can be set. */
19
+ targetTemperature: boolean;
20
+ step: number;
21
+ range: {
22
+ min: number;
23
+ max: number;
24
+ };
25
+ };
26
+ }
27
+ export interface ClimateCommands {
28
+ setMode: {
29
+ mode: ClimateMode;
30
+ };
31
+ setTargetTemperature: {
32
+ temperature: number;
33
+ };
34
+ setPreset: {
35
+ preset: string;
36
+ };
37
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"climate.js","sourceRoot":"","sources":["../../src/model/climate.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import type { EntityBase } from './base.ts';
2
+ /** An entity with no dedicated kind: shown, not controlled. */
3
+ export interface GenericEntity extends EntityBase<'generic'> {
4
+ value: string;
5
+ unit?: string;
6
+ }
7
+ export type GenericCommands = Record<string, never>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generic.js","sourceRoot":"","sources":["../../src/model/generic.ts"],"names":[],"mappings":""}
@@ -0,0 +1,23 @@
1
+ /** How far back a history query looks. */
2
+ export type HistoryRange = '1h' | '1d' | '1w' | '1m';
3
+ /** How coarse the points are. Left out, the integration picks one that suits the range. */
4
+ export type HistoryBucket = '5m' | '1h' | '1d';
5
+ export interface HistoryQuery {
6
+ range: HistoryRange;
7
+ bucket?: HistoryBucket;
8
+ }
9
+ export interface HistoryPoint {
10
+ /** The start of the bucket, ISO 8601. */
11
+ timestamp: string;
12
+ /** What a reading was over the bucket: its average for a measurement (a temperature, power), or how much it
13
+ * grew for a running total (energy used in that bucket). */
14
+ value: number;
15
+ }
16
+ export interface HistoryResult {
17
+ /** Oldest first; empty when the backend keeps no history for the entity. */
18
+ points: HistoryPoint[];
19
+ /** `total` when each value is how much the counter grew in that bucket, `measurement` when it is
20
+ * the reading itself. */
21
+ kind: 'measurement' | 'total';
22
+ unit?: string;
23
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/model/history.ts"],"names":[],"mappings":""}
@@ -0,0 +1,51 @@
1
+ import type { ActionCommands, ActionEntity } from './action.ts';
2
+ import type { ClimateCommands, ClimateEntity } from './climate.ts';
3
+ import type { GenericCommands, GenericEntity } from './generic.ts';
4
+ import type { LightCommands, LightEntity } from './light.ts';
5
+ import type { MediaPlayerCommands, MediaPlayerEntity } from './media-player.ts';
6
+ import type { PersonCommands, PersonEntity } from './person.ts';
7
+ import type { SensorCommands, SensorEntity } from './sensor.ts';
8
+ import type { SwitchCommands, SwitchEntity } from './switch.ts';
9
+ import type { WeatherCommands, WeatherEntity } from './weather.ts';
10
+ export * from './base.ts';
11
+ export * from './browse.ts';
12
+ export * from './history.ts';
13
+ export * from './action.ts';
14
+ export * from './climate.ts';
15
+ export * from './generic.ts';
16
+ export * from './light.ts';
17
+ export * from './media-player.ts';
18
+ export * from './person.ts';
19
+ export * from './sensor.ts';
20
+ export * from './switch.ts';
21
+ export * from './weather.ts';
22
+ /** Every entity `@hashsome/core` knows how to model. */
23
+ export type Entity = MediaPlayerEntity | LightEntity | ClimateEntity | SensorEntity | SwitchEntity | ActionEntity | PersonEntity | WeatherEntity | GenericEntity;
24
+ export type EntityKind = Entity['kind'];
25
+ /** An entity as an integration produces it: the model without `ref`, which `BaseIntegration` adds. */
26
+ export type EntityInput = Entity extends infer E ? E extends Entity ? Omit<E, 'ref'> : never : never;
27
+ /** The commands each kind defines, with their argument shapes (`void` = no arguments). */
28
+ export interface KindCommands {
29
+ mediaPlayer: MediaPlayerCommands;
30
+ light: LightCommands;
31
+ climate: ClimateCommands;
32
+ sensor: SensorCommands;
33
+ switch: SwitchCommands;
34
+ action: ActionCommands;
35
+ person: PersonCommands;
36
+ weather: WeatherCommands;
37
+ generic: GenericCommands;
38
+ }
39
+ /** Command names per kind, for validating a command before it reaches a backend. */
40
+ export declare const COMMAND_NAMES: Record<EntityKind, readonly string[]>;
41
+ export declare function isCommandOf(kind: string, name: string): boolean;
42
+ /** The entity type of one kind. */
43
+ export type KindEntity<K extends EntityKind> = Extract<Entity, {
44
+ kind: K;
45
+ }>;
46
+ /** The command names a kind defines. */
47
+ export type CommandName<K extends EntityKind> = Extract<keyof KindCommands[K], string>;
48
+ /** The argument list of a command: none for a `void` command, otherwise the one arguments object. */
49
+ export type CommandArgs<K extends EntityKind, N extends CommandName<K>> = [
50
+ KindCommands[K][N]
51
+ ] extends [void] ? [] : [args: KindCommands[K][N]];
@@ -0,0 +1,38 @@
1
+ export * from './base.js';
2
+ export * from './browse.js';
3
+ export * from './history.js';
4
+ export * from './action.js';
5
+ export * from './climate.js';
6
+ export * from './generic.js';
7
+ export * from './light.js';
8
+ export * from './media-player.js';
9
+ export * from './person.js';
10
+ export * from './sensor.js';
11
+ export * from './switch.js';
12
+ export * from './weather.js';
13
+ /** Command names per kind, for validating a command before it reaches a backend. */
14
+ export const COMMAND_NAMES = {
15
+ mediaPlayer: [
16
+ 'play',
17
+ 'pause',
18
+ 'togglePlay',
19
+ 'next',
20
+ 'previous',
21
+ 'setVolume',
22
+ 'setMuted',
23
+ 'seek',
24
+ 'setShuffle',
25
+ 'playMedia',
26
+ ],
27
+ light: ['turnOn', 'turnOff', 'toggle', 'setBrightness', 'setColorTemperature', 'setColor'],
28
+ climate: ['setMode', 'setTargetTemperature', 'setPreset'],
29
+ sensor: [],
30
+ switch: ['turnOn', 'turnOff', 'toggle'],
31
+ action: ['trigger'],
32
+ person: [],
33
+ weather: [],
34
+ generic: [],
35
+ };
36
+ export function isCommandOf(kind, name) {
37
+ return COMMAND_NAMES[kind]?.includes(name) ?? false;
38
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAUA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAoC7B,oFAAoF;AACpF,MAAM,CAAC,MAAM,aAAa,GAA0C;IAClE,WAAW,EAAE;QACX,MAAM;QACN,OAAO;QACP,YAAY;QACZ,MAAM;QACN,UAAU;QACV,WAAW;QACX,UAAU;QACV,MAAM;QACN,YAAY;QACZ,WAAW;KACZ;IACD,KAAK,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,qBAAqB,EAAE,UAAU,CAAC;IAC1F,OAAO,EAAE,CAAC,SAAS,EAAE,sBAAsB,EAAE,WAAW,CAAC;IACzD,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC;IACvC,MAAM,EAAE,CAAC,SAAS,CAAC;IACnB,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,EAAE;CACZ,CAAC;AAEF,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,IAAY;IACpD,OAAQ,aAAmD,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC;AAC7F,CAAC"}
@@ -0,0 +1,46 @@
1
+ import type { EntityBase } from './base.ts';
2
+ export type LightColor = {
3
+ mode: 'temperature';
4
+ kelvin: number;
5
+ } | {
6
+ mode: 'color';
7
+ /** 0–360. */
8
+ hue: number;
9
+ /** 0–100. */
10
+ saturation: number;
11
+ /** The color as displayed, when the backend reports it. */
12
+ rgb?: [number, number, number];
13
+ };
14
+ export interface LightEntity extends EntityBase<'light'> {
15
+ on: boolean;
16
+ /** 0..1. Absent when the light is not dimmable. */
17
+ brightness?: number;
18
+ /** The current color, when the light has one. */
19
+ color?: LightColor;
20
+ capabilities: {
21
+ brightness: boolean;
22
+ colorTemperature: boolean;
23
+ color: boolean;
24
+ /** The color temperature range in kelvin, when `colorTemperature` is true. */
25
+ kelvinRange?: {
26
+ min: number;
27
+ max: number;
28
+ };
29
+ };
30
+ }
31
+ export interface LightCommands {
32
+ turnOn: void;
33
+ turnOff: void;
34
+ toggle: void;
35
+ /** `brightness` is 0..1; 0 turns the light off. */
36
+ setBrightness: {
37
+ brightness: number;
38
+ };
39
+ setColorTemperature: {
40
+ kelvin: number;
41
+ };
42
+ setColor: {
43
+ hue: number;
44
+ saturation: number;
45
+ };
46
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"light.js","sourceRoot":"","sources":["../../src/model/light.ts"],"names":[],"mappings":""}
@@ -0,0 +1,68 @@
1
+ import type { EntityBase } from './base.ts';
2
+ export type PlaybackState = 'playing' | 'paused' | 'idle' | 'off' | 'buffering';
3
+ export interface MediaPlayerEntity extends EntityBase<'mediaPlayer'> {
4
+ playback: PlaybackState;
5
+ media?: {
6
+ title?: string;
7
+ artist?: string;
8
+ album?: string;
9
+ artworkUrl?: string;
10
+ };
11
+ /** Where playback is in the current item, in seconds, as of `positionUpdatedAt`. A player that
12
+ * is playing advances from there, so a UI interpolates instead of waiting for updates. */
13
+ position?: number;
14
+ /** Length of the current item, in seconds. Absent for a stream with no end. */
15
+ duration?: number;
16
+ /** ISO 8601: when `position` was true. */
17
+ positionUpdatedAt?: string;
18
+ /** Whether the player plays its queue in a random order. Absent when the player has no shuffle. */
19
+ shuffle?: boolean;
20
+ /** 0..1. Absent when the player has no volume control. */
21
+ volume?: number;
22
+ muted: boolean;
23
+ capabilities: {
24
+ volume: boolean;
25
+ mute: boolean;
26
+ next: boolean;
27
+ previous: boolean;
28
+ /** Has a browsable library (`Integration.browse`). */
29
+ browse: boolean;
30
+ /** The library can be searched (`BrowseQuery.search`). */
31
+ search: boolean;
32
+ /** Playback can be moved to a position (`seek`). */
33
+ seek: boolean;
34
+ /** Shuffle can be turned on and off (`setShuffle`). */
35
+ shuffle: boolean;
36
+ /** Playback can be moved to another player. */
37
+ transfer: boolean;
38
+ /** Can be grouped with other players. */
39
+ group: boolean;
40
+ };
41
+ }
42
+ export interface MediaPlayerCommands {
43
+ play: void;
44
+ pause: void;
45
+ togglePlay: void;
46
+ next: void;
47
+ previous: void;
48
+ /** `volume` is 0..1. */
49
+ setVolume: {
50
+ volume: number;
51
+ };
52
+ setMuted: {
53
+ muted: boolean;
54
+ };
55
+ /** `position` is in seconds. */
56
+ seek: {
57
+ position: number;
58
+ };
59
+ setShuffle: {
60
+ shuffle: boolean;
61
+ };
62
+ /** Plays a `BrowseItem` from this player's own library: `item` is its `id`. `mode` defaults to
63
+ * `play`: start it now. `replace` clears the queue first, `next` and `add` queue it. */
64
+ playMedia: {
65
+ item: string;
66
+ mode?: 'play' | 'replace' | 'next' | 'add';
67
+ };
68
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media-player.js","sourceRoot":"","sources":["../../src/model/media-player.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import type { EntityBase } from './base.ts';
2
+ /** Someone who lives here, and whether they are home. */
3
+ export interface PersonEntity extends EntityBase<'person'> {
4
+ /** Where they are: `home`, `away`, or the name of a zone. */
5
+ location: string;
6
+ home: boolean;
7
+ /** A picture of them, when the backend has one. */
8
+ pictureUrl?: string;
9
+ }
10
+ export type PersonCommands = Record<string, never>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"person.js","sourceRoot":"","sources":["../../src/model/person.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import type { EntityBase } from './base.ts';
2
+ export interface SensorEntity extends EntityBase<'sensor'> {
3
+ /** The reading as text (also for non-numeric sensors: `clear`, `on`). */
4
+ value: string;
5
+ /** The reading as a number, when it is one. */
6
+ numeric?: number;
7
+ unit?: string;
8
+ /** What is measured, e.g. `temperature`, `humidity`, `power`, `energy`. Open vocabulary. */
9
+ measurement?: string;
10
+ }
11
+ /** A sensor has no commands. */
12
+ export type SensorCommands = Record<string, never>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sensor.js","sourceRoot":"","sources":["../../src/model/sensor.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import type { EntityBase } from './base.ts';
2
+ /** Anything with two states that can be flipped: an outlet, a fan, a lock (on = locked). */
3
+ export interface SwitchEntity extends EntityBase<'switch'> {
4
+ on: boolean;
5
+ }
6
+ export interface SwitchCommands {
7
+ turnOn: void;
8
+ turnOff: void;
9
+ toggle: void;
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch.js","sourceRoot":"","sources":["../../src/model/switch.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import type { EntityBase } from './base.ts';
2
+ /** What the sky is doing now. A closed set so a UI can pick an icon for each; anything a backend
3
+ * reports that is not one of these is `unknown`. */
4
+ export declare const WEATHER_CONDITIONS: readonly ['sunny', 'clear-night', 'partlycloudy', 'cloudy', 'fog', 'rainy', 'pouring', 'snowy', 'snowy-rainy', 'hail', 'lightning', 'lightning-rainy', 'windy', 'exceptional', 'unknown'];
5
+ export type WeatherCondition = (typeof WEATHER_CONDITIONS)[number];
6
+ /** Current weather for a place. */
7
+ export interface WeatherEntity extends EntityBase<'weather'> {
8
+ condition: WeatherCondition;
9
+ /** In `unit`. Absent when the backend does not report it. */
10
+ temperature?: number;
11
+ /** `°C` or `°F`. */
12
+ unit?: string;
13
+ /** Percent. */
14
+ humidity?: number;
15
+ }
16
+ export type WeatherCommands = Record<string, never>;
@@ -0,0 +1,19 @@
1
+ /** What the sky is doing now. A closed set so a UI can pick an icon for each; anything a backend
2
+ * reports that is not one of these is `unknown`. */
3
+ export const WEATHER_CONDITIONS = [
4
+ 'sunny',
5
+ 'clear-night',
6
+ 'partlycloudy',
7
+ 'cloudy',
8
+ 'fog',
9
+ 'rainy',
10
+ 'pouring',
11
+ 'snowy',
12
+ 'snowy-rainy',
13
+ 'hail',
14
+ 'lightning',
15
+ 'lightning-rainy',
16
+ 'windy',
17
+ 'exceptional',
18
+ 'unknown',
19
+ ];
@@ -0,0 +1 @@
1
+ {"version":3,"file":"weather.js","sourceRoot":"","sources":["../../src/model/weather.ts"],"names":[],"mappings":"AAEA;oDACoD;AACpD,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,OAAO;IACP,aAAa;IACb,cAAc;IACd,QAAQ;IACR,KAAK;IACL,OAAO;IACP,SAAS;IACT,OAAO;IACP,aAAa;IACb,MAAM;IACN,WAAW;IACX,iBAAiB;IACjB,OAAO;IACP,aAAa;IACb,SAAS;CACD,CAAC"}
@@ -0,0 +1,61 @@
1
+ import type { EntityRef } from './entity.ts';
2
+ import type { ConnectionStatus } from './integration.ts';
3
+ import type { Entity } from './model/index.ts';
4
+ /** Where the runtime serves files an integration's entities point at (artwork, pictures). */
5
+ export declare const ASSET_PATH = "/_hashsome/asset";
6
+ /** The address a browser can load a backend's own file from: the runtime fetches it with the
7
+ * integration's credentials, so the backend need not be reachable or trusted by the browser.
8
+ * `path` is the backend's own path, e.g. `/api/image/serve/…`. */
9
+ export declare function assetUrl(integration: string, path: string): string;
10
+ /** Messages sent by the browser to the runtime's `/ws` endpoint. */
11
+ export type ClientMessage = {
12
+ type: 'subscribe';
13
+ ref: EntityRef;
14
+ } | {
15
+ type: 'unsubscribe';
16
+ ref: EntityRef;
17
+ } | {
18
+ type: 'command';
19
+ /** Client-chosen id echoed in the matching `result`. */
20
+ id: number;
21
+ ref: EntityRef;
22
+ command: string;
23
+ args?: Record<string, unknown>;
24
+ } | {
25
+ /** A read that is not a subscription: one level of a media library, or an entity's history, answered by `result`. */
26
+ type: 'query';
27
+ id: number;
28
+ ref: EntityRef;
29
+ query: 'browse' | 'history';
30
+ args?: Record<string, unknown>;
31
+ } | {
32
+ type: 'raw';
33
+ id: number;
34
+ integration: string;
35
+ request: Record<string, unknown>;
36
+ };
37
+ /** Messages sent by the runtime to the browser. `entity: null` means the entity does not exist (or
38
+ * was removed). */
39
+ export type ServerMessage = {
40
+ type: 'entity';
41
+ ref: EntityRef;
42
+ entity: Entity | null;
43
+ } | {
44
+ type: 'status';
45
+ integration: string;
46
+ status: ConnectionStatus;
47
+ } | {
48
+ type: 'result';
49
+ id: number;
50
+ ok: true;
51
+ data?: unknown;
52
+ } | {
53
+ type: 'result';
54
+ id: number;
55
+ ok: false;
56
+ error: string;
57
+ };
58
+ /** Parse and validate an untrusted client frame. Returns `undefined` if malformed. */
59
+ export declare function parseClientMessage(raw: string): ClientMessage | undefined;
60
+ export declare function parseServerMessage(raw: string): ServerMessage | undefined;
61
+ export declare const encodeMessage: (message: ClientMessage | ServerMessage) => string;