@matter/nodejs-shell 0.17.9 → 0.18.0-alpha.0-20260807-335c3291b
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/README.md +11 -1
- package/dist/esm/MatterNode.js +237 -134
- package/dist/esm/MatterNode.js.map +1 -1
- package/dist/esm/app.js +13 -7
- package/dist/esm/app.js.map +1 -1
- package/dist/esm/shell/cmd_cluster-attributes.js +64 -45
- package/dist/esm/shell/cmd_cluster-attributes.js.map +2 -2
- package/dist/esm/shell/cmd_cluster-commands.js +11 -9
- package/dist/esm/shell/cmd_cluster-commands.js.map +1 -1
- package/dist/esm/shell/cmd_cluster-events.js +36 -9
- package/dist/esm/shell/cmd_cluster-events.js.map +1 -1
- package/dist/esm/shell/cmd_commission.js +119 -93
- package/dist/esm/shell/cmd_commission.js.map +1 -1
- package/dist/esm/shell/cmd_discover.js +23 -21
- package/dist/esm/shell/cmd_discover.js.map +1 -1
- package/dist/esm/shell/cmd_icd.js +46 -30
- package/dist/esm/shell/cmd_icd.js.map +1 -1
- package/dist/esm/shell/cmd_identify.js +11 -7
- package/dist/esm/shell/cmd_identify.js.map +1 -1
- package/dist/esm/shell/cmd_nodes.js +189 -168
- package/dist/esm/shell/cmd_nodes.js.map +1 -1
- package/dist/esm/shell/cmd_session.js +3 -4
- package/dist/esm/shell/cmd_session.js.map +1 -1
- package/dist/esm/shell/cmd_subscribe.js +26 -12
- package/dist/esm/shell/cmd_subscribe.js.map +1 -1
- package/dist/esm/util/ClusterEndpoint.js +61 -0
- package/dist/esm/util/ClusterEndpoint.js.map +6 -0
- package/dist/esm/util/awaitSeeded.js +31 -0
- package/dist/esm/util/awaitSeeded.js.map +6 -0
- package/dist/esm/util/diagnosticLogging.js +99 -0
- package/dist/esm/util/diagnosticLogging.js.map +6 -0
- package/dist/esm/util/legacyStorageMigration.js +188 -0
- package/dist/esm/util/legacyStorageMigration.js.map +6 -0
- package/package.json +10 -11
- package/src/MatterNode.ts +298 -159
- package/src/app.ts +17 -9
- package/src/shell/cmd_cluster-attributes.ts +77 -53
- package/src/shell/cmd_cluster-commands.ts +12 -13
- package/src/shell/cmd_cluster-events.ts +38 -11
- package/src/shell/cmd_commission.ts +136 -113
- package/src/shell/cmd_discover.ts +36 -22
- package/src/shell/cmd_icd.ts +52 -32
- package/src/shell/cmd_identify.ts +11 -7
- package/src/shell/cmd_nodes.ts +226 -199
- package/src/shell/cmd_session.ts +3 -5
- package/src/shell/cmd_subscribe.ts +37 -14
- package/src/shell/webassets/index.html +1 -1
- package/src/tsconfig.json +0 -3
- package/src/util/ClusterEndpoint.ts +107 -0
- package/src/util/awaitSeeded.ts +43 -0
- package/src/util/diagnosticLogging.ts +117 -0
- package/src/util/legacyStorageMigration.ts +275 -0
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ Please note the extra `--` to separate the npm parameters from the shell paramet
|
|
|
37
37
|
## matter.js v0.11 Storage adjustment!
|
|
38
38
|
In matter.js 0.11 we adjusted the storage to the new environment based one. This means that by default the storage is in the user directory in .matter/shell-XX where XX is the nodeNum you provided as parameter. You can adjust the storage base location with "--storage-path=..." as parameter.
|
|
39
39
|
|
|
40
|
-
Before matter.js 0.13 it was possible to use a former storage with "--legacyStorage" and the storage will be in the .matter-shell-XX directory in the local directory as before. This option was removed in matter
|
|
40
|
+
Before matter.js 0.13 it was possible to use a former storage with "--legacyStorage" and the storage will be in the .matter-shell-XX directory in the local directory as before. This option was removed in matter.js 0.13.
|
|
41
41
|
To manually convert a storage you can follow the following steps. The described steps assume ./.matter-shell-XX is the old storage and ~/.matter/shell-XX is the new storage location.
|
|
42
42
|
|
|
43
43
|
* Stop the shell
|
|
@@ -49,6 +49,16 @@ To manually convert a storage you can follow the following steps. The described
|
|
|
49
49
|
|
|
50
50
|
All "0.MatterController.node-*" files from the old storage are not needed to be copied, if existing. They are automatically regenerated on next start.
|
|
51
51
|
|
|
52
|
+
## Migrating a pre-0.16 controller storage
|
|
53
|
+
|
|
54
|
+
On startup, the shell automatically migrates a pre-0.16 controller storage (predating the
|
|
55
|
+
`ServerNode`-based controller) to the current storage format. The old, now-unused data is left in
|
|
56
|
+
place, so the migration is non-destructive and can be repeated safely.
|
|
57
|
+
|
|
58
|
+
Once you are certain the migration succeeded and you will not downgrade this storage below 0.16,
|
|
59
|
+
run the shell with `--cleanup-legacy-storage` to delete the leftover legacy data. **This is
|
|
60
|
+
irreversible — once removed, there is no way back to the pre-0.16 layout.**
|
|
61
|
+
|
|
52
62
|
## General usage
|
|
53
63
|
|
|
54
64
|
The shell offers and interactive prompt that can execute commands. If you just enter the command name that has sub commands (with or without followed by "help"), it will display the command options. If you enter the command name followed by the options, it will execute the command, with "help" after the command name it will show the detailed help for this command.
|
package/dist/esm/MatterNode.js
CHANGED
|
@@ -4,71 +4,53 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import {
|
|
7
|
-
Diagnostic,
|
|
8
7
|
Environment,
|
|
9
8
|
Filesystem,
|
|
9
|
+
ImplementationError,
|
|
10
|
+
InternalError,
|
|
10
11
|
Logger,
|
|
11
12
|
ObserverGroup,
|
|
13
|
+
Seconds,
|
|
12
14
|
StorageService
|
|
13
15
|
} from "@matter/general";
|
|
14
|
-
import { DclBehavior, SoftwareUpdateManager } from "@matter/node";
|
|
15
|
-
import { NodeId } from "@matter/types";
|
|
16
|
-
import { CommissioningController } from "@project-chip/matter.js";
|
|
17
16
|
import {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
ControllerBehavior,
|
|
18
|
+
DclBehavior,
|
|
19
|
+
Endpoint,
|
|
20
|
+
NetworkClient,
|
|
21
|
+
ServerNode,
|
|
22
|
+
SoftwareUpdateManager
|
|
23
|
+
} from "@matter/node";
|
|
24
|
+
import { OtaProviderEndpoint } from "@matter/node/endpoints/ota-provider";
|
|
25
|
+
import { Ble, FabricAuthority } from "@matter/protocol";
|
|
26
|
+
import { NodeId } from "@matter/types";
|
|
20
27
|
import { join } from "node:path";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
eventTriggeredCallback: (peerNodeId, { path: { nodeId, clusterId, endpointId, eventName }, events }) => console.log(
|
|
29
|
-
`eventTriggeredCallback ${peerNodeId}: Event ${nodeId}/${endpointId}/${clusterId}/${eventName} triggered with ${Diagnostic.json(
|
|
30
|
-
events
|
|
31
|
-
)}`
|
|
32
|
-
),
|
|
33
|
-
stateInformationCallback: (peerNodeId, info) => {
|
|
34
|
-
switch (info) {
|
|
35
|
-
case NodeStateInformation.Connected:
|
|
36
|
-
console.log(`stateInformationCallback Node ${peerNodeId} connected`);
|
|
37
|
-
break;
|
|
38
|
-
case NodeStateInformation.Disconnected:
|
|
39
|
-
console.log(`stateInformationCallback Node ${peerNodeId} disconnected`);
|
|
40
|
-
break;
|
|
41
|
-
case NodeStateInformation.Reconnecting:
|
|
42
|
-
console.log(`stateInformationCallback Node ${peerNodeId} reconnecting`);
|
|
43
|
-
break;
|
|
44
|
-
case NodeStateInformation.WaitingForDeviceDiscovery:
|
|
45
|
-
console.log(
|
|
46
|
-
`stateInformationCallback Node ${peerNodeId} waiting that device gets discovered again`
|
|
47
|
-
);
|
|
48
|
-
break;
|
|
49
|
-
case NodeStateInformation.StructureChanged:
|
|
50
|
-
console.log(`stateInformationCallback Node ${peerNodeId} structure changed`);
|
|
51
|
-
break;
|
|
52
|
-
case NodeStateInformation.Decommissioned:
|
|
53
|
-
console.log(`stateInformationCallback Node ${peerNodeId} decommissioned`);
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
}
|
|
28
|
+
import { installDiagnosticLogging } from "./util/diagnosticLogging.js";
|
|
29
|
+
import {
|
|
30
|
+
cleanupLegacyStorage as purgeLegacyStorage,
|
|
31
|
+
eraseLegacyStorage,
|
|
32
|
+
migrateLegacyCommissionedNodes,
|
|
33
|
+
migrateLegacyControllerCredentials
|
|
34
|
+
} from "./util/legacyStorageMigration.js";
|
|
59
35
|
const logger = Logger.get("Node");
|
|
36
|
+
const ADMIN_FABRIC_LABEL = "matter.js Shell";
|
|
60
37
|
class MatterNode {
|
|
61
38
|
#storageLocation;
|
|
62
39
|
#storageManager;
|
|
63
40
|
#storageContext;
|
|
64
41
|
#environment;
|
|
65
|
-
|
|
42
|
+
#nodeEnvironment;
|
|
43
|
+
#node;
|
|
44
|
+
#nodePromise;
|
|
45
|
+
#fabric;
|
|
66
46
|
#started = false;
|
|
47
|
+
#startPromise;
|
|
67
48
|
#nodeNum;
|
|
68
49
|
#netInterface;
|
|
69
50
|
#dclFetchTestCertificates = false;
|
|
70
51
|
#allowTestOtaImages = false;
|
|
71
52
|
#transportPreference;
|
|
53
|
+
#bleEnabled = false;
|
|
72
54
|
#observers;
|
|
73
55
|
constructor(nodeNum, netInterface) {
|
|
74
56
|
this.#environment = Environment.default;
|
|
@@ -83,64 +65,129 @@ class MatterNode {
|
|
|
83
65
|
return this.#environment;
|
|
84
66
|
}
|
|
85
67
|
get node() {
|
|
86
|
-
if (this
|
|
87
|
-
throw new
|
|
68
|
+
if (this.#node === void 0) {
|
|
69
|
+
throw new ImplementationError("Controller node not initialized. Call initialize() first.");
|
|
88
70
|
}
|
|
89
|
-
return this
|
|
71
|
+
return this.#node;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The OTA provider endpoint on the controller node. The cast is unavoidable: `endpoints.for(id)` resolves by
|
|
75
|
+
* runtime id lookup, so it cannot statically know which endpoint type lives at "ota-provider".
|
|
76
|
+
*/
|
|
77
|
+
get otaProviderEndpoint() {
|
|
78
|
+
return this.node.endpoints.for("ota-provider");
|
|
90
79
|
}
|
|
91
80
|
async otaService() {
|
|
81
|
+
await this.start();
|
|
92
82
|
const service = await this.node.act((agent) => agent.get(DclBehavior).otaUpdateService);
|
|
93
83
|
await service.construction;
|
|
94
84
|
return service;
|
|
95
85
|
}
|
|
96
86
|
async certificateService() {
|
|
87
|
+
await this.start();
|
|
97
88
|
const service = await this.node.act((agent) => agent.get(DclBehavior).certificateService);
|
|
98
89
|
await service.construction;
|
|
99
90
|
return service;
|
|
100
91
|
}
|
|
101
92
|
async vendorInfoService() {
|
|
93
|
+
await this.start();
|
|
102
94
|
const service = await this.node.act((agent) => agent.get(DclBehavior).vendorInfoService);
|
|
103
95
|
await service.construction;
|
|
104
96
|
return service;
|
|
105
97
|
}
|
|
106
|
-
async initialize(resetStorage) {
|
|
107
|
-
if (this.#
|
|
108
|
-
|
|
109
|
-
|
|
98
|
+
async initialize(resetStorage, cleanupLegacyStorage = false) {
|
|
99
|
+
if (this.#netInterface !== void 0) {
|
|
100
|
+
this.#environment.vars.set("mdns.networkinterface", this.#netInterface);
|
|
101
|
+
}
|
|
102
|
+
const id = `shell-${this.#nodeNum.toString()}`;
|
|
103
|
+
const nodeEnvironment = new Environment(id, this.#environment);
|
|
104
|
+
this.#nodeEnvironment = nodeEnvironment;
|
|
105
|
+
this.#storageManager = await nodeEnvironment.get(StorageService).open(id);
|
|
106
|
+
this.#storageContext = this.#storageManager.createContext("Node");
|
|
107
|
+
this.#dclFetchTestCertificates = await this.#storageContext.get("DclFetchTestCertificates", false);
|
|
108
|
+
this.#allowTestOtaImages = await this.#storageContext.get("AllowTestOtaImages", false);
|
|
109
|
+
const storedPref = await this.#storageContext.get("TransportPreference", "");
|
|
110
|
+
this.#transportPreference = storedPref === "tcp" || storedPref === "udp" ? storedPref : void 0;
|
|
111
|
+
this.#bleEnabled = (nodeEnvironment.maybeGet(Ble) ?? Environment.default.maybeGet(Ble)) !== void 0;
|
|
112
|
+
if (nodeEnvironment.has(Filesystem)) {
|
|
113
|
+
this.#storageLocation = join(nodeEnvironment.get(Filesystem).path, id);
|
|
114
|
+
}
|
|
115
|
+
if (resetStorage) {
|
|
116
|
+
await (await this.#ensureNode()).erase();
|
|
117
|
+
await eraseLegacyStorage(nodeEnvironment, id);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
await migrateLegacyControllerCredentials(nodeEnvironment, id);
|
|
121
|
+
const node = await this.#ensureNode();
|
|
122
|
+
const { nodes, endpoints, failed } = await migrateLegacyCommissionedNodes(node);
|
|
123
|
+
if (nodes > 0) {
|
|
124
|
+
logger.info(`Legacy storage migration: ${nodes} node(s), ${endpoints} endpoint(s) migrated`);
|
|
125
|
+
}
|
|
126
|
+
if (failed > 0) {
|
|
127
|
+
logger.warn(`${failed} peer(s) failed to migrate; do not run --cleanup-legacy-storage until resolved`);
|
|
128
|
+
}
|
|
129
|
+
if (cleanupLegacyStorage) {
|
|
130
|
+
if (failed > 0) {
|
|
131
|
+
logger.warn(`Skipping --cleanup-legacy-storage this run: ${failed} peer(s) failed to migrate`);
|
|
132
|
+
} else {
|
|
133
|
+
await purgeLegacyStorage(nodeEnvironment, id);
|
|
110
134
|
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Lazily creates the controller {@link ServerNode} on first real use. Creation runs the controller behaviors
|
|
139
|
+
* (binding the mDNS socket), which is why boot defers it until {@link start}.
|
|
140
|
+
*
|
|
141
|
+
* Concurrent callers (e.g. two websocket requests) share one creation via {@link #nodePromise}, so the node is
|
|
142
|
+
* never built twice. A failed creation clears the cached promise so a subsequent call can retry.
|
|
143
|
+
*/
|
|
144
|
+
async #ensureNode() {
|
|
145
|
+
if (this.#node !== void 0) {
|
|
146
|
+
return this.#node;
|
|
147
|
+
}
|
|
148
|
+
if (this.#nodePromise !== void 0) {
|
|
149
|
+
return this.#nodePromise;
|
|
150
|
+
}
|
|
151
|
+
if (this.#nodeEnvironment === void 0) {
|
|
152
|
+
throw new ImplementationError("Controller node accessed before initialize()");
|
|
153
|
+
}
|
|
154
|
+
this.#nodePromise = (async () => {
|
|
111
155
|
const id = `shell-${this.#nodeNum.toString()}`;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
id
|
|
156
|
+
const node = await ServerNode.create(ServerNode.RootEndpoint.with(ControllerBehavior), {
|
|
157
|
+
environment: this.#nodeEnvironment,
|
|
158
|
+
id,
|
|
159
|
+
network: {
|
|
160
|
+
ble: false,
|
|
161
|
+
tcp: true,
|
|
162
|
+
transportPreference: this.#transportPreference,
|
|
163
|
+
// The shell connects peers strictly on demand, so opt out of the online-time bulk connect.
|
|
164
|
+
autoStartCommissionedPeers: false
|
|
122
165
|
},
|
|
123
|
-
autoConnect: false,
|
|
124
|
-
adminFabricLabel: "matter.js Shell",
|
|
125
|
-
enableOtaProvider: true,
|
|
126
|
-
tcp: true,
|
|
127
|
-
transportPreference: this.#transportPreference,
|
|
128
166
|
basicInformation: {
|
|
129
|
-
productName:
|
|
167
|
+
productName: ADMIN_FABRIC_LABEL
|
|
168
|
+
},
|
|
169
|
+
controller: {
|
|
170
|
+
adminFabricLabel: ADMIN_FABRIC_LABEL,
|
|
171
|
+
ble: this.#bleEnabled
|
|
172
|
+
},
|
|
173
|
+
commissioning: {
|
|
174
|
+
enabled: false
|
|
175
|
+
// The controller node is never commissionable itself.
|
|
176
|
+
},
|
|
177
|
+
subscriptions: {
|
|
178
|
+
persistenceEnabled: false
|
|
179
|
+
// Subscription persistence is a device feature, not a controller one.
|
|
130
180
|
}
|
|
131
181
|
});
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
"Legacy support was removed in Matter.js 0.13. Please downgrade or migrate the storage manually"
|
|
142
|
-
);
|
|
143
|
-
process.exit(1);
|
|
182
|
+
await node.add(new Endpoint(OtaProviderEndpoint, { id: "ota-provider" }));
|
|
183
|
+
this.#node = node;
|
|
184
|
+
return node;
|
|
185
|
+
})();
|
|
186
|
+
try {
|
|
187
|
+
return await this.#nodePromise;
|
|
188
|
+
} catch (e) {
|
|
189
|
+
this.#nodePromise = void 0;
|
|
190
|
+
throw e;
|
|
144
191
|
}
|
|
145
192
|
}
|
|
146
193
|
/** Whether OTA updates from the test DCL are offered in addition to production ones. */
|
|
@@ -155,101 +202,157 @@ class MatterNode {
|
|
|
155
202
|
await this.Store.set("AllowTestOtaImages", value);
|
|
156
203
|
}
|
|
157
204
|
this.#allowTestOtaImages = value ?? false;
|
|
158
|
-
if (this.#started && this
|
|
159
|
-
await this.
|
|
205
|
+
if (this.#started && this.#node !== void 0) {
|
|
206
|
+
await this.otaProviderEndpoint.setStateOf(SoftwareUpdateManager, {
|
|
160
207
|
allowTestOtaImages: this.#allowTestOtaImages
|
|
161
208
|
});
|
|
162
209
|
}
|
|
163
210
|
}
|
|
164
211
|
get Store() {
|
|
165
212
|
if (!this.#storageContext) {
|
|
166
|
-
throw new
|
|
213
|
+
throw new ImplementationError("Storage uninitialized");
|
|
167
214
|
}
|
|
168
215
|
return this.#storageContext;
|
|
169
216
|
}
|
|
170
217
|
async close() {
|
|
171
218
|
try {
|
|
172
|
-
await this
|
|
219
|
+
await this.#node?.close();
|
|
173
220
|
} finally {
|
|
174
221
|
this.#observers?.close();
|
|
175
222
|
await this.#storageManager?.close();
|
|
176
223
|
}
|
|
177
224
|
}
|
|
225
|
+
/** Concurrent callers share one in-flight run via {@link #startPromise} so the setup below executes exactly once. */
|
|
178
226
|
async start() {
|
|
179
227
|
if (this.#started) {
|
|
180
228
|
return;
|
|
181
229
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
230
|
+
if (this.#startPromise !== void 0) {
|
|
231
|
+
return this.#startPromise;
|
|
232
|
+
}
|
|
233
|
+
this.#startPromise = (async () => {
|
|
234
|
+
logger.info(`matter.js shell controller started for node ${this.#nodeNum}`);
|
|
235
|
+
const node = await this.#ensureNode();
|
|
236
|
+
const fabricAuthority = await node.env.load(FabricAuthority);
|
|
237
|
+
this.#fabric = await fabricAuthority.defaultFabric({ adminFabricLabel: ADMIN_FABRIC_LABEL });
|
|
238
|
+
await node.start();
|
|
239
|
+
for (const peer of node.peers.commissioned) {
|
|
240
|
+
if (peer.stateOf(NetworkClient).autoSubscribe) {
|
|
241
|
+
await peer.setStateOf(NetworkClient, { autoSubscribe: false });
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
await node.setStateOf(DclBehavior, {
|
|
186
245
|
fetchTestCertificates: this.#dclFetchTestCertificates
|
|
187
246
|
});
|
|
188
|
-
await this.
|
|
247
|
+
await this.otaProviderEndpoint.setStateOf(SoftwareUpdateManager, {
|
|
189
248
|
allowTestOtaImages: this.#allowTestOtaImages
|
|
190
249
|
});
|
|
191
250
|
if (await this.Store.has("ControllerFabricLabel")) {
|
|
192
|
-
await this.
|
|
193
|
-
await this.Store.get("ControllerFabricLabel", "matter.js Shell")
|
|
194
|
-
);
|
|
251
|
+
await this.#fabric.setLabel(await this.Store.get("ControllerFabricLabel", ADMIN_FABRIC_LABEL));
|
|
195
252
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
});
|
|
210
|
-
|
|
253
|
+
this.#observers = this.#observers ?? new ObserverGroup(this.#environment.runtime);
|
|
254
|
+
const updateManagerEvents = this.otaProviderEndpoint.eventsOf(SoftwareUpdateManager);
|
|
255
|
+
this.#observers.on(updateManagerEvents.updateAvailable, (peer, details) => {
|
|
256
|
+
logger.info(`Update available for peer`, peer, `:`, details);
|
|
257
|
+
});
|
|
258
|
+
this.#observers.on(updateManagerEvents.updateDone, (peer) => {
|
|
259
|
+
logger.info(`Update done for peer`, peer);
|
|
260
|
+
});
|
|
261
|
+
this.#observers.on(updateManagerEvents.updateFailed, (peer) => {
|
|
262
|
+
logger.info(`Update failed for peer`, peer);
|
|
263
|
+
});
|
|
264
|
+
installDiagnosticLogging(node, this.#observers);
|
|
265
|
+
this.#started = true;
|
|
266
|
+
})();
|
|
267
|
+
try {
|
|
268
|
+
await this.#startPromise;
|
|
269
|
+
} finally {
|
|
270
|
+
this.#startPromise = void 0;
|
|
271
|
+
}
|
|
211
272
|
}
|
|
273
|
+
/**
|
|
274
|
+
* Returns the {@link ClientNode}s for the commissioned peers, connecting them (unless `autoConnect: false`).
|
|
275
|
+
* Nodes connect asynchronously; use {@link awaitSeeded} before relying on the endpoint structure.
|
|
276
|
+
*/
|
|
212
277
|
async connectAndGetNodes(nodeIdStr, connectOptions) {
|
|
213
278
|
await this.start();
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
279
|
+
const commissioned = this.node.peers.commissioned;
|
|
280
|
+
const singleNodeRequested = nodeIdStr !== void 0;
|
|
281
|
+
let nodes;
|
|
282
|
+
if (nodeIdStr !== void 0) {
|
|
283
|
+
const nodeId = NodeId(BigInt(nodeIdStr));
|
|
284
|
+
const node = commissioned.find((peer) => peer.peerAddress?.nodeId === nodeId);
|
|
285
|
+
if (node === void 0) {
|
|
286
|
+
throw new ImplementationError(`Node ${nodeId} is not commissioned!`);
|
|
287
|
+
}
|
|
288
|
+
nodes = [node];
|
|
289
|
+
} else {
|
|
290
|
+
nodes = commissioned;
|
|
221
291
|
}
|
|
222
|
-
const node
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
292
|
+
for (const node of nodes) {
|
|
293
|
+
try {
|
|
294
|
+
await this.#applyClientNodeNetworkOptions(node, connectOptions);
|
|
295
|
+
if (connectOptions?.autoConnect === false) {
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
298
|
+
if (node.stateOf(NetworkClient).isDisabled) {
|
|
299
|
+
await node.enable();
|
|
300
|
+
} else {
|
|
301
|
+
await node.start();
|
|
302
|
+
}
|
|
303
|
+
} catch (e) {
|
|
304
|
+
if (singleNodeRequested) {
|
|
305
|
+
throw e;
|
|
306
|
+
}
|
|
307
|
+
logger.warn(`Node ${node.peerAddress?.nodeId} failed to connect:`, e);
|
|
308
|
+
}
|
|
227
309
|
}
|
|
228
|
-
return
|
|
310
|
+
return nodes;
|
|
229
311
|
}
|
|
230
|
-
|
|
231
|
-
if (
|
|
232
|
-
|
|
312
|
+
async #applyClientNodeNetworkOptions(node, options) {
|
|
313
|
+
if (options?.autoSubscribe !== void 0) {
|
|
314
|
+
await node.setStateOf(NetworkClient, { autoSubscribe: options.autoSubscribe });
|
|
315
|
+
}
|
|
316
|
+
const { subscribeMinIntervalFloorSeconds, subscribeMaxIntervalCeilingSeconds } = options ?? {};
|
|
317
|
+
if (subscribeMinIntervalFloorSeconds !== void 0 || subscribeMaxIntervalCeilingSeconds !== void 0) {
|
|
318
|
+
const defaultSubscription = {};
|
|
319
|
+
if (subscribeMinIntervalFloorSeconds !== void 0) {
|
|
320
|
+
defaultSubscription.minIntervalFloor = Seconds(subscribeMinIntervalFloorSeconds);
|
|
321
|
+
}
|
|
322
|
+
if (subscribeMaxIntervalCeilingSeconds !== void 0) {
|
|
323
|
+
defaultSubscription.maxIntervalCeiling = Seconds(subscribeMaxIntervalCeilingSeconds);
|
|
324
|
+
}
|
|
325
|
+
await node.setStateOf(NetworkClient, { defaultSubscription });
|
|
233
326
|
}
|
|
234
|
-
return this.commissioningController;
|
|
235
327
|
}
|
|
236
|
-
|
|
328
|
+
/**
|
|
329
|
+
* Iterates the endpoints of each {@link ClientNode}, including the root endpoint (number 0); pass
|
|
330
|
+
* {@link endpointIds} to restrict iteration.
|
|
331
|
+
*/
|
|
332
|
+
async iterateNodeDevices(nodes, callback, endpointIds) {
|
|
237
333
|
for (const node of nodes) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
for (const device of devices) {
|
|
334
|
+
for (const device of node.endpoints) {
|
|
335
|
+
if (endpointIds !== void 0 && !endpointIds.includes(device.number)) {
|
|
336
|
+
continue;
|
|
337
|
+
}
|
|
243
338
|
await callback(device, node);
|
|
244
339
|
}
|
|
245
340
|
}
|
|
246
341
|
}
|
|
247
|
-
|
|
248
|
-
|
|
342
|
+
/**
|
|
343
|
+
* Updates the controller's admin fabric label on the local fabric. Propagation to already-connected peers is not
|
|
344
|
+
* reproduced and moves to the node-management layer per docs/MIGRATION_CONTROLLER_018.md.
|
|
345
|
+
* MIGRATION-GAP: updatefabriclabel-note.
|
|
346
|
+
*/
|
|
347
|
+
async updateFabricLabel(label) {
|
|
348
|
+
await this.start();
|
|
349
|
+
if (this.#fabric === void 0) {
|
|
350
|
+
throw new InternalError("Controller fabric not initialized");
|
|
351
|
+
}
|
|
352
|
+
await this.#fabric.setLabel(label);
|
|
249
353
|
}
|
|
250
354
|
}
|
|
251
355
|
export {
|
|
252
|
-
MatterNode
|
|
253
|
-
createDiagnosticCallbacks
|
|
356
|
+
MatterNode
|
|
254
357
|
};
|
|
255
358
|
//# sourceMappingURL=MatterNode.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/MatterNode.ts"],
|
|
4
|
-
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAOA;AAAA,
|
|
4
|
+
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAOA;AAAA,EAEI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,OACG;AACP;AAAA,EAEI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,2BAA2B;AACpC,SAAS,KAAa,uBAAuB;AAC7C,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,gCAAgC;AACzC;AAAA,EACI,wBAAwB;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAEP,MAAM,SAAS,OAAO,I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AO,MAAM,GAAG;AACnE;AAAA,QACJ;AACA,cAAM,SAAS,QAAQ,IAAI;AAAA,MAC/B;AAAA,IACJ;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,kBAAkB,OAAe;AACnC,UAAM,KAAK,MAAM;AACjB,QAAI,KAAK,YAAY,QAAW;AAC5B,YAAM,IAAI,cAAc,mCAAmC;AAAA,IAC/D;AACA,UAAM,KAAK,QAAQ,SAAS,KAAK;AAAA,EACrC;AACJ;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/esm/app.js
CHANGED
|
@@ -67,6 +67,11 @@ async function main() {
|
|
|
67
67
|
default: false,
|
|
68
68
|
type: "boolean"
|
|
69
69
|
},
|
|
70
|
+
"cleanup-legacy-storage": {
|
|
71
|
+
description: "Irreversibly delete pre-0.16 storage artifacts after migration. Only use this once you are certain the migration succeeded and you will not downgrade below 0.16.",
|
|
72
|
+
default: false,
|
|
73
|
+
type: "boolean"
|
|
74
|
+
},
|
|
70
75
|
netInterface: {
|
|
71
76
|
description: "Network interface to use for MDNS announcements and scanning.",
|
|
72
77
|
type: "string",
|
|
@@ -109,6 +114,7 @@ async function main() {
|
|
|
109
114
|
bleHciId,
|
|
110
115
|
nodeType,
|
|
111
116
|
factoryReset,
|
|
117
|
+
cleanupLegacyStorage,
|
|
112
118
|
netInterface,
|
|
113
119
|
logfile,
|
|
114
120
|
webSocketInterface,
|
|
@@ -116,8 +122,14 @@ async function main() {
|
|
|
116
122
|
webServer,
|
|
117
123
|
webAddress
|
|
118
124
|
} = argv;
|
|
125
|
+
if (bleEnable) {
|
|
126
|
+
Environment.default.vars.set("ble.enable", true);
|
|
127
|
+
}
|
|
128
|
+
if (bleHciId !== void 0) {
|
|
129
|
+
Environment.default.vars.set("ble.hci.id", bleHciId);
|
|
130
|
+
}
|
|
119
131
|
theNode = new MatterNode(nodeNum, netInterface);
|
|
120
|
-
await theNode.initialize(factoryReset);
|
|
132
|
+
await theNode.initialize(factoryReset, cleanupLegacyStorage);
|
|
121
133
|
if (logfile !== void 0) {
|
|
122
134
|
await theNode.Store.set("LogFile", logfile);
|
|
123
135
|
}
|
|
@@ -138,12 +150,6 @@ async function main() {
|
|
|
138
150
|
} else {
|
|
139
151
|
theShell = new Shell(theNode, nodeNum, PROMPT, process.stdin, process.stdout);
|
|
140
152
|
}
|
|
141
|
-
if (bleEnable) {
|
|
142
|
-
Environment.default.vars.set("ble.enable", true);
|
|
143
|
-
}
|
|
144
|
-
if (bleHciId !== void 0) {
|
|
145
|
-
Environment.default.vars.set("ble.hci.id", bleHciId);
|
|
146
|
-
}
|
|
147
153
|
console.log(`Started Node #${nodeNum} (Type: ${nodeType}) ${bleEnable ? "with" : "without"} BLE`);
|
|
148
154
|
if (!webSocketInterface) {
|
|
149
155
|
theShell.start(theNode.storageLocation);
|
package/dist/esm/app.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/app.ts"],
|
|
4
|
-
"mappings": ";AACA;AAAA;AAAA;AAAA;AAAA;AAMA,SAAS,aAAa,gBAAgB,WAAW,QAAQ,gBAAgB;AACzE,SAAS,wBAAwB;AACjC,OAAO;AACP,OAAO,WAAW;AAClB,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AACtB,SAAS,6BAA6B;AAEtC,MAAM,SAAS;AACf,MAAM,yBAAyB;AAC/B,MAAM,SAAS,OAAO,IAAI,OAAO;AACjC,IAAI;AAEJ,IAAI,QAAQ,OAAO,MAAO,QAAO,SAAS,UAAU;AAEpD,IAAI;AAEG,SAAS,YAAY,YAAoB,OAAqB;AACjE,MAAI,WAAW,SAAS;AACxB,UAAQ,OAAO;AAAA,IACX,KAAK;AACD,iBAAW,SAAS;AACpB;AAAA,IACJ,KAAK;AACD,iBAAW,SAAS;AACpB;AAAA,IACJ,KAAK;AACD,iBAAW,SAAS;AACpB;AAAA,IAC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