@matter/protocol 0.13.1-alpha.0-20250517-99a1e848a → 0.14.0-alpha.0-20250521-979eda05d

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.
Files changed (266) hide show
  1. package/dist/cjs/action/Interactable.d.ts +1 -1
  2. package/dist/cjs/action/Interactable.d.ts.map +1 -1
  3. package/dist/cjs/action/client/ClientInteraction.d.ts +1 -1
  4. package/dist/cjs/action/client/ClientInteraction.d.ts.map +1 -1
  5. package/dist/cjs/action/client/ClientInteraction.js +50 -8
  6. package/dist/cjs/action/client/ClientInteraction.js.map +1 -1
  7. package/dist/cjs/action/protocols.d.ts +49 -15
  8. package/dist/cjs/action/protocols.d.ts.map +1 -1
  9. package/dist/cjs/action/request/Invoke.d.ts +10 -1
  10. package/dist/cjs/action/request/Invoke.d.ts.map +1 -1
  11. package/dist/cjs/action/request/Invoke.js +17 -5
  12. package/dist/cjs/action/request/Invoke.js.map +1 -1
  13. package/dist/cjs/action/request/Read.d.ts.map +1 -1
  14. package/dist/cjs/action/request/Read.js +1 -1
  15. package/dist/cjs/action/request/Read.js.map +1 -1
  16. package/dist/cjs/action/request/Write.d.ts +2 -0
  17. package/dist/cjs/action/request/Write.d.ts.map +1 -1
  18. package/dist/cjs/action/request/Write.js.map +1 -1
  19. package/dist/cjs/action/response/InvokeResult.d.ts +22 -6
  20. package/dist/cjs/action/response/InvokeResult.d.ts.map +1 -1
  21. package/dist/cjs/action/server/AttributeReadResponse.d.ts.map +1 -1
  22. package/dist/cjs/action/server/AttributeReadResponse.js +1 -2
  23. package/dist/cjs/action/server/AttributeReadResponse.js.map +2 -2
  24. package/dist/cjs/action/server/CommandInvokeResponse.d.ts +25 -0
  25. package/dist/cjs/action/server/CommandInvokeResponse.d.ts.map +1 -0
  26. package/dist/cjs/action/server/CommandInvokeResponse.js +331 -0
  27. package/dist/cjs/action/server/CommandInvokeResponse.js.map +6 -0
  28. package/dist/cjs/action/server/EventReadResponse.js +1 -1
  29. package/dist/cjs/action/server/ServerInteraction.d.ts +1 -3
  30. package/dist/cjs/action/server/ServerInteraction.d.ts.map +1 -1
  31. package/dist/cjs/action/server/ServerInteraction.js +4 -2
  32. package/dist/cjs/action/server/ServerInteraction.js.map +1 -1
  33. package/dist/cjs/action/server/index.d.ts +1 -0
  34. package/dist/cjs/action/server/index.d.ts.map +1 -1
  35. package/dist/cjs/action/server/index.js +1 -0
  36. package/dist/cjs/action/server/index.js.map +1 -1
  37. package/dist/cjs/cluster/client/AttributeClient.d.ts +2 -0
  38. package/dist/cjs/cluster/client/AttributeClient.d.ts.map +1 -1
  39. package/dist/cjs/cluster/client/AttributeClient.js +10 -0
  40. package/dist/cjs/cluster/client/AttributeClient.js.map +1 -1
  41. package/dist/cjs/cluster/client/ClusterClientTypes.d.ts +0 -4
  42. package/dist/cjs/cluster/client/ClusterClientTypes.d.ts.map +1 -1
  43. package/dist/cjs/cluster/index.d.ts +0 -1
  44. package/dist/cjs/cluster/index.d.ts.map +1 -1
  45. package/dist/cjs/cluster/index.js +0 -1
  46. package/dist/cjs/cluster/index.js.map +1 -1
  47. package/dist/cjs/index.d.ts +0 -1
  48. package/dist/cjs/index.d.ts.map +1 -1
  49. package/dist/cjs/index.js +0 -1
  50. package/dist/cjs/index.js.map +1 -1
  51. package/dist/cjs/interaction/AttributeDataEncoder.d.ts +1 -1
  52. package/dist/cjs/interaction/InteractionClient.d.ts +13 -0
  53. package/dist/cjs/interaction/InteractionClient.d.ts.map +1 -1
  54. package/dist/cjs/interaction/InteractionClient.js +14 -0
  55. package/dist/cjs/interaction/InteractionClient.js.map +1 -1
  56. package/dist/cjs/interaction/InteractionMessenger.d.ts +8 -8
  57. package/dist/cjs/interaction/SubscriptionClient.d.ts +1 -1
  58. package/dist/cjs/interaction/SubscriptionClient.d.ts.map +1 -1
  59. package/dist/cjs/interaction/SubscriptionClient.js +2 -2
  60. package/dist/cjs/interaction/SubscriptionClient.js.map +1 -1
  61. package/dist/cjs/interaction/index.d.ts +0 -1
  62. package/dist/cjs/interaction/index.d.ts.map +1 -1
  63. package/dist/cjs/interaction/index.js +0 -1
  64. package/dist/cjs/interaction/index.js.map +1 -1
  65. package/dist/cjs/peer/InteractionQueue.d.ts +1 -1
  66. package/dist/cjs/peer/InteractionQueue.d.ts.map +1 -1
  67. package/dist/cjs/peer/InteractionQueue.js +1 -1
  68. package/dist/cjs/peer/PeerAddress.d.ts +1 -1
  69. package/dist/cjs/peer/PeerAddress.d.ts.map +1 -1
  70. package/dist/cjs/peer/PeerAddressStore.d.ts +2 -2
  71. package/dist/cjs/peer/PeerAddressStore.d.ts.map +1 -1
  72. package/dist/cjs/peer/PeerSet.js +1 -1
  73. package/dist/cjs/session/pase/PaseClient.d.ts.map +1 -1
  74. package/dist/cjs/session/pase/PaseClient.js +2 -3
  75. package/dist/cjs/session/pase/PaseClient.js.map +2 -2
  76. package/dist/esm/action/Interactable.d.ts +1 -1
  77. package/dist/esm/action/Interactable.d.ts.map +1 -1
  78. package/dist/esm/action/client/ClientInteraction.d.ts +1 -1
  79. package/dist/esm/action/client/ClientInteraction.d.ts.map +1 -1
  80. package/dist/esm/action/client/ClientInteraction.js +50 -8
  81. package/dist/esm/action/client/ClientInteraction.js.map +1 -1
  82. package/dist/esm/action/protocols.d.ts +49 -15
  83. package/dist/esm/action/protocols.d.ts.map +1 -1
  84. package/dist/esm/action/request/Invoke.d.ts +10 -1
  85. package/dist/esm/action/request/Invoke.d.ts.map +1 -1
  86. package/dist/esm/action/request/Invoke.js +17 -5
  87. package/dist/esm/action/request/Invoke.js.map +1 -1
  88. package/dist/esm/action/request/Read.d.ts.map +1 -1
  89. package/dist/esm/action/request/Read.js +1 -1
  90. package/dist/esm/action/request/Read.js.map +1 -1
  91. package/dist/esm/action/request/Write.d.ts +2 -0
  92. package/dist/esm/action/request/Write.d.ts.map +1 -1
  93. package/dist/esm/action/request/Write.js.map +1 -1
  94. package/dist/esm/action/response/InvokeResult.d.ts +22 -6
  95. package/dist/esm/action/response/InvokeResult.d.ts.map +1 -1
  96. package/dist/esm/action/server/AttributeReadResponse.d.ts.map +1 -1
  97. package/dist/esm/action/server/AttributeReadResponse.js +1 -1
  98. package/dist/esm/action/server/AttributeReadResponse.js.map +1 -1
  99. package/dist/esm/action/server/CommandInvokeResponse.d.ts +25 -0
  100. package/dist/esm/action/server/CommandInvokeResponse.d.ts.map +1 -0
  101. package/dist/esm/action/server/CommandInvokeResponse.js +317 -0
  102. package/dist/esm/action/server/CommandInvokeResponse.js.map +6 -0
  103. package/dist/esm/action/server/EventReadResponse.js +1 -1
  104. package/dist/esm/action/server/ServerInteraction.d.ts +1 -3
  105. package/dist/esm/action/server/ServerInteraction.d.ts.map +1 -1
  106. package/dist/esm/action/server/ServerInteraction.js +4 -2
  107. package/dist/esm/action/server/ServerInteraction.js.map +1 -1
  108. package/dist/esm/action/server/index.d.ts +1 -0
  109. package/dist/esm/action/server/index.d.ts.map +1 -1
  110. package/dist/esm/action/server/index.js +1 -0
  111. package/dist/esm/action/server/index.js.map +1 -1
  112. package/dist/esm/cluster/client/AttributeClient.d.ts +2 -0
  113. package/dist/esm/cluster/client/AttributeClient.d.ts.map +1 -1
  114. package/dist/esm/cluster/client/AttributeClient.js +10 -0
  115. package/dist/esm/cluster/client/AttributeClient.js.map +1 -1
  116. package/dist/esm/cluster/client/ClusterClientTypes.d.ts +0 -4
  117. package/dist/esm/cluster/client/ClusterClientTypes.d.ts.map +1 -1
  118. package/dist/esm/cluster/index.d.ts +0 -1
  119. package/dist/esm/cluster/index.d.ts.map +1 -1
  120. package/dist/esm/cluster/index.js +0 -1
  121. package/dist/esm/cluster/index.js.map +1 -1
  122. package/dist/esm/index.d.ts +0 -1
  123. package/dist/esm/index.d.ts.map +1 -1
  124. package/dist/esm/index.js +0 -1
  125. package/dist/esm/index.js.map +1 -1
  126. package/dist/esm/interaction/AttributeDataEncoder.d.ts +1 -1
  127. package/dist/esm/interaction/InteractionClient.d.ts +13 -0
  128. package/dist/esm/interaction/InteractionClient.d.ts.map +1 -1
  129. package/dist/esm/interaction/InteractionClient.js +14 -0
  130. package/dist/esm/interaction/InteractionClient.js.map +1 -1
  131. package/dist/esm/interaction/InteractionMessenger.d.ts +8 -8
  132. package/dist/esm/interaction/SubscriptionClient.d.ts +1 -1
  133. package/dist/esm/interaction/SubscriptionClient.d.ts.map +1 -1
  134. package/dist/esm/interaction/SubscriptionClient.js +2 -2
  135. package/dist/esm/interaction/SubscriptionClient.js.map +1 -1
  136. package/dist/esm/interaction/index.d.ts +0 -1
  137. package/dist/esm/interaction/index.d.ts.map +1 -1
  138. package/dist/esm/interaction/index.js +0 -1
  139. package/dist/esm/interaction/index.js.map +1 -1
  140. package/dist/esm/peer/InteractionQueue.d.ts +1 -1
  141. package/dist/esm/peer/InteractionQueue.d.ts.map +1 -1
  142. package/dist/esm/peer/InteractionQueue.js +1 -1
  143. package/dist/esm/peer/PeerAddress.d.ts +1 -1
  144. package/dist/esm/peer/PeerAddress.d.ts.map +1 -1
  145. package/dist/esm/peer/PeerAddressStore.d.ts +2 -2
  146. package/dist/esm/peer/PeerAddressStore.d.ts.map +1 -1
  147. package/dist/esm/peer/PeerSet.js +1 -1
  148. package/dist/esm/session/pase/PaseClient.d.ts.map +1 -1
  149. package/dist/esm/session/pase/PaseClient.js +1 -2
  150. package/dist/esm/session/pase/PaseClient.js.map +1 -1
  151. package/package.json +6 -6
  152. package/src/action/Interactable.ts +1 -1
  153. package/src/action/client/ClientInteraction.ts +53 -16
  154. package/src/action/protocols.ts +70 -16
  155. package/src/action/request/Invoke.ts +32 -5
  156. package/src/action/request/Read.ts +1 -1
  157. package/src/action/request/Write.ts +4 -1
  158. package/src/action/response/InvokeResult.ts +26 -6
  159. package/src/action/response/ReadResult.ts +1 -1
  160. package/src/action/server/AttributeReadResponse.ts +1 -1
  161. package/src/action/server/CommandInvokeResponse.ts +427 -0
  162. package/src/action/server/EventReadResponse.ts +1 -1
  163. package/src/action/server/ServerInteraction.ts +6 -5
  164. package/src/action/server/index.ts +1 -0
  165. package/src/cluster/client/AttributeClient.ts +12 -0
  166. package/src/cluster/client/ClusterClientTypes.ts +0 -6
  167. package/src/cluster/index.ts +0 -1
  168. package/src/index.ts +0 -1
  169. package/src/interaction/InteractionClient.ts +24 -0
  170. package/src/interaction/SubscriptionClient.ts +2 -2
  171. package/src/interaction/index.ts +0 -1
  172. package/src/peer/InteractionQueue.ts +1 -1
  173. package/src/peer/PeerAddress.ts +1 -1
  174. package/src/peer/PeerAddressStore.ts +2 -2
  175. package/src/peer/PeerSet.ts +1 -1
  176. package/src/session/pase/PaseClient.ts +1 -2
  177. package/dist/cjs/cluster/server/AttributeServer.d.ts +0 -307
  178. package/dist/cjs/cluster/server/AttributeServer.d.ts.map +0 -1
  179. package/dist/cjs/cluster/server/AttributeServer.js +0 -736
  180. package/dist/cjs/cluster/server/AttributeServer.js.map +0 -6
  181. package/dist/cjs/cluster/server/ClusterDatasource.d.ts +0 -16
  182. package/dist/cjs/cluster/server/ClusterDatasource.d.ts.map +0 -1
  183. package/dist/cjs/cluster/server/ClusterDatasource.js +0 -22
  184. package/dist/cjs/cluster/server/ClusterDatasource.js.map +0 -6
  185. package/dist/cjs/cluster/server/ClusterServer.d.ts +0 -40
  186. package/dist/cjs/cluster/server/ClusterServer.d.ts.map +0 -1
  187. package/dist/cjs/cluster/server/ClusterServer.js +0 -22
  188. package/dist/cjs/cluster/server/ClusterServer.js.map +0 -6
  189. package/dist/cjs/cluster/server/CommandServer.d.ts +0 -34
  190. package/dist/cjs/cluster/server/CommandServer.d.ts.map +0 -1
  191. package/dist/cjs/cluster/server/CommandServer.js +0 -76
  192. package/dist/cjs/cluster/server/CommandServer.js.map +0 -6
  193. package/dist/cjs/cluster/server/EventServer.d.ts +0 -42
  194. package/dist/cjs/cluster/server/EventServer.d.ts.map +0 -1
  195. package/dist/cjs/cluster/server/EventServer.js +0 -152
  196. package/dist/cjs/cluster/server/EventServer.js.map +0 -6
  197. package/dist/cjs/cluster/server/index.d.ts +0 -11
  198. package/dist/cjs/cluster/server/index.d.ts.map +0 -1
  199. package/dist/cjs/cluster/server/index.js +0 -28
  200. package/dist/cjs/cluster/server/index.js.map +0 -6
  201. package/dist/cjs/endpoint/EndpointInterface.d.ts +0 -37
  202. package/dist/cjs/endpoint/EndpointInterface.d.ts.map +0 -1
  203. package/dist/cjs/endpoint/EndpointInterface.js +0 -22
  204. package/dist/cjs/endpoint/EndpointInterface.js.map +0 -6
  205. package/dist/cjs/endpoint/EndpointStructureLogger.d.ts +0 -31
  206. package/dist/cjs/endpoint/EndpointStructureLogger.d.ts.map +0 -1
  207. package/dist/cjs/endpoint/EndpointStructureLogger.js +0 -230
  208. package/dist/cjs/endpoint/EndpointStructureLogger.js.map +0 -6
  209. package/dist/cjs/endpoint/index.d.ts +0 -8
  210. package/dist/cjs/endpoint/index.d.ts.map +0 -1
  211. package/dist/cjs/endpoint/index.js +0 -25
  212. package/dist/cjs/endpoint/index.js.map +0 -6
  213. package/dist/cjs/interaction/InteractionEndpointStructure.d.ts +0 -95
  214. package/dist/cjs/interaction/InteractionEndpointStructure.d.ts.map +0 -1
  215. package/dist/cjs/interaction/InteractionEndpointStructure.js +0 -359
  216. package/dist/cjs/interaction/InteractionEndpointStructure.js.map +0 -6
  217. package/dist/esm/cluster/server/AttributeServer.d.ts +0 -307
  218. package/dist/esm/cluster/server/AttributeServer.d.ts.map +0 -1
  219. package/dist/esm/cluster/server/AttributeServer.js +0 -729
  220. package/dist/esm/cluster/server/AttributeServer.js.map +0 -6
  221. package/dist/esm/cluster/server/ClusterDatasource.d.ts +0 -16
  222. package/dist/esm/cluster/server/ClusterDatasource.d.ts.map +0 -1
  223. package/dist/esm/cluster/server/ClusterDatasource.js +0 -6
  224. package/dist/esm/cluster/server/ClusterDatasource.js.map +0 -6
  225. package/dist/esm/cluster/server/ClusterServer.d.ts +0 -40
  226. package/dist/esm/cluster/server/ClusterServer.d.ts.map +0 -1
  227. package/dist/esm/cluster/server/ClusterServer.js +0 -6
  228. package/dist/esm/cluster/server/ClusterServer.js.map +0 -6
  229. package/dist/esm/cluster/server/CommandServer.d.ts +0 -34
  230. package/dist/esm/cluster/server/CommandServer.d.ts.map +0 -1
  231. package/dist/esm/cluster/server/CommandServer.js +0 -56
  232. package/dist/esm/cluster/server/CommandServer.js.map +0 -6
  233. package/dist/esm/cluster/server/EventServer.d.ts +0 -42
  234. package/dist/esm/cluster/server/EventServer.d.ts.map +0 -1
  235. package/dist/esm/cluster/server/EventServer.js +0 -141
  236. package/dist/esm/cluster/server/EventServer.js.map +0 -6
  237. package/dist/esm/cluster/server/index.d.ts +0 -11
  238. package/dist/esm/cluster/server/index.d.ts.map +0 -1
  239. package/dist/esm/cluster/server/index.js +0 -11
  240. package/dist/esm/cluster/server/index.js.map +0 -6
  241. package/dist/esm/endpoint/EndpointInterface.d.ts +0 -37
  242. package/dist/esm/endpoint/EndpointInterface.d.ts.map +0 -1
  243. package/dist/esm/endpoint/EndpointInterface.js +0 -6
  244. package/dist/esm/endpoint/EndpointInterface.js.map +0 -6
  245. package/dist/esm/endpoint/EndpointStructureLogger.d.ts +0 -31
  246. package/dist/esm/endpoint/EndpointStructureLogger.d.ts.map +0 -1
  247. package/dist/esm/endpoint/EndpointStructureLogger.js +0 -210
  248. package/dist/esm/endpoint/EndpointStructureLogger.js.map +0 -6
  249. package/dist/esm/endpoint/index.d.ts +0 -8
  250. package/dist/esm/endpoint/index.d.ts.map +0 -1
  251. package/dist/esm/endpoint/index.js +0 -8
  252. package/dist/esm/endpoint/index.js.map +0 -6
  253. package/dist/esm/interaction/InteractionEndpointStructure.d.ts +0 -95
  254. package/dist/esm/interaction/InteractionEndpointStructure.d.ts.map +0 -1
  255. package/dist/esm/interaction/InteractionEndpointStructure.js +0 -355
  256. package/dist/esm/interaction/InteractionEndpointStructure.js.map +0 -6
  257. package/src/cluster/server/AttributeServer.ts +0 -997
  258. package/src/cluster/server/ClusterDatasource.ts +0 -17
  259. package/src/cluster/server/ClusterServer.ts +0 -46
  260. package/src/cluster/server/CommandServer.ts +0 -89
  261. package/src/cluster/server/EventServer.ts +0 -202
  262. package/src/cluster/server/index.ts +0 -11
  263. package/src/endpoint/EndpointInterface.ts +0 -41
  264. package/src/endpoint/EndpointStructureLogger.ts +0 -270
  265. package/src/endpoint/index.ts +0 -8
  266. package/src/interaction/InteractionEndpointStructure.ts +0 -510
