@web-portal/core-infrastructure 1.0.2 → 1.0.4
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/fesm2022/web-portal-core-infrastructure.mjs +46 -11
- package/fesm2022/web-portal-core-infrastructure.mjs.map +1 -1
- package/lib/services/file-aia-gcs.service.d.ts +3 -9
- package/lib/services/file-gcs.service.d.ts +3 -9
- package/lib/services/file-wap-gcs.service.d.ts +3 -9
- package/lib/services/file.service.d.ts +6 -0
- package/package.json +1 -1
|
@@ -1757,8 +1757,14 @@ class FileGCSService {
|
|
|
1757
1757
|
xhr = null;
|
|
1758
1758
|
}
|
|
1759
1759
|
};
|
|
1760
|
-
const progressHandler = (
|
|
1761
|
-
|
|
1760
|
+
const progressHandler = (event) => {
|
|
1761
|
+
if (event.lengthComputable) {
|
|
1762
|
+
observer.next({
|
|
1763
|
+
type: HttpEventType.UploadProgress,
|
|
1764
|
+
loaded: event.loaded,
|
|
1765
|
+
total: event.total,
|
|
1766
|
+
});
|
|
1767
|
+
}
|
|
1762
1768
|
};
|
|
1763
1769
|
const loadHandler = async () => {
|
|
1764
1770
|
if (xhr && xhr.status === 200) {
|
|
@@ -1766,7 +1772,12 @@ class FileGCSService {
|
|
|
1766
1772
|
const finalUrl = absoluteURL || presignedURL;
|
|
1767
1773
|
const result = this.buildResult(file, filePath, finalUrl);
|
|
1768
1774
|
cleanup();
|
|
1769
|
-
observer.next(
|
|
1775
|
+
observer.next(new HttpResponse({
|
|
1776
|
+
body: result,
|
|
1777
|
+
status: 200,
|
|
1778
|
+
statusText: "OK",
|
|
1779
|
+
url: presignedURL,
|
|
1780
|
+
}));
|
|
1770
1781
|
observer.complete();
|
|
1771
1782
|
}
|
|
1772
1783
|
catch (err) {
|
|
@@ -1963,14 +1974,16 @@ class FileAIA_GCSService {
|
|
|
1963
1974
|
}
|
|
1964
1975
|
const presignedURL = presignedData.PreSignedURL ||
|
|
1965
1976
|
presignedData.preSignedURL ||
|
|
1977
|
+
presignedData.presigned_url ||
|
|
1966
1978
|
presignedData.url;
|
|
1967
|
-
const filePath = presignedData.FilePath || presignedData.filePath;
|
|
1968
|
-
const absoluteURL = presignedData.AbsoluteURL || presignedData.absoluteURL;
|
|
1979
|
+
const filePath = presignedData.FilePath || presignedData.filePath || presignedData.file_path;
|
|
1980
|
+
const absoluteURL = presignedData.AbsoluteURL || presignedData.absoluteURL || presignedData.absolute_url;
|
|
1969
1981
|
if (!presignedURL) {
|
|
1970
1982
|
throw new Error("Presigned URL không hợp lệ");
|
|
1971
1983
|
}
|
|
1972
1984
|
const contentType = presignedData.ContentType ||
|
|
1973
1985
|
presignedData.contentType ||
|
|
1986
|
+
presignedData.content_type ||
|
|
1974
1987
|
file.type ||
|
|
1975
1988
|
"application/octet-stream";
|
|
1976
1989
|
xhr = new XMLHttpRequest();
|
|
@@ -1984,8 +1997,14 @@ class FileAIA_GCSService {
|
|
|
1984
1997
|
xhr = null;
|
|
1985
1998
|
}
|
|
1986
1999
|
};
|
|
1987
|
-
const progressHandler = (
|
|
1988
|
-
|
|
2000
|
+
const progressHandler = (event) => {
|
|
2001
|
+
if (event.lengthComputable) {
|
|
2002
|
+
observer.next({
|
|
2003
|
+
type: HttpEventType.UploadProgress,
|
|
2004
|
+
loaded: event.loaded,
|
|
2005
|
+
total: event.total,
|
|
2006
|
+
});
|
|
2007
|
+
}
|
|
1989
2008
|
};
|
|
1990
2009
|
const loadHandler = async () => {
|
|
1991
2010
|
if (xhr && xhr.status === 200) {
|
|
@@ -1993,7 +2012,12 @@ class FileAIA_GCSService {
|
|
|
1993
2012
|
const finalUrl = absoluteURL || presignedURL;
|
|
1994
2013
|
const result = this.buildResult(file, filePath, finalUrl);
|
|
1995
2014
|
cleanup();
|
|
1996
|
-
observer.next(
|
|
2015
|
+
observer.next(new HttpResponse({
|
|
2016
|
+
body: result,
|
|
2017
|
+
status: 200,
|
|
2018
|
+
statusText: "OK",
|
|
2019
|
+
url: presignedURL,
|
|
2020
|
+
}));
|
|
1997
2021
|
observer.complete();
|
|
1998
2022
|
}
|
|
1999
2023
|
catch (err) {
|
|
@@ -2214,8 +2238,14 @@ class FileWAPGCSService {
|
|
|
2214
2238
|
xhr = null;
|
|
2215
2239
|
}
|
|
2216
2240
|
};
|
|
2217
|
-
const progressHandler = (
|
|
2218
|
-
|
|
2241
|
+
const progressHandler = (event) => {
|
|
2242
|
+
if (event.lengthComputable) {
|
|
2243
|
+
observer.next({
|
|
2244
|
+
type: HttpEventType.UploadProgress,
|
|
2245
|
+
loaded: event.loaded,
|
|
2246
|
+
total: event.total,
|
|
2247
|
+
});
|
|
2248
|
+
}
|
|
2219
2249
|
};
|
|
2220
2250
|
const loadHandler = async () => {
|
|
2221
2251
|
if (xhr && xhr.status === 200) {
|
|
@@ -2229,7 +2259,12 @@ class FileWAPGCSService {
|
|
|
2229
2259
|
const finalUrl = absoluteURL || presignedURL;
|
|
2230
2260
|
const result = this.buildResult(file, filePath, finalUrl);
|
|
2231
2261
|
cleanup();
|
|
2232
|
-
observer.next(
|
|
2262
|
+
observer.next(new HttpResponse({
|
|
2263
|
+
body: result,
|
|
2264
|
+
status: 200,
|
|
2265
|
+
statusText: "OK",
|
|
2266
|
+
url: presignedURL,
|
|
2267
|
+
}));
|
|
2233
2268
|
observer.complete();
|
|
2234
2269
|
}
|
|
2235
2270
|
catch (err) {
|