@matter/node 0.18.0 → 0.18.1-alpha.0-20261111-b84c5d1bc

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 (618) hide show
  1. package/dist/cjs/behavior/Behavior.d.ts.map +1 -1
  2. package/dist/cjs/behavior/Behavior.js +2 -0
  3. package/dist/cjs/behavior/Behavior.js.map +1 -1
  4. package/dist/cjs/behavior/Events.d.ts.map +1 -1
  5. package/dist/cjs/behavior/Events.js +4 -2
  6. package/dist/cjs/behavior/Events.js.map +1 -1
  7. package/dist/cjs/behavior/cluster/ClusterBehavior.d.ts +17 -3
  8. package/dist/cjs/behavior/cluster/ClusterBehavior.d.ts.map +1 -1
  9. package/dist/cjs/behavior/cluster/ClusterBehavior.js +2 -20
  10. package/dist/cjs/behavior/cluster/ClusterBehavior.js.map +1 -1
  11. package/dist/cjs/behavior/cluster/ClusterBehaviorType.d.ts.map +1 -1
  12. package/dist/cjs/behavior/cluster/ClusterBehaviorType.js +8 -150
  13. package/dist/cjs/behavior/cluster/ClusterBehaviorType.js.map +1 -1
  14. package/dist/cjs/behavior/context/server/LocalActorContext.d.ts +1 -1
  15. package/dist/cjs/behavior/context/server/LocalActorContext.d.ts.map +1 -1
  16. package/dist/cjs/behavior/internal/BehaviorBacking.d.ts +2 -2
  17. package/dist/cjs/behavior/internal/BehaviorBacking.d.ts.map +1 -1
  18. package/dist/cjs/behavior/internal/BehaviorBacking.js +2 -0
  19. package/dist/cjs/behavior/internal/BehaviorBacking.js.map +1 -1
  20. package/dist/cjs/behavior/internal/ClusterDerivation.d.ts +45 -0
  21. package/dist/cjs/behavior/internal/ClusterDerivation.d.ts.map +1 -0
  22. package/dist/cjs/behavior/internal/ClusterDerivation.js +192 -0
  23. package/dist/cjs/behavior/internal/ClusterDerivation.js.map +6 -0
  24. package/dist/cjs/behavior/internal/ClusterStatics.d.ts +16 -0
  25. package/dist/cjs/behavior/internal/ClusterStatics.d.ts.map +1 -0
  26. package/dist/cjs/behavior/internal/ClusterStatics.js +138 -0
  27. package/dist/cjs/behavior/internal/ClusterStatics.js.map +6 -0
  28. package/dist/cjs/behavior/internal/ModeledState.d.ts +18 -0
  29. package/dist/cjs/behavior/internal/ModeledState.d.ts.map +1 -0
  30. package/dist/cjs/behavior/internal/ModeledState.js +54 -0
  31. package/dist/cjs/behavior/internal/ModeledState.js.map +6 -0
  32. package/dist/cjs/behavior/internal/ServerBehaviorBacking.d.ts +1 -1
  33. package/dist/cjs/behavior/internal/ServerBehaviorBacking.d.ts.map +1 -1
  34. package/dist/cjs/behavior/internal/ServerBehaviorBacking.js +3 -12
  35. package/dist/cjs/behavior/internal/ServerBehaviorBacking.js.map +1 -1
  36. package/dist/cjs/behavior/state/managed/Datasource.d.ts +54 -10
  37. package/dist/cjs/behavior/state/managed/Datasource.d.ts.map +1 -1
  38. package/dist/cjs/behavior/state/managed/Datasource.js +107 -38
  39. package/dist/cjs/behavior/state/managed/Datasource.js.map +1 -1
  40. package/dist/cjs/behavior/state/managed/Internal.d.ts +20 -5
  41. package/dist/cjs/behavior/state/managed/Internal.d.ts.map +1 -1
  42. package/dist/cjs/behavior/state/managed/Internal.js +28 -26
  43. package/dist/cjs/behavior/state/managed/Internal.js.map +1 -1
  44. package/dist/cjs/behavior/state/managed/ManagedReference.d.ts +56 -12
  45. package/dist/cjs/behavior/state/managed/ManagedReference.d.ts.map +1 -1
  46. package/dist/cjs/behavior/state/managed/ManagedReference.js +103 -43
  47. package/dist/cjs/behavior/state/managed/ManagedReference.js.map +1 -1
  48. package/dist/cjs/behavior/state/managed/NameResolver.js +1 -1
  49. package/dist/cjs/behavior/state/managed/NameResolver.js.map +1 -1
  50. package/dist/cjs/behavior/state/managed/ReadOnlyReference.d.ts +33 -0
  51. package/dist/cjs/behavior/state/managed/ReadOnlyReference.d.ts.map +1 -0
  52. package/dist/cjs/behavior/state/{validation/peer-forwarding.js → managed/ReadOnlyReference.js} +36 -17
  53. package/dist/cjs/behavior/state/managed/ReadOnlyReference.js.map +6 -0
  54. package/dist/cjs/behavior/state/managed/ValReference.d.ts +80 -13
  55. package/dist/cjs/behavior/state/managed/ValReference.d.ts.map +1 -1
  56. package/dist/cjs/behavior/state/managed/ValReference.js +32 -0
  57. package/dist/cjs/behavior/state/managed/ValReference.js.map +2 -2
  58. package/dist/cjs/behavior/state/managed/errors.d.ts +25 -0
  59. package/dist/cjs/behavior/state/managed/errors.d.ts.map +1 -0
  60. package/dist/cjs/behavior/state/{validation/FabricIndexSentinel.js → managed/errors.js} +15 -10
  61. package/dist/cjs/behavior/state/managed/errors.js.map +6 -0
  62. package/dist/cjs/behavior/state/managed/index.d.ts +1 -0
  63. package/dist/cjs/behavior/state/managed/index.d.ts.map +1 -1
  64. package/dist/cjs/behavior/state/managed/index.js +1 -0
  65. package/dist/cjs/behavior/state/managed/index.js.map +1 -1
  66. package/dist/cjs/behavior/state/managed/values/BitmapManager.js +5 -20
  67. package/dist/cjs/behavior/state/managed/values/BitmapManager.js.map +1 -1
  68. package/dist/cjs/behavior/state/managed/values/ListManager.d.ts +0 -5
  69. package/dist/cjs/behavior/state/managed/values/ListManager.d.ts.map +1 -1
  70. package/dist/cjs/behavior/state/managed/values/ListManager.js +274 -133
  71. package/dist/cjs/behavior/state/managed/values/ListManager.js.map +2 -2
  72. package/dist/cjs/behavior/state/managed/values/StructManager.d.ts.map +1 -1
  73. package/dist/cjs/behavior/state/managed/values/StructManager.js +30 -35
  74. package/dist/cjs/behavior/state/managed/values/StructManager.js.map +2 -2
  75. package/dist/cjs/behavior/state/managed/values/ValuePatcher.d.ts +8 -0
  76. package/dist/cjs/behavior/state/managed/values/ValuePatcher.d.ts.map +1 -1
  77. package/dist/cjs/behavior/state/managed/values/ValuePatcher.js +13 -2
  78. package/dist/cjs/behavior/state/managed/values/ValuePatcher.js.map +1 -1
  79. package/dist/cjs/behavior/state/validation/FabricIndexField.d.ts +30 -0
  80. package/dist/cjs/behavior/state/validation/FabricIndexField.d.ts.map +1 -0
  81. package/dist/cjs/behavior/state/validation/FabricIndexField.js +53 -0
  82. package/dist/cjs/behavior/state/validation/FabricIndexField.js.map +6 -0
  83. package/dist/cjs/behavior/state/validation/ValueValidator.d.ts.map +1 -1
  84. package/dist/cjs/behavior/state/validation/ValueValidator.js +16 -36
  85. package/dist/cjs/behavior/state/validation/ValueValidator.js.map +1 -1
  86. package/dist/cjs/behavior/state/validation/conformance.d.ts.map +1 -1
  87. package/dist/cjs/behavior/state/validation/conformance.js +6 -5
  88. package/dist/cjs/behavior/state/validation/conformance.js.map +1 -1
  89. package/dist/cjs/behavior/state/validation/constraint.d.ts.map +1 -1
  90. package/dist/cjs/behavior/state/validation/constraint.js +3 -1
  91. package/dist/cjs/behavior/state/validation/constraint.js.map +1 -1
  92. package/dist/cjs/behavior/state/validation/location.d.ts +6 -0
  93. package/dist/cjs/behavior/state/validation/location.d.ts.map +1 -1
  94. package/dist/cjs/behavior/state/validation/remote-validation.d.ts +57 -0
  95. package/dist/cjs/behavior/state/validation/remote-validation.d.ts.map +1 -0
  96. package/dist/cjs/behavior/state/validation/remote-validation.js +63 -0
  97. package/dist/cjs/behavior/state/validation/remote-validation.js.map +6 -0
  98. package/dist/cjs/behavior/supervision/Supervision.d.ts.map +1 -1
  99. package/dist/cjs/behavior/supervision/Supervision.js +1 -1
  100. package/dist/cjs/behavior/supervision/Supervision.js.map +1 -1
  101. package/dist/cjs/behavior/supervision/SupervisionConfig.d.ts.map +1 -1
  102. package/dist/cjs/behavior/supervision/SupervisionConfig.js +1 -1
  103. package/dist/cjs/behavior/supervision/SupervisionConfig.js.map +1 -1
  104. package/dist/cjs/behavior/supervision/ValueSupervisor.d.ts +3 -12
  105. package/dist/cjs/behavior/supervision/ValueSupervisor.d.ts.map +1 -1
  106. package/dist/cjs/behavior/system/commissioning/CommissioningClient.d.ts +57 -6
  107. package/dist/cjs/behavior/system/commissioning/CommissioningClient.d.ts.map +1 -1
  108. package/dist/cjs/behavior/system/commissioning/CommissioningClient.js +86 -0
  109. package/dist/cjs/behavior/system/commissioning/CommissioningClient.js.map +1 -1
  110. package/dist/cjs/behavior/system/commissioning/RemoteDescriptor.d.ts +9 -1
  111. package/dist/cjs/behavior/system/commissioning/RemoteDescriptor.d.ts.map +1 -1
  112. package/dist/cjs/behavior/system/commissioning/RemoteDescriptor.js +9 -0
  113. package/dist/cjs/behavior/system/commissioning/RemoteDescriptor.js.map +1 -1
  114. package/dist/cjs/behavior/system/controller/ControllerBehavior.d.ts +2 -1
  115. package/dist/cjs/behavior/system/controller/ControllerBehavior.d.ts.map +1 -1
  116. package/dist/cjs/behavior/system/controller/ControllerBehavior.js +2 -1
  117. package/dist/cjs/behavior/system/controller/ControllerBehavior.js.map +1 -1
  118. package/dist/cjs/behavior/system/dcl/DclBehavior.d.ts +3 -3
  119. package/dist/cjs/behavior/system/network/ServerGroupNetworking.d.ts +2 -1
  120. package/dist/cjs/behavior/system/network/ServerGroupNetworking.d.ts.map +1 -1
  121. package/dist/cjs/behavior/system/network/ServerGroupNetworking.js.map +1 -1
  122. package/dist/cjs/behavior/system/remote/api/ApiResource.d.ts +14 -0
  123. package/dist/cjs/behavior/system/remote/api/ApiResource.d.ts.map +1 -1
  124. package/dist/cjs/behavior/system/remote/api/ApiResource.js +19 -0
  125. package/dist/cjs/behavior/system/remote/api/ApiResource.js.map +1 -1
  126. package/dist/cjs/behavior/system/remote/api/Envelope.d.ts +4 -2
  127. package/dist/cjs/behavior/system/remote/api/Envelope.d.ts.map +1 -1
  128. package/dist/cjs/behavior/system/remote/api/Envelope.js +7 -5
  129. package/dist/cjs/behavior/system/remote/api/Envelope.js.map +1 -1
  130. package/dist/cjs/behavior/system/remote/api/resources/CommandResource.js +2 -2
  131. package/dist/cjs/behavior/system/remote/api/resources/CommandResource.js.map +1 -1
  132. package/dist/cjs/behavior/system/remote/api/resources/NodeResource.d.ts +1 -0
  133. package/dist/cjs/behavior/system/remote/api/resources/NodeResource.d.ts.map +1 -1
  134. package/dist/cjs/behavior/system/remote/api/resources/NodeResource.js +3 -0
  135. package/dist/cjs/behavior/system/remote/api/resources/NodeResource.js.map +1 -1
  136. package/dist/cjs/behavior/system/remote/api/resources/PropertyResource.d.ts.map +1 -1
  137. package/dist/cjs/behavior/system/remote/api/resources/PropertyResource.js +5 -3
  138. package/dist/cjs/behavior/system/remote/api/resources/PropertyResource.js.map +1 -1
  139. package/dist/cjs/behavior/system/remote/api/resources/ServerNodeResource.d.ts.map +1 -1
  140. package/dist/cjs/behavior/system/remote/api/resources/ServerNodeResource.js +2 -11
  141. package/dist/cjs/behavior/system/remote/api/resources/ServerNodeResource.js.map +1 -1
  142. package/dist/cjs/behavior/system/sessions/SessionsBehavior.d.ts +4 -0
  143. package/dist/cjs/behavior/system/sessions/SessionsBehavior.d.ts.map +1 -1
  144. package/dist/cjs/behavior/system/sessions/SessionsBehavior.js +6 -1
  145. package/dist/cjs/behavior/system/sessions/SessionsBehavior.js.map +1 -1
  146. package/dist/cjs/behavior/system/subscriptions/SubscriptionStore.d.ts +28 -0
  147. package/dist/cjs/behavior/system/subscriptions/SubscriptionStore.d.ts.map +1 -0
  148. package/dist/cjs/behavior/system/subscriptions/SubscriptionStore.js +74 -0
  149. package/dist/cjs/behavior/system/subscriptions/SubscriptionStore.js.map +6 -0
  150. package/dist/cjs/behavior/system/subscriptions/SubscriptionsServer.d.ts +8 -3
  151. package/dist/cjs/behavior/system/subscriptions/SubscriptionsServer.d.ts.map +1 -1
  152. package/dist/cjs/behavior/system/subscriptions/SubscriptionsServer.js +61 -30
  153. package/dist/cjs/behavior/system/subscriptions/SubscriptionsServer.js.map +1 -1
  154. package/dist/cjs/behaviors/access-control/AccessControlServer.d.ts +2 -2
  155. package/dist/cjs/behaviors/access-control/AccessControlServer.d.ts.map +1 -1
  156. package/dist/cjs/behaviors/administrator-commissioning/AdministratorCommissioningServer.d.ts.map +1 -1
  157. package/dist/cjs/behaviors/administrator-commissioning/AdministratorCommissioningServer.js +43 -21
  158. package/dist/cjs/behaviors/administrator-commissioning/AdministratorCommissioningServer.js.map +1 -1
  159. package/dist/cjs/behaviors/general-diagnostics/GeneralDiagnosticsServer.d.ts +29 -23
  160. package/dist/cjs/behaviors/general-diagnostics/GeneralDiagnosticsServer.d.ts.map +1 -1
  161. package/dist/cjs/behaviors/general-diagnostics/GeneralDiagnosticsServer.js +104 -60
  162. package/dist/cjs/behaviors/general-diagnostics/GeneralDiagnosticsServer.js.map +1 -1
  163. package/dist/cjs/behaviors/group-key-management/GroupKeyManagementServer.d.ts +9 -1
  164. package/dist/cjs/behaviors/group-key-management/GroupKeyManagementServer.d.ts.map +1 -1
  165. package/dist/cjs/behaviors/group-key-management/GroupKeyManagementServer.js +11 -7
  166. package/dist/cjs/behaviors/group-key-management/GroupKeyManagementServer.js.map +1 -1
  167. package/dist/cjs/behaviors/groupcast/GroupcastServer.d.ts.map +1 -1
  168. package/dist/cjs/behaviors/groupcast/GroupcastServer.js +41 -25
  169. package/dist/cjs/behaviors/groupcast/GroupcastServer.js.map +2 -2
  170. package/dist/cjs/behaviors/localization-configuration/LocalizationConfigurationServer.d.ts +1 -1
  171. package/dist/cjs/behaviors/localization-configuration/LocalizationConfigurationServer.d.ts.map +1 -1
  172. package/dist/cjs/behaviors/localization-configuration/LocalizationConfigurationServer.js +15 -4
  173. package/dist/cjs/behaviors/localization-configuration/LocalizationConfigurationServer.js.map +2 -2
  174. package/dist/cjs/behaviors/operational-credentials/VendorIdVerification.d.ts +2 -0
  175. package/dist/cjs/behaviors/operational-credentials/VendorIdVerification.d.ts.map +1 -1
  176. package/dist/cjs/behaviors/operational-credentials/VendorIdVerification.js +27 -23
  177. package/dist/cjs/behaviors/operational-credentials/VendorIdVerification.js.map +1 -1
  178. package/dist/cjs/behaviors/thermostat/ThermostatServer.d.ts +15 -4
  179. package/dist/cjs/behaviors/thermostat/ThermostatServer.d.ts.map +1 -1
  180. package/dist/cjs/behaviors/thermostat/ThermostatServer.js +66 -49
  181. package/dist/cjs/behaviors/thermostat/ThermostatServer.js.map +1 -1
  182. package/dist/cjs/behaviors/time-format-localization/TimeFormatLocalizationServer.d.ts +4 -4
  183. package/dist/cjs/behaviors/time-format-localization/TimeFormatLocalizationServer.d.ts.map +1 -1
  184. package/dist/cjs/behaviors/time-format-localization/TimeFormatLocalizationServer.js +19 -5
  185. package/dist/cjs/behaviors/time-format-localization/TimeFormatLocalizationServer.js.map +2 -2
  186. package/dist/cjs/behaviors/unit-localization/UnitLocalizationServer.d.ts.map +1 -1
  187. package/dist/cjs/behaviors/unit-localization/UnitLocalizationServer.js +13 -3
  188. package/dist/cjs/behaviors/unit-localization/UnitLocalizationServer.js.map +1 -1
  189. package/dist/cjs/endpoint/Endpoint.d.ts +5 -9
  190. package/dist/cjs/endpoint/Endpoint.d.ts.map +1 -1
  191. package/dist/cjs/endpoint/Endpoint.js +4 -23
  192. package/dist/cjs/endpoint/Endpoint.js.map +1 -1
  193. package/dist/cjs/endpoint/properties/Behaviors.d.ts.map +1 -1
  194. package/dist/cjs/endpoint/properties/Behaviors.js +5 -1
  195. package/dist/cjs/endpoint/properties/Behaviors.js.map +1 -1
  196. package/dist/cjs/node/ClientNode.d.ts +25 -0
  197. package/dist/cjs/node/ClientNode.d.ts.map +1 -1
  198. package/dist/cjs/node/ClientNode.js +41 -0
  199. package/dist/cjs/node/ClientNode.js.map +1 -1
  200. package/dist/cjs/node/ServerNode.d.ts.map +1 -1
  201. package/dist/cjs/node/ServerNode.js +2 -0
  202. package/dist/cjs/node/ServerNode.js.map +1 -1
  203. package/dist/cjs/node/client/ClientCommandMethod.d.ts.map +1 -1
  204. package/dist/cjs/node/client/ClientCommandMethod.js +3 -15
  205. package/dist/cjs/node/client/ClientCommandMethod.js.map +1 -1
  206. package/dist/cjs/node/client/ClientEventEmitter.d.ts.map +1 -1
  207. package/dist/cjs/node/client/ClientEventEmitter.js +6 -2
  208. package/dist/cjs/node/client/ClientEventEmitter.js.map +1 -1
  209. package/dist/cjs/node/client/ClientStructure.d.ts.map +1 -1
  210. package/dist/cjs/node/client/ClientStructure.js +181 -108
  211. package/dist/cjs/node/client/ClientStructure.js.map +2 -2
  212. package/dist/cjs/node/client/Peers.d.ts +18 -6
  213. package/dist/cjs/node/client/Peers.d.ts.map +1 -1
  214. package/dist/cjs/node/client/Peers.js +29 -13
  215. package/dist/cjs/node/client/Peers.js.map +1 -1
  216. package/dist/cjs/node/integration/ChangeNotificationService.d.ts +14 -3
  217. package/dist/cjs/node/integration/ChangeNotificationService.d.ts.map +1 -1
  218. package/dist/cjs/node/integration/ProtocolService.d.ts.map +1 -1
  219. package/dist/cjs/node/integration/ProtocolService.js +38 -56
  220. package/dist/cjs/node/integration/ProtocolService.js.map +1 -1
  221. package/dist/cjs/node/server/InteractionServer.d.ts.map +1 -1
  222. package/dist/cjs/node/server/InteractionServer.js +28 -24
  223. package/dist/cjs/node/server/InteractionServer.js.map +2 -2
  224. package/dist/cjs/node/server/ServerSubscription.d.ts +7 -2
  225. package/dist/cjs/node/server/ServerSubscription.d.ts.map +1 -1
  226. package/dist/cjs/node/server/ServerSubscription.js +83 -47
  227. package/dist/cjs/node/server/ServerSubscription.js.map +1 -1
  228. package/dist/cjs/storage/EndpointStore.d.ts +1 -1
  229. package/dist/cjs/storage/EndpointStore.js +1 -1
  230. package/dist/cjs/storage/client/ClientEndpointStore.d.ts +2 -2
  231. package/dist/cjs/storage/client/ClientEndpointStore.d.ts.map +1 -1
  232. package/dist/cjs/storage/client/ClientEndpointStore.js +1 -1
  233. package/dist/cjs/storage/client/DatasourceCache.d.ts +5 -3
  234. package/dist/cjs/storage/client/DatasourceCache.d.ts.map +1 -1
  235. package/dist/cjs/storage/client/DatasourceCache.js +68 -71
  236. package/dist/cjs/storage/client/DatasourceCache.js.map +1 -1
  237. package/dist/cjs/storage/client/FabricScopedListWrite.d.ts +73 -0
  238. package/dist/cjs/storage/client/FabricScopedListWrite.d.ts.map +1 -0
  239. package/dist/cjs/storage/client/FabricScopedListWrite.js +168 -0
  240. package/dist/cjs/storage/client/FabricScopedListWrite.js.map +6 -0
  241. package/dist/cjs/storage/client/RemoteWriteParticipant.d.ts +9 -6
  242. package/dist/cjs/storage/client/RemoteWriteParticipant.d.ts.map +1 -1
  243. package/dist/cjs/storage/client/RemoteWriteParticipant.js +11 -15
  244. package/dist/cjs/storage/client/RemoteWriteParticipant.js.map +1 -1
  245. package/dist/cjs/storage/client/RemoteWriter.d.ts +67 -7
  246. package/dist/cjs/storage/client/RemoteWriter.d.ts.map +1 -1
  247. package/dist/cjs/storage/client/RemoteWriter.js +61 -13
  248. package/dist/cjs/storage/client/RemoteWriter.js.map +1 -1
  249. package/dist/cjs/storage/server/DatasourceStore.d.ts +2 -2
  250. package/dist/cjs/storage/server/DatasourceStore.d.ts.map +1 -1
  251. package/dist/cjs/storage/server/DatasourceStore.js.map +1 -1
  252. package/dist/cjs/storage/server/ServerEndpointStore.d.ts +2 -2
  253. package/dist/cjs/storage/server/ServerEndpointStore.d.ts.map +1 -1
  254. package/dist/cjs/storage/server/ServerEndpointStore.js +1 -1
  255. package/dist/cjs/testing/mock-server-node.d.ts +2 -1
  256. package/dist/cjs/testing/mock-server-node.d.ts.map +1 -1
  257. package/dist/cjs/testing/mock-server-node.js +8 -5
  258. package/dist/cjs/testing/mock-server-node.js.map +2 -2
  259. package/dist/cjs/testing/node-helpers.d.ts +5 -0
  260. package/dist/cjs/testing/node-helpers.d.ts.map +1 -1
  261. package/dist/cjs/testing/node-helpers.js +4 -4
  262. package/dist/cjs/testing/node-helpers.js.map +1 -1
  263. package/dist/esm/behavior/Behavior.d.ts.map +1 -1
  264. package/dist/esm/behavior/Behavior.js +2 -0
  265. package/dist/esm/behavior/Behavior.js.map +1 -1
  266. package/dist/esm/behavior/Events.d.ts.map +1 -1
  267. package/dist/esm/behavior/Events.js +4 -2
  268. package/dist/esm/behavior/Events.js.map +1 -1
  269. package/dist/esm/behavior/cluster/ClusterBehavior.d.ts +17 -3
  270. package/dist/esm/behavior/cluster/ClusterBehavior.d.ts.map +1 -1
  271. package/dist/esm/behavior/cluster/ClusterBehavior.js +2 -20
  272. package/dist/esm/behavior/cluster/ClusterBehavior.js.map +1 -1
  273. package/dist/esm/behavior/cluster/ClusterBehaviorType.d.ts.map +1 -1
  274. package/dist/esm/behavior/cluster/ClusterBehaviorType.js +10 -159
  275. package/dist/esm/behavior/cluster/ClusterBehaviorType.js.map +1 -1
  276. package/dist/esm/behavior/context/server/LocalActorContext.d.ts +1 -1
  277. package/dist/esm/behavior/context/server/LocalActorContext.d.ts.map +1 -1
  278. package/dist/esm/behavior/internal/BehaviorBacking.d.ts +2 -2
  279. package/dist/esm/behavior/internal/BehaviorBacking.d.ts.map +1 -1
  280. package/dist/esm/behavior/internal/BehaviorBacking.js +2 -0
  281. package/dist/esm/behavior/internal/BehaviorBacking.js.map +1 -1
  282. package/dist/esm/behavior/internal/ClusterDerivation.d.ts +45 -0
  283. package/dist/esm/behavior/internal/ClusterDerivation.d.ts.map +1 -0
  284. package/dist/esm/behavior/internal/ClusterDerivation.js +172 -0
  285. package/dist/esm/behavior/internal/ClusterDerivation.js.map +6 -0
  286. package/dist/esm/behavior/internal/ClusterStatics.d.ts +16 -0
  287. package/dist/esm/behavior/internal/ClusterStatics.d.ts.map +1 -0
  288. package/dist/esm/behavior/internal/ClusterStatics.js +118 -0
  289. package/dist/esm/behavior/internal/ClusterStatics.js.map +6 -0
  290. package/dist/esm/behavior/internal/ModeledState.d.ts +18 -0
  291. package/dist/esm/behavior/internal/ModeledState.d.ts.map +1 -0
  292. package/dist/esm/behavior/internal/ModeledState.js +34 -0
  293. package/dist/esm/behavior/internal/ModeledState.js.map +6 -0
  294. package/dist/esm/behavior/internal/ServerBehaviorBacking.d.ts +1 -1
  295. package/dist/esm/behavior/internal/ServerBehaviorBacking.d.ts.map +1 -1
  296. package/dist/esm/behavior/internal/ServerBehaviorBacking.js +3 -12
  297. package/dist/esm/behavior/internal/ServerBehaviorBacking.js.map +1 -1
  298. package/dist/esm/behavior/state/managed/Datasource.d.ts +54 -10
  299. package/dist/esm/behavior/state/managed/Datasource.d.ts.map +1 -1
  300. package/dist/esm/behavior/state/managed/Datasource.js +107 -38
  301. package/dist/esm/behavior/state/managed/Datasource.js.map +1 -1
  302. package/dist/esm/behavior/state/managed/Internal.d.ts +20 -5
  303. package/dist/esm/behavior/state/managed/Internal.d.ts.map +1 -1
  304. package/dist/esm/behavior/state/managed/Internal.js +28 -26
  305. package/dist/esm/behavior/state/managed/Internal.js.map +1 -1
  306. package/dist/esm/behavior/state/managed/ManagedReference.d.ts +56 -12
  307. package/dist/esm/behavior/state/managed/ManagedReference.d.ts.map +1 -1
  308. package/dist/esm/behavior/state/managed/ManagedReference.js +103 -43
  309. package/dist/esm/behavior/state/managed/ManagedReference.js.map +1 -1
  310. package/dist/esm/behavior/state/managed/NameResolver.js +1 -1
  311. package/dist/esm/behavior/state/managed/NameResolver.js.map +1 -1
  312. package/dist/esm/behavior/state/managed/ReadOnlyReference.d.ts +33 -0
  313. package/dist/esm/behavior/state/managed/ReadOnlyReference.d.ts.map +1 -0
  314. package/dist/esm/behavior/state/managed/ReadOnlyReference.js +45 -0
  315. package/dist/esm/behavior/state/managed/ReadOnlyReference.js.map +6 -0
  316. package/dist/esm/behavior/state/managed/ValReference.d.ts +80 -13
  317. package/dist/esm/behavior/state/managed/ValReference.d.ts.map +1 -1
  318. package/dist/esm/behavior/state/managed/ValReference.js +28 -0
  319. package/dist/esm/behavior/state/managed/ValReference.js.map +2 -2
  320. package/dist/esm/behavior/state/managed/errors.d.ts +25 -0
  321. package/dist/esm/behavior/state/managed/errors.d.ts.map +1 -0
  322. package/dist/esm/behavior/state/managed/errors.js +20 -0
  323. package/dist/esm/behavior/state/managed/errors.js.map +6 -0
  324. package/dist/esm/behavior/state/managed/index.d.ts +1 -0
  325. package/dist/esm/behavior/state/managed/index.d.ts.map +1 -1
  326. package/dist/esm/behavior/state/managed/index.js +1 -0
  327. package/dist/esm/behavior/state/managed/index.js.map +1 -1
  328. package/dist/esm/behavior/state/managed/values/BitmapManager.js +6 -21
  329. package/dist/esm/behavior/state/managed/values/BitmapManager.js.map +1 -1
  330. package/dist/esm/behavior/state/managed/values/ListManager.d.ts +0 -5
  331. package/dist/esm/behavior/state/managed/values/ListManager.d.ts.map +1 -1
  332. package/dist/esm/behavior/state/managed/values/ListManager.js +277 -144
  333. package/dist/esm/behavior/state/managed/values/ListManager.js.map +2 -2
  334. package/dist/esm/behavior/state/managed/values/StructManager.d.ts.map +1 -1
  335. package/dist/esm/behavior/state/managed/values/StructManager.js +31 -36
  336. package/dist/esm/behavior/state/managed/values/StructManager.js.map +2 -2
  337. package/dist/esm/behavior/state/managed/values/ValuePatcher.d.ts +8 -0
  338. package/dist/esm/behavior/state/managed/values/ValuePatcher.d.ts.map +1 -1
  339. package/dist/esm/behavior/state/managed/values/ValuePatcher.js +13 -2
  340. package/dist/esm/behavior/state/managed/values/ValuePatcher.js.map +1 -1
  341. package/dist/esm/behavior/state/validation/FabricIndexField.d.ts +30 -0
  342. package/dist/esm/behavior/state/validation/FabricIndexField.d.ts.map +1 -0
  343. package/dist/esm/behavior/state/validation/FabricIndexField.js +33 -0
  344. package/dist/esm/behavior/state/validation/FabricIndexField.js.map +6 -0
  345. package/dist/esm/behavior/state/validation/ValueValidator.d.ts.map +1 -1
  346. package/dist/esm/behavior/state/validation/ValueValidator.js +17 -37
  347. package/dist/esm/behavior/state/validation/ValueValidator.js.map +1 -1
  348. package/dist/esm/behavior/state/validation/conformance.d.ts.map +1 -1
  349. package/dist/esm/behavior/state/validation/conformance.js +6 -5
  350. package/dist/esm/behavior/state/validation/conformance.js.map +1 -1
  351. package/dist/esm/behavior/state/validation/constraint.d.ts.map +1 -1
  352. package/dist/esm/behavior/state/validation/constraint.js +3 -1
  353. package/dist/esm/behavior/state/validation/constraint.js.map +1 -1
  354. package/dist/esm/behavior/state/validation/location.d.ts +6 -0
  355. package/dist/esm/behavior/state/validation/location.d.ts.map +1 -1
  356. package/dist/esm/behavior/state/validation/remote-validation.d.ts +57 -0
  357. package/dist/esm/behavior/state/validation/remote-validation.d.ts.map +1 -0
  358. package/dist/esm/behavior/state/validation/remote-validation.js +48 -0
  359. package/dist/esm/behavior/state/validation/remote-validation.js.map +6 -0
  360. package/dist/esm/behavior/supervision/Supervision.d.ts.map +1 -1
  361. package/dist/esm/behavior/supervision/Supervision.js +1 -1
  362. package/dist/esm/behavior/supervision/Supervision.js.map +1 -1
  363. package/dist/esm/behavior/supervision/SupervisionConfig.d.ts.map +1 -1
  364. package/dist/esm/behavior/supervision/SupervisionConfig.js +1 -1
  365. package/dist/esm/behavior/supervision/SupervisionConfig.js.map +1 -1
  366. package/dist/esm/behavior/supervision/ValueSupervisor.d.ts +3 -12
  367. package/dist/esm/behavior/supervision/ValueSupervisor.d.ts.map +1 -1
  368. package/dist/esm/behavior/system/commissioning/CommissioningClient.d.ts +57 -6
  369. package/dist/esm/behavior/system/commissioning/CommissioningClient.d.ts.map +1 -1
  370. package/dist/esm/behavior/system/commissioning/CommissioningClient.js +87 -0
  371. package/dist/esm/behavior/system/commissioning/CommissioningClient.js.map +1 -1
  372. package/dist/esm/behavior/system/commissioning/RemoteDescriptor.d.ts +9 -1
  373. package/dist/esm/behavior/system/commissioning/RemoteDescriptor.d.ts.map +1 -1
  374. package/dist/esm/behavior/system/commissioning/RemoteDescriptor.js +10 -1
  375. package/dist/esm/behavior/system/commissioning/RemoteDescriptor.js.map +1 -1
  376. package/dist/esm/behavior/system/controller/ControllerBehavior.d.ts +2 -1
  377. package/dist/esm/behavior/system/controller/ControllerBehavior.d.ts.map +1 -1
  378. package/dist/esm/behavior/system/controller/ControllerBehavior.js +2 -1
  379. package/dist/esm/behavior/system/controller/ControllerBehavior.js.map +1 -1
  380. package/dist/esm/behavior/system/dcl/DclBehavior.d.ts +3 -3
  381. package/dist/esm/behavior/system/network/ServerGroupNetworking.d.ts +2 -1
  382. package/dist/esm/behavior/system/network/ServerGroupNetworking.d.ts.map +1 -1
  383. package/dist/esm/behavior/system/network/ServerGroupNetworking.js.map +1 -1
  384. package/dist/esm/behavior/system/remote/api/ApiResource.d.ts +14 -0
  385. package/dist/esm/behavior/system/remote/api/ApiResource.d.ts.map +1 -1
  386. package/dist/esm/behavior/system/remote/api/ApiResource.js +19 -0
  387. package/dist/esm/behavior/system/remote/api/ApiResource.js.map +1 -1
  388. package/dist/esm/behavior/system/remote/api/Envelope.d.ts +4 -2
  389. package/dist/esm/behavior/system/remote/api/Envelope.d.ts.map +1 -1
  390. package/dist/esm/behavior/system/remote/api/Envelope.js +7 -5
  391. package/dist/esm/behavior/system/remote/api/Envelope.js.map +1 -1
  392. package/dist/esm/behavior/system/remote/api/resources/CommandResource.js +2 -2
  393. package/dist/esm/behavior/system/remote/api/resources/CommandResource.js.map +1 -1
  394. package/dist/esm/behavior/system/remote/api/resources/NodeResource.d.ts +1 -0
  395. package/dist/esm/behavior/system/remote/api/resources/NodeResource.d.ts.map +1 -1
  396. package/dist/esm/behavior/system/remote/api/resources/NodeResource.js +3 -0
  397. package/dist/esm/behavior/system/remote/api/resources/NodeResource.js.map +1 -1
  398. package/dist/esm/behavior/system/remote/api/resources/PropertyResource.d.ts.map +1 -1
  399. package/dist/esm/behavior/system/remote/api/resources/PropertyResource.js +5 -3
  400. package/dist/esm/behavior/system/remote/api/resources/PropertyResource.js.map +1 -1
  401. package/dist/esm/behavior/system/remote/api/resources/ServerNodeResource.d.ts.map +1 -1
  402. package/dist/esm/behavior/system/remote/api/resources/ServerNodeResource.js +2 -11
  403. package/dist/esm/behavior/system/remote/api/resources/ServerNodeResource.js.map +1 -1
  404. package/dist/esm/behavior/system/sessions/SessionsBehavior.d.ts +4 -0
  405. package/dist/esm/behavior/system/sessions/SessionsBehavior.d.ts.map +1 -1
  406. package/dist/esm/behavior/system/sessions/SessionsBehavior.js +6 -1
  407. package/dist/esm/behavior/system/sessions/SessionsBehavior.js.map +1 -1
  408. package/dist/esm/behavior/system/subscriptions/SubscriptionStore.d.ts +28 -0
  409. package/dist/esm/behavior/system/subscriptions/SubscriptionStore.d.ts.map +1 -0
  410. package/dist/esm/behavior/system/subscriptions/SubscriptionStore.js +54 -0
  411. package/dist/esm/behavior/system/subscriptions/SubscriptionStore.js.map +6 -0
  412. package/dist/esm/behavior/system/subscriptions/SubscriptionsServer.d.ts +8 -3
  413. package/dist/esm/behavior/system/subscriptions/SubscriptionsServer.d.ts.map +1 -1
  414. package/dist/esm/behavior/system/subscriptions/SubscriptionsServer.js +61 -30
  415. package/dist/esm/behavior/system/subscriptions/SubscriptionsServer.js.map +1 -1
  416. package/dist/esm/behaviors/access-control/AccessControlServer.d.ts +2 -2
  417. package/dist/esm/behaviors/access-control/AccessControlServer.d.ts.map +1 -1
  418. package/dist/esm/behaviors/administrator-commissioning/AdministratorCommissioningServer.d.ts.map +1 -1
  419. package/dist/esm/behaviors/administrator-commissioning/AdministratorCommissioningServer.js +43 -21
  420. package/dist/esm/behaviors/administrator-commissioning/AdministratorCommissioningServer.js.map +1 -1
  421. package/dist/esm/behaviors/general-diagnostics/GeneralDiagnosticsServer.d.ts +29 -23
  422. package/dist/esm/behaviors/general-diagnostics/GeneralDiagnosticsServer.d.ts.map +1 -1
  423. package/dist/esm/behaviors/general-diagnostics/GeneralDiagnosticsServer.js +105 -60
  424. package/dist/esm/behaviors/general-diagnostics/GeneralDiagnosticsServer.js.map +1 -1
  425. package/dist/esm/behaviors/group-key-management/GroupKeyManagementServer.d.ts +9 -1
  426. package/dist/esm/behaviors/group-key-management/GroupKeyManagementServer.d.ts.map +1 -1
  427. package/dist/esm/behaviors/group-key-management/GroupKeyManagementServer.js +11 -7
  428. package/dist/esm/behaviors/group-key-management/GroupKeyManagementServer.js.map +1 -1
  429. package/dist/esm/behaviors/groupcast/GroupcastServer.d.ts.map +1 -1
  430. package/dist/esm/behaviors/groupcast/GroupcastServer.js +42 -25
  431. package/dist/esm/behaviors/groupcast/GroupcastServer.js.map +2 -2
  432. package/dist/esm/behaviors/localization-configuration/LocalizationConfigurationServer.d.ts +1 -1
  433. package/dist/esm/behaviors/localization-configuration/LocalizationConfigurationServer.d.ts.map +1 -1
  434. package/dist/esm/behaviors/localization-configuration/LocalizationConfigurationServer.js +15 -4
  435. package/dist/esm/behaviors/localization-configuration/LocalizationConfigurationServer.js.map +2 -2
  436. package/dist/esm/behaviors/operational-credentials/VendorIdVerification.d.ts +2 -0
  437. package/dist/esm/behaviors/operational-credentials/VendorIdVerification.d.ts.map +1 -1
  438. package/dist/esm/behaviors/operational-credentials/VendorIdVerification.js +32 -24
  439. package/dist/esm/behaviors/operational-credentials/VendorIdVerification.js.map +1 -1
  440. package/dist/esm/behaviors/thermostat/ThermostatServer.d.ts +15 -4
  441. package/dist/esm/behaviors/thermostat/ThermostatServer.d.ts.map +1 -1
  442. package/dist/esm/behaviors/thermostat/ThermostatServer.js +66 -49
  443. package/dist/esm/behaviors/thermostat/ThermostatServer.js.map +1 -1
  444. package/dist/esm/behaviors/time-format-localization/TimeFormatLocalizationServer.d.ts +4 -4
  445. package/dist/esm/behaviors/time-format-localization/TimeFormatLocalizationServer.d.ts.map +1 -1
  446. package/dist/esm/behaviors/time-format-localization/TimeFormatLocalizationServer.js +19 -5
  447. package/dist/esm/behaviors/time-format-localization/TimeFormatLocalizationServer.js.map +2 -2
  448. package/dist/esm/behaviors/unit-localization/UnitLocalizationServer.d.ts.map +1 -1
  449. package/dist/esm/behaviors/unit-localization/UnitLocalizationServer.js +13 -3
  450. package/dist/esm/behaviors/unit-localization/UnitLocalizationServer.js.map +1 -1
  451. package/dist/esm/endpoint/Endpoint.d.ts +5 -9
  452. package/dist/esm/endpoint/Endpoint.d.ts.map +1 -1
  453. package/dist/esm/endpoint/Endpoint.js +5 -24
  454. package/dist/esm/endpoint/Endpoint.js.map +1 -1
  455. package/dist/esm/endpoint/properties/Behaviors.d.ts.map +1 -1
  456. package/dist/esm/endpoint/properties/Behaviors.js +6 -2
  457. package/dist/esm/endpoint/properties/Behaviors.js.map +1 -1
  458. package/dist/esm/node/ClientNode.d.ts +25 -0
  459. package/dist/esm/node/ClientNode.d.ts.map +1 -1
  460. package/dist/esm/node/ClientNode.js +41 -0
  461. package/dist/esm/node/ClientNode.js.map +1 -1
  462. package/dist/esm/node/ServerNode.d.ts.map +1 -1
  463. package/dist/esm/node/ServerNode.js +2 -0
  464. package/dist/esm/node/ServerNode.js.map +1 -1
  465. package/dist/esm/node/client/ClientCommandMethod.d.ts.map +1 -1
  466. package/dist/esm/node/client/ClientCommandMethod.js +4 -16
  467. package/dist/esm/node/client/ClientCommandMethod.js.map +1 -1
  468. package/dist/esm/node/client/ClientEventEmitter.d.ts.map +1 -1
  469. package/dist/esm/node/client/ClientEventEmitter.js +6 -2
  470. package/dist/esm/node/client/ClientEventEmitter.js.map +1 -1
  471. package/dist/esm/node/client/ClientStructure.d.ts.map +1 -1
  472. package/dist/esm/node/client/ClientStructure.js +181 -108
  473. package/dist/esm/node/client/ClientStructure.js.map +2 -2
  474. package/dist/esm/node/client/Peers.d.ts +18 -6
  475. package/dist/esm/node/client/Peers.d.ts.map +1 -1
  476. package/dist/esm/node/client/Peers.js +29 -14
  477. package/dist/esm/node/client/Peers.js.map +1 -1
  478. package/dist/esm/node/integration/ChangeNotificationService.d.ts +14 -3
  479. package/dist/esm/node/integration/ChangeNotificationService.d.ts.map +1 -1
  480. package/dist/esm/node/integration/ProtocolService.d.ts.map +1 -1
  481. package/dist/esm/node/integration/ProtocolService.js +40 -57
  482. package/dist/esm/node/integration/ProtocolService.js.map +1 -1
  483. package/dist/esm/node/server/InteractionServer.d.ts.map +1 -1
  484. package/dist/esm/node/server/InteractionServer.js +28 -25
  485. package/dist/esm/node/server/InteractionServer.js.map +2 -2
  486. package/dist/esm/node/server/ServerSubscription.d.ts +7 -2
  487. package/dist/esm/node/server/ServerSubscription.d.ts.map +1 -1
  488. package/dist/esm/node/server/ServerSubscription.js +83 -47
  489. package/dist/esm/node/server/ServerSubscription.js.map +1 -1
  490. package/dist/esm/storage/EndpointStore.d.ts +1 -1
  491. package/dist/esm/storage/EndpointStore.js +1 -1
  492. package/dist/esm/storage/client/ClientEndpointStore.d.ts +2 -2
  493. package/dist/esm/storage/client/ClientEndpointStore.d.ts.map +1 -1
  494. package/dist/esm/storage/client/ClientEndpointStore.js +1 -1
  495. package/dist/esm/storage/client/DatasourceCache.d.ts +5 -3
  496. package/dist/esm/storage/client/DatasourceCache.d.ts.map +1 -1
  497. package/dist/esm/storage/client/DatasourceCache.js +68 -71
  498. package/dist/esm/storage/client/DatasourceCache.js.map +1 -1
  499. package/dist/esm/storage/client/FabricScopedListWrite.d.ts +73 -0
  500. package/dist/esm/storage/client/FabricScopedListWrite.d.ts.map +1 -0
  501. package/dist/esm/storage/client/FabricScopedListWrite.js +148 -0
  502. package/dist/esm/storage/client/FabricScopedListWrite.js.map +6 -0
  503. package/dist/esm/storage/client/RemoteWriteParticipant.d.ts +9 -6
  504. package/dist/esm/storage/client/RemoteWriteParticipant.d.ts.map +1 -1
  505. package/dist/esm/storage/client/RemoteWriteParticipant.js +11 -15
  506. package/dist/esm/storage/client/RemoteWriteParticipant.js.map +1 -1
  507. package/dist/esm/storage/client/RemoteWriter.d.ts +67 -7
  508. package/dist/esm/storage/client/RemoteWriter.d.ts.map +1 -1
  509. package/dist/esm/storage/client/RemoteWriter.js +65 -14
  510. package/dist/esm/storage/client/RemoteWriter.js.map +1 -1
  511. package/dist/esm/storage/server/DatasourceStore.d.ts +2 -2
  512. package/dist/esm/storage/server/DatasourceStore.d.ts.map +1 -1
  513. package/dist/esm/storage/server/DatasourceStore.js.map +1 -1
  514. package/dist/esm/storage/server/ServerEndpointStore.d.ts +2 -2
  515. package/dist/esm/storage/server/ServerEndpointStore.d.ts.map +1 -1
  516. package/dist/esm/storage/server/ServerEndpointStore.js +1 -1
  517. package/dist/esm/testing/mock-server-node.d.ts +2 -1
  518. package/dist/esm/testing/mock-server-node.d.ts.map +1 -1
  519. package/dist/esm/testing/mock-server-node.js +16 -7
  520. package/dist/esm/testing/mock-server-node.js.map +2 -2
  521. package/dist/esm/testing/node-helpers.d.ts +5 -0
  522. package/dist/esm/testing/node-helpers.d.ts.map +1 -1
  523. package/dist/esm/testing/node-helpers.js +4 -4
  524. package/dist/esm/testing/node-helpers.js.map +1 -1
  525. package/package.json +6 -6
  526. package/src/behavior/Behavior.ts +2 -0
  527. package/src/behavior/Events.ts +6 -3
  528. package/src/behavior/cluster/ClusterBehavior.ts +22 -13
  529. package/src/behavior/cluster/ClusterBehaviorType.ts +9 -270
  530. package/src/behavior/context/server/LocalActorContext.ts +1 -4
  531. package/src/behavior/internal/BehaviorBacking.ts +10 -2
  532. package/src/behavior/internal/ClusterDerivation.ts +295 -0
  533. package/src/behavior/internal/ClusterStatics.ts +180 -0
  534. package/src/behavior/internal/ModeledState.ts +58 -0
  535. package/src/behavior/internal/ServerBehaviorBacking.ts +9 -16
  536. package/src/behavior/state/managed/Datasource.ts +181 -58
  537. package/src/behavior/state/managed/Internal.ts +44 -34
  538. package/src/behavior/state/managed/ManagedReference.ts +159 -70
  539. package/src/behavior/state/managed/NameResolver.ts +1 -1
  540. package/src/behavior/state/managed/ReadOnlyReference.ts +61 -0
  541. package/src/behavior/state/managed/ValReference.ts +104 -14
  542. package/src/behavior/state/managed/errors.ts +33 -0
  543. package/src/behavior/state/managed/index.ts +1 -0
  544. package/src/behavior/state/managed/values/BitmapManager.ts +6 -22
  545. package/src/behavior/state/managed/values/ListManager.ts +313 -164
  546. package/src/behavior/state/managed/values/StructManager.ts +48 -52
  547. package/src/behavior/state/managed/values/ValuePatcher.ts +25 -3
  548. package/src/behavior/state/validation/FabricIndexField.ts +51 -0
  549. package/src/behavior/state/validation/ValueValidator.ts +24 -54
  550. package/src/behavior/state/validation/conformance.ts +9 -7
  551. package/src/behavior/state/validation/constraint.ts +5 -1
  552. package/src/behavior/state/validation/location.ts +8 -0
  553. package/src/behavior/state/validation/remote-validation.ts +107 -0
  554. package/src/behavior/supervision/Supervision.ts +1 -2
  555. package/src/behavior/supervision/SupervisionConfig.ts +1 -2
  556. package/src/behavior/supervision/ValueSupervisor.ts +3 -13
  557. package/src/behavior/system/commissioning/CommissioningClient.ts +122 -6
  558. package/src/behavior/system/commissioning/RemoteDescriptor.ts +17 -1
  559. package/src/behavior/system/controller/ControllerBehavior.ts +2 -1
  560. package/src/behavior/system/dcl/DclBehavior.ts +3 -3
  561. package/src/behavior/system/network/ServerGroupNetworking.ts +3 -2
  562. package/src/behavior/system/remote/api/ApiResource.ts +23 -0
  563. package/src/behavior/system/remote/api/Envelope.ts +8 -6
  564. package/src/behavior/system/remote/api/resources/CommandResource.ts +2 -2
  565. package/src/behavior/system/remote/api/resources/NodeResource.ts +4 -0
  566. package/src/behavior/system/remote/api/resources/PropertyResource.ts +5 -3
  567. package/src/behavior/system/remote/api/resources/ServerNodeResource.ts +2 -13
  568. package/src/behavior/system/sessions/SessionsBehavior.ts +8 -2
  569. package/src/behavior/system/subscriptions/SubscriptionStore.ts +66 -0
  570. package/src/behavior/system/subscriptions/SubscriptionsServer.ts +73 -33
  571. package/src/behaviors/access-control/AccessControlServer.ts +3 -3
  572. package/src/behaviors/administrator-commissioning/AdministratorCommissioningServer.ts +47 -24
  573. package/src/behaviors/general-diagnostics/GeneralDiagnosticsServer.ts +138 -84
  574. package/src/behaviors/group-key-management/GroupKeyManagementServer.ts +12 -8
  575. package/src/behaviors/groupcast/GroupcastServer.ts +50 -34
  576. package/src/behaviors/localization-configuration/LocalizationConfigurationServer.ts +18 -6
  577. package/src/behaviors/operational-credentials/VendorIdVerification.ts +50 -35
  578. package/src/behaviors/thermostat/ThermostatServer.ts +93 -70
  579. package/src/behaviors/time-format-localization/TimeFormatLocalizationServer.ts +24 -9
  580. package/src/behaviors/unit-localization/UnitLocalizationServer.ts +17 -4
  581. package/src/endpoint/Endpoint.ts +5 -31
  582. package/src/endpoint/properties/Behaviors.ts +6 -2
  583. package/src/node/ClientNode.ts +41 -0
  584. package/src/node/ServerNode.ts +2 -0
  585. package/src/node/client/ClientCommandMethod.ts +4 -19
  586. package/src/node/client/ClientEventEmitter.ts +7 -3
  587. package/src/node/client/ClientStructure.ts +208 -135
  588. package/src/node/client/Peers.ts +36 -20
  589. package/src/node/integration/ChangeNotificationService.ts +18 -3
  590. package/src/node/integration/ProtocolService.ts +45 -57
  591. package/src/node/server/InteractionServer.ts +33 -35
  592. package/src/node/server/ServerSubscription.ts +88 -50
  593. package/src/storage/EndpointStore.ts +1 -1
  594. package/src/storage/client/ClientEndpointStore.ts +1 -1
  595. package/src/storage/client/DatasourceCache.ts +86 -79
  596. package/src/storage/client/FabricScopedListWrite.ts +245 -0
  597. package/src/storage/client/RemoteWriteParticipant.ts +20 -23
  598. package/src/storage/client/RemoteWriter.ts +156 -26
  599. package/src/storage/server/DatasourceStore.ts +2 -2
  600. package/src/storage/server/ServerEndpointStore.ts +1 -1
  601. package/src/testing/mock-server-node.ts +22 -9
  602. package/src/testing/node-helpers.ts +5 -1
  603. package/dist/cjs/behavior/state/validation/FabricIndexSentinel.d.ts +0 -14
  604. package/dist/cjs/behavior/state/validation/FabricIndexSentinel.d.ts.map +0 -1
  605. package/dist/cjs/behavior/state/validation/FabricIndexSentinel.js.map +0 -6
  606. package/dist/cjs/behavior/state/validation/peer-forwarding.d.ts +0 -20
  607. package/dist/cjs/behavior/state/validation/peer-forwarding.d.ts.map +0 -1
  608. package/dist/cjs/behavior/state/validation/peer-forwarding.js.map +0 -6
  609. package/dist/esm/behavior/state/validation/FabricIndexSentinel.d.ts +0 -14
  610. package/dist/esm/behavior/state/validation/FabricIndexSentinel.d.ts.map +0 -1
  611. package/dist/esm/behavior/state/validation/FabricIndexSentinel.js +0 -15
  612. package/dist/esm/behavior/state/validation/FabricIndexSentinel.js.map +0 -6
  613. package/dist/esm/behavior/state/validation/peer-forwarding.d.ts +0 -20
  614. package/dist/esm/behavior/state/validation/peer-forwarding.d.ts.map +0 -1
  615. package/dist/esm/behavior/state/validation/peer-forwarding.js +0 -26
  616. package/dist/esm/behavior/state/validation/peer-forwarding.js.map +0 -6
  617. package/src/behavior/state/validation/FabricIndexSentinel.ts +0 -20
  618. package/src/behavior/state/validation/peer-forwarding.ts +0 -47
