@firedesktop/react-base 1.76.0 → 1.77.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/utils/configuration/ConfigurationManager.js +3 -2
- package/dist/utils/configuration/ConfigurationManager.js.map +1 -1
- package/dist/utils/fetch/fetchWrapper.d.ts +5 -5
- package/dist/utils/fetch/fetchWrapper.js +25 -14
- package/dist/utils/fetch/fetchWrapper.js.map +1 -1
- package/package.json +16 -16
- package/src/lib/utils/configuration/ConfigurationManager.ts +3 -2
- package/src/lib/utils/fetch/fetchWrapper.ts +24 -13
|
@@ -47,7 +47,8 @@ function ConfigurationManager() {
|
|
|
47
47
|
'Content-Type': 'application/json; charset=utf-8',
|
|
48
48
|
'Cache-Control': 'no-cache, no-store, must-revalidate',
|
|
49
49
|
'Expires': '0',
|
|
50
|
-
'pragma': 'no-cache'
|
|
50
|
+
'pragma': 'no-cache',
|
|
51
|
+
'X-Content-Type-Options': 'nosniff'
|
|
51
52
|
}
|
|
52
53
|
})];
|
|
53
54
|
case 1:
|
|
@@ -56,7 +57,7 @@ function ConfigurationManager() {
|
|
|
56
57
|
case 2: return [2, _a.sent()];
|
|
57
58
|
case 3:
|
|
58
59
|
err_1 = _a.sent();
|
|
59
|
-
console.error('Problem loading the Site
|
|
60
|
+
console.error('Problem loading the Site Configuration');
|
|
60
61
|
return [3, 4];
|
|
61
62
|
case 4: return [2];
|
|
62
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigurationManager.js","sourceRoot":"","sources":["../../../src/lib/utils/configuration/ConfigurationManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,oBAAoB;IAEzB,SAAe,iBAAiB,CAAC,QAAgB;;;;;;;wBAE7B,WAAM,KAAK,CAAC,QAAQ,EAAE;gCAC9B,OAAO,EAAE;oCACL,cAAc,EAAE,iCAAiC;oCACjD,eAAe,EA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,CAAC,KAAK,CAAC,+DAAwD,UAAQ,CAAE,CAAC,CAAC;oBACtF,CAAC,CAAC,CAAC;iBACN;;;;KACJ;IAED,OAAO,EAAE,iBAAiB,mBAAA,EAAE,6BAA6B,+BAAA,EAAE,CAAC;AAChE,CAAC;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -5,10 +5,10 @@ declare class FetchWrapper {
|
|
|
5
5
|
status_401?: () => void;
|
|
6
6
|
status_403?: () => void;
|
|
7
7
|
constructor(apiVersion?: string, labels?: Types.ILabels, status_401?: () => void, status_403?: () => void);
|
|
8
|
-
get: (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile?: boolean, isBlobInReturn?: boolean) => Promise<any>;
|
|
9
|
-
post: (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile?: boolean, isBlobInReturn?: boolean, additionalParams?: Types.AdditionalParamsType[]) => Promise<any>;
|
|
10
|
-
put: (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile?: boolean, isBlobInReturn?: boolean) => Promise<any>;
|
|
11
|
-
delete: (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile?: boolean, isBlobInReturn?: boolean) => Promise<any>;
|
|
12
|
-
generic: (method: string, url: string, applicationName
|
|
8
|
+
get: (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile?: boolean, isBlobInReturn?: boolean, additionalParams?: Types.AdditionalParamsType[], timeoutInMilli?: number) => Promise<any>;
|
|
9
|
+
post: (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile?: boolean, isBlobInReturn?: boolean, additionalParams?: Types.AdditionalParamsType[], timeoutInMilli?: number) => Promise<any>;
|
|
10
|
+
put: (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile?: boolean, isBlobInReturn?: boolean, additionalParams?: Types.AdditionalParamsType[], timeoutInMilli?: number) => Promise<any>;
|
|
11
|
+
delete: (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile?: boolean, isBlobInReturn?: boolean, additionalParams?: Types.AdditionalParamsType[], timeoutInMilli?: number) => Promise<any>;
|
|
12
|
+
generic: (method: string, url: string, applicationName: string | undefined, token: string | undefined, onGenericServerError: (status: number, error?: any) => void, params: Blob | any, isFile: boolean, isBlobInReturn: boolean, version: string, additionalParams?: Types.AdditionalParamsType[], timeoutInMilli?: number) => Promise<any>;
|
|
13
13
|
}
|
|
14
14
|
export default FetchWrapper;
|
|
@@ -12,32 +12,39 @@ var Constants = (function () {
|
|
|
12
12
|
var FetchWrapper = (function () {
|
|
13
13
|
function FetchWrapper(apiVersion, labels, status_401, status_403) {
|
|
14
14
|
var _this = this;
|
|
15
|
-
this.get = function (url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn) {
|
|
15
|
+
this.get = function (url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, additionalParams, timeoutInMilli) {
|
|
16
16
|
if (isFile === void 0) { isFile = false; }
|
|
17
17
|
if (isBlobInReturn === void 0) { isBlobInReturn = false; }
|
|
18
|
-
|
|
18
|
+
if (additionalParams === void 0) { additionalParams = []; }
|
|
19
|
+
if (timeoutInMilli === void 0) { timeoutInMilli = 60000; }
|
|
20
|
+
return _this.generic('GET', url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, _this.apiVersion, additionalParams, timeoutInMilli);
|
|
19
21
|
};
|
|
20
|
-
this.post = function (url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, additionalParams) {
|
|
22
|
+
this.post = function (url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, additionalParams, timeoutInMilli) {
|
|
21
23
|
if (isFile === void 0) { isFile = false; }
|
|
22
24
|
if (isBlobInReturn === void 0) { isBlobInReturn = false; }
|
|
23
25
|
if (additionalParams === void 0) { additionalParams = []; }
|
|
24
|
-
|
|
26
|
+
if (timeoutInMilli === void 0) { timeoutInMilli = 60000; }
|
|
27
|
+
return _this.generic('POST', url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, _this.apiVersion, additionalParams, timeoutInMilli);
|
|
25
28
|
};
|
|
26
|
-
this.put = function (url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn) {
|
|
29
|
+
this.put = function (url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, additionalParams, timeoutInMilli) {
|
|
27
30
|
if (isFile === void 0) { isFile = false; }
|
|
28
31
|
if (isBlobInReturn === void 0) { isBlobInReturn = false; }
|
|
29
|
-
|
|
32
|
+
if (additionalParams === void 0) { additionalParams = []; }
|
|
33
|
+
if (timeoutInMilli === void 0) { timeoutInMilli = 60000; }
|
|
34
|
+
return _this.generic('PUT', url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, _this.apiVersion, additionalParams, timeoutInMilli);
|
|
30
35
|
};
|
|
31
|
-
this.delete = function (url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn) {
|
|
36
|
+
this.delete = function (url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, additionalParams, timeoutInMilli) {
|
|
32
37
|
if (isFile === void 0) { isFile = false; }
|
|
33
38
|
if (isBlobInReturn === void 0) { isBlobInReturn = false; }
|
|
34
|
-
|
|
39
|
+
if (additionalParams === void 0) { additionalParams = []; }
|
|
40
|
+
if (timeoutInMilli === void 0) { timeoutInMilli = 60000; }
|
|
41
|
+
return _this.generic('DELETE', url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, _this.apiVersion, additionalParams, timeoutInMilli);
|
|
35
42
|
};
|
|
36
|
-
this.generic = function (method, url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, version, additionalParams) {
|
|
37
|
-
if (isFile === void 0) { isFile = false; }
|
|
38
|
-
if (isBlobInReturn === void 0) { isBlobInReturn = false; }
|
|
39
|
-
if (version === void 0) { version = _this.apiVersion; }
|
|
43
|
+
this.generic = function (method, url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, version, additionalParams, timeoutInMilli) {
|
|
40
44
|
if (additionalParams === void 0) { additionalParams = []; }
|
|
45
|
+
if (timeoutInMilli === void 0) { timeoutInMilli = 60000; }
|
|
46
|
+
var abortController = new AbortController();
|
|
47
|
+
var timeoutId = setTimeout(function () { return abortController.abort(); }, timeoutInMilli);
|
|
41
48
|
var body;
|
|
42
49
|
var headers = new Headers();
|
|
43
50
|
headers.append('Cache-Control', 'no-cache, no-store, must-revalidate');
|
|
@@ -73,7 +80,8 @@ var FetchWrapper = (function () {
|
|
|
73
80
|
mode: 'cors',
|
|
74
81
|
cache: 'no-cache',
|
|
75
82
|
credentials: 'omit',
|
|
76
|
-
headers: headers
|
|
83
|
+
headers: headers,
|
|
84
|
+
signal: abortController.signal
|
|
77
85
|
};
|
|
78
86
|
var labels = _this.labels;
|
|
79
87
|
var status_401 = _this.status_401;
|
|
@@ -88,7 +96,7 @@ var FetchWrapper = (function () {
|
|
|
88
96
|
return json;
|
|
89
97
|
})
|
|
90
98
|
.catch(function (error) {
|
|
91
|
-
console.
|
|
99
|
+
console.warn("Error on fetch url: ".concat(url));
|
|
92
100
|
if (!error || error.message === 'Failed to fetch')
|
|
93
101
|
throw new Error(labels.errorServerNotAvailable);
|
|
94
102
|
if (error.status === 401 && status_401) {
|
|
@@ -120,6 +128,9 @@ var FetchWrapper = (function () {
|
|
|
120
128
|
if (finalMessage)
|
|
121
129
|
throw new Error(finalMessage);
|
|
122
130
|
throw new Error(labels.errorGeneric);
|
|
131
|
+
})
|
|
132
|
+
.finally(function () {
|
|
133
|
+
clearTimeout(timeoutId);
|
|
123
134
|
});
|
|
124
135
|
};
|
|
125
136
|
this.apiVersion = apiVersion;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchWrapper.js","sourceRoot":"","sources":["../../../src/lib/utils/fetch/fetchWrapper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gBAExB,IAAI,YAAY;oBACZ,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;gBAElC,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACzC,CAAC,CAAC;iBACD,OAAO,CAAC;gBACL,YAAY,CAAC,SAAS,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC;QACX,CAAC,CAAC;QA1IE,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAE7B,IAAI,MAAM,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,uBAAuB,IAAI,MAAM,CAAC,mBAAmB;YAChH,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;;YAErB,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;IACvC,CAAC;IAmIL,mBAAC;AAAD,CAAC,AAlJD,IAkJC;AAED,eAAe,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firedesktop/react-base",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.77.0",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"description": "This is the FireDesktop base package used to support every React Project in this Company.",
|
|
7
7
|
"author": "alessandro.gambaro",
|
|
8
8
|
"repository": "https://firedesktopDevOps@dev.azure.com/firedesktopDevOps/baseFEComponents/_git/baseFEComponents",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@syncfusion/ej2-popups": "^23.1.
|
|
11
|
-
"@syncfusion/ej2-react-notifications": "^23.1.
|
|
10
|
+
"@syncfusion/ej2-popups": "^23.1.44",
|
|
11
|
+
"@syncfusion/ej2-react-notifications": "^23.1.40"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@babel/cli": "7.
|
|
15
|
-
"@babel/core": "7.
|
|
14
|
+
"@babel/cli": "7.23.0",
|
|
15
|
+
"@babel/core": "7.23.3",
|
|
16
16
|
"@babel/plugin-proposal-class-properties": "7.18.6",
|
|
17
|
-
"@babel/plugin-transform-arrow-functions": "7.
|
|
18
|
-
"@babel/preset-typescript": "7.
|
|
19
|
-
"@testing-library/jest-dom": "6.1.
|
|
20
|
-
"@testing-library/react": "14.
|
|
17
|
+
"@babel/plugin-transform-arrow-functions": "7.23.3",
|
|
18
|
+
"@babel/preset-typescript": "7.23.3",
|
|
19
|
+
"@testing-library/jest-dom": "6.1.4",
|
|
20
|
+
"@testing-library/react": "14.1.0",
|
|
21
21
|
"@testing-library/user-event": "14.5.1",
|
|
22
|
-
"@types/jest": "29.5.
|
|
23
|
-
"@types/node": "20.
|
|
24
|
-
"@types/react": "18.2.
|
|
25
|
-
"@types/react-dom": "18.2.
|
|
26
|
-
"@types/react-redux": "7.1.
|
|
22
|
+
"@types/jest": "29.5.8",
|
|
23
|
+
"@types/node": "20.9.0",
|
|
24
|
+
"@types/react": "18.2.37",
|
|
25
|
+
"@types/react-dom": "18.2.15",
|
|
26
|
+
"@types/react-redux": "7.1.30",
|
|
27
27
|
"babel-plugin-minify-builtins": "0.5.0",
|
|
28
28
|
"babel-preset-minify": "0.5.2",
|
|
29
29
|
"bootstrap": "4.6.0",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"lodash": "4.17.21",
|
|
32
32
|
"react": "18.2.0",
|
|
33
33
|
"react-dom": "18.2.0",
|
|
34
|
-
"react-redux": "8.1.
|
|
34
|
+
"react-redux": "8.1.3",
|
|
35
35
|
"react-scripts": "5.0.1",
|
|
36
36
|
"typescript": "4.9.4",
|
|
37
|
-
"web-vitals": "3.
|
|
37
|
+
"web-vitals": "3.5.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"bootstrap": ">=4.5.3",
|
|
@@ -7,13 +7,14 @@ function ConfigurationManager() {
|
|
|
7
7
|
'Content-Type': 'application/json; charset=utf-8',
|
|
8
8
|
'Cache-Control': 'no-cache, no-store, must-revalidate',
|
|
9
9
|
'Expires': '0',
|
|
10
|
-
'pragma': 'no-cache'
|
|
10
|
+
'pragma': 'no-cache',
|
|
11
|
+
'X-Content-Type-Options': 'nosniff'
|
|
11
12
|
}
|
|
12
13
|
});
|
|
13
14
|
return await res.json();
|
|
14
15
|
}
|
|
15
16
|
catch (err) {
|
|
16
|
-
console.error('Problem loading the Site
|
|
17
|
+
console.error('Problem loading the Site Configuration');
|
|
17
18
|
}
|
|
18
19
|
};
|
|
19
20
|
|
|
@@ -26,25 +26,32 @@ class FetchWrapper {
|
|
|
26
26
|
this.labels = Constants.labels;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
get = (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile = false, isBlobInReturn = false
|
|
30
|
-
|
|
29
|
+
get = (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile = false, isBlobInReturn = false,
|
|
30
|
+
additionalParams: Types.AdditionalParamsType[] = [], timeoutInMilli: number = 60000) => {
|
|
31
|
+
return this.generic('GET', url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, this.apiVersion, additionalParams, timeoutInMilli);
|
|
31
32
|
};
|
|
32
33
|
|
|
33
34
|
post = (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile = false, isBlobInReturn = false,
|
|
34
|
-
additionalParams: Types.AdditionalParamsType[] = []) => {
|
|
35
|
-
return this.generic('POST', url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, this.apiVersion, additionalParams);
|
|
35
|
+
additionalParams: Types.AdditionalParamsType[] = [], timeoutInMilli: number = 60000) => {
|
|
36
|
+
return this.generic('POST', url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, this.apiVersion, additionalParams, timeoutInMilli);
|
|
36
37
|
};
|
|
37
38
|
|
|
38
|
-
put = (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile = false, isBlobInReturn = false
|
|
39
|
-
|
|
39
|
+
put = (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile = false, isBlobInReturn = false,
|
|
40
|
+
additionalParams: Types.AdditionalParamsType[] = [], timeoutInMilli: number = 60000) => {
|
|
41
|
+
return this.generic('PUT', url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, this.apiVersion, additionalParams, timeoutInMilli);
|
|
40
42
|
};
|
|
41
43
|
|
|
42
|
-
delete = (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile = false, isBlobInReturn = false
|
|
43
|
-
|
|
44
|
+
delete = (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile = false, isBlobInReturn = false,
|
|
45
|
+
additionalParams: Types.AdditionalParamsType[] = [], timeoutInMilli: number = 60000) => {
|
|
46
|
+
return this.generic('DELETE', url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, this.apiVersion, additionalParams, timeoutInMilli);
|
|
44
47
|
};
|
|
45
48
|
|
|
46
|
-
generic = (method: string, url: string, applicationName
|
|
47
|
-
|
|
49
|
+
generic = (method: string, url: string, applicationName: string | undefined, token: string | undefined, onGenericServerError: undefined | ((status: number, error?: any) => void),
|
|
50
|
+
params: Blob | any, isFile: boolean, isBlobInReturn: boolean, version: string, additionalParams: Types.AdditionalParamsType[] = [], timeoutInMilli: number = 60000) => {
|
|
51
|
+
|
|
52
|
+
const abortController = new AbortController();
|
|
53
|
+
const timeoutId = setTimeout(() => abortController.abort(), timeoutInMilli); // 60.000 milliseconds timeout
|
|
54
|
+
|
|
48
55
|
// Headers & Body
|
|
49
56
|
let body: BodyInit;
|
|
50
57
|
const headers = new Headers();
|
|
@@ -52,8 +59,8 @@ class FetchWrapper {
|
|
|
52
59
|
headers.append('Cache-Control', 'no-cache, no-store, must-revalidate');
|
|
53
60
|
headers.append('pragma', 'no-cache');
|
|
54
61
|
headers.append('Expires', '0');
|
|
55
|
-
|
|
56
62
|
headers.append('X-Content-Type-Options', 'nosniff');
|
|
63
|
+
|
|
57
64
|
if (version)
|
|
58
65
|
headers.append('api-version', version);
|
|
59
66
|
if (applicationName)
|
|
@@ -86,7 +93,8 @@ class FetchWrapper {
|
|
|
86
93
|
mode: 'cors',
|
|
87
94
|
cache: 'no-cache',
|
|
88
95
|
credentials: 'omit',
|
|
89
|
-
headers
|
|
96
|
+
headers,
|
|
97
|
+
signal: abortController.signal
|
|
90
98
|
} as RequestInit;
|
|
91
99
|
|
|
92
100
|
const labels = this.labels;
|
|
@@ -105,7 +113,7 @@ class FetchWrapper {
|
|
|
105
113
|
return json;
|
|
106
114
|
})
|
|
107
115
|
.catch(error => {
|
|
108
|
-
console.
|
|
116
|
+
console.warn(`Error on fetch url: ${url}`);
|
|
109
117
|
|
|
110
118
|
if (!error || error.message === 'Failed to fetch')
|
|
111
119
|
throw new Error(labels.errorServerNotAvailable);
|
|
@@ -142,6 +150,9 @@ class FetchWrapper {
|
|
|
142
150
|
throw new Error(finalMessage);
|
|
143
151
|
|
|
144
152
|
throw new Error(labels.errorGeneric);
|
|
153
|
+
})
|
|
154
|
+
.finally(() => {
|
|
155
|
+
clearTimeout(timeoutId);
|
|
145
156
|
});
|
|
146
157
|
};
|
|
147
158
|
}
|