@jaypie/express 1.2.30 → 1.2.32

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.
@@ -1,4 +1,5 @@
1
1
  import type { Request, Response } from "express";
2
+ import type { ScrubOption } from "@jaypie/kit";
2
3
  export type JaypieHandlerSetup = (req: Request, res: Response) => Promise<void> | void;
3
4
  export type JaypieHandlerTeardown = (req: Request, res: Response) => Promise<void> | void;
4
5
  export type JaypieHandlerValidate = (req: Request, res: Response) => Promise<boolean | void> | boolean | void;
@@ -14,6 +15,7 @@ export interface ExpressHandlerOptions {
14
15
  fabric?: boolean;
15
16
  locals?: Record<string, unknown | ExpressHandlerLocals>;
16
17
  name?: string;
18
+ scrub?: ScrubOption;
17
19
  secrets?: string[];
18
20
  setup?: JaypieHandlerSetup[] | JaypieHandlerSetup;
19
21
  teardown?: JaypieHandlerTeardown[] | JaypieHandlerTeardown;
@@ -1,5 +1,6 @@
1
1
  import type { Request, Response } from "express";
2
2
  import type { StreamFormat } from "@jaypie/aws";
3
+ import type { ScrubOption } from "@jaypie/kit";
3
4
  export type JaypieStreamHandlerSetup = (req: Request, res: Response) => Promise<void> | void;
4
5
  export type JaypieStreamHandlerTeardown = (req: Request, res: Response) => Promise<void> | void;
5
6
  export type JaypieStreamHandlerValidate = (req: Request, res: Response) => Promise<boolean | void> | boolean | void;
@@ -10,6 +11,7 @@ export interface ExpressStreamHandlerOptions {
10
11
  format?: StreamFormat;
11
12
  locals?: Record<string, unknown | ExpressStreamHandlerLocals>;
12
13
  name?: string;
14
+ scrub?: ScrubOption;
13
15
  secrets?: string[];
14
16
  setup?: JaypieStreamHandlerSetup[] | JaypieStreamHandlerSetup;
15
17
  teardown?: JaypieStreamHandlerTeardown[] | JaypieStreamHandlerTeardown;
@@ -1757,7 +1757,6 @@ function safeSend(res, statusCode, body) {
1757
1757
  }
1758
1758
  }
1759
1759
  function expressHandler(handlerOrOptions, optionsOrHandler) {
1760
- /* eslint-enable no-redeclare */
1761
1760
  let handler;
1762
1761
  let options;
1763
1762
  // If handler is an object and options is a function, swap them
@@ -1774,7 +1773,7 @@ function expressHandler(handlerOrOptions, optionsOrHandler) {
1774
1773
  //
1775
1774
  // Validate
1776
1775
  //
1777
- let { chaos, fabric, locals, name, secrets, setup = [], teardown = [], unavailable, validate, } = options;
1776
+ let { chaos, fabric, locals, name, scrub, secrets, setup = [], teardown = [], unavailable, validate, } = options;
1778
1777
  if (typeof handler !== "function") {
1779
1778
  throw new errors.BadRequestError(`Argument "${handler}" doesn't match type "function"`);
1780
1779
  }
@@ -1929,6 +1928,7 @@ function expressHandler(handlerOrOptions, optionsOrHandler) {
1929
1928
  jaypieFunction = kit.jaypieHandler(handler, {
1930
1929
  chaos,
1931
1930
  name,
1931
+ scrub,
1932
1932
  setup: requestSetup,
1933
1933
  teardown,
1934
1934
  unavailable,
@@ -2173,7 +2173,6 @@ function getErrorBody(error) {
2173
2173
  : new errors.UnhandledError().body();
2174
2174
  }
2175
2175
  function expressStreamHandler(handlerOrOptions, optionsOrHandler) {
2176
- /* eslint-enable no-redeclare */
2177
2176
  let handler;
2178
2177
  let options;
2179
2178
  // If handler is an object and options is a function, swap them
@@ -2191,7 +2190,7 @@ function expressStreamHandler(handlerOrOptions, optionsOrHandler) {
2191
2190
  // Validate
2192
2191
  //
2193
2192
  const format = options.format ?? "sse";
2194
- let { chaos, contentType = aws.getContentTypeForFormat(format), locals, name, secrets, setup = [], teardown = [], unavailable, validate, } = options;
2193
+ let { chaos, contentType = aws.getContentTypeForFormat(format), locals, name, scrub, secrets, setup = [], teardown = [], unavailable, validate, } = options;
2195
2194
  if (typeof handler !== "function") {
2196
2195
  throw new errors.BadRequestError(`Argument "${handler}" doesn't match type "function"`);
2197
2196
  }
@@ -2312,6 +2311,7 @@ function expressStreamHandler(handlerOrOptions, optionsOrHandler) {
2312
2311
  jaypieFunction = kit.jaypieHandler(handler, {
2313
2312
  chaos,
2314
2313
  name,
2314
+ scrub,
2315
2315
  setup: requestSetup,
2316
2316
  teardown,
2317
2317
  unavailable,