@spfn/auth 0.2.0-beta.52 → 0.2.0-beta.53

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.
@@ -182,7 +182,7 @@ interface LogoutParams {
182
182
  }
183
183
  interface ChangePasswordParams {
184
184
  userId: number;
185
- currentPassword: string;
185
+ currentPassword?: string;
186
186
  newPassword: string;
187
187
  passwordHash?: string;
188
188
  }
@@ -558,7 +558,7 @@ declare const mainAuthRouter: _spfn_core_route.Router<{
558
558
  }, RotateKeyResult>;
559
559
  changePassword: _spfn_core_route.RouteDef<{
560
560
  body: _sinclair_typebox.TObject<{
561
- currentPassword: _sinclair_typebox.TString;
561
+ currentPassword: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
562
562
  newPassword: _sinclair_typebox.TString;
563
563
  }>;
564
564
  }, {}, void>;
@@ -573,7 +573,7 @@ declare const mainAuthRouter: _spfn_core_route.Router<{
573
573
  id: number;
574
574
  name: string;
575
575
  displayName: string;
576
- category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
576
+ category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
577
577
  }[];
578
578
  userId: number;
579
579
  publicId: string;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _spfn_core_nextjs from '@spfn/core/nextjs';
2
- import { R as RoleConfig, P as PermissionConfig, C as CheckAccountExistsResult, S as SendVerificationCodeResult, a as RegisterResult, L as LoginResult, b as RotateKeyResult, I as IssueOneTimeTokenResult, O as OAuthStartResult, U as UserProfile, c as ProfileInfo, m as mainAuthRouter } from './authenticate-eucncHxN.js';
3
- export { l as AuthInitOptions, A as AuthSession, d as INVITATION_STATUSES, o as InvitationStatus, K as KEY_ALGORITHM, n as KeyAlgorithmType, j as PERMISSION_CATEGORIES, k as PermissionCategory, f as SOCIAL_PROVIDERS, q as SocialProvider, e as USER_STATUSES, p as UserStatus, i as VERIFICATION_PURPOSES, h as VERIFICATION_TARGET_TYPES, g as VerificationPurpose, V as VerificationTargetType } from './authenticate-eucncHxN.js';
2
+ import { R as RoleConfig, P as PermissionConfig, C as CheckAccountExistsResult, S as SendVerificationCodeResult, a as RegisterResult, L as LoginResult, b as RotateKeyResult, I as IssueOneTimeTokenResult, O as OAuthStartResult, U as UserProfile, c as ProfileInfo, m as mainAuthRouter } from './authenticate-CVLJS7C7.js';
3
+ export { l as AuthInitOptions, A as AuthSession, d as INVITATION_STATUSES, o as InvitationStatus, K as KEY_ALGORITHM, n as KeyAlgorithmType, j as PERMISSION_CATEGORIES, k as PermissionCategory, f as SOCIAL_PROVIDERS, q as SocialProvider, e as USER_STATUSES, p as UserStatus, i as VERIFICATION_PURPOSES, h as VERIFICATION_TARGET_TYPES, g as VerificationPurpose, V as VerificationTargetType } from './authenticate-CVLJS7C7.js';
4
4
  import * as _spfn_core_route from '@spfn/core/route';
5
5
  import { HttpMethod } from '@spfn/core/route';
6
6
  import * as _sinclair_typebox from '@sinclair/typebox';
@@ -154,7 +154,7 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
154
154
  }, RotateKeyResult>;
155
155
  changePassword: _spfn_core_route.RouteDef<{
156
156
  body: _sinclair_typebox.TObject<{
157
- currentPassword: _sinclair_typebox.TString;
157
+ currentPassword: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
158
158
  newPassword: _sinclair_typebox.TString;
159
159
  }>;
160
160
  }, {}, void>;
@@ -169,7 +169,7 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
169
169
  id: number;
170
170
  name: string;
171
171
  displayName: string;
172
- category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
172
+ category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
173
173
  }[];
174
174
  userId: number;
175
175
  publicId: string;
