@ipetsadmin/contracts 1.0.3 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -19,6 +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.1.2] - 2026-04-05
23
+
24
+ ### Added
25
+
26
+ - **`RepositoryOperationOptions`** (`src/types/repository/RepositoryOperationOptions.ts`): opaque `transactionContext?: unknown` for multi-step atomic work across repositories.
27
+
28
+ ### Changed
29
+
30
+ - **`IUserRepository`**, **`IRefreshTokenRepository`**, **`IOAuthStateRepository`**: mutating and read methods accept optional `options?: RepositoryOperationOptions`.
31
+ - **`IAuthService`**, **`IJwtTokensService`**: methods accept optional `options?: RepositoryOperationOptions` so handlers can forward a shared session/transaction.
32
+
33
+ ## [1.1.1] - 2026-04-04
34
+
35
+ ### Added
36
+
37
+ - **Service ports** (`src/interfaces/services/`): `IAuthService`, `IJwtTokensService`, `IAuth0GoogleOAuthService` — describe application service contracts implemented by `@ipetsadmin/api-main`.
38
+ - **Auth0 / OAuth types** (`src/types/auth/`): `Auth0UserProfile`, `Auth0AuthorizationParams`, `OAuthAccessTokenResult`.
39
+
40
+ ## [1.1.0] - 2026-04-04
41
+
42
+ ### Added
43
+
44
+ - **Authentication domain types** under `src/types/auth/`: `User`, `TokenPair`, `RegisterRequest`, `LoginRequest`, `RefreshRequest`, `LogoutRequest`, `AuthUserResponse`, `AuthSessionResponse`, `CreateUserInput`, `OAuthGoogleStartQuery`, `OAuthGoogleStartResponse`, `OAuthGoogleCallbackRequest`.
45
+ - **Enums:** `AuthMethod`, `OAuthProvider`.
46
+ - **Repository ports** under `src/interfaces/auth/`: `IUserRepository`, `IRefreshTokenRepository` (+ `RefreshTokenRecord`), `IOAuthStateRepository` (+ `OAuthStateRecord`).
47
+ - **`IConfig` extensions** for RS256 JWT (`jwtIssuer`, `jwtAudience`, `jwtAccessExpiresInSeconds`, `jwtRefreshExpiresInDays`, `jwtPrivateKeyPem`, `jwtPublicKeyPem`), and OAuth (`oauthAllowedRedirectUris` string). Existing optional fields retained; `jwtSecret` documented as deprecated in favor of RS256 PEMs.
48
+
49
+ ## [1.0.4] - 2026-04-02
50
+
51
+ ### Added
52
+
53
+ - **`HealthCheck` type** (`src/types/HealthCheck.ts`) — shape for `IApiResponse<HealthCheck>['data']` on health-check
54
+ endpoints (`message`, optional `status`).
55
+ - **`HealthStatus` enum** (`src/enums/health-status.ts`) — `healthy` / `unhealthy`; exported for use with `HealthCheck`
56
+ and API handlers.
57
+
22
58
  ## [1.0.3] - 2026-04-02
23
59
 
24
60
  ### Fixed
package/README.md CHANGED
@@ -34,11 +34,20 @@ pnpm add git+https://github.com/your-org/contracts.git#v1.0.0
34
34
 
35
35
  ```typescript
36
36
  import {
37
+ AuthMethod,
37
38
  Errors,
39
+ HealthCheck,
40
+ HealthStatus,
38
41
  IConfig,
39
42
  IApiResponse,
40
43
  IPaginatedResponse,
41
44
  IServerInit,
45
+ OAuthProvider,
46
+ type AuthSessionResponse,
47
+ type LoginRequest,
48
+ type RegisterRequest,
49
+ type TokenPair,
50
+ type User,
42
51
  BaseError,
43
52
  BusinessError,
44
53
  ForbiddenError,
@@ -46,8 +55,27 @@ import {
46
55
  ServerError,
47
56
  UnauthorizedError,
48
57
  } from '@ipetsadmin/contracts';
58
+
59
+ // Example: typed health-check response body
60
+ const health: IApiResponse<HealthCheck> = {
61
+ success: true,
62
+ message: 'API is running',
63
+ data: { message: 'API is running', status: HealthStatus.HEALTHY },
64
+ };
49
65
  ```
