@pi-r/aws 0.2.10 → 0.2.12

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
@@ -262,7 +262,7 @@ async function deleteObjectsV2(credential, Bucket, recursive = true, service = '
262
262
  const S3 = createStorageClient.call(this, credential, service, sdk);
263
263
  return S3.listObjects({ Bucket }).promise()
264
264
  .then(({ Contents }) => {
265
- if (Contents?.length) {
265
+ if (Contents === null || Contents === void 0 ? void 0 : Contents.length) {
266
266
  let Objects = Contents.map(data => ({ Key: data.Key }));
267
267
  if (!recursive) {
268
268
  Objects = Objects.filter(value => value.Key.indexOf('/') === -1);
@@ -357,9 +357,10 @@ async function executeBatchQuery(credential, batch, sessionKey) {
357
357
  }
358
358
  exports.executeBatchQuery = executeBatchQuery;
359
359
  function setDatabaseEndpoint(config) {
360
+ var _a, _b;
360
361
  config.endpoint || (config.endpoint = `https://dynamodb.${(0, types_1.isString)(config.region) ? config.region : process.env.AWS_DEFAULT_REGION || 'us-east-1'}.amazonaws.com`);
361
362
  if (!config.region && (0, types_1.isString)(config.endpoint)) {
362
- const region = (/dynamodb\.([^.]+)\./i.exec(config.endpoint)?.[1] || process.env.AWS_DEFAULT_REGION)?.toLowerCase();
363
+ const 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();
363
364
  if (region && region !== 'us-east-1') {
364
365
  config.region = region;
365
366
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/aws",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
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.5.6",
25
- "@e-mc/module": "^0.5.6",
26
- "@e-mc/types": "^0.5.6",
27
- "aws-sdk": "^2.1591.0"
24
+ "@e-mc/cloud": "^0.5.10",
25
+ "@e-mc/module": "^0.5.10",
26
+ "@e-mc/types": "^0.5.10",
27
+ "aws-sdk": "^2.1659.0"
28
28
  }
29
29
  }
package/upload/index.js CHANGED
@@ -12,6 +12,7 @@ function upload(credential, service = 'aws', sdk = 'aws-sdk/clients/s3') {
12
12
  const s3 = client_1.createStorageClient.call(this, credential, service, sdk);
13
13
  return async (data, callback) => {
14
14
  var _a;
15
+ var _b;
15
16
  const { bucket: Bucket, localUri } = data;
16
17
  const { pathname = '', fileGroup, contentType, metadata, endpoint, active, publicRead, acl, admin = {}, overwrite, options } = data.upload;
17
18
  let filename = data.upload.filename || path.basename(localUri), bucketKey;
@@ -27,7 +28,7 @@ function upload(credential, service = 'aws', sdk = 'aws-sdk/clients/s3') {
27
28
  };
28
29
  if (!BUCKET_SESSION.has(service + Bucket)) {
29
30
  const bucketAcl = admin.publicRead ? 'public-read' : admin.acl;
30
- 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, admin.configBucket?.create, service, sdk));
31
+ const response = BUCKET_RESPONSE[_b = bucketKey = (0, client_1.getBucketKey)(credential, Bucket, bucketAcl, service, sdk)] || (BUCKET_RESPONSE[_b] = client_1.createBucketV2.call(this, credential, Bucket, bucketAcl, (_a = admin.configBucket) === null || _a === void 0 ? void 0 : _a.create, service, sdk));
31
32
  if (!await response) {
32
33
  errorResponse(null);
33
34
  return;