@dxos/client 2.33.9-dev.bba8fc00 → 2.33.9-dev.ceab0857
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/dist/browser.js +1746 -2614
- package/dist/singleton/index.html +20 -0
- package/dist/singleton/main.js +121443 -0
- package/dist/singleton/main.js.map +7 -0
- package/dist/singleton/shared-worker.js +90426 -0
- package/dist/singleton/shared-worker.js.map +7 -0
- package/dist/src/client.d.ts +6 -0
- package/dist/src/client.d.ts.map +1 -0
- package/dist/src/client.js +24 -0
- package/dist/src/client.js.map +1 -0
- package/dist/src/{api/client.test.d.ts → client.test.d.ts} +0 -0
- package/dist/src/{api/client.test.d.ts.map → client.test.d.ts.map} +1 -1
- package/dist/src/{api/client.test.js → client.test.js} +4 -3
- package/dist/src/client.test.js.map +1 -0
- package/dist/src/index.d.ts +5 -6
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +8 -7
- package/dist/src/index.js.map +1 -1
- package/dist/src/{api/local.test.d.ts → local.test.d.ts} +0 -0
- package/dist/src/{api/local.test.d.ts.map → local.test.d.ts.map} +1 -1
- package/dist/src/{api/local.test.js → local.test.js} +0 -0
- package/dist/src/local.test.js.map +1 -0
- package/dist/src/{services → packlets/api}/client-service.d.ts +1 -2
- package/dist/src/packlets/api/client-service.d.ts.map +1 -0
- package/dist/src/{services → packlets/api}/client-service.js +7 -7
- package/dist/src/packlets/api/client-service.js.map +1 -0
- package/dist/src/packlets/api/echo.d.ts +62 -0
- package/dist/src/packlets/api/echo.d.ts.map +1 -0
- package/dist/src/packlets/api/echo.js +17 -0
- package/dist/src/packlets/api/echo.js.map +1 -0
- package/dist/src/{api → packlets/api}/errors.d.ts +0 -0
- package/dist/src/packlets/api/errors.d.ts.map +1 -0
- package/dist/src/{api → packlets/api}/errors.js +0 -0
- package/dist/src/packlets/api/errors.js.map +1 -0
- package/dist/src/packlets/api/halo.d.ts +37 -0
- package/dist/src/packlets/api/halo.d.ts.map +1 -0
- package/dist/src/packlets/api/halo.js +6 -0
- package/dist/src/packlets/api/halo.js.map +1 -0
- package/dist/src/packlets/api/index.d.ts +6 -0
- package/dist/src/packlets/api/index.d.ts.map +1 -0
- package/dist/src/{api → packlets/api}/index.js +3 -3
- package/dist/src/packlets/api/index.js.map +1 -0
- package/dist/src/packlets/api/invitations/index.d.ts +3 -0
- package/dist/src/packlets/api/invitations/index.d.ts.map +1 -0
- package/dist/src/{api → packlets/api}/invitations/index.js +2 -3
- package/dist/src/packlets/api/invitations/index.js.map +1 -0
- package/dist/src/{api → packlets/api}/invitations/invitation-request.d.ts +0 -0
- package/dist/src/packlets/api/invitations/invitation-request.d.ts.map +1 -0
- package/dist/src/{api → packlets/api}/invitations/invitation-request.js +0 -0
- package/dist/src/packlets/api/invitations/invitation-request.js.map +1 -0
- package/dist/src/{api → packlets/api}/invitations/invitation.d.ts +0 -0
- package/dist/src/packlets/api/invitations/invitation.d.ts.map +1 -0
- package/dist/src/{api → packlets/api}/invitations/invitation.js +1 -0
- package/dist/src/packlets/api/invitations/invitation.js.map +1 -0
- package/dist/src/{devtools → packlets/devtools}/config.d.ts +1 -1
- package/dist/src/packlets/devtools/config.d.ts.map +1 -0
- package/dist/src/{devtools → packlets/devtools}/config.js +0 -0
- package/dist/src/packlets/devtools/config.js.map +1 -0
- package/dist/src/{devtools → packlets/devtools}/debug-logging.d.ts +1 -1
- package/dist/src/packlets/devtools/debug-logging.d.ts.map +1 -0
- package/dist/src/{devtools → packlets/devtools}/debug-logging.js +0 -0
- package/dist/src/packlets/devtools/debug-logging.js.map +1 -0
- package/dist/src/{devtools → packlets/devtools}/devtools-context.d.ts +0 -8
- package/dist/src/packlets/devtools/devtools-context.d.ts.map +1 -0
- package/dist/src/{devtools → packlets/devtools}/devtools-context.js +0 -0
- package/dist/src/packlets/devtools/devtools-context.js.map +1 -0
- package/dist/src/{devtools → packlets/devtools}/devtools-host-events.d.ts +0 -0
- package/dist/src/packlets/devtools/devtools-host-events.d.ts.map +1 -0
- package/dist/src/{devtools → packlets/devtools}/devtools-host-events.js +0 -0
- package/dist/src/packlets/devtools/devtools-host-events.js.map +1 -0
- package/dist/src/{devtools → packlets/devtools}/devtools-host.d.ts +1 -1
- package/dist/src/packlets/devtools/devtools-host.d.ts.map +1 -0
- package/dist/src/{devtools → packlets/devtools}/devtools-host.js +0 -0
- package/dist/src/packlets/devtools/devtools-host.js.map +1 -0
- package/dist/src/{devtools → packlets/devtools}/feeds.d.ts +1 -1
- package/dist/src/packlets/devtools/feeds.d.ts.map +1 -0
- package/dist/src/{devtools → packlets/devtools}/feeds.js +0 -0
- package/dist/src/packlets/devtools/feeds.js.map +1 -0
- package/dist/src/{devtools → packlets/devtools}/index.d.ts +0 -1
- package/dist/src/packlets/devtools/index.d.ts.map +1 -0
- package/dist/src/{devtools → packlets/devtools}/index.js +0 -1
- package/dist/src/packlets/devtools/index.js.map +1 -0
- package/dist/src/{devtools → packlets/devtools}/items.d.ts +1 -1
- package/dist/src/packlets/devtools/items.d.ts.map +1 -0
- package/dist/src/{devtools → packlets/devtools}/items.js +0 -0
- package/dist/src/packlets/devtools/items.js.map +1 -0
- package/dist/src/{devtools → packlets/devtools}/keys.d.ts +1 -1
- package/dist/src/packlets/devtools/keys.d.ts.map +1 -0
- package/dist/src/{devtools → packlets/devtools}/keys.js +0 -0
- package/dist/src/packlets/devtools/keys.js.map +1 -0
- package/dist/src/{devtools → packlets/devtools}/network.d.ts +1 -1
- package/dist/src/packlets/devtools/network.d.ts.map +1 -0
- package/dist/src/{devtools → packlets/devtools}/network.js +0 -0
- package/dist/src/packlets/devtools/network.js.map +1 -0
- package/dist/src/{devtools → packlets/devtools}/parties.d.ts +1 -1
- package/dist/src/packlets/devtools/parties.d.ts.map +1 -0
- package/dist/src/{devtools → packlets/devtools}/parties.js +0 -0
- package/dist/src/packlets/devtools/parties.js.map +1 -0
- package/dist/src/{devtools → packlets/devtools}/storage.d.ts +0 -0
- package/dist/src/packlets/devtools/storage.d.ts.map +1 -0
- package/dist/src/{devtools → packlets/devtools}/storage.js +0 -0
- package/dist/src/packlets/devtools/storage.js.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/dxos/client.d.ts +131 -34
- package/dist/src/packlets/proto/gen/dxos/client.d.ts.map +1 -0
- package/dist/src/packlets/proto/gen/dxos/client.js +35 -0
- package/dist/src/packlets/proto/gen/dxos/client.js.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/dxos/config.d.ts +32 -27
- package/dist/src/packlets/proto/gen/dxos/config.d.ts.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/dxos/config.js +2 -2
- package/dist/src/packlets/proto/gen/dxos/config.js.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/dxos/credentials.d.ts +4 -4
- package/dist/src/packlets/proto/gen/dxos/credentials.d.ts.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/dxos/credentials.js +0 -0
- package/dist/src/packlets/proto/gen/dxos/credentials.js.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/dxos/devtools.d.ts +44 -44
- package/dist/src/packlets/proto/gen/dxos/devtools.d.ts.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/dxos/devtools.js +0 -0
- package/dist/src/packlets/proto/gen/dxos/devtools.js.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/dxos/echo/feed.d.ts +7 -7
- package/dist/src/packlets/proto/gen/dxos/echo/feed.d.ts.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/dxos/echo/feed.js +1 -1
- package/dist/src/packlets/proto/gen/dxos/echo/feed.js.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/dxos/echo/invitation.d.ts +2 -2
- package/dist/src/packlets/proto/gen/dxos/echo/invitation.d.ts.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/dxos/echo/invitation.js +1 -1
- package/dist/src/packlets/proto/gen/dxos/echo/invitation.js.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/dxos/echo/service.d.ts +9 -9
- package/dist/src/packlets/proto/gen/dxos/echo/service.d.ts.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/dxos/echo/service.js +0 -0
- package/dist/src/packlets/proto/gen/dxos/echo/service.js.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/dxos/echo/snapshot.d.ts +8 -8
- package/dist/src/packlets/proto/gen/dxos/echo/snapshot.d.ts.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/dxos/echo/snapshot.js +0 -0
- package/dist/src/packlets/proto/gen/dxos/echo/snapshot.js.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/dxos/echo/timeframe.d.ts +2 -2
- package/dist/src/packlets/proto/gen/dxos/echo/timeframe.d.ts.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/dxos/echo/timeframe.js +0 -0
- package/dist/src/packlets/proto/gen/dxos/echo/timeframe.js.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/dxos/halo/keys.d.ts +6 -6
- package/dist/src/packlets/proto/gen/dxos/halo/keys.d.ts.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/dxos/halo/keys.js +1 -1
- package/dist/src/packlets/proto/gen/dxos/halo/keys.js.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/dxos/rpc.d.ts +17 -7
- package/dist/src/packlets/proto/gen/dxos/rpc.d.ts.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/dxos/rpc.js +1 -1
- package/dist/src/packlets/proto/gen/dxos/rpc.js.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/google/protobuf.d.ts +2 -2
- package/dist/src/packlets/proto/gen/google/protobuf.d.ts.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/google/protobuf.js +0 -0
- package/dist/src/packlets/proto/gen/google/protobuf.js.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/index.d.ts +11 -0
- package/dist/src/packlets/proto/gen/index.d.ts.map +1 -0
- package/dist/src/packlets/proto/gen/index.js +11 -0
- package/dist/src/packlets/proto/gen/index.js.map +1 -0
- package/dist/src/packlets/proto/index.d.ts +14 -0
- package/dist/src/packlets/proto/index.d.ts.map +1 -0
- package/dist/src/{proto → packlets/proto}/index.js +13 -1
- package/dist/src/packlets/proto/index.js.map +1 -0
- package/dist/src/{proto → packlets/proto}/substitutions.d.ts +0 -0
- package/dist/src/packlets/proto/substitutions.d.ts.map +1 -0
- package/dist/src/{proto → packlets/proto}/substitutions.js +0 -0
- package/dist/src/packlets/proto/substitutions.js.map +1 -0
- package/dist/src/{api/client.d.ts → packlets/proxy/client-proxy.d.ts} +8 -16
- package/dist/src/packlets/proxy/client-proxy.d.ts.map +1 -0
- package/dist/src/{api/client.js → packlets/proxy/client-proxy.js} +31 -71
- package/dist/src/packlets/proxy/client-proxy.js.map +1 -0
- package/dist/src/packlets/proxy/devtools.d.ts +11 -0
- package/dist/src/packlets/proxy/devtools.d.ts.map +1 -0
- package/dist/src/{devtools/devtools-rpc-server.js → packlets/proxy/devtools.js} +3 -3
- package/dist/src/packlets/proxy/devtools.js.map +1 -0
- package/dist/src/{api/proxies → packlets/proxy}/echo-proxy.d.ts +3 -25
- package/dist/src/packlets/proxy/echo-proxy.d.ts.map +1 -0
- package/dist/src/{api/proxies → packlets/proxy}/echo-proxy.js +15 -21
- package/dist/src/packlets/proxy/echo-proxy.js.map +1 -0
- package/dist/src/{api/proxies → packlets/proxy}/halo-proxy.d.ts +6 -32
- package/dist/src/packlets/proxy/halo-proxy.d.ts.map +1 -0
- package/dist/src/{api/proxies → packlets/proxy}/halo-proxy.js +7 -6
- package/dist/src/packlets/proxy/halo-proxy.js.map +1 -0
- package/dist/src/packlets/proxy/index.d.ts +11 -0
- package/dist/src/packlets/proxy/index.d.ts.map +1 -0
- package/dist/src/{api/proxies → packlets/proxy}/index.js +8 -1
- package/dist/src/packlets/proxy/index.js.map +1 -0
- package/dist/src/{api/invitations → packlets/proxy}/invitation-proxy.d.ts +2 -2
- package/dist/src/packlets/proxy/invitation-proxy.d.ts.map +1 -0
- package/dist/src/{api/invitations → packlets/proxy}/invitation-proxy.js +8 -8
- package/dist/src/packlets/proxy/invitation-proxy.js.map +1 -0
- package/dist/src/{api/proxies → packlets/proxy}/party-proxy.d.ts +6 -40
- package/dist/src/packlets/proxy/party-proxy.d.ts.map +1 -0
- package/dist/src/{api/proxies → packlets/proxy}/party-proxy.js +9 -9
- package/dist/src/{api/proxies → packlets/proxy}/party-proxy.js.map +1 -1
- package/dist/src/{api → packlets/proxy}/serializer.d.ts +2 -1
- package/dist/src/packlets/proxy/serializer.d.ts.map +1 -0
- package/dist/src/{api → packlets/proxy}/serializer.js +2 -2
- package/dist/src/packlets/proxy/serializer.js.map +1 -0
- package/dist/src/{services → packlets/proxy}/service-proxy.d.ts +1 -1
- package/dist/src/packlets/proxy/service-proxy.d.ts.map +1 -0
- package/dist/src/{services → packlets/proxy}/service-proxy.js +1 -2
- package/dist/src/packlets/proxy/service-proxy.js.map +1 -0
- package/dist/src/packlets/proxy/singleton-port.d.ts +3 -0
- package/dist/src/packlets/proxy/singleton-port.d.ts.map +1 -0
- package/dist/src/packlets/proxy/singleton-port.js +59 -0
- package/dist/src/packlets/proxy/singleton-port.js.map +1 -0
- package/dist/src/packlets/proxy/version.d.ts +2 -0
- package/dist/src/packlets/proxy/version.d.ts.map +1 -0
- package/dist/src/{version.js → packlets/proxy/version.js} +1 -1
- package/dist/src/packlets/proxy/version.js.map +1 -0
- package/dist/src/{services → packlets/services}/impl/halo.d.ts +3 -2
- package/dist/src/packlets/services/impl/halo.d.ts.map +1 -0
- package/dist/src/{services → packlets/services}/impl/halo.js +2 -2
- package/dist/src/packlets/services/impl/halo.js.map +1 -0
- package/dist/src/packlets/services/impl/index.d.ts +2 -0
- package/dist/src/packlets/services/impl/index.d.ts.map +1 -0
- package/dist/src/{services → packlets/services}/impl/index.js +0 -0
- package/dist/src/packlets/services/impl/index.js.map +1 -0
- package/dist/src/{services → packlets/services}/impl/party.d.ts +1 -3
- package/dist/src/packlets/services/impl/party.d.ts.map +1 -0
- package/dist/src/{services → packlets/services}/impl/party.js +10 -11
- package/dist/src/packlets/services/impl/party.js.map +1 -0
- package/dist/src/{services → packlets/services}/impl/profile.d.ts +1 -2
- package/dist/src/packlets/services/impl/profile.d.ts.map +1 -0
- package/dist/src/{services → packlets/services}/impl/profile.js +7 -7
- package/dist/src/packlets/services/impl/profile.js.map +1 -0
- package/dist/src/{services → packlets/services}/impl/services.d.ts +1 -1
- package/dist/src/packlets/services/impl/services.d.ts.map +1 -0
- package/dist/src/{services → packlets/services}/impl/services.js +0 -0
- package/dist/src/packlets/services/impl/services.js.map +1 -0
- package/dist/src/{services → packlets/services}/impl/system.d.ts +1 -1
- package/dist/src/packlets/services/impl/system.d.ts.map +1 -0
- package/dist/src/{services → packlets/services}/impl/system.js +0 -0
- package/dist/src/packlets/services/impl/system.js.map +1 -0
- package/dist/src/{services → packlets/services}/impl/types.d.ts +1 -8
- package/dist/src/packlets/services/impl/types.d.ts.map +1 -0
- package/dist/src/{services → packlets/services}/impl/types.js +0 -0
- package/dist/src/packlets/services/impl/types.js.map +1 -0
- package/dist/src/packlets/services/index.d.ts +2 -0
- package/dist/src/packlets/services/index.d.ts.map +1 -0
- package/dist/src/{services → packlets/services}/index.js +0 -2
- package/dist/src/packlets/services/index.js.map +1 -0
- package/dist/src/{services → packlets/services}/service-host.d.ts +3 -4
- package/dist/src/packlets/services/service-host.d.ts.map +1 -0
- package/dist/src/{services → packlets/services}/service-host.js +3 -3
- package/dist/src/packlets/services/service-host.js.map +1 -0
- package/dist/src/{services → packlets/services}/storage.d.ts +0 -0
- package/dist/src/packlets/services/storage.d.ts.map +1 -0
- package/dist/src/{services → packlets/services}/storage.js +1 -1
- package/dist/src/packlets/services/storage.js.map +1 -0
- package/dist/src/{services/services.test.d.ts → services.test.d.ts} +0 -0
- package/dist/src/services.test.d.ts.map +1 -0
- package/dist/src/{services/services.test.js → services.test.js} +2 -2
- package/dist/src/services.test.js.map +1 -0
- package/dist/src/singleton/main.d.ts +2 -0
- package/dist/src/singleton/main.d.ts.map +1 -0
- package/dist/src/singleton/main.js +155 -0
- package/dist/src/singleton/main.js.map +1 -0
- package/dist/src/singleton/proxy-port.d.ts +10 -0
- package/dist/src/singleton/proxy-port.d.ts.map +1 -0
- package/dist/src/singleton/proxy-port.js +22 -0
- package/dist/src/singleton/proxy-port.js.map +1 -0
- package/dist/src/singleton/shared-worker.d.ts +2 -0
- package/dist/src/singleton/shared-worker.d.ts.map +1 -0
- package/dist/src/singleton/shared-worker.js +134 -0
- package/dist/src/singleton/shared-worker.js.map +1 -0
- package/dist/src/singleton/singleton.stories.d.ts +6 -0
- package/dist/src/singleton/singleton.stories.d.ts.map +1 -0
- package/dist/src/singleton/singleton.stories.js +52 -0
- package/dist/src/singleton/singleton.stories.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +27 -19
- package/src/{api/client.test.ts → client.test.ts} +4 -3
- package/src/client.ts +21 -0
- package/src/index.ts +13 -6
- package/src/{api/local.test.ts → local.test.ts} +0 -0
- package/src/{services → packlets/api}/client-service.ts +1 -3
- package/src/packlets/api/echo.ts +88 -0
- package/src/{api → packlets/api}/errors.ts +0 -0
- package/src/packlets/api/halo.ts +48 -0
- package/src/packlets/api/index.ts +9 -0
- package/src/{api → packlets/api}/invitations/index.ts +2 -3
- package/src/{api → packlets/api}/invitations/invitation-request.ts +0 -0
- package/src/{api → packlets/api}/invitations/invitation.ts +1 -0
- package/src/{devtools → packlets/devtools}/config.ts +1 -1
- package/src/{devtools → packlets/devtools}/debug-logging.ts +1 -1
- package/src/{devtools → packlets/devtools}/devtools-context.ts +0 -10
- package/src/{devtools → packlets/devtools}/devtools-host-events.ts +0 -0
- package/src/{devtools → packlets/devtools}/devtools-host.ts +1 -1
- package/src/{devtools → packlets/devtools}/feeds.ts +1 -1
- package/src/{devtools → packlets/devtools}/index.ts +0 -1
- package/src/{devtools → packlets/devtools}/items.ts +1 -1
- package/src/{devtools → packlets/devtools}/keys.ts +1 -1
- package/src/{devtools → packlets/devtools}/network.ts +1 -1
- package/src/{devtools → packlets/devtools}/parties.ts +1 -1
- package/src/{devtools → packlets/devtools}/storage.ts +0 -0
- package/src/{proto → packlets/proto}/gen/dxos/client.ts +131 -34
- package/src/{proto → packlets/proto}/gen/dxos/config.ts +32 -27
- package/src/{proto → packlets/proto}/gen/dxos/credentials.ts +4 -4
- package/src/{proto → packlets/proto}/gen/dxos/devtools.ts +44 -44
- package/src/{proto → packlets/proto}/gen/dxos/echo/feed.ts +7 -7
- package/src/{proto → packlets/proto}/gen/dxos/echo/invitation.ts +2 -2
- package/src/{proto → packlets/proto}/gen/dxos/echo/service.ts +9 -9
- package/src/{proto → packlets/proto}/gen/dxos/echo/snapshot.ts +8 -8
- package/src/{proto → packlets/proto}/gen/dxos/echo/timeframe.ts +2 -2
- package/src/{proto → packlets/proto}/gen/dxos/halo/keys.ts +6 -6
- package/src/{proto → packlets/proto}/gen/dxos/rpc.ts +17 -7
- package/src/{proto → packlets/proto}/gen/google/protobuf.ts +2 -2
- package/src/packlets/proto/gen/index.ts +214 -0
- package/src/{proto → packlets/proto}/imports.proto +0 -0
- package/src/packlets/proto/index.ts +17 -0
- package/src/{proto → packlets/proto}/substitutions.ts +0 -0
- package/src/{api/client.ts → packlets/proxy/client-proxy.ts} +35 -71
- package/src/{devtools/devtools-rpc-server.ts → packlets/proxy/devtools.ts} +10 -3
- package/src/{api/proxies → packlets/proxy}/echo-proxy.ts +13 -33
- package/src/{api/proxies → packlets/proxy}/halo-proxy.ts +5 -37
- package/src/packlets/proxy/index.ts +14 -0
- package/src/{api/invitations → packlets/proxy}/invitation-proxy.ts +2 -2
- package/src/{api/proxies → packlets/proxy}/party-proxy.ts +9 -56
- package/src/{api → packlets/proxy}/serializer.ts +3 -2
- package/src/{services → packlets/proxy}/service-proxy.ts +1 -2
- package/src/packlets/proxy/singleton-port.ts +60 -0
- package/src/{version.ts → packlets/proxy/version.ts} +0 -0
- package/src/{services → packlets/services}/impl/halo.ts +4 -4
- package/src/{services → packlets/services}/impl/index.ts +0 -1
- package/src/{services → packlets/services}/impl/party.ts +15 -16
- package/src/{services → packlets/services}/impl/profile.ts +2 -2
- package/src/{services → packlets/services}/impl/services.ts +1 -1
- package/src/{services → packlets/services}/impl/system.ts +1 -1
- package/src/{services → packlets/services}/impl/types.ts +1 -9
- package/src/packlets/services/index.ts +5 -0
- package/src/{services → packlets/services}/service-host.ts +4 -5
- package/src/{services → packlets/services}/storage.ts +1 -1
- package/src/{services/services.test.ts → services.test.ts} +2 -2
- package/src/singleton/main.ts +170 -0
- package/src/singleton/proxy-port.ts +23 -0
- package/src/singleton/shared-worker.ts +147 -0
- package/src/singleton/singleton.stories.tsx +36 -0
- package/dist/src/api/client.d.ts.map +0 -1
- package/dist/src/api/client.js.map +0 -1
- package/dist/src/api/client.test.js.map +0 -1
- package/dist/src/api/errors.d.ts.map +0 -1
- package/dist/src/api/errors.js.map +0 -1
- package/dist/src/api/index.d.ts +0 -8
- package/dist/src/api/index.d.ts.map +0 -1
- package/dist/src/api/index.js.map +0 -1
- package/dist/src/api/invitations/index.d.ts +0 -4
- package/dist/src/api/invitations/index.d.ts.map +0 -1
- package/dist/src/api/invitations/index.js.map +0 -1
- package/dist/src/api/invitations/invitation-proxy.d.ts.map +0 -1
- package/dist/src/api/invitations/invitation-proxy.js.map +0 -1
- package/dist/src/api/invitations/invitation-request.d.ts.map +0 -1
- package/dist/src/api/invitations/invitation-request.js.map +0 -1
- package/dist/src/api/invitations/invitation.d.ts.map +0 -1
- package/dist/src/api/invitations/invitation.js.map +0 -1
- package/dist/src/api/local.test.js.map +0 -1
- package/dist/src/api/proxies/echo-proxy.d.ts.map +0 -1
- package/dist/src/api/proxies/echo-proxy.js.map +0 -1
- package/dist/src/api/proxies/halo-proxy.d.ts.map +0 -1
- package/dist/src/api/proxies/halo-proxy.js.map +0 -1
- package/dist/src/api/proxies/index.d.ts +0 -4
- package/dist/src/api/proxies/index.d.ts.map +0 -1
- package/dist/src/api/proxies/index.js.map +0 -1
- package/dist/src/api/proxies/party-proxy.d.ts.map +0 -1
- package/dist/src/api/serializer.d.ts.map +0 -1
- package/dist/src/api/serializer.js.map +0 -1
- package/dist/src/devtools/config.d.ts.map +0 -1
- package/dist/src/devtools/config.js.map +0 -1
- package/dist/src/devtools/debug-logging.d.ts.map +0 -1
- package/dist/src/devtools/debug-logging.js.map +0 -1
- package/dist/src/devtools/devtools-context.d.ts.map +0 -1
- package/dist/src/devtools/devtools-context.js.map +0 -1
- package/dist/src/devtools/devtools-host-events.d.ts.map +0 -1
- package/dist/src/devtools/devtools-host-events.js.map +0 -1
- package/dist/src/devtools/devtools-host.d.ts.map +0 -1
- package/dist/src/devtools/devtools-host.js.map +0 -1
- package/dist/src/devtools/devtools-rpc-server.d.ts +0 -4
- package/dist/src/devtools/devtools-rpc-server.d.ts.map +0 -1
- package/dist/src/devtools/devtools-rpc-server.js.map +0 -1
- package/dist/src/devtools/feeds.d.ts.map +0 -1
- package/dist/src/devtools/feeds.js.map +0 -1
- package/dist/src/devtools/index.d.ts.map +0 -1
- package/dist/src/devtools/index.js.map +0 -1
- package/dist/src/devtools/items.d.ts.map +0 -1
- package/dist/src/devtools/items.js.map +0 -1
- package/dist/src/devtools/keys.d.ts.map +0 -1
- package/dist/src/devtools/keys.js.map +0 -1
- package/dist/src/devtools/network.d.ts.map +0 -1
- package/dist/src/devtools/network.js.map +0 -1
- package/dist/src/devtools/parties.d.ts.map +0 -1
- package/dist/src/devtools/parties.js.map +0 -1
- package/dist/src/devtools/storage.d.ts.map +0 -1
- package/dist/src/devtools/storage.js.map +0 -1
- package/dist/src/proto/gen/dxos/client.d.ts.map +0 -1
- package/dist/src/proto/gen/dxos/client.js +0 -15
- package/dist/src/proto/gen/dxos/client.js.map +0 -1
- package/dist/src/proto/gen/dxos/config.d.ts.map +0 -1
- package/dist/src/proto/gen/dxos/config.js.map +0 -1
- package/dist/src/proto/gen/dxos/credentials.d.ts.map +0 -1
- package/dist/src/proto/gen/dxos/credentials.js.map +0 -1
- package/dist/src/proto/gen/dxos/devtools.d.ts.map +0 -1
- package/dist/src/proto/gen/dxos/devtools.js.map +0 -1
- package/dist/src/proto/gen/dxos/echo/feed.d.ts.map +0 -1
- package/dist/src/proto/gen/dxos/echo/feed.js.map +0 -1
- package/dist/src/proto/gen/dxos/echo/invitation.d.ts.map +0 -1
- package/dist/src/proto/gen/dxos/echo/invitation.js.map +0 -1
- package/dist/src/proto/gen/dxos/echo/service.d.ts.map +0 -1
- package/dist/src/proto/gen/dxos/echo/service.js.map +0 -1
- package/dist/src/proto/gen/dxos/echo/snapshot.d.ts.map +0 -1
- package/dist/src/proto/gen/dxos/echo/snapshot.js.map +0 -1
- package/dist/src/proto/gen/dxos/echo/timeframe.d.ts.map +0 -1
- package/dist/src/proto/gen/dxos/echo/timeframe.js.map +0 -1
- package/dist/src/proto/gen/dxos/halo/keys.d.ts.map +0 -1
- package/dist/src/proto/gen/dxos/halo/keys.js.map +0 -1
- package/dist/src/proto/gen/dxos/rpc.d.ts.map +0 -1
- package/dist/src/proto/gen/dxos/rpc.js.map +0 -1
- package/dist/src/proto/gen/google/protobuf.d.ts.map +0 -1
- package/dist/src/proto/gen/google/protobuf.js.map +0 -1
- package/dist/src/proto/gen/index.d.ts.map +0 -1
- package/dist/src/proto/gen/index.js +0 -11
- package/dist/src/proto/gen/index.js.map +0 -1
- package/dist/src/proto/index.d.ts +0 -3
- package/dist/src/proto/index.d.ts.map +0 -1
- package/dist/src/proto/index.js.map +0 -1
- package/dist/src/proto/substitutions.d.ts.map +0 -1
- package/dist/src/proto/substitutions.js.map +0 -1
- package/dist/src/services/client-service.d.ts.map +0 -1
- package/dist/src/services/client-service.js.map +0 -1
- package/dist/src/services/impl/halo.d.ts.map +0 -1
- package/dist/src/services/impl/halo.js.map +0 -1
- package/dist/src/services/impl/index.d.ts +0 -3
- package/dist/src/services/impl/index.d.ts.map +0 -1
- package/dist/src/services/impl/index.js.map +0 -1
- package/dist/src/services/impl/party.d.ts.map +0 -1
- package/dist/src/services/impl/party.js.map +0 -1
- package/dist/src/services/impl/profile.d.ts.map +0 -1
- package/dist/src/services/impl/profile.js.map +0 -1
- package/dist/src/services/impl/services.d.ts.map +0 -1
- package/dist/src/services/impl/services.js.map +0 -1
- package/dist/src/services/impl/system.d.ts.map +0 -1
- package/dist/src/services/impl/system.js.map +0 -1
- package/dist/src/services/impl/types.d.ts.map +0 -1
- package/dist/src/services/impl/types.js.map +0 -1
- package/dist/src/services/index.d.ts +0 -5
- package/dist/src/services/index.d.ts.map +0 -1
- package/dist/src/services/index.js.map +0 -1
- package/dist/src/services/service-host.d.ts.map +0 -1
- package/dist/src/services/service-host.js.map +0 -1
- package/dist/src/services/service-proxy.d.ts.map +0 -1
- package/dist/src/services/service-proxy.js.map +0 -1
- package/dist/src/services/services.test.d.ts.map +0 -1
- package/dist/src/services/services.test.js.map +0 -1
- package/dist/src/services/storage.d.ts.map +0 -1
- package/dist/src/services/storage.js.map +0 -1
- package/dist/src/util/index.d.ts +0 -4
- package/dist/src/util/index.d.ts.map +0 -1
- package/dist/src/util/index.js +0 -23
- package/dist/src/util/index.js.map +0 -1
- package/dist/src/util/messages.d.ts +0 -3
- package/dist/src/util/messages.d.ts.map +0 -1
- package/dist/src/util/messages.js +0 -30
- package/dist/src/util/messages.js.map +0 -1
- package/dist/src/util/platform.d.ts +0 -2
- package/dist/src/util/platform.d.ts.map +0 -1
- package/dist/src/util/platform.js +0 -11
- package/dist/src/util/platform.js.map +0 -1
- package/dist/src/util/platform.test.d.ts +0 -2
- package/dist/src/util/platform.test.d.ts.map +0 -1
- package/dist/src/util/platform.test.js +0 -15
- package/dist/src/util/platform.test.js.map +0 -1
- package/dist/src/util/subscription.d.ts +0 -5
- package/dist/src/util/subscription.d.ts.map +0 -1
- package/dist/src/util/subscription.js +0 -25
- package/dist/src/util/subscription.js.map +0 -1
- package/dist/src/version.d.ts +0 -2
- package/dist/src/version.d.ts.map +0 -1
- package/dist/src/version.js.map +0 -1
- package/src/api/index.ts +0 -12
- package/src/api/proxies/index.ts +0 -7
- package/src/proto/gen/index.ts +0 -203
- package/src/proto/index.ts +0 -6
- package/src/services/index.ts +0 -9
- package/src/util/index.ts +0 -7
- package/src/util/messages.ts +0 -30
- package/src/util/platform.test.ts +0 -12
- package/src/util/platform.ts +0 -7
- package/src/util/subscription.ts +0 -23
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2022 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
export * as proto from './gen';
|
|
6
|
+
export { schema } from './gen';
|
|
7
|
+
export * from './gen/dxos/client';
|
|
8
|
+
export * from './gen/dxos/config';
|
|
9
|
+
export * from './gen/dxos/credentials';
|
|
10
|
+
export * from './gen/dxos/echo/feed';
|
|
11
|
+
export * from './gen/dxos/echo/invitation';
|
|
12
|
+
export * from './gen/dxos/echo/service';
|
|
13
|
+
export * from './gen/dxos/echo/snapshot';
|
|
14
|
+
export * from './gen/dxos/echo/timeframe';
|
|
15
|
+
export * from './gen/dxos/devtools';
|
|
16
|
+
export * from './gen/dxos/halo/keys';
|
|
17
|
+
export * from './gen/dxos/rpc';
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import debug from 'debug';
|
|
@@ -12,16 +12,19 @@ import { OpenProgress } from '@dxos/echo-db';
|
|
|
12
12
|
import { ModelConstructor } from '@dxos/model-factory';
|
|
13
13
|
import { RpcPort } from '@dxos/rpc';
|
|
14
14
|
|
|
15
|
-
import {
|
|
16
|
-
import { Runtime } from '../proto
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
15
|
+
import { InvalidConfigurationError, ClientServiceProvider, ClientServices, Echo, Halo, HaloSigner } from '../api';
|
|
16
|
+
import { Runtime } from '../proto';
|
|
17
|
+
import { createDevtoolsRpcServer } from './devtools';
|
|
18
|
+
import { EchoProxy } from './echo-proxy';
|
|
19
|
+
import { HaloProxy } from './halo-proxy';
|
|
20
|
+
import { ClientServiceProxy } from './service-proxy';
|
|
21
|
+
import { createSingletonPort } from './singleton-port';
|
|
22
|
+
import { DXOS_VERSION } from './version';
|
|
22
23
|
|
|
23
|
-
const log = debug('dxos:client');
|
|
24
|
+
const log = debug('dxos:client-proxy');
|
|
24
25
|
|
|
26
|
+
// TODO(wittjosiah): Should be kube.local or equivalent.
|
|
27
|
+
const DEFAULT_SINGLETON_HOST = 'http://localhost:8080';
|
|
25
28
|
const EXPECTED_CONFIG_VERSION = 1;
|
|
26
29
|
|
|
27
30
|
export const defaultConfig: ConfigObject = { version: 1 };
|
|
@@ -31,7 +34,7 @@ export const defaultTestingConfig: ConfigObject = {
|
|
|
31
34
|
runtime: {
|
|
32
35
|
services: {
|
|
33
36
|
signal: {
|
|
34
|
-
server: 'ws://localhost:4000'
|
|
37
|
+
server: 'ws://localhost:4000/.well-known/dx/signal'
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
40
|
}
|
|
@@ -41,7 +44,12 @@ export interface ClientOptions {
|
|
|
41
44
|
/**
|
|
42
45
|
* Only used when remote=true.
|
|
43
46
|
*/
|
|
44
|
-
rpcPort?: RpcPort
|
|
47
|
+
rpcPort?: RpcPort
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
*/
|
|
52
|
+
serviceProvider?: ClientServiceProvider
|
|
45
53
|
|
|
46
54
|
/**
|
|
47
55
|
*
|
|
@@ -54,10 +62,6 @@ export interface ClientOptions {
|
|
|
54
62
|
timeout?: number
|
|
55
63
|
}
|
|
56
64
|
|
|
57
|
-
/**
|
|
58
|
-
* The main DXOS client API.
|
|
59
|
-
* An entrypoint to ECHO, HALO, MESH, and DXNS.
|
|
60
|
-
*/
|
|
61
65
|
export class Client {
|
|
62
66
|
public readonly version = DXOS_VERSION;
|
|
63
67
|
|
|
@@ -98,14 +102,14 @@ export class Client {
|
|
|
98
102
|
}
|
|
99
103
|
|
|
100
104
|
toString () {
|
|
101
|
-
return `Client(${JSON.stringify(this.info
|
|
105
|
+
return `Client(${JSON.stringify(this.info)})`;
|
|
102
106
|
}
|
|
103
107
|
|
|
104
|
-
info () {
|
|
108
|
+
get info () {
|
|
105
109
|
return {
|
|
106
110
|
initialized: this.initialized,
|
|
107
|
-
echo: this.echo.info
|
|
108
|
-
halo: this.halo.info
|
|
111
|
+
echo: this.echo.info,
|
|
112
|
+
halo: this.halo.info
|
|
109
113
|
};
|
|
110
114
|
}
|
|
111
115
|
|
|
@@ -139,13 +143,6 @@ export class Client {
|
|
|
139
143
|
|
|
140
144
|
// TODO(burdon): Expose mesh for messaging?
|
|
141
145
|
|
|
142
|
-
/**
|
|
143
|
-
* Returns true if client is connected to a remote services protvider.
|
|
144
|
-
*/
|
|
145
|
-
get isRemote (): boolean {
|
|
146
|
-
return this._serviceProvider instanceof ClientServiceProxy;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
146
|
/**
|
|
150
147
|
* Client services that can be proxied.
|
|
151
148
|
*/
|
|
@@ -170,62 +167,29 @@ export class Client {
|
|
|
170
167
|
throw new TimeoutError(`Initialize timed out after ${t}s.`);
|
|
171
168
|
}, t * 1000);
|
|
172
169
|
|
|
173
|
-
if (this.
|
|
174
|
-
|
|
175
|
-
} else if (this._mode === Runtime.Client.Mode.LOCAL) {
|
|
176
|
-
await this.initializeLocal(onProgressCallback);
|
|
170
|
+
if (this._options.serviceProvider) {
|
|
171
|
+
this._serviceProvider = this._options.serviceProvider;
|
|
177
172
|
} else {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
173
|
+
const singletonSource = this._config.get('runtime.client.singletonSource') ?? DEFAULT_SINGLETON_HOST;
|
|
174
|
+
this._serviceProvider = new ClientServiceProxy(
|
|
175
|
+
this._options.rpcPort ?? await createSingletonPort(singletonSource),
|
|
176
|
+
this._options.timeout
|
|
177
|
+
);
|
|
183
178
|
}
|
|
184
179
|
|
|
185
180
|
this._halo = new HaloProxy(this._serviceProvider);
|
|
186
181
|
this._echo = new EchoProxy(this._serviceProvider, this._halo);
|
|
187
182
|
|
|
183
|
+
await this._serviceProvider.open(onProgressCallback);
|
|
188
184
|
await this._halo._open();
|
|
189
185
|
await this._echo._open();
|
|
190
186
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
private async initializeRemote (onProgressCallback: Parameters<this['initialize']>[0]) {
|
|
196
|
-
if (!this._options.rpcPort && isNode()) {
|
|
197
|
-
throw new Error('RPC port is required to run client in remote mode on Node environment.');
|
|
187
|
+
if (typeof window !== 'undefined') {
|
|
188
|
+
await createDevtoolsRpcServer(this, this._serviceProvider);
|
|
198
189
|
}
|
|
199
190
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
this._options.rpcPort ?? createWindowMessagePort(),
|
|
203
|
-
this._options.timeout
|
|
204
|
-
);
|
|
205
|
-
await this._serviceProvider.open(onProgressCallback);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
private async initializeLocal (onProgressCallback: Parameters<this['initialize']>[0]) {
|
|
209
|
-
log('Creating client host.');
|
|
210
|
-
this._serviceProvider = new ClientServiceHost(this._config, this._options);
|
|
211
|
-
await this._serviceProvider.open(onProgressCallback);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
private async initializeAuto (onProgressCallback: Parameters<this['initialize']>[0]) {
|
|
215
|
-
if (!this._options.rpcPort && isNode()) {
|
|
216
|
-
await this.initializeLocal(onProgressCallback);
|
|
217
|
-
} else {
|
|
218
|
-
try {
|
|
219
|
-
await this.initializeRemote(onProgressCallback);
|
|
220
|
-
} catch (error) {
|
|
221
|
-
if (error instanceof RemoteServiceConnectionTimeout) {
|
|
222
|
-
log('Failed to connect to remote services. Starting local services.');
|
|
223
|
-
await this.initializeLocal(onProgressCallback);
|
|
224
|
-
} else {
|
|
225
|
-
throw error;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
191
|
+
this._initialized = true; // TODO(burdon): Initialized === halo.initialized?
|
|
192
|
+
clearInterval(timeout);
|
|
229
193
|
}
|
|
230
194
|
|
|
231
195
|
/**
|
|
@@ -6,13 +6,20 @@ import debug from 'debug';
|
|
|
6
6
|
|
|
7
7
|
import { createBundledRpcServer, RpcPeer, RpcPort } from '@dxos/rpc';
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { DevtoolsHook } from './devtools-context';
|
|
9
|
+
import { clientServiceBundle, ClientServiceProvider } from '../api';
|
|
10
|
+
import { Client } from './client-proxy';
|
|
12
11
|
|
|
13
12
|
const log = debug('dxos:client:devtools');
|
|
14
13
|
const error = log.extend('error');
|
|
15
14
|
|
|
15
|
+
/**
|
|
16
|
+
* A hook bound to window.__DXOS__.
|
|
17
|
+
*/
|
|
18
|
+
export interface DevtoolsHook {
|
|
19
|
+
client: Client
|
|
20
|
+
openClientRpcServer: () => Promise<boolean>
|
|
21
|
+
}
|
|
22
|
+
|
|
16
23
|
const port: RpcPort = {
|
|
17
24
|
send: async message => window.postMessage({
|
|
18
25
|
data: Array.from(message),
|
|
@@ -13,33 +13,11 @@ import { ObjectModel } from '@dxos/object-model';
|
|
|
13
13
|
import { PublicKey } from '@dxos/protocols';
|
|
14
14
|
import { ComplexMap, SubscriptionGroup } from '@dxos/util';
|
|
15
15
|
|
|
16
|
-
import {
|
|
17
|
-
import { Invitation, InvitationProxy } from '../invitations';
|
|
16
|
+
import { ClientServiceProvider, Echo, Party, PartyInvitation } from '../api';
|
|
18
17
|
import { HaloProxy } from './halo-proxy';
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Wait for the invitation flow to complete and return the target party.
|
|
24
|
-
*/
|
|
25
|
-
getParty (): Promise<Party> {
|
|
26
|
-
return this.wait();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* ECHO API.
|
|
32
|
-
*/
|
|
33
|
-
// TODO(burdon): Separate public API form implementation (move comments here).
|
|
34
|
-
export interface Echo {
|
|
35
|
-
info (): { parties: number }
|
|
36
|
-
registerModel (constructor: ModelConstructor<any>): void
|
|
37
|
-
createParty (): Promise<Party>
|
|
38
|
-
cloneParty (snapshot: PartySnapshot): Promise<Party>
|
|
39
|
-
getParty (partyKey: PartyKey): Party | undefined
|
|
40
|
-
queryParties (): ResultSet<Party>
|
|
41
|
-
acceptInvitation (invitationDescriptor: InvitationDescriptor): PartyInvitation
|
|
42
|
-
}
|
|
18
|
+
import { InvitationProxy } from './invitation-proxy';
|
|
19
|
+
import { PartyProxy } from './party-proxy';
|
|
20
|
+
import { ClientServiceProxy } from './service-proxy';
|
|
43
21
|
|
|
44
22
|
/**
|
|
45
23
|
* Client proxy to local/remote ECHO service.
|
|
@@ -54,14 +32,15 @@ export class EchoProxy implements Echo {
|
|
|
54
32
|
private readonly _serviceProvider: ClientServiceProvider,
|
|
55
33
|
private readonly _haloProxy: HaloProxy
|
|
56
34
|
) {
|
|
57
|
-
|
|
58
|
-
|
|
35
|
+
// TODO(wittjosiah): Reconcile service provider host with interface.
|
|
36
|
+
this._modelFactory = _serviceProvider instanceof ClientServiceProxy
|
|
37
|
+
? new ModelFactory() : (_serviceProvider as any).echo.modelFactory;
|
|
59
38
|
|
|
60
39
|
this._modelFactory.registerModel(ObjectModel); // Register object-model by default.
|
|
61
40
|
}
|
|
62
41
|
|
|
63
42
|
toString () {
|
|
64
|
-
return `EchoProxy(${JSON.stringify(this.info
|
|
43
|
+
return `EchoProxy(${JSON.stringify(this.info)})`;
|
|
65
44
|
}
|
|
66
45
|
|
|
67
46
|
get modelFactory (): ModelFactory {
|
|
@@ -69,15 +48,16 @@ export class EchoProxy implements Echo {
|
|
|
69
48
|
}
|
|
70
49
|
|
|
71
50
|
get networkManager () {
|
|
72
|
-
if (this._serviceProvider instanceof
|
|
73
|
-
|
|
51
|
+
if (this._serviceProvider instanceof ClientServiceProxy) {
|
|
52
|
+
throw new Error('Network Manager not available in service proxy.');
|
|
74
53
|
}
|
|
75
54
|
|
|
76
|
-
|
|
55
|
+
// TODO(wittjosiah): Reconcile service provider host with interface.
|
|
56
|
+
return (this._serviceProvider as any).echo.networkManager;
|
|
77
57
|
}
|
|
78
58
|
|
|
79
59
|
// TODO(burdon): Client ID?
|
|
80
|
-
info () {
|
|
60
|
+
get info () {
|
|
81
61
|
return {
|
|
82
62
|
parties: this._parties.size
|
|
83
63
|
};
|
|
@@ -5,43 +5,11 @@
|
|
|
5
5
|
import { Event } from '@dxos/async';
|
|
6
6
|
import { DeviceInfo, keyPairFromSeedPhrase, KeyRecord } from '@dxos/credentials';
|
|
7
7
|
import { Contact, CreateProfileOptions, InvitationDescriptor, PartyMember, ResultSet } from '@dxos/echo-db';
|
|
8
|
-
import { PublicKey } from '@dxos/protocols';
|
|
9
8
|
import { SubscriptionGroup } from '@dxos/util';
|
|
10
9
|
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* HALO API.
|
|
17
|
-
*/
|
|
18
|
-
// TODO(burdon): Separate public API form implementation (move comments here).
|
|
19
|
-
export interface Halo {
|
|
20
|
-
info (): { key?: PublicKey }
|
|
21
|
-
|
|
22
|
-
get profile (): Profile | undefined
|
|
23
|
-
createProfile (options?: CreateProfileOptions): Promise<Profile>
|
|
24
|
-
recoverProfile (seedPhrase: string): Promise<Profile>
|
|
25
|
-
|
|
26
|
-
sign (request: SignRequest): Promise<SignResponse>
|
|
27
|
-
addKeyRecord (keyRecord: KeyRecord): Promise<void>
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated
|
|
31
|
-
*/
|
|
32
|
-
subscribeToProfile (callback: (profile: Profile) => void): void
|
|
33
|
-
|
|
34
|
-
queryContacts (): ResultSet<Contact>
|
|
35
|
-
createInvitation (): Promise<InvitationRequest>
|
|
36
|
-
acceptInvitation (invitationDescriptor: InvitationDescriptor): Invitation
|
|
37
|
-
|
|
38
|
-
queryDevices (): Promise<DeviceInfo[]>
|
|
39
|
-
setDevicePreference (key: string, value: string): Promise<void>
|
|
40
|
-
getDevicePreference (key: string): Promise<string | undefined>
|
|
41
|
-
|
|
42
|
-
setGlobalPreference (key: string, value: string): Promise<void>
|
|
43
|
-
getGlobalPreference (key: string): Promise<string | undefined>
|
|
44
|
-
}
|
|
10
|
+
import { ClientServiceProvider, Halo, Invitation, InvitationRequest } from '../api';
|
|
11
|
+
import { Profile, SignRequest } from '../proto';
|
|
12
|
+
import { InvitationProxy } from './invitation-proxy';
|
|
45
13
|
|
|
46
14
|
/**
|
|
47
15
|
* Client proxy to local/remote HALO service.
|
|
@@ -61,10 +29,10 @@ export class HaloProxy implements Halo {
|
|
|
61
29
|
) {}
|
|
62
30
|
|
|
63
31
|
toString () {
|
|
64
|
-
return `HaloProxy(${JSON.stringify(this.info
|
|
32
|
+
return `HaloProxy(${JSON.stringify(this.info)})`;
|
|
65
33
|
}
|
|
66
34
|
|
|
67
|
-
info () {
|
|
35
|
+
get info () {
|
|
68
36
|
return {
|
|
69
37
|
key: this._profile?.publicKey
|
|
70
38
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2022 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
export * from './client-proxy';
|
|
6
|
+
export * from './devtools';
|
|
7
|
+
export * from './echo-proxy';
|
|
8
|
+
export * from './halo-proxy';
|
|
9
|
+
export * from './invitation-proxy';
|
|
10
|
+
export * from './party-proxy';
|
|
11
|
+
export * from './serializer';
|
|
12
|
+
export * from './service-proxy';
|
|
13
|
+
export * from './singleton-port';
|
|
14
|
+
export * from './version';
|
|
@@ -10,8 +10,8 @@ import { throwUnhandledRejection } from '@dxos/debug';
|
|
|
10
10
|
import { InvitationDescriptor, InvitationDescriptorType } from '@dxos/echo-db';
|
|
11
11
|
import { RpcClosedError } from '@dxos/rpc';
|
|
12
12
|
|
|
13
|
-
import {
|
|
14
|
-
import { InvitationRequest } from '
|
|
13
|
+
import { InvitationRequest } from '../api';
|
|
14
|
+
import { AuthenticateInvitationRequest, InvitationRequest as InvitationRequestProto, InvitationState, RedeemedInvitation as RedeemedInvitationProto } from '../proto';
|
|
15
15
|
|
|
16
16
|
export interface CreateInvitationRequestOpts {
|
|
17
17
|
stream: Stream<InvitationRequestProto>
|
|
@@ -10,65 +10,17 @@ import {
|
|
|
10
10
|
Database,
|
|
11
11
|
Item,
|
|
12
12
|
RemoteDatabaseBackend,
|
|
13
|
-
|
|
14
|
-
PartyMember
|
|
13
|
+
streamToResultSet
|
|
15
14
|
} from '@dxos/echo-db';
|
|
16
|
-
import { PartyKey
|
|
15
|
+
import { PartyKey } from '@dxos/echo-protocol';
|
|
17
16
|
import { ModelFactory } from '@dxos/model-factory';
|
|
18
17
|
import { ObjectModel, ObjectProperties } from '@dxos/object-model';
|
|
19
18
|
import { PublicKey } from '@dxos/protocols';
|
|
20
19
|
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
|
|
26
|
-
export interface CreationInvitationOptions {
|
|
27
|
-
inviteeKey?: PublicKey
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Party API.
|
|
32
|
-
*/
|
|
33
|
-
// TODO(burdon): Separate public API form implementation (move comments here).
|
|
34
|
-
export interface Party {
|
|
35
|
-
get key (): PublicKey
|
|
36
|
-
get isOpen (): boolean
|
|
37
|
-
get isActive (): boolean
|
|
38
|
-
|
|
39
|
-
// TODO(burdon): Verbs should be on same interface.
|
|
40
|
-
get database (): Database
|
|
41
|
-
get select (): Database['select']
|
|
42
|
-
get reduce (): Database['reduce']
|
|
43
|
-
|
|
44
|
-
initialize (): Promise<void>
|
|
45
|
-
destroy (): Promise<void>
|
|
46
|
-
|
|
47
|
-
open (): Promise<void>
|
|
48
|
-
close (): Promise<void>
|
|
49
|
-
setActive (active: boolean, options: ActivationOptions): Promise<void>
|
|
50
|
-
|
|
51
|
-
setTitle (title: string): Promise<void>
|
|
52
|
-
getTitle (): string
|
|
53
|
-
|
|
54
|
-
// TODO(burdon): Rename (info?)
|
|
55
|
-
getDetails(): Promise<PartyDetails>
|
|
56
|
-
|
|
57
|
-
get properties (): ObjectProperties
|
|
58
|
-
/**
|
|
59
|
-
* @deprecated
|
|
60
|
-
*/
|
|
61
|
-
setProperty (key: string, value?: any): Promise<void>
|
|
62
|
-
/**
|
|
63
|
-
* @deprecated
|
|
64
|
-
*/
|
|
65
|
-
getProperty (key: string, defaultValue?: any): any
|
|
66
|
-
|
|
67
|
-
queryMembers (): ResultSet<PartyMember>
|
|
68
|
-
createInvitation (options?: CreationInvitationOptions): Promise<InvitationRequest>
|
|
69
|
-
|
|
70
|
-
createSnapshot (): Promise<PartySnapshot>
|
|
71
|
-
}
|
|
20
|
+
import { ClientServiceProvider, CreationInvitationOptions, InvitationRequest, Party } from '../api';
|
|
21
|
+
import { Party as PartyProto, PartyDetails } from '../proto';
|
|
22
|
+
import { InvitationProxy } from './invitation-proxy';
|
|
23
|
+
import { ClientServiceProxy } from './service-proxy';
|
|
72
24
|
|
|
73
25
|
/**
|
|
74
26
|
* Main public Party API.
|
|
@@ -105,8 +57,9 @@ export class PartyProxy implements Party {
|
|
|
105
57
|
new RemoteDatabaseBackend(this._serviceProvider.services.DataService, this._key),
|
|
106
58
|
memberKey
|
|
107
59
|
);
|
|
108
|
-
} else if (this._serviceProvider
|
|
109
|
-
|
|
60
|
+
} else if ((this._serviceProvider as any).echo) {
|
|
61
|
+
// TODO(wittjosiah): Reconcile service provider host with interface.
|
|
62
|
+
const party = (this._serviceProvider as any).echo.getParty(this._key) ?? failUndefined();
|
|
110
63
|
this._database = party.database;
|
|
111
64
|
} else {
|
|
112
65
|
throw new Error('Unrecognized service provider.');
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { schema } from '../proto
|
|
5
|
+
import { Party } from '../api';
|
|
6
|
+
import { schema } from '../proto';
|
|
7
|
+
import { Client } from './client-proxy';
|
|
7
8
|
|
|
8
9
|
const partyCodec = schema.getCodecForType('dxos.echo.snapshot.PartySnapshot');
|
|
9
10
|
|
|
@@ -6,8 +6,7 @@ import { promiseTimeout } from '@dxos/async';
|
|
|
6
6
|
import { OpenProgress } from '@dxos/echo-db';
|
|
7
7
|
import { createBundledRpcClient, ProtoRpcClient, RpcPort } from '@dxos/rpc';
|
|
8
8
|
|
|
9
|
-
import { RemoteServiceConnectionTimeout } from '../api';
|
|
10
|
-
import { clientServiceBundle, ClientServiceProvider, ClientServices } from './client-service';
|
|
9
|
+
import { clientServiceBundle, ClientServiceProvider, ClientServices, RemoteServiceConnectionTimeout } from '../api';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* Implements services that are not local to the app.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2021 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import debug from 'debug';
|
|
6
|
+
|
|
7
|
+
import { RpcPort } from '@dxos/rpc';
|
|
8
|
+
import { isNode } from '@dxos/util';
|
|
9
|
+
|
|
10
|
+
import { SingletonMessage } from '../proto';
|
|
11
|
+
|
|
12
|
+
const log = debug('dxos:client:singleton-port');
|
|
13
|
+
|
|
14
|
+
const waitForClient = () => {
|
|
15
|
+
return new Promise<void>(resolve => {
|
|
16
|
+
const messageHandler = (event: MessageEvent<SingletonMessage>) => {
|
|
17
|
+
if (event.data?.type === SingletonMessage.Type.CLIENT_READY) {
|
|
18
|
+
window.removeEventListener('message', messageHandler);
|
|
19
|
+
resolve();
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
window.addEventListener('message', messageHandler);
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const createSingletonPort = async (singletonSource: string): Promise<RpcPort> => {
|
|
28
|
+
if (isNode()) {
|
|
29
|
+
throw new Error('Connecting to singleton client is not available in Node environment.');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const singleton = document.createElement('iframe') as HTMLIFrameElement;
|
|
33
|
+
singleton.id = 'dxos-client-singleton';
|
|
34
|
+
singleton.src = singletonSource;
|
|
35
|
+
singleton.setAttribute('style', 'display: none;');
|
|
36
|
+
document.body.appendChild(singleton);
|
|
37
|
+
|
|
38
|
+
await waitForClient();
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
send: async message => singleton.contentWindow?.postMessage({
|
|
42
|
+
type: SingletonMessage.Type.WINDOW_MESSAGE,
|
|
43
|
+
data: Array.from(message)
|
|
44
|
+
}, '*'),
|
|
45
|
+
subscribe: callback => {
|
|
46
|
+
const handler = (event: MessageEvent<SingletonMessage>) => {
|
|
47
|
+
const message = event.data;
|
|
48
|
+
if (message?.type !== SingletonMessage.Type.WINDOW_MESSAGE) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
log('Received message from singleton client:', message);
|
|
53
|
+
callback(new Uint8Array(message.data!));
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
window.addEventListener('message', handler);
|
|
57
|
+
return () => window.removeEventListener('message', handler);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
};
|
|
File without changes
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
import assert from 'node:assert';
|
|
6
6
|
|
|
7
7
|
import { Stream } from '@dxos/codec-protobuf';
|
|
8
|
-
import { ECHO } from '@dxos/echo-db';
|
|
8
|
+
import { ECHO, resultSetToStream } from '@dxos/echo-db';
|
|
9
9
|
import { ObjectModel } from '@dxos/object-model';
|
|
10
10
|
import { SubscriptionGroup } from '@dxos/util';
|
|
11
11
|
|
|
12
|
+
import { HaloSigner } from '../../api';
|
|
12
13
|
import {
|
|
13
14
|
AddKeyRecordRequest,
|
|
14
15
|
Contacts,
|
|
@@ -18,9 +19,8 @@ import {
|
|
|
18
19
|
SetPreferenceRequest,
|
|
19
20
|
GetPreferenceRequest,
|
|
20
21
|
GetPreferenceResponse
|
|
21
|
-
} from '../../proto
|
|
22
|
-
import {
|
|
23
|
-
import { CreateServicesOpts, HaloSigner } from './types';
|
|
22
|
+
} from '../../proto';
|
|
23
|
+
import { CreateServicesOpts } from './types';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* HALO service implementation.
|
|
@@ -9,29 +9,28 @@ import { latch } from '@dxos/async';
|
|
|
9
9
|
import { Stream } from '@dxos/codec-protobuf';
|
|
10
10
|
import { defaultSecretValidator, generatePasscode, SecretProvider } from '@dxos/credentials';
|
|
11
11
|
import { InvalidStateError, raise } from '@dxos/debug';
|
|
12
|
-
import { ECHO, InvitationDescriptor, InvitationDescriptorType, PartyNotFoundError } from '@dxos/echo-db';
|
|
12
|
+
import { ECHO, InvitationDescriptor, InvitationDescriptorType, PartyNotFoundError, resultSetToStream } from '@dxos/echo-db';
|
|
13
13
|
|
|
14
14
|
import {
|
|
15
|
+
AuthenticateInvitationRequest,
|
|
16
|
+
CreateInvitationRequest,
|
|
17
|
+
CreateSnaspotRequest,
|
|
18
|
+
GetPartyDetailsRequest,
|
|
19
|
+
InvitationDescriptor as InvitationDescriptorProto,
|
|
20
|
+
InvitationRequest,
|
|
15
21
|
InvitationState,
|
|
22
|
+
Party,
|
|
23
|
+
PartyDetails,
|
|
16
24
|
PartyService as IPartyService,
|
|
25
|
+
PartySnapshot,
|
|
26
|
+
RedeemedInvitation,
|
|
27
|
+
SetPartyStateRequest,
|
|
28
|
+
SubscribeMembersRequest,
|
|
17
29
|
SubscribeMembersResponse,
|
|
18
30
|
SubscribePartiesResponse,
|
|
19
|
-
SubscribePartyResponse,
|
|
20
31
|
SubscribePartyRequest,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
AuthenticateInvitationRequest,
|
|
24
|
-
InvitationRequest,
|
|
25
|
-
RedeemedInvitation,
|
|
26
|
-
SubscribeMembersRequest,
|
|
27
|
-
Party,
|
|
28
|
-
CreateSnaspotRequest,
|
|
29
|
-
GetPartyDetailsRequest,
|
|
30
|
-
PartyDetails
|
|
31
|
-
} from '../../proto/gen/dxos/client';
|
|
32
|
-
import { InvitationDescriptor as InvitationDescriptorProto } from '../../proto/gen/dxos/echo/invitation';
|
|
33
|
-
import { PartySnapshot } from '../../proto/gen/dxos/echo/snapshot';
|
|
34
|
-
import { resultSetToStream } from '../../util';
|
|
32
|
+
SubscribePartyResponse
|
|
33
|
+
} from '../../proto';
|
|
35
34
|
import { CreateServicesOpts, InviteeInvitation, InviteeInvitations } from './types';
|
|
36
35
|
|
|
37
36
|
/**
|
|
@@ -13,6 +13,7 @@ import { ECHO, InvitationDescriptor } from '@dxos/echo-db';
|
|
|
13
13
|
import {
|
|
14
14
|
AuthenticateInvitationRequest,
|
|
15
15
|
CreateProfileRequest,
|
|
16
|
+
InvitationDescriptor as InvitationDescriptorProto,
|
|
16
17
|
InvitationRequest,
|
|
17
18
|
InvitationState,
|
|
18
19
|
Profile,
|
|
@@ -20,8 +21,7 @@ import {
|
|
|
20
21
|
RecoverProfileRequest,
|
|
21
22
|
RedeemedInvitation,
|
|
22
23
|
SubscribeProfileResponse
|
|
23
|
-
} from '../../proto
|
|
24
|
-
import { InvitationDescriptor as InvitationDescriptorProto } from '../../proto/gen/dxos/echo/invitation';
|
|
24
|
+
} from '../../proto';
|
|
25
25
|
import { CreateServicesOpts, InviteeInvitation, InviteeInvitations } from './types';
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { ClientServices } from '../../
|
|
5
|
+
import { ClientServices } from '../../api';
|
|
6
6
|
import { createHaloService } from './halo';
|
|
7
7
|
import { createPartyService } from './party';
|
|
8
8
|
import { createProfileService } from './profile';
|