@dxos/react-client 0.8.3 → 0.8.4-main.3a94e84

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 (325) hide show
  1. package/.swc/plugins/v7_linux_x86_64_13.0.0/f45bdff002284d9e8f9ef3f0be909de12da36c049cbcf261ac78fc00abb09a2d +0 -0
  2. package/dist/lib/browser/{chunk-72QD3PXL.mjs → chunk-AAR7V3KL.mjs} +14 -14
  3. package/dist/lib/browser/{chunk-AL2CUQ46.mjs → chunk-O5SEVDJG.mjs} +4 -4
  4. package/dist/lib/browser/devtools/index.mjs +5 -5
  5. package/dist/lib/browser/echo/index.mjs +15 -15
  6. package/dist/lib/browser/echo/index.mjs.map +3 -3
  7. package/dist/lib/browser/halo/index.mjs +9 -9
  8. package/dist/lib/browser/index.mjs +2 -2
  9. package/dist/lib/browser/invitations/index.mjs +1 -1
  10. package/dist/lib/browser/mesh/index.mjs +3 -3
  11. package/dist/lib/browser/meta.json +1 -1
  12. package/dist/lib/browser/testing/index.mjs +6 -6
  13. package/dist/lib/browser/worker.mjs +1 -1
  14. package/dist/lib/node-esm/{chunk-UYJUBYMU.mjs → chunk-TU2JJLZK.mjs} +4 -4
  15. package/dist/lib/node-esm/{chunk-NBTZZNQ5.mjs → chunk-ZTD6HPV2.mjs} +14 -14
  16. package/dist/lib/node-esm/devtools/index.mjs +5 -5
  17. package/dist/lib/node-esm/echo/index.mjs +15 -15
  18. package/dist/lib/node-esm/echo/index.mjs.map +3 -3
  19. package/dist/lib/node-esm/halo/index.mjs +9 -9
  20. package/dist/lib/node-esm/index.mjs +2 -2
  21. package/dist/lib/node-esm/invitations/index.mjs +1 -1
  22. package/dist/lib/node-esm/mesh/index.mjs +3 -3
  23. package/dist/lib/node-esm/meta.json +1 -1
  24. package/dist/lib/node-esm/testing/index.mjs +6 -6
  25. package/dist/lib/node-esm/worker.mjs +1 -1
  26. package/dist/types/src/playwright/{playwright.config.d.cts → playwright.config.d.ts} +1 -1
  27. package/dist/types/src/playwright/playwright.config.d.ts.map +1 -0
  28. package/dist/types/tsconfig.tsbuildinfo +1 -1
  29. package/moon.yml +19 -0
  30. package/package.json +25 -25
  31. package/src/echo/useSyncState.ts +2 -2
  32. package/src/playwright/playwright.config.ts +17 -0
  33. package/src/playwright/smoke.spec.ts +4 -6
  34. package/vitest.config.ts +1 -1
  35. package/.eslintrc.cjs +0 -12
  36. package/README.yml +0 -33
  37. package/dist/lib/node/chunk-5RUIFUEC.cjs +0 -334
  38. package/dist/lib/node/chunk-5RUIFUEC.cjs.map +0 -7
  39. package/dist/lib/node/chunk-FYOAVV65.cjs +0 -188
  40. package/dist/lib/node/chunk-FYOAVV65.cjs.map +0 -7
  41. package/dist/lib/node/devtools/index.cjs +0 -62
  42. package/dist/lib/node/devtools/index.cjs.map +0 -7
  43. package/dist/lib/node/echo/index.cjs +0 -302
  44. package/dist/lib/node/echo/index.cjs.map +0 -7
  45. package/dist/lib/node/halo/index.cjs +0 -123
  46. package/dist/lib/node/halo/index.cjs.map +0 -7
  47. package/dist/lib/node/index.cjs +0 -55
  48. package/dist/lib/node/index.cjs.map +0 -7
  49. package/dist/lib/node/invitations/index.cjs +0 -39
  50. package/dist/lib/node/invitations/index.cjs.map +0 -7
  51. package/dist/lib/node/mesh/index.cjs +0 -37
  52. package/dist/lib/node/mesh/index.cjs.map +0 -7
  53. package/dist/lib/node/meta.json +0 -1
  54. package/dist/lib/node/testing/index.cjs +0 -278
  55. package/dist/lib/node/testing/index.cjs.map +0 -7
  56. package/dist/lib/node/worker.cjs +0 -23
  57. package/dist/lib/node/worker.cjs.map +0 -7
  58. package/dist/types/src/playwright/playwright.config.d.cts.map +0 -1
  59. package/project.json +0 -40
  60. package/src/playwright/playwright.config.cts +0 -18
  61. package/typedoc/.nojekyll +0 -1
  62. package/typedoc/assets/hierarchy.js +0 -1
  63. package/typedoc/assets/highlight.css +0 -99
  64. package/typedoc/assets/icons.js +0 -18
  65. package/typedoc/assets/icons.svg +0 -1
  66. package/typedoc/assets/main.js +0 -60
  67. package/typedoc/assets/navigation.js +0 -1
  68. package/typedoc/assets/search.js +0 -1
  69. package/typedoc/assets/style.css +0 -1640
  70. package/typedoc/classes/echo.Hypergraph.html +0 -17
  71. package/typedoc/classes/echo.PropertiesType.html +0 -19
  72. package/typedoc/classes/echo.QueryResult.html +0 -18
  73. package/typedoc/classes/halo.KeyStore.html +0 -6
  74. package/typedoc/classes/index.AgentClientServiceProvider.html +0 -10
  75. package/typedoc/classes/index.AgentManagerClient.html +0 -22
  76. package/typedoc/classes/index.AlreadyJoinedError.html +0 -15
  77. package/typedoc/classes/index.ApiError.html +0 -16
  78. package/typedoc/classes/index.CancelledError.html +0 -16
  79. package/typedoc/classes/index.Client.html +0 -51
  80. package/typedoc/classes/index.ClientServicesProxy.html +0 -12
  81. package/typedoc/classes/index.Config.html +0 -17
  82. package/typedoc/classes/index.DataCorruptionError.html +0 -16
  83. package/typedoc/classes/index.DatabaseError.html +0 -15
  84. package/typedoc/classes/index.EntityNotFoundError.html +0 -15
  85. package/typedoc/classes/index.FakeAgentHostingProvider.html +0 -7
  86. package/typedoc/classes/index.IFrameManager.html +0 -6
  87. package/typedoc/classes/index.IdentityNotInitializedError.html +0 -15
  88. package/typedoc/classes/index.InvalidConfigError.html +0 -16
  89. package/typedoc/classes/index.InvalidInvitationError.html +0 -15
  90. package/typedoc/classes/index.InvalidInvitationExtensionRoleError.html +0 -16
  91. package/typedoc/classes/index.InvalidStorageVersionError.html +0 -15
  92. package/typedoc/classes/index.LocalClientServices.html +0 -12
  93. package/typedoc/classes/index.PublicKey.html +0 -55
  94. package/typedoc/classes/index.RemoteServiceConnectionError.html +0 -15
  95. package/typedoc/classes/index.RemoteServiceConnectionTimeout.html +0 -15
  96. package/typedoc/classes/index.RpcClosedError.html +0 -15
  97. package/typedoc/classes/index.RpcNotOpenError.html +0 -15
  98. package/typedoc/classes/index.SharedWorkerConnection.html +0 -5
  99. package/typedoc/classes/index.Shell.html +0 -35
  100. package/typedoc/classes/index.ShellManager.html +0 -9
  101. package/typedoc/classes/index.SystemError.html +0 -16
  102. package/typedoc/classes/index.UnknownModelError.html +0 -15
  103. package/typedoc/classes/index.WorkerClientServices.html +0 -12
  104. package/typedoc/classes/invitations.AuthenticatingInvitationObservable.html +0 -30
  105. package/typedoc/classes/invitations.CancellableInvitationObservable.html +0 -29
  106. package/typedoc/classes/invitations.InvitationEncoder.html +0 -5
  107. package/typedoc/classes/invitations.InvitationsProxy.html +0 -12
  108. package/typedoc/enums/devtools.KeyType.html +0 -9
  109. package/typedoc/enums/echo.HaloSpaceMember.Role.html +0 -9
  110. package/typedoc/enums/echo.IndexKind.Kind.html +0 -8
  111. package/typedoc/enums/echo.QueryOptions.DataLocation.html +0 -6
  112. package/typedoc/enums/echo.QueryOptions.ShowDeletedOption.html +0 -6
  113. package/typedoc/enums/echo.ResultFormat.html +0 -10
  114. package/typedoc/enums/echo.SpaceMember.PresenceState.html +0 -5
  115. package/typedoc/enums/echo.SpaceState.html +0 -13
  116. package/typedoc/enums/echo.TextKind.html +0 -5
  117. package/typedoc/enums/halo.Device.PresenceState.html +0 -6
  118. package/typedoc/enums/halo.DeviceKind.html +0 -5
  119. package/typedoc/enums/halo.DeviceType.html +0 -9
  120. package/typedoc/enums/index.ShellDisplay.html +0 -5
  121. package/typedoc/enums/index.ShellLayout.html +0 -13
  122. package/typedoc/enums/index.SystemStatus.html +0 -5
  123. package/typedoc/enums/invitations.Invitation.AuthMethod.html +0 -6
  124. package/typedoc/enums/invitations.Invitation.Kind.html +0 -5
  125. package/typedoc/enums/invitations.Invitation.State.html +0 -13
  126. package/typedoc/enums/invitations.Invitation.Type.html +0 -6
  127. package/typedoc/enums/mesh.ConnectionState.html +0 -5
  128. package/typedoc/functions/devtools.useDevtools.html +0 -1
  129. package/typedoc/functions/devtools.useStream.html +0 -2
  130. package/typedoc/functions/echo.useMembers.html +0 -1
  131. package/typedoc/functions/echo.useQueue.html +0 -2
  132. package/typedoc/functions/echo.useSchema.html +0 -2
  133. package/typedoc/functions/echo.useSpace.html +0 -6
  134. package/typedoc/functions/echo.useSpaceInvitation.html +0 -1
  135. package/typedoc/functions/echo.useSpaceInvitations.html +0 -1
  136. package/typedoc/functions/echo.useSpaceSyncState.html +0 -2
  137. package/typedoc/functions/echo.useSpaces.html +0 -5
  138. package/typedoc/functions/echo.useSubscription.html +0 -3
  139. package/typedoc/functions/echo.useSyncState.html +0 -2
  140. package/typedoc/functions/halo.useContacts.html +0 -4
  141. package/typedoc/functions/halo.useCredentials.html +0 -1
  142. package/typedoc/functions/halo.useDevices.html +0 -1
  143. package/typedoc/functions/halo.useHaloInvitation.html +0 -1
  144. package/typedoc/functions/halo.useHaloInvitations.html +0 -1
  145. package/typedoc/functions/halo.useIdentity.html +0 -3
  146. package/typedoc/functions/halo.useKeyStore.html +0 -3
  147. package/typedoc/functions/index.AgentHostingProvider.html +0 -2
  148. package/typedoc/functions/index.useAgentHostingClient.html +0 -1
  149. package/typedoc/functions/index.useClient.html +0 -3
  150. package/typedoc/functions/index.useClientStatus.html +0 -1
  151. package/typedoc/functions/index.useConfig.html +0 -3
  152. package/typedoc/functions/index.useShell.html +0 -2
  153. package/typedoc/functions/index.useShellDisplay.html +0 -2
  154. package/typedoc/functions/index.useStatus.html +0 -1
  155. package/typedoc/functions/invitations.useInvitationStatus.html +0 -1
  156. package/typedoc/functions/mesh.useNetworkStatus.html +0 -2
  157. package/typedoc/hierarchy.html +0 -1
  158. package/typedoc/index.html +0 -23
  159. package/typedoc/interfaces/devtools.DevtoolsHook.html +0 -22
  160. package/typedoc/interfaces/devtools.DevtoolsHost.html +0 -26
  161. package/typedoc/interfaces/echo.DocAccessor.html +0 -3
  162. package/typedoc/interfaces/echo.Echo.html +0 -39
  163. package/typedoc/interfaces/echo.EchoDatabase.html +0 -25
  164. package/typedoc/interfaces/echo.Expando.html +0 -3
  165. package/typedoc/interfaces/echo.Filter.html +0 -3
  166. package/typedoc/interfaces/echo.HaloSpaceMember.html +0 -18
  167. package/typedoc/interfaces/echo.IDocHandle.html +0 -6
  168. package/typedoc/interfaces/echo.IndexKind.html +0 -9
  169. package/typedoc/interfaces/echo.Query.html +0 -34
  170. package/typedoc/interfaces/echo.QueryOptions.html +0 -39
  171. package/typedoc/interfaces/echo.Queue.html +0 -17
  172. package/typedoc/interfaces/echo.Ref.html +0 -32
  173. package/typedoc/interfaces/echo.Space.html +0 -39
  174. package/typedoc/interfaces/echo.SpaceMember.html +0 -7
  175. package/typedoc/interfaces/echo.SpaceSyncState.PeerState.html +0 -14
  176. package/typedoc/interfaces/echo.SpaceSyncState.html +0 -4
  177. package/typedoc/interfaces/echo.SubscriptionHandle.html +0 -5
  178. package/typedoc/interfaces/echo.TypedObject.html +0 -16
  179. package/typedoc/interfaces/halo.Contact.html +0 -10
  180. package/typedoc/interfaces/halo.Credential.html +0 -27
  181. package/typedoc/interfaces/halo.Device.html +0 -11
  182. package/typedoc/interfaces/halo.Halo.html +0 -16
  183. package/typedoc/interfaces/halo.Identity.html +0 -15
  184. package/typedoc/interfaces/index.AgentHostingProviderClient.html +0 -6
  185. package/typedoc/interfaces/index.AppContextRequest.html +0 -33
  186. package/typedoc/interfaces/index.ClientServicesProvider.html +0 -9
  187. package/typedoc/interfaces/index.InvitationUrlRequest.html +0 -9
  188. package/typedoc/interfaces/index.LayoutRequest.html +0 -29
  189. package/typedoc/interfaces/index.ShellRuntime.html +0 -15
  190. package/typedoc/interfaces/invitations.Invitation.html +0 -92
  191. package/typedoc/interfaces/invitations.Invitations.html +0 -5
  192. package/typedoc/interfaces/mesh.GossipMessage.html +0 -10
  193. package/typedoc/interfaces/mesh.NetworkStatus.Signal.html +0 -5
  194. package/typedoc/interfaces/mesh.NetworkStatus.html +0 -6
  195. package/typedoc/media/LICENSE +0 -8
  196. package/typedoc/modules/devtools.html +0 -1
  197. package/typedoc/modules/echo.Filter.html +0 -1
  198. package/typedoc/modules/echo.HaloSpaceMember.html +0 -1
  199. package/typedoc/modules/echo.IndexKind.html +0 -1
  200. package/typedoc/modules/echo.Query.html +0 -1
  201. package/typedoc/modules/echo.QueryOptions.html +0 -1
  202. package/typedoc/modules/echo.Ref.html +0 -2
  203. package/typedoc/modules/echo.SpaceMember.html +0 -1
  204. package/typedoc/modules/echo.SpaceSyncState.html +0 -1
  205. package/typedoc/modules/echo.html +0 -1
  206. package/typedoc/modules/halo.Device.html +0 -1
  207. package/typedoc/modules/halo.html +0 -1
  208. package/typedoc/modules/index.html +0 -1
  209. package/typedoc/modules/invitations.Invitation.html +0 -1
  210. package/typedoc/modules/invitations.html +0 -1
  211. package/typedoc/modules/mesh.NetworkStatus.html +0 -1
  212. package/typedoc/modules/mesh.html +0 -1
  213. package/typedoc/modules/worker.html +0 -1
  214. package/typedoc/modules.html +0 -1
  215. package/typedoc/types/devtools.MountOptions.html +0 -3
  216. package/typedoc/types/echo.AnyLiveObject.html +0 -2
  217. package/typedoc/types/echo.Filter.And.html +0 -1
  218. package/typedoc/types/echo.Filter.Any.html +0 -1
  219. package/typedoc/types/echo.Filter.Or.html +0 -1
  220. package/typedoc/types/echo.Filter.Props.html +0 -1
  221. package/typedoc/types/echo.Filter.Type.html +0 -1
  222. package/typedoc/types/echo.Live.html +0 -5
  223. package/typedoc/types/echo.ObjectMeta.html +0 -1
  224. package/typedoc/types/echo.ObjectMigration.html +0 -7
  225. package/typedoc/types/echo.ObjectVersion.html +0 -2
  226. package/typedoc/types/echo.PeerSyncState.html +0 -1
  227. package/typedoc/types/echo.Progress.html +0 -3
  228. package/typedoc/types/echo.PropertiesTypeProps.html +0 -1
  229. package/typedoc/types/echo.Query.Any.html +0 -1
  230. package/typedoc/types/echo.Query.TextSearchOptions.html +0 -2
  231. package/typedoc/types/echo.Query.Type.html +0 -1
  232. package/typedoc/types/echo.Ref.Target.html +0 -2
  233. package/typedoc/types/echo.Selection.html +0 -1
  234. package/typedoc/types/echo.SpaceId.html +0 -6
  235. package/typedoc/types/echo.SpaceSyncStateMap.html +0 -1
  236. package/typedoc/types/echo.UseQueueOptions.html +0 -2
  237. package/typedoc/types/echo.UseSpacesParams.html +0 -3
  238. package/typedoc/types/index.AgentHostingProviderProps.html +0 -3
  239. package/typedoc/types/index.ClientContextProps.html +0 -3
  240. package/typedoc/types/index.ClientOptions.html +0 -12
  241. package/typedoc/types/index.ClientProviderProps.html +0 -2
  242. package/typedoc/types/index.ClientServices.html +0 -15
  243. package/typedoc/types/index.FromAgentOptions.html +0 -2
  244. package/typedoc/types/index.PublicKeyLike.html +0 -2
  245. package/typedoc/types/invitations.InvitationAction.html +0 -1
  246. package/typedoc/types/invitations.InvitationResult.html +0 -5
  247. package/typedoc/types/invitations.InvitationStatus.html +0 -15
  248. package/typedoc/variables/devtools.mountDevtoolsHooks.html +0 -1
  249. package/typedoc/variables/devtools.unmountDevtoolsHooks.html +0 -1
  250. package/typedoc/variables/echo.DocAccessor.html +0 -1
  251. package/typedoc/variables/echo.EchoObjectSchema.html +0 -1
  252. package/typedoc/variables/echo.Expando.html +0 -1
  253. package/typedoc/variables/echo.FQ_ID_LENGTH.html +0 -1
  254. package/typedoc/variables/echo.Filter.html +0 -1
  255. package/typedoc/variables/echo.OBJECT_ID_LENGTH.html +0 -1
  256. package/typedoc/variables/echo.ObjectVersion.html +0 -1
  257. package/typedoc/variables/echo.Query.html +0 -1
  258. package/typedoc/variables/echo.Queue.html +0 -1
  259. package/typedoc/variables/echo.ReactiveObjectSchema.html +0 -1
  260. package/typedoc/variables/echo.Ref.html +0 -2
  261. package/typedoc/variables/echo.RefArray.html +0 -2
  262. package/typedoc/variables/echo.SPACE_ID_LENGTH.html +0 -1
  263. package/typedoc/variables/echo.SpaceId.html +0 -1
  264. package/typedoc/variables/echo.SpaceSchema.html +0 -1
  265. package/typedoc/variables/echo.TypedObject.html +0 -3
  266. package/typedoc/variables/echo.compareForeignKeys.html +0 -1
  267. package/typedoc/variables/echo.createDocAccessor.html +0 -1
  268. package/typedoc/variables/echo.createEmptyEdgeSyncState.html +0 -1
  269. package/typedoc/variables/echo.createObject.html +0 -1
  270. package/typedoc/variables/echo.createQueueDXN.html +0 -2
  271. package/typedoc/variables/echo.createSubscription.html +0 -5
  272. package/typedoc/variables/echo.defineObjectMigration.html +0 -1
  273. package/typedoc/variables/echo.fromCursor.html +0 -1
  274. package/typedoc/variables/echo.fullyQualifiedId.html +0 -4
  275. package/typedoc/variables/echo.getMeta.html +0 -1
  276. package/typedoc/variables/echo.getObjectCore.html +0 -1
  277. package/typedoc/variables/echo.getRangeFromCursor.html +0 -1
  278. package/typedoc/variables/echo.getSchema.html +0 -2
  279. package/typedoc/variables/echo.getSource.html +0 -4
  280. package/typedoc/variables/echo.getSpace.html +0 -1
  281. package/typedoc/variables/echo.getSyncSummary.html +0 -1
  282. package/typedoc/variables/echo.getTarget.html +0 -4
  283. package/typedoc/variables/echo.getTextInRange.html +0 -2
  284. package/typedoc/variables/echo.getType.html +0 -5
  285. package/typedoc/variables/echo.getTypename.html +0 -6
  286. package/typedoc/variables/echo.getVersion.html +0 -3
  287. package/typedoc/variables/echo.importSpace.html +0 -1
  288. package/typedoc/variables/echo.internalDecodeReference.html +0 -1
  289. package/typedoc/variables/echo.isEchoObject.html +0 -2
  290. package/typedoc/variables/echo.isLiveObject.html +0 -2
  291. package/typedoc/variables/echo.isRelation.html +0 -2
  292. package/typedoc/variables/echo.isSpace.html +0 -1
  293. package/typedoc/variables/echo.live.html +0 -3
  294. package/typedoc/variables/echo.loadObjectReferences.html +0 -7
  295. package/typedoc/variables/echo.makeRef.html +0 -2
  296. package/typedoc/variables/echo.parseFullyQualifiedId.html +0 -2
  297. package/typedoc/variables/echo.parseId.html +0 -1
  298. package/typedoc/variables/echo.refFromDXN.html +0 -2
  299. package/typedoc/variables/echo.toCursor.html +0 -1
  300. package/typedoc/variables/echo.toCursorRange.html +0 -1
  301. package/typedoc/variables/echo.updateText.html +0 -6
  302. package/typedoc/variables/echo.useQuery.html +0 -2
  303. package/typedoc/variables/index.AgentHostingContext.html +0 -1
  304. package/typedoc/variables/index.ClientProvider.html +0 -3
  305. package/typedoc/variables/index.DXOS_VERSION.html +0 -1
  306. package/typedoc/variables/index.Defaults.html +0 -2
  307. package/typedoc/variables/index.Dynamics.html +0 -2
  308. package/typedoc/variables/index.Envs.html +0 -2
  309. package/typedoc/variables/index.Local.html +0 -2
  310. package/typedoc/variables/index.Remote.html +0 -1
  311. package/typedoc/variables/index.Storage.html +0 -2
  312. package/typedoc/variables/index.createClientServices.html +0 -4
  313. package/typedoc/variables/index.fromAgent.html +0 -2
  314. package/typedoc/variables/index.fromHost.html +0 -2
  315. package/typedoc/variables/index.fromSocket.html +0 -2
  316. package/typedoc/variables/index.fromWorker.html +0 -2
  317. package/typedoc/variables/index.getUnixSocket.html +0 -1
  318. package/typedoc/variables/index.resolveRef.html +0 -1
  319. package/typedoc/variables/index.useMulticastObservable.html +0 -3
  320. package/typedoc/variables/worker.getWorkerServiceHost.html +0 -1
  321. package/typedoc/variables/worker.onconnect.html +0 -1
  322. /package/dist/lib/browser/{chunk-72QD3PXL.mjs.map → chunk-AAR7V3KL.mjs.map} +0 -0
  323. /package/dist/lib/browser/{chunk-AL2CUQ46.mjs.map → chunk-O5SEVDJG.mjs.map} +0 -0
  324. /package/dist/lib/node-esm/{chunk-UYJUBYMU.mjs.map → chunk-TU2JJLZK.mjs.map} +0 -0
  325. /package/dist/lib/node-esm/{chunk-NBTZZNQ5.mjs.map → chunk-ZTD6HPV2.mjs.map} +0 -0
