@spfn/auth 0.2.0-beta.8 → 0.2.0-beta.9

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.
@@ -514,7 +514,7 @@ declare const mainAuthRouter: _spfn_core_route.Router<{
514
514
  id: number;
515
515
  name: string;
516
516
  displayName: string;
517
- category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
517
+ category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
518
518
  }[];
519
519
  userId: number;
520
520
  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, U as UserProfile, a as ProfileInfo, C as CheckAccountExistsResult, S as SendVerificationCodeResult, b as RegisterResult, L as LoginResult, c as RotateKeyResult, m as mainAuthRouter } from './dto-lZmWuObc.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 './dto-lZmWuObc.js';
2
+ import { R as RoleConfig, P as PermissionConfig, U as UserProfile, a as ProfileInfo, C as CheckAccountExistsResult, S as SendVerificationCodeResult, b as RegisterResult, L as LoginResult, c as RotateKeyResult, m as mainAuthRouter } from './dto-CRlgoCP5.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 './dto-CRlgoCP5.js';
4
4
  import * as _spfn_core_route from '@spfn/core/route';
5
5
  import * as _sinclair_typebox from '@sinclair/typebox';
6
6
  import '@spfn/auth/server';
@@ -274,7 +274,7 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
274
274
  id: number;
275
275
  name: string;
276
276
  displayName: string;
277
- category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
277
+ category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
278
278
  }[];
279
279
  userId: number;
280
280
  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, q as AuthContext } from './dto-lZmWuObc.js';
2
- export { B as ChangePasswordParams, w as CheckAccountExistsParams, C as CheckAccountExistsResult, X as EmailSchema, I as INVITATION_STATUSES, K as KEY_ALGORITHM, y as LoginParams, L as LoginResult, z as LogoutParams, Z as PasswordSchema, Y as PhoneSchema, x as RegisterParams, O as RegisterPublicKeyParams, b as RegisterResult, T as RevokeKeyParams, Q as RotateKeyParams, c as RotateKeyResult, e as SOCIAL_PROVIDERS, F as SendVerificationCodeParams, S as SendVerificationCodeResult, p as SocialProvider, _ as TargetTypeSchema, d as USER_STATUSES, o as UserStatus, h as VERIFICATION_PURPOSES, g as VERIFICATION_TARGET_TYPES, $ as VerificationPurposeSchema, V as VerificationTargetType, G as VerifyCodeParams, H as VerifyCodeResult, m as authRouter, W as authenticate, v as changePasswordService, r as checkAccountExistsService, t as loginService, u as logoutService, J as registerPublicKeyService, s as registerService, N as revokeKeyService, M as rotateKeyService, D as sendVerificationCodeService, E as verifyCodeService } from './dto-lZmWuObc.js';
1
+ import { k as AuthInitOptions, l as KeyAlgorithmType, n as InvitationStatus, f as VerificationPurpose, j as PermissionCategory, q as AuthContext } from './dto-CRlgoCP5.js';
2
+ export { B as ChangePasswordParams, w as CheckAccountExistsParams, C as CheckAccountExistsResult, X as EmailSchema, I as INVITATION_STATUSES, K as KEY_ALGORITHM, y as LoginParams, L as LoginResult, z as LogoutParams, Z as PasswordSchema, Y as PhoneSchema, x as RegisterParams, O as RegisterPublicKeyParams, b as RegisterResult, T as RevokeKeyParams, Q as RotateKeyParams, c as RotateKeyResult, e as SOCIAL_PROVIDERS, F as SendVerificationCodeParams, S as SendVerificationCodeResult, p as SocialProvider, _ as TargetTypeSchema, d as USER_STATUSES, o as UserStatus, h as VERIFICATION_PURPOSES, g as VERIFICATION_TARGET_TYPES, $ as VerificationPurposeSchema, V as VerificationTargetType, G as VerifyCodeParams, H as VerifyCodeResult, m as authRouter, W as authenticate, v as changePasswordService, r as checkAccountExistsService, t as loginService, u as logoutService, J as registerPublicKeyService, s as registerService, N as revokeKeyService, M as rotateKeyService, D as sendVerificationCodeService, E as verifyCodeService } from './dto-CRlgoCP5.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: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
1258
+ category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
1259
1259
  }[];
