cqrs-boilerplate-code 1.0.1 → 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.
- package/dist/common-infra/common-infra.module.d.ts +2 -0
- package/dist/common-infra/common-infra.module.js +15 -7
- package/dist/common-infra/common-infra.module.js.map +1 -1
- package/dist/common-infra/database/database.module.d.ts +2 -0
- package/dist/common-infra/database/database.module.js +18 -12
- package/dist/common-infra/database/database.module.js.map +1 -1
- package/dist/common-infra/index.d.ts +2 -0
- package/dist/{middleware → common-infra}/index.js +2 -5
- package/dist/common-infra/index.js.map +1 -0
- package/dist/core-common/core-common.module.d.ts +2 -0
- package/dist/core-common/core-common.module.js +16 -8
- package/dist/core-common/core-common.module.js.map +1 -1
- package/dist/core-common/index.d.ts +12 -5
- package/dist/core-common/index.js +9 -2
- package/dist/core-common/index.js.map +1 -1
- package/dist/core-common/logger/logger.interface.d.ts +7 -0
- package/dist/core-common/logger/logger.interface.js +3 -0
- package/dist/core-common/logger/logger.interface.js.map +1 -0
- package/dist/core-common/logger/logger.module.d.ts +4 -0
- package/dist/core-common/logger/logger.module.js +20 -8
- package/dist/core-common/logger/logger.module.js.map +1 -1
- package/dist/core-common/logger/{index.js → logger.service.js} +1 -1
- package/dist/core-common/logger/logger.service.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -7
- package/src/common-infra/common-infra.module.ts +17 -0
- package/src/common-infra/database/database.module.ts +23 -0
- package/src/common-infra/database/typeorm.config.ts +18 -0
- package/src/common-infra/index.ts +2 -0
- package/src/core-common/constant/app.constant.ts +2 -0
- package/src/core-common/core-common.module.ts +19 -0
- package/src/core-common/error/custom-error/already-exists.error.ts +17 -0
- package/src/core-common/error/custom-error/bad-request.error.ts +8 -0
- package/src/core-common/error/custom-error/conflict.error.ts +17 -0
- package/src/core-common/error/custom-error/custom-validation-error.ts +9 -0
- package/src/core-common/error/custom-error/forbidden.error.ts +8 -0
- package/src/core-common/error/custom-error/internal-server.error.ts +11 -0
- package/src/core-common/error/custom-error/not-found.error.ts +8 -0
- package/src/core-common/error/custom-error/service-unavailable.error.ts +8 -0
- package/src/core-common/error/custom-error/unauthorized.error.ts +8 -0
- package/src/core-common/error/custom-error/unprocess-entity.error.ts +8 -0
- package/src/core-common/error/custom-error/validation.error.ts +8 -0
- package/src/core-common/error/generic.error.ts +31 -0
- package/src/core-common/error/index.ts +10 -0
- package/src/core-common/index.ts +13 -0
- package/src/core-common/logger/index.ts +3 -0
- package/src/core-common/logger/logger.interface.ts +8 -0
- package/src/core-common/logger/logger.module.ts +23 -0
- package/src/core-common/logger/logger.service.ts +175 -0
- package/src/core-common/response-model/generic-error-response.model.ts +44 -0
- package/src/core-common/response-model/generic-success-response.model.ts +25 -0
- package/src/core-common/result-model/result.ts +38 -0
- package/tsconfig.build.json +10 -0
- package/tsconfig.json +58 -0
- package/dist/core-common/logger/index.js.map +0 -1
- package/dist/core-common/logger/logger.provider.d.ts +0 -2
- package/dist/core-common/logger/logger.provider.js +0 -9
- package/dist/core-common/logger/logger.provider.js.map +0 -1
- package/dist/middleware/async-storage.middleware.d.ts +0 -8
- package/dist/middleware/async-storage.middleware.js +0 -38
- package/dist/middleware/async-storage.middleware.js.map +0 -1
- package/dist/middleware/filter/global-exeception.filter.d.ts +0 -5
- package/dist/middleware/filter/global-exeception.filter.js +0 -98
- package/dist/middleware/filter/global-exeception.filter.js.map +0 -1
- package/dist/middleware/index.d.ts +0 -5
- package/dist/middleware/index.js.map +0 -1
- package/dist/middleware/interceptor/response-handler.d.ts +0 -9
- package/dist/middleware/interceptor/response-handler.js +0 -59
- package/dist/middleware/interceptor/response-handler.js.map +0 -1
- package/dist/middleware/platform-auth.middleware.d.ts +0 -5
- package/dist/middleware/platform-auth.middleware.js +0 -22
- package/dist/middleware/platform-auth.middleware.js.map +0 -1
- package/dist/middleware/utils/http-response.formatter.d.ts +0 -11
- package/dist/middleware/utils/http-response.formatter.js +0 -78
- package/dist/middleware/utils/http-response.formatter.js.map +0 -1
- /package/dist/core-common/logger/{index.d.ts → logger.service.d.ts} +0 -0
package/tsconfig.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Language & Environment */
|
|
4
|
+
"target": "es2024",
|
|
5
|
+
"lib": [
|
|
6
|
+
"es2024"
|
|
7
|
+
],
|
|
8
|
+
"module": "commonjs",
|
|
9
|
+
"moduleResolution": "node",
|
|
10
|
+
"types": [
|
|
11
|
+
"node"
|
|
12
|
+
],
|
|
13
|
+
/* Output */
|
|
14
|
+
"outDir": "./dist",
|
|
15
|
+
"declaration": true,
|
|
16
|
+
"sourceMap": true,
|
|
17
|
+
"removeComments": true,
|
|
18
|
+
"incremental": true,
|
|
19
|
+
/* Decorators (NestJS) */
|
|
20
|
+
"emitDecoratorMetadata": true,
|
|
21
|
+
"experimentalDecorators": true,
|
|
22
|
+
/* Module Interop */
|
|
23
|
+
"esModuleInterop": true,
|
|
24
|
+
"allowSyntheticDefaultImports": true,
|
|
25
|
+
"resolveJsonModule": true,
|
|
26
|
+
/* Base Paths */
|
|
27
|
+
"baseUrl": ".",
|
|
28
|
+
"paths": {
|
|
29
|
+
"@routes/*": [
|
|
30
|
+
"src/routes/*"
|
|
31
|
+
],
|
|
32
|
+
"@core-common/*": [
|
|
33
|
+
"src/core-common/*"
|
|
34
|
+
],
|
|
35
|
+
"@common-infra/*": [
|
|
36
|
+
"src/common-infra/*"
|
|
37
|
+
],
|
|
38
|
+
"@middleware/*": [
|
|
39
|
+
"src/middleware/*"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
/* Type Safety (non-strict by design) */
|
|
43
|
+
"strict": false,
|
|
44
|
+
"strictNullChecks": false,
|
|
45
|
+
"strictPropertyInitialization": false,
|
|
46
|
+
"noImplicitAny": false,
|
|
47
|
+
"noImplicitReturns": false,
|
|
48
|
+
"strictBindCallApply": true,
|
|
49
|
+
/* Code Quality */
|
|
50
|
+
"forceConsistentCasingInFileNames": true,
|
|
51
|
+
"noFallthroughCasesInSwitch": true,
|
|
52
|
+
"noUnusedLocals": true,
|
|
53
|
+
"noUnusedParameters": true,
|
|
54
|
+
/* Performance */
|
|
55
|
+
"skipLibCheck": true,
|
|
56
|
+
"inlineSources": true
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core-common/logger/index.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA0C;AAI1C,IAAK,YAKJ;AALD,WAAK,YAAY;IACf,oCAAoB,CAAA;IACpB,+BAAe,CAAA;IACf,mCAAmB,CAAA;IACnB,+BAAe,CAAA;AACjB,CAAC,EALI,YAAY,KAAZ,YAAY,QAKhB;AAeD,MAAa,aAAa;IACP,MAAM,CAAS;IACf,aAAa,CAAS;IACtB,gBAAgB,CAAS;IACzB,aAAa,CAAS;IAEvC,YAAY,WAAmB,OAAO;QACpC,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC;QAC/B,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,UAAU,CAAC;QAClE,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,UAAU,CAAC;QAC/D,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC1C,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IAID,GAAG,CAAC,OAAe,EAAE,QAAsB;QACzC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,QAAsB;QAC3C,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAA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AAC,CAAC;IACJ,CAAC;CACF;AAtJD,sCAsJC","sourcesContent":["import winston, { Logger } from \"winston\";\n\n/* ---------------------------------- Types --------------------------------- */\n\nenum SeverityText {\n INFO = \"Information\",\n DEBUG = \"Debug\",\n WARNING = \"Warning\",\n ERROR = \"Error\",\n}\n\ntype LogMetadata = {\n ClassName?: string;\n MethodName?: string;\n};\n\nexport type OrgContext = {\n orgId?: string;\n orgFid?: string;\n userId?: string;\n};\n\n/* --------------------------------- Service -------------------------------- */\n\nexport class LoggerService {\n private readonly logger: Logger;\n private readonly deploymentEnv: string;\n private readonly hostImageVersion: string;\n private readonly otelAgentHost: string;\n\n constructor(logLevel: string = \"debug\") {\n this.deploymentEnv = \"rls-dev\";\n this.hostImageVersion = process.env.SERVICE_VERSION ?? \"202501.1\";\n this.otelAgentHost = process.env.OTEL_AGENT_HOST ?? \"10.0.0.1\";\n this.logger = this.createLogger(logLevel);\n this.overrideConsole();\n }\n\n /* ------------------------------- Public API ------------------------------- */\n\n log(message: string, metadata?: LogMetadata) {\n this.write(\"info\", SeverityText.INFO, message, metadata);\n }\n\n debug(message: string, metadata?: LogMetadata) {\n this.write(\"debug\", SeverityText.DEBUG, message, metadata);\n }\n\n warn(message: string, metadata?: LogMetadata) {\n this.write(\"warn\", SeverityText.WARNING, message, metadata);\n }\n\n error(message: string, metadata?: LogMetadata, error?: Error) {\n this.write(\"error\", SeverityText.ERROR, message, metadata, error);\n }\n\n /* ------------------------------ Logger Core ------------------------------ */\n\n private write(\n level: keyof Logger,\n severity: SeverityText,\n message: string,\n metadata: LogMetadata = {},\n error?: Error,\n ) {\n const body = {\n SeverityText: severity,\n ...metadata,\n ...(error && {\n ErrorMessage: error.message,\n StackTrace: error.stack,\n }),\n };\n\n this.logger[level](this.redactSecrets(message), body);\n }\n\n private createLogger(level: string): Logger {\n return winston.createLogger({\n level,\n levels: winston.config.npm.levels,\n format: winston.format.combine(\n winston.format.timestamp({ format: \"YYYY-MM-DD HH:mm:ss\" }),\n winston.format.printf(({ level, message, timestamp, ...meta }) =>\n JSON.stringify({\n message: this.safeStringify(message),\n attributes: this.buildAttributes(level),\n timestamp: timestamp,\n ...this.cleanMeta(meta),\n }),\n ),\n ),\n transports: [new winston.transports.Console()],\n });\n }\n\n /* ------------------------------- Context -------------------------------- */\n\n private buildAttributes(level: string) {\n return {\n \"service.image.version\": this.hostImageVersion,\n \"deployment.environment\": this.deploymentEnv,\n \"otel.agent.host\": this.otelAgentHost,\n \"service.log.level\": level,\n };\n }\n\n /* ------------------------------- Helpers -------------------------------- */\n\n private cleanMeta(meta: Record<string, unknown>) {\n return Object.fromEntries(\n Object.entries(meta).filter(\n ([_, value]) => value !== undefined && value !== \"None\",\n ),\n );\n }\n\n private safeStringify(input: unknown): string {\n try {\n return typeof input === \"string\"\n ? input\n : JSON.stringify(input, this.circularReplacer());\n } catch {\n return \"[Unserializable Object]\";\n }\n }\n\n private circularReplacer() {\n const seen = new WeakSet();\n return (_: string, value: any) => {\n if (typeof value === \"object\" && value !== null) {\n if (seen.has(value)) return \"[Circular]\";\n seen.add(value);\n }\n return value;\n };\n }\n\n /* ----------------------------- Redaction -------------------------------- */\n\n private redactSecrets(message: string): string {\n const patterns = [\n {\n name: \"JWT\",\n regex: /eyJ[a-zA-Z0-9-_]+\\.[a-zA-Z0-9-_]+\\.[a-zA-Z0-9-_]+/g,\n visible: 10,\n },\n {\n name: \"BEARER\",\n regex: /Bearer\\s+eyJ[A-Za-z0-9\\-._~+/]+=*/gi,\n visible: 15,\n },\n { name: \"API_KEY\", regex: /\\b[A-Za-z0-9]{32,}\\b/g, visible: 8 },\n { name: \"AWS_SECRET\", regex: /AKIA[0-9A-Z]{16}/g, visible: 8 },\n ];\n\n return patterns.reduce((msg, { regex, visible, name }) => {\n return msg.replace(\n regex,\n (m) => `${m.slice(0, visible)}...[REDACTED_${name}]`,\n );\n }, message);\n }\n\n /* --------------------------- Console Override ---------------------------- */\n\n private overrideConsole() {\n const blocked = [\"NodeSDK\", \"AuthToken\"];\n console.log = (...args: unknown[]) => {\n const msg = args.map(String).join(\" \");\n if (blocked.some((k) => msg.includes(k))) return;\n this.log(msg);\n };\n }\n}\n"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LoggerProvider = void 0;
|
|
4
|
-
const _1 = require(".");
|
|
5
|
-
exports.LoggerProvider = {
|
|
6
|
-
provide: _1.LoggerService,
|
|
7
|
-
useClass: _1.LoggerService,
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=logger.provider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.provider.js","sourceRoot":"","sources":["../../../src/core-common/logger/logger.provider.ts"],"names":[],"mappings":";;;AACA,wBAAkC;AAErB,QAAA,cAAc,GAAa;IACtC,OAAO,EAAE,gBAAa;IACtB,QAAQ,EAAE,gBAAa;CACxB,CAAC","sourcesContent":["import { Provider } from \"@nestjs/common\";\nimport { LoggerService } from \".\";\n\nexport const LoggerProvider: Provider = {\n provide: LoggerService,\n useClass: LoggerService,\n};\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { NestMiddleware } from "@nestjs/common";
|
|
2
|
-
import { Request, Response, NextFunction } from "express";
|
|
3
|
-
export declare class AsyncStorageMiddleware implements NestMiddleware {
|
|
4
|
-
private static storage;
|
|
5
|
-
static get(key: string): any;
|
|
6
|
-
static set(key: string, value: any): void;
|
|
7
|
-
use(req: Request, _res: Response, next: NextFunction): void;
|
|
8
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var AsyncStorageMiddleware_1;
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.AsyncStorageMiddleware = void 0;
|
|
11
|
-
const common_1 = require("@nestjs/common");
|
|
12
|
-
const async_hooks_1 = require("async_hooks");
|
|
13
|
-
let AsyncStorageMiddleware = class AsyncStorageMiddleware {
|
|
14
|
-
static { AsyncStorageMiddleware_1 = this; }
|
|
15
|
-
static storage = new async_hooks_1.AsyncLocalStorage();
|
|
16
|
-
static get(key) {
|
|
17
|
-
const store = AsyncStorageMiddleware_1.storage.getStore();
|
|
18
|
-
return store?.get(key);
|
|
19
|
-
}
|
|
20
|
-
static set(key, value) {
|
|
21
|
-
const store = AsyncStorageMiddleware_1.storage.getStore();
|
|
22
|
-
if (store) {
|
|
23
|
-
store.set(key, value);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
use(req, _res, next) {
|
|
27
|
-
const store = new Map();
|
|
28
|
-
store.set("request", req);
|
|
29
|
-
AsyncStorageMiddleware_1.storage.run(store, () => {
|
|
30
|
-
next();
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
exports.AsyncStorageMiddleware = AsyncStorageMiddleware;
|
|
35
|
-
exports.AsyncStorageMiddleware = AsyncStorageMiddleware = AsyncStorageMiddleware_1 = __decorate([
|
|
36
|
-
(0, common_1.Injectable)()
|
|
37
|
-
], AsyncStorageMiddleware);
|
|
38
|
-
//# sourceMappingURL=async-storage.middleware.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async-storage.middleware.js","sourceRoot":"","sources":["../../src/middleware/async-storage.middleware.ts"],"names":[],"mappings":";;;;;;;;;;AACA,2CAA4D;AAC5D,6CAAgD;AAIzC,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;;IACzB,MAAM,CAAC,OAAO,GAAG,IAAI,+BAAiB,EAAoB,CAAC;IAEnE,MAAM,CAAC,GAAG,CAAC,GAAW;QACpB,MAAM,KAAK,GAAG,wBAAsB,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACxD,OAAO,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAED,MAAM,CAAC,GAAG,CAAC,GAAW,EAAE,KAAU;QAChC,MAAM,KAAK,GAAG,wBAAsB,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACxD,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IAED,GAAG,CAAC,GAAY,EAAE,IAAc,EAAE,IAAkB;QAClD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAe,CAAC;QACrC,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QAC1B,wBAAsB,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE;YAC7C,IAAI,EAAE,CAAC;QACT,CAAC,CAAC,CAAC;IACL,CAAC;;AArBU,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAU,GAAE;GACA,sBAAsB,CAsBlC","sourcesContent":["// async-storage.middleware.ts\nimport { Injectable, NestMiddleware } from \"@nestjs/common\";\nimport { AsyncLocalStorage } from \"async_hooks\";\nimport { Request, Response, NextFunction } from \"express\";\n\n@Injectable()\nexport class AsyncStorageMiddleware implements NestMiddleware {\n private static storage = new AsyncLocalStorage<Map<string, any>>();\n\n static get(key: string): any {\n const store = AsyncStorageMiddleware.storage.getStore();\n return store?.get(key);\n }\n\n static set(key: string, value: any): void {\n const store = AsyncStorageMiddleware.storage.getStore();\n if (store) {\n store.set(key, value);\n }\n }\n\n use(req: Request, _res: Response, next: NextFunction) {\n const store = new Map<string, any>();\n store.set(\"request\", req);\n AsyncStorageMiddleware.storage.run(store, () => {\n next();\n });\n }\n}\n"]}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.GlobalExceptionHandler = void 0;
|
|
10
|
-
const common_1 = require("@nestjs/common");
|
|
11
|
-
const error_1 = require("../../core-common/error");
|
|
12
|
-
const custom_validation_error_1 = require("../../core-common/error/custom-error/custom-validation-error");
|
|
13
|
-
const result_1 = require("../../core-common/result-model/result");
|
|
14
|
-
let GlobalExceptionHandler = class GlobalExceptionHandler {
|
|
15
|
-
catch(exception, host) {
|
|
16
|
-
const response = host.switchToHttp().getResponse();
|
|
17
|
-
if (exception instanceof result_1.Result) {
|
|
18
|
-
const statusCode = exception.error?.statusCode ?? common_1.HttpStatus.INTERNAL_SERVER_ERROR;
|
|
19
|
-
const payload = {
|
|
20
|
-
statusCode,
|
|
21
|
-
success: false,
|
|
22
|
-
error: {
|
|
23
|
-
code: exception.error?.code ?? "ERROR",
|
|
24
|
-
message: exception.error?.message ?? "An error occurred",
|
|
25
|
-
},
|
|
26
|
-
timestamp: exception.timestamp ?? new Date().toISOString(),
|
|
27
|
-
};
|
|
28
|
-
if (exception.data !== undefined && exception.data !== null) {
|
|
29
|
-
payload.data = exception.data;
|
|
30
|
-
}
|
|
31
|
-
return response.status(statusCode).json(payload);
|
|
32
|
-
}
|
|
33
|
-
if (exception instanceof error_1.GenericError) {
|
|
34
|
-
return response.status(exception.statusCode).json({
|
|
35
|
-
statusCode: exception.statusCode,
|
|
36
|
-
success: false,
|
|
37
|
-
error: {
|
|
38
|
-
code: exception.code,
|
|
39
|
-
message: exception.message,
|
|
40
|
-
},
|
|
41
|
-
timestamp: new Date().toISOString(),
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
if (exception instanceof common_1.HttpException) {
|
|
45
|
-
const status = exception.getStatus();
|
|
46
|
-
const res = exception.getResponse();
|
|
47
|
-
const isValidationPipeError = exception.stack?.includes("ValidationPipe");
|
|
48
|
-
if (isValidationPipeError) {
|
|
49
|
-
const validationErrors = new custom_validation_error_1.CustomValidationError(res);
|
|
50
|
-
return response.status(validationErrors.statusCode).json({
|
|
51
|
-
success: false,
|
|
52
|
-
error: {
|
|
53
|
-
code: validationErrors.code,
|
|
54
|
-
message: validationErrors.message,
|
|
55
|
-
validationError: validationErrors.validationErrors,
|
|
56
|
-
},
|
|
57
|
-
timestamp: new Date().toISOString(),
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
return response.status(status).json({
|
|
61
|
-
statusCode: status,
|
|
62
|
-
success: false,
|
|
63
|
-
error: {
|
|
64
|
-
code: "HTTP_EXCEPTION",
|
|
65
|
-
message: typeof res === "string"
|
|
66
|
-
? res
|
|
67
|
-
: (res.message ?? exception.message),
|
|
68
|
-
},
|
|
69
|
-
timestamp: new Date().toISOString(),
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
if (exception instanceof Error) {
|
|
73
|
-
return response.status(common_1.HttpStatus.INTERNAL_SERVER_ERROR).json({
|
|
74
|
-
statusCode: common_1.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
75
|
-
success: false,
|
|
76
|
-
error: {
|
|
77
|
-
code: exception.name,
|
|
78
|
-
message: exception.message,
|
|
79
|
-
},
|
|
80
|
-
timestamp: new Date().toISOString(),
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
return response.status(common_1.HttpStatus.INTERNAL_SERVER_ERROR).json({
|
|
84
|
-
statusCode: common_1.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
85
|
-
success: false,
|
|
86
|
-
error: {
|
|
87
|
-
code: "UNKNOWN_ERROR",
|
|
88
|
-
message: "Internal server error",
|
|
89
|
-
},
|
|
90
|
-
timestamp: new Date().toISOString(),
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
exports.GlobalExceptionHandler = GlobalExceptionHandler;
|
|
95
|
-
exports.GlobalExceptionHandler = GlobalExceptionHandler = __decorate([
|
|
96
|
-
(0, common_1.Catch)()
|
|
97
|
-
], GlobalExceptionHandler);
|
|
98
|
-
//# sourceMappingURL=global-exeception.filter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"global-exeception.filter.js","sourceRoot":"","sources":["../../../src/middleware/filter/global-exeception.filter.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAMwB;AAExB,mDAAuD;AACvD,0GAAqG;AACrG,kEAA+D;AASxD,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IACjC,KAAK,CAAC,SAAkB,EAAE,IAAmB;QAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC,WAAW,EAAY,CAAC;QAG7D,IAAI,SAAS,YAAY,eAAM,EAAE,CAAC;YAChC,MAAM,UAAU,GACd,SAAS,CAAC,KAAK,EAAE,UAAU,IAAI,mBAAU,CAAC,qBAAqB,CAAC;YAElE,MAAM,OAAO,GAAQ;gBACnB,UAAU;gBACV,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE;oBACL,IAAI,EAAE,SAAS,CAAC,KAAK,EAAE,IAAI,IAAI,OAAO;oBACtC,OAAO,EAAE,SAAS,CAAC,KAAK,EAAE,OAAO,IAA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AAC,CAAC;IACL,CAAC;CACF,CAAA;AAjGY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,cAAK,GAAE;GACK,sBAAsB,CAiGlC","sourcesContent":["import {\n ArgumentsHost,\n Catch,\n ExceptionFilter,\n HttpException,\n HttpStatus,\n} from \"@nestjs/common\";\nimport { Response } from \"express\";\nimport { GenericError } from \"../../core-common/error\";\nimport { CustomValidationError } from \"../../core-common/error/custom-error/custom-validation-error\";\nimport { Result } from \"../../core-common/result-model/result\";\n\n/**\n * Handles and processes exceptions, providing standardized error responses.\n * This global exception handler can be used to catch and respond to exceptions thrown\n * during HTTP requests and format responses accordingly.\n */\n\n@Catch()\nexport class GlobalExceptionHandler implements ExceptionFilter {\n catch(exception: unknown, host: ArgumentsHost) {\n const response = host.switchToHttp().getResponse<Response>();\n\n /* 1️⃣ Domain Result (highest priority) */\n if (exception instanceof Result) {\n const statusCode =\n exception.error?.statusCode ?? HttpStatus.INTERNAL_SERVER_ERROR;\n\n const payload: any = {\n statusCode,\n success: false,\n error: {\n code: exception.error?.code ?? \"ERROR\",\n message: exception.error?.message ?? \"An error occurred\",\n },\n timestamp: exception.timestamp ?? new Date().toISOString(),\n };\n\n if (exception.data !== undefined && exception.data !== null) {\n payload.data = exception.data;\n }\n\n return response.status(statusCode).json(payload);\n }\n\n /* 2️⃣ Custom domain errors */\n if (exception instanceof GenericError) {\n return response.status(exception.statusCode).json({\n statusCode: exception.statusCode,\n success: false,\n error: {\n code: exception.code,\n message: exception.message,\n },\n timestamp: new Date().toISOString(),\n });\n }\n\n /* 3️⃣ NestJS HTTP exceptions */\n if (exception instanceof HttpException) {\n const status = exception.getStatus();\n const res = exception.getResponse();\n\n const isValidationPipeError = exception.stack?.includes(\"ValidationPipe\");\n\n if (isValidationPipeError) {\n const validationErrors = new CustomValidationError(res);\n return response.status(validationErrors.statusCode).json({\n success: false,\n error: {\n code: validationErrors.code,\n message: validationErrors.message,\n validationError: validationErrors.validationErrors,\n },\n timestamp: new Date().toISOString(),\n });\n }\n\n return response.status(status).json({\n statusCode: status,\n success: false,\n error: {\n code: \"HTTP_EXCEPTION\",\n message:\n typeof res === \"string\"\n ? res\n : ((res as any).message ?? exception.message),\n },\n timestamp: new Date().toISOString(),\n });\n }\n\n /* 4️⃣ Native JS errors (TypeError, Error, etc.) */\n if (exception instanceof Error) {\n return response.status(HttpStatus.INTERNAL_SERVER_ERROR).json({\n statusCode: HttpStatus.INTERNAL_SERVER_ERROR,\n success: false,\n error: {\n code: exception.name,\n message: exception.message,\n },\n timestamp: new Date().toISOString(),\n });\n }\n\n /* 5️⃣ Truly unknown (non-Error throwables) */\n return response.status(HttpStatus.INTERNAL_SERVER_ERROR).json({\n statusCode: HttpStatus.INTERNAL_SERVER_ERROR,\n success: false,\n error: {\n code: \"UNKNOWN_ERROR\",\n message: \"Internal server error\",\n },\n timestamp: new Date().toISOString(),\n });\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/middleware/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA0C;AAC1C,6DAA0C;AAC1C,kEAA+C;AAC/C,iEAA8C;AAC9C,oEAAiD","sourcesContent":["export * from './async-storage.middleware'\nexport * from './platform-auth.middleware'\nexport * from './utils/http-response.formatter'\nexport * from \"./interceptor/response-handler\"\nexport * from \"./filter/global-exeception.filter\""]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CallHandler, ExecutionContext, NestInterceptor } from "@nestjs/common";
|
|
2
|
-
import { Observable } from "rxjs";
|
|
3
|
-
import { LoggerService } from "@core-common/logger";
|
|
4
|
-
export declare class ResponseHandler implements NestInterceptor {
|
|
5
|
-
private readonly logger;
|
|
6
|
-
constructor(logger: LoggerService);
|
|
7
|
-
intercept(exContext: ExecutionContext, next: CallHandler): Observable<any>;
|
|
8
|
-
private handleResponse;
|
|
9
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ResponseHandler = void 0;
|
|
13
|
-
const common_1 = require("@nestjs/common");
|
|
14
|
-
const rxjs_1 = require("rxjs");
|
|
15
|
-
const http_response_formatter_1 = require("../utils/http-response.formatter");
|
|
16
|
-
const logger_1 = require("../../core-common/logger");
|
|
17
|
-
let ResponseHandler = class ResponseHandler {
|
|
18
|
-
logger;
|
|
19
|
-
constructor(logger) {
|
|
20
|
-
this.logger = logger;
|
|
21
|
-
}
|
|
22
|
-
intercept(exContext, next) {
|
|
23
|
-
return new rxjs_1.Observable((subscriber) => {
|
|
24
|
-
next.handle().subscribe({
|
|
25
|
-
next: (data) => {
|
|
26
|
-
const mapped = this.handleResponse(exContext, data);
|
|
27
|
-
subscriber.next(mapped);
|
|
28
|
-
},
|
|
29
|
-
error: (err) => {
|
|
30
|
-
this.logger.error('Error in ResponseHandler Interceptor', err);
|
|
31
|
-
subscriber.error(err);
|
|
32
|
-
},
|
|
33
|
-
complete: () => {
|
|
34
|
-
subscriber.complete();
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
handleResponse(excecutionContext, result) {
|
|
40
|
-
let serverResponse = excecutionContext
|
|
41
|
-
.switchToHttp()
|
|
42
|
-
.getResponse();
|
|
43
|
-
const apiReponse = new http_response_formatter_1.HttpResponseFormatter().getStandardApiResponse(serverResponse.statusCode, result);
|
|
44
|
-
serverResponse.statusCode = apiReponse.statusCode
|
|
45
|
-
? apiReponse.statusCode
|
|
46
|
-
: apiReponse?.error?.statusCode;
|
|
47
|
-
serverResponse[`statusCode`] = serverResponse.statusCode;
|
|
48
|
-
if (apiReponse?.statusCode) {
|
|
49
|
-
delete apiReponse?.error?.statusCode;
|
|
50
|
-
}
|
|
51
|
-
return apiReponse;
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
exports.ResponseHandler = ResponseHandler;
|
|
55
|
-
exports.ResponseHandler = ResponseHandler = __decorate([
|
|
56
|
-
(0, common_1.Injectable)(),
|
|
57
|
-
__metadata("design:paramtypes", [logger_1.LoggerService])
|
|
58
|
-
], ResponseHandler);
|
|
59
|
-
//# sourceMappingURL=response-handler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"response-handler.js","sourceRoot":"","sources":["../../../src/middleware/interceptor/response-handler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAKwB;AAExB,+BAAkC;AAIlC,8EAAyE;AACzE,qDAAoD;AAK7C,IAAM,eAAe,GAArB,MAAM,eAAe;IAEP;IADnB,YACmB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IACrC,CAAC;IAEJ,SAAS,CAAC,SAA2B,EAAE,IAAiB;QACtD,OAAO,IAAI,iBAAU,CAAC,CAAC,UAAU,EAAE,EAAE;YACnC,IAAI,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC;gBACtB,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE;oBACb,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;oBACpD,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBAC1B,CAAC;gBACD,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;oBACb,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,sCAAsC,EAAE,GAAG,CAAC,CAAC;oBAC/D,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACxB,CAAC;gBACD,QAAQ,EAAE,GAAG,EAAE;oBACb,UAAU,CAAC,QAAQ,EAAE,CAAC;gBACxB,CAAC;aACF,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IASO,cAAc,CACpB,iBAAmC,EACnC,MAAmB;QAEnB,IAAI,cAAc,GAAG,iBAAiB;aACnC,YAAY,EAAE;aACd,WAAW,EAAkB,CAAC;QAEjC,MAAM,UAAU,GAAQ,IAAI,+CAAqB,EAAE,CAAC,sBAAsB,CACxE,cAAc,CAAC,UAAU,EACzB,MAAM,CACP,CAAC;QACF,cAAc,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU;YAC/C,CAAC,CAAC,UAAU,CAAC,UAAU;YACvB,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,UAAU,CAAC;QAClC,cAAc,CAAC,YAAY,CAAC,GAAG,cAAc,CAAC,UAAU,CAAC;QACzD,IAAI,UAAU,EAAE,UAAU,EAAE,CAAC;YAC3B,OAAO,UAAU,EAAE,KAAK,EAAE,UAAU,CAAC;QACvC,CAAC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;CACF,CAAA;AAnDY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;qCAGgB,sBAAa;GAF7B,eAAe,CAmD3B","sourcesContent":["import {\n CallHandler,\n ExecutionContext,\n Injectable,\n NestInterceptor,\n} from \"@nestjs/common\";\nimport { ServerResponse } from \"http\";\nimport { Observable } from \"rxjs\";\nimport { GenericErrorResponse } from \"../../core-common/response-model/generic-error-response.model\";\nimport { GenericSuccessResponse } from \"../../core-common/response-model/generic-success-response.model\";\nimport { Result } from \"../../core-common/result-model/result\";\nimport { HttpResponseFormatter } from \"../utils/http-response.formatter\";\nimport { LoggerService } from \"@core-common/logger\";\n/**\n * Intercepts the response and returns a standard ApiReponse object\n */\n@Injectable()\nexport class ResponseHandler implements NestInterceptor {\n constructor(\n private readonly logger: LoggerService\n ) {}\n\n intercept(exContext: ExecutionContext, next: CallHandler): Observable<any> {\n return new Observable((subscriber) => {\n next.handle().subscribe({\n next: (data) => {\n const mapped = this.handleResponse(exContext, data);\n subscriber.next(mapped);\n },\n error: (err) => {\n this.logger.error('Error in ResponseHandler Interceptor', err);\n subscriber.error(err);\n },\n complete: () => {\n subscriber.complete();\n },\n });\n });\n }\n\n /**\n * Checks the response content and appropriately sets the status code and wraps the return value in a ApiErroReponse or a\n * ApiSuccessReponse\n * @param excecutionContext - Instance of the executionContext object\n * @param result Data returned by the controller method\n * @returns - Instance of ApiSuccessReponse or ApiErrorReponse\n */\n private handleResponse(\n excecutionContext: ExecutionContext,\n result: Result<any>,\n ): GenericSuccessResponse<any> | GenericErrorResponse {\n let serverResponse = excecutionContext\n .switchToHttp()\n .getResponse<ServerResponse>();\n\n const apiReponse: any = new HttpResponseFormatter().getStandardApiResponse(\n serverResponse.statusCode,\n result,\n );\n serverResponse.statusCode = apiReponse.statusCode\n ? apiReponse.statusCode\n : apiReponse?.error?.statusCode;\n serverResponse[`statusCode`] = serverResponse.statusCode;\n if (apiReponse?.statusCode) {\n delete apiReponse?.error?.statusCode;\n }\n return apiReponse;\n }\n}\n"]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.AuthMiddleware = void 0;
|
|
10
|
-
const common_1 = require("@nestjs/common");
|
|
11
|
-
let AuthMiddleware = class AuthMiddleware {
|
|
12
|
-
use(req, _res, next) {
|
|
13
|
-
const authHeader = req.headers["authorization"];
|
|
14
|
-
console.log("Auth Middleware executed", authHeader);
|
|
15
|
-
next();
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
exports.AuthMiddleware = AuthMiddleware;
|
|
19
|
-
exports.AuthMiddleware = AuthMiddleware = __decorate([
|
|
20
|
-
(0, common_1.Injectable)()
|
|
21
|
-
], AuthMiddleware);
|
|
22
|
-
//# sourceMappingURL=platform-auth.middleware.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"platform-auth.middleware.js","sourceRoot":"","sources":["../../src/middleware/platform-auth.middleware.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4D;AAIrD,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,GAAG,CAAC,GAAY,EAAE,IAAc,EAAE,IAAgB;QAChD,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QAGhD,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,UAAU,CAAC,CAAC;QACpD,IAAI,EAAE,CAAC;IACT,CAAC;CACF,CAAA;AARY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;GACA,cAAc,CAQ1B","sourcesContent":["import { Injectable, NestMiddleware } from \"@nestjs/common\";\nimport { Request, Response } from \"express\";\n\n@Injectable()\nexport class AuthMiddleware implements NestMiddleware<Request, Response> {\n use(req: Request, _res: Response, next: () => void): void {\n const authHeader = req.headers[\"authorization\"];\n // Implement your authentication logic here\n // For example, validate JWT token from authHeader \n console.log(\"Auth Middleware executed\", authHeader);\n next();\n }\n}\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { GenericErrorResponse } from "../../core-common/response-model/generic-error-response.model";
|
|
2
|
-
import { GenericSuccessResponse } from "../../core-common/response-model/generic-success-response.model";
|
|
3
|
-
export declare class HttpResponseFormatter {
|
|
4
|
-
constructor();
|
|
5
|
-
getStandardApiResponse(statusCode: number, responseData: any): GenericSuccessResponse<any> | GenericErrorResponse;
|
|
6
|
-
private getSuccessResponse;
|
|
7
|
-
private isSuccessfulResult;
|
|
8
|
-
private isFailedResult;
|
|
9
|
-
private getFailureResponse;
|
|
10
|
-
private getStatusCode;
|
|
11
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HttpResponseFormatter = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
const already_exists_error_1 = require("../../core-common/error/custom-error/already-exists.error");
|
|
6
|
-
const generic_error_1 = require("../../core-common/error/generic.error");
|
|
7
|
-
const generic_error_response_model_1 = require("../../core-common/response-model/generic-error-response.model");
|
|
8
|
-
const generic_success_response_model_1 = require("../../core-common/response-model/generic-success-response.model");
|
|
9
|
-
const result_1 = require("../../core-common/result-model/result");
|
|
10
|
-
const error_1 = require("../../core-common/error");
|
|
11
|
-
const internal_server_error_1 = require("../../core-common/error/custom-error/internal-server.error");
|
|
12
|
-
class HttpResponseFormatter {
|
|
13
|
-
constructor() { }
|
|
14
|
-
getStandardApiResponse(statusCode, responseData) {
|
|
15
|
-
if (this.isSuccessfulResult(responseData)) {
|
|
16
|
-
return this.getSuccessResponse(responseData, statusCode);
|
|
17
|
-
}
|
|
18
|
-
if (this.isFailedResult(responseData)) {
|
|
19
|
-
return this.getFailureResponse(responseData);
|
|
20
|
-
}
|
|
21
|
-
return responseData;
|
|
22
|
-
}
|
|
23
|
-
getSuccessResponse(responseData, statusCode) {
|
|
24
|
-
const apiSuccessResponse = new generic_success_response_model_1.GenericSuccessResponse();
|
|
25
|
-
apiSuccessResponse.initialize(responseData, statusCode);
|
|
26
|
-
return apiSuccessResponse;
|
|
27
|
-
}
|
|
28
|
-
isSuccessfulResult(responseData) {
|
|
29
|
-
return responseData instanceof result_1.Result && responseData.success;
|
|
30
|
-
}
|
|
31
|
-
isFailedResult(responseData) {
|
|
32
|
-
return responseData instanceof result_1.Result && !responseData.success;
|
|
33
|
-
}
|
|
34
|
-
getFailureResponse(result) {
|
|
35
|
-
const statusCode = this.getStatusCode(result.error);
|
|
36
|
-
const apiErrorResponse = new generic_error_response_model_1.GenericErrorResponse();
|
|
37
|
-
apiErrorResponse.initialize(result, statusCode);
|
|
38
|
-
return apiErrorResponse;
|
|
39
|
-
}
|
|
40
|
-
getStatusCode(error) {
|
|
41
|
-
if (error instanceof error_1.BadRequestError) {
|
|
42
|
-
return common_1.HttpStatus.BAD_REQUEST;
|
|
43
|
-
}
|
|
44
|
-
if (error instanceof error_1.UnauthorizedError) {
|
|
45
|
-
return common_1.HttpStatus.UNAUTHORIZED;
|
|
46
|
-
}
|
|
47
|
-
if (error instanceof error_1.ForbiddenError) {
|
|
48
|
-
return common_1.HttpStatus.FORBIDDEN;
|
|
49
|
-
}
|
|
50
|
-
if (error instanceof error_1.NotFoundError) {
|
|
51
|
-
return common_1.HttpStatus.NOT_FOUND;
|
|
52
|
-
}
|
|
53
|
-
if (error instanceof already_exists_error_1.AlreadyExistsError) {
|
|
54
|
-
return common_1.HttpStatus.CONFLICT;
|
|
55
|
-
}
|
|
56
|
-
if (error instanceof error_1.ConflictError) {
|
|
57
|
-
return common_1.HttpStatus.CONFLICT;
|
|
58
|
-
}
|
|
59
|
-
if (error instanceof error_1.ValidationError) {
|
|
60
|
-
return common_1.HttpStatus.UNPROCESSABLE_ENTITY;
|
|
61
|
-
}
|
|
62
|
-
if (error instanceof error_1.UnprocessableEntityError) {
|
|
63
|
-
return common_1.HttpStatus.UNPROCESSABLE_ENTITY;
|
|
64
|
-
}
|
|
65
|
-
if (error instanceof error_1.ServiceUnavailableError) {
|
|
66
|
-
return common_1.HttpStatus.SERVICE_UNAVAILABLE;
|
|
67
|
-
}
|
|
68
|
-
if (error instanceof internal_server_error_1.InternalServerError) {
|
|
69
|
-
return common_1.HttpStatus.INTERNAL_SERVER_ERROR;
|
|
70
|
-
}
|
|
71
|
-
if (error instanceof generic_error_1.GenericError) {
|
|
72
|
-
return error.statusCode;
|
|
73
|
-
}
|
|
74
|
-
return common_1.HttpStatus.INTERNAL_SERVER_ERROR;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
exports.HttpResponseFormatter = HttpResponseFormatter;
|
|
78
|
-
//# sourceMappingURL=http-response.formatter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-response.formatter.js","sourceRoot":"","sources":["../../../src/middleware/utils/http-response.formatter.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAC5C,oGAA+F;AAC/F,yEAAqE;AACrE,gHAAqG;AACrG,oHAAyG;AACzG,kEAA+D;AAC/D,mDAA+L;AAC/L,sGAAiG;AAKjG,MAAa,qBAAqB;IAChC,gBAAe,CAAC;IAMT,sBAAsB,CAC3B,UAAkB,EAClB,YAAiB;QAEjB,IAAI,IAAI,CAAC,kBAAkB,CAAC,YAAY,CAAC,EAAE,CAAC;YAC1C,OAAO,IAAI,CAAC,kBAAkB,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QAC3D,CAAC;QAED,IAAI,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,EAAE,CAAC;YACtC,OAAO,IAAI,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;QAC/C,CAAC;QAED,OAAO,YAAY,CAAC;IACtB,CAAC;IAQO,kBAAkB,CACxB,YAAiB,EACjB,UAAkB;QAElB,MAAM,kBAAkB,GAAG,IAAI,uDAAsB,EAAE,CAAC;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AC;QACzC,CAAC;QAED,IAAI,KAAK,YAAY,gCAAwB,EAAE,CAAC;YAC9C,OAAO,mBAAU,CAAC,oBAAoB,CAAC;QACzC,CAAC;QAED,IAAI,KAAK,YAAY,+BAAuB,EAAE,CAAC;YAC7C,OAAO,mBAAU,CAAC,mBAAmB,CAAC;QACxC,CAAC;QAED,IAAI,KAAK,YAAY,2CAAmB,EAAE,CAAC;YACzC,OAAO,mBAAU,CAAC,qBAAqB,CAAC;QAC1C,CAAC;QAED,IAAI,KAAK,YAAY,4BAAY,EAAE,CAAC;YAClC,OAAO,KAAK,CAAC,UAAU,CAAC;QAC1B,CAAC;QAED,OAAO,mBAAU,CAAC,qBAAqB,CAAC;IAC1C,CAAC;CACF;AAjHD,sDAiHC","sourcesContent":["import { HttpStatus } from \"@nestjs/common\";\nimport { AlreadyExistsError } from \"../../core-common/error/custom-error/already-exists.error\";\nimport { GenericError } from \"../../core-common/error/generic.error\";\nimport { GenericErrorResponse } from \"../../core-common/response-model/generic-error-response.model\";\nimport { GenericSuccessResponse } from \"../../core-common/response-model/generic-success-response.model\";\nimport { Result } from \"../../core-common/result-model/result\";\nimport { BadRequestError, ConflictError, ForbiddenError, NotFoundError, ServiceUnavailableError, UnauthorizedError, UnprocessableEntityError, ValidationError } from \"../../core-common/error\";\nimport { InternalServerError } from \"../../core-common/error/custom-error/internal-server.error\";\n\n/**\n * Helps in returning a appropriate and standard Response format based on success or error scenario\n */\nexport class HttpResponseFormatter {\n constructor() {}\n /**\n * Returns a standard formatted ApiSuccesReponse or ApiErrorResponse depending on the response data\n * @param statusCode - Http Status code\n * @param responseData - Response value from the api controller method\n */\n public getStandardApiResponse(\n statusCode: number,\n responseData: any,\n ): GenericSuccessResponse<any> | GenericErrorResponse {\n if (this.isSuccessfulResult(responseData)) {\n return this.getSuccessResponse(responseData, statusCode);\n }\n\n if (this.isFailedResult(responseData)) {\n return this.getFailureResponse(responseData);\n }\n\n return responseData;\n }\n\n /**\n *\n * @param responseData Initializes and returns the success api response\n * @param statusCode - Http Status code\n * @returns - instance of ApiSuccessResponse object\n */\n private getSuccessResponse(\n responseData: any,\n statusCode: number,\n ): GenericSuccessResponse<any> {\n const apiSuccessResponse = new GenericSuccessResponse();\n apiSuccessResponse.initialize(responseData, statusCode);\n return apiSuccessResponse;\n }\n\n /**\n * Checks if the the data is of type Result and is successful\n * @param responseData - response data\n * @returns - boolean\n */\n private isSuccessfulResult(responseData: any): boolean {\n return responseData instanceof Result && responseData.success;\n }\n\n /**\n * Checks if the the data is of type Result and is successful\n * @param responseData - response data\n * @returns - boolean\n */\n private isFailedResult(responseData: any): boolean {\n return responseData instanceof Result && !responseData.success;\n }\n\n /**\n * Gets the failure response based on the result contents\n * @param result - Result object returned from the controller method\n */\n private getFailureResponse(result: Result<any>) {\n const statusCode = this.getStatusCode(result.error);\n const apiErrorResponse = new GenericErrorResponse();\n apiErrorResponse.initialize(result, statusCode);\n return apiErrorResponse;\n }\n\n private getStatusCode(error: GenericError): number {\n if (error instanceof BadRequestError) {\n return HttpStatus.BAD_REQUEST;\n }\n\n if (error instanceof UnauthorizedError) {\n return HttpStatus.UNAUTHORIZED;\n }\n\n if (error instanceof ForbiddenError) {\n return HttpStatus.FORBIDDEN;\n }\n\n if (error instanceof NotFoundError) {\n return HttpStatus.NOT_FOUND;\n }\n\n if (error instanceof AlreadyExistsError) {\n return HttpStatus.CONFLICT;\n }\n\n if (error instanceof ConflictError) {\n return HttpStatus.CONFLICT;\n }\n\n if (error instanceof ValidationError) {\n return HttpStatus.UNPROCESSABLE_ENTITY;\n }\n\n if (error instanceof UnprocessableEntityError) {\n return HttpStatus.UNPROCESSABLE_ENTITY;\n }\n\n if (error instanceof ServiceUnavailableError) {\n return HttpStatus.SERVICE_UNAVAILABLE;\n }\n\n if (error instanceof InternalServerError) {\n return HttpStatus.INTERNAL_SERVER_ERROR;\n }\n\n if (error instanceof GenericError) {\n return error.statusCode;\n }\n\n return HttpStatus.INTERNAL_SERVER_ERROR;\n }\n}\n"]}
|
|
File without changes
|