@spfn/auth 0.2.0-beta.29 → 0.2.0-beta.30

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.
@@ -542,7 +542,7 @@ declare const mainAuthRouter: _spfn_core_route.Router<{
542
542
  id: number;
543
543
  name: string;
544
544
  displayName: string;
545
- category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
545
+ category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
546
546
  }[];
547
547
  userId: number;
548
548
  email: string | null;
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, O as OAuthStartResult, U as UserProfile, c as ProfileInfo, m as mainAuthRouter } from './authenticate-C4tLMVHj.js';
3
- export { k as AuthInitOptions, A as AuthSession, I as INVITATION_STATUSES, n as InvitationStatus, K as KEY_ALGORITHM, l as KeyAlgorithmType, i as PERMISSION_CATEGORIES, j as PermissionCategory, e as SOCIAL_PROVIDERS, p as SocialProvider, d as USER_STATUSES, o as UserStatus, h as VERIFICATION_PURPOSES, g as VERIFICATION_TARGET_TYPES, f as VerificationPurpose, V as VerificationTargetType } from './authenticate-C4tLMVHj.js';
2
+ import { R as RoleConfig, P as PermissionConfig, C as CheckAccountExistsResult, S as SendVerificationCodeResult, a as RegisterResult, L as LoginResult, b as RotateKeyResult, O as OAuthStartResult, U as UserProfile, c as ProfileInfo, m as mainAuthRouter } from './authenticate-CT2Xy98P.js';
3
+ export { k as AuthInitOptions, A as AuthSession, I as INVITATION_STATUSES, n as InvitationStatus, K as KEY_ALGORITHM, l as KeyAlgorithmType, i as PERMISSION_CATEGORIES, j as PermissionCategory, e as SOCIAL_PROVIDERS, p as SocialProvider, d as USER_STATUSES, o as UserStatus, h as VERIFICATION_PURPOSES, g as VERIFICATION_TARGET_TYPES, f as VerificationPurpose, V as VerificationTargetType } from './authenticate-CT2Xy98P.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';
@@ -168,7 +168,7 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
168
168
  id: number;
169
169
  name: string;
170
170
  displayName: string;
171
- category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
171
+ category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
172
172
  }[];
173
173
  userId: number;
174
174
  email: string | null;
package/dist/server.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { k as AuthInitOptions, l as KeyAlgorithmType, n as InvitationStatus, f as VerificationPurpose, j as PermissionCategory, p as SocialProvider, q as AuthContext } from './authenticate-C4tLMVHj.js';
2
- export { B as ChangePasswordParams, w as CheckAccountExistsParams, C as CheckAccountExistsResult, a6 as EmailSchema, I as INVITATION_STATUSES, K as KEY_ALGORITHM, y as LoginParams, L as LoginResult, z as LogoutParams, a2 as OAuthCallbackParams, a3 as OAuthCallbackResult, a1 as OAuthStartParams, O as OAuthStartResult, a8 as PasswordSchema, a7 as PhoneSchema, x as RegisterParams, Q as RegisterPublicKeyParams, a as RegisterResult, W as RevokeKeyParams, T as RotateKeyParams, b as RotateKeyResult, e as SOCIAL_PROVIDERS, F as SendVerificationCodeParams, S as SendVerificationCodeResult, a9 as TargetTypeSchema, d as USER_STATUSES, o as UserStatus, h as VERIFICATION_PURPOSES, g as VERIFICATION_TARGET_TYPES, aa as VerificationPurposeSchema, V as VerificationTargetType, G as VerifyCodeParams, H as VerifyCodeResult, m as authRouter, a4 as authenticate, Z as buildOAuthErrorUrl, v as changePasswordService, r as checkAccountExistsService, $ as getEnabledOAuthProviders, a0 as getGoogleAccessToken, _ as isOAuthProviderEnabled, t as loginService, u as logoutService, Y as oauthCallbackService, X as oauthStartService, a5 as optionalAuth, J as registerPublicKeyService, s as registerService, N as revokeKeyService, M as rotateKeyService, D as sendVerificationCodeService, E as verifyCodeService } from './authenticate-C4tLMVHj.js';
1
+ import { k as AuthInitOptions, l as KeyAlgorithmType, n as InvitationStatus, f as VerificationPurpose, j as PermissionCategory, p as SocialProvider, q as AuthContext } from './authenticate-CT2Xy98P.js';
2
+ export { B as ChangePasswordParams, w as CheckAccountExistsParams, C as CheckAccountExistsResult, a6 as EmailSchema, I as INVITATION_STATUSES, K as KEY_ALGORITHM, y as LoginParams, L as LoginResult, z as LogoutParams, a2 as OAuthCallbackParams, a3 as OAuthCallbackResult, a1 as OAuthStartParams, O as OAuthStartResult, a8 as PasswordSchema, a7 as PhoneSchema, x as RegisterParams, Q as RegisterPublicKeyParams, a as RegisterResult, W as RevokeKeyParams, T as RotateKeyParams, b as RotateKeyResult, e as SOCIAL_PROVIDERS, F as SendVerificationCodeParams, S as SendVerificationCodeResult, a9 as TargetTypeSchema, d as USER_STATUSES, o as UserStatus, h as VERIFICATION_PURPOSES, g as VERIFICATION_TARGET_TYPES, aa as VerificationPurposeSchema, V as VerificationTargetType, G as VerifyCodeParams, H as VerifyCodeResult, m as authRouter, a4 as authenticate, Z as buildOAuthErrorUrl, v as changePasswordService, r as checkAccountExistsService, $ as getEnabledOAuthProviders, a0 as getGoogleAccessToken, _ as isOAuthProviderEnabled, t as loginService, u as logoutService, Y as oauthCallbackService, X as oauthStartService, a5 as optionalAuth, J as registerPublicKeyService, s as registerService, N as revokeKeyService, M as rotateKeyService, D as sendVerificationCodeService, E as verifyCodeService } from './authenticate-CT2Xy98P.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';
@@ -1304,7 +1304,7 @@ declare function getAuthSessionService(userId: string | number | bigint): Promis
1304
1304
  id: number;