50
66
 
67
+ ### Authentication and users
68
+
69
+ The package defines **shared contracts** for email/password and OAuth (Google via Auth0 on the server), **API-issued JWTs** (access) and **opaque refresh tokens** (server-side storage only—hashes are not part of the public types):
70
+
71
+ - **Enums:** `AuthMethod` (`password` | `oauth`), `OAuthProvider` (e.g. `GOOGLE`, extensible later).
72
+ - **Entities / DTOs:** `User`, `TokenPair`, `AuthUserResponse`, `AuthSessionResponse`, `RegisterRequest`, `LoginRequest`, `RefreshRequest`, `LogoutRequest`, OAuth Google start/callback types, `CreateUserInput`.
73
+ - **Repository ports (implementations live in services):** `IUserRepository`, `IRefreshTokenRepository`, `IOAuthStateRepository` — keep domain types free of MongoDB/Passport imports so SQL or other adapters can implement the same interfaces later.
74
+ - **Service ports** (`interfaces/services/`): `IAuthService`, `IJwtTokensService`, `IAuth0GoogleOAuthService` — implemented by the API’s concrete classes for DI, testing, and clear boundaries.
75
+ - **Auth0/OIDC helpers:** `Auth0UserProfile`, `Auth0AuthorizationParams`, `OAuthAccessTokenResult`.
76
+
77
+ `IConfig` includes optional fields for **RS256** JWT (`jwtIssuer`, `jwtAudience`, PEM keys, TTLs), **MongoDB**, **Auth0**, and **`oauthAllowedRedirectUris`** (comma-separated allowlist for OAuth redirect URIs).
78
+
51
79
  Path aliases (`@/…`) apply only inside this package’s source; consumers import from `@ipetsadmin/contracts` as above.
52
80
 
53
81
  The published package is **dual CJS + ESM** (`exports.require` → `dist/index.js`, `exports.import` → `dist/index.mjs`).
@@ -98,9 +126,12 @@ pnpm install
98
126
 
99
127
  Source lives under `src/`:
100
128
 
101
- - `enums/` — shared enums (e.g. `Errors`)
129
+ - `enums/` — shared enums (e.g. `Errors`, `HealthStatus`, `AuthMethod`, `OAuthProvider`)
102
130
  - `errors/` — error classes (`BaseError`, domain errors, …)
103
131
  - `interfaces/general/` — cross-cutting interfaces (`IConfig`, pagination, API responses, server bootstrap types, …)
132
+ - `interfaces/auth/` — repository ports (`IUserRepository`, `IRefreshTokenRepository`, `IOAuthStateRepository`)
133
+ - `interfaces/services/` — service ports (`IAuthService`, `IJwtTokensService`, `IAuth0GoogleOAuthService`)
134
+ - `types/` — shared type aliases (`HealthCheck`, auth DTOs under `types/auth/`, …)
104
135
 
