@dxos/client 2.33.9-dev.0cfaca1b → 2.33.9-dev.227ba79d
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 +1260 -2057
- 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 +34 -34
- package/dist/src/packlets/proto/gen/dxos/client.d.ts.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/dxos/client.js +1 -1
- package/dist/src/packlets/proto/gen/dxos/client.js.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/dxos/config.d.ts +27 -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 +4 -4
- 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 +0 -0
- package/dist/src/packlets/proto/gen/index.d.ts.map +1 -0
- package/dist/src/{proto → packlets/proto}/gen/index.js +1 -1
- 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} +7 -15
- package/dist/src/packlets/proxy/client-proxy.d.ts.map +1 -0
- package/dist/src/{api/client.js → packlets/proxy/client-proxy.js} +31 -75
- 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/{util → packlets/proxy}/messages.d.ts +0 -0
- package/dist/src/packlets/proxy/messages.d.ts.map +1 -0
- package/dist/src/{util → packlets/proxy}/messages.js +2 -2
- package/dist/src/packlets/proxy/messages.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/{version.d.ts → packlets/proxy/version.d.ts} +0 -0
- package/dist/src/packlets/proxy/version.d.ts.map +1 -0
- package/dist/src/{version.js → packlets/proxy/version.js} +0 -0
- 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/tsconfig.tsbuildinfo +1 -1
- package/package.json +19 -18
- 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 +34 -34
- package/src/{proto → packlets/proto}/gen/dxos/config.ts +27 -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 +4 -4
- package/src/{proto → packlets/proto}/gen/index.ts +1 -1
- 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} +39 -79
- 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/{util → packlets/proxy}/messages.ts +1 -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/{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/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.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.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.map +0 -1
- 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.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/index.ts +0 -6
- package/src/services/index.ts +0 -9
- package/src/util/index.ts +0 -7
- package/src/util/platform.test.ts +0 -12
- package/src/util/platform.ts +0 -7
- package/src/util/subscription.ts +0 -23
package/dist/browser.js
CHANGED
|
@@ -11979,7 +11979,7 @@ var require_stream_writable = __commonJS({
|
|
|
11979
11979
|
var internalUtil = {
|
|
11980
11980
|
deprecate: require_browser2()
|
|
11981
11981
|
};
|
|
11982
|
-
var
|
|
11982
|
+
var Stream10 = require_stream_browser();
|
|
11983
11983
|
var Buffer3 = (init_Buffer(), __toCommonJS(Buffer_exports)).Buffer;
|
|
11984
11984
|
var OurUint8Array = global.Uint8Array || function() {
|
|
11985
11985
|
};
|
|
@@ -12002,7 +12002,7 @@ var require_stream_writable = __commonJS({
|
|
|
12002
12002
|
var ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END;
|
|
12003
12003
|
var ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
|
|
12004
12004
|
var errorOrDestroy = destroyImpl.errorOrDestroy;
|
|
12005
|
-
require_inherits_browser()(Writable,
|
|
12005
|
+
require_inherits_browser()(Writable, Stream10);
|
|
12006
12006
|
function nop() {
|
|
12007
12007
|
}
|
|
12008
12008
|
function WritableState(options, stream, isDuplex) {
|
|
@@ -12096,7 +12096,7 @@ var require_stream_writable = __commonJS({
|
|
|
12096
12096
|
if (typeof options.final === "function")
|
|
12097
12097
|
this._final = options.final;
|
|
12098
12098
|
}
|
|
12099
|
-
|
|
12099
|
+
Stream10.call(this);
|
|
12100
12100
|
}
|
|
12101
12101
|
Writable.prototype.pipe = function() {
|
|
12102
12102
|
errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
|
|
@@ -13086,7 +13086,7 @@ var require_stream_readable = __commonJS({
|
|
|
13086
13086
|
var EElistenerCount = function EElistenerCount2(emitter, type) {
|
|
13087
13087
|
return emitter.listeners(type).length;
|
|
13088
13088
|
};
|
|
13089
|
-
var
|
|
13089
|
+
var Stream10 = require_stream_browser();
|
|
13090
13090
|
var Buffer3 = (init_Buffer(), __toCommonJS(Buffer_exports)).Buffer;
|
|
13091
13091
|
var OurUint8Array = global.Uint8Array || function() {
|
|
13092
13092
|
};
|
|
@@ -13116,7 +13116,7 @@ var require_stream_readable = __commonJS({
|
|
|
13116
13116
|
var StringDecoder;
|
|
13117
13117
|
var createReadableStreamAsyncIterator;
|
|
13118
13118
|
var from2;
|
|
13119
|
-
require_inherits_browser()(Readable2,
|
|
13119
|
+
require_inherits_browser()(Readable2, Stream10);
|
|
13120
13120
|
var errorOrDestroy = destroyImpl.errorOrDestroy;
|
|
13121
13121
|
var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
|
|
13122
13122
|
function prependListener(emitter, event, fn) {
|
|
@@ -13180,7 +13180,7 @@ var require_stream_readable = __commonJS({
|
|
|
13180
13180
|
if (typeof options.destroy === "function")
|
|
13181
13181
|
this._destroy = options.destroy;
|
|
13182
13182
|
}
|
|
13183
|
-
|
|
13183
|
+
Stream10.call(this);
|
|
13184
13184
|
}
|
|
13185
13185
|
Object.defineProperty(Readable2.prototype, "destroyed", {
|
|
13186
13186
|
enumerable: false,
|
|
@@ -13620,7 +13620,7 @@ var require_stream_readable = __commonJS({
|
|
|
13620
13620
|
return this;
|
|
13621
13621
|
};
|
|
13622
13622
|
Readable2.prototype.on = function(ev, fn) {
|
|
13623
|
-
var res =
|
|
13623
|
+
var res = Stream10.prototype.on.call(this, ev, fn);
|
|
13624
13624
|
var state = this._readableState;
|
|
13625
13625
|
if (ev === "data") {
|
|
13626
13626
|
state.readableListening = this.listenerCount("readable") > 0;
|
|
@@ -13643,14 +13643,14 @@ var require_stream_readable = __commonJS({
|
|
|
13643
13643
|
};
|
|
13644
13644
|
Readable2.prototype.addListener = Readable2.prototype.on;
|
|
13645
13645
|
Readable2.prototype.removeListener = function(ev, fn) {
|
|
13646
|
-
var res =
|
|
13646
|
+
var res = Stream10.prototype.removeListener.call(this, ev, fn);
|
|
13647
13647
|
if (ev === "readable") {
|
|
13648
13648
|
process.nextTick(updateReadableListening, this);
|
|
13649
13649
|
}
|
|
13650
13650
|
return res;
|
|
13651
13651
|
};
|
|
13652
13652
|
Readable2.prototype.removeAllListeners = function(ev) {
|
|
13653
|
-
var res =
|
|
13653
|
+
var res = Stream10.prototype.removeAllListeners.apply(this, arguments);
|
|
13654
13654
|
if (ev === "readable" || ev === void 0) {
|
|
13655
13655
|
process.nextTick(updateReadableListening, this);
|
|
13656
13656
|
}
|
|
@@ -14086,14 +14086,14 @@ var require_pipeline = __commonJS({
|
|
|
14086
14086
|
// ../../../common/temp/node_modules/.pnpm/readable-stream@3.6.0/node_modules/readable-stream/readable.js
|
|
14087
14087
|
var require_readable = __commonJS({
|
|
14088
14088
|
"../../../common/temp/node_modules/.pnpm/readable-stream@3.6.0/node_modules/readable-stream/readable.js"(exports, module2) {
|
|
14089
|
-
var
|
|
14090
|
-
if (process.env.READABLE_STREAM === "disable" &&
|
|
14091
|
-
module2.exports =
|
|
14092
|
-
Object.assign(module2.exports,
|
|
14093
|
-
module2.exports.Stream =
|
|
14089
|
+
var Stream10 = require_readable();
|
|
14090
|
+
if (process.env.READABLE_STREAM === "disable" && Stream10) {
|
|
14091
|
+
module2.exports = Stream10.Readable;
|
|
14092
|
+
Object.assign(module2.exports, Stream10);
|
|
14093
|
+
module2.exports.Stream = Stream10;
|
|
14094
14094
|
} else {
|
|
14095
14095
|
exports = module2.exports = require_stream_readable();
|
|
14096
|
-
exports.Stream =
|
|
14096
|
+
exports.Stream = Stream10 || exports;
|
|
14097
14097
|
exports.Readable = exports;
|
|
14098
14098
|
exports.Writable = require_stream_writable();
|
|
14099
14099
|
exports.Duplex = require_stream_duplex();
|
|
@@ -70430,7 +70430,7 @@ var require_streamx = __commonJS({
|
|
|
70430
70430
|
this.push(data);
|
|
70431
70431
|
this._writableState.afterWrite(err);
|
|
70432
70432
|
}
|
|
70433
|
-
var
|
|
70433
|
+
var Stream10 = class extends EventEmitter {
|
|
70434
70434
|
constructor(opts) {
|
|
70435
70435
|
super();
|
|
70436
70436
|
this._duplexState = 0;
|
|
@@ -70504,7 +70504,7 @@ var require_streamx = __commonJS({
|
|
|
70504
70504
|
return super.on(name, fn);
|
|
70505
70505
|
}
|
|
70506
70506
|
};
|
|
70507
|
-
var Readable2 = class extends
|
|
70507
|
+
var Readable2 = class extends Stream10 {
|
|
70508
70508
|
constructor(opts) {
|
|
70509
70509
|
super(opts);
|
|
70510
70510
|
this._duplexState |= OPENING | WRITE_DONE;
|
|
@@ -70655,7 +70655,7 @@ var require_streamx = __commonJS({
|
|
|
70655
70655
|
}
|
|
70656
70656
|
}
|
|
70657
70657
|
};
|
|
70658
|
-
var Writable = class extends
|
|
70658
|
+
var Writable = class extends Stream10 {
|
|
70659
70659
|
constructor(opts) {
|
|
70660
70660
|
super(opts);
|
|
70661
70661
|
this._duplexState |= OPENING | READ_DONE;
|
|
@@ -70856,7 +70856,7 @@ var require_streamx = __commonJS({
|
|
|
70856
70856
|
pipelinePromise,
|
|
70857
70857
|
isStream,
|
|
70858
70858
|
isStreamx,
|
|
70859
|
-
Stream:
|
|
70859
|
+
Stream: Stream10,
|
|
70860
70860
|
Writable,
|
|
70861
70861
|
Readable: Readable2,
|
|
70862
70862
|
Duplex,
|
|
@@ -82357,15 +82357,15 @@ var require_feed = __commonJS({
|
|
|
82357
82357
|
"use strict";
|
|
82358
82358
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
82359
82359
|
exports.ItemMutation = void 0;
|
|
82360
|
-
var
|
|
82361
|
-
(function(
|
|
82360
|
+
var ItemMutation2;
|
|
82361
|
+
(function(ItemMutation3) {
|
|
82362
82362
|
let Action;
|
|
82363
82363
|
(function(Action2) {
|
|
82364
82364
|
Action2[Action2["NOOP"] = 0] = "NOOP";
|
|
82365
82365
|
Action2[Action2["DELETE"] = 1] = "DELETE";
|
|
82366
82366
|
Action2[Action2["RESTORE"] = 2] = "RESTORE";
|
|
82367
|
-
})(Action =
|
|
82368
|
-
})(
|
|
82367
|
+
})(Action = ItemMutation3.Action || (ItemMutation3.Action = {}));
|
|
82368
|
+
})(ItemMutation2 = exports.ItemMutation || (exports.ItemMutation = {}));
|
|
82369
82369
|
}
|
|
82370
82370
|
});
|
|
82371
82371
|
|
|
@@ -82375,14 +82375,14 @@ var require_invitation2 = __commonJS({
|
|
|
82375
82375
|
"use strict";
|
|
82376
82376
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
82377
82377
|
exports.InvitationDescriptor = void 0;
|
|
82378
|
-
var
|
|
82379
|
-
(function(
|
|
82378
|
+
var InvitationDescriptor8;
|
|
82379
|
+
(function(InvitationDescriptor9) {
|
|
82380
82380
|
let Type;
|
|
82381
82381
|
(function(Type2) {
|
|
82382
82382
|
Type2[Type2["INTERACTIVE"] = 1] = "INTERACTIVE";
|
|
82383
82383
|
Type2[Type2["OFFLINE"] = 2] = "OFFLINE";
|
|
82384
|
-
})(Type =
|
|
82385
|
-
})(
|
|
82384
|
+
})(Type = InvitationDescriptor9.Type || (InvitationDescriptor9.Type = {}));
|
|
82385
|
+
})(InvitationDescriptor8 = exports.InvitationDescriptor || (exports.InvitationDescriptor = {}));
|
|
82386
82386
|
}
|
|
82387
82387
|
});
|
|
82388
82388
|
|
|
@@ -87013,7 +87013,7 @@ var require_result_set = __commonJS({
|
|
|
87013
87013
|
exports.ResultSet = void 0;
|
|
87014
87014
|
var node_assert_1 = __importDefault(require_assert());
|
|
87015
87015
|
var async_1 = require("@dxos/async");
|
|
87016
|
-
var
|
|
87016
|
+
var ResultSet4 = class {
|
|
87017
87017
|
constructor(itemUpdate, getter) {
|
|
87018
87018
|
this._resultsUpdate = new async_1.Event();
|
|
87019
87019
|
this.update = this._resultsUpdate;
|
|
@@ -87043,7 +87043,7 @@ var require_result_set = __commonJS({
|
|
|
87043
87043
|
return this._resultsUpdate.waitFor(condition);
|
|
87044
87044
|
}
|
|
87045
87045
|
};
|
|
87046
|
-
exports.ResultSet =
|
|
87046
|
+
exports.ResultSet = ResultSet4;
|
|
87047
87047
|
}
|
|
87048
87048
|
});
|
|
87049
87049
|
|
|
@@ -87109,6 +87109,33 @@ var require_schema = __commonJS({
|
|
|
87109
87109
|
}
|
|
87110
87110
|
});
|
|
87111
87111
|
|
|
87112
|
+
// ../../echo/echo-db/dist/src/api/subscription.js
|
|
87113
|
+
var require_subscription = __commonJS({
|
|
87114
|
+
"../../echo/echo-db/dist/src/api/subscription.js"(exports) {
|
|
87115
|
+
"use strict";
|
|
87116
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
87117
|
+
exports.streamToResultSet = exports.resultSetToStream = void 0;
|
|
87118
|
+
var async_1 = require("@dxos/async");
|
|
87119
|
+
var codec_protobuf_1 = require("@dxos/codec-protobuf");
|
|
87120
|
+
var result_set_1 = require_result_set();
|
|
87121
|
+
var resultSetToStream3 = (resultSet, map) => new codec_protobuf_1.Stream(({ next }) => {
|
|
87122
|
+
next(map(resultSet.value));
|
|
87123
|
+
return resultSet.update.on(() => next(map(resultSet.value)));
|
|
87124
|
+
});
|
|
87125
|
+
exports.resultSetToStream = resultSetToStream3;
|
|
87126
|
+
var streamToResultSet2 = (stream, map) => {
|
|
87127
|
+
const event = new async_1.Event();
|
|
87128
|
+
let lastItem;
|
|
87129
|
+
stream.subscribe((data) => {
|
|
87130
|
+
lastItem = data;
|
|
87131
|
+
event.emit();
|
|
87132
|
+
});
|
|
87133
|
+
return new result_set_1.ResultSet(event, () => map(lastItem));
|
|
87134
|
+
};
|
|
87135
|
+
exports.streamToResultSet = streamToResultSet2;
|
|
87136
|
+
}
|
|
87137
|
+
});
|
|
87138
|
+
|
|
87112
87139
|
// ../../echo/echo-db/dist/src/api/index.js
|
|
87113
87140
|
var require_api2 = __commonJS({
|
|
87114
87141
|
"../../echo/echo-db/dist/src/api/index.js"(exports) {
|
|
@@ -87136,6 +87163,7 @@ var require_api2 = __commonJS({
|
|
|
87136
87163
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
87137
87164
|
__exportStar(require_result_set(), exports);
|
|
87138
87165
|
__exportStar(require_schema(), exports);
|
|
87166
|
+
__exportStar(require_subscription(), exports);
|
|
87139
87167
|
}
|
|
87140
87168
|
});
|
|
87141
87169
|
|
|
@@ -87230,10 +87258,7 @@ var require_connection = __commonJS({
|
|
|
87230
87258
|
log3("Dropping signal for incorrect session id.");
|
|
87231
87259
|
return;
|
|
87232
87260
|
}
|
|
87233
|
-
(0, node_assert_1.default)(msg.data);
|
|
87234
|
-
if (msg.data.offer && this._state === ConnectionState.INITIATING_CONNECTION) {
|
|
87235
|
-
throw new Error("Invalid state: Cannot send offer to an initiating peer.");
|
|
87236
|
-
}
|
|
87261
|
+
(0, node_assert_1.default)(msg.data.signal);
|
|
87237
87262
|
(0, node_assert_1.default)((_a = msg.id) === null || _a === void 0 ? void 0 : _a.equals(this.remoteId));
|
|
87238
87263
|
(0, node_assert_1.default)((_b = msg.remoteId) === null || _b === void 0 ? void 0 : _b.equals(this.ownId));
|
|
87239
87264
|
if (this._state === ConnectionState.INITIAL) {
|
|
@@ -87284,19 +87309,17 @@ var require_swarm = __commonJS({
|
|
|
87284
87309
|
var connection_1 = require_connection();
|
|
87285
87310
|
var log3 = (0, debug_1.default)("dxos:network-manager:swarm");
|
|
87286
87311
|
var Swarm = class {
|
|
87287
|
-
constructor(_topic, _ownPeerId, _topology, _protocolProvider, _signalMessaging,
|
|
87312
|
+
constructor(_topic, _ownPeerId, _topology, _protocolProvider, _signalMessaging, _transportFactory, _label) {
|
|
87288
87313
|
this._topic = _topic;
|
|
87289
87314
|
this._ownPeerId = _ownPeerId;
|
|
87290
87315
|
this._topology = _topology;
|
|
87291
87316
|
this._protocolProvider = _protocolProvider;
|
|
87292
87317
|
this._signalMessaging = _signalMessaging;
|
|
87293
|
-
this._lookupPeers = _lookupPeers;
|
|
87294
87318
|
this._transportFactory = _transportFactory;
|
|
87295
87319
|
this._label = _label;
|
|
87296
87320
|
this.id = protocols_1.PublicKey.random();
|
|
87297
87321
|
this._connections = new util_1.ComplexMap((x) => x.toHex());
|
|
87298
87322
|
this._discoveredPeers = new util_1.ComplexSet((x) => x.toHex());
|
|
87299
|
-
this._peerCandidatesUpdated = new async_1.Event();
|
|
87300
87323
|
this.connectionAdded = new async_1.Event();
|
|
87301
87324
|
this.connectionRemoved = new async_1.Event();
|
|
87302
87325
|
this.connected = new async_1.Event();
|
|
@@ -87316,16 +87339,17 @@ var require_swarm = __commonJS({
|
|
|
87316
87339
|
get topic() {
|
|
87317
87340
|
return this._topic;
|
|
87318
87341
|
}
|
|
87319
|
-
|
|
87320
|
-
log3(`
|
|
87321
|
-
|
|
87322
|
-
|
|
87323
|
-
|
|
87324
|
-
|
|
87342
|
+
onSwarmEvent(swarmEvent) {
|
|
87343
|
+
log3(`Swarm event ${JSON.stringify(swarmEvent)}`);
|
|
87344
|
+
if (swarmEvent.peerAvailable) {
|
|
87345
|
+
const peerId = protocols_1.PublicKey.from(swarmEvent.peerAvailable.peer);
|
|
87346
|
+
log3(`New peer for ${this._topic} ${peerId}`);
|
|
87347
|
+
if (!peerId.equals(this._ownPeerId)) {
|
|
87348
|
+
this._discoveredPeers.add(peerId);
|
|
87325
87349
|
}
|
|
87326
|
-
|
|
87350
|
+
} else if (swarmEvent.peerLeft) {
|
|
87351
|
+
this._discoveredPeers.delete(protocols_1.PublicKey.from(swarmEvent.peerLeft.peer));
|
|
87327
87352
|
}
|
|
87328
|
-
this._peerCandidatesUpdated.emit();
|
|
87329
87353
|
this._topology.update();
|
|
87330
87354
|
}
|
|
87331
87355
|
async onOffer(message) {
|
|
@@ -87333,8 +87357,14 @@ var require_swarm = __commonJS({
|
|
|
87333
87357
|
log3(`Offer from ${JSON.stringify(message)}`);
|
|
87334
87358
|
(0, node_assert_1.default)(message.id);
|
|
87335
87359
|
const remoteId = message.id;
|
|
87336
|
-
|
|
87337
|
-
|
|
87360
|
+
if (!((_a = message.remoteId) === null || _a === void 0 ? void 0 : _a.equals(this._ownPeerId))) {
|
|
87361
|
+
log3(`Rejecting offer with incorrect peerId: ${message.remoteId}`);
|
|
87362
|
+
return { accept: false };
|
|
87363
|
+
}
|
|
87364
|
+
if (!((_b = message.topic) === null || _b === void 0 ? void 0 : _b.equals(this._topic))) {
|
|
87365
|
+
log3(`Rejecting offer with incorrect topic: ${message.topic}`);
|
|
87366
|
+
return { accept: false };
|
|
87367
|
+
}
|
|
87338
87368
|
if (this._connections.has(remoteId)) {
|
|
87339
87369
|
if (remoteId.toHex() < this._ownPeerId.toHex()) {
|
|
87340
87370
|
log3(`[${this._ownPeerId}] Closing local connection and accepting remote peer's offer.`);
|
|
@@ -87404,9 +87434,6 @@ var require_swarm = __commonJS({
|
|
|
87404
87434
|
this.errors.raise(err);
|
|
87405
87435
|
}
|
|
87406
87436
|
this._topology.update();
|
|
87407
|
-
},
|
|
87408
|
-
lookup: () => {
|
|
87409
|
-
this._lookupPeers(this._topic);
|
|
87410
87437
|
}
|
|
87411
87438
|
};
|
|
87412
87439
|
}
|
|
@@ -87415,6 +87442,7 @@ var require_swarm = __commonJS({
|
|
|
87415
87442
|
return;
|
|
87416
87443
|
}
|
|
87417
87444
|
const sessionId = protocols_1.PublicKey.random();
|
|
87445
|
+
log3(`Initiate connection: topic=${this._topic} peerId=${remoteId} sessionId=${sessionId}`);
|
|
87418
87446
|
const connection = this._createConnection(true, remoteId, sessionId);
|
|
87419
87447
|
this._signalMessaging.offer({
|
|
87420
87448
|
id: this._ownPeerId,
|
|
@@ -87444,7 +87472,7 @@ var require_swarm = __commonJS({
|
|
|
87444
87472
|
this._topology.update();
|
|
87445
87473
|
}
|
|
87446
87474
|
_createConnection(initiator, remoteId, sessionId) {
|
|
87447
|
-
log3(`Create connection topic=${this._topic} remoteId=${remoteId} initiator=${initiator}`);
|
|
87475
|
+
log3(`Create connection topic=${this._topic} ownId=${this._ownPeerId} remoteId=${remoteId} initiator=${initiator}`);
|
|
87448
87476
|
(0, node_assert_1.default)(!this._connections.has(remoteId), "Peer already connected.");
|
|
87449
87477
|
const connection = new connection_1.Connection(this._topic, this._ownPeerId, remoteId, sessionId, initiator, (msg) => this._signalMessaging.signal(msg), this._protocolProvider({ channel: (0, crypto_1.discoveryKey)(this._topic), initiator }), this._transportFactory);
|
|
87450
87478
|
this._connections.set(remoteId, connection);
|
|
@@ -87705,8 +87733,9 @@ var require_in_memory_signal_manager = __commonJS({
|
|
|
87705
87733
|
this._onOffer = _onOffer;
|
|
87706
87734
|
this.statusChanged = new async_1.Event();
|
|
87707
87735
|
this.commandTrace = new async_1.Event();
|
|
87708
|
-
this.
|
|
87709
|
-
this.
|
|
87736
|
+
this.swarmEvent = new async_1.Event();
|
|
87737
|
+
this.onMessage = new async_1.Event();
|
|
87738
|
+
state.swarmEvent.on((data) => this.swarmEvent.emit(data));
|
|
87710
87739
|
}
|
|
87711
87740
|
getStatus() {
|
|
87712
87741
|
return [];
|
|
@@ -87717,32 +87746,51 @@ var require_in_memory_signal_manager = __commonJS({
|
|
|
87717
87746
|
}
|
|
87718
87747
|
state.swarms.get(topic).add(peerId);
|
|
87719
87748
|
state.connections.set(peerId, this);
|
|
87720
|
-
|
|
87749
|
+
state.swarmEvent.emit([topic, {
|
|
87750
|
+
peerAvailable: {
|
|
87751
|
+
peer: peerId.asUint8Array(),
|
|
87752
|
+
since: new Date()
|
|
87753
|
+
}
|
|
87754
|
+
}]);
|
|
87755
|
+
for (const [topic2, peerIds] of state.swarms) {
|
|
87756
|
+
Array.from(peerIds).forEach((peerId2) => {
|
|
87757
|
+
this.swarmEvent.emit([topic2, {
|
|
87758
|
+
peerAvailable: {
|
|
87759
|
+
peer: peerId2.asUint8Array(),
|
|
87760
|
+
since: new Date()
|
|
87761
|
+
}
|
|
87762
|
+
}]);
|
|
87763
|
+
});
|
|
87764
|
+
}
|
|
87721
87765
|
}
|
|
87722
87766
|
leave(topic, peerId) {
|
|
87723
87767
|
if (!state.swarms.has(topic)) {
|
|
87724
87768
|
state.swarms.set(topic, new util_1.ComplexSet((x) => x.toHex()));
|
|
87725
87769
|
}
|
|
87726
87770
|
state.swarms.get(topic).delete(peerId);
|
|
87727
|
-
|
|
87728
|
-
|
|
87729
|
-
|
|
87771
|
+
const swarmEvent = {
|
|
87772
|
+
peerLeft: {
|
|
87773
|
+
peer: peerId.asUint8Array()
|
|
87774
|
+
}
|
|
87775
|
+
};
|
|
87776
|
+
state.swarmEvent.emit([topic, swarmEvent]);
|
|
87730
87777
|
}
|
|
87731
87778
|
offer(msg) {
|
|
87732
87779
|
(0, node_assert_1.default)(msg.remoteId);
|
|
87733
87780
|
(0, node_assert_1.default)(state.connections.has(msg.remoteId), "Peer not connected");
|
|
87734
87781
|
return state.connections.get(msg.remoteId)._onOffer(msg);
|
|
87735
87782
|
}
|
|
87736
|
-
async
|
|
87783
|
+
async message(msg) {
|
|
87737
87784
|
(0, node_assert_1.default)(msg.remoteId);
|
|
87738
87785
|
(0, node_assert_1.default)(state.connections.get(msg.remoteId), "Peer not connected");
|
|
87739
|
-
state.connections.get(msg.remoteId).
|
|
87786
|
+
state.connections.get(msg.remoteId).onMessage.emit(msg);
|
|
87740
87787
|
}
|
|
87741
87788
|
async destroy() {
|
|
87742
87789
|
}
|
|
87743
87790
|
};
|
|
87744
87791
|
exports.InMemorySignalManager = InMemorySignalManager;
|
|
87745
87792
|
var state = {
|
|
87793
|
+
swarmEvent: new async_1.Event(),
|
|
87746
87794
|
swarms: new util_1.ComplexMap((x) => x.toHex()),
|
|
87747
87795
|
connections: new util_1.ComplexMap((x) => x.toHex())
|
|
87748
87796
|
};
|
|
@@ -87774,9 +87822,11 @@ var require_substitutions4 = __commonJS({
|
|
|
87774
87822
|
"../../mesh/network-manager/dist/src/proto/substitutions.js"(exports) {
|
|
87775
87823
|
"use strict";
|
|
87776
87824
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
87825
|
+
var codec_protobuf_1 = require("@dxos/codec-protobuf");
|
|
87777
87826
|
var protocols_1 = require("@dxos/protocols");
|
|
87778
87827
|
exports.default = {
|
|
87779
|
-
...protocols_1.publicKeySubstitutions
|
|
87828
|
+
...protocols_1.publicKeySubstitutions,
|
|
87829
|
+
...codec_protobuf_1.timestampSubstitutions
|
|
87780
87830
|
};
|
|
87781
87831
|
}
|
|
87782
87832
|
});
|
|
@@ -87792,7 +87842,7 @@ var require_gen5 = __commonJS({
|
|
|
87792
87842
|
exports.schema = exports.schemaJson = void 0;
|
|
87793
87843
|
var codec_protobuf_1 = require("@dxos/codec-protobuf");
|
|
87794
87844
|
var substitutions_1 = __importDefault(require_substitutions4());
|
|
87795
|
-
exports.schemaJson = JSON.parse('{"nested":{"dxos":{"nested":{"credentials":{"nested":{"Message":{"fields":{"payload":{"rule":"required","type":"google.protobuf.Any","id":1,"comment":null}},"comment":null},"SignedMessage":{"fields":{"signed":{"rule":"required","type":"Signed","id":1,"comment":"The signed message contents."},"signatures":{"rule":"repeated","type":"Signature","id":2,"comment":"An array of Signatures, one for each key that signed the message."}},"nested":{"Signature":{"oneofs":{"_keyChain":{"oneof":["keyChain"]}},"fields":{"key":{"rule":"required","type":"PubKey","id":1,"comment":"The publicKey of the keypair that made this signature."},"signature":{"rule":"required","type":"bytes","id":2,"comment":"The bytes of the signature."},"keyChain":{"type":"KeyChain","id":3,"options":{"proto3_optional":true},"comment":"The certification chain of SignedMessages for this key."}},"comment":null},"Signed":{"fields":{"created":{"rule":"required","type":"string","id":1,"comment":"RFC-3339 datetime string."},"nonce":{"rule":"required","type":"bytes","id":2,"comment":null},"payload":{"rule":"required","type":"google.protobuf.Any","id":10,"comment":"The payload to be signed."}},"comment":null}},"comment":"A generic container message used whenever messages are signed (e.g. PartyCredential)"}}},"halo":{"nested":{"keys":{"nested":{"KeyChain":{"fields":{"publicKey":{"rule":"required","type":"PubKey","id":1,"comment":null},"message":{"rule":"required","type":"SignedMessage","id":2,"comment":null},"parents":{"rule":"repeated","type":"KeyChain","id":3,"comment":null}},"comment":null},"KeyRecord":{"oneofs":{"_secretKey":{"oneof":["secretKey"]},"_hint":{"oneof":["hint"]},"_own":{"oneof":["own"]},"_trusted":{"oneof":["trusted"]},"_added":{"oneof":["added"]},"_created":{"oneof":["created"]}},"fields":{"type":{"rule":"required","type":"KeyType","id":1,"comment":"The `KeyType` type of the key. This is often unknown for keys from other sources."},"publicKey":{"rule":"required","type":"PubKey","id":2,"comment":"The public key as a Buffer (required)."},"secretKey":{"type":"PrivKey","id":3,"options":{"proto3_optional":true},"comment":"The secret key as a Buffer (this will never be visible outside the Keyring)."},"hint":{"type":"bool","id":4,"options":{"proto3_optional":true},"comment":"Is this key from a Greeting \\"hint\\"?"},"own":{"type":"bool","id":5,"options":{"proto3_optional":true},"comment":"Determines if this is our key?\\nUsually true if `secretKey` is present; may be false for \\"inception keys\\" such as the Party key."},"trusted":{"type":"bool","id":6,"options":{"proto3_optional":true},"comment":"Is this key to be trusted?"},"added":{"type":"string","id":7,"options":{"proto3_optional":true},"comment":"An RFC-3339 date/time string for when the key was added to the Keyring."},"created":{"type":"string","id":8,"options":{"proto3_optional":true},"comment":"An RFC-3339 date/time string for when the key was created."}},"comment":null},"KeyRecordList":{"fields":{"keys":{"rule":"repeated","type":"KeyRecord","id":1,"comment":null}},"comment":null},"KeyType":{"values":{"UNKNOWN":0,"IDENTITY":1,"DEVICE":2,"PARTY":3,"FEED":4,"DXNS_ADDRESS":5},"comment":null,"comments":{"UNKNOWN":null,"IDENTITY":null,"DEVICE":null,"PARTY":null,"FEED":null,"DXNS_ADDRESS":null}},"PrivKey":{"fields":{"data":{"type":"bytes","id":1,"comment":null}},"comment":null},"PubKey":{"fields":{"data":{"type":"bytes","id":1,"comment":null}},"comment":null}}}}},"mesh":{"nested":{"signal":{"nested":{"
|
|
87845
|
+
exports.schemaJson = JSON.parse('{"nested":{"dxos":{"nested":{"credentials":{"nested":{"Message":{"fields":{"payload":{"rule":"required","type":"google.protobuf.Any","id":1,"comment":null}},"comment":null},"SignedMessage":{"fields":{"signed":{"rule":"required","type":"Signed","id":1,"comment":"The signed message contents."},"signatures":{"rule":"repeated","type":"Signature","id":2,"comment":"An array of Signatures, one for each key that signed the message."}},"nested":{"Signature":{"oneofs":{"_keyChain":{"oneof":["keyChain"]}},"fields":{"key":{"rule":"required","type":"PubKey","id":1,"comment":"The publicKey of the keypair that made this signature."},"signature":{"rule":"required","type":"bytes","id":2,"comment":"The bytes of the signature."},"keyChain":{"type":"KeyChain","id":3,"options":{"proto3_optional":true},"comment":"The certification chain of SignedMessages for this key."}},"comment":null},"Signed":{"fields":{"created":{"rule":"required","type":"string","id":1,"comment":"RFC-3339 datetime string."},"nonce":{"rule":"required","type":"bytes","id":2,"comment":null},"payload":{"rule":"required","type":"google.protobuf.Any","id":10,"comment":"The payload to be signed."}},"comment":null}},"comment":"A generic container message used whenever messages are signed (e.g. PartyCredential)"}}},"halo":{"nested":{"keys":{"nested":{"KeyChain":{"fields":{"publicKey":{"rule":"required","type":"PubKey","id":1,"comment":null},"message":{"rule":"required","type":"SignedMessage","id":2,"comment":null},"parents":{"rule":"repeated","type":"KeyChain","id":3,"comment":null}},"comment":null},"KeyRecord":{"oneofs":{"_secretKey":{"oneof":["secretKey"]},"_hint":{"oneof":["hint"]},"_own":{"oneof":["own"]},"_trusted":{"oneof":["trusted"]},"_added":{"oneof":["added"]},"_created":{"oneof":["created"]}},"fields":{"type":{"rule":"required","type":"KeyType","id":1,"comment":"The `KeyType` type of the key. This is often unknown for keys from other sources."},"publicKey":{"rule":"required","type":"PubKey","id":2,"comment":"The public key as a Buffer (required)."},"secretKey":{"type":"PrivKey","id":3,"options":{"proto3_optional":true},"comment":"The secret key as a Buffer (this will never be visible outside the Keyring)."},"hint":{"type":"bool","id":4,"options":{"proto3_optional":true},"comment":"Is this key from a Greeting \\"hint\\"?"},"own":{"type":"bool","id":5,"options":{"proto3_optional":true},"comment":"Determines if this is our key?\\nUsually true if `secretKey` is present; may be false for \\"inception keys\\" such as the Party key."},"trusted":{"type":"bool","id":6,"options":{"proto3_optional":true},"comment":"Is this key to be trusted?"},"added":{"type":"string","id":7,"options":{"proto3_optional":true},"comment":"An RFC-3339 date/time string for when the key was added to the Keyring."},"created":{"type":"string","id":8,"options":{"proto3_optional":true},"comment":"An RFC-3339 date/time string for when the key was created."}},"comment":null},"KeyRecordList":{"fields":{"keys":{"rule":"repeated","type":"KeyRecord","id":1,"comment":null}},"comment":null},"KeyType":{"values":{"UNKNOWN":0,"IDENTITY":1,"DEVICE":2,"PARTY":3,"FEED":4,"DXNS_ADDRESS":5},"comment":null,"comments":{"UNKNOWN":null,"IDENTITY":null,"DEVICE":null,"PARTY":null,"FEED":null,"DXNS_ADDRESS":null}},"PrivKey":{"fields":{"data":{"type":"bytes","id":1,"comment":null}},"comment":null},"PubKey":{"fields":{"data":{"type":"bytes","id":1,"comment":null}},"comment":null}}}}},"mesh":{"nested":{"signal":{"options":{"go_package":"github.com/dxos/kube/go/signal/pb"},"nested":{"HostEvent":{"oneofs":{"event":{"oneof":["peerAvailable"],"comment":null}},"fields":{"peerAvailable":{"type":"SwarmEvent.PeerAvailable","id":1,"comment":null}},"comment":null},"JoinRequest":{"fields":{"swarm":{"type":"bytes","id":1,"comment":null},"peer":{"type":"bytes","id":2,"comment":null}},"comment":null},"Message":{"fields":{"author":{"type":"bytes","id":1,"comment":null},"recipient":{"type":"bytes","id":2,"comment":null},"payload":{"type":"google.protobuf.Any","id":3,"comment":null}},"comment":null},"PeerEvent":{"oneofs":{"event":{"oneof":["message"],"comment":null}},"fields":{"message":{"type":"Message","id":1,"comment":null}},"comment":null},"ReceptionRequest":{"fields":{"peer":{"type":"bytes","id":1,"comment":null}},"comment":null},"Signal":{"methods":{"Join":{"requestType":"JoinRequest","responseType":"SwarmEvent","responseStream":true,"comment":null},"ReceiveMessages":{"requestType":"ReceptionRequest","responseType":"Message","responseStream":true,"comment":null},"SendMessage":{"requestType":"Message","responseType":"google.protobuf.Empty","comment":null}},"comment":null},"SwarmEvent":{"oneofs":{"event":{"oneof":["peerAvailable","peerLeft"],"comment":null}},"fields":{"peerAvailable":{"type":"PeerAvailable","id":1,"comment":null},"peerLeft":{"type":"PeerLeft","id":2,"comment":null}},"nested":{"PeerAvailable":{"oneofs":{"_until":{"oneof":["until"]},"_announceBackToHost":{"oneof":["announceBackToHost"]}},"fields":{"peer":{"type":"bytes","id":1,"comment":null},"since":{"type":"google.protobuf.Timestamp","id":2,"comment":null},"until":{"type":"google.protobuf.Timestamp","id":3,"options":{"proto3_optional":true},"comment":null},"announceBackToHost":{"type":"bytes","id":4,"options":{"proto3_optional":true},"comment":null}},"comment":null},"PeerLeft":{"fields":{"peer":{"type":"bytes","id":1,"comment":null}},"comment":null}},"comment":null}}},"signalMessage":{"nested":{"Acknowledgement":{"fields":{"messageId":{"type":"PubKey","id":1,"comment":null}},"comment":null},"Answer":{"oneofs":{"_offerMessageId":{"oneof":["offerMessageId"]}},"fields":{"accept":{"type":"bool","id":1,"comment":null},"offerMessageId":{"type":"PubKey","id":2,"options":{"proto3_optional":true},"comment":"MessageId of the Offer being answered."}},"comment":null},"MessageData":{"oneofs":{"payload":{"oneof":["offer","answer","signal","ack"],"comment":null}},"fields":{"offer":{"type":"Offer","id":1,"comment":null},"answer":{"type":"Answer","id":2,"comment":null},"signal":{"type":"Signal","id":3,"comment":null},"ack":{"type":"Acknowledgement","id":4,"comment":null}},"comment":null},"Offer":{"fields":{},"comment":null},"Signal":{"fields":{"json":{"type":"string","id":1,"comment":null}},"comment":null},"SignalMessage":{"oneofs":{"_messageId":{"oneof":["messageId"]}},"fields":{"id":{"type":"PubKey","id":1,"comment":"Sender\'s public key."},"remoteId":{"type":"PubKey","id":2,"comment":"Receiver`s public key."},"topic":{"type":"PubKey","id":3,"comment":"Swarm identefier."},"sessionId":{"type":"PubKey","id":4,"comment":"Unique connection identifier."},"data":{"type":"MessageData","id":5,"comment":"Message payload."},"messageId":{"type":"PubKey","id":6,"options":{"proto3_optional":true},"comment":"Unique message identifier. Used for Acknolegment and matching Anwers to Offers."}},"comment":null}}}}}}},"google":{"nested":{"protobuf":{"nested":{"Any":{"fields":{"type_url":{"type":"string","id":1},"value":{"type":"bytes","id":2}},"comment":null},"Empty":{"fields":{},"comment":null},"Timestamp":{"fields":{"seconds":{"type":"int64","id":1},"nanos":{"type":"int32","id":2}},"comment":null}}}}}}}');
|
|
87796
87846
|
exports.schema = codec_protobuf_1.Schema.fromJson(exports.schemaJson, substitutions_1.default);
|
|
87797
87847
|
}
|
|
87798
87848
|
});
|
|
@@ -87816,797 +87866,41 @@ var require_browser18 = __commonJS({
|
|
|
87816
87866
|
}
|
|
87817
87867
|
});
|
|
87818
87868
|
|
|
87819
|
-
//
|
|
87820
|
-
var
|
|
87821
|
-
"
|
|
87822
|
-
"use strict";
|
|
87823
|
-
var anyMap = /* @__PURE__ */ new WeakMap();
|
|
87824
|
-
var eventsMap = /* @__PURE__ */ new WeakMap();
|
|
87825
|
-
var producersMap = /* @__PURE__ */ new WeakMap();
|
|
87826
|
-
var anyProducer = Symbol("anyProducer");
|
|
87827
|
-
var resolvedPromise = Promise.resolve();
|
|
87828
|
-
var listenerAdded = Symbol("listenerAdded");
|
|
87829
|
-
var listenerRemoved = Symbol("listenerRemoved");
|
|
87830
|
-
function assertEventName(eventName) {
|
|
87831
|
-
if (typeof eventName !== "string" && typeof eventName !== "symbol") {
|
|
87832
|
-
throw new TypeError("eventName must be a string or a symbol");
|
|
87833
|
-
}
|
|
87834
|
-
}
|
|
87835
|
-
function assertListener(listener) {
|
|
87836
|
-
if (typeof listener !== "function") {
|
|
87837
|
-
throw new TypeError("listener must be a function");
|
|
87838
|
-
}
|
|
87839
|
-
}
|
|
87840
|
-
function getListeners(instance, eventName) {
|
|
87841
|
-
const events = eventsMap.get(instance);
|
|
87842
|
-
if (!events.has(eventName)) {
|
|
87843
|
-
events.set(eventName, /* @__PURE__ */ new Set());
|
|
87844
|
-
}
|
|
87845
|
-
return events.get(eventName);
|
|
87846
|
-
}
|
|
87847
|
-
function getEventProducers(instance, eventName) {
|
|
87848
|
-
const key = typeof eventName === "string" ? eventName : anyProducer;
|
|
87849
|
-
const producers = producersMap.get(instance);
|
|
87850
|
-
if (!producers.has(key)) {
|
|
87851
|
-
producers.set(key, /* @__PURE__ */ new Set());
|
|
87852
|
-
}
|
|
87853
|
-
return producers.get(key);
|
|
87854
|
-
}
|
|
87855
|
-
function enqueueProducers(instance, eventName, eventData) {
|
|
87856
|
-
const producers = producersMap.get(instance);
|
|
87857
|
-
if (producers.has(eventName)) {
|
|
87858
|
-
for (const producer of producers.get(eventName)) {
|
|
87859
|
-
producer.enqueue(eventData);
|
|
87860
|
-
}
|
|
87861
|
-
}
|
|
87862
|
-
if (producers.has(anyProducer)) {
|
|
87863
|
-
const item = Promise.all([eventName, eventData]);
|
|
87864
|
-
for (const producer of producers.get(anyProducer)) {
|
|
87865
|
-
producer.enqueue(item);
|
|
87866
|
-
}
|
|
87867
|
-
}
|
|
87868
|
-
}
|
|
87869
|
-
function iterator(instance, eventName) {
|
|
87870
|
-
let isFinished = false;
|
|
87871
|
-
let flush = () => {
|
|
87872
|
-
};
|
|
87873
|
-
let queue = [];
|
|
87874
|
-
const producer = {
|
|
87875
|
-
enqueue(item) {
|
|
87876
|
-
queue.push(item);
|
|
87877
|
-
flush();
|
|
87878
|
-
},
|
|
87879
|
-
finish() {
|
|
87880
|
-
isFinished = true;
|
|
87881
|
-
flush();
|
|
87882
|
-
}
|
|
87883
|
-
};
|
|
87884
|
-
getEventProducers(instance, eventName).add(producer);
|
|
87885
|
-
return {
|
|
87886
|
-
async next() {
|
|
87887
|
-
if (!queue) {
|
|
87888
|
-
return { done: true };
|
|
87889
|
-
}
|
|
87890
|
-
if (queue.length === 0) {
|
|
87891
|
-
if (isFinished) {
|
|
87892
|
-
queue = void 0;
|
|
87893
|
-
return this.next();
|
|
87894
|
-
}
|
|
87895
|
-
await new Promise((resolve) => {
|
|
87896
|
-
flush = resolve;
|
|
87897
|
-
});
|
|
87898
|
-
return this.next();
|
|
87899
|
-
}
|
|
87900
|
-
return {
|
|
87901
|
-
done: false,
|
|
87902
|
-
value: await queue.shift()
|
|
87903
|
-
};
|
|
87904
|
-
},
|
|
87905
|
-
async return(value) {
|
|
87906
|
-
queue = void 0;
|
|
87907
|
-
getEventProducers(instance, eventName).delete(producer);
|
|
87908
|
-
flush();
|
|
87909
|
-
return arguments.length > 0 ? { done: true, value: await value } : { done: true };
|
|
87910
|
-
},
|
|
87911
|
-
[Symbol.asyncIterator]() {
|
|
87912
|
-
return this;
|
|
87913
|
-
}
|
|
87914
|
-
};
|
|
87915
|
-
}
|
|
87916
|
-
function defaultMethodNamesOrAssert(methodNames) {
|
|
87917
|
-
if (methodNames === void 0) {
|
|
87918
|
-
return allEmitteryMethods;
|
|
87919
|
-
}
|
|
87920
|
-
if (!Array.isArray(methodNames)) {
|
|
87921
|
-
throw new TypeError("`methodNames` must be an array of strings");
|
|
87922
|
-
}
|
|
87923
|
-
for (const methodName of methodNames) {
|
|
87924
|
-
if (!allEmitteryMethods.includes(methodName)) {
|
|
87925
|
-
if (typeof methodName !== "string") {
|
|
87926
|
-
throw new TypeError("`methodNames` element must be a string");
|
|
87927
|
-
}
|
|
87928
|
-
throw new Error(`${methodName} is not Emittery method`);
|
|
87929
|
-
}
|
|
87930
|
-
}
|
|
87931
|
-
return methodNames;
|
|
87932
|
-
}
|
|
87933
|
-
var isListenerSymbol = (symbol) => symbol === listenerAdded || symbol === listenerRemoved;
|
|
87934
|
-
var Emittery = class {
|
|
87935
|
-
static mixin(emitteryPropertyName, methodNames) {
|
|
87936
|
-
methodNames = defaultMethodNamesOrAssert(methodNames);
|
|
87937
|
-
return (target) => {
|
|
87938
|
-
if (typeof target !== "function") {
|
|
87939
|
-
throw new TypeError("`target` must be function");
|
|
87940
|
-
}
|
|
87941
|
-
for (const methodName of methodNames) {
|
|
87942
|
-
if (target.prototype[methodName] !== void 0) {
|
|
87943
|
-
throw new Error(`The property \`${methodName}\` already exists on \`target\``);
|
|
87944
|
-
}
|
|
87945
|
-
}
|
|
87946
|
-
function getEmitteryProperty() {
|
|
87947
|
-
Object.defineProperty(this, emitteryPropertyName, {
|
|
87948
|
-
enumerable: false,
|
|
87949
|
-
value: new Emittery()
|
|
87950
|
-
});
|
|
87951
|
-
return this[emitteryPropertyName];
|
|
87952
|
-
}
|
|
87953
|
-
Object.defineProperty(target.prototype, emitteryPropertyName, {
|
|
87954
|
-
enumerable: false,
|
|
87955
|
-
get: getEmitteryProperty
|
|
87956
|
-
});
|
|
87957
|
-
const emitteryMethodCaller = (methodName) => function(...args) {
|
|
87958
|
-
return this[emitteryPropertyName][methodName](...args);
|
|
87959
|
-
};
|
|
87960
|
-
for (const methodName of methodNames) {
|
|
87961
|
-
Object.defineProperty(target.prototype, methodName, {
|
|
87962
|
-
enumerable: false,
|
|
87963
|
-
value: emitteryMethodCaller(methodName)
|
|
87964
|
-
});
|
|
87965
|
-
}
|
|
87966
|
-
return target;
|
|
87967
|
-
};
|
|
87968
|
-
}
|
|
87969
|
-
constructor() {
|
|
87970
|
-
anyMap.set(this, /* @__PURE__ */ new Set());
|
|
87971
|
-
eventsMap.set(this, /* @__PURE__ */ new Map());
|
|
87972
|
-
producersMap.set(this, /* @__PURE__ */ new Map());
|
|
87973
|
-
}
|
|
87974
|
-
on(eventName, listener) {
|
|
87975
|
-
assertEventName(eventName);
|
|
87976
|
-
assertListener(listener);
|
|
87977
|
-
getListeners(this, eventName).add(listener);
|
|
87978
|
-
if (!isListenerSymbol(eventName)) {
|
|
87979
|
-
this.emit(listenerAdded, { eventName, listener });
|
|
87980
|
-
}
|
|
87981
|
-
return this.off.bind(this, eventName, listener);
|
|
87982
|
-
}
|
|
87983
|
-
off(eventName, listener) {
|
|
87984
|
-
assertEventName(eventName);
|
|
87985
|
-
assertListener(listener);
|
|
87986
|
-
if (!isListenerSymbol(eventName)) {
|
|
87987
|
-
this.emit(listenerRemoved, { eventName, listener });
|
|
87988
|
-
}
|
|
87989
|
-
getListeners(this, eventName).delete(listener);
|
|
87990
|
-
}
|
|
87991
|
-
once(eventName) {
|
|
87992
|
-
return new Promise((resolve) => {
|
|
87993
|
-
assertEventName(eventName);
|
|
87994
|
-
const off = this.on(eventName, (data) => {
|
|
87995
|
-
off();
|
|
87996
|
-
resolve(data);
|
|
87997
|
-
});
|
|
87998
|
-
});
|
|
87999
|
-
}
|
|
88000
|
-
events(eventName) {
|
|
88001
|
-
assertEventName(eventName);
|
|
88002
|
-
return iterator(this, eventName);
|
|
88003
|
-
}
|
|
88004
|
-
async emit(eventName, eventData) {
|
|
88005
|
-
assertEventName(eventName);
|
|
88006
|
-
enqueueProducers(this, eventName, eventData);
|
|
88007
|
-
const listeners = getListeners(this, eventName);
|
|
88008
|
-
const anyListeners = anyMap.get(this);
|
|
88009
|
-
const staticListeners = [...listeners];
|
|
88010
|
-
const staticAnyListeners = isListenerSymbol(eventName) ? [] : [...anyListeners];
|
|
88011
|
-
await resolvedPromise;
|
|
88012
|
-
return Promise.all([
|
|
88013
|
-
...staticListeners.map(async (listener) => {
|
|
88014
|
-
if (listeners.has(listener)) {
|
|
88015
|
-
return listener(eventData);
|
|
88016
|
-
}
|
|
88017
|
-
}),
|
|
88018
|
-
...staticAnyListeners.map(async (listener) => {
|
|
88019
|
-
if (anyListeners.has(listener)) {
|
|
88020
|
-
return listener(eventName, eventData);
|
|
88021
|
-
}
|
|
88022
|
-
})
|
|
88023
|
-
]);
|
|
88024
|
-
}
|
|
88025
|
-
async emitSerial(eventName, eventData) {
|
|
88026
|
-
assertEventName(eventName);
|
|
88027
|
-
const listeners = getListeners(this, eventName);
|
|
88028
|
-
const anyListeners = anyMap.get(this);
|
|
88029
|
-
const staticListeners = [...listeners];
|
|
88030
|
-
const staticAnyListeners = [...anyListeners];
|
|
88031
|
-
await resolvedPromise;
|
|
88032
|
-
for (const listener of staticListeners) {
|
|
88033
|
-
if (listeners.has(listener)) {
|
|
88034
|
-
await listener(eventData);
|
|
88035
|
-
}
|
|
88036
|
-
}
|
|
88037
|
-
for (const listener of staticAnyListeners) {
|
|
88038
|
-
if (anyListeners.has(listener)) {
|
|
88039
|
-
await listener(eventName, eventData);
|
|
88040
|
-
}
|
|
88041
|
-
}
|
|
88042
|
-
}
|
|
88043
|
-
onAny(listener) {
|
|
88044
|
-
assertListener(listener);
|
|
88045
|
-
anyMap.get(this).add(listener);
|
|
88046
|
-
this.emit(listenerAdded, { listener });
|
|
88047
|
-
return this.offAny.bind(this, listener);
|
|
88048
|
-
}
|
|
88049
|
-
anyEvent() {
|
|
88050
|
-
return iterator(this);
|
|
88051
|
-
}
|
|
88052
|
-
offAny(listener) {
|
|
88053
|
-
assertListener(listener);
|
|
88054
|
-
this.emit(listenerRemoved, { listener });
|
|
88055
|
-
anyMap.get(this).delete(listener);
|
|
88056
|
-
}
|
|
88057
|
-
clearListeners(eventName) {
|
|
88058
|
-
if (typeof eventName === "string") {
|
|
88059
|
-
getListeners(this, eventName).clear();
|
|
88060
|
-
const producers = getEventProducers(this, eventName);
|
|
88061
|
-
for (const producer of producers) {
|
|
88062
|
-
producer.finish();
|
|
88063
|
-
}
|
|
88064
|
-
producers.clear();
|
|
88065
|
-
} else {
|
|
88066
|
-
anyMap.get(this).clear();
|
|
88067
|
-
for (const listeners of eventsMap.get(this).values()) {
|
|
88068
|
-
listeners.clear();
|
|
88069
|
-
}
|
|
88070
|
-
for (const producers of producersMap.get(this).values()) {
|
|
88071
|
-
for (const producer of producers) {
|
|
88072
|
-
producer.finish();
|
|
88073
|
-
}
|
|
88074
|
-
producers.clear();
|
|
88075
|
-
}
|
|
88076
|
-
}
|
|
88077
|
-
}
|
|
88078
|
-
listenerCount(eventName) {
|
|
88079
|
-
if (typeof eventName === "string") {
|
|
88080
|
-
return anyMap.get(this).size + getListeners(this, eventName).size + getEventProducers(this, eventName).size + getEventProducers(this).size;
|
|
88081
|
-
}
|
|
88082
|
-
if (typeof eventName !== "undefined") {
|
|
88083
|
-
assertEventName(eventName);
|
|
88084
|
-
}
|
|
88085
|
-
let count = anyMap.get(this).size;
|
|
88086
|
-
for (const value of eventsMap.get(this).values()) {
|
|
88087
|
-
count += value.size;
|
|
88088
|
-
}
|
|
88089
|
-
for (const value of producersMap.get(this).values()) {
|
|
88090
|
-
count += value.size;
|
|
88091
|
-
}
|
|
88092
|
-
return count;
|
|
88093
|
-
}
|
|
88094
|
-
bindMethods(target, methodNames) {
|
|
88095
|
-
if (typeof target !== "object" || target === null) {
|
|
88096
|
-
throw new TypeError("`target` must be an object");
|
|
88097
|
-
}
|
|
88098
|
-
methodNames = defaultMethodNamesOrAssert(methodNames);
|
|
88099
|
-
for (const methodName of methodNames) {
|
|
88100
|
-
if (target[methodName] !== void 0) {
|
|
88101
|
-
throw new Error(`The property \`${methodName}\` already exists on \`target\``);
|
|
88102
|
-
}
|
|
88103
|
-
Object.defineProperty(target, methodName, {
|
|
88104
|
-
enumerable: false,
|
|
88105
|
-
value: this[methodName].bind(this)
|
|
88106
|
-
});
|
|
88107
|
-
}
|
|
88108
|
-
}
|
|
88109
|
-
};
|
|
88110
|
-
var allEmitteryMethods = Object.getOwnPropertyNames(Emittery.prototype).filter((v) => v !== "constructor");
|
|
88111
|
-
Emittery.Typed = class extends Emittery {
|
|
88112
|
-
};
|
|
88113
|
-
Object.defineProperty(Emittery.Typed, "Typed", {
|
|
88114
|
-
enumerable: false,
|
|
88115
|
-
value: void 0
|
|
88116
|
-
});
|
|
88117
|
-
Object.defineProperty(Emittery, "listenerAdded", {
|
|
88118
|
-
value: listenerAdded,
|
|
88119
|
-
writable: false,
|
|
88120
|
-
enumerable: true,
|
|
88121
|
-
configurable: false
|
|
88122
|
-
});
|
|
88123
|
-
Object.defineProperty(Emittery, "listenerRemoved", {
|
|
88124
|
-
value: listenerRemoved,
|
|
88125
|
-
writable: false,
|
|
88126
|
-
enumerable: true,
|
|
88127
|
-
configurable: false
|
|
88128
|
-
});
|
|
88129
|
-
module2.exports = Emittery;
|
|
88130
|
-
}
|
|
88131
|
-
});
|
|
88132
|
-
|
|
88133
|
-
// ../../../common/temp/node_modules/.pnpm/nanocustomassert@1.0.0/node_modules/nanocustomassert/index.js
|
|
88134
|
-
var require_nanocustomassert = __commonJS({
|
|
88135
|
-
"../../../common/temp/node_modules/.pnpm/nanocustomassert@1.0.0/node_modules/nanocustomassert/index.js"(exports, module2) {
|
|
88136
|
-
module2.exports = assert8;
|
|
88137
|
-
var AssertionError = class extends Error {
|
|
88138
|
-
};
|
|
88139
|
-
AssertionError.prototype.name = "AssertionError";
|
|
88140
|
-
function assert8(t, m, ...rest) {
|
|
88141
|
-
if (!t) {
|
|
88142
|
-
var err;
|
|
88143
|
-
if (!m || typeof m === "string") {
|
|
88144
|
-
err = new AssertionError(m);
|
|
88145
|
-
}
|
|
88146
|
-
if (typeof m === "function") {
|
|
88147
|
-
err = new m(...rest);
|
|
88148
|
-
}
|
|
88149
|
-
if (Error.captureStackTrace)
|
|
88150
|
-
Error.captureStackTrace(err, assert8);
|
|
88151
|
-
throw err;
|
|
88152
|
-
}
|
|
88153
|
-
}
|
|
88154
|
-
}
|
|
88155
|
-
});
|
|
88156
|
-
|
|
88157
|
-
// ../../../common/temp/node_modules/.pnpm/nanomessage-rpc@3.2.0/node_modules/nanomessage-rpc/src/errors.js
|
|
88158
|
-
var require_errors7 = __commonJS({
|
|
88159
|
-
"../../../common/temp/node_modules/.pnpm/nanomessage-rpc@3.2.0/node_modules/nanomessage-rpc/src/errors.js"(exports) {
|
|
88160
|
-
var nanoerror = require_nanoerror();
|
|
88161
|
-
exports.encodeError = encodeError;
|
|
88162
|
-
exports.decodeError = decodeError;
|
|
88163
|
-
var errors = /* @__PURE__ */ new Map();
|
|
88164
|
-
function createError(code, message) {
|
|
88165
|
-
exports[code] = nanoerror(code, message);
|
|
88166
|
-
}
|
|
88167
|
-
function encodeError(err) {
|
|
88168
|
-
return { error: true, data: { code: err.code, unformatMessage: err.unformatMessage, args: err.args, stack: err.stack } };
|
|
88169
|
-
}
|
|
88170
|
-
function decodeError(code, message) {
|
|
88171
|
-
if (exports[code])
|
|
88172
|
-
return exports[code];
|
|
88173
|
-
if (errors.has(code))
|
|
88174
|
-
return errors.get(code);
|
|
88175
|
-
const error2 = nanoerror(code, message);
|
|
88176
|
-
errors.set(code, error2);
|
|
88177
|
-
return error2;
|
|
88178
|
-
}
|
|
88179
|
-
createError("NRPC_ERR_NAME_MISSING", "missing action handler for: %s");
|
|
88180
|
-
createError("NRPC_ERR_RESPONSE_ERROR", "%s");
|
|
88181
|
-
createError("NRPC_ERR_REQUEST_CANCELED", "%s");
|
|
88182
|
-
createError("NRPC_ERR_CLOSE", "nanomessage-rpc was closed");
|
|
88183
|
-
createError("NRPC_ERR_NOT_OPEN", "nanomessage-rpc is not open");
|
|
88184
|
-
createError("NRPC_ERR_ENCODE", "error encoding the request: %s");
|
|
88185
|
-
createError("NRPC_ERR_DECODE", "error decoding the request: %s");
|
|
88186
|
-
}
|
|
88187
|
-
});
|
|
88188
|
-
|
|
88189
|
-
// ../../../common/temp/node_modules/.pnpm/nanomessage-rpc@3.2.0/node_modules/nanomessage-rpc/src/codec.js
|
|
88190
|
-
var require_codec3 = __commonJS({
|
|
88191
|
-
"../../../common/temp/node_modules/.pnpm/nanomessage-rpc@3.2.0/node_modules/nanomessage-rpc/src/codec.js"(exports, module2) {
|
|
88192
|
-
var varint = require_varint();
|
|
88193
|
-
var { BJSON } = require_nanomessage2();
|
|
88194
|
-
var { NRPC_ERR_ENCODE, NRPC_ERR_DECODE } = require_errors7();
|
|
88195
|
-
function writeNumber(value, dest) {
|
|
88196
|
-
varint.encode(value, dest.buf, dest.offset);
|
|
88197
|
-
dest.offset += varint.encode.bytes;
|
|
88198
|
-
}
|
|
88199
|
-
function writeCodec(enc, length, value, dest) {
|
|
88200
|
-
writeNumber(length, dest);
|
|
88201
|
-
enc.encode(value, dest.buf, dest.offset);
|
|
88202
|
-
dest.offset += length;
|
|
88203
|
-
}
|
|
88204
|
-
function writeString(value, length, dest) {
|
|
88205
|
-
writeNumber(length, dest);
|
|
88206
|
-
dest.buf.write(value, dest.offset, length, "utf8");
|
|
88207
|
-
dest.offset += length;
|
|
88208
|
-
}
|
|
88209
|
-
function readNumber(source) {
|
|
88210
|
-
const num = varint.decode(source.buf, source.offset);
|
|
88211
|
-
source.offset += varint.decode.bytes;
|
|
88212
|
-
return num;
|
|
88213
|
-
}
|
|
88214
|
-
function readCodec(enc, source) {
|
|
88215
|
-
const length = readNumber(source);
|
|
88216
|
-
const buf = enc.decode(source.buf, source.offset, source.offset + length);
|
|
88217
|
-
source.offset += length;
|
|
88218
|
-
return buf;
|
|
88219
|
-
}
|
|
88220
|
-
function readBuffer(source) {
|
|
88221
|
-
const length = readNumber(source);
|
|
88222
|
-
const buf = source.buf.slice(source.offset, source.offset + length);
|
|
88223
|
-
source.offset += length;
|
|
88224
|
-
return buf;
|
|
88225
|
-
}
|
|
88226
|
-
var ATTR_RESPONSE = 1;
|
|
88227
|
-
var ATTR_EVENT = 1 << 1;
|
|
88228
|
-
var ATTR_ERROR = 1 << 2;
|
|
88229
|
-
var Codec = class {
|
|
88230
|
-
constructor(valueEncoding = BJSON) {
|
|
88231
|
-
this._valueEncoding = valueEncoding;
|
|
88232
|
-
this._lastHeader = null;
|
|
88233
|
-
this._lastDataLength = null;
|
|
88234
|
-
this._lastNameLength = null;
|
|
88235
|
-
}
|
|
88236
|
-
encode(obj, buf, offset = 0) {
|
|
88237
|
-
try {
|
|
88238
|
-
if (obj.name) {
|
|
88239
|
-
return this._encodeRequest(obj, buf, offset);
|
|
88240
|
-
}
|
|
88241
|
-
return this._encodeResponse(obj, buf, offset);
|
|
88242
|
-
} catch (_err) {
|
|
88243
|
-
const err = new NRPC_ERR_ENCODE(_err.message);
|
|
88244
|
-
err.stack = _err.stack || err.stack;
|
|
88245
|
-
throw _err;
|
|
88246
|
-
}
|
|
88247
|
-
}
|
|
88248
|
-
decode(buf, offset = 0) {
|
|
88249
|
-
try {
|
|
88250
|
-
const header = varint.decode(buf, offset);
|
|
88251
|
-
offset += varint.decode.bytes;
|
|
88252
|
-
if (header & ATTR_RESPONSE) {
|
|
88253
|
-
return this._decodeResponse(header, buf, offset);
|
|
88254
|
-
}
|
|
88255
|
-
return this._decodeRequest(header, buf, offset);
|
|
88256
|
-
} catch (_err) {
|
|
88257
|
-
const err = new NRPC_ERR_DECODE(_err.message);
|
|
88258
|
-
err.stack = _err.stack || err.stack;
|
|
88259
|
-
throw _err;
|
|
88260
|
-
}
|
|
88261
|
-
}
|
|
88262
|
-
encodingLength(obj) {
|
|
88263
|
-
if (obj.name) {
|
|
88264
|
-
return this._encodingLengthRequest(obj);
|
|
88265
|
-
}
|
|
88266
|
-
return this._encodingLengthResponse(obj);
|
|
88267
|
-
}
|
|
88268
|
-
_headerRequest(obj) {
|
|
88269
|
-
let header = 0;
|
|
88270
|
-
if (obj.event)
|
|
88271
|
-
header = header | ATTR_EVENT;
|
|
88272
|
-
this._lastHeader = header;
|
|
88273
|
-
return header;
|
|
88274
|
-
}
|
|
88275
|
-
_headerResponse(obj) {
|
|
88276
|
-
let header = 0;
|
|
88277
|
-
header = header | ATTR_RESPONSE;
|
|
88278
|
-
if (obj.error)
|
|
88279
|
-
header = header | ATTR_ERROR;
|
|
88280
|
-
this._lastHeader = header;
|
|
88281
|
-
return header;
|
|
88282
|
-
}
|
|
88283
|
-
_encodeRequest(obj, buf, offset) {
|
|
88284
|
-
const result = { buf, offset };
|
|
88285
|
-
writeNumber(this._lastHeader, result);
|
|
88286
|
-
writeString(obj.name, this._lastNameLength, result);
|
|
88287
|
-
writeCodec(this._valueEncoding, this._lastDataLength, obj.data, result);
|
|
88288
|
-
return result.buf;
|
|
88289
|
-
}
|
|
88290
|
-
_decodeRequest(header, buf, offset) {
|
|
88291
|
-
const obj = {};
|
|
88292
|
-
const result = { buf, offset };
|
|
88293
|
-
obj.event = !!(header & ATTR_EVENT);
|
|
88294
|
-
obj.name = readBuffer(result).toString();
|
|
88295
|
-
obj.data = readCodec(this._valueEncoding, result);
|
|
88296
|
-
return obj;
|
|
88297
|
-
}
|
|
88298
|
-
_encodingLengthRequest(obj) {
|
|
88299
|
-
const header = this._headerRequest(obj);
|
|
88300
|
-
this._lastDataLength = this._valueEncoding.encodingLength(obj.data);
|
|
88301
|
-
this._lastNameLength = Buffer.byteLength(obj.name, "utf8");
|
|
88302
|
-
return varint.encodingLength(header) + varint.encodingLength(this._lastDataLength) + this._lastDataLength + varint.encodingLength(this._lastNameLength) + this._lastNameLength;
|
|
88303
|
-
}
|
|
88304
|
-
_encodingLengthResponse(obj) {
|
|
88305
|
-
const header = this._headerResponse(obj);
|
|
88306
|
-
let codec2 = this._valueEncoding;
|
|
88307
|
-
if (obj.error)
|
|
88308
|
-
codec2 = BJSON;
|
|
88309
|
-
const dataLength = codec2.encodingLength(obj.data);
|
|
88310
|
-
return varint.encodingLength(header) + varint.encodingLength(dataLength) + dataLength;
|
|
88311
|
-
}
|
|
88312
|
-
_encodeResponse(obj, buf, offset) {
|
|
88313
|
-
let codec2 = this._valueEncoding;
|
|
88314
|
-
if (obj.error)
|
|
88315
|
-
codec2 = BJSON;
|
|
88316
|
-
const dataLength = codec2.encodingLength(obj.data);
|
|
88317
|
-
const result = { buf, offset };
|
|
88318
|
-
writeNumber(this._lastHeader, result);
|
|
88319
|
-
writeCodec(codec2, dataLength, obj.data, result);
|
|
88320
|
-
return result.buf;
|
|
88321
|
-
}
|
|
88322
|
-
_decodeResponse(header, buf, offset) {
|
|
88323
|
-
const obj = {};
|
|
88324
|
-
const result = { buf, offset };
|
|
88325
|
-
obj.error = !!(header & ATTR_ERROR);
|
|
88326
|
-
let codec2 = this._valueEncoding;
|
|
88327
|
-
if (obj.error)
|
|
88328
|
-
codec2 = BJSON;
|
|
88329
|
-
obj.data = readCodec(codec2, result);
|
|
88330
|
-
return obj;
|
|
88331
|
-
}
|
|
88332
|
-
};
|
|
88333
|
-
module2.exports = Codec;
|
|
88334
|
-
}
|
|
88335
|
-
});
|
|
88336
|
-
|
|
88337
|
-
// ../../../common/temp/node_modules/.pnpm/nanomessage-rpc@3.2.0/node_modules/nanomessage-rpc/src/nanomessage-rpc.js
|
|
88338
|
-
var require_nanomessage_rpc = __commonJS({
|
|
88339
|
-
"../../../common/temp/node_modules/.pnpm/nanomessage-rpc@3.2.0/node_modules/nanomessage-rpc/src/nanomessage-rpc.js"(exports, module2) {
|
|
88340
|
-
var { EventEmitter } = require_events2();
|
|
88341
|
-
var Emittery = require_emittery();
|
|
88342
|
-
var nanomessage = require_nanomessage2();
|
|
88343
|
-
var assert8 = require_nanocustomassert();
|
|
88344
|
-
var { NanoresourcePromise } = require_nanoresource_promise();
|
|
88345
|
-
var Codec = require_codec3();
|
|
88346
|
-
var {
|
|
88347
|
-
encodeError,
|
|
88348
|
-
decodeError,
|
|
88349
|
-
NRPC_ERR_NAME_MISSING,
|
|
88350
|
-
NRPC_ERR_RESPONSE_ERROR,
|
|
88351
|
-
NRPC_ERR_CLOSE,
|
|
88352
|
-
NRPC_ERR_NOT_OPEN,
|
|
88353
|
-
NRPC_ERR_REQUEST_CANCELED
|
|
88354
|
-
} = require_errors7();
|
|
88355
|
-
var kNanomessage = Symbol("nrpc.nanomessage");
|
|
88356
|
-
var kOnmessage = Symbol("nrpc.onmessage");
|
|
88357
|
-
var kSubscribe = Symbol("nrpc.subscribe");
|
|
88358
|
-
var kActions = Symbol("nrpc.actions");
|
|
88359
|
-
var kEmittery = Symbol("nrpc.emittery");
|
|
88360
|
-
var kFastCheckOpen = Symbol("nrpc.fastcheckopen");
|
|
88361
|
-
var kCreateRequest = Symbol("nrpc.createrequest");
|
|
88362
|
-
var noop = () => {
|
|
88363
|
-
};
|
|
88364
|
-
var NanomessageRPC = class extends NanoresourcePromise {
|
|
88365
|
-
constructor(opts = {}) {
|
|
88366
|
-
super();
|
|
88367
|
-
const { onError = () => {
|
|
88368
|
-
}, valueEncoding, send, subscribe, open = noop, close = noop, ...nanomessageOpts } = opts;
|
|
88369
|
-
assert8(send, "send is required");
|
|
88370
|
-
assert8(subscribe, "subscribe is required");
|
|
88371
|
-
this.ee = new EventEmitter();
|
|
88372
|
-
this[kNanomessage] = nanomessage({
|
|
88373
|
-
...nanomessageOpts,
|
|
88374
|
-
send: send.bind(this),
|
|
88375
|
-
open: open.bind(this),
|
|
88376
|
-
close: close.bind(this),
|
|
88377
|
-
onMessage: this[kOnmessage].bind(this),
|
|
88378
|
-
subscribe: this[kSubscribe](subscribe),
|
|
88379
|
-
valueEncoding: new Codec(valueEncoding)
|
|
88380
|
-
});
|
|
88381
|
-
this[kEmittery] = new Emittery();
|
|
88382
|
-
this[kActions] = /* @__PURE__ */ new Map();
|
|
88383
|
-
this._onError = onError;
|
|
88384
|
-
this.ee.on("error", (err) => {
|
|
88385
|
-
this._onError(err);
|
|
88386
|
-
});
|
|
88387
|
-
}
|
|
88388
|
-
get requests() {
|
|
88389
|
-
return this[kNanomessage].requests;
|
|
88390
|
-
}
|
|
88391
|
-
get inflightRequests() {
|
|
88392
|
-
return this[kNanomessage].inflightRequests;
|
|
88393
|
-
}
|
|
88394
|
-
get requestTimeout() {
|
|
88395
|
-
return this[kNanomessage].timeout;
|
|
88396
|
-
}
|
|
88397
|
-
get concurrency() {
|
|
88398
|
-
return this[kNanomessage].concurrency;
|
|
88399
|
-
}
|
|
88400
|
-
setRequestsTimeout(timeout) {
|
|
88401
|
-
this[kNanomessage].setRequestsTimeout(timeout);
|
|
88402
|
-
}
|
|
88403
|
-
setConcurrency(concurrency) {
|
|
88404
|
-
this[kNanomessage].setConcurrency(concurrency);
|
|
88405
|
-
}
|
|
88406
|
-
onError(cb) {
|
|
88407
|
-
this._onError = cb;
|
|
88408
|
-
}
|
|
88409
|
-
action(name, handler) {
|
|
88410
|
-
this[kActions].set(name, handler);
|
|
88411
|
-
return this;
|
|
88412
|
-
}
|
|
88413
|
-
actions(actions) {
|
|
88414
|
-
Object.keys(actions).forEach((name) => this.action(name, actions[name]));
|
|
88415
|
-
return this;
|
|
88416
|
-
}
|
|
88417
|
-
call(name, data, opts = {}) {
|
|
88418
|
-
return this[kCreateRequest]({ name, data }, opts);
|
|
88419
|
-
}
|
|
88420
|
-
emit(name, data, opts = {}) {
|
|
88421
|
-
return this[kCreateRequest]({ name, data, event: true }, opts);
|
|
88422
|
-
}
|
|
88423
|
-
on(...args) {
|
|
88424
|
-
return this[kEmittery].on(...args);
|
|
88425
|
-
}
|
|
88426
|
-
once(...args) {
|
|
88427
|
-
return this[kEmittery].once(...args);
|
|
88428
|
-
}
|
|
88429
|
-
off(...args) {
|
|
88430
|
-
return this[kEmittery].off(...args);
|
|
88431
|
-
}
|
|
88432
|
-
events(name) {
|
|
88433
|
-
return this[kEmittery].events(name);
|
|
88434
|
-
}
|
|
88435
|
-
async _open() {
|
|
88436
|
-
await this[kNanomessage].open();
|
|
88437
|
-
this.ee.emit("opened");
|
|
88438
|
-
}
|
|
88439
|
-
async _close() {
|
|
88440
|
-
await this[kNanomessage].close();
|
|
88441
|
-
this.ee.emit("closed");
|
|
88442
|
-
}
|
|
88443
|
-
async [kFastCheckOpen]() {
|
|
88444
|
-
if (this.closed || this.closing)
|
|
88445
|
-
throw new NRPC_ERR_CLOSE();
|
|
88446
|
-
if (this.opening)
|
|
88447
|
-
return this.open();
|
|
88448
|
-
if (!this.opened)
|
|
88449
|
-
throw new NRPC_ERR_NOT_OPEN();
|
|
88450
|
-
}
|
|
88451
|
-
[kSubscribe](subscribe) {
|
|
88452
|
-
return (next) => {
|
|
88453
|
-
subscribe((data) => {
|
|
88454
|
-
try {
|
|
88455
|
-
next(data);
|
|
88456
|
-
} catch (err) {
|
|
88457
|
-
process.nextTick(() => this.ee.emit("error", err));
|
|
88458
|
-
}
|
|
88459
|
-
});
|
|
88460
|
-
};
|
|
88461
|
-
}
|
|
88462
|
-
[kCreateRequest](packet, { timeout, signal, wait = true }) {
|
|
88463
|
-
assert8(packet.name && typeof packet.name === "string", "name is required");
|
|
88464
|
-
if (packet.event && !wait) {
|
|
88465
|
-
return this[kFastCheckOpen]().then(() => this[kNanomessage].send(packet));
|
|
88466
|
-
}
|
|
88467
|
-
let errCanceled;
|
|
88468
|
-
let request;
|
|
88469
|
-
const promise = this[kFastCheckOpen]().then(() => {
|
|
88470
|
-
if (errCanceled)
|
|
88471
|
-
throw errCanceled;
|
|
88472
|
-
request = this[kNanomessage].request(packet, { timeout, signal });
|
|
88473
|
-
this.ee.emit("request-created", request, packet);
|
|
88474
|
-
return request;
|
|
88475
|
-
}).then((result) => {
|
|
88476
|
-
if (result.error) {
|
|
88477
|
-
const { code, unformatMessage, args, stack } = result.data;
|
|
88478
|
-
const ErrorDecoded = decodeError(code, unformatMessage);
|
|
88479
|
-
const err = new ErrorDecoded(...args);
|
|
88480
|
-
err.stack = stack || err.stack;
|
|
88481
|
-
throw err;
|
|
88482
|
-
} else {
|
|
88483
|
-
return result.data;
|
|
88484
|
-
}
|
|
88485
|
-
});
|
|
88486
|
-
promise.cancel = (err) => {
|
|
88487
|
-
if (!err) {
|
|
88488
|
-
errCanceled = new NRPC_ERR_REQUEST_CANCELED("request canceled");
|
|
88489
|
-
} else if (typeof err === "string") {
|
|
88490
|
-
errCanceled = new NRPC_ERR_REQUEST_CANCELED(err);
|
|
88491
|
-
}
|
|
88492
|
-
if (request)
|
|
88493
|
-
return request.cancel(errCanceled);
|
|
88494
|
-
errCanceled = err;
|
|
88495
|
-
};
|
|
88496
|
-
return promise;
|
|
88497
|
-
}
|
|
88498
|
-
async [kOnmessage](message) {
|
|
88499
|
-
this.ee.emit("message", message);
|
|
88500
|
-
try {
|
|
88501
|
-
if (message.event) {
|
|
88502
|
-
await this[kEmittery].emit(message.name, message.data);
|
|
88503
|
-
return { data: null };
|
|
88504
|
-
}
|
|
88505
|
-
const action = this[kActions].get(message.name);
|
|
88506
|
-
if (!action) {
|
|
88507
|
-
return encodeError(new NRPC_ERR_NAME_MISSING(message.name));
|
|
88508
|
-
}
|
|
88509
|
-
const result = await action(message.data);
|
|
88510
|
-
return { data: result };
|
|
88511
|
-
} catch (err) {
|
|
88512
|
-
if (err.isNanoerror) {
|
|
88513
|
-
return encodeError(err);
|
|
88514
|
-
}
|
|
88515
|
-
const rErr = new NRPC_ERR_RESPONSE_ERROR(err.message);
|
|
88516
|
-
rErr.stack = err.stack || rErr.stack;
|
|
88517
|
-
return encodeError(rErr);
|
|
88518
|
-
}
|
|
88519
|
-
}
|
|
88520
|
-
};
|
|
88521
|
-
module2.exports = NanomessageRPC;
|
|
88522
|
-
}
|
|
88523
|
-
});
|
|
88524
|
-
|
|
88525
|
-
// ../../../common/temp/node_modules/.pnpm/nanomessage-rpc@3.2.0/node_modules/nanomessage-rpc/src/use-socket.js
|
|
88526
|
-
var require_use_socket = __commonJS({
|
|
88527
|
-
"../../../common/temp/node_modules/.pnpm/nanomessage-rpc@3.2.0/node_modules/nanomessage-rpc/src/use-socket.js"(exports, module2) {
|
|
88528
|
-
var eos = require_end_of_stream2();
|
|
88529
|
-
function useSocket(socket, onCloseDestroyStream = true) {
|
|
88530
|
-
return {
|
|
88531
|
-
send(buf) {
|
|
88532
|
-
if (socket.destroyed)
|
|
88533
|
-
return;
|
|
88534
|
-
socket.write(buf);
|
|
88535
|
-
},
|
|
88536
|
-
subscribe(next) {
|
|
88537
|
-
socket.on("data", next);
|
|
88538
|
-
return () => socket.removeListener("data", next);
|
|
88539
|
-
},
|
|
88540
|
-
open() {
|
|
88541
|
-
eos(socket, () => {
|
|
88542
|
-
this.close().catch((err) => process.nextTick(() => this.ee.emit("error", err)));
|
|
88543
|
-
});
|
|
88544
|
-
},
|
|
88545
|
-
close() {
|
|
88546
|
-
return new Promise((resolve) => {
|
|
88547
|
-
if (socket.destroyed || !onCloseDestroyStream)
|
|
88548
|
-
return resolve();
|
|
88549
|
-
eos(socket, () => resolve());
|
|
88550
|
-
socket.destroy();
|
|
88551
|
-
});
|
|
88552
|
-
}
|
|
88553
|
-
};
|
|
88554
|
-
}
|
|
88555
|
-
module2.exports = useSocket;
|
|
88556
|
-
}
|
|
88557
|
-
});
|
|
88558
|
-
|
|
88559
|
-
// ../../../common/temp/node_modules/.pnpm/nanomessage-rpc@3.2.0/node_modules/nanomessage-rpc/index.js
|
|
88560
|
-
var require_nanomessage_rpc2 = __commonJS({
|
|
88561
|
-
"../../../common/temp/node_modules/.pnpm/nanomessage-rpc@3.2.0/node_modules/nanomessage-rpc/index.js"(exports, module2) {
|
|
88562
|
-
var NanomessageRPC = require_nanomessage_rpc();
|
|
88563
|
-
module2.exports = (...args) => new NanomessageRPC(...args);
|
|
88564
|
-
module2.exports.NanomessageRPC = NanomessageRPC;
|
|
88565
|
-
module2.exports.useSocket = require_use_socket();
|
|
88566
|
-
module2.exports.errors = require_errors7();
|
|
88567
|
-
}
|
|
88568
|
-
});
|
|
88569
|
-
|
|
88570
|
-
// ../../mesh/network-manager/dist/src/signal/websocket-rpc.js
|
|
88571
|
-
var require_websocket_rpc = __commonJS({
|
|
88572
|
-
"../../mesh/network-manager/dist/src/signal/websocket-rpc.js"(exports) {
|
|
87869
|
+
// ../../mesh/network-manager/dist/src/signal/signal-rpc-client.js
|
|
87870
|
+
var require_signal_rpc_client = __commonJS({
|
|
87871
|
+
"../../mesh/network-manager/dist/src/signal/signal-rpc-client.js"(exports) {
|
|
88573
87872
|
"use strict";
|
|
88574
87873
|
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
88575
87874
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
88576
87875
|
};
|
|
88577
87876
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88578
|
-
exports.
|
|
87877
|
+
exports.SignalRPCClient = void 0;
|
|
88579
87878
|
var debug_1 = __importDefault(require("debug"));
|
|
88580
87879
|
var isomorphic_ws_1 = __importDefault(require_browser18());
|
|
88581
|
-
var nanomessage_rpc_1 = __importDefault(require_nanomessage_rpc2());
|
|
88582
|
-
var node_assert_1 = __importDefault(require_assert());
|
|
88583
|
-
var util_1 = require_util();
|
|
88584
87880
|
var async_1 = require("@dxos/async");
|
|
88585
|
-
var
|
|
88586
|
-
var
|
|
88587
|
-
var
|
|
88588
|
-
|
|
88589
|
-
|
|
87881
|
+
var rpc_1 = require("@dxos/rpc");
|
|
87882
|
+
var gen_1 = require_gen5();
|
|
87883
|
+
var log3 = (0, debug_1.default)("dxos:network-manager:signal-rpc-client");
|
|
87884
|
+
var SignalRPCClient = class {
|
|
87885
|
+
constructor(_url) {
|
|
87886
|
+
this._url = _url;
|
|
88590
87887
|
this._connectTrigger = new async_1.Trigger();
|
|
88591
|
-
this._messageId = Date.now();
|
|
88592
|
-
this.commandTrace = new async_1.Event();
|
|
88593
87888
|
this.connected = new async_1.Event();
|
|
88594
87889
|
this.disconnected = new async_1.Event();
|
|
88595
87890
|
this.error = new async_1.Event();
|
|
88596
|
-
this._socket = new isomorphic_ws_1.default(this.
|
|
87891
|
+
this._socket = new isomorphic_ws_1.default(this._url);
|
|
88597
87892
|
this._socket.onopen = async () => {
|
|
88598
|
-
log3(`Websocket connected ${this._host}`);
|
|
88599
|
-
this._connectTrigger.wake();
|
|
88600
87893
|
try {
|
|
88601
87894
|
await this._rpc.open();
|
|
88602
|
-
log3(`RPC open ${this.
|
|
87895
|
+
log3(`RPC open ${this._url}`);
|
|
88603
87896
|
this.connected.emit();
|
|
87897
|
+
this._connectTrigger.wake();
|
|
88604
87898
|
} catch (err) {
|
|
88605
87899
|
this.error.emit(err);
|
|
88606
87900
|
}
|
|
88607
87901
|
};
|
|
88608
87902
|
this._socket.onclose = async () => {
|
|
88609
|
-
log3(`Disconnected ${this.
|
|
87903
|
+
log3(`Disconnected ${this._url}`);
|
|
88610
87904
|
this.disconnected.emit();
|
|
88611
87905
|
try {
|
|
88612
87906
|
await this._rpc.close();
|
|
@@ -88616,41 +87910,55 @@ var require_websocket_rpc = __commonJS({
|
|
|
88616
87910
|
};
|
|
88617
87911
|
this._socket.onerror = (e) => {
|
|
88618
87912
|
var _a;
|
|
88619
|
-
log3(`Signal socket error ${this.
|
|
87913
|
+
log3(`Signal socket error ${this._url} ${e.message}`);
|
|
88620
87914
|
this.error.emit((_a = e.error) !== null && _a !== void 0 ? _a : new Error(e.message));
|
|
88621
87915
|
};
|
|
88622
|
-
this._rpc = (0,
|
|
88623
|
-
|
|
88624
|
-
|
|
88625
|
-
|
|
88626
|
-
|
|
88627
|
-
|
|
88628
|
-
|
|
88629
|
-
|
|
88630
|
-
|
|
88631
|
-
this._socket.onmessage = async (
|
|
88632
|
-
|
|
88633
|
-
|
|
88634
|
-
|
|
88635
|
-
|
|
88636
|
-
} else {
|
|
88637
|
-
data = e.data;
|
|
88638
|
-
}
|
|
88639
|
-
next(data);
|
|
88640
|
-
} catch (err) {
|
|
88641
|
-
this.error.emit(err);
|
|
87916
|
+
this._rpc = (0, rpc_1.createBundledRpcClient)({
|
|
87917
|
+
Signal: gen_1.schema.getService("dxos.mesh.signal.Signal")
|
|
87918
|
+
}, {
|
|
87919
|
+
noHandshake: true,
|
|
87920
|
+
port: {
|
|
87921
|
+
send: (msg) => {
|
|
87922
|
+
this._socket.send(msg);
|
|
87923
|
+
},
|
|
87924
|
+
subscribe: (cb) => {
|
|
87925
|
+
this._socket.onmessage = async (msg) => {
|
|
87926
|
+
if (typeof Blob !== "undefined" && msg.data instanceof Blob) {
|
|
87927
|
+
cb(Buffer.from(await msg.data.arrayBuffer()));
|
|
87928
|
+
} else {
|
|
87929
|
+
cb(msg.data);
|
|
88642
87930
|
}
|
|
88643
87931
|
};
|
|
88644
|
-
}
|
|
88645
|
-
return () => {
|
|
88646
|
-
if (this._socket) {
|
|
88647
|
-
this._socket.onmessage = () => {
|
|
88648
|
-
};
|
|
88649
|
-
}
|
|
88650
|
-
};
|
|
87932
|
+
}
|
|
88651
87933
|
}
|
|
88652
87934
|
});
|
|
88653
|
-
|
|
87935
|
+
}
|
|
87936
|
+
async join(topic, peerId) {
|
|
87937
|
+
log3("join", topic, peerId);
|
|
87938
|
+
await this._connectTrigger.wait();
|
|
87939
|
+
const swarmStream = this._rpc.rpc.Signal.join({
|
|
87940
|
+
swarm: topic.asUint8Array(),
|
|
87941
|
+
peer: peerId.asUint8Array()
|
|
87942
|
+
});
|
|
87943
|
+
await swarmStream.waitUntilReady();
|
|
87944
|
+
return swarmStream;
|
|
87945
|
+
}
|
|
87946
|
+
async receiveMessages(peerId) {
|
|
87947
|
+
await this._connectTrigger.wait();
|
|
87948
|
+
const messageStream = this._rpc.rpc.Signal.receiveMessages({
|
|
87949
|
+
peer: peerId.asUint8Array()
|
|
87950
|
+
});
|
|
87951
|
+
await messageStream.waitUntilReady();
|
|
87952
|
+
return messageStream;
|
|
87953
|
+
}
|
|
87954
|
+
async sendMessage(author, recipient, message) {
|
|
87955
|
+
log3("sendMessage", author, recipient, message);
|
|
87956
|
+
await this._connectTrigger.wait();
|
|
87957
|
+
await this._rpc.rpc.Signal.sendMessage({
|
|
87958
|
+
author: author.asUint8Array(),
|
|
87959
|
+
recipient: recipient.asUint8Array(),
|
|
87960
|
+
payload: message
|
|
87961
|
+
});
|
|
88654
87962
|
}
|
|
88655
87963
|
async close() {
|
|
88656
87964
|
try {
|
|
@@ -88659,99 +87967,8 @@ var require_websocket_rpc = __commonJS({
|
|
|
88659
87967
|
this._socket.close();
|
|
88660
87968
|
}
|
|
88661
87969
|
}
|
|
88662
|
-
async call(method, payload) {
|
|
88663
|
-
const start = Date.now();
|
|
88664
|
-
try {
|
|
88665
|
-
const response = await Promise.race([
|
|
88666
|
-
(async () => {
|
|
88667
|
-
await this._rpc.open();
|
|
88668
|
-
await this._connectTrigger.wait();
|
|
88669
|
-
return this._rpc.call(method, payload);
|
|
88670
|
-
})(),
|
|
88671
|
-
(0, async_1.sleep)(RPC_TIMEOUT).then(() => Promise.reject(new Error(`Signal RPC call timed out in ${RPC_TIMEOUT} ms`)))
|
|
88672
|
-
]);
|
|
88673
|
-
this.commandTrace.emit({
|
|
88674
|
-
messageId: `${this._host}-${this._messageId++}`,
|
|
88675
|
-
host: this._host,
|
|
88676
|
-
incoming: false,
|
|
88677
|
-
time: Date.now() - start,
|
|
88678
|
-
method,
|
|
88679
|
-
payload,
|
|
88680
|
-
response
|
|
88681
|
-
});
|
|
88682
|
-
log3(`Signal RPC ${this._host}: ${method} ${JSON.stringify(payload)} ${JSON.stringify(response)}`);
|
|
88683
|
-
return response;
|
|
88684
|
-
} catch (err) {
|
|
88685
|
-
log3(`Signal RPC error ${this._host}: ${method} ${JSON.stringify(payload)} ${err.message}`);
|
|
88686
|
-
this.commandTrace.emit({
|
|
88687
|
-
messageId: `${this._host}-${this._messageId++}`,
|
|
88688
|
-
host: this._host,
|
|
88689
|
-
incoming: false,
|
|
88690
|
-
time: Date.now() - start,
|
|
88691
|
-
method,
|
|
88692
|
-
payload,
|
|
88693
|
-
error: err.message
|
|
88694
|
-
});
|
|
88695
|
-
throw err;
|
|
88696
|
-
}
|
|
88697
|
-
}
|
|
88698
|
-
async emit(method, data) {
|
|
88699
|
-
this.commandTrace.emit({
|
|
88700
|
-
messageId: `${this._host}-${this._messageId++}`,
|
|
88701
|
-
host: this._host,
|
|
88702
|
-
incoming: false,
|
|
88703
|
-
time: 0,
|
|
88704
|
-
method,
|
|
88705
|
-
payload: data
|
|
88706
|
-
});
|
|
88707
|
-
return this._rpc.emit("signal", data);
|
|
88708
|
-
}
|
|
88709
|
-
addHandler(method, handler) {
|
|
88710
|
-
this._rpc.actions({
|
|
88711
|
-
[method]: async (data) => {
|
|
88712
|
-
const begin = Date.now();
|
|
88713
|
-
try {
|
|
88714
|
-
const response = await handler(data);
|
|
88715
|
-
this.commandTrace.emit({
|
|
88716
|
-
messageId: `${this._host}-${this._messageId++}`,
|
|
88717
|
-
host: this._host,
|
|
88718
|
-
incoming: true,
|
|
88719
|
-
time: Date.now() - begin,
|
|
88720
|
-
method,
|
|
88721
|
-
payload: data,
|
|
88722
|
-
response
|
|
88723
|
-
});
|
|
88724
|
-
return response;
|
|
88725
|
-
} catch (error2) {
|
|
88726
|
-
this.commandTrace.emit({
|
|
88727
|
-
messageId: `${this._host}-${this._messageId++}`,
|
|
88728
|
-
host: this._host,
|
|
88729
|
-
incoming: true,
|
|
88730
|
-
time: Date.now() - begin,
|
|
88731
|
-
method,
|
|
88732
|
-
payload: data,
|
|
88733
|
-
error: error2.message
|
|
88734
|
-
});
|
|
88735
|
-
throw error2;
|
|
88736
|
-
}
|
|
88737
|
-
}
|
|
88738
|
-
});
|
|
88739
|
-
}
|
|
88740
|
-
subscribe(method, handler) {
|
|
88741
|
-
this._rpc.on(method, (data) => {
|
|
88742
|
-
this.commandTrace.emit({
|
|
88743
|
-
messageId: `${this._host}-${this._messageId++}`,
|
|
88744
|
-
host: this._host,
|
|
88745
|
-
incoming: true,
|
|
88746
|
-
time: 0,
|
|
88747
|
-
method,
|
|
88748
|
-
payload: data
|
|
88749
|
-
});
|
|
88750
|
-
handler(data);
|
|
88751
|
-
});
|
|
88752
|
-
}
|
|
88753
87970
|
};
|
|
88754
|
-
exports.
|
|
87971
|
+
exports.SignalRPCClient = SignalRPCClient;
|
|
88755
87972
|
}
|
|
88756
87973
|
});
|
|
88757
87974
|
|
|
@@ -88759,33 +87976,52 @@ var require_websocket_rpc = __commonJS({
|
|
|
88759
87976
|
var require_signal_client = __commonJS({
|
|
88760
87977
|
"../../mesh/network-manager/dist/src/signal/signal-client.js"(exports) {
|
|
88761
87978
|
"use strict";
|
|
87979
|
+
var __decorate = exports && exports.__decorate || function(decorators, target, key, desc) {
|
|
87980
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
87981
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
87982
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
87983
|
+
else
|
|
87984
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
87985
|
+
if (d = decorators[i])
|
|
87986
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
87987
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
87988
|
+
};
|
|
88762
87989
|
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
88763
87990
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
88764
87991
|
};
|
|
88765
87992
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88766
87993
|
exports.SignalClient = void 0;
|
|
87994
|
+
var assert_1 = __importDefault(require("assert"));
|
|
88767
87995
|
var debug_1 = __importDefault(require("debug"));
|
|
88768
87996
|
var async_1 = require("@dxos/async");
|
|
88769
|
-
var
|
|
88770
|
-
var protocols_1 = require("@dxos/protocols");
|
|
87997
|
+
var util_1 = require("@dxos/util");
|
|
88771
87998
|
var gen_1 = require_gen5();
|
|
88772
|
-
var
|
|
88773
|
-
var websocket_rpc_1 = require_websocket_rpc();
|
|
87999
|
+
var signal_rpc_client_1 = require_signal_rpc_client();
|
|
88774
88000
|
var log3 = (0, debug_1.default)("dxos:network-manager:signal-client");
|
|
88775
88001
|
var DEFAULT_RECONNECT_TIMEOUT = 1e3;
|
|
88002
|
+
var State;
|
|
88003
|
+
(function(State2) {
|
|
88004
|
+
State2["CONNECTING"] = "CONNECTING";
|
|
88005
|
+
State2["RE_CONNECTING"] = "RE_CONNECTING";
|
|
88006
|
+
State2["CONNECTED"] = "CONNECTED";
|
|
88007
|
+
State2["DISCONNECTED"] = "DISCONNECTED";
|
|
88008
|
+
State2["CLOSED"] = "CLOSED";
|
|
88009
|
+
})(State || (State = {}));
|
|
88776
88010
|
var SignalClient = class {
|
|
88777
|
-
constructor(_host,
|
|
88011
|
+
constructor(_host, _onSignal) {
|
|
88778
88012
|
this._host = _host;
|
|
88779
|
-
this._onOffer = _onOffer;
|
|
88780
88013
|
this._onSignal = _onSignal;
|
|
88781
|
-
this._state =
|
|
88014
|
+
this._state = State.CONNECTING;
|
|
88782
88015
|
this._reconnectAfter = DEFAULT_RECONNECT_TIMEOUT;
|
|
88783
88016
|
this._connectionStarted = Date.now();
|
|
88784
88017
|
this._lastStateChange = Date.now();
|
|
88785
|
-
this.
|
|
88018
|
+
this._cleanupSubscriptions = new util_1.SubscriptionGroup();
|
|
88786
88019
|
this.statusChanged = new async_1.Event();
|
|
88787
88020
|
this.commandTrace = new async_1.Event();
|
|
88788
|
-
this.
|
|
88021
|
+
this.swarmEvent = new async_1.Event();
|
|
88022
|
+
this._swarmStreams = new util_1.ComplexMap((key) => key.toHex());
|
|
88023
|
+
this._messageStreams = new util_1.ComplexMap((key) => key.toHex());
|
|
88024
|
+
this._setState(State.CONNECTING);
|
|
88789
88025
|
this._createClient();
|
|
88790
88026
|
}
|
|
88791
88027
|
_setState(newState) {
|
|
@@ -88797,90 +88033,70 @@ var require_signal_client = __commonJS({
|
|
|
88797
88033
|
_createClient() {
|
|
88798
88034
|
this._connectionStarted = Date.now();
|
|
88799
88035
|
try {
|
|
88800
|
-
this._client = new
|
|
88036
|
+
this._client = new signal_rpc_client_1.SignalRPCClient(this._host);
|
|
88801
88037
|
} catch (error2) {
|
|
88802
|
-
if (this._state ===
|
|
88038
|
+
if (this._state === State.RE_CONNECTING) {
|
|
88803
88039
|
this._reconnectAfter *= 2;
|
|
88804
88040
|
}
|
|
88805
88041
|
this._lastError = error2;
|
|
88806
|
-
this._setState(
|
|
88042
|
+
this._setState(State.DISCONNECTED);
|
|
88807
88043
|
this._reconnect();
|
|
88808
88044
|
}
|
|
88809
|
-
this._client.
|
|
88810
|
-
id: protocols_1.PublicKey.from(message.id),
|
|
88811
|
-
remoteId: protocols_1.PublicKey.from(message.remoteId),
|
|
88812
|
-
topic: protocols_1.PublicKey.from(message.topic),
|
|
88813
|
-
sessionId: protocols_1.PublicKey.from(message.sessionId),
|
|
88814
|
-
data: message.data
|
|
88815
|
-
}));
|
|
88816
|
-
this._client.subscribe("signal", (msg) => {
|
|
88817
|
-
var _a;
|
|
88818
|
-
return this._onSignal({
|
|
88819
|
-
id: protocols_1.PublicKey.from(msg.id),
|
|
88820
|
-
remoteId: protocols_1.PublicKey.from(msg.remoteId),
|
|
88821
|
-
topic: protocols_1.PublicKey.from(msg.topic),
|
|
88822
|
-
sessionId: protocols_1.PublicKey.from(msg.sessionId),
|
|
88823
|
-
data: gen_1.schema.getCodecForType("dxos.mesh.signal.MessageData").decode((_a = msg.data) !== null && _a !== void 0 ? _a : (0, debug_2.failUndefined)()),
|
|
88824
|
-
messageId: msg.messageId ? protocols_1.PublicKey.from(msg.messageId) : void 0
|
|
88825
|
-
});
|
|
88826
|
-
});
|
|
88827
|
-
this._clientCleanup.push(this._client.connected.on(() => {
|
|
88828
|
-
log3("Socket connected");
|
|
88045
|
+
this._cleanupSubscriptions.push(this._client.connected.on(() => {
|
|
88829
88046
|
this._lastError = void 0;
|
|
88830
88047
|
this._reconnectAfter = DEFAULT_RECONNECT_TIMEOUT;
|
|
88831
|
-
this._setState(
|
|
88048
|
+
this._setState(State.CONNECTED);
|
|
88832
88049
|
}));
|
|
88833
|
-
this.
|
|
88050
|
+
this._cleanupSubscriptions.push(this._client.error.on((error2) => {
|
|
88834
88051
|
log3(`Socket error: ${error2.message}`);
|
|
88835
|
-
if (this._state ===
|
|
88052
|
+
if (this._state === State.CLOSED) {
|
|
88836
88053
|
return;
|
|
88837
88054
|
}
|
|
88838
|
-
if (this._state ===
|
|
88055
|
+
if (this._state === State.RE_CONNECTING) {
|
|
88839
88056
|
this._reconnectAfter *= 2;
|
|
88840
88057
|
}
|
|
88841
88058
|
this._lastError = error2;
|
|
88842
|
-
this._setState(
|
|
88059
|
+
this._setState(State.DISCONNECTED);
|
|
88843
88060
|
this._reconnect();
|
|
88844
88061
|
}));
|
|
88845
|
-
this.
|
|
88062
|
+
this._cleanupSubscriptions.push(this._client.disconnected.on(() => {
|
|
88846
88063
|
log3("Socket disconnected");
|
|
88847
|
-
if (this._state !==
|
|
88064
|
+
if (this._state !== State.CONNECTING && this._state !== State.RE_CONNECTING) {
|
|
88848
88065
|
return;
|
|
88849
88066
|
}
|
|
88850
|
-
if (this._state ===
|
|
88067
|
+
if (this._state === State.RE_CONNECTING) {
|
|
88851
88068
|
this._reconnectAfter *= 2;
|
|
88852
88069
|
}
|
|
88853
|
-
this._setState(
|
|
88070
|
+
this._setState(State.DISCONNECTED);
|
|
88854
88071
|
this._reconnect();
|
|
88855
88072
|
}));
|
|
88856
|
-
this._clientCleanup.push(this._client.commandTrace.on((trace) => this.commandTrace.emit(trace)));
|
|
88857
88073
|
}
|
|
88858
88074
|
_reconnect() {
|
|
88075
|
+
log3(`Reconnecting in ${this._reconnectAfter}ms`);
|
|
88859
88076
|
if (this._reconnectIntervalId !== void 0) {
|
|
88860
88077
|
console.error("Signal api already reconnecting.");
|
|
88861
88078
|
return;
|
|
88862
88079
|
}
|
|
88863
|
-
if (this._state ===
|
|
88080
|
+
if (this._state === State.CLOSED) {
|
|
88864
88081
|
return;
|
|
88865
88082
|
}
|
|
88866
88083
|
this._reconnectIntervalId = setTimeout(() => {
|
|
88867
88084
|
this._reconnectIntervalId = void 0;
|
|
88868
|
-
this.
|
|
88869
|
-
this._clientCleanup = [];
|
|
88085
|
+
this._cleanupSubscriptions.unsubscribe();
|
|
88870
88086
|
this._client.close().catch(() => {
|
|
88871
88087
|
});
|
|
88872
|
-
this._setState(
|
|
88088
|
+
this._setState(State.RE_CONNECTING);
|
|
88873
88089
|
this._createClient();
|
|
88874
88090
|
}, this._reconnectAfter);
|
|
88875
88091
|
}
|
|
88876
88092
|
async close() {
|
|
88877
|
-
this.
|
|
88878
|
-
this._clientCleanup = [];
|
|
88093
|
+
this._cleanupSubscriptions.unsubscribe();
|
|
88879
88094
|
if (this._reconnectIntervalId !== void 0) {
|
|
88880
88095
|
clearTimeout(this._reconnectIntervalId);
|
|
88881
88096
|
}
|
|
88882
88097
|
await this._client.close();
|
|
88883
|
-
this._setState(
|
|
88098
|
+
this._setState(State.CLOSED);
|
|
88099
|
+
log3("Closed.");
|
|
88884
88100
|
}
|
|
88885
88101
|
getStatus() {
|
|
88886
88102
|
var _a;
|
|
@@ -88894,47 +88110,61 @@ var require_signal_client = __commonJS({
|
|
|
88894
88110
|
};
|
|
88895
88111
|
}
|
|
88896
88112
|
async join(topic, peerId) {
|
|
88897
|
-
|
|
88898
|
-
|
|
88899
|
-
|
|
88900
|
-
});
|
|
88901
|
-
return peers.map((id) => protocols_1.PublicKey.from(id));
|
|
88113
|
+
log3(`Join: topic=${topic} peerId=${peerId}`);
|
|
88114
|
+
await this._subscribeMessages(peerId);
|
|
88115
|
+
await this._subscribeSwarmEvents(topic, peerId);
|
|
88902
88116
|
}
|
|
88903
88117
|
async leave(topic, peerId) {
|
|
88904
|
-
|
|
88905
|
-
|
|
88906
|
-
|
|
88907
|
-
|
|
88118
|
+
var _a, _b;
|
|
88119
|
+
log3(`Leave: topic=${topic} peerId=${peerId}`);
|
|
88120
|
+
(_a = this._swarmStreams.get(topic)) === null || _a === void 0 ? void 0 : _a.close();
|
|
88121
|
+
this._swarmStreams.delete(topic);
|
|
88122
|
+
(_b = this._messageStreams.get(topic)) === null || _b === void 0 ? void 0 : _b.close();
|
|
88123
|
+
this._messageStreams.delete(topic);
|
|
88908
88124
|
}
|
|
88909
|
-
async
|
|
88910
|
-
const
|
|
88911
|
-
|
|
88912
|
-
|
|
88913
|
-
|
|
88125
|
+
async signal(message) {
|
|
88126
|
+
const payload = {
|
|
88127
|
+
type_url: "dxos.mesh.signalMessage.SignalMessage",
|
|
88128
|
+
value: gen_1.schema.getCodecForType("dxos.mesh.signalMessage.SignalMessage").encode(message)
|
|
88129
|
+
};
|
|
88130
|
+
return this._client.sendMessage(message.id, message.remoteId, payload);
|
|
88914
88131
|
}
|
|
88915
|
-
async
|
|
88916
|
-
|
|
88917
|
-
|
|
88918
|
-
|
|
88919
|
-
|
|
88920
|
-
|
|
88921
|
-
|
|
88922
|
-
|
|
88132
|
+
async _subscribeSwarmEvents(topic, peerId) {
|
|
88133
|
+
(0, assert_1.default)(!this._swarmStreams.has(topic));
|
|
88134
|
+
const swarmStream = await this._client.join(topic, peerId);
|
|
88135
|
+
swarmStream.subscribe((swarmEvent) => {
|
|
88136
|
+
this.swarmEvent.emit([topic, swarmEvent]);
|
|
88137
|
+
});
|
|
88138
|
+
this._swarmStreams.set(topic, swarmStream);
|
|
88139
|
+
this._cleanupSubscriptions.push(() => {
|
|
88140
|
+
swarmStream.close();
|
|
88141
|
+
this._swarmStreams.delete(topic);
|
|
88923
88142
|
});
|
|
88924
88143
|
}
|
|
88925
|
-
async
|
|
88926
|
-
|
|
88927
|
-
|
|
88928
|
-
|
|
88929
|
-
|
|
88930
|
-
|
|
88931
|
-
|
|
88932
|
-
|
|
88933
|
-
|
|
88934
|
-
|
|
88935
|
-
|
|
88144
|
+
async _subscribeMessages(peerId) {
|
|
88145
|
+
const messageStream = await this._client.receiveMessages(peerId);
|
|
88146
|
+
messageStream.subscribe(async (message) => {
|
|
88147
|
+
if (message.payload.type_url === "dxos.mesh.signalMessage.SignalMessage") {
|
|
88148
|
+
const signalMessage = gen_1.schema.getCodecForType("dxos.mesh.signalMessage.SignalMessage").decode(message.payload.value);
|
|
88149
|
+
log3("Message received: " + JSON.stringify(signalMessage));
|
|
88150
|
+
(0, assert_1.default)(signalMessage.remoteId.equals(peerId));
|
|
88151
|
+
await this._onSignal(signalMessage);
|
|
88152
|
+
} else {
|
|
88153
|
+
log3("Unknown message type: " + message.payload.type_url);
|
|
88154
|
+
}
|
|
88155
|
+
});
|
|
88156
|
+
if (!this._messageStreams.has(peerId)) {
|
|
88157
|
+
this._messageStreams.set(peerId, messageStream);
|
|
88158
|
+
}
|
|
88159
|
+
this._cleanupSubscriptions.push(() => {
|
|
88160
|
+
messageStream.close();
|
|
88161
|
+
this._messageStreams.delete(peerId);
|
|
88162
|
+
});
|
|
88936
88163
|
}
|
|
88937
88164
|
};
|
|
88165
|
+
__decorate([
|
|
88166
|
+
async_1.synchronized
|
|
88167
|
+
], SignalClient.prototype, "_subscribeSwarmEvents", null);
|
|
88938
88168
|
exports.SignalClient = SignalClient;
|
|
88939
88169
|
}
|
|
88940
88170
|
});
|
|
@@ -88947,9 +88177,9 @@ var require_signal_manager = __commonJS({
|
|
|
88947
88177
|
}
|
|
88948
88178
|
});
|
|
88949
88179
|
|
|
88950
|
-
// ../../mesh/network-manager/dist/src/signal/
|
|
88951
|
-
var
|
|
88952
|
-
"../../mesh/network-manager/dist/src/signal/
|
|
88180
|
+
// ../../mesh/network-manager/dist/src/signal/signal-manager-impl.js
|
|
88181
|
+
var require_signal_manager_impl = __commonJS({
|
|
88182
|
+
"../../mesh/network-manager/dist/src/signal/signal-manager-impl.js"(exports) {
|
|
88953
88183
|
"use strict";
|
|
88954
88184
|
var __decorate = exports && exports.__decorate || function(decorators, target, key, desc) {
|
|
88955
88185
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -88965,30 +88195,32 @@ var require_websocket_signal_manager = __commonJS({
|
|
|
88965
88195
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
88966
88196
|
};
|
|
88967
88197
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88968
|
-
exports.
|
|
88198
|
+
exports.SignalManagerImpl = void 0;
|
|
88969
88199
|
var debug_1 = __importDefault(require("debug"));
|
|
88970
88200
|
var node_assert_1 = __importDefault(require_assert());
|
|
88971
88201
|
var async_1 = require("@dxos/async");
|
|
88972
88202
|
var util_1 = require("@dxos/util");
|
|
88973
88203
|
var signal_client_1 = require_signal_client();
|
|
88974
|
-
var log3 = (0, debug_1.default)("dxos:network-manager:
|
|
88975
|
-
var
|
|
88976
|
-
constructor(_hosts
|
|
88204
|
+
var log3 = (0, debug_1.default)("dxos:network-manager:signal-manager-impl");
|
|
88205
|
+
var SignalManagerImpl = class {
|
|
88206
|
+
constructor(_hosts) {
|
|
88977
88207
|
this._hosts = _hosts;
|
|
88978
|
-
this._onOffer = _onOffer;
|
|
88979
88208
|
this._servers = /* @__PURE__ */ new Map();
|
|
88980
88209
|
this._topicsJoined = new util_1.ComplexMap((topic) => topic.toHex());
|
|
88981
88210
|
this._topicsJoinedPerSignal = /* @__PURE__ */ new Map();
|
|
88211
|
+
this._reconciling = false;
|
|
88212
|
+
this._destroyed = false;
|
|
88982
88213
|
this.statusChanged = new async_1.Event();
|
|
88983
88214
|
this.commandTrace = new async_1.Event();
|
|
88984
|
-
this.
|
|
88985
|
-
this.
|
|
88215
|
+
this.swarmEvent = new async_1.Event();
|
|
88216
|
+
this.onMessage = new async_1.Event();
|
|
88986
88217
|
log3(`Created WebsocketSignalManager with signal servers: ${_hosts}`);
|
|
88987
88218
|
(0, node_assert_1.default)(_hosts.length === 1, "Only a single signaling server connection is supported");
|
|
88988
88219
|
for (const host of this._hosts) {
|
|
88989
|
-
const server = new signal_client_1.SignalClient(host, async (msg) => this.
|
|
88990
|
-
this.
|
|
88220
|
+
const server = new signal_client_1.SignalClient(host, async (msg) => this.onMessage.emit(msg));
|
|
88221
|
+
server.swarmEvent.on((data) => this.swarmEvent.emit(data));
|
|
88991
88222
|
server.statusChanged.on(() => this.statusChanged.emit(this.getStatus()));
|
|
88223
|
+
this._servers.set(host, server);
|
|
88992
88224
|
server.commandTrace.on((trace) => this.commandTrace.emit(trace));
|
|
88993
88225
|
this._topicsJoinedPerSignal.set(host, new util_1.ComplexMap((x) => x.toHex()));
|
|
88994
88226
|
}
|
|
@@ -88997,87 +88229,98 @@ var require_websocket_signal_manager = __commonJS({
|
|
|
88997
88229
|
return Array.from(this._servers.values()).map((server) => server.getStatus());
|
|
88998
88230
|
}
|
|
88999
88231
|
join(topic, peerId) {
|
|
88232
|
+
(0, node_assert_1.default)(!this._topicsJoined.has(topic), `Topic ${topic} is already joined`);
|
|
89000
88233
|
log3(`Join ${topic} ${peerId}`);
|
|
89001
88234
|
this._topicsJoined.set(topic, peerId);
|
|
89002
|
-
|
|
88235
|
+
this._scheduleReconcile();
|
|
89003
88236
|
}
|
|
89004
88237
|
leave(topic, peerId) {
|
|
88238
|
+
(0, node_assert_1.default)(!!this._topicsJoined.has(topic), `Topic ${topic} was not joined`);
|
|
89005
88239
|
log3(`Leave ${topic} ${peerId}`);
|
|
89006
88240
|
this._topicsJoined.delete(topic);
|
|
89007
|
-
|
|
88241
|
+
this._scheduleReconcile();
|
|
89008
88242
|
}
|
|
89009
|
-
|
|
89010
|
-
|
|
89011
|
-
|
|
89012
|
-
|
|
89013
|
-
|
|
89014
|
-
|
|
89015
|
-
|
|
89016
|
-
|
|
89017
|
-
|
|
89018
|
-
|
|
89019
|
-
|
|
89020
|
-
|
|
89021
|
-
|
|
89022
|
-
|
|
89023
|
-
|
|
89024
|
-
this._reconcile();
|
|
89025
|
-
}));
|
|
89026
|
-
}
|
|
89027
|
-
for (const [topic2, peerId2] of this._topicsJoinedPerSignal.get(host).entries()) {
|
|
89028
|
-
if (!this._topicsJoined.has(topic2)) {
|
|
89029
|
-
log3(`Leave ${topic2} as ${peerId2} on ${host}`);
|
|
89030
|
-
promises.push(server.leave(topic2, peerId2).then(() => {
|
|
89031
|
-
log3(`Left successfully ${host}`);
|
|
89032
|
-
this._topicsJoinedPerSignal.get(host).delete(topic2);
|
|
89033
|
-
}, (err) => {
|
|
89034
|
-
log3(`Leave error ${host} ${err.message}`);
|
|
89035
|
-
this._reconcile();
|
|
89036
|
-
}));
|
|
89037
|
-
}
|
|
89038
|
-
}
|
|
89039
|
-
}
|
|
88243
|
+
_scheduleReconcile() {
|
|
88244
|
+
if (this._destroyed) {
|
|
88245
|
+
return;
|
|
88246
|
+
}
|
|
88247
|
+
if (!this._reconciling) {
|
|
88248
|
+
this._reconciling = true;
|
|
88249
|
+
this._reconcileJoinedTopics().then(() => {
|
|
88250
|
+
this._reconciling = false;
|
|
88251
|
+
}, (err) => {
|
|
88252
|
+
this._reconciling = false;
|
|
88253
|
+
log3(`Error while reconciling: ${err}`);
|
|
88254
|
+
this._reconcileLater();
|
|
88255
|
+
});
|
|
88256
|
+
} else {
|
|
88257
|
+
this._reconcileLater();
|
|
89040
88258
|
}
|
|
89041
|
-
await Promise.all(promises);
|
|
89042
88259
|
}
|
|
89043
|
-
|
|
89044
|
-
if (this.
|
|
88260
|
+
_reconcileLater() {
|
|
88261
|
+
if (this._destroyed) {
|
|
89045
88262
|
return;
|
|
89046
88263
|
}
|
|
89047
|
-
|
|
89048
|
-
|
|
89049
|
-
this._reconcileTimeoutId = void 0;
|
|
89050
|
-
await this._reconcileJoinedTopics();
|
|
89051
|
-
}, 3e3);
|
|
89052
|
-
}
|
|
89053
|
-
lookup(topic) {
|
|
89054
|
-
log3(`Lookup ${topic}`);
|
|
89055
|
-
for (const server of this._servers.values()) {
|
|
89056
|
-
server.lookup(topic).then((peers) => {
|
|
89057
|
-
log3(`Peer candidates changed ${topic} ${peers}`);
|
|
89058
|
-
this.peerCandidatesChanged.emit([topic, peers]);
|
|
89059
|
-
}, () => {
|
|
89060
|
-
});
|
|
88264
|
+
if (!this._reconcileTimeoutId) {
|
|
88265
|
+
this._reconcileTimeoutId = setTimeout(async () => this._scheduleReconcile(), 3e3);
|
|
89061
88266
|
}
|
|
89062
88267
|
}
|
|
89063
|
-
|
|
89064
|
-
log3(
|
|
89065
|
-
|
|
88268
|
+
async _reconcileJoinedTopics() {
|
|
88269
|
+
log3("Reconciling..");
|
|
88270
|
+
for (const [host, server] of this._servers) {
|
|
88271
|
+
const actualJoinedTopics = this._topicsJoinedPerSignal.get(host);
|
|
88272
|
+
for (const [topic, actualPeerId] of actualJoinedTopics) {
|
|
88273
|
+
try {
|
|
88274
|
+
const desiredPeerId = this._topicsJoined.get(topic);
|
|
88275
|
+
if (!desiredPeerId || !desiredPeerId.equals(actualPeerId)) {
|
|
88276
|
+
await server.leave(topic, actualPeerId);
|
|
88277
|
+
actualJoinedTopics.delete(topic);
|
|
88278
|
+
}
|
|
88279
|
+
} catch (err) {
|
|
88280
|
+
log3(`Error leaving swarm: ${err}`);
|
|
88281
|
+
this._scheduleReconcile();
|
|
88282
|
+
}
|
|
88283
|
+
}
|
|
88284
|
+
for (const [topic, desiredPeerId] of this._topicsJoined) {
|
|
88285
|
+
try {
|
|
88286
|
+
const actualPeerId = actualJoinedTopics.get(topic);
|
|
88287
|
+
if (!actualPeerId) {
|
|
88288
|
+
await server.join(topic, desiredPeerId);
|
|
88289
|
+
actualJoinedTopics.set(topic, desiredPeerId);
|
|
88290
|
+
} else {
|
|
88291
|
+
if (!actualPeerId.equals(desiredPeerId)) {
|
|
88292
|
+
throw new Error(`Joined with peerId different from desired: ${JSON.stringify({ actualPeerId, desiredPeerId })}`);
|
|
88293
|
+
}
|
|
88294
|
+
}
|
|
88295
|
+
} catch (err) {
|
|
88296
|
+
log3(`Error joining swarm: ${err}`);
|
|
88297
|
+
this._scheduleReconcile();
|
|
88298
|
+
}
|
|
88299
|
+
}
|
|
88300
|
+
}
|
|
88301
|
+
log3("Done reconciling..");
|
|
88302
|
+
this._reconciling = false;
|
|
89066
88303
|
}
|
|
89067
|
-
async
|
|
88304
|
+
async message(msg) {
|
|
89068
88305
|
log3(`Signal ${msg.remoteId}`);
|
|
89069
88306
|
for (const server of this._servers.values()) {
|
|
89070
|
-
|
|
88307
|
+
server.signal(msg).catch((err) => {
|
|
88308
|
+
log3(`Error signaling: ${err}`);
|
|
88309
|
+
});
|
|
89071
88310
|
}
|
|
89072
88311
|
}
|
|
89073
88312
|
async destroy() {
|
|
88313
|
+
this._destroyed = true;
|
|
88314
|
+
if (this._reconcileTimeoutId) {
|
|
88315
|
+
clearTimeout(this._reconcileTimeoutId);
|
|
88316
|
+
}
|
|
89074
88317
|
await Promise.all(Array.from(this._servers.values()).map((server) => server.close()));
|
|
89075
88318
|
}
|
|
89076
88319
|
};
|
|
89077
88320
|
__decorate([
|
|
89078
88321
|
async_1.synchronized
|
|
89079
|
-
],
|
|
89080
|
-
exports.
|
|
88322
|
+
], SignalManagerImpl.prototype, "_reconcileJoinedTopics", null);
|
|
88323
|
+
exports.SignalManagerImpl = SignalManagerImpl;
|
|
89081
88324
|
}
|
|
89082
88325
|
});
|
|
89083
88326
|
|
|
@@ -89110,8 +88353,7 @@ var require_signal = __commonJS({
|
|
|
89110
88353
|
__exportStar(require_signal_api(), exports);
|
|
89111
88354
|
__exportStar(require_signal_client(), exports);
|
|
89112
88355
|
__exportStar(require_signal_manager(), exports);
|
|
89113
|
-
__exportStar(
|
|
89114
|
-
__exportStar(require_websocket_signal_manager(), exports);
|
|
88356
|
+
__exportStar(require_signal_manager_impl(), exports);
|
|
89115
88357
|
}
|
|
89116
88358
|
});
|
|
89117
88359
|
|
|
@@ -89183,7 +88425,11 @@ var require_message_router = __commonJS({
|
|
|
89183
88425
|
log3(`sent message: ${JSON.stringify(message)}`);
|
|
89184
88426
|
const cancelRetry = (0, util_1.exponentialBackoffInterval)(async () => {
|
|
89185
88427
|
log3(`retrying message: ${JSON.stringify(message)}`);
|
|
89186
|
-
|
|
88428
|
+
try {
|
|
88429
|
+
await this._sendMessage(message);
|
|
88430
|
+
} catch (error2) {
|
|
88431
|
+
log3(`ERROR failed to send message: ${error2}`);
|
|
88432
|
+
}
|
|
89187
88433
|
}, this._retryDelay);
|
|
89188
88434
|
const timeout = setTimeout(() => {
|
|
89189
88435
|
log3("Signal was not delivered!");
|
|
@@ -90432,14 +89678,14 @@ var require_network_manager = __commonJS({
|
|
|
90432
89678
|
var _a2, _b;
|
|
90433
89679
|
return (_b = await ((_a2 = this._swarms.get(message.topic)) === null || _a2 === void 0 ? void 0 : _a2.onOffer(message))) !== null && _b !== void 0 ? _b : { accept: false };
|
|
90434
89680
|
};
|
|
90435
|
-
this._signalManager = options.signal ? new signal_1.
|
|
90436
|
-
this._signalManager.
|
|
89681
|
+
this._signalManager = options.signal ? new signal_1.SignalManagerImpl(options.signal) : new signal_1.InMemorySignalManager(onOffer);
|
|
89682
|
+
this._signalManager.swarmEvent.on(([topic, event]) => {
|
|
90437
89683
|
var _a2;
|
|
90438
|
-
return (_a2 = this._swarms.get(topic)) === null || _a2 === void 0 ? void 0 : _a2.
|
|
89684
|
+
return (_a2 = this._swarms.get(topic)) === null || _a2 === void 0 ? void 0 : _a2.onSwarmEvent(event);
|
|
90439
89685
|
});
|
|
90440
|
-
this._signalManager.
|
|
89686
|
+
this._signalManager.onMessage.on((msg) => this._messageRouter.receiveMessage(msg));
|
|
90441
89687
|
this._messageRouter = new message_router_1.MessageRouter({
|
|
90442
|
-
sendMessage: (msg) => this._signalManager.
|
|
89688
|
+
sendMessage: (msg) => this._signalManager.message(msg),
|
|
90443
89689
|
onSignal: async (msg) => {
|
|
90444
89690
|
var _a2;
|
|
90445
89691
|
return (_a2 = this._swarms.get(msg.topic)) === null || _a2 === void 0 ? void 0 : _a2.onSignal(msg);
|
|
@@ -90478,7 +89724,7 @@ var require_network_manager = __commonJS({
|
|
|
90478
89724
|
throw new mesh_protocol_1.ERR_EXTENSION_RESPONSE_FAILED(credentials_1.GreetingCommandPlugin.EXTENSION_NAME, credentials_1.ERR_GREET_ALREADY_CONNECTED_TO_SWARM, `Already connected to swarm ${topic}`);
|
|
90479
89725
|
}
|
|
90480
89726
|
const transportFactory = this._signalManager instanceof signal_1.InMemorySignalManager ? transport_1.inMemoryTransportFactory : (0, transport_1.createWebRTCTransportFactory)({ iceServers: this._ice });
|
|
90481
|
-
const swarm = new swarm_1.Swarm(topic, peerId, topology, protocol, this._messageRouter,
|
|
89727
|
+
const swarm = new swarm_1.Swarm(topic, peerId, topology, protocol, this._messageRouter, transportFactory, options.label);
|
|
90482
89728
|
swarm.errors.handle((error2) => {
|
|
90483
89729
|
log3(`Swarm error: ${error2}`);
|
|
90484
89730
|
});
|
|
@@ -90590,9 +89836,6 @@ var require_fully_connected_topology = __commonJS({
|
|
|
90590
89836
|
init(controller) {
|
|
90591
89837
|
(0, node_assert_1.default)(!this._controller, "Already initialized");
|
|
90592
89838
|
this._controller = controller;
|
|
90593
|
-
this._intervalId = setInterval(() => {
|
|
90594
|
-
controller.lookup();
|
|
90595
|
-
}, 1e4);
|
|
90596
89839
|
}
|
|
90597
89840
|
update() {
|
|
90598
89841
|
(0, node_assert_1.default)(this._controller, "Not initialized");
|
|
@@ -90605,9 +89848,6 @@ var require_fully_connected_topology = __commonJS({
|
|
|
90605
89848
|
return true;
|
|
90606
89849
|
}
|
|
90607
89850
|
async destroy() {
|
|
90608
|
-
if (this._intervalId !== void 0) {
|
|
90609
|
-
clearInterval(this._intervalId);
|
|
90610
|
-
}
|
|
90611
89851
|
}
|
|
90612
89852
|
toString() {
|
|
90613
89853
|
return "FullyConnectedTopology";
|
|
@@ -90674,9 +89914,6 @@ var require_mmst_topology = __commonJS({
|
|
|
90674
89914
|
init(controller) {
|
|
90675
89915
|
(0, node_assert_1.default)(!this._controller, "Already initialized");
|
|
90676
89916
|
this._controller = controller;
|
|
90677
|
-
this._lookupIntervalId = setInterval(() => {
|
|
90678
|
-
controller.lookup();
|
|
90679
|
-
}, 1e4);
|
|
90680
89917
|
}
|
|
90681
89918
|
update() {
|
|
90682
89919
|
(0, node_assert_1.default)(this._controller, "Not initialized");
|
|
@@ -90695,9 +89932,6 @@ var require_mmst_topology = __commonJS({
|
|
|
90695
89932
|
return accept;
|
|
90696
89933
|
}
|
|
90697
89934
|
async destroy() {
|
|
90698
|
-
if (this._lookupIntervalId !== void 0) {
|
|
90699
|
-
clearInterval(this._lookupIntervalId);
|
|
90700
|
-
}
|
|
90701
89935
|
}
|
|
90702
89936
|
_runAlgorithm() {
|
|
90703
89937
|
(0, node_assert_1.default)(this._controller, "Not initialized");
|
|
@@ -90748,9 +89982,6 @@ var require_star_topology = __commonJS({
|
|
|
90748
89982
|
init(controller) {
|
|
90749
89983
|
(0, node_assert_1.default)(!this._controller, "Already initialized.");
|
|
90750
89984
|
this._controller = controller;
|
|
90751
|
-
this._intervalId = setInterval(() => {
|
|
90752
|
-
controller.lookup();
|
|
90753
|
-
}, 1e4);
|
|
90754
89985
|
}
|
|
90755
89986
|
update() {
|
|
90756
89987
|
(0, node_assert_1.default)(this._controller, "Not initialized.");
|
|
@@ -90778,9 +90009,6 @@ var require_star_topology = __commonJS({
|
|
|
90778
90009
|
return ownPeerId.equals(this._centralPeer) || peer.equals(this._centralPeer);
|
|
90779
90010
|
}
|
|
90780
90011
|
async destroy() {
|
|
90781
|
-
if (this._intervalId !== void 0) {
|
|
90782
|
-
clearInterval(this._intervalId);
|
|
90783
|
-
}
|
|
90784
90012
|
}
|
|
90785
90013
|
};
|
|
90786
90014
|
exports.StarTopology = StarTopology;
|
|
@@ -91217,7 +90445,7 @@ var require_invitation_descriptor = __commonJS({
|
|
|
91217
90445
|
var errors_1 = require_errors6();
|
|
91218
90446
|
exports.InvitationDescriptorType = proto.InvitationDescriptor.Type;
|
|
91219
90447
|
var base62 = (0, base_x_1.default)("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
|
91220
|
-
var
|
|
90448
|
+
var InvitationDescriptor8 = class {
|
|
91221
90449
|
constructor(type, swarmKey, invitation, identityKey, secret) {
|
|
91222
90450
|
this.type = type;
|
|
91223
90451
|
this.swarmKey = swarmKey;
|
|
@@ -91236,7 +90464,7 @@ var require_invitation_descriptor = __commonJS({
|
|
|
91236
90464
|
}
|
|
91237
90465
|
static fromQueryParameters(queryParameters) {
|
|
91238
90466
|
const { hash, swarmKey, invitation, identityKey, type } = queryParameters;
|
|
91239
|
-
const descriptor = new
|
|
90467
|
+
const descriptor = new InvitationDescriptor8(parseInvitationType(type), protocols_1.PublicKey.bufferize(swarmKey), protocols_1.PublicKey.bufferize(invitation), identityKey ? protocols_1.PublicKey.from(identityKey) : void 0);
|
|
91240
90468
|
if (hash !== descriptor.hash) {
|
|
91241
90469
|
throw new errors_1.InvalidInvitationError();
|
|
91242
90470
|
}
|
|
@@ -91246,11 +90474,11 @@ var require_invitation_descriptor = __commonJS({
|
|
|
91246
90474
|
(0, node_assert_1.default)(protoInvitation.type, "Invitation type not provided.");
|
|
91247
90475
|
(0, node_assert_1.default)(protoInvitation.swarmKey, "Invitation swarm key not provided.");
|
|
91248
90476
|
(0, node_assert_1.default)(protoInvitation.invitation, "Invitation not provided.");
|
|
91249
|
-
return new
|
|
90477
|
+
return new InvitationDescriptor8(protoInvitation.type, protoInvitation.swarmKey, Buffer.from(protoInvitation.invitation), protoInvitation.identityKey ? protocols_1.PublicKey.from(protoInvitation.identityKey) : void 0, protoInvitation.secret ? Buffer.from(protoInvitation.secret) : void 0);
|
|
91250
90478
|
}
|
|
91251
90479
|
static decode(code) {
|
|
91252
90480
|
const json = base62.decode(code).toString();
|
|
91253
|
-
return
|
|
90481
|
+
return InvitationDescriptor8.fromQueryParameters(JSON.parse(json));
|
|
91254
90482
|
}
|
|
91255
90483
|
get hash() {
|
|
91256
90484
|
const query = this.toQueryParameters();
|
|
@@ -91283,7 +90511,7 @@ var require_invitation_descriptor = __commonJS({
|
|
|
91283
90511
|
return base62.encode(buffer);
|
|
91284
90512
|
}
|
|
91285
90513
|
};
|
|
91286
|
-
exports.InvitationDescriptor =
|
|
90514
|
+
exports.InvitationDescriptor = InvitationDescriptor8;
|
|
91287
90515
|
var parseInvitationType = (str) => {
|
|
91288
90516
|
const type = parseInt(str);
|
|
91289
90517
|
(0, node_assert_1.default)(type === 1 || type === 2, "Invalid invitation type");
|
|
@@ -96129,7 +95357,7 @@ var require_echo2 = __commonJS({
|
|
|
96129
95357
|
var snapshots_1 = require_snapshots();
|
|
96130
95358
|
var log3 = (0, debug_1.default)("dxos:echo");
|
|
96131
95359
|
var error2 = log3.extend("error");
|
|
96132
|
-
var
|
|
95360
|
+
var ECHO5 = class {
|
|
96133
95361
|
constructor({
|
|
96134
95362
|
keyStorage = (0, memdown_1.default)(),
|
|
96135
95363
|
storage = (0, random_access_multi_storage_1.createStorage)("", random_access_multi_storage_1.StorageType.RAM),
|
|
@@ -96290,11 +95518,11 @@ var require_echo2 = __commonJS({
|
|
|
96290
95518
|
};
|
|
96291
95519
|
__decorate([
|
|
96292
95520
|
async_1.synchronized
|
|
96293
|
-
],
|
|
95521
|
+
], ECHO5.prototype, "open", null);
|
|
96294
95522
|
__decorate([
|
|
96295
95523
|
async_1.synchronized
|
|
96296
|
-
],
|
|
96297
|
-
exports.ECHO =
|
|
95524
|
+
], ECHO5.prototype, "close", null);
|
|
95525
|
+
exports.ECHO = ECHO5;
|
|
96298
95526
|
}
|
|
96299
95527
|
});
|
|
96300
95528
|
|
|
@@ -96488,7 +95716,7 @@ __export(src_exports, {
|
|
|
96488
95716
|
InvitationDescriptor: () => import_echo_db9.InvitationDescriptor,
|
|
96489
95717
|
InvitationDescriptorType: () => import_echo_db9.InvitationDescriptorType,
|
|
96490
95718
|
InvitationProxy: () => InvitationProxy,
|
|
96491
|
-
InvitationRequest: () =>
|
|
95719
|
+
InvitationRequest: () => InvitationRequest,
|
|
96492
95720
|
Item: () => import_echo_db9.Item,
|
|
96493
95721
|
ItemFilterDeleted: () => import_echo_db9.ItemFilterDeleted,
|
|
96494
95722
|
ItemID: () => import_echo_protocol2.ItemID,
|
|
@@ -96520,10 +95748,7 @@ __export(src_exports, {
|
|
|
96520
95748
|
defaultConfig: () => defaultConfig,
|
|
96521
95749
|
defaultTestingConfig: () => defaultTestingConfig,
|
|
96522
95750
|
generateSeedPhrase: () => import_credentials5.generateSeedPhrase,
|
|
96523
|
-
|
|
96524
|
-
proto: () => gen_exports,
|
|
96525
|
-
resultSetToStream: () => resultSetToStream,
|
|
96526
|
-
streamToResultSet: () => streamToResultSet
|
|
95751
|
+
proto: () => gen_exports
|
|
96527
95752
|
});
|
|
96528
95753
|
module.exports = __toCommonJS(src_exports);
|
|
96529
95754
|
var import_credentials5 = __toESM(require_src5());
|
|
@@ -96532,480 +95757,26 @@ var import_echo_protocol2 = __toESM(require_src7());
|
|
|
96532
95757
|
var import_object_model2 = __toESM(require_src8());
|
|
96533
95758
|
var import_network_manager = __toESM(require_src9());
|
|
96534
95759
|
|
|
96535
|
-
// src/
|
|
96536
|
-
var import_node_assert = __toESM(require_assert());
|
|
96537
|
-
var import_codec_protobuf2 = require("@dxos/codec-protobuf");
|
|
96538
|
-
var import_util = require("@dxos/util");
|
|
96539
|
-
|
|
96540
|
-
// src/util/platform.ts
|
|
96541
|
-
var isNode = () => typeof process !== "undefined" && process.versions != null && process.versions.node != null;
|
|
96542
|
-
|
|
96543
|
-
// src/util/messages.ts
|
|
96544
|
-
var createWindowMessagePort = () => {
|
|
96545
|
-
if (isNode()) {
|
|
96546
|
-
throw new Error("Connecting to wallet extension is not available in Node environment.");
|
|
96547
|
-
}
|
|
96548
|
-
return {
|
|
96549
|
-
send: async (message) => window.postMessage({
|
|
96550
|
-
payloadFromAppToContentScript: Array.from(message)
|
|
96551
|
-
}, "*"),
|
|
96552
|
-
subscribe: (callback) => {
|
|
96553
|
-
const listener = (event) => {
|
|
96554
|
-
var _a;
|
|
96555
|
-
const payload = (_a = event == null ? void 0 : event.data) == null ? void 0 : _a.payloadFromContentScriptToApp;
|
|
96556
|
-
if (payload) {
|
|
96557
|
-
callback(new Uint8Array(payload));
|
|
96558
|
-
}
|
|
96559
|
-
};
|
|
96560
|
-
window.addEventListener("message", listener);
|
|
96561
|
-
return () => window.removeEventListener("message", listener);
|
|
96562
|
-
}
|
|
96563
|
-
};
|
|
96564
|
-
};
|
|
96565
|
-
|
|
96566
|
-
// src/util/subscription.ts
|
|
96567
|
-
var import_async = require("@dxos/async");
|
|
96568
|
-
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
96569
|
-
var import_echo_db = __toESM(require_src14());
|
|
96570
|
-
var resultSetToStream = (resultSet, map) => new import_codec_protobuf.Stream(({ next }) => {
|
|
96571
|
-
next(map(resultSet.value));
|
|
96572
|
-
return resultSet.update.on(() => next(map(resultSet.value)));
|
|
96573
|
-
});
|
|
96574
|
-
var streamToResultSet = (stream, map) => {
|
|
96575
|
-
const event = new import_async.Event();
|
|
96576
|
-
let lastItem;
|
|
96577
|
-
stream.subscribe((data) => {
|
|
96578
|
-
lastItem = data;
|
|
96579
|
-
event.emit();
|
|
96580
|
-
});
|
|
96581
|
-
return new import_echo_db.ResultSet(event, () => map(lastItem));
|
|
96582
|
-
};
|
|
96583
|
-
|
|
96584
|
-
// src/services/impl/halo.ts
|
|
96585
|
-
var HaloService = class {
|
|
96586
|
-
constructor(echo, signer) {
|
|
96587
|
-
this.echo = echo;
|
|
96588
|
-
this.signer = signer;
|
|
96589
|
-
}
|
|
96590
|
-
async sign(request) {
|
|
96591
|
-
(0, import_node_assert.default)(this.signer, "Signer not set.");
|
|
96592
|
-
(0, import_node_assert.default)(request.publicKey, "Provide a publicKey of the key that should be used for signing.");
|
|
96593
|
-
const key = await this.echo.halo.keyring.getFullKey(request.publicKey);
|
|
96594
|
-
(0, import_node_assert.default)(key, "Key not found.");
|
|
96595
|
-
return this.signer.sign(request, key);
|
|
96596
|
-
}
|
|
96597
|
-
async addKeyRecord(request) {
|
|
96598
|
-
(0, import_node_assert.default)(request.keyRecord && request.keyRecord.publicKey, "Missing key record.");
|
|
96599
|
-
await this.echo.halo.keyring.addKeyRecord(request.keyRecord);
|
|
96600
|
-
(0, import_node_assert.default)(await this.echo.halo.keyring.getKey(request.keyRecord.publicKey), "Key not inserted correctly.");
|
|
96601
|
-
}
|
|
96602
|
-
subscribeContacts() {
|
|
96603
|
-
if (this.echo.halo.identity) {
|
|
96604
|
-
return resultSetToStream(this.echo.halo.queryContacts(), (contacts) => ({ contacts }));
|
|
96605
|
-
}
|
|
96606
|
-
return new import_codec_protobuf2.Stream(({ next }) => {
|
|
96607
|
-
if (!this.echo.halo.identity) {
|
|
96608
|
-
next({ contacts: [] });
|
|
96609
|
-
}
|
|
96610
|
-
const subGroup = new import_util.SubscriptionGroup();
|
|
96611
|
-
setImmediate(async () => {
|
|
96612
|
-
await this.echo.halo.identityReady.waitForCondition(() => !!this.echo.halo.identity);
|
|
96613
|
-
const resultSet = this.echo.halo.queryContacts();
|
|
96614
|
-
next({ contacts: resultSet.value });
|
|
96615
|
-
subGroup.push(resultSet.update.on(() => next({ contacts: resultSet.value })));
|
|
96616
|
-
});
|
|
96617
|
-
return () => subGroup.unsubscribe();
|
|
96618
|
-
});
|
|
96619
|
-
}
|
|
96620
|
-
async setGlobalPreference(request) {
|
|
96621
|
-
var _a, _b, _c;
|
|
96622
|
-
(0, import_node_assert.default)(request.key, "Missing key of property.");
|
|
96623
|
-
const preferences = (_c = (_b = (_a = this.echo.halo.identity) == null ? void 0 : _a.preferences) == null ? void 0 : _b.getGlobalPreferences()) == null ? void 0 : _c.model;
|
|
96624
|
-
(0, import_node_assert.default)(preferences, "Preferences failed to load.");
|
|
96625
|
-
await preferences.setProperty(request.key, request.value);
|
|
96626
|
-
}
|
|
96627
|
-
async getGlobalPreference(request) {
|
|
96628
|
-
var _a, _b, _c;
|
|
96629
|
-
(0, import_node_assert.default)(request.key, "Missing key of property.");
|
|
96630
|
-
const preferences = (_c = (_b = (_a = this.echo.halo.identity) == null ? void 0 : _a.preferences) == null ? void 0 : _b.getGlobalPreferences()) == null ? void 0 : _c.model;
|
|
96631
|
-
return {
|
|
96632
|
-
value: preferences == null ? void 0 : preferences.getProperty(request.key)
|
|
96633
|
-
};
|
|
96634
|
-
}
|
|
96635
|
-
async setDevicePreference(request) {
|
|
96636
|
-
var _a, _b, _c;
|
|
96637
|
-
(0, import_node_assert.default)(request.key, "Missing key of property.");
|
|
96638
|
-
const preferences = (_c = (_b = (_a = this.echo.halo.identity) == null ? void 0 : _a.preferences) == null ? void 0 : _b.getDevicePreferences()) == null ? void 0 : _c.model;
|
|
96639
|
-
(0, import_node_assert.default)(preferences, "Preferences failed to load.");
|
|
96640
|
-
await preferences.setProperty(request.key, request.value);
|
|
96641
|
-
}
|
|
96642
|
-
async getDevicePreference(request) {
|
|
96643
|
-
var _a, _b, _c;
|
|
96644
|
-
(0, import_node_assert.default)(request.key, "Missing key of property.");
|
|
96645
|
-
const preferences = (_c = (_b = (_a = this.echo.halo.identity) == null ? void 0 : _a.preferences) == null ? void 0 : _b.getDevicePreferences()) == null ? void 0 : _c.model;
|
|
96646
|
-
return {
|
|
96647
|
-
value: preferences == null ? void 0 : preferences.getProperty(request.key)
|
|
96648
|
-
};
|
|
96649
|
-
}
|
|
96650
|
-
};
|
|
96651
|
-
var createHaloService = ({ echo, signer }) => new HaloService(echo, signer);
|
|
96652
|
-
|
|
96653
|
-
// src/services/impl/party.ts
|
|
96654
|
-
var import_node_assert2 = __toESM(require_assert());
|
|
96655
|
-
var import_uuid = require("uuid");
|
|
96656
|
-
var import_async2 = require("@dxos/async");
|
|
96657
|
-
var import_codec_protobuf3 = require("@dxos/codec-protobuf");
|
|
96658
|
-
var import_credentials = __toESM(require_src5());
|
|
96659
|
-
var import_debug = require("@dxos/debug");
|
|
96660
|
-
var import_echo_db2 = __toESM(require_src14());
|
|
96661
|
-
var PartyService = class {
|
|
96662
|
-
constructor(echo) {
|
|
96663
|
-
this.echo = echo;
|
|
96664
|
-
this.inviteeInvitations = /* @__PURE__ */ new Map();
|
|
96665
|
-
}
|
|
96666
|
-
subscribeToParty(request) {
|
|
96667
|
-
const update = (next) => {
|
|
96668
|
-
try {
|
|
96669
|
-
const party2 = this.echo.getParty(request.partyKey);
|
|
96670
|
-
next({
|
|
96671
|
-
party: party2 && {
|
|
96672
|
-
publicKey: party2.key,
|
|
96673
|
-
isOpen: party2.isOpen,
|
|
96674
|
-
isActive: party2.isActive,
|
|
96675
|
-
members: party2.queryMembers().value
|
|
96676
|
-
}
|
|
96677
|
-
});
|
|
96678
|
-
} catch (error2) {
|
|
96679
|
-
if (error2 instanceof import_debug.InvalidStateError) {
|
|
96680
|
-
} else {
|
|
96681
|
-
throw error2;
|
|
96682
|
-
}
|
|
96683
|
-
}
|
|
96684
|
-
};
|
|
96685
|
-
const party = this.echo.getParty(request.partyKey);
|
|
96686
|
-
if (party) {
|
|
96687
|
-
return new import_codec_protobuf3.Stream(({ next }) => party.update.on(() => update(next)));
|
|
96688
|
-
} else {
|
|
96689
|
-
return new import_codec_protobuf3.Stream(({ next }) => {
|
|
96690
|
-
let unsubscribeParty;
|
|
96691
|
-
const unsubscribeParties = this.echo.queryParties().subscribe((parties) => {
|
|
96692
|
-
const party2 = parties.find((party3) => party3.key.equals(request.partyKey));
|
|
96693
|
-
if (party2 && !unsubscribeParty) {
|
|
96694
|
-
unsubscribeParty = party2.update.on(() => update(next));
|
|
96695
|
-
}
|
|
96696
|
-
});
|
|
96697
|
-
update(next);
|
|
96698
|
-
return () => {
|
|
96699
|
-
unsubscribeParties();
|
|
96700
|
-
unsubscribeParty == null ? void 0 : unsubscribeParty();
|
|
96701
|
-
};
|
|
96702
|
-
});
|
|
96703
|
-
}
|
|
96704
|
-
}
|
|
96705
|
-
subscribeParties() {
|
|
96706
|
-
return resultSetToStream(this.echo.queryParties(), (parties) => ({
|
|
96707
|
-
parties: parties.map((party) => ({
|
|
96708
|
-
publicKey: party.key,
|
|
96709
|
-
isOpen: party.isOpen,
|
|
96710
|
-
isActive: party.isActive,
|
|
96711
|
-
members: party.queryMembers().value
|
|
96712
|
-
}))
|
|
96713
|
-
}));
|
|
96714
|
-
}
|
|
96715
|
-
async getPartyDetails(request) {
|
|
96716
|
-
var _a;
|
|
96717
|
-
const party = (_a = this.echo.getParty(request.partyKey)) != null ? _a : (0, import_debug.raise)(new import_echo_db2.PartyNotFoundError(request.partyKey));
|
|
96718
|
-
return {
|
|
96719
|
-
processedTimeframe: party.timeframe
|
|
96720
|
-
};
|
|
96721
|
-
}
|
|
96722
|
-
async createParty() {
|
|
96723
|
-
const party = await this.echo.createParty();
|
|
96724
|
-
return {
|
|
96725
|
-
publicKey: party.key,
|
|
96726
|
-
isOpen: party.isOpen,
|
|
96727
|
-
isActive: party.isActive
|
|
96728
|
-
};
|
|
96729
|
-
}
|
|
96730
|
-
async cloneParty(snapshot) {
|
|
96731
|
-
const party = await this.echo.cloneParty(snapshot);
|
|
96732
|
-
return {
|
|
96733
|
-
publicKey: party.key,
|
|
96734
|
-
isOpen: party.isOpen,
|
|
96735
|
-
isActive: party.isActive
|
|
96736
|
-
};
|
|
96737
|
-
}
|
|
96738
|
-
async setPartyState(request) {
|
|
96739
|
-
const party = this.echo.getParty(request.partyKey);
|
|
96740
|
-
if (!party) {
|
|
96741
|
-
throw new Error("Party not found");
|
|
96742
|
-
}
|
|
96743
|
-
if (request.open === true) {
|
|
96744
|
-
await party.open();
|
|
96745
|
-
} else if (request.open === false) {
|
|
96746
|
-
await party.close();
|
|
96747
|
-
}
|
|
96748
|
-
if (request.activeGlobal === true) {
|
|
96749
|
-
await party.activate({ global: true });
|
|
96750
|
-
} else if (request.activeGlobal === false) {
|
|
96751
|
-
await party.deactivate({ global: true });
|
|
96752
|
-
}
|
|
96753
|
-
if (request.activeDevice === true) {
|
|
96754
|
-
await party.activate({ device: true });
|
|
96755
|
-
} else if (request.activeDevice === false) {
|
|
96756
|
-
await party.deactivate({ device: true });
|
|
96757
|
-
}
|
|
96758
|
-
return {
|
|
96759
|
-
publicKey: party.key,
|
|
96760
|
-
isOpen: party.isOpen,
|
|
96761
|
-
isActive: party.isActive
|
|
96762
|
-
};
|
|
96763
|
-
}
|
|
96764
|
-
createInvitation(request) {
|
|
96765
|
-
return new import_codec_protobuf3.Stream(({ next, close }) => {
|
|
96766
|
-
var _a;
|
|
96767
|
-
const party = (_a = this.echo.getParty(request.partyKey)) != null ? _a : (0, import_debug.raise)(new import_echo_db2.PartyNotFoundError(request.partyKey));
|
|
96768
|
-
setImmediate(async () => {
|
|
96769
|
-
try {
|
|
96770
|
-
let invitation;
|
|
96771
|
-
if (!request.inviteeKey) {
|
|
96772
|
-
const secret = Buffer.from((0, import_credentials.generatePasscode)());
|
|
96773
|
-
const secretProvider = async () => {
|
|
96774
|
-
next({ state: 2 /* CONNECTED */ });
|
|
96775
|
-
return Buffer.from(secret);
|
|
96776
|
-
};
|
|
96777
|
-
invitation = await party.invitationManager.createInvitation({
|
|
96778
|
-
secretProvider,
|
|
96779
|
-
secretValidator: import_credentials.defaultSecretValidator
|
|
96780
|
-
}, {
|
|
96781
|
-
onFinish: () => {
|
|
96782
|
-
next({ state: 3 /* SUCCESS */ });
|
|
96783
|
-
close();
|
|
96784
|
-
}
|
|
96785
|
-
});
|
|
96786
|
-
(0, import_node_assert2.default)(invitation.type === import_echo_db2.InvitationDescriptorType.INTERACTIVE);
|
|
96787
|
-
invitation.secret = Buffer.from(secret);
|
|
96788
|
-
} else {
|
|
96789
|
-
invitation = await party.invitationManager.createOfflineInvitation(request.inviteeKey);
|
|
96790
|
-
}
|
|
96791
|
-
next({ state: 1 /* WAITING_FOR_CONNECTION */, descriptor: invitation.toProto() });
|
|
96792
|
-
if (invitation.type === import_echo_db2.InvitationDescriptorType.OFFLINE) {
|
|
96793
|
-
close();
|
|
96794
|
-
}
|
|
96795
|
-
} catch (error2) {
|
|
96796
|
-
next({ state: 4 /* ERROR */, error: error2.message });
|
|
96797
|
-
close();
|
|
96798
|
-
}
|
|
96799
|
-
});
|
|
96800
|
-
});
|
|
96801
|
-
}
|
|
96802
|
-
acceptInvitation(request) {
|
|
96803
|
-
return new import_codec_protobuf3.Stream(({ next, close }) => {
|
|
96804
|
-
const id = (0, import_uuid.v4)();
|
|
96805
|
-
const [secretLatch, secretTrigger] = (0, import_async2.latch)();
|
|
96806
|
-
const inviteeInvitation = { secretTrigger };
|
|
96807
|
-
const secretProvider = async () => {
|
|
96808
|
-
await secretLatch;
|
|
96809
|
-
const secret = inviteeInvitation.secret;
|
|
96810
|
-
if (!secret) {
|
|
96811
|
-
throw new Error("Secret not provided.");
|
|
96812
|
-
}
|
|
96813
|
-
return Buffer.from(secret);
|
|
96814
|
-
};
|
|
96815
|
-
const partyPromise = this.echo.joinParty(import_echo_db2.InvitationDescriptor.fromProto(request), request.type === import_echo_db2.InvitationDescriptorType.INTERACTIVE ? secretProvider : void 0);
|
|
96816
|
-
this.inviteeInvitations.set(id, inviteeInvitation);
|
|
96817
|
-
next({ id, state: 2 /* CONNECTED */ });
|
|
96818
|
-
partyPromise.then((party) => {
|
|
96819
|
-
next({ id, state: 3 /* SUCCESS */, partyKey: party.key });
|
|
96820
|
-
}).catch((err) => {
|
|
96821
|
-
console.error(err);
|
|
96822
|
-
next({ id, state: 4 /* ERROR */, error: String(err) });
|
|
96823
|
-
}).finally(() => {
|
|
96824
|
-
close();
|
|
96825
|
-
});
|
|
96826
|
-
});
|
|
96827
|
-
}
|
|
96828
|
-
async authenticateInvitation(request) {
|
|
96829
|
-
var _a;
|
|
96830
|
-
(0, import_node_assert2.default)(request.processId, "Process ID is missing.");
|
|
96831
|
-
const invitation = this.inviteeInvitations.get(request.processId);
|
|
96832
|
-
(0, import_node_assert2.default)(invitation, "Invitation not found.");
|
|
96833
|
-
(0, import_node_assert2.default)(request.secret, "Secret not provided.");
|
|
96834
|
-
invitation.secret = request.secret;
|
|
96835
|
-
(_a = invitation.secretTrigger) == null ? void 0 : _a.call(invitation);
|
|
96836
|
-
}
|
|
96837
|
-
subscribeMembers(request) {
|
|
96838
|
-
const party = this.echo.getParty(request.partyKey);
|
|
96839
|
-
if (party) {
|
|
96840
|
-
return resultSetToStream(party.queryMembers(), (members) => ({ members }));
|
|
96841
|
-
} else {
|
|
96842
|
-
return new import_codec_protobuf3.Stream(({ next }) => {
|
|
96843
|
-
let unsubscribeMembers;
|
|
96844
|
-
const unsubscribeParties = this.echo.queryParties().subscribe((parties) => {
|
|
96845
|
-
const party2 = parties.find((party3) => party3.key.equals(request.partyKey));
|
|
96846
|
-
if (!unsubscribeMembers && party2) {
|
|
96847
|
-
const resultSet = party2.queryMembers();
|
|
96848
|
-
next({ members: resultSet.value });
|
|
96849
|
-
unsubscribeMembers = resultSet.update.on(() => next({ members: resultSet.value }));
|
|
96850
|
-
}
|
|
96851
|
-
});
|
|
96852
|
-
return () => {
|
|
96853
|
-
unsubscribeParties();
|
|
96854
|
-
unsubscribeMembers();
|
|
96855
|
-
};
|
|
96856
|
-
});
|
|
96857
|
-
}
|
|
96858
|
-
}
|
|
96859
|
-
async createSnapshot(request) {
|
|
96860
|
-
var _a;
|
|
96861
|
-
(0, import_node_assert2.default)(request.partyKey);
|
|
96862
|
-
const party = (_a = this.echo.getParty(request.partyKey)) != null ? _a : (0, import_debug.raise)(new import_echo_db2.PartyNotFoundError(request.partyKey));
|
|
96863
|
-
return party.createSnapshot();
|
|
96864
|
-
}
|
|
96865
|
-
};
|
|
96866
|
-
var createPartyService = ({ echo }) => new PartyService(echo);
|
|
96867
|
-
|
|
96868
|
-
// src/services/impl/profile.ts
|
|
96869
|
-
var import_node_assert3 = __toESM(require_assert());
|
|
96870
|
-
var import_uuid2 = require("uuid");
|
|
96871
|
-
var import_async3 = require("@dxos/async");
|
|
96872
|
-
var import_codec_protobuf4 = require("@dxos/codec-protobuf");
|
|
96873
|
-
var import_credentials2 = __toESM(require_src5());
|
|
96874
|
-
var import_echo_db3 = __toESM(require_src14());
|
|
96875
|
-
var ProfileService = class {
|
|
96876
|
-
constructor(echo) {
|
|
96877
|
-
this.echo = echo;
|
|
96878
|
-
this.inviteeInvitations = /* @__PURE__ */ new Map();
|
|
96879
|
-
}
|
|
96880
|
-
subscribeProfile() {
|
|
96881
|
-
return new import_codec_protobuf4.Stream(({ next }) => {
|
|
96882
|
-
const emitNext = () => next({
|
|
96883
|
-
profile: this.echo.halo.isInitialized ? this.echo.halo.getProfile() : void 0
|
|
96884
|
-
});
|
|
96885
|
-
emitNext();
|
|
96886
|
-
return this.echo.halo.subscribeToProfile(emitNext);
|
|
96887
|
-
});
|
|
96888
|
-
}
|
|
96889
|
-
async createProfile(request) {
|
|
96890
|
-
return this.echo.halo.createProfile(request);
|
|
96891
|
-
}
|
|
96892
|
-
async recoverProfile(request) {
|
|
96893
|
-
if (!request.seedPhrase) {
|
|
96894
|
-
throw new Error("Recovery SeedPhrase not provided.");
|
|
96895
|
-
}
|
|
96896
|
-
await this.echo.open();
|
|
96897
|
-
await this.echo.halo.recover(request.seedPhrase);
|
|
96898
|
-
const profile = this.echo.halo.getProfile();
|
|
96899
|
-
(0, import_node_assert3.default)(profile, "Recovering profile failed.");
|
|
96900
|
-
return profile;
|
|
96901
|
-
}
|
|
96902
|
-
createInvitation() {
|
|
96903
|
-
return new import_codec_protobuf4.Stream(({ next, close }) => {
|
|
96904
|
-
setImmediate(async () => {
|
|
96905
|
-
const secret = Buffer.from((0, import_credentials2.generatePasscode)());
|
|
96906
|
-
let invitation;
|
|
96907
|
-
const secretProvider = async () => {
|
|
96908
|
-
next({ descriptor: invitation.toProto(), state: 2 /* CONNECTED */ });
|
|
96909
|
-
return Buffer.from(secret);
|
|
96910
|
-
};
|
|
96911
|
-
invitation = await this.echo.halo.createInvitation({
|
|
96912
|
-
secretProvider,
|
|
96913
|
-
secretValidator: import_credentials2.defaultSecretValidator
|
|
96914
|
-
}, {
|
|
96915
|
-
onFinish: () => {
|
|
96916
|
-
next({ state: 3 /* SUCCESS */ });
|
|
96917
|
-
close();
|
|
96918
|
-
}
|
|
96919
|
-
});
|
|
96920
|
-
invitation.secret = secret;
|
|
96921
|
-
next({ descriptor: invitation.toProto(), state: 1 /* WAITING_FOR_CONNECTION */ });
|
|
96922
|
-
});
|
|
96923
|
-
});
|
|
96924
|
-
}
|
|
96925
|
-
acceptInvitation(request) {
|
|
96926
|
-
return new import_codec_protobuf4.Stream(({ next, close }) => {
|
|
96927
|
-
const id = (0, import_uuid2.v4)();
|
|
96928
|
-
const [secretLatch, secretTrigger] = (0, import_async3.latch)();
|
|
96929
|
-
const inviteeInvitation = { secretTrigger };
|
|
96930
|
-
const secretProvider = async () => {
|
|
96931
|
-
await secretLatch;
|
|
96932
|
-
const secret = inviteeInvitation.secret;
|
|
96933
|
-
if (!secret) {
|
|
96934
|
-
throw new Error("Secret not provided.");
|
|
96935
|
-
}
|
|
96936
|
-
return Buffer.from(secret);
|
|
96937
|
-
};
|
|
96938
|
-
const haloPartyPromise = this.echo.halo.join(import_echo_db3.InvitationDescriptor.fromProto(request), secretProvider);
|
|
96939
|
-
this.inviteeInvitations.set(id, inviteeInvitation);
|
|
96940
|
-
next({ id, state: 2 /* CONNECTED */ });
|
|
96941
|
-
haloPartyPromise.then((party) => {
|
|
96942
|
-
next({ id, state: 3 /* SUCCESS */, partyKey: party.key });
|
|
96943
|
-
}).catch((err) => {
|
|
96944
|
-
next({ id, state: 4 /* ERROR */, error: String(err) });
|
|
96945
|
-
});
|
|
96946
|
-
});
|
|
96947
|
-
}
|
|
96948
|
-
async authenticateInvitation(request) {
|
|
96949
|
-
var _a;
|
|
96950
|
-
(0, import_node_assert3.default)(request.processId, "Process ID is missing.");
|
|
96951
|
-
const invitation = this.inviteeInvitations.get(request.processId);
|
|
96952
|
-
(0, import_node_assert3.default)(invitation, "Invitation not found.");
|
|
96953
|
-
(0, import_node_assert3.default)(request.secret, "Secret not provided.");
|
|
96954
|
-
invitation.secret = request.secret;
|
|
96955
|
-
(_a = invitation.secretTrigger) == null ? void 0 : _a.call(invitation);
|
|
96956
|
-
}
|
|
96957
|
-
};
|
|
96958
|
-
var createProfileService = ({ echo }) => new ProfileService(echo);
|
|
96959
|
-
|
|
96960
|
-
// src/services/impl/system.ts
|
|
96961
|
-
var createSystemService = ({ config, echo }) => ({
|
|
96962
|
-
getConfig: async () => config.values,
|
|
96963
|
-
reset: async () => {
|
|
96964
|
-
await echo.reset();
|
|
96965
|
-
}
|
|
96966
|
-
});
|
|
96967
|
-
|
|
96968
|
-
// src/services/impl/services.ts
|
|
96969
|
-
var createServices = (opts) => ({
|
|
96970
|
-
SystemService: createSystemService(opts),
|
|
96971
|
-
ProfileService: createProfileService(opts),
|
|
96972
|
-
HaloService: createHaloService(opts),
|
|
96973
|
-
PartyService: createPartyService(opts),
|
|
96974
|
-
DataService: opts.echo.dataService,
|
|
96975
|
-
TracingService: {
|
|
96976
|
-
setTracingOptions: () => {
|
|
96977
|
-
throw new Error("Tracing not available.");
|
|
96978
|
-
},
|
|
96979
|
-
subscribeToRpcTrace: () => {
|
|
96980
|
-
throw new Error("Tracing not available.");
|
|
96981
|
-
}
|
|
96982
|
-
}
|
|
96983
|
-
});
|
|
96984
|
-
|
|
96985
|
-
// src/services/client-service.ts
|
|
96986
|
-
var import_echo_protocol = __toESM(require_src7());
|
|
96987
|
-
var import_rpc = require("@dxos/rpc");
|
|
96988
|
-
|
|
96989
|
-
// src/proto/gen/index.ts
|
|
95760
|
+
// src/packlets/proto/gen/index.ts
|
|
96990
95761
|
var gen_exports = {};
|
|
96991
95762
|
__export(gen_exports, {
|
|
96992
95763
|
schema: () => schema,
|
|
96993
95764
|
schemaJson: () => schemaJson
|
|
96994
95765
|
});
|
|
96995
|
-
var
|
|
95766
|
+
var import_codec_protobuf2 = require("@dxos/codec-protobuf");
|
|
96996
95767
|
|
|
96997
|
-
// src/proto/substitutions.ts
|
|
96998
|
-
var
|
|
96999
|
-
var
|
|
95768
|
+
// src/packlets/proto/substitutions.ts
|
|
95769
|
+
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
95770
|
+
var import_credentials = __toESM(require_src5());
|
|
97000
95771
|
var import_protocols = require("@dxos/protocols");
|
|
97001
95772
|
var substitutions_default = {
|
|
97002
|
-
...
|
|
95773
|
+
...import_codec_protobuf.timestampSubstitutions,
|
|
97003
95774
|
...import_protocols.publicKeySubstitutions,
|
|
97004
95775
|
...import_protocols.timeframeSubstitutions,
|
|
97005
|
-
...
|
|
95776
|
+
...import_codec_protobuf.anySubstitutions,
|
|
97006
95777
|
"dxos.echo.feed.CredentialsMessage": {
|
|
97007
|
-
encode: (msg) => ({ data:
|
|
97008
|
-
decode: (msg) =>
|
|
95778
|
+
encode: (msg) => ({ data: import_credentials.codec.encode(msg) }),
|
|
95779
|
+
decode: (msg) => import_credentials.codec.decode(msg.data)
|
|
97009
95780
|
},
|
|
97010
95781
|
"dxos.devtools.SubscribeToSwarmInfoResponse.SwarmInfo.ConnectionInfo.Json": {
|
|
97011
95782
|
encode: (value) => ({ data: JSON.stringify(value) }),
|
|
@@ -97013,11 +95784,82 @@ var substitutions_default = {
|
|
|
97013
95784
|
}
|
|
97014
95785
|
};
|
|
97015
95786
|
|
|
97016
|
-
// src/proto/gen/index.ts
|
|
97017
|
-
var schemaJson = JSON.parse('{"nested":{"dxos":{"nested":{"client":{"nested":{"AddKeyRecordRequest":{"fields":{"keyRecord":{"type":"KeyRecord","id":1,"comment":null}},"comment":null},"AuthenticateInvitationRequest":{"fields":{"processId":{"type":"string","id":1,"comment":"Id from corresponding RedeemedInvitation."},"secret":{"type":"bytes","id":2,"comment":null}},"comment":null},"Contact":{"oneofs":{"_displayName":{"oneof":["displayName"]}},"fields":{"publicKey":{"type":"dxos.halo.keys.PubKey","id":1,"comment":null},"displayName":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null}},"comment":null},"Contacts":{"fields":{"contacts":{"rule":"repeated","type":"Contact","id":1,"comment":null}},"comment":null},"CreateInvitationRequest":{"oneofs":{"_inviteeKey":{"oneof":["inviteeKey"]}},"fields":{"partyKey":{"rule":"required","type":"dxos.halo.keys.PubKey","id":1,"comment":null},"inviteeKey":{"type":"dxos.halo.keys.PubKey","id":2,"options":{"proto3_optional":true},"comment":"When specified the invitation will be of OFFLINE type, not requiring secret exchange."}},"comment":null},"CreateProfileRequest":{"oneofs":{"_username":{"oneof":["username"]},"_publicKey":{"oneof":["publicKey"]},"_secretKey":{"oneof":["secretKey"]}},"fields":{"username":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"publicKey":{"type":"bytes","id":2,"options":{"proto3_optional":true},"comment":null},"secretKey":{"type":"bytes","id":3,"options":{"proto3_optional":true},"comment":null}},"comment":null},"CreateSnaspotRequest":{"fields":{"partyKey":{"type":"dxos.halo.keys.PubKey","id":1,"comment":null}},"comment":null},"GetPartyDetailsRequest":{"fields":{"partyKey":{"rule":"required","type":"dxos.halo.keys.PubKey","id":1,"comment":null}},"comment":null},"GetPreferenceRequest":{"fields":{"key":{"type":"string","id":1,"comment":null}},"comment":null},"GetPreferenceResponse":{"fields":{"value":{"type":"string","id":1,"comment":null}},"comment":null},"HaloService":{"methods":{"Sign":{"requestType":"SignRequest","responseType":"SignResponse","comment":null},"AddKeyRecord":{"requestType":"AddKeyRecordRequest","responseType":"google.protobuf.Empty","comment":null},"SubscribeContacts":{"requestType":"google.protobuf.Empty","responseType":"Contacts","responseStream":true,"comment":null},"SetGlobalPreference":{"requestType":"SetPreferenceRequest","responseType":"google.protobuf.Empty","comment":null},"GetGlobalPreference":{"requestType":"GetPreferenceRequest","responseType":"GetPreferenceResponse","comment":null},"SetDevicePreference":{"requestType":"SetPreferenceRequest","responseType":"google.protobuf.Empty","comment":null},"GetDevicePreference":{"requestType":"GetPreferenceRequest","responseType":"GetPreferenceResponse","comment":null}},"comment":null},"InvitationRequest":{"oneofs":{"_descriptor":{"oneof":["descriptor"]},"_error":{"oneof":["error"]}},"fields":{"descriptor":{"type":"InvitationDescriptor","id":1,"options":{"proto3_optional":true},"comment":null},"state":{"type":"InvitationState","id":2,"comment":null},"error":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":"Only if state == ERROR."}},"comment":"Invitation process created by sender."},"InvitationState":{"values":{"WAITING_FOR_CONNECTION":1,"CONNECTED":2,"SUCCESS":3,"ERROR":4},"comment":null,"comments":{"WAITING_FOR_CONNECTION":null,"CONNECTED":null,"SUCCESS":null,"ERROR":null}},"Party":{"fields":{"publicKey":{"rule":"required","type":"dxos.halo.keys.PubKey","id":1,"comment":null},"isOpen":{"rule":"required","type":"bool","id":2,"comment":null},"isActive":{"rule":"required","type":"bool","id":3,"comment":null},"members":{"rule":"repeated","type":"Member","id":4,"comment":null}},"nested":{"Member":{"oneofs":{"_displayName":{"oneof":["displayName"]}},"fields":{"publicKey":{"rule":"required","type":"dxos.halo.keys.PubKey","id":1,"comment":null},"displayName":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null}},"comment":null}},"comment":null},"PartyActivationOptions":{"fields":{"global":{"type":"bool","id":1,"comment":null},"device":{"type":"bool","id":2,"comment":null}},"comment":null},"PartyDetails":{"fields":{"processedTimeframe":{"rule":"required","type":"dxos.echo.timeframe.TimeframeVector","id":1,"comment":"The timeframe of mutations processed by the client."}},"comment":null},"PartyService":{"methods":{"SubscribeToParty":{"requestType":"SubscribePartyRequest","responseType":"SubscribePartyResponse","responseStream":true,"comment":null},"SubscribeParties":{"requestType":"google.protobuf.Empty","responseType":"SubscribePartiesResponse","responseStream":true,"comment":null},"GetPartyDetails":{"requestType":"GetPartyDetailsRequest","responseType":"PartyDetails","comment":null},"CreateParty":{"requestType":"google.protobuf.Empty","responseType":"Party","comment":null},"CloneParty":{"requestType":"PartySnapshot","responseType":"Party","comment":null},"SetPartyState":{"requestType":"SetPartyStateRequest","responseType":"Party","comment":"Open and close or activate and deactivate a party."},"CreateInvitation":{"requestType":"CreateInvitationRequest","responseType":"InvitationRequest","responseStream":true,"comment":null},"AcceptInvitation":{"requestType":"InvitationDescriptor","responseType":"RedeemedInvitation","responseStream":true,"comment":null},"AuthenticateInvitation":{"requestType":"AuthenticateInvitationRequest","responseType":"google.protobuf.Empty","comment":null},"SubscribeMembers":{"requestType":"SubscribeMembersRequest","responseType":"SubscribeMembersResponse","responseStream":true,"comment":null},"CreateSnapshot":{"requestType":"CreateSnaspotRequest","responseType":"PartySnapshot","comment":null}},"comment":null},"Profile":{"oneofs":{"_username":{"oneof":["username"]}},"fields":{"publicKey":{"rule":"required","type":"dxos.halo.keys.PubKey","id":1,"comment":null},"username":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null}},"comment":null},"ProfileService":{"methods":{"SubscribeProfile":{"requestType":"google.protobuf.Empty","responseType":"SubscribeProfileResponse","responseStream":true,"comment":null},"CreateProfile":{"requestType":"CreateProfileRequest","responseType":"Profile","comment":null},"RecoverProfile":{"requestType":"RecoverProfileRequest","responseType":"Profile","comment":null},"CreateInvitation":{"requestType":"google.protobuf.Empty","responseType":"InvitationRequest","responseStream":true,"comment":null},"AcceptInvitation":{"requestType":"InvitationDescriptor","responseType":"RedeemedInvitation","responseStream":true,"comment":null},"AuthenticateInvitation":{"requestType":"AuthenticateInvitationRequest","responseType":"google.protobuf.Empty","comment":null}},"comment":null},"RecoverProfileRequest":{"fields":{"seedPhrase":{"type":"string","id":1,"comment":null}},"comment":null},"RedeemedInvitation":{"oneofs":{"_error":{"oneof":["error"]},"_partyKey":{"oneof":["partyKey"]}},"fields":{"id":{"type":"string","id":1,"comment":null},"state":{"type":"InvitationState","id":2,"comment":null},"error":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":"Only if state == ERROR."},"partyKey":{"type":"dxos.halo.keys.PubKey","id":4,"options":{"proto3_optional":true},"comment":"Only on party invitations that are finished."}},"comment":"Invitation that is being redeemed."},"SetPartyStateRequest":{"oneofs":{"_open":{"oneof":["open"]},"_activeGlobal":{"oneof":["activeGlobal"]},"_activeDevice":{"oneof":["activeDevice"]}},"fields":{"partyKey":{"rule":"required","type":"dxos.halo.keys.PubKey","id":1,"comment":null},"open":{"type":"bool","id":2,"options":{"proto3_optional":true},"comment":null},"activeGlobal":{"type":"bool","id":3,"options":{"proto3_optional":true},"comment":null},"activeDevice":{"type":"bool","id":4,"options":{"proto3_optional":true},"comment":null}},"comment":null},"SetPreferenceRequest":{"fields":{"key":{"type":"string","id":1,"comment":null},"value":{"type":"string","id":2,"comment":null}},"comment":null},"SignRequest":{"fields":{"publicKey":{"type":"PubKey","id":1,"comment":"- The public key of the key that is supposed to be used for signing."},"payload":{"type":"bytes","id":2,"comment":null}},"comment":null},"SignResponse":{"fields":{"signed":{"type":"bytes","id":2,"comment":null}},"comment":null},"SubscribeMembersRequest":{"fields":{"partyKey":{"rule":"required","type":"dxos.halo.keys.PubKey","id":1,"comment":null}},"comment":null},"SubscribeMembersResponse":{"fields":{"members":{"rule":"repeated","type":"PartyMember","id":1,"comment":null}},"nested":{"PartyMember":{"oneofs":{"_displayName":{"oneof":["displayName"]}},"fields":{"publicKey":{"rule":"required","type":"dxos.halo.keys.PubKey","id":1,"comment":null},"displayName":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null}},"comment":null}},"comment":null},"SubscribePartiesResponse":{"fields":{"parties":{"rule":"repeated","type":"Party","id":1,"comment":null}},"comment":null},"SubscribePartyRequest":{"fields":{"partyKey":{"rule":"required","type":"dxos.halo.keys.PubKey","id":1,"comment":null}},"comment":null},"SubscribePartyResponse":{"oneofs":{"_party":{"oneof":["party"]}},"fields":{"party":{"type":"Party","id":1,"options":{"proto3_optional":true},"comment":null}},"comment":null},"SubscribeProfileResponse":{"oneofs":{"_profile":{"oneof":["profile"]}},"fields":{"profile":{"type":"Profile","id":1,"options":{"proto3_optional":true},"comment":null}},"comment":null},"SystemService":{"methods":{"GetConfig":{"requestType":"google.protobuf.Empty","responseType":"Config","comment":null},"Reset":{"requestType":"google.protobuf.Empty","responseType":"google.protobuf.Empty","comment":null}},"comment":null}}},"config":{"nested":{"Config":{"oneofs":{"_version":{"oneof":["version"]},"_package":{"oneof":["package"]},"_runtime":{"oneof":["runtime"]}},"fields":{"version":{"type":"int32","id":1,"options":{"proto3_optional":true},"comment":null},"package":{"type":"Package","id":2,"options":{"proto3_optional":true},"comment":null},"runtime":{"type":"Runtime","id":3,"options":{"proto3_optional":true},"comment":null}},"comment":null},"Module":{"oneofs":{"_name":{"oneof":["name"]},"_type":{"oneof":["type"]},"_displayName":{"oneof":["displayName"]},"_description":{"oneof":["description"]},"_build":{"oneof":["build"]},"_record":{"oneof":["record"]}},"fields":{"name":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"type":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"displayName":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null},"description":{"type":"string","id":4,"options":{"proto3_optional":true},"comment":null},"tags":{"rule":"repeated","type":"string","id":5,"comment":null},"build":{"type":"Build","id":100,"options":{"proto3_optional":true},"comment":null},"repos":{"rule":"repeated","type":"Repo","id":101,"comment":null},"record":{"type":"google.protobuf.Any","id":200,"options":{"proto3_optional":true},"comment":"The data will be validated based on the type when being published."}},"nested":{"Build":{"oneofs":{"_command":{"oneof":["command"]},"_outdir":{"oneof":["outdir"]},"_version":{"oneof":["version"]},"_tag":{"oneof":["tag"]}},"fields":{"command":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"outdir":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"version":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null},"tag":{"type":"string","id":4,"options":{"proto3_optional":true},"comment":null}},"comment":null}},"comment":null},"Package":{"oneofs":{"_license":{"oneof":["license"]}},"fields":{"license":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"repos":{"rule":"repeated","type":"Repo","id":2,"comment":null},"modules":{"rule":"repeated","type":"Module","id":3,"comment":null}},"comment":null},"Repo":{"oneofs":{"_name":{"oneof":["name"]},"_url":{"oneof":["url"]},"_version":{"oneof":["version"]}},"fields":{"name":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"url":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"version":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null}},"comment":null},"Runtime":{"oneofs":{"_client":{"oneof":["client"]},"_app":{"oneof":["app"]},"_cli":{"oneof":["cli"]},"_props":{"oneof":["props"]},"_services":{"oneof":["services"]},"_system":{"oneof":["system"]}},"fields":{"client":{"type":"Client","id":1,"options":{"proto3_optional":true},"comment":null},"app":{"type":"App","id":2,"options":{"proto3_optional":true},"comment":null},"cli":{"type":"CLI","id":3,"options":{"proto3_optional":true},"comment":null},"props":{"type":"Props","id":4,"options":{"proto3_optional":true},"comment":null},"services":{"type":"Services","id":5,"options":{"proto3_optional":true},"comment":null},"system":{"type":"System","id":6,"options":{"proto3_optional":true},"comment":null}},"nested":{"App":{"oneofs":{"_org":{"oneof":["org"]},"_theme":{"oneof":["theme"]},"_website":{"oneof":["website"]},"_publicUrl":{"oneof":["publicUrl"]}},"fields":{"org":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"theme":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"website":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null},"publicUrl":{"type":"string","id":4,"options":{"(env)":"PUBLIC_URL","proto3_optional":true},"comment":null}},"comment":null},"CLI":{"oneofs":{"_nodePath":{"oneof":["nodePath"]},"_app":{"oneof":["app"]},"_console":{"oneof":["console"]},"_mdns":{"oneof":["mdns"]},"_signal":{"oneof":["signal"]},"_npmClient":{"oneof":["npmClient"]},"_channel":{"oneof":["channel"]}},"fields":{"nodePath":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"app":{"type":"AppServe","id":2,"options":{"proto3_optional":true},"comment":null},"console":{"type":"Package","id":3,"options":{"proto3_optional":true},"comment":null},"mdns":{"type":"Package","id":4,"options":{"proto3_optional":true},"comment":null},"signal":{"type":"Package","id":5,"options":{"proto3_optional":true},"comment":null},"npmClient":{"type":"string","id":6,"options":{"proto3_optional":true},"comment":null},"channel":{"type":"string","id":7,"options":{"proto3_optional":true},"comment":null}},"nested":{"AppServe":{"oneofs":{"_serve":{"oneof":["serve"]}},"fields":{"serve":{"type":"Serve","id":1,"options":{"proto3_optional":true},"comment":null}},"nested":{"Serve":{"oneofs":{"_config":{"oneof":["config"]},"_loginApp":{"oneof":["loginApp"]},"_keyPhrase":{"oneof":["keyPhrase"]}},"fields":{"config":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"loginApp":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"keyPhrase":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null}},"comment":null}},"comment":null},"Package":{"oneofs":{"_package":{"oneof":["package"]},"_channel":{"oneof":["channel"]},"_bin":{"oneof":["bin"]},"_config":{"oneof":["config"]}},"fields":{"package":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"channel":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"bin":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null},"config":{"type":"string","id":4,"options":{"proto3_optional":true},"comment":null}},"comment":null}},"comment":null},"Client":{"oneofs":{"_debug":{"oneof":["debug"]},"_storage":{"oneof":["storage"]},"_enableSnapshots":{"oneof":["enableSnapshots"]},"_snapshotInterval":{"oneof":["snapshotInterval"]},"_invitationExpiration":{"oneof":["invitationExpiration"]},"_mode":{"oneof":["mode"]}},"fields":{"debug":{"type":"string","id":1,"options":{"(env)":"DEBUG","proto3_optional":true},"comment":null},"storage":{"type":"Storage","id":2,"options":{"proto3_optional":true},"comment":null},"enableSnapshots":{"type":"bool","id":3,"options":{"proto3_optional":true},"comment":null},"snapshotInterval":{"type":"int32","id":4,"options":{"proto3_optional":true},"comment":"Milliseconds"},"invitationExpiration":{"type":"int32","id":5,"options":{"proto3_optional":true},"comment":"Milliseconds"},"mode":{"type":"Mode","id":6,"options":{"proto3_optional":true},"comment":null}},"nested":{"Mode":{"values":{"AUTOMATIC":0,"LOCAL":1,"REMOTE":2},"comment":"Whether the client services are local with ClientServiceHost or remote and need to be accessed via ClientServiceProxy. Defaults to AUTOMATIC.","comments":{"AUTOMATIC":"Connects to the browser wallet if avialable, otherwise runs services in the local mode.","LOCAL":"Run services in the local mode.","REMOTE":"Connect to the browser wallet or to the remote services through the RPC port."}},"Storage":{"oneofs":{"_persistent":{"oneof":["persistent"]},"_storageType":{"oneof":["storageType"]},"_keyStorage":{"oneof":["keyStorage"]},"_path":{"oneof":["path"]}},"fields":{"persistent":{"type":"bool","id":1,"options":{"proto3_optional":true},"comment":null},"storageType":{"type":"StorageDriver","id":2,"options":{"proto3_optional":true},"comment":null},"keyStorage":{"type":"StorageDriver","id":3,"options":{"proto3_optional":true},"comment":null},"path":{"type":"string","id":4,"options":{"proto3_optional":true},"comment":null}},"nested":{"StorageDriver":{"values":{"RAM":0,"IDB":1,"CHROME":2,"FIREFOX":3,"NODE":4,"LEVELJS":11,"JSONDOWN":12},"comment":null,"comments":{"RAM":null,"IDB":null,"CHROME":null,"FIREFOX":null,"NODE":null,"LEVELJS":null,"JSONDOWN":null}}},"comment":null}},"comment":null},"Props":{"oneofs":{"_title":{"oneof":["title"]}},"fields":{"title":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null}},"comment":null},"Services":{"oneofs":{"_kube":{"oneof":["kube"]},"_app":{"oneof":["app"]},"_dxns":{"oneof":["dxns"]},"_ipfs":{"oneof":["ipfs"]},"_signal":{"oneof":["signal"]},"_machine":{"oneof":["machine"]},"_bot":{"oneof":["bot"]}},"fields":{"kube":{"type":"Kube","id":1,"options":{"proto3_optional":true},"comment":null},"app":{"type":"AppServer","id":2,"options":{"proto3_optional":true},"comment":null},"dxns":{"type":"Dxns","id":3,"options":{"proto3_optional":true},"comment":null},"ipfs":{"type":"Ipfs","id":4,"options":{"proto3_optional":true},"comment":null},"signal":{"type":"Signal","id":5,"options":{"proto3_optional":true},"comment":null},"ice":{"rule":"repeated","type":"Ice","id":6,"comment":null},"machine":{"type":"Machine","id":7,"options":{"proto3_optional":true},"comment":null},"bot":{"type":"BotFactory","id":8,"options":{"proto3_optional":true},"comment":null}},"nested":{"AppServer":{"oneofs":{"_prefix":{"oneof":["prefix"]},"_server":{"oneof":["server"]}},"fields":{"prefix":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"server":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null}},"comment":null},"BotFactory":{"oneofs":{"_topic":{"oneof":["topic"]},"_persistent":{"oneof":["persistent"]},"_retryAttempts":{"oneof":["retryAttempts"]},"_retryInterval":{"oneof":["retryInterval"]}},"fields":{"topic":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"persistent":{"type":"bool","id":2,"options":{"proto3_optional":true},"comment":null},"retryAttempts":{"type":"int32","id":3,"options":{"proto3_optional":true},"comment":null},"retryInterval":{"type":"int32","id":4,"options":{"proto3_optional":true},"comment":null}},"comment":null},"Dxns":{"oneofs":{"_server":{"oneof":["server"]},"_accountUri":{"oneof":["accountUri"]},"_address":{"oneof":["address"]},"_account":{"oneof":["account"]},"_faucet":{"oneof":["faucet"]}},"fields":{"server":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":"DXNS endpoint."},"accountUri":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":"Substrate account URI. This is a secret.\\nKUBEs do not serve this with the config but we store it in profile.yml.\\n\\nTODO(dmaretskyi): Deprecate this and move it to keyring."},"address":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":"Public Polkadot Address."},"account":{"type":"string","id":4,"options":{"proto3_optional":true},"comment":"Public address of a DXNS Account."},"faucet":{"type":"string","id":5,"options":{"proto3_optional":true},"comment":null}},"comment":null},"Ice":{"oneofs":{"_urls":{"oneof":["urls"]},"_username":{"oneof":["username"]},"_credential":{"oneof":["credential"]}},"fields":{"urls":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"username":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"credential":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null}},"comment":null},"Ipfs":{"oneofs":{"_server":{"oneof":["server"]},"_gateway":{"oneof":["gateway"]}},"fields":{"server":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"gateway":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null}},"comment":null},"Kube":{"oneofs":{"_endpoints":{"oneof":["endpoints"]},"_publicUrl":{"oneof":["publicUrl"]}},"fields":{"endpoints":{"type":"Endpoints","id":1,"options":{"proto3_optional":true},"comment":null},"publicUrl":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null}},"nested":{"Endpoints":{"oneofs":{"_logs":{"oneof":["logs"]},"_services":{"oneof":["services"]},"_cert":{"oneof":["cert"]}},"fields":{"logs":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"services":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"cert":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null}},"comment":null}},"comment":null},"Machine":{"oneofs":{"_doAccessToken":{"oneof":["doAccessToken"]},"_githubAccessToken":{"oneof":["githubAccessToken"]},"_githubUsername":{"oneof":["githubUsername"]},"_dnsDomain":{"oneof":["dnsDomain"]},"_npmAccessToken":{"oneof":["npmAccessToken"]}},"fields":{"doAccessToken":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"githubAccessToken":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"githubUsername":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null},"dnsDomain":{"type":"string","id":4,"options":{"proto3_optional":true},"comment":null},"npmAccessToken":{"type":"string","id":5,"options":{"proto3_optional":true},"comment":null}},"comment":null},"Signal":{"oneofs":{"_server":{"oneof":["server"]},"_api":{"oneof":["api"]},"_status":{"oneof":["status"]}},"fields":{"server":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"api":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"status":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null}},"comment":null}},"comment":null},"System":{"oneofs":{"_debug":{"oneof":["debug"]}},"fields":{"debug":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null}},"comment":null}},"comment":null}}},"credentials":{"nested":{"Message":{"fields":{"payload":{"rule":"required","type":"google.protobuf.Any","id":1,"comment":null}},"comment":null},"SignedMessage":{"fields":{"signed":{"rule":"required","type":"Signed","id":1,"comment":"The signed message contents."},"signatures":{"rule":"repeated","type":"Signature","id":2,"comment":"An array of Signatures, one for each key that signed the message."}},"nested":{"Signature":{"oneofs":{"_keyChain":{"oneof":["keyChain"]}},"fields":{"key":{"rule":"required","type":"PubKey","id":1,"comment":"The publicKey of the keypair that made this signature."},"signature":{"rule":"required","type":"bytes","id":2,"comment":"The bytes of the signature."},"keyChain":{"type":"KeyChain","id":3,"options":{"proto3_optional":true},"comment":"The certification chain of SignedMessages for this key."}},"comment":null},"Signed":{"fields":{"created":{"rule":"required","type":"string","id":1,"comment":"RFC-3339 datetime string."},"nonce":{"rule":"required","type":"bytes","id":2,"comment":null},"payload":{"rule":"required","type":"google.protobuf.Any","id":10,"comment":"The payload to be signed."}},"comment":null}},"comment":"A generic container message used whenever messages are signed (e.g. PartyCredential)"}}},"devtools":{"nested":{"ClearSnapshotsRequest":{"fields":{},"comment":null},"DevtoolsHost":{"methods":{"Events":{"requestType":"google.protobuf.Empty","responseType":"Event","responseStream":true,"comment":null},"GetConfig":{"requestType":"google.protobuf.Empty","responseType":"GetConfigResponse","comment":null},"ResetStorage":{"requestType":"ResetStorageRequest","responseType":"google.protobuf.Empty","comment":null},"EnableDebugLogging":{"requestType":"EnableDebugLoggingRequest","responseType":"EnableDebugLoggingResponse","comment":null},"DisableDebugLogging":{"requestType":"EnableDebugLoggingRequest","responseType":"EnableDebugLoggingResponse","comment":null},"SubscribeToKeyringKeys":{"requestType":"SubscribeToKeyringKeysRequest","responseType":"SubscribeToKeyringKeysResponse","responseStream":true,"comment":null},"SubscribeToCredentialMessages":{"requestType":"SubscribeToCredentialMessagesRequest","responseType":"SubscribeToCredentialMessagesResponse","responseStream":true,"comment":null},"SubscribeToParties":{"requestType":"SubscribeToPartiesRequest","responseType":"SubscribeToPartiesResponse","responseStream":true,"comment":null},"SubscribeToItems":{"requestType":"SubscribeToItemsRequest","responseType":"SubscribeToItemsResponse","responseStream":true,"comment":null},"SubscribeToFeeds":{"requestType":"SubscribeToFeedsRequest","responseType":"SubscribeToFeedsResponse","responseStream":true,"comment":null},"SubscribeToFeedBlocks":{"requestType":"SubscribeToFeedBlocksRequest","responseType":"SubscribeToFeedBlocksResponse","responseStream":true,"comment":null},"GetPartySnapshot":{"requestType":"GetPartySnapshotRequest","responseType":"GetPartySnapshotResponse","comment":null},"SavePartySnapshot":{"requestType":"SavePartySnapshotRequest","responseType":"SavePartySnapshotResponse","comment":null},"ClearSnapshots":{"requestType":"ClearSnapshotsRequest","responseType":"google.protobuf.Empty","comment":null},"GetNetworkPeers":{"requestType":"GetNetworkPeersRequest","responseType":"GetNetworkPeersResponse","comment":null},"SubscribeToNetworkTopics":{"requestType":"google.protobuf.Empty","responseType":"SubscribeToNetworkTopicsResponse","responseStream":true,"comment":null},"SubscribeToSignalStatus":{"requestType":"google.protobuf.Empty","responseType":"SubscribeToSignalStatusResponse","responseStream":true,"comment":null},"SubscribeToSignalTrace":{"requestType":"google.protobuf.Empty","responseType":"SubscribeToSignalTraceResponse","responseStream":true,"comment":null},"SubscribeToSwarmInfo":{"requestType":"SubscribeToSwarmInfoRequest","responseType":"SubscribeToSwarmInfoResponse","responseStream":true,"comment":null}},"comment":null},"DisableDebugLoggingRequest":{"oneofs":{"_namespaces":{"oneof":["namespaces"]}},"fields":{"namespaces":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null}},"comment":null},"DisableDebugLoggingResponse":{"oneofs":{"_enabledNamespaces":{"oneof":["enabledNamespaces"]}},"fields":{"enabledNamespaces":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null}},"comment":null},"EnableDebugLoggingRequest":{"oneofs":{"_namespaces":{"oneof":["namespaces"]}},"fields":{"namespaces":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null}},"comment":null},"EnableDebugLoggingResponse":{"oneofs":{"_enabledNamespaces":{"oneof":["enabledNamespaces"]}},"fields":{"enabledNamespaces":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null}},"comment":null},"Event":{"oneofs":{"payload":{"oneof":["ready"],"comment":null}},"fields":{"ready":{"type":"ReadyEvent","id":1,"comment":null}},"comment":null},"GetConfigResponse":{"fields":{"config":{"type":"string","id":1,"comment":null}},"comment":null},"GetNetworkPeersRequest":{"fields":{"topic":{"type":"bytes","id":1,"comment":null}},"comment":null},"GetNetworkPeersResponse":{"fields":{"peers":{"rule":"repeated","type":"PeerInfo","id":1,"comment":null}},"nested":{"PeerInfo":{"fields":{"id":{"type":"PubKey","id":1,"comment":null},"state":{"type":"string","id":2,"comment":null},"connections":{"rule":"repeated","type":"bytes","id":3,"comment":null}},"comment":null}},"comment":null},"GetPartySnapshotRequest":{"fields":{"partyKey":{"rule":"required","type":"PubKey","id":1,"comment":null}},"comment":null},"GetPartySnapshotResponse":{"oneofs":{"_snapshot":{"oneof":["snapshot"]}},"fields":{"snapshot":{"type":"PartySnapshot","id":1,"options":{"proto3_optional":true},"comment":null}},"comment":null},"ReadyEvent":{"fields":{},"comment":null},"ResetStorageRequest":{"fields":{},"comment":null},"SavePartySnapshotRequest":{"fields":{"partyKey":{"rule":"required","type":"PubKey","id":1,"comment":null}},"comment":null},"SavePartySnapshotResponse":{"oneofs":{"_snapshot":{"oneof":["snapshot"]}},"fields":{"snapshot":{"type":"PartySnapshot","id":1,"options":{"proto3_optional":true},"comment":null}},"comment":null},"SetTracingOptionsRequest":{"fields":{"enable":{"type":"bool","id":1,"comment":null}},"comment":null},"SubscribeToCredentialMessagesRequest":{"oneofs":{"_partyKey":{"oneof":["partyKey"]}},"fields":{"partyKey":{"type":"PubKey","id":1,"options":{"proto3_optional":true},"comment":null}},"comment":null},"SubscribeToCredentialMessagesResponse":{"fields":{"messages":{"rule":"repeated","type":"SignedMessage","id":1,"comment":null}},"comment":null},"SubscribeToFeedBlocksRequest":{"oneofs":{"_partyKey":{"oneof":["partyKey"]},"_feedKey":{"oneof":["feedKey"]},"_maxBlocks":{"oneof":["maxBlocks"]}},"fields":{"partyKey":{"type":"PubKey","id":1,"options":{"proto3_optional":true},"comment":null},"feedKey":{"type":"PubKey","id":2,"options":{"proto3_optional":true},"comment":null},"maxBlocks":{"type":"int32","id":3,"options":{"proto3_optional":true},"comment":null}},"comment":null},"SubscribeToFeedBlocksResponse":{"fields":{"blocks":{"rule":"repeated","type":"Block","id":1,"comment":null}},"nested":{"Block":{"fields":{"key":{"type":"bytes","id":1,"comment":null},"seq":{"type":"int32","id":2,"comment":null},"sync":{"type":"bool","id":3,"comment":null},"path":{"type":"string","id":4,"comment":null},"data":{"type":"FeedMessage","id":5,"comment":null}},"comment":null}},"comment":null},"SubscribeToFeedsRequest":{"fields":{"partyKey":{"type":"PubKey","id":1,"comment":null},"feedKeys":{"rule":"repeated","type":"PubKey","id":2,"comment":null}},"comment":null},"SubscribeToFeedsResponse":{"fields":{"feeds":{"rule":"repeated","type":"Feed","id":1,"comment":null}},"nested":{"Feed":{"fields":{"feedKey":{"type":"PubKey","id":1,"comment":null},"length":{"type":"int32","id":2,"comment":null}},"comment":null}},"comment":null},"SubscribeToItemsRequest":{"fields":{},"comment":null},"SubscribeToItemsResponse":{"fields":{"data":{"type":"string","id":1,"comment":null}},"comment":null},"SubscribeToKeyringKeysRequest":{"fields":{},"comment":null},"SubscribeToKeyringKeysResponse":{"fields":{"keys":{"rule":"repeated","type":"KeyRecord","id":1,"comment":null}},"comment":null},"SubscribeToNetworkTopicsResponse":{"fields":{"topics":{"rule":"repeated","type":"Topic","id":1,"comment":null}},"nested":{"Topic":{"oneofs":{"_label":{"oneof":["label"]}},"fields":{"topic":{"type":"PubKey","id":1,"comment":null},"label":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null}},"comment":null}},"comment":null},"SubscribeToPartiesRequest":{"fields":{"partyKeys":{"rule":"repeated","type":"PubKey","id":1,"comment":null}},"comment":null},"SubscribeToPartiesResponse":{"fields":{"parties":{"rule":"repeated","type":"PartyInfo","id":1,"comment":null}},"nested":{"PartyInfo":{"fields":{"key":{"type":"PubKey","id":1,"comment":null},"isOpen":{"type":"bool","id":2,"comment":null},"isActive":{"type":"bool","id":3,"comment":null},"timeframe":{"type":"TimeframeVector","id":4,"comment":null},"feeds":{"rule":"repeated","type":"PubKey","id":5,"comment":null},"properties":{"keyType":"string","type":"string","id":6,"comment":null}},"comment":null}},"comment":null},"SubscribeToSignalStatusResponse":{"fields":{"servers":{"rule":"repeated","type":"SignalServer","id":1,"comment":null}},"nested":{"SignalServer":{"oneofs":{"_error":{"oneof":["error"]}},"fields":{"host":{"type":"string","id":1,"comment":null},"state":{"type":"string","id":2,"comment":null},"error":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null},"reconnectIn":{"type":"int32","id":4,"comment":null},"connectionStarted":{"type":"int32","id":5,"comment":null},"lastStateChange":{"type":"int32","id":6,"comment":null}},"comment":null}},"comment":null},"SubscribeToSignalTraceResponse":{"fields":{"events":{"rule":"repeated","type":"string","id":1,"comment":null}},"comment":null},"SubscribeToSwarmInfoRequest":{"fields":{},"comment":null},"SubscribeToSwarmInfoResponse":{"fields":{"data":{"rule":"repeated","type":"SwarmInfo","id":1,"comment":null}},"nested":{"SwarmInfo":{"oneofs":{"_label":{"oneof":["label"]}},"fields":{"id":{"type":"PubKey","id":1,"comment":null},"topic":{"type":"PubKey","id":2,"comment":null},"label":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null},"isActive":{"type":"bool","id":4,"comment":null},"connections":{"rule":"repeated","type":"ConnectionInfo","id":5,"comment":null}},"nested":{"ConnectionInfo":{"oneofs":{"_transport":{"oneof":["transport"]}},"fields":{"state":{"type":"string","id":1,"comment":null},"sessionId":{"type":"PubKey","id":2,"comment":null},"remotePeerId":{"type":"PubKey","id":3,"comment":null},"transport":{"type":"string","id":4,"options":{"proto3_optional":true},"comment":null},"protocolExtensions":{"rule":"repeated","type":"string","id":5,"comment":null},"events":{"rule":"repeated","type":"Json","id":6,"comment":null}},"nested":{"Json":{"oneofs":{"_data":{"oneof":["data"]}},"fields":{"data":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null}},"comment":null}},"comment":null}},"comment":null}},"comment":null},"TracingService":{"methods":{"SetTracingOptions":{"requestType":"SetTracingOptionsRequest","responseType":"google.protobuf.Empty","comment":null},"SubscribeToRpcTrace":{"requestType":"google.protobuf.Empty","responseType":"RpcMessage","responseStream":true,"comment":null}},"comment":null}}},"echo":{"nested":{"feed":{"nested":{"CredentialsMessage":{"fields":{"data":{"type":"bytes","id":1,"comment":null}},"comment":"A container for dxos.credentials.Message"},"EchoEnvelope":{"oneofs":{"_genesis":{"oneof":["genesis"]},"_itemMutation":{"oneof":["itemMutation"]},"_mutation":{"oneof":["mutation"]},"_snapshot":{"oneof":["snapshot"]}},"fields":{"itemId":{"type":"string","id":1,"comment":null},"genesis":{"type":"ItemGenesis","id":10,"options":{"proto3_optional":true},"comment":null},"itemMutation":{"type":"ItemMutation","id":11,"options":{"proto3_optional":true},"comment":null},"mutation":{"type":"bytes","id":12,"options":{"proto3_optional":true},"comment":null},"snapshot":{"type":"ModelSnapshot","id":13,"options":{"proto3_optional":true},"comment":"Set the model to the provided snapshot."}},"comment":"Wrapper for all ECHO messages."},"FeedMessage":{"oneofs":{"payload":{"oneof":["halo","echo"],"comment":null}},"fields":{"timeframe":{"type":"TimeframeVector","id":1,"comment":null},"halo":{"type":"CredentialsMessage","id":10,"comment":null},"echo":{"type":"EchoEnvelope","id":11,"comment":null}},"comment":"Outer message type decoded by Codec.\\nThis is what is written to the feeds."},"ItemGenesis":{"oneofs":{"_itemType":{"oneof":["itemType"]},"_modelVersion":{"oneof":["modelVersion"]},"_link":{"oneof":["link"]}},"fields":{"itemType":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"modelType":{"type":"string","id":2,"comment":null},"modelVersion":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null},"link":{"type":"LinkData","id":4,"options":{"proto3_optional":true},"comment":null}},"comment":null},"ItemMutation":{"oneofs":{"_parentId":{"oneof":["parentId"]},"_action":{"oneof":["action"]}},"fields":{"parentId":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"action":{"type":"Action","id":2,"options":{"proto3_optional":true},"comment":null}},"nested":{"Action":{"values":{"NOOP":0,"DELETE":1,"RESTORE":2},"comment":null,"comments":{"NOOP":null,"DELETE":null,"RESTORE":null}}},"comment":"Item mutation."},"LinkData":{"fields":{"source":{"type":"string","id":1,"comment":null},"target":{"type":"string","id":2,"comment":null}},"comment":null}}},"invitation":{"nested":{"InvitationDescriptor":{"oneofs":{"_identityKey":{"oneof":["identityKey"]},"_secret":{"oneof":["secret"]}},"fields":{"type":{"type":"Type","id":1,"comment":null},"swarmKey":{"type":"bytes","id":2,"comment":null},"invitation":{"type":"bytes","id":3,"comment":null},"identityKey":{"type":"bytes","id":4,"options":{"proto3_optional":true},"comment":"Only present if type == OFFLINE."},"secret":{"type":"bytes","id":5,"options":{"proto3_optional":true},"comment":"Must be stripped out when passing to another peer."}},"nested":{"Type":{"values":{"INTERACTIVE":1,"OFFLINE":2},"comment":"Defines an invitation type.","comments":{"INTERACTIVE":"Interactive invitation is when both peers are online at the same time.","OFFLINE":"Offline is when only a single peer needs to be online at the time."}}},"comment":null}}},"service":{"nested":{"DataService":{"methods":{"SubscribeEntitySet":{"requestType":"SubscribeEntitySetRequest","responseType":"SubscribeEntitySetResponse","responseStream":true,"comment":null},"SubscribeEntityStream":{"requestType":"SubscribeEntityStreamRequest","responseType":"SubscribeEntityStreamResponse","responseStream":true,"comment":null},"Write":{"requestType":"WriteRequest","responseType":"MutationReceipt","comment":null}},"comment":null},"MutationReceipt":{"fields":{"feedKey":{"type":"PubKey","id":1,"comment":null},"seq":{"type":"int32","id":2,"comment":null}},"comment":null},"SubscribeEntitySetRequest":{"fields":{"partyKey":{"type":"PubKey","id":1,"comment":null}},"comment":null},"SubscribeEntitySetResponse":{"fields":{"added":{"rule":"repeated","type":"EchoEnvelope","id":1,"comment":null},"deleted":{"rule":"repeated","type":"EchoEnvelope","id":2,"comment":null}},"comment":null},"SubscribeEntityStreamRequest":{"fields":{"partyKey":{"type":"PubKey","id":1,"comment":null},"itemId":{"type":"string","id":2,"comment":null}},"comment":null},"SubscribeEntityStreamResponse":{"oneofs":{"kind":{"oneof":["snapshot","mutation"],"comment":null}},"fields":{"snapshot":{"type":"ItemSnapshot","id":1,"comment":null},"mutation":{"type":"Mutation","id":2,"comment":null}},"nested":{"Mutation":{"fields":{"data":{"type":"EchoEnvelope","id":1,"comment":null},"meta":{"type":"Metadata","id":2,"comment":null}},"nested":{"Metadata":{"fields":{"feedKey":{"type":"PubKey","id":1,"comment":null},"memberKey":{"type":"PubKey","id":2,"comment":null},"seq":{"type":"int32","id":3,"comment":null},"timeframe":{"type":"TimeframeVector","id":4,"comment":null}},"comment":null}},"comment":null}},"comment":null},"WriteRequest":{"fields":{"partyKey":{"type":"PubKey","id":1,"comment":null},"mutation":{"type":"EchoEnvelope","id":2,"comment":null}},"comment":null}}},"snapshot":{"nested":{"DatabaseSnapshot":{"fields":{"items":{"rule":"repeated","type":"ItemSnapshot","id":1,"comment":null},"links":{"rule":"repeated","type":"LinkSnapshot","id":2,"comment":null}},"comment":null},"HaloStateSnapshot":{"fields":{"messages":{"rule":"repeated","type":"dxos.CredentialsMessage","id":1,"comment":null}},"comment":null},"ItemSnapshot":{"oneofs":{"_itemId":{"oneof":["itemId"]},"_itemType":{"oneof":["itemType"]},"_modelVersion":{"oneof":["modelVersion"]},"_parentId":{"oneof":["parentId"]},"_model":{"oneof":["model"]}},"fields":{"itemId":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"itemType":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"modelType":{"type":"string","id":3,"comment":null},"modelVersion":{"type":"string","id":4,"options":{"proto3_optional":true},"comment":null},"parentId":{"type":"string","id":5,"options":{"proto3_optional":true},"comment":null},"model":{"type":"ModelSnapshot","id":6,"options":{"proto3_optional":true},"comment":null}},"comment":null},"LinkSnapshot":{"oneofs":{"_linkId":{"oneof":["linkId"]},"_linkType":{"oneof":["linkType"]},"_modelVersion":{"oneof":["modelVersion"]},"_model":{"oneof":["model"]}},"fields":{"linkId":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"linkType":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"modelType":{"type":"string","id":3,"comment":null},"modelVersion":{"type":"string","id":4,"options":{"proto3_optional":true},"comment":null},"source":{"rule":"required","type":"string","id":5,"comment":null},"target":{"rule":"required","type":"string","id":6,"comment":null},"model":{"type":"ModelSnapshot","id":7,"options":{"proto3_optional":true},"comment":null}},"comment":null},"ModelMutation":{"fields":{"mutation":{"rule":"required","type":"bytes","id":1,"comment":null},"meta":{"rule":"required","type":"ModelMutationMeta","id":2,"comment":null}},"comment":null},"ModelMutationMeta":{"fields":{"feedKey":{"rule":"required","type":"dxos.halo.keys.PubKey","id":1,"comment":null},"seq":{"rule":"required","type":"int32","id":2,"comment":null},"memberKey":{"rule":"required","type":"dxos.halo.keys.PubKey","id":3,"comment":null}},"comment":null},"ModelSnapshot":{"oneofs":{"_snapshot":{"oneof":["snapshot"]}},"fields":{"snapshot":{"type":"bytes","id":1,"options":{"proto3_optional":true},"comment":"Encoded model snapshot (defined by the model\'s codec).\\nIf undefined the state machine will be initialized with it\'s default state."},"mutations":{"rule":"repeated","type":"ModelMutation","id":2,"comment":"Mutations to be applied on top of the snapshot, or on top of initial state if the snapshot is undefined."}},"comment":null},"PartySnapshot":{"oneofs":{"_timeframe":{"oneof":["timeframe"]},"_timestamp":{"oneof":["timestamp"]}},"fields":{"partyKey":{"type":"bytes","id":1,"comment":null},"timeframe":{"type":"TimeframeVector","id":2,"options":{"proto3_optional":true},"comment":null},"timestamp":{"type":"int32","id":3,"options":{"proto3_optional":true},"comment":null},"halo":{"type":"HaloStateSnapshot","id":11,"comment":null},"database":{"type":"DatabaseSnapshot","id":12,"comment":null}},"comment":null}}},"timeframe":{"nested":{"TimeframeVector":{"fields":{"frames":{"rule":"repeated","type":"Frame","id":1,"comment":null}},"nested":{"Frame":{"fields":{"feedKey":{"type":"bytes","id":1,"comment":null},"seq":{"type":"int32","id":3,"comment":null}},"comment":null}},"comment":"Vector timestamp used to order messages."}}}}},"halo":{"nested":{"keys":{"nested":{"KeyChain":{"fields":{"publicKey":{"rule":"required","type":"PubKey","id":1,"comment":null},"message":{"rule":"required","type":"SignedMessage","id":2,"comment":null},"parents":{"rule":"repeated","type":"KeyChain","id":3,"comment":null}},"comment":null},"KeyRecord":{"oneofs":{"_secretKey":{"oneof":["secretKey"]},"_hint":{"oneof":["hint"]},"_own":{"oneof":["own"]},"_trusted":{"oneof":["trusted"]},"_added":{"oneof":["added"]},"_created":{"oneof":["created"]}},"fields":{"type":{"rule":"required","type":"KeyType","id":1,"comment":"The `KeyType` type of the key. This is often unknown for keys from other sources."},"publicKey":{"rule":"required","type":"PubKey","id":2,"comment":"The public key as a Buffer (required)."},"secretKey":{"type":"PrivKey","id":3,"options":{"proto3_optional":true},"comment":"The secret key as a Buffer (this will never be visible outside the Keyring)."},"hint":{"type":"bool","id":4,"options":{"proto3_optional":true},"comment":"Is this key from a Greeting \\"hint\\"?"},"own":{"type":"bool","id":5,"options":{"proto3_optional":true},"comment":"Determines if this is our key?\\nUsually true if `secretKey` is present; may be false for \\"inception keys\\" such as the Party key."},"trusted":{"type":"bool","id":6,"options":{"proto3_optional":true},"comment":"Is this key to be trusted?"},"added":{"type":"string","id":7,"options":{"proto3_optional":true},"comment":"An RFC-3339 date/time string for when the key was added to the Keyring."},"created":{"type":"string","id":8,"options":{"proto3_optional":true},"comment":"An RFC-3339 date/time string for when the key was created."}},"comment":null},"KeyRecordList":{"fields":{"keys":{"rule":"repeated","type":"KeyRecord","id":1,"comment":null}},"comment":null},"KeyType":{"values":{"UNKNOWN":0,"IDENTITY":1,"DEVICE":2,"PARTY":3,"FEED":4,"DXNS_ADDRESS":5},"comment":null,"comments":{"UNKNOWN":null,"IDENTITY":null,"DEVICE":null,"PARTY":null,"FEED":null,"DXNS_ADDRESS":null}},"PrivKey":{"fields":{"data":{"type":"bytes","id":1,"comment":null}},"comment":null},"PubKey":{"fields":{"data":{"type":"bytes","id":1,"comment":null}},"comment":null}}}}},"rpc":{"nested":{"Error":{"oneofs":{"_name":{"oneof":["name"]},"_message":{"oneof":["message"]},"_stack":{"oneof":["stack"]}},"fields":{"name":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"message":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"stack":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null}},"comment":null},"MessageTrace":{"fields":{"direction":{"type":"Direction","id":1,"comment":null},"data":{"type":"bytes","id":2,"comment":null}},"nested":{"Direction":{"values":{"INCOMING":0,"OUTGOING":1},"comment":null,"comments":{"INCOMING":null,"OUTGOING":null}}},"comment":null},"Request":{"fields":{"id":{"type":"int32","id":1,"comment":null},"method":{"type":"string","id":2,"comment":null},"payload":{"type":"google.protobuf.Any","id":3,"comment":null},"stream":{"type":"bool","id":4,"comment":null}},"comment":null},"Response":{"oneofs":{"content":{"oneof":["payload","error","close"],"comment":null}},"fields":{"id":{"type":"int32","id":1,"comment":null},"payload":{"type":"google.protobuf.Any","id":2,"comment":null},"error":{"type":"Error","id":3,"comment":null},"close":{"type":"bool","id":4,"comment":null}},"comment":null},"RpcMessage":{"oneofs":{"content":{"oneof":["request","response","open","openAck","streamClose"],"comment":null}},"fields":{"request":{"type":"Request","id":1,"comment":null},"response":{"type":"Response","id":2,"comment":null},"open":{"type":"bool","id":3,"comment":"Means that the node is trying to open the connection."},"openAck":{"type":"bool","id":4,"comment":"Means that the node has received the \\"open\\" message and is ready to perform requests."},"streamClose":{"type":"StreamClose","id":5,"comment":null}},"comment":null},"StreamClose":{"fields":{"id":{"type":"int32","id":1,"comment":null}},"comment":null}}}}},"google":{"nested":{"protobuf":{"nested":{"Any":{"fields":{"type_url":{"type":"string","id":1},"value":{"type":"bytes","id":2}},"comment":null},"DescriptorProto":{"fields":{"name":{"type":"string","id":1},"field":{"rule":"repeated","type":"FieldDescriptorProto","id":2},"extension":{"rule":"repeated","type":"FieldDescriptorProto","id":6},"nestedType":{"rule":"repeated","type":"DescriptorProto","id":3},"enumType":{"rule":"repeated","type":"EnumDescriptorProto","id":4},"extensionRange":{"rule":"repeated","type":"ExtensionRange","id":5},"oneofDecl":{"rule":"repeated","type":"OneofDescriptorProto","id":8},"options":{"type":"MessageOptions","id":7},"reservedRange":{"rule":"repeated","type":"ReservedRange","id":9},"reservedName":{"rule":"repeated","type":"string","id":10}},"nested":{"ExtensionRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2}},"comment":null},"ReservedRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2}},"comment":null}},"comment":null},"Empty":{"fields":{},"comment":null},"EnumDescriptorProto":{"fields":{"name":{"type":"string","id":1},"value":{"rule":"repeated","type":"EnumValueDescriptorProto","id":2},"options":{"type":"EnumOptions","id":3}},"comment":null},"EnumOptions":{"fields":{"allowAlias":{"type":"bool","id":2},"deprecated":{"type":"bool","id":3},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"comment":null},"EnumValueDescriptorProto":{"fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":2},"options":{"type":"EnumValueOptions","id":3}},"comment":null},"EnumValueOptions":{"fields":{"deprecated":{"type":"bool","id":1},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"comment":null},"FieldDescriptorProto":{"fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":3},"label":{"type":"Label","id":4},"type":{"type":"Type","id":5},"typeName":{"type":"string","id":6},"extendee":{"type":"string","id":2},"defaultValue":{"type":"string","id":7},"oneofIndex":{"type":"int32","id":9},"jsonName":{"type":"string","id":10},"options":{"type":"FieldOptions","id":8}},"nested":{"Label":{"values":{"LABEL_OPTIONAL":1,"LABEL_REQUIRED":2,"LABEL_REPEATED":3},"comments":{}},"Type":{"values":{"TYPE_DOUBLE":1,"TYPE_FLOAT":2,"TYPE_INT64":3,"TYPE_UINT64":4,"TYPE_INT32":5,"TYPE_FIXED64":6,"TYPE_FIXED32":7,"TYPE_BOOL":8,"TYPE_STRING":9,"TYPE_GROUP":10,"TYPE_MESSAGE":11,"TYPE_BYTES":12,"TYPE_UINT32":13,"TYPE_ENUM":14,"TYPE_SFIXED32":15,"TYPE_SFIXED64":16,"TYPE_SINT32":17,"TYPE_SINT64":18},"comments":{}}},"comment":null},"FieldOptions":{"fields":{"ctype":{"type":"CType","id":1,"options":{"default":"STRING"}},"packed":{"type":"bool","id":2},"jstype":{"type":"JSType","id":6,"options":{"default":"JS_NORMAL"}},"lazy":{"type":"bool","id":5},"deprecated":{"type":"bool","id":3},"weak":{"type":"bool","id":10},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[4,4]],"nested":{"CType":{"values":{"STRING":0,"CORD":1,"STRING_PIECE":2},"comments":{}},"JSType":{"values":{"JS_NORMAL":0,"JS_STRING":1,"JS_NUMBER":2},"comments":{}}},"comment":null},"FileDescriptorProto":{"fields":{"name":{"type":"string","id":1},"package":{"type":"string","id":2},"dependency":{"rule":"repeated","type":"string","id":3},"publicDependency":{"rule":"repeated","type":"int32","id":10,"options":{"packed":false}},"weakDependency":{"rule":"repeated","type":"int32","id":11,"options":{"packed":false}},"messageType":{"rule":"repeated","type":"DescriptorProto","id":4},"enumType":{"rule":"repeated","type":"EnumDescriptorProto","id":5},"service":{"rule":"repeated","type":"ServiceDescriptorProto","id":6},"extension":{"rule":"repeated","type":"FieldDescriptorProto","id":7},"options":{"type":"FileOptions","id":8},"sourceCodeInfo":{"type":"SourceCodeInfo","id":9},"syntax":{"type":"string","id":12}},"comment":null},"FileDescriptorSet":{"fields":{"file":{"rule":"repeated","type":"FileDescriptorProto","id":1}},"comment":null},"FileOptions":{"fields":{"javaPackage":{"type":"string","id":1},"javaOuterClassname":{"type":"string","id":8},"javaMultipleFiles":{"type":"bool","id":10},"javaGenerateEqualsAndHash":{"type":"bool","id":20,"options":{"deprecated":true}},"javaStringCheckUtf8":{"type":"bool","id":27},"optimizeFor":{"type":"OptimizeMode","id":9,"options":{"default":"SPEED"}},"goPackage":{"type":"string","id":11},"ccGenericServices":{"type":"bool","id":16},"javaGenericServices":{"type":"bool","id":17},"pyGenericServices":{"type":"bool","id":18},"deprecated":{"type":"bool","id":23},"ccEnableArenas":{"type":"bool","id":31},"objcClassPrefix":{"type":"string","id":36},"csharpNamespace":{"type":"string","id":37},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[38,38]],"nested":{"OptimizeMode":{"values":{"SPEED":1,"CODE_SIZE":2,"LITE_RUNTIME":3},"comments":{}}},"comment":null},"GeneratedCodeInfo":{"fields":{"annotation":{"rule":"repeated","type":"Annotation","id":1}},"nested":{"Annotation":{"fields":{"path":{"rule":"repeated","type":"int32","id":1},"sourceFile":{"type":"string","id":2},"begin":{"type":"int32","id":3},"end":{"type":"int32","id":4}},"comment":null}},"comment":null},"MessageOptions":{"fields":{"messageSetWireFormat":{"type":"bool","id":1},"noStandardDescriptorAccessor":{"type":"bool","id":2},"deprecated":{"type":"bool","id":3},"mapEntry":{"type":"bool","id":7},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[8,8]],"comment":null},"MethodDescriptorProto":{"fields":{"name":{"type":"string","id":1},"inputType":{"type":"string","id":2},"outputType":{"type":"string","id":3},"options":{"type":"MethodOptions","id":4},"clientStreaming":{"type":"bool","id":5},"serverStreaming":{"type":"bool","id":6}},"comment":null},"MethodOptions":{"fields":{"deprecated":{"type":"bool","id":33},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"comment":null},"OneofDescriptorProto":{"fields":{"name":{"type":"string","id":1},"options":{"type":"OneofOptions","id":2}},"comment":null},"OneofOptions":{"fields":{"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"comment":null},"ServiceDescriptorProto":{"fields":{"name":{"type":"string","id":1},"method":{"rule":"repeated","type":"MethodDescriptorProto","id":2},"options":{"type":"ServiceOptions","id":3}},"comment":null},"ServiceOptions":{"fields":{"deprecated":{"type":"bool","id":33},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"comment":null},"SourceCodeInfo":{"fields":{"location":{"rule":"repeated","type":"Location","id":1}},"nested":{"Location":{"fields":{"path":{"rule":"repeated","type":"int32","id":1},"span":{"rule":"repeated","type":"int32","id":2},"leadingComments":{"type":"string","id":3},"trailingComments":{"type":"string","id":4},"leadingDetachedComments":{"rule":"repeated","type":"string","id":6}},"comment":null}},"comment":null},"Timestamp":{"fields":{"seconds":{"type":"int64","id":1},"nanos":{"type":"int32","id":2}},"comment":null},"UninterpretedOption":{"fields":{"name":{"rule":"repeated","type":"NamePart","id":2},"identifierValue":{"type":"string","id":3},"positiveIntValue":{"type":"uint64","id":4},"negativeIntValue":{"type":"int64","id":5},"doubleValue":{"type":"double","id":6},"stringValue":{"type":"bytes","id":7},"aggregateValue":{"type":"string","id":8}},"nested":{"NamePart":{"fields":{"namePart":{"rule":"required","type":"string","id":1},"isExtension":{"rule":"required","type":"bool","id":2}},"comment":null}},"comment":null}}}}}}}');
|
|
97018
|
-
var schema =
|
|
95787
|
+
// src/packlets/proto/gen/index.ts
|
|
95788
|
+
var schemaJson = JSON.parse('{"nested":{"dxos":{"nested":{"client":{"nested":{"AddKeyRecordRequest":{"fields":{"keyRecord":{"type":"KeyRecord","id":1,"comment":null}},"comment":null},"AuthenticateInvitationRequest":{"fields":{"processId":{"type":"string","id":1,"comment":"Id from corresponding RedeemedInvitation."},"secret":{"type":"bytes","id":2,"comment":null}},"comment":null},"Contact":{"oneofs":{"_displayName":{"oneof":["displayName"]}},"fields":{"publicKey":{"type":"dxos.halo.keys.PubKey","id":1,"comment":null},"displayName":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null}},"comment":null},"Contacts":{"fields":{"contacts":{"rule":"repeated","type":"Contact","id":1,"comment":null}},"comment":null},"CreateInvitationRequest":{"oneofs":{"_inviteeKey":{"oneof":["inviteeKey"]}},"fields":{"partyKey":{"rule":"required","type":"dxos.halo.keys.PubKey","id":1,"comment":null},"inviteeKey":{"type":"dxos.halo.keys.PubKey","id":2,"options":{"proto3_optional":true},"comment":"When specified the invitation will be of OFFLINE type, not requiring secret exchange."}},"comment":null},"CreateProfileRequest":{"oneofs":{"_username":{"oneof":["username"]},"_publicKey":{"oneof":["publicKey"]},"_secretKey":{"oneof":["secretKey"]}},"fields":{"username":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"publicKey":{"type":"bytes","id":2,"options":{"proto3_optional":true},"comment":null},"secretKey":{"type":"bytes","id":3,"options":{"proto3_optional":true},"comment":null}},"comment":null},"CreateSnaspotRequest":{"fields":{"partyKey":{"type":"dxos.halo.keys.PubKey","id":1,"comment":null}},"comment":null},"GetPartyDetailsRequest":{"fields":{"partyKey":{"rule":"required","type":"dxos.halo.keys.PubKey","id":1,"comment":null}},"comment":null},"GetPreferenceRequest":{"fields":{"key":{"type":"string","id":1,"comment":null}},"comment":null},"GetPreferenceResponse":{"fields":{"value":{"type":"string","id":1,"comment":null}},"comment":null},"HaloService":{"methods":{"Sign":{"requestType":"SignRequest","responseType":"SignResponse","comment":null},"AddKeyRecord":{"requestType":"AddKeyRecordRequest","responseType":"google.protobuf.Empty","comment":null},"SubscribeContacts":{"requestType":"google.protobuf.Empty","responseType":"Contacts","responseStream":true,"comment":null},"SetGlobalPreference":{"requestType":"SetPreferenceRequest","responseType":"google.protobuf.Empty","comment":null},"GetGlobalPreference":{"requestType":"GetPreferenceRequest","responseType":"GetPreferenceResponse","comment":null},"SetDevicePreference":{"requestType":"SetPreferenceRequest","responseType":"google.protobuf.Empty","comment":null},"GetDevicePreference":{"requestType":"GetPreferenceRequest","responseType":"GetPreferenceResponse","comment":null}},"comment":null},"InvitationRequest":{"oneofs":{"_descriptor":{"oneof":["descriptor"]},"_error":{"oneof":["error"]}},"fields":{"descriptor":{"type":"InvitationDescriptor","id":1,"options":{"proto3_optional":true},"comment":null},"state":{"type":"InvitationState","id":2,"comment":null},"error":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":"Only if state == ERROR."}},"comment":"Invitation process created by sender."},"InvitationState":{"values":{"WAITING_FOR_CONNECTION":1,"CONNECTED":2,"SUCCESS":3,"ERROR":4},"comment":null,"comments":{"WAITING_FOR_CONNECTION":null,"CONNECTED":null,"SUCCESS":null,"ERROR":null}},"Party":{"fields":{"publicKey":{"rule":"required","type":"dxos.halo.keys.PubKey","id":1,"comment":null},"isOpen":{"rule":"required","type":"bool","id":2,"comment":null},"isActive":{"rule":"required","type":"bool","id":3,"comment":null},"members":{"rule":"repeated","type":"Member","id":4,"comment":null}},"nested":{"Member":{"oneofs":{"_displayName":{"oneof":["displayName"]}},"fields":{"publicKey":{"rule":"required","type":"dxos.halo.keys.PubKey","id":1,"comment":null},"displayName":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null}},"comment":null}},"comment":null},"PartyActivationOptions":{"fields":{"global":{"type":"bool","id":1,"comment":null},"device":{"type":"bool","id":2,"comment":null}},"comment":null},"PartyDetails":{"fields":{"processedTimeframe":{"rule":"required","type":"dxos.echo.timeframe.TimeframeVector","id":1,"comment":"The timeframe of mutations processed by the client."}},"comment":null},"PartyService":{"methods":{"SubscribeToParty":{"requestType":"SubscribePartyRequest","responseType":"SubscribePartyResponse","responseStream":true,"comment":null},"SubscribeParties":{"requestType":"google.protobuf.Empty","responseType":"SubscribePartiesResponse","responseStream":true,"comment":null},"GetPartyDetails":{"requestType":"GetPartyDetailsRequest","responseType":"PartyDetails","comment":null},"CreateParty":{"requestType":"google.protobuf.Empty","responseType":"Party","comment":null},"CloneParty":{"requestType":"PartySnapshot","responseType":"Party","comment":null},"SetPartyState":{"requestType":"SetPartyStateRequest","responseType":"Party","comment":"Open and close or activate and deactivate a party."},"CreateInvitation":{"requestType":"CreateInvitationRequest","responseType":"InvitationRequest","responseStream":true,"comment":null},"AcceptInvitation":{"requestType":"InvitationDescriptor","responseType":"RedeemedInvitation","responseStream":true,"comment":null},"AuthenticateInvitation":{"requestType":"AuthenticateInvitationRequest","responseType":"google.protobuf.Empty","comment":null},"SubscribeMembers":{"requestType":"SubscribeMembersRequest","responseType":"SubscribeMembersResponse","responseStream":true,"comment":null},"CreateSnapshot":{"requestType":"CreateSnaspotRequest","responseType":"PartySnapshot","comment":null}},"comment":null},"Profile":{"oneofs":{"_username":{"oneof":["username"]}},"fields":{"publicKey":{"rule":"required","type":"dxos.halo.keys.PubKey","id":1,"comment":null},"username":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null}},"comment":null},"ProfileService":{"methods":{"SubscribeProfile":{"requestType":"google.protobuf.Empty","responseType":"SubscribeProfileResponse","responseStream":true,"comment":null},"CreateProfile":{"requestType":"CreateProfileRequest","responseType":"Profile","comment":null},"RecoverProfile":{"requestType":"RecoverProfileRequest","responseType":"Profile","comment":null},"CreateInvitation":{"requestType":"google.protobuf.Empty","responseType":"InvitationRequest","responseStream":true,"comment":null},"AcceptInvitation":{"requestType":"InvitationDescriptor","responseType":"RedeemedInvitation","responseStream":true,"comment":null},"AuthenticateInvitation":{"requestType":"AuthenticateInvitationRequest","responseType":"google.protobuf.Empty","comment":null}},"comment":null},"RecoverProfileRequest":{"fields":{"seedPhrase":{"type":"string","id":1,"comment":null}},"comment":null},"RedeemedInvitation":{"oneofs":{"_error":{"oneof":["error"]},"_partyKey":{"oneof":["partyKey"]}},"fields":{"id":{"type":"string","id":1,"comment":null},"state":{"type":"InvitationState","id":2,"comment":null},"error":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":"Only if state == ERROR."},"partyKey":{"type":"dxos.halo.keys.PubKey","id":4,"options":{"proto3_optional":true},"comment":"Only on party invitations that are finished."}},"comment":"Invitation that is being redeemed."},"SetPartyStateRequest":{"oneofs":{"_open":{"oneof":["open"]},"_activeGlobal":{"oneof":["activeGlobal"]},"_activeDevice":{"oneof":["activeDevice"]}},"fields":{"partyKey":{"rule":"required","type":"dxos.halo.keys.PubKey","id":1,"comment":null},"open":{"type":"bool","id":2,"options":{"proto3_optional":true},"comment":null},"activeGlobal":{"type":"bool","id":3,"options":{"proto3_optional":true},"comment":null},"activeDevice":{"type":"bool","id":4,"options":{"proto3_optional":true},"comment":null}},"comment":null},"SetPreferenceRequest":{"fields":{"key":{"type":"string","id":1,"comment":null},"value":{"type":"string","id":2,"comment":null}},"comment":null},"SignRequest":{"fields":{"publicKey":{"type":"PubKey","id":1,"comment":"- The public key of the key that is supposed to be used for signing."},"payload":{"type":"bytes","id":2,"comment":null}},"comment":null},"SignResponse":{"fields":{"signed":{"type":"bytes","id":2,"comment":null}},"comment":null},"SubscribeMembersRequest":{"fields":{"partyKey":{"rule":"required","type":"dxos.halo.keys.PubKey","id":1,"comment":null}},"comment":null},"SubscribeMembersResponse":{"fields":{"members":{"rule":"repeated","type":"PartyMember","id":1,"comment":null}},"nested":{"PartyMember":{"oneofs":{"_displayName":{"oneof":["displayName"]}},"fields":{"publicKey":{"rule":"required","type":"dxos.halo.keys.PubKey","id":1,"comment":null},"displayName":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null}},"comment":null}},"comment":null},"SubscribePartiesResponse":{"fields":{"parties":{"rule":"repeated","type":"Party","id":1,"comment":null}},"comment":null},"SubscribePartyRequest":{"fields":{"partyKey":{"rule":"required","type":"dxos.halo.keys.PubKey","id":1,"comment":null}},"comment":null},"SubscribePartyResponse":{"oneofs":{"_party":{"oneof":["party"]}},"fields":{"party":{"type":"Party","id":1,"options":{"proto3_optional":true},"comment":null}},"comment":null},"SubscribeProfileResponse":{"oneofs":{"_profile":{"oneof":["profile"]}},"fields":{"profile":{"type":"Profile","id":1,"options":{"proto3_optional":true},"comment":null}},"comment":null},"SystemService":{"methods":{"GetConfig":{"requestType":"google.protobuf.Empty","responseType":"Config","comment":null},"Reset":{"requestType":"google.protobuf.Empty","responseType":"google.protobuf.Empty","comment":null}},"comment":null}}},"config":{"nested":{"Config":{"oneofs":{"_version":{"oneof":["version"]},"_package":{"oneof":["package"]},"_runtime":{"oneof":["runtime"]}},"fields":{"version":{"type":"int32","id":1,"options":{"proto3_optional":true},"comment":null},"package":{"type":"Package","id":2,"options":{"proto3_optional":true},"comment":null},"runtime":{"type":"Runtime","id":3,"options":{"proto3_optional":true},"comment":null}},"comment":null},"Module":{"oneofs":{"_name":{"oneof":["name"]},"_type":{"oneof":["type"]},"_displayName":{"oneof":["displayName"]},"_description":{"oneof":["description"]},"_build":{"oneof":["build"]},"_record":{"oneof":["record"]}},"fields":{"name":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"type":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"displayName":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null},"description":{"type":"string","id":4,"options":{"proto3_optional":true},"comment":null},"tags":{"rule":"repeated","type":"string","id":5,"comment":null},"build":{"type":"Build","id":100,"options":{"proto3_optional":true},"comment":null},"repos":{"rule":"repeated","type":"Repo","id":101,"comment":null},"record":{"type":"google.protobuf.Any","id":200,"options":{"proto3_optional":true},"comment":"The data will be validated based on the type when being published."}},"nested":{"Build":{"oneofs":{"_command":{"oneof":["command"]},"_outdir":{"oneof":["outdir"]},"_version":{"oneof":["version"]},"_tag":{"oneof":["tag"]}},"fields":{"command":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"outdir":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"version":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null},"tag":{"type":"string","id":4,"options":{"proto3_optional":true},"comment":null}},"comment":null}},"comment":null},"Package":{"oneofs":{"_license":{"oneof":["license"]}},"fields":{"license":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"repos":{"rule":"repeated","type":"Repo","id":2,"comment":null},"modules":{"rule":"repeated","type":"Module","id":3,"comment":null}},"comment":null},"Repo":{"oneofs":{"_name":{"oneof":["name"]},"_url":{"oneof":["url"]},"_version":{"oneof":["version"]}},"fields":{"name":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"url":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"version":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null}},"comment":null},"Runtime":{"oneofs":{"_client":{"oneof":["client"]},"_app":{"oneof":["app"]},"_cli":{"oneof":["cli"]},"_props":{"oneof":["props"]},"_services":{"oneof":["services"]},"_system":{"oneof":["system"]}},"fields":{"client":{"type":"Client","id":1,"options":{"proto3_optional":true},"comment":null},"app":{"type":"App","id":2,"options":{"proto3_optional":true},"comment":null},"cli":{"type":"CLI","id":3,"options":{"proto3_optional":true},"comment":null},"props":{"type":"Props","id":4,"options":{"proto3_optional":true},"comment":null},"services":{"type":"Services","id":5,"options":{"proto3_optional":true},"comment":null},"system":{"type":"System","id":6,"options":{"proto3_optional":true},"comment":null}},"nested":{"App":{"oneofs":{"_org":{"oneof":["org"]},"_theme":{"oneof":["theme"]},"_website":{"oneof":["website"]},"_publicUrl":{"oneof":["publicUrl"]}},"fields":{"org":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"theme":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"website":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null},"publicUrl":{"type":"string","id":4,"options":{"(env)":"PUBLIC_URL","proto3_optional":true},"comment":null}},"comment":null},"CLI":{"oneofs":{"_nodePath":{"oneof":["nodePath"]},"_app":{"oneof":["app"]},"_console":{"oneof":["console"]},"_mdns":{"oneof":["mdns"]},"_signal":{"oneof":["signal"]},"_npmClient":{"oneof":["npmClient"]},"_channel":{"oneof":["channel"]}},"fields":{"nodePath":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"app":{"type":"AppServe","id":2,"options":{"proto3_optional":true},"comment":null},"console":{"type":"Package","id":3,"options":{"proto3_optional":true},"comment":null},"mdns":{"type":"Package","id":4,"options":{"proto3_optional":true},"comment":null},"signal":{"type":"Package","id":5,"options":{"proto3_optional":true},"comment":null},"npmClient":{"type":"string","id":6,"options":{"proto3_optional":true},"comment":null},"channel":{"type":"string","id":7,"options":{"proto3_optional":true},"comment":null}},"nested":{"AppServe":{"oneofs":{"_serve":{"oneof":["serve"]}},"fields":{"serve":{"type":"Serve","id":1,"options":{"proto3_optional":true},"comment":null}},"nested":{"Serve":{"oneofs":{"_config":{"oneof":["config"]},"_loginApp":{"oneof":["loginApp"]},"_keyPhrase":{"oneof":["keyPhrase"]}},"fields":{"config":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"loginApp":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"keyPhrase":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null}},"comment":null}},"comment":null},"Package":{"oneofs":{"_package":{"oneof":["package"]},"_channel":{"oneof":["channel"]},"_bin":{"oneof":["bin"]},"_config":{"oneof":["config"]}},"fields":{"package":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"channel":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"bin":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null},"config":{"type":"string","id":4,"options":{"proto3_optional":true},"comment":null}},"comment":null}},"comment":null},"Client":{"oneofs":{"_debug":{"oneof":["debug"]},"_storage":{"oneof":["storage"]},"_enableSnapshots":{"oneof":["enableSnapshots"]},"_snapshotInterval":{"oneof":["snapshotInterval"]},"_invitationExpiration":{"oneof":["invitationExpiration"]},"_mode":{"oneof":["mode"]}},"fields":{"debug":{"type":"string","id":1,"options":{"(env)":"DEBUG","proto3_optional":true},"comment":null},"storage":{"type":"Storage","id":2,"options":{"proto3_optional":true},"comment":null},"enableSnapshots":{"type":"bool","id":3,"options":{"proto3_optional":true},"comment":null},"snapshotInterval":{"type":"int32","id":4,"options":{"proto3_optional":true},"comment":"Milliseconds"},"invitationExpiration":{"type":"int32","id":5,"options":{"proto3_optional":true},"comment":"Milliseconds"},"mode":{"type":"Mode","id":6,"options":{"proto3_optional":true},"comment":null}},"nested":{"Mode":{"values":{"AUTOMATIC":0,"LOCAL":1,"REMOTE":2},"comment":"Whether the client services are local with ClientServiceHost or remote and need to be accessed via ClientServiceProxy. Defaults to AUTOMATIC.","comments":{"AUTOMATIC":"Connects to the browser wallet if avialable, otherwise runs services in the local mode.","LOCAL":"Run services in the local mode.","REMOTE":"Connect to the browser wallet or to the remote services through the RPC port."}},"Storage":{"oneofs":{"_persistent":{"oneof":["persistent"]},"_storageType":{"oneof":["storageType"]},"_keyStorage":{"oneof":["keyStorage"]},"_path":{"oneof":["path"]}},"fields":{"persistent":{"type":"bool","id":1,"options":{"proto3_optional":true},"comment":null},"storageType":{"type":"StorageDriver","id":2,"options":{"proto3_optional":true},"comment":null},"keyStorage":{"type":"StorageDriver","id":3,"options":{"proto3_optional":true},"comment":null},"path":{"type":"string","id":4,"options":{"proto3_optional":true},"comment":null}},"nested":{"StorageDriver":{"values":{"RAM":0,"IDB":1,"CHROME":2,"FIREFOX":3,"NODE":4,"LEVELJS":11,"JSONDOWN":12},"comment":null,"comments":{"RAM":null,"IDB":null,"CHROME":null,"FIREFOX":null,"NODE":null,"LEVELJS":null,"JSONDOWN":null}}},"comment":null}},"comment":null},"Props":{"oneofs":{"_title":{"oneof":["title"]}},"fields":{"title":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null}},"comment":null},"Services":{"oneofs":{"_kube":{"oneof":["kube"]},"_app":{"oneof":["app"]},"_dxns":{"oneof":["dxns"]},"_ipfs":{"oneof":["ipfs"]},"_signal":{"oneof":["signal"]},"_machine":{"oneof":["machine"]},"_bot":{"oneof":["bot"]}},"fields":{"kube":{"type":"Kube","id":1,"options":{"proto3_optional":true},"comment":null},"app":{"type":"AppServer","id":2,"options":{"proto3_optional":true},"comment":null},"dxns":{"type":"Dxns","id":3,"options":{"proto3_optional":true},"comment":null},"ipfs":{"type":"Ipfs","id":4,"options":{"proto3_optional":true},"comment":null},"signal":{"type":"Signal","id":5,"options":{"proto3_optional":true},"comment":null},"ice":{"rule":"repeated","type":"Ice","id":6,"comment":null},"machine":{"type":"Machine","id":7,"options":{"proto3_optional":true},"comment":null},"bot":{"type":"BotFactory","id":8,"options":{"proto3_optional":true},"comment":null}},"nested":{"AppServer":{"oneofs":{"_prefix":{"oneof":["prefix"]},"_server":{"oneof":["server"]}},"fields":{"prefix":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"server":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null}},"comment":null},"BotFactory":{"oneofs":{"_topic":{"oneof":["topic"]},"_persistent":{"oneof":["persistent"]},"_retryAttempts":{"oneof":["retryAttempts"]},"_retryInterval":{"oneof":["retryInterval"]}},"fields":{"topic":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"persistent":{"type":"bool","id":2,"options":{"proto3_optional":true},"comment":null},"retryAttempts":{"type":"int32","id":3,"options":{"proto3_optional":true},"comment":null},"retryInterval":{"type":"int32","id":4,"options":{"proto3_optional":true},"comment":null}},"comment":null},"Dxns":{"oneofs":{"_server":{"oneof":["server"]},"_accountUri":{"oneof":["accountUri"]},"_address":{"oneof":["address"]},"_account":{"oneof":["account"]},"_faucet":{"oneof":["faucet"]}},"fields":{"server":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":"DXNS endpoint."},"accountUri":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":"Substrate account URI. This is a secret.\\nKUBEs do not serve this with the config but we store it in profile.yml.\\n\\nTODO(dmaretskyi): Deprecate this and move it to keyring."},"address":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":"Public Polkadot Address."},"account":{"type":"string","id":4,"options":{"proto3_optional":true},"comment":"Public address of a DXNS Account."},"faucet":{"type":"string","id":5,"options":{"proto3_optional":true},"comment":null}},"comment":null},"Ice":{"oneofs":{"_urls":{"oneof":["urls"]},"_username":{"oneof":["username"]},"_credential":{"oneof":["credential"]}},"fields":{"urls":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"username":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"credential":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null}},"comment":null},"Ipfs":{"oneofs":{"_server":{"oneof":["server"]},"_gateway":{"oneof":["gateway"]}},"fields":{"server":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"gateway":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null}},"comment":null},"Kube":{"oneofs":{"_endpoints":{"oneof":["endpoints"]},"_publicUrl":{"oneof":["publicUrl"]}},"fields":{"endpoints":{"type":"Endpoints","id":1,"options":{"proto3_optional":true},"comment":null},"publicUrl":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null}},"nested":{"Endpoints":{"oneofs":{"_logs":{"oneof":["logs"]},"_services":{"oneof":["services"]},"_cert":{"oneof":["cert"]}},"fields":{"logs":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"services":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"cert":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null}},"comment":null}},"comment":null},"Machine":{"oneofs":{"_doAccessToken":{"oneof":["doAccessToken"]},"_githubAccessToken":{"oneof":["githubAccessToken"]},"_githubUsername":{"oneof":["githubUsername"]},"_dnsDomain":{"oneof":["dnsDomain"]},"_npmAccessToken":{"oneof":["npmAccessToken"]}},"fields":{"doAccessToken":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"githubAccessToken":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"githubUsername":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null},"dnsDomain":{"type":"string","id":4,"options":{"proto3_optional":true},"comment":null},"npmAccessToken":{"type":"string","id":5,"options":{"proto3_optional":true},"comment":null}},"comment":null},"Signal":{"oneofs":{"_server":{"oneof":["server"]},"_api":{"oneof":["api"]},"_status":{"oneof":["status"]}},"fields":{"server":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"api":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"status":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null}},"comment":null}},"comment":null},"System":{"oneofs":{"_debug":{"oneof":["debug"]}},"fields":{"debug":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null}},"comment":null}},"comment":null}}},"credentials":{"nested":{"Message":{"fields":{"payload":{"rule":"required","type":"google.protobuf.Any","id":1,"comment":null}},"comment":null},"SignedMessage":{"fields":{"signed":{"rule":"required","type":"Signed","id":1,"comment":"The signed message contents."},"signatures":{"rule":"repeated","type":"Signature","id":2,"comment":"An array of Signatures, one for each key that signed the message."}},"nested":{"Signature":{"oneofs":{"_keyChain":{"oneof":["keyChain"]}},"fields":{"key":{"rule":"required","type":"PubKey","id":1,"comment":"The publicKey of the keypair that made this signature."},"signature":{"rule":"required","type":"bytes","id":2,"comment":"The bytes of the signature."},"keyChain":{"type":"KeyChain","id":3,"options":{"proto3_optional":true},"comment":"The certification chain of SignedMessages for this key."}},"comment":null},"Signed":{"fields":{"created":{"rule":"required","type":"string","id":1,"comment":"RFC-3339 datetime string."},"nonce":{"rule":"required","type":"bytes","id":2,"comment":null},"payload":{"rule":"required","type":"google.protobuf.Any","id":10,"comment":"The payload to be signed."}},"comment":null}},"comment":"A generic container message used whenever messages are signed (e.g. PartyCredential)"}}},"devtools":{"nested":{"ClearSnapshotsRequest":{"fields":{},"comment":null},"DevtoolsHost":{"methods":{"Events":{"requestType":"google.protobuf.Empty","responseType":"Event","responseStream":true,"comment":null},"GetConfig":{"requestType":"google.protobuf.Empty","responseType":"GetConfigResponse","comment":null},"ResetStorage":{"requestType":"ResetStorageRequest","responseType":"google.protobuf.Empty","comment":null},"EnableDebugLogging":{"requestType":"EnableDebugLoggingRequest","responseType":"EnableDebugLoggingResponse","comment":null},"DisableDebugLogging":{"requestType":"EnableDebugLoggingRequest","responseType":"EnableDebugLoggingResponse","comment":null},"SubscribeToKeyringKeys":{"requestType":"SubscribeToKeyringKeysRequest","responseType":"SubscribeToKeyringKeysResponse","responseStream":true,"comment":null},"SubscribeToCredentialMessages":{"requestType":"SubscribeToCredentialMessagesRequest","responseType":"SubscribeToCredentialMessagesResponse","responseStream":true,"comment":null},"SubscribeToParties":{"requestType":"SubscribeToPartiesRequest","responseType":"SubscribeToPartiesResponse","responseStream":true,"comment":null},"SubscribeToItems":{"requestType":"SubscribeToItemsRequest","responseType":"SubscribeToItemsResponse","responseStream":true,"comment":null},"SubscribeToFeeds":{"requestType":"SubscribeToFeedsRequest","responseType":"SubscribeToFeedsResponse","responseStream":true,"comment":null},"SubscribeToFeedBlocks":{"requestType":"SubscribeToFeedBlocksRequest","responseType":"SubscribeToFeedBlocksResponse","responseStream":true,"comment":null},"GetPartySnapshot":{"requestType":"GetPartySnapshotRequest","responseType":"GetPartySnapshotResponse","comment":null},"SavePartySnapshot":{"requestType":"SavePartySnapshotRequest","responseType":"SavePartySnapshotResponse","comment":null},"ClearSnapshots":{"requestType":"ClearSnapshotsRequest","responseType":"google.protobuf.Empty","comment":null},"GetNetworkPeers":{"requestType":"GetNetworkPeersRequest","responseType":"GetNetworkPeersResponse","comment":null},"SubscribeToNetworkTopics":{"requestType":"google.protobuf.Empty","responseType":"SubscribeToNetworkTopicsResponse","responseStream":true,"comment":null},"SubscribeToSignalStatus":{"requestType":"google.protobuf.Empty","responseType":"SubscribeToSignalStatusResponse","responseStream":true,"comment":null},"SubscribeToSignalTrace":{"requestType":"google.protobuf.Empty","responseType":"SubscribeToSignalTraceResponse","responseStream":true,"comment":null},"SubscribeToSwarmInfo":{"requestType":"SubscribeToSwarmInfoRequest","responseType":"SubscribeToSwarmInfoResponse","responseStream":true,"comment":null}},"comment":null},"DisableDebugLoggingRequest":{"oneofs":{"_namespaces":{"oneof":["namespaces"]}},"fields":{"namespaces":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null}},"comment":null},"DisableDebugLoggingResponse":{"oneofs":{"_enabledNamespaces":{"oneof":["enabledNamespaces"]}},"fields":{"enabledNamespaces":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null}},"comment":null},"EnableDebugLoggingRequest":{"oneofs":{"_namespaces":{"oneof":["namespaces"]}},"fields":{"namespaces":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null}},"comment":null},"EnableDebugLoggingResponse":{"oneofs":{"_enabledNamespaces":{"oneof":["enabledNamespaces"]}},"fields":{"enabledNamespaces":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null}},"comment":null},"Event":{"oneofs":{"payload":{"oneof":["ready"],"comment":null}},"fields":{"ready":{"type":"ReadyEvent","id":1,"comment":null}},"comment":null},"GetConfigResponse":{"fields":{"config":{"type":"string","id":1,"comment":null}},"comment":null},"GetNetworkPeersRequest":{"fields":{"topic":{"type":"bytes","id":1,"comment":null}},"comment":null},"GetNetworkPeersResponse":{"fields":{"peers":{"rule":"repeated","type":"PeerInfo","id":1,"comment":null}},"nested":{"PeerInfo":{"fields":{"id":{"type":"PubKey","id":1,"comment":null},"state":{"type":"string","id":2,"comment":null},"connections":{"rule":"repeated","type":"bytes","id":3,"comment":null}},"comment":null}},"comment":null},"GetPartySnapshotRequest":{"fields":{"partyKey":{"rule":"required","type":"PubKey","id":1,"comment":null}},"comment":null},"GetPartySnapshotResponse":{"oneofs":{"_snapshot":{"oneof":["snapshot"]}},"fields":{"snapshot":{"type":"PartySnapshot","id":1,"options":{"proto3_optional":true},"comment":null}},"comment":null},"ReadyEvent":{"fields":{},"comment":null},"ResetStorageRequest":{"fields":{},"comment":null},"SavePartySnapshotRequest":{"fields":{"partyKey":{"rule":"required","type":"PubKey","id":1,"comment":null}},"comment":null},"SavePartySnapshotResponse":{"oneofs":{"_snapshot":{"oneof":["snapshot"]}},"fields":{"snapshot":{"type":"PartySnapshot","id":1,"options":{"proto3_optional":true},"comment":null}},"comment":null},"SetTracingOptionsRequest":{"fields":{"enable":{"type":"bool","id":1,"comment":null}},"comment":null},"SubscribeToCredentialMessagesRequest":{"oneofs":{"_partyKey":{"oneof":["partyKey"]}},"fields":{"partyKey":{"type":"PubKey","id":1,"options":{"proto3_optional":true},"comment":null}},"comment":null},"SubscribeToCredentialMessagesResponse":{"fields":{"messages":{"rule":"repeated","type":"SignedMessage","id":1,"comment":null}},"comment":null},"SubscribeToFeedBlocksRequest":{"oneofs":{"_partyKey":{"oneof":["partyKey"]},"_feedKey":{"oneof":["feedKey"]},"_maxBlocks":{"oneof":["maxBlocks"]}},"fields":{"partyKey":{"type":"PubKey","id":1,"options":{"proto3_optional":true},"comment":null},"feedKey":{"type":"PubKey","id":2,"options":{"proto3_optional":true},"comment":null},"maxBlocks":{"type":"int32","id":3,"options":{"proto3_optional":true},"comment":null}},"comment":null},"SubscribeToFeedBlocksResponse":{"fields":{"blocks":{"rule":"repeated","type":"Block","id":1,"comment":null}},"nested":{"Block":{"fields":{"key":{"type":"bytes","id":1,"comment":null},"seq":{"type":"int32","id":2,"comment":null},"sync":{"type":"bool","id":3,"comment":null},"path":{"type":"string","id":4,"comment":null},"data":{"type":"FeedMessage","id":5,"comment":null}},"comment":null}},"comment":null},"SubscribeToFeedsRequest":{"fields":{"partyKey":{"type":"PubKey","id":1,"comment":null},"feedKeys":{"rule":"repeated","type":"PubKey","id":2,"comment":null}},"comment":null},"SubscribeToFeedsResponse":{"fields":{"feeds":{"rule":"repeated","type":"Feed","id":1,"comment":null}},"nested":{"Feed":{"fields":{"feedKey":{"type":"PubKey","id":1,"comment":null},"length":{"type":"int32","id":2,"comment":null}},"comment":null}},"comment":null},"SubscribeToItemsRequest":{"fields":{},"comment":null},"SubscribeToItemsResponse":{"fields":{"data":{"type":"string","id":1,"comment":null}},"comment":null},"SubscribeToKeyringKeysRequest":{"fields":{},"comment":null},"SubscribeToKeyringKeysResponse":{"fields":{"keys":{"rule":"repeated","type":"KeyRecord","id":1,"comment":null}},"comment":null},"SubscribeToNetworkTopicsResponse":{"fields":{"topics":{"rule":"repeated","type":"Topic","id":1,"comment":null}},"nested":{"Topic":{"oneofs":{"_label":{"oneof":["label"]}},"fields":{"topic":{"type":"PubKey","id":1,"comment":null},"label":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null}},"comment":null}},"comment":null},"SubscribeToPartiesRequest":{"fields":{"partyKeys":{"rule":"repeated","type":"PubKey","id":1,"comment":null}},"comment":null},"SubscribeToPartiesResponse":{"fields":{"parties":{"rule":"repeated","type":"PartyInfo","id":1,"comment":null}},"nested":{"PartyInfo":{"fields":{"key":{"type":"PubKey","id":1,"comment":null},"isOpen":{"type":"bool","id":2,"comment":null},"isActive":{"type":"bool","id":3,"comment":null},"timeframe":{"type":"TimeframeVector","id":4,"comment":null},"feeds":{"rule":"repeated","type":"PubKey","id":5,"comment":null},"properties":{"keyType":"string","type":"string","id":6,"comment":null}},"comment":null}},"comment":null},"SubscribeToSignalStatusResponse":{"fields":{"servers":{"rule":"repeated","type":"SignalServer","id":1,"comment":null}},"nested":{"SignalServer":{"oneofs":{"_error":{"oneof":["error"]}},"fields":{"host":{"type":"string","id":1,"comment":null},"state":{"type":"string","id":2,"comment":null},"error":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null},"reconnectIn":{"type":"int32","id":4,"comment":null},"connectionStarted":{"type":"int32","id":5,"comment":null},"lastStateChange":{"type":"int32","id":6,"comment":null}},"comment":null}},"comment":null},"SubscribeToSignalTraceResponse":{"fields":{"events":{"rule":"repeated","type":"string","id":1,"comment":null}},"comment":null},"SubscribeToSwarmInfoRequest":{"fields":{},"comment":null},"SubscribeToSwarmInfoResponse":{"fields":{"data":{"rule":"repeated","type":"SwarmInfo","id":1,"comment":null}},"nested":{"SwarmInfo":{"oneofs":{"_label":{"oneof":["label"]}},"fields":{"id":{"type":"PubKey","id":1,"comment":null},"topic":{"type":"PubKey","id":2,"comment":null},"label":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null},"isActive":{"type":"bool","id":4,"comment":null},"connections":{"rule":"repeated","type":"ConnectionInfo","id":5,"comment":null}},"nested":{"ConnectionInfo":{"oneofs":{"_transport":{"oneof":["transport"]}},"fields":{"state":{"type":"string","id":1,"comment":null},"sessionId":{"type":"PubKey","id":2,"comment":null},"remotePeerId":{"type":"PubKey","id":3,"comment":null},"transport":{"type":"string","id":4,"options":{"proto3_optional":true},"comment":null},"protocolExtensions":{"rule":"repeated","type":"string","id":5,"comment":null},"events":{"rule":"repeated","type":"Json","id":6,"comment":null}},"nested":{"Json":{"oneofs":{"_data":{"oneof":["data"]}},"fields":{"data":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null}},"comment":null}},"comment":null}},"comment":null}},"comment":null},"TracingService":{"methods":{"SetTracingOptions":{"requestType":"SetTracingOptionsRequest","responseType":"google.protobuf.Empty","comment":null},"SubscribeToRpcTrace":{"requestType":"google.protobuf.Empty","responseType":"RpcMessage","responseStream":true,"comment":null}},"comment":null}}},"echo":{"nested":{"feed":{"nested":{"CredentialsMessage":{"fields":{"data":{"type":"bytes","id":1,"comment":null}},"comment":"A container for dxos.credentials.Message"},"EchoEnvelope":{"oneofs":{"_genesis":{"oneof":["genesis"]},"_itemMutation":{"oneof":["itemMutation"]},"_mutation":{"oneof":["mutation"]},"_snapshot":{"oneof":["snapshot"]}},"fields":{"itemId":{"type":"string","id":1,"comment":null},"genesis":{"type":"ItemGenesis","id":10,"options":{"proto3_optional":true},"comment":null},"itemMutation":{"type":"ItemMutation","id":11,"options":{"proto3_optional":true},"comment":null},"mutation":{"type":"bytes","id":12,"options":{"proto3_optional":true},"comment":null},"snapshot":{"type":"ModelSnapshot","id":13,"options":{"proto3_optional":true},"comment":"Set the model to the provided snapshot."}},"comment":"Wrapper for all ECHO messages."},"FeedMessage":{"oneofs":{"payload":{"oneof":["halo","echo"],"comment":null}},"fields":{"timeframe":{"type":"TimeframeVector","id":1,"comment":null},"halo":{"type":"CredentialsMessage","id":10,"comment":null},"echo":{"type":"EchoEnvelope","id":11,"comment":null}},"comment":"Outer message type decoded by Codec.\\nThis is what is written to the feeds."},"ItemGenesis":{"oneofs":{"_itemType":{"oneof":["itemType"]},"_modelVersion":{"oneof":["modelVersion"]},"_link":{"oneof":["link"]}},"fields":{"itemType":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"modelType":{"type":"string","id":2,"comment":null},"modelVersion":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null},"link":{"type":"LinkData","id":4,"options":{"proto3_optional":true},"comment":null}},"comment":null},"ItemMutation":{"oneofs":{"_parentId":{"oneof":["parentId"]},"_action":{"oneof":["action"]}},"fields":{"parentId":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"action":{"type":"Action","id":2,"options":{"proto3_optional":true},"comment":null}},"nested":{"Action":{"values":{"NOOP":0,"DELETE":1,"RESTORE":2},"comment":null,"comments":{"NOOP":null,"DELETE":null,"RESTORE":null}}},"comment":"Item mutation."},"LinkData":{"fields":{"source":{"type":"string","id":1,"comment":null},"target":{"type":"string","id":2,"comment":null}},"comment":null}}},"invitation":{"nested":{"InvitationDescriptor":{"oneofs":{"_identityKey":{"oneof":["identityKey"]},"_secret":{"oneof":["secret"]}},"fields":{"type":{"type":"Type","id":1,"comment":null},"swarmKey":{"type":"bytes","id":2,"comment":null},"invitation":{"type":"bytes","id":3,"comment":null},"identityKey":{"type":"bytes","id":4,"options":{"proto3_optional":true},"comment":"Only present if type == OFFLINE."},"secret":{"type":"bytes","id":5,"options":{"proto3_optional":true},"comment":"Must be stripped out when passing to another peer."}},"nested":{"Type":{"values":{"INTERACTIVE":1,"OFFLINE":2},"comment":"Defines an invitation type.","comments":{"INTERACTIVE":"Interactive invitation is when both peers are online at the same time.","OFFLINE":"Offline is when only a single peer needs to be online at the time."}}},"comment":null}}},"service":{"nested":{"DataService":{"methods":{"SubscribeEntitySet":{"requestType":"SubscribeEntitySetRequest","responseType":"SubscribeEntitySetResponse","responseStream":true,"comment":null},"SubscribeEntityStream":{"requestType":"SubscribeEntityStreamRequest","responseType":"SubscribeEntityStreamResponse","responseStream":true,"comment":null},"Write":{"requestType":"WriteRequest","responseType":"MutationReceipt","comment":null}},"comment":null},"MutationReceipt":{"fields":{"feedKey":{"type":"PubKey","id":1,"comment":null},"seq":{"type":"int32","id":2,"comment":null}},"comment":null},"SubscribeEntitySetRequest":{"fields":{"partyKey":{"type":"PubKey","id":1,"comment":null}},"comment":null},"SubscribeEntitySetResponse":{"fields":{"added":{"rule":"repeated","type":"EchoEnvelope","id":1,"comment":null},"deleted":{"rule":"repeated","type":"EchoEnvelope","id":2,"comment":null}},"comment":null},"SubscribeEntityStreamRequest":{"fields":{"partyKey":{"type":"PubKey","id":1,"comment":null},"itemId":{"type":"string","id":2,"comment":null}},"comment":null},"SubscribeEntityStreamResponse":{"oneofs":{"kind":{"oneof":["snapshot","mutation"],"comment":null}},"fields":{"snapshot":{"type":"ItemSnapshot","id":1,"comment":null},"mutation":{"type":"Mutation","id":2,"comment":null}},"nested":{"Mutation":{"fields":{"data":{"type":"EchoEnvelope","id":1,"comment":null},"meta":{"type":"Metadata","id":2,"comment":null}},"nested":{"Metadata":{"fields":{"feedKey":{"type":"PubKey","id":1,"comment":null},"memberKey":{"type":"PubKey","id":2,"comment":null},"seq":{"type":"int32","id":3,"comment":null},"timeframe":{"type":"TimeframeVector","id":4,"comment":null}},"comment":null}},"comment":null}},"comment":null},"WriteRequest":{"fields":{"partyKey":{"type":"PubKey","id":1,"comment":null},"mutation":{"type":"EchoEnvelope","id":2,"comment":null}},"comment":null}}},"snapshot":{"nested":{"DatabaseSnapshot":{"fields":{"items":{"rule":"repeated","type":"ItemSnapshot","id":1,"comment":null},"links":{"rule":"repeated","type":"LinkSnapshot","id":2,"comment":null}},"comment":null},"HaloStateSnapshot":{"fields":{"messages":{"rule":"repeated","type":"dxos.CredentialsMessage","id":1,"comment":null}},"comment":null},"ItemSnapshot":{"oneofs":{"_itemId":{"oneof":["itemId"]},"_itemType":{"oneof":["itemType"]},"_modelVersion":{"oneof":["modelVersion"]},"_parentId":{"oneof":["parentId"]},"_model":{"oneof":["model"]}},"fields":{"itemId":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"itemType":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"modelType":{"type":"string","id":3,"comment":null},"modelVersion":{"type":"string","id":4,"options":{"proto3_optional":true},"comment":null},"parentId":{"type":"string","id":5,"options":{"proto3_optional":true},"comment":null},"model":{"type":"ModelSnapshot","id":6,"options":{"proto3_optional":true},"comment":null}},"comment":null},"LinkSnapshot":{"oneofs":{"_linkId":{"oneof":["linkId"]},"_linkType":{"oneof":["linkType"]},"_modelVersion":{"oneof":["modelVersion"]},"_model":{"oneof":["model"]}},"fields":{"linkId":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"linkType":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"modelType":{"type":"string","id":3,"comment":null},"modelVersion":{"type":"string","id":4,"options":{"proto3_optional":true},"comment":null},"source":{"rule":"required","type":"string","id":5,"comment":null},"target":{"rule":"required","type":"string","id":6,"comment":null},"model":{"type":"ModelSnapshot","id":7,"options":{"proto3_optional":true},"comment":null}},"comment":null},"ModelMutation":{"fields":{"mutation":{"rule":"required","type":"bytes","id":1,"comment":null},"meta":{"rule":"required","type":"ModelMutationMeta","id":2,"comment":null}},"comment":null},"ModelMutationMeta":{"fields":{"feedKey":{"rule":"required","type":"dxos.halo.keys.PubKey","id":1,"comment":null},"seq":{"rule":"required","type":"int32","id":2,"comment":null},"memberKey":{"rule":"required","type":"dxos.halo.keys.PubKey","id":3,"comment":null}},"comment":null},"ModelSnapshot":{"oneofs":{"_snapshot":{"oneof":["snapshot"]}},"fields":{"snapshot":{"type":"bytes","id":1,"options":{"proto3_optional":true},"comment":"Encoded model snapshot (defined by the model\'s codec).\\nIf undefined the state machine will be initialized with it\'s default state."},"mutations":{"rule":"repeated","type":"ModelMutation","id":2,"comment":"Mutations to be applied on top of the snapshot, or on top of initial state if the snapshot is undefined."}},"comment":null},"PartySnapshot":{"oneofs":{"_timeframe":{"oneof":["timeframe"]},"_timestamp":{"oneof":["timestamp"]}},"fields":{"partyKey":{"type":"bytes","id":1,"comment":null},"timeframe":{"type":"TimeframeVector","id":2,"options":{"proto3_optional":true},"comment":null},"timestamp":{"type":"int32","id":3,"options":{"proto3_optional":true},"comment":null},"halo":{"type":"HaloStateSnapshot","id":11,"comment":null},"database":{"type":"DatabaseSnapshot","id":12,"comment":null}},"comment":null}}},"timeframe":{"nested":{"TimeframeVector":{"fields":{"frames":{"rule":"repeated","type":"Frame","id":1,"comment":null}},"nested":{"Frame":{"fields":{"feedKey":{"type":"bytes","id":1,"comment":null},"seq":{"type":"int32","id":3,"comment":null}},"comment":null}},"comment":"Vector timestamp used to order messages."}}}}},"halo":{"nested":{"keys":{"nested":{"KeyChain":{"fields":{"publicKey":{"rule":"required","type":"PubKey","id":1,"comment":null},"message":{"rule":"required","type":"SignedMessage","id":2,"comment":null},"parents":{"rule":"repeated","type":"KeyChain","id":3,"comment":null}},"comment":null},"KeyRecord":{"oneofs":{"_secretKey":{"oneof":["secretKey"]},"_hint":{"oneof":["hint"]},"_own":{"oneof":["own"]},"_trusted":{"oneof":["trusted"]},"_added":{"oneof":["added"]},"_created":{"oneof":["created"]}},"fields":{"type":{"rule":"required","type":"KeyType","id":1,"comment":"The `KeyType` type of the key. This is often unknown for keys from other sources."},"publicKey":{"rule":"required","type":"PubKey","id":2,"comment":"The public key as a Buffer (required)."},"secretKey":{"type":"PrivKey","id":3,"options":{"proto3_optional":true},"comment":"The secret key as a Buffer (this will never be visible outside the Keyring)."},"hint":{"type":"bool","id":4,"options":{"proto3_optional":true},"comment":"Is this key from a Greeting \\"hint\\"?"},"own":{"type":"bool","id":5,"options":{"proto3_optional":true},"comment":"Determines if this is our key?\\nUsually true if `secretKey` is present; may be false for \\"inception keys\\" such as the Party key."},"trusted":{"type":"bool","id":6,"options":{"proto3_optional":true},"comment":"Is this key to be trusted?"},"added":{"type":"string","id":7,"options":{"proto3_optional":true},"comment":"An RFC-3339 date/time string for when the key was added to the Keyring."},"created":{"type":"string","id":8,"options":{"proto3_optional":true},"comment":"An RFC-3339 date/time string for when the key was created."}},"comment":null},"KeyRecordList":{"fields":{"keys":{"rule":"repeated","type":"KeyRecord","id":1,"comment":null}},"comment":null},"KeyType":{"values":{"UNKNOWN":0,"IDENTITY":1,"DEVICE":2,"PARTY":3,"FEED":4,"DXNS_ADDRESS":5},"comment":null,"comments":{"UNKNOWN":null,"IDENTITY":null,"DEVICE":null,"PARTY":null,"FEED":null,"DXNS_ADDRESS":null}},"PrivKey":{"fields":{"data":{"type":"bytes","id":1,"comment":null}},"comment":null},"PubKey":{"fields":{"data":{"type":"bytes","id":1,"comment":null}},"comment":null}}}}},"rpc":{"options":{"go_package":"github.com/dxos/kube/go/dxrpc/pb"},"nested":{"Error":{"oneofs":{"_name":{"oneof":["name"]},"_message":{"oneof":["message"]},"_stack":{"oneof":["stack"]}},"fields":{"name":{"type":"string","id":1,"options":{"proto3_optional":true},"comment":null},"message":{"type":"string","id":2,"options":{"proto3_optional":true},"comment":null},"stack":{"type":"string","id":3,"options":{"proto3_optional":true},"comment":null}},"comment":null},"MessageTrace":{"fields":{"direction":{"type":"Direction","id":1,"comment":null},"data":{"type":"bytes","id":2,"comment":null}},"nested":{"Direction":{"values":{"INCOMING":0,"OUTGOING":1},"comment":null,"comments":{"INCOMING":null,"OUTGOING":null}}},"comment":null},"Request":{"fields":{"id":{"type":"int32","id":1,"comment":null},"method":{"type":"string","id":2,"comment":null},"payload":{"type":"google.protobuf.Any","id":3,"comment":null},"stream":{"type":"bool","id":4,"comment":null}},"comment":null},"Response":{"oneofs":{"content":{"oneof":["payload","error","close","streamReady"],"comment":null}},"fields":{"id":{"type":"int32","id":1,"comment":null},"payload":{"type":"google.protobuf.Any","id":2,"comment":null},"error":{"type":"Error","id":3,"comment":null},"close":{"type":"bool","id":4,"comment":"Sent when stream is closed without an error."},"streamReady":{"type":"bool","id":5,"comment":"Sent when the server has processed a request with a streaming response.\\n\\nCan be skipped by the server.\\nIn this case the first payload should be treated as the server being ready."}},"comment":null},"RpcMessage":{"oneofs":{"content":{"oneof":["request","response","open","openAck","streamClose"],"comment":null}},"fields":{"request":{"type":"Request","id":1,"comment":null},"response":{"type":"Response","id":2,"comment":null},"open":{"type":"bool","id":3,"comment":"Means that the node is trying to open the connection."},"openAck":{"type":"bool","id":4,"comment":"Means that the node has received the \\"open\\" message and is ready to perform requests."},"streamClose":{"type":"StreamClose","id":5,"comment":null}},"comment":null},"StreamClose":{"fields":{"id":{"type":"int32","id":1,"comment":null}},"comment":null}}}}},"google":{"nested":{"protobuf":{"nested":{"Any":{"fields":{"type_url":{"type":"string","id":1},"value":{"type":"bytes","id":2}},"comment":null},"DescriptorProto":{"fields":{"name":{"type":"string","id":1},"field":{"rule":"repeated","type":"FieldDescriptorProto","id":2},"extension":{"rule":"repeated","type":"FieldDescriptorProto","id":6},"nestedType":{"rule":"repeated","type":"DescriptorProto","id":3},"enumType":{"rule":"repeated","type":"EnumDescriptorProto","id":4},"extensionRange":{"rule":"repeated","type":"ExtensionRange","id":5},"oneofDecl":{"rule":"repeated","type":"OneofDescriptorProto","id":8},"options":{"type":"MessageOptions","id":7},"reservedRange":{"rule":"repeated","type":"ReservedRange","id":9},"reservedName":{"rule":"repeated","type":"string","id":10}},"nested":{"ExtensionRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2}},"comment":null},"ReservedRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2}},"comment":null}},"comment":null},"Empty":{"fields":{},"comment":null},"EnumDescriptorProto":{"fields":{"name":{"type":"string","id":1},"value":{"rule":"repeated","type":"EnumValueDescriptorProto","id":2},"options":{"type":"EnumOptions","id":3}},"comment":null},"EnumOptions":{"fields":{"allowAlias":{"type":"bool","id":2},"deprecated":{"type":"bool","id":3},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"comment":null},"EnumValueDescriptorProto":{"fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":2},"options":{"type":"EnumValueOptions","id":3}},"comment":null},"EnumValueOptions":{"fields":{"deprecated":{"type":"bool","id":1},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"comment":null},"FieldDescriptorProto":{"fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":3},"label":{"type":"Label","id":4},"type":{"type":"Type","id":5},"typeName":{"type":"string","id":6},"extendee":{"type":"string","id":2},"defaultValue":{"type":"string","id":7},"oneofIndex":{"type":"int32","id":9},"jsonName":{"type":"string","id":10},"options":{"type":"FieldOptions","id":8}},"nested":{"Label":{"values":{"LABEL_OPTIONAL":1,"LABEL_REQUIRED":2,"LABEL_REPEATED":3},"comments":{}},"Type":{"values":{"TYPE_DOUBLE":1,"TYPE_FLOAT":2,"TYPE_INT64":3,"TYPE_UINT64":4,"TYPE_INT32":5,"TYPE_FIXED64":6,"TYPE_FIXED32":7,"TYPE_BOOL":8,"TYPE_STRING":9,"TYPE_GROUP":10,"TYPE_MESSAGE":11,"TYPE_BYTES":12,"TYPE_UINT32":13,"TYPE_ENUM":14,"TYPE_SFIXED32":15,"TYPE_SFIXED64":16,"TYPE_SINT32":17,"TYPE_SINT64":18},"comments":{}}},"comment":null},"FieldOptions":{"fields":{"ctype":{"type":"CType","id":1,"options":{"default":"STRING"}},"packed":{"type":"bool","id":2},"jstype":{"type":"JSType","id":6,"options":{"default":"JS_NORMAL"}},"lazy":{"type":"bool","id":5},"deprecated":{"type":"bool","id":3},"weak":{"type":"bool","id":10},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[4,4]],"nested":{"CType":{"values":{"STRING":0,"CORD":1,"STRING_PIECE":2},"comments":{}},"JSType":{"values":{"JS_NORMAL":0,"JS_STRING":1,"JS_NUMBER":2},"comments":{}}},"comment":null},"FileDescriptorProto":{"fields":{"name":{"type":"string","id":1},"package":{"type":"string","id":2},"dependency":{"rule":"repeated","type":"string","id":3},"publicDependency":{"rule":"repeated","type":"int32","id":10,"options":{"packed":false}},"weakDependency":{"rule":"repeated","type":"int32","id":11,"options":{"packed":false}},"messageType":{"rule":"repeated","type":"DescriptorProto","id":4},"enumType":{"rule":"repeated","type":"EnumDescriptorProto","id":5},"service":{"rule":"repeated","type":"ServiceDescriptorProto","id":6},"extension":{"rule":"repeated","type":"FieldDescriptorProto","id":7},"options":{"type":"FileOptions","id":8},"sourceCodeInfo":{"type":"SourceCodeInfo","id":9},"syntax":{"type":"string","id":12}},"comment":null},"FileDescriptorSet":{"fields":{"file":{"rule":"repeated","type":"FileDescriptorProto","id":1}},"comment":null},"FileOptions":{"fields":{"javaPackage":{"type":"string","id":1},"javaOuterClassname":{"type":"string","id":8},"javaMultipleFiles":{"type":"bool","id":10},"javaGenerateEqualsAndHash":{"type":"bool","id":20,"options":{"deprecated":true}},"javaStringCheckUtf8":{"type":"bool","id":27},"optimizeFor":{"type":"OptimizeMode","id":9,"options":{"default":"SPEED"}},"goPackage":{"type":"string","id":11},"ccGenericServices":{"type":"bool","id":16},"javaGenericServices":{"type":"bool","id":17},"pyGenericServices":{"type":"bool","id":18},"deprecated":{"type":"bool","id":23},"ccEnableArenas":{"type":"bool","id":31},"objcClassPrefix":{"type":"string","id":36},"csharpNamespace":{"type":"string","id":37},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[38,38]],"nested":{"OptimizeMode":{"values":{"SPEED":1,"CODE_SIZE":2,"LITE_RUNTIME":3},"comments":{}}},"comment":null},"GeneratedCodeInfo":{"fields":{"annotation":{"rule":"repeated","type":"Annotation","id":1}},"nested":{"Annotation":{"fields":{"path":{"rule":"repeated","type":"int32","id":1},"sourceFile":{"type":"string","id":2},"begin":{"type":"int32","id":3},"end":{"type":"int32","id":4}},"comment":null}},"comment":null},"MessageOptions":{"fields":{"messageSetWireFormat":{"type":"bool","id":1},"noStandardDescriptorAccessor":{"type":"bool","id":2},"deprecated":{"type":"bool","id":3},"mapEntry":{"type":"bool","id":7},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[8,8]],"comment":null},"MethodDescriptorProto":{"fields":{"name":{"type":"string","id":1},"inputType":{"type":"string","id":2},"outputType":{"type":"string","id":3},"options":{"type":"MethodOptions","id":4},"clientStreaming":{"type":"bool","id":5},"serverStreaming":{"type":"bool","id":6}},"comment":null},"MethodOptions":{"fields":{"deprecated":{"type":"bool","id":33},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"comment":null},"OneofDescriptorProto":{"fields":{"name":{"type":"string","id":1},"options":{"type":"OneofOptions","id":2}},"comment":null},"OneofOptions":{"fields":{"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"comment":null},"ServiceDescriptorProto":{"fields":{"name":{"type":"string","id":1},"method":{"rule":"repeated","type":"MethodDescriptorProto","id":2},"options":{"type":"ServiceOptions","id":3}},"comment":null},"ServiceOptions":{"fields":{"deprecated":{"type":"bool","id":33},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"comment":null},"SourceCodeInfo":{"fields":{"location":{"rule":"repeated","type":"Location","id":1}},"nested":{"Location":{"fields":{"path":{"rule":"repeated","type":"int32","id":1},"span":{"rule":"repeated","type":"int32","id":2},"leadingComments":{"type":"string","id":3},"trailingComments":{"type":"string","id":4},"leadingDetachedComments":{"rule":"repeated","type":"string","id":6}},"comment":null}},"comment":null},"Timestamp":{"fields":{"seconds":{"type":"int64","id":1},"nanos":{"type":"int32","id":2}},"comment":null},"UninterpretedOption":{"fields":{"name":{"rule":"repeated","type":"NamePart","id":2},"identifierValue":{"type":"string","id":3},"positiveIntValue":{"type":"uint64","id":4},"negativeIntValue":{"type":"int64","id":5},"doubleValue":{"type":"double","id":6},"stringValue":{"type":"bytes","id":7},"aggregateValue":{"type":"string","id":8}},"nested":{"NamePart":{"fields":{"namePart":{"rule":"required","type":"string","id":1},"isExtension":{"rule":"required","type":"bool","id":2}},"comment":null}},"comment":null}}}}}}}');
|
|
95789
|
+
var schema = import_codec_protobuf2.Schema.fromJson(schemaJson, substitutions_default);
|
|
97019
95790
|
|
|
97020
|
-
// src/
|
|
95791
|
+
// src/packlets/proto/gen/dxos/config.ts
|
|
95792
|
+
var Runtime;
|
|
95793
|
+
((Runtime2) => {
|
|
95794
|
+
let Client2;
|
|
95795
|
+
((Client3) => {
|
|
95796
|
+
let Mode;
|
|
95797
|
+
((Mode2) => {
|
|
95798
|
+
Mode2[Mode2["AUTOMATIC"] = 0] = "AUTOMATIC";
|
|
95799
|
+
Mode2[Mode2["LOCAL"] = 1] = "LOCAL";
|
|
95800
|
+
Mode2[Mode2["REMOTE"] = 2] = "REMOTE";
|
|
95801
|
+
})(Mode = Client3.Mode || (Client3.Mode = {}));
|
|
95802
|
+
let Storage;
|
|
95803
|
+
((Storage2) => {
|
|
95804
|
+
let StorageDriver2;
|
|
95805
|
+
((StorageDriver3) => {
|
|
95806
|
+
StorageDriver3[StorageDriver3["RAM"] = 0] = "RAM";
|
|
95807
|
+
StorageDriver3[StorageDriver3["IDB"] = 1] = "IDB";
|
|
95808
|
+
StorageDriver3[StorageDriver3["CHROME"] = 2] = "CHROME";
|
|
95809
|
+
StorageDriver3[StorageDriver3["FIREFOX"] = 3] = "FIREFOX";
|
|
95810
|
+
StorageDriver3[StorageDriver3["NODE"] = 4] = "NODE";
|
|
95811
|
+
StorageDriver3[StorageDriver3["LEVELJS"] = 11] = "LEVELJS";
|
|
95812
|
+
StorageDriver3[StorageDriver3["JSONDOWN"] = 12] = "JSONDOWN";
|
|
95813
|
+
})(StorageDriver2 = Storage2.StorageDriver || (Storage2.StorageDriver = {}));
|
|
95814
|
+
})(Storage = Client3.Storage || (Client3.Storage = {}));
|
|
95815
|
+
})(Client2 = Runtime2.Client || (Runtime2.Client = {}));
|
|
95816
|
+
})(Runtime || (Runtime = {}));
|
|
95817
|
+
|
|
95818
|
+
// src/packlets/proto/gen/dxos/echo/feed.ts
|
|
95819
|
+
var ItemMutation;
|
|
95820
|
+
((ItemMutation2) => {
|
|
95821
|
+
let Action;
|
|
95822
|
+
((Action2) => {
|
|
95823
|
+
Action2[Action2["NOOP"] = 0] = "NOOP";
|
|
95824
|
+
Action2[Action2["DELETE"] = 1] = "DELETE";
|
|
95825
|
+
Action2[Action2["RESTORE"] = 2] = "RESTORE";
|
|
95826
|
+
})(Action = ItemMutation2.Action || (ItemMutation2.Action = {}));
|
|
95827
|
+
})(ItemMutation || (ItemMutation = {}));
|
|
95828
|
+
|
|
95829
|
+
// src/packlets/proto/gen/dxos/echo/invitation.ts
|
|
95830
|
+
var InvitationDescriptor;
|
|
95831
|
+
((InvitationDescriptor8) => {
|
|
95832
|
+
let Type;
|
|
95833
|
+
((Type2) => {
|
|
95834
|
+
Type2[Type2["INTERACTIVE"] = 1] = "INTERACTIVE";
|
|
95835
|
+
Type2[Type2["OFFLINE"] = 2] = "OFFLINE";
|
|
95836
|
+
})(Type = InvitationDescriptor8.Type || (InvitationDescriptor8.Type = {}));
|
|
95837
|
+
})(InvitationDescriptor || (InvitationDescriptor = {}));
|
|
95838
|
+
|
|
95839
|
+
// src/packlets/proto/gen/dxos/halo/keys.ts
|
|
95840
|
+
var KeyType = /* @__PURE__ */ ((KeyType2) => {
|
|
95841
|
+
KeyType2[KeyType2["UNKNOWN"] = 0] = "UNKNOWN";
|
|
95842
|
+
KeyType2[KeyType2["IDENTITY"] = 1] = "IDENTITY";
|
|
95843
|
+
KeyType2[KeyType2["DEVICE"] = 2] = "DEVICE";
|
|
95844
|
+
KeyType2[KeyType2["PARTY"] = 3] = "PARTY";
|
|
95845
|
+
KeyType2[KeyType2["FEED"] = 4] = "FEED";
|
|
95846
|
+
KeyType2[KeyType2["DXNS_ADDRESS"] = 5] = "DXNS_ADDRESS";
|
|
95847
|
+
return KeyType2;
|
|
95848
|
+
})(KeyType || {});
|
|
95849
|
+
|
|
95850
|
+
// src/packlets/proto/gen/dxos/rpc.ts
|
|
95851
|
+
var MessageTrace;
|
|
95852
|
+
((MessageTrace2) => {
|
|
95853
|
+
let Direction;
|
|
95854
|
+
((Direction2) => {
|
|
95855
|
+
Direction2[Direction2["INCOMING"] = 0] = "INCOMING";
|
|
95856
|
+
Direction2[Direction2["OUTGOING"] = 1] = "OUTGOING";
|
|
95857
|
+
})(Direction = MessageTrace2.Direction || (MessageTrace2.Direction = {}));
|
|
95858
|
+
})(MessageTrace || (MessageTrace = {}));
|
|
95859
|
+
|
|
95860
|
+
// src/packlets/api/client-service.ts
|
|
95861
|
+
var import_echo_protocol = __toESM(require_src7());
|
|
95862
|
+
var import_rpc = require("@dxos/rpc");
|
|
97021
95863
|
var clientServiceBundle = (0, import_rpc.createServiceBundle)({
|
|
97022
95864
|
SystemService: schema.getService("dxos.client.SystemService"),
|
|
97023
95865
|
ProfileService: schema.getService("dxos.client.ProfileService"),
|
|
@@ -97028,36 +95870,110 @@ var clientServiceBundle = (0, import_rpc.createServiceBundle)({
|
|
|
97028
95870
|
TracingService: schema.getService("dxos.devtools.TracingService")
|
|
97029
95871
|
});
|
|
97030
95872
|
|
|
97031
|
-
// src/
|
|
97032
|
-
var
|
|
97033
|
-
|
|
97034
|
-
|
|
97035
|
-
|
|
97036
|
-
|
|
97037
|
-
|
|
97038
|
-
// src/devtools/config.ts
|
|
97039
|
-
var getConfig = (hook) => ({
|
|
97040
|
-
config: JSON.stringify(hook.config.values)
|
|
97041
|
-
});
|
|
97042
|
-
|
|
97043
|
-
// src/devtools/debug-logging.ts
|
|
97044
|
-
var enableDebugLogging = (hook, data) => {
|
|
97045
|
-
hook.debug.enable(data.namespaces);
|
|
97046
|
-
};
|
|
97047
|
-
var disableDebugLogging = (hook) => {
|
|
97048
|
-
hook.debug.disable();
|
|
97049
|
-
};
|
|
97050
|
-
|
|
97051
|
-
// src/devtools/feeds.ts
|
|
97052
|
-
var import_readable_stream = require("readable-stream");
|
|
97053
|
-
var import_codec_protobuf7 = require("@dxos/codec-protobuf");
|
|
97054
|
-
var import_feed_store = __toESM(require_src6());
|
|
97055
|
-
var subscribeToFeeds = ({ echo }, { partyKey, feedKeys }) => new import_codec_protobuf7.Stream(({ next }) => {
|
|
97056
|
-
if (!partyKey || (feedKeys == null ? void 0 : feedKeys.length) === 0) {
|
|
97057
|
-
return;
|
|
95873
|
+
// src/packlets/api/invitations/invitation.ts
|
|
95874
|
+
var Invitation = class {
|
|
95875
|
+
constructor(_descriptor, _invitationPromise, _onAuthenticate) {
|
|
95876
|
+
this._descriptor = _descriptor;
|
|
95877
|
+
this._invitationPromise = _invitationPromise;
|
|
95878
|
+
this._onAuthenticate = _onAuthenticate;
|
|
97058
95879
|
}
|
|
97059
|
-
|
|
97060
|
-
|
|
95880
|
+
get descriptor() {
|
|
95881
|
+
return this._descriptor;
|
|
95882
|
+
}
|
|
95883
|
+
authenticate(secret) {
|
|
95884
|
+
this._onAuthenticate(secret);
|
|
95885
|
+
}
|
|
95886
|
+
wait() {
|
|
95887
|
+
return this._invitationPromise;
|
|
95888
|
+
}
|
|
95889
|
+
toJSON() {
|
|
95890
|
+
return this.descriptor.toProto();
|
|
95891
|
+
}
|
|
95892
|
+
};
|
|
95893
|
+
|
|
95894
|
+
// src/packlets/api/invitations/invitation-request.ts
|
|
95895
|
+
var import_node_assert = __toESM(require_assert());
|
|
95896
|
+
var import_async = require("@dxos/async");
|
|
95897
|
+
var import_debug = require("@dxos/debug");
|
|
95898
|
+
var InvitationRequest = class {
|
|
95899
|
+
constructor(_descriptor, connected, finished, error2) {
|
|
95900
|
+
this._descriptor = _descriptor;
|
|
95901
|
+
this._hasConnected = false;
|
|
95902
|
+
this._isCanceled = false;
|
|
95903
|
+
this.canceled = new import_async.Event();
|
|
95904
|
+
this.connected = connected;
|
|
95905
|
+
this.finished = finished;
|
|
95906
|
+
this.error = error2;
|
|
95907
|
+
this.connected.on(() => {
|
|
95908
|
+
this._hasConnected = true;
|
|
95909
|
+
});
|
|
95910
|
+
}
|
|
95911
|
+
get descriptor() {
|
|
95912
|
+
return this._descriptor;
|
|
95913
|
+
}
|
|
95914
|
+
get secret() {
|
|
95915
|
+
var _a;
|
|
95916
|
+
return (_a = this._descriptor.secret) != null ? _a : (0, import_debug.raise)(new Error("Invitation secret is not set"));
|
|
95917
|
+
}
|
|
95918
|
+
get hasConnected() {
|
|
95919
|
+
return this._hasConnected;
|
|
95920
|
+
}
|
|
95921
|
+
cancel() {
|
|
95922
|
+
(0, import_node_assert.default)(!this._isCanceled, new Error("Invitation is already canceled"));
|
|
95923
|
+
this._isCanceled = true;
|
|
95924
|
+
this.canceled.emit();
|
|
95925
|
+
}
|
|
95926
|
+
toString() {
|
|
95927
|
+
return `InvitationRequest(${JSON.stringify(this._descriptor.toQueryParameters())})`;
|
|
95928
|
+
}
|
|
95929
|
+
};
|
|
95930
|
+
|
|
95931
|
+
// src/packlets/api/echo.ts
|
|
95932
|
+
var PartyInvitation = class extends Invitation {
|
|
95933
|
+
getParty() {
|
|
95934
|
+
return this.wait();
|
|
95935
|
+
}
|
|
95936
|
+
};
|
|
95937
|
+
|
|
95938
|
+
// src/packlets/api/errors.ts
|
|
95939
|
+
var import_debug2 = require("@dxos/debug");
|
|
95940
|
+
var InvalidConfigurationError = class extends import_debug2.DXOSError {
|
|
95941
|
+
constructor(message) {
|
|
95942
|
+
super("INVALID_CONFIGURATION", message);
|
|
95943
|
+
}
|
|
95944
|
+
};
|
|
95945
|
+
var RemoteServiceConnectionTimeout = class extends import_debug2.DXOSError {
|
|
95946
|
+
constructor(message) {
|
|
95947
|
+
super("REMOTE_SERVICE_CONNECTION_TIMEOUT", message);
|
|
95948
|
+
}
|
|
95949
|
+
};
|
|
95950
|
+
|
|
95951
|
+
// src/packlets/devtools/devtools-host.ts
|
|
95952
|
+
var import_codec_protobuf8 = require("@dxos/codec-protobuf");
|
|
95953
|
+
|
|
95954
|
+
// src/packlets/devtools/config.ts
|
|
95955
|
+
var getConfig = (hook) => ({
|
|
95956
|
+
config: JSON.stringify(hook.config.values)
|
|
95957
|
+
});
|
|
95958
|
+
|
|
95959
|
+
// src/packlets/devtools/debug-logging.ts
|
|
95960
|
+
var enableDebugLogging = (hook, data) => {
|
|
95961
|
+
hook.debug.enable(data.namespaces);
|
|
95962
|
+
};
|
|
95963
|
+
var disableDebugLogging = (hook) => {
|
|
95964
|
+
hook.debug.disable();
|
|
95965
|
+
};
|
|
95966
|
+
|
|
95967
|
+
// src/packlets/devtools/feeds.ts
|
|
95968
|
+
var import_readable_stream = require("readable-stream");
|
|
95969
|
+
var import_codec_protobuf3 = require("@dxos/codec-protobuf");
|
|
95970
|
+
var import_feed_store = __toESM(require_src6());
|
|
95971
|
+
var subscribeToFeeds = ({ echo }, { partyKey, feedKeys }) => new import_codec_protobuf3.Stream(({ next }) => {
|
|
95972
|
+
if (!partyKey || (feedKeys == null ? void 0 : feedKeys.length) === 0) {
|
|
95973
|
+
return;
|
|
95974
|
+
}
|
|
95975
|
+
const feedMap = /* @__PURE__ */ new Map();
|
|
95976
|
+
setImmediate(async () => {
|
|
97061
95977
|
const { value: parties } = echo.queryParties();
|
|
97062
95978
|
const party = parties.find((party2) => party2.key.equals(partyKey));
|
|
97063
95979
|
if (!party) {
|
|
@@ -97093,7 +96009,7 @@ var subscribeToFeeds = ({ echo }, { partyKey, feedKeys }) => new import_codec_pr
|
|
|
97093
96009
|
feedMap.forEach(({ stream }) => stream.destroy());
|
|
97094
96010
|
};
|
|
97095
96011
|
});
|
|
97096
|
-
var subscribeToFeedBlocks = ({ echo }, { partyKey, feedKey, maxBlocks = 10 }) => new
|
|
96012
|
+
var subscribeToFeedBlocks = ({ echo }, { partyKey, feedKey, maxBlocks = 10 }) => new import_codec_protobuf3.Stream(({ next }) => {
|
|
97097
96013
|
if (!partyKey || !feedKey) {
|
|
97098
96014
|
return;
|
|
97099
96015
|
}
|
|
@@ -97121,8 +96037,8 @@ var subscribeToFeedBlocks = ({ echo }, { partyKey, feedKey, maxBlocks = 10 }) =>
|
|
|
97121
96037
|
};
|
|
97122
96038
|
});
|
|
97123
96039
|
|
|
97124
|
-
// src/devtools/items.ts
|
|
97125
|
-
var
|
|
96040
|
+
// src/packlets/devtools/items.ts
|
|
96041
|
+
var import_codec_protobuf4 = require("@dxos/codec-protobuf");
|
|
97126
96042
|
var getData = (echo) => {
|
|
97127
96043
|
const result = {
|
|
97128
96044
|
parties: []
|
|
@@ -97148,7 +96064,7 @@ var getData = (echo) => {
|
|
|
97148
96064
|
data: JSON.stringify(result)
|
|
97149
96065
|
};
|
|
97150
96066
|
};
|
|
97151
|
-
var subscribeToItems = ({ echo }) => new
|
|
96067
|
+
var subscribeToItems = ({ echo }) => new import_codec_protobuf4.Stream(({ next }) => {
|
|
97152
96068
|
const update = () => {
|
|
97153
96069
|
const res = getData(echo);
|
|
97154
96070
|
next(res);
|
|
@@ -97172,16 +96088,16 @@ var subscribeToItems = ({ echo }) => new import_codec_protobuf8.Stream(({ next }
|
|
|
97172
96088
|
};
|
|
97173
96089
|
});
|
|
97174
96090
|
|
|
97175
|
-
// src/devtools/keys.ts
|
|
97176
|
-
var
|
|
97177
|
-
var
|
|
97178
|
-
var subscribeToKeyringKeys = ({ keyring }) => new
|
|
96091
|
+
// src/packlets/devtools/keys.ts
|
|
96092
|
+
var import_codec_protobuf5 = require("@dxos/codec-protobuf");
|
|
96093
|
+
var import_util = require("@dxos/util");
|
|
96094
|
+
var subscribeToKeyringKeys = ({ keyring }) => new import_codec_protobuf5.Stream(({ next }) => {
|
|
97179
96095
|
next({ keys: keyring.keys });
|
|
97180
96096
|
return keyring.keysUpdate.on((keys) => {
|
|
97181
96097
|
next({ keys });
|
|
97182
96098
|
});
|
|
97183
96099
|
});
|
|
97184
|
-
var subscribeToCredentialMessages = ({ echo }, { partyKey }) => new
|
|
96100
|
+
var subscribeToCredentialMessages = ({ echo }, { partyKey }) => new import_codec_protobuf5.Stream(({ next }) => {
|
|
97185
96101
|
const party = partyKey && echo.getParty(partyKey);
|
|
97186
96102
|
if (!party) {
|
|
97187
96103
|
throw new Error("Party not found");
|
|
@@ -97189,17 +96105,17 @@ var subscribeToCredentialMessages = ({ echo }, { partyKey }) => new import_codec
|
|
|
97189
96105
|
const update = () => {
|
|
97190
96106
|
next({ messages: Array.from(party.processor.credentialMessages.values()) });
|
|
97191
96107
|
};
|
|
97192
|
-
const subscriptions = new
|
|
96108
|
+
const subscriptions = new import_util.SubscriptionGroup();
|
|
97193
96109
|
subscriptions.push(party.processor.keyOrInfoAdded.on(() => update()));
|
|
97194
96110
|
subscriptions.push(party.processor.feedAdded.on(() => update()));
|
|
97195
96111
|
update();
|
|
97196
96112
|
return () => subscriptions.unsubscribe();
|
|
97197
96113
|
});
|
|
97198
96114
|
|
|
97199
|
-
// src/devtools/network.ts
|
|
97200
|
-
var
|
|
96115
|
+
// src/packlets/devtools/network.ts
|
|
96116
|
+
var import_codec_protobuf6 = require("@dxos/codec-protobuf");
|
|
97201
96117
|
var import_protocols2 = require("@dxos/protocols");
|
|
97202
|
-
var subscribeToNetworkStatus = (hook) => new
|
|
96118
|
+
var subscribeToNetworkStatus = (hook) => new import_codec_protobuf6.Stream(({ next, close }) => {
|
|
97203
96119
|
const update = () => {
|
|
97204
96120
|
try {
|
|
97205
96121
|
const status = hook.networkManager.signal.getStatus();
|
|
@@ -97211,7 +96127,7 @@ var subscribeToNetworkStatus = (hook) => new import_codec_protobuf10.Stream(({ n
|
|
|
97211
96127
|
hook.networkManager.signal.statusChanged.on(update);
|
|
97212
96128
|
update();
|
|
97213
96129
|
});
|
|
97214
|
-
var subscribeToSignalTrace = (hook) => new
|
|
96130
|
+
var subscribeToSignalTrace = (hook) => new import_codec_protobuf6.Stream(({ next }) => {
|
|
97215
96131
|
next({ events: [] });
|
|
97216
96132
|
const trace = [];
|
|
97217
96133
|
hook.networkManager.signal.commandTrace.on((msg) => {
|
|
@@ -97219,7 +96135,7 @@ var subscribeToSignalTrace = (hook) => new import_codec_protobuf10.Stream(({ nex
|
|
|
97219
96135
|
next({ events: trace.map((msg2) => JSON.stringify(msg2)) });
|
|
97220
96136
|
});
|
|
97221
96137
|
});
|
|
97222
|
-
var subscribeToNetworkTopics = (hook) => new
|
|
96138
|
+
var subscribeToNetworkTopics = (hook) => new import_codec_protobuf6.Stream(({ next, close }) => {
|
|
97223
96139
|
const update = () => {
|
|
97224
96140
|
try {
|
|
97225
96141
|
const topics = hook.networkManager.topics;
|
|
@@ -97238,7 +96154,7 @@ var subscribeToNetworkTopics = (hook) => new import_codec_protobuf10.Stream(({ n
|
|
|
97238
96154
|
hook.networkManager.topicsUpdated.on(update);
|
|
97239
96155
|
update();
|
|
97240
96156
|
});
|
|
97241
|
-
var subscribeToSwarmInfo = (hook) => new
|
|
96157
|
+
var subscribeToSwarmInfo = (hook) => new import_codec_protobuf6.Stream(({ next }) => {
|
|
97242
96158
|
var _a;
|
|
97243
96159
|
const networkManager = hook.networkManager;
|
|
97244
96160
|
const update = () => {
|
|
@@ -97264,9 +96180,9 @@ var getNetworkPeers = (hook, request) => {
|
|
|
97264
96180
|
};
|
|
97265
96181
|
};
|
|
97266
96182
|
|
|
97267
|
-
// src/devtools/parties.ts
|
|
97268
|
-
var
|
|
97269
|
-
var subscribeToParties = ({ echo }, { partyKeys = [] }) => new
|
|
96183
|
+
// src/packlets/devtools/parties.ts
|
|
96184
|
+
var import_codec_protobuf7 = require("@dxos/codec-protobuf");
|
|
96185
|
+
var subscribeToParties = ({ echo }, { partyKeys = [] }) => new import_codec_protobuf7.Stream(({ next }) => {
|
|
97270
96186
|
const update = () => {
|
|
97271
96187
|
const { value: parties } = echo.queryParties();
|
|
97272
96188
|
const filteredParties = parties.filter((party) => !(partyKeys == null ? void 0 : partyKeys.length) || partyKeys.some((partyKey) => partyKey.equals(party.key)));
|
|
@@ -97315,15 +96231,15 @@ var savePartySnapshot = async ({ echo }, request) => {
|
|
|
97315
96231
|
return { snapshot };
|
|
97316
96232
|
};
|
|
97317
96233
|
|
|
97318
|
-
// src/devtools/storage.ts
|
|
96234
|
+
// src/packlets/devtools/storage.ts
|
|
97319
96235
|
var resetStorage = async (hook) => {
|
|
97320
96236
|
await hook.echo.reset();
|
|
97321
96237
|
window.location.reload();
|
|
97322
96238
|
};
|
|
97323
96239
|
|
|
97324
|
-
// src/devtools/devtools-host.ts
|
|
96240
|
+
// src/packlets/devtools/devtools-host.ts
|
|
97325
96241
|
var createDevtoolsHost = (context, events) => ({
|
|
97326
|
-
events: () => new
|
|
96242
|
+
events: () => new import_codec_protobuf8.Stream(({ next }) => {
|
|
97327
96243
|
events.ready.on(() => {
|
|
97328
96244
|
next({ ready: {} });
|
|
97329
96245
|
});
|
|
@@ -97360,18 +96276,25 @@ var createDevtoolsHost = (context, events) => ({
|
|
|
97360
96276
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo(context)
|
|
97361
96277
|
});
|
|
97362
96278
|
|
|
97363
|
-
// src/devtools/devtools-host-events.ts
|
|
97364
|
-
var
|
|
96279
|
+
// src/packlets/devtools/devtools-host-events.ts
|
|
96280
|
+
var import_async2 = require("@dxos/async");
|
|
97365
96281
|
var DevtoolsHostEvents = class {
|
|
97366
96282
|
constructor() {
|
|
97367
|
-
this.ready = new
|
|
96283
|
+
this.ready = new import_async2.Event();
|
|
97368
96284
|
}
|
|
97369
96285
|
};
|
|
97370
96286
|
|
|
97371
|
-
// src/
|
|
97372
|
-
var
|
|
96287
|
+
// src/packlets/proxy/client-proxy.ts
|
|
96288
|
+
var import_debug7 = __toESM(require("debug"));
|
|
96289
|
+
var import_node_assert4 = __toESM(require_assert());
|
|
96290
|
+
var import_async7 = require("@dxos/async");
|
|
96291
|
+
var import_config2 = require("@dxos/config");
|
|
96292
|
+
var import_debug8 = require("@dxos/debug");
|
|
96293
|
+
|
|
96294
|
+
// src/packlets/proxy/devtools.ts
|
|
96295
|
+
var import_debug3 = __toESM(require("debug"));
|
|
97373
96296
|
var import_rpc2 = require("@dxos/rpc");
|
|
97374
|
-
var log = (0,
|
|
96297
|
+
var log = (0, import_debug3.default)("dxos:client:devtools");
|
|
97375
96298
|
var error = log.extend("error");
|
|
97376
96299
|
var port = {
|
|
97377
96300
|
send: async (message) => window.postMessage({
|
|
@@ -97418,273 +96341,38 @@ var createDevtoolsRpcServer = async (client, serviceHost) => {
|
|
|
97418
96341
|
};
|
|
97419
96342
|
};
|
|
97420
96343
|
|
|
97421
|
-
// src/
|
|
97422
|
-
var
|
|
97423
|
-
var import_level_js = __toESM(require("level-js"));
|
|
97424
|
-
var import_memdown = __toESM(require("memdown"));
|
|
97425
|
-
var import_config2 = require("@dxos/config");
|
|
97426
|
-
var import_random_access_multi_storage = require("@dxos/random-access-multi-storage");
|
|
97427
|
-
var StorageDriver = import_config2.defs.Runtime.Client.Storage.StorageDriver;
|
|
97428
|
-
var createStorageObjects = (config) => {
|
|
97429
|
-
const {
|
|
97430
|
-
path = "dxos/storage",
|
|
97431
|
-
storageType,
|
|
97432
|
-
keyStorage,
|
|
97433
|
-
persistent = false
|
|
97434
|
-
} = config != null ? config : {};
|
|
97435
|
-
if (persistent && storageType === StorageDriver.RAM) {
|
|
97436
|
-
throw new InvalidConfigurationError("RAM storage cannot be used in persistent mode.");
|
|
97437
|
-
}
|
|
97438
|
-
if (!persistent && (storageType !== void 0 && storageType !== StorageDriver.RAM)) {
|
|
97439
|
-
throw new InvalidConfigurationError("Cannot use a persistent storage in not persistent mode.");
|
|
97440
|
-
}
|
|
97441
|
-
if (persistent && keyStorage === StorageDriver.RAM) {
|
|
97442
|
-
throw new InvalidConfigurationError("RAM key storage cannot be used in persistent mode.");
|
|
97443
|
-
}
|
|
97444
|
-
if (!persistent && (keyStorage !== StorageDriver.RAM && keyStorage !== void 0)) {
|
|
97445
|
-
throw new InvalidConfigurationError("Cannot use a persistent key storage in not persistent mode.");
|
|
97446
|
-
}
|
|
97447
|
-
return {
|
|
97448
|
-
storage: (0, import_random_access_multi_storage.createStorage)(`${path}/`, persistent ? toStorageType(storageType) : import_random_access_multi_storage.StorageType.RAM),
|
|
97449
|
-
keyStorage: createKeyStorage(`${path}/keystore`, persistent ? toKeyStorageType(keyStorage) : "ram")
|
|
97450
|
-
};
|
|
97451
|
-
};
|
|
97452
|
-
var createKeyStorage = (path, type) => {
|
|
97453
|
-
const defaultedType = type != null ? type : isNode() ? "jsondown" : "leveljs";
|
|
97454
|
-
switch (defaultedType) {
|
|
97455
|
-
case "leveljs":
|
|
97456
|
-
return (0, import_level_js.default)(path);
|
|
97457
|
-
case "jsondown":
|
|
97458
|
-
return (0, import_jsondown.default)(path);
|
|
97459
|
-
case "ram":
|
|
97460
|
-
return (0, import_memdown.default)();
|
|
97461
|
-
default:
|
|
97462
|
-
throw new InvalidConfigurationError(`Invalid key storage type: ${defaultedType}`);
|
|
97463
|
-
}
|
|
97464
|
-
};
|
|
97465
|
-
var toStorageType = (type) => {
|
|
97466
|
-
switch (type) {
|
|
97467
|
-
case void 0:
|
|
97468
|
-
return void 0;
|
|
97469
|
-
case StorageDriver.RAM:
|
|
97470
|
-
return import_random_access_multi_storage.StorageType.RAM;
|
|
97471
|
-
case StorageDriver.CHROME:
|
|
97472
|
-
return import_random_access_multi_storage.StorageType.CHROME;
|
|
97473
|
-
case StorageDriver.FIREFOX:
|
|
97474
|
-
return import_random_access_multi_storage.StorageType.FIREFOX;
|
|
97475
|
-
case StorageDriver.IDB:
|
|
97476
|
-
return import_random_access_multi_storage.StorageType.IDB;
|
|
97477
|
-
case StorageDriver.NODE:
|
|
97478
|
-
return import_random_access_multi_storage.StorageType.NODE;
|
|
97479
|
-
default:
|
|
97480
|
-
throw new Error(`Invalid storage type: ${StorageDriver[type]}`);
|
|
97481
|
-
}
|
|
97482
|
-
};
|
|
97483
|
-
var toKeyStorageType = (type) => {
|
|
97484
|
-
switch (type) {
|
|
97485
|
-
case void 0:
|
|
97486
|
-
return void 0;
|
|
97487
|
-
case StorageDriver.RAM:
|
|
97488
|
-
return "ram";
|
|
97489
|
-
case StorageDriver.LEVELJS:
|
|
97490
|
-
return "leveljs";
|
|
97491
|
-
case StorageDriver.JSONDOWN:
|
|
97492
|
-
return "jsondown";
|
|
97493
|
-
default:
|
|
97494
|
-
throw new Error(`Invalid key storage type: ${StorageDriver[type]}`);
|
|
97495
|
-
}
|
|
97496
|
-
};
|
|
97497
|
-
|
|
97498
|
-
// src/services/service-host.ts
|
|
97499
|
-
var ClientServiceHost = class {
|
|
97500
|
-
constructor(_config, _options) {
|
|
97501
|
-
this._config = _config;
|
|
97502
|
-
this._options = _options;
|
|
97503
|
-
this._devtoolsEvents = new DevtoolsHostEvents();
|
|
97504
|
-
const { storage, keyStorage } = createStorageObjects(this._config.get("runtime.client.storage", {}));
|
|
97505
|
-
this._echo = new import_echo_db4.ECHO({
|
|
97506
|
-
storage,
|
|
97507
|
-
keyStorage,
|
|
97508
|
-
networkManagerOptions: {
|
|
97509
|
-
signal: this._config.get("runtime.services.signal.server") ? [this._config.get("runtime.services.signal.server")] : void 0,
|
|
97510
|
-
ice: this._config.get("runtime.services.ice"),
|
|
97511
|
-
log: true
|
|
97512
|
-
},
|
|
97513
|
-
snapshots: this._config.get("runtime.client.enableSnapshots", false),
|
|
97514
|
-
snapshotInterval: this._config.get("runtime.client.snapshotInterval")
|
|
97515
|
-
});
|
|
97516
|
-
this._services = {
|
|
97517
|
-
...createServices({ config: this._config, echo: this._echo, signer: this._options.signer }),
|
|
97518
|
-
DevtoolsHost: this._createDevtoolsService()
|
|
97519
|
-
};
|
|
97520
|
-
}
|
|
97521
|
-
get services() {
|
|
97522
|
-
return this._services;
|
|
97523
|
-
}
|
|
97524
|
-
async open(onProgressCallback) {
|
|
97525
|
-
await this._echo.open(onProgressCallback);
|
|
97526
|
-
this._devtoolsEvents.ready.emit();
|
|
97527
|
-
}
|
|
97528
|
-
async close() {
|
|
97529
|
-
await this._echo.close();
|
|
97530
|
-
}
|
|
97531
|
-
get echo() {
|
|
97532
|
-
return this._echo;
|
|
97533
|
-
}
|
|
97534
|
-
_createDevtoolsService() {
|
|
97535
|
-
const dependencies = {
|
|
97536
|
-
config: this._config,
|
|
97537
|
-
echo: this._echo,
|
|
97538
|
-
feedStore: this._echo.feedStore,
|
|
97539
|
-
networkManager: this._echo.networkManager,
|
|
97540
|
-
modelFactory: this._echo.modelFactory,
|
|
97541
|
-
keyring: this._echo.halo.keyring,
|
|
97542
|
-
debug: debug2
|
|
97543
|
-
};
|
|
97544
|
-
return createDevtoolsHost(dependencies, this._devtoolsEvents);
|
|
97545
|
-
}
|
|
97546
|
-
};
|
|
97547
|
-
|
|
97548
|
-
// src/services/service-proxy.ts
|
|
96344
|
+
// src/packlets/proxy/echo-proxy.ts
|
|
96345
|
+
var import_node_assert3 = __toESM(require_assert());
|
|
97549
96346
|
var import_async5 = require("@dxos/async");
|
|
97550
|
-
var
|
|
97551
|
-
var
|
|
97552
|
-
constructor(port2, _timeout = 300) {
|
|
97553
|
-
this._timeout = _timeout;
|
|
97554
|
-
this._client = (0, import_rpc3.createBundledRpcClient)(clientServiceBundle, {
|
|
97555
|
-
port: port2
|
|
97556
|
-
});
|
|
97557
|
-
this.services = this._client.rpc;
|
|
97558
|
-
}
|
|
97559
|
-
async open(onProgressCallback) {
|
|
97560
|
-
await (0, import_async5.promiseTimeout)(this._client.open(), this._timeout, new RemoteServiceConnectionTimeout());
|
|
97561
|
-
}
|
|
97562
|
-
async close() {
|
|
97563
|
-
this._client.close();
|
|
97564
|
-
}
|
|
97565
|
-
};
|
|
97566
|
-
|
|
97567
|
-
// src/api/client.ts
|
|
97568
|
-
var import_debug8 = __toESM(require("debug"));
|
|
97569
|
-
var import_node_assert7 = __toESM(require_assert());
|
|
97570
|
-
var import_async10 = require("@dxos/async");
|
|
97571
|
-
var import_config3 = require("@dxos/config");
|
|
97572
|
-
var import_debug9 = require("@dxos/debug");
|
|
97573
|
-
|
|
97574
|
-
// src/proto/gen/dxos/config.ts
|
|
97575
|
-
var Runtime;
|
|
97576
|
-
((Runtime2) => {
|
|
97577
|
-
let Client2;
|
|
97578
|
-
((Client3) => {
|
|
97579
|
-
let Mode;
|
|
97580
|
-
((Mode2) => {
|
|
97581
|
-
Mode2[Mode2["AUTOMATIC"] = 0] = "AUTOMATIC";
|
|
97582
|
-
Mode2[Mode2["LOCAL"] = 1] = "LOCAL";
|
|
97583
|
-
Mode2[Mode2["REMOTE"] = 2] = "REMOTE";
|
|
97584
|
-
})(Mode = Client3.Mode || (Client3.Mode = {}));
|
|
97585
|
-
let Storage;
|
|
97586
|
-
((Storage2) => {
|
|
97587
|
-
let StorageDriver2;
|
|
97588
|
-
((StorageDriver3) => {
|
|
97589
|
-
StorageDriver3[StorageDriver3["RAM"] = 0] = "RAM";
|
|
97590
|
-
StorageDriver3[StorageDriver3["IDB"] = 1] = "IDB";
|
|
97591
|
-
StorageDriver3[StorageDriver3["CHROME"] = 2] = "CHROME";
|
|
97592
|
-
StorageDriver3[StorageDriver3["FIREFOX"] = 3] = "FIREFOX";
|
|
97593
|
-
StorageDriver3[StorageDriver3["NODE"] = 4] = "NODE";
|
|
97594
|
-
StorageDriver3[StorageDriver3["LEVELJS"] = 11] = "LEVELJS";
|
|
97595
|
-
StorageDriver3[StorageDriver3["JSONDOWN"] = 12] = "JSONDOWN";
|
|
97596
|
-
})(StorageDriver2 = Storage2.StorageDriver || (Storage2.StorageDriver = {}));
|
|
97597
|
-
})(Storage = Client3.Storage || (Client3.Storage = {}));
|
|
97598
|
-
})(Client2 = Runtime2.Client || (Runtime2.Client = {}));
|
|
97599
|
-
})(Runtime || (Runtime = {}));
|
|
97600
|
-
|
|
97601
|
-
// src/version.ts
|
|
97602
|
-
var DXOS_VERSION = "2.33.8";
|
|
97603
|
-
|
|
97604
|
-
// src/api/errors.ts
|
|
97605
|
-
var import_debug3 = require("@dxos/debug");
|
|
97606
|
-
var InvalidConfigurationError = class extends import_debug3.DXOSError {
|
|
97607
|
-
constructor(message) {
|
|
97608
|
-
super("INVALID_CONFIGURATION", message);
|
|
97609
|
-
}
|
|
97610
|
-
};
|
|
97611
|
-
var RemoteServiceConnectionTimeout = class extends import_debug3.DXOSError {
|
|
97612
|
-
constructor(message) {
|
|
97613
|
-
super("REMOTE_SERVICE_CONNECTION_TIMEOUT", message);
|
|
97614
|
-
}
|
|
97615
|
-
};
|
|
97616
|
-
|
|
97617
|
-
// src/api/proxies/echo-proxy.ts
|
|
97618
|
-
var import_node_assert6 = __toESM(require_assert());
|
|
97619
|
-
var import_async8 = require("@dxos/async");
|
|
97620
|
-
var import_debug7 = require("@dxos/debug");
|
|
97621
|
-
var import_echo_db7 = __toESM(require_src14());
|
|
96347
|
+
var import_debug6 = require("@dxos/debug");
|
|
96348
|
+
var import_echo_db3 = __toESM(require_src14());
|
|
97622
96349
|
var import_model_factory = require("@dxos/model-factory");
|
|
97623
96350
|
var import_object_model = __toESM(require_src8());
|
|
97624
|
-
var
|
|
96351
|
+
var import_util2 = require("@dxos/util");
|
|
97625
96352
|
|
|
97626
|
-
// src/
|
|
97627
|
-
var
|
|
97628
|
-
var
|
|
97629
|
-
var import_debug5 = require("@dxos/debug");
|
|
97630
|
-
var import_echo_db5 = __toESM(require_src14());
|
|
97631
|
-
var import_rpc4 = require("@dxos/rpc");
|
|
97632
|
-
|
|
97633
|
-
// src/api/invitations/invitation-request.ts
|
|
97634
|
-
var import_node_assert4 = __toESM(require_assert());
|
|
97635
|
-
var import_async6 = require("@dxos/async");
|
|
96353
|
+
// src/packlets/proxy/invitation-proxy.ts
|
|
96354
|
+
var import_node_assert2 = __toESM(require_assert());
|
|
96355
|
+
var import_async3 = require("@dxos/async");
|
|
97636
96356
|
var import_debug4 = require("@dxos/debug");
|
|
97637
|
-
var
|
|
97638
|
-
|
|
97639
|
-
this._descriptor = _descriptor;
|
|
97640
|
-
this._hasConnected = false;
|
|
97641
|
-
this._isCanceled = false;
|
|
97642
|
-
this.canceled = new import_async6.Event();
|
|
97643
|
-
this.connected = connected;
|
|
97644
|
-
this.finished = finished;
|
|
97645
|
-
this.error = error2;
|
|
97646
|
-
this.connected.on(() => {
|
|
97647
|
-
this._hasConnected = true;
|
|
97648
|
-
});
|
|
97649
|
-
}
|
|
97650
|
-
get descriptor() {
|
|
97651
|
-
return this._descriptor;
|
|
97652
|
-
}
|
|
97653
|
-
get secret() {
|
|
97654
|
-
var _a;
|
|
97655
|
-
return (_a = this._descriptor.secret) != null ? _a : (0, import_debug4.raise)(new Error("Invitation secret is not set"));
|
|
97656
|
-
}
|
|
97657
|
-
get hasConnected() {
|
|
97658
|
-
return this._hasConnected;
|
|
97659
|
-
}
|
|
97660
|
-
cancel() {
|
|
97661
|
-
(0, import_node_assert4.default)(!this._isCanceled, new Error("Invitation is already canceled"));
|
|
97662
|
-
this._isCanceled = true;
|
|
97663
|
-
this.canceled.emit();
|
|
97664
|
-
}
|
|
97665
|
-
toString() {
|
|
97666
|
-
return `InvitationRequest(${JSON.stringify(this._descriptor.toQueryParameters())})`;
|
|
97667
|
-
}
|
|
97668
|
-
};
|
|
97669
|
-
|
|
97670
|
-
// src/api/invitations/invitation-proxy.ts
|
|
96357
|
+
var import_echo_db = __toESM(require_src14());
|
|
96358
|
+
var import_rpc3 = require("@dxos/rpc");
|
|
97671
96359
|
var InvitationProxy = class {
|
|
97672
96360
|
constructor() {
|
|
97673
96361
|
this.activeInvitations = [];
|
|
97674
|
-
this.invitationsUpdate = new
|
|
96362
|
+
this.invitationsUpdate = new import_async3.Event();
|
|
97675
96363
|
}
|
|
97676
96364
|
async createInvitationRequest({ stream }) {
|
|
97677
96365
|
return new Promise((resolve, reject) => {
|
|
97678
|
-
const connected = new
|
|
97679
|
-
const finished = new
|
|
97680
|
-
const error2 = new
|
|
96366
|
+
const connected = new import_async3.Event();
|
|
96367
|
+
const finished = new import_async3.Event();
|
|
96368
|
+
const error2 = new import_async3.Event();
|
|
97681
96369
|
let invitation;
|
|
97682
96370
|
connected.on(() => this.invitationsUpdate.emit());
|
|
97683
96371
|
stream.subscribe((invitationMsg) => {
|
|
97684
96372
|
if (!invitation) {
|
|
97685
|
-
(0,
|
|
97686
|
-
const descriptor =
|
|
97687
|
-
invitation = new
|
|
96373
|
+
(0, import_node_assert2.default)(invitationMsg.descriptor, "Missing invitation descriptor.");
|
|
96374
|
+
const descriptor = import_echo_db.InvitationDescriptor.fromProto(invitationMsg.descriptor);
|
|
96375
|
+
invitation = new InvitationRequest(descriptor, connected, finished, error2);
|
|
97688
96376
|
invitation.canceled.on(() => this._removeInvitation(invitation));
|
|
97689
96377
|
this.activeInvitations.push(invitation);
|
|
97690
96378
|
this.invitationsUpdate.emit();
|
|
@@ -97699,7 +96387,7 @@ var InvitationProxy = class {
|
|
|
97699
96387
|
stream.close();
|
|
97700
96388
|
}
|
|
97701
96389
|
if (invitationMsg.state === 4 /* ERROR */) {
|
|
97702
|
-
(0,
|
|
96390
|
+
(0, import_node_assert2.default)(invitationMsg.error, "Unknown error.");
|
|
97703
96391
|
const err = new Error(invitationMsg.error);
|
|
97704
96392
|
reject(err);
|
|
97705
96393
|
error2.emit(err);
|
|
@@ -97718,24 +96406,24 @@ var InvitationProxy = class {
|
|
|
97718
96406
|
this.invitationsUpdate.emit();
|
|
97719
96407
|
}
|
|
97720
96408
|
static handleInvitationRedemption({ stream, invitationDescriptor, onAuthenticate }) {
|
|
97721
|
-
const [getInvitationProcess, resolveInvitationProcess] = (0,
|
|
97722
|
-
const [waitForFinish, resolveFinish] = (0,
|
|
96409
|
+
const [getInvitationProcess, resolveInvitationProcess] = (0, import_async3.trigger)();
|
|
96410
|
+
const [waitForFinish, resolveFinish] = (0, import_async3.trigger)();
|
|
97723
96411
|
stream.subscribe(async (process2) => {
|
|
97724
96412
|
resolveInvitationProcess(process2);
|
|
97725
96413
|
if (process2.state === 3 /* SUCCESS */) {
|
|
97726
96414
|
resolveFinish(process2);
|
|
97727
96415
|
} else if (process2.state === 4 /* ERROR */) {
|
|
97728
|
-
(0,
|
|
96416
|
+
(0, import_node_assert2.default)(process2.error);
|
|
97729
96417
|
const error2 = new Error(process2.error);
|
|
97730
|
-
(0,
|
|
96418
|
+
(0, import_debug4.throwUnhandledRejection)(error2);
|
|
97731
96419
|
}
|
|
97732
96420
|
}, (err) => {
|
|
97733
|
-
if (err && !(err instanceof
|
|
97734
|
-
(0,
|
|
96421
|
+
if (err && !(err instanceof import_rpc3.RpcClosedError)) {
|
|
96422
|
+
(0, import_debug4.throwUnhandledRejection)(err);
|
|
97735
96423
|
}
|
|
97736
96424
|
});
|
|
97737
96425
|
const authenticate = async (secret) => {
|
|
97738
|
-
if (invitationDescriptor.type ===
|
|
96426
|
+
if (invitationDescriptor.type === import_echo_db.InvitationDescriptorType.OFFLINE) {
|
|
97739
96427
|
throw new Error("Cannot authenticate offline invitation.");
|
|
97740
96428
|
}
|
|
97741
96429
|
const invitationProcess = await getInvitationProcess();
|
|
@@ -97744,7 +96432,7 @@ var InvitationProxy = class {
|
|
|
97744
96432
|
secret
|
|
97745
96433
|
});
|
|
97746
96434
|
};
|
|
97747
|
-
if (invitationDescriptor.secret && invitationDescriptor.type ===
|
|
96435
|
+
if (invitationDescriptor.secret && invitationDescriptor.type === import_echo_db.InvitationDescriptorType.INTERACTIVE) {
|
|
97748
96436
|
void authenticate(invitationDescriptor.secret);
|
|
97749
96437
|
}
|
|
97750
96438
|
return {
|
|
@@ -97754,30 +96442,30 @@ var InvitationProxy = class {
|
|
|
97754
96442
|
}
|
|
97755
96443
|
};
|
|
97756
96444
|
|
|
97757
|
-
// src/
|
|
97758
|
-
var
|
|
97759
|
-
|
|
97760
|
-
|
|
97761
|
-
|
|
97762
|
-
|
|
97763
|
-
|
|
97764
|
-
|
|
97765
|
-
|
|
97766
|
-
|
|
97767
|
-
|
|
97768
|
-
|
|
96445
|
+
// src/packlets/proxy/party-proxy.ts
|
|
96446
|
+
var import_debug5 = require("@dxos/debug");
|
|
96447
|
+
var import_echo_db2 = __toESM(require_src14());
|
|
96448
|
+
|
|
96449
|
+
// src/packlets/proxy/service-proxy.ts
|
|
96450
|
+
var import_async4 = require("@dxos/async");
|
|
96451
|
+
var import_rpc4 = require("@dxos/rpc");
|
|
96452
|
+
var ClientServiceProxy = class {
|
|
96453
|
+
constructor(port2, _timeout = 300) {
|
|
96454
|
+
this._timeout = _timeout;
|
|
96455
|
+
this._client = (0, import_rpc4.createBundledRpcClient)(clientServiceBundle, {
|
|
96456
|
+
port: port2
|
|
96457
|
+
});
|
|
96458
|
+
this.services = this._client.rpc;
|
|
97769
96459
|
}
|
|
97770
|
-
|
|
97771
|
-
|
|
96460
|
+
async open(onProgressCallback) {
|
|
96461
|
+
await (0, import_async4.promiseTimeout)(this._client.open(), this._timeout, new RemoteServiceConnectionTimeout());
|
|
97772
96462
|
}
|
|
97773
|
-
|
|
97774
|
-
|
|
96463
|
+
async close() {
|
|
96464
|
+
this._client.close();
|
|
97775
96465
|
}
|
|
97776
96466
|
};
|
|
97777
96467
|
|
|
97778
|
-
// src/
|
|
97779
|
-
var import_debug6 = require("@dxos/debug");
|
|
97780
|
-
var import_echo_db6 = __toESM(require_src14());
|
|
96468
|
+
// src/packlets/proxy/party-proxy.ts
|
|
97781
96469
|
var PartyProxy = class {
|
|
97782
96470
|
constructor(_serviceProvider, _modelFactory, party, memberKey) {
|
|
97783
96471
|
this._serviceProvider = _serviceProvider;
|
|
@@ -97791,9 +96479,9 @@ var PartyProxy = class {
|
|
|
97791
96479
|
return;
|
|
97792
96480
|
}
|
|
97793
96481
|
if (this._serviceProvider instanceof ClientServiceProxy) {
|
|
97794
|
-
this._database = new
|
|
97795
|
-
} else if (this._serviceProvider
|
|
97796
|
-
const party2 = (_a = this._serviceProvider.echo.getParty(this._key)) != null ? _a : (0,
|
|
96482
|
+
this._database = new import_echo_db2.Database(this._modelFactory, new import_echo_db2.RemoteDatabaseBackend(this._serviceProvider.services.DataService, this._key), memberKey);
|
|
96483
|
+
} else if (this._serviceProvider.echo) {
|
|
96484
|
+
const party2 = (_a = this._serviceProvider.echo.getParty(this._key)) != null ? _a : (0, import_debug5.failUndefined)();
|
|
97797
96485
|
this._database = party2.database;
|
|
97798
96486
|
} else {
|
|
97799
96487
|
throw new Error("Unrecognized service provider.");
|
|
@@ -97828,7 +96516,7 @@ var PartyProxy = class {
|
|
|
97828
96516
|
if (this._database && this._serviceProvider instanceof ClientServiceProxy) {
|
|
97829
96517
|
await this._database.initialize();
|
|
97830
96518
|
}
|
|
97831
|
-
this._item = await ((_a = this._database) == null ? void 0 : _a.waitForItem({ type:
|
|
96519
|
+
this._item = await ((_a = this._database) == null ? void 0 : _a.waitForItem({ type: import_echo_db2.PARTY_ITEM_TYPE }));
|
|
97832
96520
|
}
|
|
97833
96521
|
async destroy() {
|
|
97834
96522
|
if (this._database && this._serviceProvider instanceof ClientServiceProxy) {
|
|
@@ -97863,10 +96551,10 @@ var PartyProxy = class {
|
|
|
97863
96551
|
return this._item.model;
|
|
97864
96552
|
}
|
|
97865
96553
|
async setTitle(title) {
|
|
97866
|
-
await this.setProperty(
|
|
96554
|
+
await this.setProperty(import_echo_db2.PARTY_TITLE_PROPERTY, title);
|
|
97867
96555
|
}
|
|
97868
96556
|
getTitle() {
|
|
97869
|
-
return this.getProperty(
|
|
96557
|
+
return this.getProperty(import_echo_db2.PARTY_TITLE_PROPERTY);
|
|
97870
96558
|
}
|
|
97871
96559
|
async setProperty(key, value) {
|
|
97872
96560
|
await this.properties.set(key, value);
|
|
@@ -97875,7 +96563,7 @@ var PartyProxy = class {
|
|
|
97875
96563
|
return this.properties.get(key, defaultValue);
|
|
97876
96564
|
}
|
|
97877
96565
|
queryMembers() {
|
|
97878
|
-
return streamToResultSet(this._serviceProvider.services.PartyService.subscribeMembers({ partyKey: this.key }), (response) => {
|
|
96566
|
+
return (0, import_echo_db2.streamToResultSet)(this._serviceProvider.services.PartyService.subscribeMembers({ partyKey: this.key }), (response) => {
|
|
97879
96567
|
var _a;
|
|
97880
96568
|
return (_a = response == null ? void 0 : response.members) != null ? _a : [];
|
|
97881
96569
|
});
|
|
@@ -97894,35 +96582,30 @@ var PartyProxy = class {
|
|
|
97894
96582
|
}
|
|
97895
96583
|
};
|
|
97896
96584
|
|
|
97897
|
-
// src/
|
|
97898
|
-
var PartyInvitation = class extends Invitation {
|
|
97899
|
-
getParty() {
|
|
97900
|
-
return this.wait();
|
|
97901
|
-
}
|
|
97902
|
-
};
|
|
96585
|
+
// src/packlets/proxy/echo-proxy.ts
|
|
97903
96586
|
var EchoProxy = class {
|
|
97904
96587
|
constructor(_serviceProvider, _haloProxy) {
|
|
97905
96588
|
this._serviceProvider = _serviceProvider;
|
|
97906
96589
|
this._haloProxy = _haloProxy;
|
|
97907
|
-
this._parties = new
|
|
97908
|
-
this._partiesChanged = new
|
|
97909
|
-
this._subscriptions = new
|
|
97910
|
-
this._modelFactory = _serviceProvider instanceof
|
|
96590
|
+
this._parties = new import_util2.ComplexMap((key) => key.toHex());
|
|
96591
|
+
this._partiesChanged = new import_async5.Event();
|
|
96592
|
+
this._subscriptions = new import_util2.SubscriptionGroup();
|
|
96593
|
+
this._modelFactory = _serviceProvider instanceof ClientServiceProxy ? new import_model_factory.ModelFactory() : _serviceProvider.echo.modelFactory;
|
|
97911
96594
|
this._modelFactory.registerModel(import_object_model.ObjectModel);
|
|
97912
96595
|
}
|
|
97913
96596
|
toString() {
|
|
97914
|
-
return `EchoProxy(${JSON.stringify(this.info
|
|
96597
|
+
return `EchoProxy(${JSON.stringify(this.info)})`;
|
|
97915
96598
|
}
|
|
97916
96599
|
get modelFactory() {
|
|
97917
96600
|
return this._modelFactory;
|
|
97918
96601
|
}
|
|
97919
96602
|
get networkManager() {
|
|
97920
|
-
if (this._serviceProvider instanceof
|
|
97921
|
-
|
|
96603
|
+
if (this._serviceProvider instanceof ClientServiceProxy) {
|
|
96604
|
+
throw new Error("Network Manager not available in service proxy.");
|
|
97922
96605
|
}
|
|
97923
|
-
|
|
96606
|
+
return this._serviceProvider.echo.networkManager;
|
|
97924
96607
|
}
|
|
97925
|
-
info() {
|
|
96608
|
+
get info() {
|
|
97926
96609
|
return {
|
|
97927
96610
|
parties: this._parties.size
|
|
97928
96611
|
};
|
|
@@ -97943,7 +96626,7 @@ var EchoProxy = class {
|
|
|
97943
96626
|
await partyProxy.initialize();
|
|
97944
96627
|
this._parties.set(partyProxy.key, partyProxy);
|
|
97945
96628
|
partyProxy.database.entityUpdate.on((entity) => {
|
|
97946
|
-
if (entity.type ===
|
|
96629
|
+
if (entity.type === import_echo_db3.PARTY_ITEM_TYPE) {
|
|
97947
96630
|
this._partiesChanged.emit();
|
|
97948
96631
|
}
|
|
97949
96632
|
});
|
|
@@ -97970,7 +96653,7 @@ var EchoProxy = class {
|
|
|
97970
96653
|
await this._subscriptions.unsubscribe();
|
|
97971
96654
|
}
|
|
97972
96655
|
async createParty() {
|
|
97973
|
-
const [partyReceivedPromise, partyReceived] = (0,
|
|
96656
|
+
const [partyReceivedPromise, partyReceived] = (0, import_async5.latch)();
|
|
97974
96657
|
const party = await this._serviceProvider.services.PartyService.createParty();
|
|
97975
96658
|
const handler = () => {
|
|
97976
96659
|
if (this._parties.has(party.publicKey)) {
|
|
@@ -97984,7 +96667,7 @@ var EchoProxy = class {
|
|
|
97984
96667
|
return this._parties.get(party.publicKey);
|
|
97985
96668
|
}
|
|
97986
96669
|
async cloneParty(snapshot) {
|
|
97987
|
-
const [partyReceivedPromise, partyReceived] = (0,
|
|
96670
|
+
const [partyReceivedPromise, partyReceived] = (0, import_async5.latch)();
|
|
97988
96671
|
const party = await this._serviceProvider.services.PartyService.cloneParty(snapshot);
|
|
97989
96672
|
const handler = () => {
|
|
97990
96673
|
if (this._parties.has(party.publicKey)) {
|
|
@@ -98001,7 +96684,7 @@ var EchoProxy = class {
|
|
|
98001
96684
|
return this._parties.get(partyKey);
|
|
98002
96685
|
}
|
|
98003
96686
|
queryParties() {
|
|
98004
|
-
return new
|
|
96687
|
+
return new import_echo_db3.ResultSet(this._partiesChanged, () => Array.from(this._parties.values()));
|
|
98005
96688
|
}
|
|
98006
96689
|
acceptInvitation(invitationDescriptor) {
|
|
98007
96690
|
const invitationProcessStream = this._serviceProvider.services.PartyService.acceptInvitation(invitationDescriptor.toProto());
|
|
@@ -98015,32 +96698,32 @@ var EchoProxy = class {
|
|
|
98015
96698
|
const waitForParty = async () => {
|
|
98016
96699
|
var _a;
|
|
98017
96700
|
const process2 = await waitForFinish();
|
|
98018
|
-
(0,
|
|
96701
|
+
(0, import_node_assert3.default)(process2.partyKey);
|
|
98019
96702
|
await this._partiesChanged.waitForCondition(() => this._parties.has(process2.partyKey));
|
|
98020
|
-
return (_a = this.getParty(process2.partyKey)) != null ? _a : (0,
|
|
96703
|
+
return (_a = this.getParty(process2.partyKey)) != null ? _a : (0, import_debug6.failUndefined)();
|
|
98021
96704
|
};
|
|
98022
96705
|
return new PartyInvitation(invitationDescriptor, waitForParty(), authenticate);
|
|
98023
96706
|
}
|
|
98024
96707
|
};
|
|
98025
96708
|
|
|
98026
|
-
// src/
|
|
98027
|
-
var
|
|
98028
|
-
var
|
|
98029
|
-
var
|
|
98030
|
-
var
|
|
96709
|
+
// src/packlets/proxy/halo-proxy.ts
|
|
96710
|
+
var import_async6 = require("@dxos/async");
|
|
96711
|
+
var import_credentials2 = __toESM(require_src5());
|
|
96712
|
+
var import_echo_db4 = __toESM(require_src14());
|
|
96713
|
+
var import_util3 = require("@dxos/util");
|
|
98031
96714
|
var HaloProxy = class {
|
|
98032
96715
|
constructor(_serviceProvider) {
|
|
98033
96716
|
this._serviceProvider = _serviceProvider;
|
|
98034
96717
|
this._invitationProxy = new InvitationProxy();
|
|
98035
|
-
this._subscriptions = new
|
|
98036
|
-
this._contactsChanged = new
|
|
98037
|
-
this.profileChanged = new
|
|
96718
|
+
this._subscriptions = new import_util3.SubscriptionGroup();
|
|
96719
|
+
this._contactsChanged = new import_async6.Event();
|
|
96720
|
+
this.profileChanged = new import_async6.Event();
|
|
98038
96721
|
this._contacts = [];
|
|
98039
96722
|
}
|
|
98040
96723
|
toString() {
|
|
98041
|
-
return `HaloProxy(${JSON.stringify(this.info
|
|
96724
|
+
return `HaloProxy(${JSON.stringify(this.info)})`;
|
|
98042
96725
|
}
|
|
98043
|
-
info() {
|
|
96726
|
+
get info() {
|
|
98044
96727
|
var _a;
|
|
98045
96728
|
return {
|
|
98046
96729
|
key: (_a = this._profile) == null ? void 0 : _a.publicKey
|
|
@@ -98065,7 +96748,7 @@ var HaloProxy = class {
|
|
|
98065
96748
|
throw new Error("Seedphrase must not be specified with existing keys");
|
|
98066
96749
|
}
|
|
98067
96750
|
if (seedphrase) {
|
|
98068
|
-
const keyPair = (0,
|
|
96751
|
+
const keyPair = (0, import_credentials2.keyPairFromSeedPhrase)(seedphrase);
|
|
98069
96752
|
publicKey = keyPair.publicKey;
|
|
98070
96753
|
secretKey = keyPair.secretKey;
|
|
98071
96754
|
}
|
|
@@ -98077,7 +96760,7 @@ var HaloProxy = class {
|
|
|
98077
96760
|
return this._profile;
|
|
98078
96761
|
}
|
|
98079
96762
|
queryContacts() {
|
|
98080
|
-
return new
|
|
96763
|
+
return new import_echo_db4.ResultSet(this._contactsChanged, () => this._contacts);
|
|
98081
96764
|
}
|
|
98082
96765
|
async createInvitation() {
|
|
98083
96766
|
const stream = await this._serviceProvider.services.ProfileService.createInvitation();
|
|
@@ -98144,8 +96827,35 @@ var HaloProxy = class {
|
|
|
98144
96827
|
}
|
|
98145
96828
|
};
|
|
98146
96829
|
|
|
98147
|
-
// src/
|
|
98148
|
-
var
|
|
96830
|
+
// src/packlets/proxy/messages.ts
|
|
96831
|
+
var import_util4 = require("@dxos/util");
|
|
96832
|
+
var createWindowMessagePort = () => {
|
|
96833
|
+
if ((0, import_util4.isNode)()) {
|
|
96834
|
+
throw new Error("Connecting to wallet extension is not available in Node environment.");
|
|
96835
|
+
}
|
|
96836
|
+
return {
|
|
96837
|
+
send: async (message) => window.postMessage({
|
|
96838
|
+
payloadFromAppToContentScript: Array.from(message)
|
|
96839
|
+
}, "*"),
|
|
96840
|
+
subscribe: (callback) => {
|
|
96841
|
+
const listener = (event) => {
|
|
96842
|
+
var _a;
|
|
96843
|
+
const payload = (_a = event == null ? void 0 : event.data) == null ? void 0 : _a.payloadFromContentScriptToApp;
|
|
96844
|
+
if (payload) {
|
|
96845
|
+
callback(new Uint8Array(payload));
|
|
96846
|
+
}
|
|
96847
|
+
};
|
|
96848
|
+
window.addEventListener("message", listener);
|
|
96849
|
+
return () => window.removeEventListener("message", listener);
|
|
96850
|
+
}
|
|
96851
|
+
};
|
|
96852
|
+
};
|
|
96853
|
+
|
|
96854
|
+
// src/packlets/proxy/version.ts
|
|
96855
|
+
var DXOS_VERSION = "2.33.8";
|
|
96856
|
+
|
|
96857
|
+
// src/packlets/proxy/client-proxy.ts
|
|
96858
|
+
var log2 = (0, import_debug7.default)("dxos:client-proxy");
|
|
98149
96859
|
var EXPECTED_CONFIG_VERSION = 1;
|
|
98150
96860
|
var defaultConfig = { version: 1 };
|
|
98151
96861
|
var defaultTestingConfig = {
|
|
@@ -98153,7 +96863,7 @@ var defaultTestingConfig = {
|
|
|
98153
96863
|
runtime: {
|
|
98154
96864
|
services: {
|
|
98155
96865
|
signal: {
|
|
98156
|
-
server: "ws://localhost:4000"
|
|
96866
|
+
server: "ws://localhost:4000/.well-known/dx/signal"
|
|
98157
96867
|
}
|
|
98158
96868
|
}
|
|
98159
96869
|
}
|
|
@@ -98162,11 +96872,19 @@ var Client = class {
|
|
|
98162
96872
|
constructor(config = defaultConfig, options = {}) {
|
|
98163
96873
|
this.version = DXOS_VERSION;
|
|
98164
96874
|
this._initialized = false;
|
|
96875
|
+
var _a;
|
|
98165
96876
|
if (typeof config !== "object" || config == null) {
|
|
98166
|
-
throw new
|
|
96877
|
+
throw new import_debug8.InvalidParameterError("Invalid config.");
|
|
98167
96878
|
}
|
|
98168
|
-
this._config = config instanceof
|
|
96879
|
+
this._config = config instanceof import_config2.Config ? config : new import_config2.Config(config);
|
|
98169
96880
|
this._options = options;
|
|
96881
|
+
if (options.serviceProvider) {
|
|
96882
|
+
this._serviceProvider = options.serviceProvider;
|
|
96883
|
+
} else {
|
|
96884
|
+
this._serviceProvider = new ClientServiceProxy((_a = this._options.rpcPort) != null ? _a : createWindowMessagePort(), this._options.timeout);
|
|
96885
|
+
}
|
|
96886
|
+
this._halo = new HaloProxy(this._serviceProvider);
|
|
96887
|
+
this._echo = new EchoProxy(this._serviceProvider, this._halo);
|
|
98170
96888
|
if (Object.keys(this._config.values).length > 0 && this._config.values.version !== EXPECTED_CONFIG_VERSION) {
|
|
98171
96889
|
throw new InvalidConfigurationError(`Invalid config version: ${this._config.values.version} !== ${EXPECTED_CONFIG_VERSION}]`);
|
|
98172
96890
|
}
|
|
@@ -98174,13 +96892,13 @@ var Client = class {
|
|
|
98174
96892
|
log2(`mode=${Runtime.Client.Mode[this._mode]}`);
|
|
98175
96893
|
}
|
|
98176
96894
|
toString() {
|
|
98177
|
-
return `Client(${JSON.stringify(this.info
|
|
96895
|
+
return `Client(${JSON.stringify(this.info)})`;
|
|
98178
96896
|
}
|
|
98179
|
-
info() {
|
|
96897
|
+
get info() {
|
|
98180
96898
|
return {
|
|
98181
96899
|
initialized: this.initialized,
|
|
98182
|
-
echo: this.echo.info
|
|
98183
|
-
halo: this.halo.info
|
|
96900
|
+
echo: this.echo.info,
|
|
96901
|
+
halo: this.halo.info
|
|
98184
96902
|
};
|
|
98185
96903
|
}
|
|
98186
96904
|
get config() {
|
|
@@ -98190,16 +96908,13 @@ var Client = class {
|
|
|
98190
96908
|
return this._initialized;
|
|
98191
96909
|
}
|
|
98192
96910
|
get echo() {
|
|
98193
|
-
(0,
|
|
96911
|
+
(0, import_node_assert4.default)(this._echo, "Client not initialized.");
|
|
98194
96912
|
return this._echo;
|
|
98195
96913
|
}
|
|
98196
96914
|
get halo() {
|
|
98197
|
-
(0,
|
|
96915
|
+
(0, import_node_assert4.default)(this._halo, "Client not initialized.");
|
|
98198
96916
|
return this._halo;
|
|
98199
96917
|
}
|
|
98200
|
-
get isRemote() {
|
|
98201
|
-
return this._serviceProvider instanceof ClientServiceProxy;
|
|
98202
|
-
}
|
|
98203
96918
|
get services() {
|
|
98204
96919
|
return this._serviceProvider.services;
|
|
98205
96920
|
}
|
|
@@ -98209,55 +96924,17 @@ var Client = class {
|
|
|
98209
96924
|
}
|
|
98210
96925
|
const t = 10;
|
|
98211
96926
|
const timeout = setTimeout(() => {
|
|
98212
|
-
throw new
|
|
96927
|
+
throw new import_debug8.TimeoutError(`Initialize timed out after ${t}s.`);
|
|
98213
96928
|
}, t * 1e3);
|
|
98214
|
-
|
|
98215
|
-
|
|
98216
|
-
|
|
98217
|
-
await this.initializeLocal(onProgressCallback);
|
|
98218
|
-
} else {
|
|
98219
|
-
await this.initializeAuto(onProgressCallback);
|
|
98220
|
-
}
|
|
96929
|
+
await this._serviceProvider.open(onProgressCallback);
|
|
96930
|
+
await this._halo._open();
|
|
96931
|
+
await this._echo._open();
|
|
98221
96932
|
if (typeof window !== "undefined") {
|
|
98222
96933
|
await createDevtoolsRpcServer(this, this._serviceProvider);
|
|
98223
96934
|
}
|
|
98224
|
-
this._halo = new HaloProxy(this._serviceProvider);
|
|
98225
|
-
this._echo = new EchoProxy(this._serviceProvider, this._halo);
|
|
98226
|
-
await this._halo._open();
|
|
98227
|
-
await this._echo._open();
|
|
98228
96935
|
this._initialized = true;
|
|
98229
96936
|
clearInterval(timeout);
|
|
98230
96937
|
}
|
|
98231
|
-
async initializeRemote(onProgressCallback) {
|
|
98232
|
-
var _a;
|
|
98233
|
-
if (!this._options.rpcPort && isNode()) {
|
|
98234
|
-
throw new Error("RPC port is required to run client in remote mode on Node environment.");
|
|
98235
|
-
}
|
|
98236
|
-
log2("Creating client proxy.");
|
|
98237
|
-
this._serviceProvider = new ClientServiceProxy((_a = this._options.rpcPort) != null ? _a : createWindowMessagePort(), this._options.timeout);
|
|
98238
|
-
await this._serviceProvider.open(onProgressCallback);
|
|
98239
|
-
}
|
|
98240
|
-
async initializeLocal(onProgressCallback) {
|
|
98241
|
-
log2("Creating client host.");
|
|
98242
|
-
this._serviceProvider = new ClientServiceHost(this._config, this._options);
|
|
98243
|
-
await this._serviceProvider.open(onProgressCallback);
|
|
98244
|
-
}
|
|
98245
|
-
async initializeAuto(onProgressCallback) {
|
|
98246
|
-
if (!this._options.rpcPort && isNode()) {
|
|
98247
|
-
await this.initializeLocal(onProgressCallback);
|
|
98248
|
-
} else {
|
|
98249
|
-
try {
|
|
98250
|
-
await this.initializeRemote(onProgressCallback);
|
|
98251
|
-
} catch (error2) {
|
|
98252
|
-
if (error2 instanceof RemoteServiceConnectionTimeout) {
|
|
98253
|
-
log2("Failed to connect to remote services. Starting local services.");
|
|
98254
|
-
await this.initializeLocal(onProgressCallback);
|
|
98255
|
-
} else {
|
|
98256
|
-
throw error2;
|
|
98257
|
-
}
|
|
98258
|
-
}
|
|
98259
|
-
}
|
|
98260
|
-
}
|
|
98261
96938
|
async destroy() {
|
|
98262
96939
|
await this._echo._close();
|
|
98263
96940
|
this._halo._close();
|
|
@@ -98278,16 +96955,16 @@ var Client = class {
|
|
|
98278
96955
|
}
|
|
98279
96956
|
};
|
|
98280
96957
|
__decorateClass([
|
|
98281
|
-
|
|
96958
|
+
import_async7.synchronized
|
|
98282
96959
|
], Client.prototype, "initialize", 1);
|
|
98283
96960
|
__decorateClass([
|
|
98284
|
-
|
|
96961
|
+
import_async7.synchronized
|
|
98285
96962
|
], Client.prototype, "destroy", 1);
|
|
98286
96963
|
__decorateClass([
|
|
98287
|
-
|
|
96964
|
+
import_async7.synchronized
|
|
98288
96965
|
], Client.prototype, "reset", 1);
|
|
98289
96966
|
|
|
98290
|
-
// src/
|
|
96967
|
+
// src/packlets/proxy/serializer.ts
|
|
98291
96968
|
var partyCodec = schema.getCodecForType("dxos.echo.snapshot.PartySnapshot");
|
|
98292
96969
|
var PartySerializer = class {
|
|
98293
96970
|
constructor(_client) {
|
|
@@ -98302,16 +96979,542 @@ var PartySerializer = class {
|
|
|
98302
96979
|
}
|
|
98303
96980
|
};
|
|
98304
96981
|
|
|
98305
|
-
// src/
|
|
98306
|
-
var
|
|
98307
|
-
|
|
98308
|
-
|
|
98309
|
-
|
|
98310
|
-
|
|
98311
|
-
|
|
98312
|
-
|
|
98313
|
-
|
|
98314
|
-
|
|
96982
|
+
// src/packlets/services/service-host.ts
|
|
96983
|
+
var debug3 = __toESM(require("@dxos/debug"));
|
|
96984
|
+
var import_echo_db8 = __toESM(require_src14());
|
|
96985
|
+
|
|
96986
|
+
// src/packlets/services/impl/halo.ts
|
|
96987
|
+
var import_node_assert5 = __toESM(require_assert());
|
|
96988
|
+
var import_codec_protobuf9 = require("@dxos/codec-protobuf");
|
|
96989
|
+
var import_echo_db5 = __toESM(require_src14());
|
|
96990
|
+
var import_util5 = require("@dxos/util");
|
|
96991
|
+
var HaloService2 = class {
|
|
96992
|
+
constructor(echo, signer) {
|
|
96993
|
+
this.echo = echo;
|
|
96994
|
+
this.signer = signer;
|
|
96995
|
+
}
|
|
96996
|
+
async sign(request) {
|
|
96997
|
+
(0, import_node_assert5.default)(this.signer, "Signer not set.");
|
|
96998
|
+
(0, import_node_assert5.default)(request.publicKey, "Provide a publicKey of the key that should be used for signing.");
|
|
96999
|
+
const key = await this.echo.halo.keyring.getFullKey(request.publicKey);
|
|
97000
|
+
(0, import_node_assert5.default)(key, "Key not found.");
|
|
97001
|
+
return this.signer.sign(request, key);
|
|
97002
|
+
}
|
|
97003
|
+
async addKeyRecord(request) {
|
|
97004
|
+
(0, import_node_assert5.default)(request.keyRecord && request.keyRecord.publicKey, "Missing key record.");
|
|
97005
|
+
await this.echo.halo.keyring.addKeyRecord(request.keyRecord);
|
|
97006
|
+
(0, import_node_assert5.default)(await this.echo.halo.keyring.getKey(request.keyRecord.publicKey), "Key not inserted correctly.");
|
|
97007
|
+
}
|
|
97008
|
+
subscribeContacts() {
|
|
97009
|
+
if (this.echo.halo.identity) {
|
|
97010
|
+
return (0, import_echo_db5.resultSetToStream)(this.echo.halo.queryContacts(), (contacts) => ({ contacts }));
|
|
97011
|
+
}
|
|
97012
|
+
return new import_codec_protobuf9.Stream(({ next }) => {
|
|
97013
|
+
if (!this.echo.halo.identity) {
|
|
97014
|
+
next({ contacts: [] });
|
|
97015
|
+
}
|
|
97016
|
+
const subGroup = new import_util5.SubscriptionGroup();
|
|
97017
|
+
setImmediate(async () => {
|
|
97018
|
+
await this.echo.halo.identityReady.waitForCondition(() => !!this.echo.halo.identity);
|
|
97019
|
+
const resultSet = this.echo.halo.queryContacts();
|
|
97020
|
+
next({ contacts: resultSet.value });
|
|
97021
|
+
subGroup.push(resultSet.update.on(() => next({ contacts: resultSet.value })));
|
|
97022
|
+
});
|
|
97023
|
+
return () => subGroup.unsubscribe();
|
|
97024
|
+
});
|
|
97025
|
+
}
|
|
97026
|
+
async setGlobalPreference(request) {
|
|
97027
|
+
var _a, _b, _c;
|
|
97028
|
+
(0, import_node_assert5.default)(request.key, "Missing key of property.");
|
|
97029
|
+
const preferences = (_c = (_b = (_a = this.echo.halo.identity) == null ? void 0 : _a.preferences) == null ? void 0 : _b.getGlobalPreferences()) == null ? void 0 : _c.model;
|
|
97030
|
+
(0, import_node_assert5.default)(preferences, "Preferences failed to load.");
|
|
97031
|
+
await preferences.setProperty(request.key, request.value);
|
|
97032
|
+
}
|
|
97033
|
+
async getGlobalPreference(request) {
|
|
97034
|
+
var _a, _b, _c;
|
|
97035
|
+
(0, import_node_assert5.default)(request.key, "Missing key of property.");
|
|
97036
|
+
const preferences = (_c = (_b = (_a = this.echo.halo.identity) == null ? void 0 : _a.preferences) == null ? void 0 : _b.getGlobalPreferences()) == null ? void 0 : _c.model;
|
|
97037
|
+
return {
|
|
97038
|
+
value: preferences == null ? void 0 : preferences.getProperty(request.key)
|
|
97039
|
+
};
|
|
97040
|
+
}
|
|
97041
|
+
async setDevicePreference(request) {
|
|
97042
|
+
var _a, _b, _c;
|
|
97043
|
+
(0, import_node_assert5.default)(request.key, "Missing key of property.");
|
|
97044
|
+
const preferences = (_c = (_b = (_a = this.echo.halo.identity) == null ? void 0 : _a.preferences) == null ? void 0 : _b.getDevicePreferences()) == null ? void 0 : _c.model;
|
|
97045
|
+
(0, import_node_assert5.default)(preferences, "Preferences failed to load.");
|
|
97046
|
+
await preferences.setProperty(request.key, request.value);
|
|
97047
|
+
}
|
|
97048
|
+
async getDevicePreference(request) {
|
|
97049
|
+
var _a, _b, _c;
|
|
97050
|
+
(0, import_node_assert5.default)(request.key, "Missing key of property.");
|
|
97051
|
+
const preferences = (_c = (_b = (_a = this.echo.halo.identity) == null ? void 0 : _a.preferences) == null ? void 0 : _b.getDevicePreferences()) == null ? void 0 : _c.model;
|
|
97052
|
+
return {
|
|
97053
|
+
value: preferences == null ? void 0 : preferences.getProperty(request.key)
|
|
97054
|
+
};
|
|
97055
|
+
}
|
|
97056
|
+
};
|
|
97057
|
+
var createHaloService = ({ echo, signer }) => new HaloService2(echo, signer);
|
|
97058
|
+
|
|
97059
|
+
// src/packlets/services/impl/party.ts
|
|
97060
|
+
var import_node_assert6 = __toESM(require_assert());
|
|
97061
|
+
var import_uuid = require("uuid");
|
|
97062
|
+
var import_async8 = require("@dxos/async");
|
|
97063
|
+
var import_codec_protobuf10 = require("@dxos/codec-protobuf");
|
|
97064
|
+
var import_credentials3 = __toESM(require_src5());
|
|
97065
|
+
var import_debug9 = require("@dxos/debug");
|
|
97066
|
+
var import_echo_db6 = __toESM(require_src14());
|
|
97067
|
+
var PartyService2 = class {
|
|
97068
|
+
constructor(echo) {
|
|
97069
|
+
this.echo = echo;
|
|
97070
|
+
this.inviteeInvitations = /* @__PURE__ */ new Map();
|
|
97071
|
+
}
|
|
97072
|
+
subscribeToParty(request) {
|
|
97073
|
+
const update = (next) => {
|
|
97074
|
+
try {
|
|
97075
|
+
const party2 = this.echo.getParty(request.partyKey);
|
|
97076
|
+
next({
|
|
97077
|
+
party: party2 && {
|
|
97078
|
+
publicKey: party2.key,
|
|
97079
|
+
isOpen: party2.isOpen,
|
|
97080
|
+
isActive: party2.isActive,
|
|
97081
|
+
members: party2.queryMembers().value
|
|
97082
|
+
}
|
|
97083
|
+
});
|
|
97084
|
+
} catch (error2) {
|
|
97085
|
+
if (error2 instanceof import_debug9.InvalidStateError) {
|
|
97086
|
+
} else {
|
|
97087
|
+
throw error2;
|
|
97088
|
+
}
|
|
97089
|
+
}
|
|
97090
|
+
};
|
|
97091
|
+
const party = this.echo.getParty(request.partyKey);
|
|
97092
|
+
if (party) {
|
|
97093
|
+
return new import_codec_protobuf10.Stream(({ next }) => party.update.on(() => update(next)));
|
|
97094
|
+
} else {
|
|
97095
|
+
return new import_codec_protobuf10.Stream(({ next }) => {
|
|
97096
|
+
let unsubscribeParty;
|
|
97097
|
+
const unsubscribeParties = this.echo.queryParties().subscribe((parties) => {
|
|
97098
|
+
const party2 = parties.find((party3) => party3.key.equals(request.partyKey));
|
|
97099
|
+
if (party2 && !unsubscribeParty) {
|
|
97100
|
+
unsubscribeParty = party2.update.on(() => update(next));
|
|
97101
|
+
}
|
|
97102
|
+
});
|
|
97103
|
+
update(next);
|
|
97104
|
+
return () => {
|
|
97105
|
+
unsubscribeParties();
|
|
97106
|
+
unsubscribeParty == null ? void 0 : unsubscribeParty();
|
|
97107
|
+
};
|
|
97108
|
+
});
|
|
97109
|
+
}
|
|
97110
|
+
}
|
|
97111
|
+
subscribeParties() {
|
|
97112
|
+
return (0, import_echo_db6.resultSetToStream)(this.echo.queryParties(), (parties) => ({
|
|
97113
|
+
parties: parties.map((party) => ({
|
|
97114
|
+
publicKey: party.key,
|
|
97115
|
+
isOpen: party.isOpen,
|
|
97116
|
+
isActive: party.isActive,
|
|
97117
|
+
members: party.queryMembers().value
|
|
97118
|
+
}))
|
|
97119
|
+
}));
|
|
97120
|
+
}
|
|
97121
|
+
async getPartyDetails(request) {
|
|
97122
|
+
var _a;
|
|
97123
|
+
const party = (_a = this.echo.getParty(request.partyKey)) != null ? _a : (0, import_debug9.raise)(new import_echo_db6.PartyNotFoundError(request.partyKey));
|
|
97124
|
+
return {
|
|
97125
|
+
processedTimeframe: party.timeframe
|
|
97126
|
+
};
|
|
97127
|
+
}
|
|
97128
|
+
async createParty() {
|
|
97129
|
+
const party = await this.echo.createParty();
|
|
97130
|
+
return {
|
|
97131
|
+
publicKey: party.key,
|
|
97132
|
+
isOpen: party.isOpen,
|
|
97133
|
+
isActive: party.isActive
|
|
97134
|
+
};
|
|
97135
|
+
}
|
|
97136
|
+
async cloneParty(snapshot) {
|
|
97137
|
+
const party = await this.echo.cloneParty(snapshot);
|
|
97138
|
+
return {
|
|
97139
|
+
publicKey: party.key,
|
|
97140
|
+
isOpen: party.isOpen,
|
|
97141
|
+
isActive: party.isActive
|
|
97142
|
+
};
|
|
97143
|
+
}
|
|
97144
|
+
async setPartyState(request) {
|
|
97145
|
+
const party = this.echo.getParty(request.partyKey);
|
|
97146
|
+
if (!party) {
|
|
97147
|
+
throw new Error("Party not found");
|
|
97148
|
+
}
|
|
97149
|
+
if (request.open === true) {
|
|
97150
|
+
await party.open();
|
|
97151
|
+
} else if (request.open === false) {
|
|
97152
|
+
await party.close();
|
|
97153
|
+
}
|
|
97154
|
+
if (request.activeGlobal === true) {
|
|
97155
|
+
await party.activate({ global: true });
|
|
97156
|
+
} else if (request.activeGlobal === false) {
|
|
97157
|
+
await party.deactivate({ global: true });
|
|
97158
|
+
}
|
|
97159
|
+
if (request.activeDevice === true) {
|
|
97160
|
+
await party.activate({ device: true });
|
|
97161
|
+
} else if (request.activeDevice === false) {
|
|
97162
|
+
await party.deactivate({ device: true });
|
|
97163
|
+
}
|
|
97164
|
+
return {
|
|
97165
|
+
publicKey: party.key,
|
|
97166
|
+
isOpen: party.isOpen,
|
|
97167
|
+
isActive: party.isActive
|
|
97168
|
+
};
|
|
97169
|
+
}
|
|
97170
|
+
createInvitation(request) {
|
|
97171
|
+
return new import_codec_protobuf10.Stream(({ next, close }) => {
|
|
97172
|
+
var _a;
|
|
97173
|
+
const party = (_a = this.echo.getParty(request.partyKey)) != null ? _a : (0, import_debug9.raise)(new import_echo_db6.PartyNotFoundError(request.partyKey));
|
|
97174
|
+
setImmediate(async () => {
|
|
97175
|
+
try {
|
|
97176
|
+
let invitation;
|
|
97177
|
+
if (!request.inviteeKey) {
|
|
97178
|
+
const secret = Buffer.from((0, import_credentials3.generatePasscode)());
|
|
97179
|
+
const secretProvider = async () => {
|
|
97180
|
+
next({ state: 2 /* CONNECTED */ });
|
|
97181
|
+
return Buffer.from(secret);
|
|
97182
|
+
};
|
|
97183
|
+
invitation = await party.invitationManager.createInvitation({
|
|
97184
|
+
secretProvider,
|
|
97185
|
+
secretValidator: import_credentials3.defaultSecretValidator
|
|
97186
|
+
}, {
|
|
97187
|
+
onFinish: () => {
|
|
97188
|
+
next({ state: 3 /* SUCCESS */ });
|
|
97189
|
+
close();
|
|
97190
|
+
}
|
|
97191
|
+
});
|
|
97192
|
+
(0, import_node_assert6.default)(invitation.type === import_echo_db6.InvitationDescriptorType.INTERACTIVE);
|
|
97193
|
+
invitation.secret = Buffer.from(secret);
|
|
97194
|
+
} else {
|
|
97195
|
+
invitation = await party.invitationManager.createOfflineInvitation(request.inviteeKey);
|
|
97196
|
+
}
|
|
97197
|
+
next({ state: 1 /* WAITING_FOR_CONNECTION */, descriptor: invitation.toProto() });
|
|
97198
|
+
if (invitation.type === import_echo_db6.InvitationDescriptorType.OFFLINE) {
|
|
97199
|
+
close();
|
|
97200
|
+
}
|
|
97201
|
+
} catch (error2) {
|
|
97202
|
+
next({ state: 4 /* ERROR */, error: error2.message });
|
|
97203
|
+
close();
|
|
97204
|
+
}
|
|
97205
|
+
});
|
|
97206
|
+
});
|
|
97207
|
+
}
|
|
97208
|
+
acceptInvitation(request) {
|
|
97209
|
+
return new import_codec_protobuf10.Stream(({ next, close }) => {
|
|
97210
|
+
const id = (0, import_uuid.v4)();
|
|
97211
|
+
const [secretLatch, secretTrigger] = (0, import_async8.latch)();
|
|
97212
|
+
const inviteeInvitation = { secretTrigger };
|
|
97213
|
+
const secretProvider = async () => {
|
|
97214
|
+
await secretLatch;
|
|
97215
|
+
const secret = inviteeInvitation.secret;
|
|
97216
|
+
if (!secret) {
|
|
97217
|
+
throw new Error("Secret not provided.");
|
|
97218
|
+
}
|
|
97219
|
+
return Buffer.from(secret);
|
|
97220
|
+
};
|
|
97221
|
+
const partyPromise = this.echo.joinParty(import_echo_db6.InvitationDescriptor.fromProto(request), request.type === import_echo_db6.InvitationDescriptorType.INTERACTIVE ? secretProvider : void 0);
|
|
97222
|
+
this.inviteeInvitations.set(id, inviteeInvitation);
|
|
97223
|
+
next({ id, state: 2 /* CONNECTED */ });
|
|
97224
|
+
partyPromise.then((party) => {
|
|
97225
|
+
next({ id, state: 3 /* SUCCESS */, partyKey: party.key });
|
|
97226
|
+
}).catch((err) => {
|
|
97227
|
+
console.error(err);
|
|
97228
|
+
next({ id, state: 4 /* ERROR */, error: String(err) });
|
|
97229
|
+
}).finally(() => {
|
|
97230
|
+
close();
|
|
97231
|
+
});
|
|
97232
|
+
});
|
|
97233
|
+
}
|
|
97234
|
+
async authenticateInvitation(request) {
|
|
97235
|
+
var _a;
|
|
97236
|
+
(0, import_node_assert6.default)(request.processId, "Process ID is missing.");
|
|
97237
|
+
const invitation = this.inviteeInvitations.get(request.processId);
|
|
97238
|
+
(0, import_node_assert6.default)(invitation, "Invitation not found.");
|
|
97239
|
+
(0, import_node_assert6.default)(request.secret, "Secret not provided.");
|
|
97240
|
+
invitation.secret = request.secret;
|
|
97241
|
+
(_a = invitation.secretTrigger) == null ? void 0 : _a.call(invitation);
|
|
97242
|
+
}
|
|
97243
|
+
subscribeMembers(request) {
|
|
97244
|
+
const party = this.echo.getParty(request.partyKey);
|
|
97245
|
+
if (party) {
|
|
97246
|
+
return (0, import_echo_db6.resultSetToStream)(party.queryMembers(), (members) => ({ members }));
|
|
97247
|
+
} else {
|
|
97248
|
+
return new import_codec_protobuf10.Stream(({ next }) => {
|
|
97249
|
+
let unsubscribeMembers;
|
|
97250
|
+
const unsubscribeParties = this.echo.queryParties().subscribe((parties) => {
|
|
97251
|
+
const party2 = parties.find((party3) => party3.key.equals(request.partyKey));
|
|
97252
|
+
if (!unsubscribeMembers && party2) {
|
|
97253
|
+
const resultSet = party2.queryMembers();
|
|
97254
|
+
next({ members: resultSet.value });
|
|
97255
|
+
unsubscribeMembers = resultSet.update.on(() => next({ members: resultSet.value }));
|
|
97256
|
+
}
|
|
97257
|
+
});
|
|
97258
|
+
return () => {
|
|
97259
|
+
unsubscribeParties();
|
|
97260
|
+
unsubscribeMembers();
|
|
97261
|
+
};
|
|
97262
|
+
});
|
|
97263
|
+
}
|
|
97264
|
+
}
|
|
97265
|
+
async createSnapshot(request) {
|
|
97266
|
+
var _a;
|
|
97267
|
+
(0, import_node_assert6.default)(request.partyKey);
|
|
97268
|
+
const party = (_a = this.echo.getParty(request.partyKey)) != null ? _a : (0, import_debug9.raise)(new import_echo_db6.PartyNotFoundError(request.partyKey));
|
|
97269
|
+
return party.createSnapshot();
|
|
97270
|
+
}
|
|
97271
|
+
};
|
|
97272
|
+
var createPartyService = ({ echo }) => new PartyService2(echo);
|
|
97273
|
+
|
|
97274
|
+
// src/packlets/services/impl/profile.ts
|
|
97275
|
+
var import_node_assert7 = __toESM(require_assert());
|
|
97276
|
+
var import_uuid2 = require("uuid");
|
|
97277
|
+
var import_async9 = require("@dxos/async");
|
|
97278
|
+
var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
97279
|
+
var import_credentials4 = __toESM(require_src5());
|
|
97280
|
+
var import_echo_db7 = __toESM(require_src14());
|
|
97281
|
+
var ProfileService2 = class {
|
|
97282
|
+
constructor(echo) {
|
|
97283
|
+
this.echo = echo;
|
|
97284
|
+
this.inviteeInvitations = /* @__PURE__ */ new Map();
|
|
97285
|
+
}
|
|
97286
|
+
subscribeProfile() {
|
|
97287
|
+
return new import_codec_protobuf11.Stream(({ next }) => {
|
|
97288
|
+
const emitNext = () => next({
|
|
97289
|
+
profile: this.echo.halo.isInitialized ? this.echo.halo.getProfile() : void 0
|
|
97290
|
+
});
|
|
97291
|
+
emitNext();
|
|
97292
|
+
return this.echo.halo.subscribeToProfile(emitNext);
|
|
97293
|
+
});
|
|
97294
|
+
}
|
|
97295
|
+
async createProfile(request) {
|
|
97296
|
+
return this.echo.halo.createProfile(request);
|
|
97297
|
+
}
|
|
97298
|
+
async recoverProfile(request) {
|
|
97299
|
+
if (!request.seedPhrase) {
|
|
97300
|
+
throw new Error("Recovery SeedPhrase not provided.");
|
|
97301
|
+
}
|
|
97302
|
+
await this.echo.open();
|
|
97303
|
+
await this.echo.halo.recover(request.seedPhrase);
|
|
97304
|
+
const profile = this.echo.halo.getProfile();
|
|
97305
|
+
(0, import_node_assert7.default)(profile, "Recovering profile failed.");
|
|
97306
|
+
return profile;
|
|
97307
|
+
}
|
|
97308
|
+
createInvitation() {
|
|
97309
|
+
return new import_codec_protobuf11.Stream(({ next, close }) => {
|
|
97310
|
+
setImmediate(async () => {
|
|
97311
|
+
const secret = Buffer.from((0, import_credentials4.generatePasscode)());
|
|
97312
|
+
let invitation;
|
|
97313
|
+
const secretProvider = async () => {
|
|
97314
|
+
next({ descriptor: invitation.toProto(), state: 2 /* CONNECTED */ });
|
|
97315
|
+
return Buffer.from(secret);
|
|
97316
|
+
};
|
|
97317
|
+
invitation = await this.echo.halo.createInvitation({
|
|
97318
|
+
secretProvider,
|
|
97319
|
+
secretValidator: import_credentials4.defaultSecretValidator
|
|
97320
|
+
}, {
|
|
97321
|
+
onFinish: () => {
|
|
97322
|
+
next({ state: 3 /* SUCCESS */ });
|
|
97323
|
+
close();
|
|
97324
|
+
}
|
|
97325
|
+
});
|
|
97326
|
+
invitation.secret = secret;
|
|
97327
|
+
next({ descriptor: invitation.toProto(), state: 1 /* WAITING_FOR_CONNECTION */ });
|
|
97328
|
+
});
|
|
97329
|
+
});
|
|
97330
|
+
}
|
|
97331
|
+
acceptInvitation(request) {
|
|
97332
|
+
return new import_codec_protobuf11.Stream(({ next, close }) => {
|
|
97333
|
+
const id = (0, import_uuid2.v4)();
|
|
97334
|
+
const [secretLatch, secretTrigger] = (0, import_async9.latch)();
|
|
97335
|
+
const inviteeInvitation = { secretTrigger };
|
|
97336
|
+
const secretProvider = async () => {
|
|
97337
|
+
await secretLatch;
|
|
97338
|
+
const secret = inviteeInvitation.secret;
|
|
97339
|
+
if (!secret) {
|
|
97340
|
+
throw new Error("Secret not provided.");
|
|
97341
|
+
}
|
|
97342
|
+
return Buffer.from(secret);
|
|
97343
|
+
};
|
|
97344
|
+
const haloPartyPromise = this.echo.halo.join(import_echo_db7.InvitationDescriptor.fromProto(request), secretProvider);
|
|
97345
|
+
this.inviteeInvitations.set(id, inviteeInvitation);
|
|
97346
|
+
next({ id, state: 2 /* CONNECTED */ });
|
|
97347
|
+
haloPartyPromise.then((party) => {
|
|
97348
|
+
next({ id, state: 3 /* SUCCESS */, partyKey: party.key });
|
|
97349
|
+
}).catch((err) => {
|
|
97350
|
+
next({ id, state: 4 /* ERROR */, error: String(err) });
|
|
97351
|
+
});
|
|
97352
|
+
});
|
|
97353
|
+
}
|
|
97354
|
+
async authenticateInvitation(request) {
|
|
97355
|
+
var _a;
|
|
97356
|
+
(0, import_node_assert7.default)(request.processId, "Process ID is missing.");
|
|
97357
|
+
const invitation = this.inviteeInvitations.get(request.processId);
|
|
97358
|
+
(0, import_node_assert7.default)(invitation, "Invitation not found.");
|
|
97359
|
+
(0, import_node_assert7.default)(request.secret, "Secret not provided.");
|
|
97360
|
+
invitation.secret = request.secret;
|
|
97361
|
+
(_a = invitation.secretTrigger) == null ? void 0 : _a.call(invitation);
|
|
97362
|
+
}
|
|
97363
|
+
};
|
|
97364
|
+
var createProfileService = ({ echo }) => new ProfileService2(echo);
|
|
97365
|
+
|
|
97366
|
+
// src/packlets/services/impl/system.ts
|
|
97367
|
+
var createSystemService = ({ config, echo }) => ({
|
|
97368
|
+
getConfig: async () => config.values,
|
|
97369
|
+
reset: async () => {
|
|
97370
|
+
await echo.reset();
|
|
97371
|
+
}
|
|
97372
|
+
});
|
|
97373
|
+
|
|
97374
|
+
// src/packlets/services/impl/services.ts
|
|
97375
|
+
var createServices = (opts) => ({
|
|
97376
|
+
SystemService: createSystemService(opts),
|
|
97377
|
+
ProfileService: createProfileService(opts),
|
|
97378
|
+
HaloService: createHaloService(opts),
|
|
97379
|
+
PartyService: createPartyService(opts),
|
|
97380
|
+
DataService: opts.echo.dataService,
|
|
97381
|
+
TracingService: {
|
|
97382
|
+
setTracingOptions: () => {
|
|
97383
|
+
throw new Error("Tracing not available.");
|
|
97384
|
+
},
|
|
97385
|
+
subscribeToRpcTrace: () => {
|
|
97386
|
+
throw new Error("Tracing not available.");
|
|
97387
|
+
}
|
|
97388
|
+
}
|
|
97389
|
+
});
|
|
97390
|
+
|
|
97391
|
+
// src/packlets/services/storage.ts
|
|
97392
|
+
var import_jsondown = __toESM(require("jsondown"));
|
|
97393
|
+
var import_level_js = __toESM(require("level-js"));
|
|
97394
|
+
var import_memdown = __toESM(require("memdown"));
|
|
97395
|
+
var import_config3 = require("@dxos/config");
|
|
97396
|
+
var import_random_access_multi_storage = require("@dxos/random-access-multi-storage");
|
|
97397
|
+
var import_util6 = require("@dxos/util");
|
|
97398
|
+
var StorageDriver = import_config3.defs.Runtime.Client.Storage.StorageDriver;
|
|
97399
|
+
var createStorageObjects = (config) => {
|
|
97400
|
+
const {
|
|
97401
|
+
path = "dxos/storage",
|
|
97402
|
+
storageType,
|
|
97403
|
+
keyStorage,
|
|
97404
|
+
persistent = false
|
|
97405
|
+
} = config != null ? config : {};
|
|
97406
|
+
if (persistent && storageType === StorageDriver.RAM) {
|
|
97407
|
+
throw new InvalidConfigurationError("RAM storage cannot be used in persistent mode.");
|
|
97408
|
+
}
|
|
97409
|
+
if (!persistent && (storageType !== void 0 && storageType !== StorageDriver.RAM)) {
|
|
97410
|
+
throw new InvalidConfigurationError("Cannot use a persistent storage in not persistent mode.");
|
|
97411
|
+
}
|
|
97412
|
+
if (persistent && keyStorage === StorageDriver.RAM) {
|
|
97413
|
+
throw new InvalidConfigurationError("RAM key storage cannot be used in persistent mode.");
|
|
97414
|
+
}
|
|
97415
|
+
if (!persistent && (keyStorage !== StorageDriver.RAM && keyStorage !== void 0)) {
|
|
97416
|
+
throw new InvalidConfigurationError("Cannot use a persistent key storage in not persistent mode.");
|
|
97417
|
+
}
|
|
97418
|
+
return {
|
|
97419
|
+
storage: (0, import_random_access_multi_storage.createStorage)(`${path}/`, persistent ? toStorageType(storageType) : import_random_access_multi_storage.StorageType.RAM),
|
|
97420
|
+
keyStorage: createKeyStorage(`${path}/keystore`, persistent ? toKeyStorageType(keyStorage) : "ram")
|
|
97421
|
+
};
|
|
97422
|
+
};
|
|
97423
|
+
var createKeyStorage = (path, type) => {
|
|
97424
|
+
const defaultedType = type != null ? type : (0, import_util6.isNode)() ? "jsondown" : "leveljs";
|
|
97425
|
+
switch (defaultedType) {
|
|
97426
|
+
case "leveljs":
|
|
97427
|
+
return (0, import_level_js.default)(path);
|
|
97428
|
+
case "jsondown":
|
|
97429
|
+
return (0, import_jsondown.default)(path);
|
|
97430
|
+
case "ram":
|
|
97431
|
+
return (0, import_memdown.default)();
|
|
97432
|
+
default:
|
|
97433
|
+
throw new InvalidConfigurationError(`Invalid key storage type: ${defaultedType}`);
|
|
97434
|
+
}
|
|
97435
|
+
};
|
|
97436
|
+
var toStorageType = (type) => {
|
|
97437
|
+
switch (type) {
|
|
97438
|
+
case void 0:
|
|
97439
|
+
return void 0;
|
|
97440
|
+
case StorageDriver.RAM:
|
|
97441
|
+
return import_random_access_multi_storage.StorageType.RAM;
|
|
97442
|
+
case StorageDriver.CHROME:
|
|
97443
|
+
return import_random_access_multi_storage.StorageType.CHROME;
|
|
97444
|
+
case StorageDriver.FIREFOX:
|
|
97445
|
+
return import_random_access_multi_storage.StorageType.FIREFOX;
|
|
97446
|
+
case StorageDriver.IDB:
|
|
97447
|
+
return import_random_access_multi_storage.StorageType.IDB;
|
|
97448
|
+
case StorageDriver.NODE:
|
|
97449
|
+
return import_random_access_multi_storage.StorageType.NODE;
|
|
97450
|
+
default:
|
|
97451
|
+
throw new Error(`Invalid storage type: ${StorageDriver[type]}`);
|
|
97452
|
+
}
|
|
97453
|
+
};
|
|
97454
|
+
var toKeyStorageType = (type) => {
|
|
97455
|
+
switch (type) {
|
|
97456
|
+
case void 0:
|
|
97457
|
+
return void 0;
|
|
97458
|
+
case StorageDriver.RAM:
|
|
97459
|
+
return "ram";
|
|
97460
|
+
case StorageDriver.LEVELJS:
|
|
97461
|
+
return "leveljs";
|
|
97462
|
+
case StorageDriver.JSONDOWN:
|
|
97463
|
+
return "jsondown";
|
|
97464
|
+
default:
|
|
97465
|
+
throw new Error(`Invalid key storage type: ${StorageDriver[type]}`);
|
|
97466
|
+
}
|
|
97467
|
+
};
|
|
97468
|
+
|
|
97469
|
+
// src/packlets/services/service-host.ts
|
|
97470
|
+
var ClientServiceHost = class {
|
|
97471
|
+
constructor(_config, _signer) {
|
|
97472
|
+
this._config = _config;
|
|
97473
|
+
this._signer = _signer;
|
|
97474
|
+
this._devtoolsEvents = new DevtoolsHostEvents();
|
|
97475
|
+
const { storage, keyStorage } = createStorageObjects(this._config.get("runtime.client.storage", {}));
|
|
97476
|
+
this._echo = new import_echo_db8.ECHO({
|
|
97477
|
+
storage,
|
|
97478
|
+
keyStorage,
|
|
97479
|
+
networkManagerOptions: {
|
|
97480
|
+
signal: this._config.get("runtime.services.signal.server") ? [this._config.get("runtime.services.signal.server")] : void 0,
|
|
97481
|
+
ice: this._config.get("runtime.services.ice"),
|
|
97482
|
+
log: true
|
|
97483
|
+
},
|
|
97484
|
+
snapshots: this._config.get("runtime.client.enableSnapshots", false),
|
|
97485
|
+
snapshotInterval: this._config.get("runtime.client.snapshotInterval")
|
|
97486
|
+
});
|
|
97487
|
+
this._services = {
|
|
97488
|
+
...createServices({ config: this._config, echo: this._echo, signer: this._signer }),
|
|
97489
|
+
DevtoolsHost: this._createDevtoolsService()
|
|
97490
|
+
};
|
|
97491
|
+
}
|
|
97492
|
+
get services() {
|
|
97493
|
+
return this._services;
|
|
97494
|
+
}
|
|
97495
|
+
async open(onProgressCallback) {
|
|
97496
|
+
await this._echo.open(onProgressCallback);
|
|
97497
|
+
this._devtoolsEvents.ready.emit();
|
|
97498
|
+
}
|
|
97499
|
+
async close() {
|
|
97500
|
+
await this._echo.close();
|
|
97501
|
+
}
|
|
97502
|
+
get echo() {
|
|
97503
|
+
return this._echo;
|
|
97504
|
+
}
|
|
97505
|
+
_createDevtoolsService() {
|
|
97506
|
+
const dependencies = {
|
|
97507
|
+
config: this._config,
|
|
97508
|
+
echo: this._echo,
|
|
97509
|
+
feedStore: this._echo.feedStore,
|
|
97510
|
+
networkManager: this._echo.networkManager,
|
|
97511
|
+
modelFactory: this._echo.modelFactory,
|
|
97512
|
+
keyring: this._echo.halo.keyring,
|
|
97513
|
+
debug: debug3
|
|
97514
|
+
};
|
|
97515
|
+
return createDevtoolsHost(dependencies, this._devtoolsEvents);
|
|
97516
|
+
}
|
|
97517
|
+
};
|
|
98315
97518
|
/*!
|
|
98316
97519
|
* prr
|
|
98317
97520
|
* (c) 2013 Rod Vagg <rod@vagg.org>
|