@pi-r/aws-lib 0.6.1 → 0.6.2

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/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getBucketKey = exports.formatDefaultRetention = exports.checkBucketCannedACL = exports.setDatabaseEndpoint = exports.setEndpoint = exports.getPrivatePolicy = exports.getBucketPublicReadPolicy = exports.getPublicReadPolicy = exports.isDatabaseDefined = exports.isProviderChainDefined = exports.isSharedCredentialsDefined = exports.isEnvDefined = exports.isAccessDefined = void 0;
4
- const types_1 = require("@e-mc/types");
5
4
  function isAccessDefined(credential) {
6
5
  return !!(credential.accessKeyId && credential.secretAccessKey);
7
6
  }
@@ -68,14 +67,14 @@ exports.getPrivatePolicy = getPrivatePolicy;
68
67
  function setEndpoint(config, instance, fallbackRegion) {
69
68
  let { region, endpoint } = config;
70
69
  if (!endpoint) {
71
- const location = (0, types_1.isString)(region) ? region : process.env.AWS_REGION || fallbackRegion;
70
+ const location = typeof region === 'string' && region || process.env.AWS_REGION || fallbackRegion;
72
71
  if (location) {
73
72
  endpoint = `https://${instance}.${location}.amazonaws.com`;
74
73
  config.endpoint = endpoint;
75
74
  }
76
75
  }
77
76
  if (!region) {
78
- region = ((0, types_1.isString)(endpoint) && new RegExp(`\\b${instance}\\.([^.]+)\\.`, 'i').exec(endpoint)?.[1] || process.env.AWS_REGION || fallbackRegion)?.toLowerCase();
77
+ region = (typeof endpoint === 'string' && new RegExp(`\\b${instance}\\.([^.]+)\\.`, 'i').exec(endpoint)?.[1] || process.env.AWS_REGION || fallbackRegion)?.toLowerCase();
79
78
  if (region && region !== "us-east-1" /* STRINGS.REGION */) {
80
79
  config.region = region;
81
80
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/aws-lib",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "AWS cloud utility functions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "types/index.d.ts",
@@ -20,7 +20,5 @@
20
20
  "author": "An Pham <anpham6@gmail.com>",
21
21
  "license": "MIT",
22
22
  "homepage": "https://github.com/anpham6/pi-r#readme",
23
- "dependencies": {
24
- "@e-mc/types": "^0.8.3"
25
- }
23
+ "dependencies": {}
26
24
  }
package/types/index.d.ts CHANGED
@@ -97,7 +97,7 @@ declare namespace AWS {
97
97
  function getPrivatePolicy(bucket: string): string;
98
98
  function setDatabaseEndpoint(config: EndpointConfig, fallbackRegion?: string): void;
99
99
  function setEndpoint(config: EndpointConfig, instance: string, fallbackRegion?: string): void;
100
- function checkBucketCannedACL(value: unknown): Undef<BucketCannedACL>;
100
+ function checkBucketCannedACL(value: unknown): BucketCannedACL | undefined;
101
101
  function formatDefaultRetention(retention: DefaultRetention): string;
102
102
  function getBucketKey(credential: unknown, bucket: string, acl: string | undefined, service: string, sdk: string): string;
103
103
  }