@ipetsadmin/contracts 1.0.2 → 1.0.4
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 +25 -0
- package/README.md +28 -11
- package/dist/index.d.mts +116 -0
- package/dist/index.d.ts +116 -12
- package/dist/index.js +96 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +90 -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,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
19
19
|
|
|
20
20
|
### Security
|
|
21
21
|
|
|
22
|
+
## [1.0.4] - 2026-04-02
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- **`HealthCheck` type** (`src/types/HealthCheck.ts`) — shape for `IApiResponse<HealthCheck>['data']` on health-check
|
|
27
|
+
endpoints (`message`, optional `status`).
|
|
28
|
+
- **`HealthStatus` enum** (`src/enums/health-status.ts`) — `healthy` / `unhealthy`; exported for use with `HealthCheck`
|
|
29
|
+
and API handlers.
|
|
30
|
+
|
|
31
|
+
## [1.0.3] - 2026-04-02
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
|
|
35
|
+
- **ESM named imports** (`import { BusinessError } from '@ipetsadmin/contracts'`): the library is now built with **tsup**
|
|
36
|
+
as **dual CJS + ESM** (`dist/index.js` and `dist/index.mjs`). Node and bundlers resolve **`exports.import`** to the
|
|
37
|
+
ESM bundle, which exposes real `export` bindings. The previous **TypeScript-only CommonJS** output used
|
|
38
|
+
`__exportStar` / getters that **Node’s ESM↔CJS interop** does not turn into static named exports, so `import { … }`
|
|
39
|
+
often failed in `"type": "module"` projects while `require()` still worked.
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
|
|
43
|
+
- **Build**: `pnpm run build` runs `tsup` (replaces `tsc` + `tsc-alias` for the published entry). Declaration files are
|
|
44
|
+
emitted as `dist/index.d.ts` and `dist/index.d.mts`.
|
|
45
|
+
- **`package.json`**: `module` points at `dist/index.mjs`; `exports` includes **`import`** for the ESM build.
|
|
46
|
+
|
|
22
47
|
## [1.0.2] - 2026-04-02
|
|
23
48
|
|
|
24
49
|
### Fixed
|
package/README.md
CHANGED
|
@@ -35,6 +35,8 @@ pnpm add git+https://github.com/your-org/contracts.git#v1.0.0
|
|
|
35
35
|
```typescript
|
|
36
36
|
import {
|
|
37
37
|
Errors,
|
|
38
|
+
HealthCheck,
|
|
39
|
+
HealthStatus,
|
|
38
40
|
IConfig,
|
|
39
41
|
IApiResponse,
|
|
40
42
|
IPaginatedResponse,
|
|
@@ -46,10 +48,23 @@ import {
|
|
|
46
48
|
ServerError,
|
|
47
49
|
UnauthorizedError,
|
|
48
50
|
} from '@ipetsadmin/contracts';
|
|
51
|
+
|
|
52
|
+
// Example: typed health-check response body
|
|
53
|
+
const health: IApiResponse<HealthCheck> = {
|
|
54
|
+
success: true,
|
|
55
|
+
message: 'API is running',
|
|
56
|
+
data: { message: 'API is running', status: HealthStatus.HEALTHY },
|
|
57
|
+
};
|
|
49
58
|
```
|
|
50
59
|
|
|
51
60
|
Path aliases (`@/…`) apply only inside this package’s source; consumers import from `@ipetsadmin/contracts` as above.
|
|
52
61
|
|
|
62
|
+
The published package is **dual CJS + ESM** (`exports.require` → `dist/index.js`, `exports.import` → `dist/index.mjs`).
|
|
63
|
+
That way **`import { BaseError, BusinessError } from '@ipetsadmin/contracts'`** works in ESM projects (`"type": "module"`,
|
|
64
|
+
Vite, etc.), and **`require('@ipetsadmin/contracts')`** still works in CommonJS. Use TypeScript
|
|
65
|
+
**`moduleResolution`: `"node16"`** or **`"nodenext"`** (or **`"bundler"`**) in consuming apps so types resolve through
|
|
66
|
+
`package.json` `exports`.
|
|
67
|
+
|
|
53
68
|
## Development
|
|
54
69
|
|
|
55
70
|
Install dependencies and (on first clone) install Git hooks:
|
|
@@ -58,16 +73,16 @@ Install dependencies and (on first clone) install Git hooks:
|
|
|
58
73
|
pnpm install
|
|
59
74
|
```
|
|
60
75
|
|
|
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)
|
|
76
|
+
| Script | Description |
|
|
77
|
+
| ----------------------- | ------------------------------------------------------------------------------------------ |
|
|
78
|
+
| `pnpm run build` | **tsup**: bundle `src/index.ts` → `dist/index.js` (CJS) + `dist/index.mjs` (ESM) + `.d.ts` |
|
|
79
|
+
| `pnpm run clean` | Remove `dist/` |
|
|
80
|
+
| `pnpm run typecheck` | `tsc --noEmit` (no emit, full typecheck) |
|
|
81
|
+
| `pnpm run lint` | ESLint with cache (`.eslintcache`) |
|
|
82
|
+
| `pnpm run lint:fix` | ESLint with `--fix` |
|
|
83
|
+
| `pnpm run format` | Prettier write (respects `.prettierignore`) |
|
|
84
|
+
| `pnpm run format:check` | Prettier check only |
|
|
85
|
+
| `pnpm run validate` | `typecheck` → `lint` → `format:check` (use in CI) |
|
|
71
86
|
|
|
72
87
|
**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
88
|
|
|
@@ -75,6 +90,7 @@ pnpm install
|
|
|
75
90
|
|
|
76
91
|
### Tooling in this repo
|
|
77
92
|
|
|
93
|
+
- **tsup** — `tsup.config.ts`; dual CJS/ESM build for the npm entry
|
|
78
94
|
- **ESLint** — `eslint.config.mjs` (flat config), TypeScript type-aware rules via `typescript-eslint`, conflicts with Prettier disabled via `eslint-config-prettier`
|
|
79
95
|
- **Prettier** — `.prettierrc.json`, `.prettierignore`
|
|
80
96
|
- **Editor defaults** — `.editorconfig`
|
|
@@ -91,9 +107,10 @@ pnpm install
|
|
|
91
107
|
|
|
92
108
|
Source lives under `src/`:
|
|
93
109
|
|
|
94
|
-
- `enums/` — shared enums (e.g. `Errors`)
|
|
110
|
+
- `enums/` — shared enums (e.g. `Errors`, `HealthStatus`)
|
|
95
111
|
- `errors/` — error classes (`BaseError`, domain errors, …)
|
|
96
112
|
- `interfaces/general/` — cross-cutting interfaces (`IConfig`, pagination, API responses, server bootstrap types, …)
|
|
113
|
+
- `types/` — shared type aliases (e.g. `HealthCheck` for `IApiResponse` payloads)
|
|
97
114
|
|
|
98
115
|
The public API is whatever `src/index.ts` re-exports. Additional error classes may exist under `src/errors/` but only appear in consumers if listed in `index.ts`.
|
|
99
116
|
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { Application } from 'express';
|
|
2
|
+
import { Logger } from 'winston';
|
|
3
|
+
|
|
4
|
+
declare enum HealthStatus {
|
|
5
|
+
HEALTHY = "healthy",
|
|
6
|
+
UNHEALTHY = "unhealthy"
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type HealthCheck = {
|
|
10
|
+
message: string;
|
|
11
|
+
status?: HealthStatus;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
interface IConfig {
|
|
15
|
+
port: number;
|
|
16
|
+
cors: {
|
|
17
|
+
origin: string;
|
|
18
|
+
};
|
|
19
|
+
environment: string;
|
|
20
|
+
apiVersions: string[];
|
|
21
|
+
mongodbUri?: string;
|
|
22
|
+
mongodbDbName?: string;
|
|
23
|
+
maxRequestRateLimit?: number;
|
|
24
|
+
maxTimeoutRateLimit?: number;
|
|
25
|
+
jwtSecret?: string;
|
|
26
|
+
jwtExpirationTime?: string;
|
|
27
|
+
saltRounds?: number;
|
|
28
|
+
redisUrl?: string;
|
|
29
|
+
jwtRecoveryPasswordSecret?: string;
|
|
30
|
+
jwtRecoveryPasswordExpirationTime?: string;
|
|
31
|
+
resendApiKey?: string;
|
|
32
|
+
frontendUrl?: string;
|
|
33
|
+
emailFromDomain?: string;
|
|
34
|
+
auth0Domain?: string;
|
|
35
|
+
auth0ClientId?: string;
|
|
36
|
+
auth0ClientSecret?: string;
|
|
37
|
+
auth0Audience?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface IPagination {
|
|
41
|
+
page: number;
|
|
42
|
+
limit: number;
|
|
43
|
+
total: number;
|
|
44
|
+
totalPages: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface IPaginatedResponse<T> {
|
|
48
|
+
data: T[];
|
|
49
|
+
pagination: IPagination;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface IServerInit {
|
|
53
|
+
app: Application;
|
|
54
|
+
config: IConfig;
|
|
55
|
+
logger: Logger;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface IApiResponse<T = unknown> {
|
|
59
|
+
success: boolean;
|
|
60
|
+
data?: T;
|
|
61
|
+
pagination?: IPagination;
|
|
62
|
+
error?: string;
|
|
63
|
+
message?: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
declare enum Errors {
|
|
67
|
+
NOT_FOUND_ERROR = "NotFoundError",
|
|
68
|
+
BUSINESS_ERROR = "BusinessError",
|
|
69
|
+
FORBIDDEN_ERROR = "ForbiddenError",
|
|
70
|
+
SERVER_ERROR = "ServerError",
|
|
71
|
+
UNAUTHORIZED_ERROR = "UnauthorizedError",
|
|
72
|
+
BAD_REQUEST_ERROR = "BadRequestError",
|
|
73
|
+
UNPROCESSABLE_ENTITY_ERROR = "UnprocessableEntityError",
|
|
74
|
+
TOO_MANY_REQUESTS_ERROR = "TooManyRequestsError",
|
|
75
|
+
INTERNAL_SERVER_ERROR = "InternalServerError",
|
|
76
|
+
SERVICE_UNAVAILABLE_ERROR = "ServiceUnavailableError",
|
|
77
|
+
GATEWAY_TIMEOUT_ERROR = "GatewayTimeoutError",
|
|
78
|
+
BAD_GATEWAY_ERROR = "BadGatewayError",
|
|
79
|
+
PRECONDITION_FAILED_ERROR = "PreconditionFailedError",
|
|
80
|
+
PAYLOAD_TOO_LARGE_ERROR = "PayloadTooLargeError"
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
declare class BaseError extends Error {
|
|
84
|
+
details?: Record<string, unknown>;
|
|
85
|
+
toErrorRecord(): {
|
|
86
|
+
error: string;
|
|
87
|
+
details?: unknown;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
declare class BusinessError extends BaseError {
|
|
92
|
+
details?: Record<string, unknown>;
|
|
93
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
declare class ForbiddenError extends BaseError {
|
|
97
|
+
details?: Record<string, unknown>;
|
|
98
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
declare class NotFoundError extends BaseError {
|
|
102
|
+
details?: Record<string, unknown>;
|
|
103
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
declare class ServerError extends BaseError {
|
|
107
|
+
details?: Record<string, unknown>;
|
|
108
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
declare class UnauthorizedError extends BaseError {
|
|
112
|
+
details?: Record<string, unknown>;
|
|
113
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export { BaseError, BusinessError, Errors, ForbiddenError, type HealthCheck, HealthStatus, type IApiResponse, type IConfig, type IPaginatedResponse, type IServerInit, NotFoundError, ServerError, UnauthorizedError };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,116 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { Application } from 'express';
|
|
2
|
+
import { Logger } from 'winston';
|
|
3
|
+
|
|
4
|
+
declare enum HealthStatus {
|
|
5
|
+
HEALTHY = "healthy",
|
|
6
|
+
UNHEALTHY = "unhealthy"
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type HealthCheck = {
|
|
10
|
+
message: string;
|
|
11
|
+
status?: HealthStatus;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
interface IConfig {
|
|
15
|
+
port: number;
|
|
16
|
+
cors: {
|
|
17
|
+
origin: string;
|
|
18
|
+
};
|
|
19
|
+
environment: string;
|
|
20
|
+
apiVersions: string[];
|
|
21
|
+
mongodbUri?: string;
|
|
22
|
+
mongodbDbName?: string;
|
|
23
|
+
maxRequestRateLimit?: number;
|
|
24
|
+
maxTimeoutRateLimit?: number;
|
|
25
|
+
jwtSecret?: string;
|
|
26
|
+
jwtExpirationTime?: string;
|
|
27
|
+
saltRounds?: number;
|
|
28
|
+
redisUrl?: string;
|
|
29
|
+
jwtRecoveryPasswordSecret?: string;
|
|
30
|
+
jwtRecoveryPasswordExpirationTime?: string;
|
|
31
|
+
resendApiKey?: string;
|
|
32
|
+
frontendUrl?: string;
|
|
33
|
+
emailFromDomain?: string;
|
|
34
|
+
auth0Domain?: string;
|
|
35
|
+
auth0ClientId?: string;
|
|
36
|
+
auth0ClientSecret?: string;
|
|
37
|
+
auth0Audience?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface IPagination {
|
|
41
|
+
page: number;
|
|
42
|
+
limit: number;
|
|
43
|
+
total: number;
|
|
44
|
+
totalPages: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface IPaginatedResponse<T> {
|
|
48
|
+
data: T[];
|
|
49
|
+
pagination: IPagination;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface IServerInit {
|
|
53
|
+
app: Application;
|
|
54
|
+
config: IConfig;
|
|
55
|
+
logger: Logger;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface IApiResponse<T = unknown> {
|
|
59
|
+
success: boolean;
|
|
60
|
+
data?: T;
|
|
61
|
+
pagination?: IPagination;
|
|
62
|
+
error?: string;
|
|
63
|
+
message?: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
declare enum Errors {
|
|
67
|
+
NOT_FOUND_ERROR = "NotFoundError",
|
|
68
|
+
BUSINESS_ERROR = "BusinessError",
|
|
69
|
+
FORBIDDEN_ERROR = "ForbiddenError",
|
|
70
|
+
SERVER_ERROR = "ServerError",
|
|
71
|
+
UNAUTHORIZED_ERROR = "UnauthorizedError",
|
|
72
|
+
BAD_REQUEST_ERROR = "BadRequestError",
|
|
73
|
+
UNPROCESSABLE_ENTITY_ERROR = "UnprocessableEntityError",
|
|
74
|
+
TOO_MANY_REQUESTS_ERROR = "TooManyRequestsError",
|
|
75
|
+
INTERNAL_SERVER_ERROR = "InternalServerError",
|
|
76
|
+
SERVICE_UNAVAILABLE_ERROR = "ServiceUnavailableError",
|
|
77
|
+
GATEWAY_TIMEOUT_ERROR = "GatewayTimeoutError",
|
|
78
|
+
BAD_GATEWAY_ERROR = "BadGatewayError",
|
|
79
|
+
PRECONDITION_FAILED_ERROR = "PreconditionFailedError",
|
|
80
|
+
PAYLOAD_TOO_LARGE_ERROR = "PayloadTooLargeError"
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
declare class BaseError extends Error {
|
|
84
|
+
details?: Record<string, unknown>;
|
|
85
|
+
toErrorRecord(): {
|
|
86
|
+
error: string;
|
|
87
|
+
details?: unknown;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
declare class BusinessError extends BaseError {
|
|
92
|
+
details?: Record<string, unknown>;
|
|
93
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
declare class ForbiddenError extends BaseError {
|
|
97
|
+
details?: Record<string, unknown>;
|
|
98
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
declare class NotFoundError extends BaseError {
|
|
102
|
+
details?: Record<string, unknown>;
|
|
103
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
declare class ServerError extends BaseError {
|
|
107
|
+
details?: Record<string, unknown>;
|
|
108
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
declare class UnauthorizedError extends BaseError {
|
|
112
|
+
details?: Record<string, unknown>;
|
|
113
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export { BaseError, BusinessError, Errors, ForbiddenError, type HealthCheck, HealthStatus, type IApiResponse, type IConfig, type IPaginatedResponse, type IServerInit, NotFoundError, ServerError, UnauthorizedError };
|
package/dist/index.js
CHANGED
|
@@ -1,28 +1,99 @@
|
|
|
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/enums/health-status.ts
|
|
23
|
+
var HealthStatus = /* @__PURE__ */ ((HealthStatus2) => {
|
|
24
|
+
HealthStatus2["HEALTHY"] = "healthy";
|
|
25
|
+
HealthStatus2["UNHEALTHY"] = "unhealthy";
|
|
26
|
+
return HealthStatus2;
|
|
27
|
+
})(HealthStatus || {});
|
|
28
|
+
|
|
29
|
+
// src/errors/BaseError.ts
|
|
30
|
+
var BaseError = class extends Error {
|
|
31
|
+
toErrorRecord() {
|
|
32
|
+
const obj = { error: this.message };
|
|
33
|
+
if (this.details) {
|
|
34
|
+
obj.details = this.details;
|
|
7
35
|
}
|
|
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);
|
|
36
|
+
return obj;
|
|
37
|
+
}
|
|
15
38
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
39
|
+
|
|
40
|
+
// src/errors/BusinessError.ts
|
|
41
|
+
var BusinessError = class _BusinessError extends BaseError {
|
|
42
|
+
constructor(message, details) {
|
|
43
|
+
super(message);
|
|
44
|
+
this.name = "BusinessError" /* BUSINESS_ERROR */;
|
|
45
|
+
this.details = details || {};
|
|
46
|
+
Object.setPrototypeOf(this, _BusinessError.prototype);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// src/errors/ForbiddenError.ts
|
|
51
|
+
var ForbiddenError = class _ForbiddenError extends BaseError {
|
|
52
|
+
constructor(message, details) {
|
|
53
|
+
super(message);
|
|
54
|
+
this.name = "ForbiddenError" /* FORBIDDEN_ERROR */;
|
|
55
|
+
this.details = details || {};
|
|
56
|
+
Object.setPrototypeOf(this, _ForbiddenError.prototype);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// src/errors/NotFoundError.ts
|
|
61
|
+
var NotFoundError = class _NotFoundError extends BaseError {
|
|
62
|
+
constructor(message, details) {
|
|
63
|
+
super(message);
|
|
64
|
+
this.name = "NotFoundError" /* NOT_FOUND_ERROR */;
|
|
65
|
+
this.details = details || {};
|
|
66
|
+
Object.setPrototypeOf(this, _NotFoundError.prototype);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// src/errors/ServerError.ts
|
|
71
|
+
var ServerError = class _ServerError extends BaseError {
|
|
72
|
+
constructor(message, details) {
|
|
73
|
+
super(message);
|
|
74
|
+
this.name = "ServerError" /* SERVER_ERROR */;
|
|
75
|
+
this.details = details || {};
|
|
76
|
+
Object.setPrototypeOf(this, _ServerError.prototype);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// src/errors/UnauthorizedError.ts
|
|
81
|
+
var UnauthorizedError = class _UnauthorizedError extends BaseError {
|
|
82
|
+
constructor(message, details) {
|
|
83
|
+
super(message);
|
|
84
|
+
this.name = "UnauthorizedError" /* UNAUTHORIZED_ERROR */;
|
|
85
|
+
this.details = details || {};
|
|
86
|
+
Object.setPrototypeOf(this, _UnauthorizedError.prototype);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
exports.BaseError = BaseError;
|
|
91
|
+
exports.BusinessError = BusinessError;
|
|
92
|
+
exports.Errors = Errors;
|
|
93
|
+
exports.ForbiddenError = ForbiddenError;
|
|
94
|
+
exports.HealthStatus = HealthStatus;
|
|
95
|
+
exports.NotFoundError = NotFoundError;
|
|
96
|
+
exports.ServerError = ServerError;
|
|
97
|
+
exports.UnauthorizedError = UnauthorizedError;
|
|
98
|
+
//# sourceMappingURL=index.js.map
|
|
28
99
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/enums/errors.ts","../src/enums/health-status.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","HealthStatus"],"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 enum HealthStatus {\n HEALTHY = 'healthy',\n UNHEALTHY = 'unhealthy',\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,90 @@
|
|
|
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/enums/health-status.ts
|
|
21
|
+
var HealthStatus = /* @__PURE__ */ ((HealthStatus2) => {
|
|
22
|
+
HealthStatus2["HEALTHY"] = "healthy";
|
|
23
|
+
HealthStatus2["UNHEALTHY"] = "unhealthy";
|
|
24
|
+
return HealthStatus2;
|
|
25
|
+
})(HealthStatus || {});
|
|
26
|
+
|
|
27
|
+
// src/errors/BaseError.ts
|
|
28
|
+
var BaseError = class extends Error {
|
|
29
|
+
toErrorRecord() {
|
|
30
|
+
const obj = { error: this.message };
|
|
31
|
+
if (this.details) {
|
|
32
|
+
obj.details = this.details;
|
|
33
|
+
}
|
|
34
|
+
return obj;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// src/errors/BusinessError.ts
|
|
39
|
+
var BusinessError = class _BusinessError extends BaseError {
|
|
40
|
+
constructor(message, details) {
|
|
41
|
+
super(message);
|
|
42
|
+
this.name = "BusinessError" /* BUSINESS_ERROR */;
|
|
43
|
+
this.details = details || {};
|
|
44
|
+
Object.setPrototypeOf(this, _BusinessError.prototype);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// src/errors/ForbiddenError.ts
|
|
49
|
+
var ForbiddenError = class _ForbiddenError extends BaseError {
|
|
50
|
+
constructor(message, details) {
|
|
51
|
+
super(message);
|
|
52
|
+
this.name = "ForbiddenError" /* FORBIDDEN_ERROR */;
|
|
53
|
+
this.details = details || {};
|
|
54
|
+
Object.setPrototypeOf(this, _ForbiddenError.prototype);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// src/errors/NotFoundError.ts
|
|
59
|
+
var NotFoundError = class _NotFoundError extends BaseError {
|
|
60
|
+
constructor(message, details) {
|
|
61
|
+
super(message);
|
|
62
|
+
this.name = "NotFoundError" /* NOT_FOUND_ERROR */;
|
|
63
|
+
this.details = details || {};
|
|
64
|
+
Object.setPrototypeOf(this, _NotFoundError.prototype);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// src/errors/ServerError.ts
|
|
69
|
+
var ServerError = class _ServerError extends BaseError {
|
|
70
|
+
constructor(message, details) {
|
|
71
|
+
super(message);
|
|
72
|
+
this.name = "ServerError" /* SERVER_ERROR */;
|
|
73
|
+
this.details = details || {};
|
|
74
|
+
Object.setPrototypeOf(this, _ServerError.prototype);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// src/errors/UnauthorizedError.ts
|
|
79
|
+
var UnauthorizedError = class _UnauthorizedError extends BaseError {
|
|
80
|
+
constructor(message, details) {
|
|
81
|
+
super(message);
|
|
82
|
+
this.name = "UnauthorizedError" /* UNAUTHORIZED_ERROR */;
|
|
83
|
+
this.details = details || {};
|
|
84
|
+
Object.setPrototypeOf(this, _UnauthorizedError.prototype);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export { BaseError, BusinessError, Errors, ForbiddenError, HealthStatus, NotFoundError, ServerError, UnauthorizedError };
|
|
89
|
+
//# sourceMappingURL=index.mjs.map
|
|
90
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/enums/errors.ts","../src/enums/health-status.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","HealthStatus"],"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 enum HealthStatus {\n HEALTHY = 'healthy',\n UNHEALTHY = 'unhealthy',\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.4",
|
|
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":""}
|