@ajayjbtickets/common 1.0.5 → 1.0.8
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/config/config.d.ts +2 -2
- package/dist/config/config.js +1 -2
- package/dist/config/config.js.map +1 -1
- package/dist/constants/environments.d.ts +1 -2
- package/dist/constants/environments.js +2 -2
- package/dist/constants/environments.js.map +1 -1
- package/dist/core/ApiError.js +3 -6
- package/dist/core/ApiError.js.map +1 -1
- package/dist/core/Logger.d.ts +1 -2
- package/dist/core/Logger.js +2 -2
- package/dist/core/Logger.js.map +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.js +10 -10
- package/dist/middlewares/schemaValidator.d.ts +1 -2
- package/dist/middlewares/schemaValidator.js +2 -1
- package/dist/middlewares/schemaValidator.js.map +1 -1
- package/dist/middlewares/verifyToken.d.ts +1 -2
- package/dist/middlewares/verifyToken.js +4 -3
- package/dist/middlewares/verifyToken.js.map +1 -1
- package/dist/services/jwt.service.d.ts +1 -2
- package/dist/services/jwt.service.js +2 -1
- package/dist/services/jwt.service.js.map +1 -1
- package/dist/services/password.service.d.ts +1 -2
- package/dist/services/password.service.js +2 -1
- package/dist/services/password.service.js.map +1 -1
- package/dist/utils/asyncHandler.d.ts +2 -2
- package/dist/utils/asyncHandler.js +2 -1
- package/dist/utils/asyncHandler.js.map +1 -1
- package/package.json +1 -1
package/dist/config/config.d.ts
CHANGED
package/dist/config/config.js
CHANGED
|
@@ -20,6 +20,5 @@ const getSanitizedConfig = (config) => {
|
|
|
20
20
|
return config;
|
|
21
21
|
};
|
|
22
22
|
const config = getConfig();
|
|
23
|
-
|
|
24
|
-
exports.sanitizedConfig = sanitizedConfig;
|
|
23
|
+
exports.sanitizedConfig = getSanitizedConfig(config);
|
|
25
24
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":";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G,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,eAAe,GAAG,gBAAgB,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;AACd,QAAA,eAAe,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
exports.ENVIRONMENTS = void 0;
|
|
4
|
+
exports.ENVIRONMENTS = {
|
|
4
5
|
production: "production",
|
|
5
6
|
development: "development",
|
|
6
7
|
testing: "testing",
|
|
7
8
|
};
|
|
8
|
-
exports.default = ENVIRONMENTS;
|
|
9
9
|
//# sourceMappingURL=environments.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environments.js","sourceRoot":"","sources":["../../src/constants/environments.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"environments.js","sourceRoot":"","sources":["../../src/constants/environments.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B,UAAU,EAAE,YAAY;IACxB,WAAW,EAAE,aAAa;IAC1B,OAAO,EAAE,SAAS;CACnB,CAAC"}
|
package/dist/core/ApiError.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.ForbiddenError = exports.BadRequestError = exports.NoDataError = exports.NoEntryError = exports.NotFoundError = exports.InternalError = exports.AccessTokenError = exports.AuthFailureError = exports.TokenExpiredError = exports.BadTokenError = exports.ApiError = exports.ErrorType = void 0;
|
|
7
4
|
const ApiResponse_1 = require("@/core/ApiResponse");
|
|
8
5
|
const config_1 = require("@/config/config");
|
|
9
|
-
const environments_1 =
|
|
6
|
+
const environments_1 = require("@/constants/environments");
|
|
10
7
|
var ErrorType;
|
|
11
8
|
(function (ErrorType) {
|
|
12
9
|
ErrorType["BAD_TOKEN"] = "BadTokenError";
|
|
@@ -60,7 +57,7 @@ class ApiError extends Error {
|
|
|
60
57
|
default:
|
|
61
58
|
let messsage = err.message;
|
|
62
59
|
messsage =
|
|
63
|
-
config_1.sanitizedConfig.ENVIRONMENT !== environments_1.
|
|
60
|
+
config_1.sanitizedConfig.ENVIRONMENT !== environments_1.ENVIRONMENTS.production
|
|
64
61
|
? messsage
|
|
65
62
|
: "Something went wrong!";
|
|
66
63
|
new ApiResponse_1.InternalErrorResponse(messsage, err.errors).send(res);
|
|
@@ -96,7 +93,7 @@ exports.AccessTokenError = AccessTokenError;
|
|
|
96
93
|
class InternalError extends ApiError {
|
|
97
94
|
constructor(message = "Internal error", errors = []) {
|
|
98
95
|
message =
|
|
99
|
-
config_1.sanitizedConfig.ENVIRONMENT !== environments_1.
|
|
96
|
+
config_1.sanitizedConfig.ENVIRONMENT !== environments_1.ENVIRONMENTS.production
|
|
100
97
|
? message
|
|
101
98
|
: "Something went wrong!";
|
|
102
99
|
super(ErrorType.INTERNAL, message, errors);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiError.js","sourceRoot":"","sources":["../../src/core/ApiError.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ApiError.js","sourceRoot":"","sources":["../../src/core/ApiError.ts"],"names":[],"mappings":";;;AAEA,oDAO4B;AAC5B,4CAAkD;AAClD,2DAAwD;AAExD,IAAY,SAWX;AAXD,WAAY,SAAS;IACnB,wCAA2B,CAAA;IAC3B,gDAAmC,CAAA;IACnC,8CAAi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kB,aAAa,EAAE,SAA4B,EAAE;QACzE,KAAK,CAAC,SAAS,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC;CACF;AAJD,0CAIC;AAED,MAAa,cAAe,SAAQ,QAAQ;IAC1C,YACE,UAAkB,mBAAmB,EACrC,SAA4B,EAAE;QAE9B,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC9C,CAAC;CACF;AAPD,wCAOC"}
|
package/dist/core/Logger.d.ts
CHANGED
package/dist/core/Logger.js
CHANGED
|
@@ -36,6 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.logger = void 0;
|
|
39
40
|
const winston_1 = __importStar(require("winston"));
|
|
40
41
|
const fs_1 = __importDefault(require("fs"));
|
|
41
42
|
const path_1 = __importDefault(require("path"));
|
|
@@ -65,10 +66,9 @@ const consoleTransport = new winston_1.default.transports.Console({
|
|
|
65
66
|
format: "YYYY-MM-DD hh:mm:ss.SSS A",
|
|
66
67
|
}), winston_1.format.align(), winston_1.format.printf((info) => `[${info.timestamp}] ${info.level}: ${info.message}`)),
|
|
67
68
|
});
|
|
68
|
-
|
|
69
|
+
exports.logger = winston_1.default.createLogger({
|
|
69
70
|
transports: [consoleTransport, logfileRotateTransport],
|
|
70
71
|
exceptionHandlers: [logfileRotateTransport],
|
|
71
72
|
exitOnError: false,
|
|
72
73
|
});
|
|
73
|
-
exports.default = logger;
|
|
74
74
|
//# sourceMappingURL=Logger.js.map
|
package/dist/core/Logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Logger.js","sourceRoot":"","sources":["../../src/core/Logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Logger.js","sourceRoot":"","sources":["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C,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,OAAO,EAAE,CAC/D,CACF;CACF,CAAC,CAAC;AAEU,QAAA,MAAM,GAAG,iBAAO,CAAC,YAAY,CAAC;IACzC,UAAU,EAAE,CAAC,gBAAgB,EAAE,sBAAsB,CAAC;IACtD,iBAAiB,EAAE,CAAC,sBAAsB,CAAC;IAC3C,WAAW,EAAE,KAAK;CACnB,CAAC,CAAC"}
|
package/dist/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 "./constants/environments";
|
|
2
|
+
export * from "./core/ApiError";
|
|
3
|
+
export * from "./core/ApiResponse";
|
|
4
|
+
export * from "./core/Logger";
|
|
5
|
+
export * from "./middlewares/schemaValidator";
|
|
6
|
+
export * from "./middlewares/verifyToken";
|
|
7
|
+
export * from "./services/jwt.service";
|
|
8
|
+
export * from "./services/password.service";
|
|
9
|
+
export * from "./types/validation";
|
|
10
|
+
export * from "./utils/asyncHandler";
|
package/dist/index.js
CHANGED
|
@@ -14,14 +14,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("
|
|
18
|
-
__exportStar(require("
|
|
19
|
-
__exportStar(require("
|
|
20
|
-
__exportStar(require("
|
|
21
|
-
__exportStar(require("
|
|
22
|
-
__exportStar(require("
|
|
23
|
-
__exportStar(require("
|
|
24
|
-
__exportStar(require("
|
|
25
|
-
__exportStar(require("
|
|
26
|
-
__exportStar(require("
|
|
17
|
+
__exportStar(require("./constants/environments"), exports);
|
|
18
|
+
__exportStar(require("./core/ApiError"), exports);
|
|
19
|
+
__exportStar(require("./core/ApiResponse"), exports);
|
|
20
|
+
__exportStar(require("./core/Logger"), exports);
|
|
21
|
+
__exportStar(require("./middlewares/schemaValidator"), exports);
|
|
22
|
+
__exportStar(require("./middlewares/verifyToken"), exports);
|
|
23
|
+
__exportStar(require("./services/jwt.service"), exports);
|
|
24
|
+
__exportStar(require("./services/password.service"), exports);
|
|
25
|
+
__exportStar(require("./types/validation"), exports);
|
|
26
|
+
__exportStar(require("./utils/asyncHandler"), exports);
|
|
27
27
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Request, Response, NextFunction } from "express";
|
|
2
2
|
import { ZodSchema } from "zod";
|
|
3
3
|
import { ValidationSource } from "@/types/validation";
|
|
4
|
-
declare const schemaValidator: (type: ValidationSource, schema: ZodSchema) => (req: Request, res: Response, next: NextFunction) => void;
|
|
5
|
-
export default schemaValidator;
|
|
4
|
+
export declare const schemaValidator: (type: ValidationSource, schema: ZodSchema) => (req: Request, res: Response, next: NextFunction) => void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.schemaValidator = void 0;
|
|
3
4
|
const ApiError_1 = require("@/core/ApiError");
|
|
4
5
|
const schemaValidator = (type, schema) => {
|
|
5
6
|
return (req, res, next) => {
|
|
@@ -16,5 +17,5 @@ const schemaValidator = (type, schema) => {
|
|
|
16
17
|
}
|
|
17
18
|
};
|
|
18
19
|
};
|
|
19
|
-
exports.
|
|
20
|
+
exports.schemaValidator = schemaValidator;
|
|
20
21
|
//# sourceMappingURL=schemaValidator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaValidator.js","sourceRoot":"","sources":["../../src/middlewares/schemaValidator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schemaValidator.js","sourceRoot":"","sources":["../../src/middlewares/schemaValidator.ts"],"names":[],"mappings":";;;AAGA,8CAAkD;AAG3C,MAAM,eAAe,GAAG,CAAC,IAAsB,EAAE,MAAiB,EAAE,EAAE;IAC3E,OAAO,CAAC,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;QACzD,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;QAE3C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,WAAW,CAAC,CAAC,GAAG,CACnE,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;gBACjB,KAAK,EAAE,GAAG;gBACV,OAAO,EAAE,KAAK;aACf,CAAC,CACH,CAAC;YACF,IAAI,CAAC,IAAI,0BAAe,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,IAAI,EAAE,CAAC;QACT,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAhBW,QAAA,eAAe,mBAgB1B"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { Request, Response, NextFunction } from "express";
|
|
2
|
-
declare const verifyToken: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
3
|
-
export default verifyToken;
|
|
2
|
+
export declare const verifyToken: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
@@ -3,16 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.verifyToken = void 0;
|
|
6
7
|
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
7
8
|
const ApiError_1 = require("@/core/ApiError");
|
|
8
|
-
const jwt_service_1 =
|
|
9
|
+
const jwt_service_1 = require("@/services/jwt.service");
|
|
9
10
|
const verifyToken = async (req, res, next) => {
|
|
10
11
|
try {
|
|
11
12
|
const { token } = req?.session;
|
|
12
13
|
if (!token) {
|
|
13
14
|
next(new ApiError_1.BadTokenError("Authentication token is missing"));
|
|
14
15
|
}
|
|
15
|
-
const decoded = jwt_service_1.
|
|
16
|
+
const decoded = jwt_service_1.JwtService.verify(token);
|
|
16
17
|
req.user = decoded;
|
|
17
18
|
next();
|
|
18
19
|
}
|
|
@@ -28,5 +29,5 @@ const verifyToken = async (req, res, next) => {
|
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
};
|
|
31
|
-
exports.
|
|
32
|
+
exports.verifyToken = verifyToken;
|
|
32
33
|
//# sourceMappingURL=verifyToken.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyToken.js","sourceRoot":"","sources":["../../src/middlewares/verifyToken.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"verifyToken.js","sourceRoot":"","sources":["../../src/middlewares/verifyToken.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAwC;AAGxC,8CAAmE;AACnE,wDAAgE;AAEzD,MAAM,WAAW,GAAG,KAAK,EAC9B,GAAY,EACZ,GAAa,EACb,IAAkB,EAClB,EAAE;IACF,IAAI,CAAC;QACH,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,EAAE,OAAO,CAAC;QAC/B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,IAAI,CAAC,IAAI,wBAAa,CAAC,iCAAiC,CAAC,CAAC,CAAC;QAC7D,CAAC;QAED,MAAM,OAAO,GAAG,wBAAU,CAAC,MAAM,CAAC,KAAK,CAAe,CAAC;QAEvD,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC;QACnB,IAAI,EAAE,CAAC;IACT,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,sBAAY,CAAC,iBAAiB,EAAE,CAAC;YACpD,IAAI,CAAC,IAAI,4BAAiB,EAAE,CAAC,CAAC;QAChC,CAAC;aAAM,IAAI,KAAK,YAAY,sBAAY,CAAC,iBAAiB,EAAE,CAAC;YAC3D,IAAI,CAAC,IAAI,wBAAa,EAAE,CAAC,CAAC;QAC5B,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,wBAAa,EAAE,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAxBW,QAAA,WAAW,eAwBtB"}
|
|
@@ -3,9 +3,8 @@ export interface JwtPayload {
|
|
|
3
3
|
_id: string;
|
|
4
4
|
email: string;
|
|
5
5
|
}
|
|
6
|
-
declare class JwtService {
|
|
6
|
+
export declare class JwtService {
|
|
7
7
|
static sign(payload: string | Buffer | object, signOptions?: SignOptions): string;
|
|
8
8
|
static verify(token: string, verifyOptions?: VerifyOptions): string | jsonwebtoken.Jwt | jsonwebtoken.JwtPayload;
|
|
9
9
|
static generatePayload<T extends JwtPayload>(user: T): T;
|
|
10
10
|
}
|
|
11
|
-
export default JwtService;
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.JwtService = void 0;
|
|
6
7
|
const config_1 = require("@/config/config");
|
|
7
8
|
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
8
9
|
class JwtService {
|
|
@@ -21,5 +22,5 @@ class JwtService {
|
|
|
21
22
|
};
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
|
-
exports.
|
|
25
|
+
exports.JwtService = JwtService;
|
|
25
26
|
//# sourceMappingURL=jwt.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jwt.service.js","sourceRoot":"","sources":["../../src/services/jwt.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"jwt.service.js","sourceRoot":"","sources":["../../src/services/jwt.service.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAkD;AAClD,gEAAwE;AAOxE,MAAa,UAAU;IACrB,MAAM,CAAC,IAAI,CACT,OAAiC,EACjC,cAA2B,EAAE;QAE7B,MAAM,KAAK,GAAG,sBAAY,CAAC,IAAI,CAC7B,OAAO,EACP,wBAAe,CAAC,OAAO,EACvB,WAAW,CACZ,CAAC;QACF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,KAAa,EAAE,aAA6B;QACxD,MAAM,OAAO,GAAG,sBAAY,CAAC,MAAM,CACjC,KAAK,EACL,wBAAe,CAAC,OAAO,EACvB,aAAa,CACd,CAAC;QACF,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,CAAC,eAAe,CAAuB,IAAO;QAClD,OAAO;YACL,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE;YACxB,KAAK,EAAE,IAAI,CAAC,KAAK;SACb,CAAC;IACT,CAAC;CACF;AA5BD,gCA4BC"}
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Password = void 0;
|
|
6
7
|
const bcrypt_1 = __importDefault(require("bcrypt"));
|
|
7
8
|
class Password {
|
|
8
9
|
static hashPassword(password, salesRounds) {
|
|
@@ -26,5 +27,5 @@ class Password {
|
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
|
-
exports.
|
|
30
|
+
exports.Password = Password;
|
|
30
31
|
//# sourceMappingURL=password.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"password.service.js","sourceRoot":"","sources":["../../src/services/password.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"password.service.js","sourceRoot":"","sources":["../../src/services/password.service.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,MAAa,QAAQ;IACnB,MAAM,CAAC,YAAY,CAAC,QAAgB,EAAE,WAAmB;QACvD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,gBAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,EAAE,UAAU,GAAG,EAAE,IAAI;gBACpD,IAAI,GAAG,EAAE,CAAC;oBACR,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACtB,CAAC;gBACD,OAAO,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,eAAe,CACpB,QAAgB,EAChB,cAAsB;QAEtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,gBAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,cAAc,EAAE,UAAU,GAAG,EAAE,MAAM;gBAC5D,IAAI,GAAG,EAAE,CAAC;oBACR,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACtB,CAAC;gBACD,OAAO,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAzBD,4BAyBC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Request, Response, NextFunction } from "express";
|
|
2
2
|
type AsyncFunction = (req: Request, res: Response, next: NextFunction) => Promise<any>;
|
|
3
|
-
declare const asyncHandler: (execution: AsyncFunction) => (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
4
|
-
export
|
|
3
|
+
export declare const asyncHandler: (execution: AsyncFunction) => (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
4
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asyncHandler = void 0;
|
|
3
4
|
const asyncHandler = (execution) => async (req, res, next) => {
|
|
4
5
|
try {
|
|
5
6
|
await execution(req, res, next);
|
|
@@ -8,5 +9,5 @@ const asyncHandler = (execution) => async (req, res, next) => {
|
|
|
8
9
|
next(err);
|
|
9
10
|
}
|
|
10
11
|
};
|
|
11
|
-
exports.
|
|
12
|
+
exports.asyncHandler = asyncHandler;
|
|
12
13
|
//# sourceMappingURL=asyncHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asyncHandler.js","sourceRoot":"","sources":["../../src/utils/asyncHandler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"asyncHandler.js","sourceRoot":"","sources":["../../src/utils/asyncHandler.ts"],"names":[],"mappings":";;;AAQO,MAAM,YAAY,GACvB,CAAC,SAAwB,EAAE,EAAE,CAC7B,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;IACxD,IAAI,CAAC;QACH,MAAM,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,GAAG,CAAC,CAAC;IACZ,CAAC;AACH,CAAC,CAAC;AARS,QAAA,YAAY,gBAQrB"}
|