@platform/fs.s3
Advanced tools
Comparing version 0.7.64 to 0.7.67
@@ -10,3 +10,3 @@ "use strict"; | ||
function formatETag(value) { | ||
return value ? value.replace(/^\"/, '').replace(/\"$/, '') : ''; | ||
return value ? value.replace(/^"/, '').replace(/"$/, '') : ''; | ||
} | ||
@@ -13,0 +13,0 @@ exports.formatETag = formatETag; |
@@ -9,8 +9,8 @@ "use strict"; | ||
function toBucketUrl(args) { | ||
var bucket = util_format_1.formatBucket(args.bucket); | ||
var bucket = (0, util_format_1.formatBucket)(args.bucket); | ||
if (!bucket) { | ||
throw new Error("No bucket provided."); | ||
} | ||
var url = url_1.parse(args.s3.endpoint.href, false); | ||
return "https://" + bucket + "." + url.host; | ||
var url = (0, url_1.parse)(args.s3.endpoint.href, false); | ||
return "https://".concat(bucket, ".").concat(url.host); | ||
} | ||
@@ -21,4 +21,4 @@ exports.toBucketUrl = toBucketUrl; | ||
var endpoint = toBucketUrl({ s3: s3, bucket: bucket }); | ||
var path = util_format_1.formatKeyPath(args.path); | ||
return endpoint + "/" + path; | ||
var path = (0, util_format_1.formatKeyPath)(args.path); | ||
return "".concat(endpoint, "/").concat(path); | ||
} | ||
@@ -28,3 +28,3 @@ exports.toObjectUrl = toObjectUrl; | ||
var s3 = args.s3, bucket = args.bucket; | ||
var path = util_format_1.formatKeyPath(args.path); | ||
var path = (0, util_format_1.formatKeyPath)(args.path); | ||
if (!path) { | ||
@@ -37,3 +37,3 @@ throw new Error("Object key path must be specified for pre-signed URLs."); | ||
Key: path, | ||
Expires: util_time_1.toSeconds(expires), | ||
Expires: (0, util_time_1.toSeconds)(expires), | ||
}; | ||
@@ -50,7 +50,7 @@ if (operation === 'putObject') { | ||
var s3 = args.s3, expires = args.expires, acl = args.acl, bucket = args.bucket; | ||
var key = util_format_1.formatKeyPath(args.key); | ||
var key = (0, util_format_1.formatKeyPath)(args.key); | ||
if (!key) { | ||
throw new Error("Object key path must be specified for pre-signed URLs."); | ||
} | ||
var contentType = args.contentType || libs_1.toMimetype(key, 'application/octet-stream'); | ||
var contentType = args.contentType || (0, libs_1.toMimetype)(key, 'application/octet-stream'); | ||
var fields = { | ||
@@ -68,3 +68,3 @@ 'content-type': contentType, | ||
var post = s3.createPresignedPost({ | ||
Expires: util_time_1.toSeconds(expires), | ||
Expires: (0, util_time_1.toSeconds)(expires), | ||
Bucket: bucket, | ||
@@ -71,0 +71,0 @@ Conditions: Conditions, |
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { S3, S3Config } from './types'; | ||
@@ -39,9 +41,9 @@ export * from './types'; | ||
lstat: typeof import("fs-extra").lstat; | ||
lstatSync: import("fs").StatSyncFn<import("fs").PathLike>; | ||
lstatSync: import("fs").StatSyncFn; | ||
path: import("path").PlatformPath; | ||
join: (...paths: string[]) => string; | ||
resolve: (...pathSegments: string[]) => string; | ||
dirname: (p: string) => string; | ||
basename: (p: string, ext?: string | undefined) => string; | ||
extname: (p: string) => string; | ||
resolve: (...paths: string[]) => string; | ||
dirname: (path: string) => string; | ||
basename: (path: string, ext?: string | undefined) => string; | ||
extname: (path: string) => string; | ||
size: { | ||
@@ -48,0 +50,0 @@ toString(input: number | Buffer, options?: import("@platform/fs/lib/size").IFileSizeStringOptions | undefined): string; |
@@ -27,3 +27,3 @@ "use strict"; | ||
Key: target.key, | ||
CopySource: encodeURI(source.bucket + "/" + source.key), | ||
CopySource: encodeURI("".concat(source.bucket, "/").concat(source.key)), | ||
ACL: args.acl, | ||
@@ -36,3 +36,3 @@ ContentType: args.contentType, | ||
res = _b.sent(); | ||
etag = common_1.formatETag((_a = res.CopyObjectResult) === null || _a === void 0 ? void 0 : _a.ETag); | ||
etag = (0, common_1.formatETag)((_a = res.CopyObjectResult) === null || _a === void 0 ? void 0 : _a.ETag); | ||
return [2, done(200, { etag: etag })]; | ||
@@ -39,0 +39,0 @@ case 3: |
@@ -35,3 +35,3 @@ "use strict"; | ||
catch (error) { | ||
throw new Error("Failed to parse S3 object at key [" + key + "] from JSON. " + error.message); | ||
throw new Error("Failed to parse S3 object at key [".concat(key, "] from JSON. ").concat(error.message)); | ||
} | ||
@@ -43,6 +43,6 @@ } | ||
readProps = function (obj) { | ||
response.modifiedAt = common_1.formatTimestamp(obj.LastModified); | ||
response.etag = common_1.formatETag(obj.ETag); | ||
response.modifiedAt = (0, common_1.formatTimestamp)(obj.LastModified); | ||
response.etag = (0, common_1.formatETag)(obj.ETag); | ||
response.contentType = obj.ContentType || ''; | ||
response.bytes = common_1.defaultValue(obj.ContentLength, -1); | ||
response.bytes = (0, common_1.defaultValue)(obj.ContentLength, -1); | ||
return obj; | ||
@@ -49,0 +49,0 @@ }; |
@@ -35,31 +35,31 @@ "use strict"; | ||
var endpoint = options.endpoint; | ||
return s3_url_1.url({ getS3: getS3, bucket: bucket, path: path, endpoint: endpoint }); | ||
return (0, s3_url_1.url)({ getS3: getS3, bucket: bucket, path: path, endpoint: endpoint }); | ||
}, | ||
list: function (args) { | ||
var s3 = getS3('origin'); | ||
return s3_list_1.list(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 })); | ||
return (0, s3_list_1.list)(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 })); | ||
}, | ||
get: function (args) { | ||
var s3 = getS3('origin'); | ||
return s3_get_1.get(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 })); | ||
return (0, s3_get_1.get)(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 })); | ||
}, | ||
put: function (args) { | ||
var s3 = getS3('origin'); | ||
return s3_put_1.put(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 })); | ||
return (0, s3_put_1.put)(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 })); | ||
}, | ||
post: function (args) { | ||
var s3 = getS3('origin'); | ||
return s3_post_1.post(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 })); | ||
return (0, s3_post_1.post)(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 })); | ||
}, | ||
deleteOne: function (args) { | ||
var s3 = getS3('origin'); | ||
return s3_delete_1.deleteOne(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 })); | ||
return (0, s3_delete_1.deleteOne)(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 })); | ||
}, | ||
deleteMany: function (args) { | ||
var s3 = getS3('origin'); | ||
return s3_delete_1.deleteMany(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 })); | ||
return (0, s3_delete_1.deleteMany)(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 })); | ||
}, | ||
copy: function (args) { | ||
var s3 = getS3('origin'); | ||
return s3_copy_1.copy(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 })); | ||
return (0, s3_copy_1.copy)(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 })); | ||
}, | ||
@@ -66,0 +66,0 @@ bucket: function (name) { |
@@ -28,3 +28,3 @@ "use strict"; | ||
prefix: prefix || '', | ||
max: common_1.defaultValue(max, -1), | ||
max: (0, common_1.defaultValue)(max, -1), | ||
items: [], | ||
@@ -36,4 +36,4 @@ }; | ||
key: data.Key || '', | ||
modifiedAt: common_1.formatTimestamp(data.LastModified), | ||
etag: common_1.formatETag(data.ETag) || '', | ||
modifiedAt: (0, common_1.formatTimestamp)(data.LastModified), | ||
etag: (0, common_1.formatETag)(data.ETag) || '', | ||
storage: data.StorageClass || 'STANDARD', | ||
@@ -88,3 +88,3 @@ owner: { | ||
prefix: prefix || '', | ||
max: common_1.defaultValue(max, -1), | ||
max: (0, common_1.defaultValue)(max, -1), | ||
items: [], | ||
@@ -99,3 +99,3 @@ }; | ||
_a.trys.push([1, 4, , 5]); | ||
Prefix = args.prefix ? args.prefix.replace(/\/$/, '') + "/" : undefined; | ||
Prefix = args.prefix ? "".concat(args.prefix.replace(/\/$/, ''), "/") : undefined; | ||
return [4, s3.listObjectsV2({ | ||
@@ -102,0 +102,0 @@ Bucket: bucket, |
@@ -59,3 +59,3 @@ "use strict"; | ||
if (err) { | ||
var error = new Error(("Failed getting object meta-data. " + err.message).trim()); | ||
var error = new Error("Failed getting object meta-data. ".concat(err.message).trim()); | ||
done(500, { error: error }); | ||
@@ -71,3 +71,3 @@ } | ||
else { | ||
error = new Error(("Failed to post object. " + res.statusText).trim()); | ||
error = new Error("Failed to post object. ".concat(res.statusText).trim()); | ||
done(status, { error: error }); | ||
@@ -74,0 +74,0 @@ } |
@@ -14,3 +14,3 @@ "use strict"; | ||
url = common_1.util.toObjectUrl({ s3: s3, bucket: bucket, path: key }); | ||
contentType = args.contentType || common_1.toMimetype(key, 'application/octet-stream'); | ||
contentType = args.contentType || (0, common_1.toMimetype)(key, 'application/octet-stream'); | ||
done = function (status, options) { | ||
@@ -17,0 +17,0 @@ if (options === void 0) { options = {}; } |
{ | ||
"name": "@platform/fs.s3", | ||
"version": "0.7.64", | ||
"version": "0.7.67", | ||
"description": "Filesystem like API into AWS S3 (and Digital Ocean Spaces)", | ||
@@ -9,3 +9,2 @@ "main": "lib/index", | ||
"test": "ts test", | ||
"tdd": "ts test --watch", | ||
"lint": "ts lint", | ||
@@ -18,18 +17,18 @@ "build": "ts build --no-esm", | ||
"dependencies": { | ||
"@platform/fs": "0.7.5", | ||
"@platform/fs.s3.types": "0.3.27", | ||
"@platform/http": "0.14.29", | ||
"@platform/libs": "0.2.14", | ||
"@platform/log": "0.1.62", | ||
"@platform/types": "0.5.25", | ||
"@platform/util.mimetype": "0.1.48", | ||
"@platform/util.value": "0.9.10", | ||
"aws-sdk": "2.979.0", | ||
"@platform/fs": "0.7.9", | ||
"@platform/fs.s3.types": "0.3.30", | ||
"@platform/http": "0.14.32", | ||
"@platform/libs": "0.3.2", | ||
"@platform/log": "0.1.65", | ||
"@platform/types": "0.5.27", | ||
"@platform/util.mimetype": "0.1.51", | ||
"@platform/util.value": "0.9.13", | ||
"aws-sdk": "2.1186.0", | ||
"form-data": "4.0.0" | ||
}, | ||
"devDependencies": { | ||
"@platform/test": "0.2.10", | ||
"@platform/ts": "4.1.23", | ||
"@platform/test": "0.3.2", | ||
"@platform/ts": "4.7.7", | ||
"@types/dotenv": "8.2.0", | ||
"dotenv": "10.0.0" | ||
"dotenv": "16.0.1" | ||
}, | ||
@@ -36,0 +35,0 @@ "files": [ |
69553
44
1481
+ Added@platform/fs@0.7.9(transitive)
+ Added@platform/fs.s3.types@0.3.30(transitive)
+ Added@platform/http@0.14.32(transitive)
+ Added@platform/http.types@0.2.55(transitive)
+ Added@platform/libs@0.3.2(transitive)
+ Added@platform/log@0.1.65(transitive)
+ Added@platform/types@0.5.27(transitive)
+ Added@platform/util.is@0.0.165(transitive)
+ Added@platform/util.mimetype@0.1.51(transitive)
+ Added@platform/util.value@0.9.13(transitive)
+ Added@types/fs-extra@9.0.13(transitive)
+ Added@types/js-yaml@4.0.5(transitive)
+ Added@types/ramda@0.28.15(transitive)
+ Addedarchiver@5.3.1(transitive)
+ Addedavailable-typed-arrays@1.0.7(transitive)
+ Addedaws-sdk@2.1186.0(transitive)
+ Addedcall-bind@1.0.7(transitive)
+ Addedchalk@5.0.1(transitive)
+ Addedcli-table@0.3.11(transitive)
+ Addedcross-fetch@3.1.5(transitive)
+ Addeddayjs@1.11.4(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddotenv@16.0.1(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedfilesize@9.0.11(transitive)
+ Addedfor-each@0.3.3(transitive)
+ Addedfs-extra@10.1.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedglob@8.0.3(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedis-arguments@1.1.1(transitive)
+ Addedis-callable@1.2.7(transitive)
+ Addedis-generator-function@1.0.10(transitive)
+ Addedis-typed-array@1.1.13(transitive)
+ Addedjmespath@0.16.0(transitive)
+ Addedminimatch@5.1.0(transitive)
+ Addednode-fetch@2.6.7(transitive)
+ Addedpossible-typed-array-names@1.0.0(transitive)
+ Addedramda@0.28.0(transitive)
+ Addedrxjs@7.5.6(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedtslib@2.6.2(transitive)
+ Addedutil@0.12.5(transitive)
+ Addeduuid@8.0.0(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)
+ Addedwhich-typed-array@1.1.15(transitive)
- Removed@platform/fs@0.7.5(transitive)
- Removed@platform/fs.s3.types@0.3.27(transitive)
- Removed@platform/fs.types@0.1.12(transitive)
- Removed@platform/http@0.14.29(transitive)
- Removed@platform/http.types@0.2.52(transitive)
- Removed@platform/libs@0.2.14(transitive)
- Removed@platform/log@0.1.62(transitive)
- Removed@platform/types@0.5.25(transitive)
- Removed@platform/util.is@0.0.162(transitive)
- Removed@platform/util.mimetype@0.1.48(transitive)
- Removed@platform/util.value@0.9.10(transitive)
- Removed@types/fs-extra@9.0.12(transitive)
- Removed@types/js-yaml@4.0.3(transitive)
- Removed@types/ramda@0.27.44(transitive)
- Removedansi-styles@4.3.0(transitive)
- Removedarchiver@5.3.0(transitive)
- Removedaws-sdk@2.979.0(transitive)
- Removedchalk@4.1.2(transitive)
- Removedcli-table@0.3.6(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removedcross-fetch@3.1.4(transitive)
- Removeddayjs@1.10.6(transitive)
- Removeddotenv@10.0.0(transitive)
- Removedfilesize@8.0.0(transitive)
- Removedfs-extra@10.0.0(transitive)
- Removedglob@7.1.7(transitive)
- Removedhas-flag@4.0.0(transitive)
- Removedjmespath@0.15.0(transitive)
- Removedminimatch@3.0.45.1.6(transitive)
- Removednode-fetch@2.6.1(transitive)
- Removedramda@0.27.1(transitive)
- Removedrxjs@7.3.0(transitive)
- Removedsupports-color@7.2.0(transitive)
- Removedtslib@2.1.0(transitive)
- Removeduuid@3.3.2(transitive)
Updated@platform/fs@0.7.9
Updated@platform/fs.s3.types@0.3.30
Updated@platform/http@0.14.32
Updated@platform/libs@0.3.2
Updated@platform/log@0.1.65
Updated@platform/types@0.5.27
Updated@platform/util.value@0.9.13
Updatedaws-sdk@2.1186.0