@ipetsadmin/contracts 1.1.5 → 1.1.7
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 +24 -0
- package/dist/index.d.mts +23 -1
- package/dist/index.d.ts +23 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -19,6 +19,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
19
19
|
|
|
20
20
|
### Security
|
|
21
21
|
|
|
22
|
+
## [1.1.7] - 2026-04-25
|
|
23
|
+
|
|
24
|
+
## Added
|
|
25
|
+
|
|
26
|
+
- **VerifyEmailRequest**: Add request type for be used in client function
|
|
27
|
+
|
|
28
|
+
## [1.1.6] - 2026-04-25
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
|
|
32
|
+
- **Email verification**:
|
|
33
|
+
- **`IEmailVerificationTokenRepository`** (with **`EmailVerificationTokenRecord`**: `id`, `userId`, `tokenHash`, `expiresAt`, optional `consumedAt`) — create and consume one-time verify-email tokens.
|
|
34
|
+
- **`IEmailVerificationConfig`**: `frontendUrl`, `tokenExpiresInSeconds` for link generation and token TTL.
|
|
35
|
+
- **`IAuthService`**: **`verifyEmail(token, options?)`** to complete email verification in the auth service (implemented in `api-main`).
|
|
36
|
+
|
|
37
|
+
### Changed
|
|
38
|
+
|
|
39
|
+
- **`IUser`**: add **`role`** (**`UserRole`**), **`isActive`**, and optional **`passwordHash`** (alongside the profile fields from 1.1.4); supports authorization, account state, and persistence round-trips. Auth API responses continue to omit secrets.
|
|
40
|
+
- **`IUserRepository`** file location: **`src/interfaces/repositories/IUserRepository.ts`** (no longer under **`repositories/auth/`**). The package barrel still re-exports the port; update deep imports to the new path if you used `…/repositories/auth/IUserRepository`.
|
|
41
|
+
|
|
42
|
+
### Fixed
|
|
43
|
+
|
|
44
|
+
- **Package barrel (`src/index.ts`)**: **`UserRole`** is re-exported with **`export { UserRole } from '@/enums/roles'`** instead of **`export *`**, so the enum is a reliable **named export** in the tsup CJS/ESM and `.d.ts` output (avoids "declared locally, but is not exported" for consumers).
|
|
45
|
+
|
|
22
46
|
## [1.1.5] - 2026-04-25
|
|
23
47
|
|
|
24
48
|
### Added
|
package/dist/index.d.mts
CHANGED
|
@@ -158,6 +158,10 @@ type SendEmailResult = {
|
|
|
158
158
|
accepted: boolean;
|
|
159
159
|
};
|
|
160
160
|
|
|
161
|
+
type VerifyEmailRequest = {
|
|
162
|
+
readonly token: string;
|
|
163
|
+
};
|
|
164
|
+
|
|
161
165
|
interface IConfig {
|
|
162
166
|
port: number;
|
|
163
167
|
cors: {
|
|
@@ -251,6 +255,18 @@ interface IOAuthStateRepository {
|
|
|
251
255
|
consume(state: string, options?: RepositoryOperationOptions): Promise<OAuthStateRecord | null>;
|
|
252
256
|
}
|
|
253
257
|
|
|
258
|
+
type EmailVerificationTokenRecord = {
|
|
259
|
+
id: string;
|
|
260
|
+
userId: string;
|
|
261
|
+
tokenHash: string;
|
|
262
|
+
expiresAt: string;
|
|
263
|
+
consumedAt?: string;
|
|
264
|
+
};
|
|
265
|
+
interface IEmailVerificationTokenRepository {
|
|
266
|
+
create(userId: string, tokenHash: string, expiresAt: Date, options?: RepositoryOperationOptions): Promise<EmailVerificationTokenRecord>;
|
|
267
|
+
consumeByHash(tokenHash: string, options?: RepositoryOperationOptions): Promise<EmailVerificationTokenRecord | null>;
|
|
268
|
+
}
|
|
269
|
+
|
|
254
270
|
interface IAuthService {
|
|
255
271
|
register(email: string, password: string, options?: RepositoryOperationOptions): Promise<AuthSessionResponse>;
|
|
256
272
|
loginWithUser(user: IUser, options?: RepositoryOperationOptions): Promise<AuthSessionResponse>;
|
|
@@ -258,6 +274,7 @@ interface IAuthService {
|
|
|
258
274
|
completeGoogleOAuth(code: string, state: string, redirectUri: string, options?: RepositoryOperationOptions): Promise<AuthSessionResponse>;
|
|
259
275
|
refreshSession(refreshToken: string, options?: RepositoryOperationOptions): Promise<AuthSessionResponse>;
|
|
260
276
|
logout(refreshToken: string, options?: RepositoryOperationOptions): Promise<void>;
|
|
277
|
+
verifyEmail(token: string, options?: RepositoryOperationOptions): Promise<void>;
|
|
261
278
|
}
|
|
262
279
|
|
|
263
280
|
interface IJwtTokensService {
|
|
@@ -291,6 +308,11 @@ interface IEmailProviderAdapter {
|
|
|
291
308
|
send(input: SendEmailInput): Promise<SendEmailResult>;
|
|
292
309
|
}
|
|
293
310
|
|
|
311
|
+
interface IEmailVerificationConfig {
|
|
312
|
+
frontendUrl: string;
|
|
313
|
+
tokenExpiresInSeconds: number;
|
|
314
|
+
}
|
|
315
|
+
|
|
294
316
|
declare enum Errors {
|
|
295
317
|
NOT_FOUND_ERROR = "NotFoundError",
|
|
296
318
|
BUSINESS_ERROR = "BusinessError",
|
|
@@ -341,4 +363,4 @@ declare class UnauthorizedError extends BaseError {
|
|
|
341
363
|
constructor(message: string, details?: Record<string, unknown>);
|
|
342
364
|
}
|
|
343
365
|
|
|
344
|
-
export { type Auth0AuthorizationParams, type Auth0UserProfile, AuthMethod, type AuthSessionResponse, type AuthUserResponse, BaseError, BusinessError, type CreateUserInput, type EmailAddress, EmailProvider, Errors, ForbiddenError, type HealthCheck, HealthStatus, type IApiResponse, type IAuth0GoogleOAuthService, type IAuthService, type IConfig, type IEmailConfig, type IEmailProviderAdapter, type IEmailService, 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, type SendEmailInput, type SendEmailResult, ServerError, type TokenPair, UnauthorizedError, UserRole };
|
|
366
|
+
export { type Auth0AuthorizationParams, type Auth0UserProfile, AuthMethod, type AuthSessionResponse, type AuthUserResponse, BaseError, BusinessError, type CreateUserInput, type EmailAddress, EmailProvider, type EmailVerificationTokenRecord, Errors, ForbiddenError, type HealthCheck, HealthStatus, type IApiResponse, type IAuth0GoogleOAuthService, type IAuthService, type IConfig, type IEmailConfig, type IEmailProviderAdapter, type IEmailService, type IEmailVerificationConfig, type IEmailVerificationTokenRepository, 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, type SendEmailInput, type SendEmailResult, ServerError, type TokenPair, UnauthorizedError, UserRole, type VerifyEmailRequest };
|
package/dist/index.d.ts
CHANGED
|
@@ -158,6 +158,10 @@ type SendEmailResult = {
|
|
|
158
158
|
accepted: boolean;
|
|
159
159
|
};
|
|
160
160
|
|
|
161
|
+
type VerifyEmailRequest = {
|
|
162
|
+
readonly token: string;
|
|
163
|
+
};
|
|
164
|
+
|
|
161
165
|
interface IConfig {
|
|
162
166
|
port: number;
|
|
163
167
|
cors: {
|
|
@@ -251,6 +255,18 @@ interface IOAuthStateRepository {
|
|
|
251
255
|
consume(state: string, options?: RepositoryOperationOptions): Promise<OAuthStateRecord | null>;
|
|
252
256
|
}
|
|
253
257
|
|
|
258
|
+
type EmailVerificationTokenRecord = {
|
|
259
|
+
id: string;
|
|
260
|
+
userId: string;
|
|
261
|
+
tokenHash: string;
|
|
262
|
+
expiresAt: string;
|
|
263
|
+
consumedAt?: string;
|
|
264
|
+
};
|
|
265
|
+
interface IEmailVerificationTokenRepository {
|
|
266
|
+
create(userId: string, tokenHash: string, expiresAt: Date, options?: RepositoryOperationOptions): Promise<EmailVerificationTokenRecord>;
|
|
267
|
+
consumeByHash(tokenHash: string, options?: RepositoryOperationOptions): Promise<EmailVerificationTokenRecord | null>;
|
|
268
|
+
}
|
|
269
|
+
|
|
254
270
|
interface IAuthService {
|
|
255
271
|
register(email: string, password: string, options?: RepositoryOperationOptions): Promise<AuthSessionResponse>;
|
|
256
272
|
loginWithUser(user: IUser, options?: RepositoryOperationOptions): Promise<AuthSessionResponse>;
|
|
@@ -258,6 +274,7 @@ interface IAuthService {
|
|
|
258
274
|
completeGoogleOAuth(code: string, state: string, redirectUri: string, options?: RepositoryOperationOptions): Promise<AuthSessionResponse>;
|
|
259
275
|
refreshSession(refreshToken: string, options?: RepositoryOperationOptions): Promise<AuthSessionResponse>;
|
|
260
276
|
logout(refreshToken: string, options?: RepositoryOperationOptions): Promise<void>;
|
|
277
|
+
verifyEmail(token: string, options?: RepositoryOperationOptions): Promise<void>;
|
|
261
278
|
}
|
|
262
279
|
|
|
263
280
|
interface IJwtTokensService {
|
|
@@ -291,6 +308,11 @@ interface IEmailProviderAdapter {
|
|
|
291
308
|
send(input: SendEmailInput): Promise<SendEmailResult>;
|
|
292
309
|
}
|
|
293
310
|
|
|
311
|
+
interface IEmailVerificationConfig {
|
|
312
|
+
frontendUrl: string;
|
|
313
|
+
tokenExpiresInSeconds: number;
|
|
314
|
+
}
|
|
315
|
+
|
|
294
316
|
declare enum Errors {
|
|
295
317
|
NOT_FOUND_ERROR = "NotFoundError",
|
|
296
318
|
BUSINESS_ERROR = "BusinessError",
|
|
@@ -341,4 +363,4 @@ declare class UnauthorizedError extends BaseError {
|
|
|
341
363
|
constructor(message: string, details?: Record<string, unknown>);
|
|
342
364
|
}
|
|
343
365
|
|
|
344
|
-
export { type Auth0AuthorizationParams, type Auth0UserProfile, AuthMethod, type AuthSessionResponse, type AuthUserResponse, BaseError, BusinessError, type CreateUserInput, type EmailAddress, EmailProvider, Errors, ForbiddenError, type HealthCheck, HealthStatus, type IApiResponse, type IAuth0GoogleOAuthService, type IAuthService, type IConfig, type IEmailConfig, type IEmailProviderAdapter, type IEmailService, 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, type SendEmailInput, type SendEmailResult, ServerError, type TokenPair, UnauthorizedError, UserRole };
|
|
366
|
+
export { type Auth0AuthorizationParams, type Auth0UserProfile, AuthMethod, type AuthSessionResponse, type AuthUserResponse, BaseError, BusinessError, type CreateUserInput, type EmailAddress, EmailProvider, type EmailVerificationTokenRecord, Errors, ForbiddenError, type HealthCheck, HealthStatus, type IApiResponse, type IAuth0GoogleOAuthService, type IAuthService, type IConfig, type IEmailConfig, type IEmailProviderAdapter, type IEmailService, type IEmailVerificationConfig, type IEmailVerificationTokenRepository, 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, type SendEmailInput, type SendEmailResult, ServerError, type TokenPair, UnauthorizedError, UserRole, type VerifyEmailRequest };
|