@dxos/messaging 0.6.12-main.5cc132e → 0.6.12-main.78ddbdf

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.
@@ -42,7 +42,7 @@ var ReliablePayload = schema.getCodecForType("dxos.mesh.messaging.ReliablePayloa
42
42
  var Acknowledgement = schema.getCodecForType("dxos.mesh.messaging.Acknowledgement");
43
43
  var RECEIVED_MESSAGES_GC_INTERVAL = 12e4;
44
44
  var Messenger = class {
45
- constructor({ signalManager, retryDelay = 300 }) {
45
+ constructor({ signalManager, retryDelay = 1e3 }) {
46
46
  this._monitor = new MessengerMonitor();
47
47
  // { peerId, payloadType } => listeners set
48
48
  this._listeners = new ComplexMap(({ peerId, payloadType }) => peerId + payloadType);
@@ -1997,7 +1997,6 @@ _ts_decorate([
1997
1997
  ], WebsocketSignalManager.prototype, "checkServerFailure", null);
1998
1998
 
1999
1999
  // packages/core/mesh/messaging/src/signal-manager/edge-signal-manager.ts
2000
- import { AnySchema } from "@bufbuild/protobuf/wkt";
2001
2000
  import { Event as Event5 } from "@dxos/async";
2002
2001
  import { Resource as Resource3 } from "@dxos/context";
2003
2002
  import { protocol } from "@dxos/edge-client";
@@ -2005,6 +2004,7 @@ import { invariant as invariant6 } from "@dxos/invariant";
2005
2004
  import { PublicKey as PublicKey7 } from "@dxos/keys";
2006
2005
  import { log as log7 } from "@dxos/log";
2007
2006
  import { EdgeService } from "@dxos/protocols";
2007
+ import { bufWkt } from "@dxos/protocols/buf";
2008
2008
  import { SwarmRequestSchema, SwarmRequest_Action as SwarmRequestAction, SwarmResponseSchema } from "@dxos/protocols/buf/dxos/edge/messenger_pb";
2009
2009
  import { ComplexMap as ComplexMap4, ComplexSet as ComplexSet4 } from "@dxos/util";
2010
2010
  var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/signal-manager/edge-signal-manager.ts";
@@ -2038,7 +2038,7 @@ var EdgeSignalManager = class extends Resource3 {
2038
2038
  }
2039
2039
  }, {
2040
2040
  F: __dxlog_file7,
2041
- L: 53,
2041
+ L: 52,
2042
2042
  S: this,
2043
2043
  C: (f, a) => f(...a)
2044
2044
  });
@@ -2076,12 +2076,12 @@ var EdgeSignalManager = class extends Resource3 {
2076
2076
  }
2077
2077
  }, {
2078
2078
  F: __dxlog_file7,
2079
- L: 84,
2079
+ L: 83,
2080
2080
  S: this,
2081
2081
  C: (f, a) => f(...a)
2082
2082
  });
2083
2083
  }
2084
- await this._edgeConnection.send(protocol.createMessage(AnySchema, {
2084
+ await this._edgeConnection.send(protocol.createMessage(bufWkt.AnySchema, {
2085
2085
  serviceId: EdgeService.SIGNAL_SERVICE_ID,
2086
2086
  source: message.author,
2087
2087
  target: [
@@ -2111,7 +2111,7 @@ var EdgeSignalManager = class extends Resource3 {
2111
2111
  _processSwarmResponse(message) {
2112
2112
  invariant6(protocol.getPayloadType(message) === SwarmResponseSchema.typeName, "Wrong payload type", {
2113
2113
  F: __dxlog_file7,
2114
- L: 121,
2114
+ L: 120,
2115
2115
  S: this,
2116
2116
  A: [
2117
2117
  "protocol.getPayloadType(message) === SwarmResponseSchema.typeName",
@@ -2125,14 +2125,14 @@ var EdgeSignalManager = class extends Resource3 {
2125
2125
  topic
2126
2126
  }, {
2127
2127
  F: __dxlog_file7,
2128
- L: 125,
2128
+ L: 124,
2129
2129
  S: this,
2130
2130
  C: (f, a) => f(...a)
2131
2131
  });
2132
2132
  return;
2133
2133
  }
2134
2134
  const oldPeers = this._swarmPeers.get(topic);
2135
- const timestamp = new Date(Date.parse(message.timestamp));
2135
+ const timestamp = message.timestamp ? new Date(Date.parse(message.timestamp)) : /* @__PURE__ */ new Date();
2136
2136
  const newPeers = new ComplexSet4(PeerInfoHash, payload.peers);
2137
2137
  for (const peer of newPeers) {
2138
2138
  if (oldPeers.has(peer)) {
@@ -2160,19 +2160,19 @@ var EdgeSignalManager = class extends Resource3 {
2160
2160
  this._swarmPeers.set(topic, newPeers);
2161
2161
  }
2162
2162
  _processMessage(message) {
2163
- invariant6(protocol.getPayloadType(message) === AnySchema.typeName, "Wrong payload type", {
2163
+ invariant6(protocol.getPayloadType(message) === bufWkt.AnySchema.typeName, "Wrong payload type", {
2164
2164
  F: __dxlog_file7,
2165
- L: 158,
2165
+ L: 157,
2166
2166
  S: this,
2167
2167
  A: [
2168
- "protocol.getPayloadType(message) === AnySchema.typeName",
2168
+ "protocol.getPayloadType(message) === bufWkt.AnySchema.typeName",
2169
2169
  "'Wrong payload type'"
2170
2170
  ]
2171
2171
  });
2172
- const payload = protocol.getPayload(message, AnySchema);
2172
+ const payload = protocol.getPayload(message, bufWkt.AnySchema);
2173
2173
  invariant6(message.source, "source is missing", {
2174
2174
  F: __dxlog_file7,
2175
- L: 160,
2175
+ L: 159,
2176
2176
  S: this,
2177
2177
  A: [
2178
2178
  "message.source",
@@ -2181,7 +2181,7 @@ var EdgeSignalManager = class extends Resource3 {
2181
2181
  });
2182
2182
  invariant6(message.target, "target is missing", {
2183
2183
  F: __dxlog_file7,
2184
- L: 161,
2184
+ L: 160,
2185
2185
  S: this,
2186
2186
  A: [
2187
2187
  "message.target",
@@ -2190,7 +2190,7 @@ var EdgeSignalManager = class extends Resource3 {
2190
2190
  });
2191
2191
  invariant6(message.target.length === 1, "target should have exactly one item", {
2192
2192
  F: __dxlog_file7,
2193
- L: 162,
2193
+ L: 161,
2194
2194
  S: this,
2195
2195
  A: [
2196
2196
  "message.target.length === 1",
@@ -2214,7 +2214,7 @@ var EdgeSignalManager = class extends Resource3 {
2214
2214
  swarms: Array.from(this._swarmPeers.keys())
2215
2215
  }, {
2216
2216
  F: __dxlog_file7,
2217
- L: 181,
2217
+ L: 180,
2218
2218
  S: this,
2219
2219
  C: (f, a) => f(...a)
2220
2220
  });