@matter/node 0.16.0-alpha.0-20260111-c66f560b7 → 0.16.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/dist/cjs/behavior/system/websocket/WebSocketServer.d.ts.map +1 -1
- package/dist/cjs/behavior/system/websocket/WebSocketServer.js +1 -1
- package/dist/cjs/endpoint/EndpointVariableService.d.ts +8 -10
- package/dist/cjs/endpoint/EndpointVariableService.d.ts.map +1 -1
- package/dist/cjs/endpoint/EndpointVariableService.js +5 -2
- package/dist/cjs/endpoint/EndpointVariableService.js.map +1 -1
- package/dist/esm/behavior/system/websocket/WebSocketServer.d.ts.map +1 -1
- package/dist/esm/behavior/system/websocket/WebSocketServer.js +1 -1
- package/dist/esm/endpoint/EndpointVariableService.d.ts +8 -10
- package/dist/esm/endpoint/EndpointVariableService.d.ts.map +1 -1
- package/dist/esm/endpoint/EndpointVariableService.js +5 -2
- package/dist/esm/endpoint/EndpointVariableService.js.map +1 -1
- package/package.json +7 -7
- package/src/behavior/system/websocket/WebSocketServer.ts +1 -1
- package/src/endpoint/EndpointVariableService.ts +23 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebSocketServer.d.ts","sourceRoot":"","sources":["../../../../../src/behavior/system/websocket/WebSocketServer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;GAEG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAC7C,gBAAyB,EAAE,eAAe;IAC1C,gBAAyB,aAAa,4BAAsB;CAC/D;AAED,yBAAiB,eAAe,CAAC;IAC7B,MAAa,KAAM,SAAQ,YAAY,CAAC,KAAK;QACzC;;;;;;;;;WASG;QACM,OAAO,
|
|
1
|
+
{"version":3,"file":"WebSocketServer.d.ts","sourceRoot":"","sources":["../../../../../src/behavior/system/websocket/WebSocketServer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;GAEG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAC7C,gBAAyB,EAAE,eAAe;IAC1C,gBAAyB,aAAa,4BAAsB;CAC/D;AAED,yBAAiB,eAAe,CAAC;IAC7B,MAAa,KAAM,SAAQ,YAAY,CAAC,KAAK;QACzC;;;;;;;;;WASG;QACM,OAAO,SAA2B;KAC9C;CACJ"}
|
|
@@ -44,7 +44,7 @@ class WebSocketServer extends import_RemoteServer.RemoteServer {
|
|
|
44
44
|
* - ws+unix (WebSockets over a UNIX socket)
|
|
45
45
|
* - wss+unix (WebSockets over a secure UNIX socket)
|
|
46
46
|
*/
|
|
47
|
-
address = "ws+unix
|
|
47
|
+
address = "ws+unix://matter.sock";
|
|
48
48
|
}
|
|
49
49
|
WebSocketServer2.State = State;
|
|
50
50
|
})(WebSocketServer || (WebSocketServer = {}));
|
|
@@ -19,8 +19,8 @@ import { Endpoint } from "./Endpoint.js";
|
|
|
19
19
|
*
|
|
20
20
|
* - Configure endpoint behaviors with `<endpoint subkey>.<behavior id>.<property name>` subkey
|
|
21
21
|
*
|
|
22
|
-
* Additionally you may configure behaviors globally (regardless of endpoint) using the
|
|
23
|
-
* subkey. Endpoint-specific configuration overrides this value.
|
|
22
|
+
* Additionally you may configure behaviors globally (regardless of endpoint) using the
|
|
23
|
+
* `behaviors.<behavior id>.<property name>` subkey. Endpoint-specific configuration overrides this value.
|
|
24
24
|
*
|
|
25
25
|
* Environmental configuration overrides values supplied in {@link Endpoint.Configuration}.
|
|
26
26
|
*
|
|
@@ -30,7 +30,7 @@ import { Endpoint } from "./Endpoint.js";
|
|
|
30
30
|
* For example, to set the vendor name for all nodes:
|
|
31
31
|
*
|
|
32
32
|
* ```bash
|
|
33
|
-
* export
|
|
33
|
+
* export MATTER_BASICINFORMATION_VENDORNAME="My Vendor Name"
|
|
34
34
|
* ```
|
|
35
35
|
*
|
|
36
36
|
* Or, to configure a light as on by default:
|
|
@@ -43,10 +43,8 @@ import { Endpoint } from "./Endpoint.js";
|
|
|
43
43
|
*
|
|
44
44
|
* ```json
|
|
45
45
|
* {
|
|
46
|
-
* "
|
|
47
|
-
* "
|
|
48
|
-
* "vendorName": "My Vendor Name"
|
|
49
|
-
* }
|
|
46
|
+
* "basicInformation": {
|
|
47
|
+
* "vendorName": "My Vendor Name"
|
|
50
48
|
* },
|
|
51
49
|
*
|
|
52
50
|
* "nodes": {
|
|
@@ -63,11 +61,11 @@ import { Endpoint } from "./Endpoint.js";
|
|
|
63
61
|
* }
|
|
64
62
|
* ```
|
|
65
63
|
*
|
|
66
|
-
* Matter.js automatically expands dotted names so a more compact configuration option is:
|
|
64
|
+
* Matter.js automatically expands dotted names, so a more compact configuration option is:
|
|
67
65
|
*
|
|
68
66
|
* ```json
|
|
69
67
|
* {
|
|
70
|
-
* "
|
|
68
|
+
* "basicInformation.vendorName": "My Vendor Name",
|
|
71
69
|
* "nodes.node1.parts.light.onOff.OnOff": true,
|
|
72
70
|
* }
|
|
73
71
|
* ```
|
|
@@ -85,7 +83,7 @@ export declare class EndpointVariableService {
|
|
|
85
83
|
*/
|
|
86
84
|
forEndpoint(endpoint: Endpoint): VariableService.Map;
|
|
87
85
|
/**
|
|
88
|
-
* Access the variable
|
|
86
|
+
* Access the variable map for a type of behavior.
|
|
89
87
|
*/
|
|
90
88
|
forBehaviorType(type: Behavior.Type): VariableService.Map;
|
|
91
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EndpointVariableService.d.ts","sourceRoot":"","sources":["../../../src/endpoint/EndpointVariableService.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAY,eAAe,EAAE,MAAM,UAAU,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"EndpointVariableService.d.ts","sourceRoot":"","sources":["../../../src/endpoint/EndpointVariableService.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAY,eAAe,EAAE,MAAM,UAAU,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAiBzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,qBAAa,uBAAuB;;gBAKpB,GAAG,EAAE,WAAW;IAI5B,MAAM,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,WAAW;IAM9C;;OAEG;IACH,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI;IAU3D;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,eAAe,CAAC,GAAG;IAwCpD;;OAEG;IACH,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI;CAuBtC"}
|
|
@@ -85,14 +85,17 @@ class EndpointVariableService {
|
|
|
85
85
|
return vars;
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
|
-
* Access the variable
|
|
88
|
+
* Access the variable map for a type of behavior.
|
|
89
89
|
*/
|
|
90
90
|
forBehaviorType(type) {
|
|
91
91
|
let vars = this.#varsForBehavior.get(type);
|
|
92
92
|
if (vars !== void 0) {
|
|
93
93
|
return vars;
|
|
94
94
|
}
|
|
95
|
-
|
|
95
|
+
let envVars = this.#env.vars.get(`${BEHAVIOR_SUBKEY}.${type.id}`);
|
|
96
|
+
if (!(0, import_general.isObject)(envVars)) {
|
|
97
|
+
envVars = this.#env.vars.get(type.id);
|
|
98
|
+
}
|
|
96
99
|
if ((0, import_general.isObject)(envVars)) {
|
|
97
100
|
vars = envVars;
|
|
98
101
|
} else {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/endpoint/EndpointVariableService.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,qBAAsE;AAPtE;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,qBAAsE;AAPtE;AAAA;AAAA;AAAA;AAAA;AAaA,MAAM,cAAc;AAKpB,MAAM,kBAAkB;AAKxB,MAAM,cAAc;AAkEb,MAAM,wBAAwB;AAAA,EACjC;AAAA,EACA,mBAAmB,oBAAI,QAAuC;AAAA,EAC9D,mBAAmB,oBAAI,QAA4C;AAAA,EAEnE,YAAY,KAAkB;AAC1B,SAAK,OAAO;AAAA,EAChB;AAAA,EAEA,QAAQ,6BAAc,MAAM,EAAE,KAAkB;AAC5C,UAAM,UAAU,IAAI,wBAAwB,GAAG;AAC/C,QAAI,IAAI,yBAAyB,OAAO;AACxC,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA,EAKA,oBAAoB,UAAoB,MAAqB;AACzD,UAAM,SAAS,KAAK,gBAAgB,IAAI;AACxC,UAAM,kBAAkB,KAAK,YAAY,QAAQ;AACjD,UAAM,UAAU,gBAAgB,KAAK,EAAE,KAAK,gBAAgB,KAAK,GAAG,YAAY,CAAC;AACjF,YAAI,yBAAS,OAAO,GAAG;AACnB,aAAO,EAAE,GAAG,QAAQ,GAAG,QAAQ;AAAA,IACnC;AACA,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA,EAKA,YAAY,UAAyC;AAEjD,QAAI,CAAC,SAAS,UAAU,OAAO;AAC3B,aAAO,CAAC;AAAA,IACZ;AAGA,QAAI,OAAO,KAAK,iBAAiB,IAAI,QAAQ;AAC7C,QAAI,SAAS,QAAW;AACpB,aAAO;AAAA,IACX;AAIA,QAAI;AACJ,QAAI,SAAS,UAAU,QAAW;AAC9B,gBAAU,KAAK,KAAK,KAAK,IAAI,GAAG,WAAW,IAAI,SAAS,EAAE,EAAE;AAAA,IAChE,WAAW,CAAC,SAAS,UAAU,aAAa;AAExC,aAAO,CAAC;AAAA,IACZ,OAAO;AACH,YAAM,WAAW,KAAK,YAAY,SAAS,KAAK,EAAE,WAAW;AAC7D,cAAI,yBAAS,QAAQ,GAAG;AACpB,kBAAU,SAAS,SAAS,EAAE;AAAA,MAClC;AAAA,IACJ;AAGA,YAAI,yBAAS,OAAO,GAAG;AACnB,aAAO;AAAA,IACX,OAAO;AACH,aAAO,CAAC;AAAA,IACZ;AAGA,SAAK,iBAAiB,IAAI,UAAU,IAAI;AAExC,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA,EAKA,gBAAgB,MAAqB;AAEjC,QAAI,OAAO,KAAK,iBAAiB,IAAI,IAAI;AACzC,QAAI,SAAS,QAAW;AACpB,aAAO;AAAA,IACX;AAGA,QAAI,UAAU,KAAK,KAAK,KAAK,IAAI,GAAG,eAAe,IAAI,KAAK,EAAE,EAAE;AAChE,QAAI,KAAC,yBAAS,OAAO,GAAG;AACpB,gBAAU,KAAK,KAAK,KAAK,IAAI,KAAK,EAAE;AAAA,IACxC;AACA,YAAI,yBAAS,OAAO,GAAG;AACnB,aAAO;AAAA,IACX,OAAO;AACH,aAAO,CAAC;AAAA,IACZ;AAGA,SAAK,iBAAiB,IAAI,MAAM,IAAI;AAEpC,WAAO;AAAA,EACX;AACJ;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebSocketServer.d.ts","sourceRoot":"","sources":["../../../../../src/behavior/system/websocket/WebSocketServer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;GAEG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAC7C,gBAAyB,EAAE,eAAe;IAC1C,gBAAyB,aAAa,4BAAsB;CAC/D;AAED,yBAAiB,eAAe,CAAC;IAC7B,MAAa,KAAM,SAAQ,YAAY,CAAC,KAAK;QACzC;;;;;;;;;WASG;QACM,OAAO,
|
|
1
|
+
{"version":3,"file":"WebSocketServer.d.ts","sourceRoot":"","sources":["../../../../../src/behavior/system/websocket/WebSocketServer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;GAEG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAC7C,gBAAyB,EAAE,eAAe;IAC1C,gBAAyB,aAAa,4BAAsB;CAC/D;AAED,yBAAiB,eAAe,CAAC;IAC7B,MAAa,KAAM,SAAQ,YAAY,CAAC,KAAK;QACzC;;;;;;;;;WASG;QACM,OAAO,SAA2B;KAC9C;CACJ"}
|
|
@@ -21,7 +21,7 @@ class WebSocketServer extends RemoteServer {
|
|
|
21
21
|
* - ws+unix (WebSockets over a UNIX socket)
|
|
22
22
|
* - wss+unix (WebSockets over a secure UNIX socket)
|
|
23
23
|
*/
|
|
24
|
-
address = "ws+unix
|
|
24
|
+
address = "ws+unix://matter.sock";
|
|
25
25
|
}
|
|
26
26
|
WebSocketServer2.State = State;
|
|
27
27
|
})(WebSocketServer || (WebSocketServer = {}));
|
|
@@ -19,8 +19,8 @@ import { Endpoint } from "./Endpoint.js";
|
|
|
19
19
|
*
|
|
20
20
|
* - Configure endpoint behaviors with `<endpoint subkey>.<behavior id>.<property name>` subkey
|
|
21
21
|
*
|
|
22
|
-
* Additionally you may configure behaviors globally (regardless of endpoint) using the
|
|
23
|
-
* subkey. Endpoint-specific configuration overrides this value.
|
|
22
|
+
* Additionally you may configure behaviors globally (regardless of endpoint) using the
|
|
23
|
+
* `behaviors.<behavior id>.<property name>` subkey. Endpoint-specific configuration overrides this value.
|
|
24
24
|
*
|
|
25
25
|
* Environmental configuration overrides values supplied in {@link Endpoint.Configuration}.
|
|
26
26
|
*
|
|
@@ -30,7 +30,7 @@ import { Endpoint } from "./Endpoint.js";
|
|
|
30
30
|
* For example, to set the vendor name for all nodes:
|
|
31
31
|
*
|
|
32
32
|
* ```bash
|
|
33
|
-
* export
|
|
33
|
+
* export MATTER_BASICINFORMATION_VENDORNAME="My Vendor Name"
|
|
34
34
|
* ```
|
|
35
35
|
*
|
|
36
36
|
* Or, to configure a light as on by default:
|
|
@@ -43,10 +43,8 @@ import { Endpoint } from "./Endpoint.js";
|
|
|
43
43
|
*
|
|
44
44
|
* ```json
|
|
45
45
|
* {
|
|
46
|
-
* "
|
|
47
|
-
* "
|
|
48
|
-
* "vendorName": "My Vendor Name"
|
|
49
|
-
* }
|
|
46
|
+
* "basicInformation": {
|
|
47
|
+
* "vendorName": "My Vendor Name"
|
|
50
48
|
* },
|
|
51
49
|
*
|
|
52
50
|
* "nodes": {
|
|
@@ -63,11 +61,11 @@ import { Endpoint } from "./Endpoint.js";
|
|
|
63
61
|
* }
|
|
64
62
|
* ```
|
|
65
63
|
*
|
|
66
|
-
* Matter.js automatically expands dotted names so a more compact configuration option is:
|
|
64
|
+
* Matter.js automatically expands dotted names, so a more compact configuration option is:
|
|
67
65
|
*
|
|
68
66
|
* ```json
|
|
69
67
|
* {
|
|
70
|
-
* "
|
|
68
|
+
* "basicInformation.vendorName": "My Vendor Name",
|
|
71
69
|
* "nodes.node1.parts.light.onOff.OnOff": true,
|
|
72
70
|
* }
|
|
73
71
|
* ```
|
|
@@ -85,7 +83,7 @@ export declare class EndpointVariableService {
|
|
|
85
83
|
*/
|
|
86
84
|
forEndpoint(endpoint: Endpoint): VariableService.Map;
|
|
87
85
|
/**
|
|
88
|
-
* Access the variable
|
|
86
|
+
* Access the variable map for a type of behavior.
|
|
89
87
|
*/
|
|
90
88
|
forBehaviorType(type: Behavior.Type): VariableService.Map;
|
|
91
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EndpointVariableService.d.ts","sourceRoot":"","sources":["../../../src/endpoint/EndpointVariableService.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAY,eAAe,EAAE,MAAM,UAAU,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"EndpointVariableService.d.ts","sourceRoot":"","sources":["../../../src/endpoint/EndpointVariableService.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAY,eAAe,EAAE,MAAM,UAAU,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAiBzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,qBAAa,uBAAuB;;gBAKpB,GAAG,EAAE,WAAW;IAI5B,MAAM,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,WAAW;IAM9C;;OAEG;IACH,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI;IAU3D;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,eAAe,CAAC,GAAG;IAwCpD;;OAEG;IACH,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI;CAuBtC"}
|
|
@@ -62,14 +62,17 @@ class EndpointVariableService {
|
|
|
62
62
|
return vars;
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
|
-
* Access the variable
|
|
65
|
+
* Access the variable map for a type of behavior.
|
|
66
66
|
*/
|
|
67
67
|
forBehaviorType(type) {
|
|
68
68
|
let vars = this.#varsForBehavior.get(type);
|
|
69
69
|
if (vars !== void 0) {
|
|
70
70
|
return vars;
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
let envVars = this.#env.vars.get(`${BEHAVIOR_SUBKEY}.${type.id}`);
|
|
73
|
+
if (!isObject(envVars)) {
|
|
74
|
+
envVars = this.#env.vars.get(type.id);
|
|
75
|
+
}
|
|
73
76
|
if (isObject(envVars)) {
|
|
74
77
|
vars = envVars;
|
|
75
78
|
} else {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/endpoint/EndpointVariableService.ts"],
|
|
4
|
-
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,SAAsB,eAAe,gBAAiC;
|
|
4
|
+
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,SAAsB,eAAe,gBAAiC;AAMtE,MAAM,cAAc;AAKpB,MAAM,kBAAkB;AAKxB,MAAM,cAAc;AAkEb,MAAM,wBAAwB;AAAA,EACjC;AAAA,EACA,mBAAmB,oBAAI,QAAuC;AAAA,EAC9D,mBAAmB,oBAAI,QAA4C;AAAA,EAEnE,YAAY,KAAkB;AAC1B,SAAK,OAAO;AAAA,EAChB;AAAA,EAEA,QAAQ,cAAc,MAAM,EAAE,KAAkB;AAC5C,UAAM,UAAU,IAAI,wBAAwB,GAAG;AAC/C,QAAI,IAAI,yBAAyB,OAAO;AACxC,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA,EAKA,oBAAoB,UAAoB,MAAqB;AACzD,UAAM,SAAS,KAAK,gBAAgB,IAAI;AACxC,UAAM,kBAAkB,KAAK,YAAY,QAAQ;AACjD,UAAM,UAAU,gBAAgB,KAAK,EAAE,KAAK,gBAAgB,KAAK,GAAG,YAAY,CAAC;AACjF,QAAI,SAAS,OAAO,GAAG;AACnB,aAAO,EAAE,GAAG,QAAQ,GAAG,QAAQ;AAAA,IACnC;AACA,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA,EAKA,YAAY,UAAyC;AAEjD,QAAI,CAAC,SAAS,UAAU,OAAO;AAC3B,aAAO,CAAC;AAAA,IACZ;AAGA,QAAI,OAAO,KAAK,iBAAiB,IAAI,QAAQ;AAC7C,QAAI,SAAS,QAAW;AACpB,aAAO;AAAA,IACX;AAIA,QAAI;AACJ,QAAI,SAAS,UAAU,QAAW;AAC9B,gBAAU,KAAK,KAAK,KAAK,IAAI,GAAG,WAAW,IAAI,SAAS,EAAE,EAAE;AAAA,IAChE,WAAW,CAAC,SAAS,UAAU,aAAa;AAExC,aAAO,CAAC;AAAA,IACZ,OAAO;AACH,YAAM,WAAW,KAAK,YAAY,SAAS,KAAK,EAAE,WAAW;AAC7D,UAAI,SAAS,QAAQ,GAAG;AACpB,kBAAU,SAAS,SAAS,EAAE;AAAA,MAClC;AAAA,IACJ;AAGA,QAAI,SAAS,OAAO,GAAG;AACnB,aAAO;AAAA,IACX,OAAO;AACH,aAAO,CAAC;AAAA,IACZ;AAGA,SAAK,iBAAiB,IAAI,UAAU,IAAI;AAExC,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA,EAKA,gBAAgB,MAAqB;AAEjC,QAAI,OAAO,KAAK,iBAAiB,IAAI,IAAI;AACzC,QAAI,SAAS,QAAW;AACpB,aAAO;AAAA,IACX;AAGA,QAAI,UAAU,KAAK,KAAK,KAAK,IAAI,GAAG,eAAe,IAAI,KAAK,EAAE,EAAE;AAChE,QAAI,CAAC,SAAS,OAAO,GAAG;AACpB,gBAAU,KAAK,KAAK,KAAK,IAAI,KAAK,EAAE;AAAA,IACxC;AACA,QAAI,SAAS,OAAO,GAAG;AACnB,aAAO;AAAA,IACX,OAAO;AACH,aAAO,CAAC;AAAA,IACZ;AAGA,SAAK,iBAAiB,IAAI,MAAM,IAAI;AAEpC,WAAO;AAAA,EACX;AACJ;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matter/node",
|
|
3
|
-
"version": "0.16.0
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "API for building Matter nodes",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"iot",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"#*": "./src/*"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@matter/general": "0.16.0
|
|
46
|
-
"@matter/model": "0.16.0
|
|
47
|
-
"@matter/types": "0.16.0
|
|
48
|
-
"@matter/protocol": "0.16.0
|
|
45
|
+
"@matter/general": "0.16.0",
|
|
46
|
+
"@matter/model": "0.16.0",
|
|
47
|
+
"@matter/types": "0.16.0",
|
|
48
|
+
"@matter/protocol": "0.16.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@matter/tools": "0.16.0
|
|
52
|
-
"@matter/testing": "0.16.0
|
|
51
|
+
"@matter/tools": "0.16.0",
|
|
52
|
+
"@matter/testing": "0.16.0"
|
|
53
53
|
},
|
|
54
54
|
"files": [
|
|
55
55
|
"dist/**/*",
|
|
@@ -8,8 +8,19 @@ import { Behavior } from "#behavior/Behavior.js";
|
|
|
8
8
|
import { Environment, Environmental, isObject, VariableService } from "#general";
|
|
9
9
|
import { Endpoint } from "./Endpoint.js";
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Prefix path segment for node-specific configuration values.
|
|
13
|
+
*/
|
|
11
14
|
const NODE_SUBKEY = "nodes";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Optional prefix path segment for behavior-specific configuration values.
|
|
18
|
+
*/
|
|
12
19
|
const BEHAVIOR_SUBKEY = "behaviors";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Path segment for configuring individual nodes within and endpoint.
|
|
23
|
+
*/
|
|
13
24
|
const PART_SUBKEY = "parts";
|
|
14
25
|
|
|
15
26
|
/**
|
|
@@ -25,8 +36,8 @@ const PART_SUBKEY = "parts";
|
|
|
25
36
|
*
|
|
26
37
|
* - Configure endpoint behaviors with `<endpoint subkey>.<behavior id>.<property name>` subkey
|
|
27
38
|
*
|
|
28
|
-
* Additionally you may configure behaviors globally (regardless of endpoint) using the
|
|
29
|
-
* subkey. Endpoint-specific configuration overrides this value.
|
|
39
|
+
* Additionally you may configure behaviors globally (regardless of endpoint) using the
|
|
40
|
+
* `behaviors.<behavior id>.<property name>` subkey. Endpoint-specific configuration overrides this value.
|
|
30
41
|
*
|
|
31
42
|
* Environmental configuration overrides values supplied in {@link Endpoint.Configuration}.
|
|
32
43
|
*
|
|
@@ -36,7 +47,7 @@ const PART_SUBKEY = "parts";
|
|
|
36
47
|
* For example, to set the vendor name for all nodes:
|
|
37
48
|
*
|
|
38
49
|
* ```bash
|
|
39
|
-
* export
|
|
50
|
+
* export MATTER_BASICINFORMATION_VENDORNAME="My Vendor Name"
|
|
40
51
|
* ```
|
|
41
52
|
*
|
|
42
53
|
* Or, to configure a light as on by default:
|
|
@@ -49,10 +60,8 @@ const PART_SUBKEY = "parts";
|
|
|
49
60
|
*
|
|
50
61
|
* ```json
|
|
51
62
|
* {
|
|
52
|
-
* "
|
|
53
|
-
* "
|
|
54
|
-
* "vendorName": "My Vendor Name"
|
|
55
|
-
* }
|
|
63
|
+
* "basicInformation": {
|
|
64
|
+
* "vendorName": "My Vendor Name"
|
|
56
65
|
* },
|
|
57
66
|
*
|
|
58
67
|
* "nodes": {
|
|
@@ -69,11 +78,11 @@ const PART_SUBKEY = "parts";
|
|
|
69
78
|
* }
|
|
70
79
|
* ```
|
|
71
80
|
*
|
|
72
|
-
* Matter.js automatically expands dotted names so a more compact configuration option is:
|
|
81
|
+
* Matter.js automatically expands dotted names, so a more compact configuration option is:
|
|
73
82
|
*
|
|
74
83
|
* ```json
|
|
75
84
|
* {
|
|
76
|
-
* "
|
|
85
|
+
* "basicInformation.vendorName": "My Vendor Name",
|
|
77
86
|
* "nodes.node1.parts.light.onOff.OnOff": true,
|
|
78
87
|
* }
|
|
79
88
|
* ```
|
|
@@ -150,7 +159,7 @@ export class EndpointVariableService {
|
|
|
150
159
|
}
|
|
151
160
|
|
|
152
161
|
/**
|
|
153
|
-
* Access the variable
|
|
162
|
+
* Access the variable map for a type of behavior.
|
|
154
163
|
*/
|
|
155
164
|
forBehaviorType(type: Behavior.Type) {
|
|
156
165
|
// Get cached value
|
|
@@ -160,7 +169,10 @@ export class EndpointVariableService {
|
|
|
160
169
|
}
|
|
161
170
|
|
|
162
171
|
// Load environment variables
|
|
163
|
-
|
|
172
|
+
let envVars = this.#env.vars.get(`${BEHAVIOR_SUBKEY}.${type.id}`) as VariableService.Value;
|
|
173
|
+
if (!isObject(envVars)) {
|
|
174
|
+
envVars = this.#env.vars.get(type.id) as VariableService.Value;
|
|
175
|
+
}
|
|
164
176
|
if (isObject(envVars)) {
|
|
165
177
|
vars = envVars;
|
|
166
178
|
} else {
|