@middy/util
Advanced tools
Comparing version 2.0.0-alpha.6 to 2.0.0-beta.0
16
index.js
@@ -40,10 +40,10 @@ "use strict"; | ||
const createClient = async (options, handler) => { | ||
const createClient = async (options, request) => { | ||
let awsClientCredentials = {}; // Role Credentials | ||
if (options.awsClientAssumeRole) { | ||
if (!handler) throw new Error('Handler required when assuming role'); | ||
if (!request) throw new Error('Request required when assuming role'); | ||
awsClientCredentials = await getInternal({ | ||
credentials: options.awsClientAssumeRole | ||
}, handler); | ||
}, request); | ||
} | ||
@@ -64,3 +64,3 @@ | ||
const getInternal = async (variables, handler) => { | ||
const getInternal = async (variables, request) => { | ||
if (!variables) return {}; | ||
@@ -71,3 +71,3 @@ let keys = []; | ||
if (variables === true) { | ||
keys = values = Object.keys(handler.internal); | ||
keys = values = Object.keys(request.internal); | ||
} else if (typeof variables === 'string') { | ||
@@ -90,3 +90,3 @@ keys = values = [variables]; | ||
const rootOptionKey = pathOptionKey.shift(); | ||
let valuePromise = handler.internal[rootOptionKey]; | ||
let valuePromise = request.internal[rootOptionKey]; | ||
@@ -115,3 +115,3 @@ if (typeof ((_valuePromise = valuePromise) === null || _valuePromise === void 0 ? void 0 : _valuePromise.then) !== 'function') { | ||
const processCache = (options, fetch = () => undefined, handler) => { | ||
const processCache = (options, fetch = () => undefined, request) => { | ||
if (options.cacheExpiry) { | ||
@@ -127,3 +127,3 @@ const cached = getCache(options.cacheKey); | ||
const value = fetch(handler); | ||
const value = fetch(request); | ||
const expiry = Date.now() + options.cacheExpiry; | ||
@@ -130,0 +130,0 @@ |
{ | ||
"name": "@middy/util", | ||
"version": "2.0.0-alpha.6", | ||
"version": "2.0.0-beta.0", | ||
"description": "🛵 The stylish Node.js middleware engine for AWS Lambda (util package)", | ||
@@ -20,4 +20,3 @@ "type": "commonjs", | ||
"test": "npm run test:typings && npm run test:unit", | ||
"test:unit": "ava", | ||
"test:typings": "typings-tester --config tsconfig.json index.d.ts" | ||
"test:unit": "ava" | ||
}, | ||
@@ -47,4 +46,11 @@ "license": "MIT", | ||
}, | ||
"devDependencies": { | ||
"@middy/core": "^2.0.0-beta.0", | ||
"@types/aws-lambda": "^8.10.3", | ||
"@types/node": "^14.0.0", | ||
"aws-sdk": "^2.804.0", | ||
"aws-xray-sdk": "^3.2.0" | ||
}, | ||
"homepage": "https://github.com/middyjs/middy#readme", | ||
"gitHead": "e6ab94a1f33ca215f63ee613bc9469ccd56caf21" | ||
"gitHead": "cf78e46ea77bf8feb3ae6061d8e8e9a02f8eeb2e" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10750
5
171
5