@quatrain/storage-s3 1.1.7 → 1.1.11

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.
@@ -28,7 +28,7 @@ class S3StorageAdapter extends storage_1.AbstractStorageAdapter {
28
28
  },
29
29
  };
30
30
  this._client = new client_s3_1.S3Client(config);
31
- storage_1.Storage.log(`AWS Storage Adapter initialized in ${this._params.config.region}`);
31
+ storage_1.Storage.info(`AWS Storage Adapter initialized in ${this._params.config.region}`);
32
32
  }
33
33
  getDriver() {
34
34
  return this._client;
@@ -51,7 +51,7 @@ class S3StorageAdapter extends storage_1.AbstractStorageAdapter {
51
51
  Body: yield this.streamToBuffer(stream),
52
52
  ContentType: file.contentType,
53
53
  };
54
- storage_1.Storage.log(`Uploading ${file.ref} to ${file.bucket}`);
54
+ storage_1.Storage.debug(`Uploading ${file.ref} to ${file.bucket}`);
55
55
  const command = new client_s3_1.PutObjectCommand(input);
56
56
  yield this._client.send(command);
57
57
  return file;
@@ -59,7 +59,7 @@ class S3StorageAdapter extends storage_1.AbstractStorageAdapter {
59
59
  }
60
60
  copy(file, destFile) {
61
61
  return __awaiter(this, void 0, void 0, function* () {
62
- storage_1.Storage.log(`Copying file ${file.ref} to ${destFile.ref}`);
62
+ storage_1.Storage.debug(`Copying file ${file.ref} to ${destFile.ref}`);
63
63
  const command = new client_s3_1.CopyObjectCommand({
64
64
  CopySource: encodeURI(`${file.bucket}/${file.ref}`),
65
65
  Bucket: file.bucket,
@@ -90,6 +90,7 @@ class S3StorageAdapter extends storage_1.AbstractStorageAdapter {
90
90
  Bucket: file.bucket,
91
91
  Key: encodeURI(file.ref),
92
92
  });
93
+ storage_1.Storage.debug(`Creating public url for ${file.ref}`);
93
94
  const url = yield (0, s3_request_presigner_1.getSignedUrl)(this._client, command, { expiresIn });
94
95
  return { url, expiresIn };
95
96
  });
@@ -103,14 +104,14 @@ class S3StorageAdapter extends storage_1.AbstractStorageAdapter {
103
104
  Key: file.ref,
104
105
  });
105
106
  yield ((_a = this._client) === null || _a === void 0 ? void 0 : _a.send(command));
106
- storage_1.Storage.log('Object successfully deleted.');
107
+ storage_1.Storage.info(`Object ${file.ref} successfully deleted`);
107
108
  return true;
108
109
  });
109
110
  }
110
111
  getReadable(file) {
111
112
  var _a, _b;
112
113
  return __awaiter(this, void 0, void 0, function* () {
113
- storage_1.Storage.log('GET Readable :', file.ref);
114
+ storage_1.Storage.debug(`GET Readable for ${file.ref}`);
114
115
  const command = new client_s3_1.GetObjectCommand({
115
116
  Bucket: file.bucket || this._params.config.bucket,
116
117
  Key: file.ref,
@@ -149,15 +150,15 @@ class S3StorageAdapter extends storage_1.AbstractStorageAdapter {
149
150
  }
150
151
  getUploadUrl(file, expiresIn = 3600) {
151
152
  return __awaiter(this, void 0, void 0, function* () {
152
- const input = {
153
+ const command = new client_s3_1.PutObjectCommand({
153
154
  Bucket: file.bucket || this._params.config.bucket,
154
155
  Key: file.ref,
155
- };
156
- const command = new client_s3_1.PutObjectCommand(input);
156
+ ContentType: file.contentType,
157
+ });
157
158
  const url = yield (0, s3_request_presigner_1.getSignedUrl)(this._client, command, { expiresIn });
158
159
  return {
159
- href: url,
160
- type: 'PUT',
160
+ url,
161
+ method: 'PUT',
161
162
  accept: file.contentType || 'application/octet-stream',
162
163
  expiresIn,
163
164
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quatrain/storage-s3",
3
- "version": "1.1.7",
3
+ "version": "1.1.11",
4
4
  "description": "Storage adapter for S3 compatible services",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "dependencies": {
25
25
  "@aws-sdk/client-s3": "^3.337.0",
26
26
  "@aws-sdk/s3-request-presigner": "^3.342.0",
27
- "@quatrain/storage": "^1.1.7",
27
+ "@quatrain/storage": "^1.1.11",
28
28
  "fs-extra": "^11.2.0"
29
29
  },
30
30
  "scripts": {