@pi-r/aws 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 CHANGED
@@ -261,7 +261,7 @@ async function deleteObjectsV2(credential, Bucket, recursive = true, service = '
261
261
  const S3 = createStorageClient.call(this, credential, service, sdk);
262
262
  return S3.listObjects({ Bucket }).promise()
263
263
  .then(async ({ Contents }) => {
264
- if (Contents?.length) {
264
+ if (Contents === null || Contents === void 0 ? void 0 : Contents.length) {
265
265
  let Objects = Contents.map(data => ({ Key: data.Key }));
266
266
  if (!recursive) {
267
267
  Objects = Objects.filter(value => !value.Key.includes('/'));
@@ -399,10 +399,11 @@ async function executeBatchQuery(credential, batch, sessionKey) {
399
399
  }
400
400
  exports.executeBatchQuery = executeBatchQuery;
401
401
  function setDatabaseEndpoint(config) {
402
+ var _a, _b;
402
403
  let region = config.region;
403
404
  const endpoint = config.endpoint || (config.endpoint = `https://dynamodb.${(0, types_1.isString)(region) ? region : process.env.AWS_DEFAULT_REGION || process.env.AWS_REGION || 'us-east-1'}.amazonaws.com`);
404
405
  if (!region) {
405
- region = ((0, types_1.isString)(endpoint) && /\bdynamodb\.([^.]+)\./i.exec(endpoint)?.[1] || process.env.AWS_DEFAULT_REGION || process.env.AWS_REGION)?.toLowerCase();
406
+ region = (_b = ((0, types_1.isString)(endpoint) && ((_a = /\bdynamodb\.([^.]+)\./i.exec(endpoint)) === null || _a === void 0 ? void 0 : _a[1]) || process.env.AWS_DEFAULT_REGION || process.env.AWS_REGION)) === null || _b === void 0 ? void 0 : _b.toLowerCase();
406
407
  if (region && region !== 'us-east-1') {
407
408
  config.region = region;
408
409
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/aws",
3
- "version": "0.6.6",
3
+ "version": "0.6.7",
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.8.7",
25
- "@e-mc/module": "^0.8.7",
26
- "@e-mc/types": "^0.8.7",
24
+ "@e-mc/cloud": "^0.8.8",
25
+ "@e-mc/module": "^0.8.8",
26
+ "@e-mc/types": "^0.8.8",
27
27
  "aws-sdk": "^2.1591.0"
28
28
  }
29
29
  }
package/upload/index.js CHANGED
@@ -28,7 +28,7 @@ module.exports = function upload(credential, service = 'aws', sdk = 'aws-sdk/cli
28
28
  const configBucket = admin.configBucket;
29
29
  if (!BUCKET_SESSION.has(service + Bucket)) {
30
30
  const bucketAcl = admin.publicRead ? 'public-read' : admin.acl;
31
- 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?.create, service, sdk));
31
+ 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));
32
32
  if (!await response) {
33
33
  errorResponse(null);
34
34
  return;
@@ -36,9 +36,9 @@ module.exports = function upload(credential, service = 'aws', sdk = 'aws-sdk/cli
36
36
  BUCKET_SESSION.add(service + Bucket);
37
37
  }
38
38
  if (service !== 'ibm' && service !== 'oci') {
39
- const DefaultRetention = configBucket?.retentionPolicy;
39
+ const DefaultRetention = configBucket === null || configBucket === void 0 ? void 0 : configBucket.retentionPolicy;
40
40
  if ((0, types_1.isPlainObject)(DefaultRetention)) {
41
- s3.putObjectLockConfiguration({ Bucket, ObjectLockConfiguration: { ObjectLockEnabled: 'Enabled', Rule: { DefaultRetention } }, ExpectedBucketOwner: options?.ExpectedBucketOwner, RequestPayer: options?.RequestPayer }, err => {
41
+ 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 => {
42
42
  if (!err) {
43
43
  client_1.writeMessageDefaultRetention.call(this, Bucket, DefaultRetention, service);
44
44
  }