@dxos/client-services 0.1.50 → 0.1.51-main.04d9478
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-BAHSFG33.mjs → chunk-QUJROKKU.mjs} +100 -58
- package/dist/lib/browser/chunk-QUJROKKU.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 +113 -71
- 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 +130 -88
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/invitations/invitations-handler.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.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/invitations/invitations-handler.ts +14 -6
- package/src/packlets/invitations/space-invitation-protocol.test.ts +8 -1
- 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.ts +4 -2
- package/src/packlets/spaces/spaces-service.ts +4 -0
- package/dist/lib/browser/chunk-BAHSFG33.mjs.map +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invitations-handler.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/invitations-handler.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,kCAAkC,EAElC,+BAA+B,
|
|
1
|
+
{"version":3,"file":"invitations-handler.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/invitations-handler.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,kCAAkC,EAElC,+BAA+B,EAEhC,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AASxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,kBAAkB;IAIjB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAE5C,gBAAgB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,+BAA+B;IAgJ9G,gBAAgB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,UAAU,EAAE,UAAU,GAAG,kCAAkC;CAkL3G"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Stream } from '@dxos/codec-protobuf';
|
|
2
|
-
import {
|
|
2
|
+
import { LogEntry, LoggingService, QueryLogsRequest } from '@dxos/protocols/proto/dxos/client/services';
|
|
3
3
|
/**
|
|
4
4
|
* Logging service used to spy on logs of the host.
|
|
5
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging-service.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/logging/logging-service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"logging-service.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/logging/logging-service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAGxG;;GAEG;AACH,qBAAa,kBAAmB,YAAW,cAAc;IACvD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgC;IAEhD,IAAI;IAIJ,KAAK;IAKX,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAAC,QAAQ,CAAC;IA4CtD,OAAO,CAAC,aAAa,CAEnB;CACH"}
|
|
@@ -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,sCAAsC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;
|
|
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,WAA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,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAIxD,qBAAa,iBAAkB,YAAW,aAAa;IAEnD,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,yBAAyB;IAC1C,OAAO,CAAC,QAAQ,CAAC,oBAAoB;gBAHpB,gBAAgB,EAAE,eAAe,EACjC,aAAa,EAAE,YAAY,EAC3B,yBAAyB,EAAE,wBAAwB,EACnD,oBAAoB,EAAE,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAGtE,WAAW,IAAI,OAAO,CAAC,KAAK,CAAC;IAU7B,WAAW,CAAC,OAAO,EAAE,kBAAkB;IAI7C,WAAW,IAAI,MAAM,CAAC,mBAAmB,CAAC;IAoDpC,WAAW,CAAC,EAAE,QAAQ,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.
|
|
3
|
+
"version": "0.1.51-main.04d9478",
|
|
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.
|
|
27
|
-
"@dxos/client-protocol": "0.1.
|
|
28
|
-
"@dxos/codec-protobuf": "0.1.
|
|
29
|
-
"@dxos/config": "0.1.
|
|
30
|
-
"@dxos/context": "0.1.
|
|
31
|
-
"@dxos/credentials": "0.1.
|
|
32
|
-
"@dxos/crypto": "0.1.
|
|
33
|
-
"@dxos/debug": "0.1.
|
|
34
|
-
"@dxos/document-model": "0.1.
|
|
35
|
-
"@dxos/echo-db": "0.1.
|
|
36
|
-
"@dxos/echo-pipeline": "0.1.
|
|
37
|
-
"@dxos/errors": "0.1.
|
|
38
|
-
"@dxos/feed-store": "0.1.
|
|
39
|
-
"@dxos/keyring": "0.1.
|
|
40
|
-
"@dxos/keys": "0.1.
|
|
41
|
-
"@dxos/log": "0.1.
|
|
42
|
-
"@dxos/messaging": "0.1.
|
|
43
|
-
"@dxos/model-factory": "0.1.
|
|
44
|
-
"@dxos/network-manager": "0.1.
|
|
45
|
-
"@dxos/node-std": "0.1.
|
|
46
|
-
"@dxos/protocols": "0.1.
|
|
47
|
-
"@dxos/random-access-storage": "0.1.
|
|
48
|
-
"@dxos/rpc": "0.1.
|
|
49
|
-
"@dxos/teleport": "0.1.
|
|
50
|
-
"@dxos/teleport-extension-gossip": "0.1.
|
|
51
|
-
"@dxos/text-model": "0.1.
|
|
52
|
-
"@dxos/timeframe": "0.1.
|
|
53
|
-
"@dxos/util": "0.1.
|
|
26
|
+
"@dxos/async": "0.1.51-main.04d9478",
|
|
27
|
+
"@dxos/client-protocol": "0.1.51-main.04d9478",
|
|
28
|
+
"@dxos/codec-protobuf": "0.1.51-main.04d9478",
|
|
29
|
+
"@dxos/config": "0.1.51-main.04d9478",
|
|
30
|
+
"@dxos/context": "0.1.51-main.04d9478",
|
|
31
|
+
"@dxos/credentials": "0.1.51-main.04d9478",
|
|
32
|
+
"@dxos/crypto": "0.1.51-main.04d9478",
|
|
33
|
+
"@dxos/debug": "0.1.51-main.04d9478",
|
|
34
|
+
"@dxos/document-model": "0.1.51-main.04d9478",
|
|
35
|
+
"@dxos/echo-db": "0.1.51-main.04d9478",
|
|
36
|
+
"@dxos/echo-pipeline": "0.1.51-main.04d9478",
|
|
37
|
+
"@dxos/errors": "0.1.51-main.04d9478",
|
|
38
|
+
"@dxos/feed-store": "0.1.51-main.04d9478",
|
|
39
|
+
"@dxos/keyring": "0.1.51-main.04d9478",
|
|
40
|
+
"@dxos/keys": "0.1.51-main.04d9478",
|
|
41
|
+
"@dxos/log": "0.1.51-main.04d9478",
|
|
42
|
+
"@dxos/messaging": "0.1.51-main.04d9478",
|
|
43
|
+
"@dxos/model-factory": "0.1.51-main.04d9478",
|
|
44
|
+
"@dxos/network-manager": "0.1.51-main.04d9478",
|
|
45
|
+
"@dxos/node-std": "0.1.51-main.04d9478",
|
|
46
|
+
"@dxos/protocols": "0.1.51-main.04d9478",
|
|
47
|
+
"@dxos/random-access-storage": "0.1.51-main.04d9478",
|
|
48
|
+
"@dxos/rpc": "0.1.51-main.04d9478",
|
|
49
|
+
"@dxos/teleport": "0.1.51-main.04d9478",
|
|
50
|
+
"@dxos/teleport-extension-gossip": "0.1.51-main.04d9478",
|
|
51
|
+
"@dxos/text-model": "0.1.51-main.04d9478",
|
|
52
|
+
"@dxos/timeframe": "0.1.51-main.04d9478",
|
|
53
|
+
"@dxos/util": "0.1.51-main.04d9478"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/readable-stream": "^2.3.9",
|
|
57
|
-
"@dxos/signal": "0.1.
|
|
57
|
+
"@dxos/signal": "0.1.51-main.04d9478"
|
|
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
|
),
|
|
@@ -4,20 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
import assert from 'node:assert';
|
|
6
6
|
|
|
7
|
-
import { PushStream, scheduleTask,
|
|
7
|
+
import { PushStream, scheduleTask, TimeoutError, Trigger } from '@dxos/async';
|
|
8
8
|
import {
|
|
9
9
|
AuthenticatingInvitationObservable,
|
|
10
10
|
AUTHENTICATION_CODE_LENGTH,
|
|
11
11
|
CancellableInvitationObservable,
|
|
12
12
|
INVITATION_TIMEOUT,
|
|
13
|
-
ON_CLOSE_DELAY,
|
|
14
13
|
} from '@dxos/client-protocol';
|
|
15
14
|
import { Context } from '@dxos/context';
|
|
16
15
|
import { generatePasscode } from '@dxos/credentials';
|
|
17
16
|
import { InvalidInvitationExtensionRoleError } from '@dxos/errors';
|
|
18
17
|
import { PublicKey } from '@dxos/keys';
|
|
19
18
|
import { log } from '@dxos/log';
|
|
20
|
-
import { createTeleportProtocolFactory, NetworkManager, StarTopology } from '@dxos/network-manager';
|
|
19
|
+
import { createTeleportProtocolFactory, NetworkManager, StarTopology, SwarmConnection } from '@dxos/network-manager';
|
|
21
20
|
import { trace } from '@dxos/protocols';
|
|
22
21
|
import { Invitation } from '@dxos/protocols/proto/dxos/client/services';
|
|
23
22
|
import { AuthenticationResponse } from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
@@ -154,7 +153,8 @@ export class InvitationsHandler {
|
|
|
154
153
|
log.trace('dxos.sdk.invitations-handler.host.onOpen', trace.error({ id: traceId, error: err }));
|
|
155
154
|
} finally {
|
|
156
155
|
if (type !== Invitation.Type.MULTIUSE) {
|
|
157
|
-
|
|
156
|
+
// Wait for graceful close before disposing.
|
|
157
|
+
await swarmConnection.close();
|
|
158
158
|
await ctx.dispose();
|
|
159
159
|
}
|
|
160
160
|
}
|
|
@@ -177,9 +177,10 @@ export class InvitationsHandler {
|
|
|
177
177
|
return extension;
|
|
178
178
|
};
|
|
179
179
|
|
|
180
|
+
let swarmConnection: SwarmConnection;
|
|
180
181
|
scheduleTask(ctx, async () => {
|
|
181
182
|
const topic = invitation.swarmKey!;
|
|
182
|
-
|
|
183
|
+
swarmConnection = await this._networkManager.joinSwarm({
|
|
183
184
|
topic,
|
|
184
185
|
peerId: topic,
|
|
185
186
|
protocolProvider: createTeleportProtocolFactory(async (teleport) => {
|
|
@@ -211,6 +212,10 @@ export class InvitationsHandler {
|
|
|
211
212
|
|
|
212
213
|
const authenticated = new Trigger<string>();
|
|
213
214
|
|
|
215
|
+
// TODO(dmaretskyi): Turn into state?
|
|
216
|
+
// Whether the Host has already admitted us and the remote connection is no longer needed.
|
|
217
|
+
let admitted = false;
|
|
218
|
+
|
|
214
219
|
let currentState: Invitation.State;
|
|
215
220
|
const stream = new PushStream<Invitation>();
|
|
216
221
|
const setState = (newData: Partial<Invitation>) => {
|
|
@@ -244,7 +249,7 @@ export class InvitationsHandler {
|
|
|
244
249
|
onOpen: (extensionCtx) => {
|
|
245
250
|
extensionCtx.onDispose(async () => {
|
|
246
251
|
log('extension disposed', { currentState });
|
|
247
|
-
if (
|
|
252
|
+
if (!admitted) {
|
|
248
253
|
stream.error(new Error('Remote peer disconnected.'));
|
|
249
254
|
}
|
|
250
255
|
});
|
|
@@ -307,6 +312,9 @@ export class InvitationsHandler {
|
|
|
307
312
|
const admissionRequest = await protocol.createAdmissionRequest();
|
|
308
313
|
const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
|
|
309
314
|
|
|
315
|
+
// Remote connection no longer needed.
|
|
316
|
+
admitted = true;
|
|
317
|
+
|
|
310
318
|
// 4. Record credential in our HALO.
|
|
311
319
|
const result = await protocol.accept(admissionResponse, admissionRequest);
|
|
312
320
|
|
|
@@ -78,7 +78,7 @@ describe('services/space-invitations-protocol', () => {
|
|
|
78
78
|
|
|
79
79
|
const space1 = await host.dataSpaceManager!.createSpace();
|
|
80
80
|
|
|
81
|
-
const [{ invitation: invitation1 }, { invitation: invitation2 }] = await Promise.all(
|
|
81
|
+
const [{ invitation: invitation1, error: error1 }, { invitation: invitation2, error: error2 }] = await Promise.all(
|
|
82
82
|
performInvitation({
|
|
83
83
|
host,
|
|
84
84
|
guest,
|
|
@@ -100,6 +100,13 @@ describe('services/space-invitations-protocol', () => {
|
|
|
100
100
|
}),
|
|
101
101
|
);
|
|
102
102
|
|
|
103
|
+
if (error1) {
|
|
104
|
+
throw error1;
|
|
105
|
+
}
|
|
106
|
+
if (error2) {
|
|
107
|
+
throw error2;
|
|
108
|
+
}
|
|
109
|
+
|
|
103
110
|
expect(attempt).to.eq(1);
|
|
104
111
|
expect(invitation1?.spaceKey).to.exist;
|
|
105
112
|
expect(invitation2?.spaceKey).to.exist;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import { Event } from '@dxos/async';
|
|
6
6
|
import { Stream } from '@dxos/codec-protobuf';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { LogLevel, LogProcessor, LogEntry as NaturalLogEntry, getContextFromEntry, log } from '@dxos/log';
|
|
8
|
+
import { LogEntry, LoggingService, QueryLogsRequest } from '@dxos/protocols/proto/dxos/client/services';
|
|
9
9
|
import { jsonify } from '@dxos/util';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -24,9 +24,13 @@ export class LoggingServiceImpl implements LoggingService {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
queryLogs(request: QueryLogsRequest): Stream<LogEntry> {
|
|
27
|
-
const filters = request.filters?.length ? request.filters : undefined;
|
|
28
27
|
return new Stream<LogEntry>(({ ctx, next }) => {
|
|
29
28
|
const handler = (entry: NaturalLogEntry) => {
|
|
29
|
+
// This call was caused by the logging service itself.
|
|
30
|
+
if (LOG_PROCESSING > 0) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
30
34
|
// Prevent logging feedback loop from logging service.
|
|
31
35
|
if (
|
|
32
36
|
entry.meta?.file.includes('logging-service') ||
|
|
@@ -36,22 +40,30 @@ export class LoggingServiceImpl implements LoggingService {
|
|
|
36
40
|
return;
|
|
37
41
|
}
|
|
38
42
|
|
|
39
|
-
if (shouldLog(entry,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
if (!shouldLog(entry, request)) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const record: LogEntry = {
|
|
48
|
+
...entry,
|
|
49
|
+
context: jsonify(getContextFromEntry(entry)),
|
|
50
|
+
timestamp: new Date(),
|
|
51
|
+
meta: {
|
|
52
|
+
// TODO(dmaretskyi): Fix proto.
|
|
53
|
+
file: entry.meta?.file ?? '',
|
|
54
|
+
line: entry.meta?.line ?? 0,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
LOG_PROCESSING++;
|
|
46
60
|
next(record);
|
|
61
|
+
} finally {
|
|
62
|
+
LOG_PROCESSING--;
|
|
47
63
|
}
|
|
48
64
|
};
|
|
49
65
|
|
|
50
|
-
|
|
51
|
-
this._logs.off(handler);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
this._logs.on(handler);
|
|
66
|
+
this._logs.on(ctx, handler);
|
|
55
67
|
});
|
|
56
68
|
}
|
|
57
69
|
|
|
@@ -59,3 +71,34 @@ export class LoggingServiceImpl implements LoggingService {
|
|
|
59
71
|
this._logs.emit(entry);
|
|
60
72
|
};
|
|
61
73
|
}
|
|
74
|
+
|
|
75
|
+
const matchFilter = (
|
|
76
|
+
filter: QueryLogsRequest.Filter,
|
|
77
|
+
level: LogLevel,
|
|
78
|
+
path: string,
|
|
79
|
+
options: QueryLogsRequest.MatchingOptions,
|
|
80
|
+
) => {
|
|
81
|
+
switch (options) {
|
|
82
|
+
case QueryLogsRequest.MatchingOptions.INCLUSIVE:
|
|
83
|
+
return level >= filter.level && (!filter.pattern || path.includes(filter.pattern));
|
|
84
|
+
case QueryLogsRequest.MatchingOptions.EXPLICIT:
|
|
85
|
+
return level === filter.level && (!filter.pattern || path.includes(filter.pattern));
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Determines if the current line should be logged (called by the processor).
|
|
91
|
+
*/
|
|
92
|
+
const shouldLog = (entry: NaturalLogEntry, request: QueryLogsRequest): boolean => {
|
|
93
|
+
const options = request.options ?? QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
94
|
+
if (request.filters === undefined) {
|
|
95
|
+
return options === QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
96
|
+
} else {
|
|
97
|
+
return request.filters.some((filter) => matchFilter(filter, entry.level, entry.meta?.file ?? '', options));
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Counter that is used to track whether we are processing a log entry.
|
|
103
|
+
*/
|
|
104
|
+
let LOG_PROCESSING = 0;
|
|
@@ -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
|
};
|