@cs-tickets/common 1.0.2 → 1.0.4
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/build/errors/bad-request-error.d.ts +1 -1
- package/build/errors/database-connection-error.d.ts +1 -1
- package/build/errors/database-connection-error.js +1 -1
- package/build/errors/not-authorized-error.d.ts +1 -1
- package/build/errors/not-authorized-error.js +1 -1
- package/build/errors/not-found-error.d.ts +1 -1
- package/build/errors/not-found-error.js +1 -1
- package/build/errors/request-validation-error.d.ts +2 -2
- package/build/errors/request-validation-error.js +1 -1
- package/build/index.d.ts +10 -10
- package/build/middlewares/current-user.d.ts +1 -1
- package/build/middlewares/error-handler.d.ts +1 -1
- package/build/middlewares/error-handler.js +1 -1
- package/build/middlewares/require-auth.d.ts +1 -1
- package/build/middlewares/validate-request.d.ts +1 -1
- package/package.json +3 -3
@@ -6,7 +6,7 @@ class DatabaseConnectionError extends custom_error_1.CustomError {
|
|
6
6
|
constructor() {
|
7
7
|
super();
|
8
8
|
this.statusCode = 500;
|
9
|
-
this.reason =
|
9
|
+
this.reason = 'Failed to connect to database';
|
10
10
|
Object.setPrototypeOf(this, DatabaseConnectionError.prototype);
|
11
11
|
}
|
12
12
|
serializeErrors() {
|
@@ -9,7 +9,7 @@ class NotAuthorizedError extends custom_error_1.CustomError {
|
|
9
9
|
Object.setPrototypeOf(this, NotAuthorizedError.prototype);
|
10
10
|
}
|
11
11
|
serializeErrors() {
|
12
|
-
return [{ message:
|
12
|
+
return [{ message: 'Not authorized' }];
|
13
13
|
}
|
14
14
|
}
|
15
15
|
exports.NotAuthorizedError = NotAuthorizedError;
|
@@ -9,7 +9,7 @@ class NotFoundError extends custom_error_1.CustomError {
|
|
9
9
|
Object.setPrototypeOf(this, NotFoundError.prototype);
|
10
10
|
}
|
11
11
|
serializeErrors() {
|
12
|
-
return [{ message:
|
12
|
+
return [{ message: 'Not Found' }];
|
13
13
|
}
|
14
14
|
}
|
15
15
|
exports.NotFoundError = NotFoundError;
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { ValidationError } from
|
2
|
-
import { CustomError } from
|
1
|
+
import { ValidationError } from 'express-validator';
|
2
|
+
import { CustomError } from './custom-error';
|
3
3
|
export declare class RequestValidationError extends CustomError {
|
4
4
|
errors: ValidationError[];
|
5
5
|
statusCode: number;
|
@@ -12,7 +12,7 @@ class RequestValidationError extends custom_error_1.CustomError {
|
|
12
12
|
}
|
13
13
|
serializeErrors() {
|
14
14
|
return this.errors
|
15
|
-
.filter((error) => error.type ===
|
15
|
+
.filter((error) => error.type === 'field')
|
16
16
|
.map((error) => {
|
17
17
|
return { message: error.msg, field: error.path };
|
18
18
|
});
|
package/build/index.d.ts
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
export * from
|
2
|
-
export * from
|
3
|
-
export * from
|
4
|
-
export * from
|
5
|
-
export * from
|
6
|
-
export * from
|
7
|
-
export * from
|
8
|
-
export * from
|
9
|
-
export * from
|
10
|
-
export * from
|
1
|
+
export * from './errors/bad-request-error';
|
2
|
+
export * from './errors/custom-error';
|
3
|
+
export * from './errors/database-connection-error';
|
4
|
+
export * from './errors/not-authorized-error';
|
5
|
+
export * from './errors/not-found-error';
|
6
|
+
export * from './errors/request-validation-error';
|
7
|
+
export * from './middlewares/current-user';
|
8
|
+
export * from './middlewares/error-handler';
|
9
|
+
export * from './middlewares/require-auth';
|
10
|
+
export * from './middlewares/validate-request';
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Request, Response, NextFunction } from
|
1
|
+
import { Request, Response, NextFunction } from 'express';
|
2
2
|
export declare const errorHandler: (err: Error, req: Request, res: Response, next: NextFunction) => void;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Request, Response, NextFunction } from
|
1
|
+
import { Request, Response, NextFunction } from 'express';
|
2
2
|
export declare const requireAuth: (req: Request, res: Response, next: NextFunction) => void;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Request, Response, NextFunction } from
|
1
|
+
import { Request, Response, NextFunction } from 'express';
|
2
2
|
export declare const validateRequest: (req: Request, res: Response, next: NextFunction) => void;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@cs-tickets/common",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.4",
|
4
4
|
"description": "",
|
5
5
|
"main": "./build/index.js",
|
6
6
|
"types": "./build/index.d.ts",
|
@@ -21,10 +21,10 @@
|
|
21
21
|
},
|
22
22
|
"dependencies": {
|
23
23
|
"@types/cookie-session": "^2.0.49",
|
24
|
-
"@types/express": "^
|
24
|
+
"@types/express": "^4.17.21",
|
25
25
|
"@types/jsonwebtoken": "^9.0.10",
|
26
26
|
"cookie-session": "^2.1.0",
|
27
|
-
"express": "^
|
27
|
+
"express": "^4.18.2",
|
28
28
|
"express-validator": "^7.2.1",
|
29
29
|
"jsonwebtoken": "^9.0.2"
|
30
30
|
}
|