@spfn/auth 0.2.0-beta.40 → 0.2.0-beta.42

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.
package/README.md CHANGED
@@ -1092,6 +1092,8 @@ Update authenticated user's username. Validates uniqueness before updating.
1092
1092
  |-------|-------------|---------|
1093
1093
  | `auth.login` | 로그인 성공 | 이메일/전화 로그인, OAuth 기존 사용자 |
1094
1094
  | `auth.register` | 회원가입 성공 | 이메일/전화 회원가입, OAuth 신규 사용자 |
1095
+ | `auth.invitation.created` | 초대 생성/재발송 | createInvitation, resendInvitation |
1096
+ | `auth.invitation.accepted` | 초대 수락 | acceptInvitation |
1095
1097
 
1096
1098
  ---
1097
1099
 
@@ -1123,6 +1125,34 @@ Update authenticated user's username. Validates uniqueness before updating.
1123
1125
  `metadata`는 클라이언트가 register/OAuth 요청 body에 포함한 값이 그대로 전달됩니다.
1124
1126
  레퍼럴 코드, UTM 파라미터 등 앱 고유 데이터를 이벤트 구독자에게 전달할 때 사용합니다.
1125
1127
 
1128
+ #### `auth.invitation.created`
1129
+
1130
+ ```typescript
1131
+ {
1132
+ invitationId: string;
1133
+ email: string;
1134
+ token: string;
1135
+ roleId: number;
1136
+ invitedBy: string;
1137
+ expiresAt: string; // ISO 8601
1138
+ isResend: boolean; // true면 재발송
1139
+ metadata?: Record<string, unknown>;
1140
+ }
1141
+ ```
1142
+
1143
+ #### `auth.invitation.accepted`
1144
+
1145
+ ```typescript
1146
+ {
1147
+ invitationId: string;
1148
+ email: string;
1149
+ userId: string; // 생성된 사용자 ID
1150
+ roleId: number;
1151
+ invitedBy: string;
1152
+ metadata?: Record<string, unknown>;
1153
+ }
1154
+ ```
1155
+
1126
1156
  ---
1127
1157
 
1128
1158
  ### Subscribing to Events
@@ -1165,6 +1195,51 @@ authApi.oauthStart.call({
1165
1195
  });
