cloudmr-ux 4.1.7 → 4.1.9
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.
|
@@ -34,6 +34,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
34
34
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
38
|
+
var t = {};
|
|
39
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
40
|
+
t[p] = s[p];
|
|
41
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
42
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
43
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
44
|
+
t[p[i]] = s[p[i]];
|
|
45
|
+
}
|
|
46
|
+
return t;
|
|
47
|
+
};
|
|
37
48
|
import axios from 'axios';
|
|
38
49
|
import { createAsyncThunk } from '@reduxjs/toolkit';
|
|
39
50
|
import { getFileExtension } from "../../common/utilities/SystemUtilities";
|
|
@@ -136,18 +147,18 @@ export var uploadJob = createAsyncThunk('UploadJob', function (_a, thunkAPI) {
|
|
|
136
147
|
});
|
|
137
148
|
});
|
|
138
149
|
}
|
|
139
|
-
var endpoints, FILE_CHUNK_SIZE, payload, initResponse, _b, uploadId, partUrls_1, Key, fileParts, i, part, totalSize_1, totalUploadedParts_1, uploadedParts, finalizeResponse, e_1;
|
|
140
|
-
return __generator(this, function (
|
|
141
|
-
switch (
|
|
150
|
+
var endpoints, FILE_CHUNK_SIZE, payload, initResponse, _b, uploadId, partUrls_1, Key, fileParts, i, part, totalSize_1, totalUploadedParts_1, uploadedParts, finalizeResponse, _c, _file, lambdaFileMeta, e_1;
|
|
151
|
+
return __generator(this, function (_d) {
|
|
152
|
+
switch (_d.label) {
|
|
142
153
|
case 0:
|
|
143
154
|
endpoints = getEndpoints();
|
|
144
|
-
|
|
155
|
+
_d.label = 1;
|
|
145
156
|
case 1:
|
|
146
|
-
|
|
157
|
+
_d.trys.push([1, 6, , 7]);
|
|
147
158
|
FILE_CHUNK_SIZE = 10 * 1024 * 1024;
|
|
148
159
|
return [4 /*yield*/, createPayload(uploadToken, file, fileAlias)];
|
|
149
160
|
case 2:
|
|
150
|
-
payload =
|
|
161
|
+
payload = _d.sent();
|
|
151
162
|
if (payload === undefined)
|
|
152
163
|
return [2 /*return*/, { code: 403, response: 'file not found', file: undefined, uploadTarget: uploadTarget }
|
|
153
164
|
// thunkAPI.dispatch(setupSetters.setUploadProgress({target: uploadTarget, progress: 0}));
|
|
@@ -155,7 +166,7 @@ export var uploadJob = createAsyncThunk('UploadJob', function (_a, thunkAPI) {
|
|
|
155
166
|
];
|
|
156
167
|
return [4 /*yield*/, AuthenticatedHttpClient.post(payload.destination, payload.lambdaFile, payload.config)];
|
|
157
168
|
case 3:
|
|
158
|
-
initResponse =
|
|
169
|
+
initResponse = _d.sent();
|
|
159
170
|
console.log(initResponse);
|
|
160
171
|
_b = initResponse.data, uploadId = _b.uploadId, partUrls_1 = _b.partUrls, Key = _b.Key;
|
|
161
172
|
fileParts = [];
|
|
@@ -181,22 +192,23 @@ export var uploadJob = createAsyncThunk('UploadJob', function (_a, thunkAPI) {
|
|
|
181
192
|
});
|
|
182
193
|
}); }))];
|
|
183
194
|
case 4:
|
|
184
|
-
uploadedParts =
|
|
185
|
-
return [4 /*yield*/,
|
|
195
|
+
uploadedParts = _d.sent();
|
|
196
|
+
return [4 /*yield*/, AuthenticatedHttpClient.post(endpoints.JOB_UPLOAD_FINALIZE, {
|
|
186
197
|
uploadId: uploadId,
|
|
187
198
|
parts: uploadedParts,
|
|
188
199
|
Key: Key
|
|
189
200
|
}, payload.config)];
|
|
190
201
|
case 5:
|
|
191
|
-
finalizeResponse =
|
|
202
|
+
finalizeResponse = _d.sent();
|
|
192
203
|
console.log(finalizeResponse);
|
|
193
204
|
console.log('all uploads completed');
|
|
194
205
|
if (onUploaded)
|
|
195
206
|
onUploaded(initResponse, file);
|
|
196
207
|
thunkAPI.dispatch(getUpstreamJobs());
|
|
197
|
-
|
|
208
|
+
_c = payload.lambdaFile, _file = _c.file, lambdaFileMeta = __rest(_c, ["file"]);
|
|
209
|
+
return [2 /*return*/, { code: 200, response: initResponse.data.response, file: lambdaFileMeta, uploadTarget: uploadTarget }];
|
|
198
210
|
case 6:
|
|
199
|
-
e_1 =
|
|
211
|
+
e_1 = _d.sent();
|
|
200
212
|
console.log("Following error encountered during uploading:");
|
|
201
213
|
console.error(e_1);
|
|
202
214
|
return [2 /*return*/, { code: 500, response: e_1.response, file: undefined, uploadTarget: uploadTarget }];
|