@@ -8,15 +8,24 @@ import { InteractionSession } from "#action/Interactable.js";
8
8
  import { OccurrenceManager } from "#events/OccurrenceManager.js";
9
9
  import { MaybePromise, Observable } from "#general";
10
10
  import { DataModelPath, MatterModel } from "#model";
11
- import type { AttributeId, ClusterId, DeviceTypeId, EndpointNumber, FabricIndex, NodeId, TlvSchema } from "#types";
12
- import { AttributePath, EventId, EventPath } from "#types";
11
+ import type {
12
+ AttributeId,
13
+ ClusterId,
14
+ CommandId,
15
+ DeviceTypeId,
16
+ EndpointNumber,
17
+ FabricIndex,
18
+ NodeId,
19
+ TlvSchema,
20
+ } from "#types";
21
+ import { AttributePath, CommandPath, EventId, EventPath } from "#types";
13
22
  import { AccessControl } from "./server/AccessControl.js";
14
23
  import { Val } from "./Val.js";
15
24
 
16
- export interface AvailableElementIds {
17
- attributes: Set<AttributeId>;
18
- events: Set<EventId>;
19
- }
25
+ export type CommandInvokeHandler = (
26
+ args: Val.Struct | undefined,
27
+ session: InteractionSession,
28
+ ) => MaybePromise<Val.Struct | void>;
20
29
 
