@dxos/react-client 0.8.3 → 0.8.4-main.1068cf700f

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 (417) hide show
  1. package/.storybook/main.mts +11 -0
  2. package/.storybook/preview.mts +8 -0
  3. package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
  4. package/dist/lib/browser/chunk-5UKA2BMA.mjs +179 -0
  5. package/dist/lib/browser/chunk-5UKA2BMA.mjs.map +7 -0
  6. package/dist/lib/browser/{chunk-AL2CUQ46.mjs → chunk-LO3TU5CK.mjs} +8 -8
  7. package/dist/lib/browser/chunk-LO3TU5CK.mjs.map +7 -0
  8. package/dist/lib/browser/chunk-PFF63FPR.mjs +16 -0
  9. package/dist/lib/browser/chunk-PFF63FPR.mjs.map +7 -0
  10. package/dist/lib/browser/chunk-TSF6Y5VB.mjs +8 -0
  11. package/dist/lib/browser/chunk-TSF6Y5VB.mjs.map +7 -0
  12. package/dist/lib/browser/devtools/index.mjs +7 -6
  13. package/dist/lib/browser/devtools/index.mjs.map +3 -3
  14. package/dist/lib/browser/echo/index.mjs +67 -117
  15. package/dist/lib/browser/echo/index.mjs.map +4 -4
  16. package/dist/lib/browser/halo/index.mjs +12 -10
  17. package/dist/lib/browser/halo/index.mjs.map +3 -3
  18. package/dist/lib/browser/index.mjs +115 -13
  19. package/dist/lib/browser/index.mjs.map +4 -4
  20. package/dist/lib/browser/invitations/index.mjs +1 -1
  21. package/dist/lib/browser/mesh/index.mjs +4 -3
  22. package/dist/lib/browser/mesh/index.mjs.map +1 -1
  23. package/dist/lib/browser/meta.json +1 -1
  24. package/dist/lib/browser/testing/index.mjs +125 -119
  25. package/dist/lib/browser/testing/index.mjs.map +3 -3
  26. package/dist/lib/browser/worker.mjs +1 -1
  27. package/dist/lib/node-esm/chunk-373DPHEQ.mjs +10 -0
  28. package/dist/lib/node-esm/chunk-373DPHEQ.mjs.map +7 -0
  29. package/dist/lib/node-esm/{chunk-UYJUBYMU.mjs → chunk-AQJH2UNZ.mjs} +8 -8
  30. package/dist/lib/node-esm/chunk-AQJH2UNZ.mjs.map +7 -0
  31. package/dist/lib/node-esm/chunk-NETTSER2.mjs +17 -0
  32. package/dist/lib/node-esm/chunk-NETTSER2.mjs.map +7 -0
  33. package/dist/lib/node-esm/chunk-T3QTQHBD.mjs +180 -0
  34. package/dist/lib/node-esm/chunk-T3QTQHBD.mjs.map +7 -0
  35. package/dist/lib/node-esm/devtools/index.mjs +7 -6
  36. package/dist/lib/node-esm/devtools/index.mjs.map +3 -3
  37. package/dist/lib/node-esm/echo/index.mjs +67 -117
  38. package/dist/lib/node-esm/echo/index.mjs.map +4 -4
  39. package/dist/lib/node-esm/halo/index.mjs +12 -10
  40. package/dist/lib/node-esm/halo/index.mjs.map +3 -3
  41. package/dist/lib/node-esm/index.mjs +115 -13
  42. package/dist/lib/node-esm/index.mjs.map +4 -4
  43. package/dist/lib/node-esm/invitations/index.mjs +1 -1
  44. package/dist/lib/node-esm/mesh/index.mjs +4 -3
  45. package/dist/lib/node-esm/mesh/index.mjs.map +1 -1
  46. package/dist/lib/node-esm/meta.json +1 -1
  47. package/dist/lib/node-esm/testing/index.mjs +125 -119
  48. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  49. package/dist/lib/node-esm/worker.mjs +1 -1
  50. package/dist/types/src/client/AgentHostingProvider.d.ts.map +1 -1
  51. package/dist/types/src/client/ClientProvider.d.ts +0 -10
  52. package/dist/types/src/client/ClientProvider.d.ts.map +1 -1
  53. package/dist/types/src/echo/index.d.ts +2 -2
  54. package/dist/types/src/echo/index.d.ts.map +1 -1
  55. package/dist/types/src/echo/useMembers.d.ts +2 -2
  56. package/dist/types/src/echo/useMembers.d.ts.map +1 -1
  57. package/dist/types/src/echo/useQueue.d.ts +2 -2
  58. package/dist/types/src/echo/useQueue.d.ts.map +1 -1
  59. package/dist/types/src/echo/useSpaceInvitations.d.ts +3 -2
  60. package/dist/types/src/echo/useSpaceInvitations.d.ts.map +1 -1
  61. package/dist/types/src/echo/useSpaceProperties.d.ts +13 -0
  62. package/dist/types/src/echo/useSpaceProperties.d.ts.map +1 -0
  63. package/dist/types/src/echo/useSpaces.d.ts +17 -8
  64. package/dist/types/src/echo/useSpaces.d.ts.map +1 -1
  65. package/dist/types/src/echo/useSubscription.d.ts +1 -1
  66. package/dist/types/src/echo/useSubscription.d.ts.map +1 -1
  67. package/dist/types/src/echo/useSyncState.d.ts +1 -1
  68. package/dist/types/src/echo/useSyncState.d.ts.map +1 -1
  69. package/dist/types/src/halo/Passkey.stories.d.ts +5 -5
  70. package/dist/types/src/halo/Passkey.stories.d.ts.map +1 -1
  71. package/dist/types/src/halo/useHaloInvitations.d.ts.map +1 -1
  72. package/dist/types/src/invitations/useInvitationStatus.d.ts +1 -1
  73. package/dist/types/src/invitations/useInvitationStatus.d.ts.map +1 -1
  74. package/dist/types/src/testing/ClientRepeater.d.ts +6 -5
  75. package/dist/types/src/testing/ClientRepeater.d.ts.map +1 -1
  76. package/dist/types/src/testing/ClientRepeater.stories.d.ts +6 -10
  77. package/dist/types/src/testing/ClientRepeater.stories.d.ts.map +1 -1
  78. package/dist/types/src/testing/context.d.ts +4 -2
  79. package/dist/types/src/testing/context.d.ts.map +1 -1
  80. package/dist/types/src/testing/withClientProvider.d.ts +6 -10
  81. package/dist/types/src/testing/withClientProvider.d.ts.map +1 -1
  82. package/dist/types/src/testing/withClientProvider.stories.d.ts +8 -9
  83. package/dist/types/src/testing/withClientProvider.stories.d.ts.map +1 -1
  84. package/dist/types/tsconfig.tsbuildinfo +1 -1
  85. package/moon.yml +23 -0
  86. package/package.json +43 -32
  87. package/src/client/AgentHostingProvider.tsx +1 -1
  88. package/src/client/ClientProvider.test.tsx +3 -2
  89. package/src/client/ClientProvider.tsx +33 -50
  90. package/src/client/useConfig.test.tsx +2 -1
  91. package/src/devtools/useStream.ts +1 -1
  92. package/src/echo/index.ts +2 -2
  93. package/src/echo/useMembers.ts +5 -3
  94. package/src/echo/useQueue.ts +2 -2
  95. package/src/echo/useSpaceInvitations.ts +11 -5
  96. package/src/echo/useSpaceProperties.ts +28 -0
  97. package/src/echo/useSpaces.test.tsx +3 -2
  98. package/src/echo/useSpaces.ts +37 -20
  99. package/src/echo/useSubscription.ts +1 -1
  100. package/src/echo/useSyncState.ts +3 -3
  101. package/src/halo/Passkey.stories.tsx +17 -14
  102. package/src/halo/useDevices.test.tsx +2 -1
  103. package/src/halo/useHaloInvitations.ts +1 -1
  104. package/src/invitations/useInvitationStatus.ts +9 -8
  105. package/src/testing/ClientRepeater.stories.tsx +21 -12
  106. package/src/testing/ClientRepeater.tsx +29 -36
  107. package/src/testing/context.tsx +4 -3
  108. package/src/testing/withClientProvider.stories.tsx +32 -16
  109. package/src/testing/withClientProvider.tsx +81 -64
  110. package/tsconfig.json +3 -6
  111. package/vitest.config.ts +12 -16
  112. package/.eslintrc.cjs +0 -12
  113. package/README.yml +0 -33
  114. package/dist/lib/browser/chunk-72QD3PXL.mjs +0 -312
  115. package/dist/lib/browser/chunk-72QD3PXL.mjs.map +0 -7
  116. package/dist/lib/browser/chunk-AL2CUQ46.mjs.map +0 -7
  117. package/dist/lib/node/chunk-5RUIFUEC.cjs +0 -334
  118. package/dist/lib/node/chunk-5RUIFUEC.cjs.map +0 -7
  119. package/dist/lib/node/chunk-FYOAVV65.cjs +0 -188
  120. package/dist/lib/node/chunk-FYOAVV65.cjs.map +0 -7
  121. package/dist/lib/node/devtools/index.cjs +0 -62
  122. package/dist/lib/node/devtools/index.cjs.map +0 -7
  123. package/dist/lib/node/echo/index.cjs +0 -302
  124. package/dist/lib/node/echo/index.cjs.map +0 -7
  125. package/dist/lib/node/halo/index.cjs +0 -123
  126. package/dist/lib/node/halo/index.cjs.map +0 -7
  127. package/dist/lib/node/index.cjs +0 -55
  128. package/dist/lib/node/index.cjs.map +0 -7
  129. package/dist/lib/node/invitations/index.cjs +0 -39
  130. package/dist/lib/node/invitations/index.cjs.map +0 -7
  131. package/dist/lib/node/mesh/index.cjs +0 -37
  132. package/dist/lib/node/mesh/index.cjs.map +0 -7
  133. package/dist/lib/node/meta.json +0 -1
  134. package/dist/lib/node/testing/index.cjs +0 -278
  135. package/dist/lib/node/testing/index.cjs.map +0 -7
  136. package/dist/lib/node/worker.cjs +0 -23
  137. package/dist/lib/node/worker.cjs.map +0 -7
  138. package/dist/lib/node-esm/chunk-NBTZZNQ5.mjs +0 -314
  139. package/dist/lib/node-esm/chunk-NBTZZNQ5.mjs.map +0 -7
  140. package/dist/lib/node-esm/chunk-UYJUBYMU.mjs.map +0 -7
  141. package/dist/types/src/echo/useQuery.d.ts +0 -11
  142. package/dist/types/src/echo/useQuery.d.ts.map +0 -1
  143. package/dist/types/src/echo/useQuery.test.d.ts +0 -2
  144. package/dist/types/src/echo/useQuery.test.d.ts.map +0 -1
  145. package/dist/types/src/echo/useSchema.d.ts +0 -8
  146. package/dist/types/src/echo/useSchema.d.ts.map +0 -1
  147. package/dist/types/src/playwright/playwright.config.d.cts +0 -3
  148. package/dist/types/src/playwright/playwright.config.d.cts.map +0 -1
  149. package/dist/types/src/playwright/smoke.spec.d.ts +0 -2
  150. package/dist/types/src/playwright/smoke.spec.d.ts.map +0 -1
  151. package/project.json +0 -40
  152. package/src/echo/useQuery.test.tsx +0 -128
  153. package/src/echo/useQuery.ts +0 -56
  154. package/src/echo/useSchema.ts +0 -54
  155. package/src/playwright/playwright.config.cts +0 -18
  156. package/src/playwright/smoke.spec.ts +0 -26
  157. package/typedoc/.nojekyll +0 -1
  158. package/typedoc/assets/hierarchy.js +0 -1
  159. package/typedoc/assets/highlight.css +0 -99
  160. package/typedoc/assets/icons.js +0 -18
  161. package/typedoc/assets/icons.svg +0 -1
  162. package/typedoc/assets/main.js +0 -60
  163. package/typedoc/assets/navigation.js +0 -1
  164. package/typedoc/assets/search.js +0 -1
  165. package/typedoc/assets/style.css +0 -1640
  166. package/typedoc/classes/echo.Hypergraph.html +0 -17
  167. package/typedoc/classes/echo.PropertiesType.html +0 -19
  168. package/typedoc/classes/echo.QueryResult.html +0 -18
  169. package/typedoc/classes/halo.KeyStore.html +0 -6
  170. package/typedoc/classes/index.AgentClientServiceProvider.html +0 -10
  171. package/typedoc/classes/index.AgentManagerClient.html +0 -22
  172. package/typedoc/classes/index.AlreadyJoinedError.html +0 -15
  173. package/typedoc/classes/index.ApiError.html +0 -16
  174. package/typedoc/classes/index.CancelledError.html +0 -16
  175. package/typedoc/classes/index.Client.html +0 -51
  176. package/typedoc/classes/index.ClientServicesProxy.html +0 -12
  177. package/typedoc/classes/index.Config.html +0 -17
  178. package/typedoc/classes/index.DataCorruptionError.html +0 -16
  179. package/typedoc/classes/index.DatabaseError.html +0 -15
  180. package/typedoc/classes/index.EntityNotFoundError.html +0 -15
  181. package/typedoc/classes/index.FakeAgentHostingProvider.html +0 -7
  182. package/typedoc/classes/index.IFrameManager.html +0 -6
  183. package/typedoc/classes/index.IdentityNotInitializedError.html +0 -15
  184. package/typedoc/classes/index.InvalidConfigError.html +0 -16
  185. package/typedoc/classes/index.InvalidInvitationError.html +0 -15
  186. package/typedoc/classes/index.InvalidInvitationExtensionRoleError.html +0 -16
  187. package/typedoc/classes/index.InvalidStorageVersionError.html +0 -15
  188. package/typedoc/classes/index.LocalClientServices.html +0 -12
  189. package/typedoc/classes/index.PublicKey.html +0 -55
  190. package/typedoc/classes/index.RemoteServiceConnectionError.html +0 -15
  191. package/typedoc/classes/index.RemoteServiceConnectionTimeout.html +0 -15
  192. package/typedoc/classes/index.RpcClosedError.html +0 -15
  193. package/typedoc/classes/index.RpcNotOpenError.html +0 -15
  194. package/typedoc/classes/index.SharedWorkerConnection.html +0 -5
  195. package/typedoc/classes/index.Shell.html +0 -35
  196. package/typedoc/classes/index.ShellManager.html +0 -9
  197. package/typedoc/classes/index.SystemError.html +0 -16
  198. package/typedoc/classes/index.UnknownModelError.html +0 -15
  199. package/typedoc/classes/index.WorkerClientServices.html +0 -12
  200. package/typedoc/classes/invitations.AuthenticatingInvitationObservable.html +0 -30
  201. package/typedoc/classes/invitations.CancellableInvitationObservable.html +0 -29
  202. package/typedoc/classes/invitations.InvitationEncoder.html +0 -5
  203. package/typedoc/classes/invitations.InvitationsProxy.html +0 -12
  204. package/typedoc/enums/devtools.KeyType.html +0 -9
  205. package/typedoc/enums/echo.HaloSpaceMember.Role.html +0 -9
  206. package/typedoc/enums/echo.IndexKind.Kind.html +0 -8
  207. package/typedoc/enums/echo.QueryOptions.DataLocation.html +0 -6
  208. package/typedoc/enums/echo.QueryOptions.ShowDeletedOption.html +0 -6
  209. package/typedoc/enums/echo.ResultFormat.html +0 -10
  210. package/typedoc/enums/echo.SpaceMember.PresenceState.html +0 -5
  211. package/typedoc/enums/echo.SpaceState.html +0 -13
  212. package/typedoc/enums/echo.TextKind.html +0 -5
  213. package/typedoc/enums/halo.Device.PresenceState.html +0 -6
  214. package/typedoc/enums/halo.DeviceKind.html +0 -5
  215. package/typedoc/enums/halo.DeviceType.html +0 -9
  216. package/typedoc/enums/index.ShellDisplay.html +0 -5
  217. package/typedoc/enums/index.ShellLayout.html +0 -13
  218. package/typedoc/enums/index.SystemStatus.html +0 -5
  219. package/typedoc/enums/invitations.Invitation.AuthMethod.html +0 -6
  220. package/typedoc/enums/invitations.Invitation.Kind.html +0 -5
  221. package/typedoc/enums/invitations.Invitation.State.html +0 -13
  222. package/typedoc/enums/invitations.Invitation.Type.html +0 -6
  223. package/typedoc/enums/mesh.ConnectionState.html +0 -5
  224. package/typedoc/functions/devtools.useDevtools.html +0 -1
  225. package/typedoc/functions/devtools.useStream.html +0 -2
  226. package/typedoc/functions/echo.useMembers.html +0 -1
  227. package/typedoc/functions/echo.useQueue.html +0 -2
  228. package/typedoc/functions/echo.useSchema.html +0 -2
  229. package/typedoc/functions/echo.useSpace.html +0 -6
  230. package/typedoc/functions/echo.useSpaceInvitation.html +0 -1
  231. package/typedoc/functions/echo.useSpaceInvitations.html +0 -1
  232. package/typedoc/functions/echo.useSpaceSyncState.html +0 -2
  233. package/typedoc/functions/echo.useSpaces.html +0 -5
  234. package/typedoc/functions/echo.useSubscription.html +0 -3
  235. package/typedoc/functions/echo.useSyncState.html +0 -2
  236. package/typedoc/functions/halo.useContacts.html +0 -4
  237. package/typedoc/functions/halo.useCredentials.html +0 -1
  238. package/typedoc/functions/halo.useDevices.html +0 -1
  239. package/typedoc/functions/halo.useHaloInvitation.html +0 -1
  240. package/typedoc/functions/halo.useHaloInvitations.html +0 -1
  241. package/typedoc/functions/halo.useIdentity.html +0 -3
  242. package/typedoc/functions/halo.useKeyStore.html +0 -3
  243. package/typedoc/functions/index.AgentHostingProvider.html +0 -2
  244. package/typedoc/functions/index.useAgentHostingClient.html +0 -1
  245. package/typedoc/functions/index.useClient.html +0 -3
  246. package/typedoc/functions/index.useClientStatus.html +0 -1
  247. package/typedoc/functions/index.useConfig.html +0 -3
  248. package/typedoc/functions/index.useShell.html +0 -2
  249. package/typedoc/functions/index.useShellDisplay.html +0 -2
  250. package/typedoc/functions/index.useStatus.html +0 -1
  251. package/typedoc/functions/invitations.useInvitationStatus.html +0 -1
  252. package/typedoc/functions/mesh.useNetworkStatus.html +0 -2
  253. package/typedoc/hierarchy.html +0 -1
  254. package/typedoc/index.html +0 -23
  255. package/typedoc/interfaces/devtools.DevtoolsHook.html +0 -22
  256. package/typedoc/interfaces/devtools.DevtoolsHost.html +0 -26
  257. package/typedoc/interfaces/echo.DocAccessor.html +0 -3
  258. package/typedoc/interfaces/echo.Echo.html +0 -39
  259. package/typedoc/interfaces/echo.EchoDatabase.html +0 -25
  260. package/typedoc/interfaces/echo.Expando.html +0 -3
  261. package/typedoc/interfaces/echo.Filter.html +0 -3
  262. package/typedoc/interfaces/echo.HaloSpaceMember.html +0 -18
  263. package/typedoc/interfaces/echo.IDocHandle.html +0 -6
  264. package/typedoc/interfaces/echo.IndexKind.html +0 -9
  265. package/typedoc/interfaces/echo.Query.html +0 -34
  266. package/typedoc/interfaces/echo.QueryOptions.html +0 -39
  267. package/typedoc/interfaces/echo.Queue.html +0 -17
  268. package/typedoc/interfaces/echo.Ref.html +0 -32
  269. package/typedoc/interfaces/echo.Space.html +0 -39
  270. package/typedoc/interfaces/echo.SpaceMember.html +0 -7
  271. package/typedoc/interfaces/echo.SpaceSyncState.PeerState.html +0 -14
  272. package/typedoc/interfaces/echo.SpaceSyncState.html +0 -4
  273. package/typedoc/interfaces/echo.SubscriptionHandle.html +0 -5
  274. package/typedoc/interfaces/echo.TypedObject.html +0 -16
  275. package/typedoc/interfaces/halo.Contact.html +0 -10
  276. package/typedoc/interfaces/halo.Credential.html +0 -27
  277. package/typedoc/interfaces/halo.Device.html +0 -11
  278. package/typedoc/interfaces/halo.Halo.html +0 -16
  279. package/typedoc/interfaces/halo.Identity.html +0 -15
  280. package/typedoc/interfaces/index.AgentHostingProviderClient.html +0 -6
  281. package/typedoc/interfaces/index.AppContextRequest.html +0 -33
  282. package/typedoc/interfaces/index.ClientServicesProvider.html +0 -9
  283. package/typedoc/interfaces/index.InvitationUrlRequest.html +0 -9
  284. package/typedoc/interfaces/index.LayoutRequest.html +0 -29
  285. package/typedoc/interfaces/index.ShellRuntime.html +0 -15
  286. package/typedoc/interfaces/invitations.Invitation.html +0 -92
  287. package/typedoc/interfaces/invitations.Invitations.html +0 -5
  288. package/typedoc/interfaces/mesh.GossipMessage.html +0 -10
  289. package/typedoc/interfaces/mesh.NetworkStatus.Signal.html +0 -5
  290. package/typedoc/interfaces/mesh.NetworkStatus.html +0 -6
  291. package/typedoc/media/LICENSE +0 -8
  292. package/typedoc/modules/devtools.html +0 -1
  293. package/typedoc/modules/echo.Filter.html +0 -1
  294. package/typedoc/modules/echo.HaloSpaceMember.html +0 -1
  295. package/typedoc/modules/echo.IndexKind.html +0 -1
  296. package/typedoc/modules/echo.Query.html +0 -1
  297. package/typedoc/modules/echo.QueryOptions.html +0 -1
  298. package/typedoc/modules/echo.Ref.html +0 -2
  299. package/typedoc/modules/echo.SpaceMember.html +0 -1
  300. package/typedoc/modules/echo.SpaceSyncState.html +0 -1
  301. package/typedoc/modules/echo.html +0 -1
  302. package/typedoc/modules/halo.Device.html +0 -1
  303. package/typedoc/modules/halo.html +0 -1
  304. package/typedoc/modules/index.html +0 -1
  305. package/typedoc/modules/invitations.Invitation.html +0 -1
  306. package/typedoc/modules/invitations.html +0 -1
  307. package/typedoc/modules/mesh.NetworkStatus.html +0 -1
  308. package/typedoc/modules/mesh.html +0 -1
  309. package/typedoc/modules/worker.html +0 -1
  310. package/typedoc/modules.html +0 -1
  311. package/typedoc/types/devtools.MountOptions.html +0 -3
  312. package/typedoc/types/echo.AnyLiveObject.html +0 -2
  313. package/typedoc/types/echo.Filter.And.html +0 -1
  314. package/typedoc/types/echo.Filter.Any.html +0 -1
  315. package/typedoc/types/echo.Filter.Or.html +0 -1
  316. package/typedoc/types/echo.Filter.Props.html +0 -1
  317. package/typedoc/types/echo.Filter.Type.html +0 -1
  318. package/typedoc/types/echo.Live.html +0 -5
  319. package/typedoc/types/echo.ObjectMeta.html +0 -1
  320. package/typedoc/types/echo.ObjectMigration.html +0 -7
  321. package/typedoc/types/echo.ObjectVersion.html +0 -2
  322. package/typedoc/types/echo.PeerSyncState.html +0 -1
  323. package/typedoc/types/echo.Progress.html +0 -3
  324. package/typedoc/types/echo.PropertiesTypeProps.html +0 -1
  325. package/typedoc/types/echo.Query.Any.html +0 -1
  326. package/typedoc/types/echo.Query.TextSearchOptions.html +0 -2
  327. package/typedoc/types/echo.Query.Type.html +0 -1
  328. package/typedoc/types/echo.Ref.Target.html +0 -2
  329. package/typedoc/types/echo.Selection.html +0 -1
  330. package/typedoc/types/echo.SpaceId.html +0 -6
  331. package/typedoc/types/echo.SpaceSyncStateMap.html +0 -1
  332. package/typedoc/types/echo.UseQueueOptions.html +0 -2
  333. package/typedoc/types/echo.UseSpacesParams.html +0 -3
  334. package/typedoc/types/index.AgentHostingProviderProps.html +0 -3
  335. package/typedoc/types/index.ClientContextProps.html +0 -3
  336. package/typedoc/types/index.ClientOptions.html +0 -12
  337. package/typedoc/types/index.ClientProviderProps.html +0 -2
  338. package/typedoc/types/index.ClientServices.html +0 -15
  339. package/typedoc/types/index.FromAgentOptions.html +0 -2
  340. package/typedoc/types/index.PublicKeyLike.html +0 -2
  341. package/typedoc/types/invitations.InvitationAction.html +0 -1
  342. package/typedoc/types/invitations.InvitationResult.html +0 -5
  343. package/typedoc/types/invitations.InvitationStatus.html +0 -15
  344. package/typedoc/variables/devtools.mountDevtoolsHooks.html +0 -1
  345. package/typedoc/variables/devtools.unmountDevtoolsHooks.html +0 -1
  346. package/typedoc/variables/echo.DocAccessor.html +0 -1
  347. package/typedoc/variables/echo.EchoObjectSchema.html +0 -1
  348. package/typedoc/variables/echo.Expando.html +0 -1
  349. package/typedoc/variables/echo.FQ_ID_LENGTH.html +0 -1
  350. package/typedoc/variables/echo.Filter.html +0 -1
  351. package/typedoc/variables/echo.OBJECT_ID_LENGTH.html +0 -1
  352. package/typedoc/variables/echo.ObjectVersion.html +0 -1
  353. package/typedoc/variables/echo.Query.html +0 -1
  354. package/typedoc/variables/echo.Queue.html +0 -1
  355. package/typedoc/variables/echo.ReactiveObjectSchema.html +0 -1
  356. package/typedoc/variables/echo.Ref.html +0 -2
  357. package/typedoc/variables/echo.RefArray.html +0 -2
  358. package/typedoc/variables/echo.SPACE_ID_LENGTH.html +0 -1
  359. package/typedoc/variables/echo.SpaceId.html +0 -1
  360. package/typedoc/variables/echo.SpaceSchema.html +0 -1
  361. package/typedoc/variables/echo.TypedObject.html +0 -3
  362. package/typedoc/variables/echo.compareForeignKeys.html +0 -1
  363. package/typedoc/variables/echo.createDocAccessor.html +0 -1
  364. package/typedoc/variables/echo.createEmptyEdgeSyncState.html +0 -1
  365. package/typedoc/variables/echo.createObject.html +0 -1
  366. package/typedoc/variables/echo.createQueueDXN.html +0 -2
  367. package/typedoc/variables/echo.createSubscription.html +0 -5
  368. package/typedoc/variables/echo.defineObjectMigration.html +0 -1
  369. package/typedoc/variables/echo.fromCursor.html +0 -1
  370. package/typedoc/variables/echo.fullyQualifiedId.html +0 -4
  371. package/typedoc/variables/echo.getMeta.html +0 -1
  372. package/typedoc/variables/echo.getObjectCore.html +0 -1
  373. package/typedoc/variables/echo.getRangeFromCursor.html +0 -1
  374. package/typedoc/variables/echo.getSchema.html +0 -2
  375. package/typedoc/variables/echo.getSource.html +0 -4
  376. package/typedoc/variables/echo.getSpace.html +0 -1
  377. package/typedoc/variables/echo.getSyncSummary.html +0 -1
  378. package/typedoc/variables/echo.getTarget.html +0 -4
  379. package/typedoc/variables/echo.getTextInRange.html +0 -2
  380. package/typedoc/variables/echo.getType.html +0 -5
  381. package/typedoc/variables/echo.getTypename.html +0 -6
  382. package/typedoc/variables/echo.getVersion.html +0 -3
  383. package/typedoc/variables/echo.importSpace.html +0 -1
  384. package/typedoc/variables/echo.internalDecodeReference.html +0 -1
  385. package/typedoc/variables/echo.isEchoObject.html +0 -2
  386. package/typedoc/variables/echo.isLiveObject.html +0 -2
  387. package/typedoc/variables/echo.isRelation.html +0 -2
  388. package/typedoc/variables/echo.isSpace.html +0 -1
  389. package/typedoc/variables/echo.live.html +0 -3
  390. package/typedoc/variables/echo.loadObjectReferences.html +0 -7
  391. package/typedoc/variables/echo.makeRef.html +0 -2
  392. package/typedoc/variables/echo.parseFullyQualifiedId.html +0 -2
  393. package/typedoc/variables/echo.parseId.html +0 -1
  394. package/typedoc/variables/echo.refFromDXN.html +0 -2
  395. package/typedoc/variables/echo.toCursor.html +0 -1
  396. package/typedoc/variables/echo.toCursorRange.html +0 -1
  397. package/typedoc/variables/echo.updateText.html +0 -6
  398. package/typedoc/variables/echo.useQuery.html +0 -2
  399. package/typedoc/variables/index.AgentHostingContext.html +0 -1
  400. package/typedoc/variables/index.ClientProvider.html +0 -3
  401. package/typedoc/variables/index.DXOS_VERSION.html +0 -1
  402. package/typedoc/variables/index.Defaults.html +0 -2
  403. package/typedoc/variables/index.Dynamics.html +0 -2
  404. package/typedoc/variables/index.Envs.html +0 -2
  405. package/typedoc/variables/index.Local.html +0 -2
  406. package/typedoc/variables/index.Remote.html +0 -1
  407. package/typedoc/variables/index.Storage.html +0 -2
  408. package/typedoc/variables/index.createClientServices.html +0 -4
  409. package/typedoc/variables/index.fromAgent.html +0 -2
  410. package/typedoc/variables/index.fromHost.html +0 -2
  411. package/typedoc/variables/index.fromSocket.html +0 -2
  412. package/typedoc/variables/index.fromWorker.html +0 -2
  413. package/typedoc/variables/index.getUnixSocket.html +0 -1
  414. package/typedoc/variables/index.resolveRef.html +0 -1
  415. package/typedoc/variables/index.useMulticastObservable.html +0 -3
  416. package/typedoc/variables/worker.getWorkerServiceHost.html +0 -1
  417. package/typedoc/variables/worker.onconnect.html +0 -1
