@dxos/client-services 0.1.51-next.57ad9f3 → 0.1.51
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-YPN5TDAA.mjs → chunk-2GQ7337P.mjs} +91 -44
- 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 +108 -61
- 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 +132 -79
- 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 -21
- 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.ts +2 -2
- package/src/packlets/spaces/data-space.ts +4 -1
- package/src/packlets/spaces/spaces-service.ts +3 -0
- package/src/packlets/testing/test-builder.ts +7 -0
- package/dist/lib/browser/chunk-YPN5TDAA.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));
|
|
@@ -260,6 +264,11 @@ var DevtoolsServiceImpl = class {
|
|
|
260
264
|
usageQuota: (_e = navigatorInfo == null ? void 0 : navigatorInfo.quota) != null ? _e : 0
|
|
261
265
|
};
|
|
262
266
|
}
|
|
267
|
+
async getBlobs() {
|
|
268
|
+
return {
|
|
269
|
+
blobs: await this.params.context.blobStore.list()
|
|
270
|
+
};
|
|
271
|
+
}
|
|
263
272
|
async getSnapshots() {
|
|
264
273
|
return {
|
|
265
274
|
snapshots: await this.params.context.snapshotStore.listSnapshots()
|
|
@@ -800,7 +809,8 @@ var IdentityManager = class {
|
|
|
800
809
|
});
|
|
801
810
|
assert2(identityRecord.haloSpace.dataFeedKey);
|
|
802
811
|
const dataFeed = await this._feedStore.openFeed(identityRecord.haloSpace.dataFeedKey, {
|
|
803
|
-
writable: true
|
|
812
|
+
writable: true,
|
|
813
|
+
sparse: true
|
|
804
814
|
});
|
|
805
815
|
const space = await this._constructSpace({
|
|
806
816
|
spaceRecord: identityRecord.haloSpace,
|
|
@@ -823,7 +833,7 @@ var IdentityManager = class {
|
|
|
823
833
|
identityKey: identityRecord.identityKey
|
|
824
834
|
}, {
|
|
825
835
|
file: "identity-manager.ts",
|
|
826
|
-
line:
|
|
836
|
+
line: 226,
|
|
827
837
|
scope: this,
|
|
828
838
|
callSite: (f, a) => f(...a)
|
|
829
839
|
});
|
|
@@ -844,7 +854,7 @@ var IdentityManager = class {
|
|
|
844
854
|
onAuthFailure: () => {
|
|
845
855
|
log3.warn("auth failure", {}, {
|
|
846
856
|
file: "identity-manager.ts",
|
|
847
|
-
line:
|
|
857
|
+
line: 245,
|
|
848
858
|
scope: this,
|
|
849
859
|
callSite: (f, a) => f(...a)
|
|
850
860
|
});
|
|
@@ -2630,7 +2640,8 @@ var DataSpace = class DataSpace2 {
|
|
|
2630
2640
|
}
|
|
2631
2641
|
if (!this.inner.dataFeedKey) {
|
|
2632
2642
|
const dataFeed = await this._feedStore.openFeed(await this._keyring.createKey(), {
|
|
2633
|
-
writable: true
|
|
2643
|
+
writable: true,
|
|
2644
|
+
sparse: true
|
|
2634
2645
|
});
|
|
2635
2646
|
this.inner.setDataFeed(dataFeed);
|
|
2636
2647
|
credentials.push(await this._signingContext.credentialSigner.createCredential({
|
|
@@ -2960,7 +2971,8 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2960
2971
|
writable: true
|
|
2961
2972
|
});
|
|
2962
2973
|
const dataFeed = metadata.dataFeedKey && await this._feedStore.openFeed(metadata.dataFeedKey, {
|
|
2963
|
-
writable: true
|
|
2974
|
+
writable: true,
|
|
2975
|
+
sparse: true
|
|
2964
2976
|
});
|
|
2965
2977
|
const space = await this._spaceManager.constructSpace({
|
|
2966
2978
|
metadata,
|
|
@@ -2973,7 +2985,6 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2973
2985
|
session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
|
|
2974
2986
|
remotePeerId: session.remotePeerId
|
|
2975
2987
|
}));
|
|
2976
|
-
session.addExtension("dxos.mesh.teleport.objectsync", space.snapshotManager.objectSync.createExtension());
|
|
2977
2988
|
session.addExtension("dxos.mesh.teleport.notarization", dataSpace.notarizationPlugin.createExtension());
|
|
2978
2989
|
},
|
|
2979
2990
|
onAuthFailure: () => {
|
|
@@ -3106,6 +3117,7 @@ var SpacesServiceImpl = class {
|
|
|
3106
3117
|
for (const space of dataSpaceManager.spaces.values()) {
|
|
3107
3118
|
subscriptions.add(space.stateUpdate.on(ctx, onUpdate));
|
|
3108
3119
|
subscriptions.add(space.presence.updated.on(ctx, onUpdate));
|
|
3120
|
+
subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx, onUpdate));
|
|
3109
3121
|
space.inner.controlPipeline.state.timeframeUpdate.debounce(TIMEFRAME_UPDATE_DEBOUNCE_TIME).on(ctx, onUpdate);
|
|
3110
3122
|
if (space.dataPipeline.pipelineState) {
|
|
3111
3123
|
subscriptions.add(space.dataPipeline.pipelineState.timeframeUpdate.debounce(TIMEFRAME_UPDATE_DEBOUNCE_TIME).on(ctx, onUpdate));
|
|
@@ -3176,21 +3188,23 @@ var SpacesServiceImpl = class {
|
|
|
3176
3188
|
await space.createEpoch();
|
|
3177
3189
|
}
|
|
3178
3190
|
_transformSpace(space) {
|
|
3179
|
-
var _a, _b, _c, _d, _e, _f;
|
|
3191
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
3180
3192
|
return {
|
|
3181
3193
|
spaceKey: space.key,
|
|
3182
3194
|
state: space.state,
|
|
3183
3195
|
error: space.error ? encodeError(space.error) : void 0,
|
|
3184
3196
|
pipeline: {
|
|
3185
3197
|
currentEpoch: space.dataPipeline.currentEpoch,
|
|
3198
|
+
appliedEpoch: space.dataPipeline.appliedEpoch,
|
|
3186
3199
|
controlFeeds: space.inner.controlPipeline.state.feeds.map((feed) => feed.key),
|
|
3187
3200
|
currentControlTimeframe: space.inner.controlPipeline.state.timeframe,
|
|
3188
3201
|
targetControlTimeframe: space.inner.controlPipeline.state.targetTimeframe,
|
|
3189
3202
|
totalControlTimeframe: space.inner.controlPipeline.state.endTimeframe,
|
|
3190
3203
|
dataFeeds: (_b = (_a = space.dataPipeline.pipelineState) == null ? void 0 : _a.feeds.map((feed) => feed.key)) != null ? _b : [],
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3204
|
+
startDataTimeframe: (_c = space.dataPipeline.pipelineState) == null ? void 0 : _c.startTimeframe,
|
|
3205
|
+
currentDataTimeframe: (_d = space.dataPipeline.pipelineState) == null ? void 0 : _d.timeframe,
|
|
3206
|
+
targetDataTimeframe: (_e = space.dataPipeline.pipelineState) == null ? void 0 : _e.targetTimeframe,
|
|
3207
|
+
totalDataTimeframe: (_f = space.dataPipeline.pipelineState) == null ? void 0 : _f.endTimeframe
|
|
3194
3208
|
},
|
|
3195
3209
|
members: Array.from(space.inner.spaceState.members.values()).map((member) => {
|
|
3196
3210
|
var _a2, _b2, _c2;
|
|
@@ -3204,7 +3218,7 @@ var SpacesServiceImpl = class {
|
|
|
3204
3218
|
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
|
|
3205
3219
|
};
|
|
3206
3220
|
}),
|
|
3207
|
-
creator: (
|
|
3221
|
+
creator: (_g = space.inner.spaceState.creator) == null ? void 0 : _g.key,
|
|
3208
3222
|
cache: space.cache,
|
|
3209
3223
|
metrics: space.metrics
|
|
3210
3224
|
};
|
|
@@ -3273,6 +3287,7 @@ import { PublicKey as PublicKey9 } from "@dxos/keys";
|
|
|
3273
3287
|
import { log as log13 } from "@dxos/log";
|
|
3274
3288
|
import { STORAGE_VERSION, trace as trace5 } from "@dxos/protocols";
|
|
3275
3289
|
import { Invitation as Invitation5 } from "@dxos/protocols/proto/dxos/client/services";
|
|
3290
|
+
import { BlobStore } from "@dxos/teleport-extension-object-sync";
|
|
3276
3291
|
var ServiceContext = class {
|
|
3277
3292
|
// prettier-ignore
|
|
3278
3293
|
constructor(storage, networkManager, signalManager, modelFactory) {
|
|
@@ -3286,6 +3301,7 @@ var ServiceContext = class {
|
|
|
3286
3301
|
this._instanceId = PublicKey9.random().toHex();
|
|
3287
3302
|
this.metadataStore = new MetadataStore(storage.createDirectory("metadata"));
|
|
3288
3303
|
this.snapshotStore = new SnapshotStore(storage.createDirectory("snapshots"));
|
|
3304
|
+
this.blobStore = new BlobStore(storage.createDirectory("blobs"));
|
|
3289
3305
|
this.keyring = new Keyring(storage.createDirectory("keyring"));
|
|
3290
3306
|
this.feedStore = new FeedStore({
|
|
3291
3307
|
factory: new FeedFactory({
|
|
@@ -3299,6 +3315,7 @@ var ServiceContext = class {
|
|
|
3299
3315
|
this.spaceManager = new SpaceManager({
|
|
3300
3316
|
feedStore: this.feedStore,
|
|
3301
3317
|
networkManager: this.networkManager,
|
|
3318
|
+
blobStore: this.blobStore,
|
|
3302
3319
|
metadataStore: this.metadataStore,
|
|
3303
3320
|
modelFactory: this.modelFactory,
|
|
3304
3321
|
snapshotStore: this.snapshotStore
|
|
@@ -3315,14 +3332,14 @@ var ServiceContext = class {
|
|
|
3315
3332
|
id: this._instanceId
|
|
3316
3333
|
}), {
|
|
3317
3334
|
file: "service-context.ts",
|
|
3318
|
-
line:
|
|
3335
|
+
line: 126,
|
|
3319
3336
|
scope: this,
|
|
3320
3337
|
callSite: (f, a) => f(...a)
|
|
3321
3338
|
});
|
|
3322
3339
|
await this._checkStorageVersion();
|
|
3323
3340
|
log13("opening...", {}, {
|
|
3324
3341
|
file: "service-context.ts",
|
|
3325
|
-
line:
|
|
3342
|
+
line: 130,
|
|
3326
3343
|
scope: this,
|
|
3327
3344
|
callSite: (f, a) => f(...a)
|
|
3328
3345
|
});
|
|
@@ -3335,7 +3352,7 @@ var ServiceContext = class {
|
|
|
3335
3352
|
}
|
|
3336
3353
|
log13("opened", {}, {
|
|
3337
3354
|
file: "service-context.ts",
|
|
3338
|
-
line:
|
|
3355
|
+
line: 138,
|
|
3339
3356
|
scope: this,
|
|
3340
3357
|
callSite: (f, a) => f(...a)
|
|
3341
3358
|
});
|
|
@@ -3343,7 +3360,7 @@ var ServiceContext = class {
|
|
|
3343
3360
|
id: this._instanceId
|
|
3344
3361
|
}), {
|
|
3345
3362
|
file: "service-context.ts",
|
|
3346
|
-
line:
|
|
3363
|
+
line: 139,
|
|
3347
3364
|
scope: this,
|
|
3348
3365
|
callSite: (f, a) => f(...a)
|
|
3349
3366
|
});
|
|
@@ -3352,7 +3369,7 @@ var ServiceContext = class {
|
|
|
3352
3369
|
var _a, _b;
|
|
3353
3370
|
log13("closing...", {}, {
|
|
3354
3371
|
file: "service-context.ts",
|
|
3355
|
-
line:
|
|
3372
|
+
line: 143,
|
|
3356
3373
|
scope: this,
|
|
3357
3374
|
callSite: (f, a) => f(...a)
|
|
3358
3375
|
});
|
|
@@ -3366,7 +3383,7 @@ var ServiceContext = class {
|
|
|
3366
3383
|
this.dataServiceSubscriptions.clear();
|
|
3367
3384
|
log13("closed", {}, {
|
|
3368
3385
|
file: "service-context.ts",
|
|
3369
|
-
line:
|
|
3386
|
+
line: 152,
|
|
3370
3387
|
scope: this,
|
|
3371
3388
|
callSite: (f, a) => f(...a)
|
|
3372
3389
|
});
|
|
@@ -3397,7 +3414,7 @@ var ServiceContext = class {
|
|
|
3397
3414
|
var _a;
|
|
3398
3415
|
log13("initializing spaces...", {}, {
|
|
3399
3416
|
file: "service-context.ts",
|
|
3400
|
-
line:
|
|
3417
|
+
line: 185,
|
|
3401
3418
|
scope: this,
|
|
3402
3419
|
callSite: (f, a) => f(...a)
|
|
3403
3420
|
});
|
|
@@ -3436,7 +3453,7 @@ var ServiceContext = class {
|
|
|
3436
3453
|
details: assertion
|
|
3437
3454
|
}, {
|
|
3438
3455
|
file: "service-context.ts",
|
|
3439
|
-
line:
|
|
3456
|
+
line: 224,
|
|
3440
3457
|
scope: this,
|
|
3441
3458
|
callSite: (f, a) => f(...a)
|
|
3442
3459
|
});
|
|
@@ -3447,7 +3464,7 @@ var ServiceContext = class {
|
|
|
3447
3464
|
details: assertion
|
|
3448
3465
|
}, {
|
|
3449
3466
|
file: "service-context.ts",
|
|
3450
|
-
line:
|
|
3467
|
+
line: 228,
|
|
3451
3468
|
scope: this,
|
|
3452
3469
|
callSite: (f, a) => f(...a)
|
|
3453
3470
|
});
|
|
@@ -3458,7 +3475,7 @@ var ServiceContext = class {
|
|
|
3458
3475
|
details: assertion
|
|
3459
3476
|
}, {
|
|
3460
3477
|
file: "service-context.ts",
|
|
3461
|
-
line:
|
|
3478
|
+
line: 233,
|
|
3462
3479
|
scope: this,
|
|
3463
3480
|
callSite: (f, a) => f(...a)
|
|
3464
3481
|
});
|
|
@@ -3469,7 +3486,7 @@ var ServiceContext = class {
|
|
|
3469
3486
|
} catch (err) {
|
|
3470
3487
|
log13.catch(err, {}, {
|
|
3471
3488
|
file: "service-context.ts",
|
|
3472
|
-
line:
|
|
3489
|
+
line: 239,
|
|
3473
3490
|
scope: this,
|
|
3474
3491
|
callSite: (f, a) => f(...a)
|
|
3475
3492
|
});
|
|
@@ -3566,7 +3583,8 @@ var DevicesServiceImpl = class {
|
|
|
3566
3583
|
// packages/sdk/client-services/src/packlets/logging/logging-service.ts
|
|
3567
3584
|
import { Event as Event7 } from "@dxos/async";
|
|
3568
3585
|
import { Stream as Stream11 } from "@dxos/codec-protobuf";
|
|
3569
|
-
import { log as log14
|
|
3586
|
+
import { getContextFromEntry, log as log14 } from "@dxos/log";
|
|
3587
|
+
import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
|
|
3570
3588
|
import { jsonify } from "@dxos/util";
|
|
3571
3589
|
var LoggingServiceImpl = class {
|
|
3572
3590
|
constructor() {
|
|
@@ -3583,31 +3601,60 @@ var LoggingServiceImpl = class {
|
|
|
3583
3601
|
log14.runtimeConfig.processors.splice(index, 1);
|
|
3584
3602
|
}
|
|
3585
3603
|
queryLogs(request) {
|
|
3586
|
-
var _a;
|
|
3587
|
-
const filters = ((_a = request.filters) == null ? void 0 : _a.length) ? request.filters : void 0;
|
|
3588
3604
|
return new Stream11(({ ctx, next }) => {
|
|
3589
3605
|
const handler = (entry2) => {
|
|
3590
|
-
var
|
|
3591
|
-
if (
|
|
3606
|
+
var _a, _b, _c, _d, _e;
|
|
3607
|
+
if (LOG_PROCESSING > 0) {
|
|
3592
3608
|
return;
|
|
3593
3609
|
}
|
|
3594
|
-
if (
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3610
|
+
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"))) {
|
|
3611
|
+
return;
|
|
3612
|
+
}
|
|
3613
|
+
if (!shouldLog(entry2, request)) {
|
|
3614
|
+
return;
|
|
3615
|
+
}
|
|
3616
|
+
const record = {
|
|
3617
|
+
...entry2,
|
|
3618
|
+
context: jsonify(getContextFromEntry(entry2)),
|
|
3619
|
+
timestamp: new Date(),
|
|
3620
|
+
meta: {
|
|
3621
|
+
// TODO(dmaretskyi): Fix proto.
|
|
3622
|
+
file: (_c = (_b = entry2.meta) == null ? void 0 : _b.file) != null ? _c : "",
|
|
3623
|
+
line: (_e = (_d = entry2.meta) == null ? void 0 : _d.line) != null ? _e : 0
|
|
3624
|
+
}
|
|
3625
|
+
};
|
|
3626
|
+
try {
|
|
3627
|
+
LOG_PROCESSING++;
|
|
3601
3628
|
next(record);
|
|
3629
|
+
} finally {
|
|
3630
|
+
LOG_PROCESSING--;
|
|
3602
3631
|
}
|
|
3603
3632
|
};
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3633
|
+
this._logs.on(ctx, handler);
|
|
3634
|
+
});
|
|
3635
|
+
}
|
|
3636
|
+
};
|
|
3637
|
+
var matchFilter = (filter, level, path, options) => {
|
|
3638
|
+
switch (options) {
|
|
3639
|
+
case QueryLogsRequest.MatchingOptions.INCLUSIVE:
|
|
3640
|
+
return level >= filter.level && (!filter.pattern || path.includes(filter.pattern));
|
|
3641
|
+
case QueryLogsRequest.MatchingOptions.EXPLICIT:
|
|
3642
|
+
return level === filter.level && (!filter.pattern || path.includes(filter.pattern));
|
|
3643
|
+
}
|
|
3644
|
+
};
|
|
3645
|
+
var shouldLog = (entry2, request) => {
|
|
3646
|
+
var _a;
|
|
3647
|
+
const options = (_a = request.options) != null ? _a : QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
3648
|
+
if (request.filters === void 0) {
|
|
3649
|
+
return options === QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
3650
|
+
} else {
|
|
3651
|
+
return request.filters.some((filter) => {
|
|
3652
|
+
var _a2, _b;
|
|
3653
|
+
return matchFilter(filter, entry2.level, (_b = (_a2 = entry2.meta) == null ? void 0 : _a2.file) != null ? _b : "", options);
|
|
3608
3654
|
});
|
|
3609
3655
|
}
|
|
3610
3656
|
};
|
|
3657
|
+
var LOG_PROCESSING = 0;
|
|
3611
3658
|
|
|
3612
3659
|
// packages/sdk/client-services/src/packlets/network/network-service.ts
|
|
3613
3660
|
import { Stream as Stream12 } from "@dxos/codec-protobuf";
|
|
@@ -3964,4 +4011,4 @@ export {
|
|
|
3964
4011
|
ClientServicesHost,
|
|
3965
4012
|
LocalClientServices
|
|
3966
4013
|
};
|
|
3967
|
-
//# sourceMappingURL=chunk-
|
|
4014
|
+
//# sourceMappingURL=chunk-2GQ7337P.mjs.map
|