21
30
  /**
22
31
  * Optimized Matter protocol<->JS object interface
@@ -65,7 +74,7 @@ export interface NodeProtocol extends CollectionProtocol<EndpointProtocol> {
65
74
  /**
66
75
  * Inspects an Attribute- or Event path and log in human-readable form if possible
67
76
  */
68
- inspectPath(path: AttributePath | EventPath): string;
77
+ inspectPath(path: AttributePath | EventPath | CommandPath): string;
69
78
  }
70
79
 
71
80
  /**
@@ -74,6 +83,11 @@ export interface NodeProtocol extends CollectionProtocol<EndpointProtocol> {
74
83
  export interface EndpointProtocol
75
84
  extends CollectionProtocol<ClusterProtocol>,
76
85
  AddressableElementProtocol<EndpointNumber> {
86
+ /**
87
+ * Bitmap with each wildcard path flag bit set where this value should be skipped.
88
+ */
89
+ wildcardPathFlags: number;
90
+
77
91
  /**
78
92
  * Path to the endpoint within the data model.
79
93
  */
@@ -118,6 +132,11 @@ export interface ClusterProtocol {
118
132
  * session. So doing is the responsibility of the node implementation.
119
133
  */
120
134
  openForWrite(session: InteractionSession): Promise<Val.ProtocolStruct>;
135
+
136
+ /**
137
+ * Invoke handler for the commands of the cluster
138
+ */
139
+ commands: Record<CommandId, CommandInvokeHandler>;
121
140
  }
