@firedesktop/react-base 1.85.0 → 1.86.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.
|
@@ -53,142 +53,169 @@ var FetchWrapper = (function () {
|
|
|
53
53
|
if (isBlobInReturn === void 0) { isBlobInReturn = false; }
|
|
54
54
|
if (additionalParams === void 0) { additionalParams = []; }
|
|
55
55
|
if (timeoutInMilli === void 0) { timeoutInMilli = 60000; }
|
|
56
|
-
return _this
|
|
56
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
57
|
+
return __generator(this, function (_a) {
|
|
58
|
+
return [2, this.generic('GET', url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, this.apiVersion, additionalParams, timeoutInMilli)];
|
|
59
|
+
});
|
|
60
|
+
});
|
|
57
61
|
};
|
|
58
62
|
this.post = function (url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, additionalParams, timeoutInMilli) {
|
|
59
63
|
if (isFile === void 0) { isFile = false; }
|
|
60
64
|
if (isBlobInReturn === void 0) { isBlobInReturn = false; }
|
|
61
65
|
if (additionalParams === void 0) { additionalParams = []; }
|
|
62
66
|
if (timeoutInMilli === void 0) { timeoutInMilli = 60000; }
|
|
63
|
-
return _this
|
|
67
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
68
|
+
return __generator(this, function (_a) {
|
|
69
|
+
return [2, this.generic('POST', url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, this.apiVersion, additionalParams, timeoutInMilli)];
|
|
70
|
+
});
|
|
71
|
+
});
|
|
64
72
|
};
|
|
65
73
|
this.put = function (url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, additionalParams, timeoutInMilli) {
|
|
66
74
|
if (isFile === void 0) { isFile = false; }
|
|
67
75
|
if (isBlobInReturn === void 0) { isBlobInReturn = false; }
|
|
68
76
|
if (additionalParams === void 0) { additionalParams = []; }
|
|
69
77
|
if (timeoutInMilli === void 0) { timeoutInMilli = 60000; }
|
|
70
|
-
return _this
|
|
78
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
79
|
+
return __generator(this, function (_a) {
|
|
80
|
+
return [2, this.generic('PUT', url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, this.apiVersion, additionalParams, timeoutInMilli)];
|
|
81
|
+
});
|
|
82
|
+
});
|
|
71
83
|
};
|
|
72
84
|
this.delete = function (url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, additionalParams, timeoutInMilli) {
|
|
73
85
|
if (isFile === void 0) { isFile = false; }
|
|
74
86
|
if (isBlobInReturn === void 0) { isBlobInReturn = false; }
|
|
75
87
|
if (additionalParams === void 0) { additionalParams = []; }
|
|
76
88
|
if (timeoutInMilli === void 0) { timeoutInMilli = 60000; }
|
|
77
|
-
return _this
|
|
89
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
90
|
+
return __generator(this, function (_a) {
|
|
91
|
+
return [2, this.generic('DELETE', url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, this.apiVersion, additionalParams, timeoutInMilli)];
|
|
92
|
+
});
|
|
93
|
+
});
|
|
78
94
|
};
|
|
79
95
|
this.generic = function (method, url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, version, additionalParams, timeoutInMilli) {
|
|
80
96
|
if (additionalParams === void 0) { additionalParams = []; }
|
|
81
97
|
if (timeoutInMilli === void 0) { timeoutInMilli = 60000; }
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
var requestInit = {
|
|
114
|
-
body: body,
|
|
115
|
-
method: method,
|
|
116
|
-
mode: 'cors',
|
|
117
|
-
cache: 'no-cache',
|
|
118
|
-
credentials: 'omit',
|
|
119
|
-
headers: headers,
|
|
120
|
-
signal: abortController.signal
|
|
121
|
-
};
|
|
122
|
-
var labels = _this.labels;
|
|
123
|
-
var status_401 = _this.status_401;
|
|
124
|
-
var status_403 = _this.status_403;
|
|
125
|
-
try {
|
|
126
|
-
return fetch(encodeURI(url), requestInit)
|
|
127
|
-
.then(function (response) {
|
|
128
|
-
if (response.status < 200 || response.status >= 300)
|
|
129
|
-
throw response;
|
|
130
|
-
return isBlobInReturn ? response.blob() : response.json();
|
|
131
|
-
})
|
|
132
|
-
.then(function (json) {
|
|
133
|
-
return json;
|
|
134
|
-
})
|
|
135
|
-
.catch(function (error) { return __awaiter(_this, void 0, void 0, function () {
|
|
136
|
-
return __generator(this, function (_a) {
|
|
137
|
-
switch (_a.label) {
|
|
138
|
-
case 0:
|
|
139
|
-
console.warn("Error on fetch url: ".concat(url), error);
|
|
140
|
-
if (!error || (error === null || error === void 0 ? void 0 : error.message) === 'Failed to fetch')
|
|
141
|
-
throw new Error(labels.errorServerNotAvailable);
|
|
142
|
-
if (!(error.status === 401 && status_401)) return [3, 2];
|
|
143
|
-
return [4, status_401()];
|
|
144
|
-
case 1:
|
|
145
|
-
_a.sent();
|
|
146
|
-
return [3, 5];
|
|
147
|
-
case 2:
|
|
148
|
-
if (!(error.status === 403 && status_401)) return [3, 4];
|
|
149
|
-
return [4, status_403()];
|
|
150
|
-
case 3:
|
|
151
|
-
_a.sent();
|
|
152
|
-
return [3, 5];
|
|
153
|
-
case 4:
|
|
154
|
-
if (onGenericServerError) {
|
|
155
|
-
onGenericServerError(error.status, error);
|
|
156
|
-
}
|
|
157
|
-
_a.label = 5;
|
|
158
|
-
case 5:
|
|
159
|
-
if (!error.text) {
|
|
160
|
-
if (error.status === 400) {
|
|
161
|
-
throw labels.errorBadRequest;
|
|
162
|
-
}
|
|
163
|
-
else if (error.status === 401 || error.status === 403) {
|
|
164
|
-
throw labels.errorSessionExpired;
|
|
98
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
99
|
+
var abortController, timeoutId, body, headers, formData, index, element, requestInit, labels, status_401, status_403, error_1;
|
|
100
|
+
var _this = this;
|
|
101
|
+
return __generator(this, function (_a) {
|
|
102
|
+
switch (_a.label) {
|
|
103
|
+
case 0:
|
|
104
|
+
abortController = new AbortController();
|
|
105
|
+
timeoutId = setTimeout(function () { return abortController.abort(); }, timeoutInMilli);
|
|
106
|
+
headers = new Headers();
|
|
107
|
+
headers.append('Cache-Control', 'no-cache, no-store, must-revalidate');
|
|
108
|
+
headers.append('pragma', 'no-cache');
|
|
109
|
+
headers.append('Expires', '0');
|
|
110
|
+
headers.append('X-Content-Type-Options', 'nosniff');
|
|
111
|
+
if (version)
|
|
112
|
+
headers.append('api-version', version);
|
|
113
|
+
if (applicationName)
|
|
114
|
+
headers.append('ApplicationName', applicationName);
|
|
115
|
+
if (token)
|
|
116
|
+
headers.append('SessionToken', token);
|
|
117
|
+
if (params) {
|
|
118
|
+
if (isFile) {
|
|
119
|
+
formData = new FormData();
|
|
120
|
+
formData.append('file', params);
|
|
121
|
+
body = formData;
|
|
122
|
+
if (additionalParams) {
|
|
123
|
+
for (index = 0; index < additionalParams.length; index++) {
|
|
124
|
+
element = additionalParams[index];
|
|
125
|
+
formData.append(element.name, '' + element.value);
|
|
126
|
+
}
|
|
165
127
|
}
|
|
166
128
|
}
|
|
167
|
-
else
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
129
|
+
else {
|
|
130
|
+
headers.append('Content-Type', 'application/json');
|
|
131
|
+
body = JSON.stringify(params);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
requestInit = {
|
|
135
|
+
body: body,
|
|
136
|
+
method: method,
|
|
137
|
+
mode: 'cors',
|
|
138
|
+
cache: 'no-cache',
|
|
139
|
+
credentials: 'omit',
|
|
140
|
+
headers: headers,
|
|
141
|
+
signal: abortController.signal
|
|
142
|
+
};
|
|
143
|
+
labels = this.labels;
|
|
144
|
+
status_401 = this.status_401;
|
|
145
|
+
status_403 = this.status_403;
|
|
146
|
+
_a.label = 1;
|
|
147
|
+
case 1:
|
|
148
|
+
_a.trys.push([1, 3, , 4]);
|
|
149
|
+
return [4, fetch(encodeURI(url), requestInit)
|
|
150
|
+
.then(function (response) {
|
|
151
|
+
if (response.status < 200 || response.status >= 300)
|
|
152
|
+
throw response;
|
|
153
|
+
return isBlobInReturn ? response.blob() : response.json();
|
|
154
|
+
})
|
|
155
|
+
.then(function (json) {
|
|
156
|
+
return json;
|
|
157
|
+
})
|
|
158
|
+
.catch(function (error) { return __awaiter(_this, void 0, void 0, function () {
|
|
159
|
+
return __generator(this, function (_a) {
|
|
160
|
+
switch (_a.label) {
|
|
161
|
+
case 0:
|
|
162
|
+
console.warn("Error on fetch url: ".concat(url), error);
|
|
163
|
+
if (!error || (error === null || error === void 0 ? void 0 : error.message) === 'Failed to fetch')
|
|
164
|
+
throw new Error(labels.errorServerNotAvailable);
|
|
165
|
+
if (!(error.status === 401 && status_401)) return [3, 2];
|
|
166
|
+
return [4, status_401()];
|
|
167
|
+
case 1:
|
|
168
|
+
_a.sent();
|
|
169
|
+
return [3, 5];
|
|
170
|
+
case 2:
|
|
171
|
+
if (!(error.status === 403 && status_401)) return [3, 4];
|
|
172
|
+
return [4, status_403()];
|
|
173
|
+
case 3:
|
|
174
|
+
_a.sent();
|
|
175
|
+
return [3, 5];
|
|
176
|
+
case 4:
|
|
177
|
+
if (onGenericServerError) {
|
|
178
|
+
onGenericServerError(error.status, error);
|
|
179
|
+
}
|
|
180
|
+
_a.label = 5;
|
|
181
|
+
case 5:
|
|
182
|
+
if (!error.text) {
|
|
183
|
+
if (error.status === 400) {
|
|
184
|
+
throw labels.errorBadRequest;
|
|
185
|
+
}
|
|
186
|
+
else if (error.status === 401 || error.status === 403) {
|
|
187
|
+
throw labels.errorSessionExpired;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
else
|
|
191
|
+
return [2, error.text()];
|
|
192
|
+
if (error.message && error.message !== '')
|
|
193
|
+
throw error.message;
|
|
194
|
+
throw labels.errorGeneric;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}); })
|
|
198
|
+
.then(function (finalMessage) {
|
|
199
|
+
var _a;
|
|
200
|
+
if (typeof (finalMessage) === 'object')
|
|
201
|
+
return finalMessage;
|
|
202
|
+
if (finalMessage)
|
|
203
|
+
throw finalMessage;
|
|
204
|
+
throw (_a = labels === null || labels === void 0 ? void 0 : labels.errorGeneric) !== null && _a !== void 0 ? _a : 'Error';
|
|
205
|
+
})
|
|
206
|
+
.finally(function () {
|
|
207
|
+
clearTimeout(timeoutId);
|
|
208
|
+
})];
|
|
209
|
+
case 2: return [2, _a.sent()];
|
|
210
|
+
case 3:
|
|
211
|
+
error_1 = _a.sent();
|
|
212
|
+
if (onGenericServerError)
|
|
213
|
+
onGenericServerError(error_1 === null || error_1 === void 0 ? void 0 : error_1.status, error_1);
|
|
214
|
+
throw error_1;
|
|
215
|
+
case 4: return [2];
|
|
216
|
+
}
|
|
185
217
|
});
|
|
186
|
-
}
|
|
187
|
-
catch (error) {
|
|
188
|
-
if (onGenericServerError)
|
|
189
|
-
onGenericServerError(error === null || error === void 0 ? void 0 : error.status, error);
|
|
190
|
-
throw error;
|
|
191
|
-
}
|
|
218
|
+
});
|
|
192
219
|
};
|
|
193
220
|
this.apiVersion = apiVersion;
|
|
194
221
|
this.status_401 = status_401;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchWrapper.js","sourceRoot":"","sources":["../../../src/lib/utils/fetch/fetchWrapper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;IAAA;IAOA,CAAC;IANU,gBAAM,GAAG;QACZ,eAAe,EAAE,kCAAkC;QACnD,YAAY,EAAE,2CAA2C;QACzD,uBAAuB,EAAE,sBAAsB;QAC/C,mBAAmB,EAAE,yCAAyC;KAChD,CAAC;IACvB,gBAAC;CAAA,AAPD,IAOC;AAED;IAMI,sBAAY,UAAmB,EAAE,MAAsB,EAAE,UAAgC,EAAE,UAAgC;QAA3H,iBASC;QAED,QAAG,GAAG,
|
|
1
|
+
{"version":3,"file":"fetchWrapper.js","sourceRoot":"","sources":["../../../src/lib/utils/fetch/fetchWrapper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;IAAA;IAOA,CAAC;IANU,gBAAM,GAAG;QACZ,eAAe,EAAE,kCAAkC;QACnD,YAAY,EAAE,2CAA2C;QACzD,uBAAuB,EAAE,sBAAsB;QAC/C,mBAAmB,EAAE,yCAAyC;KAChD,CAAC;IACvB,gBAAC;CAAA,AAPD,IAOC;AAED;IAMI,sBAAY,UAAmB,EAAE,MAAsB,EAAE,UAAgC,EAAE,UAAgC;QAA3H,iBASC;QAED,QAAG,GAAG,UAAO,GAAW,EAAE,eAAwB,EAAE,KAAc,EAAE,oBAA4D,EAAE,MAAmB,EAAE,MAAc,EAAE,cAAsB,EACzL,gBAAmD,EAAE,cAA8B;YADgE,uBAAA,EAAA,cAAc;YAAE,+BAAA,EAAA,sBAAsB;YACzL,iCAAA,EAAA,qBAAmD;YAAE,+BAAA,EAAA,sBAA8B;;;oBACnF,WAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,eAAe,EAAE,KAAK,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,CAAC,UAAU,EAAE,gBAAgB,EAAE,c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C;oCAExB,IAAI,YAAY;wCACZ,MAAM,YAAY,CAAC;oCAEvB,MAAM,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAAY,mCAAI,OAAO,CAAC;gCAC1C,CAAC,CAAC;qCACD,OAAO,CAAC;oCACL,YAAY,CAAC,SAAS,CAAC,CAAC;gCAC5B,CAAC,CAAC,EAAA;gCApDN,WAAO,SAoDD,EAAC;;;4BAGP,IAAI,oBAAoB;gCACpB,oBAAoB,CAAC,OAAK,aAAL,OAAK,uBAAL,OAAK,CAAE,MAAM,EAAE,OAAK,CAAC,CAAC;4BAE/C,MAAM,OAAK,CAAC;;;;;SAEnB,CAAC;QApJE,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;IA6IL,mBAAC;AAAD,CAAC,AA5JD,IA4JC;AAED,eAAe,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -26,27 +26,27 @@ 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,
|
|
29
|
+
get = async (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile = false, isBlobInReturn = false,
|
|
30
30
|
additionalParams: Types.AdditionalParamsType[] = [], timeoutInMilli: number = 60000) => {
|
|
31
31
|
return this.generic('GET', url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, this.apiVersion, additionalParams, timeoutInMilli);
|
|
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
|
+
post = async (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile = false, isBlobInReturn = false,
|
|
35
35
|
additionalParams: Types.AdditionalParamsType[] = [], timeoutInMilli: number = 60000) => {
|
|
36
36
|
return this.generic('POST', url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, this.apiVersion, additionalParams, timeoutInMilli);
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
put = (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile = false, isBlobInReturn = false,
|
|
39
|
+
put = async (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile = false, isBlobInReturn = false,
|
|
40
40
|
additionalParams: Types.AdditionalParamsType[] = [], timeoutInMilli: number = 60000) => {
|
|
41
41
|
return this.generic('PUT', url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, this.apiVersion, additionalParams, timeoutInMilli);
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
delete = (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile = false, isBlobInReturn = false,
|
|
44
|
+
delete = async (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile = false, isBlobInReturn = false,
|
|
45
45
|
additionalParams: Types.AdditionalParamsType[] = [], timeoutInMilli: number = 60000) => {
|
|
46
46
|
return this.generic('DELETE', url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, this.apiVersion, additionalParams, timeoutInMilli);
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
generic = (method: string, url: string, applicationName: string | undefined, token: string | undefined,
|
|
49
|
+
generic = async (method: string, url: string, applicationName: string | undefined, token: string | undefined,
|
|
50
50
|
onGenericServerError?: (status: number, error?: any) => void,
|
|
51
51
|
params?: Blob | any, isFile?: boolean, isBlobInReturn?: boolean, version?: string,
|
|
52
52
|
additionalParams: Types.AdditionalParamsType[] = [], timeoutInMilli: number = 60000) => {
|
|
@@ -104,7 +104,7 @@ class FetchWrapper {
|
|
|
104
104
|
const status_403 = this.status_403;
|
|
105
105
|
|
|
106
106
|
try {
|
|
107
|
-
return fetch(encodeURI(url), requestInit)
|
|
107
|
+
return await fetch(encodeURI(url), requestInit)
|
|
108
108
|
.then(response => {
|
|
109
109
|
// Others Status Code
|
|
110
110
|
if (response.status < 200 || response.status >= 300)
|