@@ -4,26 +4,18 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
- import { isObject, serialize } from "@matter/general";
7
+ import { InternalError, isObject, serialize } from "@matter/general";
8
8
  import type { Schema } from "@matter/model";
9
- import { Access, AttributeModel, DataModelPath, ValueModel } from "@matter/model";
10
- import {
11
- AccessControl,
12
- ExpiredReferenceError,
13
- hasLocalActor,
14
- hasRemoteActor,
15
- ReadError,
16
- SchemaImplementationError,
17
- Val,
18
- WriteError,
19
- } from "@matter/protocol";
9
+ import { AttributeModel, DataModelPath, ValueModel } from "@matter/model";
10
+ import { AccessControl, hasRemoteActor, ReadError, SchemaImplementationError, Val, WriteError } from "@matter/protocol";
20
11
  import { Status } from "@matter/types";
21
12
  import type { RootSupervisor } from "../../../supervision/RootSupervisor.js";
22
13
  import type { ValueSupervisor } from "../../../supervision/ValueSupervisor.js";
23
14
  import type { ValidationLocation } from "../../validation/location.js";
24
15
  import { Internal } from "../Internal.js";
25
16
  import { ManagedReference } from "../ManagedReference.js";
26
- import type { ValReference } from "../ValReference.js";
17
+ import { ReadOnlyReference } from "../ReadOnlyReference.js";
18
+ import { ValReference } from "../ValReference.js";
27
19
  import { PrimitiveManager } from "./PrimitiveManager.js";
