@ipetsadmin/contracts 1.1.2 → 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 +17 -0
- package/dist/index.d.mts +19 -19
- package/dist/index.d.ts +19 -19
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -19,6 +19,23 @@ 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
|
+
|
|
22
39
|
## [1.1.2] - 2026-04-05
|
|
23
40
|
|
|
24
41
|
### Added
|
package/dist/index.d.mts
CHANGED
|
@@ -20,18 +20,18 @@ declare enum OAuthProvider {
|
|
|
20
20
|
GOOGLE = "google"
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
interface IUser {
|
|
24
|
+
id: string;
|
|
25
|
+
email: string;
|
|
26
|
+
emailVerified: boolean;
|
|
27
|
+
authMethod: AuthMethod;
|
|
28
|
+
oauth?: {
|
|
29
|
+
provider: OAuthProvider;
|
|
30
|
+
providerSubject: string;
|
|
31
31
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
32
|
+
createdAt: string;
|
|
33
|
+
updatedAt: string;
|
|
34
|
+
}
|
|
35
35
|
|
|
36
36
|
type TokenPair = {
|
|
37
37
|
readonly accessToken: string;
|
|
@@ -58,7 +58,7 @@ type LogoutRequest = {
|
|
|
58
58
|
readonly refreshToken: string;
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
type AuthUserResponse = Pick<
|
|
61
|
+
type AuthUserResponse = Pick<IUser, 'id' | 'email' | 'emailVerified' | 'authMethod' | 'oauth'>;
|
|
62
62
|
|
|
63
63
|
type AuthSessionResponse = TokenPair & {
|
|
64
64
|
readonly user: AuthUserResponse;
|
|
@@ -171,11 +171,11 @@ interface IApiResponse<T = unknown> {
|
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
interface IUserRepository {
|
|
174
|
-
create(input: CreateUserInput, options?: RepositoryOperationOptions): Promise<
|
|
175
|
-
findById(id: string, options?: RepositoryOperationOptions): Promise<
|
|
176
|
-
findByEmail(email: string, options?: RepositoryOperationOptions): Promise<
|
|
177
|
-
findByOAuth(provider: OAuthProvider, providerSubject: string, options?: RepositoryOperationOptions): Promise<
|
|
178
|
-
update(id: string, patch: Partial<Pick<
|
|
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
179
|
passwordHash?: string | null;
|
|
180
180
|
}, options?: RepositoryOperationOptions): Promise<void>;
|
|
181
181
|
}
|
|
@@ -206,7 +206,7 @@ interface IOAuthStateRepository {
|
|
|
206
206
|
|
|
207
207
|
interface IAuthService {
|
|
208
208
|
register(email: string, password: string, options?: RepositoryOperationOptions): Promise<AuthSessionResponse>;
|
|
209
|
-
loginWithUser(user:
|
|
209
|
+
loginWithUser(user: IUser, options?: RepositoryOperationOptions): Promise<AuthSessionResponse>;
|
|
210
210
|
startGoogleOAuth(redirectUri: string): Promise<OAuthGoogleStartResponse>;
|
|
211
211
|
completeGoogleOAuth(code: string, state: string, redirectUri: string, options?: RepositoryOperationOptions): Promise<AuthSessionResponse>;
|
|
212
212
|
refreshSession(refreshToken: string, options?: RepositoryOperationOptions): Promise<AuthSessionResponse>;
|
|
@@ -275,4 +275,4 @@ declare class UnauthorizedError extends BaseError {
|
|
|
275
275
|
constructor(message: string, details?: Record<string, unknown>);
|
|
276
276
|
}
|
|
277
277
|
|
|
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
|
|
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
|
@@ -20,18 +20,18 @@ declare enum OAuthProvider {
|
|
|
20
20
|
GOOGLE = "google"
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
interface IUser {
|
|
24
|
+
id: string;
|
|
25
|
+
email: string;
|
|
26
|
+
emailVerified: boolean;
|
|
27
|
+
authMethod: AuthMethod;
|
|
28
|
+
oauth?: {
|
|
29
|
+
provider: OAuthProvider;
|
|
30
|
+
providerSubject: string;
|
|
31
31
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
32
|
+
createdAt: string;
|
|
33
|
+
updatedAt: string;
|
|
34
|
+
}
|
|
35
35
|
|
|
36
36
|
type TokenPair = {
|
|
37
37
|
readonly accessToken: string;
|
|
@@ -58,7 +58,7 @@ type LogoutRequest = {
|
|
|
58
58
|
readonly refreshToken: string;
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
type AuthUserResponse = Pick<
|
|
61
|
+
type AuthUserResponse = Pick<IUser, 'id' | 'email' | 'emailVerified' | 'authMethod' | 'oauth'>;
|
|
62
62
|
|
|
63
63
|
type AuthSessionResponse = TokenPair & {
|
|
64
64
|
readonly user: AuthUserResponse;
|
|
@@ -171,11 +171,11 @@ interface IApiResponse<T = unknown> {
|
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
interface IUserRepository {
|
|
174
|
-
create(input: CreateUserInput, options?: RepositoryOperationOptions): Promise<
|
|
175
|
-
findById(id: string, options?: RepositoryOperationOptions): Promise<
|
|
176
|
-
findByEmail(email: string, options?: RepositoryOperationOptions): Promise<
|
|
177
|
-
findByOAuth(provider: OAuthProvider, providerSubject: string, options?: RepositoryOperationOptions): Promise<
|
|
178
|
-
update(id: string, patch: Partial<Pick<
|
|
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
179
|
passwordHash?: string | null;
|
|
180
180
|
}, options?: RepositoryOperationOptions): Promise<void>;
|
|
181
181
|
}
|
|
@@ -206,7 +206,7 @@ interface IOAuthStateRepository {
|
|
|
206
206
|
|
|
207
207
|
interface IAuthService {
|
|
208
208
|
register(email: string, password: string, options?: RepositoryOperationOptions): Promise<AuthSessionResponse>;
|
|
209
|
-
loginWithUser(user:
|
|
209
|
+
loginWithUser(user: IUser, options?: RepositoryOperationOptions): Promise<AuthSessionResponse>;
|
|
210
210
|
startGoogleOAuth(redirectUri: string): Promise<OAuthGoogleStartResponse>;
|
|
211
211
|
completeGoogleOAuth(code: string, state: string, redirectUri: string, options?: RepositoryOperationOptions): Promise<AuthSessionResponse>;
|
|
212
212
|
refreshSession(refreshToken: string, options?: RepositoryOperationOptions): Promise<AuthSessionResponse>;
|
|
@@ -275,4 +275,4 @@ declare class UnauthorizedError extends BaseError {
|
|
|
275
275
|
constructor(message: string, details?: Record<string, unknown>);
|
|
276
276
|
}
|
|
277
277
|
|
|
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
|
|
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 };
|