@dxos/client-services 0.1.29-next.b1a9bc6 → 0.1.29
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-ILMYW75X.mjs → chunk-ZIQUYEJS.mjs} +183 -94
- package/dist/lib/browser/{chunk-ILMYW75X.mjs.map → chunk-ZIQUYEJS.mjs.map} +4 -4
- 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 +191 -104
- 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 +196 -100
- package/dist/lib/node/packlets/testing/index.cjs.map +4 -4
- package/dist/types/src/packlets/services/client-rpc-server.d.ts +22 -0
- package/dist/types/src/packlets/services/client-rpc-server.d.ts.map +1 -0
- package/dist/types/src/packlets/services/local-client-services.d.ts +2 -1
- package/dist/types/src/packlets/services/local-client-services.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +21 -6
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-registry.d.ts +3 -1
- package/dist/types/src/packlets/services/service-registry.d.ts.map +1 -1
- package/dist/types/src/packlets/system/system-service.d.ts +2 -2
- package/dist/types/src/packlets/system/system-service.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts +0 -1
- package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/worker-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/worker-session.d.ts +4 -4
- package/dist/types/src/packlets/vault/worker-session.d.ts.map +1 -1
- package/package.json +30 -30
- package/src/packlets/services/client-rpc-server.ts +91 -0
- package/src/packlets/services/local-client-services.ts +4 -0
- package/src/packlets/services/service-host.ts +51 -10
- package/src/packlets/services/service-registry.ts +9 -1
- package/src/packlets/system/system-service.ts +3 -3
- package/src/packlets/tests/shared-worker.test.ts +39 -42
- package/src/packlets/vault/iframe-host-runtime.ts +25 -34
- package/src/packlets/vault/worker-runtime.ts +5 -15
- package/src/packlets/vault/worker-session.ts +40 -28
|
@@ -1991,18 +1991,16 @@ var MemoryShellRuntime = class {
|
|
|
1991
1991
|
|
|
1992
1992
|
// packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
|
|
1993
1993
|
import { Trigger as Trigger9 } from "@dxos/async";
|
|
1994
|
-
import { clientServiceBundle as clientServiceBundle3 } from "@dxos/client";
|
|
1995
1994
|
import { log as log16, logInfo as logInfo2 } from "@dxos/log";
|
|
1996
1995
|
import { MemorySignalManager as MemorySignalManager3, MemorySignalManagerContext as MemorySignalManagerContext3, WebsocketSignalManager as WebsocketSignalManager3 } from "@dxos/messaging";
|
|
1997
1996
|
import { createWebRTCTransportFactory as createWebRTCTransportFactory2, NetworkManager as NetworkManager3 } from "@dxos/network-manager";
|
|
1998
|
-
import { createProtoRpcPeer as createProtoRpcPeer4 } from "@dxos/rpc";
|
|
1999
1997
|
import { getAsyncValue } from "@dxos/util";
|
|
2000
1998
|
|
|
2001
1999
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
2002
2000
|
import assert12 from "@dxos/node-std/assert";
|
|
2003
2001
|
import { Event as Event6 } from "@dxos/async";
|
|
2004
|
-
import { clientServiceBundle
|
|
2005
|
-
import { raise as
|
|
2002
|
+
import { clientServiceBundle, createDefaultModelFactory } from "@dxos/client";
|
|
2003
|
+
import { raise as raise3 } from "@dxos/debug";
|
|
2006
2004
|
import { DataServiceImpl } from "@dxos/echo-pipeline";
|
|
2007
2005
|
import { log as log14 } from "@dxos/log";
|
|
2008
2006
|
import { SystemStatus } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -2789,7 +2787,8 @@ var SystemServiceImpl = class {
|
|
|
2789
2787
|
this._onReset = onReset;
|
|
2790
2788
|
}
|
|
2791
2789
|
async getConfig() {
|
|
2792
|
-
|
|
2790
|
+
var _a, _b;
|
|
2791
|
+
return (_b = (_a = this._config) == null ? void 0 : _a.values) != null ? _b : {};
|
|
2793
2792
|
}
|
|
2794
2793
|
async updateStatus({ status }) {
|
|
2795
2794
|
await this._onUpdateStatus(status);
|
|
@@ -2954,10 +2953,65 @@ import { NetworkManager, WebRTCTransportProxyFactory } from "@dxos/network-manag
|
|
|
2954
2953
|
// packages/sdk/client-services/src/packlets/vault/worker-session.ts
|
|
2955
2954
|
import assert11 from "@dxos/node-std/assert";
|
|
2956
2955
|
import { asyncTimeout as asyncTimeout2, Trigger as Trigger6 } from "@dxos/async";
|
|
2957
|
-
import {
|
|
2956
|
+
import { iframeServiceBundle as iframeServiceBundle2, workerServiceBundle as workerServiceBundle2 } from "@dxos/client";
|
|
2958
2957
|
import { log as log11, logInfo } from "@dxos/log";
|
|
2959
2958
|
import { createProtoRpcPeer as createProtoRpcPeer3 } from "@dxos/rpc";
|
|
2960
2959
|
import { Callback } from "@dxos/util";
|
|
2960
|
+
|
|
2961
|
+
// packages/sdk/client-services/src/packlets/services/client-rpc-server.ts
|
|
2962
|
+
import { Stream as Stream12 } from "@dxos/codec-protobuf";
|
|
2963
|
+
import { raise as raise2 } from "@dxos/debug";
|
|
2964
|
+
import { parseMethodName, RpcPeer } from "@dxos/rpc";
|
|
2965
|
+
var ClientRpcServer = class {
|
|
2966
|
+
constructor(params) {
|
|
2967
|
+
this._handlerCache = /* @__PURE__ */ new Map();
|
|
2968
|
+
const { serviceRegistry, handleCall, handleStream, ...rpcOptions } = params;
|
|
2969
|
+
this._handleCall = handleCall;
|
|
2970
|
+
this._handleStream = handleStream;
|
|
2971
|
+
this._serviceRegistry = serviceRegistry;
|
|
2972
|
+
this._rpcPeer = new RpcPeer({
|
|
2973
|
+
...rpcOptions,
|
|
2974
|
+
callHandler: (method, params2) => {
|
|
2975
|
+
const [serviceName, methodName] = parseMethodName(method);
|
|
2976
|
+
const handler = (method2, params3) => this._getServiceHandler(serviceName).call(method2, params3);
|
|
2977
|
+
if (this._handleCall) {
|
|
2978
|
+
return this._handleCall(methodName, params2, handler);
|
|
2979
|
+
} else {
|
|
2980
|
+
return handler(methodName, params2);
|
|
2981
|
+
}
|
|
2982
|
+
},
|
|
2983
|
+
streamHandler: (method, params2) => {
|
|
2984
|
+
const [serviceName, methodName] = parseMethodName(method);
|
|
2985
|
+
const handler = (method2, params3) => this._getServiceHandler(serviceName).callStream(method2, params3);
|
|
2986
|
+
if (this._handleStream) {
|
|
2987
|
+
return Stream12.unwrapPromise(this._handleStream(methodName, params2, handler));
|
|
2988
|
+
} else {
|
|
2989
|
+
return handler(methodName, params2);
|
|
2990
|
+
}
|
|
2991
|
+
}
|
|
2992
|
+
});
|
|
2993
|
+
}
|
|
2994
|
+
async open() {
|
|
2995
|
+
await this._rpcPeer.open();
|
|
2996
|
+
}
|
|
2997
|
+
async close() {
|
|
2998
|
+
await this._rpcPeer.close();
|
|
2999
|
+
}
|
|
3000
|
+
_getServiceHandler(serviceName) {
|
|
3001
|
+
var _a;
|
|
3002
|
+
if (!this._handlerCache.has(serviceName)) {
|
|
3003
|
+
const [key, descriptor] = (_a = Object.entries(this._serviceRegistry.descriptors).find(([key2, descriptor2]) => descriptor2.name === serviceName)) != null ? _a : raise2(new Error(`Service not available: ${serviceName}`));
|
|
3004
|
+
const service = this._serviceRegistry.services[key];
|
|
3005
|
+
if (!service) {
|
|
3006
|
+
throw new Error(`Service not available: ${serviceName}`);
|
|
3007
|
+
}
|
|
3008
|
+
this._handlerCache.set(serviceName, descriptor.createServer(service));
|
|
3009
|
+
}
|
|
3010
|
+
return this._handlerCache.get(serviceName);
|
|
3011
|
+
}
|
|
3012
|
+
};
|
|
3013
|
+
|
|
3014
|
+
// packages/sdk/client-services/src/packlets/vault/worker-session.ts
|
|
2961
3015
|
var __decorate3 = function(decorators, target, key, desc) {
|
|
2962
3016
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2963
3017
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -2969,36 +3023,44 @@ var __decorate3 = function(decorators, target, key, desc) {
|
|
|
2969
3023
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2970
3024
|
};
|
|
2971
3025
|
var WorkerSession = class {
|
|
2972
|
-
constructor({
|
|
3026
|
+
constructor({ serviceHost, systemPort, appPort, shellPort, readySignal, options = {
|
|
2973
3027
|
heartbeatInterval: 1e3
|
|
2974
3028
|
} }) {
|
|
2975
3029
|
this._startTrigger = new Trigger6();
|
|
2976
3030
|
this.onClose = new Callback();
|
|
2977
3031
|
assert11(options);
|
|
2978
|
-
assert11(
|
|
3032
|
+
assert11(serviceHost);
|
|
2979
3033
|
this._options = options;
|
|
2980
|
-
this.
|
|
2981
|
-
const
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
3034
|
+
this._serviceHost = serviceHost;
|
|
3035
|
+
const middleware = {
|
|
3036
|
+
handleCall: async (method, params, handler) => {
|
|
3037
|
+
const error = await readySignal.wait({
|
|
3038
|
+
timeout: 3e3
|
|
3039
|
+
});
|
|
3040
|
+
if (error) {
|
|
3041
|
+
throw error;
|
|
3042
|
+
}
|
|
3043
|
+
return handler(method, params);
|
|
3044
|
+
},
|
|
3045
|
+
handleStream: async (method, params, handler) => {
|
|
3046
|
+
const error = await readySignal.wait({
|
|
3047
|
+
timeout: 3e3
|
|
3048
|
+
});
|
|
3049
|
+
if (error) {
|
|
3050
|
+
throw error;
|
|
3051
|
+
}
|
|
3052
|
+
return handler(method, params);
|
|
3053
|
+
}
|
|
2992
3054
|
};
|
|
2993
|
-
this._clientRpc =
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
3055
|
+
this._clientRpc = new ClientRpcServer({
|
|
3056
|
+
serviceRegistry: this._serviceHost.serviceRegistry,
|
|
3057
|
+
port: appPort,
|
|
3058
|
+
...middleware
|
|
2997
3059
|
});
|
|
2998
|
-
this._shellClientRpc =
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3060
|
+
this._shellClientRpc = new ClientRpcServer({
|
|
3061
|
+
serviceRegistry: this._serviceHost.serviceRegistry,
|
|
3062
|
+
port: shellPort,
|
|
3063
|
+
...middleware
|
|
3002
3064
|
});
|
|
3003
3065
|
this._iframeRpc = createProtoRpcPeer3({
|
|
3004
3066
|
requested: iframeServiceBundle2,
|
|
@@ -3016,7 +3078,7 @@ var WorkerSession = class {
|
|
|
3016
3078
|
} catch (err) {
|
|
3017
3079
|
log11.catch(err, {}, {
|
|
3018
3080
|
file: "worker-session.ts",
|
|
3019
|
-
line:
|
|
3081
|
+
line: 107,
|
|
3020
3082
|
scope: this,
|
|
3021
3083
|
callSite: (f, a) => f(...a)
|
|
3022
3084
|
});
|
|
@@ -3034,7 +3096,7 @@ var WorkerSession = class {
|
|
|
3034
3096
|
async open() {
|
|
3035
3097
|
log11.info("opening..", {}, {
|
|
3036
3098
|
file: "worker-session.ts",
|
|
3037
|
-
line:
|
|
3099
|
+
line: 121,
|
|
3038
3100
|
scope: this,
|
|
3039
3101
|
callSite: (f, a) => f(...a)
|
|
3040
3102
|
});
|
|
@@ -3054,7 +3116,7 @@ var WorkerSession = class {
|
|
|
3054
3116
|
err: err1
|
|
3055
3117
|
}, {
|
|
3056
3118
|
file: "worker-session.ts",
|
|
3057
|
-
line:
|
|
3119
|
+
line: 133,
|
|
3058
3120
|
scope: this,
|
|
3059
3121
|
callSite: (f, a) => f(...a)
|
|
3060
3122
|
});
|
|
@@ -3063,7 +3125,7 @@ var WorkerSession = class {
|
|
|
3063
3125
|
} catch (err) {
|
|
3064
3126
|
log11.catch(err, {}, {
|
|
3065
3127
|
file: "worker-session.ts",
|
|
3066
|
-
line:
|
|
3128
|
+
line: 137,
|
|
3067
3129
|
scope: this,
|
|
3068
3130
|
callSite: (f, a) => f(...a)
|
|
3069
3131
|
});
|
|
@@ -3074,7 +3136,7 @@ var WorkerSession = class {
|
|
|
3074
3136
|
async close() {
|
|
3075
3137
|
log11.info("closing..", {}, {
|
|
3076
3138
|
file: "worker-session.ts",
|
|
3077
|
-
line:
|
|
3139
|
+
line: 144,
|
|
3078
3140
|
scope: this,
|
|
3079
3141
|
callSite: (f, a) => f(...a)
|
|
3080
3142
|
});
|
|
@@ -3083,7 +3145,7 @@ var WorkerSession = class {
|
|
|
3083
3145
|
} catch (err) {
|
|
3084
3146
|
log11.catch(err, {}, {
|
|
3085
3147
|
file: "worker-session.ts",
|
|
3086
|
-
line:
|
|
3148
|
+
line: 148,
|
|
3087
3149
|
scope: this,
|
|
3088
3150
|
callSite: (f, a) => f(...a)
|
|
3089
3151
|
});
|
|
@@ -3102,7 +3164,7 @@ var WorkerSession = class {
|
|
|
3102
3164
|
} catch (e) {
|
|
3103
3165
|
log11.info("No shell connected.", {}, {
|
|
3104
3166
|
file: "worker-session.ts",
|
|
3105
|
-
line:
|
|
3167
|
+
line: 162,
|
|
3106
3168
|
scope: this,
|
|
3107
3169
|
callSite: (f, a) => f(...a)
|
|
3108
3170
|
});
|
|
@@ -3121,18 +3183,19 @@ var WorkerRuntime = class {
|
|
|
3121
3183
|
this._transportFactory = new WebRTCTransportProxyFactory();
|
|
3122
3184
|
this._ready = new Trigger7();
|
|
3123
3185
|
this.sessions = /* @__PURE__ */ new Set();
|
|
3186
|
+
this._clientServices = new ClientServicesHost();
|
|
3124
3187
|
}
|
|
3125
3188
|
async start() {
|
|
3126
3189
|
log12("starting...", {}, {
|
|
3127
3190
|
file: "worker-runtime.ts",
|
|
3128
|
-
line:
|
|
3191
|
+
line: 44,
|
|
3129
3192
|
scope: this,
|
|
3130
3193
|
callSite: (f, a) => f(...a)
|
|
3131
3194
|
});
|
|
3132
3195
|
try {
|
|
3133
3196
|
this._config = await this._configProvider();
|
|
3134
3197
|
const signalServer = this._config.get("runtime.services.signal.server");
|
|
3135
|
-
this._clientServices
|
|
3198
|
+
this._clientServices.initialize({
|
|
3136
3199
|
config: this._config,
|
|
3137
3200
|
networkManager: new NetworkManager({
|
|
3138
3201
|
log: true,
|
|
@@ -3146,7 +3209,7 @@ var WorkerRuntime = class {
|
|
|
3146
3209
|
this._ready.wake(void 0);
|
|
3147
3210
|
log12("started", {}, {
|
|
3148
3211
|
file: "worker-runtime.ts",
|
|
3149
|
-
line:
|
|
3212
|
+
line: 61,
|
|
3150
3213
|
scope: this,
|
|
3151
3214
|
callSite: (f, a) => f(...a)
|
|
3152
3215
|
});
|
|
@@ -3154,7 +3217,7 @@ var WorkerRuntime = class {
|
|
|
3154
3217
|
this._ready.wake(err);
|
|
3155
3218
|
log12.catch(err, {}, {
|
|
3156
3219
|
file: "worker-runtime.ts",
|
|
3157
|
-
line:
|
|
3220
|
+
line: 64,
|
|
3158
3221
|
scope: this,
|
|
3159
3222
|
callSite: (f, a) => f(...a)
|
|
3160
3223
|
});
|
|
@@ -3168,17 +3231,7 @@ var WorkerRuntime = class {
|
|
|
3168
3231
|
*/
|
|
3169
3232
|
async createSession({ appPort, systemPort, shellPort }) {
|
|
3170
3233
|
const session = new WorkerSession({
|
|
3171
|
-
|
|
3172
|
-
const error = await this._ready.wait();
|
|
3173
|
-
if (error) {
|
|
3174
|
-
throw error;
|
|
3175
|
-
}
|
|
3176
|
-
const service = find(this._clientServices.services);
|
|
3177
|
-
if (!service) {
|
|
3178
|
-
throw new Error("Service not found");
|
|
3179
|
-
}
|
|
3180
|
-
return service;
|
|
3181
|
-
},
|
|
3234
|
+
serviceHost: this._clientServices,
|
|
3182
3235
|
appPort,
|
|
3183
3236
|
systemPort,
|
|
3184
3237
|
shellPort,
|
|
@@ -3412,7 +3465,7 @@ var ServiceContext = class {
|
|
|
3412
3465
|
// packages/sdk/client-services/src/packlets/services/service-registry.ts
|
|
3413
3466
|
var ServiceRegistry = class {
|
|
3414
3467
|
// prettier-ignore
|
|
3415
|
-
constructor(_serviceBundle, _handlers) {
|
|
3468
|
+
constructor(_serviceBundle, _handlers = {}) {
|
|
3416
3469
|
this._serviceBundle = _serviceBundle;
|
|
3417
3470
|
this._handlers = _handlers;
|
|
3418
3471
|
}
|
|
@@ -3425,6 +3478,12 @@ var ServiceRegistry = class {
|
|
|
3425
3478
|
setServices(services) {
|
|
3426
3479
|
this._handlers = services;
|
|
3427
3480
|
}
|
|
3481
|
+
addService(name, service) {
|
|
3482
|
+
this._handlers[name] = service;
|
|
3483
|
+
}
|
|
3484
|
+
removeService(name) {
|
|
3485
|
+
delete this._handlers[name];
|
|
3486
|
+
}
|
|
3428
3487
|
};
|
|
3429
3488
|
|
|
3430
3489
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
@@ -3434,16 +3493,20 @@ var ClientServicesHost = class {
|
|
|
3434
3493
|
modelFactory = createDefaultModelFactory(),
|
|
3435
3494
|
// TODO(burdon): Create ApolloLink abstraction (see Client).
|
|
3436
3495
|
networkManager,
|
|
3437
|
-
storage
|
|
3496
|
+
storage,
|
|
3438
3497
|
// TODO(wittjosiah): Turn this on by default.
|
|
3439
3498
|
lockKey
|
|
3440
|
-
}) {
|
|
3499
|
+
} = {}) {
|
|
3441
3500
|
this._statusUpdate = new Event6();
|
|
3442
3501
|
this._open = false;
|
|
3443
|
-
this._config = config;
|
|
3444
|
-
this._modelFactory = modelFactory;
|
|
3445
|
-
this._networkManager = networkManager;
|
|
3446
3502
|
this._storage = storage;
|
|
3503
|
+
this._modelFactory = modelFactory;
|
|
3504
|
+
if (config) {
|
|
3505
|
+
this.initialize({
|
|
3506
|
+
config,
|
|
3507
|
+
networkManager
|
|
3508
|
+
});
|
|
3509
|
+
}
|
|
3447
3510
|
this._resourceLock = lockKey ? new VaultResourceLock({
|
|
3448
3511
|
lockKey,
|
|
3449
3512
|
onAcquire: () => this.open(),
|
|
@@ -3466,27 +3529,52 @@ var ClientServicesHost = class {
|
|
|
3466
3529
|
await this._serviceContext.reset();
|
|
3467
3530
|
}
|
|
3468
3531
|
});
|
|
3469
|
-
this._serviceRegistry = new ServiceRegistry(
|
|
3532
|
+
this._serviceRegistry = new ServiceRegistry(clientServiceBundle, {
|
|
3470
3533
|
SystemService: this._systemService
|
|
3471
3534
|
});
|
|
3472
3535
|
}
|
|
3473
3536
|
get isOpen() {
|
|
3474
3537
|
return this._open;
|
|
3475
3538
|
}
|
|
3539
|
+
get serviceRegistry() {
|
|
3540
|
+
return this._serviceRegistry;
|
|
3541
|
+
}
|
|
3476
3542
|
get descriptors() {
|
|
3477
3543
|
return this._serviceRegistry.descriptors;
|
|
3478
3544
|
}
|
|
3479
3545
|
get services() {
|
|
3480
3546
|
return this._serviceRegistry.services;
|
|
3481
3547
|
}
|
|
3548
|
+
/**
|
|
3549
|
+
* Initialize the service host with the config.
|
|
3550
|
+
* Config can also be provided in the constructor.
|
|
3551
|
+
* Can only be called once.
|
|
3552
|
+
*/
|
|
3553
|
+
initialize({ config, networkManager }) {
|
|
3554
|
+
assert12(!this._open, "service host is open");
|
|
3555
|
+
if (config) {
|
|
3556
|
+
assert12(!this._config, "config already set");
|
|
3557
|
+
this._config = config;
|
|
3558
|
+
if (!this._storage) {
|
|
3559
|
+
this._storage = createStorageObjects(config.get("runtime.client.storage", {})).storage;
|
|
3560
|
+
}
|
|
3561
|
+
}
|
|
3562
|
+
if (networkManager) {
|
|
3563
|
+
assert12(!this._networkManager, "network manager already set");
|
|
3564
|
+
this._networkManager = networkManager;
|
|
3565
|
+
}
|
|
3566
|
+
}
|
|
3482
3567
|
async open() {
|
|
3483
3568
|
var _a, _b;
|
|
3484
3569
|
if (this._open) {
|
|
3485
3570
|
return;
|
|
3486
3571
|
}
|
|
3572
|
+
assert12(this._config, "config not set");
|
|
3573
|
+
assert12(this._storage, "storage not set");
|
|
3574
|
+
assert12(this._networkManager, "network manager not set");
|
|
3487
3575
|
log14("opening...", {}, {
|
|
3488
3576
|
file: "service-host.ts",
|
|
3489
|
-
line:
|
|
3577
|
+
line: 166,
|
|
3490
3578
|
scope: this,
|
|
3491
3579
|
callSite: (f, a) => f(...a)
|
|
3492
3580
|
});
|
|
@@ -3499,10 +3587,10 @@ var ClientServicesHost = class {
|
|
|
3499
3587
|
DeviceInvitationsService: new DeviceInvitationsServiceImpl(this._serviceContext.identityManager, this._serviceContext.deviceInvitations),
|
|
3500
3588
|
SpaceInvitationsService: new SpaceInvitationsServiceImpl(this._serviceContext.identityManager, () => {
|
|
3501
3589
|
var _a2;
|
|
3502
|
-
return (_a2 = this._serviceContext.spaceInvitations) != null ? _a2 :
|
|
3590
|
+
return (_a2 = this._serviceContext.spaceInvitations) != null ? _a2 : raise3(new Error("SpaceInvitations not initialized"));
|
|
3503
3591
|
}, () => {
|
|
3504
3592
|
var _a2;
|
|
3505
|
-
return (_a2 = this._serviceContext.dataSpaceManager) != null ? _a2 :
|
|
3593
|
+
return (_a2 = this._serviceContext.dataSpaceManager) != null ? _a2 : raise3(new Error("SpaceManager not initialized"));
|
|
3506
3594
|
}),
|
|
3507
3595
|
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
|
|
3508
3596
|
await this._serviceContext.initialized.wait();
|
|
@@ -3526,7 +3614,7 @@ var ClientServicesHost = class {
|
|
|
3526
3614
|
deviceKey
|
|
3527
3615
|
}, {
|
|
3528
3616
|
file: "service-host.ts",
|
|
3529
|
-
line:
|
|
3617
|
+
line: 219,
|
|
3530
3618
|
scope: this,
|
|
3531
3619
|
callSite: (f, a) => f(...a)
|
|
3532
3620
|
});
|
|
@@ -3541,7 +3629,7 @@ var ClientServicesHost = class {
|
|
|
3541
3629
|
deviceKey
|
|
3542
3630
|
}, {
|
|
3543
3631
|
file: "service-host.ts",
|
|
3544
|
-
line:
|
|
3632
|
+
line: 228,
|
|
3545
3633
|
scope: this,
|
|
3546
3634
|
callSite: (f, a) => f(...a)
|
|
3547
3635
|
});
|
|
@@ -3555,7 +3643,7 @@ var ClientServicesHost = class {
|
|
|
3555
3643
|
deviceKey
|
|
3556
3644
|
}, {
|
|
3557
3645
|
file: "service-host.ts",
|
|
3558
|
-
line:
|
|
3646
|
+
line: 233,
|
|
3559
3647
|
scope: this,
|
|
3560
3648
|
callSite: (f, a) => f(...a)
|
|
3561
3649
|
});
|
|
@@ -3573,6 +3661,9 @@ var LocalClientServices = class {
|
|
|
3573
3661
|
get services() {
|
|
3574
3662
|
return this._host.services;
|
|
3575
3663
|
}
|
|
3664
|
+
get host() {
|
|
3665
|
+
return this._host;
|
|
3666
|
+
}
|
|
3576
3667
|
async open() {
|
|
3577
3668
|
await this._host.open();
|
|
3578
3669
|
}
|
|
@@ -3637,17 +3728,6 @@ var IFrameHostRuntime = class {
|
|
|
3637
3728
|
this._configProvider = configProvider;
|
|
3638
3729
|
this._appPort = appPort;
|
|
3639
3730
|
this._shellPort = shellPort;
|
|
3640
|
-
this._getService = async (find) => {
|
|
3641
|
-
const error = await this._ready.wait();
|
|
3642
|
-
if (error) {
|
|
3643
|
-
throw error;
|
|
3644
|
-
}
|
|
3645
|
-
const service = await find(this._clientServices.services);
|
|
3646
|
-
if (!service) {
|
|
3647
|
-
throw new Error("Service not found");
|
|
3648
|
-
}
|
|
3649
|
-
return service;
|
|
3650
|
-
};
|
|
3651
3731
|
if (this._shellPort) {
|
|
3652
3732
|
this._shellRuntime = new ShellRuntimeImpl(this._shellPort);
|
|
3653
3733
|
}
|
|
@@ -3662,7 +3742,7 @@ var IFrameHostRuntime = class {
|
|
|
3662
3742
|
var _a;
|
|
3663
3743
|
log16("starting...", {}, {
|
|
3664
3744
|
file: "iframe-host-runtime.ts",
|
|
3665
|
-
line:
|
|
3745
|
+
line: 67,
|
|
3666
3746
|
scope: this,
|
|
3667
3747
|
callSite: (f, a) => f(...a)
|
|
3668
3748
|
});
|
|
@@ -3680,21 +3760,30 @@ var IFrameHostRuntime = class {
|
|
|
3680
3760
|
transportFactory: this._transportFactory
|
|
3681
3761
|
})
|
|
3682
3762
|
});
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
SpaceInvitationsService: async () => await this._getService((services) => services.SpaceInvitationsService),
|
|
3693
|
-
SpacesService: async () => await this._getService((services) => services.SpacesService),
|
|
3694
|
-
SystemService: async () => await this._getService((services) => services.SystemService),
|
|
3695
|
-
TracingService: async () => await this._getService((services) => services.TracingService)
|
|
3763
|
+
const middleware = {
|
|
3764
|
+
handleCall: async (method, params, handler) => {
|
|
3765
|
+
const error = await this._ready.wait({
|
|
3766
|
+
timeout: 3e3
|
|
3767
|
+
});
|
|
3768
|
+
if (error) {
|
|
3769
|
+
throw error;
|
|
3770
|
+
}
|
|
3771
|
+
return handler(method, params);
|
|
3696
3772
|
},
|
|
3697
|
-
|
|
3773
|
+
handleStream: async (method, params, handler) => {
|
|
3774
|
+
const error = await this._ready.wait({
|
|
3775
|
+
timeout: 3e3
|
|
3776
|
+
});
|
|
3777
|
+
if (error) {
|
|
3778
|
+
throw error;
|
|
3779
|
+
}
|
|
3780
|
+
return handler(method, params);
|
|
3781
|
+
}
|
|
3782
|
+
};
|
|
3783
|
+
this._clientRpc = new ClientRpcServer({
|
|
3784
|
+
serviceRegistry: this._clientServices.host.serviceRegistry,
|
|
3785
|
+
port: this._appPort,
|
|
3786
|
+
...middleware
|
|
3698
3787
|
});
|
|
3699
3788
|
await Promise.all([
|
|
3700
3789
|
this._clientServices.open(),
|
|
@@ -3704,7 +3793,7 @@ var IFrameHostRuntime = class {
|
|
|
3704
3793
|
this._ready.wake(void 0);
|
|
3705
3794
|
log16("started", {}, {
|
|
3706
3795
|
file: "iframe-host-runtime.ts",
|
|
3707
|
-
line:
|
|
3796
|
+
line: 110,
|
|
3708
3797
|
scope: this,
|
|
3709
3798
|
callSite: (f, a) => f(...a)
|
|
3710
3799
|
});
|
|
@@ -3712,7 +3801,7 @@ var IFrameHostRuntime = class {
|
|
|
3712
3801
|
this._ready.wake(err);
|
|
3713
3802
|
log16.catch(err, {}, {
|
|
3714
3803
|
file: "iframe-host-runtime.ts",
|
|
3715
|
-
line:
|
|
3804
|
+
line: 113,
|
|
3716
3805
|
scope: this,
|
|
3717
3806
|
callSite: (f, a) => f(...a)
|
|
3718
3807
|
});
|
|
@@ -3722,7 +3811,7 @@ var IFrameHostRuntime = class {
|
|
|
3722
3811
|
var _a;
|
|
3723
3812
|
log16("stopping...", {}, {
|
|
3724
3813
|
file: "iframe-host-runtime.ts",
|
|
3725
|
-
line:
|
|
3814
|
+
line: 118,
|
|
3726
3815
|
scope: this,
|
|
3727
3816
|
callSite: (f, a) => f(...a)
|
|
3728
3817
|
});
|
|
@@ -3731,7 +3820,7 @@ var IFrameHostRuntime = class {
|
|
|
3731
3820
|
await ((_a = this._shellRuntime) == null ? void 0 : _a.close());
|
|
3732
3821
|
log16("stopped", {}, {
|
|
3733
3822
|
file: "iframe-host-runtime.ts",
|
|
3734
|
-
line:
|
|
3823
|
+
line: 122,
|
|
3735
3824
|
scope: this,
|
|
3736
3825
|
callSite: (f, a) => f(...a)
|
|
3737
3826
|
});
|
|
@@ -3776,4 +3865,4 @@ export {
|
|
|
3776
3865
|
LocalClientServices,
|
|
3777
3866
|
fromHost
|
|
3778
3867
|
};
|
|
3779
|
-
//# sourceMappingURL=chunk-
|
|
3868
|
+
//# sourceMappingURL=chunk-ZIQUYEJS.mjs.map
|