response-standardizer 1.1.6 → 1.1.7

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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Request, Response } from "express";
2
- import { RestResponseFunctions, RestMiddlewareFunctions, AuthRequest } from "./types.js";
2
+ import { RestResponseFunctions, RestMiddlewareFunctions } from "./types.js";
3
3
  declare global {
4
4
  namespace Express {
5
5
  interface Response {
@@ -24,4 +24,3 @@ export declare const warn: (message: string, meta?: any) => void;
24
24
  export declare const info: (message: string, meta?: any) => void;
25
25
  export declare const log: (level: "INFO" | "WARN" | "ERROR", message: string, meta?: any) => void;
26
26
  export declare const handleRestException: (req: Request, res: Response, err: Error) => void;
27
- export declare const controller: (req: AuthRequest, res: Response, process: () => {}) => void;
package/dist/index.js CHANGED
@@ -189,11 +189,3 @@ export const handleRestException = (req, res, err) => {
189
189
  RestResponse.exceptionError(req, res, err.message);
190
190
  }
191
191
  };
192
- export const controller = (req, res, process) => {
193
- try {
194
- process();
195
- }
196
- catch (err) {
197
- handleRestException(req, res, err);
198
- }
199
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "response-standardizer",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "Express middleware to standardize API responses",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -244,12 +244,4 @@ export const handleRestException = (req: Request, res: Response, err: Error) =>
244
244
  }else if(err instanceof Error){
245
245
  RestResponse.exceptionError(req, res, err.message)
246
246
  }
247
- }
248
-
249
- export const controller = (req: AuthRequest, res: Response, process: () => {}) => {
250
- try{
251
- process();
252
- }catch(err){
253
- handleRestException(req, res, err as Error)
254
- }
255
247
  }
@@ -1,7 +1,3 @@
1
- import { Response } from "express";
2
- import { handleRestException } from ".";
3
- import { AuthRequest } from "./types";
4
-
5
1
  export class ServiceException extends Error {
6
2
  status: number;
7
3
  errors: any
@@ -11,5 +7,4 @@ export class ServiceException extends Error {
11
7
  this.status = status;
12
8
  this.errors = errors;
13
9
  }
14
- }
15
-
10
+ }