@nebulahome/integration-sdk 1.0.0 → 1.2.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/CHANGELOG.md +29 -0
- package/FILES.md +73 -3
- package/README.md +3 -2
- package/dist/chunks/node-dist.js +1842 -100
- package/dist/chunks/node-index.d.ts +86 -10
- package/dist/chunks/node-project.js +2 -2
- package/dist/index.d.ts +19 -0
- package/dist/schemas.d.ts +71 -6
- package/dist/schemas.js +1 -1
- package/dist/testing.d.ts +20 -1
- package/dist/testing.js +22 -2
- package/package.json +3 -3
- package/schemas/discovery.schema.json +327 -5
- package/schemas/driver.schema.json +2 -1
- package/schemas/manifest.schema.json +16 -3
- package/schemas/profile.schema.json +114 -0
|
@@ -221,6 +221,20 @@ declare const declaredCapabilitiesSchema: z.ZodRecord<z.ZodEnum<{
|
|
|
221
221
|
}> & z.core.$partial, z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
|
|
222
222
|
/** What an entity declares it can do, with the device's own limits for each. */
|
|
223
223
|
type DeclaredCapabilities = z.output<typeof declaredCapabilitiesSchema>;
|
|
224
|
+
/**
|
|
225
|
+
* What lets an entity be told apart from the same reading reached another way: its own key in its
|
|
226
|
+
* transport's terms - `switch:0` on a Shelly - and where it sits in Matter.
|
|
227
|
+
*/
|
|
228
|
+
declare const entityLinkHintSchema: z.ZodObject<{
|
|
229
|
+
key: z.ZodOptional<z.ZodString>;
|
|
230
|
+
matter: z.ZodOptional<z.ZodObject<{
|
|
231
|
+
endpoint: z.ZodInt;
|
|
232
|
+
cluster: z.ZodInt;
|
|
233
|
+
attribute: z.ZodInt;
|
|
234
|
+
}, z.core.$strict>>;
|
|
235
|
+
}, z.core.$strict>;
|
|
236
|
+
/** What lets an entity be told apart from the same reading reached another way. */
|
|
237
|
+
type EntityLinkHint = z.output<typeof entityLinkHintSchema>;
|
|
224
238
|
//#endregion
|
|
225
239
|
//#region ../contracts/dist/entity-state.d.ts
|
|
226
240
|
/**
|
|
@@ -685,9 +699,10 @@ type IntegrationSetup = z.output<typeof integrationSetupSchema>;
|
|
|
685
699
|
/**
|
|
686
700
|
* The wires the interface names on a vendor's card: what a person recognises on the box, whatever
|
|
687
701
|
* transport of the platform's or of the vendor's own carries it. `udp` is a device's own protocol
|
|
688
|
-
* over plain datagrams on the network (Govee's LAN API), `modbus` Modbus TCP
|
|
702
|
+
* over plain datagrams on the network (Govee's LAN API), `modbus` Modbus TCP, `matter` the
|
|
703
|
+
* house's Matter fabric.
|
|
689
704
|
*/
|
|
690
|
-
declare const TRANSPORT_WIRES: readonly ["http", "mqtt", "ble", "zigbee", "udp", "modbus"];
|
|
705
|
+
declare const TRANSPORT_WIRES: readonly ["http", "mqtt", "ble", "zigbee", "udp", "modbus", "matter"];
|
|
691
706
|
/** A wire the interface names. */
|
|
692
707
|
type TransportWire = (typeof TRANSPORT_WIRES)[number];
|
|
693
708
|
/**
|
|
@@ -698,8 +713,8 @@ declare const integrationInstallSchema: z.ZodObject<{
|
|
|
698
713
|
build: z.ZodString;
|
|
699
714
|
version: z.ZodString;
|
|
700
715
|
source: z.ZodEnum<{
|
|
701
|
-
local: "local";
|
|
702
716
|
index: "index";
|
|
717
|
+
local: "local";
|
|
703
718
|
}>;
|
|
704
719
|
artifactSha256: z.ZodString;
|
|
705
720
|
installedAt: z.ZodISODateTime;
|
|
@@ -914,6 +929,8 @@ type EntityDescriptor = {
|
|
|
914
929
|
readonly deviceClass?: string;
|
|
915
930
|
readonly stateClass?: EntityStateClass;
|
|
916
931
|
readonly displayPrecision?: number;
|
|
932
|
+
/** What links it to the same reading reached another way. */
|
|
933
|
+
readonly link?: EntityLinkHint;
|
|
917
934
|
};
|
|
918
935
|
/** What a claimed device turns out to be. */
|
|
919
936
|
type DeviceDescriptor = {
|
|
@@ -923,6 +940,9 @@ type DeviceDescriptor = {
|
|
|
923
940
|
readonly model?: string;
|
|
924
941
|
readonly swVersion?: string;
|
|
925
942
|
readonly hwVersion?: string;
|
|
943
|
+
/** The hardware's MAC address, lower case with colons, when it says one. */
|
|
944
|
+
readonly mac?: string;
|
|
945
|
+
readonly serialNumber?: string;
|
|
926
946
|
/**
|
|
927
947
|
* The device this one is reached through, named the way this integration names devices.
|
|
928
948
|
*
|
|
@@ -1647,16 +1667,21 @@ declare const vendorManifestSchema: z.ZodObject<{
|
|
|
1647
1667
|
padding: number;
|
|
1648
1668
|
}>>>;
|
|
1649
1669
|
internetRequired: z.ZodDefault<z.ZodBoolean>;
|
|
1670
|
+
twins: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1671
|
+
mac: "mac";
|
|
1672
|
+
serial: "serial";
|
|
1673
|
+
}>>>;
|
|
1650
1674
|
setup: z.ZodOptional<z.ZodString>;
|
|
1651
1675
|
account: z.ZodOptional<z.ZodString>;
|
|
1652
1676
|
transports: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
1653
1677
|
module: z.ZodString;
|
|
1654
1678
|
wires: z.ZodArray<z.ZodEnum<{
|
|
1679
|
+
udp: "udp";
|
|
1680
|
+
matter: "matter";
|
|
1655
1681
|
http: "http";
|
|
1656
1682
|
mqtt: "mqtt";
|
|
1657
1683
|
ble: "ble";
|
|
1658
1684
|
zigbee: "zigbee";
|
|
1659
|
-
udp: "udp";
|
|
1660
1685
|
modbus: "modbus";
|
|
1661
1686
|
}>>;
|
|
1662
1687
|
}, z.core.$strict>]>>>;
|
|
@@ -1748,6 +1773,7 @@ declare const bundleManifestSchema: z.ZodObject<{
|
|
|
1748
1773
|
kind: z.ZodEnum<{
|
|
1749
1774
|
declarative: "declarative";
|
|
1750
1775
|
code: "code";
|
|
1776
|
+
matter: "matter";
|
|
1751
1777
|
}>;
|
|
1752
1778
|
defaultIcon: z.ZodOptional<z.ZodString>;
|
|
1753
1779
|
webPagePort: z.ZodOptional<z.ZodInt>;
|
|
@@ -1793,12 +1819,12 @@ type TemplateReference = {
|
|
|
1793
1819
|
//#region ../package-runtime/dist/discovery.d.ts
|
|
1794
1820
|
/** Validates a whole `discovery.json`. */
|
|
1795
1821
|
declare const vendorDiscoverySchema: z.ZodObject<{
|
|
1796
|
-
listen: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
1822
|
+
listen: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
1797
1823
|
mdns: z.ZodString;
|
|
1798
1824
|
}, z.core.$strict>, z.ZodObject<{
|
|
1799
1825
|
module: z.ZodString;
|
|
1800
1826
|
lan: z.ZodDefault<z.ZodBoolean>;
|
|
1801
|
-
}, z.core.$strict>]
|
|
1827
|
+
}, z.core.$strict>]>>>;
|
|
1802
1828
|
match: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
1803
1829
|
path: z.ZodString;
|
|
1804
1830
|
equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
@@ -1811,6 +1837,16 @@ declare const vendorDiscoverySchema: z.ZodObject<{
|
|
|
1811
1837
|
}, z.core.$strict>, z.ZodObject<{
|
|
1812
1838
|
path: z.ZodString;
|
|
1813
1839
|
startsWith: z.ZodString;
|
|
1840
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1841
|
+
path: z.ZodString;
|
|
1842
|
+
endsWith: z.ZodString;
|
|
1843
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1844
|
+
path: z.ZodString;
|
|
1845
|
+
contains: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
1846
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1847
|
+
path: z.ZodString;
|
|
1848
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
1849
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
1814
1850
|
}, z.core.$strict>]>>>;
|
|
1815
1851
|
probe: z.ZodOptional<z.ZodObject<{
|
|
1816
1852
|
transport: z.ZodString;
|
|
@@ -1818,12 +1854,41 @@ declare const vendorDiscoverySchema: z.ZodObject<{
|
|
|
1818
1854
|
args: z.ZodDefault<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
|
|
1819
1855
|
timeoutMs: z.ZodOptional<z.ZodInt>;
|
|
1820
1856
|
}, z.core.$strict>>;
|
|
1821
|
-
identity: z.ZodObject<{
|
|
1857
|
+
identity: z.ZodDefault<z.ZodObject<{
|
|
1822
1858
|
model: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
1823
1859
|
externalId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
1824
1860
|
name: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
1825
1861
|
swVersion: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
1826
|
-
|
|
1862
|
+
mac: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
1863
|
+
serialNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
1864
|
+
auth: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
1865
|
+
}, z.core.$strict>>;
|
|
1866
|
+
matter: z.ZodOptional<z.ZodObject<{
|
|
1867
|
+
match: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
1868
|
+
path: z.ZodString;
|
|
1869
|
+
equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
1870
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1871
|
+
path: z.ZodString;
|
|
1872
|
+
exists: z.ZodLiteral<true>;
|
|
1873
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1874
|
+
path: z.ZodString;
|
|
1875
|
+
oneOf: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
1876
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1877
|
+
path: z.ZodString;
|
|
1878
|
+
startsWith: z.ZodString;
|
|
1879
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1880
|
+
path: z.ZodString;
|
|
1881
|
+
endsWith: z.ZodString;
|
|
1882
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1883
|
+
path: z.ZodString;
|
|
1884
|
+
contains: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
1885
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1886
|
+
path: z.ZodString;
|
|
1887
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
1888
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
1889
|
+
}, z.core.$strict>]>>;
|
|
1890
|
+
model: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
1891
|
+
}, z.core.$strict>>;
|
|
1827
1892
|
adopt: z.ZodDefault<z.ZodEnum<{
|
|
1828
1893
|
owner: "owner";
|
|
1829
1894
|
automatic: "automatic";
|
|
@@ -1842,6 +1907,11 @@ type DiscoveryDriver = {
|
|
|
1842
1907
|
readonly id: string;
|
|
1843
1908
|
/** The driver's own name, offered as its one model when it lists none. */
|
|
1844
1909
|
readonly name: string;
|
|
1910
|
+
/**
|
|
1911
|
+
* What reaches its devices. A driver on the `matter` transport takes only Matter devices, and no
|
|
1912
|
+
* other driver does.
|
|
1913
|
+
*/
|
|
1914
|
+
readonly transport: string;
|
|
1845
1915
|
readonly models: readonly string[];
|
|
1846
1916
|
readonly modelCodes?: Readonly<Record<string, string | readonly string[]>> | undefined;
|
|
1847
1917
|
};
|
|
@@ -1864,6 +1934,11 @@ type SightingIdentity = {
|
|
|
1864
1934
|
readonly name: string | null;
|
|
1865
1935
|
readonly modelCode: string | null;
|
|
1866
1936
|
readonly swVersion: string | null;
|
|
1937
|
+
/** Lower case with colons. */
|
|
1938
|
+
readonly mac: string | null;
|
|
1939
|
+
readonly serialNumber: string | null;
|
|
1940
|
+
/** Whether it said it is behind a password; false when it did not say. */
|
|
1941
|
+
readonly needsPassword: boolean;
|
|
1867
1942
|
};
|
|
1868
1943
|
/** The driver a device belongs to, and which of its models it is. */
|
|
1869
1944
|
type Association = {
|
|
@@ -1974,9 +2049,10 @@ type LoadedBundle = {
|
|
|
1974
2049
|
* `installed` is the data directory's `hub/integrations`: where the platform installs a vendor
|
|
1975
2050
|
* from the integrations index or its local folder, and the only place a production hub reads.
|
|
1976
2051
|
* `development` is a directory of bundles under development - an integration repository's
|
|
1977
|
-
* `dist/`, named in the hub's `HUB_DEV_BUNDLE_DIR` - read beside it.
|
|
2052
|
+
* `dist/`, named in the hub's `HUB_DEV_BUNDLE_DIR` - read beside it. `platform` is no place at
|
|
2053
|
+
* all: the vendor the hub is itself, `matter`, built in code.
|
|
1978
2054
|
*/
|
|
1979
|
-
type BundleOrigin = 'development' | 'installed';
|
|
2055
|
+
type BundleOrigin = 'development' | 'installed' | 'platform';
|
|
1980
2056
|
/** Where a vendor's devices announce themselves, ready to listen to. */
|
|
1981
2057
|
type LoadedListenSource = {
|
|
1982
2058
|
readonly kind: 'mdns';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __toESM } from "./node-rolldown-runtime.js";
|
|
2
|
-
import {
|
|
2
|
+
import { f as defineAccount, r as require_semver } from "./node-dist.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { readFile, stat } from "node:fs/promises";
|
|
5
5
|
import path from "node:path";
|
|
@@ -89,7 +89,7 @@ function defineTransport(spec) {
|
|
|
89
89
|
* bundle built with this SDK says `^<major>.<minor>.0`.
|
|
90
90
|
*/
|
|
91
91
|
/** The SDK's own version: `1.0.0`, or a prerelease of it. */
|
|
92
|
-
const SDK_VERSION = "1.
|
|
92
|
+
const SDK_VERSION = "1.2.0";
|
|
93
93
|
/**
|
|
94
94
|
* The runtime range a bundle built with this SDK declares: this version's major and minor, so a
|
|
95
95
|
* platform with the same contract or a later one of the same major loads it.
|
package/dist/index.d.ts
CHANGED
|
@@ -221,6 +221,20 @@ declare const declaredCapabilitiesSchema: z.ZodRecord<z.ZodEnum<{
|
|
|
221
221
|
}> & z.core.$partial, z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
|
|
222
222
|
/** What an entity declares it can do, with the device's own limits for each. */
|
|
223
223
|
type DeclaredCapabilities = z.output<typeof declaredCapabilitiesSchema>;
|
|
224
|
+
/**
|
|
225
|
+
* What lets an entity be told apart from the same reading reached another way: its own key in its
|
|
226
|
+
* transport's terms - `switch:0` on a Shelly - and where it sits in Matter.
|
|
227
|
+
*/
|
|
228
|
+
declare const entityLinkHintSchema: z.ZodObject<{
|
|
229
|
+
key: z.ZodOptional<z.ZodString>;
|
|
230
|
+
matter: z.ZodOptional<z.ZodObject<{
|
|
231
|
+
endpoint: z.ZodInt;
|
|
232
|
+
cluster: z.ZodInt;
|
|
233
|
+
attribute: z.ZodInt;
|
|
234
|
+
}, z.core.$strict>>;
|
|
235
|
+
}, z.core.$strict>;
|
|
236
|
+
/** What lets an entity be told apart from the same reading reached another way. */
|
|
237
|
+
type EntityLinkHint = z.output<typeof entityLinkHintSchema>;
|
|
224
238
|
//#endregion
|
|
225
239
|
//#region ../contracts/dist/entity-state.d.ts
|
|
226
240
|
/**
|
|
@@ -680,6 +694,8 @@ type EntityDescriptor = {
|
|
|
680
694
|
readonly deviceClass?: string;
|
|
681
695
|
readonly stateClass?: EntityStateClass;
|
|
682
696
|
readonly displayPrecision?: number;
|
|
697
|
+
/** What links it to the same reading reached another way. */
|
|
698
|
+
readonly link?: EntityLinkHint;
|
|
683
699
|
};
|
|
684
700
|
/** What a claimed device turns out to be. */
|
|
685
701
|
type DeviceDescriptor = {
|
|
@@ -689,6 +705,9 @@ type DeviceDescriptor = {
|
|
|
689
705
|
readonly model?: string;
|
|
690
706
|
readonly swVersion?: string;
|
|
691
707
|
readonly hwVersion?: string;
|
|
708
|
+
/** The hardware's MAC address, lower case with colons, when it says one. */
|
|
709
|
+
readonly mac?: string;
|
|
710
|
+
readonly serialNumber?: string;
|
|
692
711
|
/**
|
|
693
712
|
* The device this one is reached through, named the way this integration names devices.
|
|
694
713
|
*
|
package/dist/schemas.d.ts
CHANGED
|
@@ -20,16 +20,21 @@ export declare const BUNDLE_FILE_SCHEMAS: {
|
|
|
20
20
|
padding: number;
|
|
21
21
|
}>>>;
|
|
22
22
|
internetRequired: z.ZodDefault<z.ZodBoolean>;
|
|
23
|
+
twins: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
24
|
+
mac: "mac";
|
|
25
|
+
serial: "serial";
|
|
26
|
+
}>>>;
|
|
23
27
|
setup: z.ZodOptional<z.ZodString>;
|
|
24
28
|
account: z.ZodOptional<z.ZodString>;
|
|
25
29
|
transports: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
26
30
|
module: z.ZodString;
|
|
27
31
|
wires: z.ZodArray<z.ZodEnum<{
|
|
32
|
+
udp: "udp";
|
|
33
|
+
matter: "matter";
|
|
28
34
|
http: "http";
|
|
29
35
|
mqtt: "mqtt";
|
|
30
36
|
ble: "ble";
|
|
31
37
|
zigbee: "zigbee";
|
|
32
|
-
udp: "udp";
|
|
33
38
|
modbus: "modbus";
|
|
34
39
|
}>>;
|
|
35
40
|
}, z.core.$strict>]>>>;
|
|
@@ -110,6 +115,7 @@ export declare const BUNDLE_FILE_SCHEMAS: {
|
|
|
110
115
|
kind: z.ZodEnum<{
|
|
111
116
|
declarative: "declarative";
|
|
112
117
|
code: "code";
|
|
118
|
+
matter: "matter";
|
|
113
119
|
}>;
|
|
114
120
|
defaultIcon: z.ZodOptional<z.ZodString>;
|
|
115
121
|
webPagePort: z.ZodOptional<z.ZodInt>;
|
|
@@ -343,6 +349,16 @@ export declare const BUNDLE_FILE_SCHEMAS: {
|
|
|
343
349
|
}, z.core.$strict>, z.ZodObject<{
|
|
344
350
|
path: z.ZodString;
|
|
345
351
|
startsWith: z.ZodString;
|
|
352
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
353
|
+
path: z.ZodString;
|
|
354
|
+
endsWith: z.ZodString;
|
|
355
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
356
|
+
path: z.ZodString;
|
|
357
|
+
contains: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
358
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
359
|
+
path: z.ZodString;
|
|
360
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
361
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
346
362
|
}, z.core.$strict>]>>;
|
|
347
363
|
identity: z.ZodObject<{
|
|
348
364
|
externalId: z.ZodString;
|
|
@@ -351,6 +367,8 @@ export declare const BUNDLE_FILE_SCHEMAS: {
|
|
|
351
367
|
model: z.ZodOptional<z.ZodString>;
|
|
352
368
|
swVersion: z.ZodOptional<z.ZodString>;
|
|
353
369
|
hwVersion: z.ZodOptional<z.ZodString>;
|
|
370
|
+
mac: z.ZodOptional<z.ZodString>;
|
|
371
|
+
serialNumber: z.ZodOptional<z.ZodString>;
|
|
354
372
|
}, z.core.$strict>;
|
|
355
373
|
}, z.core.$strict>;
|
|
356
374
|
subscriptions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -364,8 +382,8 @@ export declare const BUNDLE_FILE_SCHEMAS: {
|
|
|
364
382
|
entities: z.ZodArray<z.ZodObject<{
|
|
365
383
|
domain: z.ZodEnum<{
|
|
366
384
|
number: "number";
|
|
367
|
-
custom: "custom";
|
|
368
385
|
image: "image";
|
|
386
|
+
custom: "custom";
|
|
369
387
|
light: "light";
|
|
370
388
|
switch: "switch";
|
|
371
389
|
sensor: "sensor";
|
|
@@ -514,6 +532,14 @@ export declare const BUNDLE_FILE_SCHEMAS: {
|
|
|
514
532
|
total_increasing: "total_increasing";
|
|
515
533
|
}>>;
|
|
516
534
|
displayPrecision: z.ZodOptional<z.ZodInt>;
|
|
535
|
+
link: z.ZodOptional<z.ZodObject<{
|
|
536
|
+
key: z.ZodOptional<z.ZodString>;
|
|
537
|
+
matter: z.ZodOptional<z.ZodObject<{
|
|
538
|
+
endpoint: z.ZodInt;
|
|
539
|
+
cluster: z.ZodInt;
|
|
540
|
+
attribute: z.ZodInt;
|
|
541
|
+
}, z.core.$strict>>;
|
|
542
|
+
}, z.core.$strict>>;
|
|
517
543
|
stream: z.ZodOptional<z.ZodObject<{
|
|
518
544
|
source: z.ZodString;
|
|
519
545
|
args: z.ZodDefault<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
|
|
@@ -534,12 +560,12 @@ export declare const BUNDLE_FILE_SCHEMAS: {
|
|
|
534
560
|
}, z.core.$strict>>;
|
|
535
561
|
}, z.core.$strict>;
|
|
536
562
|
readonly discovery: z.ZodObject<{
|
|
537
|
-
listen: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
563
|
+
listen: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
538
564
|
mdns: z.ZodString;
|
|
539
565
|
}, z.core.$strict>, z.ZodObject<{
|
|
540
566
|
module: z.ZodString;
|
|
541
567
|
lan: z.ZodDefault<z.ZodBoolean>;
|
|
542
|
-
}, z.core.$strict>]
|
|
568
|
+
}, z.core.$strict>]>>>;
|
|
543
569
|
match: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
544
570
|
path: z.ZodString;
|
|
545
571
|
equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
@@ -552,6 +578,16 @@ export declare const BUNDLE_FILE_SCHEMAS: {
|
|
|
552
578
|
}, z.core.$strict>, z.ZodObject<{
|
|
553
579
|
path: z.ZodString;
|
|
554
580
|
startsWith: z.ZodString;
|
|
581
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
582
|
+
path: z.ZodString;
|
|
583
|
+
endsWith: z.ZodString;
|
|
584
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
585
|
+
path: z.ZodString;
|
|
586
|
+
contains: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
587
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
588
|
+
path: z.ZodString;
|
|
589
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
590
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
555
591
|
}, z.core.$strict>]>>>;
|
|
556
592
|
probe: z.ZodOptional<z.ZodObject<{
|
|
557
593
|
transport: z.ZodString;
|
|
@@ -559,12 +595,41 @@ export declare const BUNDLE_FILE_SCHEMAS: {
|
|
|
559
595
|
args: z.ZodDefault<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
|
|
560
596
|
timeoutMs: z.ZodOptional<z.ZodInt>;
|
|
561
597
|
}, z.core.$strict>>;
|
|
562
|
-
identity: z.ZodObject<{
|
|
598
|
+
identity: z.ZodDefault<z.ZodObject<{
|
|
563
599
|
model: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
564
600
|
externalId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
565
601
|
name: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
566
602
|
swVersion: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
567
|
-
|
|
603
|
+
mac: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
604
|
+
serialNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
605
|
+
auth: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
606
|
+
}, z.core.$strict>>;
|
|
607
|
+
matter: z.ZodOptional<z.ZodObject<{
|
|
608
|
+
match: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
609
|
+
path: z.ZodString;
|
|
610
|
+
equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
611
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
612
|
+
path: z.ZodString;
|
|
613
|
+
exists: z.ZodLiteral<true>;
|
|
614
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
615
|
+
path: z.ZodString;
|
|
616
|
+
oneOf: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
617
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
618
|
+
path: z.ZodString;
|
|
619
|
+
startsWith: z.ZodString;
|
|
620
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
621
|
+
path: z.ZodString;
|
|
622
|
+
endsWith: z.ZodString;
|
|
623
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
624
|
+
path: z.ZodString;
|
|
625
|
+
contains: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
626
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
627
|
+
path: z.ZodString;
|
|
628
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
629
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
630
|
+
}, z.core.$strict>]>>;
|
|
631
|
+
model: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
632
|
+
}, z.core.$strict>>;
|
|
568
633
|
adopt: z.ZodDefault<z.ZodEnum<{
|
|
569
634
|
owner: "owner";
|
|
570
635
|
automatic: "automatic";
|
package/dist/schemas.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as accountDeclarationSchema, h as integrationSetupSchema, l as vendorDiscoverySchema, m as vendorManifestSchema, p as driverManifestSchema, u as integrationProfileSchema } from "./chunks/node-dist.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/schemas.ts
|
|
4
4
|
/**
|
package/dist/testing.d.ts
CHANGED
|
@@ -209,6 +209,25 @@ export declare function identify(vendor: LoadedVendor, heard: {
|
|
|
209
209
|
readonly probed?: unknown;
|
|
210
210
|
readonly deviceKey?: string;
|
|
211
211
|
}): Identification;
|
|
212
|
+
/** What discovery makes of one of the house's Matter devices. */
|
|
213
|
+
type MatterIdentification = {
|
|
214
|
+
/** Whether the vendor's `matter` rules take it: every condition holds. */
|
|
215
|
+
readonly matches: boolean;
|
|
216
|
+
/** The Matter driver and the model it names; null when no driver takes the device. */
|
|
217
|
+
readonly association: Association | null;
|
|
218
|
+
};
|
|
219
|
+
/**
|
|
220
|
+
* Says what discovery makes of one of the house's Matter devices, by the vendor's `matter` rules.
|
|
221
|
+
* A device that another vendor's rules take too is the platform's own instead, which one vendor's
|
|
222
|
+
* test cannot see.
|
|
223
|
+
*
|
|
224
|
+
* @param vendor - The vendor, loaded with `loadIntegration`.
|
|
225
|
+
* @param identity - Who the device says it is: `vendorId`, `productId`, `vendorName`,
|
|
226
|
+
* `isBridged` and the rest of the fields FILES.md lists; a field left out is one it does not say.
|
|
227
|
+
* @returns What discovery makes of it.
|
|
228
|
+
* @throws {Error} When the vendor has no discovery that loaded.
|
|
229
|
+
*/
|
|
230
|
+
export declare function identifyMatter(vendor: LoadedVendor, identity: Readonly<Record<string, unknown>>): MatterIdentification;
|
|
212
231
|
//#endregion
|
|
213
232
|
//#region src/testing/load.d.ts
|
|
214
233
|
/** What loading takes. */
|
|
@@ -264,4 +283,4 @@ export declare class IntegrationError extends Error {
|
|
|
264
283
|
constructor(problems: readonly string[]);
|
|
265
284
|
}
|
|
266
285
|
//#endregion
|
|
267
|
-
export type { Association, BundleFailure, DriverHarness, DriverHarnessOptions, FakeSdk, FakeSdkOptions, FakeUdpSocket, FakeWebSocket, HarnessDevice, Identification, LoadIntegrationOptions, LoadedAccount, LoadedBundle, LoadedDiscovery, LoadedIntegration, LoadedListenSource, LoadedVendor, LogLevel, LogRecord, SentDatagram, SightingIdentity };
|
|
286
|
+
export type { Association, BundleFailure, DriverHarness, DriverHarnessOptions, FakeSdk, FakeSdkOptions, FakeUdpSocket, FakeWebSocket, HarnessDevice, Identification, LoadIntegrationOptions, LoadedAccount, LoadedBundle, LoadedDiscovery, LoadedIntegration, LoadedListenSource, LoadedVendor, LogLevel, LogRecord, MatterIdentification, SentDatagram, SightingIdentity };
|
package/dist/testing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as associateModel, c as matchesMatter, g as composeEntityId, i as associateMatter, n as readVendorDirectory, o as identifySighting, s as matchesAnnouncement, t as instantiateVendor } from "./chunks/node-dist.js";
|
|
2
2
|
import { a as sourceModule, i as runtimeVersion, o as createFakeSdk, r as readProject, t as IntegrationError } from "./chunks/node-project.js";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
4
|
//#region src/testing/harness.ts
|
|
@@ -180,6 +180,26 @@ function identify(vendor, heard) {
|
|
|
180
180
|
association: associateModel(plan, identity.modelCode, claims)
|
|
181
181
|
};
|
|
182
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* Says what discovery makes of one of the house's Matter devices, by the vendor's `matter` rules.
|
|
185
|
+
* A device that another vendor's rules take too is the platform's own instead, which one vendor's
|
|
186
|
+
* test cannot see.
|
|
187
|
+
*
|
|
188
|
+
* @param vendor - The vendor, loaded with `loadIntegration`.
|
|
189
|
+
* @param identity - Who the device says it is: `vendorId`, `productId`, `vendorName`,
|
|
190
|
+
* `isBridged` and the rest of the fields FILES.md lists; a field left out is one it does not say.
|
|
191
|
+
* @returns What discovery makes of it.
|
|
192
|
+
* @throws {Error} When the vendor has no discovery that loaded.
|
|
193
|
+
*/
|
|
194
|
+
function identifyMatter(vendor, identity) {
|
|
195
|
+
const plan = vendor.discovery?.plan;
|
|
196
|
+
if (plan === void 0) throw new Error(`${vendor.manifest.id} has no discovery.json that loaded`);
|
|
197
|
+
const matches = matchesMatter(plan, identity);
|
|
198
|
+
return {
|
|
199
|
+
matches,
|
|
200
|
+
association: matches ? associateMatter(plan, identity) : null
|
|
201
|
+
};
|
|
202
|
+
}
|
|
183
203
|
//#endregion
|
|
184
204
|
//#region src/testing/load.ts
|
|
185
205
|
/**
|
|
@@ -248,4 +268,4 @@ async function loadIntegration(options = {}) {
|
|
|
248
268
|
};
|
|
249
269
|
}
|
|
250
270
|
//#endregion
|
|
251
|
-
export { IntegrationError, createFakeSdk, driverHarness, identify, loadIntegration };
|
|
271
|
+
export { IntegrationError, createFakeSdk, driverHarness, identify, identifyMatter, loadIntegration };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nebulahome/integration-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Write a NebulaHome integration: check it, build it, test it and release it for the platform.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"vitest": "^4.1.11",
|
|
65
65
|
"@nebulahome/contracts": "0.0.0",
|
|
66
66
|
"@nebulahome/eslint-config": "0.0.0",
|
|
67
|
-
"@nebulahome/
|
|
68
|
-
"@nebulahome/
|
|
67
|
+
"@nebulahome/package-runtime": "0.0.0",
|
|
68
|
+
"@nebulahome/tsconfig": "0.0.0"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|
|
71
71
|
"build": "tsdown && node scripts/build-schemas.js",
|