@dxos/client-services 0.5.9-main.1cc8373 → 0.5.9-main.1f2bcac
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-W55ZOE2M.mjs → chunk-LAXUVAKD.mjs} +130 -75
- package/dist/lib/browser/chunk-LAXUVAKD.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-Y4ZFTXGB.cjs → chunk-3Z5PAMUS.cjs} +213 -158
- package/dist/lib/node/chunk-3Z5PAMUS.cjs.map +7 -0
- package/dist/lib/node/index.cjs +45 -45
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +8 -8
- package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/epoch-migrations.d.ts +2 -2
- package/dist/types/src/packlets/spaces/epoch-migrations.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/profile-archive.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +36 -36
- package/src/packlets/identity/identity-service.ts +28 -22
- package/src/packlets/spaces/data-space.ts +1 -1
- package/src/packlets/spaces/epoch-migrations.ts +57 -38
- package/src/packlets/storage/profile-archive.ts +15 -1
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-W55ZOE2M.mjs.map +0 -7
- package/dist/lib/node/chunk-Y4ZFTXGB.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_3Z5PAMUS_exports = {};
|
|
30
|
+
__export(chunk_3Z5PAMUS_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
ClientServicesProviderResource: () => ClientServicesProviderResource,
|
|
@@ -70,7 +70,7 @@ __export(chunk_Y4ZFTXGB_exports, {
|
|
|
70
70
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
71
71
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
72
72
|
});
|
|
73
|
-
module.exports = __toCommonJS(
|
|
73
|
+
module.exports = __toCommonJS(chunk_3Z5PAMUS_exports);
|
|
74
74
|
var import_async = require("@dxos/async");
|
|
75
75
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
76
76
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -216,32 +216,28 @@ var import_util7 = require("@dxos/util");
|
|
|
216
216
|
var import_async14 = require("@dxos/async");
|
|
217
217
|
var import_context11 = require("@dxos/context");
|
|
218
218
|
var import_credentials14 = require("@dxos/credentials");
|
|
219
|
-
var import_async15 = require("@dxos/async");
|
|
220
|
-
var import_automerge = require("@dxos/automerge/automerge");
|
|
221
|
-
var import_context12 = require("@dxos/context");
|
|
222
219
|
var import_echo_db = require("@dxos/echo-db");
|
|
223
|
-
var
|
|
220
|
+
var import_echo_protocol2 = require("@dxos/echo-protocol");
|
|
224
221
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
225
222
|
var import_invariant13 = require("@dxos/invariant");
|
|
226
223
|
var import_log13 = require("@dxos/log");
|
|
227
224
|
var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
|
|
228
|
-
var
|
|
229
|
-
var
|
|
230
|
-
var import_context13 = require("@dxos/context");
|
|
225
|
+
var import_async15 = require("@dxos/async");
|
|
226
|
+
var import_context12 = require("@dxos/context");
|
|
231
227
|
var import_invariant14 = require("@dxos/invariant");
|
|
232
228
|
var import_keys11 = require("@dxos/keys");
|
|
233
229
|
var import_log14 = require("@dxos/log");
|
|
234
230
|
var import_protocols10 = require("@dxos/protocols");
|
|
235
231
|
var import_teleport3 = require("@dxos/teleport");
|
|
236
|
-
var
|
|
237
|
-
var
|
|
232
|
+
var import_util8 = require("@dxos/util");
|
|
233
|
+
var import_async16 = require("@dxos/async");
|
|
238
234
|
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
239
|
-
var
|
|
235
|
+
var import_context13 = require("@dxos/context");
|
|
240
236
|
var import_credentials15 = require("@dxos/credentials");
|
|
241
237
|
var import_echo_db2 = require("@dxos/echo-db");
|
|
238
|
+
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
242
239
|
var import_echo_pipeline4 = require("@dxos/echo-pipeline");
|
|
243
|
-
var
|
|
244
|
-
var import_echo_protocol2 = require("@dxos/echo-protocol");
|
|
240
|
+
var import_echo_protocol3 = require("@dxos/echo-protocol");
|
|
245
241
|
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
246
242
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
247
243
|
var import_invariant15 = require("@dxos/invariant");
|
|
@@ -252,12 +248,12 @@ var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
|
|
|
252
248
|
var import_credentials16 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
253
249
|
var import_teleport_extension_gossip2 = require("@dxos/teleport-extension-gossip");
|
|
254
250
|
var import_tracing6 = require("@dxos/tracing");
|
|
255
|
-
var
|
|
251
|
+
var import_util9 = require("@dxos/util");
|
|
256
252
|
var import_credentials17 = require("@dxos/credentials");
|
|
257
253
|
var import_debug4 = require("@dxos/debug");
|
|
258
254
|
var import_credentials18 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
259
255
|
var import_timeframe4 = require("@dxos/timeframe");
|
|
260
|
-
var
|
|
256
|
+
var import_async17 = require("@dxos/async");
|
|
261
257
|
var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
262
258
|
var import_credentials19 = require("@dxos/credentials");
|
|
263
259
|
var import_debug5 = require("@dxos/debug");
|
|
@@ -267,12 +263,12 @@ var import_log16 = require("@dxos/log");
|
|
|
267
263
|
var import_protocols12 = require("@dxos/protocols");
|
|
268
264
|
var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
|
|
269
265
|
var import_tracing7 = require("@dxos/tracing");
|
|
270
|
-
var
|
|
271
|
-
var
|
|
266
|
+
var import_async18 = require("@dxos/async");
|
|
267
|
+
var import_context14 = require("@dxos/context");
|
|
272
268
|
var import_credentials20 = require("@dxos/credentials");
|
|
273
269
|
var import_debug6 = require("@dxos/debug");
|
|
274
270
|
var import_echo_db3 = require("@dxos/echo-db");
|
|
275
|
-
var
|
|
271
|
+
var import_echo_pipeline5 = require("@dxos/echo-pipeline");
|
|
276
272
|
var import_feed_store6 = require("@dxos/feed-store");
|
|
277
273
|
var import_invariant17 = require("@dxos/invariant");
|
|
278
274
|
var import_keyring = require("@dxos/keyring");
|
|
@@ -282,7 +278,7 @@ var import_protocols13 = require("@dxos/protocols");
|
|
|
282
278
|
var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
|
|
283
279
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
284
280
|
var import_tracing8 = require("@dxos/tracing");
|
|
285
|
-
var
|
|
281
|
+
var import_util10 = require("@dxos/util");
|
|
286
282
|
var import_invariant18 = require("@dxos/invariant");
|
|
287
283
|
var import_lock_file = require("@dxos/lock-file");
|
|
288
284
|
var import_log18 = require("@dxos/log");
|
|
@@ -291,7 +287,7 @@ var import_config = require("@dxos/protocols/proto/dxos/config");
|
|
|
291
287
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
292
288
|
var import_client_protocol6 = require("@dxos/client-protocol");
|
|
293
289
|
var import_config2 = require("@dxos/protocols/proto/dxos/config");
|
|
294
|
-
var
|
|
290
|
+
var import_util11 = require("@dxos/util");
|
|
295
291
|
var import_node_path = __toESM(require("node:path"));
|
|
296
292
|
var import_keys14 = require("@dxos/keys");
|
|
297
293
|
var import_kv_store = require("@dxos/kv-store");
|
|
@@ -299,10 +295,10 @@ var import_automerge_repo = require("@dxos/automerge/automerge-repo");
|
|
|
299
295
|
var import_invariant19 = require("@dxos/invariant");
|
|
300
296
|
var import_log19 = require("@dxos/log");
|
|
301
297
|
var import_protocols15 = require("@dxos/protocols");
|
|
302
|
-
var
|
|
303
|
-
var
|
|
298
|
+
var import_util12 = require("@dxos/util");
|
|
299
|
+
var import_async19 = require("@dxos/async");
|
|
304
300
|
var import_client_protocol7 = require("@dxos/client-protocol");
|
|
305
|
-
var
|
|
301
|
+
var import_context15 = require("@dxos/context");
|
|
306
302
|
var import_invariant20 = require("@dxos/invariant");
|
|
307
303
|
var import_keys15 = require("@dxos/keys");
|
|
308
304
|
var import_log20 = require("@dxos/log");
|
|
@@ -312,30 +308,30 @@ var import_protocols16 = require("@dxos/protocols");
|
|
|
312
308
|
var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
|
|
313
309
|
var import_tracing9 = require("@dxos/tracing");
|
|
314
310
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
315
|
-
var
|
|
311
|
+
var import_async20 = require("@dxos/async");
|
|
316
312
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
317
313
|
var import_invariant21 = require("@dxos/invariant");
|
|
318
314
|
var import_services18 = require("@dxos/protocols/proto/dxos/client/services");
|
|
319
315
|
var import_config3 = require("@dxos/config");
|
|
320
316
|
var import_services19 = require("@dxos/protocols/proto/dxos/client/services");
|
|
321
317
|
var import_tracing10 = require("@dxos/tracing");
|
|
322
|
-
var
|
|
318
|
+
var import_util13 = require("@dxos/util");
|
|
323
319
|
var import_keys16 = require("@dxos/keys");
|
|
324
|
-
var
|
|
325
|
-
var
|
|
320
|
+
var import_util14 = require("@dxos/util");
|
|
321
|
+
var import_async21 = require("@dxos/async");
|
|
326
322
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
327
323
|
var import_keys17 = require("@dxos/keys");
|
|
328
|
-
var
|
|
329
|
-
var
|
|
324
|
+
var import_util15 = require("@dxos/util");
|
|
325
|
+
var import_async22 = require("@dxos/async");
|
|
330
326
|
var import_codec_protobuf14 = require("@dxos/codec-protobuf");
|
|
331
327
|
var import_keys18 = require("@dxos/keys");
|
|
332
328
|
var import_log21 = require("@dxos/log");
|
|
333
329
|
var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
|
|
334
|
-
var
|
|
330
|
+
var import_util16 = require("@dxos/util");
|
|
335
331
|
var import_codec_protobuf15 = require("@dxos/codec-protobuf");
|
|
336
332
|
var import_codec_protobuf16 = require("@dxos/codec-protobuf");
|
|
337
333
|
var import_services21 = require("@dxos/protocols/proto/dxos/client/services");
|
|
338
|
-
var
|
|
334
|
+
var import_util17 = require("@dxos/util");
|
|
339
335
|
var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
340
336
|
return new import_codec_protobuf.Stream(({ next }) => {
|
|
341
337
|
const subscriptions = new import_async.EventSubscriptions();
|
|
@@ -650,7 +646,7 @@ var DevtoolsServiceImpl = class {
|
|
|
650
646
|
});
|
|
651
647
|
}
|
|
652
648
|
};
|
|
653
|
-
var DXOS_VERSION = "0.5.9-main.
|
|
649
|
+
var DXOS_VERSION = "0.5.9-main.1f2bcac";
|
|
654
650
|
var getPlatform = () => {
|
|
655
651
|
if (process.browser) {
|
|
656
652
|
if (typeof window !== "undefined") {
|
|
@@ -1804,7 +1800,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1804
1800
|
duplicate: space.id
|
|
1805
1801
|
}, {
|
|
1806
1802
|
F: __dxlog_file7,
|
|
1807
|
-
L:
|
|
1803
|
+
L: 129,
|
|
1808
1804
|
S: this,
|
|
1809
1805
|
C: (f, a) => f(...a)
|
|
1810
1806
|
});
|
|
@@ -1815,6 +1811,13 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1815
1811
|
recodedDefaultSpace = true;
|
|
1816
1812
|
recordedDefaultSpaceTrigger.wake();
|
|
1817
1813
|
}
|
|
1814
|
+
}, (err) => {
|
|
1815
|
+
import_log5.log.catch(err, void 0, {
|
|
1816
|
+
F: __dxlog_file7,
|
|
1817
|
+
L: 140,
|
|
1818
|
+
S: this,
|
|
1819
|
+
C: (f, a) => f(...a)
|
|
1820
|
+
});
|
|
1818
1821
|
});
|
|
1819
1822
|
await Promise.race([
|
|
1820
1823
|
allProcessed,
|
|
@@ -3819,11 +3822,12 @@ var AutomergeSpaceState = class extends import_context11.Resource {
|
|
|
3819
3822
|
}
|
|
3820
3823
|
};
|
|
3821
3824
|
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/epoch-migrations.ts";
|
|
3825
|
+
var LOAD_DOC_TIMEOUT = 1e4;
|
|
3822
3826
|
var runEpochMigration = async (ctx, context) => {
|
|
3823
3827
|
switch (context.migration) {
|
|
3824
3828
|
case import_services13.CreateEpochRequest.Migration.INIT_AUTOMERGE: {
|
|
3825
|
-
const document = context.
|
|
3826
|
-
await context.
|
|
3829
|
+
const document = context.echoHost.createDoc();
|
|
3830
|
+
await context.echoHost.flush();
|
|
3827
3831
|
return {
|
|
3828
3832
|
newRoot: document.url
|
|
3829
3833
|
};
|
|
@@ -3832,10 +3836,11 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3832
3836
|
if (!context.currentRoot) {
|
|
3833
3837
|
throw new Error("Space does not have an automerge root");
|
|
3834
3838
|
}
|
|
3835
|
-
const rootHandle = context.
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
+
const rootHandle = await context.echoHost.loadDoc(ctx, context.currentRoot, {
|
|
3840
|
+
timeout: LOAD_DOC_TIMEOUT
|
|
3841
|
+
});
|
|
3842
|
+
const newRoot = context.echoHost.createDoc(rootHandle.docSync());
|
|
3843
|
+
await context.echoHost.flush();
|
|
3839
3844
|
return {
|
|
3840
3845
|
newRoot: newRoot.url
|
|
3841
3846
|
};
|
|
@@ -3843,66 +3848,76 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3843
3848
|
case import_services13.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT: {
|
|
3844
3849
|
import_log13.log.info("Fragmenting", void 0, {
|
|
3845
3850
|
F: __dxlog_file15,
|
|
3846
|
-
L:
|
|
3851
|
+
L: 64,
|
|
3847
3852
|
S: void 0,
|
|
3848
3853
|
C: (f, a) => f(...a)
|
|
3849
3854
|
});
|
|
3850
3855
|
const currentRootUrl = context.currentRoot;
|
|
3851
|
-
const rootHandle = context.
|
|
3852
|
-
|
|
3856
|
+
const rootHandle = await context.echoHost.loadDoc(ctx, currentRootUrl, {
|
|
3857
|
+
timeout: LOAD_DOC_TIMEOUT
|
|
3858
|
+
});
|
|
3853
3859
|
const objects = Object.entries(rootHandle.docSync().objects);
|
|
3854
3860
|
const properties = (0, import_echo_db.findInlineObjectOfType)(rootHandle.docSync(), import_echo_schema.TYPE_PROPERTIES);
|
|
3855
3861
|
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
3856
3862
|
(0, import_invariant13.invariant)(properties, "Properties not found", {
|
|
3857
3863
|
F: __dxlog_file15,
|
|
3858
|
-
L:
|
|
3864
|
+
L: 75,
|
|
3859
3865
|
S: void 0,
|
|
3860
3866
|
A: [
|
|
3861
3867
|
"properties",
|
|
3862
3868
|
"'Properties not found'"
|
|
3863
3869
|
]
|
|
3864
3870
|
});
|
|
3865
|
-
const
|
|
3871
|
+
const newRoot = context.echoHost.createDoc({
|
|
3866
3872
|
...rootHandle.docSync(),
|
|
3867
3873
|
objects: Object.fromEntries([
|
|
3868
3874
|
properties
|
|
3869
3875
|
])
|
|
3870
|
-
};
|
|
3871
|
-
const newRoot = context.repo.create(newSpaceDoc);
|
|
3876
|
+
});
|
|
3872
3877
|
(0, import_invariant13.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
3873
3878
|
F: __dxlog_file15,
|
|
3874
|
-
L:
|
|
3879
|
+
L: 82,
|
|
3875
3880
|
S: void 0,
|
|
3876
3881
|
A: [
|
|
3877
3882
|
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
3878
3883
|
""
|
|
3879
3884
|
]
|
|
3880
3885
|
});
|
|
3881
|
-
const
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
], value);
|
|
3886
|
+
const newLinks = [];
|
|
3887
|
+
for (const [id, objData] of otherObjects) {
|
|
3888
|
+
const handle = context.echoHost.createDoc({
|
|
3889
|
+
version: import_echo_protocol2.SpaceDocVersion.CURRENT,
|
|
3890
|
+
access: {
|
|
3891
|
+
spaceKey: context.spaceKey.toHex()
|
|
3892
|
+
},
|
|
3893
|
+
objects: {
|
|
3894
|
+
[id]: objData
|
|
3895
|
+
}
|
|
3892
3896
|
});
|
|
3897
|
+
newLinks.push([
|
|
3898
|
+
id,
|
|
3899
|
+
handle.url
|
|
3900
|
+
]);
|
|
3901
|
+
}
|
|
3902
|
+
newRoot.change((doc) => {
|
|
3903
|
+
doc.links ??= {};
|
|
3904
|
+
for (const [id, url] of newLinks) {
|
|
3905
|
+
doc.links[id] = url;
|
|
3906
|
+
}
|
|
3893
3907
|
});
|
|
3894
|
-
await context.
|
|
3908
|
+
await context.echoHost.flush();
|
|
3895
3909
|
return {
|
|
3896
3910
|
newRoot: newRoot.url
|
|
3897
3911
|
};
|
|
3898
3912
|
}
|
|
3899
3913
|
case import_services13.CreateEpochRequest.Migration.MIGRATE_REFERENCES_TO_DXN: {
|
|
3900
3914
|
const currentRootUrl = context.currentRoot;
|
|
3901
|
-
const rootHandle = context.
|
|
3902
|
-
|
|
3915
|
+
const rootHandle = await context.echoHost.loadDoc(ctx, currentRootUrl, {
|
|
3916
|
+
timeout: LOAD_DOC_TIMEOUT
|
|
3917
|
+
});
|
|
3903
3918
|
(0, import_invariant13.invariant)(rootHandle.docSync(), "Root doc not found", {
|
|
3904
3919
|
F: __dxlog_file15,
|
|
3905
|
-
L:
|
|
3920
|
+
L: 115,
|
|
3906
3921
|
S: void 0,
|
|
3907
3922
|
A: [
|
|
3908
3923
|
"rootHandle.docSync()",
|
|
@@ -3911,25 +3926,44 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3911
3926
|
});
|
|
3912
3927
|
const newRootContent = await (0, import_echo_db.convertLegacySpaceRootDoc)(structuredClone(rootHandle.docSync()));
|
|
3913
3928
|
for (const [id, url] of Object.entries(newRootContent.links ?? {})) {
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
+
try {
|
|
3930
|
+
const handle = await context.echoHost.loadDoc(ctx, url, {
|
|
3931
|
+
timeout: LOAD_DOC_TIMEOUT
|
|
3932
|
+
});
|
|
3933
|
+
(0, import_invariant13.invariant)(handle.docSync(), void 0, {
|
|
3934
|
+
F: __dxlog_file15,
|
|
3935
|
+
L: 122,
|
|
3936
|
+
S: void 0,
|
|
3937
|
+
A: [
|
|
3938
|
+
"handle.docSync()",
|
|
3939
|
+
""
|
|
3940
|
+
]
|
|
3941
|
+
});
|
|
3942
|
+
const newDoc = await (0, import_echo_db.convertLegacyReferences)(structuredClone(handle.docSync()));
|
|
3943
|
+
const migratedDoc = (0, import_echo_db.migrateDocument)(handle.docSync(), newDoc);
|
|
3944
|
+
const newHandle = context.echoHost.createDoc(migratedDoc, {
|
|
3945
|
+
preserveHistory: true
|
|
3946
|
+
});
|
|
3947
|
+
newRootContent.links[id] = newHandle.url;
|
|
3948
|
+
} catch (err) {
|
|
3949
|
+
import_log13.log.warn("Failed to migrate reference", {
|
|
3950
|
+
id,
|
|
3951
|
+
url,
|
|
3952
|
+
error: err
|
|
3953
|
+
}, {
|
|
3954
|
+
F: __dxlog_file15,
|
|
3955
|
+
L: 128,
|
|
3956
|
+
S: void 0,
|
|
3957
|
+
C: (f, a) => f(...a)
|
|
3958
|
+
});
|
|
3959
|
+
delete newRootContent.links[id];
|
|
3960
|
+
}
|
|
3929
3961
|
}
|
|
3930
3962
|
const migratedRoot = (0, import_echo_db.migrateDocument)(rootHandle.docSync(), newRootContent);
|
|
3931
|
-
const newRoot = context.
|
|
3932
|
-
|
|
3963
|
+
const newRoot = context.echoHost.createDoc(migratedRoot, {
|
|
3964
|
+
preserveHistory: true
|
|
3965
|
+
});
|
|
3966
|
+
await context.echoHost.flush();
|
|
3933
3967
|
return {
|
|
3934
3968
|
newRoot: newRoot.url
|
|
3935
3969
|
};
|
|
@@ -3937,14 +3971,14 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3937
3971
|
case import_services13.CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT: {
|
|
3938
3972
|
(0, import_invariant13.invariant)(context.newAutomergeRoot, void 0, {
|
|
3939
3973
|
F: __dxlog_file15,
|
|
3940
|
-
L:
|
|
3974
|
+
L: 143,
|
|
3941
3975
|
S: void 0,
|
|
3942
3976
|
A: [
|
|
3943
3977
|
"context.newAutomergeRoot",
|
|
3944
3978
|
""
|
|
3945
3979
|
]
|
|
3946
3980
|
});
|
|
3947
|
-
await context.
|
|
3981
|
+
await context.echoHost.flush();
|
|
3948
3982
|
return {
|
|
3949
3983
|
newRoot: context.newAutomergeRoot
|
|
3950
3984
|
};
|
|
@@ -3959,14 +3993,14 @@ var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
|
|
|
3959
3993
|
var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
|
|
3960
3994
|
var NotarizationPlugin = class {
|
|
3961
3995
|
constructor() {
|
|
3962
|
-
this._ctx = new
|
|
3996
|
+
this._ctx = new import_context12.Context(void 0, {
|
|
3963
3997
|
F: __dxlog_file16,
|
|
3964
3998
|
L: 62
|
|
3965
3999
|
});
|
|
3966
|
-
this._extensionOpened = new
|
|
4000
|
+
this._extensionOpened = new import_async15.Event();
|
|
3967
4001
|
this._extensions = /* @__PURE__ */ new Set();
|
|
3968
|
-
this._processedCredentials = new
|
|
3969
|
-
this._processCredentialsTriggers = new
|
|
4002
|
+
this._processedCredentials = new import_util8.ComplexSet(import_keys11.PublicKey.hash);
|
|
4003
|
+
this._processCredentialsTriggers = new import_util8.ComplexMap(import_keys11.PublicKey.hash);
|
|
3970
4004
|
}
|
|
3971
4005
|
get hasWriter() {
|
|
3972
4006
|
return !!this._writer;
|
|
@@ -3997,7 +4031,7 @@ var NotarizationPlugin = class {
|
|
|
3997
4031
|
"'Credentials must have an id'"
|
|
3998
4032
|
]
|
|
3999
4033
|
});
|
|
4000
|
-
const errors = new
|
|
4034
|
+
const errors = new import_async15.Trigger();
|
|
4001
4035
|
const ctx = this._ctx.derive({
|
|
4002
4036
|
onError: (err) => {
|
|
4003
4037
|
import_log14.log.warn("Notarization error", {
|
|
@@ -4014,7 +4048,7 @@ var NotarizationPlugin = class {
|
|
|
4014
4048
|
});
|
|
4015
4049
|
opCtx?.onDispose(() => ctx.dispose());
|
|
4016
4050
|
if (timeout !== 0) {
|
|
4017
|
-
(0,
|
|
4051
|
+
(0, import_async15.scheduleTask)(ctx, () => {
|
|
4018
4052
|
import_log14.log.warn("Notarization timeout", {
|
|
4019
4053
|
timeout,
|
|
4020
4054
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
@@ -4025,12 +4059,12 @@ var NotarizationPlugin = class {
|
|
|
4025
4059
|
C: (f, a) => f(...a)
|
|
4026
4060
|
});
|
|
4027
4061
|
void ctx.dispose();
|
|
4028
|
-
errors.throw(new
|
|
4062
|
+
errors.throw(new import_async15.TimeoutError(timeout, "Notarization timed out"));
|
|
4029
4063
|
}, timeout);
|
|
4030
4064
|
}
|
|
4031
4065
|
const allNotarized = Promise.all(credentials.map((credential) => this._waitUntilProcessed(credential.id)));
|
|
4032
4066
|
const peersTried = /* @__PURE__ */ new Set();
|
|
4033
|
-
const notarizeTask = new
|
|
4067
|
+
const notarizeTask = new import_async15.DeferredTask(ctx, async () => {
|
|
4034
4068
|
try {
|
|
4035
4069
|
if (this._extensions.size === 0) {
|
|
4036
4070
|
return;
|
|
@@ -4048,7 +4082,7 @@ var NotarizationPlugin = class {
|
|
|
4048
4082
|
C: (f, a) => f(...a)
|
|
4049
4083
|
});
|
|
4050
4084
|
peersTried.clear();
|
|
4051
|
-
(0,
|
|
4085
|
+
(0, import_async15.scheduleTask)(ctx, () => notarizeTask.schedule(), retryTimeout);
|
|
4052
4086
|
return;
|
|
4053
4087
|
}
|
|
4054
4088
|
peersTried.add(peer);
|
|
@@ -4070,7 +4104,7 @@ var NotarizationPlugin = class {
|
|
|
4070
4104
|
S: this,
|
|
4071
4105
|
C: (f, a) => f(...a)
|
|
4072
4106
|
});
|
|
4073
|
-
await (0,
|
|
4107
|
+
await (0, import_async15.sleep)(successDelay);
|
|
4074
4108
|
} catch (err) {
|
|
4075
4109
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
4076
4110
|
import_log14.log.info("error notarizing (recoverable)", err, {
|
|
@@ -4087,7 +4121,7 @@ var NotarizationPlugin = class {
|
|
|
4087
4121
|
this._extensionOpened.on(ctx, () => notarizeTask.schedule());
|
|
4088
4122
|
try {
|
|
4089
4123
|
await Promise.race([
|
|
4090
|
-
(0,
|
|
4124
|
+
(0, import_context12.rejectOnDispose)(ctx),
|
|
4091
4125
|
allNotarized,
|
|
4092
4126
|
errors.wait()
|
|
4093
4127
|
]);
|
|
@@ -4128,7 +4162,7 @@ var NotarizationPlugin = class {
|
|
|
4128
4162
|
if (this._processedCredentials.has(id)) {
|
|
4129
4163
|
return;
|
|
4130
4164
|
}
|
|
4131
|
-
await (0,
|
|
4165
|
+
await (0, import_util8.entry)(this._processCredentialsTriggers, id).orInsert(new import_async15.Trigger()).value.wait();
|
|
4132
4166
|
}
|
|
4133
4167
|
/**
|
|
4134
4168
|
* Requests from other peers to notarize credentials.
|
|
@@ -4655,7 +4689,7 @@ var DataSpace = class {
|
|
|
4655
4689
|
return null;
|
|
4656
4690
|
}
|
|
4657
4691
|
const { newRoot } = await runEpochMigration(ctx, {
|
|
4658
|
-
|
|
4692
|
+
echoHost: this._echoHost,
|
|
4659
4693
|
spaceId: this.id,
|
|
4660
4694
|
spaceKey: this.key,
|
|
4661
4695
|
migration: options.migration,
|
|
@@ -4856,12 +4890,12 @@ var DataSpaceManager = class {
|
|
|
4856
4890
|
this._echoHost = _echoHost;
|
|
4857
4891
|
this._invitationsManager = _invitationsManager;
|
|
4858
4892
|
this._params = _params;
|
|
4859
|
-
this._ctx = new
|
|
4893
|
+
this._ctx = new import_context13.Context(void 0, {
|
|
4860
4894
|
F: __dxlog_file18,
|
|
4861
4895
|
L: 104
|
|
4862
4896
|
});
|
|
4863
|
-
this.updated = new
|
|
4864
|
-
this._spaces = new
|
|
4897
|
+
this.updated = new import_async16.Event();
|
|
4898
|
+
this._spaces = new import_util9.ComplexMap(import_keys12.PublicKey.hash);
|
|
4865
4899
|
this._isOpen = false;
|
|
4866
4900
|
this._instanceId = import_keys12.PublicKey.random().toHex();
|
|
4867
4901
|
import_tracing6.trace.diagnostic({
|
|
@@ -4914,7 +4948,7 @@ var DataSpaceManager = class {
|
|
|
4914
4948
|
S: this,
|
|
4915
4949
|
C: (f, a) => f(...a)
|
|
4916
4950
|
});
|
|
4917
|
-
await (0,
|
|
4951
|
+
await (0, import_util9.forEachAsync)(this._metadataStore.spaces, async (spaceMetadata) => {
|
|
4918
4952
|
try {
|
|
4919
4953
|
(0, import_log15.log)("load space", {
|
|
4920
4954
|
spaceMetadata
|
|
@@ -5018,13 +5052,13 @@ var DataSpaceManager = class {
|
|
|
5018
5052
|
return false;
|
|
5019
5053
|
}
|
|
5020
5054
|
switch (space.databaseRoot.getVersion()) {
|
|
5021
|
-
case
|
|
5055
|
+
case import_echo_protocol3.SpaceDocVersion.CURRENT: {
|
|
5022
5056
|
const [_, properties] = (0, import_echo_db2.findInlineObjectOfType)(space.databaseRoot.docSync(), import_echo_schema2.TYPE_PROPERTIES) ?? [];
|
|
5023
5057
|
return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
|
|
5024
5058
|
}
|
|
5025
|
-
case
|
|
5059
|
+
case import_echo_protocol3.SpaceDocVersion.LEGACY: {
|
|
5026
5060
|
const convertedDoc = await (0, import_echo_db2.convertLegacyReferences)(space.databaseRoot.docSync());
|
|
5027
|
-
const [_, properties] = (0, import_echo_db2.findInlineObjectOfType)(convertedDoc,
|
|
5061
|
+
const [_, properties] = (0, import_echo_db2.findInlineObjectOfType)(convertedDoc, import_echo_protocol3.LEGACY_TYPE_PROPERTIES) ?? [];
|
|
5028
5062
|
return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
|
|
5029
5063
|
}
|
|
5030
5064
|
default:
|
|
@@ -5045,7 +5079,7 @@ var DataSpaceManager = class {
|
|
|
5045
5079
|
const document = await this._getSpaceRootDocument(space);
|
|
5046
5080
|
const properties = {
|
|
5047
5081
|
system: {
|
|
5048
|
-
type: (0,
|
|
5082
|
+
type: (0, import_echo_protocol3.encodeReference)((0, import_echo_schema2.getTypeReference)(import_client_protocol5.PropertiesType))
|
|
5049
5083
|
},
|
|
5050
5084
|
data: {
|
|
5051
5085
|
[DEFAULT_SPACE_KEY]: this._signingContext.identityKey.toHex()
|
|
@@ -5056,7 +5090,7 @@ var DataSpaceManager = class {
|
|
|
5056
5090
|
};
|
|
5057
5091
|
const propertiesId = (0, import_echo_schema2.generateEchoId)();
|
|
5058
5092
|
document.change((doc) => {
|
|
5059
|
-
(0,
|
|
5093
|
+
(0, import_util9.assignDeep)(doc, [
|
|
5060
5094
|
"objects",
|
|
5061
5095
|
propertiesId
|
|
5062
5096
|
], properties);
|
|
@@ -5163,7 +5197,7 @@ var DataSpaceManager = class {
|
|
|
5163
5197
|
* TODO(dmaretskyi): Consider removing.
|
|
5164
5198
|
*/
|
|
5165
5199
|
async waitUntilSpaceReady(spaceKey) {
|
|
5166
|
-
await (0,
|
|
5200
|
+
await (0, import_context13.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
|
|
5167
5201
|
const space = this._spaces.get(spaceKey);
|
|
5168
5202
|
return !!space && space.state === import_services14.SpaceState.READY;
|
|
5169
5203
|
}));
|
|
@@ -5210,10 +5244,10 @@ var DataSpaceManager = class {
|
|
|
5210
5244
|
swarmIdentity: {
|
|
5211
5245
|
peerKey: this._signingContext.deviceKey,
|
|
5212
5246
|
credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
|
|
5213
|
-
credentialAuthenticator: (0,
|
|
5247
|
+
credentialAuthenticator: (0, import_util9.deferFunction)(() => dataSpace.authVerifier.verifier)
|
|
5214
5248
|
},
|
|
5215
5249
|
onAuthorizedConnection: (session) => {
|
|
5216
|
-
session.addExtension("dxos.mesh.teleport.admission-discovery", new
|
|
5250
|
+
session.addExtension("dxos.mesh.teleport.admission-discovery", new import_echo_pipeline4.CredentialServerExtension(space));
|
|
5217
5251
|
session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
|
|
5218
5252
|
remotePeerId: session.remotePeerId
|
|
5219
5253
|
}));
|
|
@@ -5315,7 +5349,7 @@ var DataSpaceManager = class {
|
|
|
5315
5349
|
const peers = presence.getPeersByIdentityKey(member.key);
|
|
5316
5350
|
const sessions = peers.map((p) => p.peerId && spaceProtocol.sessions.get(p.peerId));
|
|
5317
5351
|
const sessionsToClose = sessions.filter((s) => {
|
|
5318
|
-
return (s && member.role === import_credentials16.SpaceMember.Role.REMOVED !== (s.authStatus ===
|
|
5352
|
+
return (s && member.role === import_credentials16.SpaceMember.Role.REMOVED !== (s.authStatus === import_echo_pipeline3.AuthStatus.FAILURE)) ?? false;
|
|
5319
5353
|
});
|
|
5320
5354
|
sessionsToClose.forEach((session) => {
|
|
5321
5355
|
void session.close().catch(import_log15.log.error);
|
|
@@ -5388,19 +5422,19 @@ var DataSpaceManager = class {
|
|
|
5388
5422
|
}
|
|
5389
5423
|
};
|
|
5390
5424
|
_ts_decorate5([
|
|
5391
|
-
|
|
5425
|
+
import_async16.synchronized
|
|
5392
5426
|
], DataSpaceManager.prototype, "open", null);
|
|
5393
5427
|
_ts_decorate5([
|
|
5394
|
-
|
|
5428
|
+
import_async16.synchronized
|
|
5395
5429
|
], DataSpaceManager.prototype, "close", null);
|
|
5396
5430
|
_ts_decorate5([
|
|
5397
|
-
|
|
5431
|
+
import_async16.synchronized
|
|
5398
5432
|
], DataSpaceManager.prototype, "createSpace", null);
|
|
5399
5433
|
_ts_decorate5([
|
|
5400
|
-
|
|
5434
|
+
import_async16.synchronized
|
|
5401
5435
|
], DataSpaceManager.prototype, "acceptSpace", null);
|
|
5402
5436
|
DataSpaceManager = _ts_decorate5([
|
|
5403
|
-
(0,
|
|
5437
|
+
(0, import_async16.trackLeaks)("open", "close")
|
|
5404
5438
|
], DataSpaceManager);
|
|
5405
5439
|
var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
5406
5440
|
var SpacesServiceImpl = class {
|
|
@@ -5468,7 +5502,7 @@ var SpacesServiceImpl = class {
|
|
|
5468
5502
|
}
|
|
5469
5503
|
querySpaces() {
|
|
5470
5504
|
return new import_codec_protobuf11.Stream(({ next, ctx }) => {
|
|
5471
|
-
const scheduler = new
|
|
5505
|
+
const scheduler = new import_async17.UpdateScheduler(ctx, async () => {
|
|
5472
5506
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5473
5507
|
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
5474
5508
|
(0, import_log16.log)("update", {
|
|
@@ -5486,9 +5520,9 @@ var SpacesServiceImpl = class {
|
|
|
5486
5520
|
}, {
|
|
5487
5521
|
maxFrequency: process.env.NODE_ENV === "test" ? void 0 : 2
|
|
5488
5522
|
});
|
|
5489
|
-
(0,
|
|
5523
|
+
(0, import_async17.scheduleTask)(ctx, async () => {
|
|
5490
5524
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5491
|
-
const subscriptions = new
|
|
5525
|
+
const subscriptions = new import_async17.EventSubscriptions();
|
|
5492
5526
|
ctx.onDispose(() => subscriptions.clear());
|
|
5493
5527
|
const subscribeSpaces = () => {
|
|
5494
5528
|
subscriptions.clear();
|
|
@@ -5528,7 +5562,7 @@ var SpacesServiceImpl = class {
|
|
|
5528
5562
|
}
|
|
5529
5563
|
subscribeMessages({ spaceKey, channel }) {
|
|
5530
5564
|
return new import_codec_protobuf11.Stream(({ ctx, next }) => {
|
|
5531
|
-
(0,
|
|
5565
|
+
(0, import_async17.scheduleTask)(ctx, async () => {
|
|
5532
5566
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5533
5567
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols12.SpaceNotFoundError(spaceKey));
|
|
5534
5568
|
const handle = space.listen(getChannelId(channel), (message) => {
|
|
@@ -5547,7 +5581,7 @@ var SpacesServiceImpl = class {
|
|
|
5547
5581
|
}
|
|
5548
5582
|
};
|
|
5549
5583
|
ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
|
|
5550
|
-
(0,
|
|
5584
|
+
(0, import_async17.scheduleTask)(ctx, async () => {
|
|
5551
5585
|
await space.spaceState.addCredentialProcessor(processor);
|
|
5552
5586
|
if (noTail) {
|
|
5553
5587
|
close();
|
|
@@ -5739,7 +5773,7 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
5739
5773
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5740
5774
|
}
|
|
5741
5775
|
var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
5742
|
-
var ServiceContext = class extends
|
|
5776
|
+
var ServiceContext = class extends import_context14.Resource {
|
|
5743
5777
|
constructor(storage, level, networkManager, signalManager, _runtimeParams) {
|
|
5744
5778
|
super();
|
|
5745
5779
|
this.storage = storage;
|
|
@@ -5747,11 +5781,11 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5747
5781
|
this.networkManager = networkManager;
|
|
5748
5782
|
this.signalManager = signalManager;
|
|
5749
5783
|
this._runtimeParams = _runtimeParams;
|
|
5750
|
-
this.initialized = new
|
|
5784
|
+
this.initialized = new import_async18.Trigger();
|
|
5751
5785
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
5752
5786
|
this._instanceId = import_keys13.PublicKey.random().toHex();
|
|
5753
|
-
this.metadataStore = new
|
|
5754
|
-
this.snapshotStore = new
|
|
5787
|
+
this.metadataStore = new import_echo_pipeline5.MetadataStore(storage.createDirectory("metadata"));
|
|
5788
|
+
this.snapshotStore = new import_echo_pipeline5.SnapshotStore(storage.createDirectory("snapshots"));
|
|
5755
5789
|
this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
|
|
5756
5790
|
this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
|
|
5757
5791
|
this.feedStore = new import_feed_store6.FeedStore({
|
|
@@ -5759,12 +5793,12 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5759
5793
|
root: storage.createDirectory("feeds"),
|
|
5760
5794
|
signer: this.keyring,
|
|
5761
5795
|
hypercore: {
|
|
5762
|
-
valueEncoding:
|
|
5796
|
+
valueEncoding: import_echo_pipeline5.valueEncoding,
|
|
5763
5797
|
stats: true
|
|
5764
5798
|
}
|
|
5765
5799
|
})
|
|
5766
5800
|
});
|
|
5767
|
-
this.spaceManager = new
|
|
5801
|
+
this.spaceManager = new import_echo_pipeline5.SpaceManager({
|
|
5768
5802
|
feedStore: this.feedStore,
|
|
5769
5803
|
networkManager: this.networkManager,
|
|
5770
5804
|
blobStore: this.blobStore,
|
|
@@ -5855,7 +5889,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5855
5889
|
}
|
|
5856
5890
|
async createIdentity(params = {}) {
|
|
5857
5891
|
const identity = await this.identityManager.createIdentity(params);
|
|
5858
|
-
await this._initialize(new
|
|
5892
|
+
await this._initialize(new import_context14.Context(void 0, {
|
|
5859
5893
|
F: __dxlog_file20,
|
|
5860
5894
|
L: 187
|
|
5861
5895
|
}));
|
|
@@ -5884,7 +5918,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5884
5918
|
}
|
|
5885
5919
|
async _acceptIdentity(params) {
|
|
5886
5920
|
const identity = await this.identityManager.acceptIdentity(params);
|
|
5887
|
-
await this._initialize(new
|
|
5921
|
+
await this._initialize(new import_context14.Context(void 0, {
|
|
5888
5922
|
F: __dxlog_file20,
|
|
5889
5923
|
L: 209
|
|
5890
5924
|
}));
|
|
@@ -5997,7 +6031,7 @@ _ts_decorate6([
|
|
|
5997
6031
|
import_tracing8.trace.span()
|
|
5998
6032
|
], ServiceContext.prototype, "_initialize", null);
|
|
5999
6033
|
ServiceContext = _ts_decorate6([
|
|
6000
|
-
(0,
|
|
6034
|
+
(0, import_util10.safeInstanceof)("dxos.client-services.ServiceContext"),
|
|
6001
6035
|
import_tracing8.trace.resource()
|
|
6002
6036
|
], ServiceContext);
|
|
6003
6037
|
var ServiceRegistry = class {
|
|
@@ -6077,7 +6111,7 @@ _ts_decorate7([
|
|
|
6077
6111
|
], Lock.prototype, "lockKey", null);
|
|
6078
6112
|
var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
|
|
6079
6113
|
var getRootPath = (config) => {
|
|
6080
|
-
const { dataRoot = (0,
|
|
6114
|
+
const { dataRoot = (0, import_util11.isNode)() ? import_client_protocol6.DX_DATA : "dxos/storage" } = config ?? {};
|
|
6081
6115
|
return `${dataRoot}/`;
|
|
6082
6116
|
};
|
|
6083
6117
|
var isPersistent = (config) => {
|
|
@@ -6205,14 +6239,15 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
6205
6239
|
return archive;
|
|
6206
6240
|
};
|
|
6207
6241
|
var importProfileData = async ({ storage, level }, archive) => {
|
|
6208
|
-
|
|
6242
|
+
let batch = level.batch();
|
|
6243
|
+
let count = 0;
|
|
6209
6244
|
for (const entry2 of archive.storage) {
|
|
6210
6245
|
switch (entry2.type) {
|
|
6211
6246
|
case import_protocols15.ProfileArchiveEntryType.FILE: {
|
|
6212
6247
|
const directory = await storage.createDirectory();
|
|
6213
6248
|
(0, import_invariant19.invariant)(typeof entry2.key === "string", "Invalid key type", {
|
|
6214
6249
|
F: __dxlog_file22,
|
|
6215
|
-
L:
|
|
6250
|
+
L: 79,
|
|
6216
6251
|
S: void 0,
|
|
6217
6252
|
A: [
|
|
6218
6253
|
"typeof entry.key === 'string'",
|
|
@@ -6222,21 +6257,21 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
6222
6257
|
const file = await directory.getOrCreateFile(entry2.key);
|
|
6223
6258
|
(0, import_invariant19.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6224
6259
|
F: __dxlog_file22,
|
|
6225
|
-
L:
|
|
6260
|
+
L: 81,
|
|
6226
6261
|
S: void 0,
|
|
6227
6262
|
A: [
|
|
6228
6263
|
"entry.value instanceof Uint8Array",
|
|
6229
6264
|
"'Invalid value type'"
|
|
6230
6265
|
]
|
|
6231
6266
|
});
|
|
6232
|
-
await file.write(0, (0,
|
|
6267
|
+
await file.write(0, (0, import_util12.arrayToBuffer)(entry2.value));
|
|
6233
6268
|
await file.close();
|
|
6234
6269
|
break;
|
|
6235
6270
|
}
|
|
6236
6271
|
case import_protocols15.ProfileArchiveEntryType.KEY_VALUE: {
|
|
6237
6272
|
(0, import_invariant19.invariant)(entry2.key instanceof Uint8Array, "Invalid key type", {
|
|
6238
6273
|
F: __dxlog_file22,
|
|
6239
|
-
L:
|
|
6274
|
+
L: 87,
|
|
6240
6275
|
S: void 0,
|
|
6241
6276
|
A: [
|
|
6242
6277
|
"entry.key instanceof Uint8Array",
|
|
@@ -6245,7 +6280,7 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
6245
6280
|
});
|
|
6246
6281
|
(0, import_invariant19.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6247
6282
|
F: __dxlog_file22,
|
|
6248
|
-
L:
|
|
6283
|
+
L: 88,
|
|
6249
6284
|
S: void 0,
|
|
6250
6285
|
A: [
|
|
6251
6286
|
"entry.value instanceof Uint8Array",
|
|
@@ -6261,7 +6296,27 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
6261
6296
|
default:
|
|
6262
6297
|
throw new Error(`Invalid entry type: ${entry2.type}`);
|
|
6263
6298
|
}
|
|
6299
|
+
if (++count % 1e3 === 0) {
|
|
6300
|
+
await batch.write();
|
|
6301
|
+
batch = level.batch();
|
|
6302
|
+
import_log19.log.info("importing", {
|
|
6303
|
+
count,
|
|
6304
|
+
total: archive.storage.length,
|
|
6305
|
+
progress: `${(count / archive.storage.length * 100).toFixed()}%`
|
|
6306
|
+
}, {
|
|
6307
|
+
F: __dxlog_file22,
|
|
6308
|
+
L: 101,
|
|
6309
|
+
S: void 0,
|
|
6310
|
+
C: (f, a) => f(...a)
|
|
6311
|
+
});
|
|
6312
|
+
}
|
|
6264
6313
|
}
|
|
6314
|
+
import_log19.log.info("committing changes..", void 0, {
|
|
6315
|
+
F: __dxlog_file22,
|
|
6316
|
+
L: 109,
|
|
6317
|
+
S: void 0,
|
|
6318
|
+
C: (f, a) => f(...a)
|
|
6319
|
+
});
|
|
6265
6320
|
await batch.write();
|
|
6266
6321
|
};
|
|
6267
6322
|
var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
@@ -6323,7 +6378,7 @@ var DevicesServiceImpl = class {
|
|
|
6323
6378
|
presenceSubscribed = true;
|
|
6324
6379
|
}
|
|
6325
6380
|
};
|
|
6326
|
-
const subscriptions = new
|
|
6381
|
+
const subscriptions = new import_async20.EventSubscriptions();
|
|
6327
6382
|
if (this._identityManager.identity) {
|
|
6328
6383
|
subscribeIdentity();
|
|
6329
6384
|
subscribePresence();
|
|
@@ -6363,7 +6418,7 @@ var DiagnosticsCollector = class {
|
|
|
6363
6418
|
client: clientDiagnostics,
|
|
6364
6419
|
broadcast: await this.broadcastSender.broadcastDiagnosticsRequest()
|
|
6365
6420
|
};
|
|
6366
|
-
return JSON.parse(JSON.stringify(diagnostics, (0,
|
|
6421
|
+
return JSON.parse(JSON.stringify(diagnostics, (0, import_util13.jsonKeyReplacer)(options)));
|
|
6367
6422
|
}
|
|
6368
6423
|
};
|
|
6369
6424
|
var findSystemServiceProvider = () => {
|
|
@@ -6373,7 +6428,7 @@ var findSystemServiceProvider = () => {
|
|
|
6373
6428
|
};
|
|
6374
6429
|
var findConfigs = () => {
|
|
6375
6430
|
const configs = import_tracing10.TRACE_PROCESSOR.findResourcesByAnnotation(import_config3.ConfigResource);
|
|
6376
|
-
return configs.map((r) => r.instance.deref()).filter(
|
|
6431
|
+
return configs.map((r) => r.instance.deref()).filter(import_util13.nonNullable);
|
|
6377
6432
|
};
|
|
6378
6433
|
var ContactsServiceImpl = class {
|
|
6379
6434
|
constructor(_identityManager, _spaceManager, _dataSpaceManagerProvider) {
|
|
@@ -6414,7 +6469,7 @@ var ContactsServiceImpl = class {
|
|
|
6414
6469
|
});
|
|
6415
6470
|
}
|
|
6416
6471
|
return acc;
|
|
6417
|
-
}, new
|
|
6472
|
+
}, new import_util15.ComplexMap(import_keys17.PublicKey.hash));
|
|
6418
6473
|
return {
|
|
6419
6474
|
contacts: [
|
|
6420
6475
|
...contacts.values()
|
|
@@ -6422,16 +6477,16 @@ var ContactsServiceImpl = class {
|
|
|
6422
6477
|
};
|
|
6423
6478
|
}
|
|
6424
6479
|
queryContacts() {
|
|
6425
|
-
const subscribedSpaceKeySet = new
|
|
6480
|
+
const subscribedSpaceKeySet = new import_util15.ComplexSet(import_keys17.PublicKey.hash);
|
|
6426
6481
|
return new import_codec_protobuf13.Stream(({ next, ctx }) => {
|
|
6427
|
-
const pushUpdateTask = new
|
|
6482
|
+
const pushUpdateTask = new import_async21.UpdateScheduler(ctx, async () => {
|
|
6428
6483
|
const contacts = await this.getContacts();
|
|
6429
6484
|
next(contacts);
|
|
6430
6485
|
}, {
|
|
6431
6486
|
maxFrequency: 2
|
|
6432
6487
|
});
|
|
6433
|
-
(0,
|
|
6434
|
-
const subscriptions = new
|
|
6488
|
+
(0, import_async21.scheduleTask)(ctx, async () => {
|
|
6489
|
+
const subscriptions = new import_async21.EventSubscriptions();
|
|
6435
6490
|
ctx.onDispose(() => subscriptions.clear());
|
|
6436
6491
|
const subscribeToSpaceAndUpdate = () => {
|
|
6437
6492
|
const oldSetSize = subscribedSpaceKeySet.size;
|
|
@@ -6454,7 +6509,7 @@ var ContactsServiceImpl = class {
|
|
|
6454
6509
|
};
|
|
6455
6510
|
var LoggingServiceImpl = class {
|
|
6456
6511
|
constructor() {
|
|
6457
|
-
this._logs = new
|
|
6512
|
+
this._logs = new import_async22.Event();
|
|
6458
6513
|
this._started = Date.now();
|
|
6459
6514
|
this._sessionId = import_keys18.PublicKey.random().toHex();
|
|
6460
6515
|
this._logProcessor = (_config, entry2) => {
|
|
@@ -6470,15 +6525,15 @@ var LoggingServiceImpl = class {
|
|
|
6470
6525
|
}
|
|
6471
6526
|
async controlMetrics({ reset, record }) {
|
|
6472
6527
|
if (reset) {
|
|
6473
|
-
|
|
6528
|
+
import_util16.tracer.clear();
|
|
6474
6529
|
}
|
|
6475
6530
|
if (record === true) {
|
|
6476
|
-
|
|
6531
|
+
import_util16.tracer.start();
|
|
6477
6532
|
} else if (record === false) {
|
|
6478
|
-
|
|
6533
|
+
import_util16.tracer.stop();
|
|
6479
6534
|
}
|
|
6480
6535
|
return {
|
|
6481
|
-
recording:
|
|
6536
|
+
recording: import_util16.tracer.recording
|
|
6482
6537
|
};
|
|
6483
6538
|
}
|
|
6484
6539
|
/**
|
|
@@ -6486,10 +6541,10 @@ var LoggingServiceImpl = class {
|
|
|
6486
6541
|
*/
|
|
6487
6542
|
queryMetrics({ interval = 5e3 }) {
|
|
6488
6543
|
const getNumericalValues = (key) => {
|
|
6489
|
-
const events =
|
|
6544
|
+
const events = import_util16.tracer.get(key) ?? [];
|
|
6490
6545
|
return {
|
|
6491
6546
|
key,
|
|
6492
|
-
stats: (0,
|
|
6547
|
+
stats: (0, import_util16.numericalValues)(events, "duration")
|
|
6493
6548
|
};
|
|
6494
6549
|
};
|
|
6495
6550
|
return new import_codec_protobuf14.Stream(({ next }) => {
|
|
@@ -6527,7 +6582,7 @@ var LoggingServiceImpl = class {
|
|
|
6527
6582
|
}
|
|
6528
6583
|
const record = {
|
|
6529
6584
|
...entry2,
|
|
6530
|
-
context: (0,
|
|
6585
|
+
context: (0, import_util16.jsonify)((0, import_log21.getContextFromEntry)(entry2)),
|
|
6531
6586
|
timestamp: /* @__PURE__ */ new Date(),
|
|
6532
6587
|
meta: {
|
|
6533
6588
|
// TODO(dmaretskyi): Fix proto.
|
|
@@ -6536,7 +6591,7 @@ var LoggingServiceImpl = class {
|
|
|
6536
6591
|
scope: {
|
|
6537
6592
|
hostSessionId: this._sessionId,
|
|
6538
6593
|
uptimeSeconds: (Date.now() - this._started) / 1e3,
|
|
6539
|
-
name: (0,
|
|
6594
|
+
name: (0, import_util16.getDebugName)(entry2.meta?.S)
|
|
6540
6595
|
}
|
|
6541
6596
|
}
|
|
6542
6597
|
};
|
|
@@ -6617,7 +6672,7 @@ var SystemServiceImpl = class {
|
|
|
6617
6672
|
const diagnostics = await this._getDiagnostics();
|
|
6618
6673
|
return {
|
|
6619
6674
|
timestamp: /* @__PURE__ */ new Date(),
|
|
6620
|
-
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0,
|
|
6675
|
+
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util17.jsonKeyReplacer)({
|
|
6621
6676
|
truncate: keys === import_services21.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
|
|
6622
6677
|
humanize: keys === import_services21.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
|
|
6623
6678
|
})))
|
|
@@ -6674,7 +6729,7 @@ var ClientServicesHost = class {
|
|
|
6674
6729
|
runtimeParams
|
|
6675
6730
|
} = {}) {
|
|
6676
6731
|
this._tracingService = import_tracing9.TRACE_PROCESSOR.createTraceSender();
|
|
6677
|
-
this._statusUpdate = new
|
|
6732
|
+
this._statusUpdate = new import_async19.Event();
|
|
6678
6733
|
this._opening = false;
|
|
6679
6734
|
this._open = false;
|
|
6680
6735
|
this._storage = storage;
|
|
@@ -6693,7 +6748,7 @@ var ClientServicesHost = class {
|
|
|
6693
6748
|
lockKey,
|
|
6694
6749
|
onAcquire: () => {
|
|
6695
6750
|
if (!this._opening) {
|
|
6696
|
-
void this.open(new
|
|
6751
|
+
void this.open(new import_context15.Context(void 0, {
|
|
6697
6752
|
F: __dxlog_file24,
|
|
6698
6753
|
L: 121
|
|
6699
6754
|
}));
|
|
@@ -7016,11 +7071,11 @@ _ts_decorate8([
|
|
|
7016
7071
|
import_tracing9.trace.info()
|
|
7017
7072
|
], ClientServicesHost.prototype, "_open", void 0);
|
|
7018
7073
|
_ts_decorate8([
|
|
7019
|
-
|
|
7074
|
+
import_async19.synchronized,
|
|
7020
7075
|
import_tracing9.trace.span()
|
|
7021
7076
|
], ClientServicesHost.prototype, "open", null);
|
|
7022
7077
|
_ts_decorate8([
|
|
7023
|
-
|
|
7078
|
+
import_async19.synchronized,
|
|
7024
7079
|
import_tracing9.trace.span()
|
|
7025
7080
|
], ClientServicesHost.prototype, "close", null);
|
|
7026
7081
|
ClientServicesHost = _ts_decorate8([
|
|
@@ -7070,4 +7125,4 @@ ClientServicesHost = _ts_decorate8([
|
|
|
7070
7125
|
subscribeToSpaces,
|
|
7071
7126
|
subscribeToSwarmInfo
|
|
7072
7127
|
});
|
|
7073
|
-
//# sourceMappingURL=chunk-
|
|
7128
|
+
//# sourceMappingURL=chunk-3Z5PAMUS.cjs.map
|