122
141
 
123
142
  /**
@@ -126,6 +145,11 @@ export interface ClusterProtocol {
126
145
  * TODO - commands
127
146
  */
128
147
  export interface ClusterTypeProtocol extends AddressableElementProtocol<ClusterId> {
148
+ /**
149
+ * Bitmap with each wildcard path flag bit set where this value should be skipped.
150
+ */
151
+ wildcardPathFlags: number;
152
+
129
153
  /**
130
154
  * Attribute metadata.
131
155
  */
@@ -135,12 +159,22 @@ export interface ClusterTypeProtocol extends AddressableElementProtocol<ClusterI
135
159
  * Event metadata.
136
160
  */
137
161
  events: CollectionProtocol<EventTypeProtocol>;
162
+
163
+ /**
164
+ * Command metadata.
165
+ */
166
+ commands: CollectionProtocol<CommandTypeProtocol>;
138
167
  }
139
168
 
140
169
  /**
141
- * Descriptor for a specific property type.
170
+ * Descriptor for a specific attribute property type.
142
171
  */
143
172
  export interface AttributeTypeProtocol extends AddressableElementProtocol<AttributeId> {
173
+ /**
174
+ * Bitmap with each wildcard path flag bit set where this value should be skipped.
175
+ */
176
+ wildcardPathFlags: number;
177
+
144
178
  /**
145
179
  * The TLV schema for this property.
146
180
  */
@@ -163,16 +197,41 @@ export interface AttributeTypeProtocol extends AddressableElementProtocol<Attrib
163
197
  }
