@jaypie/express 1.1.10 → 1.1.12

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/dist/module.cjs CHANGED
@@ -368,7 +368,7 @@ const expressHandler = (handler, options = {}) => {
368
368
  status: res.status,
369
369
  statusSent: false,
370
370
  };
371
- // eslint-disable-next-line no-shadow
371
+
372
372
  res.end = (...params) => {
373
373
  originalRes.attemptedCall = originalRes.end;
374
374
  originalRes.attemptedParams = params;
@@ -376,7 +376,7 @@ const expressHandler = (handler, options = {}) => {
376
376
  "[jaypie] Illegal call to res.end(); prefer Jaypie response conventions",
377
377
  );
378
378
  };
379
- // eslint-disable-next-line no-shadow
379
+
380
380
  res.json = (...params) => {
381
381
  originalRes.attemptedCall = originalRes.json;
382
382
  originalRes.attemptedParams = params;
@@ -384,7 +384,7 @@ const expressHandler = (handler, options = {}) => {
384
384
  "[jaypie] Illegal call to res.json(); prefer Jaypie response conventions",
385
385
  );
386
386
  };
387
- // eslint-disable-next-line no-shadow
387
+
388
388
  res.send = (...params) => {
389
389
  originalRes.attemptedCall = originalRes.send;
390
390
  originalRes.attemptedParams = params;
@@ -392,9 +392,9 @@ const expressHandler = (handler, options = {}) => {
392
392
  "[jaypie] Illegal call to res.send(); prefer Jaypie response conventions",
393
393
  );
394
394
  };
395
- // eslint-disable-next-line no-shadow
395
+
396
396
  res.status = (...params) => {
397
- originalRes.statusSent = params;
397
+ originalRes.statusSent = params[0];
398
398
  return originalRes.status(...params);
399
399
  };
400
400
 
@@ -1,5 +1,5 @@
1
1
  import { CorsError } from '@jaypie/errors';
2
- import { force, envBoolean, log, JAYPIE, HTTP, validate, jaypieHandler, UnhandledError, BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, MethodNotAllowedError, GoneError, TeapotError, InternalError, BadGatewayError, UnavailableError, GatewayTimeoutError, NotImplementedError } from '@jaypie/core';
2
+ import { force, envBoolean, log, JAYPIE, HTTP, validate, jaypieHandler, UnhandledError, GatewayTimeoutError, UnavailableError, BadGatewayError, InternalError, TeapotError, GoneError, MethodNotAllowedError, NotFoundError, ForbiddenError, UnauthorizedError, BadRequestError, NotImplementedError } from '@jaypie/core';
3
3
  import expressCors from 'cors';
4
4
  import { getCurrentInvoke } from '@codegenie/serverless-express';
5
5
 
@@ -366,7 +366,7 @@ const expressHandler = (handler, options = {}) => {
366
366
  status: res.status,
367
367
  statusSent: false,
368
368
  };
369
- // eslint-disable-next-line no-shadow
369
+
370
370
  res.end = (...params) => {
371
371
  originalRes.attemptedCall = originalRes.end;
372
372
  originalRes.attemptedParams = params;
@@ -374,7 +374,7 @@ const expressHandler = (handler, options = {}) => {
374
374
  "[jaypie] Illegal call to res.end(); prefer Jaypie response conventions",
375
375
  );
376
376
  };
377
- // eslint-disable-next-line no-shadow
377
+
378
378
  res.json = (...params) => {
379
379
  originalRes.attemptedCall = originalRes.json;
380
380
  originalRes.attemptedParams = params;
@@ -382,7 +382,7 @@ const expressHandler = (handler, options = {}) => {
382
382
  "[jaypie] Illegal call to res.json(); prefer Jaypie response conventions",
383
383
  );
384
384
  };
385
- // eslint-disable-next-line no-shadow
385
+
386
386
  res.send = (...params) => {
387
387
  originalRes.attemptedCall = originalRes.send;
388
388
  originalRes.attemptedParams = params;
@@ -390,9 +390,9 @@ const expressHandler = (handler, options = {}) => {
390
390
  "[jaypie] Illegal call to res.send(); prefer Jaypie response conventions",
391
391
  );
392
392
  };
