@ipetsadmin/contracts 1.0.1 → 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.
Files changed (58) hide show
  1. package/CHANGELOG.md +32 -6
  2. package/README.md +19 -10
  3. package/dist/index.d.mts +106 -0
  4. package/dist/index.d.ts +106 -12
  5. package/dist/index.js +87 -34
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +83 -0
  8. package/dist/index.mjs.map +1 -0
  9. package/package.json +16 -6
  10. package/dist/enums/errors.d.ts +0 -17
  11. package/dist/enums/errors.d.ts.map +0 -1
  12. package/dist/enums/errors.js +0 -21
  13. package/dist/enums/errors.js.map +0 -1
  14. package/dist/errors/BaseError.d.ts +0 -8
  15. package/dist/errors/BaseError.d.ts.map +0 -1
  16. package/dist/errors/BaseError.js +0 -13
  17. package/dist/errors/BaseError.js.map +0 -1
  18. package/dist/errors/BusinessError.d.ts +0 -6
  19. package/dist/errors/BusinessError.d.ts.map +0 -1
  20. package/dist/errors/BusinessError.js +0 -17
  21. package/dist/errors/BusinessError.js.map +0 -1
  22. package/dist/errors/ForbiddenError.d.ts +0 -6
  23. package/dist/errors/ForbiddenError.d.ts.map +0 -1
  24. package/dist/errors/ForbiddenError.js +0 -17
  25. package/dist/errors/ForbiddenError.js.map +0 -1
  26. package/dist/errors/NotFoundError.d.ts +0 -6
  27. package/dist/errors/NotFoundError.d.ts.map +0 -1
  28. package/dist/errors/NotFoundError.js +0 -17
  29. package/dist/errors/NotFoundError.js.map +0 -1
  30. package/dist/errors/ServerError.d.ts +0 -6
  31. package/dist/errors/ServerError.d.ts.map +0 -1
  32. package/dist/errors/ServerError.js +0 -17
  33. package/dist/errors/ServerError.js.map +0 -1
  34. package/dist/errors/UnauthorizedError.d.ts +0 -6
  35. package/dist/errors/UnauthorizedError.d.ts.map +0 -1
  36. package/dist/errors/UnauthorizedError.js +0 -17
  37. package/dist/errors/UnauthorizedError.js.map +0 -1
  38. package/dist/index.d.ts.map +0 -1
  39. package/dist/interfaces/general/IApiResponse.d.ts +0 -9
  40. package/dist/interfaces/general/IApiResponse.d.ts.map +0 -1
  41. package/dist/interfaces/general/IApiResponse.js +0 -3
  42. package/dist/interfaces/general/IApiResponse.js.map +0 -1
  43. package/dist/interfaces/general/IConfig.d.ts +0 -26
  44. package/dist/interfaces/general/IConfig.d.ts.map +0 -1
  45. package/dist/interfaces/general/IConfig.js +0 -3
  46. package/dist/interfaces/general/IConfig.js.map +0 -1
  47. package/dist/interfaces/general/IPaginatedResponse.d.ts +0 -6
  48. package/dist/interfaces/general/IPaginatedResponse.d.ts.map +0 -1
  49. package/dist/interfaces/general/IPaginatedResponse.js +0 -3
  50. package/dist/interfaces/general/IPaginatedResponse.js.map +0 -1
  51. package/dist/interfaces/general/IPagination.d.ts +0 -7
  52. package/dist/interfaces/general/IPagination.d.ts.map +0 -1
  53. package/dist/interfaces/general/IPagination.js +0 -3
  54. package/dist/interfaces/general/IPagination.js.map +0 -1
  55. package/dist/interfaces/general/IServerInit.d.ts +0 -9
  56. package/dist/interfaces/general/IServerInit.d.ts.map +0 -1
  57. package/dist/interfaces/general/IServerInit.js +0 -3
  58. package/dist/interfaces/general/IServerInit.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -19,16 +19,42 @@ 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
+
38
+ ## [1.0.2] - 2026-04-02
39
+
40
+ ### Fixed
41
+
42
+ - **Error classes are now true named exports** in `src/errors/*.ts` (`export class …` instead of `export default class`).
43
+ The barrel file re-exports them with `export * from '@/errors/…'`, which compiles to plain `__exportStar` assignments
44
+ on `exports` in CommonJS. This avoids the previous pattern where TypeScript emitted **getter-only** re-exports for
45
+ `export { default as X }`, which some runtimes, bundlers, and reflection-based tooling do not surface as normal
46
+ named exports.
47
+ - **`package.json` `exports` map** added (`types`, `require`, `default`) so Node and TypeScript
48
+ `moduleResolution` `node16` / `nodenext` resolve the package entry and types reliably.
49
+
22
50
  ## [1.0.1] - 2026-04-02
