@dxos/client-services 0.1.51-main.b7fee56 → 0.1.51-main.b9e09c2
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-YPN5TDAA.mjs} +17 -8
- package/dist/lib/browser/{chunk-5W2L64HI.mjs.map → chunk-YPN5TDAA.mjs.map} +3 -3
- 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 +16 -7
- 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 +16 -7
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- 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/identity/identity.test.ts +9 -3
- package/src/packlets/spaces/data-space-manager.test.ts +64 -1
- package/src/packlets/spaces/data-space.ts +4 -2
- package/src/packlets/spaces/spaces-service.ts +4 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-space.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/spaces/data-space.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAA4B,MAAM,aAAa,CAAC;AAK9D,OAAO,EAAE,aAAa,EAAE,KAAK,EAA0B,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEjG,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,UAAU,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAC7F,OAAO,EAAE,WAAW,EAAE,MAAM,s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AAQ,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,kBAAkB;IAMpE,iBAAiB,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,wBAAwB;IAajE,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE,uBAAuB,GAAG,MAAM,CAAC,UAAU,CAAC;IAcrE,gBAAgB,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,uBAAuB;IAOnE,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE,kBAAkB;IAMlD,OAAO,CAAC,eAAe;CAoCxB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/client-services",
|
|
3
|
-
"version": "0.1.51-main.
|
|
3
|
+
"version": "0.1.51-main.b9e09c2",
|
|
4
4
|
"description": "DXOS client services implementation",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -23,38 +23,38 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@types/lockfile": "^1.0.2",
|
|
25
25
|
"lockfile": "^1.0.4",
|
|
26
|
-
"@dxos/async": "0.1.51-main.
|
|
27
|
-
"@dxos/client-protocol": "0.1.51-main.
|
|
28
|
-
"@dxos/codec-protobuf": "0.1.51-main.
|
|
29
|
-
"@dxos/config": "0.1.51-main.
|
|
30
|
-
"@dxos/context": "0.1.51-main.
|
|
31
|
-
"@dxos/credentials": "0.1.51-main.
|
|
32
|
-
"@dxos/crypto": "0.1.51-main.
|
|
33
|
-
"@dxos/debug": "0.1.51-main.
|
|
34
|
-
"@dxos/document-model": "0.1.51-main.
|
|
35
|
-
"@dxos/echo-db": "0.1.51-main.
|
|
36
|
-
"@dxos/echo-pipeline": "0.1.51-main.
|
|
37
|
-
"@dxos/errors": "0.1.51-main.
|
|
38
|
-
"@dxos/feed-store": "0.1.51-main.
|
|
39
|
-
"@dxos/keyring": "0.1.51-main.
|
|
40
|
-
"@dxos/keys": "0.1.51-main.
|
|
41
|
-
"@dxos/log": "0.1.51-main.
|
|
42
|
-
"@dxos/messaging": "0.1.51-main.
|
|
43
|
-
"@dxos/model-factory": "0.1.51-main.
|
|
44
|
-
"@dxos/network-manager": "0.1.51-main.
|
|
45
|
-
"@dxos/node-std": "0.1.51-main.
|
|
46
|
-
"@dxos/protocols": "0.1.51-main.
|
|
47
|
-
"@dxos/random-access-storage": "0.1.51-main.
|
|
48
|
-
"@dxos/rpc": "0.1.51-main.
|
|
49
|
-
"@dxos/teleport": "0.1.51-main.
|
|
50
|
-
"@dxos/teleport-extension-gossip": "0.1.51-main.
|
|
51
|
-
"@dxos/text-model": "0.1.51-main.
|
|
52
|
-
"@dxos/timeframe": "0.1.51-main.
|
|
53
|
-
"@dxos/util": "0.1.51-main.
|
|
26
|
+
"@dxos/async": "0.1.51-main.b9e09c2",
|
|
27
|
+
"@dxos/client-protocol": "0.1.51-main.b9e09c2",
|
|
28
|
+
"@dxos/codec-protobuf": "0.1.51-main.b9e09c2",
|
|
29
|
+
"@dxos/config": "0.1.51-main.b9e09c2",
|
|
30
|
+
"@dxos/context": "0.1.51-main.b9e09c2",
|
|
31
|
+
"@dxos/credentials": "0.1.51-main.b9e09c2",
|
|
32
|
+
"@dxos/crypto": "0.1.51-main.b9e09c2",
|
|
33
|
+
"@dxos/debug": "0.1.51-main.b9e09c2",
|
|
34
|
+
"@dxos/document-model": "0.1.51-main.b9e09c2",
|
|
35
|
+
"@dxos/echo-db": "0.1.51-main.b9e09c2",
|
|
36
|
+
"@dxos/echo-pipeline": "0.1.51-main.b9e09c2",
|
|
37
|
+
"@dxos/errors": "0.1.51-main.b9e09c2",
|
|
38
|
+
"@dxos/feed-store": "0.1.51-main.b9e09c2",
|
|
39
|
+
"@dxos/keyring": "0.1.51-main.b9e09c2",
|
|
40
|
+
"@dxos/keys": "0.1.51-main.b9e09c2",
|
|
41
|
+
"@dxos/log": "0.1.51-main.b9e09c2",
|
|
42
|
+
"@dxos/messaging": "0.1.51-main.b9e09c2",
|
|
43
|
+
"@dxos/model-factory": "0.1.51-main.b9e09c2",
|
|
44
|
+
"@dxos/network-manager": "0.1.51-main.b9e09c2",
|
|
45
|
+
"@dxos/node-std": "0.1.51-main.b9e09c2",
|
|
46
|
+
"@dxos/protocols": "0.1.51-main.b9e09c2",
|
|
47
|
+
"@dxos/random-access-storage": "0.1.51-main.b9e09c2",
|
|
48
|
+
"@dxos/rpc": "0.1.51-main.b9e09c2",
|
|
49
|
+
"@dxos/teleport": "0.1.51-main.b9e09c2",
|
|
50
|
+
"@dxos/teleport-extension-gossip": "0.1.51-main.b9e09c2",
|
|
51
|
+
"@dxos/text-model": "0.1.51-main.b9e09c2",
|
|
52
|
+
"@dxos/timeframe": "0.1.51-main.b9e09c2",
|
|
53
|
+
"@dxos/util": "0.1.51-main.b9e09c2"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/readable-stream": "^2.3.9",
|
|
57
|
-
"@dxos/signal": "0.1.51-main.
|
|
57
|
+
"@dxos/signal": "0.1.51-main.b9e09c2"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
@@ -66,6 +66,8 @@ describe('identity/identity', () => {
|
|
|
66
66
|
}),
|
|
67
67
|
});
|
|
68
68
|
|
|
69
|
+
const metadata = new MetadataStore(createStorage({ type: StorageType.RAM }).createDirectory());
|
|
70
|
+
await metadata.setIdentityRecord({ haloSpace: { key: spaceKey }, identityKey, deviceKey });
|
|
69
71
|
const space: Space = new Space({
|
|
70
72
|
spaceKey,
|
|
71
73
|
protocol,
|
|
@@ -73,7 +75,7 @@ describe('identity/identity', () => {
|
|
|
73
75
|
feedProvider: (feedKey) => feedStore.openFeed(feedKey),
|
|
74
76
|
memberKey: identityKey,
|
|
75
77
|
modelFactory: createDefaultModelFactory(),
|
|
76
|
-
metadataStore:
|
|
78
|
+
metadataStore: metadata,
|
|
77
79
|
snapshotManager: new SnapshotManager(
|
|
78
80
|
new SnapshotStore(createStorage({ type: StorageType.RAM }).createDirectory()),
|
|
79
81
|
),
|
|
@@ -178,6 +180,8 @@ describe('identity/identity', () => {
|
|
|
178
180
|
}),
|
|
179
181
|
});
|
|
180
182
|
|
|
183
|
+
const metadata = new MetadataStore(createStorage({ type: StorageType.RAM }).createDirectory());
|
|
184
|
+
await metadata.setIdentityRecord({ haloSpace: { key: spaceKey }, identityKey, deviceKey });
|
|
181
185
|
const space = new Space({
|
|
182
186
|
spaceKey,
|
|
183
187
|
protocol,
|
|
@@ -185,7 +189,7 @@ describe('identity/identity', () => {
|
|
|
185
189
|
feedProvider: (feedKey) => feedStore.openFeed(feedKey),
|
|
186
190
|
memberKey: identityKey,
|
|
187
191
|
modelFactory: createDefaultModelFactory(),
|
|
188
|
-
metadataStore:
|
|
192
|
+
metadataStore: metadata,
|
|
189
193
|
snapshotManager: new SnapshotManager(
|
|
190
194
|
new SnapshotStore(createStorage({ type: StorageType.RAM }).createDirectory()),
|
|
191
195
|
),
|
|
@@ -263,6 +267,8 @@ describe('identity/identity', () => {
|
|
|
263
267
|
}),
|
|
264
268
|
});
|
|
265
269
|
|
|
270
|
+
const metadata = new MetadataStore(createStorage({ type: StorageType.RAM }).createDirectory());
|
|
271
|
+
await metadata.setIdentityRecord({ haloSpace: { key: spaceKey }, identityKey: identity1.identityKey, deviceKey });
|
|
266
272
|
const space = new Space({
|
|
267
273
|
spaceKey,
|
|
268
274
|
protocol,
|
|
@@ -270,7 +276,7 @@ describe('identity/identity', () => {
|
|
|
270
276
|
feedProvider: (feedKey) => feedStore.openFeed(feedKey),
|
|
271
277
|
memberKey: identityKey,
|
|
272
278
|
modelFactory: createDefaultModelFactory(),
|
|
273
|
-
metadataStore:
|
|
279
|
+
metadataStore: metadata,
|
|
274
280
|
snapshotManager: new SnapshotManager(
|
|
275
281
|
new SnapshotStore(createStorage({ type: StorageType.RAM }).createDirectory()),
|
|
276
282
|
),
|
|
@@ -6,11 +6,13 @@ import { expect } from 'chai';
|
|
|
6
6
|
import path from 'node:path';
|
|
7
7
|
|
|
8
8
|
import { latch } from '@dxos/async';
|
|
9
|
-
import { createAdmissionCredentials } from '@dxos/credentials';
|
|
9
|
+
import { SpecificCredential, createAdmissionCredentials } from '@dxos/credentials';
|
|
10
10
|
import { AuthStatus, DataServiceSubscriptions } from '@dxos/echo-pipeline';
|
|
11
11
|
import { testLocalDatabase } from '@dxos/echo-pipeline/testing';
|
|
12
12
|
import { writeMessages } from '@dxos/feed-store';
|
|
13
|
+
import { PublicKey } from '@dxos/keys';
|
|
13
14
|
import { log } from '@dxos/log';
|
|
15
|
+
import { Epoch } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
14
16
|
import { StorageType } from '@dxos/random-access-storage';
|
|
15
17
|
import { afterTest, describe, test } from '@dxos/test';
|
|
16
18
|
import { range } from '@dxos/util';
|
|
@@ -233,5 +235,66 @@ describe('DataSpaceManager', () => {
|
|
|
233
235
|
await space.createEpoch();
|
|
234
236
|
expect((await file.stat()).size === 0).to.be.true;
|
|
235
237
|
}).onlyEnvironments('nodejs', 'chromium', 'firefox');
|
|
238
|
+
|
|
239
|
+
test('Loads only last epoch', async () => {
|
|
240
|
+
const builder = new TestBuilder();
|
|
241
|
+
afterTest(async () => builder.destroy());
|
|
242
|
+
|
|
243
|
+
const peer = builder.createPeer();
|
|
244
|
+
const identity = await createSigningContext(peer.keyring);
|
|
245
|
+
const epochsNumber = 10;
|
|
246
|
+
const dataService = new DataServiceSubscriptions();
|
|
247
|
+
let spaceKey: PublicKey;
|
|
248
|
+
{
|
|
249
|
+
// Create space and create epochs in it.s
|
|
250
|
+
const dataSpaceManager = new DataSpaceManager(
|
|
251
|
+
peer.spaceManager,
|
|
252
|
+
peer.metadataStore,
|
|
253
|
+
dataService,
|
|
254
|
+
peer.keyring,
|
|
255
|
+
identity,
|
|
256
|
+
peer.feedStore,
|
|
257
|
+
);
|
|
258
|
+
await dataSpaceManager.open();
|
|
259
|
+
afterTest(() => dataSpaceManager.close());
|
|
260
|
+
|
|
261
|
+
const space = await dataSpaceManager.createSpace();
|
|
262
|
+
spaceKey = space.key;
|
|
263
|
+
await space.inner.controlPipeline.state.waitUntilTimeframe(space.inner.controlPipeline.state.endTimeframe);
|
|
264
|
+
|
|
265
|
+
for (const _ of range(epochsNumber)) {
|
|
266
|
+
await testLocalDatabase(space.dataPipeline);
|
|
267
|
+
await space.createEpoch();
|
|
268
|
+
}
|
|
269
|
+
await space.close();
|
|
270
|
+
await dataSpaceManager.close();
|
|
271
|
+
}
|
|
272
|
+
{
|
|
273
|
+
// Load same space and check if it loads only last epoch.s
|
|
274
|
+
const dataSpaceManager = new DataSpaceManager(
|
|
275
|
+
peer.spaceManager,
|
|
276
|
+
peer.metadataStore,
|
|
277
|
+
dataService,
|
|
278
|
+
peer.keyring,
|
|
279
|
+
identity,
|
|
280
|
+
peer.feedStore,
|
|
281
|
+
);
|
|
282
|
+
await dataSpaceManager.open();
|
|
283
|
+
afterTest(() => dataSpaceManager.close());
|
|
284
|
+
|
|
285
|
+
const space = dataSpaceManager.spaces.get(spaceKey)!;
|
|
286
|
+
|
|
287
|
+
const epochs: number[] = [];
|
|
288
|
+
space.dataPipeline.onNewEpoch.on((epoch: SpecificCredential<Epoch>) => {
|
|
289
|
+
epochs.push(epoch.subject.assertion.number);
|
|
290
|
+
});
|
|
291
|
+
const processedFirstEpoch = space.dataPipeline.onNewEpoch.waitFor(() => true);
|
|
292
|
+
|
|
293
|
+
await space.inner.controlPipeline.state.waitUntilTimeframe(space.inner.controlPipeline.state.endTimeframe);
|
|
294
|
+
|
|
295
|
+
await processedFirstEpoch;
|
|
296
|
+
expect(epochs).to.deep.equal([epochsNumber]);
|
|
297
|
+
}
|
|
298
|
+
});
|
|
236
299
|
});
|
|
237
300
|
});
|
|
@@ -19,6 +19,7 @@ import { SpaceCache } from '@dxos/protocols/proto/dxos/echo/metadata';
|
|
|
19
19
|
import { AdmittedFeed, Credential } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
20
20
|
import { GossipMessage } from '@dxos/protocols/proto/dxos/mesh/teleport/gossip';
|
|
21
21
|
import { Gossip, Presence } from '@dxos/teleport-extension-gossip';
|
|
22
|
+
import { Timeframe } from '@dxos/timeframe';
|
|
22
23
|
import { ComplexSet } from '@dxos/util';
|
|
23
24
|
|
|
24
25
|
import { TrustedKeySetAuthVerifier } from '../identity';
|
|
@@ -189,7 +190,6 @@ export class DataSpace {
|
|
|
189
190
|
}
|
|
190
191
|
this._state = SpaceState.INITIALIZING;
|
|
191
192
|
|
|
192
|
-
// TODO(dmaretskyi): Cancel with context.
|
|
193
193
|
await this._inner.controlPipeline.state.waitUntilReachedTargetTimeframe({
|
|
194
194
|
ctx: this._ctx,
|
|
195
195
|
breakOnStall: false,
|
|
@@ -285,7 +285,7 @@ export class DataSpace {
|
|
|
285
285
|
async createEpoch() {
|
|
286
286
|
const epoch = await this.dataPipeline.createEpoch();
|
|
287
287
|
|
|
288
|
-
await this.inner.controlPipeline.writer.write({
|
|
288
|
+
const receipt = await this.inner.controlPipeline.writer.write({
|
|
289
289
|
credential: {
|
|
290
290
|
credential: await this._signingContext.credentialSigner.createCredential({
|
|
291
291
|
subject: this.key,
|
|
@@ -297,6 +297,8 @@ export class DataSpace {
|
|
|
297
297
|
},
|
|
298
298
|
});
|
|
299
299
|
|
|
300
|
+
await this.inner.controlPipeline.state.waitUntilTimeframe(new Timeframe([[receipt.feedKey, receipt.seq]]));
|
|
301
|
+
|
|
300
302
|
for (const feed of this.inner.dataPipeline.pipelineState?.feeds ?? []) {
|
|
301
303
|
const indexBeforeEpoch = epoch.timeframe.get(feed.key);
|
|
302
304
|
if (indexBeforeEpoch) {
|
|
@@ -42,6 +42,7 @@ export class SpacesServiceImpl implements SpacesService {
|
|
|
42
42
|
if (!this._identityManager.identity) {
|
|
43
43
|
throw new Error('This device has no HALO identity available. See https://docs.dxos.org/guide/halo');
|
|
44
44
|
}
|
|
45
|
+
|
|
45
46
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
46
47
|
const space = await dataSpaceManager.createSpace();
|
|
47
48
|
return this._transformSpace(space);
|
|
@@ -155,6 +156,8 @@ export class SpacesServiceImpl implements SpacesService {
|
|
|
155
156
|
state: space.state,
|
|
156
157
|
error: space.error ? encodeError(space.error) : undefined,
|
|
157
158
|
pipeline: {
|
|
159
|
+
currentEpoch: space.dataPipeline.currentEpoch,
|
|
160
|
+
|
|
158
161
|
controlFeeds: space.inner.controlPipeline.state.feeds.map((feed) => feed.key),
|
|
159
162
|
currentControlTimeframe: space.inner.controlPipeline.state.timeframe,
|
|
160
163
|
targetControlTimeframe: space.inner.controlPipeline.state.targetTimeframe,
|
|
@@ -178,6 +181,7 @@ export class SpacesServiceImpl implements SpacesService {
|
|
|
178
181
|
? SpaceMember.PresenceState.ONLINE
|
|
179
182
|
: SpaceMember.PresenceState.OFFLINE,
|
|
180
183
|
})),
|
|
184
|
+
creator: space.inner.spaceState.creator?.key,
|
|
181
185
|
cache: space.cache,
|
|
182
186
|
metrics: space.metrics,
|
|
183
187
|
};
|