diff --git a/dist/cjs/index.js b/dist/cjs/index.js index 2624641..254c8b3 100644 --- a/dist/cjs/index.js +++ b/dist/cjs/index.js @@ -62,12 +62,14 @@ class CustomMetrics { if (options.client) { this.client = options.client; } - else if (options.creds) { - let credentials = options.creds; - let params = { - credentials, - region: credentials.region || options.region, - }; + else { + let params = {}; + if (options.creds) { + params.credentials = options.creds; + } + if (options.region) { + params.region = params.credentials.region || options.region; + } this.client = new client_dynamodb_1.DynamoDBClient(params); } if (!options.table && !options.tableName) { diff --git a/dist/mjs/index.js b/dist/mjs/index.js index 25c989c..af4e33b 100644 --- a/dist/mjs/index.js +++ b/dist/mjs/index.js @@ -70,12 +70,14 @@ export class CustomMetrics { if (options.client) { this.client = options.client; } - else if (options.creds) { - let credentials = options.creds; - let params = { - credentials, - region: credentials.region || options.region, - }; + else { + let params = {}; + if (options.creds) { + params.credentials = options.creds; + } + if (options.region) { + params.region = params.credentials.region || options.region; + } this.client = new DynamoDBClient(params); } if (!options.table && !options.tableName) { diff --git a/package-lock.json b/package-lock.json index 0da9802..f23ff38 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "custom-metrics", - "version": "0.7.6", + "version": "0.8.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "custom-metrics", - "version": "0.7.6", + "version": "0.8.0", "license": "MIT", "dependencies": { "@aws-sdk/client-dynamodb": "^3.405.0", diff --git a/package.json b/package.json index 5c429b7..d8c78e0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "custom-metrics", - "version": "0.7.6", + "version": "0.8.0", "description": "Custom metrics for AWS", "main": "dist/cjs/index.js", "module": "dist/mjs/index.js",