@actuallab/rpc 12.3.83 → 12.3.85

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/index.d.cts CHANGED
@@ -748,7 +748,7 @@ declare const RPC_CLOSE_CODE_UNSUPPORTED_FORMAT = 4001;
748
748
  /** Maximum time to wait for the server's handshake response after opening the socket. */
749
749
  declare const HANDSHAKE_TIMEOUT_MS = 10000;
750
750
  /** Builds the WebSocket connection URL for an RpcClientPeer. */
751
- type RpcConnectionUrlResolver = (peer: RpcClientPeer) => string;
751
+ type RpcConnectionUrlResolver = (peer: RpcClientPeer) => string | Promise<string>;
752
752
  /** Default connection URL provider — sets `clientId` and `f` query parameters,
753
753
  * replacing any existing values to keep the wire format consistent with the
754
754
  * peer's actual `serializationFormat`. */
package/dist/index.d.ts CHANGED
@@ -748,7 +748,7 @@ declare const RPC_CLOSE_CODE_UNSUPPORTED_FORMAT = 4001;
748
748
  /** Maximum time to wait for the server's handshake response after opening the socket. */
749
749
  declare const HANDSHAKE_TIMEOUT_MS = 10000;
750
750
  /** Builds the WebSocket connection URL for an RpcClientPeer. */
751
- type RpcConnectionUrlResolver = (peer: RpcClientPeer) => string;
751
+ type RpcConnectionUrlResolver = (peer: RpcClientPeer) => string | Promise<string>;
752
752
  /** Default connection URL provider — sets `clientId` and `f` query parameters,
753
753
  * replacing any existing values to keep the wire format consistent with the
754
754
  * peer's actual `serializationFormat`. */
package/dist/index.js CHANGED
@@ -2188,6 +2188,17 @@ var defaultConnectionUrlResolver = (peer) => {
2188
2188
  return peer.ref + sep + `clientId=${peer.clientId}&f=${formatKey}`;
2189
2189
  }
2190
2190
  };
2191
+ var sanitizeUrl = (url) => {
2192
+ try {
2193
+ const parsed = new URL(url);
2194
+ if (!parsed.searchParams.has("session"))
2195
+ return url;
2196
+ parsed.searchParams.set("session", "<redacted>");
2197
+ return parsed.toString();
2198
+ } catch {
2199
+ return url.replace(/([?&]session=)[^&]*/i, "$1<redacted>");
2200
+ }
2201
+ };
2191
2202
  function parseFormatFromUrl(url) {
2192
2203
  try {
2193
2204
  const f = new URL(url).searchParams.get("f");
@@ -2635,7 +2646,6 @@ var RpcClientPeer = class extends RpcPeer {
2635
2646
  }
2636
2647
  async _runImpl() {
2637
2648
  if (this._disposed) return;
2638
- const connUrl = this.connectionUrlResolver(this);
2639
2649
  infoLog?.log(`'${this.ref}': Started (Client)`);
2640
2650
  try {
2641
2651
  while (!this._disposed) {
@@ -2656,7 +2666,8 @@ var RpcClientPeer = class extends RpcPeer {
2656
2666
  let lastCloseCode = 0;
2657
2667
  let lastCloseReason = "";
2658
2668
  try {
2659
- infoLog?.log(`'${this.ref}': Connecting to ${connUrl}`);
2669
+ const connUrl = await this.connectionUrlResolver(this);
2670
+ infoLog?.log(`'${this.ref}': Connecting to ${sanitizeUrl(connUrl)}`);
2660
2671
  const ws = this.webSocketFactory?.(connUrl) ?? new WebSocket(connUrl);
2661
2672
  const conn = new RpcWebSocketConnection(
2662
2673
  ws,