1260
1260
  userId: number;
1261
1261
  email: string | null;
@@ -2747,7 +2747,7 @@ declare const permissions: drizzle_orm_pg_core.PgTableWithColumns<{
2747
2747
  tableName: "permissions";
2748
2748
  dataType: "string";
2749
2749
  columnType: "PgText";
2750
- data: "custom" | "user" | "auth" | "rbac" | "system";
2750
+ data: "auth" | "custom" | "user" | "rbac" | "system";
2751
2751
  driverParam: string;
2752
2752
  notNull: false;
2753
2753
  hasDefault: false;
@@ -3196,13 +3196,13 @@ declare class UsersRepository extends BaseRepository {
3196
3196
  create(data: NewUser): Promise<{
3197
3197
  email: string | null;
3198
3198
  phone: string | null;
3199
- status: "active" | "inactive" | "suspended";
3200
3199
  id: number;
3201
- createdAt: Date;
3202
- updatedAt: Date;
3203
3200
  passwordHash: string | null;
3204
3201
  passwordChangeRequired: boolean;
3205
3202
  roleId: number;
3203
+ createdAt: Date;
3204
+ updatedAt: Date;
3205
+ status: "active" | "inactive" | "suspended";
3206
3206
  emailVerifiedAt: Date | null;
3207
3207
  phoneVerifiedAt: Date | null;
3208
3208
  lastLoginAt: Date | null;
@@ -3268,13 +3268,13 @@ declare class UsersRepository extends BaseRepository {
3268
3268
  deleteById(id: number): Promise<{
3269
3269
  email: string | null;
3270
3270
  phone: string | null;
3271
- status: "active" | "inactive" | "suspended";
3272
3271
  id: number;
3273
- createdAt: Date;
3274
- updatedAt: Date;
3275
3272
  passwordHash: string | null;
3276
3273
  passwordChangeRequired: boolean;
3277
3274
  roleId: number;
3275
+ createdAt: Date;
3276
+ updatedAt: Date;
3277
+ status: "active" | "inactive" | "suspended";
3278
3278
  emailVerifiedAt: Date | null;
3279
3279
  phoneVerifiedAt: Date | null;
3280
3280
  lastLoginAt: Date | null;
@@ -3297,7 +3297,7 @@ declare class UsersRepository extends BaseRepository {
3297
3297
  id: number;
3298
3298
  name: string;
3299
3299
  displayName: string;
3300
- category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
3300
+ category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
3301
3301
  }[];
3302
3302
  }>;
3303
3303
  /**
@@ -3407,16 +3407,16 @@ declare class KeysRepository extends BaseRepository {
3407
3407
  * Write primary 사용
3408
3408
  */
3409
3409
  create(data: NewUserPublicKey): Promise<{
3410
- userId: number;
3410
+ publicKey: string;
3411
3411
  keyId: string;
3412
+ fingerprint: string;
3413
+ algorithm: "ES256" | "RS256";
3414
+ userId: number;
3412
3415
  id: number;
3413
3416
  isActive: boolean;
3414
3417
  createdAt: Date;
3415
- publicKey: string;
3416
- algorithm: "ES256" | "RS256";
3417
- fingerprint: string;
3418
- lastUsedAt: Date | null;
3419
3418
  expiresAt: Date | null;
3419
+ lastUsedAt: Date | null;
3420
3420
  revokedAt: Date | null;
3421
3421
  revokedReason: string | null;
3422
3422
  }>;
@@ -3443,16 +3443,16 @@ declare class KeysRepository extends BaseRepository {
3443
3443
  * Write primary 사용
3444
3444
  */
3445
3445
  deleteByKeyIdAndUserId(keyId: string, userId: number): Promise<{
3446
- userId: number;
3446
+ publicKey: string;
3447
3447
  keyId: string;
3448
+ fingerprint: string;
3449
+ algorithm: "ES256" | "RS256";
3450
+ userId: number;
3448
3451
  id: number;
3449
3452
  isActive: boolean;
3450
3453
  createdAt: Date;
3451
- publicKey: string;
3452
- algorithm: "ES256" | "RS256";
3453
- fingerprint: string;
3454
- lastUsedAt: Date | null;
3455
3454
  expiresAt: Date | null;
3455
+ lastUsedAt: Date | null;
3456
3456
  revokedAt: Date | null;
3457
3457
  revokedReason: string | null;
3458
3458
  }>;
@@ -3567,14 +3567,14 @@ declare class VerificationCodesRepository extends BaseRepository {
3567
3567
  * Write primary 사용
3568
3568
  */
3569
3569
  create(data: NewVerificationCode): Promise<{
3570
+ target: string;
3571
+ targetType: "email" | "phone";
3572
+ purpose: "registration" | "login" | "password_reset" | "email_change" | "phone_change";
3573
+ code: string;
3570
3574
  id: number;
3571
3575
  createdAt: Date;
3572
3576
  updatedAt: Date;
3573
3577
  expiresAt: Date;
3574
- target: string;
3575
- targetType: "email" | "phone";
3576
- code: string;
3577
- purpose: "registration" | "login" | "password_reset" | "email_change" | "phone_change";
3578
3578
  usedAt: Date | null;
3579
3579
  attempts: number;
3580
3580
  }>;
@@ -3763,7 +3763,7 @@ declare class PermissionsRepository extends BaseRepository {
3763
3763
  name: string;
3764
3764
  displayName: string;
3765
3765
  description: string | null;
3766
- category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3766
+ category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3767
3767
  isBuiltin: boolean;
3768
3768
  isSystem: boolean;
3769
3769
  isActive: boolean;
@@ -3779,7 +3779,7 @@ declare class PermissionsRepository extends BaseRepository {
3779
3779
  name: string;
3780
3780
  displayName: string;
3781
3781
  description: string | null;
3782
- category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3782
+ category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3783
3783
  isBuiltin: boolean;
3784
3784
  isSystem: boolean;
3785
3785
  isActive: boolean;
@@ -3819,7 +3819,7 @@ declare class PermissionsRepository extends BaseRepository {
3819
3819
  name: string;
3820
3820
  displayName: string;
3821
3821
  description: string | null;
3822
- category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3822
+ category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3823
3823
  isBuiltin: boolean;
3824
3824
  isSystem: boolean;
3825
3825
  isActive: boolean;
@@ -3838,8 +3838,8 @@ declare class PermissionsRepository extends BaseRepository {
3838
3838
  isActive: boolean;
3839
3839
  createdAt: Date;
3840
3840
  updatedAt: Date;
3841
+ category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3841
3842
  metadata: Record<string, any> | null;
3842
- category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3843
3843
  }>;
3844
3844
  }
3845
3845
  declare const permissionsRepository: PermissionsRepository;
@@ -3884,9 +3884,9 @@ declare class RolePermissionsRepository extends BaseRepository {
3884
3884
  */
3885
3885
  createMany(data: NewRolePermission[]): Promise<{
3886
3886
  id: number;
3887
+ roleId: number;
3887
3888
  createdAt: Date;
3888
3889
  updatedAt: Date;
3889
- roleId: number;
3890
3890
  permissionId: number;
3891
3891
  }[]>;
3892
3892
  /**
@@ -3902,9 +3902,9 @@ declare class RolePermissionsRepository extends BaseRepository {
3902
3902
  */
3903
3903
  setPermissionsForRole(roleId: number, permissionIds: number[]): Promise<{
3904
3904
  id: number;
3905
+ roleId: number;
3905
3906
  createdAt: Date;
3906
3907
  updatedAt: Date;
3907
- roleId: number;
3908
3908
  permissionId: number;
3909
3909
  }[]>;
3910
3910
  }
@@ -3969,10 +3969,10 @@ declare class UserPermissionsRepository extends BaseRepository {
3969
3969
  id: number;
3970
3970
  createdAt: Date;
3971
3971
  updatedAt: Date;
3972
- expiresAt: Date | null;
3973
3972
  permissionId: number;
3974
- granted: boolean;
3973
+ expiresAt: Date | null;
3975
3974
  reason: string | null;
3975
+ granted: boolean;
3976
3976
  }>;
3977
3977
  /**
3978
3978
  * 사용자 권한 오버라이드 업데이트
@@ -3995,10 +3995,10 @@ declare class UserPermissionsRepository extends BaseRepository {
3995
3995
  id: number;
3996
3996
  createdAt: Date;
3997
3997
  updatedAt: Date;
3998
- expiresAt: Date | null;
3999
3998
  permissionId: number;
4000
- granted: boolean;
3999
+ expiresAt: Date | null;
4001
4000
  reason: string | null;
4001
+ granted: boolean;
4002
4002
  }>;
4003
4003
  /**
4004
4004
  * 사용자의 모든 권한 오버라이드 삭제
@@ -4077,6 +4077,7 @@ declare class UserProfilesRepository extends BaseRepository {
4077
4077
  displayName: string;
4078
4078
  createdAt: Date;
4079
4079
  updatedAt: Date;
4080
+ metadata: Record<string, any> | null;
4080
4081
  firstName: string | null;
4081
4082
  lastName: string | null;
4082
4083
  avatarUrl: string | null;
@@ -4089,7 +4090,6 @@ declare class UserProfilesRepository extends BaseRepository {
4089
4090
  location: string | null;
4090
4091
  company: string | null;
4091
4092
  jobTitle: string | null;
4092
- metadata: Record<string, any> | null;
4093
4093
  }>;
4094
4094
  /**
4095
4095
  * 프로필 업데이트 (by ID)
@@ -4146,6 +4146,7 @@ declare class UserProfilesRepository extends BaseRepository {
4146
4146
  displayName: string;
4147
4147
  createdAt: Date;
4148
4148
  updatedAt: Date;
4149
+ metadata: Record<string, any> | null;
4149
4150
  firstName: string | null;
4150
4151
  lastName: string | null;
4151
4152
  avatarUrl: string | null;
@@ -4158,7 +4159,6 @@ declare class UserProfilesRepository extends BaseRepository {
4158
4159
  location: string | null;
4159
4160
  company: string | null;
4160
4161
  jobTitle: string | null;
4161
- metadata: Record<string, any> | null;
4162
4162
  }>;
4163
4163
  /**
4164
4164
  * 프로필 삭제 (by User ID)
@@ -4169,6 +4169,7 @@ declare class UserProfilesRepository extends BaseRepository {
4169
4169
  displayName: string;
4170
4170
  createdAt: Date;
4171
4171
  updatedAt: Date;
4172
+ metadata: Record<string, any> | null;
4172
4173
  firstName: string | null;
4173
4174
  lastName: string | null;
4174
4175
  avatarUrl: string | null;
@@ -4181,7 +4182,6 @@ declare class UserProfilesRepository extends BaseRepository {
4181
4182
  location: string | null;
4182
4183
  company: string | null;
4183
4184
  jobTitle: string | null;
4184
- metadata: Record<string, any> | null;
4185
4185
  }>;
4186
4186
  /**
4187
4187
  * 프로필 Upsert (by User ID)
@@ -4195,6 +4195,7 @@ declare class UserProfilesRepository extends BaseRepository {
4195
4195
  displayName: string;
4196
4196
  createdAt: Date;
4197
4197
  updatedAt: Date;
4198
+ metadata: Record<string, any> | null;
4198
4199
  firstName: string | null;
4199
4200
  lastName: string | null;
4200
4201
  avatarUrl: string | null;
@@ -4207,7 +4208,6 @@ declare class UserProfilesRepository extends BaseRepository {
4207
4208
  location: string | null;
4208
4209
  company: string | null;
4209
4210
  jobTitle: string | null;
4210
- metadata: Record<string, any> | null;
4211
4211
  }>;
4212
4212
  /**
4213
4213
  * User ID로 프로필 데이터 조회 (formatted)
@@ -4335,15 +4335,15 @@ declare class InvitationsRepository extends BaseRepository {
4335
4335
  */
4336
4336
  create(data: NewInvitation): Promise<{
4337
4337
  email: string;
4338
- status: "pending" | "accepted" | "expired" | "cancelled";
4339
4338
  id: number;
4339
+ roleId: number;
4340
4340
  createdAt: Date;
4341
4341
  updatedAt: Date;
4342
- roleId: number;
4342
+ status: "pending" | "accepted" | "expired" | "cancelled";
4343
4343
  metadata: Record<string, any> | null;
4344
- expiresAt: Date;
4345
4344
  token: string;
4346
4345
  invitedBy: number;
4346
+ expiresAt: Date;
4347
4347
  acceptedAt: Date | null;
4348
4348
  cancelledAt: Date | null;
4349
4349
  }>;
@@ -4369,15 +4369,15 @@ declare class InvitationsRepository extends BaseRepository {
4369
4369
  */
4370
4370
  deleteById(id: number): Promise<{
4371
4371
  email: string;
4372
- status: "pending" | "accepted" | "expired" | "cancelled";
4373
4372
  id: number;
4373
+ roleId: number;
4374
4374
  createdAt: Date;
4375
4375
  updatedAt: Date;
4376
- roleId: number;
4376
+ status: "pending" | "accepted" | "expired" | "cancelled";
4377
4377
  metadata: Record<string, any> | null;
4378
- expiresAt: Date;
4379
4378
  token: string;
4380
4379
  invitedBy: number;
4380
+ expiresAt: Date;
4381
4381
  acceptedAt: Date | null;
4382
4382
  cancelledAt: Date | null;
4383
4383
  }>;
@@ -4888,13 +4888,13 @@ declare function getUser(c: Context | {
4888
4888
  }): {
4889
4889
  email: string | null;
4890
4890
  phone: string | null;
4891
- status: "active" | "inactive" | "suspended";
4892
4891
  id: number;
4893
- createdAt: Date;
4894
- updatedAt: Date;
4895
4892
  passwordHash: string | null;
4896
4893
  passwordChangeRequired: boolean;
4897
4894
  roleId: number;
4895
+ createdAt: Date;
4896
+ updatedAt: Date;
4897
+ status: "active" | "inactive" | "suspended";
4898
4898
  emailVerifiedAt: Date | null;
4899
4899
  phoneVerifiedAt: Date | null;
4900
4900
  lastLoginAt: Date | null;
package/dist/server.js CHANGED
@@ -6888,12 +6888,18 @@ function createAWSSESProvider() {
6888
6888
  };
6889
6889
  }
6890
6890
  if (!env4.SPFN_AUTH_AWS_SES_ACCESS_KEY_ID) {
6891
+ authLogger.email.warn("AWS SES credentials not configured", {
6892
+ hint: "Set SPFN_AUTH_AWS_SES_ACCESS_KEY_ID environment variable"
6893
+ });
6891
6894
  return {
6892
6895
  success: false,
6893
6896
  error: "AWS SES credentials not configured. Set SPFN_AUTH_AWS_SES_ACCESS_KEY_ID environment variable."
6894
6897
  };
6895
6898
  }
6896
6899
  if (!env4.SPFN_AUTH_AWS_SES_FROM_EMAIL) {
6900
+ authLogger.email.warn("AWS SES sender email not configured", {
6901
+ hint: "Set SPFN_AUTH_AWS_SES_FROM_EMAIL environment variable"
6902
+ });
6897
6903
  return {
6898
6904
  success: false,
6899
6905
  error: "AWS SES sender email not configured. Set SPFN_AUTH_AWS_SES_FROM_EMAIL environment variable."
@@ -6960,6 +6966,9 @@ function createAWSSESProvider() {
6960
6966
  }
6961
6967
  };
6962
6968
  } catch (error) {
6969
+ authLogger.email.debug("@aws-sdk/client-ses not available, AWS SES provider disabled", {
6970
+ error: error instanceof Error ? error.message : String(error)
6971
+ });
6963
6972
  return null;
6964
6973
  }
6965
6974
  }
@@ -6968,6 +6977,8 @@ var awsSESProvider = createAWSSESProvider();
6968
6977
  // src/server/services/email/index.ts
6969
6978
  if (awsSESProvider) {
6970
6979
  registerEmailProvider(awsSESProvider);
6980
+ } else {
6981
+ authLogger.email.warn("No email provider registered, using fallback (dev mode). Emails will NOT be sent. Install @aws-sdk/client-ses to enable AWS SES.");
6971
6982
  }
6972
6983
 
6973
6984
  // src/server/services/email/templates/verification-code.ts