@dxos/client-services 0.1.53-next.e9dc2bc → 0.1.54-main.270ec56
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-3EI4PM2V.mjs → chunk-F4BHRFH4.mjs} +74 -20
- package/dist/lib/browser/chunk-F4BHRFH4.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +20 -59
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +1 -1
- package/dist/lib/node/index.cjs +101 -87
- 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 +62 -57
- package/dist/lib/node/packlets/testing/index.cjs.map +4 -4
- package/dist/types/src/packlets/services/index.d.ts +1 -0
- package/dist/types/src/packlets/services/index.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/worker-session.d.ts.map +1 -1
- package/package.json +32 -32
- package/src/packlets/services/index.ts +1 -0
- package/src/packlets/vault/worker-session.ts +5 -4
- package/dist/lib/browser/chunk-3EI4PM2V.mjs.map +0 -7
package/dist/lib/node/index.cjs
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// packages/sdk/client-services/src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
+
ClientRpcServer: () => ClientRpcServer,
|
|
33
34
|
ClientServicesHost: () => ClientServicesHost,
|
|
34
35
|
DataSpace: () => DataSpace,
|
|
35
36
|
DataSpaceManager: () => DataSpaceManager,
|
|
@@ -2149,11 +2150,64 @@ var SpaceInvitationProtocol = class {
|
|
|
2149
2150
|
}
|
|
2150
2151
|
};
|
|
2151
2152
|
|
|
2153
|
+
// packages/sdk/client-services/src/packlets/services/client-rpc-server.ts
|
|
2154
|
+
var import_codec_protobuf9 = require("@dxos/codec-protobuf");
|
|
2155
|
+
var import_debug3 = require("@dxos/debug");
|
|
2156
|
+
var import_rpc = require("@dxos/rpc");
|
|
2157
|
+
var ClientRpcServer = class {
|
|
2158
|
+
constructor(params) {
|
|
2159
|
+
this._handlerCache = /* @__PURE__ */ new Map();
|
|
2160
|
+
const { serviceRegistry, handleCall, handleStream, ...rpcOptions } = params;
|
|
2161
|
+
this._handleCall = handleCall;
|
|
2162
|
+
this._handleStream = handleStream;
|
|
2163
|
+
this._serviceRegistry = serviceRegistry;
|
|
2164
|
+
this._rpcPeer = new import_rpc.RpcPeer({
|
|
2165
|
+
...rpcOptions,
|
|
2166
|
+
callHandler: (method, params2) => {
|
|
2167
|
+
const [serviceName, methodName] = (0, import_rpc.parseMethodName)(method);
|
|
2168
|
+
const handler = (method2, params3) => this._getServiceHandler(serviceName).call(method2, params3);
|
|
2169
|
+
if (this._handleCall) {
|
|
2170
|
+
return this._handleCall(methodName, params2, handler);
|
|
2171
|
+
} else {
|
|
2172
|
+
return handler(methodName, params2);
|
|
2173
|
+
}
|
|
2174
|
+
},
|
|
2175
|
+
streamHandler: (method, params2) => {
|
|
2176
|
+
const [serviceName, methodName] = (0, import_rpc.parseMethodName)(method);
|
|
2177
|
+
const handler = (method2, params3) => this._getServiceHandler(serviceName).callStream(method2, params3);
|
|
2178
|
+
if (this._handleStream) {
|
|
2179
|
+
return import_codec_protobuf9.Stream.unwrapPromise(this._handleStream(methodName, params2, handler));
|
|
2180
|
+
} else {
|
|
2181
|
+
return handler(methodName, params2);
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
});
|
|
2185
|
+
}
|
|
2186
|
+
async open() {
|
|
2187
|
+
await this._rpcPeer.open();
|
|
2188
|
+
}
|
|
2189
|
+
async close() {
|
|
2190
|
+
await this._rpcPeer.close();
|
|
2191
|
+
}
|
|
2192
|
+
_getServiceHandler(serviceName) {
|
|
2193
|
+
var _a;
|
|
2194
|
+
if (!this._handlerCache.has(serviceName)) {
|
|
2195
|
+
const [key, descriptor] = (_a = Object.entries(this._serviceRegistry.descriptors).find(([key2, descriptor2]) => descriptor2.name === serviceName)) != null ? _a : (0, import_debug3.raise)(new Error(`Service not available: ${serviceName}`));
|
|
2196
|
+
const service = this._serviceRegistry.services[key];
|
|
2197
|
+
if (!service) {
|
|
2198
|
+
throw new Error(`Service not available: ${serviceName}`);
|
|
2199
|
+
}
|
|
2200
|
+
this._handlerCache.set(serviceName, descriptor.createServer(service));
|
|
2201
|
+
}
|
|
2202
|
+
return this._handlerCache.get(serviceName);
|
|
2203
|
+
}
|
|
2204
|
+
};
|
|
2205
|
+
|
|
2152
2206
|
// packages/sdk/client-services/src/packlets/services/service-context.ts
|
|
2153
2207
|
var import_tiny_invariant11 = __toESM(require("tiny-invariant"));
|
|
2154
2208
|
var import_async14 = require("@dxos/async");
|
|
2155
2209
|
var import_credentials13 = require("@dxos/credentials");
|
|
2156
|
-
var
|
|
2210
|
+
var import_debug7 = require("@dxos/debug");
|
|
2157
2211
|
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
2158
2212
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
2159
2213
|
var import_keyring = require("@dxos/keyring");
|
|
@@ -2179,7 +2233,7 @@ var import_util5 = require("@dxos/util");
|
|
|
2179
2233
|
var import_async11 = require("@dxos/async");
|
|
2180
2234
|
var import_client_protocol3 = require("@dxos/client-protocol");
|
|
2181
2235
|
var import_context6 = require("@dxos/context");
|
|
2182
|
-
var
|
|
2236
|
+
var import_debug4 = require("@dxos/debug");
|
|
2183
2237
|
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
2184
2238
|
var import_errors3 = require("@dxos/errors");
|
|
2185
2239
|
var import_keys8 = require("@dxos/keys");
|
|
@@ -2713,7 +2767,7 @@ _ts_decorate([
|
|
|
2713
2767
|
import_async11.synchronized
|
|
2714
2768
|
], DataSpace.prototype, "close", null);
|
|
2715
2769
|
_ts_decorate([
|
|
2716
|
-
(0,
|
|
2770
|
+
(0, import_debug4.timed)(1e4)
|
|
2717
2771
|
], DataSpace.prototype, "_createWritableFeeds", null);
|
|
2718
2772
|
_ts_decorate([
|
|
2719
2773
|
import_async11.synchronized
|
|
@@ -2727,7 +2781,7 @@ DataSpace = _ts_decorate([
|
|
|
2727
2781
|
|
|
2728
2782
|
// packages/sdk/client-services/src/packlets/spaces/genesis.ts
|
|
2729
2783
|
var import_credentials10 = require("@dxos/credentials");
|
|
2730
|
-
var
|
|
2784
|
+
var import_debug5 = require("@dxos/debug");
|
|
2731
2785
|
var import_credentials11 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
2732
2786
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
2733
2787
|
var spaceGenesis = async (keyring, signingContext, space) => {
|
|
@@ -2751,11 +2805,11 @@ var spaceGenesis = async (keyring, signingContext, space) => {
|
|
|
2751
2805
|
spaceKey: space.key,
|
|
2752
2806
|
role: import_credentials11.SpaceMember.Role.ADMIN,
|
|
2753
2807
|
profile: signingContext.profile,
|
|
2754
|
-
genesisFeedKey: (_a = space.controlFeedKey) != null ? _a : (0,
|
|
2808
|
+
genesisFeedKey: (_a = space.controlFeedKey) != null ? _a : (0, import_debug5.failUndefined)()
|
|
2755
2809
|
}
|
|
2756
2810
|
}),
|
|
2757
2811
|
await signingContext.credentialSigner.createCredential({
|
|
2758
|
-
subject: (_b = space.controlFeedKey) != null ? _b : (0,
|
|
2812
|
+
subject: (_b = space.controlFeedKey) != null ? _b : (0, import_debug5.failUndefined)(),
|
|
2759
2813
|
assertion: {
|
|
2760
2814
|
"@type": "dxos.halo.credentials.AdmittedFeed",
|
|
2761
2815
|
spaceKey: space.key,
|
|
@@ -2765,7 +2819,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
|
|
|
2765
2819
|
}
|
|
2766
2820
|
}),
|
|
2767
2821
|
await signingContext.credentialSigner.createCredential({
|
|
2768
|
-
subject: (_c = space.dataFeedKey) != null ? _c : (0,
|
|
2822
|
+
subject: (_c = space.dataFeedKey) != null ? _c : (0, import_debug5.failUndefined)(),
|
|
2769
2823
|
assertion: {
|
|
2770
2824
|
"@type": "dxos.halo.credentials.AdmittedFeed",
|
|
2771
2825
|
spaceKey: space.key,
|
|
@@ -2775,7 +2829,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
|
|
|
2775
2829
|
}
|
|
2776
2830
|
}),
|
|
2777
2831
|
await signingContext.credentialSigner.createCredential({
|
|
2778
|
-
subject: (_d = space.key) != null ? _d : (0,
|
|
2832
|
+
subject: (_d = space.key) != null ? _d : (0, import_debug5.failUndefined)(),
|
|
2779
2833
|
assertion: {
|
|
2780
2834
|
"@type": "dxos.halo.credentials.Epoch",
|
|
2781
2835
|
number: 0,
|
|
@@ -3097,8 +3151,8 @@ DataSpaceManager = _ts_decorate2([
|
|
|
3097
3151
|
|
|
3098
3152
|
// packages/sdk/client-services/src/packlets/spaces/spaces-service.ts
|
|
3099
3153
|
var import_async13 = require("@dxos/async");
|
|
3100
|
-
var
|
|
3101
|
-
var
|
|
3154
|
+
var import_codec_protobuf10 = require("@dxos/codec-protobuf");
|
|
3155
|
+
var import_debug6 = require("@dxos/debug");
|
|
3102
3156
|
var import_echo_pipeline2 = require("@dxos/echo-pipeline");
|
|
3103
3157
|
var import_errors4 = require("@dxos/errors");
|
|
3104
3158
|
var import_log11 = require("@dxos/log");
|
|
@@ -3124,7 +3178,7 @@ var SpacesServiceImpl = class {
|
|
|
3124
3178
|
async updateSpace({ spaceKey, state }) {
|
|
3125
3179
|
var _a;
|
|
3126
3180
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3127
|
-
const space = (_a = dataSpaceManager.spaces.get(spaceKey)) != null ? _a : (0,
|
|
3181
|
+
const space = (_a = dataSpaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
|
|
3128
3182
|
if (state) {
|
|
3129
3183
|
switch (state) {
|
|
3130
3184
|
case import_services8.SpaceState.ACTIVE:
|
|
@@ -3139,7 +3193,7 @@ var SpacesServiceImpl = class {
|
|
|
3139
3193
|
}
|
|
3140
3194
|
}
|
|
3141
3195
|
querySpaces() {
|
|
3142
|
-
return new
|
|
3196
|
+
return new import_codec_protobuf10.Stream(({ next, ctx }) => {
|
|
3143
3197
|
const scheduler = new import_async13.UpdateScheduler(ctx, async () => {
|
|
3144
3198
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3145
3199
|
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
@@ -3190,15 +3244,15 @@ var SpacesServiceImpl = class {
|
|
|
3190
3244
|
async postMessage({ spaceKey, channel, message }) {
|
|
3191
3245
|
var _a;
|
|
3192
3246
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3193
|
-
const space = (_a = dataSpaceManager.spaces.get(spaceKey)) != null ? _a : (0,
|
|
3247
|
+
const space = (_a = dataSpaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
|
|
3194
3248
|
await space.postMessage(getChannelId(channel), message);
|
|
3195
3249
|
}
|
|
3196
3250
|
subscribeMessages({ spaceKey, channel }) {
|
|
3197
|
-
return new
|
|
3251
|
+
return new import_codec_protobuf10.Stream(({ ctx, next }) => {
|
|
3198
3252
|
(0, import_async13.scheduleTask)(ctx, async () => {
|
|
3199
3253
|
var _a;
|
|
3200
3254
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3201
|
-
const space = (_a = dataSpaceManager.spaces.get(spaceKey)) != null ? _a : (0,
|
|
3255
|
+
const space = (_a = dataSpaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
|
|
3202
3256
|
const handle = space.listen(getChannelId(channel), (message) => {
|
|
3203
3257
|
next(message);
|
|
3204
3258
|
});
|
|
@@ -3207,9 +3261,9 @@ var SpacesServiceImpl = class {
|
|
|
3207
3261
|
});
|
|
3208
3262
|
}
|
|
3209
3263
|
queryCredentials({ spaceKey }) {
|
|
3210
|
-
return new
|
|
3264
|
+
return new import_codec_protobuf10.Stream(({ ctx, next }) => {
|
|
3211
3265
|
var _a;
|
|
3212
|
-
const space = (_a = this._spaceManager.spaces.get(spaceKey)) != null ? _a : (0,
|
|
3266
|
+
const space = (_a = this._spaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
|
|
3213
3267
|
const processor = {
|
|
3214
3268
|
processCredential: async (credential) => {
|
|
3215
3269
|
next(credential);
|
|
@@ -3221,7 +3275,7 @@ var SpacesServiceImpl = class {
|
|
|
3221
3275
|
}
|
|
3222
3276
|
async writeCredentials({ spaceKey, credentials }) {
|
|
3223
3277
|
var _a;
|
|
3224
|
-
const space = (_a = this._spaceManager.spaces.get(spaceKey)) != null ? _a : (0,
|
|
3278
|
+
const space = (_a = this._spaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
|
|
3225
3279
|
for (const credential of credentials != null ? credentials : []) {
|
|
3226
3280
|
await space.controlPipeline.writer.write({
|
|
3227
3281
|
credential: {
|
|
@@ -3233,7 +3287,7 @@ var SpacesServiceImpl = class {
|
|
|
3233
3287
|
async createEpoch({ spaceKey }) {
|
|
3234
3288
|
var _a;
|
|
3235
3289
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3236
|
-
const space = (_a = dataSpaceManager.spaces.get(spaceKey)) != null ? _a : (0,
|
|
3290
|
+
const space = (_a = dataSpaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
|
|
3237
3291
|
await space.createEpoch();
|
|
3238
3292
|
}
|
|
3239
3293
|
_serializeSpace(space) {
|
|
@@ -3313,7 +3367,7 @@ var ServiceContext = class {
|
|
|
3313
3367
|
this.invitations = new InvitationsHandler(this.networkManager);
|
|
3314
3368
|
this._handlerFactories.set(import_services9.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => {
|
|
3315
3369
|
var _a;
|
|
3316
|
-
return (_a = this.identityManager.identity) != null ? _a : (0,
|
|
3370
|
+
return (_a = this.identityManager.identity) != null ? _a : (0, import_debug7.failUndefined)();
|
|
3317
3371
|
}, this._acceptIdentity.bind(this)));
|
|
3318
3372
|
}
|
|
3319
3373
|
async open() {
|
|
@@ -3409,7 +3463,7 @@ var ServiceContext = class {
|
|
|
3409
3463
|
S: this,
|
|
3410
3464
|
C: (f, a) => f(...a)
|
|
3411
3465
|
});
|
|
3412
|
-
const identity = (_a = this.identityManager.identity) != null ? _a : (0,
|
|
3466
|
+
const identity = (_a = this.identityManager.identity) != null ? _a : (0, import_debug7.failUndefined)();
|
|
3413
3467
|
const signingContext = {
|
|
3414
3468
|
credentialSigner: identity.getIdentityCredentialSigner(),
|
|
3415
3469
|
identityKey: identity.identityKey,
|
|
@@ -3505,7 +3559,7 @@ var import_text_model = require("@dxos/text-model");
|
|
|
3505
3559
|
|
|
3506
3560
|
// packages/sdk/client-services/src/packlets/devices/devices-service.ts
|
|
3507
3561
|
var import_async15 = require("@dxos/async");
|
|
3508
|
-
var
|
|
3562
|
+
var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
3509
3563
|
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
3510
3564
|
var DevicesServiceImpl = class {
|
|
3511
3565
|
constructor(_identityManager) {
|
|
@@ -3515,7 +3569,7 @@ var DevicesServiceImpl = class {
|
|
|
3515
3569
|
throw new Error("Method not implemented.");
|
|
3516
3570
|
}
|
|
3517
3571
|
queryDevices() {
|
|
3518
|
-
return new
|
|
3572
|
+
return new import_codec_protobuf11.Stream(({ next }) => {
|
|
3519
3573
|
const update = () => {
|
|
3520
3574
|
var _a;
|
|
3521
3575
|
const deviceKeys = (_a = this._identityManager.identity) == null ? void 0 : _a.authorizedDeviceKeys;
|
|
@@ -3605,7 +3659,7 @@ var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
|
|
|
3605
3659
|
|
|
3606
3660
|
// packages/sdk/client-services/src/packlets/logging/logging-service.ts
|
|
3607
3661
|
var import_async16 = require("@dxos/async");
|
|
3608
|
-
var
|
|
3662
|
+
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
3609
3663
|
var import_log14 = require("@dxos/log");
|
|
3610
3664
|
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
3611
3665
|
var import_util7 = require("@dxos/util");
|
|
@@ -3624,7 +3678,7 @@ var LoggingServiceImpl = class {
|
|
|
3624
3678
|
import_log14.log.runtimeConfig.processors.splice(index, 1);
|
|
3625
3679
|
}
|
|
3626
3680
|
queryLogs(request) {
|
|
3627
|
-
return new
|
|
3681
|
+
return new import_codec_protobuf12.Stream(({ ctx, next }) => {
|
|
3628
3682
|
const handler = (entry2) => {
|
|
3629
3683
|
var _a, _b, _c, _d, _e;
|
|
3630
3684
|
if (LOG_PROCESSING > 0) {
|
|
@@ -3680,14 +3734,14 @@ var shouldLog = (entry2, request) => {
|
|
|
3680
3734
|
var LOG_PROCESSING = 0;
|
|
3681
3735
|
|
|
3682
3736
|
// packages/sdk/client-services/src/packlets/network/network-service.ts
|
|
3683
|
-
var
|
|
3737
|
+
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
3684
3738
|
var NetworkServiceImpl = class {
|
|
3685
3739
|
constructor(networkManager, signalManager) {
|
|
3686
3740
|
this.networkManager = networkManager;
|
|
3687
3741
|
this.signalManager = signalManager;
|
|
3688
3742
|
}
|
|
3689
3743
|
queryStatus() {
|
|
3690
|
-
return new
|
|
3744
|
+
return new import_codec_protobuf13.Stream(({ next }) => {
|
|
3691
3745
|
const update = () => {
|
|
3692
3746
|
next({
|
|
3693
3747
|
swarm: this.networkManager.connectionState,
|
|
@@ -3761,7 +3815,7 @@ var toStorageType = (type) => {
|
|
|
3761
3815
|
};
|
|
3762
3816
|
|
|
3763
3817
|
// packages/sdk/client-services/src/packlets/system/system-service.ts
|
|
3764
|
-
var
|
|
3818
|
+
var import_codec_protobuf14 = require("@dxos/codec-protobuf");
|
|
3765
3819
|
var SystemServiceImpl = class {
|
|
3766
3820
|
constructor({ config, statusUpdate, onUpdateStatus, getCurrentStatus, onReset }) {
|
|
3767
3821
|
this._config = config;
|
|
@@ -3778,7 +3832,7 @@ var SystemServiceImpl = class {
|
|
|
3778
3832
|
await this._onUpdateStatus(status);
|
|
3779
3833
|
}
|
|
3780
3834
|
queryStatus() {
|
|
3781
|
-
return new
|
|
3835
|
+
return new import_codec_protobuf14.Stream(({ next }) => {
|
|
3782
3836
|
const update = () => {
|
|
3783
3837
|
next({
|
|
3784
3838
|
status: this._getCurrentStatus()
|
|
@@ -4085,59 +4139,6 @@ var import_messaging2 = require("@dxos/messaging");
|
|
|
4085
4139
|
var import_network_manager3 = require("@dxos/network-manager");
|
|
4086
4140
|
var import_util9 = require("@dxos/util");
|
|
4087
4141
|
|
|
4088
|
-
// packages/sdk/client-services/src/packlets/services/client-rpc-server.ts
|
|
4089
|
-
var import_codec_protobuf14 = require("@dxos/codec-protobuf");
|
|
4090
|
-
var import_debug7 = require("@dxos/debug");
|
|
4091
|
-
var import_rpc = require("@dxos/rpc");
|
|
4092
|
-
var ClientRpcServer = class {
|
|
4093
|
-
constructor(params) {
|
|
4094
|
-
this._handlerCache = /* @__PURE__ */ new Map();
|
|
4095
|
-
const { serviceRegistry, handleCall, handleStream, ...rpcOptions } = params;
|
|
4096
|
-
this._handleCall = handleCall;
|
|
4097
|
-
this._handleStream = handleStream;
|
|
4098
|
-
this._serviceRegistry = serviceRegistry;
|
|
4099
|
-
this._rpcPeer = new import_rpc.RpcPeer({
|
|
4100
|
-
...rpcOptions,
|
|
4101
|
-
callHandler: (method, params2) => {
|
|
4102
|
-
const [serviceName, methodName] = (0, import_rpc.parseMethodName)(method);
|
|
4103
|
-
const handler = (method2, params3) => this._getServiceHandler(serviceName).call(method2, params3);
|
|
4104
|
-
if (this._handleCall) {
|
|
4105
|
-
return this._handleCall(methodName, params2, handler);
|
|
4106
|
-
} else {
|
|
4107
|
-
return handler(methodName, params2);
|
|
4108
|
-
}
|
|
4109
|
-
},
|
|
4110
|
-
streamHandler: (method, params2) => {
|
|
4111
|
-
const [serviceName, methodName] = (0, import_rpc.parseMethodName)(method);
|
|
4112
|
-
const handler = (method2, params3) => this._getServiceHandler(serviceName).callStream(method2, params3);
|
|
4113
|
-
if (this._handleStream) {
|
|
4114
|
-
return import_codec_protobuf14.Stream.unwrapPromise(this._handleStream(methodName, params2, handler));
|
|
4115
|
-
} else {
|
|
4116
|
-
return handler(methodName, params2);
|
|
4117
|
-
}
|
|
4118
|
-
}
|
|
4119
|
-
});
|
|
4120
|
-
}
|
|
4121
|
-
async open() {
|
|
4122
|
-
await this._rpcPeer.open();
|
|
4123
|
-
}
|
|
4124
|
-
async close() {
|
|
4125
|
-
await this._rpcPeer.close();
|
|
4126
|
-
}
|
|
4127
|
-
_getServiceHandler(serviceName) {
|
|
4128
|
-
var _a;
|
|
4129
|
-
if (!this._handlerCache.has(serviceName)) {
|
|
4130
|
-
const [key, descriptor] = (_a = Object.entries(this._serviceRegistry.descriptors).find(([key2, descriptor2]) => descriptor2.name === serviceName)) != null ? _a : (0, import_debug7.raise)(new Error(`Service not available: ${serviceName}`));
|
|
4131
|
-
const service = this._serviceRegistry.services[key];
|
|
4132
|
-
if (!service) {
|
|
4133
|
-
throw new Error(`Service not available: ${serviceName}`);
|
|
4134
|
-
}
|
|
4135
|
-
this._handlerCache.set(serviceName, descriptor.createServer(service));
|
|
4136
|
-
}
|
|
4137
|
-
return this._handlerCache.get(serviceName);
|
|
4138
|
-
}
|
|
4139
|
-
};
|
|
4140
|
-
|
|
4141
4142
|
// packages/sdk/client-services/src/packlets/vault/shell-runtime.ts
|
|
4142
4143
|
var import_tiny_invariant14 = __toESM(require("tiny-invariant"));
|
|
4143
4144
|
var import_async18 = require("@dxos/async");
|
|
@@ -4472,7 +4473,7 @@ var WorkerSession = class {
|
|
|
4472
4473
|
} catch (err) {
|
|
4473
4474
|
import_log18.log.catch(err, void 0, {
|
|
4474
4475
|
F: __dxlog_file17,
|
|
4475
|
-
L:
|
|
4476
|
+
L: 99,
|
|
4476
4477
|
S: this,
|
|
4477
4478
|
C: (f, a) => f(...a)
|
|
4478
4479
|
});
|
|
@@ -4487,9 +4488,9 @@ var WorkerSession = class {
|
|
|
4487
4488
|
this.bridgeService = this._iframeRpc.rpc.BridgeService;
|
|
4488
4489
|
}
|
|
4489
4490
|
async open() {
|
|
4490
|
-
import_log18.log.info("opening
|
|
4491
|
+
import_log18.log.info("opening...", void 0, {
|
|
4491
4492
|
F: __dxlog_file17,
|
|
4492
|
-
L:
|
|
4493
|
+
L: 113,
|
|
4493
4494
|
S: this,
|
|
4494
4495
|
C: (f, a) => f(...a)
|
|
4495
4496
|
});
|
|
@@ -4504,9 +4505,15 @@ var WorkerSession = class {
|
|
|
4504
4505
|
if (this.lockKey) {
|
|
4505
4506
|
void this._afterLockReleases(this.lockKey, () => this.close());
|
|
4506
4507
|
}
|
|
4508
|
+
import_log18.log.info("opened", void 0, {
|
|
4509
|
+
F: __dxlog_file17,
|
|
4510
|
+
L: 120,
|
|
4511
|
+
S: this,
|
|
4512
|
+
C: (f, a) => f(...a)
|
|
4513
|
+
});
|
|
4507
4514
|
}
|
|
4508
4515
|
async close() {
|
|
4509
|
-
import_log18.log.info("closing
|
|
4516
|
+
import_log18.log.info("closing...", void 0, {
|
|
4510
4517
|
F: __dxlog_file17,
|
|
4511
4518
|
L: 124,
|
|
4512
4519
|
S: this,
|
|
@@ -4526,6 +4533,12 @@ var WorkerSession = class {
|
|
|
4526
4533
|
this._clientRpc.close(),
|
|
4527
4534
|
this._iframeRpc.close()
|
|
4528
4535
|
]);
|
|
4536
|
+
import_log18.log.info("closed", void 0, {
|
|
4537
|
+
F: __dxlog_file17,
|
|
4538
|
+
L: 132,
|
|
4539
|
+
S: this,
|
|
4540
|
+
C: (f, a) => f(...a)
|
|
4541
|
+
});
|
|
4529
4542
|
}
|
|
4530
4543
|
async _maybeOpenShell() {
|
|
4531
4544
|
try {
|
|
@@ -4533,7 +4546,7 @@ var WorkerSession = class {
|
|
|
4533
4546
|
} catch (e) {
|
|
4534
4547
|
import_log18.log.info("No shell connected.", void 0, {
|
|
4535
4548
|
F: __dxlog_file17,
|
|
4536
|
-
L:
|
|
4549
|
+
L: 139,
|
|
4537
4550
|
S: this,
|
|
4538
4551
|
C: (f, a) => f(...a)
|
|
4539
4552
|
});
|
|
@@ -4654,6 +4667,7 @@ var WorkerRuntime = class {
|
|
|
4654
4667
|
};
|
|
4655
4668
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4656
4669
|
0 && (module.exports = {
|
|
4670
|
+
ClientRpcServer,
|
|
4657
4671
|
ClientServicesHost,
|
|
4658
4672
|
DataSpace,
|
|
4659
4673
|
DataSpaceManager,
|