@asgardeo/browser 0.5.12 → 0.6.1
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/FetchHttpClient.d.ts +32 -0
- package/dist/__legacy__/client.d.ts +4 -3
- package/dist/__legacy__/helpers/authentication-helper.d.ts +6 -5
- package/dist/__legacy__/models/client.d.ts +3 -2
- package/dist/__legacy__/models/http-client.d.ts +6 -19
- package/dist/cjs/index.js +185 -298
- package/dist/cjs/index.js.map +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +96 -209
- package/dist/index.js.map +4 -4
- package/package.json +2 -3
- package/dist/__legacy__/http-client/clients/axios-http-client.d.ts +0 -126
- package/dist/__legacy__/http-client/clients/index.d.ts +0 -19
- package/dist/__legacy__/http-client/helpers/decorators.d.ts +0 -24
- package/dist/__legacy__/http-client/helpers/index.d.ts +0 -19
- package/dist/__legacy__/http-client/index.d.ts +0 -20
- package/dist/__legacy__/http-client/models/axios-http-client.d.ts +0 -34
- package/dist/__legacy__/http-client/models/http-client.d.ts +0 -41
- package/dist/__legacy__/http-client/models/index.d.ts +0 -20
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { HttpClient, HttpRequestConfig, HttpResponse } from '@asgardeo/javascript';
|
|
19
|
+
/**
|
|
20
|
+
* Fetch-based HTTP client. Extends `HttpClient` and implements `transport()`
|
|
21
|
+
* using the native Fetch API.
|
|
22
|
+
*
|
|
23
|
+
* To plug in a custom HTTP transport, extend `HttpClient` from `@asgardeo/javascript`
|
|
24
|
+
* and override `transport()`, then pass your implementation where `FetchHttpClient`
|
|
25
|
+
* is currently used.
|
|
26
|
+
*/
|
|
27
|
+
export declare class FetchHttpClient extends HttpClient {
|
|
28
|
+
private static instances;
|
|
29
|
+
static getInstance(instanceId?: number, isHandlerEnabled?: boolean, attachToken?: (request: HttpRequestConfig) => Promise<void>): FetchHttpClient;
|
|
30
|
+
static destroyInstance(instanceId?: number): void;
|
|
31
|
+
protected transport<T = any>(config: HttpRequestConfig): Promise<HttpResponse<T>>;
|
|
32
|
+
}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
import { AuthClientConfig, IsomorphicCrypto, TokenExchangeRequestConfig, StorageManager, IdToken, OIDCEndpoints, User } from '@asgardeo/javascript';
|
|
19
19
|
import { Hooks } from './constants';
|
|
20
20
|
import { AuthenticationHelper } from './helpers';
|
|
21
|
-
import {
|
|
21
|
+
import { HttpClient } from '@asgardeo/javascript';
|
|
22
22
|
import { AuthSPAClientConfig, LegacyConfig as Config, HttpRequestConfig, HttpResponse, MainThreadClientConfig, MainThreadClientInterface, SignInConfig, SignOutError, WebWorkerClientConfig, WebWorkerClientInterface } from './models';
|
|
23
23
|
import { BrowserStorage } from './models/storage';
|
|
24
24
|
/**
|
|
@@ -460,13 +460,13 @@ export declare class AsgardeoSPAClient {
|
|
|
460
460
|
/**
|
|
461
461
|
* This methods returns the Axios http client.
|
|
462
462
|
*
|
|
463
|
-
* @return {
|
|
463
|
+
* @return {HttpClient} - The Axios HTTP client.
|
|
464
464
|
*
|
|
465
465
|
* @memberof AsgardeoSPAClient
|
|
466
466
|
*
|
|
467
467
|
* @preserve
|
|
468
468
|
*/
|
|
469
|
-
getHttpClient():
|
|
469
|
+
getHttpClient(): HttpClient;
|
|
470
470
|
/**
|
|
471
471
|
* This method decodes a JWT token payload and returns it.
|
|
472
472
|
*
|
|
@@ -671,6 +671,7 @@ export declare class AsgardeoSPAClient {
|
|
|
671
671
|
* @preserve
|
|
672
672
|
*/
|
|
673
673
|
isSignedIn(): Promise<boolean | undefined>;
|
|
674
|
+
startAutoRefreshToken(): Promise<void>;
|
|
674
675
|
/**
|
|
675
676
|
* This method specifies if there is an active session in the browser or not.
|
|
676
677
|
*
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { AsgardeoAuthClient, AuthClientConfig, User, IsomorphicCrypto, TokenExchangeRequestConfig, StorageManager, IdToken, ExtendedAuthorizeRequestUrlParams, OIDCEndpoints } from '@asgardeo/javascript';
|
|
19
19
|
import { SPAHelper } from './spa-helper';
|
|
20
|
-
import {
|
|
20
|
+
import { HttpClient } from '@asgardeo/javascript';
|
|
21
|
+
import { HttpError, HttpRequestConfig, HttpRequestInterface, HttpResponse, MainThreadClientConfig, SessionManagementHelperInterface, WebWorkerClientConfig } from '../models';
|
|
21
22
|
import { SPACustomGrantConfig } from '../models/request-custom-grant';
|
|
22
23
|
export declare class AuthenticationHelper<T extends MainThreadClientConfig | WebWorkerClientConfig> {
|
|
23
24
|
protected _authenticationClient: AsgardeoAuthClient<T>;
|
|
@@ -26,15 +27,15 @@ export declare class AuthenticationHelper<T extends MainThreadClientConfig | Web
|
|
|
26
27
|
protected _instanceId: number;
|
|
27
28
|
protected _isTokenRefreshing: boolean;
|
|
28
29
|
constructor(authClient: AsgardeoAuthClient<T>, spaHelper: SPAHelper<T>);
|
|
29
|
-
enableHttpHandler(httpClient:
|
|
30
|
-
disableHttpHandler(httpClient:
|
|
30
|
+
enableHttpHandler(httpClient: HttpClient): void;
|
|
31
|
+
disableHttpHandler(httpClient: HttpClient): void;
|
|
31
32
|
initializeSessionManger(config: AuthClientConfig<T>, oidcEndpoints: OIDCEndpoints, getSessionState: () => Promise<string>, getAuthzURL: (params?: ExtendedAuthorizeRequestUrlParams) => Promise<string>, sessionManagementHelper: SessionManagementHelperInterface): void;
|
|
32
33
|
exchangeToken(config: SPACustomGrantConfig, enableRetrievingSignOutURLFromSession?: (config: SPACustomGrantConfig) => void): Promise<User | Response>;
|
|
33
34
|
getCustomGrantConfigData(): Promise<AuthClientConfig<TokenExchangeRequestConfig> | null>;
|
|
34
35
|
refreshAccessToken(enableRetrievingSignOutURLFromSession?: (config: SPACustomGrantConfig) => void): Promise<User>;
|
|
35
36
|
protected retryFailedRequests(failedRequest: HttpRequestInterface): Promise<HttpResponse>;
|
|
36
|
-
httpRequest(httpClient:
|
|
37
|
-
httpRequestAll(requestConfigs: HttpRequestConfig[], httpClient:
|
|
37
|
+
httpRequest(httpClient: HttpClient, requestConfig: HttpRequestConfig, isHttpHandlerEnabled?: boolean, httpErrorCallback?: (error: HttpError) => void | Promise<void>, httpFinishCallback?: () => void, enableRetrievingSignOutURLFromSession?: (config: SPACustomGrantConfig) => void): Promise<HttpResponse>;
|
|
38
|
+
httpRequestAll(requestConfigs: HttpRequestConfig[], httpClient: HttpClient, isHttpHandlerEnabled?: boolean, httpErrorCallback?: (error: HttpError) => void | Promise<void>, httpFinishCallback?: () => void): Promise<HttpResponse[] | undefined>;
|
|
38
39
|
requestAccessToken(authorizationCode?: string, sessionState?: string, checkSession?: () => Promise<void>, pkce?: string, state?: string, tokenRequestConfig?: {
|
|
39
40
|
params: Record<string, unknown>;
|
|
40
41
|
}): Promise<User>;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { AuthClientConfig, User, IsomorphicCrypto, TokenExchangeRequestConfig, StorageManager, IdToken, OIDCEndpoints } from '@asgardeo/javascript';
|
|
19
19
|
import { HttpError, HttpRequestConfig, HttpResponse, MainThreadClientConfig, SignInConfig, WebWorkerClientConfig } from '.';
|
|
20
|
-
import {
|
|
20
|
+
import { HttpClient } from '@asgardeo/javascript';
|
|
21
21
|
export interface MainThreadClientInterface {
|
|
22
22
|
setHttpRequestStartCallback(callback: () => void): void;
|
|
23
23
|
setHttpRequestSuccessCallback(callback: (response: HttpResponse) => void): void;
|
|
@@ -25,7 +25,7 @@ export interface MainThreadClientInterface {
|
|
|
25
25
|
setHttpRequestErrorCallback(callback: (error: HttpError) => void | Promise<void>): void;
|
|
26
26
|
httpRequest(config: HttpRequestConfig): Promise<HttpResponse>;
|
|
27
27
|
httpRequestAll(config: HttpRequestConfig[]): Promise<HttpResponse[] | undefined>;
|
|
28
|
-
getHttpClient():
|
|
28
|
+
getHttpClient(): HttpClient;
|
|
29
29
|
enableHttpHandler(): boolean;
|
|
30
30
|
disableHttpHandler(): boolean;
|
|
31
31
|
signIn(config?: SignInConfig, authorizationCode?: string, sessionState?: string, afterSignInUrl?: string, tokenRequestConfig?: {
|
|
@@ -44,6 +44,7 @@ export interface MainThreadClientInterface {
|
|
|
44
44
|
getAccessToken(sessionId?: string): Promise<string>;
|
|
45
45
|
getStorageManager(): Promise<StorageManager<MainThreadClientConfig>>;
|
|
46
46
|
isSignedIn(): Promise<boolean>;
|
|
47
|
+
startAutoRefreshToken(): Promise<void>;
|
|
47
48
|
reInitialize(config: Partial<AuthClientConfig<MainThreadClientConfig>>): Promise<void>;
|
|
48
49
|
signInSilently(additionalParams?: Record<string, string | boolean>, tokenRequestConfig?: {
|
|
49
50
|
params: Record<string, unknown>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c) 2020-
|
|
2
|
+
* Copyright (c) 2020-2025, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
3
|
*
|
|
4
4
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
|
5
5
|
* Version 2.0 (the "License"); you may not use this file except
|
|
@@ -15,28 +15,15 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
export
|
|
22
|
-
requestStartCallback: () => void;
|
|
23
|
-
requestSuccessCallback: (response: HttpResponse) => void;
|
|
24
|
-
requestErrorCallback: (error: HttpError) => void | Promise<void>;
|
|
25
|
-
requestFinishCallback: () => void;
|
|
26
|
-
}
|
|
18
|
+
import { HttpClient, HttpError, HttpRequestConfig } from '@asgardeo/javascript';
|
|
19
|
+
import { SPACustomGrantConfig } from './request-custom-grant';
|
|
20
|
+
export { HttpClient } from '@asgardeo/javascript';
|
|
21
|
+
export type { HttpError, HttpRequestConfig, HttpResponse } from '@asgardeo/javascript';
|
|
27
22
|
export interface HttpRequestInterface {
|
|
28
|
-
httpClient:
|
|
23
|
+
httpClient: HttpClient;
|
|
29
24
|
requestConfig: HttpRequestConfig;
|
|
30
25
|
isHttpHandlerEnabled?: boolean;
|
|
31
26
|
httpErrorCallback?: (error: HttpError) => void | Promise<void>;
|
|
32
27
|
httpFinishCallback?: () => void;
|
|
33
28
|
enableRetrievingSignOutURLFromSession?: (config: SPACustomGrantConfig) => void;
|
|
34
29
|
}
|
|
35
|
-
export interface HttpRequestConfig extends AxiosRequestConfig, Omit<Request, 'headers' | 'method' | 'signal' | 'url'> {
|
|
36
|
-
attachToken?: boolean;
|
|
37
|
-
shouldEncodeToFormData?: boolean;
|
|
38
|
-
shouldAttachIDPAccessToken?: boolean;
|
|
39
|
-
startTimeInMs?: number;
|
|
40
|
-
}
|
|
41
|
-
export type { AxiosResponse as HttpResponse, Method as HttpMethod, AxiosRequestTransformer as HttpRequestTransformer, AxiosResponseTransformer as HttpResponseTransformer, AxiosAdapter as HttpAdapter, AxiosBasicCredentials as HttpBasicCredentials, ResponseType, AxiosProxyConfig as HttpProxyConfig, CancelToken, AxiosError as HttpError, AxiosPromise as HttpPromise, AxiosInstance as HttpInstance, } from 'axios';
|
|
42
|
-
export { HttpClientInstance } from '../http-client';
|