@dxos/client-services 0.6.9-staging.8e43e2a → 0.6.10-main.e92b5eb

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.
@@ -32,7 +32,7 @@ __export(testing_exports, {
32
32
  sanitizeInvitation: () => sanitizeInvitation
33
33
  });
34
34
  module.exports = __toCommonJS(testing_exports);
35
- var import_chunk_HRG7HZ3L = require("../chunk-HRG7HZ3L.cjs");
35
+ var import_chunk_52I42DSF = require("../chunk-52I42DSF.cjs");
36
36
  var import_credentials = require("@dxos/credentials");
37
37
  var import_keys = require("@dxos/keys");
38
38
  var import_async = require("@dxos/async");
@@ -229,7 +229,7 @@ var createInvitation = async (host, options) => {
229
229
  authMethod: import_services.Invitation.AuthMethod.NONE,
230
230
  ...options ?? {}
231
231
  };
232
- if (host instanceof import_chunk_HRG7HZ3L.ServiceContext) {
232
+ if (host instanceof import_chunk_52I42DSF.ServiceContext) {
233
233
  return host.invitationsManager.createInvitation({
234
234
  kind: import_services.Invitation.Kind.SPACE,
235
235
  ...options
@@ -239,7 +239,7 @@ var createInvitation = async (host, options) => {
239
239
  };
240
240
  var acceptInvitation = (guest, invitation, guestDeviceProfile) => {
241
241
  invitation = sanitizeInvitation(invitation);
242
- if (guest instanceof import_chunk_HRG7HZ3L.ServiceContext) {
242
+ if (guest instanceof import_chunk_52I42DSF.ServiceContext) {
243
243
  return guest.invitationsManager.acceptInvitation({
244
244
  invitation,
245
245
  deviceProfile: guestDeviceProfile
@@ -249,7 +249,7 @@ var acceptInvitation = (guest, invitation, guestDeviceProfile) => {
249
249
  };
250
250
  var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/testing/test-builder.ts";
251
251
  var createServiceHost = (config, signalManagerContext) => {
252
- return new import_chunk_HRG7HZ3L.ClientServicesHost({
252
+ return new import_chunk_52I42DSF.ClientServicesHost({
253
253
  config,
254
254
  signalManager: new import_messaging.MemorySignalManager(signalManagerContext),
255
255
  transportFactory: import_network_manager.MemoryTransportFactory
@@ -268,7 +268,7 @@ var createServiceContext = async ({ signalManagerFactory = async () => {
268
268
  });
269
269
  const level = (0, import_testing.createTestLevel)();
270
270
  await level.open();
271
- return new import_chunk_HRG7HZ3L.ServiceContext(storage, level, networkManager, signalManager, edgeConnection, {
271
+ return new import_chunk_52I42DSF.ServiceContext(storage, level, networkManager, signalManager, edgeConnection, {
272
272
  invitationConnectionDefaultParams: {
273
273
  controlHeartbeatInterval: 200
274
274
  },
@@ -378,7 +378,7 @@ var TestPeer = class {
378
378
  return this._props.meshEchoReplicator ??= new import_echo_pipeline.MeshEchoReplicator();
379
379
  }
380
380
  get dataSpaceManager() {
381
- return this._props.dataSpaceManager ??= new import_chunk_HRG7HZ3L.DataSpaceManager({
381
+ return this._props.dataSpaceManager ??= new import_chunk_52I42DSF.DataSpaceManager({
382
382
  spaceManager: this.spaceManager,
383
383
  metadataStore: this.metadataStore,
384
384
  keyring: this.keyring,
@@ -393,9 +393,9 @@ var TestPeer = class {
393
393
  });
394
394
  }
395
395
  get invitationsManager() {
396
- return this._props.invitationsManager ??= new import_chunk_HRG7HZ3L.InvitationsManager(new import_chunk_HRG7HZ3L.InvitationsHandler(this.networkManager), (invitation) => {
396
+ return this._props.invitationsManager ??= new import_chunk_52I42DSF.InvitationsManager(new import_chunk_52I42DSF.InvitationsHandler(this.networkManager), (invitation) => {
397
397
  if (invitation.kind === import_services2.Invitation.Kind.SPACE) {
398
- return new import_chunk_HRG7HZ3L.SpaceInvitationProtocol(this.dataSpaceManager, this.identity, this.keyring, invitation.spaceKey);
398
+ return new import_chunk_52I42DSF.SpaceInvitationProtocol(this.dataSpaceManager, this.identity, this.keyring, invitation.spaceKey);
399
399
  } else {
400
400
  throw new Error("not implemented");
401
401
  }
@@ -1,9 +1,11 @@
1
1
  import { Stream } from '@dxos/codec-protobuf';
2
+ import { type SpaceManager } from '@dxos/echo-pipeline';
2
3
  import { type FeedStore } from '@dxos/feed-store';
3
4
  import { type SubscribeToFeedsRequest, type SubscribeToFeedsResponse, type SubscribeToFeedBlocksRequest, type SubscribeToFeedBlocksResponse } from '@dxos/protocols/proto/dxos/devtools/host';
4
5
  import { type FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
5
- export declare const subscribeToFeeds: ({ feedStore }: {
6
+ export declare const subscribeToFeeds: ({ feedStore, spaceManager }: {
6
7
  feedStore: FeedStore<FeedMessage>;
8
+ spaceManager: SpaceManager;
7
9
  }, { feedKeys }: SubscribeToFeedsRequest) => Stream<SubscribeToFeedsResponse>;
8
10
  export declare const subscribeToFeedBlocks: ({ feedStore }: {
9
11
  feedStore: FeedStore<FeedMessage>;
@@ -1 +1 @@
1
- {"version":3,"file":"feeds.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/devtools/feeds.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAgB,KAAK,SAAS,EAAoB,MAAM,kBAAkB,CAAC;AAElF,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EACjC,KAAK,6BAA6B,EACnC,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAGxE,eAAO,MAAM,gBAAgB,kBACZ;IAAE,SAAS,EAAE,SAAS,CAAC,WAAW,CAAC,CAAA;CAAE,gBACtC,uBAAuB,qCAmCtC,CAAC;AAEF,eAAO,MAAM,qBAAqB,kBACjB;IAAE,SAAS,EAAE,SAAS,CAAC,WAAW,CAAC,CAAA;CAAE,0BACvB,4BAA4B,0CA6C1D,CAAC"}
1
+ {"version":3,"file":"feeds.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/devtools/feeds.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAgB,KAAK,SAAS,EAAoB,MAAM,kBAAkB,CAAC;AAGlF,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EACjC,KAAK,6BAA6B,EACnC,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAQxE,eAAO,MAAM,gBAAgB,gCACE;IAAE,SAAS,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAAC,YAAY,EAAE,YAAY,CAAA;CAAE,gBAChF,uBAAuB,qCAuCtC,CAAC;AAmBF,eAAO,MAAM,qBAAqB,kBACjB;IAAE,SAAS,EAAE,SAAS,CAAC,WAAW,CAAC,CAAA;CAAE,0BACvB,4BAA4B,0CAkD1D,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const DXOS_VERSION = "0.6.9-staging.8e43e2a";
1
+ export declare const DXOS_VERSION = "0.6.10-main.e92b5eb";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,0BAA0B,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,wBAAwB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/client-services",
3
- "version": "0.6.9-staging.8e43e2a",
3
+ "version": "0.6.10-main.e92b5eb",
4
4
  "description": "DXOS client services implementation",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -45,46 +45,46 @@
45
45
  "dependencies": {
46
46
  "cbor-x": "^1.5.4",
47
47
  "platform": "^1.3.6",
48
- "@dxos/async": "0.6.9-staging.8e43e2a",
49
- "@dxos/automerge": "0.6.9-staging.8e43e2a",
50
- "@dxos/client-protocol": "0.6.9-staging.8e43e2a",
51
- "@dxos/config": "0.6.9-staging.8e43e2a",
52
- "@dxos/context": "0.6.9-staging.8e43e2a",
53
- "@dxos/credentials": "0.6.9-staging.8e43e2a",
54
- "@dxos/codec-protobuf": "0.6.9-staging.8e43e2a",
55
- "@dxos/crypto": "0.6.9-staging.8e43e2a",
56
- "@dxos/debug": "0.6.9-staging.8e43e2a",
57
- "@dxos/echo-db": "0.6.9-staging.8e43e2a",
58
- "@dxos/echo-pipeline": "0.6.9-staging.8e43e2a",
59
- "@dxos/echo-schema": "0.6.9-staging.8e43e2a",
60
- "@dxos/echo-protocol": "0.6.9-staging.8e43e2a",
61
- "@dxos/edge-client": "0.6.9-staging.8e43e2a",
62
- "@dxos/indexing": "0.6.9-staging.8e43e2a",
63
- "@dxos/feed-store": "0.6.9-staging.8e43e2a",
64
- "@dxos/invariant": "0.6.9-staging.8e43e2a",
65
- "@dxos/keyring": "0.6.9-staging.8e43e2a",
66
- "@dxos/keys": "0.6.9-staging.8e43e2a",
67
- "@dxos/kv-store": "0.6.9-staging.8e43e2a",
68
- "@dxos/log": "0.6.9-staging.8e43e2a",
69
- "@dxos/messaging": "0.6.9-staging.8e43e2a",
70
- "@dxos/network-manager": "0.6.9-staging.8e43e2a",
71
- "@dxos/lock-file": "0.6.9-staging.8e43e2a",
72
- "@dxos/node-std": "0.6.9-staging.8e43e2a",
73
- "@dxos/protocols": "0.6.9-staging.8e43e2a",
74
- "@dxos/random-access-storage": "0.6.9-staging.8e43e2a",
75
- "@dxos/rpc": "0.6.9-staging.8e43e2a",
76
- "@dxos/teleport": "0.6.9-staging.8e43e2a",
77
- "@dxos/teleport-extension-gossip": "0.6.9-staging.8e43e2a",
78
- "@dxos/teleport-extension-object-sync": "0.6.9-staging.8e43e2a",
79
- "@dxos/timeframe": "0.6.9-staging.8e43e2a",
80
- "@dxos/tracing": "0.6.9-staging.8e43e2a",
81
- "@dxos/websocket-rpc": "0.6.9-staging.8e43e2a",
82
- "@dxos/util": "0.6.9-staging.8e43e2a"
48
+ "@dxos/async": "0.6.10-main.e92b5eb",
49
+ "@dxos/automerge": "0.6.10-main.e92b5eb",
50
+ "@dxos/client-protocol": "0.6.10-main.e92b5eb",
51
+ "@dxos/codec-protobuf": "0.6.10-main.e92b5eb",
52
+ "@dxos/config": "0.6.10-main.e92b5eb",
53
+ "@dxos/crypto": "0.6.10-main.e92b5eb",
54
+ "@dxos/context": "0.6.10-main.e92b5eb",
55
+ "@dxos/credentials": "0.6.10-main.e92b5eb",
56
+ "@dxos/debug": "0.6.10-main.e92b5eb",
57
+ "@dxos/echo-db": "0.6.10-main.e92b5eb",
58
+ "@dxos/echo-pipeline": "0.6.10-main.e92b5eb",
59
+ "@dxos/echo-protocol": "0.6.10-main.e92b5eb",
60
+ "@dxos/echo-schema": "0.6.10-main.e92b5eb",
61
+ "@dxos/edge-client": "0.6.10-main.e92b5eb",
62
+ "@dxos/feed-store": "0.6.10-main.e92b5eb",
63
+ "@dxos/indexing": "0.6.10-main.e92b5eb",
64
+ "@dxos/keyring": "0.6.10-main.e92b5eb",
65
+ "@dxos/keys": "0.6.10-main.e92b5eb",
66
+ "@dxos/invariant": "0.6.10-main.e92b5eb",
67
+ "@dxos/kv-store": "0.6.10-main.e92b5eb",
68
+ "@dxos/lock-file": "0.6.10-main.e92b5eb",
69
+ "@dxos/log": "0.6.10-main.e92b5eb",
70
+ "@dxos/messaging": "0.6.10-main.e92b5eb",
71
+ "@dxos/network-manager": "0.6.10-main.e92b5eb",
72
+ "@dxos/node-std": "0.6.10-main.e92b5eb",
73
+ "@dxos/random-access-storage": "0.6.10-main.e92b5eb",
74
+ "@dxos/protocols": "0.6.10-main.e92b5eb",
75
+ "@dxos/rpc": "0.6.10-main.e92b5eb",
76
+ "@dxos/teleport-extension-gossip": "0.6.10-main.e92b5eb",
77
+ "@dxos/teleport": "0.6.10-main.e92b5eb",
78
+ "@dxos/teleport-extension-object-sync": "0.6.10-main.e92b5eb",
79
+ "@dxos/timeframe": "0.6.10-main.e92b5eb",
80
+ "@dxos/tracing": "0.6.10-main.e92b5eb",
81
+ "@dxos/util": "0.6.10-main.e92b5eb",
82
+ "@dxos/websocket-rpc": "0.6.10-main.e92b5eb"
83
83
  },
84
84
  "devDependencies": {
85
85
  "@types/platform": "^1.3.4",
86
86
  "@types/readable-stream": "^2.3.9",
87
- "@dxos/signal": "0.6.9-staging.8e43e2a"
87
+ "@dxos/signal": "0.6.10-main.e92b5eb"
88
88
  },
89
89
  "publishConfig": {
90
90
  "access": "public"
@@ -132,7 +132,7 @@ export class DevtoolsServiceImpl implements DevtoolsHost {
132
132
  }
133
133
 
134
134
  subscribeToFeeds(request: SubscribeToFeedsRequest): Stream<SubscribeToFeedsResponse> {
135
- return subscribeToFeeds({ feedStore: this.params.context.feedStore }, request);
135
+ return subscribeToFeeds(this.params.context, request);
136
136
  }
137
137
 
138
138
  subscribeToFeedBlocks(request: SubscribeToFeedBlocksRequest): Stream<SubscribeToFeedBlocksResponse> {
@@ -4,8 +4,10 @@
4
4
 
5
5
  import { EventSubscriptions } from '@dxos/async';
6
6
  import { Stream } from '@dxos/codec-protobuf';
7
+ import { type SpaceManager } from '@dxos/echo-pipeline';
7
8
  import { FeedIterator, type FeedStore, type FeedWrapper } from '@dxos/feed-store';
8
9
  import { PublicKey } from '@dxos/keys';
10
+ import { log } from '@dxos/log';
9
11
  import {
10
12
  type SubscribeToFeedsRequest,
11
13
  type SubscribeToFeedsResponse,
@@ -15,13 +17,18 @@ import {
15
17
  import { type FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
16
18
  import { ComplexMap } from '@dxos/util';
17
19
 
20
+ type FeedInfo = {
21
+ feed: FeedWrapper<FeedMessage>;
22
+ owner?: SubscribeToFeedsResponse.FeedOwner;
23
+ };
24
+
18
25
  export const subscribeToFeeds = (
19
- { feedStore }: { feedStore: FeedStore<FeedMessage> },
26
+ { feedStore, spaceManager }: { feedStore: FeedStore<FeedMessage>; spaceManager: SpaceManager },
20
27
  { feedKeys }: SubscribeToFeedsRequest,
21
28
  ) => {
22
29
  return new Stream<SubscribeToFeedsResponse>(({ next }) => {
23
30
  const subscriptions = new EventSubscriptions();
24
- const feedMap = new ComplexMap<PublicKey, FeedWrapper<FeedMessage>>(PublicKey.hash);
31
+ const feedMap = new ComplexMap<PublicKey, FeedInfo>(PublicKey.hash);
25
32
 
26
33
  const update = () => {
27
34
  const { feeds } = feedStore;
@@ -29,18 +36,22 @@ export const subscribeToFeeds = (
29
36
  .filter((feed) => !feedKeys?.length || feedKeys.some((feedKey) => feedKey.equals(feed.key)))
30
37
  .forEach((feed) => {
31
38
  if (!feedMap.has(feed.key)) {
32
- feedMap.set(feed.key, feed);
39
+ feedMap.set(feed.key, { feed });
33
40
  feed.on('close', update);
34
41
  subscriptions.add(() => feed.off('close', update));
35
42
  }
43
+ if (!feedMap.get(feed.key)?.owner) {
44
+ feedMap.get(feed.key)!.owner = findFeedOwner(spaceManager, feed.key);
45
+ }
36
46
  });
37
47
 
38
48
  next({
39
- feeds: Array.from(feedMap.values()).map((feed) => ({
49
+ feeds: Array.from(feedMap.values()).map(({ feed, owner }) => ({
40
50
  feedKey: feed.key,
41
51
  length: feed.properties.length,
42
52
  bytes: feed.core.byteLength,
43
53
  downloaded: feed.core.bitfield?.data.toBuffer() ?? new Uint8Array(),
54
+ owner,
44
55
  })),
45
56
  });
46
57
  };
@@ -54,6 +65,23 @@ export const subscribeToFeeds = (
54
65
  });
55
66
  };
56
67
 
68
+ const findFeedOwner = (
69
+ spaceManager: SpaceManager,
70
+ feedKey: PublicKey,
71
+ ): SubscribeToFeedsResponse.FeedOwner | undefined => {
72
+ const feedInfo = [...spaceManager.spaces.values()]
73
+ .flatMap((space) => [...space.spaceState.feeds.values()])
74
+ .find((feed) => feed.key.equals(feedKey));
75
+ log.info('feeds', { feedInfo, key: feedKey.truncate(), allSpaces: spaceManager.spaces.size });
76
+ if (!feedInfo) {
77
+ return undefined;
78
+ }
79
+ return {
80
+ identity: feedInfo.assertion.identityKey,
81
+ device: feedInfo.assertion.deviceKey,
82
+ };
83
+ };
84
+
57
85
  export const subscribeToFeedBlocks = (
58
86
  { feedStore }: { feedStore: FeedStore<FeedMessage> },
59
87
  { feedKey, maxBlocks = 10 }: SubscribeToFeedBlocksRequest,
@@ -71,6 +99,11 @@ export const subscribeToFeedBlocks = (
71
99
  }
72
100
 
73
101
  const update = async () => {
102
+ if (!feed.properties.length) {
103
+ next({ blocks: [] });
104
+ return;
105
+ }
106
+
74
107
  const iterator = new FeedIterator(feed);
75
108
  await iterator.open();
76
109
  const blocks = [];
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const DXOS_VERSION = "0.6.9-staging.8e43e2a";
1
+ export const DXOS_VERSION = "0.6.10-main.e92b5eb";