@dxos/client-services 0.1.25-next.3c6b542 → 0.1.26
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-WF53R6F7.mjs → chunk-R2FEBB66.mjs} +95 -325
- package/dist/lib/browser/chunk-R2FEBB66.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -11
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +3 -3
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +111 -350
- 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 +110 -228
- package/dist/lib/node/packlets/testing/index.cjs.map +4 -4
- package/dist/types/src/packlets/identity/authenticator.d.ts +1 -1
- package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts +1 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts +2 -2
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitations-handler.d.ts +1 -1
- package/dist/types/src/packlets/invitations/space-invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts +4 -11
- 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 +1 -6
- package/dist/types/src/packlets/vault/iframe-proxy-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/index.d.ts +0 -2
- package/dist/types/src/packlets/vault/index.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/services.d.ts +1 -9
- package/dist/types/src/packlets/vault/services.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/worker-runtime.d.ts +1 -2
- package/dist/types/src/packlets/vault/worker-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/worker-session.d.ts +1 -4
- package/dist/types/src/packlets/vault/worker-session.d.ts.map +1 -1
- package/package.json +28 -29
- package/src/packlets/devtools/spaces.ts +1 -1
- package/src/packlets/identity/authenticator.ts +1 -1
- package/src/packlets/identity/identity-manager.test.ts +1 -1
- package/src/packlets/identity/identity-manager.ts +1 -1
- package/src/packlets/identity/identity.test.ts +1 -1
- package/src/packlets/identity/identity.ts +1 -1
- package/src/packlets/invitations/space-invitations-handler.test.ts +1 -1
- package/src/packlets/invitations/space-invitations-handler.ts +1 -1
- package/src/packlets/services/service-context.ts +2 -2
- package/src/packlets/services/service-host.ts +1 -1
- package/src/packlets/spaces/data-space-manager.test.ts +1 -1
- package/src/packlets/spaces/data-space-manager.ts +4 -4
- package/src/packlets/spaces/data-space.ts +3 -3
- package/src/packlets/spaces/spaces-service.ts +1 -1
- package/src/packlets/testing/test-builder.ts +3 -3
- package/src/packlets/vault/iframe-host-runtime.ts +7 -26
- package/src/packlets/vault/iframe-proxy-runtime.ts +1 -16
- package/src/packlets/vault/index.ts +0 -2
- package/src/packlets/vault/services.ts +1 -17
- package/src/packlets/vault/worker-runtime.ts +1 -3
- package/src/packlets/vault/worker-session.ts +19 -29
- package/dist/lib/browser/chunk-WF53R6F7.mjs.map +0 -7
- package/dist/types/src/packlets/vault/shell-controller.d.ts +0 -24
- package/dist/types/src/packlets/vault/shell-controller.d.ts.map +0 -1
- package/dist/types/src/packlets/vault/shell-runtime.d.ts +0 -45
- package/dist/types/src/packlets/vault/shell-runtime.d.ts.map +0 -1
- package/src/packlets/vault/shell-controller.ts +0 -78
- package/src/packlets/vault/shell-runtime.ts +0 -133
package/dist/lib/node/index.cjs
CHANGED
|
@@ -49,13 +49,10 @@ __export(src_exports, {
|
|
|
49
49
|
IdentityManager: () => IdentityManager,
|
|
50
50
|
InvitationEncoder: () => InvitationEncoder,
|
|
51
51
|
InvitationObservableProvider: () => InvitationObservableProvider,
|
|
52
|
-
MemoryShellRuntime: () => MemoryShellRuntime,
|
|
53
52
|
ON_CLOSE_DELAY: () => ON_CLOSE_DELAY,
|
|
54
53
|
ProfileServiceImpl: () => ProfileServiceImpl,
|
|
55
54
|
ServiceContext: () => ServiceContext,
|
|
56
55
|
ServiceRegistry: () => ServiceRegistry,
|
|
57
|
-
ShellController: () => ShellController,
|
|
58
|
-
ShellRuntimeImpl: () => ShellRuntimeImpl,
|
|
59
56
|
SpaceInvitationsHandler: () => SpaceInvitationsHandler,
|
|
60
57
|
SpaceInvitationsProxy: () => SpaceInvitationsProxy,
|
|
61
58
|
SpaceInvitationsServiceImpl: () => SpaceInvitationsServiceImpl,
|
|
@@ -66,14 +63,12 @@ __export(src_exports, {
|
|
|
66
63
|
VaultResourceLock: () => VaultResourceLock,
|
|
67
64
|
WorkerRuntime: () => WorkerRuntime,
|
|
68
65
|
WorkerSession: () => WorkerSession,
|
|
69
|
-
appServiceBundle: () => appServiceBundle,
|
|
70
66
|
clientServiceBundle: () => clientServiceBundle,
|
|
71
67
|
createAuthProvider: () => createAuthProvider,
|
|
72
68
|
createDefaultModelFactory: () => createDefaultModelFactory,
|
|
73
69
|
createStorageObjects: () => createStorageObjects,
|
|
74
70
|
getNetworkPeers: () => getNetworkPeers,
|
|
75
71
|
iframeServiceBundle: () => iframeServiceBundle,
|
|
76
|
-
shellServiceBundle: () => shellServiceBundle,
|
|
77
72
|
subscribeToFeedBlocks: () => subscribeToFeedBlocks,
|
|
78
73
|
subscribeToFeeds: () => subscribeToFeeds,
|
|
79
74
|
subscribeToNetworkStatus: () => subscribeToNetworkStatus,
|
|
@@ -2272,7 +2267,7 @@ var SpaceInvitationsServiceImpl = class extends AbstractInvitationsService {
|
|
|
2272
2267
|
var import_async13 = require("@dxos/async");
|
|
2273
2268
|
var import_credentials11 = require("@dxos/credentials");
|
|
2274
2269
|
var import_debug5 = require("@dxos/debug");
|
|
2275
|
-
var
|
|
2270
|
+
var import_echo_db3 = require("@dxos/echo-db");
|
|
2276
2271
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
2277
2272
|
var import_keyring = require("@dxos/keyring");
|
|
2278
2273
|
var import_log11 = require("@dxos/log");
|
|
@@ -2282,7 +2277,7 @@ var import_node_assert12 = __toESM(require("node:assert"));
|
|
|
2282
2277
|
var import_async12 = require("@dxos/async");
|
|
2283
2278
|
var import_context7 = require("@dxos/context");
|
|
2284
2279
|
var import_credentials10 = require("@dxos/credentials");
|
|
2285
|
-
var
|
|
2280
|
+
var import_echo_db2 = require("@dxos/echo-db");
|
|
2286
2281
|
var import_keys8 = require("@dxos/keys");
|
|
2287
2282
|
var import_log10 = require("@dxos/log");
|
|
2288
2283
|
var import_teleport_extension_presence = require("@dxos/teleport-extension-presence");
|
|
@@ -2292,7 +2287,7 @@ var import_util6 = require("@dxos/util");
|
|
|
2292
2287
|
var import_async11 = require("@dxos/async");
|
|
2293
2288
|
var import_context6 = require("@dxos/context");
|
|
2294
2289
|
var import_debug4 = require("@dxos/debug");
|
|
2295
|
-
var
|
|
2290
|
+
var import_echo_db = require("@dxos/echo-db");
|
|
2296
2291
|
var import_keys7 = require("@dxos/keys");
|
|
2297
2292
|
var import_credentials9 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
2298
2293
|
var import_util5 = require("@dxos/util");
|
|
@@ -2555,7 +2550,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2555
2550
|
this._feedStore = params.feedStore;
|
|
2556
2551
|
this._metadataStore = params.metadataStore;
|
|
2557
2552
|
this._signingContext = params.signingContext;
|
|
2558
|
-
this._dataPipelineController = new
|
|
2553
|
+
this._dataPipelineController = new import_echo_db.DataPipelineControllerImpl({
|
|
2559
2554
|
modelFactory: params.modelFactory,
|
|
2560
2555
|
metadataStore: params.metadataStore,
|
|
2561
2556
|
snapshotManager: params.snapshotManager,
|
|
@@ -2611,7 +2606,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2611
2606
|
timeout: CONTROL_PIPELINE_READY_TIMEFRAME
|
|
2612
2607
|
});
|
|
2613
2608
|
await this._createWritableFeeds();
|
|
2614
|
-
this.notarizationPlugin.setWriter((0,
|
|
2609
|
+
this.notarizationPlugin.setWriter((0, import_echo_db.createMappedFeedWriter)((credential) => ({
|
|
2615
2610
|
credential: {
|
|
2616
2611
|
credential
|
|
2617
2612
|
}
|
|
@@ -2761,7 +2756,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2761
2756
|
callSite: (f, a) => f(...a)
|
|
2762
2757
|
});
|
|
2763
2758
|
const space = await this._constructSpace(metadata);
|
|
2764
|
-
const credentials = await (0,
|
|
2759
|
+
const credentials = await (0, import_echo_db2.spaceGenesis)(this._keyring, this._signingContext, space.inner);
|
|
2765
2760
|
await this._metadataStore.addSpace(metadata);
|
|
2766
2761
|
const memberCredential = credentials[1];
|
|
2767
2762
|
(0, import_node_assert12.default)((0, import_credentials10.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember");
|
|
@@ -2792,7 +2787,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2792
2787
|
offlineTimeout: 3e4,
|
|
2793
2788
|
identityKey: this._signingContext.identityKey
|
|
2794
2789
|
});
|
|
2795
|
-
const snapshotManager = new
|
|
2790
|
+
const snapshotManager = new import_echo_db2.SnapshotManager(this._snapshotStore);
|
|
2796
2791
|
const controlFeed = metadata.controlFeedKey && await this._feedStore.openFeed(metadata.controlFeedKey, {
|
|
2797
2792
|
writable: true
|
|
2798
2793
|
});
|
|
@@ -2857,20 +2852,20 @@ var ServiceContext = class {
|
|
|
2857
2852
|
this.networkManager = networkManager;
|
|
2858
2853
|
this.modelFactory = modelFactory;
|
|
2859
2854
|
this.initialized = new import_async13.Trigger();
|
|
2860
|
-
this.dataServiceSubscriptions = new
|
|
2861
|
-
this.metadataStore = new
|
|
2862
|
-
this.snapshotStore = new
|
|
2855
|
+
this.dataServiceSubscriptions = new import_echo_db3.DataServiceSubscriptions();
|
|
2856
|
+
this.metadataStore = new import_echo_db3.MetadataStore(storage.createDirectory("metadata"));
|
|
2857
|
+
this.snapshotStore = new import_echo_db3.SnapshotStore(storage.createDirectory("snapshots"));
|
|
2863
2858
|
this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
|
|
2864
2859
|
this.feedStore = new import_feed_store4.FeedStore({
|
|
2865
2860
|
factory: new import_feed_store4.FeedFactory({
|
|
2866
2861
|
root: storage.createDirectory("feeds"),
|
|
2867
2862
|
signer: this.keyring,
|
|
2868
2863
|
hypercore: {
|
|
2869
|
-
valueEncoding:
|
|
2864
|
+
valueEncoding: import_echo_db3.valueEncoding
|
|
2870
2865
|
}
|
|
2871
2866
|
})
|
|
2872
2867
|
});
|
|
2873
|
-
this.spaceManager = new
|
|
2868
|
+
this.spaceManager = new import_echo_db3.SpaceManager({
|
|
2874
2869
|
feedStore: this.feedStore,
|
|
2875
2870
|
networkManager: this.networkManager
|
|
2876
2871
|
});
|
|
@@ -3059,8 +3054,8 @@ var clientServiceBundle = (0, import_rpc.createServiceBundle)({
|
|
|
3059
3054
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
3060
3055
|
var import_debug7 = require("@dxos/debug");
|
|
3061
3056
|
var import_document_model = require("@dxos/document-model");
|
|
3062
|
-
var
|
|
3063
|
-
var
|
|
3057
|
+
var import_echo_db5 = require("@dxos/echo-db");
|
|
3058
|
+
var import_log16 = require("@dxos/log");
|
|
3064
3059
|
var import_model_factory = require("@dxos/model-factory");
|
|
3065
3060
|
var import_client2 = require("@dxos/protocols/proto/dxos/client");
|
|
3066
3061
|
var import_text_model = require("@dxos/text-model");
|
|
@@ -3133,7 +3128,7 @@ var NetworkServiceImpl = class {
|
|
|
3133
3128
|
var import_async15 = require("@dxos/async");
|
|
3134
3129
|
var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
3135
3130
|
var import_debug6 = require("@dxos/debug");
|
|
3136
|
-
var
|
|
3131
|
+
var import_echo_db4 = require("@dxos/echo-db");
|
|
3137
3132
|
var SpacesServiceImpl = class {
|
|
3138
3133
|
constructor(_spaceManager) {
|
|
3139
3134
|
this._spaceManager = _spaceManager;
|
|
@@ -3150,7 +3145,7 @@ var SpacesServiceImpl = class {
|
|
|
3150
3145
|
queryCredentials({ spaceKey }) {
|
|
3151
3146
|
return new import_codec_protobuf11.Stream(({ ctx, next }) => {
|
|
3152
3147
|
var _a;
|
|
3153
|
-
const space = (_a = this._spaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new
|
|
3148
|
+
const space = (_a = this._spaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new import_echo_db4.SpaceNotFoundError(spaceKey));
|
|
3154
3149
|
const processor = space.spaceState.registerProcessor({
|
|
3155
3150
|
process: async (credential) => {
|
|
3156
3151
|
next(credential);
|
|
@@ -3162,7 +3157,7 @@ var SpacesServiceImpl = class {
|
|
|
3162
3157
|
}
|
|
3163
3158
|
async writeCredentials({ spaceKey, credentials }) {
|
|
3164
3159
|
var _a;
|
|
3165
|
-
const space = (_a = this._spaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new
|
|
3160
|
+
const space = (_a = this._spaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new import_echo_db4.SpaceNotFoundError(spaceKey));
|
|
3166
3161
|
for (const credential of credentials != null ? credentials : []) {
|
|
3167
3162
|
await space.controlPipeline.writer.write({
|
|
3168
3163
|
credential: {
|
|
@@ -3219,130 +3214,11 @@ var toStorageType = (type) => {
|
|
|
3219
3214
|
};
|
|
3220
3215
|
|
|
3221
3216
|
// packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
|
|
3222
|
-
var
|
|
3217
|
+
var import_async16 = require("@dxos/async");
|
|
3223
3218
|
var import_log12 = require("@dxos/log");
|
|
3224
3219
|
var import_messaging = require("@dxos/messaging");
|
|
3225
3220
|
var import_network_manager3 = require("@dxos/network-manager");
|
|
3226
|
-
var import_rpc3 = require("@dxos/rpc");
|
|
3227
|
-
var import_util7 = require("@dxos/util");
|
|
3228
|
-
|
|
3229
|
-
// packages/sdk/client-services/src/packlets/vault/shell-runtime.ts
|
|
3230
|
-
var import_node_assert13 = __toESM(require("node:assert"));
|
|
3231
|
-
var import_async16 = require("@dxos/async");
|
|
3232
|
-
var import_iframe = require("@dxos/protocols/proto/dxos/iframe");
|
|
3233
3221
|
var import_rpc2 = require("@dxos/rpc");
|
|
3234
|
-
|
|
3235
|
-
// packages/sdk/client-services/src/packlets/vault/services.ts
|
|
3236
|
-
var import_protocols7 = require("@dxos/protocols");
|
|
3237
|
-
var iframeServiceBundle = {
|
|
3238
|
-
IframeService: import_protocols7.schema.getService("dxos.iframe.IframeService"),
|
|
3239
|
-
BridgeService: import_protocols7.schema.getService("dxos.mesh.bridge.BridgeService")
|
|
3240
|
-
};
|
|
3241
|
-
var workerServiceBundle = {
|
|
3242
|
-
WorkerService: import_protocols7.schema.getService("dxos.iframe.WorkerService")
|
|
3243
|
-
};
|
|
3244
|
-
var appServiceBundle = {
|
|
3245
|
-
AppService: import_protocols7.schema.getService("dxos.iframe.AppService")
|
|
3246
|
-
};
|
|
3247
|
-
var shellServiceBundle = {
|
|
3248
|
-
ShellService: import_protocols7.schema.getService("dxos.iframe.ShellService")
|
|
3249
|
-
};
|
|
3250
|
-
|
|
3251
|
-
// packages/sdk/client-services/src/packlets/vault/shell-runtime.ts
|
|
3252
|
-
var ShellRuntimeImpl = class {
|
|
3253
|
-
constructor(_port) {
|
|
3254
|
-
this._port = _port;
|
|
3255
|
-
this.layoutUpdate = new import_async16.Event();
|
|
3256
|
-
this._layout = import_iframe.ShellLayout.DEFAULT;
|
|
3257
|
-
}
|
|
3258
|
-
get layout() {
|
|
3259
|
-
return this._layout;
|
|
3260
|
-
}
|
|
3261
|
-
get invitationCode() {
|
|
3262
|
-
return this._invitationCode;
|
|
3263
|
-
}
|
|
3264
|
-
get spaceKey() {
|
|
3265
|
-
return this._spaceKey;
|
|
3266
|
-
}
|
|
3267
|
-
setLayout(layout, options = {}) {
|
|
3268
|
-
this._layout = layout;
|
|
3269
|
-
this._invitationCode = options.invitationCode;
|
|
3270
|
-
this._spaceKey = options.spaceKey;
|
|
3271
|
-
this.layoutUpdate.emit({
|
|
3272
|
-
layout,
|
|
3273
|
-
...options
|
|
3274
|
-
});
|
|
3275
|
-
}
|
|
3276
|
-
async setAppContext(context) {
|
|
3277
|
-
(0, import_node_assert13.default)(this._appRpc, "runtime not open");
|
|
3278
|
-
if (context.spaceKey) {
|
|
3279
|
-
this._spaceKey = context.spaceKey;
|
|
3280
|
-
}
|
|
3281
|
-
if (context.invitationCode) {
|
|
3282
|
-
this._invitationCode = context.invitationCode;
|
|
3283
|
-
}
|
|
3284
|
-
await this._appRpc.rpc.AppService.setContext({
|
|
3285
|
-
...context,
|
|
3286
|
-
spaceKey: this._spaceKey,
|
|
3287
|
-
invitationCode: this._invitationCode
|
|
3288
|
-
});
|
|
3289
|
-
}
|
|
3290
|
-
async open() {
|
|
3291
|
-
this._appRpc = (0, import_rpc2.createProtoRpcPeer)({
|
|
3292
|
-
requested: appServiceBundle,
|
|
3293
|
-
exposed: shellServiceBundle,
|
|
3294
|
-
handlers: {
|
|
3295
|
-
ShellService: {
|
|
3296
|
-
setLayout: async (request) => {
|
|
3297
|
-
this._layout = request.layout;
|
|
3298
|
-
this._invitationCode = request.invitationCode;
|
|
3299
|
-
this._spaceKey = request.spaceKey;
|
|
3300
|
-
this.layoutUpdate.emit(request);
|
|
3301
|
-
}
|
|
3302
|
-
}
|
|
3303
|
-
},
|
|
3304
|
-
port: this._port
|
|
3305
|
-
});
|
|
3306
|
-
await this._appRpc.open();
|
|
3307
|
-
}
|
|
3308
|
-
async close() {
|
|
3309
|
-
var _a;
|
|
3310
|
-
await ((_a = this._appRpc) == null ? void 0 : _a.close());
|
|
3311
|
-
this._appRpc = void 0;
|
|
3312
|
-
}
|
|
3313
|
-
};
|
|
3314
|
-
var MemoryShellRuntime = class {
|
|
3315
|
-
constructor({ layout, invitationCode, spaceKey } = {}) {
|
|
3316
|
-
this.layoutUpdate = new import_async16.Event();
|
|
3317
|
-
this.contextUpdate = new import_async16.Event();
|
|
3318
|
-
this._layout = layout != null ? layout : import_iframe.ShellLayout.DEFAULT;
|
|
3319
|
-
this._invitationCode = invitationCode;
|
|
3320
|
-
this._spaceKey = spaceKey;
|
|
3321
|
-
}
|
|
3322
|
-
get layout() {
|
|
3323
|
-
return this._layout;
|
|
3324
|
-
}
|
|
3325
|
-
get invitationCode() {
|
|
3326
|
-
return this._invitationCode;
|
|
3327
|
-
}
|
|
3328
|
-
get spaceKey() {
|
|
3329
|
-
return this._spaceKey;
|
|
3330
|
-
}
|
|
3331
|
-
setLayout(layout, options = {}) {
|
|
3332
|
-
this._layout = layout;
|
|
3333
|
-
this._invitationCode = options.invitationCode;
|
|
3334
|
-
this._spaceKey = options.spaceKey;
|
|
3335
|
-
this.layoutUpdate.emit({
|
|
3336
|
-
layout,
|
|
3337
|
-
...options
|
|
3338
|
-
});
|
|
3339
|
-
}
|
|
3340
|
-
async setAppContext(context) {
|
|
3341
|
-
this.contextUpdate.emit(context);
|
|
3342
|
-
}
|
|
3343
|
-
};
|
|
3344
|
-
|
|
3345
|
-
// packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
|
|
3346
3222
|
var __decorate3 = function(decorators, target, key, desc) {
|
|
3347
3223
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3348
3224
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -3355,12 +3231,11 @@ var __decorate3 = function(decorators, target, key, desc) {
|
|
|
3355
3231
|
};
|
|
3356
3232
|
var LOCK_KEY = "DXOS_RESOURCE_LOCK";
|
|
3357
3233
|
var IFrameHostRuntime = class {
|
|
3358
|
-
constructor({ configProvider, appPort
|
|
3234
|
+
constructor({ configProvider, appPort }) {
|
|
3359
3235
|
this._transportFactory = (0, import_network_manager3.createWebRTCTransportFactory)();
|
|
3360
|
-
this._ready = new
|
|
3236
|
+
this._ready = new import_async16.Trigger();
|
|
3361
3237
|
this._configProvider = configProvider;
|
|
3362
3238
|
this._appPort = appPort;
|
|
3363
|
-
this._shellPort = shellPort;
|
|
3364
3239
|
this._getService = async (find) => {
|
|
3365
3240
|
const error = await this._ready.wait();
|
|
3366
3241
|
if (error) {
|
|
@@ -3372,26 +3247,16 @@ var IFrameHostRuntime = class {
|
|
|
3372
3247
|
}
|
|
3373
3248
|
return service;
|
|
3374
3249
|
};
|
|
3375
|
-
if (this._shellPort) {
|
|
3376
|
-
this._shellRuntime = new ShellRuntimeImpl(this._shellPort);
|
|
3377
|
-
}
|
|
3378
|
-
}
|
|
3379
|
-
get services() {
|
|
3380
|
-
return this._clientServices;
|
|
3381
|
-
}
|
|
3382
|
-
get shell() {
|
|
3383
|
-
return this._shellRuntime;
|
|
3384
3250
|
}
|
|
3385
3251
|
async start() {
|
|
3386
|
-
var _a;
|
|
3387
3252
|
(0, import_log12.log)("starting...", {}, {
|
|
3388
3253
|
file: "iframe-host-runtime.ts",
|
|
3389
|
-
line:
|
|
3254
|
+
line: 63,
|
|
3390
3255
|
scope: this,
|
|
3391
3256
|
callSite: (f, a) => f(...a)
|
|
3392
3257
|
});
|
|
3393
3258
|
try {
|
|
3394
|
-
this._config = await
|
|
3259
|
+
this._config = await this._configProvider();
|
|
3395
3260
|
const signalServer = this._config.get("runtime.services.signal.server");
|
|
3396
3261
|
this._clientServices = new ClientServicesHost({
|
|
3397
3262
|
lockKey: LOCK_KEY,
|
|
@@ -3404,7 +3269,7 @@ var IFrameHostRuntime = class {
|
|
|
3404
3269
|
transportFactory: this._transportFactory
|
|
3405
3270
|
})
|
|
3406
3271
|
});
|
|
3407
|
-
this._clientRpc = (0,
|
|
3272
|
+
this._clientRpc = (0, import_rpc2.createProtoRpcPeer)({
|
|
3408
3273
|
exposed: clientServiceBundle,
|
|
3409
3274
|
handlers: {
|
|
3410
3275
|
DataService: async () => await this._getService((services) => services.DataService),
|
|
@@ -3423,13 +3288,12 @@ var IFrameHostRuntime = class {
|
|
|
3423
3288
|
});
|
|
3424
3289
|
await Promise.all([
|
|
3425
3290
|
this._clientServices.open(),
|
|
3426
|
-
this._clientRpc.open()
|
|
3427
|
-
(_a = this._shellRuntime) == null ? void 0 : _a.open()
|
|
3291
|
+
this._clientRpc.open()
|
|
3428
3292
|
]);
|
|
3429
3293
|
this._ready.wake(void 0);
|
|
3430
3294
|
(0, import_log12.log)("started", {}, {
|
|
3431
3295
|
file: "iframe-host-runtime.ts",
|
|
3432
|
-
line:
|
|
3296
|
+
line: 99,
|
|
3433
3297
|
scope: this,
|
|
3434
3298
|
callSite: (f, a) => f(...a)
|
|
3435
3299
|
});
|
|
@@ -3437,26 +3301,24 @@ var IFrameHostRuntime = class {
|
|
|
3437
3301
|
this._ready.wake(err);
|
|
3438
3302
|
import_log12.log.catch(err, {}, {
|
|
3439
3303
|
file: "iframe-host-runtime.ts",
|
|
3440
|
-
line:
|
|
3304
|
+
line: 102,
|
|
3441
3305
|
scope: this,
|
|
3442
3306
|
callSite: (f, a) => f(...a)
|
|
3443
3307
|
});
|
|
3444
3308
|
}
|
|
3445
3309
|
}
|
|
3446
3310
|
async stop() {
|
|
3447
|
-
var _a;
|
|
3448
3311
|
(0, import_log12.log)("stopping...", {}, {
|
|
3449
3312
|
file: "iframe-host-runtime.ts",
|
|
3450
|
-
line:
|
|
3313
|
+
line: 107,
|
|
3451
3314
|
scope: this,
|
|
3452
3315
|
callSite: (f, a) => f(...a)
|
|
3453
3316
|
});
|
|
3454
3317
|
await this._clientRpc.close();
|
|
3455
3318
|
await this._clientServices.close();
|
|
3456
|
-
await ((_a = this._shellRuntime) == null ? void 0 : _a.close());
|
|
3457
3319
|
(0, import_log12.log)("stopped", {}, {
|
|
3458
3320
|
file: "iframe-host-runtime.ts",
|
|
3459
|
-
line:
|
|
3321
|
+
line: 110,
|
|
3460
3322
|
scope: this,
|
|
3461
3323
|
callSite: (f, a) => f(...a)
|
|
3462
3324
|
});
|
|
@@ -3468,15 +3330,26 @@ __decorate3([
|
|
|
3468
3330
|
|
|
3469
3331
|
// packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts
|
|
3470
3332
|
var import_network_manager4 = require("@dxos/network-manager");
|
|
3471
|
-
var
|
|
3333
|
+
var import_rpc3 = require("@dxos/rpc");
|
|
3334
|
+
|
|
3335
|
+
// packages/sdk/client-services/src/packlets/vault/services.ts
|
|
3336
|
+
var import_protocols7 = require("@dxos/protocols");
|
|
3337
|
+
var iframeServiceBundle = {
|
|
3338
|
+
IframeService: import_protocols7.schema.getService("dxos.iframe.IframeService"),
|
|
3339
|
+
BridgeService: import_protocols7.schema.getService("dxos.mesh.bridge.BridgeService")
|
|
3340
|
+
};
|
|
3341
|
+
var workerServiceBundle = {
|
|
3342
|
+
WorkerService: import_protocols7.schema.getService("dxos.iframe.WorkerService")
|
|
3343
|
+
};
|
|
3344
|
+
|
|
3345
|
+
// packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts
|
|
3472
3346
|
var IFrameProxyRuntime = class {
|
|
3473
|
-
constructor({ systemPort, workerAppPort, windowAppPort
|
|
3347
|
+
constructor({ systemPort, workerAppPort, windowAppPort }) {
|
|
3474
3348
|
this._transportService = new import_network_manager4.WebRTCTransportService();
|
|
3475
3349
|
this._systemPort = systemPort;
|
|
3476
3350
|
this._windowAppPort = windowAppPort;
|
|
3477
3351
|
this._workerAppPort = workerAppPort;
|
|
3478
|
-
this.
|
|
3479
|
-
this._systemRpc = (0, import_rpc4.createProtoRpcPeer)({
|
|
3352
|
+
this._systemRpc = (0, import_rpc3.createProtoRpcPeer)({
|
|
3480
3353
|
requested: workerServiceBundle,
|
|
3481
3354
|
exposed: iframeServiceBundle,
|
|
3482
3355
|
handlers: {
|
|
@@ -3491,109 +3364,22 @@ var IFrameProxyRuntime = class {
|
|
|
3491
3364
|
});
|
|
3492
3365
|
this._workerAppPort.subscribe((msg) => this._windowAppPort.send(msg));
|
|
3493
3366
|
this._windowAppPort.subscribe((msg) => this._workerAppPort.send(msg));
|
|
3494
|
-
if (this._shellPort) {
|
|
3495
|
-
this._shellRuntime = new ShellRuntimeImpl(this._shellPort);
|
|
3496
|
-
}
|
|
3497
|
-
}
|
|
3498
|
-
get shell() {
|
|
3499
|
-
return this._shellRuntime;
|
|
3500
3367
|
}
|
|
3501
3368
|
async open(origin) {
|
|
3502
|
-
var _a;
|
|
3503
3369
|
await this._systemRpc.open();
|
|
3504
3370
|
await this._systemRpc.rpc.WorkerService.start({
|
|
3505
3371
|
origin
|
|
3506
3372
|
});
|
|
3507
|
-
await ((_a = this._shellRuntime) == null ? void 0 : _a.open());
|
|
3508
3373
|
}
|
|
3509
3374
|
async close() {
|
|
3510
|
-
var _a;
|
|
3511
|
-
await ((_a = this._shellRuntime) == null ? void 0 : _a.close());
|
|
3512
3375
|
await this._systemRpc.rpc.WorkerService.stop();
|
|
3513
3376
|
await this._systemRpc.close();
|
|
3514
3377
|
}
|
|
3515
3378
|
};
|
|
3516
3379
|
|
|
3517
|
-
// packages/sdk/client-services/src/packlets/vault/shell-controller.ts
|
|
3518
|
-
var import_async18 = require("@dxos/async");
|
|
3519
|
-
var import_log13 = require("@dxos/log");
|
|
3520
|
-
var import_iframe2 = require("@dxos/protocols/proto/dxos/iframe");
|
|
3521
|
-
var import_rpc5 = require("@dxos/rpc");
|
|
3522
|
-
var ShellController = class {
|
|
3523
|
-
constructor(_port) {
|
|
3524
|
-
this._port = _port;
|
|
3525
|
-
this.contextUpdate = new import_async18.Event();
|
|
3526
|
-
this._display = import_iframe2.ShellDisplay.NONE;
|
|
3527
|
-
}
|
|
3528
|
-
get display() {
|
|
3529
|
-
return this._display;
|
|
3530
|
-
}
|
|
3531
|
-
get spaceKey() {
|
|
3532
|
-
return this._spaceKey;
|
|
3533
|
-
}
|
|
3534
|
-
setSpace(key) {
|
|
3535
|
-
this._spaceKey = key;
|
|
3536
|
-
this._emitUpdate();
|
|
3537
|
-
}
|
|
3538
|
-
async setLayout(layout, options = {}) {
|
|
3539
|
-
var _a;
|
|
3540
|
-
(0, import_log13.log)("set layout", {
|
|
3541
|
-
layout,
|
|
3542
|
-
...options
|
|
3543
|
-
}, {
|
|
3544
|
-
file: "shell-controller.ts",
|
|
3545
|
-
line: 39,
|
|
3546
|
-
scope: this,
|
|
3547
|
-
callSite: (f, a) => f(...a)
|
|
3548
|
-
});
|
|
3549
|
-
this._display = import_iframe2.ShellDisplay.FULLSCREEN;
|
|
3550
|
-
this._emitUpdate();
|
|
3551
|
-
await ((_a = this._shellRpc) == null ? void 0 : _a.rpc.ShellService.setLayout({
|
|
3552
|
-
layout,
|
|
3553
|
-
...options
|
|
3554
|
-
}));
|
|
3555
|
-
}
|
|
3556
|
-
async open() {
|
|
3557
|
-
this._shellRpc = (0, import_rpc5.createProtoRpcPeer)({
|
|
3558
|
-
requested: shellServiceBundle,
|
|
3559
|
-
exposed: appServiceBundle,
|
|
3560
|
-
handlers: {
|
|
3561
|
-
AppService: {
|
|
3562
|
-
setContext: async (request) => {
|
|
3563
|
-
(0, import_log13.log)("set context", request, {
|
|
3564
|
-
file: "shell-controller.ts",
|
|
3565
|
-
line: 52,
|
|
3566
|
-
scope: this,
|
|
3567
|
-
callSite: (f, a) => f(...a)
|
|
3568
|
-
});
|
|
3569
|
-
this._display = request.display;
|
|
3570
|
-
this._spaceKey = request.spaceKey;
|
|
3571
|
-
this._invitationCode = request.invitationCode;
|
|
3572
|
-
this.contextUpdate.emit(request);
|
|
3573
|
-
}
|
|
3574
|
-
}
|
|
3575
|
-
},
|
|
3576
|
-
port: this._port
|
|
3577
|
-
});
|
|
3578
|
-
await this._shellRpc.open();
|
|
3579
|
-
}
|
|
3580
|
-
async close() {
|
|
3581
|
-
var _a;
|
|
3582
|
-
await ((_a = this._shellRpc) == null ? void 0 : _a.close());
|
|
3583
|
-
this._shellRpc = void 0;
|
|
3584
|
-
}
|
|
3585
|
-
_emitUpdate() {
|
|
3586
|
-
this.contextUpdate.emit({
|
|
3587
|
-
display: this._display,
|
|
3588
|
-
spaceKey: this._spaceKey,
|
|
3589
|
-
invitationCode: this._invitationCode
|
|
3590
|
-
});
|
|
3591
|
-
}
|
|
3592
|
-
};
|
|
3593
|
-
|
|
3594
3380
|
// packages/sdk/client-services/src/packlets/vault/vault-resource-lock.ts
|
|
3595
|
-
var
|
|
3596
|
-
var
|
|
3381
|
+
var import_async17 = require("@dxos/async");
|
|
3382
|
+
var import_log13 = require("@dxos/log");
|
|
3597
3383
|
var Message;
|
|
3598
3384
|
(function(Message2) {
|
|
3599
3385
|
Message2["ACQUIRING"] = "acquiring";
|
|
@@ -3601,7 +3387,7 @@ var Message;
|
|
|
3601
3387
|
var VaultResourceLock = class {
|
|
3602
3388
|
constructor({ lockKey, onAcquire, onRelease }) {
|
|
3603
3389
|
this._broadcastChannel = new BroadcastChannel("vault-resource-lock");
|
|
3604
|
-
this._releaseTrigger = new
|
|
3390
|
+
this._releaseTrigger = new import_async17.Trigger();
|
|
3605
3391
|
this._lockKey = lockKey;
|
|
3606
3392
|
this._onAcquire = onAcquire;
|
|
3607
3393
|
this._onRelease = onRelease;
|
|
@@ -3612,7 +3398,7 @@ var VaultResourceLock = class {
|
|
|
3612
3398
|
message: Message.ACQUIRING
|
|
3613
3399
|
});
|
|
3614
3400
|
try {
|
|
3615
|
-
await (0,
|
|
3401
|
+
await (0, import_async17.asyncTimeout)(this._requestLock(), 3e3);
|
|
3616
3402
|
} catch (e) {
|
|
3617
3403
|
await this._requestLock(true);
|
|
3618
3404
|
}
|
|
@@ -3626,7 +3412,7 @@ var VaultResourceLock = class {
|
|
|
3626
3412
|
}
|
|
3627
3413
|
}
|
|
3628
3414
|
async _requestLock(steal = false) {
|
|
3629
|
-
(0,
|
|
3415
|
+
(0, import_log13.log)("requesting lock...", {
|
|
3630
3416
|
steal
|
|
3631
3417
|
}, {
|
|
3632
3418
|
file: "vault-resource-lock.ts",
|
|
@@ -3634,23 +3420,23 @@ var VaultResourceLock = class {
|
|
|
3634
3420
|
scope: this,
|
|
3635
3421
|
callSite: (f, a) => f(...a)
|
|
3636
3422
|
});
|
|
3637
|
-
const acquired = new
|
|
3423
|
+
const acquired = new import_async17.Trigger();
|
|
3638
3424
|
void navigator.locks.request(this._lockKey, {
|
|
3639
3425
|
steal
|
|
3640
3426
|
}, async () => {
|
|
3641
3427
|
var _a, _b;
|
|
3642
3428
|
await ((_a = this._onAcquire) == null ? void 0 : _a.call(this));
|
|
3643
3429
|
acquired.wake();
|
|
3644
|
-
this._releaseTrigger = new
|
|
3430
|
+
this._releaseTrigger = new import_async17.Trigger();
|
|
3645
3431
|
await this._releaseTrigger.wait();
|
|
3646
|
-
(0,
|
|
3432
|
+
(0, import_log13.log)("releasing lock...", {}, {
|
|
3647
3433
|
file: "vault-resource-lock.ts",
|
|
3648
3434
|
line: 65,
|
|
3649
3435
|
scope: this,
|
|
3650
3436
|
callSite: (f, a) => f(...a)
|
|
3651
3437
|
});
|
|
3652
3438
|
await ((_b = this._onRelease) == null ? void 0 : _b.call(this));
|
|
3653
|
-
(0,
|
|
3439
|
+
(0, import_log13.log)("released lock", {}, {
|
|
3654
3440
|
file: "vault-resource-lock.ts",
|
|
3655
3441
|
line: 67,
|
|
3656
3442
|
scope: this,
|
|
@@ -3661,7 +3447,7 @@ var VaultResourceLock = class {
|
|
|
3661
3447
|
await ((_a = this._onRelease) == null ? void 0 : _a.call(this));
|
|
3662
3448
|
});
|
|
3663
3449
|
await acquired.wait();
|
|
3664
|
-
(0,
|
|
3450
|
+
(0, import_log13.log)("recieved lock", {
|
|
3665
3451
|
steal
|
|
3666
3452
|
}, {
|
|
3667
3453
|
file: "vault-resource-lock.ts",
|
|
@@ -3673,17 +3459,17 @@ var VaultResourceLock = class {
|
|
|
3673
3459
|
};
|
|
3674
3460
|
|
|
3675
3461
|
// packages/sdk/client-services/src/packlets/vault/worker-runtime.ts
|
|
3676
|
-
var
|
|
3677
|
-
var
|
|
3462
|
+
var import_async19 = require("@dxos/async");
|
|
3463
|
+
var import_log15 = require("@dxos/log");
|
|
3678
3464
|
var import_messaging2 = require("@dxos/messaging");
|
|
3679
3465
|
var import_network_manager5 = require("@dxos/network-manager");
|
|
3680
3466
|
|
|
3681
3467
|
// packages/sdk/client-services/src/packlets/vault/worker-session.ts
|
|
3682
|
-
var
|
|
3683
|
-
var
|
|
3684
|
-
var
|
|
3685
|
-
var
|
|
3686
|
-
var
|
|
3468
|
+
var import_node_assert13 = __toESM(require("node:assert"));
|
|
3469
|
+
var import_async18 = require("@dxos/async");
|
|
3470
|
+
var import_log14 = require("@dxos/log");
|
|
3471
|
+
var import_rpc4 = require("@dxos/rpc");
|
|
3472
|
+
var import_util7 = require("@dxos/util");
|
|
3687
3473
|
var __decorate4 = function(decorators, target, key, desc) {
|
|
3688
3474
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3689
3475
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -3695,39 +3481,33 @@ var __decorate4 = function(decorators, target, key, desc) {
|
|
|
3695
3481
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3696
3482
|
};
|
|
3697
3483
|
var WorkerSession = class {
|
|
3698
|
-
constructor({ getService, systemPort, appPort,
|
|
3484
|
+
constructor({ getService, systemPort, appPort, options = {
|
|
3699
3485
|
heartbeatInterval: 1e3
|
|
3700
3486
|
} }) {
|
|
3701
|
-
this._startTrigger = new
|
|
3702
|
-
this.onClose = new
|
|
3703
|
-
(0,
|
|
3704
|
-
(0,
|
|
3487
|
+
this._startTrigger = new import_async18.Trigger();
|
|
3488
|
+
this.onClose = new import_util7.Callback();
|
|
3489
|
+
(0, import_node_assert13.default)(options);
|
|
3490
|
+
(0, import_node_assert13.default)(getService);
|
|
3705
3491
|
this._options = options;
|
|
3706
3492
|
this._getService = getService;
|
|
3707
|
-
|
|
3708
|
-
DataService: async () => await this._getService((services) => services.DataService),
|
|
3709
|
-
DevicesService: async () => await this._getService((services) => services.DevicesService),
|
|
3710
|
-
DevtoolsHost: async () => await this._getService((services) => services.DevtoolsHost),
|
|
3711
|
-
HaloInvitationsService: async () => await this._getService((services) => services.HaloInvitationsService),
|
|
3712
|
-
NetworkService: async () => await this._getService((services) => services.NetworkService),
|
|
3713
|
-
ProfileService: async () => await this._getService((services) => services.ProfileService),
|
|
3714
|
-
SpaceInvitationsService: async () => await this._getService((services) => services.SpaceInvitationsService),
|
|
3715
|
-
SpaceService: async () => await this._getService((services) => services.SpaceService),
|
|
3716
|
-
SpacesService: async () => await this._getService((services) => services.SpacesService),
|
|
3717
|
-
SystemService: async () => await this._getService((services) => services.SystemService),
|
|
3718
|
-
TracingService: async () => await this._getService((services) => services.TracingService)
|
|
3719
|
-
};
|
|
3720
|
-
this._clientRpc = (0, import_rpc6.createProtoRpcPeer)({
|
|
3493
|
+
this._clientRpc = (0, import_rpc4.createProtoRpcPeer)({
|
|
3721
3494
|
exposed: clientServiceBundle,
|
|
3722
|
-
handlers
|
|
3495
|
+
handlers: {
|
|
3496
|
+
DataService: async () => await this._getService((services) => services.DataService),
|
|
3497
|
+
DevicesService: async () => await this._getService((services) => services.DevicesService),
|
|
3498
|
+
DevtoolsHost: async () => await this._getService((services) => services.DevtoolsHost),
|
|
3499
|
+
HaloInvitationsService: async () => await this._getService((services) => services.HaloInvitationsService),
|
|
3500
|
+
NetworkService: async () => await this._getService((services) => services.NetworkService),
|
|
3501
|
+
ProfileService: async () => await this._getService((services) => services.ProfileService),
|
|
3502
|
+
SpaceInvitationsService: async () => await this._getService((services) => services.SpaceInvitationsService),
|
|
3503
|
+
SpaceService: async () => await this._getService((services) => services.SpaceService),
|
|
3504
|
+
SpacesService: async () => await this._getService((services) => services.SpacesService),
|
|
3505
|
+
SystemService: async () => await this._getService((services) => services.SystemService),
|
|
3506
|
+
TracingService: async () => await this._getService((services) => services.TracingService)
|
|
3507
|
+
},
|
|
3723
3508
|
port: appPort
|
|
3724
3509
|
});
|
|
3725
|
-
this.
|
|
3726
|
-
exposed: clientServiceBundle,
|
|
3727
|
-
handlers,
|
|
3728
|
-
port: shellPort
|
|
3729
|
-
});
|
|
3730
|
-
this._iframeRpc = (0, import_rpc6.createProtoRpcPeer)({
|
|
3510
|
+
this._iframeRpc = (0, import_rpc4.createProtoRpcPeer)({
|
|
3731
3511
|
requested: iframeServiceBundle,
|
|
3732
3512
|
exposed: workerServiceBundle,
|
|
3733
3513
|
handlers: {
|
|
@@ -3741,9 +3521,9 @@ var WorkerSession = class {
|
|
|
3741
3521
|
try {
|
|
3742
3522
|
await this.close();
|
|
3743
3523
|
} catch (err) {
|
|
3744
|
-
|
|
3524
|
+
import_log14.log.catch(err, {}, {
|
|
3745
3525
|
file: "worker-session.ts",
|
|
3746
|
-
line:
|
|
3526
|
+
line: 90,
|
|
3747
3527
|
scope: this,
|
|
3748
3528
|
callSite: (f, a) => f(...a)
|
|
3749
3529
|
});
|
|
@@ -3759,16 +3539,15 @@ var WorkerSession = class {
|
|
|
3759
3539
|
this.bridgeService = this._iframeRpc.rpc.BridgeService;
|
|
3760
3540
|
}
|
|
3761
3541
|
async open() {
|
|
3762
|
-
|
|
3542
|
+
import_log14.log.info("opening..", {}, {
|
|
3763
3543
|
file: "worker-session.ts",
|
|
3764
|
-
line:
|
|
3544
|
+
line: 104,
|
|
3765
3545
|
scope: this,
|
|
3766
3546
|
callSite: (f, a) => f(...a)
|
|
3767
3547
|
});
|
|
3768
3548
|
await Promise.all([
|
|
3769
3549
|
this._clientRpc.open(),
|
|
3770
|
-
this._iframeRpc.open()
|
|
3771
|
-
this._maybeOpenShell()
|
|
3550
|
+
this._iframeRpc.open()
|
|
3772
3551
|
]);
|
|
3773
3552
|
await this._startTrigger.wait({
|
|
3774
3553
|
timeout: 3e3
|
|
@@ -3777,20 +3556,20 @@ var WorkerSession = class {
|
|
|
3777
3556
|
try {
|
|
3778
3557
|
await this._iframeRpc.rpc.IframeService.heartbeat();
|
|
3779
3558
|
} catch (err1) {
|
|
3780
|
-
|
|
3559
|
+
import_log14.log.warn("Heartbeat failed", {
|
|
3781
3560
|
err: err1
|
|
3782
3561
|
}, {
|
|
3783
3562
|
file: "worker-session.ts",
|
|
3784
|
-
line:
|
|
3563
|
+
line: 116,
|
|
3785
3564
|
scope: this,
|
|
3786
3565
|
callSite: (f, a) => f(...a)
|
|
3787
3566
|
});
|
|
3788
3567
|
try {
|
|
3789
3568
|
await this.close();
|
|
3790
3569
|
} catch (err) {
|
|
3791
|
-
|
|
3570
|
+
import_log14.log.catch(err, {}, {
|
|
3792
3571
|
file: "worker-session.ts",
|
|
3793
|
-
line:
|
|
3572
|
+
line: 120,
|
|
3794
3573
|
scope: this,
|
|
3795
3574
|
callSite: (f, a) => f(...a)
|
|
3796
3575
|
});
|
|
@@ -3799,18 +3578,18 @@ var WorkerSession = class {
|
|
|
3799
3578
|
}, this._options.heartbeatInterval);
|
|
3800
3579
|
}
|
|
3801
3580
|
async close() {
|
|
3802
|
-
|
|
3581
|
+
import_log14.log.info("closing..", {}, {
|
|
3803
3582
|
file: "worker-session.ts",
|
|
3804
|
-
line:
|
|
3583
|
+
line: 127,
|
|
3805
3584
|
scope: this,
|
|
3806
3585
|
callSite: (f, a) => f(...a)
|
|
3807
3586
|
});
|
|
3808
3587
|
try {
|
|
3809
3588
|
await this.onClose.callIfSet();
|
|
3810
3589
|
} catch (err) {
|
|
3811
|
-
|
|
3590
|
+
import_log14.log.catch(err, {}, {
|
|
3812
3591
|
file: "worker-session.ts",
|
|
3813
|
-
line:
|
|
3592
|
+
line: 131,
|
|
3814
3593
|
scope: this,
|
|
3815
3594
|
callSite: (f, a) => f(...a)
|
|
3816
3595
|
});
|
|
@@ -3823,21 +3602,9 @@ var WorkerSession = class {
|
|
|
3823
3602
|
this._iframeRpc.close()
|
|
3824
3603
|
]);
|
|
3825
3604
|
}
|
|
3826
|
-
async _maybeOpenShell() {
|
|
3827
|
-
try {
|
|
3828
|
-
await (0, import_async20.asyncTimeout)(this._shellClientRpc.open(), 1e3);
|
|
3829
|
-
} catch (e) {
|
|
3830
|
-
import_log15.log.info("No shell connected.", {}, {
|
|
3831
|
-
file: "worker-session.ts",
|
|
3832
|
-
line: 147,
|
|
3833
|
-
scope: this,
|
|
3834
|
-
callSite: (f, a) => f(...a)
|
|
3835
|
-
});
|
|
3836
|
-
}
|
|
3837
|
-
}
|
|
3838
3605
|
};
|
|
3839
3606
|
__decorate4([
|
|
3840
|
-
|
|
3607
|
+
import_log14.logInfo
|
|
3841
3608
|
], WorkerSession.prototype, "origin", void 0);
|
|
3842
3609
|
|
|
3843
3610
|
// packages/sdk/client-services/src/packlets/vault/worker-runtime.ts
|
|
@@ -3846,13 +3613,13 @@ var WorkerRuntime = class {
|
|
|
3846
3613
|
constructor(_configProvider) {
|
|
3847
3614
|
this._configProvider = _configProvider;
|
|
3848
3615
|
this._transportFactory = new import_network_manager5.WebRTCTransportProxyFactory();
|
|
3849
|
-
this._ready = new
|
|
3616
|
+
this._ready = new import_async19.Trigger();
|
|
3850
3617
|
this.sessions = /* @__PURE__ */ new Set();
|
|
3851
3618
|
}
|
|
3852
3619
|
async start() {
|
|
3853
|
-
(0,
|
|
3620
|
+
(0, import_log15.log)("starting...", {}, {
|
|
3854
3621
|
file: "worker-runtime.ts",
|
|
3855
|
-
line:
|
|
3622
|
+
line: 41,
|
|
3856
3623
|
scope: this,
|
|
3857
3624
|
callSite: (f, a) => f(...a)
|
|
3858
3625
|
});
|
|
@@ -3871,17 +3638,17 @@ var WorkerRuntime = class {
|
|
|
3871
3638
|
});
|
|
3872
3639
|
await this._clientServices.open();
|
|
3873
3640
|
this._ready.wake(void 0);
|
|
3874
|
-
(0,
|
|
3641
|
+
(0, import_log15.log)("started", {}, {
|
|
3875
3642
|
file: "worker-runtime.ts",
|
|
3876
|
-
line:
|
|
3643
|
+
line: 58,
|
|
3877
3644
|
scope: this,
|
|
3878
3645
|
callSite: (f, a) => f(...a)
|
|
3879
3646
|
});
|
|
3880
3647
|
} catch (err) {
|
|
3881
3648
|
this._ready.wake(err);
|
|
3882
|
-
|
|
3649
|
+
import_log15.log.catch(err, {}, {
|
|
3883
3650
|
file: "worker-runtime.ts",
|
|
3884
|
-
line:
|
|
3651
|
+
line: 61,
|
|
3885
3652
|
scope: this,
|
|
3886
3653
|
callSite: (f, a) => f(...a)
|
|
3887
3654
|
});
|
|
@@ -3893,7 +3660,7 @@ var WorkerRuntime = class {
|
|
|
3893
3660
|
/**
|
|
3894
3661
|
* Create a new session.
|
|
3895
3662
|
*/
|
|
3896
|
-
async createSession({ appPort, systemPort
|
|
3663
|
+
async createSession({ appPort, systemPort }) {
|
|
3897
3664
|
const session = new WorkerSession({
|
|
3898
3665
|
getService: async (find) => {
|
|
3899
3666
|
const error = await this._ready.wait();
|
|
@@ -3908,7 +3675,6 @@ var WorkerRuntime = class {
|
|
|
3908
3675
|
},
|
|
3909
3676
|
appPort,
|
|
3910
3677
|
systemPort,
|
|
3911
|
-
shellPort,
|
|
3912
3678
|
readySignal: this._ready
|
|
3913
3679
|
});
|
|
3914
3680
|
session.onClose.set(async () => {
|
|
@@ -4020,7 +3786,7 @@ var ClientServicesHost = class {
|
|
|
4020
3786
|
if (this._open) {
|
|
4021
3787
|
return;
|
|
4022
3788
|
}
|
|
4023
|
-
(0,
|
|
3789
|
+
(0, import_log16.log)("opening...", {}, {
|
|
4024
3790
|
file: "service-host.ts",
|
|
4025
3791
|
line: 125,
|
|
4026
3792
|
scope: this,
|
|
@@ -4040,7 +3806,7 @@ var ClientServicesHost = class {
|
|
|
4040
3806
|
return (_a2 = this._serviceContext.dataSpaceManager) != null ? _a2 : (0, import_debug7.raise)(new Error("SpaceManager not initialized"));
|
|
4041
3807
|
}),
|
|
4042
3808
|
SpacesService: new SpacesServiceImpl(this._serviceContext.spaceManager),
|
|
4043
|
-
DataService: new
|
|
3809
|
+
DataService: new import_echo_db5.DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
|
|
4044
3810
|
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager),
|
|
4045
3811
|
// TODO(burdon): Move to new protobuf definitions.
|
|
4046
3812
|
ProfileService: new ProfileServiceImpl(this._serviceContext),
|
|
@@ -4056,7 +3822,7 @@ var ClientServicesHost = class {
|
|
|
4056
3822
|
await this._serviceContext.open();
|
|
4057
3823
|
this._open = true;
|
|
4058
3824
|
const deviceKey = (_a = this._serviceContext.identityManager.identity) == null ? void 0 : _a.deviceKey;
|
|
4059
|
-
(0,
|
|
3825
|
+
(0, import_log16.log)("opened", {
|
|
4060
3826
|
deviceKey
|
|
4061
3827
|
}, {
|
|
4062
3828
|
file: "service-host.ts",
|
|
@@ -4071,7 +3837,7 @@ var ClientServicesHost = class {
|
|
|
4071
3837
|
return;
|
|
4072
3838
|
}
|
|
4073
3839
|
const deviceKey = (_a = this._serviceContext.identityManager.identity) == null ? void 0 : _a.deviceKey;
|
|
4074
|
-
(0,
|
|
3840
|
+
(0, import_log16.log)("closing...", {
|
|
4075
3841
|
deviceKey
|
|
4076
3842
|
}, {
|
|
4077
3843
|
file: "service-host.ts",
|
|
@@ -4084,7 +3850,7 @@ var ClientServicesHost = class {
|
|
|
4084
3850
|
});
|
|
4085
3851
|
await this._serviceContext.close();
|
|
4086
3852
|
this._open = false;
|
|
4087
|
-
(0,
|
|
3853
|
+
(0, import_log16.log)("closed", {
|
|
4088
3854
|
deviceKey
|
|
4089
3855
|
}, {
|
|
4090
3856
|
file: "service-host.ts",
|
|
@@ -4096,14 +3862,14 @@ var ClientServicesHost = class {
|
|
|
4096
3862
|
};
|
|
4097
3863
|
|
|
4098
3864
|
// packages/sdk/client-services/src/packlets/services/service-proxy.ts
|
|
4099
|
-
var
|
|
3865
|
+
var import_async20 = require("@dxos/async");
|
|
4100
3866
|
var import_errors2 = require("@dxos/errors");
|
|
4101
|
-
var
|
|
3867
|
+
var import_rpc5 = require("@dxos/rpc");
|
|
4102
3868
|
var ClientServicesProxy = class {
|
|
4103
3869
|
// prettier-ignore
|
|
4104
3870
|
constructor(port, _timeout = 3e4) {
|
|
4105
3871
|
this._timeout = _timeout;
|
|
4106
|
-
this._proxy = (0,
|
|
3872
|
+
this._proxy = (0, import_rpc5.createProtoRpcPeer)({
|
|
4107
3873
|
requested: clientServiceBundle,
|
|
4108
3874
|
exposed: {},
|
|
4109
3875
|
handlers: {},
|
|
@@ -4120,7 +3886,7 @@ var ClientServicesProxy = class {
|
|
|
4120
3886
|
return this._proxy.rpc;
|
|
4121
3887
|
}
|
|
4122
3888
|
async open() {
|
|
4123
|
-
await (0,
|
|
3889
|
+
await (0, import_async20.asyncTimeout)(this._proxy.open(), this._timeout, new import_errors2.RemoteServiceConnectionTimeout());
|
|
4124
3890
|
}
|
|
4125
3891
|
async close() {
|
|
4126
3892
|
await this._proxy.close();
|
|
@@ -4147,13 +3913,10 @@ var ClientServicesProxy = class {
|
|
|
4147
3913
|
IdentityManager,
|
|
4148
3914
|
InvitationEncoder,
|
|
4149
3915
|
InvitationObservableProvider,
|
|
4150
|
-
MemoryShellRuntime,
|
|
4151
3916
|
ON_CLOSE_DELAY,
|
|
4152
3917
|
ProfileServiceImpl,
|
|
4153
3918
|
ServiceContext,
|
|
4154
3919
|
ServiceRegistry,
|
|
4155
|
-
ShellController,
|
|
4156
|
-
ShellRuntimeImpl,
|
|
4157
3920
|
SpaceInvitationsHandler,
|
|
4158
3921
|
SpaceInvitationsProxy,
|
|
4159
3922
|
SpaceInvitationsServiceImpl,
|
|
@@ -4164,14 +3927,12 @@ var ClientServicesProxy = class {
|
|
|
4164
3927
|
VaultResourceLock,
|
|
4165
3928
|
WorkerRuntime,
|
|
4166
3929
|
WorkerSession,
|
|
4167
|
-
appServiceBundle,
|
|
4168
3930
|
clientServiceBundle,
|
|
4169
3931
|
createAuthProvider,
|
|
4170
3932
|
createDefaultModelFactory,
|
|
4171
3933
|
createStorageObjects,
|
|
4172
3934
|
getNetworkPeers,
|
|
4173
3935
|
iframeServiceBundle,
|
|
4174
|
-
shellServiceBundle,
|
|
4175
3936
|
subscribeToFeedBlocks,
|
|
4176
3937
|
subscribeToFeeds,
|
|
4177
3938
|
subscribeToNetworkStatus,
|