@dxos/client-services 0.1.51-main.e7215ae → 0.1.51-next.5787f10
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-5W2L64HI.mjs → chunk-2GQ7337P.mjs} +105 -49
- package/dist/lib/browser/chunk-2GQ7337P.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 +8 -2
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +122 -66
- 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 +146 -84
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/devtools/devtools.d.ts +2 -1
- package/dist/types/src/packlets/devtools/devtools.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/feeds.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/logging/logging-service.d.ts +1 -1
- package/dist/types/src/packlets/logging/logging-service.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +5 -0
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +3 -0
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/package.json +31 -30
- package/src/packlets/devtools/devtools.ts +7 -0
- package/src/packlets/devtools/feeds.ts +1 -0
- package/src/packlets/identity/identity-manager.test.ts +4 -1
- package/src/packlets/identity/identity-manager.ts +4 -1
- package/src/packlets/identity/identity.test.ts +40 -15
- package/src/packlets/logging/logging-service.ts +58 -15
- package/src/packlets/services/service-context.ts +7 -0
- package/src/packlets/spaces/data-space-manager.test.ts +64 -1
- package/src/packlets/spaces/data-space-manager.ts +2 -2
- package/src/packlets/spaces/data-space.ts +8 -3
- package/src/packlets/spaces/spaces-service.ts +7 -0
- package/src/packlets/testing/test-builder.ts +7 -0
- package/dist/lib/browser/chunk-5W2L64HI.mjs.map +0 -7
package/dist/lib/node/index.cjs
CHANGED
|
@@ -92,11 +92,15 @@ var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
|
92
92
|
}
|
|
93
93
|
});
|
|
94
94
|
next({
|
|
95
|
-
feeds: Array.from(feedMap.values()).map((feed) =>
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
feeds: Array.from(feedMap.values()).map((feed) => {
|
|
96
|
+
var _a, _b;
|
|
97
|
+
return {
|
|
98
|
+
feedKey: feed.key,
|
|
99
|
+
length: feed.properties.length,
|
|
100
|
+
bytes: feed.core.byteLength,
|
|
101
|
+
downloaded: (_b = (_a = feed.core.bitfield) == null ? void 0 : _a.data.toBuffer()) != null ? _b : new Uint8Array()
|
|
102
|
+
};
|
|
103
|
+
})
|
|
100
104
|
});
|
|
101
105
|
};
|
|
102
106
|
subscriptions.add(feedStore.feedOpened.on(update));
|
|
@@ -328,6 +332,11 @@ var DevtoolsServiceImpl = class {
|
|
|
328
332
|
usageQuota: (_e = navigatorInfo == null ? void 0 : navigatorInfo.quota) != null ? _e : 0
|
|
329
333
|
};
|
|
330
334
|
}
|
|
335
|
+
async getBlobs() {
|
|
336
|
+
return {
|
|
337
|
+
blobs: await this.params.context.blobStore.list()
|
|
338
|
+
};
|
|
339
|
+
}
|
|
331
340
|
async getSnapshots() {
|
|
332
341
|
return {
|
|
333
342
|
snapshots: await this.params.context.snapshotStore.listSnapshots()
|
|
@@ -868,7 +877,8 @@ var IdentityManager = class {
|
|
|
868
877
|
});
|
|
869
878
|
(0, import_node_assert2.default)(identityRecord.haloSpace.dataFeedKey);
|
|
870
879
|
const dataFeed = await this._feedStore.openFeed(identityRecord.haloSpace.dataFeedKey, {
|
|
871
|
-
writable: true
|
|
880
|
+
writable: true,
|
|
881
|
+
sparse: true
|
|
872
882
|
});
|
|
873
883
|
const space = await this._constructSpace({
|
|
874
884
|
spaceRecord: identityRecord.haloSpace,
|
|
@@ -891,7 +901,7 @@ var IdentityManager = class {
|
|
|
891
901
|
identityKey: identityRecord.identityKey
|
|
892
902
|
}, {
|
|
893
903
|
file: "identity-manager.ts",
|
|
894
|
-
line:
|
|
904
|
+
line: 226,
|
|
895
905
|
scope: this,
|
|
896
906
|
callSite: (f, a) => f(...a)
|
|
897
907
|
});
|
|
@@ -912,7 +922,7 @@ var IdentityManager = class {
|
|
|
912
922
|
onAuthFailure: () => {
|
|
913
923
|
import_log3.log.warn("auth failure", {}, {
|
|
914
924
|
file: "identity-manager.ts",
|
|
915
|
-
line:
|
|
925
|
+
line: 245,
|
|
916
926
|
scope: this,
|
|
917
927
|
callSite: (f, a) => f(...a)
|
|
918
928
|
});
|
|
@@ -2140,7 +2150,7 @@ var import_log15 = require("@dxos/log");
|
|
|
2140
2150
|
var import_messaging = require("@dxos/messaging");
|
|
2141
2151
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
2142
2152
|
var import_protocols9 = require("@dxos/protocols");
|
|
2143
|
-
var
|
|
2153
|
+
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2144
2154
|
|
|
2145
2155
|
// packages/sdk/client-services/src/packlets/devices/devices-service.ts
|
|
2146
2156
|
var import_async10 = require("@dxos/async");
|
|
@@ -2251,6 +2261,7 @@ var isLocked = (lockPath) => import_lockfile.default.checkSync(lockPath);
|
|
|
2251
2261
|
var import_async12 = require("@dxos/async");
|
|
2252
2262
|
var import_codec_protobuf10 = require("@dxos/codec-protobuf");
|
|
2253
2263
|
var import_log9 = require("@dxos/log");
|
|
2264
|
+
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2254
2265
|
var import_util3 = require("@dxos/util");
|
|
2255
2266
|
var LoggingServiceImpl = class {
|
|
2256
2267
|
constructor() {
|
|
@@ -2267,31 +2278,60 @@ var LoggingServiceImpl = class {
|
|
|
2267
2278
|
import_log9.log.runtimeConfig.processors.splice(index, 1);
|
|
2268
2279
|
}
|
|
2269
2280
|
queryLogs(request) {
|
|
2270
|
-
var _a;
|
|
2271
|
-
const filters = ((_a = request.filters) == null ? void 0 : _a.length) ? request.filters : void 0;
|
|
2272
2281
|
return new import_codec_protobuf10.Stream(({ ctx, next }) => {
|
|
2273
2282
|
const handler = (entry2) => {
|
|
2274
|
-
var
|
|
2275
|
-
if (
|
|
2283
|
+
var _a, _b, _c, _d, _e;
|
|
2284
|
+
if (LOG_PROCESSING > 0) {
|
|
2276
2285
|
return;
|
|
2277
2286
|
}
|
|
2278
|
-
if ((0
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2287
|
+
if (((_a = entry2.meta) == null ? void 0 : _a.file.includes("logging-service")) || entry2.context && Object.values(entry2.context).some((value) => typeof value === "string" && value.includes("LoggingService"))) {
|
|
2288
|
+
return;
|
|
2289
|
+
}
|
|
2290
|
+
if (!shouldLog(entry2, request)) {
|
|
2291
|
+
return;
|
|
2292
|
+
}
|
|
2293
|
+
const record = {
|
|
2294
|
+
...entry2,
|
|
2295
|
+
context: (0, import_util3.jsonify)((0, import_log9.getContextFromEntry)(entry2)),
|
|
2296
|
+
timestamp: new Date(),
|
|
2297
|
+
meta: {
|
|
2298
|
+
// TODO(dmaretskyi): Fix proto.
|
|
2299
|
+
file: (_c = (_b = entry2.meta) == null ? void 0 : _b.file) != null ? _c : "",
|
|
2300
|
+
line: (_e = (_d = entry2.meta) == null ? void 0 : _d.line) != null ? _e : 0
|
|
2301
|
+
}
|
|
2302
|
+
};
|
|
2303
|
+
try {
|
|
2304
|
+
LOG_PROCESSING++;
|
|
2285
2305
|
next(record);
|
|
2306
|
+
} finally {
|
|
2307
|
+
LOG_PROCESSING--;
|
|
2286
2308
|
}
|
|
2287
2309
|
};
|
|
2288
|
-
|
|
2289
|
-
this._logs.off(handler);
|
|
2290
|
-
});
|
|
2291
|
-
this._logs.on(handler);
|
|
2310
|
+
this._logs.on(ctx, handler);
|
|
2292
2311
|
});
|
|
2293
2312
|
}
|
|
2294
2313
|
};
|
|
2314
|
+
var matchFilter = (filter, level, path, options) => {
|
|
2315
|
+
switch (options) {
|
|
2316
|
+
case import_services7.QueryLogsRequest.MatchingOptions.INCLUSIVE:
|
|
2317
|
+
return level >= filter.level && (!filter.pattern || path.includes(filter.pattern));
|
|
2318
|
+
case import_services7.QueryLogsRequest.MatchingOptions.EXPLICIT:
|
|
2319
|
+
return level === filter.level && (!filter.pattern || path.includes(filter.pattern));
|
|
2320
|
+
}
|
|
2321
|
+
};
|
|
2322
|
+
var shouldLog = (entry2, request) => {
|
|
2323
|
+
var _a;
|
|
2324
|
+
const options = (_a = request.options) != null ? _a : import_services7.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
2325
|
+
if (request.filters === void 0) {
|
|
2326
|
+
return options === import_services7.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
2327
|
+
} else {
|
|
2328
|
+
return request.filters.some((filter) => {
|
|
2329
|
+
var _a2, _b;
|
|
2330
|
+
return matchFilter(filter, entry2.level, (_b = (_a2 = entry2.meta) == null ? void 0 : _a2.file) != null ? _b : "", options);
|
|
2331
|
+
});
|
|
2332
|
+
}
|
|
2333
|
+
};
|
|
2334
|
+
var LOG_PROCESSING = 0;
|
|
2295
2335
|
|
|
2296
2336
|
// packages/sdk/client-services/src/packlets/network/network-service.ts
|
|
2297
2337
|
var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
@@ -2333,7 +2373,7 @@ var import_credentials12 = require("@dxos/credentials");
|
|
|
2333
2373
|
var import_keys9 = require("@dxos/keys");
|
|
2334
2374
|
var import_log12 = require("@dxos/log");
|
|
2335
2375
|
var import_protocols6 = require("@dxos/protocols");
|
|
2336
|
-
var
|
|
2376
|
+
var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2337
2377
|
var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
|
|
2338
2378
|
var import_util6 = require("@dxos/util");
|
|
2339
2379
|
|
|
@@ -2346,8 +2386,9 @@ var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
|
2346
2386
|
var import_errors3 = require("@dxos/errors");
|
|
2347
2387
|
var import_keys8 = require("@dxos/keys");
|
|
2348
2388
|
var import_log11 = require("@dxos/log");
|
|
2349
|
-
var
|
|
2389
|
+
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2350
2390
|
var import_credentials9 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
2391
|
+
var import_timeframe = require("@dxos/timeframe");
|
|
2351
2392
|
var import_util5 = require("@dxos/util");
|
|
2352
2393
|
|
|
2353
2394
|
// packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
|
|
@@ -2606,7 +2647,7 @@ var __decorate2 = function(decorators, target, key, desc) {
|
|
|
2606
2647
|
var DataSpace = class DataSpace2 {
|
|
2607
2648
|
constructor(params) {
|
|
2608
2649
|
this._ctx = new import_context6.Context();
|
|
2609
|
-
this._state =
|
|
2650
|
+
this._state = import_services8.SpaceState.CLOSED;
|
|
2610
2651
|
/**
|
|
2611
2652
|
* Error for _state === SpaceState.ERROR.
|
|
2612
2653
|
*/
|
|
@@ -2660,11 +2701,11 @@ var DataSpace = class DataSpace2 {
|
|
|
2660
2701
|
await this.notarizationPlugin.open();
|
|
2661
2702
|
await this._notarizationPluginConsumer.open();
|
|
2662
2703
|
await this._inner.open();
|
|
2663
|
-
this._state =
|
|
2704
|
+
this._state = import_services8.SpaceState.INACTIVE;
|
|
2664
2705
|
this.metrics.open = new Date();
|
|
2665
2706
|
}
|
|
2666
2707
|
async close() {
|
|
2667
|
-
this._state =
|
|
2708
|
+
this._state = import_services8.SpaceState.CLOSED;
|
|
2668
2709
|
await this._ctx.dispose();
|
|
2669
2710
|
await this.authVerifier.close();
|
|
2670
2711
|
await this._inner.close();
|
|
@@ -2690,7 +2731,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2690
2731
|
if (err instanceof import_errors3.CancelledError) {
|
|
2691
2732
|
(0, import_log11.log)("Data pipeline initialization cancelled", err, {
|
|
2692
2733
|
file: "data-space.ts",
|
|
2693
|
-
line:
|
|
2734
|
+
line: 173,
|
|
2694
2735
|
scope: this,
|
|
2695
2736
|
callSite: (f, a) => f(...a)
|
|
2696
2737
|
});
|
|
@@ -2698,11 +2739,11 @@ var DataSpace = class DataSpace2 {
|
|
|
2698
2739
|
}
|
|
2699
2740
|
import_log11.log.error("Error initializing data pipeline", err, {
|
|
2700
2741
|
file: "data-space.ts",
|
|
2701
|
-
line:
|
|
2742
|
+
line: 177,
|
|
2702
2743
|
scope: this,
|
|
2703
2744
|
callSite: (f, a) => f(...a)
|
|
2704
2745
|
});
|
|
2705
|
-
this._state =
|
|
2746
|
+
this._state = import_services8.SpaceState.ERROR;
|
|
2706
2747
|
this.error = err;
|
|
2707
2748
|
this.stateUpdate.emit();
|
|
2708
2749
|
} finally {
|
|
@@ -2712,10 +2753,10 @@ var DataSpace = class DataSpace2 {
|
|
|
2712
2753
|
}
|
|
2713
2754
|
async initializeDataPipeline() {
|
|
2714
2755
|
var _a, _b, _c, _d;
|
|
2715
|
-
if (this._state !==
|
|
2756
|
+
if (this._state !== import_services8.SpaceState.INACTIVE) {
|
|
2716
2757
|
throw new import_errors3.SystemError("Invalid operation");
|
|
2717
2758
|
}
|
|
2718
|
-
this._state =
|
|
2759
|
+
this._state = import_services8.SpaceState.INITIALIZING;
|
|
2719
2760
|
await this._inner.controlPipeline.state.waitUntilReachedTargetTimeframe({
|
|
2720
2761
|
ctx: this._ctx,
|
|
2721
2762
|
breakOnStall: false
|
|
@@ -2755,7 +2796,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2755
2796
|
callSite: (f, a) => f(...a)
|
|
2756
2797
|
});
|
|
2757
2798
|
await ((_b = (_a = this._callbacks).beforeReady) == null ? void 0 : _b.call(_a));
|
|
2758
|
-
this._state =
|
|
2799
|
+
this._state = import_services8.SpaceState.READY;
|
|
2759
2800
|
this.stateUpdate.emit();
|
|
2760
2801
|
await ((_d = (_c = this._callbacks).afterReady) == null ? void 0 : _d.call(_c));
|
|
2761
2802
|
}
|
|
@@ -2779,7 +2820,8 @@ var DataSpace = class DataSpace2 {
|
|
|
2779
2820
|
}
|
|
2780
2821
|
if (!this.inner.dataFeedKey) {
|
|
2781
2822
|
const dataFeed = await this._feedStore.openFeed(await this._keyring.createKey(), {
|
|
2782
|
-
writable: true
|
|
2823
|
+
writable: true,
|
|
2824
|
+
sparse: true
|
|
2783
2825
|
});
|
|
2784
2826
|
this.inner.setDataFeed(dataFeed);
|
|
2785
2827
|
credentials.push(await this._signingContext.credentialSigner.createCredential({
|
|
@@ -2805,7 +2847,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2805
2847
|
async createEpoch() {
|
|
2806
2848
|
var _a, _b;
|
|
2807
2849
|
const epoch = await this.dataPipeline.createEpoch();
|
|
2808
|
-
await this.inner.controlPipeline.writer.write({
|
|
2850
|
+
const receipt = await this.inner.controlPipeline.writer.write({
|
|
2809
2851
|
credential: {
|
|
2810
2852
|
credential: await this._signingContext.credentialSigner.createCredential({
|
|
2811
2853
|
subject: this.key,
|
|
@@ -2816,6 +2858,12 @@ var DataSpace = class DataSpace2 {
|
|
|
2816
2858
|
})
|
|
2817
2859
|
}
|
|
2818
2860
|
});
|
|
2861
|
+
await this.inner.controlPipeline.state.waitUntilTimeframe(new import_timeframe.Timeframe([
|
|
2862
|
+
[
|
|
2863
|
+
receipt.feedKey,
|
|
2864
|
+
receipt.seq
|
|
2865
|
+
]
|
|
2866
|
+
]));
|
|
2819
2867
|
for (const feed of (_b = (_a = this.inner.dataPipeline.pipelineState) == null ? void 0 : _a.feeds) != null ? _b : []) {
|
|
2820
2868
|
const indexBeforeEpoch = epoch.timeframe.get(feed.key);
|
|
2821
2869
|
if (indexBeforeEpoch) {
|
|
@@ -2835,7 +2883,7 @@ DataSpace = __decorate2([
|
|
|
2835
2883
|
var import_credentials10 = require("@dxos/credentials");
|
|
2836
2884
|
var import_debug4 = require("@dxos/debug");
|
|
2837
2885
|
var import_credentials11 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
2838
|
-
var
|
|
2886
|
+
var import_timeframe2 = require("@dxos/timeframe");
|
|
2839
2887
|
var spaceGenesis = async (keyring, signingContext, space) => {
|
|
2840
2888
|
var _a, _b, _c, _d;
|
|
2841
2889
|
const credentials = [
|
|
@@ -2886,7 +2934,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
|
|
|
2886
2934
|
"@type": "dxos.halo.credentials.Epoch",
|
|
2887
2935
|
number: 0,
|
|
2888
2936
|
previousId: void 0,
|
|
2889
|
-
timeframe: new
|
|
2937
|
+
timeframe: new import_timeframe2.Timeframe(),
|
|
2890
2938
|
snapshotCid: void 0
|
|
2891
2939
|
}
|
|
2892
2940
|
})
|
|
@@ -3066,7 +3114,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3066
3114
|
async waitUntilSpaceReady(spaceKey) {
|
|
3067
3115
|
await (0, import_context7.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
|
|
3068
3116
|
const space = this._spaces.get(spaceKey);
|
|
3069
|
-
return !!space && space.state ===
|
|
3117
|
+
return !!space && space.state === import_services9.SpaceState.READY;
|
|
3070
3118
|
}));
|
|
3071
3119
|
}
|
|
3072
3120
|
async _constructSpace(metadata) {
|
|
@@ -3091,7 +3139,8 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3091
3139
|
writable: true
|
|
3092
3140
|
});
|
|
3093
3141
|
const dataFeed = metadata.dataFeedKey && await this._feedStore.openFeed(metadata.dataFeedKey, {
|
|
3094
|
-
writable: true
|
|
3142
|
+
writable: true,
|
|
3143
|
+
sparse: true
|
|
3095
3144
|
});
|
|
3096
3145
|
const space = await this._spaceManager.constructSpace({
|
|
3097
3146
|
metadata,
|
|
@@ -3104,7 +3153,6 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3104
3153
|
session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
|
|
3105
3154
|
remotePeerId: session.remotePeerId
|
|
3106
3155
|
}));
|
|
3107
|
-
session.addExtension("dxos.mesh.teleport.objectsync", space.snapshotManager.objectSync.createExtension());
|
|
3108
3156
|
session.addExtension("dxos.mesh.teleport.notarization", dataSpace.notarizationPlugin.createExtension());
|
|
3109
3157
|
},
|
|
3110
3158
|
onAuthFailure: () => {
|
|
@@ -3190,7 +3238,7 @@ var import_debug5 = require("@dxos/debug");
|
|
|
3190
3238
|
var import_echo_pipeline2 = require("@dxos/echo-pipeline");
|
|
3191
3239
|
var import_log13 = require("@dxos/log");
|
|
3192
3240
|
var import_protocols7 = require("@dxos/protocols");
|
|
3193
|
-
var
|
|
3241
|
+
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
3194
3242
|
var import_util7 = require("@dxos/util");
|
|
3195
3243
|
var TIMEFRAME_UPDATE_DEBOUNCE_TIME = 500;
|
|
3196
3244
|
var SpacesServiceImpl = class {
|
|
@@ -3220,7 +3268,7 @@ var SpacesServiceImpl = class {
|
|
|
3220
3268
|
spaces
|
|
3221
3269
|
}, {
|
|
3222
3270
|
file: "spaces-service.ts",
|
|
3223
|
-
line:
|
|
3271
|
+
line: 60,
|
|
3224
3272
|
scope: this,
|
|
3225
3273
|
callSite: (f, a) => f(...a)
|
|
3226
3274
|
});
|
|
@@ -3237,6 +3285,7 @@ var SpacesServiceImpl = class {
|
|
|
3237
3285
|
for (const space of dataSpaceManager.spaces.values()) {
|
|
3238
3286
|
subscriptions.add(space.stateUpdate.on(ctx, onUpdate));
|
|
3239
3287
|
subscriptions.add(space.presence.updated.on(ctx, onUpdate));
|
|
3288
|
+
subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx, onUpdate));
|
|
3240
3289
|
space.inner.controlPipeline.state.timeframeUpdate.debounce(TIMEFRAME_UPDATE_DEBOUNCE_TIME).on(ctx, onUpdate);
|
|
3241
3290
|
if (space.dataPipeline.pipelineState) {
|
|
3242
3291
|
subscriptions.add(space.dataPipeline.pipelineState.timeframeUpdate.debounce(TIMEFRAME_UPDATE_DEBOUNCE_TIME).on(ctx, onUpdate));
|
|
@@ -3307,20 +3356,23 @@ var SpacesServiceImpl = class {
|
|
|
3307
3356
|
await space.createEpoch();
|
|
3308
3357
|
}
|
|
3309
3358
|
_transformSpace(space) {
|
|
3310
|
-
var _a, _b, _c, _d, _e;
|
|
3359
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
3311
3360
|
return {
|
|
3312
3361
|
spaceKey: space.key,
|
|
3313
3362
|
state: space.state,
|
|
3314
3363
|
error: space.error ? (0, import_protocols7.encodeError)(space.error) : void 0,
|
|
3315
3364
|
pipeline: {
|
|
3365
|
+
currentEpoch: space.dataPipeline.currentEpoch,
|
|
3366
|
+
appliedEpoch: space.dataPipeline.appliedEpoch,
|
|
3316
3367
|
controlFeeds: space.inner.controlPipeline.state.feeds.map((feed) => feed.key),
|
|
3317
3368
|
currentControlTimeframe: space.inner.controlPipeline.state.timeframe,
|
|
3318
3369
|
targetControlTimeframe: space.inner.controlPipeline.state.targetTimeframe,
|
|
3319
3370
|
totalControlTimeframe: space.inner.controlPipeline.state.endTimeframe,
|
|
3320
3371
|
dataFeeds: (_b = (_a = space.dataPipeline.pipelineState) == null ? void 0 : _a.feeds.map((feed) => feed.key)) != null ? _b : [],
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3372
|
+
startDataTimeframe: (_c = space.dataPipeline.pipelineState) == null ? void 0 : _c.startTimeframe,
|
|
3373
|
+
currentDataTimeframe: (_d = space.dataPipeline.pipelineState) == null ? void 0 : _d.timeframe,
|
|
3374
|
+
targetDataTimeframe: (_e = space.dataPipeline.pipelineState) == null ? void 0 : _e.targetTimeframe,
|
|
3375
|
+
totalDataTimeframe: (_f = space.dataPipeline.pipelineState) == null ? void 0 : _f.endTimeframe
|
|
3324
3376
|
},
|
|
3325
3377
|
members: Array.from(space.inner.spaceState.members.values()).map((member) => {
|
|
3326
3378
|
var _a2, _b2, _c2;
|
|
@@ -3331,9 +3383,10 @@ var SpacesServiceImpl = class {
|
|
|
3331
3383
|
displayName: (_b2 = (_a2 = member.assertion.profile) == null ? void 0 : _a2.displayName) != null ? _b2 : (0, import_util7.humanize)(member.key)
|
|
3332
3384
|
}
|
|
3333
3385
|
},
|
|
3334
|
-
presence: ((_c2 = this._identityManager.identity) == null ? void 0 : _c2.identityKey.equals(member.key)) || space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ?
|
|
3386
|
+
presence: ((_c2 = this._identityManager.identity) == null ? void 0 : _c2.identityKey.equals(member.key)) || space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ? import_services10.SpaceMember.PresenceState.ONLINE : import_services10.SpaceMember.PresenceState.OFFLINE
|
|
3335
3387
|
};
|
|
3336
3388
|
}),
|
|
3389
|
+
creator: (_g = space.inner.spaceState.creator) == null ? void 0 : _g.key,
|
|
3337
3390
|
cache: space.cache,
|
|
3338
3391
|
metrics: space.metrics
|
|
3339
3392
|
};
|
|
@@ -3439,7 +3492,8 @@ var import_keyring = require("@dxos/keyring");
|
|
|
3439
3492
|
var import_keys10 = require("@dxos/keys");
|
|
3440
3493
|
var import_log14 = require("@dxos/log");
|
|
3441
3494
|
var import_protocols8 = require("@dxos/protocols");
|
|
3442
|
-
var
|
|
3495
|
+
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
3496
|
+
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
3443
3497
|
var ServiceContext = class {
|
|
3444
3498
|
// prettier-ignore
|
|
3445
3499
|
constructor(storage, networkManager, signalManager, modelFactory) {
|
|
@@ -3453,6 +3507,7 @@ var ServiceContext = class {
|
|
|
3453
3507
|
this._instanceId = import_keys10.PublicKey.random().toHex();
|
|
3454
3508
|
this.metadataStore = new import_echo_pipeline3.MetadataStore(storage.createDirectory("metadata"));
|
|
3455
3509
|
this.snapshotStore = new import_echo_pipeline3.SnapshotStore(storage.createDirectory("snapshots"));
|
|
3510
|
+
this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
|
|
3456
3511
|
this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
|
|
3457
3512
|
this.feedStore = new import_feed_store4.FeedStore({
|
|
3458
3513
|
factory: new import_feed_store4.FeedFactory({
|
|
@@ -3466,13 +3521,14 @@ var ServiceContext = class {
|
|
|
3466
3521
|
this.spaceManager = new import_echo_pipeline3.SpaceManager({
|
|
3467
3522
|
feedStore: this.feedStore,
|
|
3468
3523
|
networkManager: this.networkManager,
|
|
3524
|
+
blobStore: this.blobStore,
|
|
3469
3525
|
metadataStore: this.metadataStore,
|
|
3470
3526
|
modelFactory: this.modelFactory,
|
|
3471
3527
|
snapshotStore: this.snapshotStore
|
|
3472
3528
|
});
|
|
3473
3529
|
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
|
|
3474
3530
|
this.invitations = new InvitationsHandler(this.networkManager);
|
|
3475
|
-
this._handlerFactories.set(
|
|
3531
|
+
this._handlerFactories.set(import_services11.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => {
|
|
3476
3532
|
var _a;
|
|
3477
3533
|
return (_a = this.identityManager.identity) != null ? _a : (0, import_debug6.failUndefined)();
|
|
3478
3534
|
}, this._acceptIdentity.bind(this)));
|
|
@@ -3482,14 +3538,14 @@ var ServiceContext = class {
|
|
|
3482
3538
|
id: this._instanceId
|
|
3483
3539
|
}), {
|
|
3484
3540
|
file: "service-context.ts",
|
|
3485
|
-
line:
|
|
3541
|
+
line: 126,
|
|
3486
3542
|
scope: this,
|
|
3487
3543
|
callSite: (f, a) => f(...a)
|
|
3488
3544
|
});
|
|
3489
3545
|
await this._checkStorageVersion();
|
|
3490
3546
|
(0, import_log14.log)("opening...", {}, {
|
|
3491
3547
|
file: "service-context.ts",
|
|
3492
|
-
line:
|
|
3548
|
+
line: 130,
|
|
3493
3549
|
scope: this,
|
|
3494
3550
|
callSite: (f, a) => f(...a)
|
|
3495
3551
|
});
|
|
@@ -3502,7 +3558,7 @@ var ServiceContext = class {
|
|
|
3502
3558
|
}
|
|
3503
3559
|
(0, import_log14.log)("opened", {}, {
|
|
3504
3560
|
file: "service-context.ts",
|
|
3505
|
-
line:
|
|
3561
|
+
line: 138,
|
|
3506
3562
|
scope: this,
|
|
3507
3563
|
callSite: (f, a) => f(...a)
|
|
3508
3564
|
});
|
|
@@ -3510,7 +3566,7 @@ var ServiceContext = class {
|
|
|
3510
3566
|
id: this._instanceId
|
|
3511
3567
|
}), {
|
|
3512
3568
|
file: "service-context.ts",
|
|
3513
|
-
line:
|
|
3569
|
+
line: 139,
|
|
3514
3570
|
scope: this,
|
|
3515
3571
|
callSite: (f, a) => f(...a)
|
|
3516
3572
|
});
|
|
@@ -3519,7 +3575,7 @@ var ServiceContext = class {
|
|
|
3519
3575
|
var _a, _b;
|
|
3520
3576
|
(0, import_log14.log)("closing...", {}, {
|
|
3521
3577
|
file: "service-context.ts",
|
|
3522
|
-
line:
|
|
3578
|
+
line: 143,
|
|
3523
3579
|
scope: this,
|
|
3524
3580
|
callSite: (f, a) => f(...a)
|
|
3525
3581
|
});
|
|
@@ -3533,7 +3589,7 @@ var ServiceContext = class {
|
|
|
3533
3589
|
this.dataServiceSubscriptions.clear();
|
|
3534
3590
|
(0, import_log14.log)("closed", {}, {
|
|
3535
3591
|
file: "service-context.ts",
|
|
3536
|
-
line:
|
|
3592
|
+
line: 152,
|
|
3537
3593
|
scope: this,
|
|
3538
3594
|
callSite: (f, a) => f(...a)
|
|
3539
3595
|
});
|
|
@@ -3564,7 +3620,7 @@ var ServiceContext = class {
|
|
|
3564
3620
|
var _a;
|
|
3565
3621
|
(0, import_log14.log)("initializing spaces...", {}, {
|
|
3566
3622
|
file: "service-context.ts",
|
|
3567
|
-
line:
|
|
3623
|
+
line: 185,
|
|
3568
3624
|
scope: this,
|
|
3569
3625
|
callSite: (f, a) => f(...a)
|
|
3570
3626
|
});
|
|
@@ -3584,7 +3640,7 @@ var ServiceContext = class {
|
|
|
3584
3640
|
};
|
|
3585
3641
|
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
|
|
3586
3642
|
await this.dataSpaceManager.open();
|
|
3587
|
-
this._handlerFactories.set(
|
|
3643
|
+
this._handlerFactories.set(import_services11.Invitation.Kind.SPACE, (invitation) => {
|
|
3588
3644
|
(0, import_node_assert11.default)(this.dataSpaceManager, "dataSpaceManager not initialized yet");
|
|
3589
3645
|
return new SpaceInvitationProtocol(this.dataSpaceManager, signingContext, this.keyring, invitation.spaceKey);
|
|
3590
3646
|
});
|
|
@@ -3603,7 +3659,7 @@ var ServiceContext = class {
|
|
|
3603
3659
|
details: assertion
|
|
3604
3660
|
}, {
|
|
3605
3661
|
file: "service-context.ts",
|
|
3606
|
-
line:
|
|
3662
|
+
line: 224,
|
|
3607
3663
|
scope: this,
|
|
3608
3664
|
callSite: (f, a) => f(...a)
|
|
3609
3665
|
});
|
|
@@ -3614,7 +3670,7 @@ var ServiceContext = class {
|
|
|
3614
3670
|
details: assertion
|
|
3615
3671
|
}, {
|
|
3616
3672
|
file: "service-context.ts",
|
|
3617
|
-
line:
|
|
3673
|
+
line: 228,
|
|
3618
3674
|
scope: this,
|
|
3619
3675
|
callSite: (f, a) => f(...a)
|
|
3620
3676
|
});
|
|
@@ -3625,7 +3681,7 @@ var ServiceContext = class {
|
|
|
3625
3681
|
details: assertion
|
|
3626
3682
|
}, {
|
|
3627
3683
|
file: "service-context.ts",
|
|
3628
|
-
line:
|
|
3684
|
+
line: 233,
|
|
3629
3685
|
scope: this,
|
|
3630
3686
|
callSite: (f, a) => f(...a)
|
|
3631
3687
|
});
|
|
@@ -3636,7 +3692,7 @@ var ServiceContext = class {
|
|
|
3636
3692
|
} catch (err) {
|
|
3637
3693
|
import_log14.log.catch(err, {}, {
|
|
3638
3694
|
file: "service-context.ts",
|
|
3639
|
-
line:
|
|
3695
|
+
line: 239,
|
|
3640
3696
|
scope: this,
|
|
3641
3697
|
callSite: (f, a) => f(...a)
|
|
3642
3698
|
});
|
|
@@ -3710,12 +3766,12 @@ var ClientServicesHost = class {
|
|
|
3710
3766
|
this._systemService = new SystemServiceImpl({
|
|
3711
3767
|
config: this._config,
|
|
3712
3768
|
statusUpdate: this._statusUpdate,
|
|
3713
|
-
getCurrentStatus: () => this.isOpen ?
|
|
3769
|
+
getCurrentStatus: () => this.isOpen ? import_services12.SystemStatus.ACTIVE : import_services12.SystemStatus.INACTIVE,
|
|
3714
3770
|
onUpdateStatus: async (status) => {
|
|
3715
3771
|
var _a, _b;
|
|
3716
|
-
if (!this.isOpen && status ===
|
|
3772
|
+
if (!this.isOpen && status === import_services12.SystemStatus.ACTIVE) {
|
|
3717
3773
|
await ((_a = this._resourceLock) == null ? void 0 : _a.acquire());
|
|
3718
|
-
} else if (this.isOpen && status ===
|
|
3774
|
+
} else if (this.isOpen && status === import_services12.SystemStatus.INACTIVE) {
|
|
3719
3775
|
await ((_b = this._resourceLock) == null ? void 0 : _b.release());
|
|
3720
3776
|
}
|
|
3721
3777
|
},
|