@ipetsadmin/contracts 1.0.4 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -19,6 +19,50 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
19
19
 
20
20
  ### Security
21
21
 
22
+ ## [1.1.3] - 2026-04-05
23
+
24
+ ### Added
25
+
26
+ - **`IUser`** (`src/interfaces/entities/IUser.ts`): entity interface for persisted users (`id`, `email`, `emailVerified`, `authMethod`, optional `oauth`, timestamps).
27
+
28
+ ### Changed
29
+
30
+ - **Repository ports** live under **`src/interfaces/repositories/auth/`** (`IUserRepository`, `IRefreshTokenRepository`, `IOAuthStateRepository`) instead of `src/interfaces/auth/`. Public API is unchanged via the package barrel (`@ipetsadmin/contracts`); only deep import paths move.
31
+ - **`IUserRepository`**: return types and `create` / `find*` results use **`IUser`** instead of the former `User` type.
32
+ - **`IAuthService`**: `loginWithUser` accepts **`IUser`** (was `User`).
33
+ - **`AuthUserResponse`**: defined as `Pick<IUser, 'id' | 'email' | 'emailVerified' | 'authMethod' | 'oauth'>`.
34
+
35
+ ### Removed
36
+
37
+ - **`User`** type (`src/types/auth/User.ts`) — replaced by **`IUser`**.
38
+
39
+ ## [1.1.2] - 2026-04-05
40
+
41
+ ### Added
42
+
43
+ - **`RepositoryOperationOptions`** (`src/types/repository/RepositoryOperationOptions.ts`): opaque `transactionContext?: unknown` for multi-step atomic work across repositories.
44
+
45
+ ### Changed
46
+
47
+ - **`IUserRepository`**, **`IRefreshTokenRepository`**, **`IOAuthStateRepository`**: mutating and read methods accept optional `options?: RepositoryOperationOptions`.
48
+ - **`IAuthService`**, **`IJwtTokensService`**: methods accept optional `options?: RepositoryOperationOptions` so handlers can forward a shared session/transaction.
49
+
50
+ ## [1.1.1] - 2026-04-04
51
+
52
+ ### Added
53
+
54
+ - **Service ports** (`src/interfaces/services/`): `IAuthService`, `IJwtTokensService`, `IAuth0GoogleOAuthService` — describe application service contracts implemented by `@ipetsadmin/api-main`.
55
+ - **Auth0 / OAuth types** (`src/types/auth/`): `Auth0UserProfile`, `Auth0AuthorizationParams`, `OAuthAccessTokenResult`.
56
+
57
+ ## [1.1.0] - 2026-04-04
58
+
59
+ ### Added
60
+
61
+ - **Authentication domain types** under `src/types/auth/`: `User`, `TokenPair`, `RegisterRequest`, `LoginRequest`, `RefreshRequest`, `LogoutRequest`, `AuthUserResponse`, `AuthSessionResponse`, `CreateUserInput`, `OAuthGoogleStartQuery`, `OAuthGoogleStartResponse`, `OAuthGoogleCallbackRequest`.
62
+ - **Enums:** `AuthMethod`, `OAuthProvider`.
63
+ - **Repository ports** under `src/interfaces/auth/`: `IUserRepository`, `IRefreshTokenRepository` (+ `RefreshTokenRecord`), `IOAuthStateRepository` (+ `OAuthStateRecord`).
64
+ - **`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.
65
+
22
66
  ## [1.0.4] - 2026-04-02
23
67
 
24
68
  ### Added
package/README.md CHANGED
@@ -34,6 +34,7 @@ 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,
38
39
  HealthCheck,
39
40
  HealthStatus,
@@ -41,6 +42,12 @@ import {
41
42
  IApiResponse,
42
43
  IPaginatedResponse,
43
44
  IServerInit,
45
+ OAuthProvider,
46
+ type AuthSessionResponse,
47
+ type LoginRequest,
48
+ type RegisterRequest,
49
+ type TokenPair,
50
+ type User,
44
51
  BaseError,
45
52
  BusinessError,
46
53
  ForbiddenError,
@@ -57,6 +64,18 @@ const health: IApiResponse<HealthCheck> = {
57
64
  };
58
65
  ```
59
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
+
60
79
  Path aliases (`@/…`) apply only inside this package’s source; consumers import from `@ipetsadmin/contracts` as above.
61
80
 
62
81
  The published package is **dual CJS + ESM** (`exports.require` → `dist/index.js`, `exports.import` → `dist/index.mjs`).
@@ -107,10 +126,12 @@ pnpm install
107
126
 
