@signalwire/js 4.0.0-dev-20260416142417 → 4.0.0-dev-20260416174405

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.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as TokenRefreshError, C as RecoveryError, D as StorageNotAvailableError, E as SerializationError, F as VertoAttachHandlerError, I as VertoInviteHandlerError, L as VertoPongError, M as UnexpectedError, N as UnimplementedError, O as StorageReadError, P as ValidationError, R as WebSocketConnectionError, S as RPCTimeoutError, T as RequestTimeoutError, _ as JSONRPCError, a as filterNull, b as OverconstrainedFallbackError, c as CallCreateError, d as DPoPInitError, f as DependencyError, g as InvalidParams, h as InvalidCredentialsError, i as getValueFrom, j as TransportConnectionError, k as StorageWriteError, l as CollectionFetchError, m as DeviceTokenError, n as filterAs, o as getLogger, p as DeserializationError, s as AuthStateHandlerError, t as throwOnRPCError, u as ConversationError, v as MediaTrackError, w as RequestError, x as PreflightError, y as MessageParseError, z as WebSocketTimeoutError } from "./operators-BwHr2-zw.mjs";
1
+ import { A as StorageNotAvailableError, B as VertoPongError, C as OverconstrainedFallbackError, D as RequestError, E as RecoveryError, F as UnexpectedError, H as WebSocketTimeoutError, I as UnimplementedError, L as ValidationError, M as StorageWriteError, N as TokenRefreshError, O as RequestTimeoutError, P as TransportConnectionError, R as VertoAttachHandlerError, S as MessageParseError, T as RPCTimeoutError, V as WebSocketConnectionError, _ as DeviceTokenError, a as filterNull, b as JSONRPCError, c as setLogLevel, d as CallCreateError, f as CollectionFetchError, g as DeserializationError, h as DependencyError, i as getValueFrom, j as StorageReadError, k as SerializationError, l as setLogger, m as DPoPInitError, n as filterAs, o as getLogger, p as ConversationError, s as setDebugOptions, t as throwOnRPCError, u as AuthStateHandlerError, v as InvalidCredentialsError, w as PreflightError, x as MediaTrackError, y as InvalidParams, z as VertoInviteHandlerError } from "./operators-B1xH6k06.mjs";
2
2
  import { jwtDecode } from "jwt-decode";
3
3
  import { BehaviorSubject, EMPTY, NEVER, Observable, ReplaySubject, Subject, TimeoutError, asapScheduler, auditTime, catchError, combineLatest, debounceTime, defer, distinctUntilChanged, exhaustMap, filter, first, firstValueFrom, from, interval, lastValueFrom, map, merge, mergeMap, observeOn, of, pipe, race, scan, share, shareReplay, skip, skipWhile, startWith, switchMap, take, takeUntil, tap, throwError, timeout, timer, toArray, withLatestFrom } from "rxjs";
4
4
  import { v4 } from "uuid";
@@ -9630,11 +9630,10 @@ var WebSocketController = class WebSocketController extends Destroyable {
9630
9630
  }
9631
9631
  send(data) {
9632
9632
  if (this._status$.value === "connected" && this.socket?.readyState === 1) {
9633
- try {
9634
- logger$3.debug(`[WebSocketConnectionManager] Sending message:\n${JSON.stringify(JSON.parse(data), null, 2)}`);
9635
- } catch {
9636
- logger$3.warn(`[WebSocketConnectionManager] Sending non-JSON message:\n${data}`);
9637
- }
9633
+ logger$3.wsTraffic({
9634
+ type: "send",
9635
+ raw: data
9636
+ });
9638
9637
  this.socket.send(data);
9639
9638
  } else this.messageQueue.push(data);
9640
9639
  }
@@ -9697,11 +9696,10 @@ var WebSocketController = class WebSocketController extends Destroyable {
9697
9696
  this.handleConnectionError();
9698
9697
  }
