From 793391d94c997db1dd3f0b4dec42dc93d648e60d Mon Sep 17 00:00:00 2001 From: will Farrell Date: Wed, 8 May 2024 08:18:47 -0600 Subject: [PATCH] fix: remove unused option --- packages/input-output-logger/index.d.ts | 3 +-- packages/input-output-logger/index.js | 7 +++---- website/docs/middlewares/input-output-logger.md | 1 - 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/packages/input-output-logger/index.d.ts b/packages/input-output-logger/index.d.ts index f65ab95be..de00ecefc 100644 --- a/packages/input-output-logger/index.d.ts +++ b/packages/input-output-logger/index.d.ts @@ -5,9 +5,8 @@ interface Options { awsContext?: boolean omitPaths?: string[] mask?: string - replacer?: (this: any, key: string, value: any) => any | Array } -declare function inputOutputLogger (options?: Options): middy.MiddlewareObj +declare function inputOutputLogger(options?: Options): middy.MiddlewareObj export default inputOutputLogger diff --git a/packages/input-output-logger/index.js b/packages/input-output-logger/index.js index 1ee9c3182..041c8e03e 100644 --- a/packages/input-output-logger/index.js +++ b/packages/input-output-logger/index.js @@ -4,12 +4,11 @@ const defaults = { logger: console.log, awsContext: false, omitPaths: [], - mask: undefined, - replacer: undefined + mask: undefined } const inputOutputLoggerMiddleware = (opts = {}) => { - const { logger, awsContext, omitPaths, mask, replacer } = { + const { logger, awsContext, omitPaths, mask } = { ...defaults, ...opts } @@ -33,7 +32,7 @@ const inputOutputLoggerMiddleware = (opts = {}) => { let cloneMessage = message if (omitPaths.length) { - cloneMessage = structuredClone(message, replacer) // Full clone to prevent nested mutations + cloneMessage = structuredClone(message) // Full clone to prevent nested mutations omit(cloneMessage, { [param]: omitPathTree[param] }) } logger(cloneMessage) diff --git a/website/docs/middlewares/input-output-logger.md b/website/docs/middlewares/input-output-logger.md index ff8010bbc..21fff463a 100644 --- a/website/docs/middlewares/input-output-logger.md +++ b/website/docs/middlewares/input-output-logger.md @@ -20,7 +20,6 @@ npm install --save @middy/input-output-logger - `awsContext` boolean (default `false`): Include [AWS Lambda context object](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-context.html) to the logger - `omitPaths` string[] (default `[]`): property accepts an array of paths that will be used to remove particular fields import the logged objects. This could serve as a simple way to redact sensitive data from logs (default []). Examples: `name`, `user.name`, `users.[].name` - `mask` string: String to replace omitted values with. Example: `***omitted***` -- `replacer` function: stringify `replacer` function Note: If using with `{ streamifyResponse: true }`, your ReadableStream must be of type `string`.