package/dist/server.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { l as AuthInitOptions, n as KeyAlgorithmType, o as InvitationStatus, g as VerificationPurpose, k as PermissionCategory, q as SocialProvider, r as AuthContext } from './authenticate-eucncHxN.js';
2
- export { D as ChangePasswordParams, x as CheckAccountExistsParams, C as CheckAccountExistsResult, a9 as EmailSchema, d as INVITATION_STATUSES, I as IssueOneTimeTokenResult, K as KEY_ALGORITHM, z as LoginParams, L as LoginResult, B as LogoutParams, a5 as OAuthCallbackParams, a6 as OAuthCallbackResult, a4 as OAuthStartParams, O as OAuthStartResult, ab as PasswordSchema, aa as PhoneSchema, y as RegisterParams, T as RegisterPublicKeyParams, a as RegisterResult, X as RevokeKeyParams, W as RotateKeyParams, b as RotateKeyResult, f as SOCIAL_PROVIDERS, G as SendVerificationCodeParams, S as SendVerificationCodeResult, ac as TargetTypeSchema, e as USER_STATUSES, p as UserStatus, i as VERIFICATION_PURPOSES, h as VERIFICATION_TARGET_TYPES, ad as VerificationPurposeSchema, V as VerificationTargetType, H as VerifyCodeParams, J as VerifyCodeResult, m as authRouter, a7 as authenticate, a0 as buildOAuthErrorUrl, w as changePasswordService, s as checkAccountExistsService, a2 as getEnabledOAuthProviders, a3 as getGoogleAccessToken, a1 as isOAuthProviderEnabled, Y as issueOneTimeTokenService, u as loginService, v as logoutService, $ as oauthCallbackService, _ as oauthStartService, a8 as optionalAuth, M as registerPublicKeyService, t as registerService, Q as revokeKeyService, N as rotateKeyService, E as sendVerificationCodeService, F as verifyCodeService, Z as verifyOneTimeTokenService } from './authenticate-eucncHxN.js';
1
+ import { l as AuthInitOptions, n as KeyAlgorithmType, o as InvitationStatus, g as VerificationPurpose, k as PermissionCategory, q as SocialProvider, r as AuthContext } from './authenticate-CVLJS7C7.js';
2
+ export { D as ChangePasswordParams, x as CheckAccountExistsParams, C as CheckAccountExistsResult, a9 as EmailSchema, d as INVITATION_STATUSES, I as IssueOneTimeTokenResult, K as KEY_ALGORITHM, z as LoginParams, L as LoginResult, B as LogoutParams, a5 as OAuthCallbackParams, a6 as OAuthCallbackResult, a4 as OAuthStartParams, O as OAuthStartResult, ab as PasswordSchema, aa as PhoneSchema, y as RegisterParams, T as RegisterPublicKeyParams, a as RegisterResult, X as RevokeKeyParams, W as RotateKeyParams, b as RotateKeyResult, f as SOCIAL_PROVIDERS, G as SendVerificationCodeParams, S as SendVerificationCodeResult, ac as TargetTypeSchema, e as USER_STATUSES, p as UserStatus, i as VERIFICATION_PURPOSES, h as VERIFICATION_TARGET_TYPES, ad as VerificationPurposeSchema, V as VerificationTargetType, H as VerifyCodeParams, J as VerifyCodeResult, m as authRouter, a7 as authenticate, a0 as buildOAuthErrorUrl, w as changePasswordService, s as checkAccountExistsService, a2 as getEnabledOAuthProviders, a3 as getGoogleAccessToken, a1 as isOAuthProviderEnabled, Y as issueOneTimeTokenService, u as loginService, v as logoutService, $ as oauthCallbackService, _ as oauthStartService, a8 as optionalAuth, M as registerPublicKeyService, t as registerService, Q as revokeKeyService, N as rotateKeyService, E as sendVerificationCodeService, F as verifyCodeService, Z as verifyOneTimeTokenService } from './authenticate-CVLJS7C7.js';
3
3
  import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
4
4
  import { UserProfile as UserProfile$1, ProfileInfo } from '@spfn/auth';
5
5
  import { BaseRepository } from '@spfn/core/db';
@@ -1330,7 +1330,7 @@ declare function getAuthSessionService(userId: string | number | bigint): Promis
1330
1330
  id: number;
1331
1331
  name: string;
1332
1332
  displayName: string;
1333
- category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
1333
+ category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
1334
1334
  }[];
1335
1335
  userId: number;
1336
1336
  publicId: string;