9699
9698
  handleMessage(event) {
9700
- try {
9701
- logger$3.debug(`[WebSocketConnectionManager] Received message:\n${JSON.stringify(JSON.parse(event.data), null, 2)}`);
9702
- } catch {
9703
- logger$3.warn(`[WebSocketConnectionManager] Received non-JSON message:\n${event.data}`);
9704
- }
9699
+ logger$3.wsTraffic({
9700
+ type: "recv",
9701
+ raw: event.data
9702
+ });
9705
9703
  this._incomingMessages$.next(event);
9706
9704
  }
9707
9705
  handleConnectionError() {
@@ -10002,6 +10000,9 @@ var SignalWire = class extends Destroyable {
10002
10000
  if (this._options.webSocketConstructor) this._deps.WebSocket = this._options.webSocketConstructor;
10003
10001
  if (this._options.savePreferences) this.preferences.enableSavePreferences(this._deps.storage);
10004
10002
  if (this._options.webRTCApiProvider) this._deps.webRTCApiProvider = this._options.webRTCApiProvider;
10003
+ if (this._options.logger !== void 0) setLogger(this._options.logger);
10004
+ if (this._options.logLevel) setLogLevel(this._options.logLevel);
10005
+ if (this._options.debug) setDebugOptions(this._options.debug);
10005
10006
  this._deviceController = this._deps.deviceController;
10006
10007
  if (!this._options.skipDeviceMonitoring) this._deviceController.enableDeviceMonitoring();
10007
10008
  this.subscribeTo(this._deviceController.errors$, (error) => {
@@ -10078,7 +10079,7 @@ var SignalWire = class extends Destroyable {
10078
10079
  if (_credentials.expiry_at && credentialProvider?.refresh) this.scheduleCredentialRefresh(credentialProvider, _credentials.expiry_at);
10079
10080
  this._deps.credential = _credentials;
10080
10081
  this.persistCredential(_credentials);
10081
- if (this.isConnected && this._clientSession?.authenticated && _credentials.token) try {
10082
+ if (this.isConnected && this._clientSession.authenticated && _credentials.token) try {
10082
10083
  await this._clientSession.reauthenticate(_credentials.token);
10083
10084
  logger$1.info("[SignalWire] Session refreshed with new credentials.");
10084
10085
  } catch (error) {
@@ -10156,9 +10157,9 @@ var SignalWire = class extends Destroyable {
10156
10157
  * unexpectedly (e.g. network change, server restart). Reconnection uses an
10157
10158
  * **exponential back-off** strategy:
10158
10159
  *
10159
- * - First retry after `reconnectDelayMin` (default **1 s**).
10160
+ * - First retry after `reconnectDelayMin` (default **0.1 s**).
10160
10161
  * - Each subsequent retry doubles the delay up to `reconnectDelayMax`
10161
- * (default **30 s**).
10162
+ * (default **3 s**).
10162
10163
  * - The delay resets to `reconnectDelayMin` once a connection succeeds.
10163
10164
  * - A per-attempt `connectionTimeout` (default **10 s**) aborts the
10164
10165
  * attempt and schedules the next retry if the server does not respond.
@@ -10895,5 +10896,5 @@ const emitReadyEvent = () => {
10895
10896
  emitReadyEvent();
10896
10897
 
10897
10898
  //#endregion
10898
- export { Address, CallCreateError, ClientPreferences, CollectionFetchError, DPoPInitError, DeviceTokenError, InvalidCredentialsError, MediaTrackError, MessageParseError, OverconstrainedFallbackError, Participant, PreflightError, RecoveryError, SelfCapabilities, SelfParticipant, SignalWire, StaticCredentialProvider, Subscriber, TokenRefreshError, UnexpectedError, VertoPongError, WebRTCCall, embeddableCall, isSelfParticipant, ready, version };
10899
+ export { Address, CallCreateError, ClientPreferences, CollectionFetchError, DPoPInitError, DeviceTokenError, InvalidCredentialsError, MediaTrackError, MessageParseError, OverconstrainedFallbackError, Participant, PreflightError, RecoveryError, SelfCapabilities, SelfParticipant, SignalWire, StaticCredentialProvider, Subscriber, TokenRefreshError, UnexpectedError, VertoPongError, WebRTCCall, embeddableCall, isSelfParticipant, ready, setDebugOptions, setLogLevel, setLogger, version };
10899
10900
  //# sourceMappingURL=index.mjs.map