@spfn/auth 0.2.0-beta.13 → 0.2.0-beta.14

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.
@@ -540,7 +540,7 @@ declare const mainAuthRouter: _spfn_core_route.Router<{
540
540
  id: number;
541
541
  name: string;
542
542
  displayName: string;
543
- category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
543
+ category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
544
544
  }[];
545
545
  userId: number;
546
546
  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-Cz2FjLdB.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-Cz2FjLdB.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-CriFdelv.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-CriFdelv.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;
@@ -0,0 +1,28 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ interface OAuthCallbackProps {
4
+ /**
5
+ * API base path for RPC calls
6
+ * @default '/api/rpc'
7
+ */
8
+ apiBasePath?: string;
9
+ /**
10
+ * Custom loading component
11
+ */
12
+ loadingComponent?: React.ReactNode;
13
+ /**
14
+ * Custom error component
15
+ */
16
+ errorComponent?: (error: string) => React.ReactNode;
17
+ /**
18
+ * Callback after successful OAuth
19
+ */
20
+ onSuccess?: (userId: string) => void;
21
+ /**
22
+ * Callback on error
23
+ */
24
+ onError?: (error: string) => void;
25
+ }
26
+ declare function OAuthCallback({ apiBasePath, loadingComponent, errorComponent, onSuccess, onError, }: OAuthCallbackProps): react_jsx_runtime.JSX.Element | null;
27
+
28
+ export { OAuthCallback, type OAuthCallbackProps };
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-Cz2FjLdB.js';
2
- export { B as ChangePasswordParams, w as CheckAccountExistsParams, C as CheckAccountExistsResult, a5 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, a7 as PasswordSchema, a6 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, a8 as TargetTypeSchema, d as USER_STATUSES, o as UserStatus, h as VERIFICATION_PURPOSES, g as VERIFICATION_TARGET_TYPES, a9 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, J as registerPublicKeyService, s as registerService, N as revokeKeyService, M as rotateKeyService, D as sendVerificationCodeService, E as verifyCodeService } from './authenticate-Cz2FjLdB.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-CriFdelv.js';
2
+ export { B as ChangePasswordParams, w as CheckAccountExistsParams, C as CheckAccountExistsResult, a5 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, a7 as PasswordSchema, a6 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, a8 as TargetTypeSchema, d as USER_STATUSES, o as UserStatus, h as VERIFICATION_PURPOSES, g as VERIFICATION_TARGET_TYPES, a9 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, J as registerPublicKeyService, s as registerService, N as revokeKeyService, M as rotateKeyService, D as sendVerificationCodeService, E as verifyCodeService } from './authenticate-CriFdelv.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';
@@ -1255,7 +1255,7 @@ declare function getAuthSessionService(userId: string | number | bigint): Promis
1255
1255
  id: number;
1256
1256
  name: string;
1257
1257
  displayName: string;
1258
- category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
1258
+ category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
1259
1259
  }[];
1260
1260
  userId: number;
1261
1261
  email: string | null;