23
51
 
24
52
  ### Fixed
25
53
 
26
- - **Error exports from the package entry** (`src/index.ts`): replaced `export * from '@/errors/...'` with explicit
27
- `export { default as } from '@/errors/…'` so each error class’s **default** export is re-exported as a **named**
28
- symbol from `@ipetsadmin/contracts`. `export *` does not re-export `default`, which broke consistent imports for
29
- consumers.
30
- - **Public error API**: `ServerError` and `UnauthorizedError` are now exported from the package entry alongside the
31
- other error classes.
54
+ - **Error exports from the package entry** (`src/index.ts`): attempted fix using `export { default as … } from '@/errors/…'`
55
+ (default exports are not re-exported by `export *`). Follow-up in **1.0.2** completes the fix with named class exports
56
+ and an `exports` field.
57
+ - **Public error API**: `ServerError` and `UnauthorizedError` re-exported from the package entry.
32
58
 
33
59
  ## [1.0.0] - 2026-04-02
34
60
 
package/README.md CHANGED
@@ -43,11 +43,19 @@ import {
43
43
  BusinessError,
44
44
  ForbiddenError,
45
45
  NotFoundError,
46
+ ServerError,
47
+ UnauthorizedError,
46
48
  } from '@ipetsadmin/contracts';
47
49
  ```
48
50
 
49
51
  Path aliases (`@/…`) apply only inside this package’s source; consumers import from `@ipetsadmin/contracts` as above.
50
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
+
51
59
  ## Development
52
60
 
53
61
  Install dependencies and (on first clone) install Git hooks:
@@ -56,16 +64,16 @@ Install dependencies and (on first clone) install Git hooks:
56
64
  pnpm install
57
65
  ```
58
66
 
59
- | Script | Description |
60
- | ----------------------- | ---------------------------------------------------------- |
61
- | `pnpm run build` | Compile `src/` → `dist/` (TypeScript + path alias rewrite) |
62
- | `pnpm run clean` | Remove `dist/` |
63
- | `pnpm run typecheck` | `tsc --noEmit` (no emit, full typecheck) |
64
- | `pnpm run lint` | ESLint with cache (`.eslintcache`) |
65
- | `pnpm run lint:fix` | ESLint with `--fix` |
66
- | `pnpm run format` | Prettier write (respects `.prettierignore`) |
67
- | `pnpm run format:check` | Prettier check only |
68
- | `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) |
69
77
 
70
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`.
71
79
 
@@ -73,6 +81,7 @@ pnpm install
73
81
 
74
82
  ### Tooling in this repo
75
83
 
84
+ - **tsup** — `tsup.config.ts`; dual CJS/ESM build for the npm entry
76
85
  - **ESLint** — `eslint.config.mjs` (flat config), TypeScript type-aware rules via `typescript-eslint`, conflicts with Prettier disabled via `eslint-config-prettier`
77
86
  - **Prettier** — `.prettierrc.json`, `.prettierignore`
78
87
  - **Editor defaults** — `.editorconfig`
@@ -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
- export * from './interfaces/general/IConfig';
2
- export * from './interfaces/general/IPaginatedResponse';
3
- export * from './interfaces/general/IServerInit';
4
- export * from './interfaces/general/IApiResponse';
5
- export * from './enums/errors';
6
- export { default as BaseError } from './errors/BaseError';
7
- export { default as BusinessError } from './errors/BusinessError';
8
- export { default as ForbiddenError } from './errors/ForbiddenError';
9
- export { default as NotFoundError } from './errors/NotFoundError';
10
- export { default as ServerError } from './errors/ServerError';
11
- export { default as UnauthorizedError } from './errors/UnauthorizedError';
12
- //# sourceMappingURL=index.d.ts.map
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,38 +1,91 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
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
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
29
+ return obj;
30
+ }
15
31
  };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
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
+ }
18
41
  };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.UnauthorizedError = exports.ServerError = exports.NotFoundError = exports.ForbiddenError = exports.BusinessError = exports.BaseError = void 0;
