You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@middy/util

Package Overview
Dependencies
Maintainers
3
Versions
176
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
7.0.2
to
7.0.3
+2
-0
index.d.ts

@@ -0,1 +1,3 @@

// Copyright 2017 - 2026 will Farrell, Luciano Mammino, and Middy contributors.
// SPDX-License-Identifier: MIT
import type middy from "@middy/core";

@@ -2,0 +4,0 @@ import type { Context as LambdaContext } from "aws-lambda";

+11
-8

@@ -0,1 +1,3 @@

// Copyright 2017 - 2026 will Farrell, Luciano Mammino, and Middy contributors.
// SPDX-License-Identifier: MIT
export const createPrefetchClient = (options) => {

@@ -106,7 +108,7 @@ const { awsClientOptions } = options;

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

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

if (cached.modified) {
const value = middlewareFetch(request, cached.value);
const value = middlewareFetch(middlewareFetchRequest, cached.value);
Object.assign(cached.value, value);

@@ -131,3 +133,3 @@ cache[cacheKey] = { value: cached.value, expiry: cached.expiry };

}
const value = middlewareFetch(request);
const value = middlewareFetch(middlewareFetchRequest);
// secrets-manager can override to unix timestamp

@@ -140,3 +142,4 @@ const expiry = cacheExpiry > 86400000 ? cacheExpiry : now + cacheExpiry;

? setTimeout(
() => processCache(options, middlewareFetch, request),
() =>
processCache(options, middlewareFetch, middlewareFetchRequest),
duration,

@@ -210,3 +213,3 @@ )

export const executionContext = (key, context) => {
export const executionContext = (request, key, context) => {
if (isExecutionModeDurable(context)) {

@@ -218,3 +221,3 @@ return request.context.executionContext[key];

export const lambdaContext = (key, context) => {
export const lambdaContext = (request, key, context) => {
if (isExecutionModeDurable(context)) {

@@ -275,3 +278,3 @@ return request.context.lambdaContext[key];

const name = httpErrorCodes[code].replace(createErrorRegexp, "");
this.name = name.substr(-5) !== "Error" ? `${name}Error` : name;
this.name = !name.endsWith("Error") ? `${name}Error` : name;

@@ -278,0 +281,0 @@ this.status = this.statusCode = code; // setting `status` for backwards compatibility w/ `http-errors`

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

@@ -14,2 +14,3 @@ "type": "module",

"module": "./index.js",
"sideEffects": false,
"exports": {

@@ -63,3 +64,3 @@ ".": {

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

@@ -66,0 +67,0 @@ "@types/node": "^22.0.0",

@@ -8,3 +8,3 @@ <div align="center">

<a href="https://github.com/middyjs/middy/actions/workflows/test-dast.yml"><img src="https://github.com/middyjs/middy/actions/workflows/test-dast.yml/badge.svg" alt="GitHub Actions dast test status"></a>
<a href="https://github.com/middyjs/middy/actions/workflows/test-perf.yml"><img src="https://github.com/middyjs/middy/actions/workflows/test-pref.yml/badge.svg" alt="GitHub Actions perf test status"></a>
<a href="https://github.com/middyjs/middy/actions/workflows/test-perf.yml"><img src="https://github.com/middyjs/middy/actions/workflows/test-perf.yml/badge.svg" alt="GitHub Actions perf test status"></a>
<a href="https://github.com/middyjs/middy/actions/workflows/test-sast.yml"><img src="https://github.com/middyjs/middy/actions/workflows/test-sast.yml/badge.svg" alt="GitHub Actions SAST test status"></a>

@@ -36,3 +36,3 @@ <a href="https://github.com/middyjs/middy/actions/workflows/test-lint.yml"><img src="https://github.com/middyjs/middy/actions/workflows/test-lint.yml/badge.svg" alt="GitHub Actions lint test status"></a>

Licensed under [MIT License](LICENSE). Copyright (c) 2017-2025 [Luciano Mammino](https://github.com/lmammino), [will Farrell](https://github.com/willfarrell), and the [Middy team](https://github.com/middyjs/middy/graphs/contributors).
Licensed under [MIT License](LICENSE). Copyright (c) 2017-2026 [will Farrell](https://github.com/willfarrell), [Luciano Mammino](https://github.com/lmammino), and [Middy contributors](https://github.com/middyjs/middy/graphs/contributors).

@@ -39,0 +39,0 @@ <a href="https://app.fossa.io/projects/git%2Bgithub.com%2Fmiddyjs%2Fmiddy?ref=badge_large">

@@ -0,1 +1,3 @@

// Copyright 2017 - 2026 will Farrell, Luciano Mammino, and Middy contributors.
// SPDX-License-Identifier: MIT
type Digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";

@@ -2,0 +4,0 @@ type LetterLower =