@@ -2470,7 +2470,7 @@ declare const permissions: drizzle_orm_pg_core.PgTableWithColumns<{
2470
2470
  tableName: "permissions";
2471
2471
  dataType: "string";
2472
2472
  columnType: "PgText";
2473
- data: "auth" | "custom" | "user" | "rbac" | "system";
2473
+ data: "custom" | "user" | "auth" | "rbac" | "system";
2474
2474
  driverParam: string;
2475
2475
  notNull: false;
2476
2476
  hasDefault: false;
@@ -3061,17 +3061,17 @@ declare class UsersRepository extends BaseRepository {
3061
3061
  * Write primary 사용
3062
3062
  */
3063
3063
  create(data: NewUser): Promise<{
3064
+ username: string | null;
3065
+ status: "active" | "inactive" | "suspended";
3064
3066
  email: string | null;
3065
3067
  phone: string | null;
3066
3068
  id: number;
3069
+ createdAt: Date;
3070
+ updatedAt: Date;
3067
3071
  publicId: string;
3068
- username: string | null;
3069
3072
  passwordHash: string | null;
3070
3073
  passwordChangeRequired: boolean;
3071
3074
  roleId: number;
3072
- createdAt: Date;
3073
- updatedAt: Date;
3074
- status: "active" | "inactive" | "suspended";
3075
3075
  emailVerifiedAt: Date | null;
3076
3076
  phoneVerifiedAt: Date | null;
3077
3077
  lastLoginAt: Date | null;
@@ -3141,17 +3141,17 @@ declare class UsersRepository extends BaseRepository {
3141
3141
  * Write primary 사용
3142
3142
  */
3143
3143
  deleteById(id: number): Promise<{
3144
+ username: string | null;
3145
+ status: "active" | "inactive" | "suspended";
3144
3146
  email: string | null;
3145
3147
  phone: string | null;
3146
3148
  id: number;
3149
+ createdAt: Date;
3150
+ updatedAt: Date;
3147
3151
  publicId: string;
3148
- username: string | null;
3149
3152
  passwordHash: string | null;
3150
3153
  passwordChangeRequired: boolean;
3151
3154
  roleId: number;
3152
- createdAt: Date;
3153
- updatedAt: Date;
3154
- status: "active" | "inactive" | "suspended";
3155
3155
  emailVerifiedAt: Date | null;
3156
3156
  phoneVerifiedAt: Date | null;
3157
3157
  lastLoginAt: Date | null;
@@ -3174,7 +3174,7 @@ declare class UsersRepository extends BaseRepository {
3174
3174
  id: number;
3175
3175
  name: string;
3176
3176
  displayName: string;
3177
- category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
3177
+ category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
3178
3178
  }[];
3179
3179
  }>;
3180
3180
  /**
@@ -3288,16 +3288,16 @@ declare class KeysRepository extends BaseRepository {
3288
3288
  * Write primary 사용
3289
3289
  */
3290
3290
  create(data: NewUserPublicKey): Promise<{
3291
- publicKey: string;
3292
- keyId: string;
3293
- fingerprint: string;
3294
- algorithm: "ES256" | "RS256";
3295
3291
  userId: number;
3292
+ keyId: string;
3296
3293
  id: number;
3297
3294
  isActive: boolean;
3298
3295
  createdAt: Date;
3299
- expiresAt: Date | null;
3296
+ publicKey: string;
3297
+ algorithm: "ES256" | "RS256";
3298
+ fingerprint: string;
3300
3299
  lastUsedAt: Date | null;
3300
+ expiresAt: Date | null;
3301
3301
  revokedAt: Date | null;
3302
3302
  revokedReason: string | null;
3303
3303
  }>;
@@ -3324,16 +3324,16 @@ declare class KeysRepository extends BaseRepository {
3324
3324
  * Write primary 사용
3325
3325
  */
3326
3326
  deleteByKeyIdAndUserId(keyId: string, userId: number): Promise<{
3327
- publicKey: string;
3328
- keyId: string;
3329
- fingerprint: string;
3330
- algorithm: "ES256" | "RS256";
3331
3327
  userId: number;
3328
+ keyId: string;
3332
3329
  id: number;
3333
3330
  isActive: boolean;
3334
3331
  createdAt: Date;
3335
- expiresAt: Date | null;
3332
+ publicKey: string;
3333
+ algorithm: "ES256" | "RS256";
3334
+ fingerprint: string;
3336
3335
  lastUsedAt: Date | null;
3336
+ expiresAt: Date | null;
3337
3337
  revokedAt: Date | null;
3338
3338
  revokedReason: string | null;
3339
3339
  }>;
@@ -3448,14 +3448,14 @@ declare class VerificationCodesRepository extends BaseRepository {
3448
3448
  * Write primary 사용
3449
3449
  */
3450
3450
  create(data: NewVerificationCode): Promise<{
3451
- target: string;
3452
- targetType: "email" | "phone";
3453
- purpose: "registration" | "login" | "password_reset" | "email_change" | "phone_change";
3454
- code: string;
3455
3451
  id: number;
3456
3452
  createdAt: Date;
3457
3453
  updatedAt: Date;
3458
3454
  expiresAt: Date;
3455
+ target: string;
3456
+ targetType: "email" | "phone";
3457
+ code: string;
3458
+ purpose: "registration" | "login" | "password_reset" | "email_change" | "phone_change";
3459
3459
  usedAt: Date | null;
3460
3460
  attempts: number;
3461
3461
  }>;
@@ -3644,7 +3644,7 @@ declare class PermissionsRepository extends BaseRepository {
3644
3644
  name: string;
3645
3645
  displayName: string;
3646
3646
  description: string | null;
3647
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3647
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3648
3648
  isBuiltin: boolean;
3649
3649
  isSystem: boolean;
3650
3650
  isActive: boolean;
@@ -3660,7 +3660,7 @@ declare class PermissionsRepository extends BaseRepository {
3660
3660
  name: string;
3661
3661
  displayName: string;
3662
3662
  description: string | null;
3663
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3663
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3664
3664
  isBuiltin: boolean;
3665
3665
  isSystem: boolean;
3666
3666
  isActive: boolean;
@@ -3700,7 +3700,7 @@ declare class PermissionsRepository extends BaseRepository {
3700
3700
  name: string;
3701
3701
  displayName: string;
3702
3702
  description: string | null;
3703
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3703
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3704
3704
  isBuiltin: boolean;
3705
3705
  isSystem: boolean;
3706
3706
  isActive: boolean;
@@ -3711,7 +3711,6 @@ declare class PermissionsRepository extends BaseRepository {
3711
3711
  */
3712
3712
  deleteById(id: number): Promise<{
3713
3713
  description: string | null;
3714
- metadata: Record<string, any> | null;
3715
3714
  id: number;
3716
3715
  name: string;
3717
3716
  displayName: string;
@@ -3720,7 +3719,8 @@ declare class PermissionsRepository extends BaseRepository {
3720
3719
  isActive: boolean;
3721
3720
  createdAt: Date;
3722
3721
  updatedAt: Date;
3723
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3722
+ metadata: Record<string, any> | null;
3723
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3724
3724
  }>;
3725
3725
  }
3726
3726
  declare const permissionsRepository: PermissionsRepository;
@@ -3765,9 +3765,9 @@ declare class RolePermissionsRepository extends BaseRepository {
3765
3765
  */
3766
3766
  createMany(data: NewRolePermission[]): Promise<{
3767
3767
  id: number;
3768
- roleId: number;
3769
3768
  createdAt: Date;
3770
3769
  updatedAt: Date;
3770
+ roleId: number;
3771
3771
  permissionId: number;
3772
3772
  }[]>;
3773
3773
  /**
@@ -3783,9 +3783,9 @@ declare class RolePermissionsRepository extends BaseRepository {
3783
3783
  */
3784
3784
  setPermissionsForRole(roleId: number, permissionIds: number[]): Promise<{
3785
3785
  id: number;
3786
- roleId: number;
3787
3786
  createdAt: Date;
3788
3787
  updatedAt: Date;
3788
+ roleId: number;
3789
3789
  permissionId: number;
3790
3790
  }[]>;
3791
3791
  }
@@ -3850,10 +3850,10 @@ declare class UserPermissionsRepository extends BaseRepository {
3850
3850
  id: number;
3851
3851
  createdAt: Date;
3852
3852
  updatedAt: Date;
3853
- permissionId: number;
3854
3853
  expiresAt: Date | null;
3855
- reason: string | null;
3854
+ permissionId: number;
3856
3855
  granted: boolean;
3856
+ reason: string | null;
3857
3857
  }>;
3858
3858
  /**
3859
3859
  * 사용자 권한 오버라이드 업데이트
@@ -3876,10 +3876,10 @@ declare class UserPermissionsRepository extends BaseRepository {
3876
3876
  id: number;
3877
3877
  createdAt: Date;
3878
3878
  updatedAt: Date;
3879
- permissionId: number;
3880
3879
  expiresAt: Date | null;
3881
- reason: string | null;
3880
+ permissionId: number;
3882
3881
  granted: boolean;
3882
+ reason: string | null;
3883
3883
  }>;
3884
3884
  /**
3885
3885
  * 사용자의 모든 권한 오버라이드 삭제
@@ -3957,7 +3957,6 @@ declare class UserProfilesRepository extends BaseRepository {
3957
3957
  * 프로필 생성
3958
3958
  */
3959
3959
  create(data: NewUserProfile): Promise<{
3960
- metadata: Record<string, any> | null;
3961
3960
  userId: number;
3962
3961
  id: number;
3963
3962
  displayName: string | null;
@@ -3975,6 +3974,7 @@ declare class UserProfilesRepository extends BaseRepository {
3975
3974
  location: string | null;
3976
3975
  company: string | null;
3977
3976
  jobTitle: string | null;
3977
+ metadata: Record<string, any> | null;
3978
3978
  }>;
3979
3979
  /**
3980
3980
  * 프로필 업데이트 (by ID)
@@ -4026,7 +4026,6 @@ declare class UserProfilesRepository extends BaseRepository {
4026
4026
  * 프로필 삭제 (by ID)
4027
4027
  */
4028
4028
  deleteById(id: number): Promise<{
4029
- metadata: Record<string, any> | null;
4030
4029
  userId: number;
4031
4030
  id: number;
4032
4031
  displayName: string | null;
@@ -4044,12 +4043,12 @@ declare class UserProfilesRepository extends BaseRepository {
4044
4043
  location: string | null;
4045
4044
  company: string | null;
4046
4045
  jobTitle: string | null;
4046
+ metadata: Record<string, any> | null;
4047
4047
  }>;
4048
4048
  /**
4049
4049
  * 프로필 삭제 (by User ID)
4050
4050
  */
4051
4051
  deleteByUserId(userId: number): Promise<{
4052
- metadata: Record<string, any> | null;
4053
4052
  userId: number;
4054
4053
  id: number;
4055
4054
  displayName: string | null;
@@ -4067,6 +4066,7 @@ declare class UserProfilesRepository extends BaseRepository {
4067
4066
  location: string | null;
4068
4067
  company: string | null;
4069
4068
  jobTitle: string | null;
4069
+ metadata: Record<string, any> | null;
4070
4070
  }>;
4071
4071
  /**
4072
4072
  * 프로필 Upsert (by User ID)
@@ -4075,7 +4075,6 @@ declare class UserProfilesRepository extends BaseRepository {
4075
4075
  * 새로 생성 시 displayName은 필수 (없으면 'User'로 설정)
4076
4076
  */
4077
4077
  upsertByUserId(userId: number, data: Partial<Omit<NewUserProfile, 'userId'>>): Promise<{
4078
- metadata: Record<string, any> | null;
4079
4078
  userId: number;
4080
4079
  id: number;
4081
4080
  displayName: string | null;
@@ -4093,6 +4092,7 @@ declare class UserProfilesRepository extends BaseRepository {
4093
4092
  location: string | null;
4094
4093
  company: string | null;
4095
4094
  jobTitle: string | null;
4095
+ metadata: Record<string, any> | null;
4096
4096
  }>;
4097
4097
  /**
4098
4098
  * User ID로 프로필 데이터 조회 (formatted)
@@ -4219,16 +4219,16 @@ declare class InvitationsRepository extends BaseRepository {
4219
4219
  * 초대 생성
4220
4220
  */
4221
4221
  create(data: NewInvitation): Promise<{
4222
+ status: "pending" | "accepted" | "expired" | "cancelled";
4222
4223
  email: string;
4223
- metadata: Record<string, any> | null;
4224
4224
  id: number;
4225
- roleId: number;
4226
4225
  createdAt: Date;
4227
4226
  updatedAt: Date;
4228
- status: "pending" | "accepted" | "expired" | "cancelled";
4227
+ roleId: number;
4228
+ metadata: Record<string, any> | null;
4229
+ expiresAt: Date;
4229
4230
  token: string;
4230
4231
  invitedBy: number;
4231
- expiresAt: Date;
4232
4232
  acceptedAt: Date | null;
4233
4233
  cancelledAt: Date | null;
4234
4234
  }>;
@@ -4253,16 +4253,16 @@ declare class InvitationsRepository extends BaseRepository {
4253
4253
  * 초대 삭제
4254
4254
  */
4255
4255
  deleteById(id: number): Promise<{
4256
+ status: "pending" | "accepted" | "expired" | "cancelled";
4256
4257
  email: string;
4257
- metadata: Record<string, any> | null;
4258
4258
  id: number;
4259
- roleId: number;
4260
4259
  createdAt: Date;
4261
4260
  updatedAt: Date;
4262
- status: "pending" | "accepted" | "expired" | "cancelled";
4261
+ roleId: number;
4262
+ metadata: Record<string, any> | null;
4263
+ expiresAt: Date;
4263
4264
  token: string;
4264
4265
  invitedBy: number;
4265
- expiresAt: Date;
4266
4266
  acceptedAt: Date | null;
4267
4267
  cancelledAt: Date | null;
4268
4268
  }>;
@@ -4969,17 +4969,17 @@ declare function getOptionalAuth(c: Context | {
4969
4969
  declare function getUser(c: Context | {
4970
4970
  raw: Context;
4971
4971
  }): {
4972
+ username: string | null;
4973
+ status: "active" | "inactive" | "suspended";
4972
4974
  email: string | null;
4973
4975
  phone: string | null;
4974
4976
  id: number;
4977
+ createdAt: Date;
4978
+ updatedAt: Date;
4975
4979
  publicId: string;
4976
- username: string | null;
4977
4980
  passwordHash: string | null;
4978
4981
  passwordChangeRequired: boolean;
4979
4982
  roleId: number;
4980
- createdAt: Date;
4981
- updatedAt: Date;
4982
- status: "active" | "inactive" | "suspended";
4983
4983
  emailVerifiedAt: Date | null;
4984
4984
  phoneVerifiedAt: Date | null;
4985
4985
  lastLoginAt: Date | null;
@@ -5577,9 +5577,9 @@ declare const invitationCreatedEvent: _spfn_core_event.EventDef<{
5577
5577
  } | undefined;
5578
5578
  email: string;
5579
5579
  roleId: number;
5580
+ expiresAt: string;
5580
5581
  token: string;
5581
5582
  invitedBy: string;
5582
- expiresAt: string;
5583
5583
  invitationId: string;
5584
5584
  isResend: boolean;
5585
5585
  }>;
package/dist/server.js CHANGED
@@ -7406,12 +7406,14 @@ async function changePasswordService(params) {
7406
7406
  }
7407
7407
  passwordHash = user.passwordHash;
7408
7408
  }
7409
- if (!passwordHash) {
7410
- throw new ValidationError2({ message: "No password set for this account" });
7411
- }
7412
- const isValid = await verifyPassword(currentPassword, passwordHash);
7413
- if (!isValid) {
7414
- throw new InvalidCredentialsError({ message: "Current password is incorrect" });
7409
+ if (passwordHash) {
7410
+ if (!currentPassword) {
7411
+ throw new ValidationError2({ message: "Current password is required" });
7412
+ }
7413
+ const isValid = await verifyPassword(currentPassword, passwordHash);
7414
+ if (!isValid) {
7415
+ throw new InvalidCredentialsError({ message: "Current password is incorrect" });
7416
+ }
7415
7417
  }
7416
7418
  const newPasswordHash = await hashPassword(newPassword);
7417
7419
  await usersRepository.updatePassword(userId, newPasswordHash, true);
@@ -8483,10 +8485,10 @@ var rotateKey = route.post("/_auth/keys/rotate").interceptor({
8483
8485
  });
8484
8486
  var changePassword = route.put("/_auth/password").input({
8485
8487
  body: Type.Object({
8486
- currentPassword: Type.String({
8488
+ currentPassword: Type.Optional(Type.String({
8487
8489
  minLength: 1,
8488
- description: "Current password for verification"
8489
- }),
8490
+ description: "Current password for verification (required when changing existing password)"
8491
+ })),
8490
8492
  newPassword: PasswordSchema
8491
8493
  })
8492
8494
  }).handler(async (c) => {