Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@middy/util

Package Overview
Dependencies
Maintainers
3
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@middy/util - npm Package Compare versions

Comparing version 5.0.2 to 5.0.3

15

index.js
export const createPrefetchClient = (options)=>{
const { awsClientOptions } = options;
const client = new options.AwsClient(awsClientOptions);
// AWS XRay
if (options.awsClientCapture && options.disablePrefetch) {

@@ -14,3 +13,2 @@ return options.awsClientCapture(client);

let awsClientCredentials = {};
// Role Credentials
if (options.awsClientAssumeRole) {

@@ -40,3 +38,2 @@ if (!request) {

};
// Internal Context
export const getInternal = async (variables, request)=>{

@@ -60,3 +57,2 @@ if (!variables || !request) return {};

for (const internalKey of values){
// 'internal.key.sub_value' -> { [key]: internal.key.sub_value }
const pathOptionKey = internalKey.split('.');

@@ -70,4 +66,2 @@ const rootOptionKey = pathOptionKey.shift();

}
// ensure promise has resolved by the time it's needed
// If one of the promises throws it will bubble up to @middy/core
values = await Promise.allSettled(promises);

@@ -94,5 +88,3 @@ const errors = values.filter((res)=>res.status === 'rejected').map((res)=>res.reason);

};
// fetch Cache
const cache = {} // key: { value:{fetchKey:Promise}, expiry }
;
const cache = {};
export const processCache = (options, fetch = ()=>undefined, request)=>{

@@ -124,3 +116,2 @@ let { cacheKey, cacheKeyExpiry, cacheExpiry } = options;

const now = Date.now();
// secrets-manager overrides to unix timestamp
const expiry = cacheExpiry > 86400000 ? cacheExpiry : now + cacheExpiry;

@@ -145,3 +136,2 @@ const duration = cacheExpiry > 86400000 ? cacheExpiry - now : cacheExpiry;

};
// Used to remove parts of a cache
export const modifyCache = (cacheKey, value)=>{

@@ -207,4 +197,3 @@ if (!cache[cacheKey]) return;

this.name = name.substr(-5) !== 'Error' ? name + 'Error' : name;
this.status = this.statusCode = code // setting `status` for backwards compatibility w/ `http-errors`
;
this.status = this.statusCode = code;
this.expose = options.expose ?? code < 500;

@@ -211,0 +200,0 @@ }

6

package.json
{
"name": "@middy/util",
"version": "5.0.2",
"version": "5.0.3",
"description": "🛵 The stylish Node.js middleware engine for AWS Lambda (util package)",

@@ -58,3 +58,3 @@ "type": "module",

"@aws-sdk/client-ssm": "^3.0.0",
"@middy/core": "5.0.2",
"@middy/core": "5.0.3",
"@types/aws-lambda": "^8.10.76",

@@ -69,3 +69,3 @@ "@types/node": "^20.0.0",

},
"gitHead": "6d17e155237022f2a0abd095ac7cd99ebfc7fc71"
"gitHead": "87660575a7ac2b52e4153c407a4c63c9449dcd0d"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc