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

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-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';
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';
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-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';
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';
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: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
1308
+ category: "custom" | "user" | "auth" | "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: "auth" | "custom" | "user" | "rbac" | "system";
2447
+ data: "custom" | "user" | "auth" | "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";
2945
2947
  email: string | null;
2946
2948
  phone: string | null;
2947
2949
  id: number;
2948
- username: string | null;
2950
+ createdAt: Date;
2951
+ updatedAt: Date;
2949
2952
  passwordHash: string | null;
2950
2953
  passwordChangeRequired: boolean;
2951
2954
  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";
3021
3023
  email: string | null;
3022
3024
  phone: string | null;
3023
3025
  id: number;
3024
- username: string | null;
3026
+ createdAt: Date;
3027
+ updatedAt: Date;
3025
3028
  passwordHash: string | null;
3026
3029
  passwordChangeRequired: boolean;
3027
3030
  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: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
3053
+ category: "custom" | "user" | "auth" | "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
- publicKey: string;
3166
- keyId: string;
3167
- fingerprint: string;
3168
- algorithm: "ES256" | "RS256";
3169
3165
  userId: number;
3166
+ keyId: string;
3170
3167
  id: number;
3171
3168
  isActive: boolean;
3172
3169
  createdAt: Date;
3173
- expiresAt: Date | null;
3170
+ publicKey: string;
3171
+ algorithm: "ES256" | "RS256";
3172
+ fingerprint: string;
3174
3173
  lastUsedAt: Date | null;
3174
+ expiresAt: 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
- publicKey: string;
3202
- keyId: string;
3203
- fingerprint: string;
3204
- algorithm: "ES256" | "RS256";
3205
3201
  userId: number;
3202
+ keyId: string;
3206
3203
  id: number;
3207
3204
  isActive: boolean;
3208
3205
  createdAt: Date;
3209
- expiresAt: Date | null;
3206
+ publicKey: string;
3207
+ algorithm: "ES256" | "RS256";
3208
+ fingerprint: string;
3210
3209
  lastUsedAt: Date | null;
3210
+ expiresAt: 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;
3329
3325
  id: number;
3330
3326
  createdAt: Date;
3331
3327
  updatedAt: Date;
3332
3328
  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: "auth" | "custom" | "user" | "rbac" | "system" | null;
3521
+ category: "custom" | "user" | "auth" | "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: "auth" | "custom" | "user" | "rbac" | "system" | null;
3537
+ category: "custom" | "user" | "auth" | "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: "auth" | "custom" | "user" | "rbac" | "system" | null;
3577
+ category: "custom" | "user" | "auth" | "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;
3597
3596
  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;
3643
3642
  createdAt: Date;
3644
3643
  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;
3661
3660
  createdAt: Date;
3662
3661
  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
- permissionId: number;
3728
3727
  expiresAt: Date | null;
3729
- reason: string | null;
3728
+ permissionId: number;
3730
3729
  granted: boolean;
3730
+ reason: string | null;
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
- permissionId: number;
3754
3753
  expiresAt: Date | null;
3755
- reason: string | null;
3754
+ permissionId: number;
3756
3755
  granted: boolean;
3756
+ reason: string | null;
3757
3757
  }>;
