@middy/cloudwatch-metrics 2.5.3 → 3.0.0-alpha.2

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2017-2021 Luciano Mammino, will Farrell and the [Middy team](https://github.com/middyjs/middy/graphs/contributors)
3
+ Copyright (c) 2017-2022 Luciano Mammino, will Farrell and the [Middy team](https://github.com/middyjs/middy/graphs/contributors)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -58,8 +58,8 @@ npm install --save @middy/cloudwatch-metrics
58
58
  ## Sample usage
59
59
 
60
60
  ```javascript
61
- const middy = require('@middy/core')
62
- const cloudwatchMetrics = require('@middy/cloudwatch-metrics')
61
+ import middy from '@middy/core'
62
+ import cloudwatchMetrics from '@middy/cloudwatch-metrics'
63
63
 
64
64
  const handler = middy((event, context) => {
65
65
  context.metrics.putMetric("ProcessingLatency", 100, "Milliseconds");
package/index.js CHANGED
@@ -1,6 +1,4 @@
1
- "use strict";
2
-
3
- const awsEmbeddedMetrics = require('aws-embedded-metrics');
1
+ import awsEmbeddedMetrics from 'aws-embedded-metrics';
4
2
 
5
3
  const cloudwatchMetricsMiddleware = (opts = {}) => {
6
4
  const defaults = {};
@@ -9,12 +7,11 @@ const cloudwatchMetricsMiddleware = (opts = {}) => {
9
7
  };
10
8
 
11
9
  const cloudwatchMetricsBefore = request => {
12
- const metrics = awsEmbeddedMetrics.createMetricsLogger(); // If not set, defaults to aws-embedded-metrics
10
+ const metrics = awsEmbeddedMetrics.createMetricsLogger();
13
11
 
14
12
  if (options.namespace) {
15
13
  metrics.setNamespace(options.namespace);
16
- } // If not set, defaults to ServiceName, ServiceType and LogGroupName
17
-
14
+ }
18
15
 
19
16
  if (options.dimensions) {
20
17
  metrics.setDimensions(...options.dimensions);
@@ -35,4 +32,4 @@ const cloudwatchMetricsMiddleware = (opts = {}) => {
35
32
  };
36
33
  };
37
34
 
38
- module.exports = cloudwatchMetricsMiddleware;
35
+ export default cloudwatchMetricsMiddleware;
package/package.json CHANGED
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "@middy/cloudwatch-metrics",
3
- "version": "2.5.3",
3
+ "version": "3.0.0-alpha.2",
4
4
  "description": "Embedded CloudWatch metrics middleware for the middy framework",
5
- "type": "commonjs",
5
+ "type": "module",
6
6
  "engines": {
7
- "node": ">=12"
7
+ "node": ">=14"
8
8
  },
9
9
  "engineStrict": true,
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
13
- "main": "index.js",
13
+ "exports": "./index.js",
14
14
  "types": "index.d.ts",
15
15
  "files": [
16
+ "index.js",
16
17
  "index.d.ts"
17
18
  ],
18
19
  "scripts": {
@@ -52,7 +53,7 @@
52
53
  "aws-embedded-metrics": "2.0.4"
53
54
  },
54
55
  "devDependencies": {
55
- "@middy/core": "^2.5.3"
56
+ "@middy/core": "^3.0.0-alpha.2"
56
57
  },
57
- "gitHead": "690884d43b9cd632aeca9a5eba1612160b987cd4"
58
+ "gitHead": "de30419273ecbff08f367f47c7e320ec981cf145"
58
59
  }