@@ -2384,7 +2384,7 @@ declare const permissions: drizzle_orm_pg_core.PgTableWithColumns<{
2384
2384
  tableName: "permissions";
2385
2385
  dataType: "string";
2386
2386
  columnType: "PgText";
2387
- data: "auth" | "custom" | "user" | "rbac" | "system";
2387
+ data: "custom" | "user" | "auth" | "rbac" | "system";
2388
2388
  driverParam: string;
2389
2389
  notNull: false;
2390
2390
  hasDefault: false;
@@ -2833,13 +2833,13 @@ declare class UsersRepository extends BaseRepository {
2833
2833
  create(data: NewUser): Promise<{
2834
2834
  email: string | null;
2835
2835
  phone: string | null;
2836
+ status: "active" | "inactive" | "suspended";
2836
2837
  id: number;
2838
+ createdAt: Date;
2839
+ updatedAt: Date;
2837
2840
  passwordHash: string | null;
2838
2841
  passwordChangeRequired: boolean;
2839
2842
  roleId: number;
2840
- createdAt: Date;
2841
- updatedAt: Date;
2842
- status: "active" | "inactive" | "suspended";
2843
2843
  emailVerifiedAt: Date | null;
2844
2844
  phoneVerifiedAt: Date | null;
2845
2845
  lastLoginAt: Date | null;
@@ -2905,13 +2905,13 @@ declare class UsersRepository extends BaseRepository {
2905
2905
  deleteById(id: number): Promise<{
2906
2906
  email: string | null;
2907
2907
  phone: string | null;
2908
+ status: "active" | "inactive" | "suspended";
2908
2909
  id: number;
2910
+ createdAt: Date;
2911
+ updatedAt: Date;
2909
2912
  passwordHash: string | null;
2910
2913
  passwordChangeRequired: boolean;
2911
2914
  roleId: number;
2912
- createdAt: Date;
2913
- updatedAt: Date;
2914
- status: "active" | "inactive" | "suspended";
2915
2915
  emailVerifiedAt: Date | null;
2916
2916
  phoneVerifiedAt: Date | null;
2917
2917
  lastLoginAt: Date | null;
@@ -2934,7 +2934,7 @@ declare class UsersRepository extends BaseRepository {
2934
2934
  id: number;
2935
2935
  name: string;
2936
2936
  displayName: string;
2937
- category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
2937
+ category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
2938
2938
  }[];
2939
2939
  }>;
2940
2940
  /**
@@ -3044,16 +3044,16 @@ declare class KeysRepository extends BaseRepository {
3044
3044
  * Write primary 사용
3045
3045
  */
3046
3046
  create(data: NewUserPublicKey): Promise<{
3047
- publicKey: string;
3048
- keyId: string;
3049
- fingerprint: string;
3050
- algorithm: "ES256" | "RS256";
3051
3047
  userId: number;
3048
+ keyId: string;
3052
3049
  id: number;
3053
3050
  isActive: boolean;
3054
3051
  createdAt: Date;
3055
- expiresAt: Date | null;
3052
+ publicKey: string;
3053
+ algorithm: "ES256" | "RS256";
3054
+ fingerprint: string;
3056
3055
  lastUsedAt: Date | null;
3056
+ expiresAt: Date | null;
3057
3057
  revokedAt: Date | null;
3058
3058
  revokedReason: string | null;
3059
3059
  }>;
@@ -3080,16 +3080,16 @@ declare class KeysRepository extends BaseRepository {
3080
3080
  * Write primary 사용
3081
3081
  */
3082
3082
  deleteByKeyIdAndUserId(keyId: string, userId: number): Promise<{
3083
- publicKey: string;
3084
- keyId: string;
3085
- fingerprint: string;
3086
- algorithm: "ES256" | "RS256";
3087
3083
  userId: number;
3084
+ keyId: string;
3088
3085
  id: number;
3089
3086
  isActive: boolean;
3090
3087
  createdAt: Date;
3091
- expiresAt: Date | null;
3088
+ publicKey: string;
3089
+ algorithm: "ES256" | "RS256";
3090
+ fingerprint: string;
3092
3091
  lastUsedAt: Date | null;
3092
+ expiresAt: Date | null;
3093
3093
  revokedAt: Date | null;
3094
3094
  revokedReason: string | null;
3095
3095
  }>;
@@ -3204,14 +3204,14 @@ declare class VerificationCodesRepository extends BaseRepository {
3204
3204
  * Write primary 사용
3205
3205
  */
3206
3206
  create(data: NewVerificationCode): Promise<{
3207
- target: string;
3208
- targetType: "email" | "phone";
3209
- purpose: "registration" | "login" | "password_reset" | "email_change" | "phone_change";
3210
- code: string;
3211
3207
  id: number;
3212
3208
  createdAt: Date;
3213
3209
  updatedAt: Date;
3214
3210
  expiresAt: Date;
3211
+ target: string;
3212
+ targetType: "email" | "phone";
3213
+ code: string;
3214
+ purpose: "registration" | "login" | "password_reset" | "email_change" | "phone_change";
3215
3215
  usedAt: Date | null;
3216
3216
  attempts: number;
3217
3217
  }>;
@@ -3400,7 +3400,7 @@ declare class PermissionsRepository extends BaseRepository {
3400
3400
  name: string;
3401
3401
  displayName: string;
3402
3402
  description: string | null;
3403
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3403
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3404
3404
  isBuiltin: boolean;
3405
3405
  isSystem: boolean;
3406
3406
  isActive: boolean;
@@ -3416,7 +3416,7 @@ declare class PermissionsRepository extends BaseRepository {
3416
3416
  name: string;
3417
3417
  displayName: string;
3418
3418
  description: string | null;
3419
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3419
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3420
3420
  isBuiltin: boolean;
3421
3421
  isSystem: boolean;
3422
3422
  isActive: boolean;
@@ -3456,7 +3456,7 @@ declare class PermissionsRepository extends BaseRepository {
3456
3456
  name: string;
3457
3457
  displayName: string;
3458
3458
  description: string | null;
3459
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3459
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3460
3460
  isBuiltin: boolean;
3461
3461
  isSystem: boolean;
3462
3462
  isActive: boolean;
@@ -3475,8 +3475,8 @@ declare class PermissionsRepository extends BaseRepository {
3475
3475
  isActive: boolean;
3476
3476
  createdAt: Date;
3477
3477
  updatedAt: Date;
3478
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3479
3478
  metadata: Record<string, any> | null;
3479
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3480
3480
  }>;
3481
3481
  }
3482
3482
  declare const permissionsRepository: PermissionsRepository;
@@ -3521,9 +3521,9 @@ declare class RolePermissionsRepository extends BaseRepository {
3521
3521
  */
3522
3522
  createMany(data: NewRolePermission[]): Promise<{
3523
3523
  id: number;
3524
- roleId: number;
3525
3524
  createdAt: Date;
3526
3525
  updatedAt: Date;
3526
+ roleId: number;
3527
3527
  permissionId: number;
3528
3528
  }[]>;
3529
3529
  /**
@@ -3539,9 +3539,9 @@ declare class RolePermissionsRepository extends BaseRepository {
3539
3539
  */
3540
3540
  setPermissionsForRole(roleId: number, permissionIds: number[]): Promise<{
3541
3541
  id: number;
3542
- roleId: number;
3543
3542
  createdAt: Date;
3544
3543
  updatedAt: Date;
3544
+ roleId: number;
3545
3545
  permissionId: number;
3546
3546
  }[]>;
3547
3547
  }
@@ -3606,10 +3606,10 @@ declare class UserPermissionsRepository extends BaseRepository {
3606
3606
  id: number;
3607
3607
  createdAt: Date;
3608
3608
  updatedAt: Date;
3609
- permissionId: number;
3610
3609
  expiresAt: Date | null;
3611
- reason: string | null;
3610
+ permissionId: number;
3612
3611
  granted: boolean;
3612
+ reason: string | null;
3613
3613
  }>;
3614
3614
  /**
3615
3615
  * 사용자 권한 오버라이드 업데이트
@@ -3632,10 +3632,10 @@ declare class UserPermissionsRepository extends BaseRepository {
3632
3632
  id: number;
3633
3633
  createdAt: Date;
3634
3634
  updatedAt: Date;
3635
- permissionId: number;
3636
3635
  expiresAt: Date | null;
3637
- reason: string | null;
3636
+ permissionId: number;
3638
3637
  granted: boolean;
3638
+ reason: string | null;
3639
3639
  }>;
3640
3640
  /**
3641
3641
  * 사용자의 모든 권한 오버라이드 삭제
@@ -3714,7 +3714,6 @@ declare class UserProfilesRepository extends BaseRepository {
3714
3714
  displayName: string;
3715
3715
  createdAt: Date;
3716
3716
  updatedAt: Date;
3717
- metadata: Record<string, any> | null;
3718
3717
  firstName: string | null;
3719
3718
  lastName: string | null;
3720
3719
  avatarUrl: string | null;
@@ -3727,6 +3726,7 @@ declare class UserProfilesRepository extends BaseRepository {
3727
3726
  location: string | null;
3728
3727
  company: string | null;
3729
3728
  jobTitle: string | null;
3729
+ metadata: Record<string, any> | null;
3730
3730
  }>;
3731
3731
  /**
3732
3732
  * 프로필 업데이트 (by ID)
@@ -3783,7 +3783,6 @@ declare class UserProfilesRepository extends BaseRepository {
3783
3783
  displayName: string;
3784
3784
  createdAt: Date;
3785
3785
  updatedAt: Date;
3786
- metadata: Record<string, any> | null;
3787
3786
  firstName: string | null;
3788
3787
  lastName: string | null;
3789
3788
  avatarUrl: string | null;
@@ -3796,6 +3795,7 @@ declare class UserProfilesRepository extends BaseRepository {
3796
3795
  location: string | null;
3797
3796
  company: string | null;
3798
3797
  jobTitle: string | null;
3798
+ metadata: Record<string, any> | null;
3799
3799
  }>;
3800
3800
  /**
3801
3801
  * 프로필 삭제 (by User ID)
@@ -3806,7 +3806,6 @@ declare class UserProfilesRepository extends BaseRepository {
3806
3806
  displayName: string;
3807
3807
  createdAt: Date;
3808
3808
  updatedAt: Date;
3809
- metadata: Record<string, any> | null;
3810
3809
  firstName: string | null;
3811
3810
  lastName: string | null;
3812
3811
  avatarUrl: string | null;
@@ -3819,6 +3818,7 @@ declare class UserProfilesRepository extends BaseRepository {
3819
3818
  location: string | null;
3820
3819
  company: string | null;
3821
3820
  jobTitle: string | null;
3821
+ metadata: Record<string, any> | null;
3822
3822
  }>;
3823
3823
  /**
3824
3824
  * 프로필 Upsert (by User ID)
@@ -3832,7 +3832,6 @@ declare class UserProfilesRepository extends BaseRepository {
3832
3832
  displayName: string;
3833
3833
  createdAt: Date;
3834
3834
  updatedAt: Date;
3835
- metadata: Record<string, any> | null;
3836
3835
  firstName: string | null;
3837
3836
  lastName: string | null;
3838
3837
  avatarUrl: string | null;
@@ -3845,6 +3844,7 @@ declare class UserProfilesRepository extends BaseRepository {
3845
3844
  location: string | null;
3846
3845
  company: string | null;
3847
3846
  jobTitle: string | null;
3847
+ metadata: Record<string, any> | null;
3848
3848
  }>;
3849
3849
  /**
3850
3850
  * User ID로 프로필 데이터 조회 (formatted)
@@ -3972,15 +3972,15 @@ declare class InvitationsRepository extends BaseRepository {
3972
3972
  */
3973
3973
  create(data: NewInvitation): Promise<{
3974
3974
  email: string;
3975
+ status: "pending" | "accepted" | "expired" | "cancelled";
3975
3976
  id: number;
3976
- roleId: number;
3977
3977
  createdAt: Date;
3978
3978
  updatedAt: Date;
3979
- status: "pending" | "accepted" | "expired" | "cancelled";
3979
+ roleId: number;
3980
3980
  metadata: Record<string, any> | null;
3981
+ expiresAt: Date;
3981
3982
  token: string;
3982
3983
  invitedBy: number;
3983
- expiresAt: Date;
3984
3984
  acceptedAt: Date | null;
3985
3985
  cancelledAt: Date | null;
3986
3986
  }>;
@@ -4006,15 +4006,15 @@ declare class InvitationsRepository extends BaseRepository {
4006
4006
  */
4007
4007
  deleteById(id: number): Promise<{
4008
4008
  email: string;
4009
+ status: "pending" | "accepted" | "expired" | "cancelled";
4009
4010
  id: number;
4010
- roleId: number;
4011
4011
  createdAt: Date;
4012
4012
  updatedAt: Date;
4013
- status: "pending" | "accepted" | "expired" | "cancelled";
4013
+ roleId: number;
4014
4014
  metadata: Record<string, any> | null;
4015
+ expiresAt: Date;
4015
4016
  token: string;
4016
4017
  invitedBy: number;
4017
- expiresAt: Date;
4018
4018
  acceptedAt: Date | null;
4019
4019
  cancelledAt: Date | null;
4020
4020
  }>;
@@ -4655,13 +4655,13 @@ declare function getUser(c: Context | {
4655
4655
  }): {
4656
4656
  email: string | null;
4657
4657
  phone: string | null;
4658
+ status: "active" | "inactive" | "suspended";
4658
4659
  id: number;
4660
+ createdAt: Date;
4661
+ updatedAt: Date;
4659
4662
  passwordHash: string | null;
4660
4663
  passwordChangeRequired: boolean;
4661
4664
  roleId: number;
4662
- createdAt: Date;
4663
- updatedAt: Date;
4664
- status: "active" | "inactive" | "suspended";
4665
4665
  emailVerifiedAt: Date | null;
4666
4666
  phoneVerifiedAt: Date | null;
4667
4667
  lastLoginAt: Date | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spfn/auth",
3
- "version": "0.2.0-beta.13",
3
+ "version": "0.2.0-beta.14",
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.1",
89
- "@spfn/core": "0.2.0-beta.12"
88
+ "@spfn/core": "0.2.0-beta.12",
89
+ "@spfn/notification": "0.1.0-beta.1"
90
90
  },
91
91
  "devDependencies": {
92
92
  "@types/bcryptjs": "^2.4.6",
@@ -114,7 +114,7 @@
114
114
  }
115
115
  },
116
116
  "scripts": {
117
- "build": "pnpm check:circular && tsup",
117
+ "build": "pnpm check:circular && tsup && tsup --config tsup.client.config.ts",
118
118
  "watch": "tsup --watch",
119
119
  "dev": "tsup --watch",
120
120
  "type-check": "tsc --noEmit",