@signalwire/core
Advanced tools
Comparing version 4.0.0-dev.202403070124.19281d4.1 to 4.0.0-dev.202403131226.8667fdc.1
@@ -76,2 +76,4 @@ import type { Channel, SagaIterator } from '@redux-saga/types'; | ||
error: SessionAuthError; | ||
}> | PayloadAction<{ | ||
token: string; | ||
}> | PayloadAction<SessionAuthStatus>; | ||
@@ -78,0 +80,0 @@ export declare type SwEventChannel = MulticastChannel<MapToPubSubShape<SwEventParams>>; |
@@ -48,11 +48,4 @@ /// <reference types="node" /> | ||
logLevel?: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent'; | ||
/** To refresh the auth token */ | ||
onRefreshToken?(): Promise<void>; | ||
/** | ||
* The SDK invokes this method and uses the new token to re-auth. | ||
* TODO: rename it: getNewToken, getRefreshedToken, fetchToken (?) | ||
* | ||
* @internal | ||
* */ | ||
_onRefreshToken?(): Promise<void>; | ||
/** The SDK invokes this method and uses the new token to re-auth. */ | ||
onRefreshToken?(): Promise<string>; | ||
sessionChannel?: SessionChannel; | ||
@@ -59,0 +52,0 @@ /** Unified eventing is required only with Call Fabric SDK */ |
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "4.0.0-dev.202403070124.19281d4.1", | ||
"version": "4.0.0-dev.202403131226.8667fdc.1", | ||
"main": "dist/index.node.js", | ||
@@ -9,0 +9,0 @@ "module": "dist/index.esm.js", |
@@ -9,3 +9,3 @@ import { | ||
import { BaseSession } from './BaseSession' | ||
import { authExpiringAction } from './redux/actions' | ||
import { authExpiringAction, reauthAction } from './redux/actions' | ||
import { type SWCloseEvent, isSATAuth } from './utils' | ||
@@ -154,4 +154,3 @@ | ||
} | ||
const refreshTokenFn = | ||
this.options._onRefreshToken || this.options.onRefreshToken | ||
const refreshTokenFn = this.options.onRefreshToken | ||
if (this.expiresIn <= this._refreshTokenNotificationDiff) { | ||
@@ -162,3 +161,4 @@ this.dispatch(authExpiringAction()) | ||
try { | ||
await refreshTokenFn() | ||
const token = await refreshTokenFn() | ||
this.dispatch(reauthAction({ token })) | ||
} catch (error) { | ||
@@ -165,0 +165,0 @@ this.logger.error(error) |
@@ -59,3 +59,3 @@ import type { Channel, SagaIterator } from '@redux-saga/types' | ||
[key: string]: ReduxComponent | ||
}, | ||
} | ||
} | ||
@@ -124,2 +124,3 @@ | ||
| PayloadAction<{ error: SessionAuthError }> | ||
| PayloadAction<{ token: string }> | ||
| PayloadAction<SessionAuthStatus> | ||
@@ -126,0 +127,0 @@ |
@@ -113,11 +113,4 @@ import type { SagaIterator } from '@redux-saga/types' | ||
logLevel?: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent' | ||
/** To refresh the auth token */ | ||
onRefreshToken?(): Promise<void> | ||
/** | ||
* The SDK invokes this method and uses the new token to re-auth. | ||
* TODO: rename it: getNewToken, getRefreshedToken, fetchToken (?) | ||
* | ||
* @internal | ||
* */ | ||
_onRefreshToken?(): Promise<void> | ||
/** The SDK invokes this method and uses the new token to re-auth. */ | ||
onRefreshToken?(): Promise<string> | ||
sessionChannel?: SessionChannel | ||
@@ -124,0 +117,0 @@ /** Unified eventing is required only with Call Fabric SDK */ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2839178
41247