@ipetsadmin/contracts 1.0.2 → 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/CHANGELOG.md +16 -0
- package/README.md +17 -10
- package/dist/index.d.mts +106 -0
- package/dist/index.d.ts +106 -12
- package/dist/index.js +88 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +83 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +10 -7
- package/dist/enums/errors.d.ts +0 -17
- package/dist/enums/errors.d.ts.map +0 -1
- package/dist/enums/errors.js +0 -21
- package/dist/enums/errors.js.map +0 -1
- package/dist/errors/BaseError.d.ts +0 -8
- package/dist/errors/BaseError.d.ts.map +0 -1
- package/dist/errors/BaseError.js +0 -14
- package/dist/errors/BaseError.js.map +0 -1
- package/dist/errors/BusinessError.d.ts +0 -6
- package/dist/errors/BusinessError.d.ts.map +0 -1
- package/dist/errors/BusinessError.js +0 -15
- package/dist/errors/BusinessError.js.map +0 -1
- package/dist/errors/ForbiddenError.d.ts +0 -6
- package/dist/errors/ForbiddenError.d.ts.map +0 -1
- package/dist/errors/ForbiddenError.js +0 -15
- package/dist/errors/ForbiddenError.js.map +0 -1
- package/dist/errors/NotFoundError.d.ts +0 -6
- package/dist/errors/NotFoundError.d.ts.map +0 -1
- package/dist/errors/NotFoundError.js +0 -15
- package/dist/errors/NotFoundError.js.map +0 -1
- package/dist/errors/ServerError.d.ts +0 -6
- package/dist/errors/ServerError.d.ts.map +0 -1
- package/dist/errors/ServerError.js +0 -15
- package/dist/errors/ServerError.js.map +0 -1
- package/dist/errors/UnauthorizedError.d.ts +0 -6
- package/dist/errors/UnauthorizedError.d.ts.map +0 -1
- package/dist/errors/UnauthorizedError.js +0 -15
- package/dist/errors/UnauthorizedError.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/interfaces/general/IApiResponse.d.ts +0 -9
- package/dist/interfaces/general/IApiResponse.d.ts.map +0 -1
- package/dist/interfaces/general/IApiResponse.js +0 -3
- package/dist/interfaces/general/IApiResponse.js.map +0 -1
- package/dist/interfaces/general/IConfig.d.ts +0 -26
- package/dist/interfaces/general/IConfig.d.ts.map +0 -1
- package/dist/interfaces/general/IConfig.js +0 -3
- package/dist/interfaces/general/IConfig.js.map +0 -1
- package/dist/interfaces/general/IPaginatedResponse.d.ts +0 -6
- package/dist/interfaces/general/IPaginatedResponse.d.ts.map +0 -1
- package/dist/interfaces/general/IPaginatedResponse.js +0 -3
- package/dist/interfaces/general/IPaginatedResponse.js.map +0 -1
- package/dist/interfaces/general/IPagination.d.ts +0 -7
- package/dist/interfaces/general/IPagination.d.ts.map +0 -1
- package/dist/interfaces/general/IPagination.js +0 -3
- package/dist/interfaces/general/IPagination.js.map +0 -1
- package/dist/interfaces/general/IServerInit.d.ts +0 -9
- package/dist/interfaces/general/IServerInit.d.ts.map +0 -1
- package/dist/interfaces/general/IServerInit.js +0 -3
- package/dist/interfaces/general/IServerInit.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -19,6 +19,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
19
19
|
|
|
20
20
|
### Security
|
|
21
21
|
|
|
22
|
+
## [1.0.3] - 2026-04-02
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- **ESM named imports** (`import { BusinessError } from '@ipetsadmin/contracts'`): the library is now built with **tsup**
|
|
27
|
+
as **dual CJS + ESM** (`dist/index.js` and `dist/index.mjs`). Node and bundlers resolve **`exports.import`** to the
|
|
28
|
+
ESM bundle, which exposes real `export` bindings. The previous **TypeScript-only CommonJS** output used
|
|
29
|
+
`__exportStar` / getters that **Node’s ESM↔CJS interop** does not turn into static named exports, so `import { … }`
|
|
30
|
+
often failed in `"type": "module"` projects while `require()` still worked.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- **Build**: `pnpm run build` runs `tsup` (replaces `tsc` + `tsc-alias` for the published entry). Declaration files are
|
|
35
|
+
emitted as `dist/index.d.ts` and `dist/index.d.mts`.
|
|
36
|
+
- **`package.json`**: `module` points at `dist/index.mjs`; `exports` includes **`import`** for the ESM build.
|
|
37
|
+
|
|
22
38
|
## [1.0.2] - 2026-04-02
|
|
23
39
|
|
|
24
40
|
### Fixed
|
package/README.md
CHANGED
|
@@ -50,6 +50,12 @@ import {
|
|
|
50
50
|
|
|
51
51
|
Path aliases (`@/…`) apply only inside this package’s source; consumers import from `@ipetsadmin/contracts` as above.
|
|
52
52
|
|
|
53
|
+
The published package is **dual CJS + ESM** (`exports.require` → `dist/index.js`, `exports.import` → `dist/index.mjs`).
|
|
54
|
+
That way **`import { BaseError, BusinessError } from '@ipetsadmin/contracts'`** works in ESM projects (`"type": "module"`,
|
|
55
|
+
Vite, etc.), and **`require('@ipetsadmin/contracts')`** still works in CommonJS. Use TypeScript
|
|
56
|
+
**`moduleResolution`: `"node16"`** or **`"nodenext"`** (or **`"bundler"`**) in consuming apps so types resolve through
|
|
57
|
+
`package.json` `exports`.
|
|
58
|
+
|
|
53
59
|
## Development
|
|
54
60
|
|
|
55
61
|
Install dependencies and (on first clone) install Git hooks:
|
|
@@ -58,16 +64,16 @@ Install dependencies and (on first clone) install Git hooks:
|
|
|
58
64
|
pnpm install
|
|
59
65
|
```
|
|
60
66
|
|
|
61
|
-
| Script | Description
|
|
62
|
-
| ----------------------- |
|
|
63
|
-
| `pnpm run build` |
|
|
64
|
-
| `pnpm run clean` | Remove `dist/`
|
|
65
|
-
| `pnpm run typecheck` | `tsc --noEmit` (no emit, full typecheck)
|
|
66
|
-
| `pnpm run lint` | ESLint with cache (`.eslintcache`)
|
|
67
|
-
| `pnpm run lint:fix` | ESLint with `--fix`
|
|
68
|
-
| `pnpm run format` | Prettier write (respects `.prettierignore`)
|
|
69
|
-
| `pnpm run format:check` | Prettier check only
|
|
70
|
-
| `pnpm run validate` | `typecheck` → `lint` → `format:check` (use in CI)
|
|
67
|
+
| Script | Description |
|
|
68
|
+
| ----------------------- | ------------------------------------------------------------------------------------------ |
|
|
69
|
+
| `pnpm run build` | **tsup**: bundle `src/index.ts` → `dist/index.js` (CJS) + `dist/index.mjs` (ESM) + `.d.ts` |
|
|
70
|
+
| `pnpm run clean` | Remove `dist/` |
|
|
71
|
+
| `pnpm run typecheck` | `tsc --noEmit` (no emit, full typecheck) |
|
|
72
|
+
| `pnpm run lint` | ESLint with cache (`.eslintcache`) |
|
|
73
|
+
| `pnpm run lint:fix` | ESLint with `--fix` |
|
|
74
|
+
| `pnpm run format` | Prettier write (respects `.prettierignore`) |
|
|
75
|
+
| `pnpm run format:check` | Prettier check only |
|
|
76
|
+
| `pnpm run validate` | `typecheck` → `lint` → `format:check` (use in CI) |
|
|
71
77
|
|
|
72
78
|
**Pre-commit:** [Husky](https://typicode.github.io/husky/) runs [lint-staged](https://github.com/lint-staged/lint-staged): ESLint + Prettier on staged `*.ts` / `*.tsx`, Prettier on staged `*.json` / `*.md`.
|
|
73
79
|
|
|
@@ -75,6 +81,7 @@ pnpm install
|
|
|
75
81
|
|
|
76
82
|
### Tooling in this repo
|
|
77
83
|
|
|
84
|
+
- **tsup** — `tsup.config.ts`; dual CJS/ESM build for the npm entry
|
|
78
85
|
- **ESLint** — `eslint.config.mjs` (flat config), TypeScript type-aware rules via `typescript-eslint`, conflicts with Prettier disabled via `eslint-config-prettier`
|
|
79
86
|
- **Prettier** — `.prettierrc.json`, `.prettierignore`
|
|
80
87
|
- **Editor defaults** — `.editorconfig`
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Application } from 'express';
|
|
2
|
+
import { Logger } from 'winston';
|
|
3
|
+
|
|
4
|
+
interface IConfig {
|
|
5
|
+
port: number;
|
|
6
|
+
cors: {
|
|
7
|
+
origin: string;
|
|
8
|
+
};
|
|
9
|
+
environment: string;
|
|
10
|
+
apiVersions: string[];
|
|
11
|
+
mongodbUri?: string;
|
|
12
|
+
mongodbDbName?: string;
|
|
13
|
+
maxRequestRateLimit?: number;
|
|
14
|
+
maxTimeoutRateLimit?: number;
|
|
15
|
+
jwtSecret?: string;
|
|
16
|
+
jwtExpirationTime?: string;
|
|
17
|
+
saltRounds?: number;
|
|
18
|
+
redisUrl?: string;
|
|
19
|
+
jwtRecoveryPasswordSecret?: string;
|
|
20
|
+
jwtRecoveryPasswordExpirationTime?: string;
|
|
21
|
+
resendApiKey?: string;
|
|
22
|
+
frontendUrl?: string;
|
|
23
|
+
emailFromDomain?: string;
|
|
24
|
+
auth0Domain?: string;
|
|
25
|
+
auth0ClientId?: string;
|
|
26
|
+
auth0ClientSecret?: string;
|
|
27
|
+
auth0Audience?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface IPagination {
|
|
31
|
+
page: number;
|
|
32
|
+
limit: number;
|
|
33
|
+
total: number;
|
|
34
|
+
totalPages: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface IPaginatedResponse<T> {
|
|
38
|
+
data: T[];
|
|
39
|
+
pagination: IPagination;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface IServerInit {
|
|
43
|
+
app: Application;
|
|
44
|
+
config: IConfig;
|
|
45
|
+
logger: Logger;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface IApiResponse<T = unknown> {
|
|
49
|
+
success: boolean;
|
|
50
|
+
data?: T;
|
|
51
|
+
pagination?: IPagination;
|
|
52
|
+
error?: string;
|
|
53
|
+
message?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
declare enum Errors {
|
|
57
|
+
NOT_FOUND_ERROR = "NotFoundError",
|
|
58
|
+
BUSINESS_ERROR = "BusinessError",
|
|
59
|
+
FORBIDDEN_ERROR = "ForbiddenError",
|
|
60
|
+
SERVER_ERROR = "ServerError",
|
|
61
|
+
UNAUTHORIZED_ERROR = "UnauthorizedError",
|
|
62
|
+
BAD_REQUEST_ERROR = "BadRequestError",
|
|
63
|
+
UNPROCESSABLE_ENTITY_ERROR = "UnprocessableEntityError",
|
|
64
|
+
TOO_MANY_REQUESTS_ERROR = "TooManyRequestsError",
|
|
65
|
+
INTERNAL_SERVER_ERROR = "InternalServerError",
|
|
66
|
+
SERVICE_UNAVAILABLE_ERROR = "ServiceUnavailableError",
|
|
67
|
+
GATEWAY_TIMEOUT_ERROR = "GatewayTimeoutError",
|
|
68
|
+
BAD_GATEWAY_ERROR = "BadGatewayError",
|
|
69
|
+
PRECONDITION_FAILED_ERROR = "PreconditionFailedError",
|
|
70
|
+
PAYLOAD_TOO_LARGE_ERROR = "PayloadTooLargeError"
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
declare class BaseError extends Error {
|
|
74
|
+
details?: Record<string, unknown>;
|
|
75
|
+
toErrorRecord(): {
|
|
76
|
+
error: string;
|
|
77
|
+
details?: unknown;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
declare class BusinessError extends BaseError {
|
|
82
|
+
details?: Record<string, unknown>;
|
|
83
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
declare class ForbiddenError extends BaseError {
|
|
87
|
+
details?: Record<string, unknown>;
|
|
88
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
declare class NotFoundError extends BaseError {
|
|
92
|
+
details?: Record<string, unknown>;
|
|
93
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
declare class ServerError extends BaseError {
|
|
97
|
+
details?: Record<string, unknown>;
|
|
98
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
declare class UnauthorizedError extends BaseError {
|
|
102
|
+
details?: Record<string, unknown>;
|
|
103
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export { BaseError, BusinessError, Errors, ForbiddenError, type IApiResponse, type IConfig, type IPaginatedResponse, type IServerInit, NotFoundError, ServerError, UnauthorizedError };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,106 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { Application } from 'express';
|
|
2
|
+
import { Logger } from 'winston';
|
|
3
|
+
|
|
4
|
+
interface IConfig {
|
|
5
|
+
port: number;
|
|
6
|
+
cors: {
|
|
7
|
+
origin: string;
|
|
8
|
+
};
|
|
9
|
+
environment: string;
|
|
10
|
+
apiVersions: string[];
|
|
11
|
+
mongodbUri?: string;
|
|
12
|
+
mongodbDbName?: string;
|
|
13
|
+
maxRequestRateLimit?: number;
|
|
14
|
+
maxTimeoutRateLimit?: number;
|
|
15
|
+
jwtSecret?: string;
|
|
16
|
+
jwtExpirationTime?: string;
|
|
17
|
+
saltRounds?: number;
|
|
18
|
+
redisUrl?: string;
|
|
19
|
+
jwtRecoveryPasswordSecret?: string;
|
|
20
|
+
jwtRecoveryPasswordExpirationTime?: string;
|
|
21
|
+
resendApiKey?: string;
|
|
22
|
+
frontendUrl?: string;
|
|
23
|
+
emailFromDomain?: string;
|
|
24
|
+
auth0Domain?: string;
|
|
25
|
+
auth0ClientId?: string;
|
|
26
|
+
auth0ClientSecret?: string;
|
|
27
|
+
auth0Audience?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface IPagination {
|
|
31
|
+
page: number;
|
|
32
|
+
limit: number;
|
|
33
|
+
total: number;
|
|
34
|
+
totalPages: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface IPaginatedResponse<T> {
|
|
38
|
+
data: T[];
|
|
39
|
+
pagination: IPagination;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface IServerInit {
|
|
43
|
+
app: Application;
|
|
44
|
+
config: IConfig;
|
|
45
|
+
logger: Logger;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface IApiResponse<T = unknown> {
|
|
49
|
+
success: boolean;
|
|
50
|
+
data?: T;
|
|
51
|
+
pagination?: IPagination;
|
|
52
|
+
error?: string;
|
|
53
|
+
message?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
declare enum Errors {
|
|
57
|
+
NOT_FOUND_ERROR = "NotFoundError",
|
|
58
|
+
BUSINESS_ERROR = "BusinessError",
|
|
59
|
+
FORBIDDEN_ERROR = "ForbiddenError",
|
|
60
|
+
SERVER_ERROR = "ServerError",
|
|
61
|
+
UNAUTHORIZED_ERROR = "UnauthorizedError",
|
|
62
|
+
BAD_REQUEST_ERROR = "BadRequestError",
|
|
63
|
+
UNPROCESSABLE_ENTITY_ERROR = "UnprocessableEntityError",
|
|
64
|
+
TOO_MANY_REQUESTS_ERROR = "TooManyRequestsError",
|
|
65
|
+
INTERNAL_SERVER_ERROR = "InternalServerError",
|
|
66
|
+
SERVICE_UNAVAILABLE_ERROR = "ServiceUnavailableError",
|
|
67
|
+
GATEWAY_TIMEOUT_ERROR = "GatewayTimeoutError",
|
|
68
|
+
BAD_GATEWAY_ERROR = "BadGatewayError",
|
|
69
|
+
PRECONDITION_FAILED_ERROR = "PreconditionFailedError",
|
|
70
|
+
PAYLOAD_TOO_LARGE_ERROR = "PayloadTooLargeError"
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
declare class BaseError extends Error {
|
|
74
|
+
details?: Record<string, unknown>;
|
|
75
|
+
toErrorRecord(): {
|
|
76
|
+
error: string;
|
|
77
|
+
details?: unknown;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
declare class BusinessError extends BaseError {
|
|
82
|
+
details?: Record<string, unknown>;
|
|
83
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
declare class ForbiddenError extends BaseError {
|
|
87
|
+
details?: Record<string, unknown>;
|
|
88
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
declare class NotFoundError extends BaseError {
|
|
92
|
+
details?: Record<string, unknown>;
|
|
93
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
declare class ServerError extends BaseError {
|
|
97
|
+
details?: Record<string, unknown>;
|
|
98
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
declare class UnauthorizedError extends BaseError {
|
|
102
|
+
details?: Record<string, unknown>;
|
|
103
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export { BaseError, BusinessError, Errors, ForbiddenError, type IApiResponse, type IConfig, type IPaginatedResponse, type IServerInit, NotFoundError, ServerError, UnauthorizedError };
|
package/dist/index.js
CHANGED
|
@@ -1,28 +1,91 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/enums/errors.ts
|
|
4
|
+
var Errors = /* @__PURE__ */ ((Errors2) => {
|
|
5
|
+
Errors2["NOT_FOUND_ERROR"] = "NotFoundError";
|
|
6
|
+
Errors2["BUSINESS_ERROR"] = "BusinessError";
|
|
7
|
+
Errors2["FORBIDDEN_ERROR"] = "ForbiddenError";
|
|
8
|
+
Errors2["SERVER_ERROR"] = "ServerError";
|
|
9
|
+
Errors2["UNAUTHORIZED_ERROR"] = "UnauthorizedError";
|
|
10
|
+
Errors2["BAD_REQUEST_ERROR"] = "BadRequestError";
|
|
11
|
+
Errors2["UNPROCESSABLE_ENTITY_ERROR"] = "UnprocessableEntityError";
|
|
12
|
+
Errors2["TOO_MANY_REQUESTS_ERROR"] = "TooManyRequestsError";
|
|
13
|
+
Errors2["INTERNAL_SERVER_ERROR"] = "InternalServerError";
|
|
14
|
+
Errors2["SERVICE_UNAVAILABLE_ERROR"] = "ServiceUnavailableError";
|
|
15
|
+
Errors2["GATEWAY_TIMEOUT_ERROR"] = "GatewayTimeoutError";
|
|
16
|
+
Errors2["BAD_GATEWAY_ERROR"] = "BadGatewayError";
|
|
17
|
+
Errors2["PRECONDITION_FAILED_ERROR"] = "PreconditionFailedError";
|
|
18
|
+
Errors2["PAYLOAD_TOO_LARGE_ERROR"] = "PayloadTooLargeError";
|
|
19
|
+
return Errors2;
|
|
20
|
+
})(Errors || {});
|
|
21
|
+
|
|
22
|
+
// src/errors/BaseError.ts
|
|
23
|
+
var BaseError = class extends Error {
|
|
24
|
+
toErrorRecord() {
|
|
25
|
+
const obj = { error: this.message };
|
|
26
|
+
if (this.details) {
|
|
27
|
+
obj.details = this.details;
|
|
7
28
|
}
|
|
8
|
-
|
|
9
|
-
}
|
|
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);
|
|
29
|
+
return obj;
|
|
30
|
+
}
|
|
15
31
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
|
|
33
|
+
// src/errors/BusinessError.ts
|
|
34
|
+
var BusinessError = class _BusinessError extends BaseError {
|
|
35
|
+
constructor(message, details) {
|
|
36
|
+
super(message);
|
|
37
|
+
this.name = "BusinessError" /* BUSINESS_ERROR */;
|
|
38
|
+
this.details = details || {};
|
|
39
|
+
Object.setPrototypeOf(this, _BusinessError.prototype);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// src/errors/ForbiddenError.ts
|
|
44
|
+
var ForbiddenError = class _ForbiddenError extends BaseError {
|
|
45
|
+
constructor(message, details) {
|
|
46
|
+
super(message);
|
|
47
|
+
this.name = "ForbiddenError" /* FORBIDDEN_ERROR */;
|
|
48
|
+
this.details = details || {};
|
|
49
|
+
Object.setPrototypeOf(this, _ForbiddenError.prototype);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// src/errors/NotFoundError.ts
|
|
54
|
+
var NotFoundError = class _NotFoundError extends BaseError {
|
|
55
|
+
constructor(message, details) {
|
|
56
|
+
super(message);
|
|
57
|
+
this.name = "NotFoundError" /* NOT_FOUND_ERROR */;
|
|
58
|
+
this.details = details || {};
|
|
59
|
+
Object.setPrototypeOf(this, _NotFoundError.prototype);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// src/errors/ServerError.ts
|
|
64
|
+
var ServerError = class _ServerError extends BaseError {
|
|
65
|
+
constructor(message, details) {
|
|
66
|
+
super(message);
|
|
67
|
+
this.name = "ServerError" /* SERVER_ERROR */;
|
|
68
|
+
this.details = details || {};
|
|
69
|
+
Object.setPrototypeOf(this, _ServerError.prototype);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// src/errors/UnauthorizedError.ts
|
|
74
|
+
var UnauthorizedError = class _UnauthorizedError extends BaseError {
|
|
75
|
+
constructor(message, details) {
|
|
76
|
+
super(message);
|
|
77
|
+
this.name = "UnauthorizedError" /* UNAUTHORIZED_ERROR */;
|
|
78
|
+
this.details = details || {};
|
|
79
|
+
Object.setPrototypeOf(this, _UnauthorizedError.prototype);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
exports.BaseError = BaseError;
|
|
84
|
+
exports.BusinessError = BusinessError;
|
|
85
|
+
exports.Errors = Errors;
|
|
86
|
+
exports.ForbiddenError = ForbiddenError;
|
|
87
|
+
exports.NotFoundError = NotFoundError;
|
|
88
|
+
exports.ServerError = ServerError;
|
|
89
|
+
exports.UnauthorizedError = UnauthorizedError;
|
|
90
|
+
//# sourceMappingURL=index.js.map
|
|
28
91
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/enums/errors.ts","../src/errors/BaseError.ts","../src/errors/BusinessError.ts","../src/errors/ForbiddenError.ts","../src/errors/NotFoundError.ts","../src/errors/ServerError.ts","../src/errors/UnauthorizedError.ts"],"names":["Errors"],"mappings":"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","file":"index.js","sourcesContent":["export enum Errors {\n NOT_FOUND_ERROR = 'NotFoundError',\n BUSINESS_ERROR = 'BusinessError',\n FORBIDDEN_ERROR = 'ForbiddenError',\n SERVER_ERROR = 'ServerError',\n UNAUTHORIZED_ERROR = 'UnauthorizedError',\n BAD_REQUEST_ERROR = 'BadRequestError',\n UNPROCESSABLE_ENTITY_ERROR = 'UnprocessableEntityError',\n TOO_MANY_REQUESTS_ERROR = 'TooManyRequestsError',\n INTERNAL_SERVER_ERROR = 'InternalServerError',\n SERVICE_UNAVAILABLE_ERROR = 'ServiceUnavailableError',\n GATEWAY_TIMEOUT_ERROR = 'GatewayTimeoutError',\n BAD_GATEWAY_ERROR = 'BadGatewayError',\n PRECONDITION_FAILED_ERROR = 'PreconditionFailedError',\n PAYLOAD_TOO_LARGE_ERROR = 'PayloadTooLargeError',\n}\n","export class BaseError extends Error {\n public details?: Record<string, unknown>;\n public toErrorRecord(): { error: string; details?: unknown } {\n const obj: { error: string; details?: unknown } = { error: this.message };\n if (this.details) {\n obj.details = this.details;\n }\n return obj;\n }\n}\n","import { BaseError } from '@/errors/BaseError';\nimport { Errors } from '@/enums/errors';\n\nexport class BusinessError extends BaseError {\n public details?: Record<string, unknown>;\n public constructor(message: string, details?: Record<string, unknown>) {\n super(message);\n this.name = Errors.BUSINESS_ERROR;\n this.details = details || {};\n Object.setPrototypeOf(this, BusinessError.prototype);\n }\n}\n","import { BaseError } from '@/errors/BaseError';\nimport { Errors } from '@/enums/errors';\n\nexport class ForbiddenError extends BaseError {\n public details?: Record<string, unknown>;\n public constructor(message: string, details?: Record<string, unknown>) {\n super(message);\n this.name = Errors.FORBIDDEN_ERROR;\n this.details = details || {};\n Object.setPrototypeOf(this, ForbiddenError.prototype);\n }\n}\n","import { BaseError } from '@/errors/BaseError';\nimport { Errors } from '@/enums/errors';\n\nexport class NotFoundError extends BaseError {\n public details?: Record<string, unknown>;\n public constructor(message: string, details?: Record<string, unknown>) {\n super(message);\n this.name = Errors.NOT_FOUND_ERROR;\n this.details = details || {};\n Object.setPrototypeOf(this, NotFoundError.prototype);\n }\n}\n","import { BaseError } from '@/errors/BaseError';\nimport { Errors } from '@/enums/errors';\n\nexport class ServerError extends BaseError {\n public details?: Record<string, unknown>;\n public constructor(message: string, details?: Record<string, unknown>) {\n super(message);\n this.name = Errors.SERVER_ERROR;\n this.details = details || {};\n Object.setPrototypeOf(this, ServerError.prototype);\n }\n}\n","import { BaseError } from '@/errors/BaseError';\nimport { Errors } from '@/enums/errors';\n\nexport class UnauthorizedError extends BaseError {\n public details?: Record<string, unknown>;\n public constructor(message: string, details?: Record<string, unknown>) {\n super(message);\n this.name = Errors.UNAUTHORIZED_ERROR;\n this.details = details || {};\n Object.setPrototypeOf(this, UnauthorizedError.prototype);\n }\n}\n"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// src/enums/errors.ts
|
|
2
|
+
var Errors = /* @__PURE__ */ ((Errors2) => {
|
|
3
|
+
Errors2["NOT_FOUND_ERROR"] = "NotFoundError";
|
|
4
|
+
Errors2["BUSINESS_ERROR"] = "BusinessError";
|
|
5
|
+
Errors2["FORBIDDEN_ERROR"] = "ForbiddenError";
|
|
6
|
+
Errors2["SERVER_ERROR"] = "ServerError";
|
|
7
|
+
Errors2["UNAUTHORIZED_ERROR"] = "UnauthorizedError";
|
|
8
|
+
Errors2["BAD_REQUEST_ERROR"] = "BadRequestError";
|
|
9
|
+
Errors2["UNPROCESSABLE_ENTITY_ERROR"] = "UnprocessableEntityError";
|
|
10
|
+
Errors2["TOO_MANY_REQUESTS_ERROR"] = "TooManyRequestsError";
|
|
11
|
+
Errors2["INTERNAL_SERVER_ERROR"] = "InternalServerError";
|
|
12
|
+
Errors2["SERVICE_UNAVAILABLE_ERROR"] = "ServiceUnavailableError";
|
|
13
|
+
Errors2["GATEWAY_TIMEOUT_ERROR"] = "GatewayTimeoutError";
|
|
14
|
+
Errors2["BAD_GATEWAY_ERROR"] = "BadGatewayError";
|
|
15
|
+
Errors2["PRECONDITION_FAILED_ERROR"] = "PreconditionFailedError";
|
|
16
|
+
Errors2["PAYLOAD_TOO_LARGE_ERROR"] = "PayloadTooLargeError";
|
|
17
|
+
return Errors2;
|
|
18
|
+
})(Errors || {});
|
|
19
|
+
|
|
20
|
+
// src/errors/BaseError.ts
|
|
21
|
+
var BaseError = class extends Error {
|
|
22
|
+
toErrorRecord() {
|
|
23
|
+
const obj = { error: this.message };
|
|
24
|
+
if (this.details) {
|
|
25
|
+
obj.details = this.details;
|
|
26
|
+
}
|
|
27
|
+
return obj;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// src/errors/BusinessError.ts
|
|
32
|
+
var BusinessError = class _BusinessError extends BaseError {
|
|
33
|
+
constructor(message, details) {
|
|
34
|
+
super(message);
|
|
35
|
+
this.name = "BusinessError" /* BUSINESS_ERROR */;
|
|
36
|
+
this.details = details || {};
|
|
37
|
+
Object.setPrototypeOf(this, _BusinessError.prototype);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// src/errors/ForbiddenError.ts
|
|
42
|
+
var ForbiddenError = class _ForbiddenError extends BaseError {
|
|
43
|
+
constructor(message, details) {
|
|
44
|
+
super(message);
|
|
45
|
+
this.name = "ForbiddenError" /* FORBIDDEN_ERROR */;
|
|
46
|
+
this.details = details || {};
|
|
47
|
+
Object.setPrototypeOf(this, _ForbiddenError.prototype);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// src/errors/NotFoundError.ts
|
|
52
|
+
var NotFoundError = class _NotFoundError extends BaseError {
|
|
53
|
+
constructor(message, details) {
|
|
54
|
+
super(message);
|
|
55
|
+
this.name = "NotFoundError" /* NOT_FOUND_ERROR */;
|
|
56
|
+
this.details = details || {};
|
|
57
|
+
Object.setPrototypeOf(this, _NotFoundError.prototype);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// src/errors/ServerError.ts
|
|
62
|
+
var ServerError = class _ServerError extends BaseError {
|
|
63
|
+
constructor(message, details) {
|
|
64
|
+
super(message);
|
|
65
|
+
this.name = "ServerError" /* SERVER_ERROR */;
|
|
66
|
+
this.details = details || {};
|
|
67
|
+
Object.setPrototypeOf(this, _ServerError.prototype);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// src/errors/UnauthorizedError.ts
|
|
72
|
+
var UnauthorizedError = class _UnauthorizedError extends BaseError {
|
|
73
|
+
constructor(message, details) {
|
|
74
|
+
super(message);
|
|
75
|
+
this.name = "UnauthorizedError" /* UNAUTHORIZED_ERROR */;
|
|
76
|
+
this.details = details || {};
|
|
77
|
+
Object.setPrototypeOf(this, _UnauthorizedError.prototype);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export { BaseError, BusinessError, Errors, ForbiddenError, NotFoundError, ServerError, UnauthorizedError };
|
|
82
|
+
//# sourceMappingURL=index.mjs.map
|
|
83
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/enums/errors.ts","../src/errors/BaseError.ts","../src/errors/BusinessError.ts","../src/errors/ForbiddenError.ts","../src/errors/NotFoundError.ts","../src/errors/ServerError.ts","../src/errors/UnauthorizedError.ts"],"names":["Errors"],"mappings":"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","file":"index.mjs","sourcesContent":["export enum Errors {\n NOT_FOUND_ERROR = 'NotFoundError',\n BUSINESS_ERROR = 'BusinessError',\n FORBIDDEN_ERROR = 'ForbiddenError',\n SERVER_ERROR = 'ServerError',\n UNAUTHORIZED_ERROR = 'UnauthorizedError',\n BAD_REQUEST_ERROR = 'BadRequestError',\n UNPROCESSABLE_ENTITY_ERROR = 'UnprocessableEntityError',\n TOO_MANY_REQUESTS_ERROR = 'TooManyRequestsError',\n INTERNAL_SERVER_ERROR = 'InternalServerError',\n SERVICE_UNAVAILABLE_ERROR = 'ServiceUnavailableError',\n GATEWAY_TIMEOUT_ERROR = 'GatewayTimeoutError',\n BAD_GATEWAY_ERROR = 'BadGatewayError',\n PRECONDITION_FAILED_ERROR = 'PreconditionFailedError',\n PAYLOAD_TOO_LARGE_ERROR = 'PayloadTooLargeError',\n}\n","export class BaseError extends Error {\n public details?: Record<string, unknown>;\n public toErrorRecord(): { error: string; details?: unknown } {\n const obj: { error: string; details?: unknown } = { error: this.message };\n if (this.details) {\n obj.details = this.details;\n }\n return obj;\n }\n}\n","import { BaseError } from '@/errors/BaseError';\nimport { Errors } from '@/enums/errors';\n\nexport class BusinessError extends BaseError {\n public details?: Record<string, unknown>;\n public constructor(message: string, details?: Record<string, unknown>) {\n super(message);\n this.name = Errors.BUSINESS_ERROR;\n this.details = details || {};\n Object.setPrototypeOf(this, BusinessError.prototype);\n }\n}\n","import { BaseError } from '@/errors/BaseError';\nimport { Errors } from '@/enums/errors';\n\nexport class ForbiddenError extends BaseError {\n public details?: Record<string, unknown>;\n public constructor(message: string, details?: Record<string, unknown>) {\n super(message);\n this.name = Errors.FORBIDDEN_ERROR;\n this.details = details || {};\n Object.setPrototypeOf(this, ForbiddenError.prototype);\n }\n}\n","import { BaseError } from '@/errors/BaseError';\nimport { Errors } from '@/enums/errors';\n\nexport class NotFoundError extends BaseError {\n public details?: Record<string, unknown>;\n public constructor(message: string, details?: Record<string, unknown>) {\n super(message);\n this.name = Errors.NOT_FOUND_ERROR;\n this.details = details || {};\n Object.setPrototypeOf(this, NotFoundError.prototype);\n }\n}\n","import { BaseError } from '@/errors/BaseError';\nimport { Errors } from '@/enums/errors';\n\nexport class ServerError extends BaseError {\n public details?: Record<string, unknown>;\n public constructor(message: string, details?: Record<string, unknown>) {\n super(message);\n this.name = Errors.SERVER_ERROR;\n this.details = details || {};\n Object.setPrototypeOf(this, ServerError.prototype);\n }\n}\n","import { BaseError } from '@/errors/BaseError';\nimport { Errors } from '@/enums/errors';\n\nexport class UnauthorizedError extends BaseError {\n public details?: Record<string, unknown>;\n public constructor(message: string, details?: Record<string, unknown>) {\n super(message);\n this.name = Errors.UNAUTHORIZED_ERROR;\n this.details = details || {};\n Object.setPrototypeOf(this, UnauthorizedError.prototype);\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ipetsadmin/contracts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Shared types, enums, and interfaces for Truffa projects",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
7
8
|
"exports": {
|
|
8
9
|
".": {
|
|
9
10
|
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
10
12
|
"require": "./dist/index.js",
|
|
11
|
-
"default": "./dist/index.
|
|
13
|
+
"default": "./dist/index.mjs"
|
|
12
14
|
}
|
|
13
15
|
},
|
|
14
16
|
"files": [
|
|
@@ -18,10 +20,11 @@
|
|
|
18
20
|
"CHANGELOG.md"
|
|
19
21
|
],
|
|
20
22
|
"lint-staged": {
|
|
21
|
-
"
|
|
23
|
+
"src/**/*.{ts,tsx}": [
|
|
22
24
|
"eslint --fix --max-warnings 0",
|
|
23
25
|
"prettier --write"
|
|
24
26
|
],
|
|
27
|
+
"tsup.config.ts": "prettier --write",
|
|
25
28
|
"*.{json,md}": "prettier --write"
|
|
26
29
|
},
|
|
27
30
|
"engines": {
|
|
@@ -43,7 +46,7 @@
|
|
|
43
46
|
"husky": "^9.1.7",
|
|
44
47
|
"lint-staged": "^16.4.0",
|
|
45
48
|
"prettier": "^3.8.1",
|
|
46
|
-
"
|
|
49
|
+
"tsup": "^8.5.1",
|
|
47
50
|
"typescript": "^5.9.3",
|
|
48
51
|
"typescript-eslint": "^8.58.0"
|
|
49
52
|
},
|
|
@@ -56,7 +59,7 @@
|
|
|
56
59
|
"access": "public"
|
|
57
60
|
},
|
|
58
61
|
"scripts": {
|
|
59
|
-
"build": "
|
|
62
|
+
"build": "tsup",
|
|
60
63
|
"clean": "rm -rf dist",
|
|
61
64
|
"typecheck": "tsc --noEmit",
|
|
62
65
|
"lint": "eslint . --cache --cache-location .eslintcache",
|
package/dist/enums/errors.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare enum Errors {
|
|
2
|
-
NOT_FOUND_ERROR = "NotFoundError",
|
|
3
|
-
BUSINESS_ERROR = "BusinessError",
|
|
4
|
-
FORBIDDEN_ERROR = "ForbiddenError",
|
|
5
|
-
SERVER_ERROR = "ServerError",
|
|
6
|
-
UNAUTHORIZED_ERROR = "UnauthorizedError",
|
|
7
|
-
BAD_REQUEST_ERROR = "BadRequestError",
|
|
8
|
-
UNPROCESSABLE_ENTITY_ERROR = "UnprocessableEntityError",
|
|
9
|
-
TOO_MANY_REQUESTS_ERROR = "TooManyRequestsError",
|
|
10
|
-
INTERNAL_SERVER_ERROR = "InternalServerError",
|
|
11
|
-
SERVICE_UNAVAILABLE_ERROR = "ServiceUnavailableError",
|
|
12
|
-
GATEWAY_TIMEOUT_ERROR = "GatewayTimeoutError",
|
|
13
|
-
BAD_GATEWAY_ERROR = "BadGatewayError",
|
|
14
|
-
PRECONDITION_FAILED_ERROR = "PreconditionFailedError",
|
|
15
|
-
PAYLOAD_TOO_LARGE_ERROR = "PayloadTooLargeError"
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/enums/errors.ts"],"names":[],"mappings":"AAAA,oBAAY,MAAM;IAChB,eAAe,kBAAkB;IACjC,cAAc,kBAAkB;IAChC,eAAe,mBAAmB;IAClC,YAAY,gBAAgB;IAC5B,kBAAkB,sBAAsB;IACxC,iBAAiB,oBAAoB;IACrC,0BAA0B,6BAA6B;IACvD,uBAAuB,yBAAyB;IAChD,qBAAqB,wBAAwB;IAC7C,yBAAyB,4BAA4B;IACrD,qBAAqB,wBAAwB;IAC7C,iBAAiB,oBAAoB;IACrC,yBAAyB,4BAA4B;IACrD,uBAAuB,yBAAyB;CACjD"}
|
package/dist/enums/errors.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Errors = void 0;
|
|
4
|
-
var Errors;
|
|
5
|
-
(function (Errors) {
|
|
6
|
-
Errors["NOT_FOUND_ERROR"] = "NotFoundError";
|
|
7
|
-
Errors["BUSINESS_ERROR"] = "BusinessError";
|
|
8
|
-
Errors["FORBIDDEN_ERROR"] = "ForbiddenError";
|
|
9
|
-
Errors["SERVER_ERROR"] = "ServerError";
|
|
10
|
-
Errors["UNAUTHORIZED_ERROR"] = "UnauthorizedError";
|
|
11
|
-
Errors["BAD_REQUEST_ERROR"] = "BadRequestError";
|
|
12
|
-
Errors["UNPROCESSABLE_ENTITY_ERROR"] = "UnprocessableEntityError";
|
|
13
|
-
Errors["TOO_MANY_REQUESTS_ERROR"] = "TooManyRequestsError";
|
|
14
|
-
Errors["INTERNAL_SERVER_ERROR"] = "InternalServerError";
|
|
15
|
-
Errors["SERVICE_UNAVAILABLE_ERROR"] = "ServiceUnavailableError";
|
|
16
|
-
Errors["GATEWAY_TIMEOUT_ERROR"] = "GatewayTimeoutError";
|
|
17
|
-
Errors["BAD_GATEWAY_ERROR"] = "BadGatewayError";
|
|
18
|
-
Errors["PRECONDITION_FAILED_ERROR"] = "PreconditionFailedError";
|
|
19
|
-
Errors["PAYLOAD_TOO_LARGE_ERROR"] = "PayloadTooLargeError";
|
|
20
|
-
})(Errors || (exports.Errors = Errors = {}));
|
|
21
|
-
//# sourceMappingURL=errors.js.map
|
package/dist/enums/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/enums/errors.ts"],"names":[],"mappings":";;;AAAA,IAAY,MAeX;AAfD,WAAY,MAAM;IAChB,2CAAiC,CAAA;IACjC,0CAAgC,CAAA;IAChC,4CAAkC,CAAA;IAClC,sCAA4B,CAAA;IAC5B,kDAAwC,CAAA;IACxC,+CAAqC,CAAA;IACrC,iEAAuD,CAAA;IACvD,0DAAgD,CAAA;IAChD,uDAA6C,CAAA;IAC7C,+DAAqD,CAAA;IACrD,uDAA6C,CAAA;IAC7C,+CAAqC,CAAA;IACrC,+DAAqD,CAAA;IACrD,0DAAgD,CAAA;AAClD,CAAC,EAfW,MAAM,sBAAN,MAAM,QAejB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BaseError.d.ts","sourceRoot":"","sources":["../../src/errors/BaseError.ts"],"names":[],"mappings":"AAAA,qBAAa,SAAU,SAAQ,KAAK;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,aAAa,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE;CAO7D"}
|
package/dist/errors/BaseError.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseError = void 0;
|
|
4
|
-
class BaseError extends Error {
|
|
5
|
-
toErrorRecord() {
|
|
6
|
-
const obj = { error: this.message };
|
|
7
|
-
if (this.details) {
|
|
8
|
-
obj.details = this.details;
|
|
9
|
-
}
|
|
10
|
-
return obj;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.BaseError = BaseError;
|
|
14
|
-
//# sourceMappingURL=BaseError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BaseError.js","sourceRoot":"","sources":["../../src/errors/BaseError.ts"],"names":[],"mappings":";;;AAAA,MAAa,SAAU,SAAQ,KAAK;IAE3B,aAAa;QAClB,MAAM,GAAG,GAAyC,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;QAC1E,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AATD,8BASC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BusinessError.d.ts","sourceRoot":"","sources":["../../src/errors/BusinessError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,qBAAa,aAAc,SAAQ,SAAS;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBACtB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAMtE"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BusinessError = void 0;
|
|
4
|
-
const BaseError_1 = require("../errors/BaseError");
|
|
5
|
-
const errors_1 = require("../enums/errors");
|
|
6
|
-
class BusinessError extends BaseError_1.BaseError {
|
|
7
|
-
constructor(message, details) {
|
|
8
|
-
super(message);
|
|
9
|
-
this.name = errors_1.Errors.BUSINESS_ERROR;
|
|
10
|
-
this.details = details || {};
|
|
11
|
-
Object.setPrototypeOf(this, BusinessError.prototype);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.BusinessError = BusinessError;
|
|
15
|
-
//# sourceMappingURL=BusinessError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BusinessError.js","sourceRoot":"","sources":["../../src/errors/BusinessError.ts"],"names":[],"mappings":";;;AAAA,kDAA+C;AAC/C,2CAAwC;AAExC,MAAa,aAAc,SAAQ,qBAAS;IAE1C,YAAmB,OAAe,EAAE,OAAiC;QACnE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAM,CAAC,cAAc,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;QAC7B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;CACF;AARD,sCAQC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ForbiddenError.d.ts","sourceRoot":"","sources":["../../src/errors/ForbiddenError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,qBAAa,cAAe,SAAQ,SAAS;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBACtB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAMtE"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ForbiddenError = void 0;
|
|
4
|
-
const BaseError_1 = require("../errors/BaseError");
|
|
5
|
-
const errors_1 = require("../enums/errors");
|
|
6
|
-
class ForbiddenError extends BaseError_1.BaseError {
|
|
7
|
-
constructor(message, details) {
|
|
8
|
-
super(message);
|
|
9
|
-
this.name = errors_1.Errors.FORBIDDEN_ERROR;
|
|
10
|
-
this.details = details || {};
|
|
11
|
-
Object.setPrototypeOf(this, ForbiddenError.prototype);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.ForbiddenError = ForbiddenError;
|
|
15
|
-
//# sourceMappingURL=ForbiddenError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ForbiddenError.js","sourceRoot":"","sources":["../../src/errors/ForbiddenError.ts"],"names":[],"mappings":";;;AAAA,kDAA+C;AAC/C,2CAAwC;AAExC,MAAa,cAAe,SAAQ,qBAAS;IAE3C,YAAmB,OAAe,EAAE,OAAiC;QACnE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAM,CAAC,eAAe,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;QAC7B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACxD,CAAC;CACF;AARD,wCAQC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NotFoundError.d.ts","sourceRoot":"","sources":["../../src/errors/NotFoundError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,qBAAa,aAAc,SAAQ,SAAS;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBACtB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAMtE"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NotFoundError = void 0;
|
|
4
|
-
const BaseError_1 = require("../errors/BaseError");
|
|
5
|
-
const errors_1 = require("../enums/errors");
|
|
6
|
-
class NotFoundError extends BaseError_1.BaseError {
|
|
7
|
-
constructor(message, details) {
|
|
8
|
-
super(message);
|
|
9
|
-
this.name = errors_1.Errors.NOT_FOUND_ERROR;
|
|
10
|
-
this.details = details || {};
|
|
11
|
-
Object.setPrototypeOf(this, NotFoundError.prototype);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.NotFoundError = NotFoundError;
|
|
15
|
-
//# sourceMappingURL=NotFoundError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NotFoundError.js","sourceRoot":"","sources":["../../src/errors/NotFoundError.ts"],"names":[],"mappings":";;;AAAA,kDAA+C;AAC/C,2CAAwC;AAExC,MAAa,aAAc,SAAQ,qBAAS;IAE1C,YAAmB,OAAe,EAAE,OAAiC;QACnE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAM,CAAC,eAAe,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;QAC7B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;CACF;AARD,sCAQC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ServerError.d.ts","sourceRoot":"","sources":["../../src/errors/ServerError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,qBAAa,WAAY,SAAQ,SAAS;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBACtB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAMtE"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ServerError = void 0;
|
|
4
|
-
const BaseError_1 = require("../errors/BaseError");
|
|
5
|
-
const errors_1 = require("../enums/errors");
|
|
6
|
-
class ServerError extends BaseError_1.BaseError {
|
|
7
|
-
constructor(message, details) {
|
|
8
|
-
super(message);
|
|
9
|
-
this.name = errors_1.Errors.SERVER_ERROR;
|
|
10
|
-
this.details = details || {};
|
|
11
|
-
Object.setPrototypeOf(this, ServerError.prototype);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.ServerError = ServerError;
|
|
15
|
-
//# sourceMappingURL=ServerError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ServerError.js","sourceRoot":"","sources":["../../src/errors/ServerError.ts"],"names":[],"mappings":";;;AAAA,kDAA+C;AAC/C,2CAAwC;AAExC,MAAa,WAAY,SAAQ,qBAAS;IAExC,YAAmB,OAAe,EAAE,OAAiC;QACnE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAM,CAAC,YAAY,CAAC;QAChC,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;QAC7B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACrD,CAAC;CACF;AARD,kCAQC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UnauthorizedError.d.ts","sourceRoot":"","sources":["../../src/errors/UnauthorizedError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,qBAAa,iBAAkB,SAAQ,SAAS;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBACtB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAMtE"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UnauthorizedError = void 0;
|
|
4
|
-
const BaseError_1 = require("../errors/BaseError");
|
|
5
|
-
const errors_1 = require("../enums/errors");
|
|
6
|
-
class UnauthorizedError extends BaseError_1.BaseError {
|
|
7
|
-
constructor(message, details) {
|
|
8
|
-
super(message);
|
|
9
|
-
this.name = errors_1.Errors.UNAUTHORIZED_ERROR;
|
|
10
|
-
this.details = details || {};
|
|
11
|
-
Object.setPrototypeOf(this, UnauthorizedError.prototype);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.UnauthorizedError = UnauthorizedError;
|
|
15
|
-
//# sourceMappingURL=UnauthorizedError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UnauthorizedError.js","sourceRoot":"","sources":["../../src/errors/UnauthorizedError.ts"],"names":[],"mappings":";;;AAAA,kDAA+C;AAC/C,2CAAwC;AAExC,MAAa,iBAAkB,SAAQ,qBAAS;IAE9C,YAAmB,OAAe,EAAE,OAAiC;QACnE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAM,CAAC,kBAAkB,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;QAC7B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC3D,CAAC;CACF;AARD,8CAQC"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yCAAyC,CAAC;AACxD,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAGlD,cAAc,gBAAgB,CAAC;AAG/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { IPagination } from '../../interfaces/general/IPagination';
|
|
2
|
-
export interface IApiResponse<T = unknown> {
|
|
3
|
-
success: boolean;
|
|
4
|
-
data?: T;
|
|
5
|
-
pagination?: IPagination;
|
|
6
|
-
error?: string;
|
|
7
|
-
message?: string;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=IApiResponse.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IApiResponse.d.ts","sourceRoot":"","sources":["../../../src/interfaces/general/IApiResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAEpE,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,OAAO;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IApiResponse.js","sourceRoot":"","sources":["../../../src/interfaces/general/IApiResponse.ts"],"names":[],"mappings":""}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export interface IConfig {
|
|
2
|
-
port: number;
|
|
3
|
-
cors: {
|
|
4
|
-
origin: string;
|
|
5
|
-
};
|
|
6
|
-
environment: string;
|
|
7
|
-
apiVersions: string[];
|
|
8
|
-
mongodbUri?: string;
|
|
9
|
-
mongodbDbName?: string;
|
|
10
|
-
maxRequestRateLimit?: number;
|
|
11
|
-
maxTimeoutRateLimit?: number;
|
|
12
|
-
jwtSecret?: string;
|
|
13
|
-
jwtExpirationTime?: string;
|
|
14
|
-
saltRounds?: number;
|
|
15
|
-
redisUrl?: string;
|
|
16
|
-
jwtRecoveryPasswordSecret?: string;
|
|
17
|
-
jwtRecoveryPasswordExpirationTime?: string;
|
|
18
|
-
resendApiKey?: string;
|
|
19
|
-
frontendUrl?: string;
|
|
20
|
-
emailFromDomain?: string;
|
|
21
|
-
auth0Domain?: string;
|
|
22
|
-
auth0ClientId?: string;
|
|
23
|
-
auth0ClientSecret?: string;
|
|
24
|
-
auth0Audience?: string;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=IConfig.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IConfig.d.ts","sourceRoot":"","sources":["../../../src/interfaces/general/IConfig.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,iCAAiC,CAAC,EAAE,MAAM,CAAC;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IConfig.js","sourceRoot":"","sources":["../../../src/interfaces/general/IConfig.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IPaginatedResponse.d.ts","sourceRoot":"","sources":["../../../src/interfaces/general/IPaginatedResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAEpE,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,UAAU,EAAE,WAAW,CAAC;CACzB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IPaginatedResponse.js","sourceRoot":"","sources":["../../../src/interfaces/general/IPaginatedResponse.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IPagination.d.ts","sourceRoot":"","sources":["../../../src/interfaces/general/IPagination.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IPagination.js","sourceRoot":"","sources":["../../../src/interfaces/general/IPagination.ts"],"names":[],"mappings":""}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Application } from 'express';
|
|
2
|
-
import type { Logger } from 'winston';
|
|
3
|
-
import type { IConfig } from '../../interfaces/general/IConfig';
|
|
4
|
-
export interface IServerInit {
|
|
5
|
-
app: Application;
|
|
6
|
-
config: IConfig;
|
|
7
|
-
logger: Logger;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=IServerInit.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IServerInit.d.ts","sourceRoot":"","sources":["../../../src/interfaces/general/IServerInit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAE5D,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,WAAW,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IServerInit.js","sourceRoot":"","sources":["../../../src/interfaces/general/IServerInit.ts"],"names":[],"mappings":""}
|