3758
3758
  /**
3759
3759
  * 사용자의 모든 권한 오버라이드 삭제
@@ -3836,7 +3836,6 @@ declare class UserProfilesRepository extends BaseRepository {
3836
3836
  displayName: string;
3837
3837
  createdAt: Date;
3838
3838
  updatedAt: Date;
3839
- metadata: Record<string, any> | null;
3840
3839
  firstName: string | null;
3841
3840
  lastName: string | null;
3842
3841
  avatarUrl: string | null;
@@ -3849,6 +3848,7 @@ declare class UserProfilesRepository extends BaseRepository {
3849
3848
  location: string | null;
3850
3849
  company: string | null;
3851
3850
  jobTitle: string | null;
3851
+ metadata: Record<string, any> | null;
3852
3852
  }>;
3853
3853
  /**
3854
3854
  * 프로필 업데이트 (by ID)
@@ -3905,7 +3905,6 @@ declare class UserProfilesRepository extends BaseRepository {
3905
3905
  displayName: string;
3906
3906
  createdAt: Date;
3907
3907
  updatedAt: Date;
3908
- metadata: Record<string, any> | null;
3909
3908
  firstName: string | null;
3910
3909
  lastName: string | null;
3911
3910
  avatarUrl: string | null;
@@ -3918,6 +3917,7 @@ declare class UserProfilesRepository extends BaseRepository {
3918
3917
  location: string | null;
3919
3918
  company: string | null;
3920
3919
  jobTitle: string | null;
3920
+ metadata: Record<string, any> | null;
3921
3921
  }>;
3922
3922
  /**
3923
3923
  * 프로필 삭제 (by User ID)
@@ -3928,7 +3928,6 @@ declare class UserProfilesRepository extends BaseRepository {
3928
3928
  displayName: string;
3929
3929
  createdAt: Date;
3930
3930
  updatedAt: Date;
3931
- metadata: Record<string, any> | null;
3932
3931
  firstName: string | null;
3933
3932
  lastName: string | null;
3934
3933
  avatarUrl: string | null;
@@ -3941,6 +3940,7 @@ declare class UserProfilesRepository extends BaseRepository {
3941
3940
  location: string | null;
3942
3941
  company: string | null;
3943
3942
  jobTitle: string | null;
3943
+ metadata: Record<string, any> | null;
3944
3944
  }>;
3945
3945
  /**
3946
3946
  * 프로필 Upsert (by User ID)
@@ -3954,7 +3954,6 @@ declare class UserProfilesRepository extends BaseRepository {
3954
3954
  displayName: string;
3955
3955
  createdAt: Date;
3956
3956
  updatedAt: Date;
3957
- metadata: Record<string, any> | null;
3958
3957
  firstName: string | null;
3959
3958
  lastName: string | null;
3960
3959
  avatarUrl: string | null;
@@ -3967,6 +3966,7 @@ declare class UserProfilesRepository extends BaseRepository {
3967
3966
  location: string | null;
3968
3967
  company: string | null;
3969
3968
  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";
4096
4097
  email: string;
4097
4098
  id: number;
4098
- roleId: number;
4099
4099
  createdAt: Date;
4100
4100
  updatedAt: Date;
4101
- status: "pending" | "accepted" | "expired" | "cancelled";
4101
+ roleId: number;
4102
4102
  metadata: Record<string, any> | null;
4103
+ expiresAt: Date;
4103
4104
  token: string;
4104
4105
  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";
4130
4131
  email: string;
4131
4132
  id: number;
4132
- roleId: number;
4133
4133
  createdAt: Date;
4134
4134
  updatedAt: Date;
4135
- status: "pending" | "accepted" | "expired" | "cancelled";
4135
+ roleId: number;
4136
4136
  metadata: Record<string, any> | null;
4137
+ expiresAt: Date;
4137
4138
  token: string;
4138
4139
  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";
4804
4806
  email: string | null;
4805
4807
  phone: string | null;
4806
4808
  id: number;
4807
- username: string | null;
4809
+ createdAt: Date;
4810
+ updatedAt: Date;
4808
4811
  passwordHash: string | null;
4809
4812
  passwordChangeRequired: boolean;
4810
4813
  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.36",
3
+ "version": "0.2.0-beta.37",
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/notification": "0.1.0-beta.11",
89
- "@spfn/core": "0.2.0-beta.27"
88
+ "@spfn/core": "0.2.0-beta.29",
89
+ "@spfn/notification": "0.1.0-beta.12"
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.26"
106
+ "spfn": "0.2.0-beta.27"
107
107
  },
108
108
  "peerDependencies": {
109
109
  "next": "^15.0.0 || ^16.0.0"