@royalinvest/dto 0.74.1 → 0.74.2

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/README.md CHANGED
@@ -1,72 +1,72 @@
1
- # NPM Packages
2
-
3
- This project contains shared **NPM packages** for RoyalInvest (e.g., DTOs, utilities).
4
- Packages are written in **TypeScript** and published to the company’s NPM organization.
5
-
6
- ---
7
-
8
- ## Getting Started
9
-
10
- ### 1. Configure NPM registry
11
-
12
- To authenticate with the NPM registry, configure your `.npmrc` file:
13
-
14
- ```bash
15
- npm config set //registry.npmjs.org/:_authToken=<your_auth_token>
16
- ```
17
-
18
- Replace `<your_auth_token>` with a token from [npmjs.com](https://www.npmjs.com/).
19
- For access to the company’s account, request a token from the administrator.
20
-
21
- ---
22
-
23
- ## Company Packages
24
-
25
- You can view all published packages here:
26
- [RoyalInvest NPM Packages](https://www.npmjs.com/settings/royalinvest/packages)
27
-
28
- ---
29
-
30
- ## Creating a New Package
31
-
32
- 1. Create a new directory under `npm-package/`.
33
- 2. Add:
34
- - `package.json` (copy structure from `dto/package.json`).
35
- - `tsconfig.json` (same as in existing packages).
36
- 3. Implement your code in `src/`.
37
-
38
- Each package should follow the same conventions for consistency.
39
-
40
- ---
41
-
42
- ## Building a Package
43
-
44
- Run the build command inside the package directory:
45
-
46
- ```bash
47
- npm run build
48
- ```
49
-
50
- Check the `scripts` section in `dto/package.json` for an example configuration.
51
-
52
- ---
53
-
54
- ## Versioning
55
-
56
- We follow **Semantic Versioning (SemVer)**:
57
-
58
- - **MAJOR** – incompatible API changes
59
- - **MINOR** – add functionality in a backward-compatible manner
60
- - **PATCH** – backward-compatible bug fixes
61
-
62
- Update the version number manually in `package.json` before publishing.
63
-
64
- ---
65
-
66
- ## Publishing
67
-
68
- To publish a package to the NPM registry:
69
-
70
- ```bash
71
- npm publish --access public
1
+ # NPM Packages
2
+
3
+ This project contains shared **NPM packages** for RoyalInvest (e.g., DTOs, utilities).
4
+ Packages are written in **TypeScript** and published to the company’s NPM organization.
5
+
6
+ ---
7
+
8
+ ## Getting Started
9
+
10
+ ### 1. Configure NPM registry
11
+
12
+ To authenticate with the NPM registry, configure your `.npmrc` file:
13
+
14
+ ```bash
15
+ npm config set //registry.npmjs.org/:_authToken=<your_auth_token>
16
+ ```
17
+
18
+ Replace `<your_auth_token>` with a token from [npmjs.com](https://www.npmjs.com/).
19
+ For access to the company’s account, request a token from the administrator.
20
+
21
+ ---
22
+
23
+ ## Company Packages
24
+
25
+ You can view all published packages here:
26
+ [RoyalInvest NPM Packages](https://www.npmjs.com/settings/royalinvest/packages)
27
+
28
+ ---
29
+
30
+ ## Creating a New Package
31
+
32
+ 1. Create a new directory under `npm-package/`.
33
+ 2. Add:
34
+ - `package.json` (copy structure from `dto/package.json`).
35
+ - `tsconfig.json` (same as in existing packages).
36
+ 3. Implement your code in `src/`.
37
+
38
+ Each package should follow the same conventions for consistency.
39
+
40
+ ---
41
+
42
+ ## Building a Package
43
+
44
+ Run the build command inside the package directory:
45
+
46
+ ```bash
47
+ npm run build
48
+ ```
49
+
50
+ Check the `scripts` section in `dto/package.json` for an example configuration.
51
+
52
+ ---
53
+
54
+ ## Versioning
55
+
56
+ We follow **Semantic Versioning (SemVer)**:
57
+
58
+ - **MAJOR** – incompatible API changes
59
+ - **MINOR** – add functionality in a backward-compatible manner
60
+ - **PATCH** – backward-compatible bug fixes
61
+
62
+ Update the version number manually in `package.json` before publishing.
63
+
64
+ ---
65
+
66
+ ## Publishing
67
+
68
+ To publish a package to the NPM registry:
69
+
70
+ ```bash
71
+ npm publish --access public
72
72
  ```
@@ -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;
@@ -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,86 +1,88 @@
1
- {
2
- "name": "@royalinvest/dto",
3
- "version": "0.74.1",
4
- "description": "Data Transfer Objects (DTOs) to carry data between frontend and backend processes.",
5
- "main": "./dist/index.js",
6
- "types": "./dist/index.d.ts",
7
- "module": "./dist/index.js",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/index.d.ts",
11
- "require": "./dist/index.js",
12
- "import": "./dist/index.js"
13
- },
14
- "./backend": {
15
- "types": "./dist/backend.d.ts",
16
- "require": "./dist/backend.js",
17
- "import": "./dist/backend.js"
18
- },
19
- "./credit-check": {
20
- "types": "./dist/credit-check/index.d.ts",
21
- "require": "./dist/credit-check/index.js",
22
- "import": "./dist/credit-check/index.js"
23
- },
24
- "./enum": {
25
- "types": "./dist/enum/index.d.ts",
26
- "require": "./dist/enum/index.js",
27
- "import": "./dist/enum/index.js"
28
- }
29
- },
30
- "repository": {
31
- "type": "git",
32
- "url": "git@ssh.dev.azure.com:v3/royalinvest/royalinvest/npm-package"
33
- },
34
- "files": [
35
- "dist"
36
- ],
37
- "publishConfig": {
38
- "access": "public"
39
- },
40
- "scripts": {
41
- "build": "npx tsc",
42
- "lint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
43
- "lint:fix": "eslint --fix \"src/**/*.{js,jsx,ts,tsx}\"",
44
- "prettier": "prettier --write \"src/**/*.{js,jsx,ts,tsx}\"",
45
- "prettier:check": "npx prettier --check \"src/**/*.{js,jsx,ts,tsx}\"",
46
- "clear-all": "rm -rf node_modules .next out dist build",
47
- "re-start": "rm -rf node_modules .next out dist build && npm install && npm run dev",
48
- "re-build": "rm -rf node_modules .next out dist build && npm install && npm run build",
49
- "prepublishOnly": "npm run build",
50
- "test": "echo \"Not implemented yet\""
51
- },
52
- "lint-staged": {
53
- "src/**/*.{js,jsx,ts,tsx}": [
54
- "prettier --write",
55
- "eslint --fix",
56
- "git add"
57
- ]
58
- },
59
- "prettier": {
60
- "tabWidth": 2,
61
- "useTabs": false,
62
- "singleQuote": false,
63
- "printWidth": 120
64
- },
65
- "author": "Samos Technologies Inc.",
66
- "license": "ISC",
67
- "devDependencies": {
68
- "@eslint/js": "^9.11.1",
69
- "@types/amqplib": "^0.10.6",
70
- "@types/node": "^24.1.0",
71
- "eslint": "^9.11.1",
72
- "eslint-plugin-react": "^7.37.0",
73
- "globals": "^15.9.0",
74
- "husky": "^8.0.0",
75
- "lint-staged": "^15.2.10",
76
- "prettier": "^3.3.3",
77
- "typescript-eslint": "^8.7.0"
78
- },
79
- "dependencies": {
80
- "amqplib": "^0.10.3",
81
- "dayjs": "^1.11.19",
82
- "pino": "^9.7.0",
83
- "pino-pretty": "^13.0.0",
84
- "prom-client": "^15.1.3"
85
- }
86
- }
1
+ {
2
+ "name": "@royalinvest/dto",
3
+ "version": "0.74.2",
4
+ "description": "Data Transfer Objects (DTOs) to carry data between frontend and backend processes.",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "module": "./dist/index.js",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "require": "./dist/index.js",
12
+ "import": "./dist/index.js"
13
+ },
14
+ "./backend": {
15
+ "types": "./dist/backend.d.ts",
16
+ "require": "./dist/backend.js",
17
+ "import": "./dist/backend.js"
18
+ },
19
+ "./credit-check": {
20
+ "types": "./dist/credit-check/index.d.ts",
21
+ "require": "./dist/credit-check/index.js",
22
+ "import": "./dist/credit-check/index.js"
23
+ },
24
+ "./enum": {
25
+ "types": "./dist/enum/index.d.ts",
26
+ "require": "./dist/enum/index.js",
27
+ "import": "./dist/enum/index.js"
28
+ }
29
+ },
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git@ssh.dev.azure.com:v3/royalinvest/royalinvest/npm-package"
33
+ },
34
+ "files": [
35
+ "dist"
36
+ ],
37
+ "publishConfig": {
38
+ "access": "public"
39
+ },
40
+ "scripts": {
41
+ "build": "npx tsc",
42
+ "lint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
43
+ "lint:fix": "eslint --fix \"src/**/*.{js,jsx,ts,tsx}\"",
44
+ "prettier": "prettier --write \"src/**/*.{js,jsx,ts,tsx}\"",
45
+ "prettier:check": "npx prettier --check \"src/**/*.{js,jsx,ts,tsx}\"",
46
+ "clear-all": "rm -rf node_modules .next out dist build",
47
+ "re-start": "rm -rf node_modules .next out dist build && npm install && npm run dev",
48
+ "re-build": "rm -rf node_modules .next out dist build && npm install && npm run build",
49
+ "prepublishOnly": "npm run build",
50
+ "test": "echo \"Not implemented yet\""
51
+ },
52
+ "lint-staged": {
53
+ "src/**/*.{js,jsx,ts,tsx}": [
54
+ "prettier --write",
55
+ "eslint --fix",
56
+ "git add"
57
+ ]
58
+ },
59
+ "prettier": {
60
+ "tabWidth": 2,
61
+ "useTabs": false,
62
+ "singleQuote": false,
63
+ "printWidth": 120
64
+ },
65
+ "author": "Samos Technologies Inc.",
66
+ "license": "ISC",
67
+ "devDependencies": {
68
+ "@eslint/js": "^9.11.1",
69
+ "@types/amqplib": "^0.10.6",
70
+ "@types/node": "^24.1.0",
71
+ "eslint": "^9.11.1",
72
+ "eslint-plugin-react": "^7.37.0",
73
+ "globals": "^15.9.0",
74
+ "husky": "^8.0.0",
75
+ "lint-staged": "^15.2.10",
76
+ "prettier": "^3.3.3",
77
+ "typescript-eslint": "^8.7.0"
78
+ },
79
+ "dependencies": {
80
+ "amqplib": "^0.10.3",
81
+ "dayjs": "^1.11.19",
82
+ "prom-client": "^15.1.3"
83
+ },
84
+ "peerDependencies": {
85
+ "pino": "^9.7.0",
86
+ "pino-pretty": "^13.0.0"
87
+ }
88
+ }
package/dist/billing.d.ts DELETED
@@ -1 +0,0 @@
1
- export type BillingIntervalType = "month" | "year" | "once";
package/dist/billing.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- export interface IMessageBrokerEvent<TPayload> {
2
- http_request_id: string;
3
- user_id: string;
4
- payload: TPayload;
5
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,57 +0,0 @@
1
- import { LeaseTypeEnum } from "./enum";
2
- import { ICertificateFormData } from "./certificateFormData";
3
- import { IContractParty } from "./contractParty";
4
- import { IDocumentDrawingInstructions } from "./documentDrawingInstructions";
5
- import { IFileMetadata } from "./fileMetadata";
6
- import { ISignaturePartySigned } from "./signaturePartySigned";
7
- import { IInvoiceRenderData } from "./invoiceRenderData";
8
- import { ICreditCheckReportData } from "./creditCheckReport";
9
- export interface IMessageGenerate {
10
- contract_id: string;
11
- details: JSON;
12
- user_id: string;
13
- template_variant_file_name: string;
14
- template_variant_name: string;
15
- template_variant_language: string;
16
- template_variant_mime_type: string;
17
- template_variant_id: string;
18
- template_name: LeaseTypeEnum;
19
- file_id?: string;
20
- isEdit?: boolean;
21
- contract_parties?: IContractParty[];
22
- drawing_instructions?: IDocumentDrawingInstructions;
23
- metadata?: IFileMetadata;
24
- }
25
- export interface IMessageGenerateSigned {
26
- party: ISignaturePartySigned;
27
- generate_hash?: boolean;
28
- }
29
- export interface IMessageGenerateVoided {
30
- user_id: string;
31
- contract_id: string;
32
- file_id: string;
33
- file_name: string;
34
- notify_party_email: boolean;
35
- generate_hash?: boolean;
36
- }
37
- export interface IMessageGenerateCertificate {
38
- file_id: string;
39
- blob_path: string;
40
- form_data: ICertificateFormData;
41
- form_instructions: JSON;
42
- language: string;
43
- }
44
- export interface IMessageGenerateInvoice {
45
- user_id: string;
46
- billing_id: string;
47
- blob_path: string;
48
- invoice_number: string;
49
- language: string;
50
- data: IInvoiceRenderData;
51
- }
52
- export interface IMessageGenerateCreditCheckReport {
53
- report_data: ICreditCheckReportData;
54
- subject_id: string;
55
- blob_path: string;
56
- language: string;
57
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,45 +0,0 @@
1
- import { IPhysicalFileDetails } from "./physicalFileDetails";
2
- import { IPlaceholderCollection } from "./placeholderCollection";
3
- import { ISignaturePartyBasic } from "./signaturePartyBasic";
4
- export interface IGeneratedNotification {
5
- contract_id: string;
6
- user_id: string;
7
- file_name: string;
8
- file_language: string;
9
- mime_type: string;
10
- template_name: string;
11
- template_variant_id: string;
12
- file_id?: string;
13
- isEdit?: boolean;
14
- generated_placeholders?: IPlaceholderCollection;
15
- generated_file_details?: IPhysicalFileDetails;
16
- }
17
- export interface ISignedNotification {
18
- file_id: string;
19
- party: ISignaturePartyBasic;
20
- generated_file_details?: IPhysicalFileDetails;
21
- }
22
- export interface IVoidedNotification {
23
- user_id: string;
24
- file_id: string;
25
- contract_id: string;
26
- notify_party_email: boolean;
27
- generated_file_details?: IPhysicalFileDetails;
28
- }
29
- export interface IGeneratedCertificateNotification {
30
- file_id: string;
31
- blob_path: string;
32
- }
33
- export interface IGeneratedInvoiceNotification {
34
- user_id: string;
35
- billing_id: string;
36
- blob_path: string;
37
- invoice_number: string;
38
- language: string;
39
- }
40
- export interface IGeneratedCreditCheckReportNotification {
41
- subject_id: string;
42
- blob_path: string;
43
- hash: string;
44
- language: string;
45
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +0,0 @@
1
- import { IContractParty } from "./contractParty";
2
- import { IProperty } from "./property";
3
- export interface IProcessContractNotification {
4
- user_id: string;
5
- contract_id: string;
6
- parties?: IContractParty[];
7
- property?: IProperty;
8
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
package/dist/payment.d.ts DELETED
@@ -1 +0,0 @@
1
- export type PaymentIntervalType = "month" | "year";
package/dist/payment.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- export interface ISignatureInitials {
2
- initials: string;
3
- signature: string;
4
- timestamp: string;
5
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
File without changes
@@ -1 +0,0 @@
1
- "use strict";
File without changes
@@ -1 +0,0 @@
1
- "use strict";
File without changes
@@ -1 +0,0 @@
1
- "use strict";
File without changes
@@ -1 +0,0 @@
1
- "use strict";