@dxos/react-client 0.8.3 → 0.8.4-main.1da679c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
- package/dist/lib/browser/{chunk-AL2CUQ46.mjs → chunk-BXOLJYAY.mjs} +5 -5
- package/dist/lib/{node-esm/chunk-UYJUBYMU.mjs.map → browser/chunk-BXOLJYAY.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-72QD3PXL.mjs → chunk-TA2HGRAF.mjs} +76 -79
- package/dist/lib/browser/chunk-TA2HGRAF.mjs.map +7 -0
- package/dist/lib/browser/devtools/index.mjs +6 -6
- package/dist/lib/browser/devtools/index.mjs.map +3 -3
- package/dist/lib/browser/echo/index.mjs +28 -31
- package/dist/lib/browser/echo/index.mjs.map +3 -3
- package/dist/lib/browser/halo/index.mjs +28 -13
- package/dist/lib/browser/halo/index.mjs.map +3 -3
- package/dist/lib/browser/index.mjs +2 -2
- package/dist/lib/browser/invitations/index.mjs +1 -1
- package/dist/lib/browser/mesh/index.mjs +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +41 -43
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/browser/worker.mjs +1 -1
- package/dist/lib/node-esm/{chunk-UYJUBYMU.mjs → chunk-256IHY6F.mjs} +5 -5
- package/dist/lib/{browser/chunk-AL2CUQ46.mjs.map → node-esm/chunk-256IHY6F.mjs.map} +3 -3
- package/dist/lib/node-esm/{chunk-NBTZZNQ5.mjs → chunk-ZJMNF7GC.mjs} +76 -79
- package/dist/lib/node-esm/chunk-ZJMNF7GC.mjs.map +7 -0
- package/dist/lib/node-esm/devtools/index.mjs +6 -6
- package/dist/lib/node-esm/devtools/index.mjs.map +3 -3
- package/dist/lib/node-esm/echo/index.mjs +28 -31
- package/dist/lib/node-esm/echo/index.mjs.map +3 -3
- package/dist/lib/node-esm/halo/index.mjs +28 -13
- package/dist/lib/node-esm/halo/index.mjs.map +3 -3
- package/dist/lib/node-esm/index.mjs +2 -2
- package/dist/lib/node-esm/invitations/index.mjs +1 -1
- package/dist/lib/node-esm/mesh/index.mjs +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +41 -43
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/worker.mjs +1 -1
- package/dist/types/src/client/AgentHostingProvider.d.ts.map +1 -1
- package/dist/types/src/client/ClientProvider.d.ts.map +1 -1
- package/dist/types/src/echo/useQuery.d.ts +3 -3
- package/dist/types/src/echo/useQuery.d.ts.map +1 -1
- package/dist/types/src/echo/useSpaceInvitations.d.ts.map +1 -1
- package/dist/types/src/echo/useSpaces.d.ts.map +1 -1
- package/dist/types/src/echo/useSyncState.d.ts +1 -1
- package/dist/types/src/echo/useSyncState.d.ts.map +1 -1
- package/dist/types/src/halo/Passkey.stories.d.ts +5 -5
- package/dist/types/src/halo/Passkey.stories.d.ts.map +1 -1
- package/dist/types/src/halo/useHaloInvitations.d.ts.map +1 -1
- package/dist/types/src/playwright/{playwright.config.d.cts → playwright.config.d.ts} +1 -1
- package/dist/types/src/playwright/playwright.config.d.ts.map +1 -0
- package/dist/types/src/testing/ClientRepeater.d.ts.map +1 -1
- package/dist/types/src/testing/ClientRepeater.stories.d.ts +6 -9
- package/dist/types/src/testing/ClientRepeater.stories.d.ts.map +1 -1
- package/dist/types/src/testing/withClientProvider.d.ts +1 -1
- package/dist/types/src/testing/withClientProvider.d.ts.map +1 -1
- package/dist/types/src/testing/withClientProvider.stories.d.ts +7 -9
- package/dist/types/src/testing/withClientProvider.stories.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/moon.yml +19 -0
- package/package.json +33 -25
- package/src/client/AgentHostingProvider.tsx +1 -1
- package/src/client/ClientProvider.test.tsx +3 -2
- package/src/client/ClientProvider.tsx +33 -36
- package/src/client/useConfig.test.tsx +2 -1
- package/src/devtools/useStream.ts +1 -1
- package/src/echo/useQuery.test.tsx +2 -1
- package/src/echo/useQuery.ts +12 -4
- package/src/echo/useSpaceInvitations.ts +2 -1
- package/src/echo/useSpaces.test.tsx +2 -1
- package/src/echo/useSpaces.ts +5 -9
- package/src/echo/useSyncState.ts +3 -3
- package/src/halo/Passkey.stories.tsx +12 -6
- package/src/halo/useDevices.test.tsx +2 -1
- package/src/halo/useHaloInvitations.ts +1 -1
- package/src/invitations/useInvitationStatus.ts +1 -1
- package/src/playwright/playwright.config.ts +17 -0
- package/src/playwright/smoke.spec.ts +4 -6
- package/src/testing/ClientRepeater.stories.tsx +11 -5
- package/src/testing/ClientRepeater.tsx +20 -24
- package/src/testing/withClientProvider.stories.tsx +14 -8
- package/src/testing/withClientProvider.tsx +7 -6
- package/vitest.config.ts +1 -1
- package/.eslintrc.cjs +0 -12
- package/README.yml +0 -33
- package/dist/lib/browser/chunk-72QD3PXL.mjs.map +0 -7
- package/dist/lib/node/chunk-5RUIFUEC.cjs +0 -334
- package/dist/lib/node/chunk-5RUIFUEC.cjs.map +0 -7
- package/dist/lib/node/chunk-FYOAVV65.cjs +0 -188
- package/dist/lib/node/chunk-FYOAVV65.cjs.map +0 -7
- package/dist/lib/node/devtools/index.cjs +0 -62
- package/dist/lib/node/devtools/index.cjs.map +0 -7
- package/dist/lib/node/echo/index.cjs +0 -302
- package/dist/lib/node/echo/index.cjs.map +0 -7
- package/dist/lib/node/halo/index.cjs +0 -123
- package/dist/lib/node/halo/index.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -55
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/invitations/index.cjs +0 -39
- package/dist/lib/node/invitations/index.cjs.map +0 -7
- package/dist/lib/node/mesh/index.cjs +0 -37
- package/dist/lib/node/mesh/index.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/testing/index.cjs +0 -278
- package/dist/lib/node/testing/index.cjs.map +0 -7
- package/dist/lib/node/worker.cjs +0 -23
- package/dist/lib/node/worker.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-NBTZZNQ5.mjs.map +0 -7
- package/dist/types/src/playwright/playwright.config.d.cts.map +0 -1
- package/project.json +0 -40
- package/src/playwright/playwright.config.cts +0 -18
- package/typedoc/.nojekyll +0 -1
- package/typedoc/assets/hierarchy.js +0 -1
- package/typedoc/assets/highlight.css +0 -99
- package/typedoc/assets/icons.js +0 -18
- package/typedoc/assets/icons.svg +0 -1
- package/typedoc/assets/main.js +0 -60
- package/typedoc/assets/navigation.js +0 -1
- package/typedoc/assets/search.js +0 -1
- package/typedoc/assets/style.css +0 -1640
- package/typedoc/classes/echo.Hypergraph.html +0 -17
- package/typedoc/classes/echo.PropertiesType.html +0 -19
- package/typedoc/classes/echo.QueryResult.html +0 -18
- package/typedoc/classes/halo.KeyStore.html +0 -6
- package/typedoc/classes/index.AgentClientServiceProvider.html +0 -10
- package/typedoc/classes/index.AgentManagerClient.html +0 -22
- package/typedoc/classes/index.AlreadyJoinedError.html +0 -15
- package/typedoc/classes/index.ApiError.html +0 -16
- package/typedoc/classes/index.CancelledError.html +0 -16
- package/typedoc/classes/index.Client.html +0 -51
- package/typedoc/classes/index.ClientServicesProxy.html +0 -12
- package/typedoc/classes/index.Config.html +0 -17
- package/typedoc/classes/index.DataCorruptionError.html +0 -16
- package/typedoc/classes/index.DatabaseError.html +0 -15
- package/typedoc/classes/index.EntityNotFoundError.html +0 -15
- package/typedoc/classes/index.FakeAgentHostingProvider.html +0 -7
- package/typedoc/classes/index.IFrameManager.html +0 -6
- package/typedoc/classes/index.IdentityNotInitializedError.html +0 -15
- package/typedoc/classes/index.InvalidConfigError.html +0 -16
- package/typedoc/classes/index.InvalidInvitationError.html +0 -15
- package/typedoc/classes/index.InvalidInvitationExtensionRoleError.html +0 -16
- package/typedoc/classes/index.InvalidStorageVersionError.html +0 -15
- package/typedoc/classes/index.LocalClientServices.html +0 -12
- package/typedoc/classes/index.PublicKey.html +0 -55
- package/typedoc/classes/index.RemoteServiceConnectionError.html +0 -15
- package/typedoc/classes/index.RemoteServiceConnectionTimeout.html +0 -15
- package/typedoc/classes/index.RpcClosedError.html +0 -15
- package/typedoc/classes/index.RpcNotOpenError.html +0 -15
- package/typedoc/classes/index.SharedWorkerConnection.html +0 -5
- package/typedoc/classes/index.Shell.html +0 -35
- package/typedoc/classes/index.ShellManager.html +0 -9
- package/typedoc/classes/index.SystemError.html +0 -16
- package/typedoc/classes/index.UnknownModelError.html +0 -15
- package/typedoc/classes/index.WorkerClientServices.html +0 -12
- package/typedoc/classes/invitations.AuthenticatingInvitationObservable.html +0 -30
- package/typedoc/classes/invitations.CancellableInvitationObservable.html +0 -29
- package/typedoc/classes/invitations.InvitationEncoder.html +0 -5
- package/typedoc/classes/invitations.InvitationsProxy.html +0 -12
- package/typedoc/enums/devtools.KeyType.html +0 -9
- package/typedoc/enums/echo.HaloSpaceMember.Role.html +0 -9
- package/typedoc/enums/echo.IndexKind.Kind.html +0 -8
- package/typedoc/enums/echo.QueryOptions.DataLocation.html +0 -6
- package/typedoc/enums/echo.QueryOptions.ShowDeletedOption.html +0 -6
- package/typedoc/enums/echo.ResultFormat.html +0 -10
- package/typedoc/enums/echo.SpaceMember.PresenceState.html +0 -5
- package/typedoc/enums/echo.SpaceState.html +0 -13
- package/typedoc/enums/echo.TextKind.html +0 -5
- package/typedoc/enums/halo.Device.PresenceState.html +0 -6
- package/typedoc/enums/halo.DeviceKind.html +0 -5
- package/typedoc/enums/halo.DeviceType.html +0 -9
- package/typedoc/enums/index.ShellDisplay.html +0 -5
- package/typedoc/enums/index.ShellLayout.html +0 -13
- package/typedoc/enums/index.SystemStatus.html +0 -5
- package/typedoc/enums/invitations.Invitation.AuthMethod.html +0 -6
- package/typedoc/enums/invitations.Invitation.Kind.html +0 -5
- package/typedoc/enums/invitations.Invitation.State.html +0 -13
- package/typedoc/enums/invitations.Invitation.Type.html +0 -6
- package/typedoc/enums/mesh.ConnectionState.html +0 -5
- package/typedoc/functions/devtools.useDevtools.html +0 -1
- package/typedoc/functions/devtools.useStream.html +0 -2
- package/typedoc/functions/echo.useMembers.html +0 -1
- package/typedoc/functions/echo.useQueue.html +0 -2
- package/typedoc/functions/echo.useSchema.html +0 -2
- package/typedoc/functions/echo.useSpace.html +0 -6
- package/typedoc/functions/echo.useSpaceInvitation.html +0 -1
- package/typedoc/functions/echo.useSpaceInvitations.html +0 -1
- package/typedoc/functions/echo.useSpaceSyncState.html +0 -2
- package/typedoc/functions/echo.useSpaces.html +0 -5
- package/typedoc/functions/echo.useSubscription.html +0 -3
- package/typedoc/functions/echo.useSyncState.html +0 -2
- package/typedoc/functions/halo.useContacts.html +0 -4
- package/typedoc/functions/halo.useCredentials.html +0 -1
- package/typedoc/functions/halo.useDevices.html +0 -1
- package/typedoc/functions/halo.useHaloInvitation.html +0 -1
- package/typedoc/functions/halo.useHaloInvitations.html +0 -1
- package/typedoc/functions/halo.useIdentity.html +0 -3
- package/typedoc/functions/halo.useKeyStore.html +0 -3
- package/typedoc/functions/index.AgentHostingProvider.html +0 -2
- package/typedoc/functions/index.useAgentHostingClient.html +0 -1
- package/typedoc/functions/index.useClient.html +0 -3
- package/typedoc/functions/index.useClientStatus.html +0 -1
- package/typedoc/functions/index.useConfig.html +0 -3
- package/typedoc/functions/index.useShell.html +0 -2
- package/typedoc/functions/index.useShellDisplay.html +0 -2
- package/typedoc/functions/index.useStatus.html +0 -1
- package/typedoc/functions/invitations.useInvitationStatus.html +0 -1
- package/typedoc/functions/mesh.useNetworkStatus.html +0 -2
- package/typedoc/hierarchy.html +0 -1
- package/typedoc/index.html +0 -23
- package/typedoc/interfaces/devtools.DevtoolsHook.html +0 -22
- package/typedoc/interfaces/devtools.DevtoolsHost.html +0 -26
- package/typedoc/interfaces/echo.DocAccessor.html +0 -3
- package/typedoc/interfaces/echo.Echo.html +0 -39
- package/typedoc/interfaces/echo.EchoDatabase.html +0 -25
- package/typedoc/interfaces/echo.Expando.html +0 -3
- package/typedoc/interfaces/echo.Filter.html +0 -3
- package/typedoc/interfaces/echo.HaloSpaceMember.html +0 -18
- package/typedoc/interfaces/echo.IDocHandle.html +0 -6
- package/typedoc/interfaces/echo.IndexKind.html +0 -9
- package/typedoc/interfaces/echo.Query.html +0 -34
- package/typedoc/interfaces/echo.QueryOptions.html +0 -39
- package/typedoc/interfaces/echo.Queue.html +0 -17
- package/typedoc/interfaces/echo.Ref.html +0 -32
- package/typedoc/interfaces/echo.Space.html +0 -39
- package/typedoc/interfaces/echo.SpaceMember.html +0 -7
- package/typedoc/interfaces/echo.SpaceSyncState.PeerState.html +0 -14
- package/typedoc/interfaces/echo.SpaceSyncState.html +0 -4
- package/typedoc/interfaces/echo.SubscriptionHandle.html +0 -5
- package/typedoc/interfaces/echo.TypedObject.html +0 -16
- package/typedoc/interfaces/halo.Contact.html +0 -10
- package/typedoc/interfaces/halo.Credential.html +0 -27
- package/typedoc/interfaces/halo.Device.html +0 -11
- package/typedoc/interfaces/halo.Halo.html +0 -16
- package/typedoc/interfaces/halo.Identity.html +0 -15
- package/typedoc/interfaces/index.AgentHostingProviderClient.html +0 -6
- package/typedoc/interfaces/index.AppContextRequest.html +0 -33
- package/typedoc/interfaces/index.ClientServicesProvider.html +0 -9
- package/typedoc/interfaces/index.InvitationUrlRequest.html +0 -9
- package/typedoc/interfaces/index.LayoutRequest.html +0 -29
- package/typedoc/interfaces/index.ShellRuntime.html +0 -15
- package/typedoc/interfaces/invitations.Invitation.html +0 -92
- package/typedoc/interfaces/invitations.Invitations.html +0 -5
- package/typedoc/interfaces/mesh.GossipMessage.html +0 -10
- package/typedoc/interfaces/mesh.NetworkStatus.Signal.html +0 -5
- package/typedoc/interfaces/mesh.NetworkStatus.html +0 -6
- package/typedoc/media/LICENSE +0 -8
- package/typedoc/modules/devtools.html +0 -1
- package/typedoc/modules/echo.Filter.html +0 -1
- package/typedoc/modules/echo.HaloSpaceMember.html +0 -1
- package/typedoc/modules/echo.IndexKind.html +0 -1
- package/typedoc/modules/echo.Query.html +0 -1
- package/typedoc/modules/echo.QueryOptions.html +0 -1
- package/typedoc/modules/echo.Ref.html +0 -2
- package/typedoc/modules/echo.SpaceMember.html +0 -1
- package/typedoc/modules/echo.SpaceSyncState.html +0 -1
- package/typedoc/modules/echo.html +0 -1
- package/typedoc/modules/halo.Device.html +0 -1
- package/typedoc/modules/halo.html +0 -1
- package/typedoc/modules/index.html +0 -1
- package/typedoc/modules/invitations.Invitation.html +0 -1
- package/typedoc/modules/invitations.html +0 -1
- package/typedoc/modules/mesh.NetworkStatus.html +0 -1
- package/typedoc/modules/mesh.html +0 -1
- package/typedoc/modules/worker.html +0 -1
- package/typedoc/modules.html +0 -1
- package/typedoc/types/devtools.MountOptions.html +0 -3
- package/typedoc/types/echo.AnyLiveObject.html +0 -2
- package/typedoc/types/echo.Filter.And.html +0 -1
- package/typedoc/types/echo.Filter.Any.html +0 -1
- package/typedoc/types/echo.Filter.Or.html +0 -1
- package/typedoc/types/echo.Filter.Props.html +0 -1
- package/typedoc/types/echo.Filter.Type.html +0 -1
- package/typedoc/types/echo.Live.html +0 -5
- package/typedoc/types/echo.ObjectMeta.html +0 -1
- package/typedoc/types/echo.ObjectMigration.html +0 -7
- package/typedoc/types/echo.ObjectVersion.html +0 -2
- package/typedoc/types/echo.PeerSyncState.html +0 -1
- package/typedoc/types/echo.Progress.html +0 -3
- package/typedoc/types/echo.PropertiesTypeProps.html +0 -1
- package/typedoc/types/echo.Query.Any.html +0 -1
- package/typedoc/types/echo.Query.TextSearchOptions.html +0 -2
- package/typedoc/types/echo.Query.Type.html +0 -1
- package/typedoc/types/echo.Ref.Target.html +0 -2
- package/typedoc/types/echo.Selection.html +0 -1
- package/typedoc/types/echo.SpaceId.html +0 -6
- package/typedoc/types/echo.SpaceSyncStateMap.html +0 -1
- package/typedoc/types/echo.UseQueueOptions.html +0 -2
- package/typedoc/types/echo.UseSpacesParams.html +0 -3
- package/typedoc/types/index.AgentHostingProviderProps.html +0 -3
- package/typedoc/types/index.ClientContextProps.html +0 -3
- package/typedoc/types/index.ClientOptions.html +0 -12
- package/typedoc/types/index.ClientProviderProps.html +0 -2
- package/typedoc/types/index.ClientServices.html +0 -15
- package/typedoc/types/index.FromAgentOptions.html +0 -2
- package/typedoc/types/index.PublicKeyLike.html +0 -2
- package/typedoc/types/invitations.InvitationAction.html +0 -1
- package/typedoc/types/invitations.InvitationResult.html +0 -5
- package/typedoc/types/invitations.InvitationStatus.html +0 -15
- package/typedoc/variables/devtools.mountDevtoolsHooks.html +0 -1
- package/typedoc/variables/devtools.unmountDevtoolsHooks.html +0 -1
- package/typedoc/variables/echo.DocAccessor.html +0 -1
- package/typedoc/variables/echo.EchoObjectSchema.html +0 -1
- package/typedoc/variables/echo.Expando.html +0 -1
- package/typedoc/variables/echo.FQ_ID_LENGTH.html +0 -1
- package/typedoc/variables/echo.Filter.html +0 -1
- package/typedoc/variables/echo.OBJECT_ID_LENGTH.html +0 -1
- package/typedoc/variables/echo.ObjectVersion.html +0 -1
- package/typedoc/variables/echo.Query.html +0 -1
- package/typedoc/variables/echo.Queue.html +0 -1
- package/typedoc/variables/echo.ReactiveObjectSchema.html +0 -1
- package/typedoc/variables/echo.Ref.html +0 -2
- package/typedoc/variables/echo.RefArray.html +0 -2
- package/typedoc/variables/echo.SPACE_ID_LENGTH.html +0 -1
- package/typedoc/variables/echo.SpaceId.html +0 -1
- package/typedoc/variables/echo.SpaceSchema.html +0 -1
- package/typedoc/variables/echo.TypedObject.html +0 -3
- package/typedoc/variables/echo.compareForeignKeys.html +0 -1
- package/typedoc/variables/echo.createDocAccessor.html +0 -1
- package/typedoc/variables/echo.createEmptyEdgeSyncState.html +0 -1
- package/typedoc/variables/echo.createObject.html +0 -1
- package/typedoc/variables/echo.createQueueDXN.html +0 -2
- package/typedoc/variables/echo.createSubscription.html +0 -5
- package/typedoc/variables/echo.defineObjectMigration.html +0 -1
- package/typedoc/variables/echo.fromCursor.html +0 -1
- package/typedoc/variables/echo.fullyQualifiedId.html +0 -4
- package/typedoc/variables/echo.getMeta.html +0 -1
- package/typedoc/variables/echo.getObjectCore.html +0 -1
- package/typedoc/variables/echo.getRangeFromCursor.html +0 -1
- package/typedoc/variables/echo.getSchema.html +0 -2
- package/typedoc/variables/echo.getSource.html +0 -4
- package/typedoc/variables/echo.getSpace.html +0 -1
- package/typedoc/variables/echo.getSyncSummary.html +0 -1
- package/typedoc/variables/echo.getTarget.html +0 -4
- package/typedoc/variables/echo.getTextInRange.html +0 -2
- package/typedoc/variables/echo.getType.html +0 -5
- package/typedoc/variables/echo.getTypename.html +0 -6
- package/typedoc/variables/echo.getVersion.html +0 -3
- package/typedoc/variables/echo.importSpace.html +0 -1
- package/typedoc/variables/echo.internalDecodeReference.html +0 -1
- package/typedoc/variables/echo.isEchoObject.html +0 -2
- package/typedoc/variables/echo.isLiveObject.html +0 -2
- package/typedoc/variables/echo.isRelation.html +0 -2
- package/typedoc/variables/echo.isSpace.html +0 -1
- package/typedoc/variables/echo.live.html +0 -3
- package/typedoc/variables/echo.loadObjectReferences.html +0 -7
- package/typedoc/variables/echo.makeRef.html +0 -2
- package/typedoc/variables/echo.parseFullyQualifiedId.html +0 -2
- package/typedoc/variables/echo.parseId.html +0 -1
- package/typedoc/variables/echo.refFromDXN.html +0 -2
- package/typedoc/variables/echo.toCursor.html +0 -1
- package/typedoc/variables/echo.toCursorRange.html +0 -1
- package/typedoc/variables/echo.updateText.html +0 -6
- package/typedoc/variables/echo.useQuery.html +0 -2
- package/typedoc/variables/index.AgentHostingContext.html +0 -1
- package/typedoc/variables/index.ClientProvider.html +0 -3
- package/typedoc/variables/index.DXOS_VERSION.html +0 -1
- package/typedoc/variables/index.Defaults.html +0 -2
- package/typedoc/variables/index.Dynamics.html +0 -2
- package/typedoc/variables/index.Envs.html +0 -2
- package/typedoc/variables/index.Local.html +0 -2
- package/typedoc/variables/index.Remote.html +0 -1
- package/typedoc/variables/index.Storage.html +0 -2
- package/typedoc/variables/index.createClientServices.html +0 -4
- package/typedoc/variables/index.fromAgent.html +0 -2
- package/typedoc/variables/index.fromHost.html +0 -2
- package/typedoc/variables/index.fromSocket.html +0 -2
- package/typedoc/variables/index.fromWorker.html +0 -2
- package/typedoc/variables/index.getUnixSocket.html +0 -1
- package/typedoc/variables/index.resolveRef.html +0 -1
- package/typedoc/variables/index.useMulticastObservable.html +0 -3
- package/typedoc/variables/worker.getWorkerServiceHost.html +0 -1
- package/typedoc/variables/worker.onconnect.html +0 -1
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
|
|
3
|
-
//
|
|
3
|
+
// src/client/AgentHostingProvider.tsx
|
|
4
4
|
import React2, { createContext as createContext2, useContext as useContext4, useState as useState4 } from "react";
|
|
5
5
|
import { AgentManagerClient, FakeAgentHostingProvider } from "@dxos/client";
|
|
6
6
|
import { log as log2 } from "@dxos/log";
|
|
7
7
|
|
|
8
|
-
//
|
|
8
|
+
// src/client/ClientProvider.tsx
|
|
9
9
|
import React, { forwardRef, useEffect, useImperativeHandle, useState } from "react";
|
|
10
10
|
import { Client, SystemStatus } from "@dxos/client";
|
|
11
11
|
import { registerSignalsRuntime } from "@dxos/echo-signals/react";
|
|
12
12
|
import { log } from "@dxos/log";
|
|
13
|
-
import { useControlledState } from "@dxos/react-hooks";
|
|
13
|
+
import { useAsyncEffect, useControlledState } from "@dxos/react-hooks";
|
|
14
14
|
import { getAsyncProviderValue } from "@dxos/util";
|
|
15
15
|
|
|
16
|
-
//
|
|
17
|
-
import { createContext } from "react";
|
|
18
|
-
var ClientContext = createContext(void 0);
|
|
19
|
-
|
|
20
|
-
// packages/sdk/react-client/src/banner.ts
|
|
16
|
+
// src/banner.ts
|
|
21
17
|
var BANNER = (client) => {
|
|
22
18
|
const commitHash = client.config.get("runtime.app.build.commitHash");
|
|
23
19
|
const hash = commitHash ? ` App Commit ${commitHash}
|
|
@@ -41,9 +37,13 @@ var printBanner = (client) => {
|
|
|
41
37
|
console.log(`%c${BANNER(client)}`, "font-family: monospace;");
|
|
42
38
|
};
|
|
43
39
|
|
|
44
|
-
//
|
|
45
|
-
|
|
46
|
-
var
|
|
40
|
+
// src/client/context.ts
|
|
41
|
+
import { createContext } from "react";
|
|
42
|
+
var ClientContext = createContext(void 0);
|
|
43
|
+
|
|
44
|
+
// src/client/ClientProvider.tsx
|
|
45
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/react-client/src/client/ClientProvider.tsx";
|
|
46
|
+
var ClientProvider = /* @__PURE__ */ forwardRef(({ children, config: configParam, client: clientParam, services: servicesParam, status: statusParam, fallback: Fallback = () => null, signalsRuntime = true, noBanner, onInitialized, ...options }, forwardedRef) => {
|
|
47
47
|
useEffect(() => {
|
|
48
48
|
signalsRuntime && registerSignalsRuntime();
|
|
49
49
|
}, []);
|
|
@@ -51,11 +51,11 @@ var ClientProvider = /* @__PURE__ */ forwardRef(({ children, config: configProvi
|
|
|
51
51
|
if (error) {
|
|
52
52
|
throw error;
|
|
53
53
|
}
|
|
54
|
-
const [client, setClient] = useState(
|
|
54
|
+
const [client, setClient] = useState(clientParam instanceof Client ? clientParam : void 0);
|
|
55
55
|
useImperativeHandle(forwardedRef, () => client, [
|
|
56
56
|
client
|
|
57
57
|
]);
|
|
58
|
-
const [status, setStatus] = useControlledState(
|
|
58
|
+
const [status, setStatus] = useControlledState(statusParam);
|
|
59
59
|
useEffect(() => {
|
|
60
60
|
if (!client) {
|
|
61
61
|
return;
|
|
@@ -65,7 +65,7 @@ var ClientProvider = /* @__PURE__ */ forwardRef(({ children, config: configProvi
|
|
|
65
65
|
}, [
|
|
66
66
|
client
|
|
67
67
|
]);
|
|
68
|
-
|
|
68
|
+
useAsyncEffect(async () => {
|
|
69
69
|
let disposed = false;
|
|
70
70
|
const initialize = async (client3) => {
|
|
71
71
|
if (!client3.initialized) {
|
|
@@ -76,14 +76,14 @@ var ClientProvider = /* @__PURE__ */ forwardRef(({ children, config: configProvi
|
|
|
76
76
|
});
|
|
77
77
|
log("client ready", void 0, {
|
|
78
78
|
F: __dxlog_file,
|
|
79
|
-
L:
|
|
79
|
+
L: 138,
|
|
80
80
|
S: void 0,
|
|
81
81
|
C: (f, a) => f(...a)
|
|
82
82
|
});
|
|
83
83
|
await onInitialized?.(client3);
|
|
84
84
|
log("initialization complete", void 0, {
|
|
85
85
|
F: __dxlog_file,
|
|
86
|
-
L:
|
|
86
|
+
L: 140,
|
|
87
87
|
S: void 0,
|
|
88
88
|
C: (f, a) => f(...a)
|
|
89
89
|
});
|
|
@@ -94,83 +94,80 @@ var ClientProvider = /* @__PURE__ */ forwardRef(({ children, config: configProvi
|
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
let client2;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
await initialize(client2);
|
|
133
|
-
}
|
|
134
|
-
} catch (err) {
|
|
135
|
-
if (!disposed) {
|
|
136
|
-
log.catch(err, void 0, {
|
|
137
|
-
F: __dxlog_file,
|
|
138
|
-
L: 168,
|
|
139
|
-
S: void 0,
|
|
140
|
-
C: (f, a) => f(...a)
|
|
141
|
-
});
|
|
142
|
-
}
|
|
97
|
+
try {
|
|
98
|
+
if (clientParam) {
|
|
99
|
+
client2 = await getAsyncProviderValue(clientParam);
|
|
100
|
+
await initialize(client2);
|
|
101
|
+
} else {
|
|
102
|
+
const config = await getAsyncProviderValue(configParam);
|
|
103
|
+
log("resolved config", {
|
|
104
|
+
config
|
|
105
|
+
}, {
|
|
106
|
+
F: __dxlog_file,
|
|
107
|
+
L: 158,
|
|
108
|
+
S: void 0,
|
|
109
|
+
C: (f, a) => f(...a)
|
|
110
|
+
});
|
|
111
|
+
const services = await getAsyncProviderValue(servicesParam, config);
|
|
112
|
+
log("created services", {
|
|
113
|
+
services
|
|
114
|
+
}, {
|
|
115
|
+
F: __dxlog_file,
|
|
116
|
+
L: 160,
|
|
117
|
+
S: void 0,
|
|
118
|
+
C: (f, a) => f(...a)
|
|
119
|
+
});
|
|
120
|
+
client2 = new Client({
|
|
121
|
+
config,
|
|
122
|
+
services,
|
|
123
|
+
...options
|
|
124
|
+
});
|
|
125
|
+
log("created client", void 0, {
|
|
126
|
+
F: __dxlog_file,
|
|
127
|
+
L: 162,
|
|
128
|
+
S: void 0,
|
|
129
|
+
C: (f, a) => f(...a)
|
|
130
|
+
});
|
|
131
|
+
await initialize(client2);
|
|
143
132
|
}
|
|
144
|
-
})
|
|
133
|
+
} catch (err) {
|
|
134
|
+
if (!disposed) {
|
|
135
|
+
log.catch(err, void 0, {
|
|
136
|
+
F: __dxlog_file,
|
|
137
|
+
L: 167,
|
|
138
|
+
S: void 0,
|
|
139
|
+
C: (f, a) => f(...a)
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
145
143
|
return () => {
|
|
146
144
|
log("clean up", void 0, {
|
|
147
145
|
F: __dxlog_file,
|
|
148
|
-
L:
|
|
146
|
+
L: 172,
|
|
149
147
|
S: void 0,
|
|
150
148
|
C: (f, a) => f(...a)
|
|
151
149
|
});
|
|
152
150
|
disposed = true;
|
|
153
|
-
|
|
154
|
-
if (!clientProvider) {
|
|
151
|
+
if (!clientParam) {
|
|
155
152
|
void client2?.destroy().then(() => {
|
|
156
153
|
log("destroyed", void 0, {
|
|
157
154
|
F: __dxlog_file,
|
|
158
|
-
L:
|
|
155
|
+
L: 179,
|
|
159
156
|
S: void 0,
|
|
160
157
|
C: (f, a) => f(...a)
|
|
161
158
|
});
|
|
162
159
|
}).catch((err) => log.catch(err, void 0, {
|
|
163
160
|
F: __dxlog_file,
|
|
164
|
-
L:
|
|
161
|
+
L: 181,
|
|
165
162
|
S: void 0,
|
|
166
163
|
C: (f, a) => f(...a)
|
|
167
164
|
}));
|
|
168
165
|
}
|
|
169
166
|
};
|
|
170
167
|
}, [
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
168
|
+
configParam,
|
|
169
|
+
clientParam,
|
|
170
|
+
servicesParam,
|
|
174
171
|
noBanner
|
|
175
172
|
]);
|
|
176
173
|
if (!client?.initialized || status !== SystemStatus.ACTIVE) {
|
|
@@ -187,7 +184,7 @@ var ClientProvider = /* @__PURE__ */ forwardRef(({ children, config: configProvi
|
|
|
187
184
|
}, children);
|
|
188
185
|
});
|
|
189
186
|
|
|
190
|
-
//
|
|
187
|
+
// src/client/useClient.ts
|
|
191
188
|
import { useContext } from "react";
|
|
192
189
|
import { raise } from "@dxos/debug";
|
|
193
190
|
var useClient = () => {
|
|
@@ -195,7 +192,7 @@ var useClient = () => {
|
|
|
195
192
|
return client;
|
|
196
193
|
};
|
|
197
194
|
|
|
198
|
-
//
|
|
195
|
+
// src/client/useClientStatus.ts
|
|
199
196
|
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
200
197
|
var useClientStatus = (client) => {
|
|
201
198
|
const [status, setStatus] = useState2();
|
|
@@ -212,7 +209,7 @@ var useClientStatus = (client) => {
|
|
|
212
209
|
return status;
|
|
213
210
|
};
|
|
214
211
|
|
|
215
|
-
//
|
|
212
|
+
// src/client/useConfig.ts
|
|
216
213
|
import { useContext as useContext2 } from "react";
|
|
217
214
|
import { raise as raise2 } from "@dxos/debug";
|
|
218
215
|
var useConfig = () => {
|
|
@@ -220,7 +217,7 @@ var useConfig = () => {
|
|
|
220
217
|
return client.config;
|
|
221
218
|
};
|
|
222
219
|
|
|
223
|
-
//
|
|
220
|
+
// src/client/useShell.ts
|
|
224
221
|
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
225
222
|
var useShell = () => {
|
|
226
223
|
const client = useClient();
|
|
@@ -235,7 +232,7 @@ var useShellDisplay = () => {
|
|
|
235
232
|
return display;
|
|
236
233
|
};
|
|
237
234
|
|
|
238
|
-
//
|
|
235
|
+
// src/client/useStatus.ts
|
|
239
236
|
import { useContext as useContext3 } from "react";
|
|
240
237
|
import { raise as raise3 } from "@dxos/debug";
|
|
241
238
|
var useStatus = () => {
|
|
@@ -243,8 +240,8 @@ var useStatus = () => {
|
|
|
243
240
|
return status;
|
|
244
241
|
};
|
|
245
242
|
|
|
246
|
-
//
|
|
247
|
-
var __dxlog_file2 = "/
|
|
243
|
+
// src/client/AgentHostingProvider.tsx
|
|
244
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/react-client/src/client/AgentHostingProvider.tsx";
|
|
248
245
|
var AgentHostingContext = /* @__PURE__ */ createContext2(null);
|
|
249
246
|
var AgentHostingProvider = (props) => {
|
|
250
247
|
const client = useClient();
|
|
@@ -311,4 +308,4 @@ export {
|
|
|
311
308
|
useShellDisplay,
|
|
312
309
|
useStatus
|
|
313
310
|
};
|
|
314
|
-
//# sourceMappingURL=chunk-
|
|
311
|
+
//# sourceMappingURL=chunk-ZJMNF7GC.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/client/AgentHostingProvider.tsx", "../../../src/client/ClientProvider.tsx", "../../../src/banner.ts", "../../../src/client/context.ts", "../../../src/client/useClient.ts", "../../../src/client/useClientStatus.ts", "../../../src/client/useConfig.ts", "../../../src/client/useShell.ts", "../../../src/client/useStatus.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type PropsWithChildren, createContext, useContext, useState } from 'react';\n\nimport { type AgentHostingProviderClient, AgentManagerClient, FakeAgentHostingProvider } from '@dxos/client';\nimport { type Halo } from '@dxos/client/halo';\nimport { type Config } from '@dxos/config';\nimport { log } from '@dxos/log';\n\nimport { useClient } from '../client';\n\nexport type AgentHostingProviderProps = { config: Config; halo: Halo };\n\nexport const AgentHostingContext = createContext<AgentHostingProviderClient | null>(null);\n\n/**\n * Experimental agent hosting provider.\n * @param props\n * @constructor\n * @deprecated\n */\nexport const AgentHostingProvider = (props: PropsWithChildren) => {\n const client = useClient();\n const [agentHostingProviderClient] = useState(makeClient(client));\n return (\n <AgentHostingContext.Provider value={agentHostingProviderClient}> {props.children}</AgentHostingContext.Provider>\n );\n};\n\nexport const useAgentHostingClient = () => {\n return useContext(AgentHostingContext);\n};\n\nconst makeClient = ({ config, halo }: AgentHostingProviderProps) => {\n const agentHostingConfig = config.get('runtime.services.agentHosting');\n if (!agentHostingConfig) {\n log('no agent hosting configured');\n return null;\n }\n\n // TODO(nf): Dynamically discover based on runtime config.\n let agentHostingProviderClient: AgentHostingProviderClient | null = null;\n switch (agentHostingConfig.type) {\n case 'LOCAL_TESTING': {\n log('using FakeAgentHostingProvider');\n return new FakeAgentHostingProvider();\n }\n\n case 'AGENTHOSTING_API': {\n agentHostingProviderClient = new AgentManagerClient(config, halo);\n if (agentHostingProviderClient.init()) {\n return agentHostingProviderClient;\n } else {\n // Not authorized or error initializing.\n return null;\n }\n }\n\n default: {\n log.error('Unknown agent hosting provider type: ' + agentHostingConfig.type);\n return null;\n }\n }\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport React, {\n type FunctionComponent,\n type PropsWithChildren,\n forwardRef,\n useEffect,\n useImperativeHandle,\n useState,\n} from 'react';\n\nimport { Client, type ClientOptions, type ClientServicesProvider, SystemStatus } from '@dxos/client';\nimport { type Config } from '@dxos/config';\nimport { registerSignalsRuntime } from '@dxos/echo-signals/react';\nimport { log } from '@dxos/log';\nimport { useAsyncEffect, useControlledState } from '@dxos/react-hooks';\nimport { type MaybePromise, type Provider, getAsyncProviderValue } from '@dxos/util';\n\nimport { printBanner } from '../banner';\n\nimport { ClientContext, type ClientContextProps } from './context';\n\n/**\n * Properties for the ClientProvider.\n */\nexport type ClientProviderProps = Omit<ClientOptions, 'config' | 'services'> &\n Pick<ClientContextProps, 'status'> &\n PropsWithChildren<{\n /**\n * Client object or async provider to enable to caller to do custom initialization.\n *\n * NOTE: For advanced use cases only.\n */\n client?: Client | Provider<Promise<Client>>;\n\n /**\n * Config object or async provider.\n *\n * NOTE: If a `client` is provided then `config` is ignored.\n */\n // TODO(burdon): Reconcile with ClientOptions.\n config?: Config | Provider<Promise<Config>>;\n\n /**\n * Callback to enable the caller to create a custom ClientServicesProvider.\n *\n * NOTE: If a `client` is provided then `services` is ignored.\n */\n // TODO(burdon): Reconcile with ClientOptions.\n services?: ClientServicesProvider | ((config?: Config) => MaybePromise<ClientServicesProvider>);\n\n /**\n * ReactNode to display until the client is available.\n */\n fallback?: FunctionComponent<Partial<ClientContextProps>>;\n\n /**\n * Enable (by default) registration of Preact signals runtime for reactive ECHO objects.\n * @see https://www.npmjs.com/package/@preact/signals-react\n */\n signalsRuntime?: boolean;\n\n /**\n * Skip the DXOS banner.\n */\n noBanner?: boolean;\n\n /**\n * Post initialization hook to enable to caller to do custom initialization.\n */\n onInitialized?: (client: Client) => MaybePromise<void>;\n }>;\n\n/**\n * Root component that provides the DXOS client instance to child components.\n * To be used with the `useClient` hook.\n */\nexport const ClientProvider = forwardRef<Client | undefined, ClientProviderProps>(\n (\n {\n children,\n config: configParam,\n client: clientParam,\n services: servicesParam,\n status: statusParam,\n fallback: Fallback = () => null,\n signalsRuntime = true,\n noBanner,\n onInitialized,\n ...options\n },\n forwardedRef,\n ) => {\n useEffect(() => {\n // TODO(wittjosiah): Ideally this should be imported asynchronously because it is optional.\n // Unfortunately, async import seemed to break signals React instrumentation.\n signalsRuntime && registerSignalsRuntime();\n }, []);\n\n // The client is initialized asynchronously.\n // If an error occurs during initialization, it is caught and the state is set.\n // This allows the error to be thrown in the render method.\n // The assumption is that a client initialization error is fatal to the app.\n // This error will be caught by the nearest error boundary.\n const [error, setError] = useState();\n if (error) {\n throw error;\n }\n\n const [client, setClient] = useState(clientParam instanceof Client ? clientParam : undefined);\n\n // Provide external access.\n useImperativeHandle(forwardedRef, () => client, [client]);\n\n // Client status subscription.\n const [status, setStatus] = useControlledState(statusParam);\n useEffect(() => {\n if (!client) {\n return;\n }\n\n const subscription = client.status.subscribe((status) => setStatus(status));\n return () => subscription.unsubscribe();\n }, [client]);\n\n // Create and/or initialize client.\n useAsyncEffect(async () => {\n let disposed = false;\n const initialize = async (client: Client) => {\n if (!client.initialized) {\n await client.initialize().catch((err) => {\n if (!disposed) {\n setError(err);\n }\n });\n log('client ready');\n await onInitialized?.(client);\n log('initialization complete');\n }\n\n setClient(client);\n if (!noBanner) {\n printBanner(client);\n }\n };\n\n let client: Client;\n try {\n if (clientParam) {\n // Asynchronously request client.\n client = await getAsyncProviderValue(clientParam);\n await initialize(client);\n } else {\n // Asynchronously construct client (config may be undefined).\n const config = await getAsyncProviderValue(configParam);\n log('resolved config', { config });\n const services = await getAsyncProviderValue(servicesParam, config);\n log('created services', { services });\n client = new Client({ config, services, ...options });\n log('created client');\n await initialize(client);\n }\n } catch (err) {\n if (!disposed) {\n log.catch(err);\n }\n }\n\n return () => {\n log('clean up');\n disposed = true;\n // Only destroy if the client is not provided by the parent.\n if (!clientParam) {\n void client\n ?.destroy()\n .then(() => {\n log('destroyed');\n })\n .catch((err) => log.catch(err));\n }\n };\n }, [configParam, clientParam, servicesParam, noBanner]);\n\n if (!client?.initialized || status !== SystemStatus.ACTIVE) {\n return <Fallback client={client} status={status} />;\n }\n\n return <ClientContext.Provider value={{ client, status }}>{children}</ClientContext.Provider>;\n },\n);\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport { type Client } from '@dxos/client';\n\n// http://patorjk.com/software/taag/#p=testall&f=Patorjk-HeX&t=DXOS\nconst BANNER = (client: Client) => {\n const commitHash = client.config.get('runtime.app.build.commitHash');\n const hash = commitHash ? ` App Commit ${commitHash} \\n` : '';\n\n return (\n '\\n' +\n '_/\\\\/\\\\/\\\\/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\/\\\\/\\\\______/\\\\/\\\\/\\\\/\\\\/\\\\_\\n' +\n '_/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\__/\\\\/\\\\_________\\n' +\n '_/\\\\/\\\\____/\\\\/\\\\______/\\\\/\\\\______/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\/\\\\/\\\\___\\n' +\n '_/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\__________/\\\\/\\\\_\\n' +\n '_/\\\\/\\\\/\\\\/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\/\\\\/\\\\____/\\\\/\\\\/\\\\/\\\\/\\\\___\\n' +\n `\\n DXOS Client ${client.version} \\n${hash}`\n );\n};\n\nlet bannerPrinted = false;\n\nexport const printBanner = (client: Client) => {\n if (bannerPrinted || window.location.hostname === 'localhost') {\n return;\n }\n\n bannerPrinted = true;\n // eslint-disable-next-line no-console\n console.log(`%c${BANNER(client)}`, 'font-family: monospace;');\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { type Context, createContext } from 'react';\n\nimport { type Client, type SystemStatus } from '@dxos/client';\n\nexport type ClientContextProps = {\n client: Client;\n status?: SystemStatus | null;\n};\n\n/**\n * @internal Use ClientProvider to create or initialize the Client.\n */\nexport const ClientContext: Context<ClientContextProps | undefined> = createContext<ClientContextProps | undefined>(\n undefined,\n);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { ClientContext } from '../client/context';\n\n/**\n * Hook returning instance of DXOS client.\n * Requires ClientContext to be set via ClientProvider.\n */\nexport const useClient = () => {\n const { client } = useContext(ClientContext) ?? raise(new Error('Missing ClientContext.'));\n return client;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { useEffect, useState } from 'react';\n\nimport { type Client, type SystemStatus } from '@dxos/client';\n\nexport const useClientStatus = (client: Client) => {\n const [status, setStatus] = useState<SystemStatus | null>();\n useEffect(() => {\n if (!client) {\n return;\n }\n\n const subscription = client.status.subscribe((status) => setStatus(status));\n return () => subscription.unsubscribe();\n }, [client, setStatus]);\n\n return status;\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { ClientContext } from './context';\n\n/**\n * Hook returning config object used to initialize the DXOS client instance.\n * Requires ClientContext to be set via ClientProvider.\n */\nexport const useConfig = () => {\n const { client } = useContext(ClientContext) ?? raise(new Error('Missing ClientContext.'));\n return client.config;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useEffect, useState } from 'react';\n\nimport { type Shell, type ShellDisplay } from '@dxos/client';\n\nimport { useClient } from './useClient';\n\n/**\n * Helper hook to access the shell.\n */\nexport const useShell = (): Shell => {\n const client = useClient();\n return client.shell;\n};\n\n/**\n * Hook to access the shell’s display state.\n */\nexport const useShellDisplay = (): ShellDisplay => {\n const client = useClient();\n const [display, setDisplay] = useState(client.shell.display);\n useEffect(() => client.shell.onDisplayChange(setDisplay), [client]);\n return display;\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { useContext } from 'react';\n\nimport { type SystemStatus } from '@dxos/client';\nimport { raise } from '@dxos/debug';\n\nimport { ClientContext } from './context';\n\nexport const useStatus = (): SystemStatus | null | undefined => {\n const { status } = useContext(ClientContext) ?? raise(new Error('Missing ClientContext.'));\n return status;\n};\n"],
|
|
5
|
+
"mappings": ";;;AAIA,OAAOA,UAAiCC,iBAAAA,gBAAeC,cAAAA,aAAYC,YAAA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BiB,KAAI,GAAI;AACrC,eAAOjB;MACT,OAAO;AAEL,eAAO;MACT;IACF;IAEA,SAAS;AACPa,MAAAA,KAAIK,MAAM,0CAA0CP,mBAAmBG,MAAI,QAAA;;;;;;AAC3E,aAAO;IACT;EACF;AACF;",
|
|
6
|
+
"names": ["React", "createContext", "useContext", "useState", "AgentManagerClient", "FakeAgentHostingProvider", "log", "React", "forwardRef", "useEffect", "useImperativeHandle", "useState", "Client", "SystemStatus", "registerSignalsRuntime", "log", "useAsyncEffect", "useControlledState", "getAsyncProviderValue", "BANNER", "client", "commitHash", "config", "get", "hash", "version", "bannerPrinted", "printBanner", "window", "location", "hostname", "console", "log", "createContext", "ClientContext", "createContext", "undefined", "ClientProvider", "forwardRef", "children", "config", "configParam", "client", "clientParam", "services", "servicesParam", "status", "statusParam", "fallback", "Fallback", "signalsRuntime", "noBanner", "onInitialized", "options", "forwardedRef", "useEffect", "registerSignalsRuntime", "error", "setError", "useState", "setClient", "Client", "undefined", "useImperativeHandle", "setStatus", "useControlledState", "subscription", "subscribe", "unsubscribe", "useAsyncEffect", "disposed", "initialize", "initialized", "catch", "err", "log", "printBanner", "getAsyncProviderValue", "destroy", "then", "SystemStatus", "ACTIVE", "ClientContext", "Provider", "value", "useContext", "raise", "useClient", "client", "useContext", "ClientContext", "raise", "Error", "useEffect", "useState", "useClientStatus", "client", "status", "setStatus", "useState", "useEffect", "subscription", "subscribe", "unsubscribe", "useContext", "raise", "useConfig", "client", "useContext", "ClientContext", "raise", "Error", "config", "useEffect", "useState", "useShell", "client", "useClient", "shell", "useShellDisplay", "display", "setDisplay", "useState", "useEffect", "onDisplayChange", "useContext", "raise", "useStatus", "status", "useContext", "ClientContext", "raise", "Error", "AgentHostingContext", "createContext", "AgentHostingProvider", "props", "client", "useClient", "agentHostingProviderClient", "useState", "makeClient", "React", "Provider", "value", "children", "useAgentHostingClient", "useContext", "config", "halo", "agentHostingConfig", "get", "log", "type", "FakeAgentHostingProvider", "AgentManagerClient", "init", "error"]
|
|
7
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
useClient
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-ZJMNF7GC.mjs";
|
|
5
5
|
|
|
6
|
-
//
|
|
6
|
+
// src/devtools/index.ts
|
|
7
7
|
export * from "@dxos/client/devtools";
|
|
8
8
|
|
|
9
|
-
//
|
|
9
|
+
// src/devtools/useDevtools.ts
|
|
10
10
|
import { raise } from "@dxos/debug";
|
|
11
11
|
var useDevtools = () => {
|
|
12
12
|
const client = useClient();
|
|
13
13
|
return client.services.services.DevtoolsHost ?? raise(new Error("DevtoolsHost not available."));
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
//
|
|
17
|
-
import {
|
|
16
|
+
// src/devtools/useStream.ts
|
|
17
|
+
import { useEffect, useState } from "react";
|
|
18
18
|
import { log } from "@dxos/log";
|
|
19
|
-
var __dxlog_file = "/
|
|
19
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/react-client/src/devtools/useStream.ts";
|
|
20
20
|
var useStream = (streamFactory, defaultValue, deps = []) => {
|
|
21
21
|
const [value, setValue] = useState(defaultValue);
|
|
22
22
|
useEffect(() => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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,
|
|
5
|
-
"mappings": ";;;;;;AAIA,cAAc;;;ACCd,SAASA,aAAa;AAIf,IAAMC,cAAc,MAAA;AACzB,QAAMC,SAASC,UAAAA;AACf,SAAOD,OAAOE,SAASA,SAASC,gBAAgBC,MAAM,IAAIC,MAAM,6BAAA,CAAA;AAClE;;;ACRA,SAA8BC,
|
|
6
|
-
"names": ["raise", "useDevtools", "client", "useClient", "services", "DevtoolsHost", "raise", "Error", "
|
|
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, useEffect, useState } 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,cAAc;;;ACCd,SAASA,aAAa;AAIf,IAAMC,cAAc,MAAA;AACzB,QAAMC,SAASC,UAAAA;AACf,SAAOD,OAAOE,SAASA,SAASC,gBAAgBC,MAAM,IAAIC,MAAM,6BAAA,CAAA;AAClE;;;ACRA,SAA8BC,WAAWC,gBAAgB;AAGzD,SAASC,WAAW;;AAKb,IAAMC,YAAY,CAAIC,eAAgCC,cAAiBC,OAAuB,CAAA,MAAE;AACrG,QAAM,CAACC,OAAOC,QAAAA,IAAYP,SAAwBI,YAAAA;AAClDL,YAAU,MAAA;AACR,UAAMS,SAASL,cAAAA;AACfK,WAAOC,UACL,CAACC,aAAgBH,SAASG,QAAAA,GAC1B,CAACC,QAAAA;AACC,UAAIA,KAAK;AACPV,YAAIW,MAAMD,KAAAA,QAAAA;;;;;;MACZ;IACF,CAAA;AAGF,WAAO,MAAA;AACL,WAAKH,OAAOK,MAAK;IACnB;EACF,GAAGR,IAAAA;AAEH,SAAOC,SAASF;AAClB;",
|
|
6
|
+
"names": ["raise", "useDevtools", "client", "useClient", "services", "DevtoolsHost", "raise", "Error", "useEffect", "useState", "log", "useStream", "streamFactory", "defaultValue", "deps", "value", "setValue", "stream", "subscribe", "response", "err", "catch", "close"]
|
|
7
7
|
}
|
|
@@ -1,36 +1,33 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
useInvitationStatus
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-256IHY6F.mjs";
|
|
5
5
|
import {
|
|
6
6
|
useClient
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-ZJMNF7GC.mjs";
|
|
8
8
|
|
|
9
|
-
//
|
|
9
|
+
// src/echo/index.ts
|
|
10
10
|
export * from "@dxos/client/echo";
|
|
11
11
|
|
|
12
|
-
//
|
|
12
|
+
// src/echo/useMembers.ts
|
|
13
13
|
import { MulticastObservable } from "@dxos/async";
|
|
14
14
|
import { HaloSpaceMember } from "@dxos/client/echo";
|
|
15
15
|
import { useMulticastObservable as useMulticastObservable2 } from "@dxos/react-hooks";
|
|
16
16
|
|
|
17
|
-
//
|
|
18
|
-
import {
|
|
17
|
+
// src/echo/useSpaces.ts
|
|
18
|
+
import { useState } from "react";
|
|
19
19
|
import { SpaceState } from "@dxos/client/echo";
|
|
20
|
-
import { useMulticastObservable } from "@dxos/react-hooks";
|
|
20
|
+
import { useAsyncEffect, useMulticastObservable } from "@dxos/react-hooks";
|
|
21
21
|
var useSpace = (spaceKeyLike) => {
|
|
22
22
|
const client = useClient();
|
|
23
23
|
const spaces = useMulticastObservable(client.spaces);
|
|
24
24
|
const [ready, setReady] = useState(false);
|
|
25
|
-
|
|
25
|
+
useAsyncEffect(async () => {
|
|
26
26
|
if (spaceKeyLike) {
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
setReady(true);
|
|
32
|
-
});
|
|
33
|
-
return () => clearTimeout(timeout);
|
|
29
|
+
await client.spaces.waitUntilReady();
|
|
30
|
+
setReady(true);
|
|
34
31
|
}, [
|
|
35
32
|
client,
|
|
36
33
|
spaceKeyLike
|
|
@@ -48,7 +45,7 @@ var useSpaces = ({ all = false } = {}) => {
|
|
|
48
45
|
return spaces.filter((space) => all || space.state.get() === SpaceState.SPACE_READY);
|
|
49
46
|
};
|
|
50
47
|
|
|
51
|
-
//
|
|
48
|
+
// src/echo/useMembers.ts
|
|
52
49
|
var useMembers = (spaceKey) => {
|
|
53
50
|
const spaces = useSpaces({
|
|
54
51
|
all: true
|
|
@@ -58,7 +55,7 @@ var useMembers = (spaceKey) => {
|
|
|
58
55
|
return members.filter((member) => member.role !== HaloSpaceMember.Role.REMOVED);
|
|
59
56
|
};
|
|
60
57
|
|
|
61
|
-
//
|
|
58
|
+
// src/echo/useQuery.ts
|
|
62
59
|
import { useMemo, useSyncExternalStore } from "react";
|
|
63
60
|
import { Filter, Query, isSpace } from "@dxos/client/echo";
|
|
64
61
|
var EMPTY_ARRAY = [];
|
|
@@ -89,8 +86,8 @@ var useQuery = (spaceOrEcho, queryOrFilter, deps) => {
|
|
|
89
86
|
return objects ?? [];
|
|
90
87
|
};
|
|
91
88
|
|
|
92
|
-
//
|
|
93
|
-
import { useEffect
|
|
89
|
+
// src/echo/useQueue.ts
|
|
90
|
+
import { useEffect, useMemo as useMemo2, useRef } from "react";
|
|
94
91
|
import { raise } from "@dxos/debug";
|
|
95
92
|
var MIN_POLL_INTERVAL = 1e3;
|
|
96
93
|
var useQueue = (queueDxn, options = {}) => {
|
|
@@ -106,12 +103,12 @@ var useQueue = (queueDxn, options = {}) => {
|
|
|
106
103
|
client,
|
|
107
104
|
queueDxn?.toString()
|
|
108
105
|
]);
|
|
109
|
-
|
|
106
|
+
useEffect(() => {
|
|
110
107
|
void queue?.refresh();
|
|
111
108
|
}, [
|
|
112
109
|
queue
|
|
113
110
|
]);
|
|
114
|
-
|
|
111
|
+
useEffect(() => {
|
|
115
112
|
let timeout;
|
|
116
113
|
mountedRef.current = true;
|
|
117
114
|
const poll = () => {
|
|
@@ -138,7 +135,7 @@ var useQueue = (queueDxn, options = {}) => {
|
|
|
138
135
|
return queue;
|
|
139
136
|
};
|
|
140
137
|
|
|
141
|
-
//
|
|
138
|
+
// src/echo/useSchema.ts
|
|
142
139
|
import { useMemo as useMemo3, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
143
140
|
var useSchema = (client, space, typename) => {
|
|
144
141
|
const { subscribe, getSchema } = useMemo3(() => {
|
|
@@ -179,7 +176,7 @@ var useSchema = (client, space, typename) => {
|
|
|
179
176
|
return useSyncExternalStore2(subscribe, getSchema);
|
|
180
177
|
};
|
|
181
178
|
|
|
182
|
-
//
|
|
179
|
+
// src/echo/useSpaceInvitations.ts
|
|
183
180
|
import { useMemo as useMemo4 } from "react";
|
|
184
181
|
import { MulticastObservable as MulticastObservable2 } from "@dxos/async";
|
|
185
182
|
import { useMulticastObservable as useMulticastObservable3 } from "@dxos/react-hooks";
|
|
@@ -195,14 +192,14 @@ var useSpaceInvitation = (spaceKey, invitationId) => {
|
|
|
195
192
|
return useInvitationStatus(invitation);
|
|
196
193
|
};
|
|
197
194
|
|
|
198
|
-
//
|
|
199
|
-
import { useEffect as
|
|
195
|
+
// src/echo/useSubscription.ts
|
|
196
|
+
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
200
197
|
import { createSubscription } from "@dxos/client/echo";
|
|
201
198
|
var useSubscription = (cb, selection) => {
|
|
202
199
|
const callbackRef = useRef2(cb);
|
|
203
200
|
callbackRef.current = cb;
|
|
204
201
|
const subscriptionRef = useRef2();
|
|
205
|
-
|
|
202
|
+
useEffect2(() => {
|
|
206
203
|
subscriptionRef.current = createSubscription(() => {
|
|
207
204
|
callbackRef.current();
|
|
208
205
|
});
|
|
@@ -212,16 +209,16 @@ var useSubscription = (cb, selection) => {
|
|
|
212
209
|
return subscriptionRef.current;
|
|
213
210
|
};
|
|
214
211
|
|
|
215
|
-
//
|
|
216
|
-
import { useEffect as
|
|
212
|
+
// src/echo/useSyncState.ts
|
|
213
|
+
import { useEffect as useEffect3, useState as useState2 } from "react";
|
|
217
214
|
import { Context } from "@dxos/context";
|
|
218
215
|
import { EdgeService } from "@dxos/protocols";
|
|
219
|
-
var __dxlog_file = "/
|
|
216
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/react-client/src/echo/useSyncState.ts";
|
|
220
217
|
var isEdgePeerId = (peerId, spaceId) => peerId.startsWith(`${EdgeService.AUTOMERGE_REPLICATOR}:${spaceId}`);
|
|
221
218
|
var useSyncState = () => {
|
|
222
219
|
const client = useClient();
|
|
223
220
|
const [spaceState, setSpaceState] = useState2({});
|
|
224
|
-
|
|
221
|
+
useEffect3(() => {
|
|
225
222
|
const ctx = new Context(void 0, {
|
|
226
223
|
F: __dxlog_file,
|
|
227
224
|
L: 25
|
|
@@ -231,7 +228,7 @@ var useSyncState = () => {
|
|
|
231
228
|
if (spaceState[space.id]) {
|
|
232
229
|
continue;
|
|
233
230
|
}
|
|
234
|
-
ctx.onDispose(space.
|
|
231
|
+
ctx.onDispose(space.db.subscribeToSyncState(ctx, ({ peers = [] }) => {
|
|
235
232
|
const syncState = peers.find((state) => isEdgePeerId(state.peerId, space.id));
|
|
236
233
|
if (syncState) {
|
|
237
234
|
setSpaceState((spaceState2) => ({
|
|
@@ -256,12 +253,12 @@ var useSyncState = () => {
|
|
|
256
253
|
};
|
|
257
254
|
var useSpaceSyncState = (space) => {
|
|
258
255
|
const [spaceState, setSpaceState] = useState2();
|
|
259
|
-
|
|
256
|
+
useEffect3(() => {
|
|
260
257
|
const ctx = new Context(void 0, {
|
|
261
258
|
F: __dxlog_file,
|
|
262
259
|
L: 64
|
|
263
260
|
});
|
|
264
|
-
space.
|
|
261
|
+
space.db.subscribeToSyncState(ctx, ({ peers = [] }) => {
|
|
265
262
|
const syncState = peers.find((state) => isEdgePeerId(state.peerId, space.id));
|
|
266
263
|
if (syncState) {
|
|
267
264
|
setSpaceState(syncState);
|