@nubisco/openbridge-sdk 0.29.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nubisco Lda
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # @nubisco/openbridge-sdk
2
+
3
+ Plugin authoring SDK: the `definePlugin()` helper with full TypeScript types. This is the package plugin authors depend on.
4
+
5
+ Part of [OpenBridge](https://github.com/nubisco/openbridge), a local-first home automation bridge for developers.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ npm install @nubisco/openbridge-sdk
11
+ ```
12
+
13
+ Requires Node.js >= 20.
14
+
15
+ ## Documentation
16
+
17
+ See the [OpenBridge documentation](https://github.com/nubisco/openbridge#readme). This package is published from the OpenBridge monorepo and versioned in lockstep with the `openbridge` daemon.
18
+
19
+ ## License
20
+
21
+ MIT (c) Jose Silva
@@ -0,0 +1,49 @@
1
+ export type { Plugin, PluginManifest, PluginContext, PluginLogger, DeviceDescriptor } from '@nubisco/openbridge-core';
2
+ export type { Service, Characteristic, CharacteristicValue, WithUUID, Categories } from 'hap-nodejs';
3
+ export { Accessory } from 'hap-nodejs';
4
+ import type { Accessory, Service as HAPService } from 'hap-nodejs';
5
+ /**
6
+ * Extended accessory with context storage and subtype service lookup.
7
+ * This mirrors the Homebridge PlatformAccessory interface so plugins
8
+ * can work with both OpenBridge and Homebridge.
9
+ */
10
+ export interface PlatformAccessory extends Accessory {
11
+ context: Record<string, unknown>;
12
+ getServiceByUUIDAndSubType(uuid: HAPService | string, subtype: string): HAPService | undefined;
13
+ configureController(controller: unknown): void;
14
+ }
15
+ /**
16
+ * Logger interface for plugin use.
17
+ * Compatible with both OpenBridge's PluginLogger and Homebridge's Logger.
18
+ */
19
+ export interface Logger {
20
+ info(message: string, ...args: unknown[]): void;
21
+ warn(message: string, ...args: unknown[]): void;
22
+ error(message: string, ...args: unknown[]): void;
23
+ debug(message: string, ...args: unknown[]): void;
24
+ log?(level: string, message: string, ...args: unknown[]): void;
25
+ success?(message: string, ...args: unknown[]): void;
26
+ }
27
+ /**
28
+ * API shim interface for platform plugins.
29
+ * Provides the HAP surface that platform plugins need to register accessories.
30
+ */
31
+ export interface API {
32
+ hap: typeof import('hap-nodejs');
33
+ on(event: string, listener: (...args: unknown[]) => void): void;
34
+ emit(event: string, ...args: unknown[]): void;
35
+ registerPlatformAccessories(pluginName: string, platformName: string, accessories: unknown[]): void;
36
+ unregisterPlatformAccessories(pluginName: string, platformName: string, accessories: unknown[]): void;
37
+ updatePlatformAccessories(accessories: unknown[]): void;
38
+ platformAccessory: unknown;
39
+ user: {
40
+ storagePath(): string;
41
+ configPath(): string;
42
+ persistPath(): string;
43
+ cachedAccessoryPath(): string;
44
+ };
45
+ versionGreaterOrEqual?(version: string): boolean;
46
+ }
47
+ /** Define a plugin with type safety */
48
+ export declare function definePlugin(plugin: import('@nubisco/openbridge-core').Plugin): import('@nubisco/openbridge-core').Plugin;
49
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAIrH,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACpG,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAEtC,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAA;AAElE;;;;GAIG;AACH,MAAM,WAAW,iBAAkB,SAAQ,SAAS;IAClD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,0BAA0B,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAA;IAC9F,mBAAmB,CAAC,UAAU,EAAE,OAAO,GAAG,IAAI,CAAA;CAC/C;AAED;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;IAC/C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;IAC/C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;IAChD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;IAChD,GAAG,CAAC,CAA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──────────────────────────────────────────────────────────────────
3
+ /** Define a plugin with type safety */
4
+ export function definePlugin(plugin) {
5
+ return plugin;
6
+ }
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAiDtC,gFAAgF;AAEhF,uCAAuC;AACvC,MAAM,UAAU,YAAY,CAC1B,MAAiD;IAEjD,OAAO,MAAM,CAAA;AACf,CAAC"}
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@nubisco/openbridge-sdk",
3
+ "version": "0.29.0",
4
+ "description": "Plugin authoring SDK for OpenBridge — definePlugin() helper with full TypeScript types",
5
+ "author": "José Silva <jose@nubisco.io>",
6
+ "license": "MIT",
7
+ "homepage": "https://github.com/nubisco/openbridge#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/nubisco/openbridge.git",
11
+ "directory": "packages/sdk"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/nubisco/openbridge/issues"
15
+ },
16
+ "keywords": [
17
+ "homekit",
18
+ "home-automation",
19
+ "plugin",
20
+ "sdk",
21
+ "typescript",
22
+ "openbridge"
23
+ ],
24
+ "type": "module",
25
+ "main": "./dist/index.js",
26
+ "types": "./dist/index.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "import": "./dist/index.js",
30
+ "types": "./dist/index.d.ts"
31
+ }
32
+ },
33
+ "files": [
34
+ "dist/",
35
+ "README.md",
36
+ "LICENSE"
37
+ ],
38
+ "engines": {
39
+ "node": ">=20"
40
+ },
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "dependencies": {
45
+ "hap-nodejs": ">=0.12.0",
46
+ "@nubisco/openbridge-core": "0.29.0"
47
+ },
48
+ "devDependencies": {
49
+ "typescript": "^5.4.0",
50
+ "@types/node": "^20.0.0"
51
+ },
52
+ "scripts": {
53
+ "build": "tsc",
54
+ "dev": "tsc --watch",
55
+ "typecheck": "tsc --noEmit"
56
+ }
57
+ }