21
- __exportStar(require("./interfaces/general/IConfig"), exports);
22
- __exportStar(require("./interfaces/general/IPaginatedResponse"), exports);
23
- __exportStar(require("./interfaces/general/IServerInit"), exports);
24
- __exportStar(require("./interfaces/general/IApiResponse"), exports);
25
- __exportStar(require("./enums/errors"), exports);
26
- var BaseError_1 = require("./errors/BaseError");
27
- Object.defineProperty(exports, "BaseError", { enumerable: true, get: function () { return __importDefault(BaseError_1).default; } });
28
- var BusinessError_1 = require("./errors/BusinessError");
29
- Object.defineProperty(exports, "BusinessError", { enumerable: true, get: function () { return __importDefault(BusinessError_1).default; } });
30
- var ForbiddenError_1 = require("./errors/ForbiddenError");
31
- Object.defineProperty(exports, "ForbiddenError", { enumerable: true, get: function () { return __importDefault(ForbiddenError_1).default; } });
32
- var NotFoundError_1 = require("./errors/NotFoundError");
33
- Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return __importDefault(NotFoundError_1).default; } });
34
- var ServerError_1 = require("./errors/ServerError");
35
- Object.defineProperty(exports, "ServerError", { enumerable: true, get: function () { return __importDefault(ServerError_1).default; } });
36
- var UnauthorizedError_1 = require("./errors/UnauthorizedError");
37
- Object.defineProperty(exports, "UnauthorizedError", { enumerable: true, get: function () { return __importDefault(UnauthorizedError_1).default; } });
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
38
91
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAMA,+DAA6C;AAC7C,0EAAwD;AACxD,mEAAiD;AACjD,oEAAkD;AAGlD,iDAA+B;AAG/B,gDAA0D;AAAjD,uHAAA,OAAO,OAAa;AAC7B,wDAAkE;AAAzD,+HAAA,OAAO,OAAiB;AACjC,0DAAoE;AAA3D,iIAAA,OAAO,OAAkB;AAClC,wDAAkE;AAAzD,+HAAA,OAAO,OAAiB;AACjC,oDAA8D;AAArD,2HAAA,OAAO,OAAe;AAC/B,gEAA0E;AAAjE,uIAAA,OAAO,OAAqB"}
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":";;;AAAO,IAAK,MAAA,qBAAAA,OAAAA,KAAL;AACL,EAAAA,QAAA,iBAAA,CAAA,GAAkB,eAAA;AAClB,EAAAA,QAAA,gBAAA,CAAA,GAAiB,eAAA;AACjB,EAAAA,QAAA,iBAAA,CAAA,GAAkB,gBAAA;AAClB,EAAAA,QAAA,cAAA,CAAA,GAAe,aAAA;AACf,EAAAA,QAAA,oBAAA,CAAA,GAAqB,mBAAA;AACrB,EAAAA,QAAA,mBAAA,CAAA,GAAoB,iBAAA;AACpB,EAAAA,QAAA,4BAAA,CAAA,GAA6B,0BAAA;AAC7B,EAAAA,QAAA,yBAAA,CAAA,GAA0B,sBAAA;AAC1B,EAAAA,QAAA,uBAAA,CAAA,GAAwB,qBAAA;AACxB,EAAAA,QAAA,2BAAA,CAAA,GAA4B,yBAAA;AAC5B,EAAAA,QAAA,uBAAA,CAAA,GAAwB,qBAAA;AACxB,EAAAA,QAAA,mBAAA,CAAA,GAAoB,iBAAA;AACpB,EAAAA,QAAA,2BAAA,CAAA,GAA4B,yBAAA;AAC5B,EAAAA,QAAA,yBAAA,CAAA,GAA0B,sBAAA;AAdhB,EAAA,OAAAA,OAAAA;AAAA,CAAA,EAAA,MAAA,IAAA,EAAA;;;ACAL,IAAM,SAAA,GAAN,cAAwB,KAAA,CAAM;AAAA,EAE5B,aAAA,GAAsD;AAC3D,IAAA,MAAM,GAAA,GAA4C,EAAE,KAAA,EAAO,IAAA,CAAK,OAAA,EAAQ;AACxE,IAAA,IAAI,KAAK,OAAA,EAAS;AAChB,MAAA,GAAA,CAAI,UAAU,IAAA,CAAK,OAAA;AAAA,IACrB;AACA,IAAA,OAAO,GAAA;AAAA,EACT;AACF;;;ACNO,IAAM,aAAA,GAAN,MAAM,cAAA,SAAsB,SAAA,CAAU;AAAA,EAEpC,WAAA,CAAY,SAAiB,OAAA,EAAmC;AACrE,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAA,eAAA;AACL,IAAA,IAAA,CAAK,OAAA,GAAU,WAAW,EAAC;AAC3B,IAAA,MAAA,CAAO,cAAA,CAAe,IAAA,EAAM,cAAA,CAAc,SAAS,CAAA;AAAA,EACrD;AACF;;;ACRO,IAAM,cAAA,GAAN,MAAM,eAAA,SAAuB,SAAA,CAAU;AAAA,EAErC,WAAA,CAAY,SAAiB,OAAA,EAAmC;AACrE,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAA,gBAAA;AACL,IAAA,IAAA,CAAK,OAAA,GAAU,WAAW,EAAC;AAC3B,IAAA,MAAA,CAAO,cAAA,CAAe,IAAA,EAAM,eAAA,CAAe,SAAS,CAAA;AAAA,EACtD;AACF;;;ACRO,IAAM,aAAA,GAAN,MAAM,cAAA,SAAsB,SAAA,CAAU;AAAA,EAEpC,WAAA,CAAY,SAAiB,OAAA,EAAmC;AACrE,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAA,eAAA;AACL,IAAA,IAAA,CAAK,OAAA,GAAU,WAAW,EAAC;AAC3B,IAAA,MAAA,CAAO,cAAA,CAAe,IAAA,EAAM,cAAA,CAAc,SAAS,CAAA;AAAA,EACrD;AACF;;;ACRO,IAAM,WAAA,GAAN,MAAM,YAAA,SAAoB,SAAA,CAAU;AAAA,EAElC,WAAA,CAAY,SAAiB,OAAA,EAAmC;AACrE,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAA,aAAA;AACL,IAAA,IAAA,CAAK,OAAA,GAAU,WAAW,EAAC;AAC3B,IAAA,MAAA,CAAO,cAAA,CAAe,IAAA,EAAM,YAAA,CAAY,SAAS,CAAA;AAAA,EACnD;AACF;;;ACRO,IAAM,iBAAA,GAAN,MAAM,kBAAA,SAA0B,SAAA,CAAU;AAAA,EAExC,WAAA,CAAY,SAAiB,OAAA,EAAmC;AACrE,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAA,mBAAA;AACL,IAAA,IAAA,CAAK,OAAA,GAAU,WAAW,EAAC;AAC3B,IAAA,MAAA,CAAO,cAAA,CAAe,IAAA,EAAM,kBAAA,CAAkB,SAAS,CAAA;AAAA,EACzD;AACF","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,9 +1,18 @@
1
1
  {
2
2
  "name": "@ipetsadmin/contracts",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Shared types, enums, and interfaces for Truffa projects",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.js",
13
+ "default": "./dist/index.mjs"
14
+ }
15
+ },
7
16
  "files": [
8
17
  "dist",
9
18
  "README.md",
@@ -11,10 +20,11 @@
11
20
  "CHANGELOG.md"
12
21
  ],
