@asgardeo/browser 0.5.12 → 0.6.0
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 +3 -3
- package/dist/__legacy__/helpers/authentication-helper.d.ts +6 -5
- package/dist/__legacy__/models/client.d.ts +2 -2
- package/dist/__legacy__/models/http-client.d.ts +6 -19
- package/dist/cjs/index.js +164 -295
- package/dist/cjs/index.js.map +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +75 -206
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asgardeo/browser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Browser-specific implementation of Asgardeo JavaScript SDK.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"asgardeo",
|
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
"vitest": "3.1.3"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"axios": "1.13.5",
|
|
52
51
|
"base64url": "3.0.1",
|
|
53
52
|
"buffer": "6.0.3",
|
|
54
53
|
"core-js": "3.42.0",
|
|
@@ -59,7 +58,7 @@
|
|
|
59
58
|
"randombytes": "2.1.0",
|
|
60
59
|
"stream-browserify": "3.0.0",
|
|
61
60
|
"tslib": "2.8.1",
|
|
62
|
-
"@asgardeo/javascript": "0.
|
|
61
|
+
"@asgardeo/javascript": "0.16.0"
|
|
63
62
|
},
|
|
64
63
|
"publishConfig": {
|
|
65
64
|
"access": "public"
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
|
-
*
|
|
4
|
-
* WSO2 Inc. 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
|
-
*/
|
|
19
|
-
import { HttpError, HttpRequestConfig, HttpResponse } from '../../..';
|
|
20
|
-
import { HttpClientInstance, HttpClientInterface } from '../models';
|
|
21
|
-
/**
|
|
22
|
-
* An Http Http client to perform Http requests.
|
|
23
|
-
*
|
|
24
|
-
* @remarks
|
|
25
|
-
* Typescript doesn't support static functions in interfaces. Therefore,
|
|
26
|
-
* a decorator i.e `staticDecorator` was written to add static support.
|
|
27
|
-
* Follow {@link https://github.com/Microsoft/TypeScript/issues/13462}
|
|
28
|
-
* for more info.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* Example usage.
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* const httpClient = HttpClient.getInstance();
|
|
35
|
-
* httpClient.init(true, onRequestStart, onRequestSuccess, onRequestError, onRequestFinish);
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
export declare class HttpClient implements HttpClientInterface<HttpRequestConfig, HttpResponse, HttpError> {
|
|
39
|
-
private static instances;
|
|
40
|
-
private static clientInstances;
|
|
41
|
-
private isHandlerEnabled;
|
|
42
|
-
private attachToken;
|
|
43
|
-
private requestStartCallback;
|
|
44
|
-
private requestSuccessCallback;
|
|
45
|
-
private requestErrorCallback;
|
|
46
|
-
private requestFinishCallback;
|
|
47
|
-
private static readonly DEFAULT_HANDLER_DISABLE_TIMEOUT;
|
|
48
|
-
/**
|
|
49
|
-
* Private constructor to avoid object instantiation from outside
|
|
50
|
-
* the class.
|
|
51
|
-
*
|
|
52
|
-
* @hideconstructor
|
|
53
|
-
*/
|
|
54
|
-
private constructor();
|
|
55
|
-
/**
|
|
56
|
-
* Returns an instance-specific HttpClient instance.
|
|
57
|
-
* Each instance ID gets its own axios instance and HttpClient to avoid state conflicts.
|
|
58
|
-
*
|
|
59
|
-
* @param instanceId - The instance ID for multi-auth context support. Defaults to 0.
|
|
60
|
-
* @return {HttpClientInstance}
|
|
61
|
-
*/
|
|
62
|
-
static getInstance(instanceId?: number): HttpClientInstance;
|
|
63
|
-
/**
|
|
64
|
-
* Destroys and cleans up an HttpClient instance.
|
|
65
|
-
* This should be called during provider teardown to prevent memory leaks.
|
|
66
|
-
*
|
|
67
|
-
* @param instanceId - The instance ID to destroy. Defaults to 0.
|
|
68
|
-
*/
|
|
69
|
-
static destroyInstance(instanceId?: number): void;
|
|
70
|
-
/**
|
|
71
|
-
* Intercepts all the requests.
|
|
72
|
-
* If the `isHandlerEnabled` flag is set to true, fires the `requestStartCallback`
|
|
73
|
-
* and retrieves the access token from the server and attaches it to the request.
|
|
74
|
-
* Else, just returns the original request.
|
|
75
|
-
*
|
|
76
|
-
* @param {HttpRequestConfig} request - Original request.
|
|
77
|
-
* @return {HttpRequestConfig}
|
|
78
|
-
*/
|
|
79
|
-
requestHandler(request: HttpRequestConfig): Promise<HttpRequestConfig>;
|
|
80
|
-
/**
|
|
81
|
-
* Handles response errors.
|
|
82
|
-
* If the `isHandlerEnabled` flag is set to true, fires the `requestErrorCallback`
|
|
83
|
-
* and the `requestFinishCallback` functions. Else, just returns the original error.
|
|
84
|
-
*
|
|
85
|
-
* @param {HttpError} error - Original error.
|
|
86
|
-
* @return {HttpError}
|
|
87
|
-
*/
|
|
88
|
-
errorHandler(error: HttpError): HttpError;
|
|
89
|
-
/**
|
|
90
|
-
* Handles response success.
|
|
91
|
-
* If the `isHandlerEnabled` flag is set to true, fires the `requestSuccessCallback`
|
|
92
|
-
* and the `requestFinishCallback` functions. Else, just returns the original response.
|
|
93
|
-
*
|
|
94
|
-
* @param {HttpResponse} response - Original response.
|
|
95
|
-
* @return {HttpResponse}
|
|
96
|
-
*/
|
|
97
|
-
successHandler(response: HttpResponse): HttpResponse;
|
|
98
|
-
/**
|
|
99
|
-
* Initializes the Http client.
|
|
100
|
-
*
|
|
101
|
-
* @param isHandlerEnabled - Flag to toggle handler enablement.
|
|
102
|
-
* @param requestStartCallback - Callback function to be triggered on request start.
|
|
103
|
-
* @param requestSuccessCallback - Callback function to be triggered on request success.
|
|
104
|
-
* @param requestErrorCallback - Callback function to be triggered on request error.
|
|
105
|
-
* @param requestFinishCallback - Callback function to be triggered on request error.
|
|
106
|
-
*/
|
|
107
|
-
init(isHandlerEnabled: boolean, attachToken: (request: HttpRequestConfig) => Promise<void>): Promise<void>;
|
|
108
|
-
/**
|
|
109
|
-
* Enables the handler.
|
|
110
|
-
*/
|
|
111
|
-
enableHandler(): void;
|
|
112
|
-
/**
|
|
113
|
-
* Disables the handler.
|
|
114
|
-
*/
|
|
115
|
-
disableHandler(): void;
|
|
116
|
-
/**
|
|
117
|
-
* Disables the handler for a given period of time.
|
|
118
|
-
*
|
|
119
|
-
* @param {number} timeout - Timeout in milliseconds.
|
|
120
|
-
*/
|
|
121
|
-
disableHandlerWithTimeout(timeout?: number): void;
|
|
122
|
-
setHttpRequestStartCallback(callback: () => void): void;
|
|
123
|
-
setHttpRequestSuccessCallback(callback: (response: HttpResponse) => void): void;
|
|
124
|
-
setHttpRequestErrorCallback(callback: (error: HttpError) => void): void;
|
|
125
|
-
setHttpRequestFinishCallback(callback: () => void): void;
|
|
126
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
|
-
*
|
|
4
|
-
* WSO2 Inc. 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
|
-
*/
|
|
19
|
-
export * from "./axios-http-client";
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
|
-
*
|
|
4
|
-
* WSO2 Inc. 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
|
-
*/
|
|
19
|
-
/**
|
|
20
|
-
* A decorator to supplement static interface support.
|
|
21
|
-
*
|
|
22
|
-
* @return {<U extends T>(constructor: U) => void}
|
|
23
|
-
*/
|
|
24
|
-
export declare function staticDecorator<T>(): <U extends T>(constructor: U) => U;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
|
-
*
|
|
4
|
-
* WSO2 Inc. 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
|
-
*/
|
|
19
|
-
export * from "./decorators";
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
|
-
*
|
|
4
|
-
* WSO2 Inc. 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
|
-
*/
|
|
19
|
-
export * from "./clients";
|
|
20
|
-
export * from "./models";
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
|
-
*
|
|
4
|
-
* WSO2 Inc. 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
|
-
*/
|
|
19
|
-
import { HttpError, HttpInstance, HttpRequestConfig, HttpResponse } from '../../..';
|
|
20
|
-
/**
|
|
21
|
-
* Http Http Client model
|
|
22
|
-
*/
|
|
23
|
-
export interface HttpClientInstance extends HttpInstance {
|
|
24
|
-
init?(isHandlerEnabled: boolean, attachToken: (request: HttpRequestConfig) => Promise<void>): Promise<void>;
|
|
25
|
-
disableHandler?: () => void;
|
|
26
|
-
disableHandlerWithTimeout?: (timeout: number) => void;
|
|
27
|
-
enableHandler?: () => void;
|
|
28
|
-
all?<T>(values: (T | Promise<T>)[]): Promise<T[]>;
|
|
29
|
-
spread?<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
|
|
30
|
-
setHttpRequestStartCallback?: (callback: () => void) => void;
|
|
31
|
-
setHttpRequestSuccessCallback?: (callback: (response: HttpResponse) => void) => void;
|
|
32
|
-
setHttpRequestErrorCallback?: (callback: (error: HttpError) => void) => void;
|
|
33
|
-
setHttpRequestFinishCallback?: (callback: () => void) => void;
|
|
34
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
|
-
*
|
|
4
|
-
* WSO2 Inc. 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
|
-
*/
|
|
19
|
-
import { HttpError, HttpResponse } from "../../models";
|
|
20
|
-
/**
|
|
21
|
-
* Http client interface with static functions.
|
|
22
|
-
*/
|
|
23
|
-
export interface HttpClientStatic<S> {
|
|
24
|
-
getInstance(instanceId?: number): S;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Http client interface.
|
|
28
|
-
*/
|
|
29
|
-
export interface HttpClientInterface<T, U, V> {
|
|
30
|
-
init(isHandlerEnabled: boolean, attachToken: () => Promise<void>): Promise<void>;
|
|
31
|
-
disableHandler: () => void;
|
|
32
|
-
disableHandlerWithTimeout: (timeout: number) => void;
|
|
33
|
-
enableHandler: () => void;
|
|
34
|
-
errorHandler(error: V): V;
|
|
35
|
-
requestHandler(request: T): Promise<T>;
|
|
36
|
-
successHandler(response: U): U;
|
|
37
|
-
setHttpRequestStartCallback?: (callback: () => void) => void;
|
|
38
|
-
setHttpRequestSuccessCallback?: (callback: (response: HttpResponse) => void) => void;
|
|
39
|
-
setHttpRequestErrorCallback?: (callback: (error: HttpError) => void) => void;
|
|
40
|
-
setHttpRequestFinishCallback?: (callback: () => void) => void;
|
|
41
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
|
-
*
|
|
4
|
-
* WSO2 Inc. 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
|
-
*/
|
|
19
|
-
export * from "./axios-http-client";
|
|
20
|
-
export * from "./http-client";
|