@pi-r/aws-v3 0.6.6 → 0.6.7
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/client/index.js +2 -2
- package/package.json +5 -5
- package/upload/index.js +3 -3
package/client/index.js
CHANGED
|
@@ -246,7 +246,7 @@ async function deleteObjectsV2(credential, Bucket, recursive = true, service = '
|
|
|
246
246
|
const [client, AWS] = createStorageClient.call(this, credential, service, sdk);
|
|
247
247
|
return client.send(new AWS.ListObjectsCommand({ Bucket }))
|
|
248
248
|
.then(async ({ Contents }) => {
|
|
249
|
-
if (Contents
|
|
249
|
+
if (Contents === null || Contents === void 0 ? void 0 : Contents.length) {
|
|
250
250
|
let Objects = Contents.map(data => ({ Key: data.Key }));
|
|
251
251
|
if (!recursive) {
|
|
252
252
|
Objects = Objects.filter(value => !value.Key.includes('/'));
|
|
@@ -283,7 +283,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
|
|
|
283
283
|
const cacheValue = { value: this.valueOfKey(credential, 'cache'), sessionKey };
|
|
284
284
|
let client;
|
|
285
285
|
const createClient = () => client || (client = createDatabaseClient.call(this, credential));
|
|
286
|
-
const closeClient = () => client
|
|
286
|
+
const closeClient = () => client === null || client === void 0 ? void 0 : client[0].destroy();
|
|
287
287
|
(0, aws_1.setDatabaseEndpoint)(credential);
|
|
288
288
|
for (let i = 0; i < length; ++i) {
|
|
289
289
|
const item = batch[i];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/aws-v3",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.7",
|
|
4
4
|
"description": "AWS V3 cloud functions for E-mc.",
|
|
5
5
|
"main": "client/index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"homepage": "https://github.com/anpham6/pi-r#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/cloud": "^0.8.
|
|
24
|
-
"@e-mc/module": "^0.8.
|
|
25
|
-
"@e-mc/types": "^0.8.
|
|
26
|
-
"@pi-r/aws": "^0.6.
|
|
23
|
+
"@e-mc/cloud": "^0.8.8",
|
|
24
|
+
"@e-mc/module": "^0.8.8",
|
|
25
|
+
"@e-mc/types": "^0.8.8",
|
|
26
|
+
"@pi-r/aws": "^0.6.7",
|
|
27
27
|
"@aws-sdk/client-dynamodb": "^3.540.0",
|
|
28
28
|
"@aws-sdk/client-s3": "^3.540.0",
|
|
29
29
|
"@aws-sdk/credential-providers": "^3.540.0",
|
package/upload/index.js
CHANGED
|
@@ -31,16 +31,16 @@ module.exports = function upload(credential, service = 'aws-v3', sdk = '@aws-sdk
|
|
|
31
31
|
const configBucket = admin.configBucket;
|
|
32
32
|
if (!BUCKET_SESSION.has(service + Bucket)) {
|
|
33
33
|
const bucketAcl = admin.publicRead ? 'public-read' : admin.acl;
|
|
34
|
-
const response = BUCKET_RESPONSE[_a = bucketKey = (0, aws_1.getBucketKey)(credential, Bucket, bucketAcl, service, sdk)] || (BUCKET_RESPONSE[_a] = client_1.createBucketV2.call(this, credential, Bucket, bucketAcl, configBucket
|
|
34
|
+
const response = BUCKET_RESPONSE[_a = bucketKey = (0, aws_1.getBucketKey)(credential, Bucket, bucketAcl, service, sdk)] || (BUCKET_RESPONSE[_a] = client_1.createBucketV2.call(this, credential, Bucket, bucketAcl, configBucket === null || configBucket === void 0 ? void 0 : configBucket.create, service, sdk));
|
|
35
35
|
if (!await response) {
|
|
36
36
|
errorResponse(null);
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
BUCKET_SESSION.add(service + Bucket);
|
|
40
40
|
}
|
|
41
|
-
const DefaultRetention = configBucket
|
|
41
|
+
const DefaultRetention = configBucket === null || configBucket === void 0 ? void 0 : configBucket.retentionPolicy;
|
|
42
42
|
if ((0, types_1.isPlainObject)(DefaultRetention)) {
|
|
43
|
-
client.send(new AWS.PutObjectLockConfigurationCommand({ Bucket, ObjectLockConfiguration: { ObjectLockEnabled: 'Enabled', Rule: { DefaultRetention } }, ExpectedBucketOwner: options
|
|
43
|
+
client.send(new AWS.PutObjectLockConfigurationCommand({ Bucket, ObjectLockConfiguration: { ObjectLockEnabled: 'Enabled', Rule: { DefaultRetention } }, ExpectedBucketOwner: options === null || options === void 0 ? void 0 : options.ExpectedBucketOwner, RequestPayer: options === null || options === void 0 ? void 0 : options.RequestPayer }))
|
|
44
44
|
.then(() => {
|
|
45
45
|
aws_1.writeMessageDefaultRetention.call(this, Bucket, DefaultRetention, service);
|
|
46
46
|
})
|