@platform/cell.client
Advanced tools
Comparing version 0.0.39 to 0.0.40
@@ -79,3 +79,6 @@ "use strict"; | ||
seconds: undefined, | ||
files: files.map(function (item) { return ({ filename: item.filename }); }), | ||
files: files.map(function (_a) { | ||
var filename = _a.filename; | ||
return ({ filename: filename }); | ||
}), | ||
}; | ||
@@ -104,18 +107,35 @@ return [4, common_1.http.post(url, body)]; | ||
return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var props, contentType, form, headers, res, ok, status, uri, filename, expiresAt; | ||
var url, uploadToS3, uploadToLocal, isLocal, res, ok, status, uri, filename, expiresAt; | ||
var _this = this; | ||
return tslib_1.__generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
props = upload.props; | ||
contentType = upload.props['content-type']; | ||
form = new common_1.FormData(); | ||
Object.keys(props) | ||
.map(function (key) { return ({ key: key, value: props[key] }); }) | ||
.forEach(function (_a) { | ||
var key = _a.key, value = _a.value; | ||
return form.append(key, value); | ||
}); | ||
form.append('file', data, { contentType: contentType }); | ||
headers = form.getHeaders(); | ||
return [4, common_1.http.post(upload.url, form, { headers: headers })]; | ||
url = upload.url; | ||
uploadToS3 = function () { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var props, contentType, form, headers; | ||
return tslib_1.__generator(this, function (_a) { | ||
props = upload.props; | ||
contentType = props['content-type']; | ||
form = new common_1.FormData(); | ||
Object.keys(props) | ||
.map(function (key) { return ({ key: key, value: props[key] }); }) | ||
.forEach(function (_a) { | ||
var key = _a.key, value = _a.value; | ||
return form.append(key, value); | ||
}); | ||
form.append('file', data, { contentType: contentType }); | ||
headers = form.getHeaders(); | ||
return [2, common_1.http.post(url, form, { headers: headers })]; | ||
}); | ||
}); }; | ||
uploadToLocal = function () { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var path, headers; | ||
return tslib_1.__generator(this, function (_a) { | ||
path = upload.props.key; | ||
headers = { 'content-type': 'multipart/form-data', path: path }; | ||
return [2, common_1.http.post(url, data, { headers: headers })]; | ||
}); | ||
}); }; | ||
isLocal = url.startsWith('http://localhost'); | ||
return [4, (isLocal ? uploadToLocal() : uploadToS3())]; | ||
case 1: | ||
@@ -122,0 +142,0 @@ res = _b.sent(); |
{ | ||
"name": "@platform/cell.client", | ||
"version": "0.0.39", | ||
"version": "0.0.40", | ||
"description": "A strongly typed HTTP client for operating the REST service API.", | ||
@@ -17,4 +17,4 @@ "main": "lib/index", | ||
"dependencies": { | ||
"@platform/cell.schema": "0.3.11", | ||
"@platform/cell.types": "0.3.14", | ||
"@platform/cell.schema": "0.3.12", | ||
"@platform/cell.types": "0.3.15", | ||
"@platform/http": "0.8.2", | ||
@@ -21,0 +21,0 @@ "@platform/libs": "0.1.5", |
Sorry, the diff of this file is not supported yet
52045
1233
+ Added@platform/cell.coord@0.8.8(transitive)
+ Added@platform/cell.schema@0.3.12(transitive)
+ Added@platform/cell.types@0.3.15(transitive)
- Removed@platform/cell.coord@0.8.7(transitive)
- Removed@platform/cell.schema@0.3.11(transitive)
- Removed@platform/cell.types@0.3.14(transitive)
Updated@platform/cell.schema@0.3.12
Updated@platform/cell.types@0.3.15