diff --git a/docs/core/logger.md b/docs/core/logger.md index 316a526efd..2c42ebcef3 100644 --- a/docs/core/logger.md +++ b/docs/core/logger.md @@ -119,10 +119,8 @@ Key | Example === "Middy Middleware" - !!! note - Middy comes bundled with Logger, so you can just import it when using the middleware. - !!! tip "Using Middy for the first time?" + You can install Middy by running `npm i @middy/core`. Learn more about [its usage and lifecycle in the official Middy documentation](https://github.com/middyjs/middy#usage){target="_blank"}. ```typescript hl_lines="1-2 10-11" diff --git a/docs/core/metrics.md b/docs/core/metrics.md index 14ccd103fc..a1b18d887d 100644 --- a/docs/core/metrics.md +++ b/docs/core/metrics.md @@ -208,10 +208,8 @@ You can add default dimensions to your metrics by passing them as parameters in === "Middy middleware" - !!! note - Middy comes bundled with Metrics, so you can just import it when using the middleware. - !!! tip "Using Middy for the first time?" + You can install Middy by running `npm i @middy/core`. Learn more about [its usage and lifecycle in the official Middy documentation](https://github.com/middyjs/middy#usage){target="_blank"}. ```typescript hl_lines="1-2 11 13" diff --git a/docs/core/tracer.md b/docs/core/tracer.md index 7cb4b1a983..b5a3baf386 100644 --- a/docs/core/tracer.md +++ b/docs/core/tracer.md @@ -119,10 +119,8 @@ You can quickly start by importing the `Tracer` class, initialize it outside the === "Middy Middleware" - !!! note - Middy comes bundled with Tracer, so you can just import it when using the middleware. - !!! tip "Using Middy for the first time?" + You can install Middy by running `npm i @middy/core`. Learn more about [its usage and lifecycle in the official Middy documentation](https://github.com/middyjs/middy#usage){target="_blank"}. ```typescript hl_lines="1-2 11 13" diff --git a/examples/cdk/package-lock.json b/examples/cdk/package-lock.json index 663be7a4dc..634a65ef44 100644 --- a/examples/cdk/package-lock.json +++ b/examples/cdk/package-lock.json @@ -13,10 +13,7 @@ "@aws-lambda-powertools/metrics": "^0.4.0", "@aws-lambda-powertools/tracer": "^0.4.0", "@aws-sdk/client-sts": "^3.43.0", - "@middy/core": "^2.5.3", - "@middy/http-error-handler": "^2.5.3", - "@middy/http-json-body-parser": "^2.5.3", - "@middy/validator": "^2.5.3", + "@middy/core": "^2.5.6", "@types/aws-lambda": "^8.10.86", "aws-cdk-lib": "2.0.0", "aws-sdk": "^2.1058.0", @@ -1799,54 +1796,9 @@ } }, "node_modules/@middy/core": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/@middy/core/-/core-2.5.4.tgz", - "integrity": "sha512-WQFUFhCG0P2rmNDBX8x5RiREfSUnMhq77QyrwIZg2/gLUhuOZa8TPFFKzIFBz+blvw9Ep41LRrWdV/gzYwMuww==", - "engines": { - "node": ">=12" - } - }, - "node_modules/@middy/http-error-handler": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/@middy/http-error-handler/-/http-error-handler-2.5.4.tgz", - "integrity": "sha512-sA+dP5e9pcVwfPN1jvkHGsQG7BpVHp9zRp+EUY+tJjy+kavjTfx7s7RMDePYrztlYpi0dFtEzKsrWGbKy9+AKA==", - "dependencies": { - "@middy/util": "^2.5.4" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@middy/http-json-body-parser": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/@middy/http-json-body-parser/-/http-json-body-parser-2.5.4.tgz", - "integrity": "sha512-R7OzTu3jfVWACImVJzrGrJLvTMlAZIpWZ3kpKLOq+yo390qEoHFS7eLzFVJlMbULsGkTF5SDle08m7+rpa95QQ==", - "dependencies": { - "@middy/util": "^2.5.4" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@middy/util": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/@middy/util/-/util-2.5.4.tgz", - "integrity": "sha512-/715LFKuz3EAao+e+4eWjO0fpJbtFjXAAA6nVcShnFKaU/s+P5qqRD9X8+iU+R1q7uFidd4eWnDhmpqJ43ZY8A==", - "engines": { - "node": ">=12" - } - }, - "node_modules/@middy/validator": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/@middy/validator/-/validator-2.5.4.tgz", - "integrity": "sha512-dhi2/4h2UdFyph3M0clXkL/w1wBXWm4JPHEB2Fx7xT0p1YhTVZYMgGM9nL3w+eKCkVDdudC2YQHVO/T0MihV5g==", - "dependencies": { - "@middy/util": "^2.5.4", - "ajv": "8.6.3", - "ajv-formats": "2.1.1", - "ajv-formats-draft2019": "1.6.1", - "ajv-i18n": "4.1.0" - }, + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/@middy/core/-/core-2.5.6.tgz", + "integrity": "sha512-uOKeXqqKK8NjOFXJCtaQl3BF9zTd6R2N/1nwvAJ3MGfXSBBiBoRxXE+NhwHd2DFzf0ruzk3lHel2XMOQu7PXIQ==", "engines": { "node": ">=12" } @@ -2066,59 +2018,6 @@ "node": ">= 6.0.0" } }, - "node_modules/ajv": { - "version": "8.6.3", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.6.3.tgz", - "integrity": "sha512-SMJOdDP6LqTkD0Uq8qLi+gMwSt0imXLSV080qFVwJCpH9U6Mb+SUGHAXM0KNbcBPguytWyvFxcHgMLe2D2XSpw==", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/ajv-formats": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", - "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", - "dependencies": { - "ajv": "^8.0.0" - }, - "peerDependencies": { - "ajv": "^8.0.0" - }, - "peerDependenciesMeta": { - "ajv": { - "optional": true - } - } - }, - "node_modules/ajv-formats-draft2019": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/ajv-formats-draft2019/-/ajv-formats-draft2019-1.6.1.tgz", - "integrity": "sha512-JQPvavpkWDvIsBp2Z33UkYCtXCSpW4HD3tAZ+oL4iEFOk9obQZffx0yANwECt6vzr6ET+7HN5czRyqXbnq/u0Q==", - "dependencies": { - "punycode": "^2.1.1", - "schemes": "^1.4.0", - "smtp-address-parser": "^1.0.3", - "uri-js": "^4.4.1" - }, - "peerDependencies": { - "ajv": "*" - } - }, - "node_modules/ajv-i18n": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ajv-i18n/-/ajv-i18n-4.1.0.tgz", - "integrity": "sha512-GmRKPqWbZc+wn77IVPixJ336h9opyWSd4iTEGv825jxbccN1JKVEG/JnJX9wxYa1/yPmT/4v/YZN3ymmHwY4ag==", - "peerDependencies": { - "ajv": "^8.0.0-beta.0" - } - }, "node_modules/ansi-escapes": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", @@ -4626,11 +4525,6 @@ "node": ">= 0.8" } }, - "node_modules/commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" - }, "node_modules/component-emitter": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", @@ -4832,11 +4726,6 @@ "node": ">= 10.14.2" } }, - "node_modules/discontinuous-range": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/discontinuous-range/-/discontinuous-range-1.0.0.tgz", - "integrity": "sha1-44Mx8IRLukm5qctxx3FYWqsbxlo=" - }, "node_modules/domexception": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/domexception/-/domexception-2.0.1.tgz", @@ -5443,11 +5332,6 @@ "node": ">= 10.14.2" } }, - "node_modules/extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, "node_modules/extend-shallow": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", @@ -5513,11 +5397,6 @@ "node": ">=0.10.0" } }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" - }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -6858,11 +6737,6 @@ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true }, - "node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" - }, "node_modules/json5": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", @@ -7102,11 +6976,6 @@ "node": ">=10" } }, - "node_modules/moo": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/moo/-/moo-0.5.1.tgz", - "integrity": "sha512-I1mnb5xn4fO80BH9BLcF0yLypy2UKl+Cb01Fu0hJRkJjlCRtxZMWkTdAtDd5ZqCOxtCkhmRwyI57vWT+1iZ67w==" - }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -7141,27 +7010,6 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, - "node_modules/nearley": { - "version": "2.20.1", - "resolved": "https://registry.npmjs.org/nearley/-/nearley-2.20.1.tgz", - "integrity": "sha512-+Mc8UaAebFzgV+KpI5n7DasuuQCHA89dmwm7JXw3TV43ukfNQ9DnBH3Mdb2g/I4Fdxc26pwimBWvjIw0UAILSQ==", - "dependencies": { - "commander": "^2.19.0", - "moo": "^0.5.0", - "railroad-diagrams": "^1.0.0", - "randexp": "0.4.6" - }, - "bin": { - "nearley-railroad": "bin/nearley-railroad.js", - "nearley-test": "bin/nearley-test.js", - "nearley-unparse": "bin/nearley-unparse.js", - "nearleyc": "bin/nearleyc.js" - }, - "funding": { - "type": "individual", - "url": "https://nearley.js.org/#give-to-nearley" - } - }, "node_modules/nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", @@ -7637,6 +7485,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true, "engines": { "node": ">=6" } @@ -7650,23 +7499,6 @@ "node": ">=0.4.x" } }, - "node_modules/railroad-diagrams": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz", - "integrity": "sha1-635iZ1SN3t+4mcG5Dlc3RVnN234=" - }, - "node_modules/randexp": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/randexp/-/randexp-0.4.6.tgz", - "integrity": "sha512-80WNmd9DA0tmZrw9qQa62GPPWfuXJknrmVmLcxvq4uZBdYqb1wYoKTmnlGUchvVWe0XiLupYkBoXVOxz3C8DYQ==", - "dependencies": { - "discontinuous-range": "1.0.0", - "ret": "~0.1.10" - }, - "engines": { - "node": ">=0.12" - } - }, "node_modules/react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", @@ -7769,14 +7601,6 @@ "node": ">=0.10.0" } }, - "node_modules/require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/require-main-filename": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", @@ -7828,6 +7652,7 @@ "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true, "engines": { "node": ">=0.12" } @@ -8188,14 +8013,6 @@ "node": ">=10" } }, - "node_modules/schemes": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/schemes/-/schemes-1.4.0.tgz", - "integrity": "sha512-ImFy9FbCsQlVgnE3TCWmLPCFnVzx0lHL/l+umHplDqAKd0dzFpnS6lFZIpagBlYhKwzVmlV36ec0Y1XTu8JBAQ==", - "dependencies": { - "extend": "^3.0.0" - } - }, "node_modules/semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", @@ -8296,17 +8113,6 @@ "node": ">=8" } }, - "node_modules/smtp-address-parser": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/smtp-address-parser/-/smtp-address-parser-1.0.8.tgz", - "integrity": "sha512-/YZCKXFO7HM5irmp1bzdefEYqPkM06Dy83xxsHqUSQWiosY7le5PFIeY7aeh6yi3+miphITBX5oZIwarnQz80A==", - "dependencies": { - "nearley": "^2.20.1" - }, - "engines": { - "node": ">=0.10" - } - }, "node_modules/snapdragon": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", @@ -9133,14 +8939,6 @@ "node": ">=0.10.0" } }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dependencies": { - "punycode": "^2.1.0" - } - }, "node_modules/urix": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", @@ -10914,42 +10712,9 @@ } }, "@middy/core": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/@middy/core/-/core-2.5.4.tgz", - "integrity": "sha512-WQFUFhCG0P2rmNDBX8x5RiREfSUnMhq77QyrwIZg2/gLUhuOZa8TPFFKzIFBz+blvw9Ep41LRrWdV/gzYwMuww==" - }, - "@middy/http-error-handler": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/@middy/http-error-handler/-/http-error-handler-2.5.4.tgz", - "integrity": "sha512-sA+dP5e9pcVwfPN1jvkHGsQG7BpVHp9zRp+EUY+tJjy+kavjTfx7s7RMDePYrztlYpi0dFtEzKsrWGbKy9+AKA==", - "requires": { - "@middy/util": "^2.5.4" - } - }, - "@middy/http-json-body-parser": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/@middy/http-json-body-parser/-/http-json-body-parser-2.5.4.tgz", - "integrity": "sha512-R7OzTu3jfVWACImVJzrGrJLvTMlAZIpWZ3kpKLOq+yo390qEoHFS7eLzFVJlMbULsGkTF5SDle08m7+rpa95QQ==", - "requires": { - "@middy/util": "^2.5.4" - } - }, - "@middy/util": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/@middy/util/-/util-2.5.4.tgz", - "integrity": "sha512-/715LFKuz3EAao+e+4eWjO0fpJbtFjXAAA6nVcShnFKaU/s+P5qqRD9X8+iU+R1q7uFidd4eWnDhmpqJ43ZY8A==" - }, - "@middy/validator": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/@middy/validator/-/validator-2.5.4.tgz", - "integrity": "sha512-dhi2/4h2UdFyph3M0clXkL/w1wBXWm4JPHEB2Fx7xT0p1YhTVZYMgGM9nL3w+eKCkVDdudC2YQHVO/T0MihV5g==", - "requires": { - "@middy/util": "^2.5.4", - "ajv": "8.6.3", - "ajv-formats": "2.1.1", - "ajv-formats-draft2019": "1.6.1", - "ajv-i18n": "4.1.0" - } + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/@middy/core/-/core-2.5.6.tgz", + "integrity": "sha512-uOKeXqqKK8NjOFXJCtaQl3BF9zTd6R2N/1nwvAJ3MGfXSBBiBoRxXE+NhwHd2DFzf0ruzk3lHel2XMOQu7PXIQ==" }, "@sinonjs/commons": { "version": "1.8.3", @@ -11147,42 +10912,6 @@ "debug": "4" } }, - "ajv": { - "version": "8.6.3", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.6.3.tgz", - "integrity": "sha512-SMJOdDP6LqTkD0Uq8qLi+gMwSt0imXLSV080qFVwJCpH9U6Mb+SUGHAXM0KNbcBPguytWyvFxcHgMLe2D2XSpw==", - "requires": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - } - }, - "ajv-formats": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", - "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", - "requires": { - "ajv": "^8.0.0" - } - }, - "ajv-formats-draft2019": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/ajv-formats-draft2019/-/ajv-formats-draft2019-1.6.1.tgz", - "integrity": "sha512-JQPvavpkWDvIsBp2Z33UkYCtXCSpW4HD3tAZ+oL4iEFOk9obQZffx0yANwECt6vzr6ET+7HN5czRyqXbnq/u0Q==", - "requires": { - "punycode": "^2.1.1", - "schemes": "^1.4.0", - "smtp-address-parser": "^1.0.3", - "uri-js": "^4.4.1" - } - }, - "ajv-i18n": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ajv-i18n/-/ajv-i18n-4.1.0.tgz", - "integrity": "sha512-GmRKPqWbZc+wn77IVPixJ336h9opyWSd4iTEGv825jxbccN1JKVEG/JnJX9wxYa1/yPmT/4v/YZN3ymmHwY4ag==", - "requires": {} - }, "ansi-escapes": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", @@ -13478,11 +13207,6 @@ "delayed-stream": "~1.0.0" } }, - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" - }, "component-emitter": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", @@ -13639,11 +13363,6 @@ "integrity": "sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q==", "dev": true }, - "discontinuous-range": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/discontinuous-range/-/discontinuous-range-1.0.0.tgz", - "integrity": "sha1-44Mx8IRLukm5qctxx3FYWqsbxlo=" - }, "domexception": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/domexception/-/domexception-2.0.1.tgz", @@ -14058,11 +13777,6 @@ "jest-regex-util": "^26.0.0" } }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, "extend-shallow": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", @@ -14115,11 +13829,6 @@ } } }, - "fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" - }, "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -15153,11 +14862,6 @@ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true }, - "json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" - }, "json5": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", @@ -15337,11 +15041,6 @@ "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", "dev": true }, - "moo": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/moo/-/moo-0.5.1.tgz", - "integrity": "sha512-I1mnb5xn4fO80BH9BLcF0yLypy2UKl+Cb01Fu0hJRkJjlCRtxZMWkTdAtDd5ZqCOxtCkhmRwyI57vWT+1iZ67w==" - }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -15373,17 +15072,6 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, - "nearley": { - "version": "2.20.1", - "resolved": "https://registry.npmjs.org/nearley/-/nearley-2.20.1.tgz", - "integrity": "sha512-+Mc8UaAebFzgV+KpI5n7DasuuQCHA89dmwm7JXw3TV43ukfNQ9DnBH3Mdb2g/I4Fdxc26pwimBWvjIw0UAILSQ==", - "requires": { - "commander": "^2.19.0", - "moo": "^0.5.0", - "railroad-diagrams": "^1.0.0", - "randexp": "0.4.6" - } - }, "nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", @@ -15752,27 +15440,14 @@ "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true }, "querystring": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=" }, - "railroad-diagrams": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz", - "integrity": "sha1-635iZ1SN3t+4mcG5Dlc3RVnN234=" - }, - "randexp": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/randexp/-/randexp-0.4.6.tgz", - "integrity": "sha512-80WNmd9DA0tmZrw9qQa62GPPWfuXJknrmVmLcxvq4uZBdYqb1wYoKTmnlGUchvVWe0XiLupYkBoXVOxz3C8DYQ==", - "requires": { - "discontinuous-range": "1.0.0", - "ret": "~0.1.10" - } - }, "react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", @@ -15852,11 +15527,6 @@ "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true }, - "require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==" - }, "require-main-filename": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", @@ -15897,7 +15567,8 @@ "ret": { "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", - "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==" + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true }, "rimraf": { "version": "3.0.2", @@ -16184,14 +15855,6 @@ "xmlchars": "^2.2.0" } }, - "schemes": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/schemes/-/schemes-1.4.0.tgz", - "integrity": "sha512-ImFy9FbCsQlVgnE3TCWmLPCFnVzx0lHL/l+umHplDqAKd0dzFpnS6lFZIpagBlYhKwzVmlV36ec0Y1XTu8JBAQ==", - "requires": { - "extend": "^3.0.0" - } - }, "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", @@ -16273,14 +15936,6 @@ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true }, - "smtp-address-parser": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/smtp-address-parser/-/smtp-address-parser-1.0.8.tgz", - "integrity": "sha512-/YZCKXFO7HM5irmp1bzdefEYqPkM06Dy83xxsHqUSQWiosY7le5PFIeY7aeh6yi3+miphITBX5oZIwarnQz80A==", - "requires": { - "nearley": "^2.20.1" - } - }, "snapdragon": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", @@ -16933,14 +16588,6 @@ } } }, - "uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "requires": { - "punycode": "^2.1.0" - } - }, "urix": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", diff --git a/examples/cdk/package.json b/examples/cdk/package.json index 564d77c354..4bc3ed270d 100644 --- a/examples/cdk/package.json +++ b/examples/cdk/package.json @@ -30,10 +30,7 @@ "@aws-lambda-powertools/metrics": "^0.4.0", "@aws-lambda-powertools/tracer": "^0.4.0", "@aws-sdk/client-sts": "^3.43.0", - "@middy/core": "^2.5.3", - "@middy/http-error-handler": "^2.5.3", - "@middy/http-json-body-parser": "^2.5.3", - "@middy/validator": "^2.5.3", + "@middy/core": "^2.5.6", "@types/aws-lambda": "^8.10.86", "aws-cdk-lib": "2.0.0", "aws-sdk": "^2.1058.0", diff --git a/packages/logger/package-lock.json b/packages/logger/package-lock.json index ad8b0e2292..d6e865700b 100644 --- a/packages/logger/package-lock.json +++ b/packages/logger/package-lock.json @@ -10,13 +10,13 @@ "license": "MIT", "dependencies": { "@aws-lambda-powertools/commons": "^0.2.0", - "@middy/core": "^2.5.3", "@types/aws-lambda": "^8.10.72", "lodash.clonedeep": "^4.5.0", "lodash.merge": "^4.6.2", "lodash.pickby": "^4.6.0" }, "devDependencies": { + "@middy/core": "^2.5.6", "@types/jest": "^27.0.0", "@types/lodash.clonedeep": "^4.5.6", "@types/lodash.merge": "^4.6.6", @@ -1067,9 +1067,10 @@ } }, "node_modules/@middy/core": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/@middy/core/-/core-2.5.4.tgz", - "integrity": "sha512-WQFUFhCG0P2rmNDBX8x5RiREfSUnMhq77QyrwIZg2/gLUhuOZa8TPFFKzIFBz+blvw9Ep41LRrWdV/gzYwMuww==", + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/@middy/core/-/core-2.5.6.tgz", + "integrity": "sha512-uOKeXqqKK8NjOFXJCtaQl3BF9zTd6R2N/1nwvAJ3MGfXSBBiBoRxXE+NhwHd2DFzf0ruzk3lHel2XMOQu7PXIQ==", + "dev": true, "engines": { "node": ">=12" } @@ -6817,9 +6818,10 @@ } }, "@middy/core": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/@middy/core/-/core-2.5.4.tgz", - "integrity": "sha512-WQFUFhCG0P2rmNDBX8x5RiREfSUnMhq77QyrwIZg2/gLUhuOZa8TPFFKzIFBz+blvw9Ep41LRrWdV/gzYwMuww==" + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/@middy/core/-/core-2.5.6.tgz", + "integrity": "sha512-uOKeXqqKK8NjOFXJCtaQl3BF9zTd6R2N/1nwvAJ3MGfXSBBiBoRxXE+NhwHd2DFzf0ruzk3lHel2XMOQu7PXIQ==", + "dev": true }, "@nodelib/fs.scandir": { "version": "2.1.5", diff --git a/packages/logger/package.json b/packages/logger/package.json index 2e8b463021..1c3aaf28f3 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -43,6 +43,7 @@ "types": "./lib/index.d.ts", "typedocMain": "src/index.ts", "devDependencies": { + "@middy/core": "^2.5.6", "@types/jest": "^27.0.0", "@types/lodash.clonedeep": "^4.5.6", "@types/lodash.merge": "^4.6.6", @@ -72,7 +73,6 @@ }, "dependencies": { "@aws-lambda-powertools/commons": "^0.2.0", - "@middy/core": "^2.5.3", "@types/aws-lambda": "^8.10.72", "lodash.clonedeep": "^4.5.0", "lodash.merge": "^4.6.2", diff --git a/packages/logger/src/middleware/middy.ts b/packages/logger/src/middleware/middy.ts index d0353962a3..cdb53183e2 100644 --- a/packages/logger/src/middleware/middy.ts +++ b/packages/logger/src/middleware/middy.ts @@ -1,5 +1,5 @@ import type { Logger } from '../Logger'; -import middy from '@middy/core'; +import type middy from '@middy/core'; /** * A middy middleware that adds the current Lambda invocation's context inside all log items. diff --git a/packages/metrics/package-lock.json b/packages/metrics/package-lock.json index 2d507394d2..30b685af0e 100644 --- a/packages/metrics/package-lock.json +++ b/packages/metrics/package-lock.json @@ -16,7 +16,7 @@ "@aws-cdk/aws-lambda-nodejs": "^1.137.0", "@aws-cdk/core": "^1.137.0", "@commitlint/cli": "^16.0.1", - "@middy/core": "^2.5.3", + "@middy/core": "^2.5.6", "@types/aws-lambda": "^8.10.72", "@types/jest": "^27.0.0", "@types/node": "^17.0.8", @@ -1968,9 +1968,9 @@ } }, "node_modules/@middy/core": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/@middy/core/-/core-2.5.4.tgz", - "integrity": "sha512-WQFUFhCG0P2rmNDBX8x5RiREfSUnMhq77QyrwIZg2/gLUhuOZa8TPFFKzIFBz+blvw9Ep41LRrWdV/gzYwMuww==", + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/@middy/core/-/core-2.5.6.tgz", + "integrity": "sha512-uOKeXqqKK8NjOFXJCtaQl3BF9zTd6R2N/1nwvAJ3MGfXSBBiBoRxXE+NhwHd2DFzf0ruzk3lHel2XMOQu7PXIQ==", "dev": true, "engines": { "node": ">=12" @@ -10790,9 +10790,9 @@ } }, "@middy/core": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/@middy/core/-/core-2.5.4.tgz", - "integrity": "sha512-WQFUFhCG0P2rmNDBX8x5RiREfSUnMhq77QyrwIZg2/gLUhuOZa8TPFFKzIFBz+blvw9Ep41LRrWdV/gzYwMuww==", + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/@middy/core/-/core-2.5.6.tgz", + "integrity": "sha512-uOKeXqqKK8NjOFXJCtaQl3BF9zTd6R2N/1nwvAJ3MGfXSBBiBoRxXE+NhwHd2DFzf0ruzk3lHel2XMOQu7PXIQ==", "dev": true }, "@nodelib/fs.scandir": { diff --git a/packages/metrics/package.json b/packages/metrics/package.json index 7edf9e3885..0c3272480b 100644 --- a/packages/metrics/package.json +++ b/packages/metrics/package.json @@ -54,7 +54,7 @@ "@aws-cdk/aws-lambda-nodejs": "^1.137.0", "@aws-cdk/core": "^1.137.0", "@commitlint/cli": "^16.0.1", - "@middy/core": "^2.5.3", + "@middy/core": "^2.5.6", "@types/aws-lambda": "^8.10.72", "@types/jest": "^27.0.0", "@types/node": "^17.0.8", diff --git a/packages/metrics/src/middleware/middy.ts b/packages/metrics/src/middleware/middy.ts index 5f40c050b9..5a0e1b7243 100644 --- a/packages/metrics/src/middleware/middy.ts +++ b/packages/metrics/src/middleware/middy.ts @@ -1,6 +1,6 @@ import type { Metrics } from '../Metrics'; -import middy from '@middy/core'; -import { ExtraOptions } from '../types'; +import type middy from '@middy/core'; +import type { ExtraOptions } from '../types'; const logMetrics = (target: Metrics | Metrics[], options: ExtraOptions = {}): middy.MiddlewareObj => { const metricsInstances = target instanceof Array ? target : [target]; diff --git a/packages/tracing/package-lock.json b/packages/tracing/package-lock.json index 59fa274714..0cf8d9dfb1 100644 --- a/packages/tracing/package-lock.json +++ b/packages/tracing/package-lock.json @@ -10,7 +10,6 @@ "license": "MIT-0", "dependencies": { "@aws-lambda-powertools/commons": "^0.2.0", - "@middy/core": "^2.5.3", "aws-xray-sdk-core": "^3.3.3" }, "devDependencies": { @@ -18,6 +17,7 @@ "@aws-cdk/aws-lambda-nodejs": "^1.139.0", "@aws-cdk/core": "^1.139.0", "@aws-sdk/client-dynamodb": "^3.47.0", + "@middy/core": "^2.5.6", "@types/aws-lambda": "^8.10.72", "@types/jest": "^27.0.0", "@types/node": "^17.0.8", @@ -3438,9 +3438,10 @@ } }, "node_modules/@middy/core": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/@middy/core/-/core-2.5.4.tgz", - "integrity": "sha512-WQFUFhCG0P2rmNDBX8x5RiREfSUnMhq77QyrwIZg2/gLUhuOZa8TPFFKzIFBz+blvw9Ep41LRrWdV/gzYwMuww==", + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/@middy/core/-/core-2.5.6.tgz", + "integrity": "sha512-uOKeXqqKK8NjOFXJCtaQl3BF9zTd6R2N/1nwvAJ3MGfXSBBiBoRxXE+NhwHd2DFzf0ruzk3lHel2XMOQu7PXIQ==", + "dev": true, "engines": { "node": ">=12" } @@ -13110,9 +13111,10 @@ } }, "@middy/core": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/@middy/core/-/core-2.5.4.tgz", - "integrity": "sha512-WQFUFhCG0P2rmNDBX8x5RiREfSUnMhq77QyrwIZg2/gLUhuOZa8TPFFKzIFBz+blvw9Ep41LRrWdV/gzYwMuww==" + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/@middy/core/-/core-2.5.6.tgz", + "integrity": "sha512-uOKeXqqKK8NjOFXJCtaQl3BF9zTd6R2N/1nwvAJ3MGfXSBBiBoRxXE+NhwHd2DFzf0ruzk3lHel2XMOQu7PXIQ==", + "dev": true }, "@nodelib/fs.scandir": { "version": "2.1.5", @@ -18726,4 +18728,4 @@ "dev": true } } -} \ No newline at end of file +} diff --git a/packages/tracing/package.json b/packages/tracing/package.json index 109d0ec3f5..9e8afdb5b5 100644 --- a/packages/tracing/package.json +++ b/packages/tracing/package.json @@ -34,6 +34,7 @@ "@aws-cdk/aws-lambda-nodejs": "^1.139.0", "@aws-cdk/core": "^1.139.0", "@aws-sdk/client-dynamodb": "^3.47.0", + "@middy/core": "^2.5.6", "@types/aws-lambda": "^8.10.72", "@types/jest": "^27.0.0", "@types/node": "^17.0.8", @@ -64,7 +65,6 @@ }, "dependencies": { "@aws-lambda-powertools/commons": "^0.2.0", - "@middy/core": "^2.5.3", "aws-xray-sdk-core": "^3.3.3" } } diff --git a/packages/tracing/src/middleware/middy.ts b/packages/tracing/src/middleware/middy.ts index 064952c181..2114a80533 100644 --- a/packages/tracing/src/middleware/middy.ts +++ b/packages/tracing/src/middleware/middy.ts @@ -1,6 +1,6 @@ -import middy from '@middy/core'; -import { Tracer } from '../Tracer'; -import { Segment, Subsegment } from 'aws-xray-sdk-core'; +import type middy from '@middy/core'; +import type { Tracer } from '../Tracer'; +import type { Segment, Subsegment } from 'aws-xray-sdk-core'; /** * A middy middleware automating capture of metadata and annotations on segments or subsegments ofr a Lambda Handler. @@ -41,7 +41,7 @@ const captureLambdaHandler = (target: Tracer): middy.MiddlewareObj => { target.setSegment(lambdaSegment as Segment); }; - const captureLambdaHandlerBefore = async (_request: middy.Request): Promise => { + const captureLambdaHandlerBefore = async (): Promise => { if (target.isTracingEnabled()) { open(); target.annotateColdStart(); @@ -59,8 +59,6 @@ const captureLambdaHandler = (target: Tracer): middy.MiddlewareObj => { const captureLambdaHandlerError = async (request: middy.Request): Promise => { if (target.isTracingEnabled()) { target.addErrorAsMetadata(request.error as Error); - // TODO: should this error be thrown?? I.e. should we stop the event flow & return? - // throw request.error; close(); } };