@dxos/client-services 0.4.10-main.ec8b427 → 0.4.10-main.ef6fbc2
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-4NKBBUMB.mjs → chunk-2B66DLAB.mjs} +202 -89
- package/dist/lib/browser/{chunk-4NKBBUMB.mjs.map → chunk-2B66DLAB.mjs.map} +4 -4
- package/dist/lib/browser/index.mjs +50 -20
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +6 -4
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-5YRLBMIC.cjs → chunk-Y7UTCQRW.cjs} +200 -92
- package/dist/lib/node/chunk-Y7UTCQRW.cjs.map +7 -0
- package/dist/lib/node/index.cjs +87 -57
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +10 -8
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/indexing/util.d.ts +2 -2
- package/dist/types/src/packlets/indexing/util.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +7 -5
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +1 -0
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/index.d.ts +1 -0
- package/dist/types/src/packlets/storage/index.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/level.d.ts +4 -0
- package/dist/types/src/packlets/storage/level.d.ts.map +1 -0
- package/dist/types/src/packlets/storage/storage.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/util.d.ts +4 -0
- package/dist/types/src/packlets/storage/util.d.ts.map +1 -0
- 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/shared-worker-connection.d.ts +5 -5
- package/dist/types/src/packlets/vault/shared-worker-connection.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/worker-runtime.d.ts +2 -0
- package/dist/types/src/packlets/vault/worker-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/worker-session.d.ts +2 -0
- package/dist/types/src/packlets/vault/worker-session.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +35 -34
- package/src/packlets/devices/devices-service.test.ts +1 -1
- package/src/packlets/identity/identity-service.test.ts +1 -1
- package/src/packlets/indexing/util.ts +4 -4
- package/src/packlets/invitations/device-invitation-protocol.test.ts +1 -1
- package/src/packlets/network/network-service.test.ts +1 -1
- package/src/packlets/services/service-context.test.ts +5 -5
- package/src/packlets/services/service-context.ts +13 -8
- package/src/packlets/services/service-host.ts +32 -8
- package/src/packlets/services/service-registry.test.ts +1 -1
- package/src/packlets/spaces/data-space.ts +51 -2
- package/src/packlets/spaces/spaces-service.test.ts +1 -1
- package/src/packlets/storage/index.ts +1 -0
- package/src/packlets/storage/level.ts +19 -0
- package/src/packlets/storage/storage.ts +3 -9
- package/src/packlets/storage/util.ts +19 -0
- package/src/packlets/testing/test-builder.ts +5 -3
- package/src/packlets/vault/shared-worker-connection.ts +3 -8
- package/src/packlets/vault/worker-runtime.ts +27 -2
- package/src/packlets/vault/worker-session.ts +6 -0
- package/src/version.ts +1 -1
- package/dist/lib/node/chunk-5YRLBMIC.cjs.map +0 -7
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_Y7UTCQRW_exports = {};
|
|
30
|
+
__export(chunk_Y7UTCQRW_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
DataSpace: () => DataSpace,
|
|
@@ -48,6 +48,7 @@ __export(chunk_5YRLBMIC_exports, {
|
|
|
48
48
|
TrustedKeySetAuthVerifier: () => TrustedKeySetAuthVerifier,
|
|
49
49
|
createAuthProvider: () => createAuthProvider,
|
|
50
50
|
createDiagnostics: () => createDiagnostics,
|
|
51
|
+
createLevel: () => createLevel,
|
|
51
52
|
createStorageObjects: () => createStorageObjects,
|
|
52
53
|
getNetworkPeers: () => getNetworkPeers,
|
|
53
54
|
invitationExpired: () => invitationExpired,
|
|
@@ -60,7 +61,7 @@ __export(chunk_5YRLBMIC_exports, {
|
|
|
60
61
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
61
62
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
62
63
|
});
|
|
63
|
-
module.exports = __toCommonJS(
|
|
64
|
+
module.exports = __toCommonJS(chunk_Y7UTCQRW_exports);
|
|
64
65
|
var import_async = require("@dxos/async");
|
|
65
66
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
66
67
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -158,7 +159,9 @@ var import_async10 = require("@dxos/async");
|
|
|
158
159
|
var import_client_protocol3 = require("@dxos/client-protocol");
|
|
159
160
|
var import_context7 = require("@dxos/context");
|
|
160
161
|
var import_debug3 = require("@dxos/debug");
|
|
162
|
+
var import_echo_db = require("@dxos/echo-db");
|
|
161
163
|
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
164
|
+
var import_echo_pipeline2 = require("@dxos/echo-pipeline");
|
|
162
165
|
var import_invariant10 = require("@dxos/invariant");
|
|
163
166
|
var import_keys7 = require("@dxos/keys");
|
|
164
167
|
var import_log8 = require("@dxos/log");
|
|
@@ -203,7 +206,7 @@ var import_async15 = require("@dxos/async");
|
|
|
203
206
|
var import_context10 = require("@dxos/context");
|
|
204
207
|
var import_credentials15 = require("@dxos/credentials");
|
|
205
208
|
var import_debug6 = require("@dxos/debug");
|
|
206
|
-
var
|
|
209
|
+
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
207
210
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
208
211
|
var import_indexing = require("@dxos/indexing");
|
|
209
212
|
var import_invariant14 = require("@dxos/invariant");
|
|
@@ -221,19 +224,23 @@ var import_protocols13 = require("@dxos/protocols");
|
|
|
221
224
|
var import_invariant15 = require("@dxos/invariant");
|
|
222
225
|
var import_lock_file = require("@dxos/lock-file");
|
|
223
226
|
var import_log13 = require("@dxos/log");
|
|
224
|
-
var import_client_protocol4 = require("@dxos/client-protocol");
|
|
225
227
|
var import_protocols14 = require("@dxos/protocols");
|
|
226
228
|
var import_config = require("@dxos/protocols/proto/dxos/config");
|
|
227
229
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
230
|
+
var import_client_protocol4 = require("@dxos/client-protocol");
|
|
231
|
+
var import_config2 = require("@dxos/protocols/proto/dxos/config");
|
|
228
232
|
var import_util8 = require("@dxos/util");
|
|
233
|
+
var import_level = require("level");
|
|
234
|
+
var import_node_path = __toESM(require("node:path"));
|
|
235
|
+
var import_keys11 = require("@dxos/keys");
|
|
229
236
|
var import_async16 = require("@dxos/async");
|
|
230
237
|
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
231
238
|
var import_context11 = require("@dxos/context");
|
|
232
|
-
var
|
|
233
|
-
var
|
|
239
|
+
var import_echo_pipeline4 = require("@dxos/echo-pipeline");
|
|
240
|
+
var E = __toESM(require("@dxos/echo-schema"));
|
|
234
241
|
var import_indexing2 = require("@dxos/indexing");
|
|
235
242
|
var import_invariant16 = require("@dxos/invariant");
|
|
236
|
-
var
|
|
243
|
+
var import_keys12 = require("@dxos/keys");
|
|
237
244
|
var import_log14 = require("@dxos/log");
|
|
238
245
|
var import_messaging = require("@dxos/messaging");
|
|
239
246
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
@@ -248,7 +255,7 @@ var import_invariant17 = require("@dxos/invariant");
|
|
|
248
255
|
var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
|
|
249
256
|
var import_async18 = require("@dxos/async");
|
|
250
257
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
251
|
-
var
|
|
258
|
+
var import_keys13 = require("@dxos/keys");
|
|
252
259
|
var import_log15 = require("@dxos/log");
|
|
253
260
|
var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
|
|
254
261
|
var import_util10 = require("@dxos/util");
|
|
@@ -2884,7 +2891,7 @@ var getPlatform = () => {
|
|
|
2884
2891
|
};
|
|
2885
2892
|
}
|
|
2886
2893
|
};
|
|
2887
|
-
var DXOS_VERSION = "0.4.10-main.
|
|
2894
|
+
var DXOS_VERSION = "0.4.10-main.ef6fbc2";
|
|
2888
2895
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
2889
2896
|
var DEFAULT_TIMEOUT = 1e3;
|
|
2890
2897
|
var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
@@ -3326,7 +3333,7 @@ var DataSpace = class {
|
|
|
3326
3333
|
state: import_services9.SpaceState[this._state]
|
|
3327
3334
|
}, {
|
|
3328
3335
|
F: __dxlog_file12,
|
|
3329
|
-
L:
|
|
3336
|
+
L: 140,
|
|
3330
3337
|
S: this,
|
|
3331
3338
|
C: (f, a) => f(...a)
|
|
3332
3339
|
});
|
|
@@ -3376,7 +3383,7 @@ var DataSpace = class {
|
|
|
3376
3383
|
state: import_services9.SpaceState[this._state]
|
|
3377
3384
|
}, {
|
|
3378
3385
|
F: __dxlog_file12,
|
|
3379
|
-
L:
|
|
3386
|
+
L: 198,
|
|
3380
3387
|
S: this,
|
|
3381
3388
|
C: (f, a) => f(...a)
|
|
3382
3389
|
});
|
|
@@ -3394,7 +3401,7 @@ var DataSpace = class {
|
|
|
3394
3401
|
state: import_services9.SpaceState[this._state]
|
|
3395
3402
|
}, {
|
|
3396
3403
|
F: __dxlog_file12,
|
|
3397
|
-
L:
|
|
3404
|
+
L: 212,
|
|
3398
3405
|
S: this,
|
|
3399
3406
|
C: (f, a) => f(...a)
|
|
3400
3407
|
});
|
|
@@ -3426,7 +3433,7 @@ var DataSpace = class {
|
|
|
3426
3433
|
if (err instanceof import_protocols8.CancelledError || err instanceof import_context7.ContextDisposedError) {
|
|
3427
3434
|
(0, import_log8.log)("data pipeline initialization cancelled", err, {
|
|
3428
3435
|
F: __dxlog_file12,
|
|
3429
|
-
L:
|
|
3436
|
+
L: 245,
|
|
3430
3437
|
S: this,
|
|
3431
3438
|
C: (f, a) => f(...a)
|
|
3432
3439
|
});
|
|
@@ -3434,7 +3441,7 @@ var DataSpace = class {
|
|
|
3434
3441
|
}
|
|
3435
3442
|
import_log8.log.error("Error initializing data pipeline", err, {
|
|
3436
3443
|
F: __dxlog_file12,
|
|
3437
|
-
L:
|
|
3444
|
+
L: 249,
|
|
3438
3445
|
S: this,
|
|
3439
3446
|
C: (f, a) => f(...a)
|
|
3440
3447
|
});
|
|
@@ -3443,7 +3450,7 @@ var DataSpace = class {
|
|
|
3443
3450
|
state: import_services9.SpaceState[this._state]
|
|
3444
3451
|
}, {
|
|
3445
3452
|
F: __dxlog_file12,
|
|
3446
|
-
L:
|
|
3453
|
+
L: 251,
|
|
3447
3454
|
S: this,
|
|
3448
3455
|
C: (f, a) => f(...a)
|
|
3449
3456
|
});
|
|
@@ -3463,7 +3470,7 @@ var DataSpace = class {
|
|
|
3463
3470
|
state: import_services9.SpaceState[this._state]
|
|
3464
3471
|
}, {
|
|
3465
3472
|
F: __dxlog_file12,
|
|
3466
|
-
L:
|
|
3473
|
+
L: 267,
|
|
3467
3474
|
S: this,
|
|
3468
3475
|
C: (f, a) => f(...a)
|
|
3469
3476
|
});
|
|
@@ -3473,7 +3480,7 @@ var DataSpace = class {
|
|
|
3473
3480
|
await (0, import_context7.cancelWithContext)(this._ctx, this.automergeSpaceState.ensureEpochInitialized());
|
|
3474
3481
|
(0, import_log8.log)("data pipeline ready", void 0, {
|
|
3475
3482
|
F: __dxlog_file12,
|
|
3476
|
-
L:
|
|
3483
|
+
L: 279,
|
|
3477
3484
|
S: this,
|
|
3478
3485
|
C: (f, a) => f(...a)
|
|
3479
3486
|
});
|
|
@@ -3483,7 +3490,7 @@ var DataSpace = class {
|
|
|
3483
3490
|
state: import_services9.SpaceState[this._state]
|
|
3484
3491
|
}, {
|
|
3485
3492
|
F: __dxlog_file12,
|
|
3486
|
-
L:
|
|
3493
|
+
L: 283,
|
|
3487
3494
|
S: this,
|
|
3488
3495
|
C: (f, a) => f(...a)
|
|
3489
3496
|
});
|
|
@@ -3499,7 +3506,7 @@ var DataSpace = class {
|
|
|
3499
3506
|
await this._createWritableFeeds();
|
|
3500
3507
|
(0, import_log8.log)("writable feeds created", void 0, {
|
|
3501
3508
|
F: __dxlog_file12,
|
|
3502
|
-
L:
|
|
3509
|
+
L: 299,
|
|
3503
3510
|
S: this,
|
|
3504
3511
|
C: (f, a) => f(...a)
|
|
3505
3512
|
});
|
|
@@ -3562,7 +3569,7 @@ var DataSpace = class {
|
|
|
3562
3569
|
rootUrl
|
|
3563
3570
|
}, {
|
|
3564
3571
|
F: __dxlog_file12,
|
|
3565
|
-
L:
|
|
3572
|
+
L: 365,
|
|
3566
3573
|
S: this,
|
|
3567
3574
|
C: (f, a) => f(...a)
|
|
3568
3575
|
});
|
|
@@ -3594,7 +3601,7 @@ var DataSpace = class {
|
|
|
3594
3601
|
err
|
|
3595
3602
|
}, {
|
|
3596
3603
|
F: __dxlog_file12,
|
|
3597
|
-
L:
|
|
3604
|
+
L: 388,
|
|
3598
3605
|
S: this,
|
|
3599
3606
|
C: (f, a) => f(...a)
|
|
3600
3607
|
});
|
|
@@ -3649,7 +3656,7 @@ var DataSpace = class {
|
|
|
3649
3656
|
const newRoot = this._automergeHost.repo.create(rootHandle.docSync());
|
|
3650
3657
|
(0, import_invariant10.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
3651
3658
|
F: __dxlog_file12,
|
|
3652
|
-
L:
|
|
3659
|
+
L: 438,
|
|
3653
3660
|
S: this,
|
|
3654
3661
|
A: [
|
|
3655
3662
|
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
@@ -3664,6 +3671,66 @@ var DataSpace = class {
|
|
|
3664
3671
|
};
|
|
3665
3672
|
}
|
|
3666
3673
|
break;
|
|
3674
|
+
case import_services9.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT:
|
|
3675
|
+
{
|
|
3676
|
+
import_log8.log.info("Fragmenting", void 0, {
|
|
3677
|
+
F: __dxlog_file12,
|
|
3678
|
+
L: 450,
|
|
3679
|
+
S: this,
|
|
3680
|
+
C: (f, a) => f(...a)
|
|
3681
|
+
});
|
|
3682
|
+
const currentRootUrl = this._automergeSpaceState.rootUrl;
|
|
3683
|
+
const rootHandle = this._automergeHost.repo.find(currentRootUrl);
|
|
3684
|
+
await (0, import_context7.cancelWithContext)(this._ctx, (0, import_async10.asyncTimeout)(rootHandle.whenReady(), 1e4));
|
|
3685
|
+
const objects = Object.entries(rootHandle.docSync().objects);
|
|
3686
|
+
const properties = objects.find(([_, value]) => value.system.type?.itemId === import_echo_db.TYPE_PROPERTIES);
|
|
3687
|
+
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
3688
|
+
(0, import_invariant10.invariant)(properties, "Properties not found", {
|
|
3689
|
+
F: __dxlog_file12,
|
|
3690
|
+
L: 460,
|
|
3691
|
+
S: this,
|
|
3692
|
+
A: [
|
|
3693
|
+
"properties",
|
|
3694
|
+
"'Properties not found'"
|
|
3695
|
+
]
|
|
3696
|
+
});
|
|
3697
|
+
const newSpaceDoc = {
|
|
3698
|
+
...rootHandle.docSync(),
|
|
3699
|
+
objects: Object.fromEntries([
|
|
3700
|
+
properties
|
|
3701
|
+
])
|
|
3702
|
+
};
|
|
3703
|
+
const newRoot = this._automergeHost.repo.create(newSpaceDoc);
|
|
3704
|
+
(0, import_invariant10.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
3705
|
+
F: __dxlog_file12,
|
|
3706
|
+
L: 465,
|
|
3707
|
+
S: this,
|
|
3708
|
+
A: [
|
|
3709
|
+
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
3710
|
+
""
|
|
3711
|
+
]
|
|
3712
|
+
});
|
|
3713
|
+
const docLoader = new import_echo_pipeline2.AutomergeDocumentLoaderImpl(this.key, this._automergeHost.repo);
|
|
3714
|
+
await docLoader.loadSpaceRootDocHandle(this._ctx, {
|
|
3715
|
+
rootUrl: newRoot.url
|
|
3716
|
+
});
|
|
3717
|
+
otherObjects.forEach(([key, value]) => {
|
|
3718
|
+
const handle = docLoader.createDocumentForObject(key);
|
|
3719
|
+
handle.change((doc) => {
|
|
3720
|
+
(0, import_util4.assignDeep)(doc, [
|
|
3721
|
+
"objects",
|
|
3722
|
+
key
|
|
3723
|
+
], value);
|
|
3724
|
+
});
|
|
3725
|
+
});
|
|
3726
|
+
epoch = {
|
|
3727
|
+
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
3728
|
+
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
3729
|
+
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe2.Timeframe(),
|
|
3730
|
+
automergeRoot: newRoot.url
|
|
3731
|
+
};
|
|
3732
|
+
}
|
|
3733
|
+
break;
|
|
3667
3734
|
}
|
|
3668
3735
|
if (!epoch) {
|
|
3669
3736
|
return;
|
|
@@ -3705,7 +3772,7 @@ var DataSpace = class {
|
|
|
3705
3772
|
state: import_services9.SpaceState[this._state]
|
|
3706
3773
|
}, {
|
|
3707
3774
|
F: __dxlog_file12,
|
|
3708
|
-
L:
|
|
3775
|
+
L: 531,
|
|
3709
3776
|
S: this,
|
|
3710
3777
|
C: (f, a) => f(...a)
|
|
3711
3778
|
});
|
|
@@ -4369,7 +4436,7 @@ var SpacesServiceImpl = class {
|
|
|
4369
4436
|
}
|
|
4370
4437
|
};
|
|
4371
4438
|
var getChannelId = (channel) => `user-channel/${channel}`;
|
|
4372
|
-
var
|
|
4439
|
+
var createSelectedDocumentsIterator = (automergeHost) => (
|
|
4373
4440
|
/**
|
|
4374
4441
|
* Get object data blobs from Automerge Repo by ids.
|
|
4375
4442
|
* @param ids
|
|
@@ -4382,17 +4449,17 @@ var createLoadDocuments = (automergeHost) => (
|
|
|
4382
4449
|
await (0, import_debug7.warnAfterTimeout)(5e3, "to long to load doc", () => handle.whenReady());
|
|
4383
4450
|
const doc = handle.docSync();
|
|
4384
4451
|
const hash = (0, import_automerge.getHeads)(doc).join("");
|
|
4385
|
-
yield [
|
|
4452
|
+
yield doc.objects?.[objectId] ? [
|
|
4386
4453
|
{
|
|
4387
4454
|
id,
|
|
4388
4455
|
object: doc.objects[objectId],
|
|
4389
4456
|
currentHash: hash
|
|
4390
4457
|
}
|
|
4391
|
-
];
|
|
4458
|
+
] : [];
|
|
4392
4459
|
}
|
|
4393
4460
|
}
|
|
4394
4461
|
);
|
|
4395
|
-
var
|
|
4462
|
+
var createDocumentsIterator = (automergeHost) => (
|
|
4396
4463
|
/**
|
|
4397
4464
|
* Recursively get all object data blobs from Automerge Repo.
|
|
4398
4465
|
* @param ids
|
|
@@ -4415,7 +4482,7 @@ var createGetAllDocuments = (automergeHost) => (
|
|
|
4415
4482
|
objectId
|
|
4416
4483
|
}),
|
|
4417
4484
|
object,
|
|
4418
|
-
currentHash: heads.
|
|
4485
|
+
currentHash: heads.join("")
|
|
4419
4486
|
};
|
|
4420
4487
|
});
|
|
4421
4488
|
}
|
|
@@ -4454,17 +4521,19 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
4454
4521
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4455
4522
|
}
|
|
4456
4523
|
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
4457
|
-
var ServiceContext = class {
|
|
4458
|
-
constructor(storage, networkManager, signalManager, _runtimeParams) {
|
|
4524
|
+
var ServiceContext = class extends import_context10.Resource {
|
|
4525
|
+
constructor(storage, level, networkManager, signalManager, _runtimeParams) {
|
|
4526
|
+
super();
|
|
4459
4527
|
this.storage = storage;
|
|
4528
|
+
this.level = level;
|
|
4460
4529
|
this.networkManager = networkManager;
|
|
4461
4530
|
this.signalManager = signalManager;
|
|
4462
4531
|
this._runtimeParams = _runtimeParams;
|
|
4463
4532
|
this.initialized = new import_async15.Trigger();
|
|
4464
4533
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
4465
4534
|
this._instanceId = import_keys10.PublicKey.random().toHex();
|
|
4466
|
-
this.metadataStore = new
|
|
4467
|
-
this.snapshotStore = new
|
|
4535
|
+
this.metadataStore = new import_echo_pipeline3.MetadataStore(storage.createDirectory("metadata"));
|
|
4536
|
+
this.snapshotStore = new import_echo_pipeline3.SnapshotStore(storage.createDirectory("snapshots"));
|
|
4468
4537
|
this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
|
|
4469
4538
|
this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
|
|
4470
4539
|
this.feedStore = new import_feed_store4.FeedStore({
|
|
@@ -4472,12 +4541,12 @@ var ServiceContext = class {
|
|
|
4472
4541
|
root: storage.createDirectory("feeds"),
|
|
4473
4542
|
signer: this.keyring,
|
|
4474
4543
|
hypercore: {
|
|
4475
|
-
valueEncoding:
|
|
4544
|
+
valueEncoding: import_echo_pipeline3.valueEncoding,
|
|
4476
4545
|
stats: true
|
|
4477
4546
|
}
|
|
4478
4547
|
})
|
|
4479
4548
|
});
|
|
4480
|
-
this.spaceManager = new
|
|
4549
|
+
this.spaceManager = new import_echo_pipeline3.SpaceManager({
|
|
4481
4550
|
feedStore: this.feedStore,
|
|
4482
4551
|
networkManager: this.networkManager,
|
|
4483
4552
|
blobStore: this.blobStore,
|
|
@@ -4486,9 +4555,9 @@ var ServiceContext = class {
|
|
|
4486
4555
|
});
|
|
4487
4556
|
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager, this._runtimeParams);
|
|
4488
4557
|
this.indexMetadata = new import_indexing.IndexMetadataStore({
|
|
4489
|
-
|
|
4558
|
+
db: level.sublevel("index-metadata")
|
|
4490
4559
|
});
|
|
4491
|
-
this.automergeHost = new
|
|
4560
|
+
this.automergeHost = new import_echo_pipeline3.AutomergeHost({
|
|
4492
4561
|
directory: storage.createDirectory("automerge"),
|
|
4493
4562
|
metadata: this.indexMetadata
|
|
4494
4563
|
});
|
|
@@ -4497,17 +4566,17 @@ var ServiceContext = class {
|
|
|
4497
4566
|
directory: storage.createDirectory("index-store")
|
|
4498
4567
|
}),
|
|
4499
4568
|
metadataStore: this.indexMetadata,
|
|
4500
|
-
loadDocuments:
|
|
4501
|
-
getAllDocuments:
|
|
4569
|
+
loadDocuments: createSelectedDocumentsIterator(this.automergeHost),
|
|
4570
|
+
getAllDocuments: createDocumentsIterator(this.automergeHost)
|
|
4502
4571
|
});
|
|
4503
4572
|
this.invitations = new InvitationsHandler(this.networkManager);
|
|
4504
4573
|
this._handlerFactories.set(import_services12.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug6.failUndefined)(), this._acceptIdentity.bind(this)));
|
|
4505
4574
|
}
|
|
4506
|
-
async
|
|
4575
|
+
async _open(ctx) {
|
|
4507
4576
|
await this._checkStorageVersion();
|
|
4508
4577
|
(0, import_log12.log)("opening...", void 0, {
|
|
4509
4578
|
F: __dxlog_file15,
|
|
4510
|
-
L:
|
|
4579
|
+
L: 156,
|
|
4511
4580
|
S: this,
|
|
4512
4581
|
C: (f, a) => f(...a)
|
|
4513
4582
|
});
|
|
@@ -4515,7 +4584,7 @@ var ServiceContext = class {
|
|
|
4515
4584
|
id: this._instanceId
|
|
4516
4585
|
}), {
|
|
4517
4586
|
F: __dxlog_file15,
|
|
4518
|
-
L:
|
|
4587
|
+
L: 157,
|
|
4519
4588
|
S: this,
|
|
4520
4589
|
C: (f, a) => f(...a)
|
|
4521
4590
|
});
|
|
@@ -4531,21 +4600,21 @@ var ServiceContext = class {
|
|
|
4531
4600
|
id: this._instanceId
|
|
4532
4601
|
}), {
|
|
4533
4602
|
F: __dxlog_file15,
|
|
4534
|
-
L:
|
|
4603
|
+
L: 167,
|
|
4535
4604
|
S: this,
|
|
4536
4605
|
C: (f, a) => f(...a)
|
|
4537
4606
|
});
|
|
4538
4607
|
(0, import_log12.log)("opened", void 0, {
|
|
4539
4608
|
F: __dxlog_file15,
|
|
4540
|
-
L:
|
|
4609
|
+
L: 168,
|
|
4541
4610
|
S: this,
|
|
4542
4611
|
C: (f, a) => f(...a)
|
|
4543
4612
|
});
|
|
4544
4613
|
}
|
|
4545
|
-
async
|
|
4614
|
+
async _close() {
|
|
4546
4615
|
(0, import_log12.log)("closing...", void 0, {
|
|
4547
4616
|
F: __dxlog_file15,
|
|
4548
|
-
L:
|
|
4617
|
+
L: 172,
|
|
4549
4618
|
S: this,
|
|
4550
4619
|
C: (f, a) => f(...a)
|
|
4551
4620
|
});
|
|
@@ -4563,7 +4632,7 @@ var ServiceContext = class {
|
|
|
4563
4632
|
await this.indexer.destroy();
|
|
4564
4633
|
(0, import_log12.log)("closed", void 0, {
|
|
4565
4634
|
F: __dxlog_file15,
|
|
4566
|
-
L:
|
|
4635
|
+
L: 185,
|
|
4567
4636
|
S: this,
|
|
4568
4637
|
C: (f, a) => f(...a)
|
|
4569
4638
|
});
|
|
@@ -4577,7 +4646,7 @@ var ServiceContext = class {
|
|
|
4577
4646
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
4578
4647
|
(0, import_invariant14.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
4579
4648
|
F: __dxlog_file15,
|
|
4580
|
-
L:
|
|
4649
|
+
L: 196,
|
|
4581
4650
|
S: this,
|
|
4582
4651
|
A: [
|
|
4583
4652
|
"factory",
|
|
@@ -4609,7 +4678,7 @@ var ServiceContext = class {
|
|
|
4609
4678
|
async _initialize(ctx) {
|
|
4610
4679
|
(0, import_log12.log)("initializing spaces...", void 0, {
|
|
4611
4680
|
F: __dxlog_file15,
|
|
4612
|
-
L:
|
|
4681
|
+
L: 227,
|
|
4613
4682
|
S: this,
|
|
4614
4683
|
C: (f, a) => f(...a)
|
|
4615
4684
|
});
|
|
@@ -4632,7 +4701,7 @@ var ServiceContext = class {
|
|
|
4632
4701
|
this._handlerFactories.set(import_services12.Invitation.Kind.SPACE, (invitation) => {
|
|
4633
4702
|
(0, import_invariant14.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
4634
4703
|
F: __dxlog_file15,
|
|
4635
|
-
L:
|
|
4704
|
+
L: 251,
|
|
4636
4705
|
S: this,
|
|
4637
4706
|
A: [
|
|
4638
4707
|
"this.dataSpaceManager",
|
|
@@ -4656,7 +4725,7 @@ var ServiceContext = class {
|
|
|
4656
4725
|
details: assertion
|
|
4657
4726
|
}, {
|
|
4658
4727
|
F: __dxlog_file15,
|
|
4659
|
-
L:
|
|
4728
|
+
L: 267,
|
|
4660
4729
|
S: this,
|
|
4661
4730
|
C: (f, a) => f(...a)
|
|
4662
4731
|
});
|
|
@@ -4667,7 +4736,7 @@ var ServiceContext = class {
|
|
|
4667
4736
|
details: assertion
|
|
4668
4737
|
}, {
|
|
4669
4738
|
F: __dxlog_file15,
|
|
4670
|
-
L:
|
|
4739
|
+
L: 271,
|
|
4671
4740
|
S: this,
|
|
4672
4741
|
C: (f, a) => f(...a)
|
|
4673
4742
|
});
|
|
@@ -4678,7 +4747,7 @@ var ServiceContext = class {
|
|
|
4678
4747
|
details: assertion
|
|
4679
4748
|
}, {
|
|
4680
4749
|
F: __dxlog_file15,
|
|
4681
|
-
L:
|
|
4750
|
+
L: 276,
|
|
4682
4751
|
S: this,
|
|
4683
4752
|
C: (f, a) => f(...a)
|
|
4684
4753
|
});
|
|
@@ -4689,7 +4758,7 @@ var ServiceContext = class {
|
|
|
4689
4758
|
} catch (err) {
|
|
4690
4759
|
import_log12.log.catch(err, void 0, {
|
|
4691
4760
|
F: __dxlog_file15,
|
|
4692
|
-
L:
|
|
4761
|
+
L: 282,
|
|
4693
4762
|
S: this,
|
|
4694
4763
|
C: (f, a) => f(...a)
|
|
4695
4764
|
});
|
|
@@ -4701,7 +4770,7 @@ var ServiceContext = class {
|
|
|
4701
4770
|
};
|
|
4702
4771
|
_ts_decorate6([
|
|
4703
4772
|
import_tracing6.trace.span()
|
|
4704
|
-
], ServiceContext.prototype, "
|
|
4773
|
+
], ServiceContext.prototype, "_open", null);
|
|
4705
4774
|
_ts_decorate6([
|
|
4706
4775
|
import_tracing6.trace.span()
|
|
4707
4776
|
], ServiceContext.prototype, "_initialize", null);
|
|
@@ -4785,9 +4854,17 @@ _ts_decorate7([
|
|
|
4785
4854
|
import_log13.logInfo
|
|
4786
4855
|
], Lock.prototype, "lockKey", null);
|
|
4787
4856
|
var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
|
|
4857
|
+
var getRootPath = (config) => {
|
|
4858
|
+
const { dataRoot = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage" } = config ?? {};
|
|
4859
|
+
return `${dataRoot}/`;
|
|
4860
|
+
};
|
|
4861
|
+
var isPersistent = (config) => {
|
|
4862
|
+
const { persistent = false } = config ?? {};
|
|
4863
|
+
return config.dataStore !== void 0 && config.dataStore !== import_config2.Runtime.Client.Storage.StorageDriver.RAM || persistent;
|
|
4864
|
+
};
|
|
4788
4865
|
var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
|
|
4789
4866
|
var createStorageObjects = (config) => {
|
|
4790
|
-
const { persistent = false, keyStore, dataStore
|
|
4867
|
+
const { persistent = false, keyStore, dataStore } = config ?? {};
|
|
4791
4868
|
if (persistent && dataStore === StorageDriver.RAM) {
|
|
4792
4869
|
throw new import_protocols14.InvalidConfigError("RAM storage cannot be used in persistent mode.");
|
|
4793
4870
|
}
|
|
@@ -4803,7 +4880,7 @@ var createStorageObjects = (config) => {
|
|
|
4803
4880
|
return {
|
|
4804
4881
|
storage: (0, import_random_access_storage.createStorage)({
|
|
4805
4882
|
type: persistent ? toStorageType(dataStore) : import_random_access_storage.StorageType.RAM,
|
|
4806
|
-
root:
|
|
4883
|
+
root: getRootPath(config)
|
|
4807
4884
|
})
|
|
4808
4885
|
};
|
|
4809
4886
|
};
|
|
@@ -4827,6 +4904,13 @@ var toStorageType = (type) => {
|
|
|
4827
4904
|
throw new Error(`Invalid storage type: ${StorageDriver[type]}`);
|
|
4828
4905
|
}
|
|
4829
4906
|
};
|
|
4907
|
+
var createLevel = async (config) => {
|
|
4908
|
+
const persistent = isPersistent(config);
|
|
4909
|
+
const storagePath = persistent ? getRootPath(config) : import_node_path.default.join("tmp", "level", import_keys11.PublicKey.random().toHex());
|
|
4910
|
+
const level = new import_level.Level(storagePath);
|
|
4911
|
+
await level.open();
|
|
4912
|
+
return level;
|
|
4913
|
+
};
|
|
4830
4914
|
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
4831
4915
|
var DevicesServiceImpl = class {
|
|
4832
4916
|
constructor(_identityManager) {
|
|
@@ -4907,7 +4991,7 @@ var LoggingServiceImpl = class {
|
|
|
4907
4991
|
constructor() {
|
|
4908
4992
|
this._logs = new import_async18.Event();
|
|
4909
4993
|
this._started = Date.now();
|
|
4910
|
-
this._sessionId =
|
|
4994
|
+
this._sessionId = import_keys13.PublicKey.random().toHex();
|
|
4911
4995
|
this._logProcessor = (_config, entry2) => {
|
|
4912
4996
|
this._logs.emit(entry2);
|
|
4913
4997
|
};
|
|
@@ -5002,12 +5086,12 @@ var LoggingServiceImpl = class {
|
|
|
5002
5086
|
});
|
|
5003
5087
|
}
|
|
5004
5088
|
};
|
|
5005
|
-
var matchFilter = (filter, level,
|
|
5089
|
+
var matchFilter = (filter, level, path2, options) => {
|
|
5006
5090
|
switch (options) {
|
|
5007
5091
|
case import_services15.QueryLogsRequest.MatchingOptions.INCLUSIVE:
|
|
5008
|
-
return level >= filter.level && (!filter.pattern ||
|
|
5092
|
+
return level >= filter.level && (!filter.pattern || path2.includes(filter.pattern));
|
|
5009
5093
|
case import_services15.QueryLogsRequest.MatchingOptions.EXPLICIT:
|
|
5010
|
-
return level === filter.level && (!filter.pattern ||
|
|
5094
|
+
return level === filter.level && (!filter.pattern || path2.includes(filter.pattern));
|
|
5011
5095
|
}
|
|
5012
5096
|
};
|
|
5013
5097
|
var shouldLog = (entry2, request) => {
|
|
@@ -5198,7 +5282,7 @@ var ClientServicesHost = class {
|
|
|
5198
5282
|
initialize({ config, ...options }) {
|
|
5199
5283
|
(0, import_invariant16.invariant)(!this._open, "service host is open", {
|
|
5200
5284
|
F: __dxlog_file18,
|
|
5201
|
-
L:
|
|
5285
|
+
L: 182,
|
|
5202
5286
|
S: this,
|
|
5203
5287
|
A: [
|
|
5204
5288
|
"!this._open",
|
|
@@ -5207,14 +5291,14 @@ var ClientServicesHost = class {
|
|
|
5207
5291
|
});
|
|
5208
5292
|
(0, import_log14.log)("initializing...", void 0, {
|
|
5209
5293
|
F: __dxlog_file18,
|
|
5210
|
-
L:
|
|
5294
|
+
L: 183,
|
|
5211
5295
|
S: this,
|
|
5212
5296
|
C: (f, a) => f(...a)
|
|
5213
5297
|
});
|
|
5214
5298
|
if (config) {
|
|
5215
5299
|
(0, import_invariant16.invariant)(!this._config, "config already set", {
|
|
5216
5300
|
F: __dxlog_file18,
|
|
5217
|
-
L:
|
|
5301
|
+
L: 186,
|
|
5218
5302
|
S: this,
|
|
5219
5303
|
A: [
|
|
5220
5304
|
"!this._config",
|
|
@@ -5226,13 +5310,21 @@ var ClientServicesHost = class {
|
|
|
5226
5310
|
this._storage = createStorageObjects(config.get("runtime.client.storage", {})).storage;
|
|
5227
5311
|
}
|
|
5228
5312
|
}
|
|
5313
|
+
if (!options.signalManager) {
|
|
5314
|
+
import_log14.log.warn("running signaling without telemetry metadata.", void 0, {
|
|
5315
|
+
F: __dxlog_file18,
|
|
5316
|
+
L: 194,
|
|
5317
|
+
S: this,
|
|
5318
|
+
C: (f, a) => f(...a)
|
|
5319
|
+
});
|
|
5320
|
+
}
|
|
5229
5321
|
const { connectionLog = true, transportFactory = (0, import_network_manager2.createSimplePeerTransportFactory)({
|
|
5230
5322
|
iceServers: this._config?.get("runtime.services.ice")
|
|
5231
5323
|
}), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
5232
5324
|
this._signalManager = signalManager;
|
|
5233
5325
|
(0, import_invariant16.invariant)(!this._networkManager, "network manager already set", {
|
|
5234
5326
|
F: __dxlog_file18,
|
|
5235
|
-
L:
|
|
5327
|
+
L: 205,
|
|
5236
5328
|
S: this,
|
|
5237
5329
|
A: [
|
|
5238
5330
|
"!this._networkManager",
|
|
@@ -5246,7 +5338,7 @@ var ClientServicesHost = class {
|
|
|
5246
5338
|
});
|
|
5247
5339
|
(0, import_log14.log)("initialized", void 0, {
|
|
5248
5340
|
F: __dxlog_file18,
|
|
5249
|
-
L:
|
|
5341
|
+
L: 212,
|
|
5250
5342
|
S: this,
|
|
5251
5343
|
C: (f, a) => f(...a)
|
|
5252
5344
|
});
|
|
@@ -5255,18 +5347,18 @@ var ClientServicesHost = class {
|
|
|
5255
5347
|
if (this._open) {
|
|
5256
5348
|
return;
|
|
5257
5349
|
}
|
|
5258
|
-
const traceId =
|
|
5350
|
+
const traceId = import_keys12.PublicKey.random().toHex();
|
|
5259
5351
|
import_log14.log.trace("dxos.client-services.host.open", import_protocols15.trace.begin({
|
|
5260
5352
|
id: traceId
|
|
5261
5353
|
}), {
|
|
5262
5354
|
F: __dxlog_file18,
|
|
5263
|
-
L:
|
|
5355
|
+
L: 223,
|
|
5264
5356
|
S: this,
|
|
5265
5357
|
C: (f, a) => f(...a)
|
|
5266
5358
|
});
|
|
5267
5359
|
(0, import_invariant16.invariant)(this._config, "config not set", {
|
|
5268
5360
|
F: __dxlog_file18,
|
|
5269
|
-
L:
|
|
5361
|
+
L: 225,
|
|
5270
5362
|
S: this,
|
|
5271
5363
|
A: [
|
|
5272
5364
|
"this._config",
|
|
@@ -5275,7 +5367,7 @@ var ClientServicesHost = class {
|
|
|
5275
5367
|
});
|
|
5276
5368
|
(0, import_invariant16.invariant)(this._storage, "storage not set", {
|
|
5277
5369
|
F: __dxlog_file18,
|
|
5278
|
-
L:
|
|
5370
|
+
L: 226,
|
|
5279
5371
|
S: this,
|
|
5280
5372
|
A: [
|
|
5281
5373
|
"this._storage",
|
|
@@ -5284,7 +5376,7 @@ var ClientServicesHost = class {
|
|
|
5284
5376
|
});
|
|
5285
5377
|
(0, import_invariant16.invariant)(this._signalManager, "signal manager not set", {
|
|
5286
5378
|
F: __dxlog_file18,
|
|
5287
|
-
L:
|
|
5379
|
+
L: 227,
|
|
5288
5380
|
S: this,
|
|
5289
5381
|
A: [
|
|
5290
5382
|
"this._signalManager",
|
|
@@ -5293,7 +5385,7 @@ var ClientServicesHost = class {
|
|
|
5293
5385
|
});
|
|
5294
5386
|
(0, import_invariant16.invariant)(this._networkManager, "network manager not set", {
|
|
5295
5387
|
F: __dxlog_file18,
|
|
5296
|
-
L:
|
|
5388
|
+
L: 228,
|
|
5297
5389
|
S: this,
|
|
5298
5390
|
A: [
|
|
5299
5391
|
"this._networkManager",
|
|
@@ -5305,13 +5397,16 @@ var ClientServicesHost = class {
|
|
|
5305
5397
|
lockKey: this._resourceLock?.lockKey
|
|
5306
5398
|
}, {
|
|
5307
5399
|
F: __dxlog_file18,
|
|
5308
|
-
L:
|
|
5400
|
+
L: 231,
|
|
5309
5401
|
S: this,
|
|
5310
5402
|
C: (f, a) => f(...a)
|
|
5311
5403
|
});
|
|
5404
|
+
if (!this._level) {
|
|
5405
|
+
this._level = await createLevel(this._config.get("runtime.client.storage", {}));
|
|
5406
|
+
}
|
|
5312
5407
|
await this._resourceLock?.acquire();
|
|
5313
5408
|
await this._loggingService.open();
|
|
5314
|
-
this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._runtimeParams);
|
|
5409
|
+
this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._runtimeParams);
|
|
5315
5410
|
this._serviceRegistry.setServices({
|
|
5316
5411
|
SystemService: this._systemService,
|
|
5317
5412
|
IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
|
|
@@ -5321,7 +5416,7 @@ var ClientServicesHost = class {
|
|
|
5321
5416
|
await this._serviceContext.initialized.wait();
|
|
5322
5417
|
return this._serviceContext.dataSpaceManager;
|
|
5323
5418
|
}),
|
|
5324
|
-
DataService: new
|
|
5419
|
+
DataService: new import_echo_pipeline4.DataServiceImpl(this._serviceContext.automergeHost),
|
|
5325
5420
|
IndexService: new import_indexing2.IndexServiceImpl({
|
|
5326
5421
|
indexer: this._serviceContext.indexer,
|
|
5327
5422
|
automergeHost: this._serviceContext.automergeHost
|
|
@@ -5339,7 +5434,7 @@ var ClientServicesHost = class {
|
|
|
5339
5434
|
await this._serviceContext.open(ctx);
|
|
5340
5435
|
(0, import_invariant16.invariant)(this.serviceRegistry.services.InvitationsService, void 0, {
|
|
5341
5436
|
F: __dxlog_file18,
|
|
5342
|
-
L:
|
|
5437
|
+
L: 297,
|
|
5343
5438
|
S: this,
|
|
5344
5439
|
A: [
|
|
5345
5440
|
"this.serviceRegistry.services.InvitationsService",
|
|
@@ -5351,7 +5446,7 @@ var ClientServicesHost = class {
|
|
|
5351
5446
|
count: loadedInvitations.invitations?.length
|
|
5352
5447
|
}, {
|
|
5353
5448
|
F: __dxlog_file18,
|
|
5354
|
-
L:
|
|
5449
|
+
L: 300,
|
|
5355
5450
|
S: this,
|
|
5356
5451
|
C: (f, a) => f(...a)
|
|
5357
5452
|
});
|
|
@@ -5373,7 +5468,7 @@ var ClientServicesHost = class {
|
|
|
5373
5468
|
deviceKey
|
|
5374
5469
|
}, {
|
|
5375
5470
|
F: __dxlog_file18,
|
|
5376
|
-
L:
|
|
5471
|
+
L: 317,
|
|
5377
5472
|
S: this,
|
|
5378
5473
|
C: (f, a) => f(...a)
|
|
5379
5474
|
});
|
|
@@ -5381,7 +5476,7 @@ var ClientServicesHost = class {
|
|
|
5381
5476
|
id: traceId
|
|
5382
5477
|
}), {
|
|
5383
5478
|
F: __dxlog_file18,
|
|
5384
|
-
L:
|
|
5479
|
+
L: 318,
|
|
5385
5480
|
S: this,
|
|
5386
5481
|
C: (f, a) => f(...a)
|
|
5387
5482
|
});
|
|
@@ -5395,7 +5490,7 @@ var ClientServicesHost = class {
|
|
|
5395
5490
|
deviceKey
|
|
5396
5491
|
}, {
|
|
5397
5492
|
F: __dxlog_file18,
|
|
5398
|
-
L:
|
|
5493
|
+
L: 329,
|
|
5399
5494
|
S: this,
|
|
5400
5495
|
C: (f, a) => f(...a)
|
|
5401
5496
|
});
|
|
@@ -5405,30 +5500,31 @@ var ClientServicesHost = class {
|
|
|
5405
5500
|
});
|
|
5406
5501
|
await this._loggingService.close();
|
|
5407
5502
|
await this._serviceContext.close();
|
|
5503
|
+
await this._level?.close();
|
|
5408
5504
|
this._open = false;
|
|
5409
5505
|
this._statusUpdate.emit();
|
|
5410
5506
|
(0, import_log14.log)("closed", {
|
|
5411
5507
|
deviceKey
|
|
5412
5508
|
}, {
|
|
5413
5509
|
F: __dxlog_file18,
|
|
5414
|
-
L:
|
|
5510
|
+
L: 337,
|
|
5415
5511
|
S: this,
|
|
5416
5512
|
C: (f, a) => f(...a)
|
|
5417
5513
|
});
|
|
5418
5514
|
}
|
|
5419
5515
|
async reset() {
|
|
5420
|
-
const traceId =
|
|
5516
|
+
const traceId = import_keys12.PublicKey.random().toHex();
|
|
5421
5517
|
import_log14.log.trace("dxos.sdk.client-services-host.reset", import_protocols15.trace.begin({
|
|
5422
5518
|
id: traceId
|
|
5423
5519
|
}), {
|
|
5424
5520
|
F: __dxlog_file18,
|
|
5425
|
-
L:
|
|
5521
|
+
L: 342,
|
|
5426
5522
|
S: this,
|
|
5427
5523
|
C: (f, a) => f(...a)
|
|
5428
5524
|
});
|
|
5429
5525
|
(0, import_log14.log)("resetting...", void 0, {
|
|
5430
5526
|
F: __dxlog_file18,
|
|
5431
|
-
L:
|
|
5527
|
+
L: 344,
|
|
5432
5528
|
S: this,
|
|
5433
5529
|
C: (f, a) => f(...a)
|
|
5434
5530
|
});
|
|
@@ -5436,7 +5532,7 @@ var ClientServicesHost = class {
|
|
|
5436
5532
|
await this._storage.reset();
|
|
5437
5533
|
(0, import_log14.log)("reset", void 0, {
|
|
5438
5534
|
F: __dxlog_file18,
|
|
5439
|
-
L:
|
|
5535
|
+
L: 347,
|
|
5440
5536
|
S: this,
|
|
5441
5537
|
C: (f, a) => f(...a)
|
|
5442
5538
|
});
|
|
@@ -5444,7 +5540,7 @@ var ClientServicesHost = class {
|
|
|
5444
5540
|
id: traceId
|
|
5445
5541
|
}), {
|
|
5446
5542
|
F: __dxlog_file18,
|
|
5447
|
-
L:
|
|
5543
|
+
L: 348,
|
|
5448
5544
|
S: this,
|
|
5449
5545
|
C: (f, a) => f(...a)
|
|
5450
5546
|
});
|
|
@@ -5454,12 +5550,10 @@ var ClientServicesHost = class {
|
|
|
5454
5550
|
const identity = await this._serviceContext.createIdentity(params);
|
|
5455
5551
|
await this._serviceContext.initialized.wait();
|
|
5456
5552
|
const space = await this._serviceContext.dataSpaceManager.createSpace();
|
|
5457
|
-
const obj = new import_client_protocol5.Properties(void 0);
|
|
5458
|
-
obj[import_client_protocol5.defaultKey] = identity.identityKey.toHex();
|
|
5459
5553
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5460
5554
|
(0, import_invariant16.invariant)(automergeIndex, void 0, {
|
|
5461
5555
|
F: __dxlog_file18,
|
|
5462
|
-
L:
|
|
5556
|
+
L: 360,
|
|
5463
5557
|
S: this,
|
|
5464
5558
|
A: [
|
|
5465
5559
|
"automergeIndex",
|
|
@@ -5468,12 +5562,25 @@ var ClientServicesHost = class {
|
|
|
5468
5562
|
});
|
|
5469
5563
|
const document = await this._serviceContext.automergeHost.repo.find(automergeIndex);
|
|
5470
5564
|
await document.whenReady();
|
|
5565
|
+
const properties = {
|
|
5566
|
+
system: {
|
|
5567
|
+
type: (0, import_echo_pipeline4.encodeReference)(E.getTypeReference(import_client_protocol5.Properties))
|
|
5568
|
+
},
|
|
5569
|
+
data: {
|
|
5570
|
+
[import_client_protocol5.defaultKey]: identity.identityKey.toHex()
|
|
5571
|
+
},
|
|
5572
|
+
meta: {
|
|
5573
|
+
keys: []
|
|
5574
|
+
}
|
|
5575
|
+
};
|
|
5576
|
+
const propertiesId = import_keys12.PublicKey.random().toHex();
|
|
5471
5577
|
document.change((doc) => {
|
|
5472
5578
|
(0, import_util9.assignDeep)(doc, [
|
|
5473
5579
|
"objects",
|
|
5474
|
-
|
|
5475
|
-
],
|
|
5580
|
+
propertiesId
|
|
5581
|
+
], properties);
|
|
5476
5582
|
});
|
|
5583
|
+
await this._serviceContext.automergeHost.repo.flush();
|
|
5477
5584
|
return identity;
|
|
5478
5585
|
}
|
|
5479
5586
|
};
|
|
@@ -5516,6 +5623,7 @@ ClientServicesHost = _ts_decorate8([
|
|
|
5516
5623
|
TrustedKeySetAuthVerifier,
|
|
5517
5624
|
createAuthProvider,
|
|
5518
5625
|
createDiagnostics,
|
|
5626
|
+
createLevel,
|
|
5519
5627
|
createStorageObjects,
|
|
5520
5628
|
getNetworkPeers,
|
|
5521
5629
|
invitationExpired,
|
|
@@ -5528,4 +5636,4 @@ ClientServicesHost = _ts_decorate8([
|
|
|
5528
5636
|
subscribeToSpaces,
|
|
5529
5637
|
subscribeToSwarmInfo
|
|
5530
5638
|
});
|
|
5531
|
-
//# sourceMappingURL=chunk-
|
|
5639
|
+
//# sourceMappingURL=chunk-Y7UTCQRW.cjs.map
|