@@ -1,188 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_FYOAVV65_exports = {};
20
- __export(chunk_FYOAVV65_exports, {
21
- AuthenticatingInvitationObservable: () => import_invitations.AuthenticatingInvitationObservable,
22
- CancellableInvitationObservable: () => import_invitations.CancellableInvitationObservable,
23
- Invitation: () => import_invitations.Invitation,
24
- InvitationEncoder: () => import_invitations.InvitationEncoder,
25
- InvitationsProxy: () => import_invitations.InvitationsProxy,
26
- useInvitationStatus: () => useInvitationStatus
27
- });
28
- module.exports = __toCommonJS(chunk_FYOAVV65_exports);
29
- var import_invitations = require("@dxos/client/invitations");
30
- var import_react = require("react");
31
- var import_invitations2 = require("@dxos/client/invitations");
32
- var import_log = require("@dxos/log");
33
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/react-client/src/invitations/useInvitationStatus.ts";
34
- var isShareableInvitation = (invitation) => invitation.authMethod !== import_invitations2.Invitation.AuthMethod.KNOWN_PUBLIC_KEY || invitation.guestKeypair?.privateKey;
35
- var useInvitationStatus = (observable) => {
36
- const [state, dispatch] = (0, import_react.useReducer)((prev, action) => {
37
- (0, import_log.log)("useInvitationStatus", {
38
- action
39
- }, {
40
- F: __dxlog_file,
41
- L: 90,
42
- S: void 0,
43
- C: (f, a) => f(...a)
44
- });
45
- const invitationProps = "invitation" in action ? {
46
- id: action.invitation.invitationId,
47
- multiUse: action.invitation.multiUse,
48
- invitationCode: import_invitations2.InvitationEncoder.encode(action.invitation),
49
- authCode: action.invitation.authCode,
50
- authMethod: action.invitation.authMethod,
51
- shareable: isShareableInvitation(action.invitation),
52
- type: action.invitation.type
53
- } : {};
54
- return {
55
- ...prev,
56
- ...invitationProps,
57
- // TODO(burdon): State.
58
- status: action.status,
59
- // `invitationObservable`, `secret`, and `result` is persisted between the status-actions that set them.
60
- result: action.status === import_invitations2.Invitation.State.SUCCESS ? action.result : prev.result,
61
- // `error` gets set each time we enter the error state
62
- ...action.status === import_invitations2.Invitation.State.ERROR && {
63
- error: action.error
64
- },
65
- // `haltedAt` gets set on only the first error/cancelled/timeout action and reset on any others.
66
- ...(action.status === import_invitations2.Invitation.State.ERROR || action.status === import_invitations2.Invitation.State.CANCELLED || action.status === import_invitations2.Invitation.State.TIMEOUT) && {
67
- haltedAt: typeof prev.haltedAt === "undefined" ? action.haltedAt : prev.haltedAt
68
- }
69
- };
70
- }, null, (_arg) => {
71
- const invitation = observable?.get();
72
- return {
73
- status: import_invitations2.Invitation.State.INIT,
74
- result: {
75
- spaceKey: null,
76
- identityKey: null,
77
- swarmKey: null,
78
- target: null
79
- },
80
- id: invitation?.invitationId,
81
- multiUse: invitation?.multiUse,
82
- invitationCode: invitation ? import_invitations2.InvitationEncoder.encode(invitation) : void 0,
83
- authCode: invitation?.authCode,
84
- authMethod: invitation?.authMethod,
85
- shareable: invitation ? isShareableInvitation(invitation) : false,
86
- type: invitation?.type
87
- };
88
- });
89
- (0, import_react.useEffect)(() => {
90
- const update = (invitation) => {
91
- switch (invitation.state) {
92
- case import_invitations2.Invitation.State.INIT:
93
- case import_invitations2.Invitation.State.CONNECTED:
94
- case import_invitations2.Invitation.State.READY_FOR_AUTHENTICATION:
95
- case import_invitations2.Invitation.State.AUTHENTICATING: {
96
- dispatch({
97
- invitation,
98
- status: invitation.state
99
- });
100
- break;
101
- }
102
- case import_invitations2.Invitation.State.SUCCESS: {
103
- dispatch({
104
- invitation,
105
- status: invitation.state,
106
- result: {
107
- spaceKey: invitation.spaceKey || null,
108
- identityKey: invitation.identityKey || null,
109
- swarmKey: invitation.swarmKey || null,
110
- target: invitation.target || null
111
- }
112
- });
113
- break;
114
- }
115
- case import_invitations2.Invitation.State.CANCELLED:
116
- case import_invitations2.Invitation.State.TIMEOUT: {
117
- dispatch({
118
- invitation,
119
- status: invitation.state,
120
- haltedAt: state.status
121
- });
122
- break;
123
- }
124
- }
125
- };
126
- const subscription = observable?.subscribe(update, (err) => {
127
- dispatch({
128
- status: import_invitations2.Invitation.State.ERROR,
129
- error: err,
130
- haltedAt: state.status
131
- });
132
- });
133
- const currentState = observable?.get();
134
- if (currentState) {
135
- update(currentState);
136
- }
137
- return () => subscription?.unsubscribe();
138
- }, [
139
- observable,
140
- state.status
141
- ]);
142
- const connect = (0, import_react.useCallback)((observable2) => {
143
- dispatch({
144
- invitation: observable2.get(),
145
- status: import_invitations2.Invitation.State.CONNECTING,
146
- observable: observable2
147
- });
148
- }, []);
149
- const authenticate = (0, import_react.useCallback)((authCode) => {
150
- (0, import_log.log)("authenticating...", {
151
- authCode
152
- }, {
153
- F: __dxlog_file,
154
- L: 195,
155
- S: void 0,
156
- C: (f, a) => f(...a)
157
- });
158
- return observable.authenticate(authCode);
159
- }, [
160
- observable
161
- ]);
162
- const cancel = (0, import_react.useCallback)(async () => observable?.cancel(), [
163
- observable
164
- ]);
165
- return (0, import_react.useMemo)(() => {
166
- return {
167
- ...state,
168
- cancel,
169
- connect,
170
- authenticate
171
- };
172
- }, [
173
- state,
174
- cancel,
175
- connect,
176
- authenticate
177
- ]);
178
- };
179
- // Annotate the CommonJS export names for ESM import in node:
180
- 0 && (module.exports = {
181
- AuthenticatingInvitationObservable,
182
- CancellableInvitationObservable,
183
- Invitation,
184
- InvitationEncoder,
185
- InvitationsProxy,
186
- useInvitationStatus
187
- });
188
- //# sourceMappingURL=chunk-FYOAVV65.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/invitations/index.ts", "../../../src/invitations/useInvitationStatus.ts"],
4
- "sourcesContent": ["//\n// Copyright 2020 DXOS.org\n//\n\n// NOTE: Export * fails here.\nexport {\n AuthenticatingInvitationObservable,\n CancellableInvitationObservable,\n InvitationEncoder,\n Invitation,\n type Invitations,\n InvitationsProxy,\n} from '@dxos/client/invitations';\n\nexport * from './useInvitationStatus';\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { useReducer, type Reducer, useMemo, useCallback, useEffect } from 'react';\n\nimport { type PublicKey } from '@dxos/client';\nimport {\n type AuthenticatingInvitationObservable,\n type CancellableInvitationObservable,\n Invitation,\n InvitationEncoder,\n} from '@dxos/client/invitations';\nimport { log } from '@dxos/log';\n\nexport type InvitationResult = {\n spaceKey: PublicKey | null;\n identityKey: PublicKey | null;\n swarmKey: PublicKey | null;\n target: string | null;\n};\n\ninterface InvitationReducerState {\n status: Invitation.State; // TODO(burdon): Rename state.\n haltedAt?: Invitation.State;\n result: InvitationResult;\n error?: number;\n id?: string;\n multiUse?: boolean;\n invitationCode?: string;\n authCode?: string;\n authMethod?: Invitation.AuthMethod;\n type?: Invitation.Type;\n}\n\ntype InvitationPayload = { invitation: Invitation };\n\nexport type InvitationAction =\n | ({\n status:\n | Invitation.State.INIT\n | Invitation.State.CONNECTED\n | Invitation.State.READY_FOR_AUTHENTICATION\n | Invitation.State.AUTHENTICATING;\n } & InvitationPayload)\n | ({\n status: Invitation.State.CONNECTING;\n observable: CancellableInvitationObservable;\n } & InvitationPayload)\n | ({\n status: Invitation.State.SUCCESS;\n result: InvitationResult;\n } & InvitationPayload)\n | ({\n status: Invitation.State.CANCELLED | Invitation.State.TIMEOUT;\n haltedAt: Invitation.State;\n } & InvitationPayload)\n | {\n status: Invitation.State.ERROR;\n error?: Error;\n haltedAt: Invitation.State;\n };\n\nexport type InvitationStatus = {\n id?: string;\n invitationCode?: string;\n authCode?: string;\n authMethod?: Invitation.AuthMethod;\n type?: Invitation.Type;\n status: Invitation.State;\n haltedAt?: Invitation.State;\n multiUse?: boolean;\n shareable?: boolean;\n result: InvitationResult;\n error?: number;\n cancel(): void;\n // TODO(wittjosiah): Remove?\n connect(observable: CancellableInvitationObservable): void;\n authenticate(authCode: string): Promise<void>;\n};\n\n// Without private key, the invitation code cannot be created.\n// These invitations are only available to be accepted but not shared.\nconst isShareableInvitation = (invitation: Invitation) =>\n invitation.authMethod !== Invitation.AuthMethod.KNOWN_PUBLIC_KEY || invitation.guestKeypair?.privateKey;\n\nexport const useInvitationStatus = (observable?: CancellableInvitationObservable): InvitationStatus => {\n const [state, dispatch] = useReducer<Reducer<InvitationReducerState, InvitationAction>, null>(\n (prev, action) => {\n log('useInvitationStatus', { action });\n const invitationProps =\n 'invitation' in action\n ? {\n id: action.invitation.invitationId,\n multiUse: action.invitation.multiUse,\n invitationCode: InvitationEncoder.encode(action.invitation),\n authCode: action.invitation.authCode,\n authMethod: action.invitation.authMethod,\n shareable: isShareableInvitation(action.invitation),\n type: action.invitation.type,\n }\n : {};\n return {\n ...prev,\n ...invitationProps,\n // TODO(burdon): State.\n status: action.status,\n // `invitationObservable`, `secret`, and `result` is persisted between the status-actions that set them.\n result: action.status === Invitation.State.SUCCESS ? action.result : prev.result,\n // `error` gets set each time we enter the error state\n ...(action.status === Invitation.State.ERROR && { error: action.error }),\n // `haltedAt` gets set on only the first error/cancelled/timeout action and reset on any others.\n ...((action.status === Invitation.State.ERROR ||\n action.status === Invitation.State.CANCELLED ||\n action.status === Invitation.State.TIMEOUT) && {\n haltedAt: typeof prev.haltedAt === 'undefined' ? action.haltedAt : prev.haltedAt,\n }),\n } as InvitationReducerState;\n },\n null,\n (_arg: null) => {\n const invitation = observable?.get();\n return {\n status: Invitation.State.INIT,\n result: { spaceKey: null, identityKey: null, swarmKey: null, target: null },\n id: invitation?.invitationId,\n multiUse: invitation?.multiUse,\n invitationCode: invitation ? InvitationEncoder.encode(invitation) : undefined,\n authCode: invitation?.authCode,\n authMethod: invitation?.authMethod,\n shareable: invitation ? isShareableInvitation(invitation) : false,\n type: invitation?.type,\n };\n },\n );\n\n // Handle unmount.\n\n useEffect(() => {\n const update = (invitation: Invitation) => {\n switch (invitation.state) {\n case Invitation.State.INIT:\n case Invitation.State.CONNECTED:\n case Invitation.State.READY_FOR_AUTHENTICATION:\n case Invitation.State.AUTHENTICATING: {\n dispatch({\n invitation,\n status: invitation.state,\n });\n break;\n }\n\n case Invitation.State.SUCCESS: {\n dispatch({\n invitation,\n status: invitation.state,\n result: {\n spaceKey: invitation.spaceKey || null,\n identityKey: invitation.identityKey || null,\n swarmKey: invitation.swarmKey || null,\n target: invitation.target || null,\n },\n });\n break;\n }\n\n case Invitation.State.CANCELLED:\n case Invitation.State.TIMEOUT: {\n dispatch({ invitation, status: invitation.state, haltedAt: state.status });\n break;\n }\n }\n };\n\n const subscription = observable?.subscribe(update, (err: Error) => {\n dispatch({ status: Invitation.State.ERROR, error: err, haltedAt: state.status });\n });\n\n const currentState = observable?.get();\n if (currentState) {\n update(currentState);\n }\n\n return () => subscription?.unsubscribe();\n }, [observable, state.status]);\n\n // Return memoized callbacks & values.\n\n const connect = useCallback((observable: CancellableInvitationObservable) => {\n dispatch({ invitation: observable.get(), status: Invitation.State.CONNECTING, observable });\n }, []);\n\n const authenticate = useCallback(\n (authCode: string) => {\n log('authenticating...', { authCode });\n return (observable as AuthenticatingInvitationObservable).authenticate(authCode);\n },\n [observable],\n );\n\n const cancel = useCallback(async () => observable?.cancel(), [observable]);\n\n return useMemo(() => {\n return {\n ...state,\n cancel,\n connect,\n authenticate,\n };\n }, [state, cancel, connect, authenticate]);\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,yBAOO;ACRP,mBAA0E;AAG1E,IAAAA,sBAKO;AACP,iBAAoB;;AAsEpB,IAAMC,wBAAwB,CAACC,eAC7BA,WAAWC,eAAeC,+BAAWC,WAAWC,oBAAoBJ,WAAWK,cAAcC;AAExF,IAAMC,sBAAsB,CAACC,eAAAA;AAClC,QAAM,CAACC,OAAOC,QAAAA,QAAYC,yBACxB,CAACC,MAAMC,WAAAA;AACLC,wBAAI,uBAAuB;MAAED;IAAO,GAAA;;;;;;AACpC,UAAME,kBACJ,gBAAgBF,SACZ;MACEG,IAAIH,OAAOb,WAAWiB;MACtBC,UAAUL,OAAOb,WAAWkB;MAC5BC,gBAAgBC,sCAAkB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;IAAChD;GAAW;AAEzE,aAAOiD,sBAAQ,MAAA;AACb,WAAO;MACL,GAAGhD;MACH+C;MACAJ;MACAG;IACF;EACF,GAAG;IAAC9C;IAAO+C;IAAQJ;IAASG;GAAa;AAC3C;",
6
- "names": ["import_invitations", "isShareableInvitation", "invitation", "authMethod", "Invitation", "AuthMethod", "KNOWN_PUBLIC_KEY", "guestKeypair", "privateKey", "useInvitationStatus", "observable", "state", "dispatch", "useReducer", "prev", "action", "log", "invitationProps", "id", "invitationId", "multiUse", "invitationCode", "InvitationEncoder", "encode", "authCode", "shareable", "type", "status", "result", "State", "SUCCESS", "ERROR", "error", "CANCELLED", "TIMEOUT", "haltedAt", "_arg", "get", "INIT", "spaceKey", "identityKey", "swarmKey", "target", "undefined", "useEffect", "update", "CONNECTED", "READY_FOR_AUTHENTICATION", "AUTHENTICATING", "subscription", "subscribe", "err", "currentState", "unsubscribe", "connect", "useCallback", "CONNECTING", "authenticate", "cancel", "useMemo"]
7
- }
@@ -1,62 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
- var devtools_exports = {};
21
- __export(devtools_exports, {
22
- useDevtools: () => useDevtools,
23
- useStream: () => useStream
24
- });
25
- module.exports = __toCommonJS(devtools_exports);
26
- var import_chunk_5RUIFUEC = require("../chunk-5RUIFUEC.cjs");
27
- __reExport(devtools_exports, require("@dxos/client/devtools"), module.exports);
28
- var import_debug = require("@dxos/debug");
29
- var import_react = require("react");
30
- var import_log = require("@dxos/log");
31
- var useDevtools = () => {
32
- const client = (0, import_chunk_5RUIFUEC.useClient)();
33
- return client.services.services.DevtoolsHost ?? (0, import_debug.raise)(new Error("DevtoolsHost not available."));
34
- };
35
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/react-client/src/devtools/useStream.ts";
36
- var useStream = (streamFactory, defaultValue, deps = []) => {
37
- const [value, setValue] = (0, import_react.useState)(defaultValue);
38
- (0, import_react.useEffect)(() => {
39
- const stream = streamFactory();
40
- stream.subscribe((response) => setValue(response), (err) => {
41
- if (err) {
42
- import_log.log.catch(err, void 0, {
43
- F: __dxlog_file,
44
- L: 21,
45
- S: void 0,
46
- C: (f, a) => f(...a)
47
- });
48
- }
49
- });
50
- return () => {
51
- void stream.close();
52
- };
53
- }, deps);
54
- return value ?? defaultValue;
55
- };
56
- // Annotate the CommonJS export names for ESM import in node:
57
- 0 && (module.exports = {
58
- useDevtools,
59
- useStream,
60
- ...require("@dxos/client/devtools")
61
- });
62
- //# sourceMappingURL=index.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/devtools/index.ts", "../../../../src/devtools/useDevtools.ts", "../../../../src/devtools/useStream.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport * from '@dxos/client/devtools';\n\nexport * from './useDevtools';\nexport * from './useStream';\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { type DevtoolsHost } from '@dxos/client/devtools';\nimport { raise } from '@dxos/debug';\n\nimport { useClient } from '../client';\n\nexport const useDevtools = (): DevtoolsHost => {\n const client = useClient();\n return client.services.services.DevtoolsHost ?? raise(new Error('DevtoolsHost not available.'));\n};\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport { type DependencyList, useState, useEffect } from 'react';\n\nimport { type Stream } from '@dxos/codec-protobuf/stream';\nimport { log } from '@dxos/log';\n\n/**\n * Subscribe to service API streams.\n */\nexport const useStream = <T>(streamFactory: () => Stream<T>, defaultValue: T, deps: DependencyList = []): T => {\n const [value, setValue] = useState<T | undefined>(defaultValue);\n useEffect(() => {\n const stream = streamFactory();\n stream.subscribe(\n (response: T) => setValue(response),\n (err) => {\n if (err) {\n log.catch(err);\n }\n },\n );\n\n return () => {\n void stream.close();\n };\n }, deps);\n\n return value ?? defaultValue;\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,6BAAc;ACCd,mBAAsB;ACDtB,mBAAyD;AAGzD,iBAAoB;ADEb,IAAMA,cAAc,MAAA;AACzB,QAAMC,aAASC,iCAAAA;AACf,SAAOD,OAAOE,SAASA,SAASC,oBAAgBC,oBAAM,IAAIC,MAAM,6BAAA,CAAA;AAClE;;ACAO,IAAMC,YAAY,CAAIC,eAAgCC,cAAiBC,OAAuB,CAAA,MAAE;AACrG,QAAM,CAACC,OAAOC,QAAAA,QAAYC,uBAAwBJ,YAAAA;AAClDK,8BAAU,MAAA;AACR,UAAMC,SAASP,cAAAA;AACfO,WAAOC,UACL,CAACC,aAAgBL,SAASK,QAAAA,GAC1B,CAACC,QAAAA;AACC,UAAIA,KAAK;AACPC,uBAAIC,MAAMF,KAAAA,QAAAA;;;;;;MACZ;IACF,CAAA;AAGF,WAAO,MAAA;AACL,WAAKH,OAAOM,MAAK;IACnB;EACF,GAAGX,IAAAA;AAEH,SAAOC,SAASF;AAClB;",
6
- "names": ["useDevtools", "client", "useClient", "services", "DevtoolsHost", "raise", "Error", "useStream", "streamFactory", "defaultValue", "deps", "value", "setValue", "useState", "useEffect", "stream", "subscribe", "response", "err", "log", "catch", "close"]
7
- }
@@ -1,302 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
- var echo_exports = {};
21
- __export(echo_exports, {
22
- useMembers: () => useMembers,
23
- useQuery: () => useQuery,
24
- useQueue: () => useQueue,
25
- useSchema: () => useSchema,
26
- useSpace: () => useSpace,
27
- useSpaceInvitation: () => useSpaceInvitation,
28
- useSpaceInvitations: () => useSpaceInvitations,
29
- useSpaceSyncState: () => useSpaceSyncState,
30
- useSpaces: () => useSpaces,
31
- useSubscription: () => useSubscription,
32
- useSyncState: () => useSyncState
33
- });
34
- module.exports = __toCommonJS(echo_exports);
35
- var import_chunk_FYOAVV65 = require("../chunk-FYOAVV65.cjs");
36
- var import_chunk_5RUIFUEC = require("../chunk-5RUIFUEC.cjs");
37
- __reExport(echo_exports, require("@dxos/client/echo"), module.exports);
38
- var import_async = require("@dxos/async");
39
- var import_echo = require("@dxos/client/echo");
40
- var import_react_hooks = require("@dxos/react-hooks");
41
- var import_react = require("react");
42
- var import_echo2 = require("@dxos/client/echo");
43
- var import_react_hooks2 = require("@dxos/react-hooks");
44
- var import_react2 = require("react");
45
- var import_echo3 = require("@dxos/client/echo");
46
- var import_react3 = require("react");
47
- var import_debug = require("@dxos/debug");
48
- var import_react4 = require("react");
49
- var import_react5 = require("react");
50
- var import_async2 = require("@dxos/async");
51
- var import_react_hooks3 = require("@dxos/react-hooks");
52
- var import_react6 = require("react");
53
- var import_echo4 = require("@dxos/client/echo");
54
- var import_react7 = require("react");
55
- var import_context = require("@dxos/context");
56
- var import_protocols = require("@dxos/protocols");
57
- var useSpace = (spaceKeyLike) => {
58
- const client = (0, import_chunk_5RUIFUEC.useClient)();
59
- const spaces = (0, import_react_hooks2.useMulticastObservable)(client.spaces);
60
- const [ready, setReady] = (0, import_react.useState)(false);
61
- (0, import_react.useEffect)(() => {
62
- if (spaceKeyLike) {
63
- return;
64
- }
65
- const timeout = setTimeout(async () => {
66
- await client.spaces.waitUntilReady();
67
- setReady(true);
68
- });
69
- return () => clearTimeout(timeout);
70
- }, [
71
- client,
72
- spaceKeyLike
73
- ]);
74
- if (spaceKeyLike) {
75
- return spaces.find((space) => space.key.equals(spaceKeyLike) || space.id === spaceKeyLike);
76
- }
77
- if (ready && client.halo.identity.get()) {
78
- return client.spaces.default;
79
- }
80
- };
81
- var useSpaces = ({ all = false } = {}) => {
82
- const client = (0, import_chunk_5RUIFUEC.useClient)();
83
- const spaces = (0, import_react_hooks2.useMulticastObservable)(client.spaces);
84
- return spaces.filter((space) => all || space.state.get() === import_echo2.SpaceState.SPACE_READY);
85
- };
86
- var useMembers = (spaceKey) => {
87
- const spaces = useSpaces({
88
- all: true
89
- });
90
- const space = spaceKey ? spaces.find((space2) => space2.key.equals(spaceKey)) : void 0;
91
- const members = (0, import_react_hooks.useMulticastObservable)(space?.members ?? import_async.MulticastObservable.empty()) ?? [];
92
- return members.filter((member) => member.role !== import_echo.HaloSpaceMember.Role.REMOVED);
93
- };
94
- var EMPTY_ARRAY = [];
95
- var noop = () => {
96
- };
97
- var useQuery = (spaceOrEcho, queryOrFilter, deps) => {
98
- const query = import_echo3.Filter.is(queryOrFilter) ? import_echo3.Query.select(queryOrFilter) : queryOrFilter;
99
- const { getObjects, subscribe } = (0, import_react2.useMemo)(() => {
100
- let subscribed = false;
101
- const queryResult = spaceOrEcho === void 0 ? void 0 : (0, import_echo3.isSpace)(spaceOrEcho) ? spaceOrEcho.db.query(query) : spaceOrEcho.query(query);
102
- return {
103
- getObjects: () => subscribed && queryResult ? queryResult.objects : EMPTY_ARRAY,
104
- subscribe: (cb) => {
105
- subscribed = true;
106
- const unsubscribe = queryResult?.subscribe(cb) ?? noop;
107
- return () => {
108
- unsubscribe?.();
109
- subscribed = false;
110
- };
111
- }
112
- };
113
- }, [
114
- spaceOrEcho,
115
- JSON.stringify(query.ast),
116
- ...deps ?? []
117
- ]);
118
- const objects = (0, import_react2.useSyncExternalStore)(subscribe, getObjects);
119
- return objects ?? [];
120
- };
121
- var MIN_POLL_INTERVAL = 1e3;
122
- var useQueue = (queueDxn, options = {}) => {
123
- const client = (0, import_chunk_5RUIFUEC.useClient)();
124
- const mountedRef = (0, import_react3.useRef)(true);
125
- const queue = (0, import_react3.useMemo)(() => {
126
- if (!queueDxn) {
127
- return void 0;
128
- }
129
- const { spaceId } = queueDxn.asQueueDXN() ?? (0, import_debug.raise)(new TypeError("Invalid queue DXN"));
130
- return client.spaces.get(spaceId)?.queues.get(queueDxn);
131
- }, [
132
- client,
133
- queueDxn?.toString()
134
- ]);
135
- (0, import_react3.useEffect)(() => {
136
- void queue?.refresh();
137
- }, [
138
- queue
139
- ]);
140
- (0, import_react3.useEffect)(() => {
141
- let timeout;
142
- mountedRef.current = true;
143
- const poll = () => {
144
- if (!mountedRef.current) {
145
- return;
146
- }
147
- void queue?.refresh().finally(() => {
148
- if (mountedRef.current && options.pollInterval) {
149
- timeout = setTimeout(poll, Math.max(options.pollInterval ?? 0, MIN_POLL_INTERVAL));
150
- }
151
- });
152
- };
153
- if (options.pollInterval) {
154
- poll();
155
- }
156
- return () => {
157
- mountedRef.current = false;
158
- clearTimeout(timeout);
159
- };
160
- }, [
161
- queue,
162
- options.pollInterval
163
- ]);
164
- return queue;
165
- };
166
- var useSchema = (client, space, typename) => {
167
- const { subscribe, getSchema } = (0, import_react4.useMemo)(() => {
168
- if (!typename || !space) {
169
- return {
170
- subscribe: () => () => {
171
- },
172
- getSchema: () => void 0
173
- };
174
- }
175
- const staticSchema = client.graph.schemaRegistry.getSchema(typename);
176
- if (staticSchema) {
177
- return {
178
- subscribe: () => () => {
179
- },
180
- getSchema: () => staticSchema
181
- };
182
- }
183
- const query = space.db.schemaRegistry.query({
184
- typename
185
- });
186
- const initialResult = query.runSync()[0];
187
- let currentSchema = initialResult;
188
- return {
189
- subscribe: (onStoreChange) => {
190
- const unsubscribe = query.subscribe(() => {
191
- currentSchema = query.results[0];
192
- onStoreChange();
193
- });
194
- return unsubscribe;
195
- },
196
- getSchema: () => currentSchema
197
- };
198
- }, [
199
- typename,
200
- space
201
- ]);
202
- return (0, import_react4.useSyncExternalStore)(subscribe, getSchema);
203
- };
204
- var useSpaceInvitations = (spaceKey) => {
205
- const space = useSpace(spaceKey);
206
- return (0, import_react_hooks3.useMulticastObservable)(space?.invitations ?? import_async2.MulticastObservable.empty()) ?? [];
207
- };
208
- var useSpaceInvitation = (spaceKey, invitationId) => {
209
- const invitations = useSpaceInvitations(spaceKey);
210
- const invitation = (0, import_react5.useMemo)(() => invitations.find((invitation2) => invitation2.get().invitationId === invitationId), [
211
- invitations
212
- ]);
213
- return (0, import_chunk_FYOAVV65.useInvitationStatus)(invitation);
214
- };
215
- var useSubscription = (cb, selection) => {
216
- const callbackRef = (0, import_react6.useRef)(cb);
217
- callbackRef.current = cb;
218
- const subscriptionRef = (0, import_react6.useRef)();
219
- (0, import_react6.useEffect)(() => {
220
- subscriptionRef.current = (0, import_echo4.createSubscription)(() => {
221
- callbackRef.current();
222
- });
223
- return () => subscriptionRef.current?.unsubscribe();
224
- }, []);
225
- subscriptionRef.current?.update(selection);
226
- return subscriptionRef.current;
227
- };
228
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/react-client/src/echo/useSyncState.ts";
229
- var isEdgePeerId = (peerId, spaceId) => peerId.startsWith(`${import_protocols.EdgeService.AUTOMERGE_REPLICATOR}:${spaceId}`);
230
- var useSyncState = () => {
231
- const client = (0, import_chunk_5RUIFUEC.useClient)();
232
- const [spaceState, setSpaceState] = (0, import_react7.useState)({});
233
- (0, import_react7.useEffect)(() => {
234
- const ctx = new import_context.Context(void 0, {
235
- F: __dxlog_file,
236
- L: 25
237
- });
238
- const createSubscriptions = (spaces) => {
239
- for (const space of spaces) {
240
- if (spaceState[space.id]) {
241
- continue;
242
- }
243
- ctx.onDispose(space.crud.subscribeToSyncState(ctx, ({ peers = [] }) => {
244
- const syncState = peers.find((state) => isEdgePeerId(state.peerId, space.id));
245
- if (syncState) {
246
- setSpaceState((spaceState2) => ({
247
- ...spaceState2,
248
- [space.id]: syncState
249
- }));
250
- }
251
- }));
252
- }
253
- };
254
- createSubscriptions(client.spaces.get());
255
- client.spaces.subscribe((spaces) => {
256
- createSubscriptions(spaces);
257
- });
258
- return () => {
259
- void ctx.dispose();
260
- };
261
- }, [
262
- client
263
- ]);
264
- return spaceState;
265
- };
266
- var useSpaceSyncState = (space) => {
267
- const [spaceState, setSpaceState] = (0, import_react7.useState)();
268
- (0, import_react7.useEffect)(() => {
269
- const ctx = new import_context.Context(void 0, {
270
- F: __dxlog_file,
271
- L: 64
272
- });
273
- space.crud.subscribeToSyncState(ctx, ({ peers = [] }) => {
274
- const syncState = peers.find((state) => isEdgePeerId(state.peerId, space.id));
275
- if (syncState) {
276
- setSpaceState(syncState);
277
- }
278
- });
279
- return () => {
280
- void ctx.dispose();
281
- };
282
- }, [
283
- space
284
- ]);
285
- return spaceState;
286
- };
287
- // Annotate the CommonJS export names for ESM import in node:
288
- 0 && (module.exports = {
289
- useMembers,
290
- useQuery,
291
- useQueue,
292
- useSchema,
293
- useSpace,
294
- useSpaceInvitation,
295
- useSpaceInvitations,
296
- useSpaceSyncState,
297
- useSpaces,
298
- useSubscription,
299
- useSyncState,
300
- ...require("@dxos/client/echo")
301
- });
302
- //# sourceMappingURL=index.cjs.map
@@ -1,7 +0,0 @@
1
- {
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,yBAAc;ACAd,mBAAoC;AAEpC,kBAAkD;AAClD,yBAAuC;ACHvC,mBAAoC;AAGpC,IAAAA,eAAuC;AACvC,IAAAC,sBAAuC;ACJvC,IAAAC,gBAA8C;AAE9C,IAAAF,eAAyE;ACFzE,IAAAE,gBAA2C;AAG3C,mBAAsB;ACFtB,IAAAA,gBAA8C;ACD9C,IAAAA,gBAAwB;AAExB,IAAAC,gBAAoC;AAEpC,IAAAF,sBAAuC;ACJvC,IAAAC,gBAAkC;AAElC,IAAAF,eAA4E;ACF5E,IAAAE,gBAAoC;AAGpC,qBAAwB;AAExB,uBAA4B;ANWrB,IAAME,WA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CAAClH,WAAAA;AAC3B,iBAAWW,SAASX,QAAQ;AAC1B,YAAI8G,WAAWnG,MAAMG,EAAE,GAAG;AACxB;QACF;AAEAkG,YAAIG,UACFxG,MAAMyG,KAAKC,qBAAqBL,KAAK,CAAC,EAAEM,QAAQ,CAAA,EAAE,MAAE;AAClD,gBAAMC,YAAYD,MAAM5G,KAAK,CAACY,UAAUkF,aAAalF,MAAMmF,QAAQ9F,MAAMG,EAAE,CAAA;AAC3E,cAAIyG,WAAW;AACbR,0BAAc,CAACD,iBAAgB;cAAE,GAAGA;cAAY,CAACnG,MAAMG,EAAE,GAAGyG;YAAU,EAAA;UACxE;QACF,CAAA,CAAA;MAEJ;IACF;AAEAL,wBAAoBpH,OAAOE,OAAOiB,IAAG,CAAA;AACrCnB,WAAOE,OAAOgD,UAAU,CAAChD,WAAAA;AACvBkH,0BAAoBlH,MAAAA;IACtB,CAAA;AAEA,WAAO,MAAA;AACL,WAAKgH,IAAIQ,QAAO;IAClB;EACF,GAAG;IAAC1H;GAAO;AAEX,SAAOgH;AACT;AAMO,IAAMW,oBAAoB,CAAC9G,UAAAA;AAChC,QAAM,CAACmG,YAAYC,aAAAA,QAAiB3G,cAAAA,UAAAA;AAEpCC,oBAAAA,WAAU,MAAA;AACR,UAAM2G,MAAM,IAAIC,uBAAAA,QAAAA;;;;AAChBtG,UAAMyG,KAAKC,qBAAqBL,KAAK,CAAC,EAAEM,QAAQ,CAAA,EAAE,MAAE;AAClD,YAAMC,YAAYD,MAAM5G,KAAK,CAACY,UAAUkF,aAAalF,MAAMmF,QAAQ9F,MAAMG,EAAE,CAAA;AAC3E,UAAIyG,WAAW;AACbR,sBAAcQ,SAAAA;MAChB;IACF,CAAA;AAEA,WAAO,MAAA;AACL,WAAKP,IAAIQ,QAAO;IAClB;EACF,GAAG;IAAC7G;GAAM;AAEV,SAAOmG;AACT;",
6
- "names": ["import_echo", "import_react_hooks", "import_react", "import_async", "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", "undefined", "members", "MulticastObservable", "empty", "member", "role", "HaloSpaceMember", "Role", "REMOVED", "EMPTY_ARRAY", "noop", "useQuery", "spaceOrEcho", "queryOrFilter", "deps", "query", "Filter", "is", "Query", "select", "getObjects", "subscribe", "useMemo", "subscribed", "queryResult", "isSpace", "db", "objects", "cb", "unsubscribe", "JSON", "stringify", "ast", "useSyncExternalStore", "MIN_POLL_INTERVAL", "useQueue", "queueDxn", "options", "mountedRef", "useRef", "queue", "spaceId", "asQueueDXN", "raise", "TypeError", "queues", "toString", "refresh", "current", "poll", "finally", "pollInterval", "Math", "max", "useSchema", "typename", "getSchema", "staticSchema", "graph", "schemaRegistry", "initialResult", "runSync", "currentSchema", "onStoreChange", "results", "useSpaceInvitations", "invitations", "useSpaceInvitation", "invitationId", "invitation", "useInvitationStatus", "useSubscription", "selection", "callbackRef", "subscriptionRef", "createSubscription", "update", "isEdgePeerId", "peerId", "startsWith", "EdgeService", "AUTOMERGE_REPLICATOR", "useSyncState", "spaceState", "setSpaceState", "ctx", "Context", "createSubscriptions", "onDispose", "crud", "subscribeToSyncState", "peers", "syncState", "dispose", "useSpaceSyncState"]
7
- }