13
22
  "lint-staged": {
14
- "*.{ts,tsx}": [
23
+ "src/**/*.{ts,tsx}": [
15
24
  "eslint --fix --max-warnings 0",
16
25
  "prettier --write"
17
26
  ],
27
+ "tsup.config.ts": "prettier --write",
18
28
  "*.{json,md}": "prettier --write"
19
29
  },
20
30
  "engines": {
@@ -36,7 +46,7 @@
36
46
  "husky": "^9.1.7",
37
47
  "lint-staged": "^16.4.0",
38
48
  "prettier": "^3.8.1",
39
- "tsc-alias": "^1.8.16",
49
+ "tsup": "^8.5.1",
40
50
  "typescript": "^5.9.3",
41
51
  "typescript-eslint": "^8.58.0"
42
52
  },
@@ -49,7 +59,7 @@
49
59
  "access": "public"
50
60
  },
51
61
  "scripts": {
52
- "build": "tsc && tsc-alias",
62
+ "build": "tsup",
53
63
  "clean": "rm -rf dist",
54
64
  "typecheck": "tsc --noEmit",
55
65
  "lint": "eslint . --cache --cache-location .eslintcache",
@@ -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"}
@@ -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
@@ -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,8 +0,0 @@
1
- export default class BaseError extends Error {
2
- details?: Record<string, unknown>;
3
- toErrorRecord(): {
4
- error: string;
5
- details?: unknown;
6
- };
7
- }
8
- //# sourceMappingURL=BaseError.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BaseError.d.ts","sourceRoot":"","sources":["../../src/errors/BaseError.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,KAAK;IACnC,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"}
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class BaseError extends Error {
4
- toErrorRecord() {
5
- const obj = { error: this.message };
6
- if (this.details) {
7
- obj.details = this.details;
8
- }
9
- return obj;
10
- }
11
- }
12
- exports.default = BaseError;
13
- //# sourceMappingURL=BaseError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BaseError.js","sourceRoot":"","sources":["../../src/errors/BaseError.ts"],"names":[],"mappings":";;AAAA,MAAqB,SAAU,SAAQ,KAAK;IAEnC,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,4BASC"}
@@ -1,6 +0,0 @@
1
- import BaseError from '../errors/BaseError';
2
- export default class BusinessError extends BaseError {
3
- details?: Record<string, unknown>;
4
- constructor(message: string, details?: Record<string, unknown>);
5
- }
6
- //# sourceMappingURL=BusinessError.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BusinessError.d.ts","sourceRoot":"","sources":["../../src/errors/BusinessError.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAG3C,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,SAAS;IAC3C,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,17 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const BaseError_1 = __importDefault(require("../errors/BaseError"));
7
- const errors_1 = require("../enums/errors");
8
- class BusinessError extends BaseError_1.default {
9
- constructor(message, details) {
10
- super(message);
11
- this.name = errors_1.Errors.BUSINESS_ERROR;
12
- this.details = details || {};
13
- Object.setPrototypeOf(this, BusinessError.prototype);
14
- }
15
- }
16
- exports.default = BusinessError;
17
- //# sourceMappingURL=BusinessError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BusinessError.js","sourceRoot":"","sources":["../../src/errors/BusinessError.ts"],"names":[],"mappings":";;;;;AAAA,mEAA2C;AAC3C,2CAAwC;AAExC,MAAqB,aAAc,SAAQ,mBAAS;IAElD,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,gCAQC"}
@@ -1,6 +0,0 @@
1
- import BaseError from './BaseError';
2
- export default class ForbiddenError extends BaseError {
3
- details?: Record<string, unknown>;
4
- constructor(message: string, details?: Record<string, unknown>);
5
- }
6
- //# sourceMappingURL=ForbiddenError.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ForbiddenError.d.ts","sourceRoot":"","sources":["../../src/errors/ForbiddenError.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AAGpC,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,SAAS;IAC5C,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,17 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const BaseError_1 = __importDefault(require("./BaseError"));
7
- const errors_1 = require("../enums/errors");
8
- class ForbiddenError extends BaseError_1.default {
9
- constructor(message, details) {
10
- super(message);
11
- this.name = errors_1.Errors.FORBIDDEN_ERROR;
12
- this.details = details || {};
13
- Object.setPrototypeOf(this, ForbiddenError.prototype);
14
- }
15
- }
16
- exports.default = ForbiddenError;
17
- //# sourceMappingURL=ForbiddenError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ForbiddenError.js","sourceRoot":"","sources":["../../src/errors/ForbiddenError.ts"],"names":[],"mappings":";;;;;AAAA,4DAAoC;AACpC,4CAAyC;AAEzC,MAAqB,cAAe,SAAQ,mBAAS;IAEnD,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,iCAQC"}
@@ -1,6 +0,0 @@
1
- import BaseError from './BaseError';
2
- export default class NotFoundError extends BaseError {
3
- details?: Record<string, unknown>;
4
- constructor(message: string, details?: Record<string, unknown>);
5
- }
6
- //# sourceMappingURL=NotFoundError.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotFoundError.d.ts","sourceRoot":"","sources":["../../src/errors/NotFoundError.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AAGpC,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,SAAS;IAC3C,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,17 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const BaseError_1 = __importDefault(require("./BaseError"));
7
- const errors_1 = require("../enums/errors");
8
- class NotFoundError extends BaseError_1.default {
9
- constructor(message, details) {
10
- super(message);
11
- this.name = errors_1.Errors.NOT_FOUND_ERROR;
12
- this.details = details || {};
13
- Object.setPrototypeOf(this, NotFoundError.prototype);
14
- }
15
- }
16
- exports.default = NotFoundError;
17
- //# sourceMappingURL=NotFoundError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotFoundError.js","sourceRoot":"","sources":["../../src/errors/NotFoundError.ts"],"names":[],"mappings":";;;;;AAAA,4DAAoC;AACpC,4CAAyC;AAEzC,MAAqB,aAAc,SAAQ,mBAAS;IAElD,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,gCAQC"}
@@ -1,6 +0,0 @@
1
- import BaseError from './BaseError';
2
- export default class ServerError extends BaseError {
3
- details?: Record<string, unknown>;
4
- constructor(message: string, details?: Record<string, unknown>);
5
- }
6
- //# sourceMappingURL=ServerError.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ServerError.d.ts","sourceRoot":"","sources":["../../src/errors/ServerError.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AAGpC,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,SAAS;IACzC,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,17 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const BaseError_1 = __importDefault(require("./BaseError"));
7
- const errors_1 = require("../enums/errors");
8
- class ServerError extends BaseError_1.default {
9
- constructor(message, details) {
10
- super(message);
11
- this.name = errors_1.Errors.SERVER_ERROR;
12
- this.details = details || {};
13
- Object.setPrototypeOf(this, ServerError.prototype);
14
- }
15
- }
16
- exports.default = ServerError;
17
- //# sourceMappingURL=ServerError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ServerError.js","sourceRoot":"","sources":["../../src/errors/ServerError.ts"],"names":[],"mappings":";;;;;AAAA,4DAAoC;AACpC,4CAAyC;AAEzC,MAAqB,WAAY,SAAQ,mBAAS;IAEhD,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,8BAQC"}
@@ -1,6 +0,0 @@
1
- import BaseError from './BaseError';
2
- export default class UnauthorizedError extends BaseError {
3
- details?: Record<string, unknown>;
4
- constructor(message: string, details?: Record<string, unknown>);
5
- }
6
- //# sourceMappingURL=UnauthorizedError.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UnauthorizedError.d.ts","sourceRoot":"","sources":["../../src/errors/UnauthorizedError.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AAGpC,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,SAAS;IAC/C,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,17 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const BaseError_1 = __importDefault(require("./BaseError"));
7
- const errors_1 = require("../enums/errors");
8
- class UnauthorizedError extends BaseError_1.default {
9
- constructor(message, details) {
10
- super(message);
11
- this.name = errors_1.Errors.UNAUTHORIZED_ERROR;
12
- this.details = details || {};
13
- Object.setPrototypeOf(this, UnauthorizedError.prototype);
14
- }
15
- }
16
- exports.default = UnauthorizedError;
17
- //# sourceMappingURL=UnauthorizedError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UnauthorizedError.js","sourceRoot":"","sources":["../../src/errors/UnauthorizedError.ts"],"names":[],"mappings":";;;;;AAAA,4DAAoC;AACpC,4CAAyC;AAEzC,MAAqB,iBAAkB,SAAQ,mBAAS;IAEtD,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,oCAQC"}
@@ -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,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,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,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=IApiResponse.js.map
@@ -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,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=IConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IConfig.js","sourceRoot":"","sources":["../../../src/interfaces/general/IConfig.ts"],"names":[],"mappings":""}
@@ -1,6 +0,0 @@
1
- import type { IPagination } from '../../interfaces/general/IPagination';
2
- export interface IPaginatedResponse<T> {
3
- data: T[];
4
- pagination: IPagination;
5
- }
6
- //# sourceMappingURL=IPaginatedResponse.d.ts.map
@@ -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,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=IPaginatedResponse.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IPaginatedResponse.js","sourceRoot":"","sources":["../../../src/interfaces/general/IPaginatedResponse.ts"],"names":[],"mappings":""}
@@ -1,7 +0,0 @@
1
- export interface IPagination {
2
- page: number;
3
- limit: number;
4
- total: number;
5
- totalPages: number;
6
- }
7
- //# sourceMappingURL=IPagination.d.ts.map
@@ -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,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=IPagination.js.map
@@ -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,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=IServerInit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IServerInit.js","sourceRoot":"","sources":["../../../src/interfaces/general/IServerInit.ts"],"names":[],"mappings":""}