@venizia/ignis 0.0.9-19 → 0.0.9-20
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/base/middlewares/app-error/app-error.middleware.d.ts +15 -0
- package/dist/base/middlewares/app-error/app-error.middleware.d.ts.map +1 -0
- package/dist/base/middlewares/app-error/app-error.middleware.js +81 -0
- package/dist/base/middlewares/app-error/app-error.middleware.js.map +1 -0
- package/dist/base/middlewares/app-error/database.handler.d.ts +20 -0
- package/dist/base/middlewares/app-error/database.handler.d.ts.map +1 -0
- package/dist/base/middlewares/app-error/database.handler.js +55 -0
- package/dist/base/middlewares/app-error/database.handler.js.map +1 -0
- package/dist/base/middlewares/app-error/definition.d.ts +59 -0
- package/dist/base/middlewares/app-error/definition.d.ts.map +1 -0
- package/dist/base/middlewares/app-error/definition.js +98 -0
- package/dist/base/middlewares/app-error/definition.js.map +1 -0
- package/dist/base/middlewares/app-error/index.d.ts +2 -0
- package/dist/base/middlewares/app-error/index.d.ts.map +1 -0
- package/dist/base/middlewares/app-error/index.js +18 -0
- package/dist/base/middlewares/app-error/index.js.map +1 -0
- package/dist/base/middlewares/app-error/types.d.ts +18 -0
- package/dist/base/middlewares/app-error/types.d.ts.map +1 -0
- package/dist/base/middlewares/app-error/types.js +3 -0
- package/dist/base/middlewares/app-error/types.js.map +1 -0
- package/dist/base/middlewares/app-error/zod.handler.d.ts +28 -0
- package/dist/base/middlewares/app-error/zod.handler.d.ts.map +1 -0
- package/dist/base/middlewares/app-error/zod.handler.js +64 -0
- package/dist/base/middlewares/app-error/zod.handler.js.map +1 -0
- package/dist/base/middlewares/emoji-favicon/emoji-favicon.middleware.d.ts.map +1 -0
- package/dist/base/middlewares/emoji-favicon/emoji-favicon.middleware.js.map +1 -0
- package/dist/base/middlewares/emoji-favicon/index.d.ts +2 -0
- package/dist/base/middlewares/emoji-favicon/index.d.ts.map +1 -0
- package/dist/base/middlewares/emoji-favicon/index.js +18 -0
- package/dist/base/middlewares/emoji-favicon/index.js.map +1 -0
- package/dist/base/middlewares/index.d.ts +4 -4
- package/dist/base/middlewares/index.d.ts.map +1 -1
- package/dist/base/middlewares/index.js +4 -4
- package/dist/base/middlewares/index.js.map +1 -1
- package/dist/base/middlewares/not-found/index.d.ts +2 -0
- package/dist/base/middlewares/not-found/index.d.ts.map +1 -0
- package/dist/base/middlewares/not-found/index.js +18 -0
- package/dist/base/middlewares/not-found/index.js.map +1 -0
- package/dist/base/middlewares/{not-found.middleware.d.ts → not-found/not-found.middleware.d.ts} +0 -1
- package/dist/base/middlewares/not-found/not-found.middleware.d.ts.map +1 -0
- package/dist/base/middlewares/{not-found.middleware.js → not-found/not-found.middleware.js} +2 -3
- package/dist/base/middlewares/{not-found.middleware.js.map → not-found/not-found.middleware.js.map} +1 -1
- package/dist/base/middlewares/request-spy/index.d.ts +2 -0
- package/dist/base/middlewares/request-spy/index.d.ts.map +1 -0
- package/dist/base/middlewares/request-spy/index.js +18 -0
- package/dist/base/middlewares/request-spy/index.js.map +1 -0
- package/dist/base/middlewares/{request-spy.middleware.d.ts → request-spy/request-spy.middleware.d.ts} +1 -1
- package/dist/base/middlewares/request-spy/request-spy.middleware.d.ts.map +1 -0
- package/dist/base/middlewares/{request-spy.middleware.js → request-spy/request-spy.middleware.js} +1 -1
- package/dist/base/middlewares/request-spy/request-spy.middleware.js.map +1 -0
- package/package.json +6 -5
- package/dist/base/middlewares/app-error.middleware.d.ts +0 -8
- package/dist/base/middlewares/app-error.middleware.d.ts.map +0 -1
- package/dist/base/middlewares/app-error.middleware.js +0 -138
- package/dist/base/middlewares/app-error.middleware.js.map +0 -1
- package/dist/base/middlewares/emoji-favicon.middleware.d.ts.map +0 -1
- package/dist/base/middlewares/emoji-favicon.middleware.js.map +0 -1
- package/dist/base/middlewares/not-found.middleware.d.ts.map +0 -1
- package/dist/base/middlewares/request-spy.middleware.d.ts.map +0 -1
- package/dist/base/middlewares/request-spy.middleware.js.map +0 -1
- /package/dist/base/middlewares/{emoji-favicon.middleware.d.ts → emoji-favicon/emoji-favicon.middleware.d.ts} +0 -0
- /package/dist/base/middlewares/{emoji-favicon.middleware.js → emoji-favicon/emoji-favicon.middleware.js} +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Logger } from '@venizia/ignis-helpers';
|
|
2
|
+
import { ErrorHandler } from 'hono/types';
|
|
3
|
+
/**
|
|
4
|
+
* Application error handler (Hono `onError`). Routes each error to the right shape:
|
|
5
|
+
* - ZodError → 422 via {@link formatZodError}
|
|
6
|
+
* - DB client error (class 22/23/44) → 400 via {@link isDatabaseClientError}
|
|
7
|
+
* - Transient DB conflict (40001/40P01) → 409 via {@link isRetryableDatabaseError}
|
|
8
|
+
* - Intentional domain error (`getError`) → its own status/message
|
|
9
|
+
* - Anything else → 500 (generic message in production)
|
|
10
|
+
*/
|
|
11
|
+
export declare const appErrorHandler: (opts: {
|
|
12
|
+
logger: Logger;
|
|
13
|
+
rootKey?: string;
|
|
14
|
+
}) => ErrorHandler;
|
|
15
|
+
//# sourceMappingURL=app-error.middleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-error.middleware.d.ts","sourceRoot":"","sources":["../../../../src/base/middlewares/app-error/app-error.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAQ1C;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,iBAqFzE,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.appErrorHandler = void 0;
|
|
4
|
+
const ignis_helpers_1 = require("@venizia/ignis-helpers");
|
|
5
|
+
const request_spy_1 = require("../request-spy");
|
|
6
|
+
const database_handler_1 = require("./database.handler");
|
|
7
|
+
const definition_1 = require("./definition");
|
|
8
|
+
const zod_handler_1 = require("./zod.handler");
|
|
9
|
+
const DEFAULT_INTERNAL_ERROR_MESSAGE = 'Internal Server Error';
|
|
10
|
+
/**
|
|
11
|
+
* Application error handler (Hono `onError`). Routes each error to the right shape:
|
|
12
|
+
* - ZodError → 422 via {@link formatZodError}
|
|
13
|
+
* - DB client error (class 22/23/44) → 400 via {@link isDatabaseClientError}
|
|
14
|
+
* - Transient DB conflict (40001/40P01) → 409 via {@link isRetryableDatabaseError}
|
|
15
|
+
* - Intentional domain error (`getError`) → its own status/message
|
|
16
|
+
* - Anything else → 500 (generic message in production)
|
|
17
|
+
*/
|
|
18
|
+
const appErrorHandler = (opts) => {
|
|
19
|
+
const { logger = console, rootKey = null } = opts;
|
|
20
|
+
const mw = async (error, context) => {
|
|
21
|
+
const requestId = context.get(request_spy_1.RequestSpyMiddleware.REQUEST_ID_KEY);
|
|
22
|
+
logger.error('[onError][%s] REQUEST ERROR | path: %s | method: %s | url: %s | Error: %j', requestId, context.req.path, context.req.method, context.req.url, error);
|
|
23
|
+
const { NODE_ENV } = process.env;
|
|
24
|
+
const env = context.env?.NODE_ENV || NODE_ENV;
|
|
25
|
+
const isProduction = env?.toLowerCase() === ignis_helpers_1.Environment.PRODUCTION;
|
|
26
|
+
const statusCode = 'statusCode' in error ? error.statusCode : ignis_helpers_1.HTTP.ResultCodes.RS_5.InternalServerError;
|
|
27
|
+
const messageCode = 'messageCode' in error ? error.messageCode : undefined;
|
|
28
|
+
if (error.name === 'ZodError') {
|
|
29
|
+
const rs = (0, zod_handler_1.formatZodError)({
|
|
30
|
+
isProduction,
|
|
31
|
+
requestId,
|
|
32
|
+
url: context.req.url,
|
|
33
|
+
path: context.req.path,
|
|
34
|
+
error,
|
|
35
|
+
});
|
|
36
|
+
return context.json(rootKey ? { [rootKey]: rs.response } : rs.response, rs.statusCode);
|
|
37
|
+
}
|
|
38
|
+
// Classify DB errors: client (400), transient/retryable conflict (409 Conflict), else server.
|
|
39
|
+
const dbError = (0, database_handler_1.isDatabaseClientError)({ error, isProduction });
|
|
40
|
+
const isRetryable = !dbError.isClientError && (0, database_handler_1.isRetryableDatabaseError)({ error });
|
|
41
|
+
let resolvedStatusCode = statusCode;
|
|
42
|
+
if (dbError.isClientError) {
|
|
43
|
+
resolvedStatusCode = ignis_helpers_1.HTTP.ResultCodes.RS_4.BadRequest;
|
|
44
|
+
}
|
|
45
|
+
else if (isRetryable) {
|
|
46
|
+
resolvedStatusCode = ignis_helpers_1.HTTP.ResultCodes.RS_4.Conflict;
|
|
47
|
+
}
|
|
48
|
+
let resolvedMessage = error.message;
|
|
49
|
+
let resolvedMessageCode = messageCode;
|
|
50
|
+
if (dbError.isClientError && dbError.message) {
|
|
51
|
+
resolvedMessage = dbError.message;
|
|
52
|
+
}
|
|
53
|
+
else if (isRetryable) {
|
|
54
|
+
// Transient conflict (deadlock / serialization failure) — safe generic message + retryable code.
|
|
55
|
+
resolvedMessage = definition_1.DATABASE_RETRYABLE_ERROR_MESSAGE;
|
|
56
|
+
resolvedMessageCode = definition_1.DATABASE_RETRYABLE_ERROR_CODE;
|
|
57
|
+
}
|
|
58
|
+
else if (isProduction && !('statusCode' in error)) {
|
|
59
|
+
// Unexpected server error (uncaught throw, non-client DB error, connection failure): never
|
|
60
|
+
// leak the raw message in production — it may carry SQL, schema names, or connection details.
|
|
61
|
+
resolvedMessage = DEFAULT_INTERNAL_ERROR_MESSAGE;
|
|
62
|
+
}
|
|
63
|
+
const rs = {
|
|
64
|
+
message: resolvedMessage,
|
|
65
|
+
messageCode: resolvedMessageCode,
|
|
66
|
+
statusCode: resolvedStatusCode,
|
|
67
|
+
requestId,
|
|
68
|
+
extra: 'extra' in error ? error?.extra : undefined,
|
|
69
|
+
details: {
|
|
70
|
+
url: context.req.url,
|
|
71
|
+
path: context.req.path,
|
|
72
|
+
stack: !isProduction ? error.stack : undefined,
|
|
73
|
+
cause: !isProduction ? error.cause : undefined,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
return context.json(rootKey ? { [rootKey]: rs } : rs, resolvedStatusCode);
|
|
77
|
+
};
|
|
78
|
+
return mw;
|
|
79
|
+
};
|
|
80
|
+
exports.appErrorHandler = appErrorHandler;
|
|
81
|
+
//# sourceMappingURL=app-error.middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-error.middleware.js","sourceRoot":"","sources":["../../../../src/base/middlewares/app-error/app-error.middleware.ts"],"names":[],"mappings":";;;AAAA,0DAAmE;AAEnE,gDAAsD;AACtD,yDAAqF;AACrF,6CAA+F;AAC/F,+CAA+C;AAE/C,MAAM,8BAA8B,GAAG,uBAAuB,CAAC;AAE/D;;;;;;;GAOG;AACI,MAAM,eAAe,GAAG,CAAC,IAA0C,EAAE,EAAE;IAC5E,MAAM,EAAE,MAAM,GAAG,OAAO,EAAE,OAAO,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;IAElD,MAAM,EAAE,GAAiB,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QAChD,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,kCAAoB,CAAC,cAAc,CAAC,CAAC;QAEnE,MAAM,CAAC,KAAK,CACV,2EAA2E,EAC3E,SAAS,EACT,OAAO,CAAC,GAAG,CAAC,IAAI,EAChB,OAAO,CAAC,GAAG,CAAC,MAAM,EAClB,OAAO,CAAC,GAAG,CAAC,GAAG,EACf,KAAK,CACN,CAAC;QAEF,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;QACjC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,QAAQ,IAAI,QAAQ,CAAC;QAC9C,MAAM,YAAY,GAAG,GAAG,EAAE,WAAW,EAAE,KAAK,2BAAW,CAAC,UAAU,CAAC;QAEnE,MAAM,UAAU,GACd,YAAY,IAAI,KAAK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is a database constraint error caused by the request (SQLSTATE class 22/23/44)
|
|
3
|
+
* and should return HTTP 400. In production the detail/table/constraint context is suppressed so
|
|
4
|
+
* no row values or schema internals leak; in non-production it is appended to aid debugging.
|
|
5
|
+
*/
|
|
6
|
+
export declare const isDatabaseClientError: (opts: {
|
|
7
|
+
error: Error;
|
|
8
|
+
isProduction: boolean;
|
|
9
|
+
}) => {
|
|
10
|
+
isClientError: boolean;
|
|
11
|
+
message?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Checks if error is a transient, retryable DB transaction conflict (serialization failure /
|
|
15
|
+
* deadlock — SQLSTATE 40001 / 40P01). These map to HTTP 409: the client can retry the same request.
|
|
16
|
+
*/
|
|
17
|
+
export declare const isRetryableDatabaseError: (opts: {
|
|
18
|
+
error: Error;
|
|
19
|
+
}) => boolean;
|
|
20
|
+
//# sourceMappingURL=database.handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.handler.d.ts","sourceRoot":"","sources":["../../../../src/base/middlewares/app-error/database.handler.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,MAAM;IAC1C,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,EAAE,OAAO,CAAC;CACvB,KAAG;IAAE,aAAa,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAyC7C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GAAI,MAAM;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,KAAG,OAIjE,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isRetryableDatabaseError = exports.isDatabaseClientError = void 0;
|
|
4
|
+
const definition_1 = require("./definition");
|
|
5
|
+
/**
|
|
6
|
+
* Checks if error is a database constraint error caused by the request (SQLSTATE class 22/23/44)
|
|
7
|
+
* and should return HTTP 400. In production the detail/table/constraint context is suppressed so
|
|
8
|
+
* no row values or schema internals leak; in non-production it is appended to aid debugging.
|
|
9
|
+
*/
|
|
10
|
+
const isDatabaseClientError = (opts) => {
|
|
11
|
+
const { error, isProduction } = opts;
|
|
12
|
+
const dbError = error;
|
|
13
|
+
const cause = dbError.cause;
|
|
14
|
+
const code = dbError.code || cause?.code;
|
|
15
|
+
// Only SQLSTATE classes caused by the request — 22 (data exception) and 23 (integrity violation) —
|
|
16
|
+
// are client errors. Anything else (e.g. class 42 syntax/undefined-column, 53 resources) stays 500.
|
|
17
|
+
// A missing or non-string code (e.g. a gRPC numeric code) is treated as non-client and must never
|
|
18
|
+
// crash this last-resort handler.
|
|
19
|
+
if (typeof code !== 'string' || !definition_1.POSTGRES_CLIENT_ERROR_CLASSES.includes(code.slice(0, 2))) {
|
|
20
|
+
return { isClientError: false };
|
|
21
|
+
}
|
|
22
|
+
const baseMessage = definition_1.DATABASE_CLIENT_ERROR_MESSAGES[code] ?? definition_1.DATABASE_CLIENT_ERROR_FALLBACK_MESSAGE;
|
|
23
|
+
// In production, expose ONLY the generic base message. `detail` can echo row values
|
|
24
|
+
// (e.g. "Key (email)=(a@b.com) already exists") and `table`/`constraint` reveal schema internals.
|
|
25
|
+
if (isProduction) {
|
|
26
|
+
return { isClientError: true, message: baseMessage };
|
|
27
|
+
}
|
|
28
|
+
// Non-production: append driver-provided context to aid debugging.
|
|
29
|
+
const lines = [baseMessage];
|
|
30
|
+
if (cause?.detail) {
|
|
31
|
+
lines.push(`Detail: ${cause.detail}`);
|
|
32
|
+
}
|
|
33
|
+
if (cause?.table) {
|
|
34
|
+
lines.push(`Table: ${cause.table}`);
|
|
35
|
+
}
|
|
36
|
+
if (cause?.constraint) {
|
|
37
|
+
lines.push(`Constraint: ${cause.constraint}`);
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
isClientError: true,
|
|
41
|
+
message: lines.join('\n'),
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
exports.isDatabaseClientError = isDatabaseClientError;
|
|
45
|
+
/**
|
|
46
|
+
* Checks if error is a transient, retryable DB transaction conflict (serialization failure /
|
|
47
|
+
* deadlock — SQLSTATE 40001 / 40P01). These map to HTTP 409: the client can retry the same request.
|
|
48
|
+
*/
|
|
49
|
+
const isRetryableDatabaseError = (opts) => {
|
|
50
|
+
const dbError = opts.error;
|
|
51
|
+
const code = dbError.code || dbError.cause?.code;
|
|
52
|
+
return typeof code === 'string' && definition_1.POSTGRES_RETRYABLE_ERROR_CODES.includes(code);
|
|
53
|
+
};
|
|
54
|
+
exports.isRetryableDatabaseError = isRetryableDatabaseError;
|
|
55
|
+
//# sourceMappingURL=database.handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.handler.js","sourceRoot":"","sources":["../../../../src/base/middlewares/app-error/database.handler.ts"],"names":[],"mappings":";;;AAAA,6CAKsB;AAGtB;;;;GAIG;AACI,MAAM,qBAAqB,GAAG,CAAC,IAGrC,EAAgD,EAAE;IACjD,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IACrC,MAAM,OAAO,GAAG,KAAuB,CAAC;IACxC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,KAAK,EAAE,IAAI,CAAC;IAEzC,mGAAmG;IACnG,oGAAoG;IACpG,kGAAkG;IAClG,kCAAkC;IAClC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,0CAA6B,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1F,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;IAClC,CAAC;IAED,MAAM,WAAW,GACf,2CAA8B,CAAC,IAAI,CAAC,IAAI,mDAAsC,CAAC;IAEjF,oFAAoF;IACpF,kGAAkG;IAClG,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;IACvD,CAAC;IAED,mEAAmE;IACnE,MAAM,KAAK,GAAG,CAAC,WAAW,CAAC,CAAC;IAC5B,IAAI,KAAK,EAAE,MAAM,EAAE,CAAC;QAClB,KAAK,CAAC,IAAI,CAAC,WAAW,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,KAAK,EAAE,KAAK,EAAE,CAAC;QACjB,KAAK,CAAC,IAAI,CAAC,UAAU,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,KAAK,EAAE,UAAU,EAAE,CAAC;QACtB,KAAK,CAAC,IAAI,CAAC,eAAe,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,OAAO;QACL,aAAa,EAAE,IAAI;QACnB,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;KAC1B,CAAC;AACJ,CAAC,CAAC;AA5CW,QAAA,qBAAqB,yBA4ChC;AAEF;;;GAGG;AACI,MAAM,wBAAwB,GAAG,CAAC,IAAsB,EAAW,EAAE;IAC1E,MAAM,OAAO,GAAG,IAAI,CAAC,KAAuB,CAAC;IAC7C,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC;IACjD,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,2CAA8B,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACnF,CAAC,CAAC;AAJW,QAAA,wBAAwB,4BAInC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PostgreSQL SQLSTATE error codes that represent a CLIENT error (HTTP 400) — i.e. caused by the
|
|
3
|
+
* request/data — rather than a server fault. Grouped by SQLSTATE class.
|
|
4
|
+
* @see https://www.postgresql.org/docs/current/errcodes-appendix.html
|
|
5
|
+
*/
|
|
6
|
+
export declare const PostgresErrorCodes: {
|
|
7
|
+
readonly DATA_EXCEPTION: "22000";
|
|
8
|
+
readonly STRING_DATA_TOO_LONG: "22001";
|
|
9
|
+
readonly NUMERIC_VALUE_OUT_OF_RANGE: "22003";
|
|
10
|
+
readonly NULL_VALUE_NOT_ALLOWED: "22004";
|
|
11
|
+
readonly INVALID_DATETIME_FORMAT: "22007";
|
|
12
|
+
readonly DATETIME_FIELD_OVERFLOW: "22008";
|
|
13
|
+
readonly INVALID_TIME_ZONE_DISPLACEMENT_VALUE: "22009";
|
|
14
|
+
readonly SUBSTRING_ERROR: "22011";
|
|
15
|
+
readonly DIVISION_BY_ZERO: "22012";
|
|
16
|
+
readonly INVALID_PARAMETER_VALUE: "22023";
|
|
17
|
+
readonly INVALID_ESCAPE_SEQUENCE: "22025";
|
|
18
|
+
readonly STRING_DATA_LENGTH_MISMATCH: "22026";
|
|
19
|
+
readonly DUPLICATE_JSON_OBJECT_KEY_VALUE: "22030";
|
|
20
|
+
readonly INVALID_JSON_TEXT: "22032";
|
|
21
|
+
readonly FLOATING_POINT_EXCEPTION: "22P01";
|
|
22
|
+
readonly INVALID_TEXT_REPRESENTATION: "22P02";
|
|
23
|
+
readonly INVALID_BINARY_REPRESENTATION: "22P03";
|
|
24
|
+
readonly UNTRANSLATABLE_CHARACTER: "22P05";
|
|
25
|
+
readonly INTEGRITY_CONSTRAINT_VIOLATION: "23000";
|
|
26
|
+
readonly RESTRICT_VIOLATION: "23001";
|
|
27
|
+
readonly NOT_NULL_VIOLATION: "23502";
|
|
28
|
+
readonly FOREIGN_KEY_VIOLATION: "23503";
|
|
29
|
+
readonly UNIQUE_VIOLATION: "23505";
|
|
30
|
+
readonly CHECK_VIOLATION: "23514";
|
|
31
|
+
readonly EXCLUSION_VIOLATION: "23P01";
|
|
32
|
+
readonly WITH_CHECK_OPTION_VIOLATION: "44000";
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* SQLSTATE classes (first two chars) whose errors are caused by the client request and therefore
|
|
36
|
+
* map to HTTP 400. Any code in these classes — even one without a specific message below — is
|
|
37
|
+
* treated as a client error and uses {@link DATABASE_CLIENT_ERROR_FALLBACK_MESSAGE}.
|
|
38
|
+
*
|
|
39
|
+
* Deliberately excluded (remain server errors / 500): class 42 (syntax, undefined column/table —
|
|
40
|
+
* application/SQL bugs), 53 (insufficient resources), 0A (feature not supported), 25 (invalid
|
|
41
|
+
* transaction state), 28 (DB authorization), 21 (cardinality), 54 (program limits). Class 40
|
|
42
|
+
* (serialization_failure / deadlock_detected) is transient/retryable and is intentionally NOT a
|
|
43
|
+
* 400 — it warrants dedicated 409/503 + retry handling rather than being treated as client input.
|
|
44
|
+
*/
|
|
45
|
+
export declare const POSTGRES_CLIENT_ERROR_CLASSES: readonly string[];
|
|
46
|
+
/** Human-readable message per specific SQLSTATE code. */
|
|
47
|
+
export declare const DATABASE_CLIENT_ERROR_MESSAGES: Record<string, string>;
|
|
48
|
+
/** Fallback message for a client-class (22/23/44) error that has no specific message above. */
|
|
49
|
+
export declare const DATABASE_CLIENT_ERROR_FALLBACK_MESSAGE = "Invalid database request";
|
|
50
|
+
/**
|
|
51
|
+
* SQLSTATE codes for transient, retryable transaction conflicts (→ HTTP 409 Conflict). The client
|
|
52
|
+
* can safely retry the same request: the transaction lost a concurrency race rather than sending
|
|
53
|
+
* bad input (not 400) or hitting a server bug (not 500). Retrying usually succeeds.
|
|
54
|
+
*/
|
|
55
|
+
export declare const POSTGRES_RETRYABLE_ERROR_CODES: readonly string[];
|
|
56
|
+
/** Safe, generic message + stable code for a retryable DB conflict (never leaks internals). */
|
|
57
|
+
export declare const DATABASE_RETRYABLE_ERROR_MESSAGE = "The request conflicted with a concurrent operation; please retry.";
|
|
58
|
+
export declare const DATABASE_RETRYABLE_ERROR_CODE = "database.conflict";
|
|
59
|
+
//# sourceMappingURL=definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../../src/base/middlewares/app-error/definition.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BrB,CAAC;AAEX;;;;;;;;;;GAUG;AACH,eAAO,MAAM,6BAA6B,EAAE,SAAS,MAAM,EAAuB,CAAC;AAEnF,yDAAyD;AACzD,eAAO,MAAM,8BAA8B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA8BjE,CAAC;AAEF,+FAA+F;AAC/F,eAAO,MAAM,sCAAsC,6BAA6B,CAAC;AAEjF;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,EAAE,SAAS,MAAM,EAG3D,CAAC;AAEF,+FAA+F;AAC/F,eAAO,MAAM,gCAAgC,sEACwB,CAAC;AACtE,eAAO,MAAM,6BAA6B,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DATABASE_RETRYABLE_ERROR_CODE = exports.DATABASE_RETRYABLE_ERROR_MESSAGE = exports.POSTGRES_RETRYABLE_ERROR_CODES = exports.DATABASE_CLIENT_ERROR_FALLBACK_MESSAGE = exports.DATABASE_CLIENT_ERROR_MESSAGES = exports.POSTGRES_CLIENT_ERROR_CLASSES = exports.PostgresErrorCodes = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* PostgreSQL SQLSTATE error codes that represent a CLIENT error (HTTP 400) — i.e. caused by the
|
|
6
|
+
* request/data — rather than a server fault. Grouped by SQLSTATE class.
|
|
7
|
+
* @see https://www.postgresql.org/docs/current/errcodes-appendix.html
|
|
8
|
+
*/
|
|
9
|
+
exports.PostgresErrorCodes = {
|
|
10
|
+
// Class 22 — Data Exception (malformed / out-of-range values)
|
|
11
|
+
DATA_EXCEPTION: '22000',
|
|
12
|
+
STRING_DATA_TOO_LONG: '22001',
|
|
13
|
+
NUMERIC_VALUE_OUT_OF_RANGE: '22003',
|
|
14
|
+
NULL_VALUE_NOT_ALLOWED: '22004',
|
|
15
|
+
INVALID_DATETIME_FORMAT: '22007',
|
|
16
|
+
DATETIME_FIELD_OVERFLOW: '22008',
|
|
17
|
+
INVALID_TIME_ZONE_DISPLACEMENT_VALUE: '22009',
|
|
18
|
+
SUBSTRING_ERROR: '22011',
|
|
19
|
+
DIVISION_BY_ZERO: '22012',
|
|
20
|
+
INVALID_PARAMETER_VALUE: '22023',
|
|
21
|
+
INVALID_ESCAPE_SEQUENCE: '22025',
|
|
22
|
+
STRING_DATA_LENGTH_MISMATCH: '22026',
|
|
23
|
+
DUPLICATE_JSON_OBJECT_KEY_VALUE: '22030',
|
|
24
|
+
INVALID_JSON_TEXT: '22032',
|
|
25
|
+
FLOATING_POINT_EXCEPTION: '22P01',
|
|
26
|
+
INVALID_TEXT_REPRESENTATION: '22P02',
|
|
27
|
+
INVALID_BINARY_REPRESENTATION: '22P03',
|
|
28
|
+
UNTRANSLATABLE_CHARACTER: '22P05',
|
|
29
|
+
// Class 23 — Integrity Constraint Violation
|
|
30
|
+
INTEGRITY_CONSTRAINT_VIOLATION: '23000',
|
|
31
|
+
RESTRICT_VIOLATION: '23001',
|
|
32
|
+
NOT_NULL_VIOLATION: '23502',
|
|
33
|
+
FOREIGN_KEY_VIOLATION: '23503',
|
|
34
|
+
UNIQUE_VIOLATION: '23505',
|
|
35
|
+
CHECK_VIOLATION: '23514',
|
|
36
|
+
EXCLUSION_VIOLATION: '23P01',
|
|
37
|
+
// Class 44 — WITH CHECK OPTION Violation (row written through an updatable view fails its CHECK)
|
|
38
|
+
WITH_CHECK_OPTION_VIOLATION: '44000',
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* SQLSTATE classes (first two chars) whose errors are caused by the client request and therefore
|
|
42
|
+
* map to HTTP 400. Any code in these classes — even one without a specific message below — is
|
|
43
|
+
* treated as a client error and uses {@link DATABASE_CLIENT_ERROR_FALLBACK_MESSAGE}.
|
|
44
|
+
*
|
|
45
|
+
* Deliberately excluded (remain server errors / 500): class 42 (syntax, undefined column/table —
|
|
46
|
+
* application/SQL bugs), 53 (insufficient resources), 0A (feature not supported), 25 (invalid
|
|
47
|
+
* transaction state), 28 (DB authorization), 21 (cardinality), 54 (program limits). Class 40
|
|
48
|
+
* (serialization_failure / deadlock_detected) is transient/retryable and is intentionally NOT a
|
|
49
|
+
* 400 — it warrants dedicated 409/503 + retry handling rather than being treated as client input.
|
|
50
|
+
*/
|
|
51
|
+
exports.POSTGRES_CLIENT_ERROR_CLASSES = ['22', '23', '44'];
|
|
52
|
+
/** Human-readable message per specific SQLSTATE code. */
|
|
53
|
+
exports.DATABASE_CLIENT_ERROR_MESSAGES = {
|
|
54
|
+
// Class 22 — Data Exception
|
|
55
|
+
[exports.PostgresErrorCodes.DATA_EXCEPTION]: 'Invalid data value',
|
|
56
|
+
[exports.PostgresErrorCodes.STRING_DATA_TOO_LONG]: 'String data too long',
|
|
57
|
+
[exports.PostgresErrorCodes.NUMERIC_VALUE_OUT_OF_RANGE]: 'Numeric value out of range',
|
|
58
|
+
[exports.PostgresErrorCodes.NULL_VALUE_NOT_ALLOWED]: 'Null value not allowed',
|
|
59
|
+
[exports.PostgresErrorCodes.INVALID_DATETIME_FORMAT]: 'Invalid date/time format',
|
|
60
|
+
[exports.PostgresErrorCodes.DATETIME_FIELD_OVERFLOW]: 'Date/time field value out of range',
|
|
61
|
+
[exports.PostgresErrorCodes.INVALID_TIME_ZONE_DISPLACEMENT_VALUE]: 'Invalid time zone displacement value',
|
|
62
|
+
[exports.PostgresErrorCodes.SUBSTRING_ERROR]: 'Substring error',
|
|
63
|
+
[exports.PostgresErrorCodes.DIVISION_BY_ZERO]: 'Division by zero',
|
|
64
|
+
[exports.PostgresErrorCodes.INVALID_PARAMETER_VALUE]: 'Invalid parameter value',
|
|
65
|
+
[exports.PostgresErrorCodes.INVALID_ESCAPE_SEQUENCE]: 'Invalid escape sequence',
|
|
66
|
+
[exports.PostgresErrorCodes.STRING_DATA_LENGTH_MISMATCH]: 'String data length mismatch',
|
|
67
|
+
[exports.PostgresErrorCodes.DUPLICATE_JSON_OBJECT_KEY_VALUE]: 'Duplicate JSON object key',
|
|
68
|
+
[exports.PostgresErrorCodes.INVALID_JSON_TEXT]: 'Invalid JSON text',
|
|
69
|
+
[exports.PostgresErrorCodes.FLOATING_POINT_EXCEPTION]: 'Floating point exception',
|
|
70
|
+
[exports.PostgresErrorCodes.INVALID_TEXT_REPRESENTATION]: 'Invalid text representation',
|
|
71
|
+
[exports.PostgresErrorCodes.INVALID_BINARY_REPRESENTATION]: 'Invalid binary representation',
|
|
72
|
+
[exports.PostgresErrorCodes.UNTRANSLATABLE_CHARACTER]: 'Untranslatable character',
|
|
73
|
+
// Class 23 — Integrity Constraint Violation
|
|
74
|
+
[exports.PostgresErrorCodes.INTEGRITY_CONSTRAINT_VIOLATION]: 'Integrity constraint violation',
|
|
75
|
+
[exports.PostgresErrorCodes.RESTRICT_VIOLATION]: 'Restrict constraint violation',
|
|
76
|
+
[exports.PostgresErrorCodes.NOT_NULL_VIOLATION]: 'Not null constraint violation',
|
|
77
|
+
[exports.PostgresErrorCodes.FOREIGN_KEY_VIOLATION]: 'Foreign key constraint violation',
|
|
78
|
+
[exports.PostgresErrorCodes.UNIQUE_VIOLATION]: 'Unique constraint violation',
|
|
79
|
+
[exports.PostgresErrorCodes.CHECK_VIOLATION]: 'Check constraint violation',
|
|
80
|
+
[exports.PostgresErrorCodes.EXCLUSION_VIOLATION]: 'Exclusion constraint violation',
|
|
81
|
+
// Class 44 — WITH CHECK OPTION Violation
|
|
82
|
+
[exports.PostgresErrorCodes.WITH_CHECK_OPTION_VIOLATION]: 'View check option violation',
|
|
83
|
+
};
|
|
84
|
+
/** Fallback message for a client-class (22/23/44) error that has no specific message above. */
|
|
85
|
+
exports.DATABASE_CLIENT_ERROR_FALLBACK_MESSAGE = 'Invalid database request';
|
|
86
|
+
/**
|
|
87
|
+
* SQLSTATE codes for transient, retryable transaction conflicts (→ HTTP 409 Conflict). The client
|
|
88
|
+
* can safely retry the same request: the transaction lost a concurrency race rather than sending
|
|
89
|
+
* bad input (not 400) or hitting a server bug (not 500). Retrying usually succeeds.
|
|
90
|
+
*/
|
|
91
|
+
exports.POSTGRES_RETRYABLE_ERROR_CODES = [
|
|
92
|
+
'40001', // serialization_failure
|
|
93
|
+
'40P01', // deadlock_detected
|
|
94
|
+
];
|
|
95
|
+
/** Safe, generic message + stable code for a retryable DB conflict (never leaks internals). */
|
|
96
|
+
exports.DATABASE_RETRYABLE_ERROR_MESSAGE = 'The request conflicted with a concurrent operation; please retry.';
|
|
97
|
+
exports.DATABASE_RETRYABLE_ERROR_CODE = 'database.conflict';
|
|
98
|
+
//# sourceMappingURL=definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../../src/base/middlewares/app-error/definition.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACU,QAAA,kBAAkB,GAAG;IAChC,8DAA8D;IAC9D,cAAc,EAAE,OAAO;IACvB,oBAAoB,EAAE,OAAO;IAC7B,0BAA0B,EAAE,OAAO;IACnC,sBAAsB,EAAE,OAAO;IAC/B,uBAAuB,EAAE,OAAO;IAChC,uBAAuB,EAAE,OAAO;IAChC,oCAAoC,EAAE,OAAO;IAC7C,eAAe,EAAE,OAAO;IACxB,gBAAgB,EAAE,OAAO;IACzB,uBAAuB,EAAE,OAAO;IAChC,uBAAuB,EAAE,OAAO;IAChC,2BAA2B,EAAE,OAAO;IACpC,+BAA+B,EAAE,OAAO;IACxC,iBAAiB,EAAE,OAAO;IAC1B,wBAAwB,EAAE,OAAO;IACjC,2BAA2B,EAAE,OAAO;IACpC,6BAA6B,EAAE,OAAO;IACtC,wBAAwB,EAAE,OAAO;IACjC,4CAA4C;IAC5C,8BAA8B,EAAE,OAAO;IACvC,kBAAkB,EAAE,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A6B;IAC/E,CAAC,0BAAkB,CAAC,6BAA6B,CAAC,EAAE,+BAA+B;IACnF,CAAC,0BAAkB,CAAC,wBAAwB,CAAC,EAAE,0BAA0B;IACzE,4CAA4C;IAC5C,CAAC,0BAAkB,CAAC,8BAA8B,CAAC,EAAE,gCAAgC;IACrF,CAAC,0BAAkB,CAAC,kBAAkB,CAAC,EAAE,+BAA+B;IACxE,CAAC,0BAAkB,CAAC,kBAAkB,CAAC,EAAE,+BAA+B;IACxE,CAAC,0BAAkB,CAAC,qBAAqB,CAAC,EAAE,kCAAkC;IAC9E,CAAC,0BAAkB,CAAC,gBAAgB,CAAC,EAAE,6BAA6B;IACpE,CAAC,0BAAkB,CAAC,eAAe,CAAC,EAAE,4BAA4B;IAClE,CAAC,0BAAkB,CAAC,mBAAmB,CAAC,EAAE,gCAAgC;IAC1E,yCAAyC;IACzC,CAAC,0BAAkB,CAAC,2BAA2B,CAAC,EAAE,6BAA6B;CAChF,CAAC;AAEF,+FAA+F;AAClF,QAAA,sCAAsC,GAAG,0BAA0B,CAAC;AAEjF;;;;GAIG;AACU,QAAA,8BAA8B,GAAsB;IAC/D,OAAO,EAAE,wBAAwB;IACjC,OAAO,EAAE,oBAAoB;CAC9B,CAAC;AAEF,+FAA+F;AAClF,QAAA,gCAAgC,GAC3C,mEAAmE,CAAC;AACzD,QAAA,6BAA6B,GAAG,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/base/middlewares/app-error/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./app-error.middleware"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/base/middlewares/app-error/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface IDatabaseError extends Error {
|
|
2
|
+
code?: string;
|
|
3
|
+
cause?: {
|
|
4
|
+
code?: string;
|
|
5
|
+
detail?: string;
|
|
6
|
+
table?: string;
|
|
7
|
+
constraint?: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface IZodIssueLike {
|
|
11
|
+
path: Array<string | number>;
|
|
12
|
+
message: string;
|
|
13
|
+
code?: string;
|
|
14
|
+
params?: Record<string, unknown>;
|
|
15
|
+
expected?: unknown;
|
|
16
|
+
received?: unknown;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/base/middlewares/app-error/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAe,SAAQ,KAAK;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/base/middlewares/app-error/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { HTTPResponseError } from 'hono/types';
|
|
2
|
+
/**
|
|
3
|
+
* Formats a ZodError into the 422 validation response. Top-level `messageCode`/`message` come from
|
|
4
|
+
* the first issue that defines a custom `params.code`, else the first issue's raw Zod code; the full
|
|
5
|
+
* per-issue list stays under `details.cause`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const formatZodError: (opts: {
|
|
8
|
+
isProduction: boolean;
|
|
9
|
+
requestId: string;
|
|
10
|
+
url: string;
|
|
11
|
+
path: string;
|
|
12
|
+
error: Error | HTTPResponseError;
|
|
13
|
+
}) => {
|
|
14
|
+
statusCode: 422;
|
|
15
|
+
response: {
|
|
16
|
+
message: string;
|
|
17
|
+
messageCode: string | undefined;
|
|
18
|
+
statusCode: 422;
|
|
19
|
+
requestId: string;
|
|
20
|
+
details: {
|
|
21
|
+
url: string;
|
|
22
|
+
path: string;
|
|
23
|
+
stack: string | undefined;
|
|
24
|
+
cause: unknown;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=zod.handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod.handler.d.ts","sourceRoot":"","sources":["../../../../src/base/middlewares/app-error/zod.handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAgB/C;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM;IACnC,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,KAAK,GAAG,iBAAiB,CAAC;CAClC;;;;;;;;;;;;;;CAgDA,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatZodError = void 0;
|
|
4
|
+
const ignis_helpers_1 = require("@venizia/ignis-helpers");
|
|
5
|
+
const DEFAULT_VALIDATION_MESSAGE = 'ValidationError';
|
|
6
|
+
/** Returns a schema-author-supplied code (`issue.params.code`) when it is a non-empty string. */
|
|
7
|
+
const extractIssueCode = (opts) => {
|
|
8
|
+
const paramsCode = opts.issue?.params?.code;
|
|
9
|
+
if (typeof paramsCode === 'string' && paramsCode.length > 0) {
|
|
10
|
+
return paramsCode;
|
|
11
|
+
}
|
|
12
|
+
return undefined;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Formats a ZodError into the 422 validation response. Top-level `messageCode`/`message` come from
|
|
16
|
+
* the first issue that defines a custom `params.code`, else the first issue's raw Zod code; the full
|
|
17
|
+
* per-issue list stays under `details.cause`.
|
|
18
|
+
*/
|
|
19
|
+
const formatZodError = (opts) => {
|
|
20
|
+
const { isProduction, requestId, url, path, error } = opts;
|
|
21
|
+
const statusCode = ignis_helpers_1.HTTP.ResultCodes.RS_4.UnprocessableEntity;
|
|
22
|
+
let validationErrors;
|
|
23
|
+
try {
|
|
24
|
+
validationErrors = JSON.parse(error.message);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
validationErrors = error;
|
|
28
|
+
}
|
|
29
|
+
const issues = Array.isArray(validationErrors) ? validationErrors : null;
|
|
30
|
+
// Top-level messageCode/message: prefer the first issue with a custom `params.code`;
|
|
31
|
+
// else fall back to the first issue's raw Zod code; else keep the generic message.
|
|
32
|
+
let messageCode;
|
|
33
|
+
let message = DEFAULT_VALIDATION_MESSAGE;
|
|
34
|
+
if (issues && issues.length > 0) {
|
|
35
|
+
const primaryIssue = issues.find(issue => extractIssueCode({ issue }) !== undefined) ?? issues[0];
|
|
36
|
+
messageCode = extractIssueCode({ issue: primaryIssue }) ?? primaryIssue.code;
|
|
37
|
+
message = primaryIssue.message;
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
statusCode,
|
|
41
|
+
response: {
|
|
42
|
+
message,
|
|
43
|
+
messageCode,
|
|
44
|
+
statusCode,
|
|
45
|
+
requestId,
|
|
46
|
+
details: {
|
|
47
|
+
url,
|
|
48
|
+
path,
|
|
49
|
+
stack: !isProduction ? error.stack : undefined,
|
|
50
|
+
cause: issues
|
|
51
|
+
? issues.map(el => ({
|
|
52
|
+
path: el.path.join('.') || 'root',
|
|
53
|
+
message: el.message,
|
|
54
|
+
code: el.code,
|
|
55
|
+
expected: el.expected,
|
|
56
|
+
received: el.received,
|
|
57
|
+
}))
|
|
58
|
+
: validationErrors,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
exports.formatZodError = formatZodError;
|
|
64
|
+
//# sourceMappingURL=zod.handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod.handler.js","sourceRoot":"","sources":["../../../../src/base/middlewares/app-error/zod.handler.ts"],"names":[],"mappings":";;;AAAA,0DAA8C;AAI9C,MAAM,0BAA0B,GAAG,iBAAiB,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EAAE,YAAY,EAAE,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC;QAC7E,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC;IACjC,CAAC;IAED,OAAO;QACL,UAAU;QACV,QAAQ,EAAE;YACR,OAAO;YACP,WAAW;YACX,UAAU;YACV,SAAS;YACT,OAAO,EAAE;gBACP,GAAG;gBACH,IAAI;gBACJ,KAAK,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;gBAC9C,KAAK,EAAE,MAAM;oBACX,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;wBAChB,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,MAAM;wBACjC,OAAO,EAAE,EAAE,CAAC,OAAO;wBACnB,IAAI,EAAE,EAAE,CAAC,IAAI;wBACb,QAAQ,EAAE,EAAE,CAAC,QAAQ;wBACrB,QAAQ,EAAE,EAAE,CAAC,QAAQ;qBACtB,CAAC,CAAC;oBACL,CAAC,CAAC,gBAAgB;aACrB;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AAtDW,QAAA,cAAc,kBAsDzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emoji-favicon.middleware.d.ts","sourceRoot":"","sources":["../../../../src/base/middlewares/emoji-favicon/emoji-favicon.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAG9C,yDAAyD;AACzD,eAAO,MAAM,YAAY,GAAI,MAAM;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,KAAG,iBAerD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emoji-favicon.middleware.js","sourceRoot":"","sources":["../../../../src/base/middlewares/emoji-favicon/emoji-favicon.middleware.ts"],"names":[],"mappings":";;;AACA,0CAAgD;AAEhD,yDAAyD;AAClD,MAAM,YAAY,GAAG,CAAC,IAAsB,EAAqB,EAAE;IACxE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAEtB,MAAM,EAAE,GAAG,IAAA,0BAAgB,EAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAClD,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YACxC,OAAO,IAAI,EAAE,CAAC;QAChB,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;QACzD,OAAO,OAAO,CAAC,IAAI,CACjB,0GAA0G,IAAI,eAAe,CAC9H,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAfW,QAAA,YAAY,gBAevB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/base/middlewares/emoji-favicon/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./emoji-favicon.middleware"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/base/middlewares/emoji-favicon/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './app-error
|
|
2
|
-
export * from './emoji-favicon
|
|
3
|
-
export * from './not-found
|
|
4
|
-
export * from './request-spy
|
|
1
|
+
export * from './app-error';
|
|
2
|
+
export * from './emoji-favicon';
|
|
3
|
+
export * from './not-found';
|
|
4
|
+
export * from './request-spy';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/base/middlewares/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/base/middlewares/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
|
|
@@ -14,8 +14,8 @@ 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("./app-error
|
|
18
|
-
__exportStar(require("./emoji-favicon
|
|
19
|
-
__exportStar(require("./not-found
|
|
20
|
-
__exportStar(require("./request-spy
|
|
17
|
+
__exportStar(require("./app-error"), exports);
|
|
18
|
+
__exportStar(require("./emoji-favicon"), exports);
|
|
19
|
+
__exportStar(require("./not-found"), exports);
|
|
20
|
+
__exportStar(require("./request-spy"), exports);
|
|
21
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/base/middlewares/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/base/middlewares/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,kDAAgC;AAChC,8CAA4B;AAC5B,gDAA8B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/base/middlewares/not-found/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./not-found.middleware"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/base/middlewares/not-found/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-found.middleware.d.ts","sourceRoot":"","sources":["../../../../src/base/middlewares/not-found/not-found.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG7C,eAAO,MAAM,eAAe,GAAI,MAAM;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,oBA0BxD,CAAC"}
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.notFoundHandler = void 0;
|
|
4
4
|
const ignis_helpers_1 = require("@venizia/ignis-helpers");
|
|
5
|
-
const
|
|
6
|
-
/** Logs unknown URLs and returns a JSON 404 response. */
|
|
5
|
+
const request_spy_1 = require("../request-spy");
|
|
7
6
|
const notFoundHandler = (opts) => {
|
|
8
7
|
const { logger = console } = opts;
|
|
9
8
|
const mw = async (context) => {
|
|
10
|
-
const requestId = context.get(
|
|
9
|
+
const requestId = context.get(request_spy_1.RequestSpyMiddleware.REQUEST_ID_KEY);
|
|
11
10
|
logger.error('[%s] URL NOT FOUND | path: %s | url: %s', requestId, context.req.path, context.req.url);
|
|
12
11
|
return context.json({
|
|
13
12
|
message: 'URL NOT FOUND',
|
package/dist/base/middlewares/{not-found.middleware.js.map → not-found/not-found.middleware.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"not-found.middleware.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"not-found.middleware.js","sourceRoot":"","sources":["../../../../src/base/middlewares/not-found/not-found.middleware.ts"],"names":[],"mappings":";;;AAAA,0DAAsD;AAEtD,gDAAsD;AAE/C,MAAM,eAAe,GAAG,CAAC,IAAyB,EAAE,EAAE;IAC3D,MAAM,EAAE,MAAM,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;IAElC,MAAM,EAAE,GAAoB,KAAK,EAAC,OAAO,EAAC,EAAE;QAC1C,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,kCAAoB,CAAC,cAAc,CAAC,CAAC;QAEnE,MAAM,CAAC,KAAK,CACV,yCAAyC,EACzC,SAAS,EACT,OAAO,CAAC,GAAG,CAAC,IAAI,EAChB,OAAO,CAAC,GAAG,CAAC,GAAG,CAChB,CAAC;QAEF,OAAO,OAAO,CAAC,IAAI,CACjB;YACE,OAAO,EAAE,eAAe;YACxB,UAAU,EAAE,oBAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ;YAC1C,SAAS;YACT,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI;YACtB,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG;SACrB,EACD,oBAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAC/B,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AA1BW,QAAA,eAAe,mBA0B1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/base/middlewares/request-spy/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./request-spy.middleware"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/base/middlewares/request-spy/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseHelper } from '@venizia/ignis-helpers';
|
|
2
2
|
import { IProvider } from '@venizia/ignis-inversion';
|
|
3
3
|
import { MiddlewareHandler } from 'hono/types';
|
|
4
|
-
import { TContext } from '
|
|
4
|
+
import { TContext } from '../../controllers';
|
|
5
5
|
/** Logs incoming/outgoing request details. Body/query only logged in non-production. */
|
|
6
6
|
export declare class RequestSpyMiddleware extends BaseHelper implements IProvider<MiddlewareHandler> {
|
|
7
7
|
static readonly REQUEST_ID_KEY = "requestId";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-spy.middleware.d.ts","sourceRoot":"","sources":["../../../../src/base/middlewares/request-spy/request-spy.middleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAA+B,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,wFAAwF;AACxF,qBAAa,oBAAqB,SAAQ,UAAW,YAAW,SAAS,CAAC,iBAAiB,CAAC;IAC1F,MAAM,CAAC,QAAQ,CAAC,cAAc,eAAe;IAE7C,OAAO,CAAC,WAAW,CAAU;;IAS7B,wDAAwD;IAClD,SAAS,CAAC,IAAI,EAAE;QAAE,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAoCjE,wEAAwE;IACxE,KAAK;CAwDN"}
|
package/dist/base/middlewares/{request-spy.middleware.js → request-spy/request-spy.middleware.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RequestSpyMiddleware = void 0;
|
|
4
|
-
const network_utility_1 = require("
|
|
4
|
+
const network_utility_1 = require("../../../utilities/network.utility");
|
|
5
5
|
const ignis_helpers_1 = require("@venizia/ignis-helpers");
|
|
6
6
|
const factory_1 = require("hono/factory");
|
|
7
7
|
/** Logs incoming/outgoing request details. Body/query only logged in non-production. */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-spy.middleware.js","sourceRoot":"","sources":["../../../../src/base/middlewares/request-spy/request-spy.middleware.ts"],"names":[],"mappings":";;;AAAA,iEAA4D;AAC5D,0DAAiF;AAEjF,0CAAgD;AAIhD,wFAAwF;AACxF,MAAa,oBAAqB,SAAQ,0BAAU;aAClC,mBAAc,GAAG,WAAW,CAAC;IAI7C;QACE,KAAK,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;QAC1B,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;QACjC,MAAM,GAAG,GAAG,QAAQ,EAAE,WAAW,EAAE,CAAC;QACpC,IAAI,CAAC,WAAW,GAAG,GAAG,KAAK,2BAAW,CAAC,UAAU,CAAC;IACpD,CAAC;IAED,wDAA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AAS,EACT,QAAQ,EACR,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,EACrB,IAAI,EACJ,KAAK,CACN,CAAC;YACJ,CAAC;YAED,MAAM,IAAI,EAAE,CAAC;YAEb,MAAM,QAAQ,GAAG,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACpD,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,oCAAoC,EACpC,SAAS,EACT,QAAQ,EACR,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,EACrB,IAAI,EACJ,QAAQ,CACT,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;;AAzGH,oDA0GC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venizia/ignis",
|
|
3
|
-
"version": "0.0.9-
|
|
3
|
+
"version": "0.0.9-20",
|
|
4
4
|
"description": "High-performance TypeScript server infrastructure combining LoopBack 4 enterprise architecture (decorator-based DI, repository pattern, component system) with Hono speed (~140k req/s). Features auto-generated OpenAPI docs, Drizzle ORM type-safe SQL, JWT/Basic authentication, Casbin authorization, convention-based bootstrapping, and pluggable components for health checks, Swagger UI, mail, Socket.IO, and static assets. Built for Bun and Node.js.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"access-control",
|
|
@@ -135,6 +135,7 @@
|
|
|
135
135
|
"scripts": {
|
|
136
136
|
"force-update": "sh ./scripts/force-update.sh",
|
|
137
137
|
"build": "sh ./scripts/build.sh",
|
|
138
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
138
139
|
"clean": "sh ./scripts/clean.sh",
|
|
139
140
|
"eslint": "eslint --report-unused-disable-directives .",
|
|
140
141
|
"lint": "bun run eslint && bun run prettier:cli",
|
|
@@ -145,9 +146,9 @@
|
|
|
145
146
|
"prepublishOnly": "bun run rebuild"
|
|
146
147
|
},
|
|
147
148
|
"dependencies": {
|
|
148
|
-
"@venizia/ignis-boot": "^0.0.5-
|
|
149
|
-
"@venizia/ignis-helpers": "^0.0.8-
|
|
150
|
-
"@venizia/ignis-inversion": "^0.0.6-
|
|
149
|
+
"@venizia/ignis-boot": "^0.0.5-10",
|
|
150
|
+
"@venizia/ignis-helpers": "^0.0.8-14",
|
|
151
|
+
"@venizia/ignis-inversion": "^0.0.6-3",
|
|
151
152
|
"lodash": "^4.18.1",
|
|
152
153
|
"reflect-metadata": "^0.2.2"
|
|
153
154
|
},
|
|
@@ -228,7 +229,7 @@
|
|
|
228
229
|
"@types/lodash": "^4.17.23",
|
|
229
230
|
"@types/nodemailer": "^8.0.0",
|
|
230
231
|
"@types/pg": "^8.20.0",
|
|
231
|
-
"@venizia/dev-configs": "^0.0.7-
|
|
232
|
+
"@venizia/dev-configs": "^0.0.7-3",
|
|
232
233
|
"drizzle-kit": "^0.31.10",
|
|
233
234
|
"eslint": "^10.4.0",
|
|
234
235
|
"prettier": "^3.8.3",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Logger } from '@venizia/ignis-helpers';
|
|
2
|
-
import { ErrorHandler } from 'hono/types';
|
|
3
|
-
/** Application error handler with ZodError and database constraint error support. */
|
|
4
|
-
export declare const appErrorHandler: (opts: {
|
|
5
|
-
logger: Logger;
|
|
6
|
-
rootKey?: string;
|
|
7
|
-
}) => ErrorHandler;
|
|
8
|
-
//# sourceMappingURL=app-error.middleware.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"app-error.middleware.d.ts","sourceRoot":"","sources":["../../../src/base/middlewares/app-error.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAqB,MAAM,YAAY,CAAC;AAsH7D,qFAAqF;AACrF,eAAO,MAAM,eAAe,GAAI,MAAM;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,iBAgEzE,CAAC"}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.appErrorHandler = void 0;
|
|
4
|
-
const ignis_helpers_1 = require("@venizia/ignis-helpers");
|
|
5
|
-
const request_spy_middleware_1 = require("./request-spy.middleware");
|
|
6
|
-
/**
|
|
7
|
-
* PostgreSQL SQLSTATE error codes for integrity constraint violations (Class 23).
|
|
8
|
-
* These are client errors and should return HTTP 400, not 500.
|
|
9
|
-
* @see https://www.postgresql.org/docs/current/errcodes-appendix.html
|
|
10
|
-
*/
|
|
11
|
-
const PostgresErrorCodes = {
|
|
12
|
-
UNIQUE_VIOLATION: '23505',
|
|
13
|
-
FOREIGN_KEY_VIOLATION: '23503',
|
|
14
|
-
NOT_NULL_VIOLATION: '23502',
|
|
15
|
-
CHECK_VIOLATION: '23514',
|
|
16
|
-
EXCLUSION_VIOLATION: '23P01',
|
|
17
|
-
INVALID_TEXT_REPRESENTATION: '22P02',
|
|
18
|
-
NUMERIC_VALUE_OUT_OF_RANGE: '22003',
|
|
19
|
-
STRING_DATA_TOO_LONG: '22001',
|
|
20
|
-
};
|
|
21
|
-
const DATABASE_CLIENT_ERROR_MESSAGES = {
|
|
22
|
-
[PostgresErrorCodes.UNIQUE_VIOLATION]: 'Unique constraint violation',
|
|
23
|
-
[PostgresErrorCodes.FOREIGN_KEY_VIOLATION]: 'Foreign key constraint violation',
|
|
24
|
-
[PostgresErrorCodes.NOT_NULL_VIOLATION]: 'Not null constraint violation',
|
|
25
|
-
[PostgresErrorCodes.CHECK_VIOLATION]: 'Check constraint violation',
|
|
26
|
-
[PostgresErrorCodes.EXCLUSION_VIOLATION]: 'Exclusion constraint violation',
|
|
27
|
-
[PostgresErrorCodes.INVALID_TEXT_REPRESENTATION]: 'Invalid text representation',
|
|
28
|
-
[PostgresErrorCodes.NUMERIC_VALUE_OUT_OF_RANGE]: 'Numeric value out of range',
|
|
29
|
-
[PostgresErrorCodes.STRING_DATA_TOO_LONG]: 'String data too long',
|
|
30
|
-
};
|
|
31
|
-
/** Checks if error is a database constraint error that should return 400. */
|
|
32
|
-
const isDatabaseClientError = (opts) => {
|
|
33
|
-
const { error } = opts;
|
|
34
|
-
const dbError = error;
|
|
35
|
-
const cause = dbError.cause;
|
|
36
|
-
const code = dbError.code || cause?.code;
|
|
37
|
-
if (code && DATABASE_CLIENT_ERROR_MESSAGES[code]) {
|
|
38
|
-
const baseMessage = DATABASE_CLIENT_ERROR_MESSAGES[code];
|
|
39
|
-
const detail = cause?.detail;
|
|
40
|
-
const table = cause?.table;
|
|
41
|
-
const constraint = cause?.constraint;
|
|
42
|
-
// Build readable message with line breaks
|
|
43
|
-
const lines = [baseMessage];
|
|
44
|
-
if (detail) {
|
|
45
|
-
lines.push(`Detail: ${detail}`);
|
|
46
|
-
}
|
|
47
|
-
if (table) {
|
|
48
|
-
lines.push(`Table: ${table}`);
|
|
49
|
-
}
|
|
50
|
-
if (constraint) {
|
|
51
|
-
lines.push(`Constraint: ${constraint}`);
|
|
52
|
-
}
|
|
53
|
-
return {
|
|
54
|
-
isClientError: true,
|
|
55
|
-
message: lines.join('\n'),
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
return { isClientError: false };
|
|
59
|
-
};
|
|
60
|
-
const formatZodError = (opts) => {
|
|
61
|
-
const { isProduction, requestId, url, path, error } = opts;
|
|
62
|
-
const statusCode = ignis_helpers_1.HTTP.ResultCodes.RS_4.UnprocessableEntity;
|
|
63
|
-
let validationErrors;
|
|
64
|
-
try {
|
|
65
|
-
validationErrors = JSON.parse(error.message);
|
|
66
|
-
}
|
|
67
|
-
catch {
|
|
68
|
-
validationErrors = error;
|
|
69
|
-
}
|
|
70
|
-
return {
|
|
71
|
-
statusCode,
|
|
72
|
-
response: {
|
|
73
|
-
message: 'ValidationError',
|
|
74
|
-
statusCode,
|
|
75
|
-
requestId,
|
|
76
|
-
details: {
|
|
77
|
-
url,
|
|
78
|
-
path,
|
|
79
|
-
stack: !isProduction ? error.stack : undefined,
|
|
80
|
-
cause: Array.isArray(validationErrors)
|
|
81
|
-
? validationErrors.map(el => ({
|
|
82
|
-
path: el.path.join('.') || 'root',
|
|
83
|
-
message: el.message,
|
|
84
|
-
code: el.code,
|
|
85
|
-
expected: el.expected,
|
|
86
|
-
received: el.received,
|
|
87
|
-
}))
|
|
88
|
-
: validationErrors,
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
/** Application error handler with ZodError and database constraint error support. */
|
|
94
|
-
const appErrorHandler = (opts) => {
|
|
95
|
-
const { logger = console, rootKey = null } = opts;
|
|
96
|
-
const mw = async (error, context) => {
|
|
97
|
-
const requestId = context.get(request_spy_middleware_1.RequestSpyMiddleware.REQUEST_ID_KEY);
|
|
98
|
-
logger.error('[onError][%s] REQUEST ERROR | path: %s | method: %s | url: %s | Error: %j', requestId, context.req.path, context.req.method, context.req.url, error);
|
|
99
|
-
const { NODE_ENV } = process.env;
|
|
100
|
-
const env = context.env?.NODE_ENV || NODE_ENV;
|
|
101
|
-
const isProduction = env?.toLowerCase() === ignis_helpers_1.Environment.PRODUCTION;
|
|
102
|
-
const statusCode = 'statusCode' in error ? error.statusCode : ignis_helpers_1.HTTP.ResultCodes.RS_5.InternalServerError;
|
|
103
|
-
const messageCode = 'messageCode' in error ? error.messageCode : undefined;
|
|
104
|
-
if (error.name === 'ZodError') {
|
|
105
|
-
const rs = formatZodError({
|
|
106
|
-
isProduction,
|
|
107
|
-
requestId,
|
|
108
|
-
url: context.req.url,
|
|
109
|
-
path: context.req.path,
|
|
110
|
-
error,
|
|
111
|
-
});
|
|
112
|
-
return context.json(rs.response, rs.statusCode);
|
|
113
|
-
}
|
|
114
|
-
// Determine if this is a database client error (should be 400, not 500)
|
|
115
|
-
const dbError = isDatabaseClientError({ error });
|
|
116
|
-
const resolvedStatusCode = dbError.isClientError
|
|
117
|
-
? ignis_helpers_1.HTTP.ResultCodes.RS_4.BadRequest
|
|
118
|
-
: statusCode;
|
|
119
|
-
const resolvedMessage = dbError.isClientError && dbError.message ? dbError.message : error.message;
|
|
120
|
-
const rs = {
|
|
121
|
-
message: resolvedMessage,
|
|
122
|
-
messageCode,
|
|
123
|
-
statusCode: resolvedStatusCode,
|
|
124
|
-
requestId,
|
|
125
|
-
extra: 'extra' in error ? error?.extra : undefined,
|
|
126
|
-
details: {
|
|
127
|
-
url: context.req.url,
|
|
128
|
-
path: context.req.path,
|
|
129
|
-
stack: !isProduction ? error.stack : undefined,
|
|
130
|
-
cause: !isProduction ? error.cause : undefined,
|
|
131
|
-
},
|
|
132
|
-
};
|
|
133
|
-
return context.json(rootKey ? { [rootKey]: rs } : rs, resolvedStatusCode);
|
|
134
|
-
};
|
|
135
|
-
return mw;
|
|
136
|
-
};
|
|
137
|
-
exports.appErrorHandler = appErrorHandler;
|
|
138
|
-
//# sourceMappingURL=app-error.middleware.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"app-error.middleware.js","sourceRoot":"","sources":["../../../src/base/middlewares/app-error.middleware.ts"],"names":[],"mappings":";;;AAAA,0DAAmE;AAEnE,qEAAgE;AAEhE;;;;GAIG;AACH,MAAM,kBAAkB,GAAG;IACzB,gBAAgB,EAAE,OAAO;IACzB,qBAAqB,EAAE,OAAO;IAC9B,kBAAkB,EAAE,OAAO;IAC3B,eAAe,EAAE,OAAO;IACxB,mBAAmB,EAAE,OAAO;IAC5B,2BAA2B,EAAE,OAAO;IACpC,0BAA0B,EAAE,OAAO;IACnC,oBAAoB,EAAE,OAAO;CACrB,CAAC;AAEX,MAAM,8BAA8B,GAA2B;IAC7D,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,EAAE,6BAA6B;IACpE,CAAC,kBAAkB,CAAC,qBAAqB,CAAC,EAAE,kCAAkC;IAC9E,CAAC,kBAAkB,CAAC,kBAAkB,CAAC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
|
|
1
|
-
{"version":3,"file":"emoji-favicon.middleware.d.ts","sourceRoot":"","sources":["../../../src/base/middlewares/emoji-favicon.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAG9C,yDAAyD;AACzD,eAAO,MAAM,YAAY,GAAI,MAAM;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,KAAG,iBAerD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"emoji-favicon.middleware.js","sourceRoot":"","sources":["../../../src/base/middlewares/emoji-favicon.middleware.ts"],"names":[],"mappings":";;;AACA,0CAAgD;AAEhD,yDAAyD;AAClD,MAAM,YAAY,GAAG,CAAC,IAAsB,EAAqB,EAAE;IACxE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAEtB,MAAM,EAAE,GAAG,IAAA,0BAAgB,EAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAClD,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YACxC,OAAO,IAAI,EAAE,CAAC;QAChB,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;QACzD,OAAO,OAAO,CAAC,IAAI,CACjB,0GAA0G,IAAI,eAAe,CAC9H,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAfW,QAAA,YAAY,gBAevB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"not-found.middleware.d.ts","sourceRoot":"","sources":["../../../src/base/middlewares/not-found.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAQ,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG7C,yDAAyD;AACzD,eAAO,MAAM,eAAe,GAAI,MAAM;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,oBA0BxD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request-spy.middleware.d.ts","sourceRoot":"","sources":["../../../src/base/middlewares/request-spy.middleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAA+B,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,wFAAwF;AACxF,qBAAa,oBAAqB,SAAQ,UAAW,YAAW,SAAS,CAAC,iBAAiB,CAAC;IAC1F,MAAM,CAAC,QAAQ,CAAC,cAAc,eAAe;IAE7C,OAAO,CAAC,WAAW,CAAU;;IAS7B,wDAAwD;IAClD,SAAS,CAAC,IAAI,EAAE;QAAE,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAoCjE,wEAAwE;IACxE,KAAK;CAwDN"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request-spy.middleware.js","sourceRoot":"","sources":["../../../src/base/middlewares/request-spy.middleware.ts"],"names":[],"mappings":";;;AAAA,iEAA4D;AAC5D,0DAAiF;AAEjF,0CAAgD;AAIhD,wFAAwF;AACxF,MAAa,oBAAqB,SAAQ,0BAAU;aAClC,mBAAc,GAAG,WAAW,CAAC;IAI7C;QACE,KAAK,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;QAC1B,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;QACjC,MAAM,GAAG,GAAG,QAAQ,EAAE,WAAW,EAAE,CAAC;QACpC,IAAI,CAAC,WAAW,GAAG,GAAG,KAAK,2BAAW,CAAC,UAAU,CA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