@pi-r/aws 0.5.3 → 0.5.5
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/LICENSE +1 -1
- package/client/index.js +3 -2
- package/package.json +5 -5
- package/upload/index.js +3 -3
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright
|
|
1
|
+
Copyright 2024 An Pham
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
4
|
|
package/client/index.js
CHANGED
|
@@ -254,7 +254,7 @@ async function deleteObjectsV2(credential, Bucket, recursive = true, service = '
|
|
|
254
254
|
const S3 = createStorageClient.call(this, credential, service, sdk);
|
|
255
255
|
return S3.listObjects({ Bucket }).promise()
|
|
256
256
|
.then(({ Contents }) => {
|
|
257
|
-
if (Contents
|
|
257
|
+
if (Contents === null || Contents === void 0 ? void 0 : Contents.length) {
|
|
258
258
|
let Objects = Contents.map(data => ({ Key: data.Key }));
|
|
259
259
|
if (!recursive) {
|
|
260
260
|
Objects = Objects.filter(value => value.Key.indexOf('/') === -1);
|
|
@@ -350,10 +350,11 @@ async function executeBatchQuery(credential, batch, sessionKey) {
|
|
|
350
350
|
}
|
|
351
351
|
exports.executeBatchQuery = executeBatchQuery;
|
|
352
352
|
function setDatabaseEndpoint(config) {
|
|
353
|
+
var _a, _b;
|
|
353
354
|
let region = config.region;
|
|
354
355
|
config.endpoint || (config.endpoint = `https://dynamodb.${(0, types_1.isString)(region) ? region : process.env.AWS_DEFAULT_REGION || 'us-east-1'}.amazonaws.com`);
|
|
355
356
|
if (!region && (0, types_1.isString)(config.endpoint)) {
|
|
356
|
-
region = (/dynamodb\.([^.]+)\./i.exec(config.endpoint)
|
|
357
|
+
region = (_b = (((_a = /dynamodb\.([^.]+)\./i.exec(config.endpoint)) === null || _a === void 0 ? void 0 : _a[1]) || process.env.AWS_DEFAULT_REGION)) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
357
358
|
if (region && region !== 'us-east-1') {
|
|
358
359
|
config.region = region;
|
|
359
360
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/aws",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "AWS V2 cloud functions for E-mc.",
|
|
5
5
|
"main": "client/index.js",
|
|
6
6
|
"types": "client/index.d.ts",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"homepage": "https://github.com/anpham6/pi-r#readme",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@e-mc/cloud": "^0.7.
|
|
25
|
-
"@e-mc/module": "^0.7.
|
|
26
|
-
"@e-mc/types": "^0.7.
|
|
27
|
-
"aws-sdk": "^2.
|
|
24
|
+
"@e-mc/cloud": "^0.7.10",
|
|
25
|
+
"@e-mc/module": "^0.7.10",
|
|
26
|
+
"@e-mc/types": "^0.7.10",
|
|
27
|
+
"aws-sdk": "^2.1659.0"
|
|
28
28
|
}
|
|
29
29
|
}
|
package/upload/index.js
CHANGED
|
@@ -29,7 +29,7 @@ function upload(credential, service = 'aws', sdk = 'aws-sdk/clients/s3') {
|
|
|
29
29
|
const configBucket = admin.configBucket;
|
|
30
30
|
if (!BUCKET_SESSION.has(service + Bucket)) {
|
|
31
31
|
const bucketAcl = admin.publicRead ? 'public-read' : admin.acl;
|
|
32
|
-
const response = BUCKET_RESPONSE[_a = bucketKey = (0, client_1.getBucketKey)(credential, Bucket, bucketAcl, service, sdk)] || (BUCKET_RESPONSE[_a] = client_1.createBucketV2.call(this, credential, Bucket, bucketAcl, configBucket
|
|
32
|
+
const response = BUCKET_RESPONSE[_a = bucketKey = (0, client_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));
|
|
33
33
|
if (!await response) {
|
|
34
34
|
errorResponse(null);
|
|
35
35
|
return;
|
|
@@ -37,9 +37,9 @@ function upload(credential, service = 'aws', sdk = 'aws-sdk/clients/s3') {
|
|
|
37
37
|
BUCKET_SESSION.add(service + Bucket);
|
|
38
38
|
}
|
|
39
39
|
if (service !== 'oci') {
|
|
40
|
-
const DefaultRetention = configBucket
|
|
40
|
+
const DefaultRetention = configBucket === null || configBucket === void 0 ? void 0 : configBucket.retentionPolicy;
|
|
41
41
|
if ((0, types_1.isPlainObject)(DefaultRetention)) {
|
|
42
|
-
s3.putObjectLockConfiguration({ Bucket, ObjectLockConfiguration: { ObjectLockEnabled: 'Enabled', Rule: { DefaultRetention } }, ExpectedBucketOwner: options
|
|
42
|
+
s3.putObjectLockConfiguration({ 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 }, err => {
|
|
43
43
|
if (!err) {
|
|
44
44
|
client_1.writeMessageDefaultRetention.call(this, Bucket, DefaultRetention, service);
|
|
45
45
|
}
|