@spfn/auth 0.2.0-beta.37 → 0.2.0-beta.39

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: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
545
+ category: "auth" | "custom" | "user" | "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-CTWlv76a.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-CTWlv76a.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-vcXIhj1J.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-vcXIhj1J.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: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
171
+ category: "auth" | "custom" | "user" | "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-CTWlv76a.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-CTWlv76a.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-vcXIhj1J.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-vcXIhj1J.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';
@@ -1305,7 +1305,7 @@ declare function getAuthSessionService(userId: string | number | bigint): Promis
1305
1305
  id: number;
1306
1306
  name: string;
1307
1307
  displayName: string;
1308
- category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
1308
+ category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
1309
1309
  }[];
1310
1310
  userId: number;
1311
1311
  email: string | null;
@@ -2444,7 +2444,7 @@ declare const permissions: drizzle_orm_pg_core.PgTableWithColumns<{
2444
2444
  tableName: "permissions";
2445
2445
  dataType: "string";
2446
2446
  columnType: "PgText";
2447
- data: "custom" | "user" | "auth" | "rbac" | "system";
2447
+ data: "auth" | "custom" | "user" | "rbac" | "system";
2448
2448
  driverParam: string;
2449
2449
  notNull: false;
2450
2450
  hasDefault: false;
@@ -2942,16 +2942,16 @@ declare class UsersRepository extends BaseRepository {
2942
2942
  * Write primary 사용
2943
2943
  */
2944
2944
  create(data: NewUser): Promise<{
2945
- username: string | null;
2946
- status: "active" | "inactive" | "suspended";
2947
2945
  email: string | null;
2948
2946
  phone: string | null;
2949
2947
  id: number;
2950
- createdAt: Date;
2951
- updatedAt: Date;
2948
+ username: string | null;
2952
2949
  passwordHash: string | null;
2953
2950
  passwordChangeRequired: boolean;
2954
2951
  roleId: number;
2952
+ createdAt: Date;
2953
+ updatedAt: Date;
2954
+ status: "active" | "inactive" | "suspended";
2955
2955
  emailVerifiedAt: Date | null;
2956
2956
  phoneVerifiedAt: Date | null;
2957
2957
  lastLoginAt: Date | null;
@@ -3018,16 +3018,16 @@ declare class UsersRepository extends BaseRepository {
3018
3018
  * Write primary 사용
3019
3019
  */
3020
3020
  deleteById(id: number): Promise<{
3021
- username: string | null;
3022
- status: "active" | "inactive" | "suspended";
3023
3021
  email: string | null;
3024
3022
  phone: string | null;
3025
3023
  id: number;
3026
- createdAt: Date;
3027
- updatedAt: Date;
3024
+ username: string | null;
3028
3025
  passwordHash: string | null;
3029
3026
  passwordChangeRequired: boolean;
3030
3027
  roleId: number;
3028
+ createdAt: Date;
3029
+ updatedAt: Date;
3030
+ status: "active" | "inactive" | "suspended";
3031
3031
  emailVerifiedAt: Date | null;
3032
3032
  phoneVerifiedAt: Date | null;
3033
3033
  lastLoginAt: Date | null;
@@ -3050,7 +3050,7 @@ declare class UsersRepository extends BaseRepository {
3050
3050
  id: number;
3051
3051
  name: string;
3052
3052
  displayName: string;
3053
- category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
3053
+ category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
3054
3054
  }[];
3055
3055
  }>;
3056
3056
  /**
@@ -3162,16 +3162,16 @@ declare class KeysRepository extends BaseRepository {
3162
3162
  * Write primary 사용
3163
3163
  */
3164
3164
  create(data: NewUserPublicKey): Promise<{
3165
- userId: number;
3165
+ publicKey: string;
3166
3166
  keyId: string;
3167
+ fingerprint: string;
3168
+ algorithm: "ES256" | "RS256";
3169
+ userId: number;
3167
3170
  id: number;
3168
3171
  isActive: boolean;
3169
3172
  createdAt: Date;
3170
- publicKey: string;
3171
- algorithm: "ES256" | "RS256";
3172
- fingerprint: string;
3173
- lastUsedAt: Date | null;
3174
3173
  expiresAt: Date | null;
3174
+ lastUsedAt: Date | null;
3175
3175
  revokedAt: Date | null;
3176
3176
  revokedReason: string | null;
3177
3177
  }>;
@@ -3198,16 +3198,16 @@ declare class KeysRepository extends BaseRepository {
3198
3198
  * Write primary 사용
3199
3199
  */
3200
3200
  deleteByKeyIdAndUserId(keyId: string, userId: number): Promise<{
3201
- userId: number;
3201
+ publicKey: string;
3202
3202
  keyId: string;
3203
+ fingerprint: string;
3204
+ algorithm: "ES256" | "RS256";
3205
+ userId: number;
3203
3206
  id: number;
3204
3207
  isActive: boolean;
3205
3208
  createdAt: Date;
3206
- publicKey: string;
3207
- algorithm: "ES256" | "RS256";
3208
- fingerprint: string;
3209
- lastUsedAt: Date | null;
3210
3209
  expiresAt: Date | null;
3210
+ lastUsedAt: Date | null;
3211
3211
  revokedAt: Date | null;
3212
3212
  revokedReason: string | null;
3213
3213
  }>;
@@ -3322,14 +3322,14 @@ declare class VerificationCodesRepository extends BaseRepository {
3322
3322
  * Write primary 사용
3323
3323
  */
3324
3324
  create(data: NewVerificationCode): Promise<{
3325
+ target: string;
3326
+ targetType: "email" | "phone";
3327
+ purpose: "registration" | "login" | "password_reset" | "email_change" | "phone_change";
3328
+ code: string;
3325
3329
  id: number;
3326
3330
  createdAt: Date;
3327
3331
  updatedAt: Date;
3328
3332
  expiresAt: Date;
3329
- target: string;
3330
- targetType: "email" | "phone";
3331
- code: string;
3332
- purpose: "registration" | "login" | "password_reset" | "email_change" | "phone_change";
3333
3333
  usedAt: Date | null;
3334
3334
  attempts: number;
3335
3335
  }>;
@@ -3518,7 +3518,7 @@ declare class PermissionsRepository extends BaseRepository {
3518
3518
  name: string;
3519
3519
  displayName: string;
3520
3520
  description: string | null;
3521
- category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3521
+ category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3522
3522
  isBuiltin: boolean;
3523
3523
  isSystem: boolean;
3524
3524
  isActive: boolean;
@@ -3534,7 +3534,7 @@ declare class PermissionsRepository extends BaseRepository {
3534
3534
  name: string;
3535
3535
  displayName: string;
3536
3536
  description: string | null;
3537
- category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3537
+ category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3538
3538
  isBuiltin: boolean;
3539
3539
  isSystem: boolean;
3540
3540
  isActive: boolean;
@@ -3574,7 +3574,7 @@ declare class PermissionsRepository extends BaseRepository {
3574
3574
  name: string;
3575
3575
  displayName: string;
3576
3576
  description: string | null;
3577
- category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3577
+ category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3578
3578
  isBuiltin: boolean;
3579
3579
  isSystem: boolean;
3580
3580
  isActive: boolean;
@@ -3593,8 +3593,8 @@ declare class PermissionsRepository extends BaseRepository {
3593
3593
  isActive: boolean;
3594
3594
  createdAt: Date;
3595
3595
  updatedAt: Date;
3596
+ category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3596
3597
  metadata: Record<string, any> | null;
3597
- category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3598
3598
  }>;
3599
3599
  }
3600
3600
  declare const permissionsRepository: PermissionsRepository;
@@ -3639,9 +3639,9 @@ declare class RolePermissionsRepository extends BaseRepository {
3639
3639
  */
3640
3640
  createMany(data: NewRolePermission[]): Promise<{
3641
3641
  id: number;
3642
+ roleId: number;
3642
3643
  createdAt: Date;
3643
3644
  updatedAt: Date;
3644
- roleId: number;
3645
3645
  permissionId: number;
3646
3646
  }[]>;
3647
3647
  /**
@@ -3657,9 +3657,9 @@ declare class RolePermissionsRepository extends BaseRepository {
3657
3657
  */
3658
3658
  setPermissionsForRole(roleId: number, permissionIds: number[]): Promise<{
3659
3659
  id: number;
3660
+ roleId: number;
3660
3661
  createdAt: Date;
3661
3662
  updatedAt: Date;
3662
- roleId: number;
3663
3663
  permissionId: number;
3664
3664
  }[]>;
3665
3665
  }
@@ -3724,10 +3724,10 @@ declare class UserPermissionsRepository extends BaseRepository {
3724
3724
  id: number;
3725
3725
  createdAt: Date;
3726
3726
  updatedAt: Date;
3727
- expiresAt: Date | null;
3728
3727
  permissionId: number;
3729
- granted: boolean;
3728
+ expiresAt: Date | null;
3730
3729
  reason: string | null;
3730
+ granted: boolean;
3731
3731
  }>;
3732
3732
  /**
3733
3733
  * 사용자 권한 오버라이드 업데이트
@@ -3750,10 +3750,10 @@ declare class UserPermissionsRepository extends BaseRepository {
3750
3750
  id: number;
3751
3751
  createdAt: Date;
3752
3752
  updatedAt: Date;
3753
- expiresAt: Date | null;
3754
3753
  permissionId: number;
3755
- granted: boolean;
3754
+ expiresAt: Date | null;
3756
3755
  reason: string | null;
3756
+ granted: boolean;
3757
3757
  }>;
3758
3758
  /**
3759
3759
  * 사용자의 모든 권한 오버라이드 삭제
@@ -3836,6 +3836,7 @@ declare class UserProfilesRepository extends BaseRepository {
3836
3836
  displayName: string;
3837
3837
  createdAt: Date;
3838
3838
  updatedAt: Date;
3839
+ metadata: Record<string, any> | null;
3839
3840
  firstName: string | null;
3840
3841
  lastName: string | null;
3841
3842
  avatarUrl: string | null;
@@ -3848,7 +3849,6 @@ declare class UserProfilesRepository extends BaseRepository {
3848
3849
  location: string | null;
3849
3850
  company: string | null;
3850
3851
  jobTitle: string | null;
3851
- metadata: Record<string, any> | null;
3852
3852
  }>;
3853
3853
  /**
3854
3854
  * 프로필 업데이트 (by ID)
@@ -3905,6 +3905,7 @@ declare class UserProfilesRepository extends BaseRepository {
3905
3905
  displayName: string;
3906
3906
  createdAt: Date;
3907
3907
  updatedAt: Date;
3908
+ metadata: Record<string, any> | null;
3908
3909
  firstName: string | null;
3909
3910
  lastName: string | null;
3910
3911
  avatarUrl: string | null;
@@ -3917,7 +3918,6 @@ declare class UserProfilesRepository extends BaseRepository {
3917
3918
  location: string | null;
3918
3919
  company: string | null;
3919
3920
  jobTitle: string | null;
3920
- metadata: Record<string, any> | null;
3921
3921
  }>;
3922
3922
  /**
3923
3923
  * 프로필 삭제 (by User ID)
@@ -3928,6 +3928,7 @@ declare class UserProfilesRepository extends BaseRepository {
3928
3928
  displayName: string;
3929
3929
  createdAt: Date;
3930
3930
  updatedAt: Date;
3931
+ metadata: Record<string, any> | null;
3931
3932
  firstName: string | null;
3932
3933
  lastName: string | null;
3933
3934
  avatarUrl: string | null;
@@ -3940,7 +3941,6 @@ declare class UserProfilesRepository extends BaseRepository {
3940
3941
  location: string | null;
3941
3942
  company: string | null;
3942
3943
  jobTitle: string | null;
3943
- metadata: Record<string, any> | null;
3944
3944
  }>;
3945
3945
  /**
3946
3946
  * 프로필 Upsert (by User ID)
@@ -3954,6 +3954,7 @@ declare class UserProfilesRepository extends BaseRepository {
3954
3954
  displayName: string;
3955
3955
  createdAt: Date;
3956
3956
  updatedAt: Date;
3957
+ metadata: Record<string, any> | null;
3957
3958
  firstName: string | null;
3958
3959
  lastName: string | null;
3959
3960
  avatarUrl: string | null;
@@ -3966,7 +3967,6 @@ declare class UserProfilesRepository extends BaseRepository {
3966
3967
  location: string | null;
3967
3968
  company: string | null;
3968
3969
  jobTitle: string | null;
3969
- metadata: Record<string, any> | null;
3970
3970
  }>;
3971
3971
  /**
3972
3972
  * User ID로 프로필 데이터 조회 (formatted)
@@ -4093,16 +4093,16 @@ declare class InvitationsRepository extends BaseRepository {
4093
4093
  * 초대 생성
4094
4094
  */
4095
4095
  create(data: NewInvitation): Promise<{
4096
- status: "pending" | "accepted" | "expired" | "cancelled";
4097
4096
  email: string;
4098
4097
  id: number;
4098
+ roleId: number;
4099
4099
  createdAt: Date;
4100
4100
  updatedAt: Date;
4101
- roleId: number;
4101
+ status: "pending" | "accepted" | "expired" | "cancelled";
4102
4102
  metadata: Record<string, any> | null;
4103
- expiresAt: Date;
4104
4103
  token: string;
4105
4104
  invitedBy: number;
4105
+ expiresAt: Date;
4106
4106
  acceptedAt: Date | null;
4107
4107
  cancelledAt: Date | null;
4108
4108
  }>;
@@ -4127,16 +4127,16 @@ declare class InvitationsRepository extends BaseRepository {
4127
4127
  * 초대 삭제
4128
4128
  */
4129
4129
  deleteById(id: number): Promise<{
4130
- status: "pending" | "accepted" | "expired" | "cancelled";
4131
4130
  email: string;
4132
4131
  id: number;
4132
+ roleId: number;
4133
4133
  createdAt: Date;
4134
4134
  updatedAt: Date;
4135
- roleId: number;
4135
+ status: "pending" | "accepted" | "expired" | "cancelled";
4136
4136
  metadata: Record<string, any> | null;
4137
- expiresAt: Date;
4138
4137
  token: string;
4139
4138
  invitedBy: number;
4139
+ expiresAt: Date;
4140
4140
  acceptedAt: Date | null;
4141
4141
  cancelledAt: Date | null;
4142
4142
  }>;
@@ -4801,16 +4801,16 @@ declare function getOptionalAuth(c: Context | {
4801
4801
  declare function getUser(c: Context | {
4802
4802
  raw: Context;
4803
4803
  }): {
4804
- username: string | null;
4805
- status: "active" | "inactive" | "suspended";
4806
4804
  email: string | null;
4807
4805
  phone: string | null;
4808
4806
  id: number;
4809
- createdAt: Date;
4810
- updatedAt: Date;
4807
+ username: string | null;
4811
4808
  passwordHash: string | null;
4812
4809
  passwordChangeRequired: boolean;
4813
4810
  roleId: number;
4811
+ createdAt: Date;
4812
+ updatedAt: Date;
4813
+ status: "active" | "inactive" | "suspended";
4814
4814
  emailVerifiedAt: Date | null;
4815
4815
  phoneVerifiedAt: Date | null;
4816
4816
  lastLoginAt: Date | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spfn/auth",
3
- "version": "0.2.0-beta.37",
3
+ "version": "0.2.0-beta.39",
4
4
  "type": "module",
5
5
  "description": "Authentication, authorization, and RBAC module for SPFN",
6
6
  "main": "./dist/index.js",
@@ -85,8 +85,8 @@
85
85
  "jose": "^6.1.0",
86
86
  "jsonwebtoken": "^9.0.2",
87
87
  "postgres": "^3.4.0",
88
- "@spfn/core": "0.2.0-beta.29",
89
- "@spfn/notification": "0.1.0-beta.12"
88
+ "@spfn/core": "0.2.0-beta.31",
89
+ "@spfn/notification": "0.1.0-beta.14"
90
90
  },
91
91
  "devDependencies": {
92
92
  "@types/bcryptjs": "^2.4.6",
@@ -103,7 +103,7 @@
103
103
  "tsx": "^4.20.6",
104
104
  "typescript": "^5.3.3",
105
105
  "vitest": "^4.0.6",
106
- "spfn": "0.2.0-beta.27"
106
+ "spfn": "0.2.0-beta.29"
107
107
  },
108
108
  "peerDependencies": {
109
109
  "next": "^15.0.0 || ^16.0.0"