1166
1196
  ```
1167
1197
 
1198
+ #### 초대 이벤트 구독 (이메일 발송 연동)
1199
+
1200
+ ```typescript
1201
+ import { invitationCreatedEvent, invitationAcceptedEvent } from '@spfn/auth/server';
1202
+
1203
+ // 초대 생성 시 이메일 발송
1204
+ invitationCreatedEvent.subscribe(async (payload) => {
1205
+ const inviteUrl = `${APP_URL}/invite/${payload.token}`;
1206
+
1207
+ await notificationService.send({
1208
+ channel: 'email',
1209
+ to: payload.email,
1210
+ subject: payload.isResend ? '초대가 재발송되었습니다' : '초대장이 도착했습니다',
1211
+ html: renderInviteEmail({
1212
+ inviteUrl,
1213
+ inviterName: payload.metadata?.inviterName,
1214
+ message: payload.metadata?.message,
1215
+ }),
1216
+ tracking: {
1217
+ category: 'invitation',
1218
+ metadata: { invitationId: payload.invitationId },
1219
+ },
1220
+ });
1221
+ });
1222
+
1223
+ // 초대 수락 시 온보딩 처리
1224
+ invitationAcceptedEvent.subscribe(async (payload) => {
1225
+ await onboardingService.start(payload.userId);
1226
+ });
1227
+ ```
1228
+
1229
+ 초대 생성 시 커스텀 만료 시간 지정:
1230
+
1231
+ ```typescript
1232
+ // expiresAt이 expiresInDays보다 우선
1233
+ authApi.createInvitation.call({
1234
+ body: {
1235
+ email: 'user@example.com',
1236
+ roleId: 2,
1237
+ expiresAt: '2026-03-20T00:00:00Z',
1238
+ metadata: { inviterName: '홍길동', message: '함께 일해요!' },
1239
+ }
1240
+ });
1241
+ ```
1242
+
1168
1243
  ---
1169
1244
 
1170
1245
  ### Job Integration
@@ -545,7 +545,7 @@ declare const mainAuthRouter: _spfn_core_route.Router<{
545
545
  id: number;
546
546
  name: string;
547
547
  displayName: string;
548
- category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
548
+ category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
549
549
  }[];
550
550
  userId: number;
551
551
  email: string | null;
@@ -633,6 +633,7 @@ declare const mainAuthRouter: _spfn_core_route.Router<{
633
633
  email: _sinclair_typebox.TString;
634
634
  roleId: _sinclair_typebox.TNumber;
635
635
  expiresInDays: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
636
+ expiresAt: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
636
637
  metadata: _sinclair_typebox.TOptional<_sinclair_typebox.TAny>;
637
638
  }>;
638
639
  }, {}, {
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-BbugF32w.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-BbugF32w.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-gnTzrnU-.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-gnTzrnU-.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';
@@ -169,7 +169,7 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
169
169
  id: number;
170
170
  name: string;
171
171
  displayName: string;
172
- category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
172
+ category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
173
173
  }[];
174
174
  userId: number;
175
175
  email: string | null;
@@ -257,6 +257,7 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
257
257
  email: _sinclair_typebox.TString;
258
258
  roleId: _sinclair_typebox.TNumber;
259
259
  expiresInDays: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
260
+ expiresAt: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
260
261
  metadata: _sinclair_typebox.TOptional<_sinclair_typebox.TAny>;
261
262
  }>;
262
263
  }, {}, {
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-BbugF32w.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-BbugF32w.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-gnTzrnU-.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-gnTzrnU-.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';
@@ -1082,6 +1082,7 @@ declare function createInvitation(params: {
1082
1082
  roleId: number;
1083
1083
  invitedBy: number;
1084
1084
  expiresInDays?: number;
1085
+ expiresAt?: Date;
1085
1086
  metadata?: Record<string, any>;
1086
1087
  }): Promise<Invitation>;
1087
1088
  /**
@@ -1305,7 +1306,7 @@ declare function getAuthSessionService(userId: string | number | bigint): Promis
1305
1306
  id: number;
1306
1307
  name: string;
1307
1308
  displayName: string;
1308
- category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
1309
+ category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
1309
1310
  }[];
1310
1311
  userId: number;
1311
1312
  email: string | null;
@@ -2444,7 +2445,7 @@ declare const permissions: drizzle_orm_pg_core.PgTableWithColumns<{
2444
2445
  tableName: "permissions";
2445
2446
  dataType: "string";
2446
2447
  columnType: "PgText";
2447
- data: "auth" | "custom" | "user" | "rbac" | "system";
2448
+ data: "custom" | "user" | "auth" | "rbac" | "system";
2448
2449
  driverParam: string;
2449
2450
  notNull: false;
2450
2451
  hasDefault: false;
@@ -2942,16 +2943,16 @@ declare class UsersRepository extends BaseRepository {
2942
2943
  * Write primary 사용
2943
2944
  */
2944
2945
  create(data: NewUser): Promise<{
2946
+ username: string | null;
2947
+ status: "active" | "inactive" | "suspended";
2945
2948
  email: string | null;
2946
2949
  phone: string | null;
2947
2950
  id: number;
2948
- username: string | null;
2951
+ createdAt: Date;
2952
+ updatedAt: Date;
2949
2953
  passwordHash: string | null;
2950
2954
  passwordChangeRequired: boolean;
2951
2955
  roleId: number;
2952
- createdAt: Date;
2953
- updatedAt: Date;
2954
- status: "active" | "inactive" | "suspended";
2955
2956
  emailVerifiedAt: Date | null;
2956
2957
  phoneVerifiedAt: Date | null;
2957
2958
  lastLoginAt: Date | null;
@@ -3018,16 +3019,16 @@ declare class UsersRepository extends BaseRepository {
3018
3019
  * Write primary 사용
3019
3020
  */
3020
3021
  deleteById(id: number): Promise<{
3022
+ username: string | null;
3023
+ status: "active" | "inactive" | "suspended";
3021
3024
  email: string | null;
3022
3025
  phone: string | null;
3023
3026
  id: number;
3024
- username: string | null;
3027
+ createdAt: Date;
3028
+ updatedAt: Date;
3025
3029
  passwordHash: string | null;
3026
3030
  passwordChangeRequired: boolean;
3027
3031
  roleId: number;
3028
- createdAt: Date;
3029
- updatedAt: Date;
3030
- status: "active" | "inactive" | "suspended";
3031
3032
  emailVerifiedAt: Date | null;
3032
3033
  phoneVerifiedAt: Date | null;
3033
3034
  lastLoginAt: Date | null;
@@ -3050,7 +3051,7 @@ declare class UsersRepository extends BaseRepository {
3050
3051
  id: number;
3051
3052
  name: string;
3052
3053
  displayName: string;
3053
- category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
3054
+ category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
3054
3055
  }[];
3055
3056
  }>;
3056
3057
  /**
@@ -3162,16 +3163,16 @@ declare class KeysRepository extends BaseRepository {
3162
3163
  * Write primary 사용
3163
3164
  */
3164
3165
  create(data: NewUserPublicKey): Promise<{
3165
- publicKey: string;
3166
- keyId: string;
3167
- fingerprint: string;
3168
- algorithm: "ES256" | "RS256";
3169
3166
  userId: number;
3167
+ keyId: string;
3170
3168
  id: number;
3171
3169
  isActive: boolean;
3172
3170
  createdAt: Date;
3173
- expiresAt: Date | null;
3171
+ publicKey: string;
3172
+ algorithm: "ES256" | "RS256";
3173
+ fingerprint: string;
3174
3174
  lastUsedAt: Date | null;
3175
+ expiresAt: Date | null;
3175
3176
  revokedAt: Date | null;
3176
3177
  revokedReason: string | null;
3177
3178
  }>;
@@ -3198,16 +3199,16 @@ declare class KeysRepository extends BaseRepository {
3198
3199
  * Write primary 사용
3199
3200
  */
3200
3201
  deleteByKeyIdAndUserId(keyId: string, userId: number): Promise<{
3201
- publicKey: string;
3202
- keyId: string;
3203
- fingerprint: string;
3204
- algorithm: "ES256" | "RS256";
3205
3202
  userId: number;
3203
+ keyId: string;
3206
3204
  id: number;
3207
3205
  isActive: boolean;
3208
3206
  createdAt: Date;
3209
- expiresAt: Date | null;
3207
+ publicKey: string;
3208
+ algorithm: "ES256" | "RS256";
3209
+ fingerprint: string;
3210
3210
  lastUsedAt: Date | null;
3211
+ expiresAt: Date | null;
3211
3212
  revokedAt: Date | null;
3212
3213
  revokedReason: string | null;
3213
3214
  }>;
@@ -3322,14 +3323,14 @@ declare class VerificationCodesRepository extends BaseRepository {
3322
3323
  * Write primary 사용
3323
3324
  */
3324
3325
  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
3326
  id: number;
3330
3327
  createdAt: Date;
3331
3328
  updatedAt: Date;
3332
3329
  expiresAt: Date;
3330
+ target: string;
3331
+ targetType: "email" | "phone";
3332
+ code: string;
3333
+ purpose: "registration" | "login" | "password_reset" | "email_change" | "phone_change";
3333
3334
  usedAt: Date | null;
3334
3335
  attempts: number;
3335
3336
  }>;
@@ -3518,7 +3519,7 @@ declare class PermissionsRepository extends BaseRepository {
3518
3519
  name: string;
3519
3520
  displayName: string;
3520
3521
  description: string | null;
3521
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3522
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3522
3523
  isBuiltin: boolean;
3523
3524
  isSystem: boolean;
3524
3525
  isActive: boolean;
@@ -3534,7 +3535,7 @@ declare class PermissionsRepository extends BaseRepository {
3534
3535
  name: string;
3535
3536
  displayName: string;
3536
3537
  description: string | null;
3537
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3538
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3538
3539
  isBuiltin: boolean;
3539
3540
  isSystem: boolean;
3540
3541
  isActive: boolean;
@@ -3574,7 +3575,7 @@ declare class PermissionsRepository extends BaseRepository {
3574
3575
  name: string;
3575
3576
  displayName: string;
3576
3577
  description: string | null;
3577
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3578
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3578
3579
  isBuiltin: boolean;
3579
3580
  isSystem: boolean;
3580
3581
  isActive: boolean;
@@ -3585,7 +3586,6 @@ declare class PermissionsRepository extends BaseRepository {
3585
3586
  */
3586
3587
  deleteById(id: number): Promise<{
3587
3588
  description: string | null;
3588
- metadata: Record<string, any> | null;
3589
3589
  id: number;
3590
3590
  name: string;
3591
3591
  displayName: string;
@@ -3594,7 +3594,8 @@ declare class PermissionsRepository extends BaseRepository {
3594
3594
  isActive: boolean;
3595
3595
  createdAt: Date;
3596
3596
  updatedAt: Date;
3597
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
3597
+ metadata: Record<string, any> | null;
3598
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
3598
3599
  }>;
3599
3600
  }
3600
3601
  declare const permissionsRepository: PermissionsRepository;
@@ -3639,9 +3640,9 @@ declare class RolePermissionsRepository extends BaseRepository {
3639
3640
  */
3640
3641
  createMany(data: NewRolePermission[]): Promise<{
3641
3642
  id: number;
3642
- roleId: number;
3643
3643
  createdAt: Date;
3644
3644
  updatedAt: Date;
3645
+ roleId: number;
3645
3646
  permissionId: number;
3646
3647
  }[]>;
3647
3648
  /**
@@ -3657,9 +3658,9 @@ declare class RolePermissionsRepository extends BaseRepository {
3657
3658
  */
3658
3659
  setPermissionsForRole(roleId: number, permissionIds: number[]): Promise<{
3659
3660
  id: number;
3660
- roleId: number;
3661
3661
  createdAt: Date;
3662
3662
  updatedAt: Date;
3663
+ roleId: number;
3663
3664
  permissionId: number;
3664
3665
  }[]>;
3665
3666
  }
@@ -3724,10 +3725,10 @@ declare class UserPermissionsRepository extends BaseRepository {
3724
3725
  id: number;
3725
3726
  createdAt: Date;
3726
3727
  updatedAt: Date;
3727
- permissionId: number;
3728
3728
  expiresAt: Date | null;
3729
- reason: string | null;
3729
+ permissionId: number;
3730
3730
  granted: boolean;
3731
+ reason: string | null;
3731
3732
  }>;
3732
3733
  /**
3733
3734
  * 사용자 권한 오버라이드 업데이트
@@ -3750,10 +3751,10 @@ declare class UserPermissionsRepository extends BaseRepository {
3750
3751
  id: number;
3751
3752
  createdAt: Date;
3752
3753
  updatedAt: Date;
3753
- permissionId: number;
3754
3754
  expiresAt: Date | null;
3755
- reason: string | null;
3755
+ permissionId: number;
3756
3756
  granted: boolean;
3757
+ reason: string | null;
3757
3758
  }>;
3758
3759
  /**
3759
3760
  * 사용자의 모든 권한 오버라이드 삭제
@@ -3831,7 +3832,6 @@ declare class UserProfilesRepository extends BaseRepository {
3831
3832
  * 프로필 생성
3832
3833
  */
3833
3834
  create(data: NewUserProfile): Promise<{
3834
- metadata: Record<string, any> | null;
3835
3835
  userId: number;
3836
3836
  id: number;
3837
3837
  displayName: string;
@@ -3849,6 +3849,7 @@ declare class UserProfilesRepository extends BaseRepository {
3849
3849
  location: string | null;
3850
3850
  company: string | null;
3851
3851
  jobTitle: string | null;
3852
+ metadata: Record<string, any> | null;
3852
3853
  }>;
3853
3854
  /**
3854
3855
  * 프로필 업데이트 (by ID)
@@ -3900,7 +3901,6 @@ declare class UserProfilesRepository extends BaseRepository {
3900
3901
  * 프로필 삭제 (by ID)
3901
3902
  */
3902
3903
  deleteById(id: number): Promise<{
3903
- metadata: Record<string, any> | null;
3904
3904
  userId: number;
3905
3905
  id: number;
3906
3906
  displayName: string;
@@ -3918,12 +3918,12 @@ declare class UserProfilesRepository extends BaseRepository {
3918
3918
  location: string | null;
3919
3919
  company: string | null;
3920
3920
  jobTitle: string | null;
3921
+ metadata: Record<string, any> | null;
3921
3922
  }>;
3922
3923
  /**
3923
3924
  * 프로필 삭제 (by User ID)
3924
3925
  */
3925
3926
  deleteByUserId(userId: number): Promise<{
3926
- metadata: Record<string, any> | null;
3927
3927
  userId: number;
3928
3928
  id: number;
3929
3929
  displayName: string;
@@ -3941,6 +3941,7 @@ declare class UserProfilesRepository extends BaseRepository {
3941
3941
  location: string | null;
3942
3942
  company: string | null;
3943
3943
  jobTitle: string | null;
3944
+ metadata: Record<string, any> | null;
3944
3945
  }>;
3945
3946
  /**
3946
3947
  * 프로필 Upsert (by User ID)
@@ -3949,7 +3950,6 @@ declare class UserProfilesRepository extends BaseRepository {
3949
3950
  * 새로 생성 시 displayName은 필수 (없으면 'User'로 설정)
3950
3951
  */
3951
3952
  upsertByUserId(userId: number, data: Partial<Omit<NewUserProfile, 'userId'>>): Promise<{
3952
- metadata: Record<string, any> | null;
3953
3953
  userId: number;
3954
3954
  id: number;
3955
3955
  displayName: string;
@@ -3967,6 +3967,7 @@ declare class UserProfilesRepository extends BaseRepository {
3967
3967
  location: string | null;
3968
3968
  company: string | null;
3969
3969
  jobTitle: string | null;
3970
+ metadata: Record<string, any> | null;
3970
3971
  }>;
3971
3972
  /**
3972
3973
  * User ID로 프로필 데이터 조회 (formatted)
@@ -4093,16 +4094,16 @@ declare class InvitationsRepository extends BaseRepository {
4093
4094
  * 초대 생성
4094
4095
  */
4095
4096
  create(data: NewInvitation): Promise<{
4097
+ status: "pending" | "accepted" | "expired" | "cancelled";
4096
4098
  email: string;
4097
- metadata: Record<string, any> | null;
4098
4099
  id: number;
4099
- roleId: number;
4100
4100
  createdAt: Date;
4101
4101
  updatedAt: Date;
4102
- status: "pending" | "accepted" | "expired" | "cancelled";
4102
+ roleId: number;
4103
+ metadata: Record<string, any> | null;
4104
+ expiresAt: Date;
4103
4105
  token: string;
4104
4106
  invitedBy: number;
4105
- expiresAt: Date;
4106
4107
  acceptedAt: Date | null;
4107
4108
  cancelledAt: Date | null;
4108
4109
  }>;
@@ -4127,16 +4128,16 @@ declare class InvitationsRepository extends BaseRepository {
4127
4128
  * 초대 삭제
4128
4129
  */
4129
4130
  deleteById(id: number): Promise<{
4131
+ status: "pending" | "accepted" | "expired" | "cancelled";
4130
4132
  email: string;
4131
- metadata: Record<string, any> | null;
4132
4133
  id: number;
4133
- roleId: number;
4134
4134
  createdAt: Date;
4135
4135
  updatedAt: Date;
4136
- status: "pending" | "accepted" | "expired" | "cancelled";
4136
+ roleId: number;
4137
+ metadata: Record<string, any> | null;
4138
+ expiresAt: Date;
4137
4139
  token: string;
4138
4140
  invitedBy: number;
4139
- expiresAt: Date;
4140
4141
  acceptedAt: Date | null;
4141
4142
  cancelledAt: Date | null;
4142
4143
  }>;
@@ -4801,16 +4802,16 @@ declare function getOptionalAuth(c: Context | {
4801
4802
  declare function getUser(c: Context | {
4802
4803
  raw: Context;
4803
4804
  }): {
4805
+ username: string | null;
4806
+ status: "active" | "inactive" | "suspended";
4804
4807
  email: string | null;
4805
4808
  phone: string | null;
4806
4809
  id: number;
4807
- username: string | null;
4810
+ createdAt: Date;
4811
+ updatedAt: Date;
4808
4812
  passwordHash: string | null;
4809
4813
  passwordChangeRequired: boolean;
4810
4814
  roleId: number;
4811
- createdAt: Date;
4812
- updatedAt: Date;
4813
- status: "active" | "inactive" | "suspended";
4814
4815
  emailVerifiedAt: Date | null;
4815
4816
  phoneVerifiedAt: Date | null;
4816
4817
  lastLoginAt: Date | null;
@@ -5314,10 +5315,67 @@ declare const authRegisterEvent: _spfn_core_event.EventDef<{
5314
5315
  userId: string;
5315
5316
  provider: "email" | "phone" | "google";
5316
5317
  }>;
5318
+ /**
5319
+ * auth.invitation.created - 초대 생성 이벤트
5320
+ *
5321
+ * 발행 시점:
5322
+ * - createInvitation() 성공 시
5323
+ * - resendInvitation() 성공 시
5324
+ *
5325
+ * @example
5326
+ * ```typescript
5327
+ * invitationCreatedEvent.subscribe(async (payload) => {
5328
+ * const inviteUrl = `${APP_URL}/invite/${payload.token}`;
5329
+ * await notificationService.send({
5330
+ * channel: 'email',
5331
+ * to: payload.email,
5332
+ * subject: 'You are invited!',
5333
+ * html: renderInviteEmail({ inviteUrl, ...payload.metadata }),
5334
+ * });
5335
+ * });
5336
+ * ```
5337
+ */
5338
+ declare const invitationCreatedEvent: _spfn_core_event.EventDef<{
5339
+ metadata?: {
5340
+ [x: string]: unknown;
5341
+ } | undefined;
5342
+ email: string;
5343
+ roleId: number;
5344
+ expiresAt: string;
5345
+ token: string;
5346
+ invitedBy: string;
5347
+ invitationId: string;
5348
+ isResend: boolean;
5349
+ }>;
5350
+ /**
5351
+ * auth.invitation.accepted - 초대 수락 이벤트
5352
+ *
5353
+ * 발행 시점:
5354
+ * - acceptInvitation() 성공 시
5355
+ *
5356
+ * @example
5357
+ * ```typescript
5358
+ * invitationAcceptedEvent.subscribe(async (payload) => {
5359
+ * await onboardingService.start(payload.userId);
5360
+ * });
5361
+ * ```
5362
+ */
5363
+ declare const invitationAcceptedEvent: _spfn_core_event.EventDef<{
5364
+ metadata?: {
5365
+ [x: string]: unknown;
5366
+ } | undefined;
5367
+ email: string;
5368
+ userId: string;
5369
+ roleId: number;
5370
+ invitedBy: string;
5371
+ invitationId: string;
5372
+ }>;
5317
5373
  /**
5318
5374
  * Auth event payload types
5319
5375
  */
5320
5376
  type AuthLoginPayload = typeof authLoginEvent._payload;
5321
5377
  type AuthRegisterPayload = typeof authRegisterEvent._payload;
5378
+ type InvitationCreatedPayload = typeof invitationCreatedEvent._payload;
5379
+ type InvitationAcceptedPayload = typeof invitationAcceptedEvent._payload;
5322
5380
 
5323
- export { type AuthConfig, AuthContext, type AuthLoginPayload, AuthProviderSchema, type AuthRegisterPayload, COOKIE_NAMES, type CreateOAuthStateParams, type GoogleTokenResponse, type GoogleUserInfo, type Invitation, InvitationStatus, InvitationsRepository, KeyAlgorithmType, type KeyPair, KeysRepository, type NewInvitation, type NewPermission, type NewPermissionEntity, type NewRole, type NewRoleEntity, type NewRolePermission, type NewUser, type NewUserPermission, type NewUserProfile, type NewUserPublicKey, type NewUserSocialAccount, type NewVerificationCode, type OAuthState, type Permission, type PermissionEntity, PermissionsRepository, type Role, type RoleEntity, type RoleGuardOptions, type RolePermission, RolePermissionsRepository, RolesRepository, type SessionData, type SessionPayload, SocialAccountsRepository, SocialProvider, type TokenPayload, type UpdateProfileParams, type User, type UserPermission, UserPermissionsRepository, type UserProfile, UserProfilesRepository, type UserPublicKey, type UserSocialAccount, UsersRepository, type VerificationCode, VerificationCodesRepository, VerificationPurpose, acceptInvitation, addPermissionToRole, authLogger, authLoginEvent, authRegisterEvent, authSchema, cancelInvitation, checkUsernameAvailableService, configureAuth, createAuthLifecycle, createInvitation, createOAuthState, createRole, decodeToken, deleteInvitation, deleteRole, exchangeCodeForTokens, expireOldInvitations, generateClientToken, generateKeyPair, generateKeyPairES256, generateKeyPairRS256, generateToken, getAllRoles, getAuth, getAuthConfig, getAuthSessionService, getGoogleAuthUrl, getGoogleOAuthConfig, getGoogleUserInfo, getInvitationByToken, getInvitationWithDetails, getKeyId, getKeySize, getLocale, getOptionalAuth, getRole, getRoleByName, getRolePermissions, getSessionInfo, getSessionTtl, getUser, getUserByEmailService, getUserByIdService, getUserByPhoneService, getUserId, getUserPermissions, getUserProfileService, getUserRole, hasAllPermissions, hasAnyPermission, hasAnyRole, hasPermission, hasRole, hashPassword, initializeAuth, invitationsRepository, isGoogleOAuthEnabled, keysRepository, listInvitations, parseDuration, permissions, permissionsRepository, refreshAccessToken, removePermissionFromRole, requireAnyPermission, requirePermissions, requireRole, resendInvitation, roleGuard, rolePermissions, rolePermissionsRepository, roles, rolesRepository, sealSession, setRolePermissions, shouldRefreshSession, shouldRotateKey, socialAccountsRepository, unsealSession, updateLastLoginService, updateLocaleService, updateRole, updateUserProfileService, updateUserService, updateUsernameService, userInvitations, userPermissions, userPermissionsRepository, userProfiles, userProfilesRepository, userPublicKeys, userSocialAccounts, users, usersRepository, validateInvitation, validatePasswordStrength, verificationCodes, verificationCodesRepository, verifyClientToken, verifyKeyFingerprint, verifyOAuthState, verifyPassword, verifyToken };
5381
+ export { type AuthConfig, AuthContext, type AuthLoginPayload, AuthProviderSchema, type AuthRegisterPayload, COOKIE_NAMES, type CreateOAuthStateParams, type GoogleTokenResponse, type GoogleUserInfo, type Invitation, type InvitationAcceptedPayload, type InvitationCreatedPayload, InvitationStatus, InvitationsRepository, KeyAlgorithmType, type KeyPair, KeysRepository, type NewInvitation, type NewPermission, type NewPermissionEntity, type NewRole, type NewRoleEntity, type NewRolePermission, type NewUser, type NewUserPermission, type NewUserProfile, type NewUserPublicKey, type NewUserSocialAccount, type NewVerificationCode, type OAuthState, type Permission, type PermissionEntity, PermissionsRepository, type Role, type RoleEntity, type RoleGuardOptions, type RolePermission, RolePermissionsRepository, RolesRepository, type SessionData, type SessionPayload, SocialAccountsRepository, SocialProvider, type TokenPayload, type UpdateProfileParams, type User, type UserPermission, UserPermissionsRepository, type UserProfile, UserProfilesRepository, type UserPublicKey, type UserSocialAccount, UsersRepository, type VerificationCode, VerificationCodesRepository, VerificationPurpose, acceptInvitation, addPermissionToRole, authLogger, authLoginEvent, authRegisterEvent, authSchema, cancelInvitation, checkUsernameAvailableService, configureAuth, createAuthLifecycle, createInvitation, createOAuthState, createRole, decodeToken, deleteInvitation, deleteRole, exchangeCodeForTokens, expireOldInvitations, generateClientToken, generateKeyPair, generateKeyPairES256, generateKeyPairRS256, generateToken, getAllRoles, getAuth, getAuthConfig, getAuthSessionService, getGoogleAuthUrl, getGoogleOAuthConfig, getGoogleUserInfo, getInvitationByToken, getInvitationWithDetails, getKeyId, getKeySize, getLocale, getOptionalAuth, getRole, getRoleByName, getRolePermissions, getSessionInfo, getSessionTtl, getUser, getUserByEmailService, getUserByIdService, getUserByPhoneService, getUserId, getUserPermissions, getUserProfileService, getUserRole, hasAllPermissions, hasAnyPermission, hasAnyRole, hasPermission, hasRole, hashPassword, initializeAuth, invitationAcceptedEvent, invitationCreatedEvent, invitationsRepository, isGoogleOAuthEnabled, keysRepository, listInvitations, parseDuration, permissions, permissionsRepository, refreshAccessToken, removePermissionFromRole, requireAnyPermission, requirePermissions, requireRole, resendInvitation, roleGuard, rolePermissions, rolePermissionsRepository, roles, rolesRepository, sealSession, setRolePermissions, shouldRefreshSession, shouldRotateKey, socialAccountsRepository, unsealSession, updateLastLoginService, updateLocaleService, updateRole, updateUserProfileService, updateUserService, updateUsernameService, userInvitations, userPermissions, userPermissionsRepository, userProfiles, userProfilesRepository, userPublicKeys, userSocialAccounts, users, usersRepository, validateInvitation, validatePasswordStrength, verificationCodes, verificationCodesRepository, verifyClientToken, verifyKeyFingerprint, verifyOAuthState, verifyPassword, verifyToken };