@royalinvest/dto 0.74.1 → 0.74.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.
|
@@ -9,7 +9,7 @@ export type TCreditScoreTier = "a_plus" | "a" | "b_plus" | "b" | "c_plus" | "c"
|
|
|
9
9
|
export type TCreditCheckRequestStatus = "draft" | "pending" | "completed" | "failed" | "expired" | "cancelled";
|
|
10
10
|
export type TCreditCheckInitiated = "tenant_initiated" | "landlord_initiated";
|
|
11
11
|
export type TCreditCheckErrorType = "bureau" | "document-generation" | "report-processing" | "other";
|
|
12
|
-
export type TConsentAuditAction = "sent" | "resent" | "viewed" | "confirmed" | "failed";
|
|
12
|
+
export type TConsentAuditAction = "sent" | "resent" | "viewed" | "confirmed" | "failed" | "revoke";
|
|
13
13
|
export type TConsentStatus = "none" | "pending" | "confirmed" | "expired" | "cancelled";
|
|
14
14
|
export type IConsentMethod = "checkbox" | "uploaded_file";
|
|
15
15
|
export type TReason = {
|
|
@@ -480,3 +480,8 @@ export interface ICreditCheckAlerts {
|
|
|
480
480
|
message: string;
|
|
481
481
|
}[];
|
|
482
482
|
}
|
|
483
|
+
export interface ISubmitConsent {
|
|
484
|
+
confirmedConsent: boolean;
|
|
485
|
+
document_language?: string;
|
|
486
|
+
bureau: TBureau;
|
|
487
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Uses pino's default error serializer for Error typed data.
|
|
3
|
+
*
|
|
4
|
+
* Also handles untyped third-party library errors and errors escaped
|
|
5
|
+
* ESLint "@typescript-eslint/prefer-promise-reject-errors" rule
|
|
6
|
+
* by ensuring consistent error object structure.
|
|
7
|
+
* This is necessary for log processing tools to properly index the error.
|
|
8
|
+
*/
|
|
9
|
+
export declare const errorSerializer: (error: unknown) => import("pino-std-serializers").SerializedError | {
|
|
10
|
+
message: unknown;
|
|
11
|
+
details: string;
|
|
12
|
+
is_native_error: boolean;
|
|
13
|
+
} | {
|
|
14
|
+
message: string;
|
|
15
|
+
is_native_error: boolean;
|
|
16
|
+
details?: undefined;
|
|
17
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.errorSerializer = void 0;
|
|
7
|
+
const pino_1 = __importDefault(require("pino"));
|
|
8
|
+
const MAX_DETAILS_LENGTH = 1000;
|
|
9
|
+
/**
|
|
10
|
+
* Uses pino's default error serializer for Error typed data.
|
|
11
|
+
*
|
|
12
|
+
* Also handles untyped third-party library errors and errors escaped
|
|
13
|
+
* ESLint "@typescript-eslint/prefer-promise-reject-errors" rule
|
|
14
|
+
* by ensuring consistent error object structure.
|
|
15
|
+
* This is necessary for log processing tools to properly index the error.
|
|
16
|
+
*/
|
|
17
|
+
const errorSerializer = (error) => {
|
|
18
|
+
if (error instanceof Error) {
|
|
19
|
+
return pino_1.default.stdSerializers.err(error);
|
|
20
|
+
}
|
|
21
|
+
// Adds is_native_error flag to differentiate native errors from others
|
|
22
|
+
if (error && typeof error === "object") {
|
|
23
|
+
let details;
|
|
24
|
+
try {
|
|
25
|
+
details = JSON.stringify(error);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
details = "[Unserializable Object]";
|
|
29
|
+
}
|
|
30
|
+
if (details.length > MAX_DETAILS_LENGTH) {
|
|
31
|
+
details = details.substring(0, MAX_DETAILS_LENGTH) + "...";
|
|
32
|
+
}
|
|
33
|
+
let message;
|
|
34
|
+
if ("message" in error)
|
|
35
|
+
message = error.message;
|
|
36
|
+
else if ("msg" in error)
|
|
37
|
+
message = error.msg;
|
|
38
|
+
if (!message || typeof message !== "string") {
|
|
39
|
+
message = "Error with unknown type";
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
message,
|
|
43
|
+
details,
|
|
44
|
+
is_native_error: false,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
message: String(error),
|
|
49
|
+
is_native_error: false,
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
exports.errorSerializer = errorSerializer;
|
package/dist/logger/index.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.baseLogger = void 0;
|
|
7
7
|
exports.createScopedLogger = createScopedLogger;
|
|
8
8
|
const pino_1 = __importDefault(require("pino"));
|
|
9
|
+
const errorSerializer_1 = require("./errorSerializer");
|
|
9
10
|
const isDev = process.env.NODE_ENV === "development";
|
|
10
11
|
const LOG_LEVEL = process.env.LOG_LEVEL || "info";
|
|
11
12
|
exports.baseLogger = (0, pino_1.default)({
|
|
@@ -26,6 +27,12 @@ exports.baseLogger = (0, pino_1.default)({
|
|
|
26
27
|
},
|
|
27
28
|
}
|
|
28
29
|
: undefined,
|
|
30
|
+
serializers: {
|
|
31
|
+
// Includes "error" in error serializing
|
|
32
|
+
// Uses custom serializer to handle more error types
|
|
33
|
+
err: errorSerializer_1.errorSerializer,
|
|
34
|
+
error: errorSerializer_1.errorSerializer,
|
|
35
|
+
}
|
|
29
36
|
});
|
|
30
37
|
function createScopedLogger(context) {
|
|
31
38
|
return exports.baseLogger.child(context);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@royalinvest/dto",
|
|
3
|
-
"version": "0.74.
|
|
3
|
+
"version": "0.74.3",
|
|
4
4
|
"description": "Data Transfer Objects (DTOs) to carry data between frontend and backend processes.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -79,8 +79,10 @@
|
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"amqplib": "^0.10.3",
|
|
81
81
|
"dayjs": "^1.11.19",
|
|
82
|
-
"pino": "^9.7.0",
|
|
83
|
-
"pino-pretty": "^13.0.0",
|
|
84
82
|
"prom-client": "^15.1.3"
|
|
83
|
+
},
|
|
84
|
+
"peerDependencies": {
|
|
85
|
+
"pino": "^9.7.0",
|
|
86
|
+
"pino-pretty": "^13.0.0"
|
|
85
87
|
}
|
|
86
88
|
}
|