@nebulahome/integration-sdk 1.0.0 → 1.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.
@@ -199,8 +199,10 @@ type EntityStateClass = (typeof ENTITY_STATE_CLASSES)[number];
199
199
  */
200
200
  declare const declaredCapabilitiesSchema: z.ZodRecord<z.ZodEnum<{
201
201
  number: "number";
202
- on_off: "on_off";
202
+ custom: "custom";
203
+ image: "image";
203
204
  level: "level";
205
+ on_off: "on_off";
204
206
  color_hs: "color_hs";
205
207
  color_temp: "color_temp";
206
208
  cover: "cover";
@@ -216,8 +218,6 @@ declare const declaredCapabilitiesSchema: z.ZodRecord<z.ZodEnum<{
216
218
  lawn_mower: "lawn_mower";
217
219
  select: "select";
218
220
  vacuum: "vacuum";
219
- image: "image";
220
- custom: "custom";
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>;
@@ -685,9 +685,10 @@ type IntegrationSetup = z.output<typeof integrationSetupSchema>;
685
685
  /**
686
686
  * The wires the interface names on a vendor's card: what a person recognises on the box, whatever
687
687
  * 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.
688
+ * over plain datagrams on the network (Govee's LAN API), `modbus` Modbus TCP, `matter` the
689
+ * house's Matter fabric.
689
690
  */
690
- declare const TRANSPORT_WIRES: readonly ["http", "mqtt", "ble", "zigbee", "udp", "modbus"];
691
+ declare const TRANSPORT_WIRES: readonly ["http", "mqtt", "ble", "zigbee", "udp", "modbus", "matter"];
691
692
  /** A wire the interface names. */
692
693
  type TransportWire = (typeof TRANSPORT_WIRES)[number];
693
694
  /**
@@ -698,8 +699,8 @@ declare const integrationInstallSchema: z.ZodObject<{
698
699
  build: z.ZodString;
699
700
  version: z.ZodString;
700
701
  source: z.ZodEnum<{
701
- local: "local";
702
702
  index: "index";
703
+ local: "local";
703
704
  }>;
704
705
  artifactSha256: z.ZodString;
705
706
  installedAt: z.ZodISODateTime;
@@ -1652,11 +1653,12 @@ declare const vendorManifestSchema: z.ZodObject<{
1652
1653
  transports: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
1653
1654
  module: z.ZodString;
1654
1655
  wires: z.ZodArray<z.ZodEnum<{
1656
+ udp: "udp";
1657
+ matter: "matter";
1655
1658
  http: "http";
1656
1659
  mqtt: "mqtt";
1657
1660
  ble: "ble";
1658
1661
  zigbee: "zigbee";
1659
- udp: "udp";
1660
1662
  modbus: "modbus";
1661
1663
  }>>;
1662
1664
  }, z.core.$strict>]>>>;
@@ -1748,6 +1750,7 @@ declare const bundleManifestSchema: z.ZodObject<{
1748
1750
  kind: z.ZodEnum<{
1749
1751
  declarative: "declarative";
1750
1752
  code: "code";
1753
+ matter: "matter";
1751
1754
  }>;
1752
1755
  defaultIcon: z.ZodOptional<z.ZodString>;
1753
1756
  webPagePort: z.ZodOptional<z.ZodInt>;
@@ -1793,12 +1796,12 @@ type TemplateReference = {
1793
1796
  //#region ../package-runtime/dist/discovery.d.ts
1794
1797
  /** Validates a whole `discovery.json`. */
1795
1798
  declare const vendorDiscoverySchema: z.ZodObject<{
1796
- listen: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1799
+ listen: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1797
1800
  mdns: z.ZodString;
1798
1801
  }, z.core.$strict>, z.ZodObject<{
1799
1802
  module: z.ZodString;
1800
1803
  lan: z.ZodDefault<z.ZodBoolean>;
1801
- }, z.core.$strict>]>>;
1804
+ }, z.core.$strict>]>>>;
1802
1805
  match: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1803
1806
  path: z.ZodString;
1804
1807
  equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