108
127
  Source lives under `src/`:
109
128
 
110
- - `enums/` — shared enums (e.g. `Errors`, `HealthStatus`)
129
+ - `enums/` — shared enums (e.g. `Errors`, `HealthStatus`, `AuthMethod`, `OAuthProvider`)
111
130
  - `errors/` — error classes (`BaseError`, domain errors, …)
112
131
  - `interfaces/general/` — cross-cutting interfaces (`IConfig`, pagination, API responses, server bootstrap types, …)
113
- - `types/` — shared type aliases (e.g. `HealthCheck` for `IApiResponse` payloads)
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/`, …)
114
135
 
115
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`.
116
137
 
package/dist/index.d.mts CHANGED
@@ -11,6 +11,106 @@ type HealthCheck = {
11
11
  status?: HealthStatus;
12
12
  };
13
13
 
14
+ declare enum AuthMethod {
15
+ PASSWORD = "password",
16
+ OAUTH = "oauth"
17
+ }
18
+
19
+ declare enum OAuthProvider {
20
+ GOOGLE = "google"
21
+ }
22
+
23
+ interface IUser {
24
+ id: string;
25
+ email: string;
26
+ emailVerified: boolean;
27
+ authMethod: AuthMethod;
28
+ oauth?: {
29
+ provider: OAuthProvider;
30
+ providerSubject: string;
31
+ };
32
+ createdAt: string;
33
+ 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<IUser, '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
+
14
114
  interface IConfig {
15
115
  port: number;
16
116
  cors: {
@@ -35,6 +135,13 @@ interface IConfig {
35
135
  auth0ClientId?: string;
36
136
  auth0ClientSecret?: string;
37
137
  auth0Audience?: string;
138
+ jwtIssuer?: string;
139
+ jwtAudience?: string;
140
+ jwtAccessExpiresInSeconds?: number;
141
+ jwtRefreshExpiresInDays?: number;
142
+ jwtPrivateKeyPem?: string;
143
+ jwtPublicKeyPem?: string;
144
+ oauthAllowedRedirectUris?: string;
38
145
  }
39
146
 
40
147
  interface IPagination {
@@ -63,6 +170,61 @@ interface IApiResponse<T = unknown> {
63
170
  message?: string;
64
171
  }
65
172
 
173
+ interface IUserRepository {
174
+ create(input: CreateUserInput, options?: RepositoryOperationOptions): Promise<IUser>;
175
+ findById(id: string, options?: RepositoryOperationOptions): Promise<IUser | null>;
176
+ findByEmail(email: string, options?: RepositoryOperationOptions): Promise<IUser | null>;
177
+ findByOAuth(provider: OAuthProvider, providerSubject: string, options?: RepositoryOperationOptions): Promise<IUser | null>;
178
+ update(id: string, patch: Partial<Pick<IUser, '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: IUser, 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
+
66
228
  declare enum Errors {
67
229
  NOT_FOUND_ERROR = "NotFoundError",
68
230
  BUSINESS_ERROR = "BusinessError",
@@ -113,4 +275,4 @@ declare class UnauthorizedError extends BaseError {
113
275
  constructor(message: string, details?: Record<string, unknown>);
114
276
  }
115
277
 
116
- export { BaseError, BusinessError, Errors, ForbiddenError, type HealthCheck, HealthStatus, 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 IUser, 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 };
package/dist/index.d.ts CHANGED
@@ -11,6 +11,106 @@ type HealthCheck = {
11
11
  status?: HealthStatus;
12
12
  };
13
13
 
14
+ declare enum AuthMethod {
15
+ PASSWORD = "password",
16
+ OAUTH = "oauth"
17
+ }
18
+
19
+ declare enum OAuthProvider {
20
+ GOOGLE = "google"
21
+ }
22
+
23
+ interface IUser {
24
+ id: string;
25
+ email: string;
26
+ emailVerified: boolean;
27
+ authMethod: AuthMethod;
28
+ oauth?: {
29
+ provider: OAuthProvider;
30
+ providerSubject: string;
31
+ };
32
+ createdAt: string;
33
+ 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<IUser, '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
+
14
114
  interface IConfig {
15
115
  port: number;
16
116
  cors: {
@@ -35,6 +135,13 @@ interface IConfig {
35
135
  auth0ClientId?: string;
36
136
  auth0ClientSecret?: string;
37
137
  auth0Audience?: string;
138
+ jwtIssuer?: string;
139
+ jwtAudience?: string;
140
+ jwtAccessExpiresInSeconds?: number;
141
+ jwtRefreshExpiresInDays?: number;
142
+ jwtPrivateKeyPem?: string;
143
+ jwtPublicKeyPem?: string;
144
+ oauthAllowedRedirectUris?: string;
38
145
  }
39
146
 
40
147
  interface IPagination {
@@ -63,6 +170,61 @@ interface IApiResponse<T = unknown> {
63
170
  message?: string;
64
171
  }
65
172
 
173
+ interface IUserRepository {
174
+ create(input: CreateUserInput, options?: RepositoryOperationOptions): Promise<IUser>;
175
+ findById(id: string, options?: RepositoryOperationOptions): Promise<IUser | null>;
176
+ findByEmail(email: string, options?: RepositoryOperationOptions): Promise<IUser | null>;
177
+ findByOAuth(provider: OAuthProvider, providerSubject: string, options?: RepositoryOperationOptions): Promise<IUser | null>;
178
+ update(id: string, patch: Partial<Pick<IUser, '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: IUser, 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
+
66
228
  declare enum Errors {
67
229
  NOT_FOUND_ERROR = "NotFoundError",
68
230
  BUSINESS_ERROR = "BusinessError",
@@ -113,4 +275,4 @@ declare class UnauthorizedError extends BaseError {
113
275
  constructor(message: string, details?: Record<string, unknown>);
114
276
  }
115
277
 
116
- export { BaseError, BusinessError, Errors, ForbiddenError, type HealthCheck, HealthStatus, 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 IUser, 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 };
package/dist/index.js CHANGED
@@ -26,6 +26,19 @@ var HealthStatus = /* @__PURE__ */ ((HealthStatus2) => {
26
26
  return HealthStatus2;
27
27
  })(HealthStatus || {});
28
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
+
29
42
  // src/errors/BaseError.ts
30
43
  var BaseError = class extends Error {
31
44
  toErrorRecord() {
@@ -87,12 +100,14 @@ var UnauthorizedError = class _UnauthorizedError extends BaseError {
87
100
  }
88
101
  };
89
102
 
103
+ exports.AuthMethod = AuthMethod;
90
104
  exports.BaseError = BaseError;
91
105
  exports.BusinessError = BusinessError;
92
106
  exports.Errors = Errors;
93
107
  exports.ForbiddenError = ForbiddenError;
94
108
  exports.HealthStatus = HealthStatus;
95
109
  exports.NotFoundError = NotFoundError;
110
+ exports.OAuthProvider = OAuthProvider;
96
111
  exports.ServerError = ServerError;
97
112
  exports.UnauthorizedError = UnauthorizedError;
98
113
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/enums/errors.ts","../src/enums/health-status.ts","../src/errors/BaseError.ts","../src/errors/BusinessError.ts","../src/errors/ForbiddenError.ts","../src/errors/NotFoundError.ts","../src/errors/ServerError.ts","../src/errors/UnauthorizedError.ts"],"names":["Errors","HealthStatus"],"mappings":";;;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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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","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,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,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 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
@@ -24,6 +24,19 @@ var HealthStatus = /* @__PURE__ */ ((HealthStatus2) => {
24
24
  return HealthStatus2;
25
25
  })(HealthStatus || {});
26
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
+
27
40
  // src/errors/BaseError.ts
28
41
  var BaseError = class extends Error {
29
42
  toErrorRecord() {
@@ -85,6 +98,6 @@ var UnauthorizedError = class _UnauthorizedError extends BaseError {
85
98
  }
86
99
  };
87
100
 
88
- export { BaseError, BusinessError, Errors, ForbiddenError, HealthStatus, NotFoundError, ServerError, UnauthorizedError };
101
+ export { AuthMethod, BaseError, BusinessError, Errors, ForbiddenError, HealthStatus, NotFoundError, OAuthProvider, ServerError, UnauthorizedError };
89
102
  //# sourceMappingURL=index.mjs.map
90
103
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/enums/errors.ts","../src/enums/health-status.ts","../src/errors/BaseError.ts","../src/errors/BusinessError.ts","../src/errors/ForbiddenError.ts","../src/errors/NotFoundError.ts","../src/errors/ServerError.ts","../src/errors/UnauthorizedError.ts"],"names":["Errors","HealthStatus"],"mappings":";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;;;ACAL,IAAM,SAAA,GAAN,cAAwB,KAAA,CAAM;AAAA,EAE5B,aAAA,GAAsD;AAC3D,IAAA,MAAM,GAAA,GAA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AmC;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","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,IA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AK,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.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.4",
3
+ "version": "1.1.3",
4
4
  "description": "Shared types, enums, and interfaces for Truffa projects",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",