28
20
 
29
21
  /**
@@ -54,18 +46,6 @@ export function ListManager(owner: RootSupervisor, schema: Schema): ValueSupervi
54
46
  };
55
47
  }
56
48
 
57
- /**
58
- * Whether a list holds fabric-scoped entries that a remote actor may see filtered by fabric: `F` access, or an attribute
59
- * with `S` access. `S` on a struct field only hides that field from other fabrics.
60
- */
61
- export function isFabricScopedList(schema: Schema) {
62
- return schema.effectiveAccess.fabric === Access.Fabric.Scoped || isFabricSensitiveList(schema);
63
- }
64
-
65
- function isFabricSensitiveList(schema: Schema) {
66
- return schema instanceof AttributeModel && schema.fabricSensitive;
67
- }
68
-
69
49
  function createConfig(owner: RootSupervisor, schema: Schema): ListConfig {
70
50
  const entry = schema instanceof ValueModel ? schema.listEntry : undefined;
71
51
  if (entry === undefined) {
@@ -75,12 +55,10 @@ function createConfig(owner: RootSupervisor, schema: Schema): ListConfig {
75
55
  const entryManager = owner.get(entry);
76
56
 
77
57
  const access = AccessControl(schema);
78
- const fabricSensitive = isFabricSensitiveList(schema);
79
-
80
58
  return {
81
59
  schema,
82
- fabricScoped: fabricSensitive || schema.effectiveAccess.fabric === Access.Fabric.Scoped,
83
- fabricSensitive,
60
+ fabricScoped: schema instanceof ValueModel && schema.fabricScopedList,
61
+ fabricSensitive: schema instanceof AttributeModel && schema.fabricSensitive,
84
62
  manageEntries: entryManager.manage !== PrimitiveManager,
85
63
  manageEntry: entryManager.manage,
86
64
  validateEntry: entryManager.validate,
@@ -100,7 +78,6 @@ interface ListConfig {
100
78
  authorizeWrite: AccessControl["authorizeWrite"];
101
79
  }
102
80
 
103
- const assertWriteOkAlways = () => true;
104
81
  const cloneEntry = (val: Val) => (Array.isArray(val) ? [...(val as Val.List)] : isObject(val) ? { ...val } : val);
105
82
  const inspectCustom = Symbol.for("nodejs.util.inspect.custom");
106
83
 
@@ -112,6 +89,35 @@ function inspectList(this: Val.List) {
112
89
  return [...this];
113
90
  }
114
91
 
92
+ /**
93
+ * Maximum number of entries in a list: list indices are 16 bits wide.
94
+ */
95
+ const MAX_LIST_LENGTH = 65536;
96
+
97
+ /**
98
+ * Array methods that add, remove, overwrite, move or insert entries. The proxy runs them on a plain array of the
99
+ * visible entries; see {@link ListProxyHandler.editEntries}.
100
+ */
101
+ const entryEdits = new Map<PropertyKey, (...args: never[]) => unknown>([
102
+ ["copyWithin", Array.prototype.copyWithin],
103
+ ["fill", Array.prototype.fill],
104
+ ["pop", Array.prototype.pop],
105
+ ["push", Array.prototype.push],
106
+ ["reverse", Array.prototype.reverse],
107
+ ["shift", Array.prototype.shift],
108
+ ["sort", Array.prototype.sort],
109
+ ["splice", Array.prototype.splice],
110
+ ["unshift", Array.prototype.unshift],
111
+ ]);
112
+
113
+ /**
114
+ * The list index a property key names, or `undefined` for any other key. Like an array, the list treats only the
115
+ * canonical decimal form as an index, so `"1.5"` and `"01"` are not indices.
116
+ */
117
+ function entryIndexFor(property: PropertyKey) {
118
+ return typeof property === "string" && /^(0|[1-9]\d*)$/.test(property) ? Number.parseInt(property) : undefined;
119
+ }
120
+
115
121
  class ListProxyHandler implements ProxyHandler<Val.List> {
116
122
  protected reference: ValReference<Val.List>;
117
123
  protected session: ValueSupervisor.Session;
@@ -126,18 +132,16 @@ class ListProxyHandler implements ProxyHandler<Val.List> {
126
132
  ...reference.location,
127
133
  path: reference.location.path.at(-1),
128
134
  owner: reference.rootOwner,
135
+ remote: reference.mirrorsRemote ? "outbound" : undefined,
129
136
  };
130
137
  }
131
138
 
132
139
  protected readVal() {
133
- return this.reference.value ?? [];
140
+ return ValReference.containerOf(this.reference);
134
141
  }
135
142
 
136
143
  protected writeVal() {
137
- if (this.reference.expired) {
138
- throw new ExpiredReferenceError(this.reference.location);
139
- }
140
- return this.reference.value;
144
+ return ValReference.writableContainerOf(this.reference);
141
145
  }
142
146
 
143
147
  protected getListLength() {
@@ -145,10 +149,14 @@ class ListProxyHandler implements ProxyHandler<Val.List> {
145
149
  }
146
150
 
147
151
  protected setListLength(length: number) {
148
- if (length > 65535) {
149
- throw new WriteError(this.reference.location, `Index ${length} is greater than allowed maximum of 65535`);
152
+ this.config.authorizeWrite(this.session, this.reference.location);
153
+ if (!Number.isInteger(length) || length < 0) {
154
+ throw new WriteError(this.reference.location, `Length ${length} is not a valid list length`);
155
+ }
156
+ if (length > this.getListLength()) {
157
+ throw new WriteError(this.reference.location, `Length ${length} would leave a gap after the last entry`);
150
158
  }
151
- this.reference.change(() => (this.writeVal().length = length), "length");
159
+ this.storeEntries(this.visibleEntries().slice(0, length));
152
160
  }
153
161
 
154
162
  protected hasEntry(index: number) {
@@ -163,8 +171,11 @@ class ListProxyHandler implements ProxyHandler<Val.List> {
163
171
  throw new ReadError(this.reference.location, `Index ${index} is out of bounds`);
164
172
  }
165
173
 
166
- if (index > 65535) {
167
- throw new ReadError(this.reference.location, `Index ${index} is greater than allowed maximum of 65535`);
174
+ if (index >= MAX_LIST_LENGTH) {
175
+ throw new ReadError(
176
+ this.reference.location,
177
+ `Index ${index} is greater than allowed maximum of ${MAX_LIST_LENGTH - 1}`,
178
+ );
168
179
  }
169
180
 
170
181
  const value = this.readVal()[index];
@@ -175,14 +186,7 @@ class ListProxyHandler implements ProxyHandler<Val.List> {
175
186
  let subref = this.reference.subrefs?.[index];
176
187
 
177
188
  if (subref === undefined) {
178
- subref = new ManagedReference(
179
- this.reference,
180
- index,
181
- undefined,
182
- assertWriteOkAlways,
183
- cloneEntry,
184
- this.session,
185
- );
189
+ subref = new ManagedReference(this.reference, index, undefined, cloneEntry, this.session, "entry");
186
190
 
187
191
  this.config.manageEntry(subref, this.session);
188
192
  }
@@ -202,35 +206,183 @@ class ListProxyHandler implements ProxyHandler<Val.List> {
202
206
  *
203
207
  * Invoked before the entry is validated, because validation judges the entry as a whole.
204
208
  */
205
- protected prepareEntry(value: Val): Val {
209
+ protected prepareEntry(value: Val, _location: AccessControl.Location): Val {
206
210
  return value;
207
211
  }
208
212
 
213
+ /**
214
+ * Store a prepared, validated entry after the caller authorized the write. The caller passes a value the list may
215
+ * own; see {@link Internal.copy}.
216
+ */
209
217
  protected writeEntry(index: number, value: Val, location: AccessControl.Location) {
210
- this.config.authorizeWrite(this.session, location);
211
-
212
- if (index < 0 || index > this.readVal().length + 1) {
218
+ if (index < 0 || index > this.readVal().length) {
213
219
  throw new WriteError(location, `Index ${index} is out of bounds`);
214
220
  }
215
221
 
216
- if (index > 65535) {
217
- throw new ReadError(location, `Index ${index} is greater than allowed maximum of 65535`);
222
+ if (index >= MAX_LIST_LENGTH) {
223
+ throw new WriteError(location, `Index ${index} is greater than allowed maximum of ${MAX_LIST_LENGTH - 1}`);
218
224
  }
219
225
 
220
- // Unwrap incoming managed values (including nested)
221
- value = Internal.unmanage(value);
222
-
223
226
  this.reference.change(() => (this.writeVal()[index] = value), index);
224
227
  }
225
228
 
229
+ /**
230
+ * Remove the entry at `index`, which is below {@link getListLength}. Only the last entry may go, so the list never
231
+ * has a gap.
232
+ */
233
+ protected deleteEntry(index: number, location: AccessControl.Location) {
234
+ if (index !== this.getListLength() - 1) {
235
+ throw new WriteError(location, `Deleting entry ${index} would leave a gap; use splice to remove it`);
236
+ }
237
+ this.setListLength(index);
238
+ }
239
+
240
+ /**
241
+ * The stored entries this session sees, in the order of the indices {@link readEntry} and {@link writeEntry} use.
242
+ */
243
+ protected visibleEntries(): Val[] {
244
+ return [...this.readVal()];
245
+ }
246
+
247
+ /**
248
+ * Replace the entries {@link visibleEntries} returns with `entries` in a single change. Throws {@link WriteError}
249
+ * when the list would exceed {@link MAX_LIST_LENGTH}.
250
+ *
251
+ * An entry that `entries` holds more than once is stored once and copied into its other slots, because the
252
+ * transaction may own the entry and a nested write changes an owned entry in place (see {@link ValReference.owns}).
253
+ * The original stays at the slot that already holds it, so the reference held for that slot stays live.
254
+ */
255
+ protected storeEntries(entries: Val[]) {
256
+ if (entries.length > MAX_LIST_LENGTH) {
257
+ throw new WriteError(
258
+ this.reference.location,
259
+ `Length ${entries.length} exceeds the maximum of ${MAX_LIST_LENGTH}`,
260
+ );
261
+ }
262
+
263
+ const current = this.readVal();
264
+ const originalSlot = new Map<Val, number>();
265
+ entries.forEach((entry, index) => {
266
+ if (typeof entry !== "object" || entry === null) {
267
+ return;
268
+ }
269
+ const slot = originalSlot.get(entry);
270
+ if (slot === undefined || current[index] === entry) {
271
+ originalSlot.set(entry, index);
272
+ }
273
+ });
274
+ const placed = entries.map((entry, index) =>
275
+ typeof entry === "object" && entry !== null && originalSlot.get(entry) !== index
276
+ ? Internal.copy(entry)
277
+ : entry,
278
+ );
279
+
280
+ this.reference.change(() => {
281
+ const list = this.writeVal();
282
+ placed.forEach((entry, index) => (list[index] = entry));
283
+ list.length = placed.length;
284
+ }, "length");
285
+ }
286
+
287
+ /**
288
+ * Apply an array method that changes entries, and return its result.
289
+ *
290
+ * The method runs on a plain array of the visible entries, so it moves entry objects rather than entry proxies. A
291
+ * stored entry keeps its value. Every other value is new: it is copied, prepared and validated before anything is
292
+ * stored. The result is stored in a single change, so a rejected entry leaves the list unchanged.
293
+ *
294
+ * A stored entry leaves this method only as a read-only view (see {@link ReadOnlyReference}): the entries `pop`,
295
+ * `shift` and `splice` remove, and the entries a `sort` comparator receives. A method that returns its array
296
+ * returns the list itself.
297
+ */
298
+ protected editEntries(method: (...args: never[]) => unknown, args: unknown[], receiver: Val.List): unknown {
299
+ this.config.authorizeWrite(this.session, this.reference.location);
300
+
301
+ const stored = this.visibleEntries();
302
+ const viewOf = this.#viewsOf(stored);
303
+ const [compare] = args;
304
+ const edited = [...stored];
305
+ const result = Reflect.apply(
306
+ method,
307
+ edited,
308
+ method === Array.prototype.sort && typeof compare === "function"
309
+ ? [(a: Val, b: Val): unknown => Reflect.apply(compare, undefined, [viewOf(a), viewOf(b)])]
310
+ : args,
311
+ );
312
+
313
+ const isStored = new Set(stored);
314
+ const entries = edited.map((entry, index) => (isStored.has(entry) ? entry : this.#acceptEntry(entry, index)));
315
+
316
+ this.storeEntries(entries);
317
+
318
+ if (result === edited) {
319
+ return receiver;
320
+ }
321
+ if (method === Array.prototype.splice && Array.isArray(result)) {
322
+ return result.map(viewOf);
323
+ }
324
+ return viewOf(result);
325
+ }
326
+
327
+ /**
328
+ * Create a function that returns a read-only managed view of an entry of `stored`, one view per entry. Any other
329
+ * value, and every entry of a list of primitives, is returned unchanged.
330
+ */
331
+ #viewsOf(stored: Val[]) {
332
+ const views = new Map<Val, Val>();
333
+ let indices: Map<Val, number> | undefined;
334
+
335
+ return (entry: Val) => {
336
+ if (!this.config.manageEntries || typeof entry !== "object" || entry === null) {
337
+ return entry;
338
+ }
339
+
340
+ let view = views.get(entry);
341
+ if (view === undefined) {
342
+ indices ??= new Map(stored.map((entry, index) => [entry, index]));
343
+ const index = indices.get(entry);
344
+ if (index === undefined) {
345
+ throw new InternalError(`Entry to view at ${this.reference.location.path} is not a stored entry`);
346
+ }
347
+
348
+ const location = { ...this.reference.location, path: this.reference.location.path.at(index) };
349
+ const reference = new ReadOnlyReference(
350
+ entry,
351
+ location,
352
+ this.reference.rootOwner,
353
+ this.reference.mirrorsRemote,
354
+ );
355
+ this.config.manageEntry(reference, this.session);
356
+ view = reference.owner;
357
+ views.set(entry, view);
358
+ }
359
+ return view;
360
+ };
361
+ }
362
+
363
+ /**
364
+ * Turn a caller's value into an entry the list may store: a copy of the value, prepared and validated. The
365
+ * caller's value stays unchanged.
366
+ */
367
+ #acceptEntry(value: Val, index: number) {
368
+ this.#sublocation.path.id = index;
369
+ if (value === undefined) {
370
+ throw new WriteError(this.#sublocation, `Entry ${index} has no value`);
371
+ }
372
+ const entry = this.prepareEntry(Internal.copy(value), this.#sublocation);
373
+ this.config.validateEntry?.(entry, this.session, this.#sublocation);
374
+ return entry;
375
+ }
376
+
226
377
  protected getIteratorFn(): Val.List[typeof Symbol.iterator] {
227
378
  return this.readVal()[Symbol.iterator];
228
379
  }
229
380
 
230
381
  get(_target: Val.List, property: PropertyKey, receiver: Val.List) {
231
- if (typeof property === "string" && property.match(/^\d+/)) {
232
- this.#sublocation.path.id = property;
233
- return this.readEntry(Number.parseInt(property), this.#sublocation);
382
+ const index = entryIndexFor(property);
383
+ if (index !== undefined) {
384
+ this.#sublocation.path.id = index;
385
+ return this.readEntry(index, this.#sublocation);
234
386
  }
235
387
 
236
388
  switch (property) {
@@ -253,15 +405,19 @@ class ListProxyHandler implements ProxyHandler<Val.List> {
253
405
  return undefined;
254
406
  }
255
407
 
408
+ const method = entryEdits.get(property);
409
+ if (method) {
410
+ return (...args: unknown[]) => this.editEntries(method, args, receiver);
411
+ }
412
+
256
413
  return Reflect.get(this.readVal(), property, receiver);
257
414
  }
258
415
 
259
416
  set(_target: Val.List, property: PropertyKey, newValue: Val, receiver: Val.List) {
260
- if (typeof property === "string" && property.match(/^\d+/)) {
261
- this.#sublocation.path.id = property;
262
- newValue = this.prepareEntry(newValue);
263
- this.config.validateEntry?.(newValue, this.session, this.#sublocation);
264
- this.writeEntry(Number.parseInt(property), newValue, this.#sublocation);
417
+ const index = entryIndexFor(property);
418
+ if (index !== undefined) {
419
+ this.config.authorizeWrite(this.session, this.reference.location);
420
+ this.writeEntry(index, this.#acceptEntry(newValue, index), this.#sublocation);
265
421
  return true;
266
422
  } else if (property === "length") {
267
423
  this.setListLength(newValue as number);
@@ -272,17 +428,24 @@ class ListProxyHandler implements ProxyHandler<Val.List> {
272
428
  }
273
429
 
274
430
  has(_target: Val.List, property: PropertyKey) {
275
- if (typeof property === "string" && property.match(/^\d+/)) {
276
- return this.hasEntry(Number.parseInt(property));
431
+ const index = entryIndexFor(property);
432
+ if (index !== undefined) {
433
+ return this.hasEntry(index);
277
434
  }
278
435
 
279
436
  return Reflect.has(this.readVal(), property);
280
437
  }
281
438
 
282
439
  deleteProperty(_target: Val.List, property: PropertyKey) {
283
- if (typeof property === "string" && property.match(/^\d+/)) {
284
- this.#sublocation.path.id = property;
285
- this.writeEntry(Number.parseInt(property), undefined, this.#sublocation);
440
+ const index = entryIndexFor(property);
441
+ if (index !== undefined) {
442
+ if (index >= this.getListLength()) {
443
+ // Ignored as on an array, but the list must still be writable, so an uncached or group list refuses
444
+ this.reference.assertWritable();
445
+ return true;
446
+ }
447
+ this.#sublocation.path.id = index;
448
+ this.deleteEntry(index, this.#sublocation);
286
449
  return true;
287
450
  }
288
451
 
@@ -293,8 +456,30 @@ class ListProxyHandler implements ProxyHandler<Val.List> {
293
456
  return Reflect.ownKeys(this.readVal());
294
457
  }
295
458
 
459
+ /**
460
+ * The descriptors of the entries and of `length` carry what {@link get} returns: the managed entry and the length
461
+ * this session sees.
462
+ */
296
463
  getOwnPropertyDescriptor(_target: Val.List, key: PropertyKey) {
297
- return Reflect.getOwnPropertyDescriptor(this.readVal(), key);
464
+ const index = entryIndexFor(key);
465
+ if (index === undefined) {
466
+ const descriptor = Reflect.getOwnPropertyDescriptor(this.readVal(), key);
467
+ if (key === "length" && descriptor !== undefined) {
468
+ descriptor.value = this.getListLength();
469
+ }
470
+ return descriptor;
471
+ }
472
+ if (index >= this.getListLength()) {
473
+ return undefined;
474
+ }
475
+
476
+ this.#sublocation.path.id = index;
477
+ return {
478
+ value: this.readEntry(index, this.#sublocation),
479
+ writable: true,
480
+ enumerable: true,
481
+ configurable: true,
482
+ };
298
483
  }
299
484
  }
300
485
 
@@ -303,6 +488,14 @@ class ListProxyHandler implements ProxyHandler<Val.List> {
303
488
  * list with fabric filtering enabled, logical indices are mapped to physical indices that match the actor's fabric.
304
489
  */
305
490
  class FabricFilteredListProxyHandler extends ListProxyHandler {
491
+ #isVisible(entry: Val) {
492
+ if (!isObject(entry)) {
493
+ return false;
494
+ }
495
+ const { fabricIndex } = entry as { fabricIndex?: number };
496
+ return !fabricIndex || fabricIndex === this.session.fabric;
497
+ }
498
+
306
499
  #mapScopedToActual(index: number, reading: boolean) {
307
500
  if (index < 0) {
308
501
  throw new (reading ? ReadError : WriteError)(
@@ -311,14 +504,10 @@ class FabricFilteredListProxyHandler extends ListProxyHandler {
311
504
  );
312
505
  }
313
506
 
507
+ const list = reading ? this.readVal() : this.writeVal();
314
508
  let nextPos = 0;
315
- for (let i = 0; i < this.readVal().length; i++) {
316
- const entry = this.readVal()[i] as undefined | { fabricIndex?: number };
317
- if (!isObject(entry)) {
318
- continue;
319
- }
320
-
321
- if (hasLocalActor(this.session) || !entry.fabricIndex || entry.fabricIndex === this.session.fabric) {
509
+ for (let i = 0; i < list.length; i++) {
510
+ if (this.#isVisible(list[i])) {
322
511
  if (nextPos === index) {
323
512
  return i;
324
513
  }
@@ -331,7 +520,7 @@ class FabricFilteredListProxyHandler extends ListProxyHandler {
331
520
  }
332
521
 
333
522
  if (nextPos === index) {
334
- return this.readVal().length;
523
+ return list.length;
335
524
  }
336
525
 
337
526
  throw new WriteError(this.reference.location, `Index ${index} would leave gaps in fabric-filtered list`);
@@ -341,7 +530,10 @@ class FabricFilteredListProxyHandler extends ListProxyHandler {
341
530
  try {
342
531
  return super.readEntry(this.#mapScopedToActual(index, true), this.reference.location) !== undefined;
343
532
  } catch (e) {
344
- return false;
533
+ if (e instanceof ReadError) {
534
+ return false;
535
+ }
536
+ throw e;
345
537
  }
346
538
  }
347
539
 
@@ -349,85 +541,55 @@ class FabricFilteredListProxyHandler extends ListProxyHandler {
349
541
  return super.readEntry(this.#mapScopedToActual(index, true), location);
350
542
  }
351
543
 
352
- protected override prepareEntry(value: Val) {
353
- if (isObject(value)) {
354
- (value as { fabricIndex?: number }).fabricIndex ??= this.session.fabric;
544
+ protected override prepareEntry(value: Val, location: AccessControl.Location) {
545
+ if (!isObject(value)) {
546
+ throw new WriteError(location, `Fabric scoped list value is not an object`, Status.Failure);
355
547
  }
548
+ (value as { fabricIndex?: number }).fabricIndex ??= this.session.fabric;
356
549
  return value;
357
550
  }
358
551
 
359
552
  protected override writeEntry(index: number, value: Val, location: AccessControl.Location) {
360
- if (value === undefined) {
361
- const valueIndex = this.#mapScopedToActual(index, false);
362
- this.writeVal().splice(valueIndex, 1);
363
- } else {
364
- if (!isObject(value)) {
365
- throw new WriteError(location, `Fabric scoped list value is not an object`, Status.Failure);
366
- }
367
- super.writeEntry(this.#mapScopedToActual(index, false), value, location);
368
- }
553
+ super.writeEntry(this.#mapScopedToActual(index, false), value, location);
369
554
  }
370
555
 
371
- protected override getListLength() {
372
- let length = 0;
373
- for (let i = 0; i < this.readVal().length; i++) {
374
- const entry = this.readVal()[i] as undefined | { fabricIndex?: number };
375
- if (isObject(entry) && (!entry.fabricIndex || entry.fabricIndex === this.session.fabric)) {
376
- length++;
377
- }
378
- }
379
- return length;
556
+ /**
557
+ * Remove the entry at `index`, which is below {@link getListLength}. Any entry may go, because the later entries
558
+ * of this fabric move up to fill the gap.
559
+ */
560
+ protected override deleteEntry(index: number, location: AccessControl.Location) {
561
+ this.config.authorizeWrite(this.session, location);
562
+ const entries = this.visibleEntries();
563
+ entries.splice(index, 1);
564
+ this.storeEntries(entries);
380
565
  }
381
566
 
382
- protected override setListLength(length: number) {
383
- const formerLength = this.getListLength();
384
-
385
- this.reference.change(() => {
386
- for (let i = formerLength - 1; i >= length; i--) {
387
- const entry = this.writeVal()[this.#mapScopedToActual(i, true)] as undefined | { fabricIndex?: number };
388
- if (isObject(entry) && (!entry.fabricIndex || entry.fabricIndex === this.session.fabric)) {
389
- this.writeVal().splice(this.#mapScopedToActual(i, false), 1);
390
- } else if (entry !== undefined) {
391
- throw new WriteError(
392
- this.reference.location,
393
- `Fabric scoped list value is not an object`,
394
- Status.Failure,
395
- );
396
- }
397
- }
398
- }, "length");
567
+ protected override visibleEntries() {
568
+ return this.readVal().filter(entry => this.#isVisible(entry));
399
569
  }
400
570
 
401
- protected override getIteratorFn(): Val.List[typeof Symbol.iterator] {
402
- const fabric = this.session.fabric;
403
- const readVal = () => this.readVal();
404
-
405
- return (() => {
406
- const iterator = readVal()[Symbol.iterator]();
407
-
408
- return {
409
- ...iterator,
410
- next() {
411
- while (true) {
412
- const next = iterator.next();
413
-
414
- if (
415
- !next.done &&
416
- isObject(next.value) &&
417
- (next.value as { fabricIndex?: number }).fabricIndex !== fabric
418
- ) {
419
- continue;
420
- }
571
+ /**
572
+ * Put `entries` into the positions of this fabric's entries, in order, and keep other fabrics' entries in their
573
+ * order. Entries beyond those positions go to the end; positions beyond the entries are removed.
574
+ */
575
+ protected override storeEntries(entries: Val[]) {
576
+ const stored = this.readVal();
577
+ const result = new Array<Val>();
578
+ let next = 0;
579
+ for (const entry of stored) {
580
+ if (!this.#isVisible(entry)) {
581
+ result.push(entry);
582
+ } else if (next < entries.length) {
583
+ result.push(entries[next++]);
584
+ }
585
+ }
586
+ result.push(...entries.slice(next));
421
587
 
422
- return next;
423
- }
424
- },
588
+ super.storeEntries(result);
589
+ }
425
590
 
426
- [Symbol.iterator]() {
427
- return this;
428
- },
429
- };
430
- }) as Val.List[typeof Symbol.iterator];
591
+ protected override getListLength() {
592
+ return this.visibleEntries().length;
431
593
  }
432
594
 
433
595
  override ownKeys() {
@@ -437,26 +599,10 @@ class FabricFilteredListProxyHandler extends ListProxyHandler {
437
599
  if (typeof k !== "string") {
438
600
  return true;
439
601
  }
440
- if (!k.match(/^\d+$/)) {
441
- return true;
442
- }
443
- if (Number.parseInt(k) < length) {
444
- return true;
445
- }
446
- return false;
602
+ const index = entryIndexFor(k);
603
+ return index === undefined || index < length;
447
604
  });
448
605
  }
449
-
450
- override getOwnPropertyDescriptor(_target: Val.List, key: PropertyKey) {
451
- if (typeof key === "string" && key.match(/^\d+$/)) {
452
- key = Number.parseInt(key);
453
- }
454
- if (typeof key !== "number") {
455
- return Reflect.getOwnPropertyDescriptor(this.readVal(), key);
456
- }
457
-
458
- return Reflect.getOwnPropertyDescriptor(this.readVal(), this.#mapScopedToActual(key, true));
459
- }
460
606
  }
461
607
 
462
608
  function createProxy(config: ListConfig, reference: ValReference<Val.List>, session: ValueSupervisor.Session) {
@@ -464,6 +610,9 @@ function createProxy(config: ListConfig, reference: ValReference<Val.List>, sess
464
610
  config.manageEntries &&
465
611
  config.fabricScoped &&
466
612
  hasRemoteActor(session) &&
613
+ // The session's fabric belongs to our server node, not to the remote node, so it does not filter a copy of
614
+ // that node's list
615
+ !reference.mirrorsRemote &&
467
616
  // Fabric-sensitive lists are filtered for reads and writes; command handlers see all entries, as data access
468
617
  // rules do not apply to them
469
618
  (session.fabricFiltered || (config.fabricSensitive && !session.command));