@equinor/fusion-framework-module-http 5.2.3 → 6.0.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/CHANGELOG.md +162 -0
- package/README.md +759 -36
- package/dist/esm/configurator.js +10 -1
- package/dist/esm/configurator.js.map +1 -1
- package/dist/esm/errors.js +18 -0
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/client/client-msal.js +35 -0
- package/dist/esm/lib/client/client-msal.js.map +1 -1
- package/dist/esm/lib/client/client.js +153 -6
- package/dist/esm/lib/client/client.js.map +1 -1
- package/dist/esm/lib/operators/http-request-handler.js +16 -0
- package/dist/esm/lib/operators/http-request-handler.js.map +1 -1
- package/dist/esm/lib/operators/http-response-handler.js +6 -0
- package/dist/esm/lib/operators/http-response-handler.js.map +1 -1
- package/dist/esm/lib/operators/process-operators.js +49 -1
- package/dist/esm/lib/operators/process-operators.js.map +1 -1
- package/dist/esm/lib/operators/request-operator-header.js +7 -0
- package/dist/esm/lib/operators/request-operator-header.js.map +1 -1
- package/dist/esm/lib/selectors/blob-selector.js +28 -3
- package/dist/esm/lib/selectors/blob-selector.js.map +1 -1
- package/dist/esm/lib/selectors/json-selector.js +24 -0
- package/dist/esm/lib/selectors/json-selector.js.map +1 -1
- package/dist/esm/module.js +40 -0
- package/dist/esm/module.js.map +1 -1
- package/dist/esm/provider.js +65 -6
- package/dist/esm/provider.js.map +1 -1
- package/dist/esm/version.js +2 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/configurator.d.ts +76 -0
- package/dist/types/errors.d.ts +18 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/lib/client/client-msal.d.ts +43 -0
- package/dist/types/lib/client/client.d.ts +147 -3
- package/dist/types/lib/client/types.d.ts +156 -5
- package/dist/types/lib/operators/http-request-handler.d.ts +16 -0
- package/dist/types/lib/operators/http-response-handler.d.ts +6 -0
- package/dist/types/lib/operators/process-operators.d.ts +44 -0
- package/dist/types/lib/operators/request-operator-header.d.ts +7 -0
- package/dist/types/lib/operators/types.d.ts +57 -0
- package/dist/types/lib/selectors/blob-selector.d.ts +9 -1
- package/dist/types/lib/selectors/index.d.ts +1 -0
- package/dist/types/lib/selectors/json-selector.d.ts +16 -1
- package/dist/types/module.d.ts +35 -0
- package/dist/types/provider.d.ts +77 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +5 -5
- package/src/configurator.ts +38 -1
- package/src/errors.ts +11 -1
- package/src/lib/client/client-msal.ts +50 -5
- package/src/lib/client/client.ts +161 -12
- package/src/lib/client/types.ts +149 -71
- package/src/lib/operators/http-request-handler.ts +12 -4
- package/src/lib/operators/http-response-handler.ts +6 -0
- package/src/lib/operators/process-operators.ts +6 -1
- package/src/lib/operators/request-operator-header.ts +7 -0
- package/src/lib/operators/types.ts +22 -4
- package/src/lib/selectors/blob-selector.ts +26 -4
- package/src/lib/selectors/index.ts +2 -0
- package/src/lib/selectors/json-selector.ts +29 -9
- package/src/module.ts +55 -2
- package/src/provider.ts +76 -2
- package/src/version.ts +1 -1
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import type { Observable } from 'rxjs';
|
|
2
2
|
import type { FetchRequest } from '../client';
|
|
3
3
|
|
|
4
|
-
export type ProcessOperator<T, R = T> = (request: T) => R | void | Promise<R | void>;
|
|
5
|
-
|
|
6
4
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* A process operator that takes a request of type `T` and returns a transformed request of type `R`, or `void`, or a Promise that resolves to `R` or `void`.
|
|
6
|
+
*
|
|
7
|
+
* Process operators are used to transform or modify requests in a sequential pipeline before they are processed by an `IHttpRequestHandler`.
|
|
8
|
+
*
|
|
9
|
+
* @template T The type of the input request.
|
|
10
|
+
* @template R The type of the output request. Defaults to `T` if not specified.
|
|
11
|
+
* @param request The input request to be processed.
|
|
12
|
+
* @returns The transformed request, `void`, or a Promise that resolves to the transformed request or `void`.
|
|
9
13
|
*/
|
|
14
|
+
export type ProcessOperator<T, R = T> = (request: T) => R | void | Promise<R | void>;
|
|
15
|
+
|
|
10
16
|
/**
|
|
11
17
|
* Represents a collection of process operators.
|
|
12
18
|
* @template T The type of the request being processed.
|
|
@@ -49,6 +55,12 @@ export interface IProcessOperators<T> {
|
|
|
49
55
|
process(request: T): Observable<T>;
|
|
50
56
|
}
|
|
51
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Represents an HTTP request handler that extends the `IProcessOperators` interface.
|
|
60
|
+
* This interface provides methods to manage and process HTTP request operators.
|
|
61
|
+
*
|
|
62
|
+
* @template T - The type of the request being processed. Defaults to `FetchRequest`.
|
|
63
|
+
*/
|
|
52
64
|
export interface IHttpRequestHandler<T extends FetchRequest = FetchRequest>
|
|
53
65
|
extends IProcessOperators<T> {
|
|
54
66
|
/**
|
|
@@ -59,4 +71,10 @@ export interface IHttpRequestHandler<T extends FetchRequest = FetchRequest>
|
|
|
59
71
|
setHeader(key: string, value: string): IHttpRequestHandler<T>;
|
|
60
72
|
}
|
|
61
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Represents an HTTP response handler that extends the `IProcessOperators` interface.
|
|
76
|
+
* This interface provides methods to manage and process HTTP response operators.
|
|
77
|
+
*
|
|
78
|
+
* @template T - The type of the response being processed. Defaults to `Response`.
|
|
79
|
+
*/
|
|
62
80
|
export interface IHttpResponseHandler<T = Response> extends IProcessOperators<T> {}
|
|
@@ -1,17 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ResponseSelector, BlobResult } from '../client/types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Extracts a blob and filename from a successful HTTP response.
|
|
5
|
+
*
|
|
6
|
+
* @param response - The HTTP response to extract the blob and filename from.
|
|
7
|
+
* @returns A promise that resolves to an object containing the extracted blob and filename.
|
|
8
|
+
* @throws {Error} If the response is not successful or if there is an error parsing the response.
|
|
9
|
+
*/
|
|
10
|
+
export const blobSelector: ResponseSelector = async <TResponse extends Response = Response>(
|
|
2
11
|
response: TResponse,
|
|
3
|
-
): Promise<
|
|
12
|
+
): Promise<BlobResult> => {
|
|
4
13
|
if (!response.ok) {
|
|
14
|
+
// Throw an error if the network response is not successful
|
|
5
15
|
throw new Error('network response was not OK');
|
|
6
16
|
}
|
|
7
|
-
|
|
17
|
+
|
|
18
|
+
// Status code 204 indicates no content, so throw an error
|
|
8
19
|
if (response.status === 204) {
|
|
9
20
|
throw new Error('no content');
|
|
10
21
|
}
|
|
11
22
|
|
|
23
|
+
// Extract the filename from the 'content-disposition' header
|
|
24
|
+
const filename = response.headers
|
|
25
|
+
.get('content-disposition')
|
|
26
|
+
?.split(';')
|
|
27
|
+
.find((n) => n.includes('filename='))
|
|
28
|
+
?.replace('filename=', '')
|
|
29
|
+
?.trim();
|
|
30
|
+
|
|
12
31
|
try {
|
|
13
|
-
return
|
|
32
|
+
// Convert the response to a Blob and return the filename and Blob
|
|
33
|
+
const blob = await response.blob();
|
|
34
|
+
return { filename, blob };
|
|
14
35
|
} catch (err) {
|
|
36
|
+
// Throw an error if there's a problem parsing the response
|
|
15
37
|
throw Error('failed to parse response');
|
|
16
38
|
}
|
|
17
39
|
};
|
|
@@ -1,30 +1,50 @@
|
|
|
1
|
+
import type { ResponseSelector } from '../client/types';
|
|
1
2
|
import { HttpJsonResponseError } from '../../errors';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
* If the response is not OK or if there is an error parsing the response, an error is thrown.
|
|
6
|
-
* If the response has a status code of 204 (No Content), a resolved Promise is returned.
|
|
5
|
+
* Asynchronously parses the JSON data from a given HTTP response.
|
|
7
6
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* If the response has a status code of 204 (No Content), this function will resolve with `undefined`.
|
|
8
|
+
*
|
|
9
|
+
* If the response is not successful (i.e. `response.ok` is `false`), this function will throw an `HttpJsonResponseError` with the response details and the parsed data (if any).
|
|
10
|
+
*
|
|
11
|
+
* If there is an error parsing the JSON data, this function will throw an `HttpJsonResponseError` with the parsing error and the original response.
|
|
12
|
+
*
|
|
13
|
+
* @template TType - The expected type of the parsed JSON data.
|
|
14
|
+
* @template TResponse - The type of the HTTP response object.
|
|
15
|
+
* @param response - The HTTP response to parse.
|
|
16
|
+
* @returns A promise that resolves with the parsed JSON data, or rejects with an `HttpJsonResponseError`.
|
|
12
17
|
*/
|
|
13
|
-
export const jsonSelector = async <
|
|
18
|
+
export const jsonSelector: ResponseSelector = async <
|
|
19
|
+
TType = unknown,
|
|
20
|
+
TResponse extends Response = Response,
|
|
21
|
+
>(
|
|
14
22
|
response: TResponse,
|
|
15
23
|
): Promise<TType> => {
|
|
16
|
-
/** Status code 204
|
|
24
|
+
/** Status code 204 indicates no content in the response */
|
|
17
25
|
if (response.status === 204) {
|
|
18
26
|
return Promise.resolve() as Promise<TType>;
|
|
19
27
|
}
|
|
20
28
|
|
|
21
29
|
try {
|
|
30
|
+
// Parse the response JSON data
|
|
22
31
|
const data = await response.json();
|
|
32
|
+
|
|
33
|
+
// Check if the response was successful
|
|
23
34
|
if (!response.ok) {
|
|
35
|
+
// Throw an error with the response details
|
|
24
36
|
throw new HttpJsonResponseError('network response was not OK', response, { data });
|
|
25
37
|
}
|
|
38
|
+
|
|
39
|
+
// Return the parsed data
|
|
26
40
|
return data;
|
|
27
41
|
} catch (cause) {
|
|
42
|
+
// If the cause is an HttpJsonResponseError, rethrow it
|
|
43
|
+
if (cause instanceof HttpJsonResponseError) {
|
|
44
|
+
throw cause;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Otherwise, throw a new HttpJsonResponseError with the parsing error
|
|
28
48
|
throw new HttpJsonResponseError('failed to parse response', response, { cause });
|
|
29
49
|
}
|
|
30
50
|
};
|
package/src/module.ts
CHANGED
|
@@ -11,8 +11,23 @@ import type {
|
|
|
11
11
|
|
|
12
12
|
import { MsalModule } from '@equinor/fusion-framework-module-msal';
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Defines the type for the HTTP module, which includes:
|
|
16
|
+
* - The module name: 'http'
|
|
17
|
+
* - The type of the HTTP client provider, which is `IHttpClientProvider`
|
|
18
|
+
* - The type of the HTTP client configurator, which is `IHttpClientConfigurator`
|
|
19
|
+
*/
|
|
14
20
|
export type HttpModule = Module<'http', IHttpClientProvider, IHttpClientConfigurator>;
|
|
15
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Defines the type for the HTTP module with MSAL authentication.
|
|
24
|
+
*
|
|
25
|
+
* This type represents the module configuration for the HTTP module, which includes:
|
|
26
|
+
* - The module name: 'http'
|
|
27
|
+
* - The type of the HTTP client provider, which is `IHttpClientProvider<HttpClientMsal>`
|
|
28
|
+
* - The type of the HTTP client configurator, which is `IHttpClientConfigurator<HttpClientMsal>`
|
|
29
|
+
* - The list of required modules, which includes the `MsalModule`
|
|
30
|
+
*/
|
|
16
31
|
export type HttpMsalModule = Module<
|
|
17
32
|
'http',
|
|
18
33
|
IHttpClientProvider<HttpClientMsal>,
|
|
@@ -21,11 +36,33 @@ export type HttpMsalModule = Module<
|
|
|
21
36
|
>;
|
|
22
37
|
|
|
23
38
|
/**
|
|
24
|
-
*
|
|
39
|
+
* HTTP module with MSAL authentication.
|
|
25
40
|
*/
|
|
26
41
|
export const module: HttpMsalModule = {
|
|
27
42
|
name: 'http',
|
|
43
|
+
/**
|
|
44
|
+
* Configures the HTTP module with MSAL authentication.
|
|
45
|
+
*
|
|
46
|
+
* This function creates a new `HttpClientConfigurator` instance using the `HttpClientMsal` class.
|
|
47
|
+
* The `HttpClientConfigurator` is responsible for configuring the HTTP client with the necessary options,
|
|
48
|
+
* such as the base URL, request headers, and other settings.
|
|
49
|
+
*
|
|
50
|
+
* @returns A new `HttpClientConfigurator` instance configured for MSAL authentication.
|
|
51
|
+
*/
|
|
28
52
|
configure: () => new HttpClientConfigurator(HttpClientMsal),
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Initializes the HTTP client provider with MSAL authentication.
|
|
56
|
+
*
|
|
57
|
+
* This function is responsible for setting up the default HTTP request handler
|
|
58
|
+
* to acquire an access token from MSAL and attach it to the request headers
|
|
59
|
+
* when the request includes scopes.
|
|
60
|
+
*
|
|
61
|
+
* @param config - The module configuration.
|
|
62
|
+
* @param hasModule - A function to check if a module is available.
|
|
63
|
+
* @param requireInstance - A function to get an instance of a module.
|
|
64
|
+
* @returns A promise that resolves to the HTTP client provider.
|
|
65
|
+
*/
|
|
29
66
|
initialize: async ({
|
|
30
67
|
config,
|
|
31
68
|
hasModule,
|
|
@@ -53,14 +90,27 @@ export const module: HttpMsalModule = {
|
|
|
53
90
|
},
|
|
54
91
|
};
|
|
55
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Configures the HTTP module with MSAL authentication.
|
|
95
|
+
*/
|
|
56
96
|
export const configureHttp = <TRef = unknown>(
|
|
57
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
58
97
|
configure: (config: ModuleConfigType<HttpMsalModule>, ref?: TRef) => void,
|
|
59
98
|
): IModuleConfigurator<HttpMsalModule, TRef> => ({
|
|
60
99
|
module,
|
|
61
100
|
configure,
|
|
62
101
|
});
|
|
63
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Configures the HTTP client with MSAL authentication.
|
|
105
|
+
*
|
|
106
|
+
* This function creates a module configurator that can be used to configure the HTTP module
|
|
107
|
+
* with MSAL authentication. The configurator takes a name and a set of HTTP client options,
|
|
108
|
+
* and returns a module configurator that can be used to configure the HTTP module.
|
|
109
|
+
*
|
|
110
|
+
* @param name - The name of the HTTP client configuration.
|
|
111
|
+
* @param args - The HTTP client options, including the MSAL configuration.
|
|
112
|
+
* @returns A module configurator that can be used to configure the HTTP module.
|
|
113
|
+
*/
|
|
64
114
|
export const configureHttpClient = <TRef = unknown>(
|
|
65
115
|
name: string,
|
|
66
116
|
args: HttpClientOptions<HttpClientMsal>,
|
|
@@ -71,6 +121,9 @@ export const configureHttpClient = <TRef = unknown>(
|
|
|
71
121
|
},
|
|
72
122
|
});
|
|
73
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Declares a module named '@equinor/fusion-framework-module' that contains an interface named 'Modules' with a property 'http' of type 'HttpMsalModule'.
|
|
126
|
+
*/
|
|
74
127
|
declare module '@equinor/fusion-framework-module' {
|
|
75
128
|
interface Modules {
|
|
76
129
|
http: HttpMsalModule;
|
package/src/provider.ts
CHANGED
|
@@ -15,12 +15,27 @@ export class ClientNotFoundException extends Error {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export interface IHttpClientProvider<TClient extends IHttpClient = IHttpClient> {
|
|
18
|
+
/**
|
|
19
|
+
* The default HTTP request handler used by the HttpClientProvider.
|
|
20
|
+
* This handler is responsible for executing HTTP requests using the configured HttpClient.
|
|
21
|
+
*/
|
|
18
22
|
readonly defaultHttpRequestHandler: IHttpRequestHandler<HttpClientRequestInitType<TClient>>;
|
|
19
|
-
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Checks if a client is configured with the given key.
|
|
26
|
+
* @param key - The key of the client to check.
|
|
27
|
+
* @returns `true` if a client is configured with the given key, `false` otherwise.
|
|
28
|
+
*/
|
|
20
29
|
hasClient(key: string): boolean;
|
|
21
|
-
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Creates a new HTTP client instance with the specified key.
|
|
33
|
+
* @param key - The key of the HTTP client to create.
|
|
34
|
+
* @returns The created HTTP client instance.
|
|
35
|
+
*/
|
|
22
36
|
createClient(key: string): TClient;
|
|
23
37
|
createClient(key: HttpClientOptions<TClient>): TClient;
|
|
38
|
+
|
|
24
39
|
/**
|
|
25
40
|
* Class cast creation of custom client
|
|
26
41
|
* @example
|
|
@@ -33,6 +48,11 @@ export interface IHttpClientProvider<TClient extends IHttpClient = IHttpClient>
|
|
|
33
48
|
createCustomClient<T extends HttpClient>(key: string): T;
|
|
34
49
|
}
|
|
35
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Checks if a given string is a valid URL.
|
|
53
|
+
* @param url - The string to check for a valid URL.
|
|
54
|
+
* @returns `true` if the input string is a valid URL, `false` otherwise.
|
|
55
|
+
*/
|
|
36
56
|
const isURL = (url: string) => {
|
|
37
57
|
const pattern = new RegExp(
|
|
38
58
|
'^(https?:\\/\\/)?' + // protocol
|
|
@@ -46,19 +66,52 @@ const isURL = (url: string) => {
|
|
|
46
66
|
return pattern.test(url);
|
|
47
67
|
};
|
|
48
68
|
|
|
69
|
+
/**
|
|
70
|
+
* The `HttpClientProvider` class is responsible for managing HTTP client instances and their configuration.
|
|
71
|
+
* It provides methods to check if a client is configured, create new client instances, and create custom client instances.
|
|
72
|
+
*/
|
|
49
73
|
export class HttpClientProvider<TClient extends IHttpClient = IHttpClient>
|
|
50
74
|
implements IHttpClientProvider<TClient>
|
|
51
75
|
{
|
|
76
|
+
/**
|
|
77
|
+
* Gets the default HTTP request handler for the HTTP client provider.
|
|
78
|
+
* @returns The default HTTP request handler.
|
|
79
|
+
*/
|
|
52
80
|
get defaultHttpRequestHandler(): IHttpRequestHandler<HttpClientRequestInitType<TClient>> {
|
|
53
81
|
return this.config.defaultHttpRequestHandler;
|
|
54
82
|
}
|
|
55
83
|
|
|
56
84
|
constructor(protected config: IHttpClientConfigurator<TClient>) {}
|
|
57
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Checks if a client with the given key is configured in the `HttpClientProvider`.
|
|
88
|
+
* @param key - The key of the HTTP client to check.
|
|
89
|
+
* @returns `true` if a client with the given key is configured, `false` otherwise.
|
|
90
|
+
*/
|
|
58
91
|
public hasClient(key: string): boolean {
|
|
59
92
|
return Object.keys(this.config.clients).includes(key);
|
|
60
93
|
}
|
|
61
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Creates a new HTTP client instance with the specified configuration.
|
|
97
|
+
*
|
|
98
|
+
* @param keyOrConfig - The key or configuration object for the HTTP client.
|
|
99
|
+
* @returns The created HTTP client instance.
|
|
100
|
+
*
|
|
101
|
+
* @remarks
|
|
102
|
+
* This method resolves the configuration for the HTTP client based on the provided `keyOrConfig` parameter.
|
|
103
|
+
* If a string is provided, it is treated as the key for a pre-configured client in the `HttpClientProvider`.
|
|
104
|
+
* If an `HttpClientOptions` object is provided, it is used as the configuration for the new client instance.
|
|
105
|
+
*
|
|
106
|
+
* The method sets up the HTTP client with the following options:
|
|
107
|
+
* - `baseUri`: The base URI for the HTTP client.
|
|
108
|
+
* - `defaultScopes`: The default scopes to be used for authentication.
|
|
109
|
+
* - `onCreate`: An optional callback function that is called when the client instance is created.
|
|
110
|
+
* - `ctor`: The constructor function for the HTTP client, defaulting to the configured `defaultHttpClientCtor`.
|
|
111
|
+
* - `requestHandler`: The HTTP request handler to be used by the client, defaulting to the `defaultHttpRequestHandler`.
|
|
112
|
+
*
|
|
113
|
+
* The created HTTP client instance is returned.
|
|
114
|
+
*/
|
|
62
115
|
public createClient(keyOrConfig: string | HttpClientOptions<TClient>): TClient {
|
|
63
116
|
const config = this._resolveConfig(keyOrConfig);
|
|
64
117
|
const {
|
|
@@ -75,10 +128,31 @@ export class HttpClientProvider<TClient extends IHttpClient = IHttpClient>
|
|
|
75
128
|
return instance as TClient;
|
|
76
129
|
}
|
|
77
130
|
|
|
131
|
+
/**
|
|
132
|
+
* Creates a new HTTP client instance with the specified configuration.
|
|
133
|
+
*
|
|
134
|
+
* @param key - The key of the pre-configured HTTP client to create.
|
|
135
|
+
* @returns The created HTTP client instance, cast to the specified type `T`.
|
|
136
|
+
*
|
|
137
|
+
* @remarks
|
|
138
|
+
* This method delegates to the `createClient` method, but casts the returned
|
|
139
|
+
* instance to the specified type `T`. This can be useful when you need to
|
|
140
|
+
* work with a specific HTTP client implementation, but the `HttpClientProvider`
|
|
141
|
+
* is configured to use a different implementation.
|
|
142
|
+
*/
|
|
78
143
|
public createCustomClient<T extends HttpClient>(key: string): T {
|
|
79
144
|
return this.createClient(key) as unknown as T;
|
|
80
145
|
}
|
|
81
146
|
|
|
147
|
+
/**
|
|
148
|
+
* Resolves the configuration for an HTTP client based on the provided `keyOrConfig` parameter.
|
|
149
|
+
*
|
|
150
|
+
* If a string is provided, it is treated as the key for a pre-configured client in the `HttpClientProvider`.
|
|
151
|
+
* If an `HttpClientOptions` object is provided, it is used as the configuration for the new client instance.
|
|
152
|
+
*
|
|
153
|
+
* @param keyOrConfig - The key or configuration object for the HTTP client.
|
|
154
|
+
* @returns The resolved HTTP client configuration.
|
|
155
|
+
*/
|
|
82
156
|
protected _resolveConfig(
|
|
83
157
|
keyOrConfig: string | HttpClientOptions<TClient>,
|
|
84
158
|
): HttpClientOptions<TClient> {
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '
|
|
2
|
+
export const version = '6.0.1';
|