@@ -1811,6 +1814,16 @@ declare const vendorDiscoverySchema: z.ZodObject<{
1811
1814
  }, z.core.$strict>, z.ZodObject<{
1812
1815
  path: z.ZodString;
1813
1816
  startsWith: z.ZodString;
1817
+ }, z.core.$strict>, z.ZodObject<{
1818
+ path: z.ZodString;
1819
+ endsWith: z.ZodString;
1820
+ }, z.core.$strict>, z.ZodObject<{
1821
+ path: z.ZodString;
1822
+ contains: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
1823
+ }, z.core.$strict>, z.ZodObject<{
1824
+ path: z.ZodString;
1825
+ min: z.ZodOptional<z.ZodNumber>;
1826
+ max: z.ZodOptional<z.ZodNumber>;
1814
1827
  }, z.core.$strict>]>>>;
1815
1828
  probe: z.ZodOptional<z.ZodObject<{
1816
1829
  transport: z.ZodString;
@@ -1818,12 +1831,38 @@ declare const vendorDiscoverySchema: z.ZodObject<{
1818
1831
  args: z.ZodDefault<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
1819
1832
  timeoutMs: z.ZodOptional<z.ZodInt>;
1820
1833
  }, z.core.$strict>>;
1821
- identity: z.ZodObject<{
1834
+ identity: z.ZodDefault<z.ZodObject<{
1822
1835
  model: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
1823
1836
  externalId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
1824
1837
  name: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
1825
1838
  swVersion: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
1826
- }, z.core.$strict>;
1839
+ }, z.core.$strict>>;
1840
+ matter: z.ZodOptional<z.ZodObject<{
1841
+ match: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1842
+ path: z.ZodString;
1843
+ equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
1844
+ }, z.core.$strict>, z.ZodObject<{
1845
+ path: z.ZodString;
1846
+ exists: z.ZodLiteral<true>;
1847
+ }, z.core.$strict>, z.ZodObject<{
1848
+ path: z.ZodString;
1849
+ oneOf: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
1850
+ }, z.core.$strict>, z.ZodObject<{
1851
+ path: z.ZodString;
1852
+ startsWith: z.ZodString;
1853
+ }, z.core.$strict>, z.ZodObject<{
1854
+ path: z.ZodString;
1855
+ endsWith: z.ZodString;
1856
+ }, z.core.$strict>, z.ZodObject<{
1857
+ path: z.ZodString;
1858
+ contains: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
1859
+ }, z.core.$strict>, z.ZodObject<{
1860
+ path: z.ZodString;
1861
+ min: z.ZodOptional<z.ZodNumber>;
1862
+ max: z.ZodOptional<z.ZodNumber>;
1863
+ }, z.core.$strict>]>>;
1864
+ model: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
1865
+ }, z.core.$strict>>;
1827
1866
  adopt: z.ZodDefault<z.ZodEnum<{
1828
1867
  owner: "owner";
1829
1868
  automatic: "automatic";
@@ -1842,6 +1881,11 @@ type DiscoveryDriver = {
1842
1881
  readonly id: string;
1843
1882
  /** The driver's own name, offered as its one model when it lists none. */
1844
1883
  readonly name: string;
1884
+ /**
1885
+ * What reaches its devices. A driver on the `matter` transport takes only Matter devices, and no
1886
+ * other driver does.
1887
+ */
1888
+ readonly transport: string;
1845
1889
  readonly models: readonly string[];
1846
1890
  readonly modelCodes?: Readonly<Record<string, string | readonly string[]>> | undefined;
1847
1891
  };
@@ -1974,9 +2018,10 @@ type LoadedBundle = {
1974
2018
  * `installed` is the data directory's `hub/integrations`: where the platform installs a vendor
1975
2019
  * from the integrations index or its local folder, and the only place a production hub reads.
1976
2020
  * `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.
2021
+ * `dist/`, named in the hub's `HUB_DEV_BUNDLE_DIR` - read beside it. `platform` is no place at
2022
+ * all: the vendor the hub is itself, `matter`, built in code.
1978
2023
  */
1979
- type BundleOrigin = 'development' | 'installed';
2024
+ type BundleOrigin = 'development' | 'installed' | 'platform';
1980
2025
  /** Where a vendor's devices announce themselves, ready to listen to. */
1981
2026
  type LoadedListenSource = {
1982
2027
  readonly kind: 'mdns';
@@ -1,5 +1,5 @@
1
1
  import { n as __toESM } from "./node-rolldown-runtime.js";
2
- import { r as require_semver, u as defineAccount } from "./node-dist.js";
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.0.0";
92
+ const SDK_VERSION = "1.1.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
@@ -199,8 +199,10 @@ type EntityStateClass = (typeof ENTITY_STATE_CLASSES)[number];
199
199
  */
200
200
  declare const declaredCapabilitiesSchema: z.ZodRecord<z.ZodEnum<{
201
201
  number: "number";
202
- on_off: "on_off";
202
+ custom: "custom";
203
+ image: "image";
203
204
  level: "level";
205
+ on_off: "on_off";
204
206
  color_hs: "color_hs";
205
207
  color_temp: "color_temp";
206
208
  cover: "cover";
@@ -216,8 +218,6 @@ declare const declaredCapabilitiesSchema: z.ZodRecord<z.ZodEnum<{
216
218
  lawn_mower: "lawn_mower";
217
219
  select: "select";
218
220
  vacuum: "vacuum";
219
- image: "image";
220
- custom: "custom";
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>;
package/dist/schemas.d.ts CHANGED
@@ -25,11 +25,12 @@ export declare const BUNDLE_FILE_SCHEMAS: {
25
25
  transports: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
26
26
  module: z.ZodString;
27
27
  wires: z.ZodArray<z.ZodEnum<{
28
+ udp: "udp";
29
+ matter: "matter";
28
30
  http: "http";
29
31
  mqtt: "mqtt";
30
32
  ble: "ble";
31
33
  zigbee: "zigbee";
32
- udp: "udp";
33
34
  modbus: "modbus";
34
35
  }>>;
35
36
  }, z.core.$strict>]>>>;
@@ -110,6 +111,7 @@ export declare const BUNDLE_FILE_SCHEMAS: {
110
111
  kind: z.ZodEnum<{
111
112
  declarative: "declarative";
112
113
  code: "code";
114
+ matter: "matter";
113
115
  }>;
114
116
  defaultIcon: z.ZodOptional<z.ZodString>;
115
117
  webPagePort: z.ZodOptional<z.ZodInt>;
@@ -343,6 +345,16 @@ export declare const BUNDLE_FILE_SCHEMAS: {
343
345
  }, z.core.$strict>, z.ZodObject<{
344
346
  path: z.ZodString;
345
347
  startsWith: z.ZodString;
348
+ }, z.core.$strict>, z.ZodObject<{
349
+ path: z.ZodString;
350
+ endsWith: z.ZodString;
351
+ }, z.core.$strict>, z.ZodObject<{
352
+ path: z.ZodString;
353
+ contains: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
354
+ }, z.core.$strict>, z.ZodObject<{
355
+ path: z.ZodString;
356
+ min: z.ZodOptional<z.ZodNumber>;
357
+ max: z.ZodOptional<z.ZodNumber>;
346
358
  }, z.core.$strict>]>>;
347
359
  identity: z.ZodObject<{
348
360
  externalId: z.ZodString;
@@ -364,8 +376,8 @@ export declare const BUNDLE_FILE_SCHEMAS: {
364
376
  entities: z.ZodArray<z.ZodObject<{
365
377
  domain: z.ZodEnum<{
366
378
  number: "number";
367
- custom: "custom";
368
379
  image: "image";
380
+ custom: "custom";
369
381
  light: "light";
370
382
  switch: "switch";
371
383
  sensor: "sensor";
@@ -387,8 +399,10 @@ export declare const BUNDLE_FILE_SCHEMAS: {
387
399
  icon: z.ZodOptional<z.ZodString>;
388
400
  capabilities: z.ZodRecord<z.ZodEnum<{
389
401
  number: "number";
390
- on_off: "on_off";
402
+ custom: "custom";
403
+ image: "image";
391
404
  level: "level";
405
+ on_off: "on_off";
392
406
  color_hs: "color_hs";
393
407
  color_temp: "color_temp";
394
408
  cover: "cover";
@@ -404,8 +418,6 @@ export declare const BUNDLE_FILE_SCHEMAS: {
404
418
  lawn_mower: "lawn_mower";
405
419
  select: "select";
406
420
  vacuum: "vacuum";
407
- image: "image";
408
- custom: "custom";
409
421
  }> & z.core.$partial, z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
410
422
  state: z.ZodRecord<z.ZodEnum<{
411
423
  number: "number";
@@ -534,12 +546,12 @@ export declare const BUNDLE_FILE_SCHEMAS: {
534
546
  }, z.core.$strict>>;
535
547
  }, z.core.$strict>;
536
548
  readonly discovery: z.ZodObject<{
537
- listen: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
549
+ listen: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
538
550
  mdns: z.ZodString;
539
551
  }, z.core.$strict>, z.ZodObject<{
540
552
  module: z.ZodString;
541
553
  lan: z.ZodDefault<z.ZodBoolean>;
542
- }, z.core.$strict>]>>;
554
+ }, z.core.$strict>]>>>;
543
555
  match: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
544
556
  path: z.ZodString;
545
557
  equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
@@ -552,6 +564,16 @@ export declare const BUNDLE_FILE_SCHEMAS: {
552
564
  }, z.core.$strict>, z.ZodObject<{
553
565
  path: z.ZodString;
554
566
  startsWith: z.ZodString;
567
+ }, z.core.$strict>, z.ZodObject<{
568
+ path: z.ZodString;
569
+ endsWith: z.ZodString;
570
+ }, z.core.$strict>, z.ZodObject<{
571
+ path: z.ZodString;
572
+ contains: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
573
+ }, z.core.$strict>, z.ZodObject<{
574
+ path: z.ZodString;
575
+ min: z.ZodOptional<z.ZodNumber>;
576
+ max: z.ZodOptional<z.ZodNumber>;
555
577
  }, z.core.$strict>]>>>;
556
578
  probe: z.ZodOptional<z.ZodObject<{
557
579
  transport: z.ZodString;
@@ -559,12 +581,38 @@ export declare const BUNDLE_FILE_SCHEMAS: {
559
581
  args: z.ZodDefault<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
560
582
  timeoutMs: z.ZodOptional<z.ZodInt>;
561
583
  }, z.core.$strict>>;
562
- identity: z.ZodObject<{
584
+ identity: z.ZodDefault<z.ZodObject<{
563
585
  model: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
564
586
  externalId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
565
587
  name: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
566
588
  swVersion: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
567
- }, z.core.$strict>;
589
+ }, z.core.$strict>>;
590
+ matter: z.ZodOptional<z.ZodObject<{
591
+ match: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
592
+ path: z.ZodString;
593
+ equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
594
+ }, z.core.$strict>, z.ZodObject<{
595
+ path: z.ZodString;
596
+ exists: z.ZodLiteral<true>;
597
+ }, z.core.$strict>, z.ZodObject<{
598
+ path: z.ZodString;
599
+ oneOf: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
600
+ }, z.core.$strict>, z.ZodObject<{
601
+ path: z.ZodString;
602
+ startsWith: z.ZodString;
603
+ }, z.core.$strict>, z.ZodObject<{
604
+ path: z.ZodString;
605
+ endsWith: z.ZodString;
606
+ }, z.core.$strict>, z.ZodObject<{
607
+ path: z.ZodString;
608
+ contains: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
609
+ }, z.core.$strict>, z.ZodObject<{
610
+ path: z.ZodString;
611
+ min: z.ZodOptional<z.ZodNumber>;
612
+ max: z.ZodOptional<z.ZodNumber>;
613
+ }, z.core.$strict>]>>;
614
+ model: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
615
+ }, z.core.$strict>>;
568
616
  adopt: z.ZodDefault<z.ZodEnum<{
569
617
  owner: "owner";
570
618
  automatic: "automatic";
package/dist/schemas.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as integrationProfileSchema, d as driverManifestSchema, f as vendorManifestSchema, l as accountDeclarationSchema, p as integrationSetupSchema, s as vendorDiscoverySchema } from "./chunks/node-dist.js";
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 identifySighting, i as associateModel, m as composeEntityId, n as readVendorDirectory, o as matchesAnnouncement, t as instantiateVendor } from "./chunks/node-dist.js";
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.0.0",
3
+ "version": "1.1.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",
@@ -63,9 +63,9 @@
63
63
  "typescript": "^6.0.3",
64
64
  "vitest": "^4.1.11",
65
65
  "@nebulahome/contracts": "0.0.0",
66
- "@nebulahome/eslint-config": "0.0.0",
67
66
  "@nebulahome/tsconfig": "0.0.0",
68
- "@nebulahome/package-runtime": "0.0.0"
67
+ "@nebulahome/package-runtime": "0.0.0",
68
+ "@nebulahome/eslint-config": "0.0.0"
69
69
  },
70
70
  "scripts": {
71
71
  "build": "tsdown && node scripts/build-schemas.js",