164
198
 
165
199
  /**
166
- * Descriptor for a specific property type.
200
+ * Descriptor for a specific event property type.
167
201
  */
168
- export interface EventTypeProtocol extends Omit<AddressableElementProtocol<EventId>, "wildcardPathFlags"> {
202
+ export interface EventTypeProtocol extends AddressableElementProtocol<EventId> {
169
203
  /**
170
204
  * The TLV schema for this property.
171
205
  */
172
206
  tlv: TlvSchema<unknown>;
173
207
 
174
208
  /**
175
- * Access control information for the attribute.
209
+ * Access control information for the event.
210
+ */
211
+ limits: AccessControl.Limits;
212
+ }
213
+
214
+ /**
215
+ * Descriptor for a specific command property type.
216
+ */
217
+ export interface CommandTypeProtocol extends AddressableElementProtocol<CommandId> {
218
+ /**
219
+ * The TLV schema for the command request.
220
+ */
221
+ requestTlv: TlvSchema<unknown>;
222
+
223
+ /**
224
+ * The TLV schema for the command response.
225
+ */
226
+ responseTlv: TlvSchema<unknown>;
227
+
228
+ /**
229
+ * The Response command Id
230
+ */
231
+ responseId: CommandId;
232
+
233
+ /**
234
+ * Access control information for the command.
176
235
  */
177
236
  limits: AccessControl.Limits;
178
237
  }
@@ -190,11 +249,6 @@ export interface AddressableElementProtocol<N extends number> {
190
249
  * Human readable name of the element.
191
250
  */
192
251
  name: string;
193
-
194
- /**
195
- * Bitmap with each wildcard path flag bit set where this value should be skipped.
196
- */
197
- wildcardPathFlags: number;
198
252
  }
199
253
 
200
254
  /**
@@ -10,26 +10,53 @@ import { MalformedRequestError } from "./MalformedRequestError.js";
10
10
  import { Specifier } from "./Specifier.js";
11
11
 
12
12
  export interface Invoke extends InvokeRequest {
13
+ /** Timeout only relevant for Client Interactions */
13
14
  timeout?: number;
14
15
  }
