@dxos/client-services 0.1.24-next.6b1f434 → 0.1.25
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-ZPZBLOQW.mjs → chunk-R2FEBB66.mjs} +95 -316
- 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 -341
- 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-ZPZBLOQW.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 -77
- 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,100 +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
|
-
this._display = import_iframe2.ShellDisplay.FULLSCREEN;
|
|
3541
|
-
this._emitUpdate();
|
|
3542
|
-
await ((_a = this._shellRpc) == null ? void 0 : _a.rpc.ShellService.setLayout({
|
|
3543
|
-
layout,
|
|
3544
|
-
...options
|
|
3545
|
-
}));
|
|
3546
|
-
}
|
|
3547
|
-
async open() {
|
|
3548
|
-
this._shellRpc = (0, import_rpc5.createProtoRpcPeer)({
|
|
3549
|
-
requested: shellServiceBundle,
|
|
3550
|
-
exposed: appServiceBundle,
|
|
3551
|
-
handlers: {
|
|
3552
|
-
AppService: {
|
|
3553
|
-
setContext: async (request) => {
|
|
3554
|
-
(0, import_log13.log)("set context", request, {
|
|
3555
|
-
file: "shell-controller.ts",
|
|
3556
|
-
line: 51,
|
|
3557
|
-
scope: this,
|
|
3558
|
-
callSite: (f, a) => f(...a)
|
|
3559
|
-
});
|
|
3560
|
-
this._display = request.display;
|
|
3561
|
-
this._spaceKey = request.spaceKey;
|
|
3562
|
-
this._invitationCode = request.invitationCode;
|
|
3563
|
-
this.contextUpdate.emit(request);
|
|
3564
|
-
}
|
|
3565
|
-
}
|
|
3566
|
-
},
|
|
3567
|
-
port: this._port
|
|
3568
|
-
});
|
|
3569
|
-
await this._shellRpc.open();
|
|
3570
|
-
}
|
|
3571
|
-
async close() {
|
|
3572
|
-
var _a;
|
|
3573
|
-
await ((_a = this._shellRpc) == null ? void 0 : _a.close());
|
|
3574
|
-
this._shellRpc = void 0;
|
|
3575
|
-
}
|
|
3576
|
-
_emitUpdate() {
|
|
3577
|
-
this.contextUpdate.emit({
|
|
3578
|
-
display: this._display,
|
|
3579
|
-
spaceKey: this._spaceKey,
|
|
3580
|
-
invitationCode: this._invitationCode
|
|
3581
|
-
});
|
|
3582
|
-
}
|
|
3583
|
-
};
|
|
3584
|
-
|
|
3585
3380
|
// packages/sdk/client-services/src/packlets/vault/vault-resource-lock.ts
|
|
3586
|
-
var
|
|
3587
|
-
var
|
|
3381
|
+
var import_async17 = require("@dxos/async");
|
|
3382
|
+
var import_log13 = require("@dxos/log");
|
|
3588
3383
|
var Message;
|
|
3589
3384
|
(function(Message2) {
|
|
3590
3385
|
Message2["ACQUIRING"] = "acquiring";
|
|
@@ -3592,7 +3387,7 @@ var Message;
|
|
|
3592
3387
|
var VaultResourceLock = class {
|
|
3593
3388
|
constructor({ lockKey, onAcquire, onRelease }) {
|
|
3594
3389
|
this._broadcastChannel = new BroadcastChannel("vault-resource-lock");
|
|
3595
|
-
this._releaseTrigger = new
|
|
3390
|
+
this._releaseTrigger = new import_async17.Trigger();
|
|
3596
3391
|
this._lockKey = lockKey;
|
|
3597
3392
|
this._onAcquire = onAcquire;
|
|
3598
3393
|
this._onRelease = onRelease;
|
|
@@ -3603,7 +3398,7 @@ var VaultResourceLock = class {
|
|
|
3603
3398
|
message: Message.ACQUIRING
|
|
3604
3399
|
});
|
|
3605
3400
|
try {
|
|
3606
|
-
await (0,
|
|
3401
|
+
await (0, import_async17.asyncTimeout)(this._requestLock(), 3e3);
|
|
3607
3402
|
} catch (e) {
|
|
3608
3403
|
await this._requestLock(true);
|
|
3609
3404
|
}
|
|
@@ -3617,7 +3412,7 @@ var VaultResourceLock = class {
|
|
|
3617
3412
|
}
|
|
3618
3413
|
}
|
|
3619
3414
|
async _requestLock(steal = false) {
|
|
3620
|
-
(0,
|
|
3415
|
+
(0, import_log13.log)("requesting lock...", {
|
|
3621
3416
|
steal
|
|
3622
3417
|
}, {
|
|
3623
3418
|
file: "vault-resource-lock.ts",
|
|
@@ -3625,23 +3420,23 @@ var VaultResourceLock = class {
|
|
|
3625
3420
|
scope: this,
|
|
3626
3421
|
callSite: (f, a) => f(...a)
|
|
3627
3422
|
});
|
|
3628
|
-
const acquired = new
|
|
3423
|
+
const acquired = new import_async17.Trigger();
|
|
3629
3424
|
void navigator.locks.request(this._lockKey, {
|
|
3630
3425
|
steal
|
|
3631
3426
|
}, async () => {
|
|
3632
3427
|
var _a, _b;
|
|
3633
3428
|
await ((_a = this._onAcquire) == null ? void 0 : _a.call(this));
|
|
3634
3429
|
acquired.wake();
|
|
3635
|
-
this._releaseTrigger = new
|
|
3430
|
+
this._releaseTrigger = new import_async17.Trigger();
|
|
3636
3431
|
await this._releaseTrigger.wait();
|
|
3637
|
-
(0,
|
|
3432
|
+
(0, import_log13.log)("releasing lock...", {}, {
|
|
3638
3433
|
file: "vault-resource-lock.ts",
|
|
3639
3434
|
line: 65,
|
|
3640
3435
|
scope: this,
|
|
3641
3436
|
callSite: (f, a) => f(...a)
|
|
3642
3437
|
});
|
|
3643
3438
|
await ((_b = this._onRelease) == null ? void 0 : _b.call(this));
|
|
3644
|
-
(0,
|
|
3439
|
+
(0, import_log13.log)("released lock", {}, {
|
|
3645
3440
|
file: "vault-resource-lock.ts",
|
|
3646
3441
|
line: 67,
|
|
3647
3442
|
scope: this,
|
|
@@ -3652,7 +3447,7 @@ var VaultResourceLock = class {
|
|
|
3652
3447
|
await ((_a = this._onRelease) == null ? void 0 : _a.call(this));
|
|
3653
3448
|
});
|
|
3654
3449
|
await acquired.wait();
|
|
3655
|
-
(0,
|
|
3450
|
+
(0, import_log13.log)("recieved lock", {
|
|
3656
3451
|
steal
|
|
3657
3452
|
}, {
|
|
3658
3453
|
file: "vault-resource-lock.ts",
|
|
@@ -3664,17 +3459,17 @@ var VaultResourceLock = class {
|
|
|
3664
3459
|
};
|
|
3665
3460
|
|
|
3666
3461
|
// packages/sdk/client-services/src/packlets/vault/worker-runtime.ts
|
|
3667
|
-
var
|
|
3668
|
-
var
|
|
3462
|
+
var import_async19 = require("@dxos/async");
|
|
3463
|
+
var import_log15 = require("@dxos/log");
|
|
3669
3464
|
var import_messaging2 = require("@dxos/messaging");
|
|
3670
3465
|
var import_network_manager5 = require("@dxos/network-manager");
|
|
3671
3466
|
|
|
3672
3467
|
// packages/sdk/client-services/src/packlets/vault/worker-session.ts
|
|
3673
|
-
var
|
|
3674
|
-
var
|
|
3675
|
-
var
|
|
3676
|
-
var
|
|
3677
|
-
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");
|
|
3678
3473
|
var __decorate4 = function(decorators, target, key, desc) {
|
|
3679
3474
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3680
3475
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -3686,39 +3481,33 @@ var __decorate4 = function(decorators, target, key, desc) {
|
|
|
3686
3481
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3687
3482
|
};
|
|
3688
3483
|
var WorkerSession = class {
|
|
3689
|
-
constructor({ getService, systemPort, appPort,
|
|
3484
|
+
constructor({ getService, systemPort, appPort, options = {
|
|
3690
3485
|
heartbeatInterval: 1e3
|
|
3691
3486
|
} }) {
|
|
3692
|
-
this._startTrigger = new
|
|
3693
|
-
this.onClose = new
|
|
3694
|
-
(0,
|
|
3695
|
-
(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);
|
|
3696
3491
|
this._options = options;
|
|
3697
3492
|
this._getService = getService;
|
|
3698
|
-
|
|
3699
|
-
DataService: async () => await this._getService((services) => services.DataService),
|
|
3700
|
-
DevicesService: async () => await this._getService((services) => services.DevicesService),
|
|
3701
|
-
DevtoolsHost: async () => await this._getService((services) => services.DevtoolsHost),
|
|
3702
|
-
HaloInvitationsService: async () => await this._getService((services) => services.HaloInvitationsService),
|
|
3703
|
-
NetworkService: async () => await this._getService((services) => services.NetworkService),
|
|
3704
|
-
ProfileService: async () => await this._getService((services) => services.ProfileService),
|
|
3705
|
-
SpaceInvitationsService: async () => await this._getService((services) => services.SpaceInvitationsService),
|
|
3706
|
-
SpaceService: async () => await this._getService((services) => services.SpaceService),
|
|
3707
|
-
SpacesService: async () => await this._getService((services) => services.SpacesService),
|
|
3708
|
-
SystemService: async () => await this._getService((services) => services.SystemService),
|
|
3709
|
-
TracingService: async () => await this._getService((services) => services.TracingService)
|
|
3710
|
-
};
|
|
3711
|
-
this._clientRpc = (0, import_rpc6.createProtoRpcPeer)({
|
|
3493
|
+
this._clientRpc = (0, import_rpc4.createProtoRpcPeer)({
|
|
3712
3494
|
exposed: clientServiceBundle,
|
|
3713
|
-
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
|
+
},
|
|
3714
3508
|
port: appPort
|
|
3715
3509
|
});
|
|
3716
|
-
this.
|
|
3717
|
-
exposed: clientServiceBundle,
|
|
3718
|
-
handlers,
|
|
3719
|
-
port: shellPort
|
|
3720
|
-
});
|
|
3721
|
-
this._iframeRpc = (0, import_rpc6.createProtoRpcPeer)({
|
|
3510
|
+
this._iframeRpc = (0, import_rpc4.createProtoRpcPeer)({
|
|
3722
3511
|
requested: iframeServiceBundle,
|
|
3723
3512
|
exposed: workerServiceBundle,
|
|
3724
3513
|
handlers: {
|
|
@@ -3732,9 +3521,9 @@ var WorkerSession = class {
|
|
|
3732
3521
|
try {
|
|
3733
3522
|
await this.close();
|
|
3734
3523
|
} catch (err) {
|
|
3735
|
-
|
|
3524
|
+
import_log14.log.catch(err, {}, {
|
|
3736
3525
|
file: "worker-session.ts",
|
|
3737
|
-
line:
|
|
3526
|
+
line: 90,
|
|
3738
3527
|
scope: this,
|
|
3739
3528
|
callSite: (f, a) => f(...a)
|
|
3740
3529
|
});
|
|
@@ -3750,16 +3539,15 @@ var WorkerSession = class {
|
|
|
3750
3539
|
this.bridgeService = this._iframeRpc.rpc.BridgeService;
|
|
3751
3540
|
}
|
|
3752
3541
|
async open() {
|
|
3753
|
-
|
|
3542
|
+
import_log14.log.info("opening..", {}, {
|
|
3754
3543
|
file: "worker-session.ts",
|
|
3755
|
-
line:
|
|
3544
|
+
line: 104,
|
|
3756
3545
|
scope: this,
|
|
3757
3546
|
callSite: (f, a) => f(...a)
|
|
3758
3547
|
});
|
|
3759
3548
|
await Promise.all([
|
|
3760
3549
|
this._clientRpc.open(),
|
|
3761
|
-
this._iframeRpc.open()
|
|
3762
|
-
this._maybeOpenShell()
|
|
3550
|
+
this._iframeRpc.open()
|
|
3763
3551
|
]);
|
|
3764
3552
|
await this._startTrigger.wait({
|
|
3765
3553
|
timeout: 3e3
|
|
@@ -3768,20 +3556,20 @@ var WorkerSession = class {
|
|
|
3768
3556
|
try {
|
|
3769
3557
|
await this._iframeRpc.rpc.IframeService.heartbeat();
|
|
3770
3558
|
} catch (err1) {
|
|
3771
|
-
|
|
3559
|
+
import_log14.log.warn("Heartbeat failed", {
|
|
3772
3560
|
err: err1
|
|
3773
3561
|
}, {
|
|
3774
3562
|
file: "worker-session.ts",
|
|
3775
|
-
line:
|
|
3563
|
+
line: 116,
|
|
3776
3564
|
scope: this,
|
|
3777
3565
|
callSite: (f, a) => f(...a)
|
|
3778
3566
|
});
|
|
3779
3567
|
try {
|
|
3780
3568
|
await this.close();
|
|
3781
3569
|
} catch (err) {
|
|
3782
|
-
|
|
3570
|
+
import_log14.log.catch(err, {}, {
|
|
3783
3571
|
file: "worker-session.ts",
|
|
3784
|
-
line:
|
|
3572
|
+
line: 120,
|
|
3785
3573
|
scope: this,
|
|
3786
3574
|
callSite: (f, a) => f(...a)
|
|
3787
3575
|
});
|
|
@@ -3790,18 +3578,18 @@ var WorkerSession = class {
|
|
|
3790
3578
|
}, this._options.heartbeatInterval);
|
|
3791
3579
|
}
|
|
3792
3580
|
async close() {
|
|
3793
|
-
|
|
3581
|
+
import_log14.log.info("closing..", {}, {
|
|
3794
3582
|
file: "worker-session.ts",
|
|
3795
|
-
line:
|
|
3583
|
+
line: 127,
|
|
3796
3584
|
scope: this,
|
|
3797
3585
|
callSite: (f, a) => f(...a)
|
|
3798
3586
|
});
|
|
3799
3587
|
try {
|
|
3800
3588
|
await this.onClose.callIfSet();
|
|
3801
3589
|
} catch (err) {
|
|
3802
|
-
|
|
3590
|
+
import_log14.log.catch(err, {}, {
|
|
3803
3591
|
file: "worker-session.ts",
|
|
3804
|
-
line:
|
|
3592
|
+
line: 131,
|
|
3805
3593
|
scope: this,
|
|
3806
3594
|
callSite: (f, a) => f(...a)
|
|
3807
3595
|
});
|
|
@@ -3814,21 +3602,9 @@ var WorkerSession = class {
|
|
|
3814
3602
|
this._iframeRpc.close()
|
|
3815
3603
|
]);
|
|
3816
3604
|
}
|
|
3817
|
-
async _maybeOpenShell() {
|
|
3818
|
-
try {
|
|
3819
|
-
await (0, import_async20.asyncTimeout)(this._shellClientRpc.open(), 1e3);
|
|
3820
|
-
} catch (e) {
|
|
3821
|
-
import_log15.log.info("No shell connected.", {}, {
|
|
3822
|
-
file: "worker-session.ts",
|
|
3823
|
-
line: 147,
|
|
3824
|
-
scope: this,
|
|
3825
|
-
callSite: (f, a) => f(...a)
|
|
3826
|
-
});
|
|
3827
|
-
}
|
|
3828
|
-
}
|
|
3829
3605
|
};
|
|
3830
3606
|
__decorate4([
|
|
3831
|
-
|
|
3607
|
+
import_log14.logInfo
|
|
3832
3608
|
], WorkerSession.prototype, "origin", void 0);
|
|
3833
3609
|
|
|
3834
3610
|
// packages/sdk/client-services/src/packlets/vault/worker-runtime.ts
|
|
@@ -3837,13 +3613,13 @@ var WorkerRuntime = class {
|
|
|
3837
3613
|
constructor(_configProvider) {
|
|
3838
3614
|
this._configProvider = _configProvider;
|
|
3839
3615
|
this._transportFactory = new import_network_manager5.WebRTCTransportProxyFactory();
|
|
3840
|
-
this._ready = new
|
|
3616
|
+
this._ready = new import_async19.Trigger();
|
|
3841
3617
|
this.sessions = /* @__PURE__ */ new Set();
|
|
3842
3618
|
}
|
|
3843
3619
|
async start() {
|
|
3844
|
-
(0,
|
|
3620
|
+
(0, import_log15.log)("starting...", {}, {
|
|
3845
3621
|
file: "worker-runtime.ts",
|
|
3846
|
-
line:
|
|
3622
|
+
line: 41,
|
|
3847
3623
|
scope: this,
|
|
3848
3624
|
callSite: (f, a) => f(...a)
|
|
3849
3625
|
});
|
|
@@ -3862,17 +3638,17 @@ var WorkerRuntime = class {
|
|
|
3862
3638
|
});
|
|
3863
3639
|
await this._clientServices.open();
|
|
3864
3640
|
this._ready.wake(void 0);
|
|
3865
|
-
(0,
|
|
3641
|
+
(0, import_log15.log)("started", {}, {
|
|
3866
3642
|
file: "worker-runtime.ts",
|
|
3867
|
-
line:
|
|
3643
|
+
line: 58,
|
|
3868
3644
|
scope: this,
|
|
3869
3645
|
callSite: (f, a) => f(...a)
|
|
3870
3646
|
});
|
|
3871
3647
|
} catch (err) {
|
|
3872
3648
|
this._ready.wake(err);
|
|
3873
|
-
|
|
3649
|
+
import_log15.log.catch(err, {}, {
|
|
3874
3650
|
file: "worker-runtime.ts",
|
|
3875
|
-
line:
|
|
3651
|
+
line: 61,
|
|
3876
3652
|
scope: this,
|
|
3877
3653
|
callSite: (f, a) => f(...a)
|
|
3878
3654
|
});
|
|
@@ -3884,7 +3660,7 @@ var WorkerRuntime = class {
|
|
|
3884
3660
|
/**
|
|
3885
3661
|
* Create a new session.
|
|
3886
3662
|
*/
|
|
3887
|
-
async createSession({ appPort, systemPort
|
|
3663
|
+
async createSession({ appPort, systemPort }) {
|
|
3888
3664
|
const session = new WorkerSession({
|
|
3889
3665
|
getService: async (find) => {
|
|
3890
3666
|
const error = await this._ready.wait();
|
|
@@ -3899,7 +3675,6 @@ var WorkerRuntime = class {
|
|
|
3899
3675
|
},
|
|
3900
3676
|
appPort,
|
|
3901
3677
|
systemPort,
|
|
3902
|
-
shellPort,
|
|
3903
3678
|
readySignal: this._ready
|
|
3904
3679
|
});
|
|
3905
3680
|
session.onClose.set(async () => {
|
|
@@ -4011,7 +3786,7 @@ var ClientServicesHost = class {
|
|
|
4011
3786
|
if (this._open) {
|
|
4012
3787
|
return;
|
|
4013
3788
|
}
|
|
4014
|
-
(0,
|
|
3789
|
+
(0, import_log16.log)("opening...", {}, {
|
|
4015
3790
|
file: "service-host.ts",
|
|
4016
3791
|
line: 125,
|
|
4017
3792
|
scope: this,
|
|
@@ -4031,7 +3806,7 @@ var ClientServicesHost = class {
|
|
|
4031
3806
|
return (_a2 = this._serviceContext.dataSpaceManager) != null ? _a2 : (0, import_debug7.raise)(new Error("SpaceManager not initialized"));
|
|
4032
3807
|
}),
|
|
4033
3808
|
SpacesService: new SpacesServiceImpl(this._serviceContext.spaceManager),
|
|
4034
|
-
DataService: new
|
|
3809
|
+
DataService: new import_echo_db5.DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
|
|
4035
3810
|
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager),
|
|
4036
3811
|
// TODO(burdon): Move to new protobuf definitions.
|
|
4037
3812
|
ProfileService: new ProfileServiceImpl(this._serviceContext),
|
|
@@ -4047,7 +3822,7 @@ var ClientServicesHost = class {
|
|
|
4047
3822
|
await this._serviceContext.open();
|
|
4048
3823
|
this._open = true;
|
|
4049
3824
|
const deviceKey = (_a = this._serviceContext.identityManager.identity) == null ? void 0 : _a.deviceKey;
|
|
4050
|
-
(0,
|
|
3825
|
+
(0, import_log16.log)("opened", {
|
|
4051
3826
|
deviceKey
|
|
4052
3827
|
}, {
|
|
4053
3828
|
file: "service-host.ts",
|
|
@@ -4062,7 +3837,7 @@ var ClientServicesHost = class {
|
|
|
4062
3837
|
return;
|
|
4063
3838
|
}
|
|
4064
3839
|
const deviceKey = (_a = this._serviceContext.identityManager.identity) == null ? void 0 : _a.deviceKey;
|
|
4065
|
-
(0,
|
|
3840
|
+
(0, import_log16.log)("closing...", {
|
|
4066
3841
|
deviceKey
|
|
4067
3842
|
}, {
|
|
4068
3843
|
file: "service-host.ts",
|
|
@@ -4075,7 +3850,7 @@ var ClientServicesHost = class {
|
|
|
4075
3850
|
});
|
|
4076
3851
|
await this._serviceContext.close();
|
|
4077
3852
|
this._open = false;
|
|
4078
|
-
(0,
|
|
3853
|
+
(0, import_log16.log)("closed", {
|
|
4079
3854
|
deviceKey
|
|
4080
3855
|
}, {
|
|
4081
3856
|
file: "service-host.ts",
|
|
@@ -4087,14 +3862,14 @@ var ClientServicesHost = class {
|
|
|
4087
3862
|
};
|
|
4088
3863
|
|
|
4089
3864
|
// packages/sdk/client-services/src/packlets/services/service-proxy.ts
|
|
4090
|
-
var
|
|
3865
|
+
var import_async20 = require("@dxos/async");
|
|
4091
3866
|
var import_errors2 = require("@dxos/errors");
|
|
4092
|
-
var
|
|
3867
|
+
var import_rpc5 = require("@dxos/rpc");
|
|
4093
3868
|
var ClientServicesProxy = class {
|
|
4094
3869
|
// prettier-ignore
|
|
4095
3870
|
constructor(port, _timeout = 3e4) {
|
|
4096
3871
|
this._timeout = _timeout;
|
|
4097
|
-
this._proxy = (0,
|
|
3872
|
+
this._proxy = (0, import_rpc5.createProtoRpcPeer)({
|
|
4098
3873
|
requested: clientServiceBundle,
|
|
4099
3874
|
exposed: {},
|
|
4100
3875
|
handlers: {},
|
|
@@ -4111,7 +3886,7 @@ var ClientServicesProxy = class {
|
|
|
4111
3886
|
return this._proxy.rpc;
|
|
4112
3887
|
}
|
|
4113
3888
|
async open() {
|
|
4114
|
-
await (0,
|
|
3889
|
+
await (0, import_async20.asyncTimeout)(this._proxy.open(), this._timeout, new import_errors2.RemoteServiceConnectionTimeout());
|
|
4115
3890
|
}
|
|
4116
3891
|
async close() {
|
|
4117
3892
|
await this._proxy.close();
|
|
@@ -4138,13 +3913,10 @@ var ClientServicesProxy = class {
|
|
|
4138
3913
|
IdentityManager,
|
|
4139
3914
|
InvitationEncoder,
|
|
4140
3915
|
InvitationObservableProvider,
|
|
4141
|
-
MemoryShellRuntime,
|
|
4142
3916
|
ON_CLOSE_DELAY,
|
|
4143
3917
|
ProfileServiceImpl,
|
|
4144
3918
|
ServiceContext,
|
|
4145
3919
|
ServiceRegistry,
|
|
4146
|
-
ShellController,
|
|
4147
|
-
ShellRuntimeImpl,
|
|
4148
3920
|
SpaceInvitationsHandler,
|
|
4149
3921
|
SpaceInvitationsProxy,
|
|
4150
3922
|
SpaceInvitationsServiceImpl,
|
|
@@ -4155,14 +3927,12 @@ var ClientServicesProxy = class {
|
|
|
4155
3927
|
VaultResourceLock,
|
|
4156
3928
|
WorkerRuntime,
|
|
4157
3929
|
WorkerSession,
|
|
4158
|
-
appServiceBundle,
|
|
4159
3930
|
clientServiceBundle,
|
|
4160
3931
|
createAuthProvider,
|
|
4161
3932
|
createDefaultModelFactory,
|
|
4162
3933
|
createStorageObjects,
|
|
4163
3934
|
getNetworkPeers,
|
|
4164
3935
|
iframeServiceBundle,
|
|
4165
|
-
shellServiceBundle,
|
|
4166
3936
|
subscribeToFeedBlocks,
|
|
4167
3937
|
subscribeToFeeds,
|
|
4168
3938
|
subscribeToNetworkStatus,
|