@@ -1,101 +1,80 @@
1
1
  import {
2
2
  useInvitationStatus
3
- } from "../chunk-AL2CUQ46.mjs";
3
+ } from "../chunk-LO3TU5CK.mjs";
4
4
  import {
5
5
  useClient
6
- } from "../chunk-72QD3PXL.mjs";
6
+ } from "../chunk-PFF63FPR.mjs";
7
+ import "../chunk-TSF6Y5VB.mjs";
7
8
 
8
- // packages/sdk/react-client/src/echo/index.ts
9
+ // src/echo/index.ts
9
10
  export * from "@dxos/client/echo";
11
+ export * from "@dxos/echo-react";
10
12
 
11
- // packages/sdk/react-client/src/echo/useMembers.ts
13
+ // src/echo/useMembers.ts
12
14
  import { MulticastObservable } from "@dxos/async";
15
+ import { PublicKey as PublicKey2 } from "@dxos/client";
13
16
  import { HaloSpaceMember } from "@dxos/client/echo";
14
17
  import { useMulticastObservable as useMulticastObservable2 } from "@dxos/react-hooks";
15
18
 
16
- // packages/sdk/react-client/src/echo/useSpaces.ts
17
- import { useEffect, useState } from "react";
19
+ // src/echo/useSpaces.ts
20
+ import { useState } from "react";
21
+ import { PublicKey } from "@dxos/client";
18
22
  import { SpaceState } from "@dxos/client/echo";
