homey-lib 2.45.3 → 2.46.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/.eslintignore +2 -1
- package/assets/app/schema.d.ts +546 -0
- package/assets/app/schema.json +136 -0
- package/assets/capability/schema.d.ts +53 -0
- package/helpers/index.js +21 -0
- package/index.js +48 -24
- package/lib/App/index.js +184 -5
- package/lib/Capability/index.js +42 -0
- package/lib/Device/index.js +10 -0
- package/lib/Energy/index.js +6 -0
- package/lib/Media/index.js +3 -0
- package/lib/Signal/index.js +25 -0
- package/lib/Signal/validators.js +21 -0
- package/lib/Util/file.js +84 -0
- package/lib/Util/index.js +72 -0
- package/lib/Util/zigbee.js +225 -0
- package/package.json +11 -3
- package/tsconfig.types.json +15 -0
- package/types/assets/app/schema.d.ts +546 -0
- package/types/assets/capability/schema.d.ts +53 -0
- package/types/helpers/index.d.ts +12 -0
- package/types/helpers/index.d.ts.map +1 -0
- package/types/index.d.ts +24 -0
- package/types/index.d.ts.map +1 -0
- package/types/lib/App/index.d.ts +140 -0
- package/types/lib/App/index.d.ts.map +1 -0
- package/types/lib/Capability/index.d.ts +61 -0
- package/types/lib/Capability/index.d.ts.map +1 -0
- package/types/lib/Device/index.d.ts +18 -0
- package/types/lib/Device/index.d.ts.map +1 -0
- package/types/lib/Energy/index.d.ts +12 -0
- package/types/lib/Energy/index.d.ts.map +1 -0
- package/types/lib/Media/index.d.ts +8 -0
- package/types/lib/Media/index.d.ts.map +1 -0
- package/types/lib/Signal/index.d.ts +52 -0
- package/types/lib/Signal/index.d.ts.map +1 -0
- package/types/lib/Signal/validators.d.ts +37 -0
- package/types/lib/Signal/validators.d.ts.map +1 -0
- package/types/lib/Util/file.d.ts +27 -0
- package/types/lib/Util/file.d.ts.map +1 -0
- package/types/lib/Util/index.d.ts +76 -0
- package/types/lib/Util/index.d.ts.map +1 -0
- package/types/lib/Util/zigbee.d.ts +88 -0
- package/types/lib/Util/zigbee.d.ts.map +1 -0
- package/webpack/index.js +1 -1
- package/webpack.config.js +1 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
export = App;
|
|
2
|
+
declare class App {
|
|
3
|
+
static REQUIRED_PYTHON_PLATFORMS: string[];
|
|
4
|
+
static SUPPORTED_PYTHON_VERSIONS: string[];
|
|
5
|
+
/**
|
|
6
|
+
* @param {AppManifest} appJson
|
|
7
|
+
* @returns {void}
|
|
8
|
+
*/
|
|
9
|
+
static validatePythonVersion(appJson: AppManifest): void;
|
|
10
|
+
/**
|
|
11
|
+
* @param {string} titleFormatted
|
|
12
|
+
* @param {{ name: string }[]} args
|
|
13
|
+
* @param {string} errorPath
|
|
14
|
+
* @returns {void}
|
|
15
|
+
*/
|
|
16
|
+
static _checkTitleFormatted(titleFormatted: string, args: {
|
|
17
|
+
name: string;
|
|
18
|
+
}[], errorPath: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* @param {string} appId
|
|
21
|
+
* @returns {boolean}
|
|
22
|
+
*/
|
|
23
|
+
static isValidId(appId: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* @param {string} color
|
|
26
|
+
* @returns {boolean}
|
|
27
|
+
*/
|
|
28
|
+
static isValidBrandColor(color: string): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* @returns {Record<string, unknown>}
|
|
31
|
+
*/
|
|
32
|
+
static getJSONSchema(): Record<string, unknown>;
|
|
33
|
+
/**
|
|
34
|
+
* @returns {Record<string, Record<string, unknown>>}
|
|
35
|
+
*/
|
|
36
|
+
static getPermissions(): Record<string, Record<string, unknown>>;
|
|
37
|
+
/**
|
|
38
|
+
* @returns {string[]}
|
|
39
|
+
*/
|
|
40
|
+
static getCategories(): string[];
|
|
41
|
+
/**
|
|
42
|
+
* @returns {string[]}
|
|
43
|
+
*/
|
|
44
|
+
static getLocales(): string[];
|
|
45
|
+
/**
|
|
46
|
+
* @param {string} appId
|
|
47
|
+
* @returns {string}
|
|
48
|
+
*/
|
|
49
|
+
static getBrandColor(appId: string): string;
|
|
50
|
+
/**
|
|
51
|
+
* @param {Array<Record<string, unknown>> | undefined} errors
|
|
52
|
+
* @param {AppManifest} appJson
|
|
53
|
+
* @returns {string | null}
|
|
54
|
+
*/
|
|
55
|
+
static errorsText(errors: Array<Record<string, unknown>> | undefined, appJson: AppManifest): string | null;
|
|
56
|
+
/**
|
|
57
|
+
* @param {string} path
|
|
58
|
+
*/
|
|
59
|
+
constructor(path: string);
|
|
60
|
+
_path: string;
|
|
61
|
+
/**
|
|
62
|
+
* @param {...unknown} args
|
|
63
|
+
* @returns {void}
|
|
64
|
+
*/
|
|
65
|
+
debug(...args: unknown[]): void;
|
|
66
|
+
/**
|
|
67
|
+
* @param {{ level?: 'debug' | 'publish' | 'verified', debug?: boolean }} [options]
|
|
68
|
+
* @returns {Promise<void>}
|
|
69
|
+
*/
|
|
70
|
+
validate({ level, debug, }?: {
|
|
71
|
+
level?: "debug" | "publish" | "verified";
|
|
72
|
+
debug?: boolean;
|
|
73
|
+
}): Promise<void>;
|
|
74
|
+
_debug: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* @param {Record<string, unknown>} setting
|
|
77
|
+
* @param {{ id: string }} driver
|
|
78
|
+
* @returns {void}
|
|
79
|
+
*/
|
|
80
|
+
_checkPrivateSettingPrefixUse(setting: Record<string, unknown>, driver: {
|
|
81
|
+
id: string;
|
|
82
|
+
}): void;
|
|
83
|
+
/**
|
|
84
|
+
* @param {Record<string, unknown> | null | undefined} driver
|
|
85
|
+
* @param {Record<string, unknown> | null | undefined} setting
|
|
86
|
+
* @returns {void}
|
|
87
|
+
*/
|
|
88
|
+
_checkZwaveForSetting(driver: Record<string, unknown> | null | undefined, setting: Record<string, unknown> | null | undefined): void;
|
|
89
|
+
/**
|
|
90
|
+
* @param {string} filepath
|
|
91
|
+
* @returns {Promise<string[]>}
|
|
92
|
+
*/
|
|
93
|
+
_getDirectoryContents(filepath: string): Promise<string[]>;
|
|
94
|
+
/**
|
|
95
|
+
* @param {string} filepath
|
|
96
|
+
* @returns {Promise<void>}
|
|
97
|
+
*/
|
|
98
|
+
_ensureFileExistsCaseSensitive(filepath: string): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* @param {string} filepath
|
|
101
|
+
* @returns {Promise<boolean>}
|
|
102
|
+
*/
|
|
103
|
+
_fileExistsCaseSensitive(filepath: string): Promise<boolean>;
|
|
104
|
+
/**
|
|
105
|
+
* @param {{ small: string, large: string }} imagesObj
|
|
106
|
+
* @param {'app' | 'driver'} type
|
|
107
|
+
* @param {string} [errorPath]
|
|
108
|
+
* @returns {Promise<void>}
|
|
109
|
+
*/
|
|
110
|
+
_validateImages(imagesObj: {
|
|
111
|
+
small: string;
|
|
112
|
+
large: string;
|
|
113
|
+
}, type: "app" | "driver", errorPath?: string): Promise<void>;
|
|
114
|
+
/**
|
|
115
|
+
* @returns {Promise<void>}
|
|
116
|
+
*/
|
|
117
|
+
_validateModules(): Promise<void>;
|
|
118
|
+
/**
|
|
119
|
+
* @param {Record<string, unknown>} card
|
|
120
|
+
* @param {string} errorPath
|
|
121
|
+
* @param {AppManifest} appJson
|
|
122
|
+
* @param {{ levelPublish: boolean, levelVerified: boolean }} options
|
|
123
|
+
* @returns {void}
|
|
124
|
+
*/
|
|
125
|
+
_validateFlowCard(card: Record<string, unknown>, errorPath: string, appJson: AppManifest, { levelPublish, levelVerified }: {
|
|
126
|
+
levelPublish: boolean;
|
|
127
|
+
levelVerified: boolean;
|
|
128
|
+
}): void;
|
|
129
|
+
/**
|
|
130
|
+
* @param {string} filepath
|
|
131
|
+
* @param {number} numBytes
|
|
132
|
+
* @returns {Promise<Buffer>}
|
|
133
|
+
*/
|
|
134
|
+
_readBytes(filepath: string, numBytes: number): Promise<Buffer>;
|
|
135
|
+
}
|
|
136
|
+
declare namespace App {
|
|
137
|
+
export { AppManifest };
|
|
138
|
+
}
|
|
139
|
+
type AppManifest = import("../../assets/app/schema").App;
|
|
140
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/App/index.js"],"names":[],"mappings":";AA8EA;IACE,2CAAqD;IACrD,2CAAmD;IAsyBnD;;;OAGG;IACH,sCAHW,WAAW,GACT,IAAI,CAOhB;IA4PD;;;;;OAKG;IACH,4CALW,MAAM,QACN;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,aAClB,MAAM,GACJ,IAAI,CAkChB;IAiBD;;;OAGG;IACH,wBAHW,MAAM,GACJ,OAAO,CAQnB;IAED;;;OAGG;IACH,gCAHW,MAAM,GACJ,OAAO,CAInB;IAED;;OAEG;IACH,wBAFa,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMnC;IAED;;OAEG;IACH,yBAFa,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAcnD;IAED;;OAEG;IACH,wBAFa,MAAM,EAAE,CAIpB;IAED;;OAEG;IACH,qBAFa,MAAM,EAAE,CAKpB;IAED;;;OAGG;IACH,4BAHW,MAAM,GACJ,MAAM,CAuBlB;IAED;;;;OAIG;IACH,0BAJW,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,WAC1C,WAAW,GACT,MAAM,GAAG,IAAI,CAyDzB;IApvCD;;OAEG;IACH,kBAFW,MAAM,EAQhB;IALC,cAAiB;IAOnB;;;OAGG;IACH,eAHc,OAAO,EAAA,GACR,IAAI,CAKhB;IAED;;;OAGG;IACH,6BAHW;QAAE,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAC3D,OAAO,CAAC,IAAI,CAAC,CA4wBzB;IAtwBC,gBAAmB;IAmxBrB;;;;OAIG;IACH,uCAJW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,UACvB;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GACZ,IAAI,CAwBhB;IAED;;;;OAIG;IACH,8BAJW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,WAC1C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GACxC,IAAI,CAuBhB;IAED;;;OAGG;IACH,gCAHW,MAAM,GACJ,OAAO,CAAC,MAAM,EAAE,CAAC,CAY7B;IAED;;;OAGG;IACH,yCAHW,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAOzB;IAED;;;OAGG;IACH,mCAHW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAe5B;IAED;;;;;OAKG;IACH,2BALW;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,QAChC,KAAK,GAAG,QAAQ,cAChB,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CA6BzB;IAED;;OAEG;IACH,oBAFa,OAAO,CAAC,IAAI,CAAC,CAuBzB;IAED;;;;;;OAMG;IACH,wBANW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,aACvB,MAAM,WACN,WAAW,mCACX;QAAE,YAAY,EAAE,OAAO,CAAC;QAAC,aAAa,EAAE,OAAO,CAAA;KAAE,GAC/C,IAAI,CA+EhB;IA0CD;;;;OAIG;IACH,qBAJW,MAAM,YACN,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAU3B;CAwJF;;;;mBAtyCa,OAAO,yBAAyB,EAAE,GAAG"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export = Capability;
|
|
2
|
+
declare class Capability {
|
|
3
|
+
/**
|
|
4
|
+
* @returns {Record<string, unknown>}
|
|
5
|
+
*/
|
|
6
|
+
static getJSONSchema(): Record<string, unknown>;
|
|
7
|
+
/**
|
|
8
|
+
* @returns {Record<string, CapabilityDefinition>}
|
|
9
|
+
*/
|
|
10
|
+
static getCapabilities(): Record<string, CapabilityDefinition>;
|
|
11
|
+
/**
|
|
12
|
+
* @param {string} id
|
|
13
|
+
* @returns {CapabilityDefinition}
|
|
14
|
+
*/
|
|
15
|
+
static getCapability(id: string): CapabilityDefinition;
|
|
16
|
+
/**
|
|
17
|
+
* @param {string} id
|
|
18
|
+
* @returns {boolean}
|
|
19
|
+
*/
|
|
20
|
+
static hasCapability(id: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* @param {string} capabilityId
|
|
23
|
+
* @param {CapabilityDefinition} capability
|
|
24
|
+
* @returns {CapabilityDefinition}
|
|
25
|
+
*/
|
|
26
|
+
static _composeCapability(capabilityId: string, capability: CapabilityDefinition): CapabilityDefinition;
|
|
27
|
+
/**
|
|
28
|
+
* @param {string} capabilityIdToCheck
|
|
29
|
+
* @param {string} capabilityId
|
|
30
|
+
* @returns {boolean}
|
|
31
|
+
*/
|
|
32
|
+
static isInstanceOfId(capabilityIdToCheck: string, capabilityId: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* @param {string} capabilityId
|
|
35
|
+
* @returns {string}
|
|
36
|
+
*/
|
|
37
|
+
static getBaseId(capabilityId: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* @param {CapabilityDefinition} capability
|
|
40
|
+
*/
|
|
41
|
+
constructor(capability: CapabilityDefinition);
|
|
42
|
+
_capability: import("../../assets/capability/schema").Capability;
|
|
43
|
+
/**
|
|
44
|
+
* @param {...unknown} args
|
|
45
|
+
* @returns {void}
|
|
46
|
+
*/
|
|
47
|
+
debug(...args: unknown[]): void;
|
|
48
|
+
/**
|
|
49
|
+
* @param {{ debug?: boolean }} [options]
|
|
50
|
+
* @returns {Promise<void>}
|
|
51
|
+
*/
|
|
52
|
+
validate({ debug, }?: {
|
|
53
|
+
debug?: boolean;
|
|
54
|
+
}): Promise<void>;
|
|
55
|
+
_debug: boolean;
|
|
56
|
+
}
|
|
57
|
+
declare namespace Capability {
|
|
58
|
+
export { CapabilityDefinition };
|
|
59
|
+
}
|
|
60
|
+
type CapabilityDefinition = import("../../assets/capability/schema").Capability;
|
|
61
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/Capability/index.js"],"names":[],"mappings":";AAWA;IAsCE;;OAEG;IACH,wBAFa,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAKnC;IAED;;OAEG;IACH,0BAFa,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAchD;IAED;;;OAGG;IACH,yBAHW,MAAM,GACJ,oBAAoB,CAShC;IAED;;;OAGG;IACH,yBAHW,MAAM,GACJ,OAAO,CAKnB;IAED;;;;OAIG;IACH,wCAJW,MAAM,cACN,oBAAoB,GAClB,oBAAoB,CA2ChC;IAED;;;;OAIG;IACH,2CAJW,MAAM,gBACN,MAAM,GACJ,OAAO,CAMnB;IAED;;;OAGG;IACH,+BAHW,MAAM,GACJ,MAAM,CAKlB;IArJD;;OAEG;IACH,wBAFU,oBAAoB,EAI7B;IADC,iEAA6B;IAG/B;;;OAGG;IACH,eAHc,OAAO,EAAA,GACR,IAAI,CAKhB;IAED;;;OAGG;IACH,sBAHW;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GACjB,OAAO,CAAC,IAAI,CAAC,CAgBzB;IAXC,gBAAmB;CAgItB;;;;4BA9Ja,OAAO,gCAAgC,EAAE,UAAU"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export = Device;
|
|
2
|
+
declare class Device {
|
|
3
|
+
/**
|
|
4
|
+
* @returns {Record<string, Record<string, unknown>>}
|
|
5
|
+
*/
|
|
6
|
+
static getClasses(): Record<string, Record<string, unknown>>;
|
|
7
|
+
/**
|
|
8
|
+
* @param {string} id
|
|
9
|
+
* @returns {Record<string, unknown>}
|
|
10
|
+
*/
|
|
11
|
+
static getClass(id: string): Record<string, unknown>;
|
|
12
|
+
/**
|
|
13
|
+
* @returns {ReturnType<typeof Capability.getCapabilities>}
|
|
14
|
+
*/
|
|
15
|
+
static getCapabilities(): ReturnType<typeof Capability.getCapabilities>;
|
|
16
|
+
}
|
|
17
|
+
import Capability = require("../Capability");
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/Device/index.js"],"names":[],"mappings":";AAMA;IAEE;;OAEG;IACH,qBAFa,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAanD;IAED;;;OAGG;IACH,oBAHW,MAAM,GACJ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASnC;IAGD;;OAEG;IACH,0BAFa,UAAU,CAAC,OAAO,UAAU,CAAC,eAAe,CAAC,CAIzD;CAEF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export = Energy;
|
|
2
|
+
declare class Energy {
|
|
3
|
+
/**
|
|
4
|
+
* @returns {Record<string, Record<string, unknown>>}
|
|
5
|
+
*/
|
|
6
|
+
static getCurrencies(): Record<string, Record<string, unknown>>;
|
|
7
|
+
/**
|
|
8
|
+
* @returns {string[]}
|
|
9
|
+
*/
|
|
10
|
+
static getBatteries(): string[];
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/Energy/index.js"],"names":[],"mappings":";AAEA;IAEE;;OAEG;IACH,wBAFa,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAKnD;IAED;;OAEG;IACH,uBAFa,MAAM,EAAE,CAwBpB;CAEF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/Media/index.js"],"names":[],"mappings":";AAEA;IAEE;;OAEG;IACH,oBAFa,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAKnD;CAEF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export = Signal;
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {'433' | '868' | 'ir'} SignalFrequency
|
|
4
|
+
*/
|
|
5
|
+
declare class Signal {
|
|
6
|
+
/**
|
|
7
|
+
* @param {Record<string, unknown>} signal
|
|
8
|
+
* @param {{ frequency?: SignalFrequency }} [options]
|
|
9
|
+
*/
|
|
10
|
+
constructor(signal: Record<string, unknown>, { frequency }?: {
|
|
11
|
+
frequency?: SignalFrequency;
|
|
12
|
+
});
|
|
13
|
+
_signal: Record<string, unknown>;
|
|
14
|
+
_frequency: SignalFrequency;
|
|
15
|
+
/**
|
|
16
|
+
* @param {string} message
|
|
17
|
+
* @param {boolean} result
|
|
18
|
+
* @returns {void}
|
|
19
|
+
*/
|
|
20
|
+
_check(message: string, result: boolean): void;
|
|
21
|
+
/**
|
|
22
|
+
* @param {...unknown} args
|
|
23
|
+
* @returns {void}
|
|
24
|
+
*/
|
|
25
|
+
debug(...args: unknown[]): void;
|
|
26
|
+
/**
|
|
27
|
+
* @param {{ debug?: boolean }} [options]
|
|
28
|
+
* @returns {Promise<void>}
|
|
29
|
+
*/
|
|
30
|
+
validate({ debug, }?: {
|
|
31
|
+
debug?: boolean;
|
|
32
|
+
}): Promise<void>;
|
|
33
|
+
_debug: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* @param {Record<string, (value: unknown, signal: Record<string, unknown>) => { result: boolean, msg: string }>} validatorEngine
|
|
36
|
+
* @returns {void}
|
|
37
|
+
*/
|
|
38
|
+
_validateWithEngine(validatorEngine: Record<string, (value: unknown, signal: Record<string, unknown>) => {
|
|
39
|
+
result: boolean;
|
|
40
|
+
msg: string;
|
|
41
|
+
}>): void;
|
|
42
|
+
_validateProntohex(): void;
|
|
43
|
+
_validateRegular(): void;
|
|
44
|
+
_validate433(): void;
|
|
45
|
+
_validate868(): void;
|
|
46
|
+
_validateInfrared(): void;
|
|
47
|
+
}
|
|
48
|
+
declare namespace Signal {
|
|
49
|
+
export { SignalFrequency };
|
|
50
|
+
}
|
|
51
|
+
type SignalFrequency = "433" | "868" | "ir";
|
|
52
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/Signal/index.js"],"names":[],"mappings":";AAaA;;GAEG;AAEH;IAEE;;;OAGG;IACH,oBAHW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,kBACvB;QAAE,SAAS,CAAC,EAAE,eAAe,CAAA;KAAE,EAOzC;IAJC,iCAAqB;IACrB,4BAA2B;IAgB7B;;;;OAIG;IACH,gBAJW,MAAM,UACN,OAAO,GACL,IAAI,CAMhB;IApBD;;;OAGG;IACH,eAHc,OAAO,EAAA,GACR,IAAI,CAOhB;IAaD;;;OAGG;IACH,sBAHW;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GACjB,OAAO,CAAC,IAAI,CAAC,CAgCzB;IA3BC,gBAAmB;IA6BrB;;;OAGG;IACH,qCAHW,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,GACnG,IAAI,CAIhB;IAED,2BAIC;IAED,yBAKC;IAED,qBAGC;IAED,qBAGC;IAED,0BAEC;CAEF;;;;uBA7GY,KAAK,GAAG,KAAK,GAAG,IAAI"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type SignalDefinition = Record<string, unknown>;
|
|
2
|
+
export type ValidationResult = {
|
|
3
|
+
result: boolean;
|
|
4
|
+
msg: string;
|
|
5
|
+
};
|
|
6
|
+
export type Validator = (value: unknown, signal: SignalDefinition) => ValidationResult;
|
|
7
|
+
export type ValidatorEngine = Record<string, Validator>;
|
|
8
|
+
export type CheckFn = (message: string, result: boolean) => void;
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {Record<string, unknown>} SignalDefinition
|
|
11
|
+
* @typedef {{ result: boolean, msg: string }} ValidationResult
|
|
12
|
+
* @typedef {(value: unknown, signal: SignalDefinition) => ValidationResult} Validator
|
|
13
|
+
* @typedef {Record<string, Validator>} ValidatorEngine
|
|
14
|
+
* @typedef {(message: string, result: boolean) => void} CheckFn
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* @param {ValidatorEngine} validator
|
|
18
|
+
* @param {CheckFn} check
|
|
19
|
+
* @param {SignalDefinition} signal
|
|
20
|
+
* @returns {void}
|
|
21
|
+
*/
|
|
22
|
+
export function validate(validator: ValidatorEngine, check: CheckFn, signal: SignalDefinition): void;
|
|
23
|
+
/** @type {ValidatorEngine} */
|
|
24
|
+
export const genericValidator: ValidatorEngine;
|
|
25
|
+
/** @type {ValidatorEngine} */
|
|
26
|
+
export const irValidator: ValidatorEngine;
|
|
27
|
+
/** @type {ValidatorEngine} */
|
|
28
|
+
export const rfValidator: ValidatorEngine;
|
|
29
|
+
/** @type {ValidatorEngine} */
|
|
30
|
+
export const rf433Validator: ValidatorEngine;
|
|
31
|
+
/** @type {ValidatorEngine} */
|
|
32
|
+
export const rf868Validator: ValidatorEngine;
|
|
33
|
+
/** @type {ValidatorEngine} */
|
|
34
|
+
export const modulationValidator: ValidatorEngine;
|
|
35
|
+
/** @type {ValidatorEngine} */
|
|
36
|
+
export const prontoValidator: ValidatorEngine;
|
|
37
|
+
//# sourceMappingURL=validators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../lib/Signal/validators.js"],"names":[],"mappings":"+BAKa,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;+BACvB;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE;wBAChC,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,KAAK,gBAAgB;8BAC9D,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC;sBACzB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI;AALvD;;;;;;GAMG;AAGH;;;;;GAKG;AACH,oCALW,eAAe,SACf,OAAO,UACP,gBAAgB,GACd,IAAI,CAWhB;AA0DD,8BAA8B;AAC9B,+BADW,eAAe,CAwFxB;AAsJF,8BAA8B;AAC9B,0BADW,eAAe,CAUxB;AAvJF,8BAA8B;AAC9B,0BADW,eAAe,CAiDxB;AAmEF,8BAA8B;AAC9B,6BADW,eAAe,CAMxB;AAMF,8BAA8B;AAC9B,6BADW,eAAe,CAMxB;AA7EF,8BAA8B;AAC9B,kCADW,eAAe,CAiCxB;AAEF,8BAA8B;AAC9B,8BADW,eAAe,CAkBxB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculate a hex hash for the contents of a file.
|
|
3
|
+
* @param {string} filePath - Absolute or relative path to the file.
|
|
4
|
+
* @param {string} [hashName='sha256'] - Hash algorithm name (e.g. sha256).
|
|
5
|
+
* @returns {Promise<string>} Resolves with a hex-encoded digest.
|
|
6
|
+
*/
|
|
7
|
+
export function hashFile(filePath: string, hashName?: string): Promise<string>;
|
|
8
|
+
/**
|
|
9
|
+
* Create an integrity string for a file using an allowed hash algorithm.
|
|
10
|
+
* @param {string} filePath - Absolute or relative path to the file.
|
|
11
|
+
* @param {string} [hashName='sha256'] - Allowed hash algorithm name.
|
|
12
|
+
* @returns {Promise<string>} Resolves with `hashName:hexDigest`.
|
|
13
|
+
*/
|
|
14
|
+
export function getIntegrity(filePath: string, hashName?: string): Promise<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Validate file integrity using a `hashName:hexDigest` string.
|
|
17
|
+
* @param {string} filePath - Absolute or relative path to the file.
|
|
18
|
+
* @param {string} integrity - Hash name and hex digest separated by `:`.
|
|
19
|
+
* @returns {Promise<boolean>} Resolves with true when hashes match.
|
|
20
|
+
*/
|
|
21
|
+
export function validateIntegrity(filePath: string, integrity: string): Promise<boolean>;
|
|
22
|
+
export function getOTAFilePath({ appPath, driverId, fileName }: {
|
|
23
|
+
appPath: any;
|
|
24
|
+
driverId: any;
|
|
25
|
+
fileName: any;
|
|
26
|
+
}): string;
|
|
27
|
+
//# sourceMappingURL=file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../lib/Util/file.js"],"names":[],"mappings":"AAkBA;;;;;GAKG;AACH,mCAJW,MAAM,aACN,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAW3B;AAwBD;;;;;GAKG;AACH,uCAJW,MAAM,aACN,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAW3B;AArCD;;;;;GAKG;AACH,4CAJW,MAAM,aACN,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAgB5B;AAmBD;;;;WAEC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export = Util;
|
|
2
|
+
declare class Util {
|
|
3
|
+
/**
|
|
4
|
+
* @param {string} modelId
|
|
5
|
+
* @returns {string[]}
|
|
6
|
+
*/
|
|
7
|
+
static getPlatformLocalFeatures(modelId: string): string[];
|
|
8
|
+
/**
|
|
9
|
+
* @param {string} modelId
|
|
10
|
+
* @param {string[]} wantedFeatures
|
|
11
|
+
* @returns {string[]}
|
|
12
|
+
*/
|
|
13
|
+
static getMissingPlatformLocalFeatures(modelId: string, wantedFeatures: string[]): string[];
|
|
14
|
+
/**
|
|
15
|
+
* Create an integrity string for a file using an allowed hash algorithm.
|
|
16
|
+
* NOTE: This method is only available in Node.js environments.
|
|
17
|
+
* @param {string} filePath - Absolute or relative path to the file.
|
|
18
|
+
* @param {string} hashName - Allowed hash algorithm name.
|
|
19
|
+
* @returns {Promise<string>} Resolves with `hashName:hexDigest`.
|
|
20
|
+
*/
|
|
21
|
+
static getIntegrity(filePath: string, hashName: string): Promise<string>;
|
|
22
|
+
/**
|
|
23
|
+
* Validate file integrity using a `hashName:hexDigest` string.
|
|
24
|
+
* NOTE: This method is only available in Node.js environments.
|
|
25
|
+
* @param {string} filePath - Absolute or relative path to the file.
|
|
26
|
+
* @param {string} integrity - Hash name and hex digest separated by `:`.
|
|
27
|
+
* @returns {Promise<boolean>} Resolves with true when hashes match.
|
|
28
|
+
*/
|
|
29
|
+
static validateIntegrity(filePath: string, integrity: string): Promise<boolean>;
|
|
30
|
+
/**
|
|
31
|
+
* Parse the Zigbee OTA header from a file.
|
|
32
|
+
* NOTE: This method is only available in Node.js environments.
|
|
33
|
+
* @param {string} filePath - Absolute or relative path to the OTA file.
|
|
34
|
+
* @returns {Promise<import('./zigbee').ZigbeeOTAHeader>} Parsed header values.
|
|
35
|
+
*/
|
|
36
|
+
static parseZigbeeOTAHeader(filePath: string): Promise<import("./zigbee").ZigbeeOTAHeader>;
|
|
37
|
+
/**
|
|
38
|
+
* Validate a Zigbee OTA header against expected values.
|
|
39
|
+
* NOTE: This method is only available in Node.js environments.
|
|
40
|
+
* @param {object} options - Validation options.
|
|
41
|
+
* @param {string} options.filePath - Absolute or relative path to the OTA file.
|
|
42
|
+
* @param {number} [options.manufacturerCode] - Expected manufacturer code.
|
|
43
|
+
* @param {number} [options.fileVersion] - Expected file version.
|
|
44
|
+
* @param {number} [options.imageType] - Expected image type.
|
|
45
|
+
* @returns {Promise<import('./zigbee').ZigbeeOTAHeader>} Parsed header values.
|
|
46
|
+
*/
|
|
47
|
+
static validateZigbeeOTAHeader(options: {
|
|
48
|
+
filePath: string;
|
|
49
|
+
manufacturerCode?: number;
|
|
50
|
+
fileVersion?: number;
|
|
51
|
+
imageType?: number;
|
|
52
|
+
}): Promise<import("./zigbee").ZigbeeOTAHeader>;
|
|
53
|
+
/**
|
|
54
|
+
* Returns the expected file path for an OTA file based on app path, driver ID and file name.
|
|
55
|
+
* NOTE: This method is only available in Node.js environments.
|
|
56
|
+
* @param {object} options - File path options.
|
|
57
|
+
* @param {string} options.appPath - Absolute path to the app.
|
|
58
|
+
* @param {string} options.driverId - Driver ID.
|
|
59
|
+
* @param {string} options.fileName - OTA file name.
|
|
60
|
+
* @returns {string} Resolves with the expected file path.
|
|
61
|
+
*/
|
|
62
|
+
static getOTAFilePath({ appPath, driverId, fileName }: {
|
|
63
|
+
appPath: string;
|
|
64
|
+
driverId: string;
|
|
65
|
+
fileName: string;
|
|
66
|
+
}): string;
|
|
67
|
+
}
|
|
68
|
+
declare namespace Util {
|
|
69
|
+
let FEATURE_SPEAKER: string;
|
|
70
|
+
let FEATURE_LED_RING: string;
|
|
71
|
+
let FEATURE_NFC: string;
|
|
72
|
+
let FEATURE_MATTER: string;
|
|
73
|
+
let FEATURE_CAMERA_STREAMING: string;
|
|
74
|
+
let _platformLocalFeatures: Record<string, string[]>;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/Util/index.js"],"names":[],"mappings":";AAKA;IAEE;;;OAGG;IACH,yCAHW,MAAM,GACJ,MAAM,EAAE,CAIpB;IAED;;;;OAIG;IACH,gDAJW,MAAM,kBACN,MAAM,EAAE,GACN,MAAM,EAAE,CAKpB;IAED;;;;;;OAMG;IACH,8BAJW,MAAM,YACN,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAI3B;IAED;;;;;;OAMG;IACH,mCAJW,MAAM,aACN,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAI5B;IAED;;;;;OAKG;IACH,sCAHW,MAAM,GACJ,OAAO,CAAC,OAAO,UAAU,EAAE,eAAe,CAAC,CAIvD;IAED;;;;;;;;;OASG;IACH,wCANG;QAAwB,QAAQ,EAAxB,MAAM;QACW,gBAAgB,GAAjC,MAAM;QACW,WAAW,GAA5B,MAAM;QACW,SAAS,GAA1B,MAAM;KACd,GAAU,OAAO,CAAC,OAAO,UAAU,EAAE,eAAe,CAAC,CAIvD;IAED;;;;;;;;OAQG;IACH,uDALG;QAAwB,OAAO,EAAvB,MAAM;QACU,QAAQ,EAAxB,MAAM;QACU,QAAQ,EAAxB,MAAM;KACd,GAAU,MAAM,CAIlB;CAEF;;;;;;;gCAOU,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export type ZigbeeOTAHeader = {
|
|
2
|
+
/**
|
|
3
|
+
* - File size in bytes.
|
|
4
|
+
*/
|
|
5
|
+
fileSize: number;
|
|
6
|
+
/**
|
|
7
|
+
* - OTA file identifier.
|
|
8
|
+
*/
|
|
9
|
+
fileIdentifier: number;
|
|
10
|
+
/**
|
|
11
|
+
* - OTA header version.
|
|
12
|
+
*/
|
|
13
|
+
headerVersion: number;
|
|
14
|
+
/**
|
|
15
|
+
* - OTA header length in bytes.
|
|
16
|
+
*/
|
|
17
|
+
headerLength: number;
|
|
18
|
+
/**
|
|
19
|
+
* - Field control bitmask.
|
|
20
|
+
*/
|
|
21
|
+
fieldControl: number;
|
|
22
|
+
/**
|
|
23
|
+
* - Manufacturer code.
|
|
24
|
+
*/
|
|
25
|
+
manufacturerCode: number;
|
|
26
|
+
/**
|
|
27
|
+
* - Image type.
|
|
28
|
+
*/
|
|
29
|
+
imageType: number;
|
|
30
|
+
/**
|
|
31
|
+
* - File version.
|
|
32
|
+
*/
|
|
33
|
+
fileVersion: number;
|
|
34
|
+
/**
|
|
35
|
+
* - Zigbee stack version.
|
|
36
|
+
*/
|
|
37
|
+
zigbeeStackVersion: number;
|
|
38
|
+
/**
|
|
39
|
+
* - Header string (ASCII).
|
|
40
|
+
*/
|
|
41
|
+
headerString: string;
|
|
42
|
+
/**
|
|
43
|
+
* - Total image size in bytes.
|
|
44
|
+
*/
|
|
45
|
+
totalImageSize: number;
|
|
46
|
+
/**
|
|
47
|
+
* - Security credential version.
|
|
48
|
+
*/
|
|
49
|
+
securityCredentialVersion?: number;
|
|
50
|
+
/**
|
|
51
|
+
* - Destination EUI64 hex string.
|
|
52
|
+
*/
|
|
53
|
+
upgradeFileDestination?: string;
|
|
54
|
+
/**
|
|
55
|
+
* - Minimum hardware version.
|
|
56
|
+
*/
|
|
57
|
+
minimumHardwareVersion?: number;
|
|
58
|
+
/**
|
|
59
|
+
* - Maximum hardware version.
|
|
60
|
+
*/
|
|
61
|
+
maximumHardwareVersion?: number;
|
|
62
|
+
/**
|
|
63
|
+
* - Unparsed header bytes.
|
|
64
|
+
*/
|
|
65
|
+
remainingHeaderBytes: number;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Parse the Zigbee OTA header from a file.
|
|
69
|
+
* @param {string} filePath - Absolute or relative path to the OTA file.
|
|
70
|
+
* @returns {Promise<ZigbeeOTAHeader>} Parsed header values.
|
|
71
|
+
*/
|
|
72
|
+
export function parseZigbeeOTAHeader(filePath: string): Promise<ZigbeeOTAHeader>;
|
|
73
|
+
/**
|
|
74
|
+
* Validate a Zigbee OTA header against expected values.
|
|
75
|
+
* @param {object} options - Validation options.
|
|
76
|
+
* @param {string} options.filePath - Absolute or relative path to the OTA file.
|
|
77
|
+
* @param {number} [options.manufacturerCode] - Expected manufacturer code.
|
|
78
|
+
* @param {number} [options.fileVersion] - Expected file version.
|
|
79
|
+
* @param {number} [options.imageType] - Expected image type.
|
|
80
|
+
* @returns {Promise<ZigbeeOTAHeader>} Parsed header values.
|
|
81
|
+
*/
|
|
82
|
+
export function validateZigbeeOTAHeader({ filePath, manufacturerCode, fileVersion, imageType, }?: {
|
|
83
|
+
filePath: string;
|
|
84
|
+
manufacturerCode?: number;
|
|
85
|
+
fileVersion?: number;
|
|
86
|
+
imageType?: number;
|
|
87
|
+
}): Promise<ZigbeeOTAHeader>;
|
|
88
|
+
//# sourceMappingURL=zigbee.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zigbee.d.ts","sourceRoot":"","sources":["../../../lib/Util/zigbee.js"],"names":[],"mappings":";;;;cAgBc,MAAM;;;;oBACN,MAAM;;;;mBACN,MAAM;;;;kBACN,MAAM;;;;kBACN,MAAM;;;;sBACN,MAAM;;;;eACN,MAAM;;;;iBACN,MAAM;;;;wBACN,MAAM;;;;kBACN,MAAM;;;;oBACN,MAAM;;;;gCACN,MAAM;;;;6BACN,MAAM;;;;6BACN,MAAM;;;;6BACN,MAAM;;;;0BACN,MAAM;;AAuBpB;;;;GAIG;AACH,+CAHW,MAAM,GACJ,OAAO,CAAC,eAAe,CAAC,CAmGpC;AAED;;;;;;;;GAQG;AACH,kGANG;IAAwB,QAAQ,EAAxB,MAAM;IACW,gBAAgB,GAAjC,MAAM;IACW,WAAW,GAA5B,MAAM;IACW,SAAS,GAA1B,MAAM;CACd,GAAU,OAAO,CAAC,eAAe,CAAC,CAsDpC"}
|