Skip to content
Merged

7.1.5 #1591

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@middy/github-workflows",
"version": "7.1.4",
"version": "7.1.5",
"private": true,
"engines": {
"node": ">=24.0"
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/test-sast.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: "Test (sast)"

name: Tests (sast)
on:
pull_request:
schedule:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/website-cloudflare-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
push:
paths:
- "websites/*"
- "websites/**"
branches:
- main

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

## Sponsors

<a href="https://fourtheorem.com"><img alt="fourTheorem" src="https://raw.githubusercontent.com/middyjs/middy/main/website/static/img/logo/fourtheorem.svg" style="max-width:50%" width="380"/></a>
<a href="https://github.com/aws"><img alt="Amazon Web Services Free and Open Source Software Fund (AWS FOSS Fund)" src="https://raw.githubusercontent.com/middyjs/middy/main/website/static/img/logo/amazon-web-services.svg" style="max-width:50%" width="380"/></a>
<a href="https://fourtheorem.com"><img alt="fourTheorem" src="https://raw.githubusercontent.com/middyjs/middy/main/websites/middy.js.org/static/img/logo/fourtheorem.svg" style="max-width:50%" width="380"/></a>
<a href="https://github.com/aws"><img alt="Amazon Web Services Free and Open Source Software Fund (AWS FOSS Fund)" src="https://raw.githubusercontent.com/middyjs/middy/main/websites/middy.js.org/static/img/logo/amazon-web-services.svg" style="max-width:50%" width="380"/></a>

## License

Expand Down
1,906 changes: 1,205 additions & 701 deletions package-lock.json

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@middy/monorepo",
"version": "7.1.4",
"version": "7.1.5",
"description": "🛵 The stylish Node.js middleware engine for AWS Lambda",
"private": true,
"type": "module",
Expand All @@ -10,7 +10,6 @@
"engineStrict": true,
"scripts": {
"prepare": "husky",
"preinstall": "npm link --workspaces",
"git:pre-commit": "npm run git:lint-staged && npm run git:test-staged",
"git:commit-msg": "commitlint --config commitlint.config.cjs --edit",
"git:lint-staged": "npm run test:lint",
Expand All @@ -30,7 +29,7 @@
"test:perf": "node --test ./**/*.perf.js",
"test:dast": "npm run test:dast:fuzz",
"test:dast:fuzz": "node --test --experimental-test-module-mocks ./**/*.fuzz.js",
"test:packages:unit": "node --test ./packages/**/*.test.js --test-force-exit --experimental-test-module-mocks --experimental-test-coverage --test-coverage-lines=99 --test-coverage-branches=98 --test-coverage-functions=99",
"test:packages:unit": "node --test ./packages/**/*.test.js --test-force-exit --experimental-test-module-mocks --experimental-test-coverage --test-coverage-lines=100 --test-coverage-branches=100 --test-coverage-functions=100",
"test:packages:perf": "node --test ./packages/**/*.perf.js",
"test:packages:fuzz": "node --test ./packages/**/*.fuzz.js --experimental-test-module-mocks",
"test:llrt": "cd llrt && npm test",
Expand All @@ -42,7 +41,7 @@
"audit": "npm audit fix --workspaces",
"release:license:add": "license-check-and-add add -f license.json",
"release:license:remove": "license-check-and-add remove -f license.json",
"release:sync": "npm version $npm_package_version --workspaces && find ./packages -name \"package.json\" -exec sed -i '' -E \"s#\\\"@middy/(.*)\\\": ([^,]*)#\\\"@middy/\\1\\\": $(npm pkg get version)#g\" {} \\; && npm run rm:node_modules && npm link --workspaces && npm install && npm run lint",
"release:sync": "npm version $npm_package_version --workspaces; find ./packages -name \"package.json\" -exec sed -i '' -E \"s#\\\"@middy/(.*)\\\": ([^,]*)#\\\"@middy/\\1\\\": $(npm pkg get version)#g\" {} \\; && npm run rm:node_modules && npm link --workspaces && npm install && npm run lint",
"release:tag": "git tag $npm_package_version"
},
"repository": {
Expand Down Expand Up @@ -80,12 +79,14 @@
},
"overrides": {
"@sveltejs/kit": {
".": "file:/Users/willfarrell/Development/github/kit/packages/kit",
"cookie": "0.7.2"
"cookie": "^0.7.2",
"devalue": "^5.6.4"
},
"svelte": {
"devalue": "^5.6.4"
},
"license-check-and-add": {
"globby": "14.1.0",
"minimatch": "10.2.2"
"minimatch": "^10.2.4"
}
},
"devEngines": {
Expand Down
6 changes: 3 additions & 3 deletions packages/appconfig/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@middy/appconfig",
"version": "7.1.4",
"version": "7.1.5",
"description": "AppConfig middleware for the middy framework",
"type": "module",
"engines": {
Expand Down Expand Up @@ -71,11 +71,11 @@
}
},
"dependencies": {
"@middy/util": "7.1.4"
"@middy/util": "7.1.5"
},
"devDependencies": {
"@aws-sdk/client-appconfigdata": "^3.0.0",
"@middy/core": "7.1.4",
"@middy/core": "7.1.5",
"@types/aws-lambda": "^8.0.0",
"@types/node": "^22.0.0",
"aws-xray-sdk": "^3.3.3"
Expand Down
4 changes: 2 additions & 2 deletions packages/cloudformation-response/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@middy/cloudformation-response",
"version": "7.1.4",
"version": "7.1.5",
"description": "CloudFormation Custom Response event response handling for the middy framework",
"type": "module",
"engines": {
Expand Down Expand Up @@ -64,7 +64,7 @@
"url": "https://github.com/sponsors/willfarrell"
},
"devDependencies": {
"@middy/core": "7.1.4",
"@middy/core": "7.1.5",
"@types/aws-lambda": "^8.0.0",
"@types/node": "^22.0.0"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/cloudformation-router/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@middy/cloudformation-router",
"version": "7.1.4",
"version": "7.1.5",
"description": "CloudFormation Custom Response event router for the middy framework",
"type": "module",
"engines": {
Expand Down Expand Up @@ -65,7 +65,7 @@
"url": "https://github.com/sponsors/willfarrell"
},
"devDependencies": {
"@middy/core": "7.1.4",
"@middy/core": "7.1.5",
"@types/aws-lambda": "^8.0.0",
"@types/node": "^22.0.0"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/cloudwatch-metrics/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@middy/cloudwatch-metrics",
"version": "7.1.4",
"version": "7.1.5",
"description": "Embedded CloudWatch metrics middleware for the middy framework",
"type": "module",
"engines": {
Expand Down Expand Up @@ -71,7 +71,7 @@
"aws-embedded-metrics": "4.2.1"
},
"devDependencies": {
"@middy/core": "7.1.4",
"@middy/core": "7.1.5",
"@types/aws-lambda": "^8.0.0",
"@types/node": "^22.0.0"
}
Expand Down
28 changes: 28 additions & 0 deletions packages/core/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,34 @@ test("Should not invoke timeoutEarlyResponse on success", async (t) => {
ok(!timeoutCalled);
});

test("Should handle handler without timeout (no getRemainingTimeInMillis)", async (t) => {
const handler = middy(() => {
return "response";
});

const response = await handler(defaultEvent, {});
strictEqual(response, "response");
});

test("Should use lambdaContext.getRemainingTimeInMillis as fallback", async (t) => {
const plugin = {
timeoutEarlyInMillis: 1,
timeoutEarlyResponse: () => true,
};
const context = {
lambdaContext: {
getRemainingTimeInMillis: () => 100,
},
};

const handler = middy(async () => {
return "response";
}, plugin);

const response = await handler(defaultEvent, context);
strictEqual(response, "response");
});

test("Should use default timeoutEarlyResponse when timeout expires", async (t) => {
t.mock.timers.reset();
const context = {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@middy/core",
"version": "7.1.4",
"version": "7.1.5",
"description": "🛵 The stylish Node.js middleware engine for AWS Lambda (core package)",
"type": "module",
"engines": {
Expand Down Expand Up @@ -97,7 +97,7 @@
"url": "https://github.com/sponsors/willfarrell"
},
"dependencies": {
"@middy/util": "7.1.4"
"@middy/util": "7.1.5"
},
"peerDependencies": {
"@aws/durable-execution-sdk-js": "^1.0.0"
Expand Down
6 changes: 3 additions & 3 deletions packages/do-not-wait-for-empty-event-loop/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@middy/do-not-wait-for-empty-event-loop",
"version": "7.1.4",
"version": "7.1.5",
"description": "Middleware for the middy framework that allows to easily disable the wait for empty event loop in a Lambda function",
"type": "module",
"engines": {
Expand Down Expand Up @@ -63,10 +63,10 @@
"url": "https://github.com/sponsors/willfarrell"
},
"dependencies": {
"@middy/util": "7.1.4"
"@middy/util": "7.1.5"
},
"devDependencies": {
"@middy/core": "7.1.4",
"@middy/core": "7.1.5",
"@types/aws-lambda": "^8.0.0",
"@types/node": "^22.0.0"
}
Expand Down
6 changes: 3 additions & 3 deletions packages/dynamodb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@middy/dynamodb",
"version": "7.1.4",
"version": "7.1.5",
"description": "DynamoDB middleware for the middy framework",
"type": "module",
"engines": {
Expand Down Expand Up @@ -75,12 +75,12 @@
}
},
"dependencies": {
"@middy/util": "7.1.4"
"@middy/util": "7.1.5"
},
"devDependencies": {
"@aws-sdk/client-dynamodb": "^3.0.0",
"@aws-sdk/util-dynamodb": "^3.0.0",
"@middy/core": "7.1.4",
"@middy/core": "7.1.5",
"@types/aws-lambda": "^8.0.0",
"@types/node": "^22.0.0",
"aws-xray-sdk": "^3.3.3"
Expand Down
4 changes: 2 additions & 2 deletions packages/error-logger/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@middy/error-logger",
"version": "7.1.4",
"version": "7.1.5",
"description": "Error logger middleware for the middy framework",
"type": "module",
"engines": {
Expand Down Expand Up @@ -64,7 +64,7 @@
"url": "https://github.com/sponsors/willfarrell"
},
"devDependencies": {
"@middy/core": "7.1.4",
"@middy/core": "7.1.5",
"@types/aws-lambda": "^8.0.0",
"@types/node": "^22.0.0"
}
Expand Down
6 changes: 3 additions & 3 deletions packages/event-normalizer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@middy/event-normalizer",
"version": "7.1.4",
"version": "7.1.5",
"description": "Parse and normalize AWS events middleware for the middy framework",
"type": "module",
"engines": {
Expand Down Expand Up @@ -67,10 +67,10 @@
"url": "https://github.com/sponsors/willfarrell"
},
"dependencies": {
"@middy/util": "7.1.4"
"@middy/util": "7.1.5"
},
"devDependencies": {
"@middy/core": "7.1.4",
"@middy/core": "7.1.5",
"@serverless/event-mocks": "^1.1.1",
"@types/aws-lambda": "^8.0.0",
"@types/node": "^22.0.0"
Expand Down
46 changes: 46 additions & 0 deletions packages/http-content-encoding/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,27 @@ test("It should skip override encodings not in preferredEncodings", async (t) =>
});
});

test("It should encode Buffer body", async (t) => {
const body = Buffer.from(compressibleBody);
const handler = middy((event, context) => ({ statusCode: 200, body })).use(
httpContentEncoding(),
);

const event = { headers: {} };

const response = await handler(event, {
...defaultContext,
preferredEncoding: "gzip",
});

deepStrictEqual(response, {
statusCode: 200,
body: gzipSync(body).toString("base64"),
headers: { "Content-Encoding": "gzip", Vary: "Accept-Encoding" },
isBase64Encoded: true,
});
});

test("It should not encode when compressed body is larger than original", async (t) => {
// Very short body - compression overhead makes it larger
const body = "x";
Expand Down Expand Up @@ -469,6 +490,31 @@ test("It should append no-transform when event has Cache-Control: no-transform a
});
});

test("It should handle lowercase cache-control in event headers", async (t) => {
const handler = middy((event, context) => ({
statusCode: 200,
body: "body",
}));
handler.use(httpContentEncoding());

const event = {
headers: {
"cache-control": "no-transform",
},
};

const response = await handler(event, {
...defaultContext,
preferredEncoding: "br",
});

deepStrictEqual(response, {
statusCode: 200,
headers: { "Cache-Control": "no-transform" },
body: "body",
});
});

test("It should handle lowercase cache-control header when appending no-transform", async (t) => {
const handler = middy((event, context) => ({
statusCode: 200,
Expand Down
6 changes: 3 additions & 3 deletions packages/http-content-encoding/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@middy/http-content-encoding",
"version": "7.1.4",
"version": "7.1.5",
"description": "HTTP content encoding middleware for the middy framework",
"type": "module",
"engines": {
Expand Down Expand Up @@ -68,11 +68,11 @@
"url": "https://github.com/sponsors/willfarrell"
},
"dependencies": {
"@middy/util": "7.1.4"
"@middy/util": "7.1.5"
},
"devDependencies": {
"@datastream/core": "0.0.42",
"@middy/core": "7.1.4",
"@middy/core": "7.1.5",
"@types/aws-lambda": "^8.0.0",
"@types/node": "^22.0.0"
}
Expand Down
6 changes: 3 additions & 3 deletions packages/http-content-negotiation/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@middy/http-content-negotiation",
"version": "7.1.4",
"version": "7.1.5",
"description": "HTTP content negotiation middleware for the middy framework",
"type": "module",
"engines": {
Expand Down Expand Up @@ -65,11 +65,11 @@
"url": "https://github.com/sponsors/willfarrell"
},
"dependencies": {
"@middy/util": "7.1.4",
"@middy/util": "7.1.5",
"negotiator": "1.0.0"
},
"devDependencies": {
"@middy/core": "7.1.4",
"@middy/core": "7.1.5",
"@types/aws-lambda": "^8.0.0",
"@types/node": "^22.0.0"
}
Expand Down
Loading
Loading