@applica-software-guru/didonato-storage-client 1.0.41 → 1.0.42
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/index.js +1 -9
- package/dist/index.mjs +1 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -124,8 +124,7 @@ var DidonatoStorageClient = class {
|
|
|
124
124
|
async downloadFile(req) {
|
|
125
125
|
const res = await this.getDownloadUrl({ id: req.id });
|
|
126
126
|
if (!res || !res.downloadUrl) throw new Error("No download URL");
|
|
127
|
-
const
|
|
128
|
-
const r = await fetch(res.downloadUrl, { headers });
|
|
127
|
+
const r = await fetch(res.downloadUrl);
|
|
129
128
|
if (!r.ok) throw new Error("Download failed");
|
|
130
129
|
const blob = await r.blob();
|
|
131
130
|
return { blob };
|
|
@@ -137,15 +136,8 @@ var DidonatoStorageClient = class {
|
|
|
137
136
|
_uploadToSignedUrl(req) {
|
|
138
137
|
return new Promise(async (resolve, reject) => {
|
|
139
138
|
try {
|
|
140
|
-
const authHeaders = await this.headers();
|
|
141
139
|
const xhr = new XMLHttpRequest();
|
|
142
140
|
xhr.open("PUT", req.uploadUrl);
|
|
143
|
-
Object.keys(authHeaders || {}).forEach((k) => {
|
|
144
|
-
try {
|
|
145
|
-
xhr.setRequestHeader(k, authHeaders[k]);
|
|
146
|
-
} catch {
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
141
|
Object.keys(req.requiredHeaders || {}).forEach((k) => {
|
|
150
142
|
try {
|
|
151
143
|
xhr.setRequestHeader(k, (req.requiredHeaders || {})[k]);
|
package/dist/index.mjs
CHANGED
|
@@ -97,8 +97,7 @@ var DidonatoStorageClient = class {
|
|
|
97
97
|
async downloadFile(req) {
|
|
98
98
|
const res = await this.getDownloadUrl({ id: req.id });
|
|
99
99
|
if (!res || !res.downloadUrl) throw new Error("No download URL");
|
|
100
|
-
const
|
|
101
|
-
const r = await fetch(res.downloadUrl, { headers });
|
|
100
|
+
const r = await fetch(res.downloadUrl);
|
|
102
101
|
if (!r.ok) throw new Error("Download failed");
|
|
103
102
|
const blob = await r.blob();
|
|
104
103
|
return { blob };
|
|
@@ -110,15 +109,8 @@ var DidonatoStorageClient = class {
|
|
|
110
109
|
_uploadToSignedUrl(req) {
|
|
111
110
|
return new Promise(async (resolve, reject) => {
|
|
112
111
|
try {
|
|
113
|
-
const authHeaders = await this.headers();
|
|
114
112
|
const xhr = new XMLHttpRequest();
|
|
115
113
|
xhr.open("PUT", req.uploadUrl);
|
|
116
|
-
Object.keys(authHeaders || {}).forEach((k) => {
|
|
117
|
-
try {
|
|
118
|
-
xhr.setRequestHeader(k, authHeaders[k]);
|
|
119
|
-
} catch {
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
114
|
Object.keys(req.requiredHeaders || {}).forEach((k) => {
|
|
123
115
|
try {
|
|
124
116
|
xhr.setRequestHeader(k, (req.requiredHeaders || {})[k]);
|