19
- import { useMulticastObservable } from "@dxos/react-hooks";
20
- var useSpace = (spaceKeyLike) => {
23
+ import { useAsyncEffect, useMulticastObservable } from "@dxos/react-hooks";
24
+ var useSpace = (spaceId) => {
21
25
  const client = useClient();
22
26
  const spaces = useMulticastObservable(client.spaces);
23
27
  const [ready, setReady] = useState(false);
24
- useEffect(() => {
25
- if (spaceKeyLike) {
28
+ useAsyncEffect(async () => {
29
+ if (spaceId) {
26
30
  return;
27
31
  }
28
- const timeout = setTimeout(async () => {
29
- await client.spaces.waitUntilReady();
30
- setReady(true);
31
- });
32
- return () => clearTimeout(timeout);
32
+ await client.spaces.waitUntilReady();
33
+ setReady(true);
33
34
  }, [
34
35
  client,
35
- spaceKeyLike
36
+ spaceId
36
37
  ]);
37
- if (spaceKeyLike) {
38
- return spaces.find((space) => space.key.equals(spaceKeyLike) || space.id === spaceKeyLike);
38
+ if (spaceId) {
39
+ return spaces.find((space) => {
40
+ if (spaceId instanceof PublicKey) {
41
+ return space.key.equals(spaceId);
42
+ }
43
+ return space.id === spaceId;
44
+ });
39
45
  }
40
46
  if (ready && client.halo.identity.get()) {
41
47
  return client.spaces.default;
42
48
  }
43
49
  };
50
+ var useDatabase = (spaceId) => {
51
+ const space = useSpace(spaceId);
52
+ return space?.db;
53
+ };
44
54
  var useSpaces = ({ all = false } = {}) => {
45
55
  const client = useClient();
46
56
  const spaces = useMulticastObservable(client.spaces);
47
57
  return spaces.filter((space) => all || space.state.get() === SpaceState.SPACE_READY);
48
58
  };
49
59
 
50
- // packages/sdk/react-client/src/echo/useMembers.ts
60
+ // src/echo/useMembers.ts
51
61
  var useMembers = (spaceKey) => {
52
62
  const spaces = useSpaces({
53
63
  all: true
54
64
  });
55
- const space = spaceKey ? spaces.find((space2) => space2.key.equals(spaceKey)) : void 0;
65
+ const space = spaceKey ? spaces.find((space2) => spaceKey instanceof PublicKey2 ? space2.key.equals(spaceKey) : space2.id === spaceKey) : void 0;
56
66
  const members = useMulticastObservable2(space?.members ?? MulticastObservable.empty()) ?? [];
57
67
  return members.filter((member) => member.role !== HaloSpaceMember.Role.REMOVED);
58
68
  };
59
69
 
60
- // packages/sdk/react-client/src/echo/useQuery.ts
61
- import { useMemo, useSyncExternalStore } from "react";
62
- import { Filter, Query, isSpace } from "@dxos/client/echo";
63
- var EMPTY_ARRAY = [];
64
- var noop = () => {
65
- };
66
- var useQuery = (spaceOrEcho, queryOrFilter, deps) => {
67
- const query = Filter.is(queryOrFilter) ? Query.select(queryOrFilter) : queryOrFilter;
68
- const { getObjects, subscribe } = useMemo(() => {
69
- let subscribed = false;
70
- const queryResult = spaceOrEcho === void 0 ? void 0 : isSpace(spaceOrEcho) ? spaceOrEcho.db.query(query) : spaceOrEcho.query(query);
71
- return {
72
- getObjects: () => subscribed && queryResult ? queryResult.objects : EMPTY_ARRAY,
73
- subscribe: (cb) => {
74
- subscribed = true;
75
- const unsubscribe = queryResult?.subscribe(cb) ?? noop;
76
- return () => {
77
- unsubscribe?.();
78
- subscribed = false;
79
- };
80
- }
81
- };
82
- }, [
83
- spaceOrEcho,
84
- JSON.stringify(query.ast),
85
- ...deps ?? []
86
- ]);
87
- const objects = useSyncExternalStore(subscribe, getObjects);
88
- return objects ?? [];
89
- };
90
-
91
- // packages/sdk/react-client/src/echo/useQueue.ts
92
- import { useEffect as useEffect2, useMemo as useMemo2, useRef } from "react";
70
+ // src/echo/useQueue.ts
71
+ import { useEffect, useMemo, useRef } from "react";
93
72
  import { raise } from "@dxos/debug";
94
73
  var MIN_POLL_INTERVAL = 1e3;
95
74
  var useQueue = (queueDxn, options = {}) => {
96
75
  const client = useClient();
97
76
  const mountedRef = useRef(true);
98
- const queue = useMemo2(() => {
77
+ const queue = useMemo(() => {
99
78
  if (!queueDxn) {
100
79
  return void 0;
101
80
  }
@@ -105,12 +84,12 @@ var useQueue = (queueDxn, options = {}) => {
105
84
  client,
106
85
  queueDxn?.toString()
107
86
  ]);
108
- useEffect2(() => {
87
+ useEffect(() => {
109
88
  void queue?.refresh();
110
89
  }, [
111
90
  queue
112
91
  ]);
113
- useEffect2(() => {
92
+ useEffect(() => {
114
93
  let timeout;
115
94
  mountedRef.current = true;
116
95
  const poll = () => {
@@ -137,71 +116,42 @@ var useQueue = (queueDxn, options = {}) => {
137
116
  return queue;
138
117
  };
139
118
 
140
- // packages/sdk/react-client/src/echo/useSchema.ts
141
- import { useMemo as useMemo3, useSyncExternalStore as useSyncExternalStore2 } from "react";
142
- var useSchema = (client, space, typename) => {
143
- const { subscribe, getSchema } = useMemo3(() => {
144
- if (!typename || !space) {
145
- return {
146
- subscribe: () => () => {
147
- },
148
- getSchema: () => void 0
149
- };
150
- }
151
- const staticSchema = client.graph.schemaRegistry.getSchema(typename);
152
- if (staticSchema) {
153
- return {
154
- subscribe: () => () => {
155
- },
156
- getSchema: () => staticSchema
157
- };
158
- }
159
- const query = space.db.schemaRegistry.query({
160
- typename
161
- });
162
- const initialResult = query.runSync()[0];
163
- let currentSchema = initialResult;
164
- return {
165
- subscribe: (onStoreChange) => {
166
- const unsubscribe = query.subscribe(() => {
167
- currentSchema = query.results[0];
168
- onStoreChange();
169
- });
170
- return unsubscribe;
171
- },
172
- getSchema: () => currentSchema
173
- };
174
- }, [
175
- typename,
176
- space
177
- ]);
178
- return useSyncExternalStore2(subscribe, getSchema);
179
- };
180
-
181
- // packages/sdk/react-client/src/echo/useSpaceInvitations.ts
182
- import { useMemo as useMemo4 } from "react";
119
+ // src/echo/useSpaceInvitations.ts
120
+ import { useMemo as useMemo2 } from "react";
183
121
  import { MulticastObservable as MulticastObservable2 } from "@dxos/async";
184
122
  import { useMulticastObservable as useMulticastObservable3 } from "@dxos/react-hooks";
185
- var useSpaceInvitations = (spaceKey) => {
186
- const space = useSpace(spaceKey);
123
+ var useSpaceInvitations = (spaceId) => {
124
+ const space = useSpace(spaceId);
187
125
  return useMulticastObservable3(space?.invitations ?? MulticastObservable2.empty()) ?? [];
188
126
  };
189
- var useSpaceInvitation = (spaceKey, invitationId) => {
190
- const invitations = useSpaceInvitations(spaceKey);
191
- const invitation = useMemo4(() => invitations.find((invitation2) => invitation2.get().invitationId === invitationId), [
127
+ var useSpaceInvitation = (spaceId, invitationId) => {
128
+ const invitations = useSpaceInvitations(spaceId);
129
+ const invitation = useMemo2(() => invitations.find((invitation2) => invitation2.get().invitationId === invitationId), [
192
130
  invitations
193
131
  ]);
194
132
  return useInvitationStatus(invitation);
195
133
  };
196
134
 
197
- // packages/sdk/react-client/src/echo/useSubscription.ts
198
- import { useEffect as useEffect3, useRef as useRef2 } from "react";
135
+ // src/echo/useSpaceProperties.ts
136
+ import { MulticastObservable as MulticastObservable3 } from "@dxos/async";
137
+ import { SpaceState as SpaceState2 } from "@dxos/client/echo";
138
+ import { useObject } from "@dxos/echo-react";
139
+ import { useMulticastObservable as useMulticastObservable4 } from "@dxos/react-hooks";
140
+ var useSpaceProperties = (spaceId) => {
141
+ const space = useSpace(spaceId);
142
+ const spaceState = useMulticastObservable4(space?.state ?? MulticastObservable3.empty());
143
+ const properties = spaceState === SpaceState2.SPACE_READY ? space?.properties : void 0;
144
+ return useObject(properties);
145
+ };
146
+
147
+ // src/echo/useSubscription.ts
148
+ import { useEffect as useEffect2, useRef as useRef2 } from "react";
199
149
  import { createSubscription } from "@dxos/client/echo";
200
150
  var useSubscription = (cb, selection) => {
201
151
  const callbackRef = useRef2(cb);
202
152
  callbackRef.current = cb;
203
- const subscriptionRef = useRef2();
204
- useEffect3(() => {
153
+ const subscriptionRef = useRef2(null);
154
+ useEffect2(() => {
205
155
  subscriptionRef.current = createSubscription(() => {
206
156
  callbackRef.current();
207
157
  });
@@ -211,16 +161,16 @@ var useSubscription = (cb, selection) => {
211
161
  return subscriptionRef.current;
212
162
  };
213
163
 
214
- // packages/sdk/react-client/src/echo/useSyncState.ts
215
- import { useEffect as useEffect4, useState as useState2 } from "react";
164
+ // src/echo/useSyncState.ts
165
+ import { useEffect as useEffect3, useState as useState2 } from "react";
216
166
  import { Context } from "@dxos/context";
217
167
  import { EdgeService } from "@dxos/protocols";
218
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/react-client/src/echo/useSyncState.ts";
168
+ var __dxlog_file = "/__w/dxos/dxos/packages/sdk/react-client/src/echo/useSyncState.ts";
219
169
  var isEdgePeerId = (peerId, spaceId) => peerId.startsWith(`${EdgeService.AUTOMERGE_REPLICATOR}:${spaceId}`);
220
170
  var useSyncState = () => {
221
171
  const client = useClient();
222
172
  const [spaceState, setSpaceState] = useState2({});
223
- useEffect4(() => {
173
+ useEffect3(() => {
224
174
  const ctx = new Context(void 0, {
225
175
  F: __dxlog_file,
226
176
  L: 25
@@ -230,7 +180,7 @@ var useSyncState = () => {
230
180
  if (spaceState[space.id]) {
231
181
  continue;
232
182
  }
233
- ctx.onDispose(space.crud.subscribeToSyncState(ctx, ({ peers = [] }) => {
183
+ ctx.onDispose(space.internal.db.subscribeToSyncState(ctx, ({ peers = [] }) => {
234
184
  const syncState = peers.find((state) => isEdgePeerId(state.peerId, space.id));
235
185
  if (syncState) {
236
186
  setSpaceState((spaceState2) => ({
@@ -255,12 +205,12 @@ var useSyncState = () => {
255
205
  };
256
206
  var useSpaceSyncState = (space) => {
257
207
  const [spaceState, setSpaceState] = useState2();
258
- useEffect4(() => {
208
+ useEffect3(() => {
259
209
  const ctx = new Context(void 0, {
260
210
  F: __dxlog_file,
261
211
  L: 64
262
212
  });
263
- space.crud.subscribeToSyncState(ctx, ({ peers = [] }) => {
213
+ space.internal.db.subscribeToSyncState(ctx, ({ peers = [] }) => {
264
214
  const syncState = peers.find((state) => isEdgePeerId(state.peerId, space.id));
265
215
  if (syncState) {
266
216
  setSpaceState(syncState);
@@ -275,13 +225,13 @@ var useSpaceSyncState = (space) => {
275
225
  return spaceState;
276
226
  };
277
227
  export {
228
+ useDatabase,
278
229
  useMembers,
279
- useQuery,
280
230
  useQueue,
281
- useSchema,
282
231
  useSpace,
283
232
  useSpaceInvitation,
284
233
  useSpaceInvitations,
234
+ useSpaceProperties,
285
235
  useSpaceSyncState,
286
236
  useSpaces,
287
237
  useSubscription,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../../src/echo/index.ts", "../../../../src/echo/useMembers.ts", "../../../../src/echo/useSpaces.ts", "../../../../src/echo/useQuery.ts", "../../../../src/echo/useQueue.ts", "../../../../src/echo/useSchema.ts", "../../../../src/echo/useSpaceInvitations.ts", "../../../../src/echo/useSubscription.ts", "../../../../src/echo/useSyncState.ts"],
4
- "sourcesContent": ["//\n// Copyright 2020 DXOS.org\n//\n\nexport * from '@dxos/client/echo';\n\nexport * from './useMembers';\nexport * from './useQuery';\nexport * from './useQueue';\nexport * from './useSchema';\nexport * from './useSpaces';\nexport * from './useSpaceInvitations';\nexport * from './useSubscription';\nexport * from './useSyncState';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { MulticastObservable } from '@dxos/async';\nimport { type PublicKey } from '@dxos/client';\nimport { HaloSpaceMember, type SpaceMember } from '@dxos/client/echo';\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useSpaces } from './useSpaces';\n\nexport const useMembers = (spaceKey: PublicKey | undefined): SpaceMember[] => {\n // TODO(dmaretskyi): useSpace hook for spaces that are not ready.\n const spaces = useSpaces({ all: true });\n const space = spaceKey ? spaces.find((space) => space.key.equals(spaceKey)) : undefined;\n\n // EMPTY_OBSERVABLE needs to be a stable reference to avoid re-subscribing on every render.\n const members = useMulticastObservable(space?.members ?? MulticastObservable.empty()) ?? [];\n return members.filter((member) => member.role !== HaloSpaceMember.Role.REMOVED);\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { useEffect, useState } from 'react';\n\nimport { type PublicKeyLike } from '@dxos/client';\nimport { type Space, SpaceState } from '@dxos/client/echo';\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useClient } from '../client';\n\n/**\n * Get a specific Space using its key.\n * The space is not guaranteed to be in the ready state.\n * Returns the default space if no key is provided.\n * Requires a ClientProvider somewhere in the parent tree.\n *\n * @param spaceKeyLike the key of the space to look for\n */\nexport const useSpace = (spaceKeyLike?: PublicKeyLike): Space | undefined => {\n const client = useClient();\n const spaces = useMulticastObservable<Space[]>(client.spaces);\n const [ready, setReady] = useState(false);\n\n useEffect(() => {\n // Only wait for ready if looking for the default space.\n if (spaceKeyLike) {\n return;\n }\n\n const timeout = setTimeout(async () => {\n await client.spaces.waitUntilReady();\n setReady(true);\n });\n\n return () => clearTimeout(timeout);\n }, [client, spaceKeyLike]);\n\n if (spaceKeyLike) {\n return spaces.find((space) => space.key.equals(spaceKeyLike) || space.id === spaceKeyLike);\n }\n\n if (ready && client.halo.identity.get()) {\n return client.spaces.default;\n }\n};\n\nexport type UseSpacesParams = {\n /**\n * Return uninitialized spaces as well.\n */\n all?: boolean;\n};\n\n/**\n * Get all Spaces available to current user.\n * Requires a ClientProvider somewhere in the parent tree.\n * By default, only ready spaces are returned.\n * @returns an array of Spaces\n */\nexport const useSpaces = ({ all = false }: UseSpacesParams = {}): Space[] => {\n const client = useClient();\n const spaces = useMulticastObservable<Space[]>(client.spaces);\n\n // TODO(dmaretskyi): Array reference equality.\n return spaces.filter((space) => all || space.state.get() === SpaceState.SPACE_READY);\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { useMemo, useSyncExternalStore } from 'react';\n\nimport { type Echo, Filter, type Live, Query, type Space, isSpace } from '@dxos/client/echo';\n\nconst EMPTY_ARRAY: never[] = [];\n\nconst noop = () => {};\n\n// TODO(dmaretskyi): Queries are fully serializable, so we can remove `deps` argument.\ninterface UseQueryFn {\n <Q extends Query.Any>(spaceOrEcho: Space | Echo | undefined, query: Q, deps?: any[]): Live<Query.Type<Q>>[];\n\n <F extends Filter.Any>(spaceOrEcho: Space | Echo | undefined, filter: F, deps?: any[]): Live<Filter.Type<F>>[];\n}\n\n/**\n * Create subscription.\n */\nexport const useQuery: UseQueryFn = (\n spaceOrEcho: Space | Echo | undefined,\n queryOrFilter: Query.Any | Filter.Any,\n deps?: any[],\n): Live<unknown>[] => {\n const query = Filter.is(queryOrFilter) ? Query.select(queryOrFilter) : queryOrFilter;\n\n const { getObjects, subscribe } = useMemo(() => {\n let subscribed = false;\n const queryResult =\n spaceOrEcho === undefined\n ? undefined\n : isSpace(spaceOrEcho)\n ? spaceOrEcho.db.query(query)\n : spaceOrEcho.query(query);\n\n return {\n getObjects: () => (subscribed && queryResult ? queryResult.objects : EMPTY_ARRAY),\n subscribe: (cb: () => void) => {\n subscribed = true;\n const unsubscribe = queryResult?.subscribe(cb) ?? noop;\n return () => {\n unsubscribe?.();\n subscribed = false;\n };\n },\n };\n }, [spaceOrEcho, JSON.stringify(query.ast), ...(deps ?? [])]);\n\n // https://beta.reactjs.org/reference/react/useSyncExternalStore\n // NOTE: This hook will resubscribe whenever the callback passed to the first argument changes; make sure it is stable.\n const objects = useSyncExternalStore<Live<unknown>[] | undefined>(subscribe, getObjects);\n return objects ?? [];\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useEffect, useMemo, useRef } from 'react';\n\nimport { type Queue } from '@dxos/client/echo';\nimport { raise } from '@dxos/debug';\nimport { type Obj, type Relation } from '@dxos/echo';\nimport { type DXN } from '@dxos/keys';\n\nimport { useClient } from '../client';\n\nconst MIN_POLL_INTERVAL = 1_000;\n\nexport type UseQueueOptions = {\n pollInterval?: number;\n};\n\n/**\n * Polls the given Edge queue.\n */\n// TODO(burdon): Replace polling with socket?\n// TODO(dmaretskyi): Move into client package.\n// TODO(dmaretskyi): Consider passing the space into the hook to support queue DXNs without space id.\n// TODO(ZaymonFC): If queue is unchanged returned object should be refferentially stable on poll.\nexport const useQueue = <T extends Obj.Any | Relation.Any>(\n queueDxn?: DXN,\n options: UseQueueOptions = {},\n): Queue<T> | undefined => {\n const client = useClient();\n const mountedRef = useRef(true);\n\n const queue = useMemo<Queue<T> | undefined>(() => {\n if (!queueDxn) {\n return undefined;\n }\n\n const { spaceId } = queueDxn.asQueueDXN() ?? raise(new TypeError('Invalid queue DXN'));\n return client.spaces.get(spaceId)?.queues.get<T>(queueDxn);\n }, [client, queueDxn?.toString()]);\n\n useEffect(() => {\n void queue?.refresh();\n }, [queue]);\n\n useEffect(() => {\n let timeout: NodeJS.Timeout;\n mountedRef.current = true;\n\n const poll = () => {\n if (!mountedRef.current) {\n return;\n }\n\n void queue?.refresh().finally(() => {\n if (mountedRef.current && options.pollInterval) {\n timeout = setTimeout(poll, Math.max(options.pollInterval ?? 0, MIN_POLL_INTERVAL));\n }\n });\n };\n\n if (options.pollInterval) {\n poll();\n }\n\n return () => {\n mountedRef.current = false;\n clearTimeout(timeout);\n };\n }, [queue, options.pollInterval]);\n\n return queue;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Schema } from 'effect';\nimport { useMemo, useSyncExternalStore } from 'react';\n\nimport { type Client } from '@dxos/client';\nimport { type Space } from '@dxos/client/echo';\nimport { type BaseSchema } from '@dxos/echo-schema';\n\n/**\n * Subscribe to and retrieve schema changes from a space's schema registry.\n */\nexport const useSchema = (\n client: Client,\n space: Space | undefined,\n typename: string | undefined,\n): Schema.Schema.AnyNoContext | undefined => {\n const { subscribe, getSchema } = useMemo(() => {\n if (!typename || !space) {\n return {\n subscribe: () => () => {},\n getSchema: () => undefined,\n };\n }\n\n const staticSchema = client.graph.schemaRegistry.getSchema(typename);\n if (staticSchema) {\n return {\n subscribe: () => () => {},\n getSchema: () => staticSchema,\n };\n }\n\n const query = space.db.schemaRegistry.query({ typename });\n const initialResult: BaseSchema = query.runSync()[0];\n let currentSchema = initialResult;\n\n return {\n subscribe: (onStoreChange: () => void) => {\n const unsubscribe = query.subscribe(() => {\n currentSchema = query.results[0];\n onStoreChange();\n });\n\n return unsubscribe;\n },\n getSchema: () => currentSchema,\n };\n }, [typename, space]);\n\n return useSyncExternalStore(subscribe, getSchema);\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { useMemo } from 'react';\n\nimport { MulticastObservable } from '@dxos/async';\nimport { type PublicKey } from '@dxos/client';\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useSpace } from './useSpaces';\nimport { type CancellableInvitationObservable, useInvitationStatus } from '../invitations';\n\nexport const useSpaceInvitations = (spaceKey?: PublicKey): CancellableInvitationObservable[] => {\n const space = useSpace(spaceKey);\n return useMulticastObservable(space?.invitations ?? MulticastObservable.empty()) ?? [];\n};\n\nexport const useSpaceInvitation = (spaceKey?: PublicKey, invitationId?: string) => {\n const invitations = useSpaceInvitations(spaceKey);\n const invitation = useMemo(\n () => invitations.find((invitation) => invitation.get().invitationId === invitationId),\n [invitations],\n );\n return useInvitationStatus(invitation);\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useEffect, useRef } from 'react';\n\nimport { type Selection, type SubscriptionHandle, createSubscription } from '@dxos/client/echo';\n\n/**\n * Create reactive selection.\n * Calls the callback when the selection changes and during the first render.\n */\n// TODO(wittjosiah): Is this still needed with signals reactivity? If not, remove or update jsdoc with usage info.\nexport const useSubscription = (cb: () => void, selection: Selection) => {\n // Make sure that the callback is always the one from the latest render.\n // Without this, we would always call the callback from the initial render,\n // which might contain stale data.\n const callbackRef = useRef(cb);\n callbackRef.current = cb;\n\n const subscriptionRef = useRef<SubscriptionHandle>();\n\n useEffect(() => {\n subscriptionRef.current = createSubscription(() => {\n callbackRef.current();\n });\n\n return () => subscriptionRef.current?.unsubscribe();\n }, []);\n\n subscriptionRef.current?.update(selection);\n return subscriptionRef.current;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useEffect, useState } from 'react';\n\nimport { type PeerSyncState, type SpaceSyncStateMap, type Space } from '@dxos/client/echo';\nimport { Context } from '@dxos/context';\nimport { type SpaceId } from '@dxos/keys';\nimport { EdgeService } from '@dxos/protocols';\n\nimport { useClient } from '../client';\n\nconst isEdgePeerId = (peerId: string, spaceId: SpaceId) =>\n peerId.startsWith(`${EdgeService.AUTOMERGE_REPLICATOR}:${spaceId}`);\n\n/**\n * Hook Subscribes to sync state for each space.\n */\nexport const useSyncState = (): SpaceSyncStateMap => {\n const client = useClient();\n const [spaceState, setSpaceState] = useState<SpaceSyncStateMap>({});\n\n useEffect(() => {\n const ctx = new Context();\n const createSubscriptions = (spaces: Space[]) => {\n for (const space of spaces) {\n if (spaceState[space.id]) {\n continue;\n }\n\n ctx.onDispose(\n space.crud.subscribeToSyncState(ctx, ({ peers = [] }) => {\n const syncState = peers.find((state) => isEdgePeerId(state.peerId, space.id));\n if (syncState) {\n setSpaceState((spaceState) => ({ ...spaceState, [space.id]: syncState }));\n }\n }),\n );\n }\n };\n\n createSubscriptions(client.spaces.get());\n client.spaces.subscribe((spaces) => {\n createSubscriptions(spaces);\n });\n\n return () => {\n void ctx.dispose();\n };\n }, [client]);\n\n return spaceState;\n};\n\n/**\n * Hook Subscribes to sync state for a single space.\n */\n// TODO(wittjosiah): Reconcile w/ useSyncState.\nexport const useSpaceSyncState = (space: Space): PeerSyncState | undefined => {\n const [spaceState, setSpaceState] = useState<PeerSyncState>();\n\n useEffect(() => {\n const ctx = new Context();\n space.crud.subscribeToSyncState(ctx, ({ peers = [] }) => {\n const syncState = peers.find((state) => isEdgePeerId(state.peerId, space.id));\n if (syncState) {\n setSpaceState(syncState);\n }\n });\n\n return () => {\n void ctx.dispose();\n };\n }, [space]);\n\n return spaceState;\n};\n"],
5
- "mappings": ";;;;;;;;AAIA,cAAc;;;ACAd,SAASA,2BAA2B;AAEpC,SAASC,uBAAyC;AAClD,SAASC,0BAAAA,+BAA8B;;;ACHvC,SAASC,WAAWC,gBAAgB;AAGpC,SAAqBC,kBAAkB;AACvC,SAASC,8BAA8B;AAYhC,IAAMC,WAAW,CAACC,iBAAAA;AACvB,QAAMC,SAASC,UAAAA;AACf,QAAMC,SAASC,uBAAgCH,OAAOE,MAAM;AAC5D,QAAM,CAACE,OAAOC,QAAAA,IAAYC,SAAS,KAAA;AAEnCC,YAAU,MAAA;AAER,QAAIR,cAAc;AAChB;IACF;AAEA,UAAMS,UAAUC,WAAW,YAAA;AACzB,YAAMT,OAAOE,OAAOQ,eAAc;AAClCL,eAAS,IAAA;IACX,CAAA;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WAAWQ,MAAMC,EAAE,GAAG;AACxB;QACF;AAEAL,YAAIM,UACFF,MAAMG,KAAKC,qBAAqBR,KAAK,CAAC,EAAES,QAAQ,CAAA,EAAE,MAAE;AAClD,gBAAMC,YAAYD,MAAME,KAAK,CAACC,UAAUzB,aAAayB,MAAMxB,QAAQgB,MAAMC,EAAE,CAAA;AAC3E,cAAIK,WAAW;AACbb,0BAAc,CAACD,iBAAgB;cAAE,GAAGA;cAAY,CAACQ,MAAMC,EAAE,GAAGK;YAAU,EAAA;UACxE;QACF,CAAA,CAAA;MAEJ;IACF;AAEAR,wBAAoBR,OAAOS,OAAOU,IAAG,CAAA;AACrCnB,WAAOS,OAAOW,UAAU,CAACX,WAAAA;AACvBD,0BAAoBC,MAAAA;IACtB,CAAA;AAEA,WAAO,MAAA;AACL,WAAKH,IAAIe,QAAO;IAClB;EACF,GAAG;IAACrB;GAAO;AAEX,SAAOE;AACT;AAMO,IAAMoB,oBAAoB,CAACZ,UAAAA;AAChC,QAAM,CAACR,YAAYC,aAAAA,IAAiBC,UAAAA;AAEpCC,EAAAA,WAAU,MAAA;AACR,UAAMC,MAAM,IAAIC,QAAAA,QAAAA;;;;AAChBG,UAAMG,KAAKC,qBAAqBR,KAAK,CAAC,EAAES,QAAQ,CAAA,EAAE,MAAE;AAClD,YAAMC,YAAYD,MAAME,KAAK,CAACC,UAAUzB,aAAayB,MAAMxB,QAAQgB,MAAMC,EAAE,CAAA;AAC3E,UAAIK,WAAW;AACbb,sBAAca,SAAAA;MAChB;IACF,CAAA;AAEA,WAAO,MAAA;AACL,WAAKV,IAAIe,QAAO;IAClB;EACF,GAAG;IAACX;GAAM;AAEV,SAAOR;AACT;",
6
- "names": ["MulticastObservable", "HaloSpaceMember", "useMulticastObservable", "useEffect", "useState", "SpaceState", "useMulticastObservable", "useSpace", "spaceKeyLike", "client", "useClient", "spaces", "useMulticastObservable", "ready", "setReady", "useState", "useEffect", "timeout", "setTimeout", "waitUntilReady", "clearTimeout", "find", "space", "key", "equals", "id", "halo", "identity", "get", "default", "useSpaces", "all", "filter", "state", "SpaceState", "SPACE_READY", "useMembers", "spaceKey", "spaces", "useSpaces", "all", "space", "find", "key", "equals", "undefined", "members", "useMulticastObservable", "MulticastObservable", "empty", "filter", "member", "role", "HaloSpaceMember", "Role", "REMOVED", "useMemo", "useSyncExternalStore", "Filter", "Query", "isSpace", "EMPTY_ARRAY", "noop", "useQuery", "spaceOrEcho", "queryOrFilter", "deps", "query", "Filter", "is", "Query", "select", "getObjects", "subscribe", "useMemo", "subscribed", "queryResult", "undefined", "isSpace", "db", "objects", "cb", "unsubscribe", "JSON", "stringify", "ast", "useSyncExternalStore", "useEffect", "useMemo", "useRef", "raise", "MIN_POLL_INTERVAL", "useQueue", "queueDxn", "options", "client", "useClient", "mountedRef", "useRef", "queue", "useMemo", "undefined", "spaceId", "asQueueDXN", "raise", "TypeError", "spaces", "get", "queues", "toString", "useEffect", "refresh", "timeout", "current", "poll", "finally", "pollInterval", "setTimeout", "Math", "max", "clearTimeout", "useMemo", "useSyncExternalStore", "useSchema", "client", "space", "typename", "subscribe", "getSchema", "useMemo", "undefined", "staticSchema", "graph", "schemaRegistry", "query", "db", "initialResult", "runSync", "currentSchema", "onStoreChange", "unsubscribe", "results", "useSyncExternalStore", "useMemo", "MulticastObservable", "useMulticastObservable", "useSpaceInvitations", "spaceKey", "space", "useSpace", "useMulticastObservable", "invitations", "MulticastObservable", "empty", "useSpaceInvitation", "invitationId", "invitation", "useMemo", "find", "get", "useInvitationStatus", "useEffect", "useRef", "createSubscription", "useSubscription", "cb", "selection", "callbackRef", "useRef", "current", "subscriptionRef", "useEffect", "createSubscription", "unsubscribe", "update", "useEffect", "useState", "Context", "EdgeService", "isEdgePeerId", "peerId", "spaceId", "startsWith", "EdgeService", "AUTOMERGE_REPLICATOR", "useSyncState", "client", "useClient", "spaceState", "setSpaceState", "useState", "useEffect", "ctx", "Context", "createSubscriptions", "spaces", "space", "id", "onDispose", "crud", "subscribeToSyncState", "peers", "syncState", "find", "state", "get", "subscribe", "dispose", "useSpaceSyncState"]
3
+ "sources": ["../../../../src/echo/index.ts", "../../../../src/echo/useMembers.ts", "../../../../src/echo/useSpaces.ts", "../../../../src/echo/useQueue.ts", "../../../../src/echo/useSpaceInvitations.ts", "../../../../src/echo/useSpaceProperties.ts", "../../../../src/echo/useSubscription.ts", "../../../../src/echo/useSyncState.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2020 DXOS.org\n//\n\nexport * from '@dxos/client/echo';\nexport * from '@dxos/echo-react';\n\nexport * from './useMembers';\nexport * from './useQueue';\nexport * from './useSpaces';\nexport * from './useSpaceInvitations';\nexport * from './useSpaceProperties';\nexport * from './useSubscription';\nexport * from './useSyncState';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { MulticastObservable } from '@dxos/async';\nimport { PublicKey, type PublicKeyLike } from '@dxos/client';\nimport { HaloSpaceMember, type SpaceMember } from '@dxos/client/echo';\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useSpaces } from './useSpaces';\n\nexport const useMembers = (spaceKey: PublicKeyLike | undefined): SpaceMember[] => {\n // TODO(dmaretskyi): useSpace hook for spaces that are not ready.\n const spaces = useSpaces({ all: true });\n const space = spaceKey\n ? spaces.find((space) => (spaceKey instanceof PublicKey ? space.key.equals(spaceKey) : space.id === spaceKey))\n : undefined;\n\n // EMPTY_OBSERVABLE needs to be a stable reference to avoid re-subscribing on every render.\n const members = useMulticastObservable(space?.members ?? MulticastObservable.empty()) ?? [];\n return members.filter((member) => member.role !== HaloSpaceMember.Role.REMOVED);\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { useState } from 'react';\n\nimport { PublicKey } from '@dxos/client';\nimport { type Space, type SpaceId, SpaceState } from '@dxos/client/echo';\nimport { useAsyncEffect, useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useClient } from '../client';\n\n/**\n * Get a specific Space using its id.\n * The space is not guaranteed to be in the ready state.\n * Returns the default space if no id is provided.\n * Requires a ClientProvider somewhere in the parent tree.\n *\n * @param spaceId the id of the space to look for\n */\n// TODO(wittjosiah): Currently unable to remove `PublicKey` from this api.\n// When initially joining a space that is all that is returned.\nexport const useSpace = (spaceId?: SpaceId | PublicKey): Space | undefined => {\n const client = useClient();\n const spaces = useMulticastObservable<Space[]>(client.spaces);\n const [ready, setReady] = useState(false);\n\n useAsyncEffect(async () => {\n // Only wait for ready if looking for the default space.\n if (spaceId) {\n return;\n }\n\n await client.spaces.waitUntilReady();\n setReady(true);\n }, [client, spaceId]);\n\n if (spaceId) {\n return spaces.find((space) => {\n if (spaceId instanceof PublicKey) {\n return space.key.equals(spaceId);\n }\n\n return space.id === spaceId;\n });\n }\n\n if (ready && client.halo.identity.get()) {\n return client.spaces.default;\n }\n};\n\n/**\n * Get a Space database by the id of the space.\n * The space is not guaranteed to be in the ready state.\n * Returns the default space if no id is provided.\n * Requires a ClientProvider somewhere in the parent tree.\n *\n * @param spaceId the id of the space to look for\n */\nexport const useDatabase = (spaceId?: SpaceId): Space['db'] | undefined => {\n const space = useSpace(spaceId);\n return space?.db;\n};\n\nexport type UseSpacesProps = {\n /**\n * Return uninitialized spaces as well.\n */\n all?: boolean;\n};\n\n/**\n * Get all Spaces available to current user.\n * Requires a ClientProvider somewhere in the parent tree.\n * By default, only ready spaces are returned.\n * @returns an array of Spaces\n */\nexport const useSpaces = ({ all = false }: UseSpacesProps = {}): Space[] => {\n const client = useClient();\n const spaces = useMulticastObservable<Space[]>(client.spaces);\n\n // TODO(dmaretskyi): Array reference equality.\n return spaces.filter((space) => all || space.state.get() === SpaceState.SPACE_READY);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useEffect, useMemo, useRef } from 'react';\n\nimport { type Queue } from '@dxos/client/echo';\nimport { raise } from '@dxos/debug';\nimport { type Entity } from '@dxos/echo';\nimport { type DXN } from '@dxos/keys';\n\nimport { useClient } from '../client';\n\nconst MIN_POLL_INTERVAL = 1_000;\n\nexport type UseQueueOptions = {\n pollInterval?: number;\n};\n\n/**\n * Polls the given Edge queue.\n */\n// TODO(burdon): Replace polling with socket?\n// TODO(dmaretskyi): Move into client package.\n// TODO(dmaretskyi): Consider passing the space into the hook to support queue DXNs without space id.\n// TODO(ZaymonFC): If queue is unchanged returned object should be refferentially stable on poll.\nexport const useQueue = <T extends Entity.Unknown>(\n queueDxn?: DXN,\n options: UseQueueOptions = {},\n): Queue<T> | undefined => {\n const client = useClient();\n const mountedRef = useRef(true);\n\n const queue = useMemo<Queue<T> | undefined>(() => {\n if (!queueDxn) {\n return undefined;\n }\n\n const { spaceId } = queueDxn.asQueueDXN() ?? raise(new TypeError('Invalid queue DXN'));\n return client.spaces.get(spaceId)?.queues.get<T>(queueDxn);\n }, [client, queueDxn?.toString()]);\n\n useEffect(() => {\n void queue?.refresh();\n }, [queue]);\n\n useEffect(() => {\n let timeout: NodeJS.Timeout;\n mountedRef.current = true;\n\n const poll = () => {\n if (!mountedRef.current) {\n return;\n }\n\n void queue?.refresh().finally(() => {\n if (mountedRef.current && options.pollInterval) {\n timeout = setTimeout(poll, Math.max(options.pollInterval ?? 0, MIN_POLL_INTERVAL));\n }\n });\n };\n\n if (options.pollInterval) {\n poll();\n }\n\n return () => {\n mountedRef.current = false;\n clearTimeout(timeout);\n };\n }, [queue, options.pollInterval]);\n\n return queue;\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { useMemo } from 'react';\n\nimport { MulticastObservable } from '@dxos/async';\nimport { type PublicKey } from '@dxos/client';\nimport { type SpaceId } from '@dxos/client/echo';\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { type CancellableInvitationObservable, useInvitationStatus } from '../invitations';\n\nimport { useSpace } from './useSpaces';\n\n// TODO(wittjosiah): Currently unable to remove `PublicKey` from this api.\n// When initially joining a space that is all that is returned.\nexport const useSpaceInvitations = (spaceId?: SpaceId | PublicKey): CancellableInvitationObservable[] => {\n const space = useSpace(spaceId);\n return useMulticastObservable(space?.invitations ?? MulticastObservable.empty()) ?? [];\n};\n\n// TODO(wittjosiah): Currently unable to remove `PublicKey` from this api.\n// When initially joining a space that is all that is returned.\nexport const useSpaceInvitation = (spaceId?: SpaceId | PublicKey, invitationId?: string) => {\n const invitations = useSpaceInvitations(spaceId);\n const invitation = useMemo(\n () => invitations.find((invitation) => invitation.get().invitationId === invitationId),\n [invitations],\n );\n return useInvitationStatus(invitation);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { MulticastObservable } from '@dxos/async';\nimport { type SpaceProperties, SpaceState } from '@dxos/client/echo';\nimport { type Key, type Obj } from '@dxos/echo';\nimport { type ObjectUpdateCallback, useObject } from '@dxos/echo-react';\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useSpace } from './useSpaces';\n\n/**\n * Subscribe to a space's properties with reactive updates.\n * Returns undefined if the space is undefined or not ready yet.\n * Automatically waits for the space to be ready before returning properties.\n *\n * @param spaceId - The space ID to get properties from (can be undefined).\n * @returns A tuple of [snapshot, updateCallback] or [undefined, no-op] if not ready.\n */\nexport const useSpaceProperties = (\n spaceId: Key.SpaceId | undefined,\n): [Obj.Snapshot<SpaceProperties> | undefined, ObjectUpdateCallback<SpaceProperties>] => {\n const space = useSpace(spaceId);\n const spaceState = useMulticastObservable(space?.state ?? MulticastObservable.empty());\n const properties = spaceState === SpaceState.SPACE_READY ? space?.properties : undefined;\n return useObject(properties);\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useEffect, useRef } from 'react';\n\nimport { type Selection, type SubscriptionHandle, createSubscription } from '@dxos/client/echo';\n\n/**\n * Create reactive selection.\n * Calls the callback when the selection changes and during the first render.\n */\n// TODO(wittjosiah): Is this still needed with signals reactivity? If not, remove or update jsdoc with usage info.\nexport const useSubscription = (cb: () => void, selection: Selection) => {\n // Make sure that the callback is always the one from the latest render.\n // Without this, we would always call the callback from the initial render,\n // which might contain stale data.\n const callbackRef = useRef(cb);\n callbackRef.current = cb;\n\n const subscriptionRef = useRef<SubscriptionHandle>(null);\n\n useEffect(() => {\n subscriptionRef.current = createSubscription(() => {\n callbackRef.current();\n });\n\n return () => subscriptionRef.current?.unsubscribe();\n }, []);\n\n subscriptionRef.current?.update(selection);\n return subscriptionRef.current;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useEffect, useState } from 'react';\n\nimport { type PeerSyncState, type Space, type SpaceSyncStateMap } from '@dxos/client/echo';\nimport { Context } from '@dxos/context';\nimport { type SpaceId } from '@dxos/keys';\nimport { EdgeService } from '@dxos/protocols';\n\nimport { useClient } from '../client';\n\nconst isEdgePeerId = (peerId: string, spaceId: SpaceId) =>\n peerId.startsWith(`${EdgeService.AUTOMERGE_REPLICATOR}:${spaceId}`);\n\n/**\n * Hook Subscribes to sync state for each space.\n */\nexport const useSyncState = (): SpaceSyncStateMap => {\n const client = useClient();\n const [spaceState, setSpaceState] = useState<SpaceSyncStateMap>({});\n\n useEffect(() => {\n const ctx = new Context();\n const createSubscriptions = (spaces: Space[]) => {\n for (const space of spaces) {\n if (spaceState[space.id]) {\n continue;\n }\n\n ctx.onDispose(\n space.internal.db.subscribeToSyncState(ctx, ({ peers = [] }) => {\n const syncState = peers.find((state) => isEdgePeerId(state.peerId, space.id));\n if (syncState) {\n setSpaceState((spaceState) => ({ ...spaceState, [space.id]: syncState }));\n }\n }),\n );\n }\n };\n\n createSubscriptions(client.spaces.get());\n client.spaces.subscribe((spaces) => {\n createSubscriptions(spaces);\n });\n\n return () => {\n void ctx.dispose();\n };\n }, [client]);\n\n return spaceState;\n};\n\n/**\n * Hook Subscribes to sync state for a single space.\n */\n// TODO(wittjosiah): Reconcile w/ useSyncState.\nexport const useSpaceSyncState = (space: Space): PeerSyncState | undefined => {\n const [spaceState, setSpaceState] = useState<PeerSyncState>();\n\n useEffect(() => {\n const ctx = new Context();\n space.internal.db.subscribeToSyncState(ctx, ({ peers = [] }) => {\n const syncState = peers.find((state) => isEdgePeerId(state.peerId, space.id));\n if (syncState) {\n setSpaceState(syncState);\n }\n });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oBAAoB,CAACb,UAAAA;AAChC,QAAM,CAACR,YAAYC,aAAAA,IAAiBC,UAAAA;AAEpCC,EAAAA,WAAU,MAAA;AACR,UAAMC,MAAM,IAAIC,QAAAA,QAAAA;;;;AAChBG,UAAMG,SAASC,GAAGC,qBAAqBT,KAAK,CAAC,EAAEU,QAAQ,CAAA,EAAE,MAAE;AACzD,YAAMC,YAAYD,MAAME,KAAK,CAACC,UAAU1B,aAAa0B,MAAMzB,QAAQgB,MAAMC,EAAE,CAAA;AAC3E,UAAIM,WAAW;AACbd,sBAAcc,SAAAA;MAChB;IACF,CAAA;AAEA,WAAO,MAAA;AACL,WAAKX,IAAIgB,QAAO;IAClB;EACF,GAAG;IAACZ;GAAM;AAEV,SAAOR;AACT;",
6
+ "names": ["MulticastObservable", "PublicKey", "HaloSpaceMember", "useMulticastObservable", "useState", "PublicKey", "SpaceState", "useAsyncEffect", "useMulticastObservable", "useSpace", "spaceId", "client", "useClient", "spaces", "useMulticastObservable", "ready", "setReady", "useState", "useAsyncEffect", "waitUntilReady", "find", "space", "PublicKey", "key", "equals", "id", "halo", "identity", "get", "default", "useDatabase", "db", "useSpaces", "all", "filter", "state", "SpaceState", "SPACE_READY", "useMembers", "spaceKey", "spaces", "useSpaces", "all", "space", "find", "PublicKey", "key", "equals", "id", "undefined", "members", "useMulticastObservable", "MulticastObservable", "empty", "filter", "member", "role", "HaloSpaceMember", "Role", "REMOVED", "useEffect", "useMemo", "useRef", "raise", "MIN_POLL_INTERVAL", "useQueue", "queueDxn", "options", "client", "useClient", "mountedRef", "useRef", "queue", "useMemo", "undefined", "spaceId", "asQueueDXN", "raise", "TypeError", "spaces", "get", "queues", "toString", "useEffect", "refresh", "timeout", "current", "poll", "finally", "pollInterval", "setTimeout", "Math", "max", "clearTimeout", "useMemo", "MulticastObservable", "useMulticastObservable", "useSpaceInvitations", "spaceId", "space", "useSpace", "useMulticastObservable", "invitations", "MulticastObservable", "empty", "useSpaceInvitation", "invitationId", "invitation", "useMemo", "find", "get", "useInvitationStatus", "MulticastObservable", "SpaceState", "useObject", "useMulticastObservable", "useSpaceProperties", "spaceId", "space", "useSpace", "spaceState", "useMulticastObservable", "state", "MulticastObservable", "empty", "properties", "SpaceState", "SPACE_READY", "undefined", "useObject", "useEffect", "useRef", "createSubscription", "useSubscription", "cb", "selection", "callbackRef", "useRef", "current", "subscriptionRef", "useEffect", "createSubscription", "unsubscribe", "update", "useEffect", "useState", "Context", "EdgeService", "isEdgePeerId", "peerId", "spaceId", "startsWith", "EdgeService", "AUTOMERGE_REPLICATOR", "useSyncState", "client", "useClient", "spaceState", "setSpaceState", "useState", "useEffect", "ctx", "Context", "createSubscriptions", "spaces", "space", "id", "onDispose", "internal", "db", "subscribeToSyncState", "peers", "syncState", "find", "state", "get", "subscribe", "dispose", "useSpaceSyncState"]
7
7
  }
@@ -1,35 +1,36 @@
1
1
  import {
2
2
  useInvitationStatus
3
- } from "../chunk-AL2CUQ46.mjs";
3
+ } from "../chunk-LO3TU5CK.mjs";
4
4
  import {
5
5
  useClient
6
- } from "../chunk-72QD3PXL.mjs";
6
+ } from "../chunk-PFF63FPR.mjs";
7
+ import "../chunk-TSF6Y5VB.mjs";
7
8
 
8
- // packages/sdk/react-client/src/halo/index.ts
9
+ // src/halo/index.ts
9
10
  import { Device, DeviceKind, DeviceType } from "@dxos/client/halo";
10
11
 
11
- // packages/sdk/react-client/src/halo/useContacts.ts
12
+ // src/halo/useContacts.ts
12
13
  import { useMulticastObservable } from "@dxos/react-hooks";
13
14
  var useContacts = () => {
14
15
  const client = useClient();
15
16
  return useMulticastObservable(client.halo.contacts);
16
17
  };
17
18
 
18
- // packages/sdk/react-client/src/halo/useCredentials.ts
19
+ // src/halo/useCredentials.ts
19
20
  import { useMulticastObservable as useMulticastObservable2 } from "@dxos/react-hooks";
20
21
  var useCredentials = () => {
21
22
  const client = useClient();
22
23
  return useMulticastObservable2(client.halo.credentials);
23
24
  };
24
25
 
25
- // packages/sdk/react-client/src/halo/useDevices.ts
26
+ // src/halo/useDevices.ts
26
27
  import { useMulticastObservable as useMulticastObservable3 } from "@dxos/react-hooks";
27
28
  var useDevices = () => {
28
29
  const client = useClient();
29
30
  return useMulticastObservable3(client.halo.devices);
30
31
  };
31
32
 
32
- // packages/sdk/react-client/src/halo/useHaloInvitations.ts
33
+ // src/halo/useHaloInvitations.ts
33
34
  import { useMemo } from "react";
34
35
  import { useMulticastObservable as useMulticastObservable4 } from "@dxos/react-hooks";
35
36
  var useHaloInvitations = () => {
@@ -44,19 +45,20 @@ var useHaloInvitation = (invitationId) => {
44
45
  return useInvitationStatus(invitation);
45
46
  };
46
47
 
47
- // packages/sdk/react-client/src/halo/useIdentity.ts
48
+ // src/halo/useIdentity.ts
48
49
  import { useMulticastObservable as useMulticastObservable5 } from "@dxos/react-hooks";
49
50
  var useIdentity = () => {
50
51
  const client = useClient();
51
52
  return useMulticastObservable5(client.halo.identity);
52
53
  };
53
54
 
54
- // packages/sdk/react-client/src/halo/useKeyStore.ts
55
+ // src/halo/useKeyStore.ts
55
56
  import { useMemo as useMemo2, useReducer } from "react";
56
57
  var KeyStore = class {
58
+ _defaultKeys;
59
+ _keyMap = /* @__PURE__ */ new Map();
57
60
  constructor(_defaultKeys = []) {
58
61
  this._defaultKeys = _defaultKeys;
59
- this._keyMap = /* @__PURE__ */ new Map();
60
62
  }
61
63
  get map() {
62
64
  return this._keyMap;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/halo/index.ts", "../../../../src/halo/useContacts.ts", "../../../../src/halo/useCredentials.ts", "../../../../src/halo/useDevices.ts", "../../../../src/halo/useHaloInvitations.ts", "../../../../src/halo/useIdentity.ts", "../../../../src/halo/useKeyStore.ts"],
4
- "sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\n// NOTE: Export * fails here.\nexport {\n type Credential,\n type Contact,\n type Identity,\n type Halo,\n Device,\n DeviceKind,\n DeviceType,\n} from '@dxos/client/halo';\n\nexport * from './useContacts';\nexport * from './useCredentials';\nexport * from './useDevices';\nexport * from './useHaloInvitations';\nexport * from './useIdentity';\nexport * from './useKeyStore';\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport type { Contact } from '@dxos/client/halo';\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useClient } from '../client';\n\n/**\n * Returns all known Contacts across all Spaces.\n * Contacts are known members of a common Space.\n * Requires ClientContext to be set via ClientProvider.\n */\nexport const useContacts = (): Contact[] => {\n const client = useClient();\n return useMulticastObservable(client.halo.contacts);\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport type { Credential } from '@dxos/client/halo';\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useClient } from '../client';\n\nexport const useCredentials = (): Credential[] => {\n const client = useClient();\n return useMulticastObservable(client.halo.credentials);\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport type { Device } from '@dxos/client/halo';\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useClient } from '../client';\n\nexport const useDevices = (): Device[] => {\n const client = useClient();\n return useMulticastObservable(client.halo.devices);\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { useMemo } from 'react';\n\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useClient } from '../client';\nimport { useInvitationStatus, type CancellableInvitationObservable } from '../invitations';\n\nexport const useHaloInvitations = (): CancellableInvitationObservable[] => {\n const client = useClient();\n return useMulticastObservable(client.halo.invitations);\n};\n\nexport const useHaloInvitation = (invitationId?: string) => {\n const invitations = useHaloInvitations();\n const invitation = useMemo(\n () => invitations.find((invitation) => invitation.get().invitationId === invitationId),\n [invitations],\n );\n return useInvitationStatus(invitation);\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { type Identity } from '@dxos/client/halo';\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useClient } from '../client';\n\n/**\n * Hook returning DXOS identity object.\n * Requires ClientContext to be set via ClientProvider.\n */\nexport const useIdentity = (): Identity | null => {\n const client = useClient();\n return useMulticastObservable(client.halo.identity);\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useMemo, useReducer } from 'react';\n\n// TODO(burdon): Move to settings plugin.\nexport class KeyStore {\n private _keyMap = new Map<string, string>();\n\n constructor(private readonly _defaultKeys: string[] = []) {}\n\n get map() {\n return this._keyMap;\n }\n\n // TODO(burdon): Create subkeys.\n initialize(): this {\n this._defaultKeys.forEach((key) => {\n const value = localStorage.getItem(key);\n this.setKey(key, value ?? '');\n });\n\n return this;\n }\n\n getKey(key: string): void {\n localStorage.getItem(key);\n }\n\n setKey(key: string, value: string): void {\n localStorage.setItem(key, '');\n this._keyMap.set(key, value);\n }\n}\n\n/**\n * Settings store.\n * @deprecated Replace with HALO key store when available.\n */\nexport const useKeyStore = (\n defaultKeys: string[] = [],\n): [Map<string, string>, (key: string, value: string) => void] => {\n const [, forceUpdate] = useReducer((x) => x + 1, 0);\n const store = useMemo(() => new KeyStore(defaultKeys).initialize(), [defaultKeys]);\n const setKey = (key: string, value: string) => {\n store.setKey(key, value);\n forceUpdate();\n };\n\n return [store.map, setKey];\n};\n"],
5
- "mappings": ";;;;;;;;AAKA,SAKEA,QACAC,YACAC,kBACK;;;ACRP,SAASC,8BAA8B;AAShC,IAAMC,cAAc,MAAA;AACzB,QAAMC,SAASC,UAAAA;AACf,SAAOC,uBAAuBF,OAAOG,KAAKC,QAAQ;AACpD;;;ACZA,SAASC,0BAAAA,+BAA8B;AAIhC,IAAMC,iBAAiB,MAAA;AAC5B,QAAMC,SAASC,UAAAA;AACf,SAAOC,wBAAuBF,OAAOG,KAAKC,WAAW;AACvD;;;ACPA,SAASC,0BAAAA,+BAA8B;AAIhC,IAAMC,aAAa,MAAA;AACxB,QAAMC,SAASC,UAAAA;AACf,SAAOC,wBAAuBF,OAAOG,KAAKC,OAAO;AACnD;;;ACRA,SAASC,eAAe;AAExB,SAASC,0BAAAA,+BAA8B;AAKhC,IAAMC,qBAAqB,MAAA;A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UAAMT,OAAOJ,KAAKC,KAAAA;AAClBS,gBAAAA;EACF;AAEA,SAAO;IAACG,MAAMhB;IAAKO;;AACrB;",
6
- "names": ["Device", "DeviceKind", "DeviceType", "useMulticastObservable", "useContacts", "client", "useClient", "useMulticastObservable", "halo", "contacts", "useMulticastObservable", "useCredentials", "client", "useClient", "useMulticastObservable", "halo", "credentials", "useMulticastObservable", "useDevices", "client", "useClient", "useMulticastObservable", "halo", "devices", "useMemo", "useMulticastObservable", "useHaloInvitations", "client", "useClient", "useMulticastObservable", "halo", "invitations", "useHaloInvitation", "invitationId", "invitation", "useMemo", "find", "get", "useInvitationStatus", "useMulticastObservable", "useIdentity", "client", "useClient", "useMulticastObservable", "halo", "identity", "useMemo", "useReducer", "KeyStore", "_defaultKeys", "_keyMap", "Map", "map", "initialize", "forEach", "key", "value", "localStorage", "getItem", "setKey", "getKey", "setItem", "set", "useKeyStore", "defaultKeys", "forceUpdate", "useReducer", "x", "store", "useMemo"]
4
+ "sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\n// NOTE: Export * fails here.\nexport {\n type Credential,\n type Contact,\n type Identity,\n type Halo,\n Device,\n DeviceKind,\n DeviceType,\n} from '@dxos/client/halo';\n\nexport * from './useContacts';\nexport * from './useCredentials';\nexport * from './useDevices';\nexport * from './useHaloInvitations';\nexport * from './useIdentity';\nexport * from './useKeyStore';\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport type { Contact } from '@dxos/client/halo';\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useClient } from '../client';\n\n/**\n * Returns all known Contacts across all Spaces.\n * Contacts are known members of a common Space.\n * Requires ClientContext to be set via ClientProvider.\n */\nexport const useContacts = (): Contact[] => {\n const client = useClient();\n return useMulticastObservable(client.halo.contacts);\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport type { Credential } from '@dxos/client/halo';\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useClient } from '../client';\n\nexport const useCredentials = (): Credential[] => {\n const client = useClient();\n return useMulticastObservable(client.halo.credentials);\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport type { Device } from '@dxos/client/halo';\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useClient } from '../client';\n\nexport const useDevices = (): Device[] => {\n const client = useClient();\n return useMulticastObservable(client.halo.devices);\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { useMemo } from 'react';\n\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useClient } from '../client';\nimport { type CancellableInvitationObservable, useInvitationStatus } from '../invitations';\n\nexport const useHaloInvitations = (): CancellableInvitationObservable[] => {\n const client = useClient();\n return useMulticastObservable(client.halo.invitations);\n};\n\nexport const useHaloInvitation = (invitationId?: string) => {\n const invitations = useHaloInvitations();\n const invitation = useMemo(\n () => invitations.find((invitation) => invitation.get().invitationId === invitationId),\n [invitations],\n );\n return useInvitationStatus(invitation);\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { type Identity } from '@dxos/client/halo';\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useClient } from '../client';\n\n/**\n * Hook returning DXOS identity object.\n * Requires ClientContext to be set via ClientProvider.\n */\nexport const useIdentity = (): Identity | null => {\n const client = useClient();\n return useMulticastObservable(client.halo.identity);\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useMemo, useReducer } from 'react';\n\n// TODO(burdon): Move to settings plugin.\nexport class KeyStore {\n private _keyMap = new Map<string, string>();\n\n constructor(private readonly _defaultKeys: string[] = []) {}\n\n get map() {\n return this._keyMap;\n }\n\n // TODO(burdon): Create subkeys.\n initialize(): this {\n this._defaultKeys.forEach((key) => {\n const value = localStorage.getItem(key);\n this.setKey(key, value ?? '');\n });\n\n return this;\n }\n\n getKey(key: string): void {\n localStorage.getItem(key);\n }\n\n setKey(key: string, value: string): void {\n localStorage.setItem(key, '');\n this._keyMap.set(key, value);\n }\n}\n\n/**\n * Settings store.\n * @deprecated Replace with HALO key store when available.\n */\nexport const useKeyStore = (\n defaultKeys: string[] = [],\n): [Map<string, string>, (key: string, value: string) => void] => {\n const [, forceUpdate] = useReducer((x) => x + 1, 0);\n const store = useMemo(() => new KeyStore(defaultKeys).initialize(), [defaultKeys]);\n const setKey = (key: string, value: string) => {\n store.setKey(key, value);\n forceUpdate();\n };\n\n return [store.map, setKey];\n};\n"],
5
+ "mappings": ";;;;;;;;;AAKA,SAKEA,QACAC,YACAC,kBACK;;;ACRP,SAASC,8BAA8B;AAShC,IAAMC,cAAc,MAAA;AACzB,QAAMC,SAASC,UAAAA;AACf,SAAOC,uBAAuBF,OAAOG,KAAKC,QAAQ;AACpD;;;ACZA,SAASC,0BAAAA,+BAA8B;AAIhC,IAAMC,iBAAiB,MAAA;AAC5B,QAAMC,SAASC,UAAAA;AACf,SAAOC,wBAAuBF,OAAOG,KAAKC,WAAW;AACvD;;;ACPA,SAASC,0BAAAA,+BAA8B;AAIhC,IAAMC,aAAa,MAAA;AACxB,QAAMC,SAASC,UAAAA;AACf,SAAOC,wBAAuBF,OAAOG,KAAKC,OAAO;AACnD;;;ACRA,SAASC,eAAe;AAExB,SAASC,0BAAAA,+BAA8B;AAKhC,IAAMC,qBAAqB,MAAA;AAChC,QAAMC,SAASC,UAAAA;AACf,SAAOC,wBAAuBF,OAAOG,KAAKC,WAAW;AACvD;AAEO,IAAMC,oBAAoB,CAACC,iBAAAA;AAChC,QAAMF,cAAcL,mBAAAA;AACpB,QAAMQ,aAAaC,QACjB,MAAMJ,YAAYK,KAAK,CAACF,gBAAeA,YAAWG,IAAG,EAAGJ,iBAAiBA,YAAAA,GACzE;IAACF;GAAY;AAEf,SAAOO,oBAAoBJ,UAAAA;AAC7B;;;AClBA,SAASK,0BAAAA,+BAA8B;AAQhC,IAAMC,cAAc,MAAA;AACzB,QAAMC,SAASC,UAAAA;AACf,SAAOC,wBAAuBF,OAAOG,KAAKC,QAAQ;AACpD;;;ACZA,SAASC,WAAAA,UAASC,kBAAkB;AAG7B,IAAMC,WAAN,MAAMA;;EACHC,UAAU,oBAAIC,IAAAA;EAEtB,YAA6BC,eAAyB,CAAA,GAAI;SAA7BA,eAAAA;EAA8B;EAE3D,IAAIC,MAAM;AACR,WAAO,KAAKH;EACd;;EAGAI,aAAmB;AACjB,SAAKF,aAAaG,QAAQ,CAACC,QAAAA;AACzB,YAAMC,QAAQC,aAAaC,QAAQH,GAAAA;AACnC,WAAKI,OAAOJ,KAAKC,SAAS,EAAA;IAC5B,CAAA;AAEA,WAAO;EACT;EAEAI,OAAOL,KAAmB;AACxBE,iBAAaC,QAAQH,GAAAA;EACvB;EAEAI,OAAOJ,KAAaC,OAAqB;AACvCC,iBAAaI,QAAQN,KAAK,EAAA;AAC1B,SAAKN,QAAQa,IAAIP,KAAKC,KAAAA;EACxB;AACF;AAMO,IAAMO,cAAc,CACzBC,cAAwB,CAAA,MAAE;AAE1B,QAAM,CAAA,EAAGC,WAAAA,IAAeC,WAAW,CAACC,MAAMA,IAAI,GAAG,CAAA;AACjD,QAAMC,QAAQC,SAAQ,MAAM,IAAIrB,SAASgB,WAAAA,EAAaX,WAAU,GAAI;IAACW;GAAY;AACjF,QAAML,SAAS,CAACJ,KAAaC,UAAAA;AAC3BY,UAAMT,OAAOJ,KAAKC,KAAAA;AAClBS,gBAAAA;EACF;AAEA,SAAO;IAACG,MAAMhB;IAAKO;;AACrB;",
6
+ "names": ["Device", "DeviceKind", "DeviceType", "useMulticastObservable", "useContacts", "client", "useClient", "useMulticastObservable", "halo", "contacts", "useMulticastObservable", "useCredentials", "client", "useClient", "useMulticastObservable", "halo", "credentials", "useMulticastObservable", "useDevices", "client", "useClient", "useMulticastObservable", "halo", "devices", "useMemo", "useMulticastObservable", "useHaloInvitations", "client", "useClient", "useMulticastObservable", "halo", "invitations", "useHaloInvitation", "invitationId", "invitation", "useMemo", "find", "get", "useInvitationStatus", "useMulticastObservable", "useIdentity", "client", "useClient", "useMulticastObservable", "halo", "identity", "useMemo", "useReducer", "KeyStore", "_keyMap", "Map", "_defaultKeys", "map", "initialize", "forEach", "key", "value", "localStorage", "getItem", "setKey", "getKey", "setItem", "set", "useKeyStore", "defaultKeys", "forceUpdate", "useReducer", "x", "store", "useMemo"]
7
7
  }