@omnia/fx 7.8.64-preview → 7.8.65-preview
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosRequestConfig, AxiosInstance, AxiosResponse } from "axios";
|
|
2
|
-
import { GuidValue, HttpHeaders, IContextProviderCollection, IContextProvider } from "../../models";
|
|
2
|
+
import { GuidValue, HttpHeaders, IContextProviderCollection, IContextProvider, Future } from "../../models";
|
|
3
3
|
export interface HttpClientConstructor {
|
|
4
4
|
configPromise?: Promise<AxiosRequestConfig>;
|
|
5
5
|
}
|
|
@@ -43,33 +43,70 @@ export declare class HttpClient {
|
|
|
43
43
|
constructor(configPromise?: Promise<AxiosRequestConfig>);
|
|
44
44
|
useConfig(conf: AxiosRequestConfig): void;
|
|
45
45
|
/**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
* Handle abort functionality of abort setup
|
|
47
|
+
* @param config axios config
|
|
48
|
+
* @param httpClientOnAbort abort setup function of Future object type
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
private tryConfigAxiosAbortSignal;
|
|
49
52
|
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
* Perform request using the provided request config
|
|
54
|
+
* @param config axios config
|
|
55
|
+
* @param onAbortCallback abort call back of Future type from outside
|
|
56
|
+
* @returns
|
|
57
|
+
*/
|
|
58
|
+
request<T = any>(config: AxiosRequestConfig): Future<AxiosResponse<T>>;
|
|
53
59
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
* Perform GET request for provided url
|
|
61
|
+
* @param url url
|
|
62
|
+
* @param config axios config
|
|
63
|
+
* @param onAbortCallback abort call back of Future type from outside
|
|
64
|
+
* @returns
|
|
65
|
+
*/
|
|
66
|
+
get<T = any>(url: string, config?: AxiosRequestConfig): Future<AxiosResponse<T>>;
|
|
67
|
+
/**
|
|
68
|
+
* Perform DELETE request for provided url
|
|
69
|
+
* @param url url
|
|
70
|
+
* @param config axios config
|
|
71
|
+
* @param onAbortCallback abort call back of Future type from outside
|
|
72
|
+
* @returns
|
|
73
|
+
*/
|
|
74
|
+
delete<T = any>(url: string, config?: AxiosRequestConfig): Future<AxiosResponse<T>>;
|
|
57
75
|
/**
|
|
58
|
-
|
|
59
|
-
|
|
76
|
+
* Perform HEAD request for provided url
|
|
77
|
+
* @param url url
|
|
78
|
+
* @param config axios request config
|
|
79
|
+
* @param onAbortCallback abort call back of Future type from outside
|
|
80
|
+
* @returns
|
|
81
|
+
*/
|
|
60
82
|
head(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse<any>>;
|
|
61
83
|
/**
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
84
|
+
* Perform POST request for provided url
|
|
85
|
+
* @param url url
|
|
86
|
+
* @param data data
|
|
87
|
+
* @param config axios config
|
|
88
|
+
* @param onAbortCallback abort call back of Future type from outside
|
|
89
|
+
* @returns
|
|
90
|
+
*/
|
|
91
|
+
post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Future<AxiosResponse<T>>;
|
|
65
92
|
/**
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
93
|
+
* Perform PUT request for provided url
|
|
94
|
+
* @param url url
|
|
95
|
+
* @param data data
|
|
96
|
+
* @param config axios config
|
|
97
|
+
* @param onAbortCallback abort call back of Future type from outside
|
|
98
|
+
* @returns
|
|
99
|
+
*/
|
|
100
|
+
put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Future<AxiosResponse<T>>;
|
|
69
101
|
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
102
|
+
* Perform PATCH request for provided url
|
|
103
|
+
* @param url url
|
|
104
|
+
* @param data data
|
|
105
|
+
* @param config axios config
|
|
106
|
+
* @param onAbortCallback abort call back of Future type from outside
|
|
107
|
+
* @returns
|
|
108
|
+
*/
|
|
109
|
+
patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Future<AxiosResponse<T>>;
|
|
73
110
|
private handleAxiosError;
|
|
74
111
|
private handleSuccessResponse;
|
|
75
112
|
private enableCircuitBreaker;
|
|
@@ -15,6 +15,12 @@ export declare class Future<T> extends Promise<T> {
|
|
|
15
15
|
* @memberof Future
|
|
16
16
|
*/
|
|
17
17
|
tryCatch(): Future<[success: T, error: Error]>;
|
|
18
|
+
/**
|
|
19
|
+
* Expose abort for other future to use.
|
|
20
|
+
* chain method for future
|
|
21
|
+
* @param onAbort
|
|
22
|
+
*/
|
|
23
|
+
abortIf(onAbort: (cb: (reason?: any) => void) => void): this;
|
|
18
24
|
/**
|
|
19
25
|
* Aborts the request
|
|
20
26
|
*
|
|
@@ -53,6 +53,20 @@ class Future extends Promise {
|
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Expose abort for other future to use.
|
|
58
|
+
* chain method for future
|
|
59
|
+
* @param onAbort
|
|
60
|
+
*/
|
|
61
|
+
abortIf(onAbort) {
|
|
62
|
+
//to avoid "Illegal invocation" from lost context of this
|
|
63
|
+
const abort = (reason) => { this.abort(reason); };
|
|
64
|
+
onAbort(abort);
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
// then<TResult1 = T, TResult2 = never>(onfulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2> {
|
|
68
|
+
// this.then();
|
|
69
|
+
// }
|
|
56
70
|
/**
|
|
57
71
|
* Aborts the request
|
|
58
72
|
*
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omnia/fx",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "7.8.
|
|
4
|
+
"version": "7.8.65-preview",
|
|
5
5
|
"description": "Provide Omnia Fx typings and tooling for clientside Omnia development.",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
],
|
|
21
21
|
"author": "Omnia Digital Workplace AB",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@omnia/fx-models": "7.8.
|
|
23
|
+
"@omnia/fx-models": "7.8.65-preview",
|
|
24
24
|
"@microsoft/signalr": "6.0.1",
|
|
25
25
|
"broadcast-channel": "4.8.0",
|
|
26
26
|
"dayjs": "1.10.7",
|