15
16
 
16
17
  /**
17
18
  * Request invocation of one or more commands.
18
19
  */
19
- export function Invoke(definition: Invoke.Definition): Invoke {
20
+ export function Invoke(options: Invoke.Definition): Invoke;
21
+
22
+ /**
23
+ * Request invocation multiple commands with defined options
24
+ */
25
+ export function Invoke(options: Invoke.Definition, ...commands: CommandData[]): Invoke;
26
+
27
+ /**
28
+ * Request invocation multiple commands as list of Commands with default options.
29
+ */
30
+ export function Invoke(...commands: CommandData[]): Invoke;
31
+
32
+ export function Invoke(optionsOrData: Invoke.Definition | CommandData, ...commands: CommandData[]): Invoke {
33
+ let options;
34
+ if ("commands" in optionsOrData) {
35
+ options = optionsOrData;
36
+ } else {
37
+ commands = [optionsOrData, ...commands];
38
+ options = {};
39
+ }
40
+
20
41
  const {
21
- commands,
42
+ commands: invokeRequests = [],
22
43
  interactionModelRevision = FALLBACK_INTERACTIONMODEL_REVISION,
23
44
  suppressResponse = false,
24
45
  timed: timedRequest = false,
25
- } = definition;
46
+ } = options;
47
+
48
+ if (commands.length) {
49
+ for (const entry of commands) {
50
+ invokeRequests.push(entry);
51
+ }
52
+ }
26
53
 
27
- if (!commands?.length) {
54
+ if (!invokeRequests?.length) {
28
55
  throw new MalformedRequestError(`Invocation requires at least one command`);
29
56
  }
30
57
 
31
58
  return {
32
- invokeRequests: commands,
59
+ invokeRequests,
33
60
  interactionModelRevision,
34
61
  suppressResponse,
35
62
  timedRequest,
@@ -4,6 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
+ import { camelize } from "#general";
7
8
  import { FALLBACK_INTERACTIONMODEL_REVISION } from "#session/Session.js";
8
9
  import type {
9
10
  AttributePath,
@@ -14,7 +15,6 @@ import type {
14
15
  GlobalAttributes,
15
16
  ReadRequest,
16
17
  } from "#types";
17
- import { camelize } from "@matter/general";
18
18
  import { MalformedRequestError } from "./MalformedRequestError.js";
19
19
  import { Specifier } from "./Specifier.js";
20
20
 
@@ -9,7 +9,10 @@ import { AttributeData, ClusterType, WriteRequest } from "#types";
9
9
  import { MalformedRequestError } from "./MalformedRequestError.js";
10
10
  import { Specifier } from "./Specifier.js";
11
11
 
12
- export interface Write extends WriteRequest {}
12
+ export interface Write extends WriteRequest {
13
+ /** Timeout only relevant for Client Interactions */
14
+ timeout?: number;
15
+ }
13
16
 
14
17
  /**
15
18
  * Formulate a write-request using Matter numeric IDs.
@@ -4,13 +4,33 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
- import type { Invoke } from "#action/request/Invoke.js";
8
- import type { CommandData } from "#types";
7
+ import type { ClusterId, CommandId, CommandPath, EndpointNumber, StatusCode, TlvStream } from "#types";
9
8
 
10
- export type InvokeResult<T extends Invoke> = T extends { suppressResponse: true }
11
- ? Promise<void>
12
- : AsyncIterable<InvokeResult.Chunk>;
9
+ export type InvokeResult = AsyncIterable<InvokeResult.Chunk>;
13
10
 
14
11
  export namespace InvokeResult {
15
- export type Chunk = CommandData[];
12
+ export type Chunk = Iterable<Data>;
13
+
14
+ export type Data = CommandStatus | CommandResponse;
15
+
16
+ export interface ConcreteCommandPath extends CommandPath {
17
+ endpointId: EndpointNumber;
18
+ clusterId: ClusterId;
19
+ commandId: CommandId;
20
+ }
21
+
22
+ export interface CommandStatus {
23
+ kind: "cmd-status";
24
+ path: ConcreteCommandPath;
25
+ commandRef?: number;
26
+ status: StatusCode;
27
+ clusterStatus?: number;
28
+ }
29
+
30
+ export interface CommandResponse {
31
+ kind: "cmd-response";
32
+ path: ConcreteCommandPath;
33
+ commandRef?: number;
34
+ data: TlvStream;
35
+ }
16
36
  }
@@ -47,7 +47,7 @@ export namespace ReadResult {
47
47
  path: ConcreteAttributePath;
48
48
  value: unknown;
49
49
  version: number;
50
- tlv: TlvSchema<unknown>;
50
+ tlv: TlvSchema<unknown>; // TODO: Remove when we also move encoding to the new format
51
51
  }
52
52
 
53
53
  export interface AttributeStatus {
@@ -20,10 +20,10 @@ import {
20
20
  GlobalAttributes,
21
21
  NodeId,
22
22
  Status,
23
+ StatusCode,
23
24
  StatusResponseError,
24
25
  TlvSchema,
25
26
  } from "#types";
26
- import { StatusCode } from "@matter/types";
27
27
 
28
28
  const logger = Logger.get("AttributeReadResponse");
29
29