@dxos/client-services 0.1.41-next.d517c89 → 0.1.41
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/lib/browser/{chunk-LGMYP2WL.mjs → chunk-T73F4MV4.mjs} +232 -213
- package/dist/lib/browser/chunk-T73F4MV4.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +1 -1
- package/dist/lib/node/index.cjs +271 -252
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +259 -217
- package/dist/lib/node/packlets/testing/index.cjs.map +4 -4
- package/dist/types/src/packlets/logging/index.d.ts +2 -0
- package/dist/types/src/packlets/logging/index.d.ts.map +1 -0
- package/dist/types/src/packlets/logging/logging-service.d.ts +13 -0
- package/dist/types/src/packlets/logging/logging-service.d.ts.map +1 -0
- package/dist/types/src/packlets/logging/logging.test.d.ts +2 -0
- package/dist/types/src/packlets/logging/logging.test.d.ts.map +1 -0
- package/dist/types/src/packlets/services/service-host.d.ts +1 -0
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts +6 -5
- package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/iframe-proxy-runtime.d.ts +9 -8
- package/dist/types/src/packlets/vault/iframe-proxy-runtime.d.ts.map +1 -1
- package/package.json +30 -30
- package/src/packlets/logging/index.ts +5 -0
- package/src/packlets/logging/logging-service.ts +78 -0
- package/src/packlets/logging/logging.test.ts +50 -0
- package/src/packlets/services/service-host.ts +9 -2
- package/src/packlets/spaces/data-space-manager.ts +7 -3
- package/src/packlets/tests/shared-worker.test.ts +9 -10
- package/src/packlets/vault/iframe-host-runtime.ts +13 -16
- package/src/packlets/vault/iframe-proxy-runtime.ts +28 -34
- package/dist/lib/browser/chunk-LGMYP2WL.mjs.map +0 -7
- package/dist/types/src/packlets/deprecated/index.d.ts +0 -2
- package/dist/types/src/packlets/deprecated/index.d.ts.map +0 -1
- package/dist/types/src/packlets/deprecated/tracing.d.ts +0 -12
- package/dist/types/src/packlets/deprecated/tracing.d.ts.map +0 -1
- package/src/packlets/deprecated/index.ts +0 -5
- package/src/packlets/deprecated/tracing.ts +0 -21
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { iframeServiceBundle, workerServiceBundle, WorkerServiceBundle } from '@dxos/client';
|
|
5
|
+
import { Config, iframeServiceBundle, workerServiceBundle, WorkerServiceBundle } from '@dxos/client';
|
|
6
6
|
import { RemoteServiceConnectionError } from '@dxos/errors';
|
|
7
7
|
import { log } from '@dxos/log';
|
|
8
8
|
import { WebRTCTransportService } from '@dxos/network-manager';
|
|
9
9
|
import { BridgeService } from '@dxos/protocols/proto/dxos/mesh/bridge';
|
|
10
10
|
import { createProtoRpcPeer, ProtoRpcPeer, RpcPort } from '@dxos/rpc';
|
|
11
|
+
import { getAsyncValue, MaybePromise, Provider } from '@dxos/util';
|
|
11
12
|
|
|
12
13
|
import { ShellRuntime, ShellRuntimeImpl } from './shell-runtime';
|
|
13
14
|
|
|
14
15
|
// NOTE: Keep as RpcPorts to avoid dependency on @dxos/rpc-tunnel so we don't depend on browser-specific apis.
|
|
15
16
|
export type IFrameProxyRuntimeParams = {
|
|
17
|
+
config: Config | Provider<MaybePromise<Config>>;
|
|
16
18
|
systemPort: RpcPort;
|
|
17
|
-
workerAppPort: RpcPort;
|
|
18
|
-
windowAppPort: RpcPort;
|
|
19
19
|
shellPort?: RpcPort;
|
|
20
20
|
};
|
|
21
21
|
|
|
@@ -23,32 +23,40 @@ export type IFrameProxyRuntimeParams = {
|
|
|
23
23
|
* Manages the client connection to the shared worker.
|
|
24
24
|
*/
|
|
25
25
|
export class IFrameProxyRuntime {
|
|
26
|
+
private readonly _configProvider: IFrameProxyRuntimeParams['config'];
|
|
26
27
|
private readonly _systemPort: RpcPort;
|
|
27
|
-
private readonly _windowAppPort: RpcPort;
|
|
28
|
-
private readonly _workerAppPort: RpcPort;
|
|
29
28
|
private readonly _shellPort?: RpcPort;
|
|
30
|
-
private
|
|
31
|
-
private
|
|
32
|
-
private
|
|
33
|
-
|
|
34
|
-
{ urls: 'stun:dev.kube.dxos.org:3478', username: 'dxos', credential: 'dxos' },
|
|
35
|
-
{ urls: 'turn:dev.kube.dxos.org:3478', username: 'dxos', credential: 'dxos' },
|
|
36
|
-
{ urls: 'stun:kube.dxos.org:3478', username: 'dxos', credential: 'dxos' },
|
|
37
|
-
{ urls: 'turn:kube.dxos.org:3478', username: 'dxos', credential: 'dxos' }
|
|
38
|
-
]
|
|
39
|
-
});
|
|
29
|
+
private _config!: Config;
|
|
30
|
+
private _transportService!: BridgeService;
|
|
31
|
+
private _systemRpc!: ProtoRpcPeer<WorkerServiceBundle>;
|
|
32
|
+
private _shellRuntime?: ShellRuntimeImpl;
|
|
40
33
|
|
|
41
|
-
constructor({
|
|
34
|
+
constructor({ config, systemPort, shellPort }: IFrameProxyRuntimeParams) {
|
|
35
|
+
this._configProvider = config;
|
|
42
36
|
this._systemPort = systemPort;
|
|
43
|
-
this._windowAppPort = windowAppPort;
|
|
44
|
-
this._workerAppPort = workerAppPort;
|
|
45
37
|
this._shellPort = shellPort;
|
|
46
38
|
|
|
39
|
+
if (this._shellPort) {
|
|
40
|
+
this._shellRuntime = new ShellRuntimeImpl(this._shellPort);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
get shell(): ShellRuntime | undefined {
|
|
45
|
+
return this._shellRuntime;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async open(origin: string) {
|
|
49
|
+
this._config = await getAsyncValue(this._configProvider);
|
|
50
|
+
|
|
51
|
+
this._transportService = new WebRTCTransportService({
|
|
52
|
+
iceServers: this._config.get('runtime.services.ice')
|
|
53
|
+
});
|
|
54
|
+
|
|
47
55
|
this._systemRpc = createProtoRpcPeer({
|
|
48
56
|
requested: workerServiceBundle,
|
|
49
57
|
exposed: iframeServiceBundle,
|
|
50
58
|
handlers: {
|
|
51
|
-
BridgeService: this._transportService
|
|
59
|
+
BridgeService: this._transportService,
|
|
52
60
|
IframeService: {
|
|
53
61
|
async heartbeat() {
|
|
54
62
|
// Ok.
|
|
@@ -56,22 +64,9 @@ export class IFrameProxyRuntime {
|
|
|
56
64
|
}
|
|
57
65
|
},
|
|
58
66
|
port: this._systemPort,
|
|
59
|
-
timeout:
|
|
67
|
+
timeout: 200
|
|
60
68
|
});
|
|
61
69
|
|
|
62
|
-
this._workerAppPort.subscribe((msg) => this._windowAppPort.send(msg));
|
|
63
|
-
this._windowAppPort.subscribe((msg) => this._workerAppPort.send(msg));
|
|
64
|
-
|
|
65
|
-
if (this._shellPort) {
|
|
66
|
-
this._shellRuntime = new ShellRuntimeImpl(this._shellPort);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
get shell(): ShellRuntime | undefined {
|
|
71
|
-
return this._shellRuntime;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
async open(origin: string) {
|
|
75
70
|
try {
|
|
76
71
|
await this._systemRpc.open();
|
|
77
72
|
await this._systemRpc.rpc.WorkerService.start({ origin });
|
|
@@ -79,7 +74,6 @@ export class IFrameProxyRuntime {
|
|
|
79
74
|
log.catch(err);
|
|
80
75
|
throw new RemoteServiceConnectionError('Failed to connect to worker');
|
|
81
76
|
}
|
|
82
|
-
|
|
83
77
|
await this._shellRuntime?.open();
|
|
84
78
|
}
|
|
85
79
|
|