@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,5 +1,6 @@
1
1
  import * as express from 'express';
2
2
  import { Application, Request, Response, NextFunction } from 'express';
3
+ import { ScrubOption } from '@jaypie/kit';
3
4
  import { StreamFormat } from '@jaypie/aws';
4
5
  import { IncomingHttpHeaders, OutgoingHttpHeaders } from 'node:http';
5
6
  import { Readable, Writable } from 'node:stream';
@@ -366,6 +367,7 @@ interface ExpressHandlerOptions {
366
367
  fabric?: boolean;
367
368
  locals?: Record<string, unknown | ExpressHandlerLocals>;
368
369
  name?: string;
370
+ scrub?: ScrubOption;
369
371
  secrets?: string[];
370
372
  setup?: JaypieHandlerSetup[] | JaypieHandlerSetup;
371
373
  teardown?: JaypieHandlerTeardown[] | JaypieHandlerTeardown;
@@ -388,6 +390,7 @@ interface ExpressStreamHandlerOptions {
388
390
  format?: StreamFormat;
389
391
  locals?: Record<string, unknown | ExpressStreamHandlerLocals>;
390
392
  name?: string;
393
+ scrub?: ScrubOption;
391
394
  secrets?: string[];
392
395
  setup?: JaypieStreamHandlerSetup[] | JaypieStreamHandlerSetup;
393
396
  teardown?: JaypieStreamHandlerTeardown[] | JaypieStreamHandlerTeardown;
@@ -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;
@@ -1,5 +1,6 @@
1
1
  import * as express from 'express';
2
2
  import { Application, Request, Response, NextFunction } from 'express';
3
+ import { ScrubOption } from '@jaypie/kit';
3
4
  import { StreamFormat } from '@jaypie/aws';
4
5
  import { IncomingHttpHeaders, OutgoingHttpHeaders } from 'node:http';
5
6
  import { Readable, Writable } from 'node:stream';
@@ -366,6 +367,7 @@ interface ExpressHandlerOptions {
366
367
  fabric?: boolean;
367
368
  locals?: Record<string, unknown | ExpressHandlerLocals>;
368
369
  name?: string;
370
+ scrub?: ScrubOption;
369
371
  secrets?: string[];
370
372
  setup?: JaypieHandlerSetup[] | JaypieHandlerSetup;
371
373
  teardown?: JaypieHandlerTeardown[] | JaypieHandlerTeardown;
@@ -388,6 +390,7 @@ interface ExpressStreamHandlerOptions {
388
390
  format?: StreamFormat;
389
391
  locals?: Record<string, unknown | ExpressStreamHandlerLocals>;
390
392
  name?: string;
393
+ scrub?: ScrubOption;
391
394
  secrets?: string[];
392
395
  setup?: JaypieStreamHandlerSetup[] | JaypieStreamHandlerSetup;
393
396
  teardown?: JaypieStreamHandlerTeardown[] | JaypieStreamHandlerTeardown;
package/dist/esm/index.js CHANGED
@@ -1755,7 +1755,6 @@ function safeSend(res, statusCode, body) {
1755
1755
  }
1756
1756
  }
1757
1757
  function expressHandler(handlerOrOptions, optionsOrHandler) {
1758
- /* eslint-enable no-redeclare */
1759
1758
  let handler;
1760
1759
  let options;
1761
1760
  // If handler is an object and options is a function, swap them
@@ -1772,7 +1771,7 @@ function expressHandler(handlerOrOptions, optionsOrHandler) {
1772
1771
  //
1773
1772
  // Validate
1774
1773
  //
1775
- let { chaos, fabric, locals, name, secrets, setup = [], teardown = [], unavailable, validate, } = options;
1774
+ let { chaos, fabric, locals, name, scrub, secrets, setup = [], teardown = [], unavailable, validate, } = options;
1776
1775
  if (typeof handler !== "function") {
1777
1776
  throw new BadRequestError(`Argument "${handler}" doesn't match type "function"`);
1778
1777
  }
@@ -1927,6 +1926,7 @@ function expressHandler(handlerOrOptions, optionsOrHandler) {
1927
1926
  jaypieFunction = jaypieHandler(handler, {
1928
1927
  chaos,
1929
1928
  name,
1929
+ scrub,
1930
1930
  setup: requestSetup,
1931
1931
  teardown,
1932
1932
  unavailable,
@@ -2171,7 +2171,6 @@ function getErrorBody(error) {
2171
2171
  : new UnhandledError().body();
2172
2172
  }
2173
2173
  function expressStreamHandler(handlerOrOptions, optionsOrHandler) {
2174
- /* eslint-enable no-redeclare */
2175
2174
  let handler;
2176
2175
  let options;
2177
2176
  // If handler is an object and options is a function, swap them
@@ -2189,7 +2188,7 @@ function expressStreamHandler(handlerOrOptions, optionsOrHandler) {
2189
2188
  // Validate
2190
2189
  //
2191
2190
  const format = options.format ?? "sse";
2192
- let { chaos, contentType = getContentTypeForFormat(format), locals, name, secrets, setup = [], teardown = [], unavailable, validate, } = options;
2191
+ let { chaos, contentType = getContentTypeForFormat(format), locals, name, scrub, secrets, setup = [], teardown = [], unavailable, validate, } = options;
2193
2192
  if (typeof handler !== "function") {
2194
2193
  throw new BadRequestError(`Argument "${handler}" doesn't match type "function"`);
2195
2194
  }
@@ -2310,6 +2309,7 @@ function expressStreamHandler(handlerOrOptions, optionsOrHandler) {
2310
2309
  jaypieFunction = jaypieHandler(handler, {
2311
2310
  chaos,
2312
2311
  name,
2312
+ scrub,
2313
2313
  setup: requestSetup,
2314
2314
  teardown,
2315
2315
  unavailable,