1305
1305
  name: string;
1306
1306
  displayName: string;
1307
- category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
1307
+ category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
1308
1308
  }[];
1309
1309
  userId: number;
1310
1310
  email: string | null;
@@ -2433,7 +2433,7 @@ declare const permissions: drizzle_orm_pg_core.PgTableWithColumns<{
2433
2433
  tableName: "permissions";
2434
2434
  dataType: "string";
2435
2435
  columnType: "PgText";
2436
- data: "auth" | "custom" | "user" | "rbac" | "system";
2436
+ data: "custom" | "user" | "auth" | "rbac" | "system";
2437
2437
  driverParam: string;
2438
2438
  notNull: false;
2439
2439
  hasDefault: false;
@@ -2931,16 +2931,16 @@ declare class UsersRepository extends BaseRepository {
2931
2931
  * Write primary 사용
2932
2932
  */
2933
2933
  create(data: NewUser): Promise<{
2934
+ username: string | null;
2935
+ status: "active" | "inactive" | "suspended";
2934
2936
  email: string | null;
2935
2937
  phone: string | null;
2936
2938
  id: number;
2937
- username: string | null;
2939
+ createdAt: Date;
2940
+ updatedAt: Date;
2938
2941
  passwordHash: string | null;
2939
2942
  passwordChangeRequired: boolean;
2940
2943
  roleId: number;
2941
- createdAt: Date;
2942
- updatedAt: Date;
2943
- status: "active" | "inactive" | "suspended";
2944
2944
  emailVerifiedAt: Date | null;
2945
2945
  phoneVerifiedAt: Date | null;
2946
2946
  lastLoginAt: Date | null;
@@ -3007,16 +3007,16 @@ declare class UsersRepository extends BaseRepository {
3007
3007
  * Write primary 사용
3008
3008
  */
3009
3009
  deleteById(id: number): Promise<{
3010
+ username: string | null;
3011
+ status: "active" | "inactive" | "suspended";
3010
3012
  email: string | null;
3011
3013
  phone: string | null;
3012
3014
  id: number;
3013
- username: string | null;
3015
+ createdAt: Date;
3016
+ updatedAt: Date;
3014
3017
  passwordHash: string | null;
3015
3018
  passwordChangeRequired: boolean;
3016
3019
  roleId: number;
3017
- createdAt: Date;
3018
- updatedAt: Date;
3019
- status: "active" | "inactive" | "suspended";
3020
3020
  emailVerifiedAt: Date | null;
3021
3021
  phoneVerifiedAt: Date | null;
3022
3022
  lastLoginAt: Date | null;
@@ -3039,7 +3039,7 @@ declare class UsersRepository extends BaseRepository {
3039
3039
  id: number;
3040
3040
  name: string;
3041
3041
  displayName: string;
3042
- category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
3042
+ category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
3043
3043
  }[];
3044
3044
  }>;
3045
3045
  /**
@@ -3151,16 +3151,16 @@ declare class KeysRepository extends BaseRepository {
3151
3151
  * Write primary 사용
3152
3152
  */
3153
3153
  create(data: NewUserPublicKey): Promise<{
3154
- publicKey: string;
3155
- keyId: string;
3156
- fingerprint: string;
3157
- algorithm: "ES256" | "RS256";
3158
3154
  userId: number;
3155
+ keyId: string;
3159
3156
  id: number;
3160
3157
  isActive: boolean;
3161
3158
  createdAt: Date;
3162
- expiresAt: Date | null;
3159
+ publicKey: string;
3160
+ algorithm: "ES256" | "RS256";
3161
+ fingerprint: string;
3163
3162
  lastUsedAt: Date | null;
3163
+ expiresAt: Date | null;
3164
3164
  revokedAt: Date | null;
3165
3165
  revokedReason: string | null;
3166
3166
  }>;
@@ -3187,16 +3187,16 @@ declare class KeysRepository extends BaseRepository {
3187
3187
  * Write primary 사용
3188
3188
  */
3189
3189
  deleteByKeyIdAndUserId(keyId: string, userId: number): Promise<{
3190
- publicKey: string;
3191
- keyId: string;
3192
- fingerprint: string;
3193
- algorithm: "ES256" | "RS256";
3194
3190
  userId: number;
3191
+ keyId: string;
3195
3192
  id: number;
3196
3193
  isActive: boolean;
3197
3194
  createdAt: Date;
3198
- expiresAt: Date | null;
3195
+ publicKey: string;
3196
+ algorithm: "ES256" | "RS256";
3197
+ fingerprint: string;
3199
3198
  lastUsedAt: Date | null;
3199
+ expiresAt: Date | null;
3200
3200
  revokedAt: Date | null;
3201
3201
  revokedReason: string | null;
3202
3202
  }>;
@@ -3311,14 +3311,14 @@ declare class VerificationCodesRepository extends BaseRepository {
3311
3311
  * Write primary 사용
3312
3312
  */
3313
3313
  create(data: NewVerificationCode): Promise<{
3314
- target: string;
3315
- targetType: "email" | "phone";
3316
- purpose: "registration" | "login" | "password_reset" | "email_change" | "phone_change";
3317
- code: string;
3318
3314
  id: number;
3319
3315
  createdAt: Date;
3320
3316
  updatedAt: Date;
3321
3317
  expiresAt: Date;
3318
+ target: string;
3319
+ targetType: "email" | "phone";
3320
+ code: string;
3321
+ purpose: "registration" | "login" | "password_reset" | "email_change" | "phone_change";
3322
3322
  usedAt: Date | null;
3323
3323
  attempts: number;
3324
3324
  }>;
@@ -3507,7 +3507,7 @@ declare class PermissionsRepository extends BaseRepository {
3507
3507
  name: string;
3508
3508
  displayName: string;
3509
3509
  description: string | null;
3510
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3510
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3511
3511
  isBuiltin: boolean;
3512
3512
  isSystem: boolean;
3513
3513
  isActive: boolean;
@@ -3523,7 +3523,7 @@ declare class PermissionsRepository extends BaseRepository {
3523
3523
  name: string;
3524
3524
  displayName: string;
3525
3525
  description: string | null;
3526
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3526
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3527
3527
  isBuiltin: boolean;
3528
3528
  isSystem: boolean;
3529
3529
  isActive: boolean;
@@ -3563,7 +3563,7 @@ declare class PermissionsRepository extends BaseRepository {
3563
3563
  name: string;
3564
3564
  displayName: string;
3565
3565
  description: string | null;
3566
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3566
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3567
3567
  isBuiltin: boolean;
3568
3568
  isSystem: boolean;
3569
3569
  isActive: boolean;
@@ -3582,8 +3582,8 @@ declare class PermissionsRepository extends BaseRepository {
3582
3582
  isActive: boolean;
3583
3583
  createdAt: Date;
3584
3584
  updatedAt: Date;
3585
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3586
3585
  metadata: Record<string, any> | null;
3586
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3587
3587
  }>;
3588
3588
  }
3589
3589
  declare const permissionsRepository: PermissionsRepository;
@@ -3628,9 +3628,9 @@ declare class RolePermissionsRepository extends BaseRepository {
3628
3628
  */
3629
3629
  createMany(data: NewRolePermission[]): Promise<{
3630
3630
  id: number;
3631
- roleId: number;
3632
3631
  createdAt: Date;
3633
3632
  updatedAt: Date;
3633
+ roleId: number;
3634
3634
  permissionId: number;
3635
3635
  }[]>;
3636
3636
  /**
@@ -3646,9 +3646,9 @@ declare class RolePermissionsRepository extends BaseRepository {
3646
3646
  */
3647
3647
  setPermissionsForRole(roleId: number, permissionIds: number[]): Promise<{
3648
3648
  id: number;
3649
- roleId: number;
3650
3649
  createdAt: Date;
3651
3650
  updatedAt: Date;
3651
+ roleId: number;
3652
3652
  permissionId: number;
3653
3653
  }[]>;
3654
3654
  }
@@ -3713,10 +3713,10 @@ declare class UserPermissionsRepository extends BaseRepository {
3713
3713
  id: number;
3714
3714
  createdAt: Date;
3715
3715
  updatedAt: Date;
3716
- permissionId: number;
3717
3716
  expiresAt: Date | null;
3718
- reason: string | null;
3717
+ permissionId: number;
3719
3718
  granted: boolean;
3719
+ reason: string | null;
3720
3720
  }>;
3721
3721
  /**
3722
3722
  * 사용자 권한 오버라이드 업데이트
@@ -3739,10 +3739,10 @@ declare class UserPermissionsRepository extends BaseRepository {
3739
3739
  id: number;
3740
3740
  createdAt: Date;
3741
3741
  updatedAt: Date;
3742
- permissionId: number;
3743
3742
  expiresAt: Date | null;
3744
- reason: string | null;
3743
+ permissionId: number;
3745
3744
  granted: boolean;
3745
+ reason: string | null;
3746
3746
  }>;
3747
3747
  /**
3748
3748
  * 사용자의 모든 권한 오버라이드 삭제
@@ -3821,7 +3821,6 @@ declare class UserProfilesRepository extends BaseRepository {
3821
3821
  displayName: string;
3822
3822
  createdAt: Date;
3823
3823
  updatedAt: Date;
3824
- metadata: Record<string, any> | null;
3825
3824
  firstName: string | null;
3826
3825
  lastName: string | null;
3827
3826
  avatarUrl: string | null;
@@ -3834,6 +3833,7 @@ declare class UserProfilesRepository extends BaseRepository {
3834
3833
  location: string | null;
3835
3834
  company: string | null;
3836
3835
  jobTitle: string | null;
3836
+ metadata: Record<string, any> | null;
3837
3837
  }>;
3838
3838
  /**
3839
3839
  * 프로필 업데이트 (by ID)
@@ -3890,7 +3890,6 @@ declare class UserProfilesRepository extends BaseRepository {
3890
3890
  displayName: string;
3891
3891
  createdAt: Date;
3892
3892
  updatedAt: Date;
3893
- metadata: Record<string, any> | null;
3894
3893
  firstName: string | null;
3895
3894
  lastName: string | null;
3896
3895
  avatarUrl: string | null;
@@ -3903,6 +3902,7 @@ declare class UserProfilesRepository extends BaseRepository {
3903
3902
  location: string | null;
3904
3903
  company: string | null;
3905
3904
  jobTitle: string | null;
3905
+ metadata: Record<string, any> | null;
3906
3906
  }>;
3907
3907
  /**
3908
3908
  * 프로필 삭제 (by User ID)
@@ -3913,7 +3913,6 @@ declare class UserProfilesRepository extends BaseRepository {
3913
3913
  displayName: string;
3914
3914
  createdAt: Date;
3915
3915
  updatedAt: Date;
3916
- metadata: Record<string, any> | null;
3917
3916
  firstName: string | null;
3918
3917
  lastName: string | null;
3919
3918
  avatarUrl: string | null;
@@ -3926,6 +3925,7 @@ declare class UserProfilesRepository extends BaseRepository {
3926
3925
  location: string | null;
3927
3926
  company: string | null;
3928
3927
  jobTitle: string | null;
3928
+ metadata: Record<string, any> | null;
3929
3929
  }>;
3930
3930
  /**
3931
3931
  * 프로필 Upsert (by User ID)
@@ -3939,7 +3939,6 @@ declare class UserProfilesRepository extends BaseRepository {
3939
3939
  displayName: string;
3940
3940
  createdAt: Date;
3941
3941
  updatedAt: Date;
3942
- metadata: Record<string, any> | null;
3943
3942
  firstName: string | null;
3944
3943
  lastName: string | null;
3945
3944
  avatarUrl: string | null;
@@ -3952,6 +3951,7 @@ declare class UserProfilesRepository extends BaseRepository {
3952
3951
  location: string | null;
3953
3952
  company: string | null;
3954
3953
  jobTitle: string | null;
3954
+ metadata: Record<string, any> | null;
3955
3955
  }>;
3956
3956
  /**
3957
3957
  * User ID로 프로필 데이터 조회 (formatted)
@@ -4078,16 +4078,16 @@ declare class InvitationsRepository extends BaseRepository {
4078
4078
  * 초대 생성
4079
4079
  */
4080
4080
  create(data: NewInvitation): Promise<{
4081
+ status: "pending" | "accepted" | "expired" | "cancelled";
4081
4082
  email: string;
4082
4083
  id: number;
4083
- roleId: number;
4084
4084
  createdAt: Date;
4085
4085
  updatedAt: Date;
4086
- status: "pending" | "accepted" | "expired" | "cancelled";
4086
+ roleId: number;
4087
4087
  metadata: Record<string, any> | null;
4088
+ expiresAt: Date;
4088
4089
  token: string;
4089
4090
  invitedBy: number;
4090
- expiresAt: Date;
4091
4091
  acceptedAt: Date | null;
4092
4092
  cancelledAt: Date | null;
4093
4093
  }>;
@@ -4112,16 +4112,16 @@ declare class InvitationsRepository extends BaseRepository {
4112
4112
  * 초대 삭제
4113
4113
  */
4114
4114
  deleteById(id: number): Promise<{
4115
+ status: "pending" | "accepted" | "expired" | "cancelled";
4115
4116
  email: string;
4116
4117
  id: number;
4117
- roleId: number;
4118
4118
  createdAt: Date;
4119
4119
  updatedAt: Date;
4120
- status: "pending" | "accepted" | "expired" | "cancelled";
4120
+ roleId: number;
4121
4121
  metadata: Record<string, any> | null;
4122
+ expiresAt: Date;
4122
4123
  token: string;
4123
4124
  invitedBy: number;
4124
- expiresAt: Date;
4125
4125
  acceptedAt: Date | null;
4126
4126
  cancelledAt: Date | null;
4127
4127
  }>;
@@ -4786,16 +4786,16 @@ declare function getOptionalAuth(c: Context | {
4786
4786
  declare function getUser(c: Context | {
4787
4787
  raw: Context;
4788
4788
  }): {
4789
+ username: string | null;
4790
+ status: "active" | "inactive" | "suspended";
4789
4791
  email: string | null;
4790
4792
  phone: string | null;
4791
4793
  id: number;
4792
- username: string | null;
4794
+ createdAt: Date;
4795
+ updatedAt: Date;
4793
4796
  passwordHash: string | null;
4794
4797
  passwordChangeRequired: boolean;
4795
4798
  roleId: number;
4796
- createdAt: Date;
4797
- updatedAt: Date;
4798
- status: "active" | "inactive" | "suspended";
4799
4799
  emailVerifiedAt: Date | null;
4800
4800
  phoneVerifiedAt: Date | null;
4801
4801
  lastLoginAt: Date | null;
@@ -0,0 +1,3 @@
1
+ ALTER TABLE "spfn_auth"."users" ADD COLUMN "username" text;--> statement-breakpoint
2
+ CREATE INDEX "users_username_idx" ON "spfn_auth"."users" USING btree ("username");--> statement-breakpoint
3
+ ALTER TABLE "spfn_auth"."users" ADD CONSTRAINT "users_username_unique" UNIQUE("username");