@dxos/messaging 0.4.10-main.99ef736 → 0.4.10-main.fa5a270

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.
@@ -125,7 +125,6 @@ export class SignalClient implements SignalMethods {
125
125
  private readonly _host: string,
126
126
  private readonly _onMessage: (params: { author: PublicKey; recipient: PublicKey; payload: Any }) => Promise<void>,
127
127
  private readonly _onSwarmEvent: (params: { topic: PublicKey; swarmEvent: SwarmEvent }) => Promise<void>,
128
- private readonly _getMetadata?: () => any,
129
128
  ) {
130
129
  if (!this._host.startsWith('wss://') && !this._host.startsWith('ws://')) {
131
130
  throw new Error(`Signal server requires a websocket URL. Provided: ${this._host}`);
@@ -310,7 +309,6 @@ export class SignalClient implements SignalMethods {
310
309
 
311
310
  this._reconnectTask!.schedule();
312
311
  },
313
- getMetadata: this._getMetadata,
314
312
  },
315
313
  });
316
314
  } catch (err: any) {
@@ -30,7 +30,6 @@ export type SignalCallbacks = {
30
30
  onDisconnected?: () => void;
31
31
 
32
32
  onError?: (error: Error) => void;
33
- getMetadata?: () => any;
34
33
  };
35
34
 
36
35
  export type SignalRPCClientParams = {
@@ -165,7 +164,6 @@ export class SignalRPCClient {
165
164
  const swarmStream = this._rpc.rpc.Signal.join({
166
165
  swarm: topic.asUint8Array(),
167
166
  peer: peerId.asUint8Array(),
168
- metadata: this._callbacks?.getMetadata?.(),
169
167
  });
170
168
  await swarmStream.waitUntilReady();
171
169
  return swarmStream;
@@ -192,7 +190,6 @@ export class SignalRPCClient {
192
190
  author: author.asUint8Array(),
193
191
  recipient: recipient.asUint8Array(),
194
192
  payload,
195
- metadata: this._callbacks?.getMetadata?.(),
196
193
  });
197
194
  }
198
195
  }
@@ -5,4 +5,3 @@
5
5
  export * from './memory-signal-manager';
6
6
  export * from './signal-manager';
7
7
  export * from './websocket-signal-manager';
8
- export * from './utils';
@@ -42,10 +42,7 @@ export class WebsocketSignalManager implements SignalManager {
42
42
 
43
43
  private readonly _instanceId = PublicKey.random().toHex();
44
44
 
45
- constructor(
46
- private readonly _hosts: Runtime.Services.Signal[],
47
- private readonly _getMetadata?: () => any,
48
- ) {
45
+ constructor(private readonly _hosts: Runtime.Services.Signal[]) {
49
46
  log('Created WebsocketSignalManager', { hosts: this._hosts });
50
47
  for (const host of this._hosts) {
51
48
  if (this._servers.has(host.server)) {
@@ -55,7 +52,6 @@ export class WebsocketSignalManager implements SignalManager {
55
52
  host.server,
56
53
  async (message) => this.onMessage.emit(message),
57
54
  async (data) => this.swarmEvent.emit(data),
58
- this._getMetadata,
59
55
  );
60
56
  server.statusChanged.on(() => this.statusChanged.emit(this.getStatus()));
61
57
 
@@ -1,7 +0,0 @@
1
- import { type DevicesService, type IdentityService } from '@dxos/protocols/proto/dxos/client/services';
2
- export declare const setIdentityTags: ({ identityService, devicesService, setTag, }: {
3
- identityService: IdentityService;
4
- devicesService: DevicesService;
5
- setTag: (k: string, v: string) => void;
6
- }) => void;
7
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/signal-manager/utils.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAGvG,eAAO,MAAM,eAAe;qBAKT,eAAe;oBAChB,cAAc;gBAClB,MAAM,KAAK,MAAM,KAAK,IAAI;UAyBvC,CAAC"}
@@ -1,42 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import { invariant } from '@dxos/invariant';
6
- import { log } from '@dxos/log';
7
- import { type DevicesService, type IdentityService } from '@dxos/protocols/proto/dxos/client/services';
8
- import { DeviceKind } from '@dxos/protocols/proto/dxos/client/services';
9
-
10
- export const setIdentityTags = ({
11
- identityService,
12
- devicesService,
13
- setTag,
14
- }: {
15
- identityService: IdentityService;
16
- devicesService: DevicesService;
17
- setTag: (k: string, v: string) => void;
18
- }) => {
19
- identityService.queryIdentity().subscribe((idqr) => {
20
- if (!idqr?.identity?.identityKey) {
21
- log('empty response from identity service', { idqr });
22
- return;
23
- }
24
-
25
- setTag('identityKey', idqr.identity.identityKey.truncate());
26
- });
27
-
28
- devicesService.queryDevices().subscribe((dqr) => {
29
- if (!dqr || !dqr.devices || dqr.devices.length === 0) {
30
- log('empty response from device service', { device: dqr });
31
- return;
32
- }
33
- invariant(dqr, 'empty response from device service');
34
-
35
- const thisDevice = dqr.devices.find((device) => device.kind === DeviceKind.CURRENT);
36
- if (!thisDevice) {
37
- log('no current device', { device: dqr });
38
- return;
39
- }
40
- setTag('deviceKey', thisDevice.deviceKey.truncate());
41
- });
42
- };