@meshagent/meshagent-ts-auth 0.39.4 → 0.39.5

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/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## [0.39.5]
2
+ - Stability
3
+
1
4
  ## [0.39.4]
2
5
  - Updated the Node/TS React dev package dependency graph to the newer `@meshagent/meshagent` and `@meshagent/meshagent-react` versions (`^0.38.4`) and upgraded supporting UI dependencies (including `shadcn` `^4.5.0`, `radix-ui` `^1.4.3`, and `lucide-react` `^0.525.0`).
3
6
  - Updated build tooling in the React dev package (new `build:js` / `build:types` scripts using TS configs) to match the updated packaging workflow.
@@ -42126,6 +42126,12 @@ ${newlined}
42126
42126
 
42127
42127
  // ../meshagent-ts/dist/esm/room-client.js
42128
42128
  var room_client_exports = {};
42129
+ function isRetryableStartupClose({ kind, reason }) {
42130
+ if (kind === protocol_12.ProtocolCloseKind.ERROR) {
42131
+ return true;
42132
+ }
42133
+ return (reason ?? "").toLowerCase().includes("1013");
42134
+ }
42129
42135
  function normalizeCloseReason(reason) {
42130
42136
  if (reason == null) {
42131
42137
  return null;
@@ -42768,7 +42774,7 @@ ${newlined}
42768
42774
  await this._openProtocol({ initial: true });
42769
42775
  } catch (error) {
42770
42776
  if (error instanceof ProtocolStartupFailure) {
42771
- if (error.kind !== protocol_12.ProtocolCloseKind.ERROR || this._reconnectTimeout === 0) {
42777
+ if (!isRetryableStartupClose({ kind: error.kind, reason: error.reason }) || this._reconnectTimeout === 0) {
42772
42778
  this._setStartupTerminalState({
42773
42779
  closeKind: error.kind,
42774
42780
  closeReason: error.reason,
@@ -42803,7 +42809,7 @@ ${newlined}
42803
42809
  }
42804
42810
  const closeKind = this._protocolInstance.closeKind;
42805
42811
  const protocolCloseReason = normalizeCloseReason(this._protocolInstance.closeReason);
42806
- if (closeKind != null && closeKind !== protocol_12.ProtocolCloseKind.ERROR) {
42812
+ if (closeKind != null && !isRetryableStartupClose({ kind: closeKind, reason: protocolCloseReason })) {
42807
42813
  this._setStartupTerminalState({
42808
42814
  closeKind,
42809
42815
  closeReason: protocolCloseReason,
@@ -42880,6 +42886,9 @@ ${newlined}
42880
42886
  const remaining = deadline - Date.now();
42881
42887
  return remaining <= 0 ? 0 : remaining;
42882
42888
  }
42889
+ _reconnectRetryDelay({ retryCount }) {
42890
+ return Math.min(_RoomClient.RECONNECT_RETRY_MAX_DELAY_MS, _RoomClient.RECONNECT_RETRY_BASE_DELAY_MS * 2 ** retryCount);
42891
+ }
42883
42892
  async _attemptInitialProtocolStartup({ protocol, remaining }) {
42884
42893
  void protocol;
42885
42894
  if (remaining == null) {
@@ -42973,21 +42982,25 @@ ${newlined}
42973
42982
  };
42974
42983
  const deadline = this._reconnectTimeout == null ? null : Date.now() + this._reconnectTimeout;
42975
42984
  let firstAttempt = true;
42985
+ let retryCount = 0;
42976
42986
  while (!this._closing) {
42977
42987
  if (firstAttempt) {
42978
42988
  firstAttempt = false;
42979
42989
  if (this._reconnectTimeout == null) {
42980
- await new Promise((resolve) => setTimeout(resolve, _RoomClient.RECONNECT_RETRY_INTERVAL_MS));
42990
+ await new Promise((resolve) => setTimeout(resolve, this._reconnectRetryDelay({ retryCount })));
42991
+ retryCount += 1;
42981
42992
  }
42982
42993
  } else {
42983
42994
  const remaining2 = this._remainingReconnectTimeout(deadline);
42984
42995
  if (remaining2 != null && remaining2 === 0) {
42985
42996
  return this._timedOutRetryResult({ disconnectReason: failureReason });
42986
42997
  }
42987
- const delay = remaining2 == null ? _RoomClient.RECONNECT_RETRY_INTERVAL_MS : Math.min(remaining2, _RoomClient.RECONNECT_RETRY_INTERVAL_MS);
42998
+ const backoffDelay = this._reconnectRetryDelay({ retryCount });
42999
+ const delay = remaining2 == null ? backoffDelay : Math.min(remaining2, backoffDelay);
42988
43000
  if (delay > 0) {
42989
43001
  await new Promise((resolve) => setTimeout(resolve, delay));
42990
43002
  }
43003
+ retryCount += 1;
42991
43004
  }
42992
43005
  const remaining = this._remainingReconnectTimeout(deadline);
42993
43006
  if (remaining != null && remaining === 0) {
@@ -43020,7 +43033,7 @@ ${newlined}
43020
43033
  if (error instanceof ProtocolStartupFailure) {
43021
43034
  recordFailureReason(error.reason);
43022
43035
  await this._closeProtocol(nextProtocol);
43023
- if (error.kind !== protocol_12.ProtocolCloseKind.ERROR) {
43036
+ if (!isRetryableStartupClose({ kind: error.kind, reason: error.reason })) {
43024
43037
  return {
43025
43038
  connected: false,
43026
43039
  closeKind: error.kind,
@@ -43512,7 +43525,8 @@ ${newlined}
43512
43525
  }
43513
43526
  };
43514
43527
  exports.RoomClient = RoomClient;
43515
- RoomClient.RECONNECT_RETRY_INTERVAL_MS = 1e3;
43528
+ RoomClient.RECONNECT_RETRY_BASE_DELAY_MS = 500;
43529
+ RoomClient.RECONNECT_RETRY_MAX_DELAY_MS = 3e4;
43516
43530
  }
43517
43531
  });
43518
43532
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshagent/meshagent-ts-auth",
3
- "version": "0.39.4",
3
+ "version": "0.39.5",
4
4
  "description": "Meshagent Typescript Auth",
5
5
  "homepage": "https://github.com/meshagent/meshagent-ts-auth",
6
6
  "scripts": {
@@ -39,7 +39,7 @@
39
39
  "CHANGELOG.md"
40
40
  ],
41
41
  "dependencies": {
42
- "@meshagent/meshagent": "^0.39.4",
42
+ "@meshagent/meshagent": "^0.39.5",
43
43
  "typescript": "^5.8.3"
44
44
  },
45
45
  "devDependencies": {