@middy/cloudwatch-metrics 7.0.2 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  <p>
6
6
  <a href="https://github.com/middyjs/middy/actions/workflows/test-unit.yml"><img src="https://github.com/middyjs/middy/actions/workflows/test-unit.yml/badge.svg" alt="GitHub Actions unit test status"></a>
7
7
  <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>
8
- <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>
8
+ <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>
9
9
  <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>
10
10
  <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>
11
11
  <br/>
package/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ // Copyright 2017 - 2026 will Farrell, Luciano Mammino, and Middy contributors.
2
+ // SPDX-License-Identifier: MIT
1
3
  import type middy from "@middy/core";
2
4
  import type { MetricsLogger } from "aws-embedded-metrics";
3
5
  import type { Context as LambdaContext } from "aws-lambda";
package/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ // Copyright 2017 - 2026 will Farrell, Luciano Mammino, and Middy contributors.
2
+ // SPDX-License-Identifier: MIT
1
3
  import awsEmbeddedMetrics from "aws-embedded-metrics";
2
4
 
3
5
  const defaults = {};
@@ -20,10 +22,10 @@ const cloudwatchMetricsMiddleware = (opts = {}) => {
20
22
  };
21
23
 
22
24
  const cloudwatchMetricsAfter = async (request) => {
23
- await request.context.metrics.flush();
25
+ await request.context.metrics?.flush();
24
26
  };
25
27
  const cloudwatchMetricsOnError = async (request) => {
26
- await cloudwatchMetricsAfter(request);
28
+ await request.context.metrics?.flush();
27
29
  };
28
30
 
29
31
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/cloudwatch-metrics",
3
- "version": "7.0.2",
3
+ "version": "7.1.0",
4
4
  "description": "Embedded CloudWatch metrics middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -11,6 +11,7 @@
11
11
  "access": "public"
12
12
  },
13
13
  "module": "./index.js",
14
+ "sideEffects": false,
14
15
  "exports": {
15
16
  ".": {
16
17
  "import": {