@swan-admin/swan-ai-measurements 1.0.88 → 1.0.89
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/esm/fileUpload.js +6 -1
- package/dist/esm/utils.js +1 -1
- package/dist/fileUpload.js +6 -1
- package/dist/utils.js +1 -1
- package/package.json +1 -1
package/dist/esm/fileUpload.js
CHANGED
|
@@ -146,8 +146,11 @@ class FileUpload {
|
|
|
146
146
|
contentType: file.type,
|
|
147
147
|
objectMetadata: arrayMetaData,
|
|
148
148
|
},
|
|
149
|
+
throwError: true,
|
|
149
150
|
});
|
|
151
|
+
console.log(res, "res for start");
|
|
150
152
|
const totalChunks = getFileChunks(file);
|
|
153
|
+
console.log(totalChunks, "total chunks");
|
|
151
154
|
for (let i = 0; i < totalChunks.length; i++) {
|
|
152
155
|
const data = yield fetchData({
|
|
153
156
|
path: FILE_UPLOAD_ENDPOINT.UPLOAD_SIGN_PART,
|
|
@@ -157,14 +160,16 @@ class FileUpload {
|
|
|
157
160
|
uploadId: res === null || res === void 0 ? void 0 : res.uploadId,
|
|
158
161
|
partNumber: i + 1,
|
|
159
162
|
},
|
|
163
|
+
throwError: true,
|
|
160
164
|
});
|
|
165
|
+
console.log(data, "data for signed url");
|
|
161
166
|
yield axios.put(data === null || data === void 0 ? void 0 : data.url, totalChunks[i], {
|
|
162
167
|
headers: { "Content-Type": file.type, "X-Api-Key": __classPrivateFieldGet(this, _FileUpload_accessKey, "f") },
|
|
163
168
|
});
|
|
164
169
|
}
|
|
165
170
|
return { message: "successfully uploaded" };
|
|
166
171
|
} catch (error) {
|
|
167
|
-
throw new Error(`Failed to upload: ${error === null || error === void 0 ? void 0 : error.message}`);
|
|
172
|
+
throw new Error(`Failed to upload: ${(error === null || error === void 0 ? void 0 : error.message) || "something went wrong"}`);
|
|
168
173
|
}
|
|
169
174
|
});
|
|
170
175
|
}
|
package/dist/esm/utils.js
CHANGED
|
@@ -27,7 +27,7 @@ export function fetchData(options) {
|
|
|
27
27
|
catch (error) {
|
|
28
28
|
console.error(error, "while uploading");
|
|
29
29
|
if (throwError) {
|
|
30
|
-
throw new Error(`Failed to upload: ${error.message}`);
|
|
30
|
+
throw new Error(`Failed to upload: ${(error === null || error === void 0 ? void 0 : error.message) || "something went wrong"}`);
|
|
31
31
|
}
|
|
32
32
|
return {};
|
|
33
33
|
}
|
package/dist/fileUpload.js
CHANGED
|
@@ -97,8 +97,11 @@ class FileUpload {
|
|
|
97
97
|
contentType: file.type,
|
|
98
98
|
objectMetadata: arrayMetaData,
|
|
99
99
|
},
|
|
100
|
+
throwError: true,
|
|
100
101
|
});
|
|
102
|
+
console.log(res, "res for start");
|
|
101
103
|
const totalChunks = (0, utils_js_1.getFileChunks)(file);
|
|
104
|
+
console.log(totalChunks, "total chunks");
|
|
102
105
|
for (let i = 0; i < totalChunks.length; i++) {
|
|
103
106
|
const data = await (0, utils_js_1.fetchData)({
|
|
104
107
|
path: constants_js_1.FILE_UPLOAD_ENDPOINT.UPLOAD_SIGN_PART,
|
|
@@ -108,13 +111,15 @@ class FileUpload {
|
|
|
108
111
|
uploadId: res?.uploadId,
|
|
109
112
|
partNumber: i + 1,
|
|
110
113
|
},
|
|
114
|
+
throwError: true,
|
|
111
115
|
});
|
|
116
|
+
console.log(data, "data for signed url");
|
|
112
117
|
await axios_1.default.put(data?.url, totalChunks[i], { headers: { "Content-Type": file.type, "X-Api-Key": this.#accessKey } });
|
|
113
118
|
}
|
|
114
119
|
return { message: "successfully uploaded" };
|
|
115
120
|
}
|
|
116
121
|
catch (error) {
|
|
117
|
-
throw new Error(`Failed to upload: ${error?.message}`);
|
|
122
|
+
throw new Error(`Failed to upload: ${error?.message || "something went wrong"}`);
|
|
118
123
|
}
|
|
119
124
|
}
|
|
120
125
|
}
|
package/dist/utils.js
CHANGED
|
@@ -23,7 +23,7 @@ async function fetchData(options) {
|
|
|
23
23
|
catch (error) {
|
|
24
24
|
console.error(error, "while uploading");
|
|
25
25
|
if (throwError) {
|
|
26
|
-
throw new Error(`Failed to upload: ${error
|
|
26
|
+
throw new Error(`Failed to upload: ${error?.message || "something went wrong"}`);
|
|
27
27
|
}
|
|
28
28
|
return {};
|
|
29
29
|
}
|