@tabletennisshop/common 1.0.2 → 1.0.3

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.
@@ -0,0 +1,8 @@
1
+ export declare abstract class CustomError extends Error {
2
+ abstract statusCode: number;
3
+ constructor(message: string);
4
+ abstract serializeErrors(): {
5
+ message: string;
6
+ details?: any;
7
+ }[];
8
+ }
@@ -0,0 +1,9 @@
1
+ import { CustomError } from "./custom-error";
2
+ export declare class NotAuthorizedError extends CustomError {
3
+ statusCode: number;
4
+ constructor(message: string);
5
+ serializeErrors(): {
6
+ message: string;
7
+ details?: any;
8
+ }[];
9
+ }
@@ -0,0 +1,9 @@
1
+ import { CustomError } from "./custom-error";
2
+ export declare class NotFoundError extends CustomError {
3
+ statusCode: number;
4
+ constructor(message: string);
5
+ serializeErrors(): {
6
+ message: string;
7
+ details?: any;
8
+ }[];
9
+ }
@@ -0,0 +1,10 @@
1
+ import { CustomError } from './custom-error';
2
+ import { ValidationError } from 'express-validator';
3
+ export declare class RequestValidateError extends CustomError {
4
+ statusCode: number;
5
+ private errors;
6
+ constructor(errors: ValidationError[]);
7
+ serializeErrors(): {
8
+ message: any;
9
+ }[];
10
+ }
@@ -0,0 +1,7 @@
1
+ export * from './errors/custom-error';
2
+ export * from './errors/not-authorized-error';
3
+ export * from './errors/not-found-error';
4
+ export * from './errors/request-validate-error';
5
+ export * from './middlewares/check-authorized-middleware';
6
+ export * from './middlewares/error-handler';
7
+ export * from './middlewares/validate-request-middleware';
@@ -0,0 +1,2 @@
1
+ import { NextFunction } from "express";
2
+ export declare const CheckAuthorized: (req: Request, res: Response, next: NextFunction) => Promise<void>;
@@ -0,0 +1,2 @@
1
+ import { NextFunction, Request, Response } from "express";
2
+ export declare const errorHandler: (err: Error, req: Request, res: Response, next: NextFunction) => void;
@@ -0,0 +1,3 @@
1
+ import { NextFunction, Request, Response } from 'express';
2
+ declare const validateRequestMiddleware: (req: Request, res: Response, next: NextFunction) => void;
3
+ export default validateRequestMiddleware;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@tabletennisshop/common",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "build/index.d.ts",
7
7
  "scripts": {
8
- "clean": "del build",
8
+ "clean": "del-cli ./build/*",
9
9
  "build": "npm run clean && tsc",
10
10
  "pub": "npm version patch && npm run build && npm publish"
11
11
  },
@@ -23,5 +23,9 @@
23
23
  "express": "^5.1.0",
24
24
  "express-validator": "^7.2.1",
25
25
  "uninstall": "^0.0.0"
26
+ },
27
+ "devDependencies": {
28
+ "del-cli": "^6.0.0",
29
+ "typescript": "^5.8.3"
26
30
  }
27
31
  }