@asgardeo/browser 0.3.0 → 0.4.2

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.
@@ -36,9 +36,9 @@ import { HttpClientInstance, HttpClientInterface } from '../models';
36
36
  * ```
37
37
  */
38
38
  export declare class HttpClient implements HttpClientInterface<HttpRequestConfig, HttpResponse, HttpError> {
39
- private static axiosInstance;
40
- private static clientInstance;
41
- private static isHandlerEnabled;
39
+ private static instances;
40
+ private static clientInstances;
41
+ private isHandlerEnabled;
42
42
  private attachToken;
43
43
  private requestStartCallback;
44
44
  private requestSuccessCallback;
@@ -53,11 +53,20 @@ export declare class HttpClient implements HttpClientInterface<HttpRequestConfig
53
53
  */
54
54
  private constructor();
55
55
  /**
56
- * Returns an aggregated instance of type `HttpInstance` of `HttpClient`.
56
+ * Returns an instance-specific HttpClient instance.
57
+ * Each instance ID gets its own axios instance and HttpClient to avoid state conflicts.
57
58
  *
58
- * @return {any}
59
+ * @param instanceId - The instance ID for multi-auth context support. Defaults to 0.
60
+ * @return {HttpClientInstance}
59
61
  */
60
- static getInstance(): HttpClientInstance;
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;
61
70
  /**
62
71
  * Intercepts all the requests.
63
72
  * If the `isHandlerEnabled` flag is set to true, fires the `requestStartCallback`
@@ -21,7 +21,7 @@ import { HttpError, HttpResponse } from "../../models";
21
21
  * Http client interface with static functions.
22
22
  */
23
23
  export interface HttpClientStatic<S> {
24
- getInstance(): S;
24
+ getInstance(instanceId?: number): S;
25
25
  }
26
26
  /**
27
27
  * Http client interface.
@@ -18,4 +18,4 @@
18
18
  import { AsgardeoAuthClient, AuthClientConfig } from '@asgardeo/javascript';
19
19
  import { AuthenticationHelper, SPAHelper } from '../helpers';
20
20
  import { WebWorkerClientConfig, WebWorkerCoreInterface } from '../models';
21
- export declare const WebWorkerCore: (config: AuthClientConfig<WebWorkerClientConfig>, getAuthHelper: (authClient: AsgardeoAuthClient<WebWorkerClientConfig>, spaHelper: SPAHelper<WebWorkerClientConfig>) => AuthenticationHelper<WebWorkerClientConfig>) => Promise<WebWorkerCoreInterface>;
21
+ export declare const WebWorkerCore: (instanceID: number, config: AuthClientConfig<WebWorkerClientConfig>, getAuthHelper: (authClient: AsgardeoAuthClient<WebWorkerClientConfig>, spaHelper: SPAHelper<WebWorkerClientConfig>) => AuthenticationHelper<WebWorkerClientConfig>) => Promise<WebWorkerCoreInterface>;