105
136
  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`.
106
137
 
package/dist/index.d.mts CHANGED
@@ -1,6 +1,116 @@
1
1
  import { Application } from 'express';
2
2
  import { Logger } from 'winston';
3
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
+ declare enum AuthMethod {
15
+ PASSWORD = "password",
16
+ OAUTH = "oauth"
17
+ }
18
+
19
+ declare enum OAuthProvider {
20
+ GOOGLE = "google"
21
+ }
22
+
23
+ type User = {
24
+ readonly id: string;
25
+ readonly email: string;
26
+ readonly emailVerified: boolean;
27
+ readonly authMethod: AuthMethod;
28
+ readonly oauth?: {
29
+ readonly provider: OAuthProvider;
30
+ readonly providerSubject: string;
31
+ };
32
+ readonly createdAt: string;
33
+ readonly updatedAt: string;
34
+ };
35
+
36
+ type TokenPair = {
37
+ readonly accessToken: string;
38
+ readonly refreshToken: string;
39
+ readonly expiresIn: number;
40
+ readonly tokenType: 'Bearer';
41
+ };
42
+
43
+ type RegisterRequest = {
44
+ readonly email: string;
45
+ readonly password: string;
46
+ };
47
+
48
+ type LoginRequest = {
49
+ readonly email: string;
50
+ readonly password: string;
51
+ };
52
+
53
+ type RefreshRequest = {
54
+ readonly refreshToken: string;
55
+ };
56
+
57
+ type LogoutRequest = {
58
+ readonly refreshToken: string;
59
+ };
60
+
61
+ type AuthUserResponse = Pick<User, 'id' | 'email' | 'emailVerified' | 'authMethod' | 'oauth'>;
62
+
63
+ type AuthSessionResponse = TokenPair & {
64
+ readonly user: AuthUserResponse;
65
+ };
66
+
67
+ type OAuthGoogleStartQuery = {
68
+ readonly redirectUri: string;
69
+ };
70
+
71
+ type OAuthGoogleStartResponse = {
72
+ readonly authorizationUrl: string;
73
+ readonly state: string;
74
+ };
75
+
76
+ type OAuthGoogleCallbackRequest = {
77
+ readonly code: string;
78
+ readonly state: string;
79
+ readonly redirectUri: string;
80
+ };
81
+
82
+ type CreateUserInput = {
83
+ readonly email: string;
84
+ readonly emailVerified: boolean;
85
+ readonly authMethod: AuthMethod;
86
+ readonly passwordHash?: string;
87
+ readonly oauth?: {
88
+ readonly provider: OAuthProvider;
89
+ readonly providerSubject: string;
90
+ };
91
+ };
92
+
93
+ type Auth0UserProfile = {
94
+ readonly sub: string;
95
+ readonly email?: string;
96
+ readonly email_verified?: boolean;
97
+ };
98
+
99
+ type Auth0AuthorizationParams = {
100
+ readonly state: string;
101
+ readonly nonce: string;
102
+ readonly redirectUri: string;
103
+ readonly connection?: string;
104
+ };
105
+
106
+ type OAuthAccessTokenResult = {
107
+ readonly accessToken: string;
108
+ };
109
+
110
+ type RepositoryOperationOptions = {
111
+ readonly transactionContext?: unknown;
112
+ };
113
+
4
114
  interface IConfig {
5
115
  port: number;
6
116
  cors: {
@@ -25,6 +135,13 @@ interface IConfig {
25
135
  auth0ClientId?: string;
26
136
  auth0ClientSecret?: string;
27
137
  auth0Audience?: string;
138
+ jwtIssuer?: string;
139
+ jwtAudience?: string;
140
+ jwtAccessExpiresInSeconds?: number;
141
+ jwtRefreshExpiresInDays?: number;
142
+ jwtPrivateKeyPem?: string;
143
+ jwtPublicKeyPem?: string;
144
+ oauthAllowedRedirectUris?: string;
28
145
  }
29
146
 
30
147
  interface IPagination {
@@ -53,6 +170,61 @@ interface IApiResponse<T = unknown> {
53
170
  message?: string;
54
171
  }
55
172
 
173
+ interface IUserRepository {
174
+ create(input: CreateUserInput, options?: RepositoryOperationOptions): Promise<User>;
175
+ findById(id: string, options?: RepositoryOperationOptions): Promise<User | null>;
176
+ findByEmail(email: string, options?: RepositoryOperationOptions): Promise<User | null>;
177
+ findByOAuth(provider: OAuthProvider, providerSubject: string, options?: RepositoryOperationOptions): Promise<User | null>;
178
+ update(id: string, patch: Partial<Pick<User, 'email' | 'emailVerified' | 'authMethod' | 'oauth'>> & {
179
+ passwordHash?: string | null;
180
+ }, options?: RepositoryOperationOptions): Promise<void>;
181
+ }
182
+
183
+ type RefreshTokenRecord = {
184
+ readonly id: string;
185
+ readonly userId: string;
186
+ readonly expiresAt: string;
187
+ readonly revokedAt?: string;
188
+ };
189
+ interface IRefreshTokenRepository {
190
+ create(userId: string, tokenHash: string, expiresAt: Date, options?: RepositoryOperationOptions): Promise<RefreshTokenRecord>;
191
+ findValidByHash(tokenHash: string, options?: RepositoryOperationOptions): Promise<RefreshTokenRecord | null>;
192
+ revokeById(id: string, options?: RepositoryOperationOptions): Promise<void>;
193
+ revokeAllForUser(userId: string, options?: RepositoryOperationOptions): Promise<void>;
194
+ }
195
+
196
+ type OAuthStateRecord = {
197
+ readonly state: string;
198
+ readonly redirectUri: string;
199
+ readonly nonce: string;
200
+ readonly expiresAt: string;
201
+ };
202
+ interface IOAuthStateRepository {
203
+ create(state: string, nonce: string, redirectUri: string, expiresAt: Date, options?: RepositoryOperationOptions): Promise<void>;
204
+ consume(state: string, options?: RepositoryOperationOptions): Promise<OAuthStateRecord | null>;
205
+ }
206
+
207
+ interface IAuthService {
208
+ register(email: string, password: string, options?: RepositoryOperationOptions): Promise<AuthSessionResponse>;
209
+ loginWithUser(user: User, options?: RepositoryOperationOptions): Promise<AuthSessionResponse>;
210
+ startGoogleOAuth(redirectUri: string): Promise<OAuthGoogleStartResponse>;
211
+ completeGoogleOAuth(code: string, state: string, redirectUri: string, options?: RepositoryOperationOptions): Promise<AuthSessionResponse>;
212
+ refreshSession(refreshToken: string, options?: RepositoryOperationOptions): Promise<AuthSessionResponse>;
213
+ logout(refreshToken: string, options?: RepositoryOperationOptions): Promise<void>;
214
+ }
215
+
216
+ interface IJwtTokensService {
217
+ issueTokenPair(userId: string, email: string, options?: RepositoryOperationOptions): Promise<TokenPair>;
218
+ consumeRefreshTokenForRotation(refreshToken: string, options?: RepositoryOperationOptions): Promise<string>;
219
+ revokeRefreshToken(refreshToken: string, options?: RepositoryOperationOptions): Promise<void>;
220
+ }
221
+
222
+ interface IAuth0GoogleOAuthService {
223
+ buildAuthorizationUrl(params: Auth0AuthorizationParams): string;
224
+ exchangeCodeForTokens(code: string, redirectUri: string): Promise<OAuthAccessTokenResult>;
225
+ getUserProfile(accessToken: string): Promise<Auth0UserProfile>;
226
+ }
227
+
56
228
  declare enum Errors {
57
229
  NOT_FOUND_ERROR = "NotFoundError",
58
230
  BUSINESS_ERROR = "BusinessError",
@@ -103,4 +275,4 @@ declare class UnauthorizedError extends BaseError {
103
275
  constructor(message: string, details?: Record<string, unknown>);
104
276
  }
105
277
 
106
- export { BaseError, BusinessError, Errors, ForbiddenError, type IApiResponse, type IConfig, type IPaginatedResponse, type IServerInit, NotFoundError, ServerError, UnauthorizedError };
278
+ export { type Auth0AuthorizationParams, type Auth0UserProfile, AuthMethod, type AuthSessionResponse, type AuthUserResponse, BaseError, BusinessError, type CreateUserInput, Errors, ForbiddenError, type HealthCheck, HealthStatus, type IApiResponse, type IAuth0GoogleOAuthService, type IAuthService, type IConfig, type IJwtTokensService, type IOAuthStateRepository, type IPaginatedResponse, type IRefreshTokenRepository, type IServerInit, type IUserRepository, type LoginRequest, type LogoutRequest, NotFoundError, type OAuthAccessTokenResult, type OAuthGoogleCallbackRequest, type OAuthGoogleStartQuery, type OAuthGoogleStartResponse, OAuthProvider, type OAuthStateRecord, type RefreshRequest, type RefreshTokenRecord, type RegisterRequest, type RepositoryOperationOptions, ServerError, type TokenPair, UnauthorizedError, type User };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,116 @@
1
1
  import { Application } from 'express';
2
2
  import { Logger } from 'winston';
3
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
+ declare enum AuthMethod {
15
+ PASSWORD = "password",
16
+ OAUTH = "oauth"
17
+ }
18
+
19
+ declare enum OAuthProvider {
20
+ GOOGLE = "google"
21
+ }
22
+
23
+ type User = {
24
+ readonly id: string;
25
+ readonly email: string;
26
+ readonly emailVerified: boolean;
27
+ readonly authMethod: AuthMethod;
28
+ readonly oauth?: {
29
+ readonly provider: OAuthProvider;
30
+ readonly providerSubject: string;
31
+ };
32
+ readonly createdAt: string;
33
+ readonly updatedAt: string;
34
+ };
35
+
36
+ type TokenPair = {
37
+ readonly accessToken: string;
38
+ readonly refreshToken: string;
39
+ readonly expiresIn: number;
40
+ readonly tokenType: 'Bearer';
41
+ };
42
+
43
+ type RegisterRequest = {
44
+ readonly email: string;
45
+ readonly password: string;
46
+ };
47
+
48
+ type LoginRequest = {
49
+ readonly email: string;
50
+ readonly password: string;
51
+ };
52
+
53
+ type RefreshRequest = {
54
+ readonly refreshToken: string;
55
+ };
56
+
57
+ type LogoutRequest = {
58
+ readonly refreshToken: string;
59
+ };
60
+
61
+ type AuthUserResponse = Pick<User, 'id' | 'email' | 'emailVerified' | 'authMethod' | 'oauth'>;
62
+
63
+ type AuthSessionResponse = TokenPair & {
64
+ readonly user: AuthUserResponse;
65
+ };
66
+
67
+ type OAuthGoogleStartQuery = {
68
+ readonly redirectUri: string;
69
+ };
70
+
71
+ type OAuthGoogleStartResponse = {
72
+ readonly authorizationUrl: string;
73
+ readonly state: string;
74
+ };
75
+
76
+ type OAuthGoogleCallbackRequest = {
77
+ readonly code: string;
78
+ readonly state: string;
79
+ readonly redirectUri: string;
80
+ };
81
+
82
+ type CreateUserInput = {
83
+ readonly email: string;
84
+ readonly emailVerified: boolean;
85
+ readonly authMethod: AuthMethod;
86
+ readonly passwordHash?: string;
87
+ readonly oauth?: {
88
+ readonly provider: OAuthProvider;
89
+ readonly providerSubject: string;
90
+ };
91
+ };
92
+
93
+ type Auth0UserProfile = {
94
+ readonly sub: string;
95
+ readonly email?: string;
96
+ readonly email_verified?: boolean;
97
+ };
98
+
99
+ type Auth0AuthorizationParams = {
100
+ readonly state: string;
101
+ readonly nonce: string;
102
+ readonly redirectUri: string;
103
+ readonly connection?: string;
104
+ };
105
+
106
+ type OAuthAccessTokenResult = {
107
+ readonly accessToken: string;
108
+ };
109
+
110
+ type RepositoryOperationOptions = {
111
+ readonly transactionContext?: unknown;
112
+ };
113
+
4
114
  interface IConfig {
5
115
  port: number;
6
116
  cors: {
@@ -25,6 +135,13 @@ interface IConfig {
25
135
  auth0ClientId?: string;
26
136
  auth0ClientSecret?: string;
27
137
  auth0Audience?: string;
138
+ jwtIssuer?: string;
139
+ jwtAudience?: string;
140
+ jwtAccessExpiresInSeconds?: number;
141
+ jwtRefreshExpiresInDays?: number;
142
+ jwtPrivateKeyPem?: string;
143
+ jwtPublicKeyPem?: string;
144
+ oauthAllowedRedirectUris?: string;
28
145
  }
29
146
 
30
147
  interface IPagination {
@@ -53,6 +170,61 @@ interface IApiResponse<T = unknown> {
53
170
  message?: string;
54
171
  }
55
172
 
173
+ interface IUserRepository {
174
+ create(input: CreateUserInput, options?: RepositoryOperationOptions): Promise<User>;
175
+ findById(id: string, options?: RepositoryOperationOptions): Promise<User | null>;
176
+ findByEmail(email: string, options?: RepositoryOperationOptions): Promise<User | null>;
177
+ findByOAuth(provider: OAuthProvider, providerSubject: string, options?: RepositoryOperationOptions): Promise<User | null>;
178
+ update(id: string, patch: Partial<Pick<User, 'email' | 'emailVerified' | 'authMethod' | 'oauth'>> & {
179
+ passwordHash?: string | null;
180
+ }, options?: RepositoryOperationOptions): Promise<void>;
181
+ }
182
+
183
+ type RefreshTokenRecord = {
184
+ readonly id: string;
185
+ readonly userId: string;
186
+ readonly expiresAt: string;
187
+ readonly revokedAt?: string;
188
+ };
189
+ interface IRefreshTokenRepository {
190
+ create(userId: string, tokenHash: string, expiresAt: Date, options?: RepositoryOperationOptions): Promise<RefreshTokenRecord>;
191
+ findValidByHash(tokenHash: string, options?: RepositoryOperationOptions): Promise<RefreshTokenRecord | null>;
192
+ revokeById(id: string, options?: RepositoryOperationOptions): Promise<void>;
193
+ revokeAllForUser(userId: string, options?: RepositoryOperationOptions): Promise<void>;
194
+ }
195
+
196
+ type OAuthStateRecord = {
197
+ readonly state: string;
198
+ readonly redirectUri: string;
199
+ readonly nonce: string;
200
+ readonly expiresAt: string;
201
+ };
202
+ interface IOAuthStateRepository {
203
+ create(state: string, nonce: string, redirectUri: string, expiresAt: Date, options?: RepositoryOperationOptions): Promise<void>;
204
+ consume(state: string, options?: RepositoryOperationOptions): Promise<OAuthStateRecord | null>;
205
+ }
206
+
207
+ interface IAuthService {
208
+ register(email: string, password: string, options?: RepositoryOperationOptions): Promise<AuthSessionResponse>;
209
+ loginWithUser(user: User, options?: RepositoryOperationOptions): Promise<AuthSessionResponse>;
210
+ startGoogleOAuth(redirectUri: string): Promise<OAuthGoogleStartResponse>;
211
+ completeGoogleOAuth(code: string, state: string, redirectUri: string, options?: RepositoryOperationOptions): Promise<AuthSessionResponse>;
212
+ refreshSession(refreshToken: string, options?: RepositoryOperationOptions): Promise<AuthSessionResponse>;
213
+ logout(refreshToken: string, options?: RepositoryOperationOptions): Promise<void>;
214
+ }
215
+
216
+ interface IJwtTokensService {
217
+ issueTokenPair(userId: string, email: string, options?: RepositoryOperationOptions): Promise<TokenPair>;
218
+ consumeRefreshTokenForRotation(refreshToken: string, options?: RepositoryOperationOptions): Promise<string>;
219
+ revokeRefreshToken(refreshToken: string, options?: RepositoryOperationOptions): Promise<void>;
220
+ }
221
+
222
+ interface IAuth0GoogleOAuthService {
223
+ buildAuthorizationUrl(params: Auth0AuthorizationParams): string;
224
+ exchangeCodeForTokens(code: string, redirectUri: string): Promise<OAuthAccessTokenResult>;
225
+ getUserProfile(accessToken: string): Promise<Auth0UserProfile>;
226
+ }
227
+
56
228
  declare enum Errors {
57
229
  NOT_FOUND_ERROR = "NotFoundError",
58
230
  BUSINESS_ERROR = "BusinessError",
@@ -103,4 +275,4 @@ declare class UnauthorizedError extends BaseError {
103
275
  constructor(message: string, details?: Record<string, unknown>);
104
276
  }
105
277
 
106
- export { BaseError, BusinessError, Errors, ForbiddenError, type IApiResponse, type IConfig, type IPaginatedResponse, type IServerInit, NotFoundError, ServerError, UnauthorizedError };
278
+ export { type Auth0AuthorizationParams, type Auth0UserProfile, AuthMethod, type AuthSessionResponse, type AuthUserResponse, BaseError, BusinessError, type CreateUserInput, Errors, ForbiddenError, type HealthCheck, HealthStatus, type IApiResponse, type IAuth0GoogleOAuthService, type IAuthService, type IConfig, type IJwtTokensService, type IOAuthStateRepository, type IPaginatedResponse, type IRefreshTokenRepository, type IServerInit, type IUserRepository, type LoginRequest, type LogoutRequest, NotFoundError, type OAuthAccessTokenResult, type OAuthGoogleCallbackRequest, type OAuthGoogleStartQuery, type OAuthGoogleStartResponse, OAuthProvider, type OAuthStateRecord, type RefreshRequest, type RefreshTokenRecord, type RegisterRequest, type RepositoryOperationOptions, ServerError, type TokenPair, UnauthorizedError, type User };
package/dist/index.js CHANGED
@@ -19,6 +19,26 @@ var Errors = /* @__PURE__ */ ((Errors2) => {
19
19
  return Errors2;
20
20
  })(Errors || {});
21
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/enums/auth-method.ts
30
+ var AuthMethod = /* @__PURE__ */ ((AuthMethod2) => {
31
+ AuthMethod2["PASSWORD"] = "password";
32
+ AuthMethod2["OAUTH"] = "oauth";
33
+ return AuthMethod2;
34
+ })(AuthMethod || {});
35
+
36
+ // src/enums/oauth-provider.ts
37
+ var OAuthProvider = /* @__PURE__ */ ((OAuthProvider2) => {
38
+ OAuthProvider2["GOOGLE"] = "google";
39
+ return OAuthProvider2;
40
+ })(OAuthProvider || {});
41
+
22
42
  // src/errors/BaseError.ts
23
43
  var BaseError = class extends Error {
24
44
  toErrorRecord() {
@@ -80,11 +100,14 @@ var UnauthorizedError = class _UnauthorizedError extends BaseError {
80
100
  }
81
101
  };
82
102
 
103
+ exports.AuthMethod = AuthMethod;
83
104
  exports.BaseError = BaseError;
84
105
  exports.BusinessError = BusinessError;
85
106
  exports.Errors = Errors;
86
107
  exports.ForbiddenError = ForbiddenError;
108
+ exports.HealthStatus = HealthStatus;
87
109
  exports.NotFoundError = NotFoundError;
110
+ exports.OAuthProvider = OAuthProvider;
88
111
  exports.ServerError = ServerError;
89
112
  exports.UnauthorizedError = UnauthorizedError;
90
113
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +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":";;;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,KAA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AAA,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"]}
1
+ {"version":3,"sources":["../src/enums/errors.ts","../src/enums/health-status.ts","../src/enums/auth-method.ts","../src/enums/oauth-provider.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","AuthMethod","OAuthProvider"],"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,IAAK,YAAA,qBAAAC,aAAAA,KAAL;AACL,EAAAA,cAAA,SAAA,CAAA,GAAU,SAAA;AACV,EAAAA,cAAA,WAAA,CAAA,GAAY,WAAA;AAFF,EAAA,OAAAA,aAAAA;AAAA,CAAA,EAAA,YAAA,IAAA,EAAA;;;ACGL,IAAK,UAAA,qBAAAC,WAAAA,KAAL;AACL,EAAAA,YAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,YAAA,OAAA,CAAA,GAAQ,OAAA;AAFE,EAAA,OAAAA,WAAAA;AAAA,CAAA,EAAA,UAAA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,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 enum HealthStatus {\n HEALTHY = 'healthy',\n UNHEALTHY = 'unhealthy',\n}\n","/**\n * How the user primarily authenticates. Switching methods is admin-only (future).\n */\nexport enum AuthMethod {\n PASSWORD = 'password',\n OAUTH = 'oauth',\n}\n","/**\n * OAuth identity provider (Auth0 connection / social). MVP: Google only; extend for Microsoft, GitHub, etc.\n */\nexport enum OAuthProvider {\n GOOGLE = 'google',\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 CHANGED
@@ -17,6 +17,26 @@ var Errors = /* @__PURE__ */ ((Errors2) => {
17
17
  return Errors2;
18
18
  })(Errors || {});
19
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/enums/auth-method.ts
28
+ var AuthMethod = /* @__PURE__ */ ((AuthMethod2) => {
29
+ AuthMethod2["PASSWORD"] = "password";
30
+ AuthMethod2["OAUTH"] = "oauth";
31
+ return AuthMethod2;
32
+ })(AuthMethod || {});
33
+
34
+ // src/enums/oauth-provider.ts
35
+ var OAuthProvider = /* @__PURE__ */ ((OAuthProvider2) => {
36
+ OAuthProvider2["GOOGLE"] = "google";
37
+ return OAuthProvider2;
38
+ })(OAuthProvider || {});
39
+
20
40
  // src/errors/BaseError.ts
21
41
  var BaseError = class extends Error {
22
42
  toErrorRecord() {
@@ -78,6 +98,6 @@ var UnauthorizedError = class _UnauthorizedError extends BaseError {
78
98
  }
79
99
  };
80
100
 
81
- export { BaseError, BusinessError, Errors, ForbiddenError, NotFoundError, ServerError, UnauthorizedError };
101
+ export { AuthMethod, BaseError, BusinessError, Errors, ForbiddenError, HealthStatus, NotFoundError, OAuthProvider, ServerError, UnauthorizedError };
82
102
  //# sourceMappingURL=index.mjs.map
83
103
  //# sourceMappingURL=index.mjs.map
@@ -1 +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":";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,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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.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"]}
1
+ {"version":3,"sources":["../src/enums/errors.ts","../src/enums/health-status.ts","../src/enums/auth-method.ts","../src/enums/oauth-provider.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","AuthMethod","OAuthProvider"],"mappings":";AAAO,IAAK,MAAA,qBAAAA,OAAAA,KAAL;AACL,EAAAA,QAAA,iBAAA,CAAA,GAAkB,eAAA;AAClB,EAAAA,QAAA,gBAAA,CAAA,GAAiB,eA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A,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.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","/**\n * How the user primarily authenticates. Switching methods is admin-only (future).\n */\nexport enum AuthMethod {\n PASSWORD = 'password',\n OAUTH = 'oauth',\n}\n","/**\n * OAuth identity provider (Auth0 connection / social). MVP: Google only; extend for Microsoft, GitHub, etc.\n */\nexport enum OAuthProvider {\n GOOGLE = 'google',\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,6 +1,6 @@
1
1
  {
2
2
  "name": "@ipetsadmin/contracts",
3
- "version": "1.0.3",
3
+ "version": "1.1.2",
4
4
  "description": "Shared types, enums, and interfaces for Truffa projects",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",