393
- // eslint-disable-next-line no-shadow
393
+
394
394
  res.status = (...params) => {
395
- originalRes.statusSent = params;
395
+ originalRes.statusSent = params[0];
396
396
  return originalRes.status(...params);
397
397
  };
398
398
 
package/index.d.ts CHANGED
@@ -10,7 +10,7 @@ export const EXPRESS: {
10
10
  };
11
11
 
12
12
  export interface CorsConfig {
13
- origins?: string | string[];
13
+ origin?: string | string[];
14
14
  overrides?: Record<string, unknown>;
15
15
  }
16
16
 
@@ -27,7 +27,7 @@ export function cors(
27
27
  ): (req: Request, res: Response, next: NextFunction) => void;
28
28
 
29
29
  export function expressHandler<T>(
30
- handler: (req: Request, res: Response, ...params: unknown[]) => Promise<T>,
30
+ handler: (req: Request, res?: Response, ...params: unknown[]) => Promise<T>,
31
31
  options?: ExpressHandlerOptions,
32
32
  ): (req: Request, res: Response, ...params: unknown[]) => Promise<T>;
33
33
 
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@jaypie/express",
3
- "version": "1.1.10",
3
+ "version": "1.1.12",
4
4
  "license": "MIT",
5
5
  "author": "Finlayson Studio",
6
6
  "type": "module",
7
7
  "exports": {
8
8
  ".": {
9
+ "types": "./index.d.ts",
9
10
  "default": {
10
11
  "require": "./dist/module.cjs",
11
12
  "default": "./src/index.js"
@@ -41,8 +42,11 @@
41
42
  "@jaypie/errors": "^1.1.2",
42
43
  "cors": "^2.8.5"
43
44
  },
45
+ "devDependencies": {
46
+ "express": "^4.21.2"
47
+ },
44
48
  "publishConfig": {
45
49
  "access": "public"
46
50
  },
47
- "gitHead": "358428010fb0d5f130295fbe38b1aab2c1f89e5f"
51
+ "gitHead": "37596b497a334443338f86baa9d370529c055c12"
48
52
  }
@@ -109,7 +109,7 @@ const expressHandler = (handler, options = {}) => {
109
109
  status: res.status,
110
110
  statusSent: false,
111
111
  };
112
- // eslint-disable-next-line no-shadow
112
+
113
113
  res.end = (...params) => {
114
114
  originalRes.attemptedCall = originalRes.end;
115
115
  originalRes.attemptedParams = params;
@@ -117,7 +117,7 @@ const expressHandler = (handler, options = {}) => {
117
117
  "[jaypie] Illegal call to res.end(); prefer Jaypie response conventions",
118
118
  );
119
119
  };
120
- // eslint-disable-next-line no-shadow
120
+
121
121
  res.json = (...params) => {
122
122
  originalRes.attemptedCall = originalRes.json;
123
123
  originalRes.attemptedParams = params;
@@ -125,7 +125,7 @@ const expressHandler = (handler, options = {}) => {
125
125
  "[jaypie] Illegal call to res.json(); prefer Jaypie response conventions",
126
126
  );
127
127
  };
128
- // eslint-disable-next-line no-shadow
128
+
129
129
  res.send = (...params) => {
130
130
  originalRes.attemptedCall = originalRes.send;
131
131
  originalRes.attemptedParams = params;
@@ -133,9 +133,9 @@ const expressHandler = (handler, options = {}) => {
133
133
  "[jaypie] Illegal call to res.send(); prefer Jaypie response conventions",
134
134
  );
135
135
  };
136
- // eslint-disable-next-line no-shadow
136
+
137
137
  res.status = (...params) => {
138
- originalRes.statusSent = params;
138
+ originalRes.statusSent = params[0];
139
139
  return originalRes.status(...params);
140
140
  };
141
141