@dxos/client-services 0.1.51-main.e7215ae → 0.1.51-next.03aa1a8
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-ARBZHWMK.mjs} +89 -40
- package/dist/lib/browser/chunk-ARBZHWMK.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/index.cjs +106 -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 +123 -74
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- 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/spaces/data-space-manager.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/package.json +30 -30
- package/src/packlets/devtools/feeds.ts +1 -0
- package/src/packlets/identity/identity-manager.ts +4 -1
- package/src/packlets/identity/identity.test.ts +9 -3
- package/src/packlets/logging/logging-service.ts +58 -15
- package/src/packlets/spaces/data-space-manager.test.ts +64 -1
- package/src/packlets/spaces/data-space-manager.ts +2 -1
- package/src/packlets/spaces/data-space.ts +8 -3
- package/src/packlets/spaces/spaces-service.ts +7 -0
- package/dist/lib/browser/chunk-5W2L64HI.mjs.map +0 -7
|
@@ -20,11 +20,15 @@ var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
next({
|
|
23
|
-
feeds: Array.from(feedMap.values()).map((feed) =>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
feeds: Array.from(feedMap.values()).map((feed) => {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
return {
|
|
26
|
+
feedKey: feed.key,
|
|
27
|
+
length: feed.properties.length,
|
|
28
|
+
bytes: feed.core.byteLength,
|
|
29
|
+
downloaded: (_b = (_a = feed.core.bitfield) == null ? void 0 : _a.data.toBuffer()) != null ? _b : new Uint8Array()
|
|
30
|
+
};
|
|
31
|
+
})
|
|
28
32
|
});
|
|
29
33
|
};
|
|
30
34
|
subscriptions.add(feedStore.feedOpened.on(update));
|
|
@@ -800,7 +804,8 @@ var IdentityManager = class {
|
|
|
800
804
|
});
|
|
801
805
|
assert2(identityRecord.haloSpace.dataFeedKey);
|
|
802
806
|
const dataFeed = await this._feedStore.openFeed(identityRecord.haloSpace.dataFeedKey, {
|
|
803
|
-
writable: true
|
|
807
|
+
writable: true,
|
|
808
|
+
sparse: true
|
|
804
809
|
});
|
|
805
810
|
const space = await this._constructSpace({
|
|
806
811
|
spaceRecord: identityRecord.haloSpace,
|
|
@@ -823,7 +828,7 @@ var IdentityManager = class {
|
|
|
823
828
|
identityKey: identityRecord.identityKey
|
|
824
829
|
}, {
|
|
825
830
|
file: "identity-manager.ts",
|
|
826
|
-
line:
|
|
831
|
+
line: 226,
|
|
827
832
|
scope: this,
|
|
828
833
|
callSite: (f, a) => f(...a)
|
|
829
834
|
});
|
|
@@ -844,7 +849,7 @@ var IdentityManager = class {
|
|
|
844
849
|
onAuthFailure: () => {
|
|
845
850
|
log3.warn("auth failure", {}, {
|
|
846
851
|
file: "identity-manager.ts",
|
|
847
|
-
line:
|
|
852
|
+
line: 245,
|
|
848
853
|
scope: this,
|
|
849
854
|
callSite: (f, a) => f(...a)
|
|
850
855
|
});
|
|
@@ -2198,6 +2203,7 @@ import { PublicKey as PublicKey7 } from "@dxos/keys";
|
|
|
2198
2203
|
import { log as log10 } from "@dxos/log";
|
|
2199
2204
|
import { SpaceState } from "@dxos/protocols/proto/dxos/client/services";
|
|
2200
2205
|
import { AdmittedFeed as AdmittedFeed3 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
2206
|
+
import { Timeframe } from "@dxos/timeframe";
|
|
2201
2207
|
import { ComplexSet as ComplexSet2 } from "@dxos/util";
|
|
2202
2208
|
|
|
2203
2209
|
// packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
|
|
@@ -2540,7 +2546,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2540
2546
|
if (err instanceof CancelledError) {
|
|
2541
2547
|
log10("Data pipeline initialization cancelled", err, {
|
|
2542
2548
|
file: "data-space.ts",
|
|
2543
|
-
line:
|
|
2549
|
+
line: 173,
|
|
2544
2550
|
scope: this,
|
|
2545
2551
|
callSite: (f, a) => f(...a)
|
|
2546
2552
|
});
|
|
@@ -2548,7 +2554,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2548
2554
|
}
|
|
2549
2555
|
log10.error("Error initializing data pipeline", err, {
|
|
2550
2556
|
file: "data-space.ts",
|
|
2551
|
-
line:
|
|
2557
|
+
line: 177,
|
|
2552
2558
|
scope: this,
|
|
2553
2559
|
callSite: (f, a) => f(...a)
|
|
2554
2560
|
});
|
|
@@ -2629,7 +2635,8 @@ var DataSpace = class DataSpace2 {
|
|
|
2629
2635
|
}
|
|
2630
2636
|
if (!this.inner.dataFeedKey) {
|
|
2631
2637
|
const dataFeed = await this._feedStore.openFeed(await this._keyring.createKey(), {
|
|
2632
|
-
writable: true
|
|
2638
|
+
writable: true,
|
|
2639
|
+
sparse: true
|
|
2633
2640
|
});
|
|
2634
2641
|
this.inner.setDataFeed(dataFeed);
|
|
2635
2642
|
credentials.push(await this._signingContext.credentialSigner.createCredential({
|
|
@@ -2655,7 +2662,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2655
2662
|
async createEpoch() {
|
|
2656
2663
|
var _a, _b;
|
|
2657
2664
|
const epoch = await this.dataPipeline.createEpoch();
|
|
2658
|
-
await this.inner.controlPipeline.writer.write({
|
|
2665
|
+
const receipt = await this.inner.controlPipeline.writer.write({
|
|
2659
2666
|
credential: {
|
|
2660
2667
|
credential: await this._signingContext.credentialSigner.createCredential({
|
|
2661
2668
|
subject: this.key,
|
|
@@ -2666,6 +2673,12 @@ var DataSpace = class DataSpace2 {
|
|
|
2666
2673
|
})
|
|
2667
2674
|
}
|
|
2668
2675
|
});
|
|
2676
|
+
await this.inner.controlPipeline.state.waitUntilTimeframe(new Timeframe([
|
|
2677
|
+
[
|
|
2678
|
+
receipt.feedKey,
|
|
2679
|
+
receipt.seq
|
|
2680
|
+
]
|
|
2681
|
+
]));
|
|
2669
2682
|
for (const feed of (_b = (_a = this.inner.dataPipeline.pipelineState) == null ? void 0 : _a.feeds) != null ? _b : []) {
|
|
2670
2683
|
const indexBeforeEpoch = epoch.timeframe.get(feed.key);
|
|
2671
2684
|
if (indexBeforeEpoch) {
|
|
@@ -2697,7 +2710,7 @@ import { ComplexMap as ComplexMap3, deferFunction as deferFunction2 } from "@dxo
|
|
|
2697
2710
|
import { createCredential } from "@dxos/credentials";
|
|
2698
2711
|
import { failUndefined as failUndefined2 } from "@dxos/debug";
|
|
2699
2712
|
import { AdmittedFeed as AdmittedFeed4, SpaceMember } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
2700
|
-
import { Timeframe } from "@dxos/timeframe";
|
|
2713
|
+
import { Timeframe as Timeframe2 } from "@dxos/timeframe";
|
|
2701
2714
|
var spaceGenesis = async (keyring, signingContext, space) => {
|
|
2702
2715
|
var _a, _b, _c, _d;
|
|
2703
2716
|
const credentials = [
|
|
@@ -2748,7 +2761,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
|
|
|
2748
2761
|
"@type": "dxos.halo.credentials.Epoch",
|
|
2749
2762
|
number: 0,
|
|
2750
2763
|
previousId: void 0,
|
|
2751
|
-
timeframe: new
|
|
2764
|
+
timeframe: new Timeframe2(),
|
|
2752
2765
|
snapshotCid: void 0
|
|
2753
2766
|
}
|
|
2754
2767
|
})
|
|
@@ -2953,7 +2966,8 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2953
2966
|
writable: true
|
|
2954
2967
|
});
|
|
2955
2968
|
const dataFeed = metadata.dataFeedKey && await this._feedStore.openFeed(metadata.dataFeedKey, {
|
|
2956
|
-
writable: true
|
|
2969
|
+
writable: true,
|
|
2970
|
+
sparse: true
|
|
2957
2971
|
});
|
|
2958
2972
|
const space = await this._spaceManager.constructSpace({
|
|
2959
2973
|
metadata,
|
|
@@ -2972,7 +2986,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2972
2986
|
onAuthFailure: () => {
|
|
2973
2987
|
log11.warn("auth failure", {}, {
|
|
2974
2988
|
file: "data-space-manager.ts",
|
|
2975
|
-
line:
|
|
2989
|
+
line: 213,
|
|
2976
2990
|
scope: this,
|
|
2977
2991
|
callSite: (f, a) => f(...a)
|
|
2978
2992
|
});
|
|
@@ -2995,7 +3009,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2995
3009
|
space: space.key
|
|
2996
3010
|
}, {
|
|
2997
3011
|
file: "data-space-manager.ts",
|
|
2998
|
-
line:
|
|
3012
|
+
line: 230,
|
|
2999
3013
|
scope: this,
|
|
3000
3014
|
callSite: (f, a) => f(...a)
|
|
3001
3015
|
});
|
|
@@ -3007,7 +3021,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3007
3021
|
open: this._isOpen
|
|
3008
3022
|
}, {
|
|
3009
3023
|
file: "data-space-manager.ts",
|
|
3010
|
-
line:
|
|
3024
|
+
line: 237,
|
|
3011
3025
|
scope: this,
|
|
3012
3026
|
callSite: (f, a) => f(...a)
|
|
3013
3027
|
});
|
|
@@ -3082,7 +3096,7 @@ var SpacesServiceImpl = class {
|
|
|
3082
3096
|
spaces
|
|
3083
3097
|
}, {
|
|
3084
3098
|
file: "spaces-service.ts",
|
|
3085
|
-
line:
|
|
3099
|
+
line: 60,
|
|
3086
3100
|
scope: this,
|
|
3087
3101
|
callSite: (f, a) => f(...a)
|
|
3088
3102
|
});
|
|
@@ -3099,6 +3113,7 @@ var SpacesServiceImpl = class {
|
|
|
3099
3113
|
for (const space of dataSpaceManager.spaces.values()) {
|
|
3100
3114
|
subscriptions.add(space.stateUpdate.on(ctx, onUpdate));
|
|
3101
3115
|
subscriptions.add(space.presence.updated.on(ctx, onUpdate));
|
|
3116
|
+
subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx, onUpdate));
|
|
3102
3117
|
space.inner.controlPipeline.state.timeframeUpdate.debounce(TIMEFRAME_UPDATE_DEBOUNCE_TIME).on(ctx, onUpdate);
|
|
3103
3118
|
if (space.dataPipeline.pipelineState) {
|
|
3104
3119
|
subscriptions.add(space.dataPipeline.pipelineState.timeframeUpdate.debounce(TIMEFRAME_UPDATE_DEBOUNCE_TIME).on(ctx, onUpdate));
|
|
@@ -3169,20 +3184,23 @@ var SpacesServiceImpl = class {
|
|
|
3169
3184
|
await space.createEpoch();
|
|
3170
3185
|
}
|
|
3171
3186
|
_transformSpace(space) {
|
|
3172
|
-
var _a, _b, _c, _d, _e;
|
|
3187
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
3173
3188
|
return {
|
|
3174
3189
|
spaceKey: space.key,
|
|
3175
3190
|
state: space.state,
|
|
3176
3191
|
error: space.error ? encodeError(space.error) : void 0,
|
|
3177
3192
|
pipeline: {
|
|
3193
|
+
currentEpoch: space.dataPipeline.currentEpoch,
|
|
3194
|
+
appliedEpoch: space.dataPipeline.appliedEpoch,
|
|
3178
3195
|
controlFeeds: space.inner.controlPipeline.state.feeds.map((feed) => feed.key),
|
|
3179
3196
|
currentControlTimeframe: space.inner.controlPipeline.state.timeframe,
|
|
3180
3197
|
targetControlTimeframe: space.inner.controlPipeline.state.targetTimeframe,
|
|
3181
3198
|
totalControlTimeframe: space.inner.controlPipeline.state.endTimeframe,
|
|
3182
3199
|
dataFeeds: (_b = (_a = space.dataPipeline.pipelineState) == null ? void 0 : _a.feeds.map((feed) => feed.key)) != null ? _b : [],
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3200
|
+
startDataTimeframe: (_c = space.dataPipeline.pipelineState) == null ? void 0 : _c.startTimeframe,
|
|
3201
|
+
currentDataTimeframe: (_d = space.dataPipeline.pipelineState) == null ? void 0 : _d.timeframe,
|
|
3202
|
+
targetDataTimeframe: (_e = space.dataPipeline.pipelineState) == null ? void 0 : _e.targetTimeframe,
|
|
3203
|
+
totalDataTimeframe: (_f = space.dataPipeline.pipelineState) == null ? void 0 : _f.endTimeframe
|
|
3186
3204
|
},
|
|
3187
3205
|
members: Array.from(space.inner.spaceState.members.values()).map((member) => {
|
|
3188
3206
|
var _a2, _b2, _c2;
|
|
@@ -3196,6 +3214,7 @@ var SpacesServiceImpl = class {
|
|
|
3196
3214
|
presence: ((_c2 = this._identityManager.identity) == null ? void 0 : _c2.identityKey.equals(member.key)) || space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ? SpaceMember2.PresenceState.ONLINE : SpaceMember2.PresenceState.OFFLINE
|
|
3197
3215
|
};
|
|
3198
3216
|
}),
|
|
3217
|
+
creator: (_g = space.inner.spaceState.creator) == null ? void 0 : _g.key,
|
|
3199
3218
|
cache: space.cache,
|
|
3200
3219
|
metrics: space.metrics
|
|
3201
3220
|
};
|
|
@@ -3557,7 +3576,8 @@ var DevicesServiceImpl = class {
|
|
|
3557
3576
|
// packages/sdk/client-services/src/packlets/logging/logging-service.ts
|
|
3558
3577
|
import { Event as Event7 } from "@dxos/async";
|
|
3559
3578
|
import { Stream as Stream11 } from "@dxos/codec-protobuf";
|
|
3560
|
-
import { log as log14
|
|
3579
|
+
import { getContextFromEntry, log as log14 } from "@dxos/log";
|
|
3580
|
+
import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
|
|
3561
3581
|
import { jsonify } from "@dxos/util";
|
|
3562
3582
|
var LoggingServiceImpl = class {
|
|
3563
3583
|
constructor() {
|
|
@@ -3574,31 +3594,60 @@ var LoggingServiceImpl = class {
|
|
|
3574
3594
|
log14.runtimeConfig.processors.splice(index, 1);
|
|
3575
3595
|
}
|
|
3576
3596
|
queryLogs(request) {
|
|
3577
|
-
var _a;
|
|
3578
|
-
const filters = ((_a = request.filters) == null ? void 0 : _a.length) ? request.filters : void 0;
|
|
3579
3597
|
return new Stream11(({ ctx, next }) => {
|
|
3580
3598
|
const handler = (entry2) => {
|
|
3581
|
-
var
|
|
3582
|
-
if (
|
|
3599
|
+
var _a, _b, _c, _d, _e;
|
|
3600
|
+
if (LOG_PROCESSING > 0) {
|
|
3583
3601
|
return;
|
|
3584
3602
|
}
|
|
3585
|
-
if (
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3603
|
+
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"))) {
|
|
3604
|
+
return;
|
|
3605
|
+
}
|
|
3606
|
+
if (!shouldLog(entry2, request)) {
|
|
3607
|
+
return;
|
|
3608
|
+
}
|
|
3609
|
+
const record = {
|
|
3610
|
+
...entry2,
|
|
3611
|
+
context: jsonify(getContextFromEntry(entry2)),
|
|
3612
|
+
timestamp: new Date(),
|
|
3613
|
+
meta: {
|
|
3614
|
+
// TODO(dmaretskyi): Fix proto.
|
|
3615
|
+
file: (_c = (_b = entry2.meta) == null ? void 0 : _b.file) != null ? _c : "",
|
|
3616
|
+
line: (_e = (_d = entry2.meta) == null ? void 0 : _d.line) != null ? _e : 0
|
|
3617
|
+
}
|
|
3618
|
+
};
|
|
3619
|
+
try {
|
|
3620
|
+
LOG_PROCESSING++;
|
|
3592
3621
|
next(record);
|
|
3622
|
+
} finally {
|
|
3623
|
+
LOG_PROCESSING--;
|
|
3593
3624
|
}
|
|
3594
3625
|
};
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3626
|
+
this._logs.on(ctx, handler);
|
|
3627
|
+
});
|
|
3628
|
+
}
|
|
3629
|
+
};
|
|
3630
|
+
var matchFilter = (filter, level, path, options) => {
|
|
3631
|
+
switch (options) {
|
|
3632
|
+
case QueryLogsRequest.MatchingOptions.INCLUSIVE:
|
|
3633
|
+
return level >= filter.level && (!filter.pattern || path.includes(filter.pattern));
|
|
3634
|
+
case QueryLogsRequest.MatchingOptions.EXPLICIT:
|
|
3635
|
+
return level === filter.level && (!filter.pattern || path.includes(filter.pattern));
|
|
3636
|
+
}
|
|
3637
|
+
};
|
|
3638
|
+
var shouldLog = (entry2, request) => {
|
|
3639
|
+
var _a;
|
|
3640
|
+
const options = (_a = request.options) != null ? _a : QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
3641
|
+
if (request.filters === void 0) {
|
|
3642
|
+
return options === QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
3643
|
+
} else {
|
|
3644
|
+
return request.filters.some((filter) => {
|
|
3645
|
+
var _a2, _b;
|
|
3646
|
+
return matchFilter(filter, entry2.level, (_b = (_a2 = entry2.meta) == null ? void 0 : _a2.file) != null ? _b : "", options);
|
|
3599
3647
|
});
|
|
3600
3648
|
}
|
|
3601
3649
|
};
|
|
3650
|
+
var LOG_PROCESSING = 0;
|
|
3602
3651
|
|
|
3603
3652
|
// packages/sdk/client-services/src/packlets/network/network-service.ts
|
|
3604
3653
|
import { Stream as Stream12 } from "@dxos/codec-protobuf";
|
|
@@ -3955,4 +4004,4 @@ export {
|
|
|
3955
4004
|
ClientServicesHost,
|
|
3956
4005
|
LocalClientServices
|
|
3957
4006
|
};
|
|
3958
|
-
//# sourceMappingURL=chunk-
|
|
4007
|
+
//# sourceMappingURL=chunk-ARBZHWMK.mjs.map
|